@salla.sa/twilight-theme-engine 1.0.133 → 1.0.135
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-2BD3R4BH.js → AddToCartForm-ODVZPTKN.js} +3 -3
- package/dist/{AddToCartForm-2BD3R4BH.js.map → AddToCartForm-ODVZPTKN.js.map} +1 -1
- package/dist/{BlogAuthorPage-BF5XVPHV.js → BlogAuthorPage-BU23SINI.js} +29 -29
- package/dist/{BlogAuthorPage-BF5XVPHV.js.map → BlogAuthorPage-BU23SINI.js.map} +1 -1
- package/dist/{BlogCategoryPage-BZTNFEM7.js → BlogCategoryPage-ZVITUHP4.js} +29 -29
- package/dist/{BlogCategoryPage-BZTNFEM7.js.map → BlogCategoryPage-ZVITUHP4.js.map} +1 -1
- package/dist/{BlogPage-7HOCNIL5.js → BlogPage-IN3V7FYK.js} +27 -27
- package/dist/{BlogPage-7HOCNIL5.js.map → BlogPage-IN3V7FYK.js.map} +1 -1
- package/dist/{BlogSinglePage-SF575W74.js → BlogSinglePage-UJG7YPYZ.js} +27 -27
- package/dist/{BlogSinglePage-SF575W74.js.map → BlogSinglePage-UJG7YPYZ.js.map} +1 -1
- package/dist/{BlogTagPage-TALXABAF.js → BlogTagPage-XDETNKGR.js} +29 -29
- package/dist/{BlogTagPage-TALXABAF.js.map → BlogTagPage-XDETNKGR.js.map} +1 -1
- package/dist/{BrandsPage-UNHLTVUG.js → BrandsPage-CBU7JFSX.js} +28 -28
- package/dist/{BrandsPage-UNHLTVUG.js.map → BrandsPage-CBU7JFSX.js.map} +1 -1
- package/dist/{Breadcrumb-VFMPAWSR.js → Breadcrumb-EA2XETAM.js} +27 -27
- package/dist/{Breadcrumb-VFMPAWSR.js.map → Breadcrumb-EA2XETAM.js.map} +1 -1
- package/dist/{CartItem-CI2XOVRH.js → CartItem-2TW36QTW.js} +27 -27
- package/dist/{CartItem-CI2XOVRH.js.map → CartItem-2TW36QTW.js.map} +1 -1
- package/dist/{CartSummary-EQOBVLXK.js → CartSummary-TW2CAX57.js} +27 -27
- package/dist/{CartSummary-EQOBVLXK.js.map → CartSummary-TW2CAX57.js.map} +1 -1
- package/dist/{Copyright-3JGEXCQZ.js → Copyright-57XPE75X.js} +3 -3
- package/dist/{Copyright-3JGEXCQZ.js.map → Copyright-57XPE75X.js.map} +1 -1
- package/dist/{CustomerLayout-V5T4OPRY.js → CustomerLayout-A2M7IY34.js} +27 -27
- package/dist/{CustomerLayout-V5T4OPRY.js.map → CustomerLayout-A2M7IY34.js.map} +1 -1
- package/dist/{Footer-QX4EO5Y4.js → Footer-L5BIYCZ2.js} +4 -4
- package/dist/{Footer-QX4EO5Y4.js.map → Footer-L5BIYCZ2.js.map} +1 -1
- package/dist/Header-NLBDW4MR.js +23 -0
- package/dist/{Header-ORMIZKUL.js.map → Header-NLBDW4MR.js.map} +1 -1
- package/dist/{LoyaltyPage-HCLFYNTM.js → LoyaltyPage-BVTDPSP3.js} +27 -27
- package/dist/{LoyaltyPage-HCLFYNTM.js.map → LoyaltyPage-BVTDPSP3.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-V5OWHGR5.js → LoyaltyPointsPage-HZYPCO7C.js} +9 -9
- package/dist/{LoyaltyPointsPage-V5OWHGR5.js.map → LoyaltyPointsPage-HZYPCO7C.js.map} +1 -1
- package/dist/{MainMenu-RX7PU77H.js → MainMenu-3HP3YJDH.js} +8 -8
- package/dist/{MainMenu-RX7PU77H.js.map → MainMenu-3HP3YJDH.js.map} +1 -1
- package/dist/MaintenancePage-U5P43D52.js +7 -0
- package/dist/{MaintenancePage-A7CNHM7B.js.map → MaintenancePage-U5P43D52.js.map} +1 -1
- package/dist/{MasterLayout-CTVC6FPX.js → MasterLayout-KD3GLYYX.js} +27 -27
- package/dist/{MasterLayout-CTVC6FPX.js.map → MasterLayout-KD3GLYYX.js.map} +1 -1
- package/dist/{MobileMenu-EQFL7JGB.js → MobileMenu-3UEQTURY.js} +28 -28
- package/dist/{MobileMenu-EQFL7JGB.js.map → MobileMenu-3UEQTURY.js.map} +1 -1
- package/dist/{NotificationsPage-ZBZNPTZS.js → NotificationsPage-C6LNYZTB.js} +27 -27
- package/dist/{NotificationsPage-ZBZNPTZS.js.map → NotificationsPage-C6LNYZTB.js.map} +1 -1
- package/dist/{OrderSinglePage-LMWLOLW2.js → OrderSinglePage-LXKINOXP.js} +28 -28
- package/dist/{OrderSinglePage-LMWLOLW2.js.map → OrderSinglePage-LXKINOXP.js.map} +1 -1
- package/dist/{OrdersPage-6G7BES7J.js → OrdersPage-VBF3P3JH.js} +27 -27
- package/dist/{OrdersPage-6G7BES7J.js.map → OrdersPage-VBF3P3JH.js.map} +1 -1
- package/dist/{PageSingle-5TPYMYII.js → PageSingle-E7DTNIY7.js} +7 -7
- package/dist/{PageSingle-5TPYMYII.js.map → PageSingle-E7DTNIY7.js.map} +1 -1
- package/dist/{ProductDetails-JHZ2ZJAA.js → ProductDetails-ZQLQWU7S.js} +8 -8
- package/dist/{ProductDetails-JHZ2ZJAA.js.map → ProductDetails-ZQLQWU7S.js.map} +1 -1
- package/dist/{ProfilePage-6JITWBAJ.js → ProfilePage-7LAIDEHS.js} +27 -27
- package/dist/{ProfilePage-6JITWBAJ.js.map → ProfilePage-7LAIDEHS.js.map} +1 -1
- package/dist/{ReviewsPage-PFMEZ27R.js → ReviewsPage-FA3V745S.js} +3 -3
- package/dist/{ReviewsPage-PFMEZ27R.js.map → ReviewsPage-FA3V745S.js.map} +1 -1
- package/dist/{SeoCartWidget-ZU3ZZRQB.js → SeoCartWidget-4456ASOT.js} +27 -27
- package/dist/{SeoCartWidget-ZU3ZZRQB.js.map → SeoCartWidget-4456ASOT.js.map} +1 -1
- package/dist/{SettingsPage-J5AF6ECW.js → SettingsPage-IVOHCXVY.js} +27 -27
- package/dist/{SettingsPage-J5AF6ECW.js.map → SettingsPage-IVOHCXVY.js.map} +1 -1
- package/dist/StoreClosedNotification-DIF6SKBX.js +58 -0
- package/dist/{StoreClosedNotification-3FYHHAIP.js.map → StoreClosedNotification-DIF6SKBX.js.map} +1 -1
- package/dist/{TestimonialsPage-4Y55RF5P.js → TestimonialsPage-JY7MF5NW.js} +7 -7
- package/dist/{TestimonialsPage-4Y55RF5P.js.map → TestimonialsPage-JY7MF5NW.js.map} +1 -1
- package/dist/{ThankYouPage-WETHDHC2.js → ThankYouPage-KNHHBFPZ.js} +27 -27
- package/dist/{ThankYouPage-WETHDHC2.js.map → ThankYouPage-KNHHBFPZ.js.map} +1 -1
- package/dist/{WalletPage-PSTUYDCC.js → WalletPage-HH72DHOC.js} +28 -28
- package/dist/{WalletPage-PSTUYDCC.js.map → WalletPage-HH72DHOC.js.map} +1 -1
- package/dist/{WishlistPage-AROQHMZ2.js → WishlistPage-5BR63SMU.js} +29 -29
- package/dist/{WishlistPage-AROQHMZ2.js.map → WishlistPage-5BR63SMU.js.map} +1 -1
- package/dist/ambient/salla-components.d.ts +5 -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.js +6 -6
- 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-WBPOWM74.js → chunk-25UDBM27.js} +4 -4
- package/dist/{chunk-WBPOWM74.js.map → chunk-25UDBM27.js.map} +1 -1
- package/dist/{chunk-XQLAAPWR.js → chunk-2GSYVPQS.js} +7 -7
- package/dist/{chunk-XQLAAPWR.js.map → chunk-2GSYVPQS.js.map} +1 -1
- package/dist/{chunk-2TLIULJZ.js → chunk-3E3ABCPC.js} +3 -3
- package/dist/{chunk-2TLIULJZ.js.map → chunk-3E3ABCPC.js.map} +1 -1
- package/dist/{chunk-HTV4KO7G.js → chunk-4CM6JIQF.js} +3 -3
- package/dist/{chunk-HTV4KO7G.js.map → chunk-4CM6JIQF.js.map} +1 -1
- package/dist/{chunk-U2I3W3KW.js → chunk-4NZKBANW.js} +4 -4
- package/dist/{chunk-U2I3W3KW.js.map → chunk-4NZKBANW.js.map} +1 -1
- package/dist/{chunk-OOLS535M.js → chunk-4SCGS2CM.js} +7 -7
- package/dist/{chunk-OOLS535M.js.map → chunk-4SCGS2CM.js.map} +1 -1
- package/dist/{chunk-XN77EK3X.js → chunk-5A37NING.js} +4 -4
- package/dist/{chunk-XN77EK3X.js.map → chunk-5A37NING.js.map} +1 -1
- package/dist/{chunk-ETQFCKGR.js → chunk-5AOW2SQW.js} +3 -3
- package/dist/{chunk-ETQFCKGR.js.map → chunk-5AOW2SQW.js.map} +1 -1
- package/dist/{chunk-EHTLXK5F.js → chunk-5UWRPWK2.js} +5 -5
- package/dist/{chunk-EHTLXK5F.js.map → chunk-5UWRPWK2.js.map} +1 -1
- package/dist/{chunk-7VNVCHID.js → chunk-6K34BCUP.js} +2 -2
- package/dist/{chunk-7VNVCHID.js.map → chunk-6K34BCUP.js.map} +1 -1
- package/dist/{chunk-QIJJTWW6.js → chunk-6VYW7CVL.js} +4 -4
- package/dist/{chunk-QIJJTWW6.js.map → chunk-6VYW7CVL.js.map} +1 -1
- package/dist/{chunk-JUFJV4AK.js → chunk-7U5OLKOS.js} +3 -3
- package/dist/{chunk-JUFJV4AK.js.map → chunk-7U5OLKOS.js.map} +1 -1
- package/dist/{chunk-B3DGM7TM.js → chunk-A5AU64GV.js} +4 -4
- package/dist/{chunk-B3DGM7TM.js.map → chunk-A5AU64GV.js.map} +1 -1
- package/dist/{chunk-GG5DAIGJ.js → chunk-AXWX5SJC.js} +5 -5
- package/dist/{chunk-GG5DAIGJ.js.map → chunk-AXWX5SJC.js.map} +1 -1
- package/dist/{chunk-CKH6WBMA.js → chunk-CZ6VJPCG.js} +3 -3
- package/dist/{chunk-CKH6WBMA.js.map → chunk-CZ6VJPCG.js.map} +1 -1
- package/dist/{chunk-F5BU7T6H.js → chunk-D53M5ASN.js} +7 -7
- package/dist/{chunk-F5BU7T6H.js.map → chunk-D53M5ASN.js.map} +1 -1
- package/dist/{chunk-RQG44QD7.js → chunk-E5DP3MHE.js} +6 -6
- package/dist/{chunk-RQG44QD7.js.map → chunk-E5DP3MHE.js.map} +1 -1
- package/dist/{chunk-FHU2MXZA.js → chunk-FXVII733.js} +18 -8
- package/dist/chunk-FXVII733.js.map +1 -0
- package/dist/{chunk-VSEMOZZY.js → chunk-HDSY5DWF.js} +3 -3
- package/dist/{chunk-VSEMOZZY.js.map → chunk-HDSY5DWF.js.map} +1 -1
- package/dist/{chunk-Z6E7MMXW.js → chunk-HIOYW3CS.js} +4 -4
- package/dist/{chunk-Z6E7MMXW.js.map → chunk-HIOYW3CS.js.map} +1 -1
- package/dist/{chunk-BK5TBUGG.js → chunk-HOJ5E2PG.js} +3 -3
- package/dist/{chunk-BK5TBUGG.js.map → chunk-HOJ5E2PG.js.map} +1 -1
- package/dist/{chunk-G3UTLR3D.js → chunk-IOLNWPRO.js} +4 -4
- package/dist/{chunk-G3UTLR3D.js.map → chunk-IOLNWPRO.js.map} +1 -1
- package/dist/{chunk-33UM6VQJ.js → chunk-KWJUCI7M.js} +4 -4
- package/dist/{chunk-33UM6VQJ.js.map → chunk-KWJUCI7M.js.map} +1 -1
- package/dist/{chunk-JGVEGQHJ.js → chunk-LFHYQ6AN.js} +3 -3
- package/dist/{chunk-JGVEGQHJ.js.map → chunk-LFHYQ6AN.js.map} +1 -1
- package/dist/{chunk-BYLNAYIZ.js → chunk-LUPDYN4T.js} +5 -5
- package/dist/{chunk-BYLNAYIZ.js.map → chunk-LUPDYN4T.js.map} +1 -1
- package/dist/{chunk-NVL6M25Q.js → chunk-MWG734P7.js} +3 -3
- package/dist/{chunk-NVL6M25Q.js.map → chunk-MWG734P7.js.map} +1 -1
- package/dist/{chunk-V2M5YNZQ.js → chunk-MWYKP7CI.js} +3 -3
- package/dist/{chunk-V2M5YNZQ.js.map → chunk-MWYKP7CI.js.map} +1 -1
- package/dist/{chunk-GYXUYHKO.js → chunk-NHA4SBKG.js} +4 -4
- package/dist/{chunk-GYXUYHKO.js.map → chunk-NHA4SBKG.js.map} +1 -1
- package/dist/{chunk-37O7OVPL.js → chunk-OJKTKMWS.js} +4 -4
- package/dist/{chunk-37O7OVPL.js.map → chunk-OJKTKMWS.js.map} +1 -1
- package/dist/chunk-OKKS2RA4.js +14 -0
- package/dist/{chunk-JYEUOEEI.js.map → chunk-OKKS2RA4.js.map} +1 -1
- package/dist/{chunk-QGKARX6O.js → chunk-P3D67RVR.js} +8 -8
- package/dist/{chunk-QGKARX6O.js.map → chunk-P3D67RVR.js.map} +1 -1
- package/dist/{chunk-MBSWV56J.js → chunk-P6TJCCM3.js} +4 -4
- package/dist/{chunk-MBSWV56J.js.map → chunk-P6TJCCM3.js.map} +1 -1
- package/dist/{chunk-FID76MUV.js → chunk-Q7E4TNN7.js} +10 -6
- package/dist/chunk-Q7E4TNN7.js.map +1 -0
- package/dist/{chunk-LDQGZ4R2.js → chunk-RBXGVURD.js} +4 -4
- package/dist/{chunk-LDQGZ4R2.js.map → chunk-RBXGVURD.js.map} +1 -1
- package/dist/{chunk-4UEXSD7E.js → chunk-RLJLG4EN.js} +6 -6
- package/dist/{chunk-4UEXSD7E.js.map → chunk-RLJLG4EN.js.map} +1 -1
- package/dist/{chunk-OM2GRPDH.js → chunk-RYGEIQWO.js} +3 -3
- package/dist/{chunk-OM2GRPDH.js.map → chunk-RYGEIQWO.js.map} +1 -1
- package/dist/{chunk-7ED3XSYN.js → chunk-SGB7HCXF.js} +4 -4
- package/dist/{chunk-7ED3XSYN.js.map → chunk-SGB7HCXF.js.map} +1 -1
- package/dist/{chunk-PCEKL6S3.js → chunk-SXI2XBCC.js} +7 -7
- package/dist/{chunk-PCEKL6S3.js.map → chunk-SXI2XBCC.js.map} +1 -1
- package/dist/{chunk-L4TQBWR7.js → chunk-TF6HFXTW.js} +3 -3
- package/dist/{chunk-L4TQBWR7.js.map → chunk-TF6HFXTW.js.map} +1 -1
- package/dist/{chunk-VSP3INDK.js → chunk-TTLRRVM2.js} +7 -7
- package/dist/{chunk-VSP3INDK.js.map → chunk-TTLRRVM2.js.map} +1 -1
- package/dist/{chunk-P2WO5CNH.js → chunk-UHGDQIIF.js} +5 -5
- package/dist/{chunk-P2WO5CNH.js.map → chunk-UHGDQIIF.js.map} +1 -1
- package/dist/{chunk-L55G7FJZ.js → chunk-VNDUKDZG.js} +38 -10
- package/dist/chunk-VNDUKDZG.js.map +1 -0
- package/dist/{chunk-HIGI3M7E.js → chunk-VZPEPWDF.js} +9 -9
- package/dist/{chunk-HIGI3M7E.js.map → chunk-VZPEPWDF.js.map} +1 -1
- package/dist/{chunk-KLJTNLZ5.js → chunk-WEKO2DAN.js} +5 -5
- package/dist/{chunk-KLJTNLZ5.js.map → chunk-WEKO2DAN.js.map} +1 -1
- package/dist/{chunk-RSRGLHVQ.js → chunk-WHFKJ3AS.js} +4 -4
- package/dist/{chunk-RSRGLHVQ.js.map → chunk-WHFKJ3AS.js.map} +1 -1
- package/dist/{chunk-5FJFN3IW.js → chunk-WQPG22DY.js} +3 -3
- package/dist/{chunk-5FJFN3IW.js.map → chunk-WQPG22DY.js.map} +1 -1
- package/dist/{chunk-Z2K2O3DI.js → chunk-WVSGVFMM.js} +4 -4
- package/dist/{chunk-Z2K2O3DI.js.map → chunk-WVSGVFMM.js.map} +1 -1
- package/dist/{chunk-JYV25VNZ.js → chunk-X55R4VVK.js} +3 -3
- package/dist/{chunk-JYV25VNZ.js.map → chunk-X55R4VVK.js.map} +1 -1
- package/dist/{chunk-IPICQKIF.js → chunk-X5QZBD5V.js} +7 -7
- package/dist/{chunk-IPICQKIF.js.map → chunk-X5QZBD5V.js.map} +1 -1
- package/dist/{chunk-TLOA4BJF.js → chunk-XHWBJYJL.js} +3 -3
- package/dist/{chunk-TLOA4BJF.js.map → chunk-XHWBJYJL.js.map} +1 -1
- package/dist/{chunk-PAMMBDFM.js → chunk-YBIL64R7.js} +3 -3
- package/dist/{chunk-PAMMBDFM.js.map → chunk-YBIL64R7.js.map} +1 -1
- package/dist/{chunk-4SM6UKLE.js → chunk-YJWJPS25.js} +17 -17
- package/dist/chunk-YJWJPS25.js.map +1 -0
- package/dist/{chunk-N4YBKFJM.js → chunk-YKNDXZAD.js} +24 -24
- package/dist/chunk-YKNDXZAD.js.map +1 -0
- package/dist/{chunk-SQBLVCES.js → chunk-ZRJXN766.js} +4 -4
- package/dist/{chunk-SQBLVCES.js.map → chunk-ZRJXN766.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 -25
- package/dist/components/home/BundleComponent.d.ts +3 -0
- package/dist/components/home/BundleComponent.d.ts.map +1 -1
- package/dist/components/home/index.js +29 -29
- package/dist/components/layout/index.js +7 -7
- package/dist/components/product/index.js +26 -26
- package/dist/components/store/index.js +27 -27
- 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-3GOSUA4H.js +31 -0
- package/dist/{document-class-4DT4LTK5.js.map → document-class-3GOSUA4H.js.map} +1 -1
- package/dist/hooks/index.js +25 -25
- package/dist/hooks/useComments.js +4 -4
- package/dist/hooks/useGtm.js +25 -25
- package/dist/hooks/useMoney.js +25 -25
- package/dist/hooks/useProduct.js +4 -4
- package/dist/hooks/useStore.js +25 -25
- package/dist/hooks/useUser.js +6 -6
- package/dist/hooks/useWishlist.js +4 -4
- package/dist/index.js +25 -25
- package/dist/native-app/index.js +4 -4
- package/dist/{navigation-FTU3OC4V.js → navigation-SN2ZTS4V.js} +8 -8
- package/dist/{navigation-FTU3OC4V.js.map → navigation-SN2ZTS4V.js.map} +1 -1
- package/dist/navigation-ZV4TGIAA.js +15 -0
- package/dist/{navigation-DT6HXCUG.js.map → navigation-ZV4TGIAA.js.map} +1 -1
- package/dist/{not-found-BVJSPRMZ.js → not-found-J3UJVHNJ.js} +28 -28
- package/dist/{not-found-BVJSPRMZ.js.map → not-found-J3UJVHNJ.js.map} +1 -1
- package/dist/providers/index.js +25 -25
- package/dist/providers/twilight-init.d.ts.map +1 -1
- 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 -33
- package/dist/routes/home.js +30 -30
- 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 -31
- package/dist/routes/product.js +29 -29
- 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 -5
- package/dist/routes/thank-you.js +9 -9
- package/dist/skeleton.js +30 -30
- package/dist/{store-lookup-OWYYSCDT.js → store-lookup-U6TJNLZM.js} +12 -12
- package/dist/{store-lookup-OWYYSCDT.js.map → store-lookup-U6TJNLZM.js.map} +1 -1
- package/dist/tanstack.js +22 -22
- package/dist/twilight/context.d.ts +3 -2
- package/dist/twilight/context.d.ts.map +1 -1
- package/dist/utils/baseHead.js +3 -3
- package/dist/utils/cookies.d.ts +15 -1
- package/dist/utils/cookies.d.ts.map +1 -1
- package/dist/utils/index.js +7 -7
- package/dist/utils/maintenance.d.ts +37 -5
- package/dist/utils/maintenance.d.ts.map +1 -1
- package/dist/utils/store-identity.d.ts +10 -0
- package/dist/utils/store-identity.d.ts.map +1 -1
- package/dist/vite/index.js +5 -5
- package/package.json +1 -1
- package/tailwind/components/home/BundleComponent.tsx.txt +46 -3
- package/tailwind/routes/root/beforeLoad.ts.txt +8 -1
- package/dist/Header-ORMIZKUL.js +0 -23
- package/dist/MaintenancePage-A7CNHM7B.js +0 -7
- package/dist/StoreClosedNotification-3FYHHAIP.js +0 -58
- package/dist/chunk-4SM6UKLE.js.map +0 -1
- package/dist/chunk-FHU2MXZA.js.map +0 -1
- package/dist/chunk-FID76MUV.js.map +0 -1
- package/dist/chunk-JYEUOEEI.js +0 -14
- package/dist/chunk-L55G7FJZ.js.map +0 -1
- package/dist/chunk-N4YBKFJM.js.map +0 -1
- package/dist/document-class-4DT4LTK5.js +0 -31
- package/dist/navigation-DT6HXCUG.js +0 -15
package/dist/Header-ORMIZKUL.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export { Header } from './chunk-IPICQKIF.js';
|
|
2
|
-
import './chunk-4UEXSD7E.js';
|
|
3
|
-
import './chunk-OUW6WESU.js';
|
|
4
|
-
import './chunk-KLJTNLZ5.js';
|
|
5
|
-
import './chunk-XN77EK3X.js';
|
|
6
|
-
import './chunk-5XDPAKF5.js';
|
|
7
|
-
import './chunk-GCPEMNSU.js';
|
|
8
|
-
import './chunk-RQG44QD7.js';
|
|
9
|
-
import './chunk-Z5M4YYWT.js';
|
|
10
|
-
import './chunk-TYNZ5B2B.js';
|
|
11
|
-
import './chunk-NVL6M25Q.js';
|
|
12
|
-
import './chunk-AXW67SY7.js';
|
|
13
|
-
import './chunk-BYMOPN2S.js';
|
|
14
|
-
import './chunk-SKLEJJ6M.js';
|
|
15
|
-
import './chunk-2TLIULJZ.js';
|
|
16
|
-
import './chunk-GYXUYHKO.js';
|
|
17
|
-
import './chunk-FHU2MXZA.js';
|
|
18
|
-
import './chunk-7VNVCHID.js';
|
|
19
|
-
import './chunk-T72DAX7R.js';
|
|
20
|
-
import './chunk-DF6FBKDN.js';
|
|
21
|
-
import './chunk-DGUM43GV.js';
|
|
22
|
-
//# sourceMappingURL=Header-ORMIZKUL.js.map
|
|
23
|
-
//# sourceMappingURL=Header-ORMIZKUL.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { MaintenancePage } from './chunk-CKH6WBMA.js';
|
|
2
|
-
import './chunk-TYNZ5B2B.js';
|
|
3
|
-
import './chunk-7VNVCHID.js';
|
|
4
|
-
import './chunk-T72DAX7R.js';
|
|
5
|
-
import './chunk-DGUM43GV.js';
|
|
6
|
-
//# sourceMappingURL=MaintenancePage-A7CNHM7B.js.map
|
|
7
|
-
//# sourceMappingURL=MaintenancePage-A7CNHM7B.js.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export { StoreClosedNotification } from './chunk-SQBLVCES.js';
|
|
2
|
-
import './chunk-N4YBKFJM.js';
|
|
3
|
-
import './chunk-H2QBHOF2.js';
|
|
4
|
-
import './chunk-IPICQKIF.js';
|
|
5
|
-
import './chunk-HTV4KO7G.js';
|
|
6
|
-
import './chunk-PCEKL6S3.js';
|
|
7
|
-
import './chunk-JYV25VNZ.js';
|
|
8
|
-
import './chunk-WBPOWM74.js';
|
|
9
|
-
import './chunk-OXMUPNMH.js';
|
|
10
|
-
import './chunk-JUFJV4AK.js';
|
|
11
|
-
import './chunk-VVZNW5CB.js';
|
|
12
|
-
import './chunk-5FJFN3IW.js';
|
|
13
|
-
import './chunk-GD26FI4J.js';
|
|
14
|
-
import './chunk-FID76MUV.js';
|
|
15
|
-
import './chunk-OM2GRPDH.js';
|
|
16
|
-
import './chunk-4UEXSD7E.js';
|
|
17
|
-
import './chunk-OUW6WESU.js';
|
|
18
|
-
import './chunk-BK5TBUGG.js';
|
|
19
|
-
import './chunk-HI5V5X3S.js';
|
|
20
|
-
import './chunk-Z2K2O3DI.js';
|
|
21
|
-
import './chunk-TLOA4BJF.js';
|
|
22
|
-
import './chunk-MVT5AF2A.js';
|
|
23
|
-
import './chunk-Z653O7MX.js';
|
|
24
|
-
import './chunk-ZCH7W7DZ.js';
|
|
25
|
-
import './chunk-L4TQBWR7.js';
|
|
26
|
-
import './chunk-JWXJPJBO.js';
|
|
27
|
-
import './chunk-CW625T2E.js';
|
|
28
|
-
import './chunk-7V36I5GT.js';
|
|
29
|
-
import './chunk-6WI7R2BD.js';
|
|
30
|
-
import './chunk-JGVEGQHJ.js';
|
|
31
|
-
import './chunk-OAMIDZKW.js';
|
|
32
|
-
import './chunk-KLJTNLZ5.js';
|
|
33
|
-
import './chunk-OQIIJRAS.js';
|
|
34
|
-
import './chunk-V2ZDTY6H.js';
|
|
35
|
-
import './chunk-XN77EK3X.js';
|
|
36
|
-
import './chunk-5XDPAKF5.js';
|
|
37
|
-
import './chunk-GCPEMNSU.js';
|
|
38
|
-
import './chunk-RQG44QD7.js';
|
|
39
|
-
import './chunk-Z5M4YYWT.js';
|
|
40
|
-
import './chunk-TYNZ5B2B.js';
|
|
41
|
-
import './chunk-NVL6M25Q.js';
|
|
42
|
-
import './chunk-AXW67SY7.js';
|
|
43
|
-
import './chunk-BYMOPN2S.js';
|
|
44
|
-
import './chunk-SKLEJJ6M.js';
|
|
45
|
-
import './chunk-6BZ5TKEV.js';
|
|
46
|
-
import './chunk-FZKRSGLP.js';
|
|
47
|
-
import './chunk-7V5HOZW4.js';
|
|
48
|
-
import './chunk-YA6ABQB7.js';
|
|
49
|
-
import './chunk-V2M5YNZQ.js';
|
|
50
|
-
import './chunk-2TLIULJZ.js';
|
|
51
|
-
import './chunk-GYXUYHKO.js';
|
|
52
|
-
import './chunk-FHU2MXZA.js';
|
|
53
|
-
import './chunk-7VNVCHID.js';
|
|
54
|
-
import './chunk-T72DAX7R.js';
|
|
55
|
-
import './chunk-DF6FBKDN.js';
|
|
56
|
-
import './chunk-DGUM43GV.js';
|
|
57
|
-
//# sourceMappingURL=StoreClosedNotification-3FYHHAIP.js.map
|
|
58
|
-
//# sourceMappingURL=StoreClosedNotification-3FYHHAIP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tanstack/search.ts","../src/utils/language-cookie.ts","../src/routes/root/beforeLoad.ts","../src/tanstack/store-base.ts","../src/tanstack/router.tsx","../src/tanstack/document-class.ts"],"names":["createIsomorphicFn","getRequestUrl","getRequestHeader","setCookie","tanstackNotFound","createTanStackRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,MAAA,GAAS,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAyB,GAAA,CAAI,QAAA,CAAS,IAAI,CAAA,IAAK,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAGtF,SAAS,gBAAgB,MAAA,EAAyC;AACvE,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA;AACrC,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,MAAA,CAAO,MAAM,CAAA;AACnC,EAAA,IAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,uBAAuB,MAAM,CAAA;AAEvD,EAAA,MAAM,IAAA,GAAO,sBAAA;AAAA,IACX,MAAA,CAAO,WAAA,CAAY,OAAA,CAAQ,MAAA,CAAO,CAAC,UAAU,CAAC,MAAA,CAAO,KAAK,CAAC,CAAC;AAAA,GAC9D;AACA,EAAA,MAAM,WAAW,KAAA,CAAM,OAAA;AAAA,IAAQ,CAAC,CAAC,GAAA,EAAK,MAAM,MAC1C,MAAA,CAAO,GAAA;AAAA,MACL,CAAC,KAAA,KACC,CAAA,EAAG,kBAAA,CAAmB,GAAG,CAAC,CAAA,CAAA,EAAI,kBAAA,CAAmB,OAAO,KAAA,KAAU,WAAW,KAAA,GAAQ,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAC,CAAA;AAAA;AAC/G,GACF;AACA,EAAA,OAAO,CAAA,EAAG,IAAA,IAAQ,GAAG,CAAA,EAAG,IAAA,GAAO,GAAA,GAAM,EAAE,CAAA,EAAG,QAAA,CAAS,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAC9D;ACPA,IAAM,sBAAA,GAAyB,kBAAA,EAAmB,CAC/C,MAAA,CAAO,MAAqB;AAC3B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EA,EAAA,MAAM,UAAA,GAAa,aAAa,OAAO,CAAA;AAEvC,EAAA,gBAAA,CAAiB,UAAA,GAAa,EAAE,IAAA,EAAM,EAAE,OAAO,UAAA,EAAW,EAAE,GAAI,EAAE,CAAA;AAClE,EAAA,OAAO,IAAA;AACT;AA0BO,SAAS,wBAAA,GAGd;AACA,EAAA,MAAM,OAAA,GAAU,eAAe,EAAE,MAAA,EAAQ,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,CAAA;AAE3D,EAAA,MAAM,kBAAkB,OAAA,CAAQ,GAAA;AAAA,IAC9B,CAAC,CAAA,KAAO,CAAA,CAAE,UAAA,EAAoD,aAAA,EAAe,QAAQ;AAAC,GACxF;AACA,EAAA,MAAM,kBAAkB,OAAA,CAAQ,GAAA;AAAA,IAC9B,CAAC,CAAA,KAAO,CAAA,CAAE,UAAA,EAAoD,aAAA,EAAe,QAAQ;AAAC,GACxF;AAEA,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,YAAA,CAAa,iBAAA,CAAkB,eAAe,CAAC,CAAA;AAAA,IAC1D,SAAA,EAAW,YAAA,CAAa,iBAAA,CAAkB,eAAe,CAAC;AAAA,GAC5D;AACF;AAKO,SAAS,wBAAwB,UAAA,EAGtC;AACA,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,aAAa,iBAAA,CAAkB,CAAC,WAAW,IAAA,IAAQ,EAAE,CAAC,CAAC,CAAA;AAAA,IAClE,SAAA,EAAW,aAAa,iBAAA,CAAkB,CAAC,WAAW,IAAA,IAAQ,EAAE,CAAC,CAAC;AAAA,GACpE;AACF","file":"chunk-4SM6UKLE.js","sourcesContent":["import { defaultStringifySearch } from '@tanstack/react-router';\n\nconst isList = ([key, value]: [string, unknown]) => key.endsWith('[]') && Array.isArray(value);\n\n/** The router's query serialiser, writing `[]` keys back as repeated keys, as `<salla-filters>` does. */\nexport function stringifySearch(search: Record<string, unknown>): string {\n const entries = Object.entries(search);\n const lists = entries.filter(isList) as [string, unknown[]][];\n if (!lists.length) return defaultStringifySearch(search);\n\n const rest = defaultStringifySearch(\n Object.fromEntries(entries.filter((entry) => !isList(entry)))\n );\n const repeated = lists.flatMap(([key, values]) =>\n values.map(\n (value) =>\n `${encodeURIComponent(key)}=${encodeURIComponent(typeof value === 'string' ? value : JSON.stringify(value))}`\n )\n );\n return `${rest || '?'}${rest ? '&' : ''}${repeated.join('&')}`;\n}\n","/**\n * @fileoverview Reading and writing the `s-lang` cookie, on the server and in the browser.\n *\n * The server reads it from the request the framework is handling and writes it to that\n * request's response. The server-only import is stripped from the client bundle by\n * `createIsomorphicFn`, as in `routes/root/beforeLoad.ts`. The browser uses `document.cookie`.\n * Either side outside a request (a prerender, a test) has nothing to read or write and says so\n * quietly.\n */\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getRequestHeader, getRequestUrl, setCookie } from '@tanstack/react-start/server';\nimport { LANGUAGE_COOKIE_MAX_AGE, LANGUAGE_COOKIE_NAME } from './cookies';\n\nconst readServerCookieHeader = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getRequestHeader('cookie') ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nconst writeServerLanguageCookie = createIsomorphicFn()\n .server((code: string): void => {\n try {\n setCookie(LANGUAGE_COOKIE_NAME, code, {\n path: '/',\n maxAge: LANGUAGE_COOKIE_MAX_AGE,\n sameSite: 'lax',\n });\n } catch {\n // Outside a request: there is no response to write to.\n }\n })\n .client((): void => {});\n\nconst readServerSearch = createIsomorphicFn()\n .server((): string => {\n try {\n return getRequestUrl().search;\n } catch {\n return '';\n }\n })\n .client((): string => '');\n\n/**\n * The query string of the page being rendered (`?lang=en`, or `''`): the request's on the\n * server, the address bar's in the browser, so both sides read the same one.\n */\nexport function readPageSearch(): string {\n return readServerSearch() || (typeof window !== 'undefined' ? window.location.search : '');\n}\n\n/** The `Cookie` header of the request being handled, or `document.cookie` in the browser. */\nexport function readCookieHeader(): string | null {\n return readServerCookieHeader() ?? (typeof document !== 'undefined' ? document.cookie : null);\n}\n\n/** Remembers `code` as the visitor's language for every store on this host. */\nexport function persistLanguageCookie(code: string): void {\n writeServerLanguageCookie(code);\n if (typeof document !== 'undefined') {\n document.cookie = `${LANGUAGE_COOKIE_NAME}=${encodeURIComponent(code)}; path=/; max-age=${LANGUAGE_COOKIE_MAX_AGE}; SameSite=Lax`;\n }\n}\n","import type { QueryClient } from '@tanstack/react-query';\nimport { redirect } from '@tanstack/react-router';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport {\n getCookie,\n getRequestHeader,\n getRequestUrl,\n setCookie,\n} from '@tanstack/react-start/server';\nimport type { StoreContext } from '../../api/store';\nimport { store as storeApi } from '../../api/store';\nimport { apps, type AppSnippet, type AppSettings } from '../../api/apps';\nimport { translations } from '../../api/translations';\nimport { advertisement } from '../../api/advertisement';\nimport { FALLBACK_LOCALE, getLanguageInfo } from '../../providers/locale-constants';\nimport { createI18nInstance } from '../../providers/i18n-factory';\nimport type { TwilightLocation } from '../../twilight/context';\nimport { getTwilightContext, updateTwilightContext } from '../../twilight/context';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n extractScopeFromCookies,\n extractScopeFromUrl,\n extractTokenFromCookies,\n resolveRequestScope,\n sameScope,\n SCOPE_COOKIE_MAX_AGE,\n SCOPE_COOKIE_NAME,\n syncScopeCookie,\n type ActiveScope,\n} from '../../utils/cookies';\nimport { syncSdkLocale, syncSdkThemeVersion } from '../../utils/sdk-helpers';\nimport { SettingsError } from '../../utils/errors';\nimport {\n resolveStoreBase,\n resolveStoreBaseFollowsLocale,\n resolveStoreBaseRedirect,\n} from '../../utils/store-identity';\nimport { persistLanguageCookie, readCookieHeader } from '../../utils/language-cookie';\nimport { decideSharedHostLanguage } from '../../utils/shared-host-language';\nimport { prefixStoreBase } from '../../utils/store-base';\nimport {\n ownerCookieMatches,\n ownerLinkMatches,\n showsMaintenancePage,\n VIEW_AS_OWNER_COOKIE_NAME,\n} from '../../utils/maintenance';\n\n// Reads the `token` cookie from the incoming request on the SERVER. twilightMiddleware\n// extracts the same cookie into a custom ALS, but that ALS does NOT propagate to the\n// route's beforeLoad / React SSR render (they run in a different async scope), so the\n// token must be read again here from the framework's own request context. On the client\n// this is a no-op (the cookie is read from document.cookie below instead). The server\n// import is stripped from the client bundle by createIsomorphicFn.\nconst readServerCookieToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The scope to write to the `scope` cookie for this request, or null to leave the cookie\n * as it is.\n *\n * Only for a market a `?scope=` URL switched to, and only when the settings were answered\n * for it: the API falls back to another market when it does not accept the requested one,\n * and Twig keeps the previous choice then too, rather than recording one the page is not\n * showing. Its type is the one the settings answered with: a URL names only the id, and\n * the store-wide type is assumed until the answer says otherwise (a store browsing by\n * branch or city), so later requests send the type the API matches against.\n */\nexport function scopeCookieUpdate(\n url: string,\n cookieHeader: string | null,\n settings: StoreContext\n): ActiveScope | null {\n if (!extractScopeFromUrl(url)) return null;\n const scope = resolveRequestScope(url, cookieHeader);\n const answered = settings.store?.scope;\n if (!scope || answered?.id == null || String(answered.id) !== scope.id) return null;\n const typed = answered.type ? { ...scope, type: answered.type } : scope;\n return sameScope(extractScopeFromCookies(cookieHeader), typed) ? null : typed;\n}\n\n/**\n * Gives the request's scope the type its settings answered with, for the rest of this\n * render, and files the settings and ads under the key the corrected scope makes, so the browser\n * — which reads the corrected scope from the cookie (see {@link scopeCookieUpdate}) — finds\n * them dehydrated instead of fetching them again. The entry under the assumed type's key\n * is removed, so the page carries them once. Server-only; a no-op when the type\n * already matches or the settings answered another scope.\n */\nexport function alignRequestScopeType(queryClient: QueryClient, settings: StoreContext): void {\n let scope: ActiveScope | null;\n try {\n scope = getTwilightContext().scope;\n } catch {\n return;\n }\n const answered = settings.store?.scope;\n if (!scope || !answered?.type || String(answered.id) !== scope.id) return;\n if (answered.type === scope.type) return;\n const assumedKey = storeApi.queries.settings().queryKey;\n const assumedAdsKey = advertisement.queries.list().queryKey;\n updateTwilightContext({ scope: { ...scope, type: answered.type } });\n queryClient.setQueryData(storeApi.queries.settings().queryKey, settings);\n // Moved, not copied: both would be dehydrated, sending the settings twice.\n queryClient.removeQueries({ queryKey: assumedKey, exact: true });\n const ads = queryClient.getQueryData(assumedAdsKey);\n if (ads) queryClient.setQueryData(advertisement.queries.list().queryKey, ads);\n queryClient.removeQueries({ queryKey: assumedAdsKey, exact: true });\n}\n\n/**\n * Writes {@link scopeCookieUpdate} to the response. Read from the request itself rather\n * than the middleware's context, for the same reason as {@link readServerCookieToken}.\n * Server-only.\n */\nexport const persistRequestScope = createIsomorphicFn()\n .server((settings: StoreContext): void => {\n let scope: ActiveScope | null;\n try {\n scope = scopeCookieUpdate(\n String(getRequestUrl()),\n getRequestHeader('cookie') ?? null,\n settings\n );\n } catch {\n // Outside a request (prerender): there is no response to write to.\n return;\n }\n if (!scope) return;\n setCookie(SCOPE_COOKIE_NAME, JSON.stringify(scope), {\n path: '/',\n maxAge: SCOPE_COOKIE_MAX_AGE,\n sameSite: 'lax',\n });\n })\n .client((): void => {});\n\n/** The request's cookie header: the framework's on the server, the document's in the browser. */\nconst requestCookies = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getRequestHeader('cookie') ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => (typeof document !== 'undefined' ? document.cookie : null));\n\n/** Remembers the owner view for the rest of this browser session; see {@link VIEW_AS_OWNER_COOKIE_NAME}. */\nconst rememberOwnerView = createIsomorphicFn()\n .server((storeId: string): void => {\n try {\n setCookie(VIEW_AS_OWNER_COOKIE_NAME, storeId, { path: '/', sameSite: 'lax' });\n } catch {\n // Outside a request (prerender): there is no response to write to.\n }\n })\n .client((storeId: string): void => {\n document.cookie = `${VIEW_AS_OWNER_COOKIE_NAME}=${storeId}; path=/; SameSite=Lax`;\n });\n\n/**\n * Whether this visitor sees the maintenance page instead of the store, deciding and\n * remembering the merchant's owner view on the way.\n *\n * Twig's backend lets the merchant into their closed store when the dashboard's link\n * brings them (`?utm_source=dashboard&identifier=<store id>`), and keeps that in the\n * session. Here the link grants a session cookie, and the cookie or the link is the\n * owner view. A customer gets the maintenance page, and `twilightMiddleware` turns the\n * render into a 503 (see `withMaintenanceStatus`).\n */\nexport function resolveMaintenance(href: string, settings: StoreContext): boolean {\n const fromLink = ownerLinkMatches(href, settings);\n const storeId = settings.store?.id;\n if (fromLink && storeId != null) rememberOwnerView(String(storeId));\n const viewAsOwner = fromLink || ownerCookieMatches(requestCookies(), settings);\n return showsMaintenancePage(settings, viewAsOwner);\n}\n\n/** On the server, once the settings are in: {@link alignRequestScopeType}, then {@link persistRequestScope}. */\nfunction settleRequestScope(queryClient: QueryClient, settings: StoreContext): void {\n if (typeof window !== 'undefined') return;\n alignRequestScopeType(queryClient, settings);\n persistRequestScope(settings);\n}\n\n/**\n * On a Salla shared host the address carries no language, so `locale` here is a virtual\n * one (`?lang=`, then the `s-lang` cookie, then the fallback). Once the settings say what\n * the store offers: remembers a language `?lang=` asked for, takes `?lang=` off the URL, and\n * sends a visitor whose language the store does not offer to the store's default. A full\n * load, because the router handling this request resolved its locale before it knew. See\n * `decideSharedHostLanguage` for the rules, and why none of them can loop.\n *\n * A no-op everywhere else.\n */\nfunction settleSharedHostLanguage(\n settings: StoreContext,\n locale: string,\n location: TwilightLocation\n): void {\n const base = resolveStoreBase();\n if (!base || !resolveStoreBaseFollowsLocale()) return;\n\n // The router's href has the virtual locale in it and no store segment; the browser's has\n // the store segment and no locale.\n const url = new URL(location.href, 'http://shared-host.invalid');\n const decision = decideSharedHostLanguage({\n settings,\n locale,\n href: `${prefixStoreBase(url.pathname, base, true)}${url.search}${url.hash}`,\n cookieHeader: readCookieHeader(),\n });\n\n if (decision.cookie) persistLanguageCookie(decision.cookie);\n if (decision.redirectTo) {\n throw redirect({ href: decision.redirectTo, reloadDocument: true, replace: true });\n }\n}\n\nexport interface BeforeLoadResult {\n settings: StoreContext;\n locale: string;\n /**\n * Whether this page is on a Salla shared host, where the address carries no language.\n * The generated locale layout reads it: it must not redirect between locale-less and\n * locale-bearing paths there, because the router strips the locale from every address.\n */\n storeBaseFollowsLocale: boolean;\n dir: 'ltr' | 'rtl';\n authToken: string | null;\n /** Installed apps' snippets, threaded through the beforeLoad context (and recovered on the\n * client via ensureTwilightContextFromMatches) so AppsSnippets can render CDN tags in SSR. */\n appsSnippets?: AppSnippet[];\n /** Per-app public `app.*` buckets, threaded the same way so rootHead can install the\n * `Salla.appScope` factory inline in the SSR head. */\n appsSettings?: AppSettings;\n /** This visitor sees the maintenance page, not the store; see {@link resolveMaintenance}. */\n maintenance: boolean;\n}\n\n/**\n * The platform's copy for `locale`, with this merchant's own wording over it.\n *\n * Returns the platform's copy untouched — and makes no request — unless the\n * settings say this language has overrides. That gate is the whole reason this\n * is affordable: the object 404s for most stores, uncached, on the critical\n * path of an SSR render.\n *\n * The entry is found by ISO code rather than by index or key. The API sends\n * `languages` as an object keyed by **upper-case** ISO, and `storeApi` converts\n * it to an array on the way through (`languagesToArray`), so neither the\n * upper-case key nor a position is available here — and matching case-sensitively\n * on `code` would be a lookup that misses silently, leaving the flag absent and\n * the feature simply never running.\n *\n * Nothing about this is fatal. A failed override read leaves the platform's\n * copy in place, which is a storefront in the words Salla ships rather than a\n * storefront that did not render.\n */\nasync function withMerchantTranslations(\n queryClient: QueryClient,\n settings: StoreContext,\n locale: string,\n common: Awaited<ReturnType<typeof translations.get>>\n): Promise<Awaited<ReturnType<typeof translations.get>>> {\n const wanted = locale.toLowerCase();\n const language = settings.languages?.find(\n (entry) => (entry.iso_code ?? entry.code)?.toLowerCase() === wanted\n );\n const storeId = settings.store?.id;\n\n if (!language?.has_custom_translations || !storeId) return common;\n\n try {\n const overrides = await queryClient.ensureQueryData(\n translations.queries.byStore(storeId, locale)\n );\n\n return translations.merge(common, overrides, locale);\n } catch (error) {\n console.warn('[salla] merchant translations could not be read; using the platform copy', error);\n return common;\n }\n}\n\n/**\n * What the root route throws when the settings did not load: their own failure, which\n * says why. When it says no store has this identifier, that is recorded first, and\n * `twilightMiddleware` answers with Twig's 410 page instead of the render.\n */\nfunction settingsFailureToThrow(failure: unknown): SettingsError {\n if (!(failure instanceof SettingsError)) return new SettingsError();\n if (failure.reason === 'not-found') updateTwilightContext({ storeNotFound: true });\n return failure;\n}\n\nexport async function rootBeforeLoad(ctx: {\n params: Record<string, string>;\n location: TwilightLocation;\n context: {\n queryClient: QueryClient;\n setLocation?: (location: Partial<TwilightLocation>) => void;\n };\n serverContext?: {\n authToken?: string | null;\n };\n}): Promise<BeforeLoadResult> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n const { dir } = getLanguageInfo(locale);\n\n if (ctx.context.setLocation) {\n ctx.context.setLocation(ctx.location);\n }\n\n // Set locale in context before any API calls so interceptor uses correct locale\n updateTwilightContext({ locale });\n\n // Re-assert the locale on the Salla SDK on every navigation. The SDK's axios\n // accept-language header drifts off the route locale (navigator.language default,\n // account-language override on profile fetch — see syncSdkLocale), which makes\n // SDK API calls (e.g. the cart's salla.api.cart.details) return wrong-locale data.\n syncSdkLocale(locale);\n\n // Mirror the SDK's selected branch into the `scope` cookie. The SDK persists the\n // selection in localStorage ONLY, so the server — which can only see cookies —\n // would otherwise compute scope=null for every visitor who picked a branch, and\n // the dehydrated settings query (keyed on the scope) would never match on the\n // client. No-op on the server and while the SDK storage API is still hydrating.\n syncScopeCookie();\n\n // Kept until the rest have settled, as a missing answer always was, then thrown:\n // it says why the store did not load.\n let settingsFailure: unknown;\n const [settingsResult, translationsResult, snippetsResult, appSettingsResult] = await Promise.all(\n [\n ctx.context.queryClient.ensureQueryData(storeApi.queries.settings()).catch((error): null => {\n settingsFailure = error;\n return null;\n }),\n ctx.context.queryClient.ensureQueryData(translations.queries.byLocale(locale)),\n // Snippets → SSR CDN <script> tags (AppsSnippets.ssrCdnScripts). Non-fatal + logged:\n // on failure AppsSnippets falls back to its own client-side query for the same data,\n // so the tags render a paint later instead of being lost for the page load.\n ctx.context.queryClient.ensureQueryData(apps.queries.snippets()).catch((error): undefined => {\n console.warn('[salla] apps/snippets prefetch failed; rendering no CDN snippet tags', error);\n return undefined;\n }),\n // Buckets → rootHead installs `Salla.appScope` inline in the SSR head (before any snippet\n // onReady runs). Non-fatal + logged: the head installs the factory either way, and the\n // client query seeds the buckets into that install once it resolves.\n ctx.context.queryClient.ensureQueryData(apps.queries.settings()).catch((error): undefined => {\n console.warn(\n '[salla] apps/snippets/settings prefetch failed; appScope buckets unseeded',\n error\n );\n return undefined;\n }),\n // Ads → the header's announcement bar renders on the server, so it no longer pushes the\n // page down when it arrives. Non-fatal: the bar then loads on the client, as before.\n ctx.context.queryClient\n .ensureQueryData(advertisement.queries.list())\n .catch((error): undefined => {\n console.warn('[salla] advertisements prefetch failed; the ad bar loads late', error);\n return undefined;\n }),\n ]\n );\n\n if (!settingsResult) throw settingsFailureToThrow(settingsFailure);\n\n // Settings answered for another market name another theme version; the SDK only\n // read its `s-version-id` at init — see syncSdkThemeVersion.\n syncSdkThemeVersion(settingsResult.headers);\n\n settleRequestScope(ctx.context.queryClient, settingsResult);\n\n // On a host where the store is the root of every URL, a page has one address:\n // `/<username>/…`. A request that found its store some other way (`?storeId=`,\n // the preview cookie, `VITE_STORE_DOMAIN`) is sent there now that the settings\n // say what the username is. A full load rather than a client navigation, because\n // the router handling this request was built without that root.\n const storeBaseHref = resolveStoreBaseRedirect(settingsResult.store?.username, ctx.location.href);\n if (storeBaseHref) {\n throw redirect({ href: storeBaseHref, reloadDocument: true, replace: true });\n }\n\n // Before the maintenance decision: its redirect keeps every other query parameter, so the\n // owner link (`?utm_source=dashboard&identifier=`) still reaches the request that follows.\n settleSharedHostLanguage(settingsResult, locale, ctx.location);\n\n const maintenance = resolveMaintenance(ctx.location.href, settingsResult);\n\n // The merchant's own wording, laid over the platform's — but only when the\n // settings say this language has any.\n //\n // Sequenced after the `Promise.all` on purpose: the object is keyed by\n // `settings.store.id`, which the settings query is what produces, so this\n // cannot join the batch above. The cost of a second round trip is why it is\n // gated rather than always fetched — see `api/translations.ts` for the two\n // corrections that shape led to.\n const messages = await withMerchantTranslations(\n ctx.context.queryClient,\n settingsResult,\n locale,\n translationsResult\n );\n\n // Create i18n instance with loaded translations\n const i18n = createI18nInstance(locale, messages ?? undefined);\n\n // Resolve authToken with fallback chain:\n // 1. SSR context (from middleware extracting cookies on server)\n // 2. The twilight context token. On the SERVER this is the token twilightMiddleware\n // extracted from the `token` cookie into the request ALS — reading it here is\n // essential, otherwise this loader's updateTwilightContext() below would\n // overwrite the middleware's token with null and every SSR render (e.g. the\n // account hub) would be unauthenticated. On the CLIENT it's the clientStore\n // token from hydration or a previous navigation.\n // 3. The `token` cookie read directly — client fallback when clientStore is empty\n // and salla.storage hasn't hydrated yet.\n // 4. Salla SDK storage (salla.storage.get('token'))\n let existingToken: string | null = null;\n try {\n existingToken = getTwilightContext().authToken;\n } catch {\n // No request context (e.g. server call outside the middleware ALS) — fall through.\n existingToken = null;\n }\n const cookieToken =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n const sallaToken =\n typeof window !== 'undefined' && typeof window.salla?.storage?.get === 'function'\n ? (window.salla.storage.get(AUTH_TOKEN_COOKIE_NAME) as string | null)\n : null;\n const serverCookieToken = readServerCookieToken();\n const authToken =\n ctx.serverContext?.authToken ??\n serverCookieToken ??\n existingToken ??\n cookieToken ??\n sallaToken ??\n null;\n\n updateTwilightContext({\n queryClient: ctx.context.queryClient,\n settings: settingsResult,\n locale,\n location: ctx.location,\n i18n,\n authToken,\n appsSnippets: snippetsResult,\n appsSettings: appSettingsResult,\n maintenance,\n });\n\n return {\n settings: settingsResult,\n locale,\n storeBaseFollowsLocale: resolveStoreBaseFollowsLocale(),\n dir,\n authToken,\n appsSnippets: snippetsResult,\n appsSettings: appSettingsResult,\n maintenance,\n };\n}\n","/**\n * @fileoverview The store segment, carried by the router instead of the route tree.\n *\n * TanStack Router rewrites every location it reads and every one it writes:\n * `input` runs before a URL is matched, and `output` before an href is rendered,\n * pushed to history or sent as a redirect's `Location`. So on a host where the\n * store is the root, the route tree stays `/{-$locale}/cart` and\n * `<Link to=\"/cart\">` renders `/mtgr-alaatr-2/cart` by itself.\n *\n * Why not the router's `basepath`: TanStack Start overwrites it from the build on\n * both sides (`router.update({ basepath })` per request on the server, and in\n * `hydrateStart` on the client). `rewrite` is a separate option that the router\n * composes with that basepath, so it survives. Server functions are dispatched on\n * the raw URL before the router runs, and assets are root-absolute, so neither\n * moves. See `docs/store-base-path.md`.\n */\nimport type { LocationRewrite } from '@tanstack/react-router';\nimport { isLocale } from '../providers/locale-constants';\nimport { readCookieHeader, readPageSearch } from '../utils/language-cookie';\nimport { hasLanguageParam, virtualLocale, withLanguageParam } from '../utils/shared-host-language';\nimport { prefixStoreBase, stripStoreBase } from '../utils/store-base';\n\n/**\n * A rewrite that serves the application from `/<base>`.\n *\n * With `followsLocale` (a Salla shared host) the address carries no language, but the\n * route tree still has its `/{-$locale}` segment, so the language is a *virtual* one:\n * `input` puts it in front of the path (`/dev-x/cart` → `/ar/cart`, from `?lang=`, then\n * the `s-lang` cookie, then the fallback) and `output` takes it off again. The old\n * address, `/ar/dev-x/cart`, is still understood and keeps its own language.\n *\n * A link keeps `?lang=` for as long as the page it is on carries one (see `output`), so a\n * visitor whose browser blocks the cookie does not lose the language on the next page.\n */\nexport function storeBaseRewrite(base: string, followsLocale = false): LocationRewrite {\n return {\n input: ({ url }) => {\n if (!followsLocale) {\n url.pathname = stripStoreBase(url.pathname, base);\n return url;\n }\n\n const [, first, second] = url.pathname.split('/');\n if (isLocale(first) && second === base) {\n url.pathname = stripStoreBase(url.pathname, base, true);\n return url;\n }\n\n const stripped = stripStoreBase(url.pathname, base);\n // Not under the store segment: nothing to put a language in front of.\n if (stripped === url.pathname) return url;\n\n const locale = virtualLocale(url.search, readCookieHeader());\n url.pathname = stripped === '/' ? `/${locale}` : `/${locale}${stripped}`;\n return url;\n },\n output: ({ url }) => {\n if (!followsLocale) {\n url.pathname = prefixStoreBase(url.pathname, base);\n return url;\n }\n\n const [, leading] = url.pathname.split('/');\n url.pathname = prefixStoreBase(url.pathname, base, true);\n\n // While the page's own address still carries `?lang=`, the cookie has not been confirmed\n // (a browser that blocks it never does), so a link that dropped its language would open in\n // another one. Such a link keeps naming its language, until a request arrives with the\n // cookie and `rootBeforeLoad` takes `?lang=` off the address.\n const page = readPageSearch();\n if (hasLanguageParam(page) && !hasLanguageParam(url.search)) {\n url.search = withLanguageParam(\n url.search,\n isLocale(leading) ? leading : virtualLocale(page, null)\n );\n }\n return url;\n },\n };\n}\n","import type { ReactNode } from 'react';\nimport { lazy, Suspense } from 'react';\nimport {\n createRouter as createTanStackRouter,\n createRootRouteWithContext,\n notFound as tanstackNotFound,\n} from '@tanstack/react-router';\nimport type { AnyRoute, RouterHistory } from '@tanstack/react-router';\nimport { QueryClient } from '@tanstack/react-query';\nimport { shouldDehydrateQuery } from '../api/product';\nimport { PageSkeleton } from '@salla.sa/twilight-components-react/skeletons';\nimport { setHeadAdapter } from '../utils/head';\nimport { tanstackHeadAdapter } from './head';\nimport { stringifySearch } from './search';\nimport {\n updateTwilightContext,\n type PageContext,\n type TwilightLocation,\n} from '../twilight/context';\nimport type { Product } from '../types';\nimport { dispatchProductViewed, dispatchRouteChanged } from '../utils/sdk-events';\nimport { rootBeforeLoad, type BeforeLoadResult } from '../routes/root/beforeLoad';\nimport { rootHead } from '../routes/root/head';\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query';\nimport type { AnyRouter } from '@tanstack/react-router';\nimport { RouteId, type RouteIdType } from '../router/route-ids';\nimport {\n UnauthorizedError,\n NotFoundError,\n RedirectError,\n isMissingResource,\n responseStatusOf,\n} from '../providers/NavigationProvider';\nimport { ErrorPage } from '../components/common/ErrorPage';\nimport type { StoreContext } from '../api/store';\nimport type { AppSnippet, AppSettings } from '../api/apps';\nimport { createI18nInstance } from '../providers/i18n-factory';\nimport { messagesForLocale } from '../api/messages';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from '../utils/store-identity';\nimport { storeBaseRewrite } from './store-base';\n\n/**\n * Initial router context passed from createRouter to beforeLoad.\n */\nexport interface RouterInitialContext {\n queryClient: QueryClient;\n setLocation: (_location: Partial<TwilightLocation>) => void;\n}\n\n/**\n * TanStack Router ID Mapping\n *\n * Maps TanStack's auto-generated path-based route IDs to semantic RouteId constants.\n * This mapping is TanStack-specific because different frameworks generate route IDs differently:\n *\n * - TanStack: Uses file path as ID (e.g., '/{-$locale}/cart')\n * - Next.js: Uses file path without locale (e.g., '/cart')\n *\n * The mapping enables hooks like useIsHome(), useIsProduct() to work consistently\n * across frameworks while each framework has its own ID generation strategy.\n */\nexport const TANSTACK_ROUTE_ID_MAP: Record<string, RouteIdType> = {\n '/{-$locale}/': RouteId.INDEX,\n '/{-$locale}/cart': RouteId.CART,\n '/{-$locale}/search': RouteId.SEARCH,\n\n '/{-$locale}/latest-products': RouteId.PRODUCT_INDEX_LATEST,\n '/{-$locale}/most-sales-products': RouteId.PRODUCT_INDEX_SALES,\n '/{-$locale}/offers': RouteId.PRODUCT_INDEX_OFFERS,\n '/{-$locale}/products': RouteId.PRODUCT_INDEX,\n\n '/{-$locale}/$slug/c{$id}': RouteId.PRODUCT_INDEX,\n '/{-$locale}/$slug/p{$id}': RouteId.PRODUCT_SINGLE,\n '/{-$locale}/$slug/brand-{$id}': RouteId.BRANDS_SINGLE,\n '/{-$locale}/$slug/tag-{$id}': RouteId.PRODUCT_INDEX_TAG,\n '/{-$locale}/$slug/page-{$id}': RouteId.PAGE_SINGLE,\n\n '/{-$locale}/blog': RouteId.BLOG_INDEX,\n '/{-$locale}/blog/$slug/a-{$id}': RouteId.BLOG_SINGLE,\n '/{-$locale}/blog/$slug/c-{$id}': RouteId.BLOG_INDEX_CATEGORY,\n '/{-$locale}/blog/$slug/tag-{$id}': RouteId.BLOG_INDEX_TAG,\n '/{-$locale}/blog/author/$id': RouteId.BLOG_INDEX_AUTHOR,\n\n '/{-$locale}/brands': RouteId.BRANDS_INDEX,\n '/{-$locale}/brands/$id': RouteId.BRANDS_SINGLE,\n '/{-$locale}/tags/$id': RouteId.PRODUCT_INDEX_TAG,\n\n '/{-$locale}/profile': RouteId.CUSTOMER_PROFILE,\n '/{-$locale}/wishlist': RouteId.CUSTOMER_WISHLIST,\n '/{-$locale}/wallet': RouteId.CUSTOMER_WALLET,\n '/{-$locale}/notifications': RouteId.CUSTOMER_NOTIFICATIONS,\n '/{-$locale}/settings': RouteId.CUSTOMER_SETTINGS,\n '/{-$locale}/orders': RouteId.CUSTOMER_ORDERS_INDEX,\n '/{-$locale}/order/$id': RouteId.CUSTOMER_ORDERS_SINGLE,\n '/{-$locale}/pending-orders': RouteId.CUSTOMER_ORDERS_INDEX_PENDING,\n '/{-$locale}/account/pending_orders': RouteId.CUSTOMER_ORDERS_INDEX_PENDING,\n '/{-$locale}/account/rating': RouteId.CUSTOMER_ORDERS_INDEX,\n\n '/{-$locale}/logout': RouteId.LOGOUT,\n '/{-$locale}/loyalty': RouteId.LOYALTY,\n '/{-$locale}/loyalty_points': RouteId.CUSTOMER_LOYALTY_POINTS,\n '/{-$locale}/testimonials': RouteId.TESTIMONIALS,\n '/{-$locale}/reviews': RouteId.REVIEWS,\n '/{-$locale}/thankyou/$orderId': RouteId.THANK_YOU,\n};\n\n/**\n * Resolves a TanStack route ID to a semantic RouteId constant.\n * Falls back to the original ID if no mapping exists.\n * @internal Exported for testing\n */\nexport function resolveRouteId(tanstackId: string): string {\n return TANSTACK_ROUTE_ID_MAP[tanstackId] ?? tanstackId;\n}\n\n// Lazy load NotFoundPage for code splitting\nconst LazyNotFoundPage = lazy(() =>\n import('../routes/not-found').then((m) => ({ default: m.NotFoundPage }))\n);\n\n/**\n * Error component shown when the root route fails to load.\n * This renders a minimal HTML page with error details.\n */\nfunction StoreUnavailablePage() {\n return (\n <>\n <div\n style={{\n position: 'fixed',\n inset: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: '#f9fafb',\n }}\n >\n <div style={{ textAlign: 'center', padding: '2rem' }}>\n <h1 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>\n Store is temporarily unavailable\n </h1>\n <p style={{ color: '#6b7280' }}>\n We're having trouble loading the store. Please try again in a moment.\n </p>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n style={{\n marginTop: '1rem',\n padding: '0.75rem 1.5rem',\n fontSize: '1rem',\n border: 'none',\n borderRadius: '0.5rem',\n background: '#111827',\n color: '#fff',\n cursor: 'pointer',\n }}\n >\n Retry\n </button>\n </div>\n </div>\n </>\n );\n}\n\nfunction RootErrorComponent({ error: _error }: { error: Error }) {\n return (\n <html lang=\"ar\" dir=\"rtl\">\n <head>\n <meta charSet=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>Store Unavailable</title>\n </head>\n <body style={{ margin: 0, fontFamily: 'sans-serif' }}>\n <StoreUnavailablePage />\n </body>\n </html>\n );\n}\n\n/**\n * Creates the root route pre-configured with RouterInitialContext.\n * beforeLoad will fetch settings/translations, loader returns serializable data.\n *\n * @example\n * ```ts\n * export const Route = createTwilightRootRoute()({ shellComponent });\n * ```\n */\nexport function createTwilightRootRoute() {\n const factory = createRootRouteWithContext<RouterInitialContext>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TanStack Router factory expects `any` for spread options\n return (options: any) =>\n factory({\n beforeLoad: rootBeforeLoad,\n head: rootHead,\n errorComponent: RootErrorComponent,\n ...options,\n });\n}\n\n/**\n * Default error component for route-level errors.\n */\nexport function DefaultErrorComponent({ error }: { error: unknown }) {\n if (error instanceof RedirectError) {\n return null;\n }\n\n if (error instanceof NotFoundError) {\n return <ErrorPage code={404} message={error.message} />;\n }\n\n if (error instanceof UnauthorizedError) {\n return <ErrorPage code={401} message={error.message} showAction={false} />;\n }\n\n const message =\n error instanceof Error\n ? error.message\n : error &&\n typeof error === 'object' &&\n 'message' in error &&\n typeof error.message === 'string'\n ? error.message\n : undefined;\n\n if (error && typeof error === 'object' && 'response' in error) {\n return responseErrorPage(error, message);\n }\n\n return <ErrorPage code={500} message={message} />;\n}\n\n/**\n * An error that carries an HTTP response. ky's own message names the API request\n * (\"Request failed with status code 410 Gone: GET https://api.salla.dev/…\"), which\n * is not a shopper's to read; an error a theme or the SDK made itself keeps its\n * message.\n */\nfunction responseErrorPage(error: object, message: string | undefined) {\n if (isMissingResource(error)) return <ErrorPage code={404} />;\n if (isHttpError(error)) {\n return <ErrorPage code={(responseStatusOf(error) ?? 500) >= 500 ? 500 : 400} />;\n }\n return <ErrorPage code={400} message={message} />;\n}\n\n/** An error ky threw for a non-2xx answer, as opposed to one carrying a response for its own reasons. */\nfunction isHttpError(error: object): boolean {\n return (error as { name?: unknown }).name === 'HTTPError';\n}\n\nconst MISSING_AS_NOT_FOUND = Symbol.for('salla.twilight.missingResourceAsNotFound');\n\ntype MarkedOnError = ((error: unknown) => void) & { [MISSING_AS_NOT_FOUND]?: true };\n\n/**\n * Every route but the root answers an API 404/410 its `loader` or `beforeLoad` let\n * escape with the not-found page and a 404, instead of the error page and a 500.\n *\n * The engine's own loaders already say so through `orThrow`; a theme's need not. Theme\n * 427703943 fetches `category.queries.detail` in its own `/category/$id` loader, so a\n * deleted category was a 500 that printed the API URL. TanStack hands a loader's error\n * to the route's `onError` and honours a `notFound()` thrown from there, on the server\n * (the status follows) and in the browser alike; the router has no default for it, so\n * each route gets one, after its own.\n *\n * The root is left alone: its `beforeLoad` failing means the store cannot be served at\n * all (\"Store Unavailable\", or Twig's 410 page when no store has the identifier).\n * Routes are built once per isolate and `createRouter` runs per request, hence the mark.\n */\nexport function answerMissingResourcesWithNotFound(router: AnyRouter): void {\n for (const route of Object.values(router.routesById) as AnyRoute[]) {\n if (route.isRoot) continue;\n const own = route.options.onError as MarkedOnError | undefined;\n if (own?.[MISSING_AS_NOT_FOUND]) continue;\n\n const onError: MarkedOnError = (error) => {\n own?.(error);\n if (isMissingResource(error)) throw tanstackNotFound();\n };\n onError[MISSING_AS_NOT_FOUND] = true;\n route.options.onError = onError;\n }\n}\n\n/**\n * SSR integration for Twilight context — mirrors TanStack Query's\n * `setupRouterSsrQueryIntegration` pattern.\n *\n * On the **server**: wraps `router.options.dehydrate` to include twilight\n * context data (settings, locale, location, authToken) alongside the router state.\n *\n * On the **client**: wraps `router.options.hydrate` to populate the module-level\n * store from the root match's `__beforeLoadContext` BEFORE head functions re-run.\n * TanStack's `hydrate()` calls `router.options.hydrate()` at line 114 of\n * `ssr-client.ts`, right before it re-evaluates head functions (line 120+).\n * By populating the store here, `getTwilightContext().settings` is available\n * to `rootHead()` and all child head functions during client hydration.\n */\nfunction setupTwilightSsrIntegration(router: AnyRouter, queryClient: QueryClient): void {\n if (typeof window === 'undefined') {\n // Server: also populate twilightCtx from root match context on dehydrate\n return;\n }\n\n // Client: hook into router.options.hydrate to populate the module store\n // from the root match's __beforeLoadContext (set by rootBeforeLoad on the server)\n const ogHydrate = router.options.hydrate;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router.options.hydrate = async (dehydratedData: any) => {\n await ogHydrate?.(dehydratedData);\n hydrateTwilightContext(router, queryClient);\n };\n}\n\nfunction warnHydrationBail(reason: string): void {\n // Silent failure here is what blanks the storefront: every head function that\n // runs next reads `getTwilightContext().settings`, which throws when the store\n // is empty. `ensureTwilightContextFromMatches` recovers at the point of use,\n // but the bail still signals a regression worth seeing in dev.\n if (import.meta.env?.DEV) {\n console.warn(`[Twilight] Could not hydrate twilight context: ${reason}`);\n }\n}\n\nfunction routerLocation(router: AnyRouter): TwilightLocation | undefined {\n const loc = router.state?.location;\n if (!loc) return undefined;\n return {\n href: loc.href,\n pathname: loc.pathname,\n search: loc.search as Record<string, unknown>,\n searchStr: loc.searchStr,\n state: loc.state as unknown as Record<string, unknown>,\n hash: loc.hash,\n };\n}\n\nfunction hydrateTwilightContext(router: AnyRouter, queryClient: QueryClient): void {\n const location = routerLocation(router);\n // A direct load can hydrate before its matches exist.\n if (location) updateTwilightContext({ location });\n\n const rootMatch = router.state?.matches?.[0];\n if (!rootMatch) {\n warnHydrationBail('no root match in router state');\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const beforeLoadCtx = (rootMatch as any).__beforeLoadContext as BeforeLoadResult | undefined;\n const matchCtx = rootMatch.context as Record<string, unknown> | undefined;\n\n const settings = (beforeLoadCtx?.settings ?? matchCtx?.settings) as StoreContext | undefined;\n const locale = (beforeLoadCtx?.locale ?? matchCtx?.locale) as string | undefined;\n const authToken = (beforeLoadCtx?.authToken ?? matchCtx?.authToken) as string | null;\n // Recover snippets here too: this is the primary hydration pass and populates settings, so the\n // best-effort ensureTwilightContextFromMatches fallback then short-circuits — if we skipped\n // appsSnippets here it would never reach the client store, and AppsSnippets' SSR-rendered CDN\n // tags would mismatch on hydration.\n const appsSnippets =\n beforeLoadCtx?.appsSnippets ?? (matchCtx?.appsSnippets as AppSnippet[] | undefined);\n // Recover appScope buckets too (like appsSnippets): this primary pass populates settings, so the\n // ensure-context fallback short-circuits — keep the client store in parity for head/install.\n const appsSettings =\n beforeLoadCtx?.appsSettings ?? (matchCtx?.appsSettings as AppSettings | undefined);\n // The maintenance decision too, for the same parity: the server rendered the maintenance\n // page from it, and the provider reads it on the client.\n const maintenance = (beforeLoadCtx?.maintenance ?? matchCtx?.maintenance) === true;\n\n if (!settings || !locale) {\n warnHydrationBail(\n `root match carried no ${!settings ? 'settings' : 'locale'} (beforeLoadContext and context both empty)`\n );\n return;\n }\n\n // Composed by the shared helper rather than read straight off one key.\n // There are two entries now — the platform's copy and this merchant's — and\n // reading only the first is how the server rendered the merchant's wording\n // and hydration replaced it with Salla's (Greptile's P1 on #366).\n const i18n = createI18nInstance(locale, messagesForLocale(queryClient, locale));\n\n const matches = router.state?.matches;\n const page = matches?.reduceRight(\n (found, m) => found ?? ((m as any).loaderData?.page ? (m as any).loaderData.page : null),\n null as any\n );\n\n // Resolve routeId on the initial load too — `onResolved` only fires on later\n // navigations, so without this the store keeps the empty default until the\n // first SPA navigation (breaks useRouteId/useIsHome on first paint/refresh).\n const leafMatch = matches?.[matches.length - 1];\n const routeId = leafMatch?.routeId ? resolveRouteId(leafMatch.routeId as string) : undefined;\n\n updateTwilightContext({\n queryClient,\n settings,\n locale,\n i18n,\n authToken,\n location,\n page,\n routeId,\n appsSnippets,\n appsSettings,\n maintenance,\n });\n}\n\ninterface PageLoaderData {\n page?: PageContext;\n product?: Product;\n}\n\n/** The navigation that last reported a product view: onLoad and onRendered both sync each one. */\nlet lastProductView: string | undefined;\n\n/** Publishes the deepest match's loader `page` to the twilight context and `salla.config`. */\nfunction syncPageFromMatches(router: AnyRouter): void {\n const matches = router.state?.matches;\n if (!matches) return;\n const data = matches.reduceRight<PageLoaderData | null>((found, m) => {\n const loaderData = (m as { loaderData?: PageLoaderData }).loaderData;\n return found ?? (loaderData?.page ? loaderData : null);\n }, null);\n const page = data?.page;\n if (!page) return;\n updateTwilightContext({ page });\n const sdkPage = {\n ...page,\n url: page.url ?? router.state.location.pathname + router.state.location.searchStr,\n };\n const push = () => window.salla?.config?.set?.('page', sdkPage);\n // The SDK script can run after hydration; it must have the page before it is ready.\n if (window.salla?.config?.set) push();\n else window.addEventListener('salla::created', push, { once: true });\n\n const view = router.state.location.state?.key ?? router.state.location.href;\n if (page.slug !== RouteId.PRODUCT_SINGLE || !data.product) {\n lastProductView = undefined;\n } else if (view !== lastProductView) {\n lastProductView = view;\n dispatchProductViewed(data.product);\n }\n}\n\n/**\n * Options for creating the TanStack Router instance.\n */\nexport interface CreateRouterOptions {\n defaultPendingComponent?: (() => ReactNode) | false;\n defaultPendingMs?: number;\n defaultPendingMinMs?: number;\n defaultStaleTime?: number;\n history?: RouterHistory;\n}\n\n/**\n * Creates and configures the TanStack Router instance for the Twilight theme.\n *\n * This router is pre-configured with:\n * - Route tree generated by the TanStack Router plugin\n * - Intent-based preload for better performance\n * - Scroll restoration for better UX\n * - Locale-aware default NotFoundPage (redirects `/cart` → `/ar/cart`)\n * - Trailing slash normalization for consistent URL handling\n * - Page skeleton shown during route transitions (via `defaultPendingComponent`)\n * - SSR query integration for Cloudflare compatibility\n *\n * @param routeTree - The generated route tree from the consuming project\n * @param options - Optional overrides for pending component behavior\n * @returns Configured TanStack Router instance\n */\nexport function createRouter(routeTree: any, options?: CreateRouterOptions) {\n setHeadAdapter(tanstackHeadAdapter);\n\n const {\n defaultPendingComponent: pendingOpt,\n defaultPendingMs = 100,\n defaultPendingMinMs = 200,\n defaultStaleTime = Infinity,\n history,\n } = options ?? {};\n\n const pendingComponent =\n pendingOpt === false ? undefined : (pendingOpt ?? (() => <PageSkeleton />));\n\n const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60_000,\n gcTime: 5 * 60_000,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n mutations: {\n retry: 0,\n },\n dehydrate: {\n shouldDehydrateQuery,\n },\n },\n });\n\n // Store queryClient in the holder for access by loaders via getTwilightContext()\n updateTwilightContext({ queryClient });\n\n // On a host that serves many stores, the store is a segment of every URL: the\n // first one on the preview host, the one after the locale on a Salla shared\n // host. The router carries it instead of the route tree: it is stripped before\n // matching and added to every href the router builds. Decided per request on\n // the server, and taken from what SSR published in the browser.\n const storeBase = resolveStoreBase();\n\n const router = createTanStackRouter({\n routeTree,\n ...(history ? { history } : {}),\n ...(storeBase ? { rewrite: storeBaseRewrite(storeBase, resolveStoreBaseFollowsLocale()) } : {}),\n context: {\n queryClient,\n setLocation: (location: Partial<TwilightLocation>) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n updateTwilightContext({ location } as any);\n },\n },\n defaultPreload: 'intent',\n scrollRestoration: true,\n scrollRestorationBehavior: 'instant',\n trailingSlash: 'never',\n stringifySearch,\n defaultStaleTime,\n defaultNotFoundComponent: () => (\n <Suspense fallback={<PageSkeleton />}>\n <LazyNotFoundPage />\n </Suspense>\n ),\n defaultPendingComponent: pendingComponent,\n defaultPendingMs,\n defaultPendingMinMs,\n defaultErrorComponent: DefaultErrorComponent,\n });\n\n answerMissingResourcesWithNotFound(router);\n\n // Setup SSR query integration (native, with incremental streaming)\n setupRouterSsrQueryIntegration({ router, queryClient });\n\n // Setup Twilight SSR integration — populates the module store from\n // dehydrated match context BEFORE head functions re-run on the client.\n // This mirrors how setupRouterSsrQueryIntegration hydrates QueryClient.\n setupTwilightSsrIntegration(router, queryClient);\n\n // Subscribe to navigation events to sync location and routeId\n function syncNavigationState() {\n const state = router?.state;\n if (!state?.location) return;\n\n const loc = state.location;\n updateTwilightContext({\n location: {\n href: loc.href,\n pathname: loc.pathname,\n search: loc.search as Record<string, unknown>,\n searchStr: loc.searchStr,\n state: loc.state as unknown as Record<string, unknown>,\n hash: loc.hash,\n },\n });\n\n const matches = state.matches;\n const leafMatch = matches[matches.length - 1];\n if (leafMatch?.routeId) {\n const semanticId = resolveRouteId(leafMatch.routeId as string);\n updateTwilightContext({ routeId: semanticId });\n }\n\n const rootMatch = state.matches[0];\n if (rootMatch?.context) {\n const ctx = rootMatch.context as BeforeLoadResult;\n if (ctx?.settings) {\n updateTwilightContext({ settings: ctx.settings, locale: ctx.locale });\n }\n }\n }\n\n // Extract page from matches as soon as loaders complete (before components mount),\n // so useTwilightInit's useEffect sees page data when it calls sdk.init().\n router.subscribe('onLoad', () => syncPageFromMatches(router));\n // A direct load resolves through hydration, which emits no onLoad; its first render does emit onRendered.\n router.subscribe('onRendered', () => syncPageFromMatches(router));\n\n // Sync location, routeId, and settings after navigation fully resolves\n router.subscribe('onResolved', () => {\n syncNavigationState();\n dispatchRouteChanged();\n });\n\n return router;\n}\n\ndeclare module '@tanstack/react-router' {\n interface Register {\n router: ReturnType<typeof createRouter>;\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Required by TanStack Router module augmentation pattern\n interface RouterContext extends RouterInitialContext {}\n}\n","import { useRouterState } from '@tanstack/react-router';\nimport {\n mergeElementAttrs,\n toReactProps,\n type DocumentElementDescriptor,\n} from '../utils/document-class';\nimport { useDocumentClass } from '../hooks/useDocumentClass';\nimport { updateTwilightContext, type PageContext } from '../twilight/context';\nimport { resolveRouteId } from './router';\n\n// ============================================================================\n// Route → body class map (mirrors PHP Route2Class::generateClassString)\n// Keyed by TanStack Router route ID (the path passed to createFileRoute).\n// null = intentionally classless (e.g. root layout routes).\n// ============================================================================\n\nconst ROUTE_CLASS_MAP: Record<string, string | null> = {\n '/{-$locale}/': 'index',\n '/{-$locale}/cart': 'cart',\n '/{-$locale}/$slug/c{$id}': 'product-index',\n '/{-$locale}/offers': 'product-index-offers',\n '/{-$locale}/products': 'product-index',\n '/{-$locale}/latest-products': 'product-index-latest',\n '/{-$locale}/most-sales-products': 'product-index-sales',\n '/{-$locale}/search': 'product-index-search',\n '/{-$locale}/$slug/tag-{$id}': 'product-index-tag',\n '/{-$locale}/tags/$id': 'product-index-tag',\n '/{-$locale}/$slug/p{$id}': 'product-single',\n '/{-$locale}/$slug/page-{$id}': 'page-single',\n '/{-$locale}/page/$slug': 'page-single',\n '/{-$locale}/p/$slug': 'page-single',\n '/{-$locale}/thankyou/$orderId': 'thank-you',\n '/{-$locale}/orders': 'customer-orders-index',\n '/{-$locale}/pending-orders': 'customer-orders-index-pending', // redirect to /account/orders?status=pending\n '/{-$locale}/account/pending_orders': 'customer-orders-index-pending',\n '/{-$locale}/account/rating': 'customer-orders-index', // redirect to /account/orders\n '/{-$locale}/order/$id': 'customer-orders-single',\n '/{-$locale}/profile': 'customer-profile',\n '/{-$locale}/wallet': 'customer-wallet',\n '/{-$locale}/wishlist': 'customer-wishlist',\n '/{-$locale}/notifications': 'customer-notifications',\n '/{-$locale}/testimonials': 'testimonials',\n '/{-$locale}/reviews': 'reviews',\n '/{-$locale}/brands': 'brands-index',\n '/{-$locale}/brands/$id': 'brands-single',\n '/{-$locale}/$slug/brand-{$id}': 'brands-single',\n '/{-$locale}/blog': 'blog-index',\n '/{-$locale}/blog/$slug/a-{$id}': 'blog-single',\n '/{-$locale}/blog/$slug/c-{$id}': 'blog-index-category',\n '/{-$locale}/blog/$slug/tag-{$id}': 'blog-index-tag',\n '/{-$locale}/blog/author/$id': 'blog-index-author',\n '/{-$locale}/loyalty': 'loyalty',\n '/{-$locale}/loyalty_points': 'customer-loyalty-points',\n};\n\n/** `/products?source=` keeps the Twig class of the old listing URL. */\nconst PRODUCTS_SOURCE_CLASS: Record<string, string> = {\n latest: 'product-index-latest',\n sales: 'product-index-sales',\n offers: 'product-index-offers',\n};\n\nfunction routeClassOf(matches: Array<{ routeId: string; search?: unknown }>): string | null {\n for (let i = matches.length - 1; i >= 0; i--) {\n const { routeId, search } = matches[i];\n if (routeId === '/{-$locale}/products') {\n const source = (search as { source?: unknown } | undefined)?.source;\n return typeof source === 'string' && Object.hasOwn(PRODUCTS_SOURCE_CLASS, source)\n ? PRODUCTS_SOURCE_CLASS[source]\n : 'product-index';\n }\n if (routeId in ROUTE_CLASS_MAP) return ROUTE_CLASS_MAP[routeId];\n }\n return null;\n}\n\n// ============================================================================\n// RouteDocumentSync — resolves body class from active route ID at runtime.\n// ============================================================================\n\n/**\n * Applies the per-route body class by looking up the deepest active route ID\n * in the built-in route→class map.\n *\n * For custom routes not in the built-in map, use `useDocumentClass` directly\n * inside your route component.\n *\n * Note: This will throw if rendered outside a TanStack Router context.\n * Use TanStackDocumentSync for safe usage inside TwilightProvider.\n */\nexport function RouteDocumentSync(): null {\n const matches = useRouterState({ select: (s) => s.matches });\n\n const routeClass = routeClassOf(matches);\n\n useDocumentClass(routeClass ? { body: { class: routeClass } } : {});\n return null;\n}\n\n/**\n * Safe version of RouteDocumentSync for use in TwilightProvider.\n * Handles being rendered outside a TanStack Router context gracefully.\n * Uses a wrapper component pattern to conditionally render hooks.\n */\nexport function TanStackDocumentSync(): null {\n const matches = useRouterState({ select: (s) => s.matches }) || [];\n\n // On the server routeId is never synced (onResolved is client-only), so useIsHome()\n // etc. disagree with the client and cause hydration mismatches. Sync it here — this\n // renders before the layout. Client already has it from onResolved.\n if (typeof window === 'undefined') {\n const leaf = matches[matches.length - 1];\n if (leaf?.routeId) {\n updateTwilightContext({ routeId: resolveRouteId(leaf.routeId as string) });\n }\n // The deepest loader's page, which the client syncs on load (`syncPageFromMatches`).\n const page = matches.reduceRight<PageContext | undefined>(\n (found, match) => found ?? (match.loaderData as { page?: PageContext } | undefined)?.page,\n undefined\n );\n if (page) updateTwilightContext({ page });\n }\n\n const routeClass = routeClassOf(matches);\n\n useDocumentClass(routeClass ? { body: { class: routeClass } } : {});\n return null;\n}\n\n// ============================================================================\n// Type augmentation — extend TanStack Router's staticData type\n// ============================================================================\n\ndeclare module '@tanstack/react-router' {\n interface StaticDataRouteOption {\n documentAttrs?: DocumentElementDescriptor;\n }\n}\n\nexport interface TanstackRouteStaticData {\n documentAttrs?: DocumentElementDescriptor;\n}\n\n// ============================================================================\n// useTanstackDocumentAttrs — for TanStack Start SSR root layouts\n// ============================================================================\n\n/**\n * Read and merge `<body>` / `<html>` attributes from all currently active\n * route matches (via `staticData.documentAttrs`).\n *\n * Returns React-ready prop objects ready to spread onto `<html>` and `<body>`.\n */\nexport function useTanstackDocumentAttrs(): {\n bodyAttrs: Record<string, string>;\n htmlAttrs: Record<string, string>;\n} {\n const matches = useRouterState({ select: (s) => s.matches });\n\n const bodyDescriptors = matches.map(\n (m) => (m.staticData as TanstackRouteStaticData | undefined)?.documentAttrs?.body ?? {}\n );\n const htmlDescriptors = matches.map(\n (m) => (m.staticData as TanstackRouteStaticData | undefined)?.documentAttrs?.html ?? {}\n );\n\n return {\n bodyAttrs: toReactProps(mergeElementAttrs(bodyDescriptors)),\n htmlAttrs: toReactProps(mergeElementAttrs(htmlDescriptors)),\n };\n}\n\n/**\n * Pure adapter: converts a `DocumentElementDescriptor` to React-ready props.\n */\nexport function tanstackDocumentAdapter(descriptor: DocumentElementDescriptor): {\n bodyAttrs: Record<string, string>;\n htmlAttrs: Record<string, string>;\n} {\n return {\n bodyAttrs: toReactProps(mergeElementAttrs([descriptor.body ?? {}])),\n htmlAttrs: toReactProps(mergeElementAttrs([descriptor.html ?? {}])),\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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,OAAA;AAClF,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA;AAC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W,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-FHU2MXZA.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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/maintenance.ts"],"names":[],"mappings":";;;AAgBO,IAAM,yBAAA,GAA4B;AAEzC,IAAM,aAAA,GAAgB,CAAC,WAAA,EAAa,QAAQ,CAAA;AAG5C,SAAS,UAAU,QAAA,EAA0D;AAC3E,EAAA,MAAM,EAAA,GAAK,UAAU,KAAA,EAAO,EAAA;AAC5B,EAAA,OAAO,EAAA,IAAM,IAAA,GAAO,IAAA,GAAO,MAAA,CAAO,EAAE,CAAA;AACtC;AAOO,SAAS,gBAAA,CAAiB,MAAc,QAAA,EAAoD;AACjG,EAAA,MAAM,OAAA,GAAU,UAAU,QAAQ,CAAA;AAClC,EAAA,IAAI,CAAC,SAAS,OAAO,KAAA;AACrB,EAAA,IAAI,MAAA;AACJ,EAAA,IAAI;AACF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B;AAAA,MACnB,GAAG,OAAA;AAAA,MACH,YAAA,EAAc,WAAA;AAAA,MACd,iBAAA,EAAmB,WAAA;AAAA,MACnB,UAAA,EAAY;AAAA;AACd,GACF;AACF","file":"chunk-FID76MUV.js","sourcesContent":["import type { StoreContext } from '../api/store';\nimport type { MaintenanceDetails } from '../types';\nimport { extractTokenFromCookies } from './cookies';\n\n/**\n * Remembers that this browser is the merchant looking at their own closed store.\n *\n * The dashboard's \"view store\" link carries `?utm_source=dashboard&identifier=<store id>`\n * (`portal` for the partners portal). Twig's backend checks that once, keeps\n * `view-as: owner` in the PHP session and lets every later request through; this\n * cookie is that session entry. No `max-age`: a session cookie, as the PHP session\n * was, so closing the browser ends the owner view.\n *\n * The value is the store id the bypass was granted for, checked against the store\n * the settings answer about, so one store's cookie opens no other store.\n */\nexport const VIEW_AS_OWNER_COOKIE_NAME = 'salla_view_as';\n\nconst OWNER_SOURCES = ['dashboard', 'portal'];\n\n/** The id as the URL and the cookie spell it, or null when the settings name none. */\nfunction storeIdOf(settings: StoreContext | null | undefined): string | null {\n const id = settings?.store?.id;\n return id == null ? null : String(id);\n}\n\n/**\n * Whether `href` is the dashboard's link into the merchant's own store:\n * `utm_source` is `dashboard` or `portal`, and `identifier` is this store's id.\n * The backend's own rule, translated.\n */\nexport function ownerLinkMatches(href: string, settings: StoreContext | null | undefined): boolean {\n const storeId = storeIdOf(settings);\n if (!storeId) return false;\n let params: URLSearchParams;\n try {\n params = new URL(href, 'http://localhost').searchParams;\n } catch {\n return false;\n }\n const source = params.get('utm_source');\n return source != null && OWNER_SOURCES.includes(source) && params.get('identifier') === storeId;\n}\n\n/** Whether the cookie remembers an owner view of this store. */\nexport function ownerCookieMatches(\n cookieHeader: string | null,\n settings: StoreContext | null | undefined\n): boolean {\n const storeId = storeIdOf(settings);\n return !!storeId && extractTokenFromCookies(cookieHeader, VIEW_AS_OWNER_COOKIE_NAME) === storeId;\n}\n\n/**\n * Whether this visitor gets the maintenance page instead of the store.\n *\n * True only when the settings say the store is closed and nothing lets the visitor\n * through: neither an owner view (the link or the cookie) nor the theme editor's\n * preview, which the backend also always lets in.\n */\nexport function showsMaintenancePage(\n settings: StoreContext | null | undefined,\n viewAsOwner: boolean\n): boolean {\n return settings?.maintenance === true && !viewAsOwner && settings.theme?.mode !== 'preview';\n}\n\n/**\n * The response header a maintenance 503 carries saying which settings decided it.\n *\n * Theme workers write no logs, and the dispatcher's line for a 5xx records the\n * answer's own `x-trace-id` and this header, so the evidence travels on the answer.\n * The backend sets `maintenance` from store-wide state alone (closed, not launched,\n * or the market in maintenance), so `request-id` and `trace` find the settings\n * request it logged, and `cache`/`age` say whether this was a cached copy of one.\n */\nexport const MAINTENANCE_EVIDENCE_HEADER = 'x-twilight-maintenance';\n\n/**\n * What the maintenance decision rested on, as `key=value` pairs. Ids and the API's\n * own header values only: nothing a visitor typed, nothing that identifies them.\n */\nexport function maintenanceEvidence(\n settings: StoreContext | null | undefined\n): Record<string, string> {\n const evidence: Record<string, string> = {};\n if (!settings) return evidence;\n for (const [key, read] of EVIDENCE) {\n const value = read(settings);\n if (value != null && value !== '') evidence[key] = String(value);\n }\n return evidence;\n}\n\nconst EVIDENCE: [string, (settings: StoreContext) => unknown][] = [\n ['store', (s) => s.store?.id],\n ['scope', (s) => s.store?.scope?.id],\n ['requested-scope', (s) => s.requestedScopeId],\n ['mode', (s) => s.theme?.mode],\n ['request-id', (s) => s.answer?.requestId],\n ['trace', (s) => s.answer?.traceId],\n ['cache', (s) => s.answer?.cacheStatus],\n ['age', (s) => s.answer?.age],\n];\n\n/** {@link maintenanceEvidence} as one header value: `store=1; scope=2; cache=HIT`. */\nexport function maintenanceEvidenceHeader(evidence: Record<string, string>): string {\n return Object.entries(evidence)\n .map(([key, value]) => `${key}=${value.replace(/[^\\x21-\\x7e]/g, '')}`)\n .join('; ');\n}\n\n// todo:: drop both once the backend sends `dashboard_url` (or the filled `button_*`) in the\n// settings; until then this mirrors `config('salla.app.dashboard_url')` and the path Twig's\n// `StoreStatusAlertWidget` appends for the owner.\nconst DASHBOARD_URL = 'https://s.salla.sa';\n\n/** The dashboard page where the merchant turns maintenance mode off, as the backend links it. */\nexport const MAINTENANCE_SETTINGS_URL = `${DASHBOARD_URL}/channel/settings?legacy=0#maintenance-mode`;\n\n/**\n * Whether the notice is the one the backend sends for a store that has not launched yet.\n *\n * The settings carry no `launched` flag: a store whose `store::launched` setting is `0`\n * gets `maintenance: true` and `StoreStatusAlertWidget::getData(true)`, the merchant's\n * \"finish launching\" notice, whose button goes to the dashboard's root, and it goes\n * there for every visitor. A closed store's notice links nowhere for a customer and to\n * {@link MAINTENANCE_SETTINGS_URL} for the owner, so the bare dashboard URL tells them\n * apart, as Twig's `CheckStoreStatus` does by rendering `construction` instead of\n * `maintenance`.\n */\n// todo:: read the backend's own flag once the settings send one.\nexport function isNotLaunchedNotice(details: MaintenanceDetails | null | undefined): boolean {\n return details?.button_url?.replace(/\\/+$/, '') === DASHBOARD_URL;\n}\n\n/**\n * The button on the SDK's merchant maintenance bar. The API fills the `button_*`\n * fields only inside Twig's owner session, which the engine's settings request has\n * none of, so the SDK, handed the settings as they are, draws an empty button. The\n * SDK renders only in the store view, so `maintenance: true` there means the owner\n * (or the preview, where the SDK mounts no bar): the three fields get what Twig's\n * owner branch gives them. The merchant's own title and message stay as they are.\n */\nexport function withOwnerMaintenanceButton<\n T extends Pick<StoreContext, 'maintenance' | 'maintenance_details'>,\n>(settings: T, buttonTitle: string): T {\n const details = settings.maintenance_details;\n if (settings.maintenance !== true || details?.button_title) return settings;\n return {\n ...settings,\n maintenance_details: {\n ...details,\n button_title: buttonTitle,\n button_full_title: buttonTitle,\n button_url: MAINTENANCE_SETTINGS_URL,\n },\n };\n}\n"]}
|
package/dist/chunk-JYEUOEEI.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { lazy } from 'react';
|
|
2
|
-
|
|
3
|
-
// src/components/cart/lazy.ts
|
|
4
|
-
var LazyCartItem = lazy(() => import('./CartItem-CI2XOVRH.js').then((m) => ({ default: m.CartItem })));
|
|
5
|
-
var LazyCartSummary = lazy(
|
|
6
|
-
() => import('./CartSummary-EQOBVLXK.js').then((m) => ({ default: m.CartSummary }))
|
|
7
|
-
);
|
|
8
|
-
var LazySeoCartWidget = lazy(
|
|
9
|
-
() => import('./SeoCartWidget-ZU3ZZRQB.js').then((m) => ({ default: m.SeoCartWidget }))
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export { LazyCartItem, LazyCartSummary, LazySeoCartWidget };
|
|
13
|
-
//# sourceMappingURL=chunk-JYEUOEEI.js.map
|
|
14
|
-
//# sourceMappingURL=chunk-JYEUOEEI.js.map
|