@salla.sa/twilight-theme-engine 1.0.187 → 1.0.188
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-G4US2K7W.js → AddToCartForm-3STDRYGB.js} +3 -3
- package/dist/{AddToCartForm-G4US2K7W.js.map → AddToCartForm-3STDRYGB.js.map} +1 -1
- package/dist/{BlogAuthorPage-222QDUPB.js → BlogAuthorPage-Q7FTVCGB.js} +20 -20
- package/dist/{BlogAuthorPage-222QDUPB.js.map → BlogAuthorPage-Q7FTVCGB.js.map} +1 -1
- package/dist/{BlogCategoryPage-NHFUGGXZ.js → BlogCategoryPage-IWZPMWUP.js} +20 -20
- package/dist/{BlogCategoryPage-NHFUGGXZ.js.map → BlogCategoryPage-IWZPMWUP.js.map} +1 -1
- package/dist/{BlogPage-J3EMWHJL.js → BlogPage-XZ47JZLY.js} +18 -18
- package/dist/{BlogPage-J3EMWHJL.js.map → BlogPage-XZ47JZLY.js.map} +1 -1
- package/dist/{BlogSinglePage-S3ZVQB4O.js → BlogSinglePage-HMJDK2RC.js} +18 -18
- package/dist/{BlogSinglePage-S3ZVQB4O.js.map → BlogSinglePage-HMJDK2RC.js.map} +1 -1
- package/dist/{BlogTagPage-WMO6LP6V.js → BlogTagPage-ZZ23AZOY.js} +20 -20
- package/dist/{BlogTagPage-WMO6LP6V.js.map → BlogTagPage-ZZ23AZOY.js.map} +1 -1
- package/dist/{BrandsPage-N77PNHAY.js → BrandsPage-U7M56AKW.js} +19 -19
- package/dist/{BrandsPage-N77PNHAY.js.map → BrandsPage-U7M56AKW.js.map} +1 -1
- package/dist/{Breadcrumb-CH35SNV3.js → Breadcrumb-XA7NJB3I.js} +18 -18
- package/dist/{Breadcrumb-CH35SNV3.js.map → Breadcrumb-XA7NJB3I.js.map} +1 -1
- package/dist/{CanvasOverlay-OTXDNGBZ.js → CanvasOverlay-FLWFB5TF.js} +4 -4
- package/dist/{CanvasOverlay-OTXDNGBZ.js.map → CanvasOverlay-FLWFB5TF.js.map} +1 -1
- package/dist/{CartItem-UPANY4SI.js → CartItem-MJZICIQM.js} +18 -18
- package/dist/{CartItem-UPANY4SI.js.map → CartItem-MJZICIQM.js.map} +1 -1
- package/dist/{CartSummary-CSNEFF4A.js → CartSummary-APN6RTOS.js} +18 -18
- package/dist/{CartSummary-CSNEFF4A.js.map → CartSummary-APN6RTOS.js.map} +1 -1
- package/dist/{Copyright-6GQAFJLC.js → Copyright-U6U5KPNW.js} +3 -3
- package/dist/{Copyright-6GQAFJLC.js.map → Copyright-U6U5KPNW.js.map} +1 -1
- package/dist/{CustomerLayout-FHYJ2LCS.js → CustomerLayout-CH5D5TNX.js} +18 -18
- package/dist/{CustomerLayout-FHYJ2LCS.js.map → CustomerLayout-CH5D5TNX.js.map} +1 -1
- package/dist/{Footer-AZZTIGG2.js → Footer-T3RCIAQT.js} +3 -3
- package/dist/{Footer-AZZTIGG2.js.map → Footer-T3RCIAQT.js.map} +1 -1
- package/dist/GoogleTag-VD4JMT3L.js +15 -0
- package/dist/{GoogleTag-UYTAI5BS.js.map → GoogleTag-VD4JMT3L.js.map} +1 -1
- package/dist/{Header-QMMLLHII.js → Header-7L6OXYSP.js} +8 -8
- package/dist/{Header-QMMLLHII.js.map → Header-7L6OXYSP.js.map} +1 -1
- package/dist/{LatestProducts-NRHWV3GJ.js → LatestProducts-XE7IRB5G.js} +20 -20
- package/dist/{LatestProducts-NRHWV3GJ.js.map → LatestProducts-XE7IRB5G.js.map} +1 -1
- package/dist/{LiveEditorBar-3AL2IGTL.js → LiveEditorBar-4C7Z7K3M.js} +3 -3
- package/dist/{LiveEditorBar-3AL2IGTL.js.map → LiveEditorBar-4C7Z7K3M.js.map} +1 -1
- package/dist/{LoyaltyPage-HWQSXH75.js → LoyaltyPage-P7CY3NDD.js} +18 -18
- package/dist/{LoyaltyPage-HWQSXH75.js.map → LoyaltyPage-P7CY3NDD.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-6WAVG4LY.js → LoyaltyPointsPage-ONKOWZG3.js} +6 -6
- package/dist/{LoyaltyPointsPage-6WAVG4LY.js.map → LoyaltyPointsPage-ONKOWZG3.js.map} +1 -1
- package/dist/{MainMenu-SLR7KZNZ.js → MainMenu-TDEMIAVE.js} +5 -5
- package/dist/{MainMenu-SLR7KZNZ.js.map → MainMenu-TDEMIAVE.js.map} +1 -1
- package/dist/{MasterLayout-WRDTHUZD.js → MasterLayout-HTDOBN3V.js} +18 -18
- package/dist/{MasterLayout-WRDTHUZD.js.map → MasterLayout-HTDOBN3V.js.map} +1 -1
- package/dist/{MobileMenu-N7XUYRY7.js → MobileMenu-E2Q4NACS.js} +19 -19
- package/dist/{MobileMenu-N7XUYRY7.js.map → MobileMenu-E2Q4NACS.js.map} +1 -1
- package/dist/{NotificationsPage-D3M5HSOT.js → NotificationsPage-7PCULMIT.js} +18 -18
- package/dist/{NotificationsPage-D3M5HSOT.js.map → NotificationsPage-7PCULMIT.js.map} +1 -1
- package/dist/{OrderSinglePage-SJGZX2PX.js → OrderSinglePage-Z26AYA2A.js} +19 -19
- package/dist/{OrderSinglePage-SJGZX2PX.js.map → OrderSinglePage-Z26AYA2A.js.map} +1 -1
- package/dist/{OrdersPage-SVAHMVKY.js → OrdersPage-KVFEL4GF.js} +18 -18
- package/dist/{OrdersPage-SVAHMVKY.js.map → OrdersPage-KVFEL4GF.js.map} +1 -1
- package/dist/{PageSingle-FC6OZBXQ.js → PageSingle-4BOTNKBG.js} +3 -3
- package/dist/{PageSingle-FC6OZBXQ.js.map → PageSingle-4BOTNKBG.js.map} +1 -1
- package/dist/{ProductDetails-GJQH2SYY.js → ProductDetails-U3JJQ3QA.js} +5 -5
- package/dist/{ProductDetails-GJQH2SYY.js.map → ProductDetails-U3JJQ3QA.js.map} +1 -1
- package/dist/{ProfilePage-OWWPOUBQ.js → ProfilePage-PVV5HUN7.js} +18 -18
- package/dist/{ProfilePage-OWWPOUBQ.js.map → ProfilePage-PVV5HUN7.js.map} +1 -1
- package/dist/{ReviewsPage-7BUBNVNY.js → ReviewsPage-P7C2DYNY.js} +3 -3
- package/dist/{ReviewsPage-7BUBNVNY.js.map → ReviewsPage-P7C2DYNY.js.map} +1 -1
- package/dist/{SeoCartWidget-L6BGLQ5D.js → SeoCartWidget-CH6ZDLJF.js} +18 -18
- package/dist/{SeoCartWidget-L6BGLQ5D.js.map → SeoCartWidget-CH6ZDLJF.js.map} +1 -1
- package/dist/{SettingsPage-Q5IDLYYH.js → SettingsPage-J3CFXCXM.js} +18 -18
- package/dist/{SettingsPage-Q5IDLYYH.js.map → SettingsPage-J3CFXCXM.js.map} +1 -1
- package/dist/{StoreClosedNotification-N7CYMV76.js → StoreClosedNotification-JD52A2L7.js} +19 -19
- package/dist/{StoreClosedNotification-N7CYMV76.js.map → StoreClosedNotification-JD52A2L7.js.map} +1 -1
- package/dist/{TestimonialsPage-7PJLORJ3.js → TestimonialsPage-YVNTJCVN.js} +3 -3
- package/dist/{TestimonialsPage-7PJLORJ3.js.map → TestimonialsPage-YVNTJCVN.js.map} +1 -1
- package/dist/{ThankYouPage-52YKBIXF.js → ThankYouPage-L3VVD4L4.js} +18 -18
- package/dist/{ThankYouPage-52YKBIXF.js.map → ThankYouPage-L3VVD4L4.js.map} +1 -1
- package/dist/{WalletPage-EWRWZM7U.js → WalletPage-VQRX53I7.js} +19 -19
- package/dist/{WalletPage-EWRWZM7U.js.map → WalletPage-VQRX53I7.js.map} +1 -1
- package/dist/{WebMcpTools-4M2KPD5D.js → WebMcpTools-5ZOYZK6M.js} +5 -5
- package/dist/{WebMcpTools-4M2KPD5D.js.map → WebMcpTools-5ZOYZK6M.js.map} +1 -1
- package/dist/{WishlistPage-YI3BJJBG.js → WishlistPage-INPQNNN6.js} +20 -20
- package/dist/{WishlistPage-YI3BJJBG.js.map → WishlistPage-INPQNNN6.js.map} +1 -1
- package/dist/api/advertisement.js +2 -2
- package/dist/api/apps.js +2 -2
- package/dist/api/blog.js +3 -3
- package/dist/api/brands.js +3 -3
- package/dist/api/cart.js +3 -3
- package/dist/api/category.js +3 -3
- package/dist/api/client.js +1 -1
- package/dist/api/custom-url.js +2 -2
- package/dist/api/home.js +2 -2
- package/dist/api/loyalty.js +3 -3
- package/dist/api/menu.js +2 -2
- package/dist/api/notification.js +2 -2
- package/dist/api/order.js +3 -3
- package/dist/api/page.js +3 -3
- package/dist/api/product.js +3 -3
- package/dist/api/profile.js +1 -1
- package/dist/api/store.js +2 -2
- package/dist/api/translations.js +2 -2
- package/dist/api/user.js +2 -2
- package/dist/api/wallet.js +2 -2
- package/dist/api/wishlist.js +4 -4
- package/dist/{chunk-EIDJUUBN.js → chunk-2H74264G.js} +5 -5
- package/dist/{chunk-EIDJUUBN.js.map → chunk-2H74264G.js.map} +1 -1
- package/dist/{chunk-ZYL6NQ75.js → chunk-2KDWKQTC.js} +3 -3
- package/dist/{chunk-ZYL6NQ75.js.map → chunk-2KDWKQTC.js.map} +1 -1
- package/dist/{chunk-VYPVJ4C6.js → chunk-2TRSXLGJ.js} +5 -5
- package/dist/{chunk-VYPVJ4C6.js.map → chunk-2TRSXLGJ.js.map} +1 -1
- package/dist/{chunk-ZCD73EGZ.js → chunk-36DUIP2H.js} +4 -4
- package/dist/{chunk-ZCD73EGZ.js.map → chunk-36DUIP2H.js.map} +1 -1
- package/dist/{chunk-2XVF3P7U.js → chunk-3UZXUVVO.js} +4 -4
- package/dist/{chunk-2XVF3P7U.js.map → chunk-3UZXUVVO.js.map} +1 -1
- package/dist/{chunk-WZDQRIFK.js → chunk-4CEURRWI.js} +4 -4
- package/dist/{chunk-WZDQRIFK.js.map → chunk-4CEURRWI.js.map} +1 -1
- package/dist/{chunk-RRJZJHZK.js → chunk-4DEJOPG6.js} +3 -3
- package/dist/{chunk-RRJZJHZK.js.map → chunk-4DEJOPG6.js.map} +1 -1
- package/dist/{chunk-V33YXUJZ.js → chunk-54DG7FCT.js} +7 -7
- package/dist/{chunk-V33YXUJZ.js.map → chunk-54DG7FCT.js.map} +1 -1
- package/dist/{chunk-J3456BT4.js → chunk-5PEBHTHI.js} +7 -7
- package/dist/{chunk-J3456BT4.js.map → chunk-5PEBHTHI.js.map} +1 -1
- package/dist/{chunk-NB5A65PP.js → chunk-6SD5P2T5.js} +5 -5
- package/dist/{chunk-NB5A65PP.js.map → chunk-6SD5P2T5.js.map} +1 -1
- package/dist/{chunk-FKXP7SNP.js → chunk-7BSJCVUD.js} +28 -15
- package/dist/chunk-7BSJCVUD.js.map +1 -0
- package/dist/{chunk-KZ3MXRA7.js → chunk-7J52H4P2.js} +7 -7
- package/dist/{chunk-KZ3MXRA7.js.map → chunk-7J52H4P2.js.map} +1 -1
- package/dist/{chunk-7SVJZ6VQ.js → chunk-A563ZHY5.js} +3 -3
- package/dist/{chunk-7SVJZ6VQ.js.map → chunk-A563ZHY5.js.map} +1 -1
- package/dist/{chunk-TLE6US5E.js → chunk-BGB557LQ.js} +14 -14
- package/dist/{chunk-TLE6US5E.js.map → chunk-BGB557LQ.js.map} +1 -1
- package/dist/{chunk-3QTCAC7A.js → chunk-BHPDI7AZ.js} +4 -4
- package/dist/{chunk-3QTCAC7A.js.map → chunk-BHPDI7AZ.js.map} +1 -1
- package/dist/{chunk-K7F7U5NR.js → chunk-BWL3QXOS.js} +4 -4
- package/dist/{chunk-K7F7U5NR.js.map → chunk-BWL3QXOS.js.map} +1 -1
- package/dist/{chunk-NUURM3QI.js → chunk-C42YDY5K.js} +3 -3
- package/dist/{chunk-NUURM3QI.js.map → chunk-C42YDY5K.js.map} +1 -1
- package/dist/{chunk-OTJ3K76X.js → chunk-CNN757MD.js} +4 -4
- package/dist/{chunk-OTJ3K76X.js.map → chunk-CNN757MD.js.map} +1 -1
- package/dist/{chunk-A3NSQLNV.js → chunk-E2HCPUBR.js} +3 -3
- package/dist/{chunk-A3NSQLNV.js.map → chunk-E2HCPUBR.js.map} +1 -1
- package/dist/{chunk-NEPSTGF6.js → chunk-GEB5BQHO.js} +4 -4
- package/dist/{chunk-NEPSTGF6.js.map → chunk-GEB5BQHO.js.map} +1 -1
- package/dist/{chunk-3MCICPB3.js → chunk-GSS3JLFP.js} +4 -4
- package/dist/{chunk-3MCICPB3.js.map → chunk-GSS3JLFP.js.map} +1 -1
- package/dist/{chunk-E5HZTOWZ.js → chunk-I6EEFDD2.js} +20 -20
- package/dist/{chunk-E5HZTOWZ.js.map → chunk-I6EEFDD2.js.map} +1 -1
- package/dist/{chunk-XN6OZJHX.js → chunk-JPMQPU72.js} +3 -3
- package/dist/{chunk-XN6OZJHX.js.map → chunk-JPMQPU72.js.map} +1 -1
- package/dist/{chunk-NMVC5IGS.js → chunk-JPZTLP7F.js} +3 -3
- package/dist/{chunk-NMVC5IGS.js.map → chunk-JPZTLP7F.js.map} +1 -1
- package/dist/{chunk-3NFAXTIG.js → chunk-KF7UMG3F.js} +3 -3
- package/dist/{chunk-3NFAXTIG.js.map → chunk-KF7UMG3F.js.map} +1 -1
- package/dist/{chunk-XK2T6G6A.js → chunk-M5TB3ZJ4.js} +4 -4
- package/dist/{chunk-XK2T6G6A.js.map → chunk-M5TB3ZJ4.js.map} +1 -1
- package/dist/{chunk-CKQGZDW7.js → chunk-MBXI7567.js} +3 -3
- package/dist/{chunk-CKQGZDW7.js.map → chunk-MBXI7567.js.map} +1 -1
- package/dist/{chunk-KHIEGO2C.js → chunk-NEMLRRIS.js} +3 -3
- package/dist/{chunk-KHIEGO2C.js.map → chunk-NEMLRRIS.js.map} +1 -1
- package/dist/{chunk-SGEJUTTK.js → chunk-NWMTGBCN.js} +3 -3
- package/dist/{chunk-SGEJUTTK.js.map → chunk-NWMTGBCN.js.map} +1 -1
- package/dist/{chunk-MQ6TJ4AJ.js → chunk-NWT2ZWNM.js} +3 -3
- package/dist/{chunk-MQ6TJ4AJ.js.map → chunk-NWT2ZWNM.js.map} +1 -1
- package/dist/{chunk-VUQICWEC.js → chunk-PJJQV3GW.js} +6 -6
- package/dist/{chunk-VUQICWEC.js.map → chunk-PJJQV3GW.js.map} +1 -1
- package/dist/{chunk-25NSKD6D.js → chunk-PLDWDVOP.js} +3 -3
- package/dist/{chunk-25NSKD6D.js.map → chunk-PLDWDVOP.js.map} +1 -1
- package/dist/{chunk-HZ2YCYJ5.js → chunk-PLJ4L2KC.js} +4 -4
- package/dist/{chunk-HZ2YCYJ5.js.map → chunk-PLJ4L2KC.js.map} +1 -1
- package/dist/{chunk-XRZ43AAK.js → chunk-QDE37XJB.js} +4 -4
- package/dist/{chunk-XRZ43AAK.js.map → chunk-QDE37XJB.js.map} +1 -1
- package/dist/{chunk-WDIKLUO5.js → chunk-RBGCTWGJ.js} +4 -4
- package/dist/{chunk-WDIKLUO5.js.map → chunk-RBGCTWGJ.js.map} +1 -1
- package/dist/{chunk-A7VR5G2M.js → chunk-SFXQMG3D.js} +4 -4
- package/dist/{chunk-A7VR5G2M.js.map → chunk-SFXQMG3D.js.map} +1 -1
- package/dist/{chunk-35JSGMTO.js → chunk-SNTUACTC.js} +4 -4
- package/dist/{chunk-35JSGMTO.js.map → chunk-SNTUACTC.js.map} +1 -1
- package/dist/{chunk-NE5XQJLZ.js → chunk-SR4YSJAF.js} +3 -3
- package/dist/{chunk-NE5XQJLZ.js.map → chunk-SR4YSJAF.js.map} +1 -1
- package/dist/{chunk-YD7DCIWM.js → chunk-T4PRV2MJ.js} +3 -3
- package/dist/{chunk-YD7DCIWM.js.map → chunk-T4PRV2MJ.js.map} +1 -1
- package/dist/{chunk-BAVTAOPI.js → chunk-TJK4DVQM.js} +3 -2
- package/dist/chunk-TJK4DVQM.js.map +1 -0
- package/dist/{chunk-2SKYTGSD.js → chunk-UKLMGZZ2.js} +3 -3
- package/dist/{chunk-2SKYTGSD.js.map → chunk-UKLMGZZ2.js.map} +1 -1
- package/dist/{chunk-W43EOOMR.js → chunk-V2OR5VQ2.js} +3 -3
- package/dist/{chunk-W43EOOMR.js.map → chunk-V2OR5VQ2.js.map} +1 -1
- package/dist/{chunk-5F2LF3P4.js → chunk-V5AMXA5A.js} +4 -4
- package/dist/{chunk-5F2LF3P4.js.map → chunk-V5AMXA5A.js.map} +1 -1
- package/dist/{chunk-XWHSTFSB.js → chunk-VBZIFYQ7.js} +3 -3
- package/dist/{chunk-XWHSTFSB.js.map → chunk-VBZIFYQ7.js.map} +1 -1
- package/dist/{chunk-UVUG2YMJ.js → chunk-VGJMO6QS.js} +4 -4
- package/dist/{chunk-UVUG2YMJ.js.map → chunk-VGJMO6QS.js.map} +1 -1
- package/dist/{chunk-GZWEIGZP.js → chunk-VPGGPNSL.js} +3 -3
- package/dist/{chunk-GZWEIGZP.js.map → chunk-VPGGPNSL.js.map} +1 -1
- package/dist/{chunk-BG7GNCYV.js → chunk-X2SIGWUY.js} +3 -3
- package/dist/{chunk-BG7GNCYV.js.map → chunk-X2SIGWUY.js.map} +1 -1
- package/dist/{chunk-EFQJXQVA.js → chunk-X3GAERFK.js} +3 -3
- package/dist/{chunk-EFQJXQVA.js.map → chunk-X3GAERFK.js.map} +1 -1
- package/dist/{chunk-GUEKZN22.js → chunk-YJROW2HU.js} +4 -4
- package/dist/{chunk-GUEKZN22.js.map → chunk-YJROW2HU.js.map} +1 -1
- package/dist/{chunk-3QAVHZBT.js → chunk-YMNCGXFV.js} +3 -3
- package/dist/{chunk-3QAVHZBT.js.map → chunk-YMNCGXFV.js.map} +1 -1
- package/dist/{chunk-GIHEV2RT.js → chunk-Z4D5KQK5.js} +3 -3
- package/dist/{chunk-GIHEV2RT.js.map → chunk-Z4D5KQK5.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 +16 -16
- package/dist/components/home/index.js +21 -21
- package/dist/components/layout/index.js +4 -4
- package/dist/components/live-editor/moves.d.ts +2 -2
- package/dist/components/live-editor/moves.d.ts.map +1 -1
- package/dist/components/product/index.js +18 -18
- package/dist/components/store/index.js +17 -17
- package/dist/components/tracking/index.js +6 -6
- package/dist/{custom-urls-SBDPEIAR.js → custom-urls-2P3OJVMY.js} +7 -7
- package/dist/{custom-urls-SBDPEIAR.js.map → custom-urls-2P3OJVMY.js.map} +1 -1
- package/dist/dev/editor/index.js +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/{document-class-LPVE4BRZ.js → document-class-ERIBJEGK.js} +17 -17
- package/dist/{document-class-LPVE4BRZ.js.map → document-class-ERIBJEGK.js.map} +1 -1
- package/dist/hooks/index.js +16 -16
- package/dist/hooks/useGtm.js +16 -16
- package/dist/hooks/useMoney.js +16 -16
- package/dist/hooks/useStore.js +16 -16
- package/dist/hooks/useUser.js +3 -3
- package/dist/index.js +16 -16
- package/dist/{navigation-SCBNHPBD.js → navigation-HP5LIBNV.js} +5 -5
- package/dist/{navigation-SCBNHPBD.js.map → navigation-HP5LIBNV.js.map} +1 -1
- package/dist/{navigation-43FATW7U.js → navigation-O6I4V3JY.js} +4 -4
- package/dist/{navigation-43FATW7U.js.map → navigation-O6I4V3JY.js.map} +1 -1
- package/dist/{not-found-DW3ZCJZW.js → not-found-EVMN6AEW.js} +19 -19
- package/dist/{not-found-DW3ZCJZW.js.map → not-found-EVMN6AEW.js.map} +1 -1
- package/dist/providers/index.js +16 -16
- package/dist/routes/account/orders.js +4 -4
- package/dist/routes/account.js +13 -13
- package/dist/routes/blog.js +8 -8
- package/dist/routes/brands.js +4 -4
- package/dist/routes/cart.js +26 -26
- package/dist/routes/home/HomePage.d.ts +1 -1
- package/dist/routes/home/HomePage.d.ts.map +1 -1
- package/dist/routes/home/blockList.d.ts +4 -0
- package/dist/routes/home/blockList.d.ts.map +1 -0
- package/dist/routes/home/index.d.ts +1 -1
- package/dist/routes/home/loader.d.ts +5 -0
- package/dist/routes/home/loader.d.ts.map +1 -1
- package/dist/routes/home/types.d.ts +2 -0
- package/dist/routes/home/types.d.ts.map +1 -1
- package/dist/routes/home.js +22 -22
- package/dist/routes/index.js +8 -8
- package/dist/routes/lazy.d.ts +1 -1
- package/dist/routes/lazy.d.ts.map +1 -1
- package/dist/routes/loyalty.js +5 -5
- package/dist/routes/page.js +4 -4
- package/dist/routes/product-listing.js +26 -26
- package/dist/routes/product.js +25 -25
- package/dist/routes/seo-redirects.js +8 -8
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +4 -4
- package/dist/skeleton.js +24 -24
- package/dist/{store-lookup-5BYEW5GZ.js → store-lookup-RAKQFOTD.js} +8 -8
- package/dist/{store-lookup-5BYEW5GZ.js.map → store-lookup-RAKQFOTD.js.map} +1 -1
- package/dist/tanstack.js +17 -17
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/tailwind/components/live-editor/moves.ts.txt +3 -2
- package/tailwind/routes/home/HomePage.tsx.txt +11 -2
- package/tailwind/routes/home/blockList.ts.txt +6 -0
- package/tailwind/routes/home/loader.ts.txt +13 -6
- package/tailwind/routes/home/types.ts.txt +2 -0
- package/dist/GoogleTag-UYTAI5BS.js +0 -15
- package/dist/chunk-BAVTAOPI.js.map +0 -1
- package/dist/chunk-FKXP7SNP.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/analytics/gtm-page.ts"],"names":["user"],"mappings":";;;;;;;;AAuCO,IAAM,qBAAA,GAAwB;AAErC,IAAI,KAAA,GAAuB,QAAQ,OAAA,EAAQ;AAC3C,IAAI,iBAAA,GAAoB,KAAA;AACxB,IAAI,WAAA,GAA6B,IAAA;AACjC,IAAI,oBAAgC,MAAM;AAAC,CAAA;AAC3C,IAAI,gBAAgB,IAAI,OAAA,CAAc,CAAC,OAAA,KAAa,oBAAoB,OAAQ,CAAA;AAChF,IAAI,eAAA,GAAuC,IAAA;AAE3C,IAAI,eAAA,uBAAsB,GAAA,EAAY;AAG/B,SAAS,eAAA,GAAiC;AAC/C,EAAA,OAAO,aAAA;AACT;AAEA,SAAS,mBAAA,GAAgD;AACvD,EAAA,IAAI;AACF,IAAA,OAAO,oBAAmB,CAAE,QAAA;AAAA,EAC9B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AAC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AAI,CAAC,MAAM,OAAA,CAAQ,OAAA,EAAS,IAAI,CAAA,IAAK,OAAO,OAAA,CAAQ,OAAA,KAAY,SAAA,EAAW;AAC3E,IAAA,MAAM,WAAW,OAAA,CAAQ,IAAA;AACzB,IAAA,MAAM,WAAW,mBAAA,EAAoB;AACrC,IAAA,IAAI,CAAC,QAAA,CAAS,MAAA,IAAU,CAAC,UAAA,CAAW,QAAQ,CAAA,EAAG;AAE/C,IAAA,MAAM,cAAc,cAAA,CAAe,QAAA,EAAU,oBAAmB,CAAE,IAAA,IAAQ,QAAW,QAAQ,CAAA;AAC7F,IAAA,OAAA,CAAQ,MAAM;AACZ,MAAA,eAAA,CAAgB,EAAE,SAAA,EAAW,EAAE,WAAA,EAAa,IAAA,IAAQ,CAAA;AACpD,MAAA,eAAA,CAAgB,WAAW,CAAA;AAAA,IAC7B,CAAC,CAAA;AAAA,EACH,CAAC,CAAA;AACH","file":"chunk-A7VR5G2M.js","sourcesContent":["/**\n * The order a Twig page fills the data layer in, for a storefront that loads once.\n *\n * A Twig page opens with its own data (`page`, `store`, `customer`, and the page's ecommerce\n * block), then loads the containers, then hands the SDK `twilight::init` and each\n * `services::<name>.init`, which the SDK copies into the data layer. Tags fire on those events\n * and read the data pushed before them, so the order is the contract.\n *\n * Here the first page is pushed once its customer is known (the signed-in one loads in the\n * browser) and, on the cart, once the cart has; GTM waits for that push ({@link whenGtmPageData}).\n * Every later page pushes its own `page` and ecommerce block too, after clearing the previous\n * page's ecommerce (GTM merges objects into what it holds, arrays index by index). Those pages\n * load nothing, so they announce no services again: Salla's container would load its Google\n * tags and Clarity a second time. Every push the engine makes goes through one queue, so a\n * page's data is always in before its events.\n */\nimport type { Cart, Product, User } from '../../types';\nimport type { Order } from '../../routes/account/types';\nimport { user as userApi } from '../../api/user';\nimport type { StoreContext } from '../../api/store';\nimport { getTwilightContext, type PageContext } from '../../twilight/context';\nimport { isNativeApp } from '../../native-app';\nimport { RouteId } from '../../router/route-ids';\nimport { onSallaEvent, whenSallaLoaded } from '../../utils/sdk-helpers';\nimport {\n gtmCartCheckout,\n gtmCustomer,\n gtmDetail,\n gtmEnabled,\n gtmImpressions,\n gtmPage,\n gtmPurchase,\n gtmStore,\n pushToDataLayer,\n servicesInitEvents,\n type DataLayerEntry,\n} from './gtm';\n\n/** How long the first page waits for its customer or its cart before it is pushed without. */\nexport const GTM_PAGE_DATA_WAIT_MS = 3000;\n\nlet queue: Promise<void> = Promise.resolve();\nlet firstPageReported = false;\nlet previousUrl: string | null = null;\nlet markPageDataReady: () => void = () => {};\nlet pageDataReady = new Promise<void>((resolve) => (markPageDataReady = resolve));\nlet stopImpressions: (() => void) | null = null;\n/** Orders this document has pushed a `purchase` for, whether or not GTM has taken it yet. */\nlet purchasesPushed = new Set<string>();\n\n/** Resolves once the first page's data is in the data layer, as Twig's head pushes it before GTM. */\nexport function whenGtmPageData(): Promise<void> {\n return pageDataReady;\n}\n\nfunction settingsOrUndefined(): StoreContext | undefined {\n try {\n return getTwilightContext().settings;\n } catch {\n return undefined;\n }\n}\n\nfunction enqueue(task: () => void | Promise<void>): void {\n queue = queue.then(task).catch((error: unknown) => {\n console.warn('[gtm] Could not push to the data layer:', error);\n });\n}\n\nfunction withDeadline<T>(value: T | Promise<T>, fallback: T): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const deadline = new Promise<T>((resolve) => {\n timer = setTimeout(() => resolve(fallback), GTM_PAGE_DATA_WAIT_MS);\n });\n return Promise.race([Promise.resolve(value), deadline])\n .catch(() => fallback)\n .finally(() => clearTimeout(timer));\n}\n\n/** The signed-in customer, from the query `useUser` already loads; a guest has no token. */\nasync function currentUser(): Promise<User | null> {\n const { authToken, queryClient } = getTwilightContext();\n if (!authToken || !queryClient) return null;\n return withDeadline(\n queryClient.ensureQueryData(userApi.queries.current()).catch(() => null),\n null\n );\n}\n\n/** The Salla app's webview: the SDK knows once loaded, the settings carry the app's headers before. */\nfunction inNativeApp(settings: StoreContext | undefined): boolean {\n const os = settings?.jitsu?.context?.extra?.headers?.['s-app-os']?.toLowerCase();\n return os === 'ios' || os === 'android' || isNativeApp();\n}\n\n/**\n * The `user` Twig's `twilight::init` carries (the SDK's own config), as far as tags read it:\n * Salla's container identifies the customer to a chat service from `user.id` when that\n * service's `services::<name>.init` arrives, which is before the SDK pushes a user of its own.\n */\nfunction initUser(settings: StoreContext | undefined, user: User | null): DataLayerEntry {\n const visitor = settings?.user;\n return {\n id: user ? (user.id ?? null) : (visitor?.id ?? null),\n type: user ? 'user' : (visitor?.type ?? 'guest'),\n country_code: user?.country_code ?? visitor?.country_code,\n language_code: visitor?.language_code,\n currency_code: visitor?.currency_code,\n };\n}\n\n/** `twilight::init`, then each `services::<name>.init`, once per document, as Twig's page does. */\nfunction announceServices(settings: StoreContext | undefined, user: User | null): void {\n const snippetServices = (getTwilightContext().appsSnippets ?? []).map((app) => app.service);\n const events = servicesInitEvents(settings?.external_services, snippetServices);\n whenSallaLoaded((sdk) => {\n // The engine calls `salla.init` itself; Twig hands it the event, which the SDK records.\n pushToDataLayer({ event: 'twilight::init', user: initUser(settings, user) });\n for (const [name, payload] of events) sdk.event.dispatch(name, payload);\n });\n}\n\nexport interface GtmPageView {\n page: PageContext;\n /** The page's ecommerce block, or a promise of it: the cart loads in the browser. */\n ecommerce?: DataLayerEntry | Promise<DataLayerEntry | null> | null;\n}\n\n/** Push a page's data, once per page view: the first opens the document's data layer. */\nexport function reportGtmPageView(view: GtmPageView): void {\n if (typeof window === 'undefined') return;\n const settings = settingsOrUndefined();\n if (!gtmEnabled(settings)) {\n markPageDataReady();\n return;\n }\n watchListImpressions();\n\n const first = !firstPageReported;\n firstPageReported = true;\n // `url()->previous()`: the page before, or the store itself when the visitor came from nowhere.\n const referrer = (first ? document.referrer : previousUrl) || window.location.origin;\n previousUrl = window.location.href;\n\n enqueue(async () => {\n const [user, ecommerce] = await Promise.all([\n currentUser(),\n withDeadline(view.ecommerce ?? null, null),\n ]);\n const customer = await gtmCustomer(user, settings);\n const page = gtmPage(\n { slug: view.page.slug, referrer, mobileApp: inNativeApp(settings) },\n settings\n );\n if (first) {\n const entry = { ...ecommerce, page, store: gtmStore(settings), customer };\n pushToDataLayer(entry);\n rememberPurchaseOnceReceived(entry);\n announceServices(settings, user);\n markPageDataReady();\n return;\n }\n // GTM merges each push into what it holds: a guest's `{ isGuest: true }` would keep the\n // signed-out customer's details, and a shorter product list the last page's extra lines.\n pushToDataLayer({ customer: null, ecommerce: null });\n pushToDataLayer({ page, customer });\n if (ecommerce) {\n pushToDataLayer(ecommerce);\n rememberPurchaseOnceReceived(ecommerce);\n }\n });\n}\n\n/** How long a browser remembers an order it reported, as `SeoThankYouWidget` caches it. */\nconst PURCHASE_REMEMBERED_MS = 24 * 60 * 60 * 1000;\n/** How often, and for how long, a pushed purchase is checked for GTM having taken it. */\nexport const PURCHASE_RECEIVED_POLL_MS = 500;\nconst PURCHASE_RECEIVED_WAIT_MS = 60_000;\nconst purchaseKey = (orderId: unknown) => `google_tagged_order_${String(orderId)}`;\n\nfunction reportedRecently(orderId: unknown): boolean {\n try {\n const at = Number(window.localStorage.getItem(purchaseKey(orderId)));\n return Boolean(at) && Date.now() - at < PURCHASE_REMEMBERED_MS;\n } catch {\n // No storage (a private window): report it, as a Twig page would the first time.\n return false;\n }\n}\n\n/**\n * Remember a pushed `purchase` once GTM has taken it (GTM stamps `gtm.uniqueEventId` on each\n * message it handles). GTM loads seconds after the page here, so a shopper who leaves before\n * then has reported nothing, and the next visit reports it. Twig renders the push and its\n * container together, so it remembers the order as it renders the page.\n */\nfunction rememberPurchaseOnceReceived(entry: DataLayerEntry): void {\n if (entry.event !== 'purchase') return;\n const orderId = (entry.ecommerce as { event_id?: unknown } | undefined)?.event_id;\n const started = Date.now();\n const check = () => {\n if ('gtm.uniqueEventId' in entry) {\n try {\n window.localStorage.setItem(purchaseKey(orderId), String(Date.now()));\n } catch {\n // No storage: nothing to remember it in.\n }\n } else if (Date.now() - started < PURCHASE_RECEIVED_WAIT_MS) {\n setTimeout(check, PURCHASE_RECEIVED_POLL_MS);\n }\n };\n check();\n}\n\n/**\n * An order's `purchase`, once: Twig caches each order it reported for a day, so a reload of\n * the thank-you page counts nothing. Not inside the Salla app, which logs the order itself.\n */\nfunction purchaseOnce(order: Order, settings: StoreContext | undefined): DataLayerEntry | null {\n const id = String(order.id);\n // A return to the page in this document waits on the first push; only a new load retries.\n if (inNativeApp(settings) || purchasesPushed.has(id) || reportedRecently(order.id)) return null;\n purchasesPushed.add(id);\n return gtmPurchase(order, settings);\n}\n\nexport interface GtmPageEcommerceInput {\n slug: string;\n product?: Product;\n order?: Order;\n /** The cart page's cart, once the page has loaded it. */\n cart?: Promise<Cart | null> | null;\n}\n\n/** A page's own ecommerce block: a product's `detail`, the cart's `checkout`, an order's `purchase`. */\nexport function gtmPageEcommerce(input: GtmPageEcommerceInput): GtmPageView['ecommerce'] {\n if (typeof window === 'undefined') return null;\n const settings = settingsOrUndefined();\n if (!gtmEnabled(settings)) return null;\n if (input.slug === RouteId.PRODUCT_SINGLE && input.product)\n return gtmDetail(input.product, settings);\n if (input.slug === RouteId.CART && input.cart)\n return input.cart.then((cart) => (cart ? gtmCartCheckout(cart, settings) : null));\n if (input.slug === RouteId.THANK_YOU && input.order) return purchaseOnce(input.order, settings);\n return null;\n}\n\n/**\n * `impressions` for each page of a product listing the engine or the theme reports through\n * `salla-products-list::products.fetched`, as `<salla-products-list>` pushes on Twig. That\n * component pushes its own before it emits the API's answer (`success`), so those are skipped.\n * Each batch first clears the last one's list (GTM merges arrays index by index), and only that:\n * the page's own block, such as the cart's `checkout`, stays for the tags still to read it.\n */\nfunction watchListImpressions(): void {\n if (stopImpressions) return;\n stopImpressions = onSallaEvent('salla-products-list::products.fetched', (payload) => {\n const fetched = payload as { data?: unknown; success?: unknown } | undefined;\n if (!Array.isArray(fetched?.data) || typeof fetched.success === 'boolean') return;\n const products = fetched.data as Product[];\n const settings = settingsOrUndefined();\n if (!products.length || !gtmEnabled(settings)) return;\n // The page the products were fetched for, not the one the queue gets to them on.\n const impressions = gtmImpressions(products, getTwilightContext().page ?? undefined, settings);\n enqueue(() => {\n pushToDataLayer({ ecommerce: { impressions: null } });\n pushToDataLayer(impressions);\n });\n });\n}\n\n/** Test seam: forget the document's first page and every listener. */\nexport function resetGtmPageTracking(): void {\n stopImpressions?.();\n stopImpressions = null;\n queue = Promise.resolve();\n firstPageReported = false;\n previousUrl = null;\n purchasesPushed = new Set();\n pageDataReady = new Promise<void>((resolve) => (markPageDataReady = resolve));\n}\n\n/** Test seam: settle every push queued so far. */\nexport function flushGtmQueue(): Promise<void> {\n return queue;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/analytics/gtm-page.ts"],"names":["user"],"mappings":";;;;;;;;AAuCO,IAAM,qBAAA,GAAwB;AAErC,IAAI,KAAA,GAAuB,QAAQ,OAAA,EAAQ;AAC3C,IAAI,iBAAA,GAAoB,KAAA;AACxB,IAAI,WAAA,GAA6B,IAAA;AACjC,IAAI,oBAAgC,MAAM;AAAC,CAAA;AAC3C,IAAI,gBAAgB,IAAI,OAAA,CAAc,CAAC,OAAA,KAAa,oBAAoB,OAAQ,CAAA;AAChF,IAAI,eAAA,GAAuC,IAAA;AAE3C,IAAI,eAAA,uBAAsB,GAAA,EAAY;AAG/B,SAAS,eAAA,GAAiC;AAC/C,EAAA,OAAO,aAAA;AACT;AAEA,SAAS,mBAAA,GAAgD;AACvD,EAAA,IAAI;AACF,IAAA,OAAO,oBAAmB,CAAE,QAAA;AAAA,EAC9B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,QAAQ,IAAA,EAAwC;AACvD,EAAA,KAAA,GAAQ,MAAM,IAAA,CAAK,IAAI,CAAA,CAAE,KAAA,CAAM,CAAC,KAAA,KAAmB;AACjD,IAAA,OAAA,CAAQ,IAAA,CAAK,2CAA2C,KAAK,CAAA;AAAA,EAC/D,CAAC,CAAA;AACH;AAEA,SAAS,YA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AAU,CAAC,UAAA,CAAW,QAAQ,CAAA,EAAG;AAE/C,IAAA,MAAM,cAAc,cAAA,CAAe,QAAA,EAAU,oBAAmB,CAAE,IAAA,IAAQ,QAAW,QAAQ,CAAA;AAC7F,IAAA,OAAA,CAAQ,MAAM;AACZ,MAAA,eAAA,CAAgB,EAAE,SAAA,EAAW,EAAE,WAAA,EAAa,IAAA,IAAQ,CAAA;AACpD,MAAA,eAAA,CAAgB,WAAW,CAAA;AAAA,IAC7B,CAAC,CAAA;AAAA,EACH,CAAC,CAAA;AACH","file":"chunk-SFXQMG3D.js","sourcesContent":["/**\n * The order a Twig page fills the data layer in, for a storefront that loads once.\n *\n * A Twig page opens with its own data (`page`, `store`, `customer`, and the page's ecommerce\n * block), then loads the containers, then hands the SDK `twilight::init` and each\n * `services::<name>.init`, which the SDK copies into the data layer. Tags fire on those events\n * and read the data pushed before them, so the order is the contract.\n *\n * Here the first page is pushed once its customer is known (the signed-in one loads in the\n * browser) and, on the cart, once the cart has; GTM waits for that push ({@link whenGtmPageData}).\n * Every later page pushes its own `page` and ecommerce block too, after clearing the previous\n * page's ecommerce (GTM merges objects into what it holds, arrays index by index). Those pages\n * load nothing, so they announce no services again: Salla's container would load its Google\n * tags and Clarity a second time. Every push the engine makes goes through one queue, so a\n * page's data is always in before its events.\n */\nimport type { Cart, Product, User } from '../../types';\nimport type { Order } from '../../routes/account/types';\nimport { user as userApi } from '../../api/user';\nimport type { StoreContext } from '../../api/store';\nimport { getTwilightContext, type PageContext } from '../../twilight/context';\nimport { isNativeApp } from '../../native-app';\nimport { RouteId } from '../../router/route-ids';\nimport { onSallaEvent, whenSallaLoaded } from '../../utils/sdk-helpers';\nimport {\n gtmCartCheckout,\n gtmCustomer,\n gtmDetail,\n gtmEnabled,\n gtmImpressions,\n gtmPage,\n gtmPurchase,\n gtmStore,\n pushToDataLayer,\n servicesInitEvents,\n type DataLayerEntry,\n} from './gtm';\n\n/** How long the first page waits for its customer or its cart before it is pushed without. */\nexport const GTM_PAGE_DATA_WAIT_MS = 3000;\n\nlet queue: Promise<void> = Promise.resolve();\nlet firstPageReported = false;\nlet previousUrl: string | null = null;\nlet markPageDataReady: () => void = () => {};\nlet pageDataReady = new Promise<void>((resolve) => (markPageDataReady = resolve));\nlet stopImpressions: (() => void) | null = null;\n/** Orders this document has pushed a `purchase` for, whether or not GTM has taken it yet. */\nlet purchasesPushed = new Set<string>();\n\n/** Resolves once the first page's data is in the data layer, as Twig's head pushes it before GTM. */\nexport function whenGtmPageData(): Promise<void> {\n return pageDataReady;\n}\n\nfunction settingsOrUndefined(): StoreContext | undefined {\n try {\n return getTwilightContext().settings;\n } catch {\n return undefined;\n }\n}\n\nfunction enqueue(task: () => void | Promise<void>): void {\n queue = queue.then(task).catch((error: unknown) => {\n console.warn('[gtm] Could not push to the data layer:', error);\n });\n}\n\nfunction withDeadline<T>(value: T | Promise<T>, fallback: T): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const deadline = new Promise<T>((resolve) => {\n timer = setTimeout(() => resolve(fallback), GTM_PAGE_DATA_WAIT_MS);\n });\n return Promise.race([Promise.resolve(value), deadline])\n .catch(() => fallback)\n .finally(() => clearTimeout(timer));\n}\n\n/** The signed-in customer, from the query `useUser` already loads; a guest has no token. */\nasync function currentUser(): Promise<User | null> {\n const { authToken, queryClient } = getTwilightContext();\n if (!authToken || !queryClient) return null;\n return withDeadline(\n queryClient.ensureQueryData(userApi.queries.current()).catch(() => null),\n null\n );\n}\n\n/** The Salla app's webview: the SDK knows once loaded, the settings carry the app's headers before. */\nfunction inNativeApp(settings: StoreContext | undefined): boolean {\n const os = settings?.jitsu?.context?.extra?.headers?.['s-app-os']?.toLowerCase();\n return os === 'ios' || os === 'android' || isNativeApp();\n}\n\n/**\n * The `user` Twig's `twilight::init` carries (the SDK's own config), as far as tags read it:\n * Salla's container identifies the customer to a chat service from `user.id` when that\n * service's `services::<name>.init` arrives, which is before the SDK pushes a user of its own.\n */\nfunction initUser(settings: StoreContext | undefined, user: User | null): DataLayerEntry {\n const visitor = settings?.user;\n return {\n id: user ? (user.id ?? null) : (visitor?.id ?? null),\n type: user ? 'user' : (visitor?.type ?? 'guest'),\n country_code: user?.country_code ?? visitor?.country_code,\n language_code: visitor?.language_code,\n currency_code: visitor?.currency_code,\n };\n}\n\n/** `twilight::init`, then each `services::<name>.init`, once per document, as Twig's page does. */\nfunction announceServices(settings: StoreContext | undefined, user: User | null): void {\n const snippetServices = (getTwilightContext().appsSnippets ?? []).map((app) => app.service);\n const events = servicesInitEvents(settings?.external_services, snippetServices);\n whenSallaLoaded((sdk) => {\n // The engine calls `salla.init` itself; Twig hands it the event, which the SDK records.\n pushToDataLayer({ event: 'twilight::init', user: initUser(settings, user) });\n for (const [name, payload] of events) sdk.event.dispatch(name, payload);\n });\n}\n\nexport interface GtmPageView {\n page: PageContext;\n /** The page's ecommerce block, or a promise of it: the cart loads in the browser. */\n ecommerce?: DataLayerEntry | Promise<DataLayerEntry | null> | null;\n}\n\n/** Push a page's data, once per page view: the first opens the document's data layer. */\nexport function reportGtmPageView(view: GtmPageView): void {\n if (typeof window === 'undefined') return;\n const settings = settingsOrUndefined();\n if (!gtmEnabled(settings)) {\n markPageDataReady();\n return;\n }\n watchListImpressions();\n\n const first = !firstPageReported;\n firstPageReported = true;\n // `url()->previous()`: the page before, or the store itself when the visitor came from nowhere.\n const referrer = (first ? document.referrer : previousUrl) || window.location.origin;\n previousUrl = window.location.href;\n\n enqueue(async () => {\n const [user, ecommerce] = await Promise.all([\n currentUser(),\n withDeadline(view.ecommerce ?? null, null),\n ]);\n const customer = await gtmCustomer(user, settings);\n const page = gtmPage(\n { slug: view.page.slug, referrer, mobileApp: inNativeApp(settings) },\n settings\n );\n if (first) {\n const entry = { ...ecommerce, page, store: gtmStore(settings), customer };\n pushToDataLayer(entry);\n rememberPurchaseOnceReceived(entry);\n announceServices(settings, user);\n markPageDataReady();\n return;\n }\n // GTM merges each push into what it holds: a guest's `{ isGuest: true }` would keep the\n // signed-out customer's details, and a shorter product list the last page's extra lines.\n pushToDataLayer({ customer: null, ecommerce: null });\n pushToDataLayer({ page, customer });\n if (ecommerce) {\n pushToDataLayer(ecommerce);\n rememberPurchaseOnceReceived(ecommerce);\n }\n });\n}\n\n/** How long a browser remembers an order it reported, as `SeoThankYouWidget` caches it. */\nconst PURCHASE_REMEMBERED_MS = 24 * 60 * 60 * 1000;\n/** How often, and for how long, a pushed purchase is checked for GTM having taken it. */\nexport const PURCHASE_RECEIVED_POLL_MS = 500;\nconst PURCHASE_RECEIVED_WAIT_MS = 60_000;\nconst purchaseKey = (orderId: unknown) => `google_tagged_order_${String(orderId)}`;\n\nfunction reportedRecently(orderId: unknown): boolean {\n try {\n const at = Number(window.localStorage.getItem(purchaseKey(orderId)));\n return Boolean(at) && Date.now() - at < PURCHASE_REMEMBERED_MS;\n } catch {\n // No storage (a private window): report it, as a Twig page would the first time.\n return false;\n }\n}\n\n/**\n * Remember a pushed `purchase` once GTM has taken it (GTM stamps `gtm.uniqueEventId` on each\n * message it handles). GTM loads seconds after the page here, so a shopper who leaves before\n * then has reported nothing, and the next visit reports it. Twig renders the push and its\n * container together, so it remembers the order as it renders the page.\n */\nfunction rememberPurchaseOnceReceived(entry: DataLayerEntry): void {\n if (entry.event !== 'purchase') return;\n const orderId = (entry.ecommerce as { event_id?: unknown } | undefined)?.event_id;\n const started = Date.now();\n const check = () => {\n if ('gtm.uniqueEventId' in entry) {\n try {\n window.localStorage.setItem(purchaseKey(orderId), String(Date.now()));\n } catch {\n // No storage: nothing to remember it in.\n }\n } else if (Date.now() - started < PURCHASE_RECEIVED_WAIT_MS) {\n setTimeout(check, PURCHASE_RECEIVED_POLL_MS);\n }\n };\n check();\n}\n\n/**\n * An order's `purchase`, once: Twig caches each order it reported for a day, so a reload of\n * the thank-you page counts nothing. Not inside the Salla app, which logs the order itself.\n */\nfunction purchaseOnce(order: Order, settings: StoreContext | undefined): DataLayerEntry | null {\n const id = String(order.id);\n // A return to the page in this document waits on the first push; only a new load retries.\n if (inNativeApp(settings) || purchasesPushed.has(id) || reportedRecently(order.id)) return null;\n purchasesPushed.add(id);\n return gtmPurchase(order, settings);\n}\n\nexport interface GtmPageEcommerceInput {\n slug: string;\n product?: Product;\n order?: Order;\n /** The cart page's cart, once the page has loaded it. */\n cart?: Promise<Cart | null> | null;\n}\n\n/** A page's own ecommerce block: a product's `detail`, the cart's `checkout`, an order's `purchase`. */\nexport function gtmPageEcommerce(input: GtmPageEcommerceInput): GtmPageView['ecommerce'] {\n if (typeof window === 'undefined') return null;\n const settings = settingsOrUndefined();\n if (!gtmEnabled(settings)) return null;\n if (input.slug === RouteId.PRODUCT_SINGLE && input.product)\n return gtmDetail(input.product, settings);\n if (input.slug === RouteId.CART && input.cart)\n return input.cart.then((cart) => (cart ? gtmCartCheckout(cart, settings) : null));\n if (input.slug === RouteId.THANK_YOU && input.order) return purchaseOnce(input.order, settings);\n return null;\n}\n\n/**\n * `impressions` for each page of a product listing the engine or the theme reports through\n * `salla-products-list::products.fetched`, as `<salla-products-list>` pushes on Twig. That\n * component pushes its own before it emits the API's answer (`success`), so those are skipped.\n * Each batch first clears the last one's list (GTM merges arrays index by index), and only that:\n * the page's own block, such as the cart's `checkout`, stays for the tags still to read it.\n */\nfunction watchListImpressions(): void {\n if (stopImpressions) return;\n stopImpressions = onSallaEvent('salla-products-list::products.fetched', (payload) => {\n const fetched = payload as { data?: unknown; success?: unknown } | undefined;\n if (!Array.isArray(fetched?.data) || typeof fetched.success === 'boolean') return;\n const products = fetched.data as Product[];\n const settings = settingsOrUndefined();\n if (!products.length || !gtmEnabled(settings)) return;\n // The page the products were fetched for, not the one the queue gets to them on.\n const impressions = gtmImpressions(products, getTwilightContext().page ?? undefined, settings);\n enqueue(() => {\n pushToDataLayer({ ecommerce: { impressions: null } });\n pushToDataLayer(impressions);\n });\n });\n}\n\n/** Test seam: forget the document's first page and every listener. */\nexport function resetGtmPageTracking(): void {\n stopImpressions?.();\n stopImpressions = null;\n queue = Promise.resolve();\n firstPageReported = false;\n previousUrl = null;\n purchasesPushed = new Set();\n pageDataReady = new Promise<void>((resolve) => (markPageDataReady = resolve));\n}\n\n/** Test seam: settle every push queued so far. */\nexport function flushGtmQueue(): Promise<void> {\n return queue;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ProductPrice } from './chunk-
|
|
2
|
-
import { getProductPreview } from './chunk-
|
|
1
|
+
import { ProductPrice } from './chunk-CNN757MD.js';
|
|
2
|
+
import { getProductPreview } from './chunk-QDE37XJB.js';
|
|
3
3
|
import { Image } from './chunk-IVO6YRRK.js';
|
|
4
4
|
export { BlogSkeleton, BreadcrumbSkeleton, CartSkeleton, CustomerLayoutSkeleton, CustomerPageSkeleton, PageSkeleton, ProductCardSkeleton, ProductDetailSkeleton, ProductGridSkeleton, SkeletonPulse } from '@salla.sa/twilight-components-react';
|
|
5
5
|
import { useMemo } from 'react';
|
|
@@ -49,5 +49,5 @@ function ProductDetailPreview({ product }) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export { ProductDetailPreview, ProductPendingPreview };
|
|
52
|
-
//# sourceMappingURL=chunk-
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
52
|
+
//# sourceMappingURL=chunk-SNTUACTC.js.map
|
|
53
|
+
//# sourceMappingURL=chunk-SNTUACTC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/product/ProductPendingPreview.tsx"],"names":[],"mappings":";;;;;;;;;AAsBO,SAAS,sBAAsB,EAAE,EAAA,EAAI,MAAA,EAAO,GAAqB,EAAC,EAAG;AAC1E,EAAA,MAAM,MAAA,GAAS,SAAA,CAAU,EAAE,MAAA,EAAQ,OAAO,CAAA;AAC1C,EAAA,MAAM,EAAA,GAAK,UAAU,MAAA,CAAO,EAAA;AAC5B,EAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,MAAO,EAAA,GAAK,iBAAA,CAAkB,EAAE,CAAA,GAAI,MA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';\nimport {\n BreadcrumbSkeleton,\n ProductDetailSkeleton,\n SkeletonPulse,\n} from '@salla.sa/twilight-components-react/skeletons';\nimport { getProductPreview } from '../../api/product';\nimport { Image } from '../../components/common/Image';\nimport { ProductPrice } from '../../components/product/ProductDetails';\nimport type { Product } from '../../types';\n\n/**\n * Product route `pendingComponent`. When the shopper opens a product from a card, the\n * list already gave us its name, price and image (`rememberProductPreview`), so paint\n * those in the product page's layout while details load, not a blank skeleton.\n * Without a remembered card (deep link, SKU link) it is `ProductDetailSkeleton`.\n * `id` defaults to the route's `id` param.\n *\n * Only plain markup: no gallery slider, form, hook slots or `salla-*` widgets, which\n * would start (and fetch) for the stand-in and again when the real page mounts.\n */\nexport function ProductPendingPreview({ id: idProp }: { id?: string } = {}) {\n const params = useParams({ strict: false }) as { id?: string };\n const id = idProp ?? params.id;\n const product = useMemo(() => (id ? getProductPreview(id) : undefined), [id]);\n\n if (!product?.name) return <ProductDetailSkeleton />;\n return <ProductDetailPreview product={product} />;\n}\n\n/** `ProductDetailSkeleton`'s boxes, with the card's image, name and price filled in. */\nexport function ProductDetailPreview({ product }: { product: Product }) {\n const image = product.image?.url ? product.image : product.images?.[0];\n\n return (\n <div data-product-preview={product.id}>\n <div className=\"s-skeleton-detail-container\">\n <BreadcrumbSkeleton />\n <div className=\"s-skeleton-detail-layout\">\n <div className=\"s-skeleton-detail-images\">\n {image?.url ? (\n <div className=\"s-skeleton-card-image overflow-hidden bg-gray-100\">\n <Image\n src={image.url}\n alt={image.alt || product.name}\n className=\"h-full w-full object-cover\"\n aspectRatio=\"1/1\"\n priority\n noWrapper\n />\n </div>\n ) : (\n <SkeletonPulse className=\"s-skeleton-card-image\" />\n )}\n <div className=\"s-skeleton-slider-thumbs\">\n {Array.from({ length: 3 }, (_, i) => (\n <SkeletonPulse key={i} className=\"s-skeleton-slider-thumb\" />\n ))}\n </div>\n </div>\n <div className=\"s-skeleton-detail-content\">\n <h1 className=\"text-xl md:text-2xl leading-10 font-bold text-gray-800\">\n {product.name}\n </h1>\n {product.subtitle && (\n <h2 className=\"product-entry__sub-title text-sm text-gray-500 leading-6\">\n {product.subtitle}\n </h2>\n )}\n <ProductPrice product={product} />\n <div className=\"s-skeleton-detail-description\">\n <SkeletonPulse className=\"s-skeleton-text-line-full\" />\n <SkeletonPulse className=\"s-skeleton-text-line-lg\" />\n <SkeletonPulse className=\"s-skeleton-text-line-sm\" />\n </div>\n <div className=\"s-skeleton-detail-actions\">\n <SkeletonPulse className=\"s-skeleton-detail-add-btn\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { filesCdn, cdn } from './chunk-
|
|
1
|
+
import { filesCdn, cdn } from './chunk-NWMTGBCN.js';
|
|
2
2
|
import { storeTranslationsQueryKey, translationsQueryKey, composeMessages, isPlainObject } from './chunk-MWUAHDQL.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -126,5 +126,5 @@ var translations = {
|
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
export { commonTranslationsPath, storeTranslationsPath, translations };
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-SR4YSJAF.js.map
|
|
130
|
+
//# sourceMappingURL=chunk-SR4YSJAF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/translations.ts"],"names":[],"mappings":";;;;AAiEA,IAAM,kBAAA,GAAqB,sBAAA;AAGpB,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,OAAO,uBAAuB,MAAM,CAAA,KAAA,CAAA;AACtC;AAWO,SAAS,qBAAA,CAAsB,SAA0B,MAAA,EAAwB;AACtF,EAAA,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,KAAA,CAAA;AAC1C;AAUA,eAAe,eACb,IAAA,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AAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBP,QAAA,EAAU,CAAC,MAAA,KACT,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,qBAAqB,MAAM,CAAA;AAAA,MACrC,OAAA,EAAS,MAAM,YAAA,CAAa,GAAA,CAAI,MAAM;AAAA,KACvC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWH,OAAA,EAAS,CAAC,OAAA,EAA0B,MAAA,KAClC,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,yBAAA,CAA0B,OAAA,EAAS,MAAM,CAAA;AAAA,MACnD,OAAA,EAAS,MAAM,YAAA,CAAa,QAAA,CAAS,SAAS,MAAM;AAAA,KACrD;AAAA;AAEP","file":"chunk-NE5XQJLZ.js","sourcesContent":["/**\n * @fileoverview Where a storefront's words come from.\n *\n * Two files, merged: the platform's copy for this language, and the merchant's\n * own edits for this language and this store. Both are plain JSON objects on\n * the uploader's CDN, one per language.\n *\n * ```\n * https://cdn.files.salla.network/translations/common/<locale>.json the platform's\n * https://cdn.files.salla.network/translations/<storeId>/<locale>.json the merchant's\n * ```\n *\n * **What this replaces, and why.** Until now the engine read a single global\n * file, `cdn.salla.network/js/translations.json`, holding every language keyed\n * `\"<locale>.trans\"`. Nothing publishes that file: it is an object last written\n * on 2026-03-26, carrying only `ar` and `en` where the platform has 39 locales,\n * 405 keys behind `Languages-Module` and 959 English strings textually\n * different from it. So every React storefront has been serving copy from\n * March, and a key added since has never reached one. It also carried no\n * merchant overrides at all — a merchant editing their theme's wording in the\n * Dashboard changed nothing on a React theme.\n *\n * **Merchant overrides are read, and only when there are any.** Getting here\n * took two corrections worth keeping.\n *\n * The first is the address. A merchant's own wording lives at\n * `translations/<storeId>/<locale>.json`, keyed by `store()->getRouteKey()` —\n * the Optimus-encoded numeric id. An early version addressed it with\n * `resolveStoreIdentifier()`, on the claim that the two are the same string.\n * That is true of the `store-identifier` *header*, which accepts a host, a\n * username or an id, and false of the R2 key: on a custom domain the resolver\n * returns `reefperfumes.com` and on a shared host a username like\n * `mtgr-alaatr-2`. Both 404, both then read as \"this store has no overrides\",\n * and the merchant's wording silently never appears — so the feature would have\n * worked under `?storeId=` alone, which is preview and localhost. It is\n * `settings.store.id` now, which is known only after the settings query.\n *\n * The second is when to ask at all. Most stores have never customised a word,\n * and a miss is an uncached round trip (`cf-cache-status: DYNAMIC` on the 404)\n * on the critical path of every SSR render. So the request is made only when\n * `settings.languages[<ISO>].has_custom_translations` says there is something\n * to get — a flag `Languages-Module` writes when a merchant saves a\n * translation. A store without overrides pays nothing, which is what made this\n * shippable at all.\n *\n * ⚠️ The flag is written on save, so a store whose wording predates it reads as\n * `false` until someone edits a translation or the backfill runs. That is a\n * store keeping today's behaviour, not a regression — React themes have never\n * read merchant overrides — but it does mean the feature is only as complete as\n * the backfill.\n *\n * **Rollout is by fallback, not by flag.** `translations/common/` is written by\n * a sync in the theme build service that may not have run yet, and a hard switch\n * would leave every storefront with no platform strings at all. A missing common\n * file therefore falls back to the old global one, which is exactly today's\n * behaviour — so this is safe to ship before the bucket is populated, and stops\n * using the fallback on its own once it is.\n */\nimport { queryOptions } from '@tanstack/react-query';\nimport { cdn, filesCdn } from './client';\nimport { storeTranslationsQueryKey, translationsQueryKey } from './translations-key';\nimport { composeMessages, isPlainObject, type Messages } from './messages';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\n/** The global file this used to be the only reader of. See the file comment. */\nconst LEGACY_GLOBAL_FILE = 'js/translations.json';\n\n/** One language of platform copy, shared by every store. */\nexport function commonTranslationsPath(locale: string): string {\n return `translations/common/${locale}.json`;\n}\n\n/**\n * One language of a single merchant's own wording.\n *\n * `storeId` is `settings.store.id`, which is the value `Languages-Module` names\n * the object with (`store()->getRouteKey()`, the Optimus-encoded numeric id).\n * It is **not** `resolveStoreIdentifier()`: that returns a hostname on a custom\n * domain and a username on a shared host, both of which 404 here and would read\n * as \"this merchant has no overrides\" — silently, on every store but a preview.\n */\nexport function storeTranslationsPath(storeId: string | number, locale: string): string {\n return `translations/${storeId}/${locale}.json`;\n}\n\n/**\n * Reads one language file, or `null` when there is nothing to read.\n *\n * A 404 is the ordinary answer, not a failure: most stores have never had a\n * word customised, so their file does not exist. Distinguishing it from a real\n * error matters only for the log — both end in `null` — but a warning on every\n * page load of every uncustomised store is a warning nobody will read.\n */\nasync function readLocaleFile(\n path: string,\n { failLoudly = false }: { failLoudly?: boolean } = {}\n): Promise<Messages | null> {\n /** A 404 always means \"absent\"; everything else is a failure to read. */\n const unreadable = (reason: string, cause?: unknown): null => {\n if (failLoudly) throw new Error(`[translations] ${path}: ${reason}`, { cause });\n console.warn('[translations]', reason, path, cause ?? '');\n return null;\n };\n\n try {\n const response = await filesCdn.get(path, { throwHttpErrors: false, timeout: 5000 });\n if (response.status === 404) return null;\n\n if (!response.ok) {\n return unreadable(`answered ${response.status}`);\n }\n\n const data: unknown = await response.json();\n if (!isPlainObject(data)) {\n return unreadable('is not a JSON object');\n }\n\n return data;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith('[translations]')) throw error;\n return unreadable('could not be read', error);\n }\n}\n\n/**\n * The pre-CDN global file, sliced to one language.\n *\n * Only reached when `translations/common/<locale>.json` is missing, which is\n * the state of the bucket until the sync has run once.\n */\nasync function readLegacyGlobal(locale: string): Promise<Messages | null> {\n try {\n const data = await cdn.get(LEGACY_GLOBAL_FILE, { timeout: 5000 }).json<TranslationMessages>();\n const forLocale = data?.[`${locale}.trans`];\n return isPlainObject(forLocale) ? forLocale : null;\n } catch {\n console.warn('[translations] the legacy global file could not be read either');\n return null;\n }\n}\n\nexport const translations = {\n /**\n * The platform's copy for `locale`.\n *\n * One file, so one request. See the file comment for why the merchant's own\n * wording is not merged in here yet and what it is waiting on.\n */\n get: async (locale: string): Promise<TranslationMessages | null> => {\n const common = await readLocaleFile(commonTranslationsPath(locale));\n const base = common ?? (await readLegacyGlobal(locale));\n if (!base) return null;\n\n // Still wrapped in the `<locale>.trans` shape the rest of the engine reads.\n // `createI18nInstance` slices by that key and so does the SDK bridge in\n // `I18nProvider`; changing the envelope here would be a second change for\n // no gain, since one language is all any of them ever take out of it.\n return { [`${locale}.trans`]: base as Record<string, string> };\n },\n\n /**\n * This merchant's own wording for `locale`, or `null` if they have none.\n *\n * Only worth calling when `settings.languages[<ISO>].has_custom_translations`\n * says there is something to get. Most stores have never customised a word,\n * and a miss here is an uncached round trip — `cf-cache-status: DYNAMIC` on a\n * 404 — on the critical path of an SSR render. The flag is what makes this\n * free for everyone who does not use it.\n *\n * Returned unwrapped, unlike {@link translations.get}: this is merged into\n * that one's messages rather than handed to i18next on its own.\n */\n forStore: async (storeId: string | number, locale: string): Promise<Messages | null> =>\n // `failLoudly`, unlike the platform file: this is only ever called because\n // the settings said overrides exist, so a 500, a timeout or a body that is\n // not JSON is a failure to read them — not a store that has none. Returning\n // `null` there would cache \"no overrides\" as a success, skip the query's\n // retry, and serve Salla's wording in place of the merchant's until the\n // entry expired. A 404 still means absent, and `rootBeforeLoad` catches the\n // throw and keeps the platform copy, so the worst case is unchanged.\n readLocaleFile(storeTranslationsPath(storeId, locale), { failLoudly: true }),\n\n /**\n * The platform's copy for `locale` with this merchant's wording laid over it.\n *\n * Takes the two as values rather than fetching them, so the caller decides\n * whether the second request happens at all and both stay separately cached.\n */\n /**\n * The platform's copy for `locale` with this merchant's wording over it.\n *\n * Delegates to `composeMessages`, which every other reader of these two\n * entries also uses — see `api/messages.ts` for why there is exactly one.\n */\n merge: (\n common: TranslationMessages | null,\n overrides: Messages | null,\n locale: string\n ): TranslationMessages | null => composeMessages(common, overrides, locale) ?? null,\n\n queries: {\n /**\n * @param locale taken as an argument rather than read from the twilight\n * context, and that is load-bearing. This key is built on the server, on\n * hydration, and again lazily from the context accessor; if any of the\n * three read a locale the others had not been given yet, the hydrated page\n * would miss the dehydrated entry and refetch both files it was just\n * handed. Every caller already has the locale in hand.\n *\n * The store is deliberately **not** in the key. One document serves one\n * store — a request that names a different one is redirected with\n * `reloadDocument`, so the client never changes store under a live cache —\n * and adding a value that resolves from the request on the server and from\n * the injected env on the client is how a key stops matching across\n * hydration.\n */\n byLocale: (locale: string) =>\n queryOptions({\n queryKey: translationsQueryKey(locale),\n queryFn: () => translations.get(locale),\n }),\n\n /**\n * This merchant's overrides, cached apart from the platform's copy.\n *\n * Its own entry rather than a wider `byLocale` key, so the common file is\n * fetched and dehydrated once per language whatever the store does, and a\n * store with no overrides never has an entry at all. Both sides compute the\n * key from the settings payload, so the hydrated page finds what the server\n * dehydrated instead of refetching it.\n */\n byStore: (storeId: string | number, locale: string) =>\n queryOptions({\n queryKey: storeTranslationsQueryKey(storeId, locale),\n queryFn: () => translations.forStore(storeId, locale),\n }),\n },\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/api/translations.ts"],"names":[],"mappings":";;;;AAiEA,IAAM,kBAAA,GAAqB,sBAAA;AAGpB,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,OAAO,uBAAuB,MAAM,CAAA,KAAA,CAAA;AACtC;AAWO,SAAS,qBAAA,CAAsB,SAA0B,MAAA,EAAwB;AACtF,EAAA,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,KAAA,CAAA;AAC1C;AAUA,eAAe,eACb,IAAA,EACA,EAAE,aAAa,KAAA,EAAM,GAA8B,EAAC,EAC1B;AAE1B,EAAA,MAAM,UAAA,GAAa,CAAC,MAAA,EAAgB,KAAA,KAA0B;AAC5D,IAAA,IAAI,UAAA,EAAY,MAAM,IAAI,KAAA,CAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,EAAI,EAAE,KAAA,EAAO,CAAA;AAC9E,IAAA,OAAA,CAAQ,IAAA,CAAK,gBAAA,EAAkB,MAAA,EAAQ,IAAA,EAAM,SAAS,EAAE,CA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S,CAAC,OAAA,EAA0B,MAAA,KAClC,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,yBAAA,CAA0B,OAAA,EAAS,MAAM,CAAA;AAAA,MACnD,OAAA,EAAS,MAAM,YAAA,CAAa,QAAA,CAAS,SAAS,MAAM;AAAA,KACrD;AAAA;AAEP","file":"chunk-SR4YSJAF.js","sourcesContent":["/**\n * @fileoverview Where a storefront's words come from.\n *\n * Two files, merged: the platform's copy for this language, and the merchant's\n * own edits for this language and this store. Both are plain JSON objects on\n * the uploader's CDN, one per language.\n *\n * ```\n * https://cdn.files.salla.network/translations/common/<locale>.json the platform's\n * https://cdn.files.salla.network/translations/<storeId>/<locale>.json the merchant's\n * ```\n *\n * **What this replaces, and why.** Until now the engine read a single global\n * file, `cdn.salla.network/js/translations.json`, holding every language keyed\n * `\"<locale>.trans\"`. Nothing publishes that file: it is an object last written\n * on 2026-03-26, carrying only `ar` and `en` where the platform has 39 locales,\n * 405 keys behind `Languages-Module` and 959 English strings textually\n * different from it. So every React storefront has been serving copy from\n * March, and a key added since has never reached one. It also carried no\n * merchant overrides at all — a merchant editing their theme's wording in the\n * Dashboard changed nothing on a React theme.\n *\n * **Merchant overrides are read, and only when there are any.** Getting here\n * took two corrections worth keeping.\n *\n * The first is the address. A merchant's own wording lives at\n * `translations/<storeId>/<locale>.json`, keyed by `store()->getRouteKey()` —\n * the Optimus-encoded numeric id. An early version addressed it with\n * `resolveStoreIdentifier()`, on the claim that the two are the same string.\n * That is true of the `store-identifier` *header*, which accepts a host, a\n * username or an id, and false of the R2 key: on a custom domain the resolver\n * returns `reefperfumes.com` and on a shared host a username like\n * `mtgr-alaatr-2`. Both 404, both then read as \"this store has no overrides\",\n * and the merchant's wording silently never appears — so the feature would have\n * worked under `?storeId=` alone, which is preview and localhost. It is\n * `settings.store.id` now, which is known only after the settings query.\n *\n * The second is when to ask at all. Most stores have never customised a word,\n * and a miss is an uncached round trip (`cf-cache-status: DYNAMIC` on the 404)\n * on the critical path of every SSR render. So the request is made only when\n * `settings.languages[<ISO>].has_custom_translations` says there is something\n * to get — a flag `Languages-Module` writes when a merchant saves a\n * translation. A store without overrides pays nothing, which is what made this\n * shippable at all.\n *\n * ⚠️ The flag is written on save, so a store whose wording predates it reads as\n * `false` until someone edits a translation or the backfill runs. That is a\n * store keeping today's behaviour, not a regression — React themes have never\n * read merchant overrides — but it does mean the feature is only as complete as\n * the backfill.\n *\n * **Rollout is by fallback, not by flag.** `translations/common/` is written by\n * a sync in the theme build service that may not have run yet, and a hard switch\n * would leave every storefront with no platform strings at all. A missing common\n * file therefore falls back to the old global one, which is exactly today's\n * behaviour — so this is safe to ship before the bucket is populated, and stops\n * using the fallback on its own once it is.\n */\nimport { queryOptions } from '@tanstack/react-query';\nimport { cdn, filesCdn } from './client';\nimport { storeTranslationsQueryKey, translationsQueryKey } from './translations-key';\nimport { composeMessages, isPlainObject, type Messages } from './messages';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\n/** The global file this used to be the only reader of. See the file comment. */\nconst LEGACY_GLOBAL_FILE = 'js/translations.json';\n\n/** One language of platform copy, shared by every store. */\nexport function commonTranslationsPath(locale: string): string {\n return `translations/common/${locale}.json`;\n}\n\n/**\n * One language of a single merchant's own wording.\n *\n * `storeId` is `settings.store.id`, which is the value `Languages-Module` names\n * the object with (`store()->getRouteKey()`, the Optimus-encoded numeric id).\n * It is **not** `resolveStoreIdentifier()`: that returns a hostname on a custom\n * domain and a username on a shared host, both of which 404 here and would read\n * as \"this merchant has no overrides\" — silently, on every store but a preview.\n */\nexport function storeTranslationsPath(storeId: string | number, locale: string): string {\n return `translations/${storeId}/${locale}.json`;\n}\n\n/**\n * Reads one language file, or `null` when there is nothing to read.\n *\n * A 404 is the ordinary answer, not a failure: most stores have never had a\n * word customised, so their file does not exist. Distinguishing it from a real\n * error matters only for the log — both end in `null` — but a warning on every\n * page load of every uncustomised store is a warning nobody will read.\n */\nasync function readLocaleFile(\n path: string,\n { failLoudly = false }: { failLoudly?: boolean } = {}\n): Promise<Messages | null> {\n /** A 404 always means \"absent\"; everything else is a failure to read. */\n const unreadable = (reason: string, cause?: unknown): null => {\n if (failLoudly) throw new Error(`[translations] ${path}: ${reason}`, { cause });\n console.warn('[translations]', reason, path, cause ?? '');\n return null;\n };\n\n try {\n const response = await filesCdn.get(path, { throwHttpErrors: false, timeout: 5000 });\n if (response.status === 404) return null;\n\n if (!response.ok) {\n return unreadable(`answered ${response.status}`);\n }\n\n const data: unknown = await response.json();\n if (!isPlainObject(data)) {\n return unreadable('is not a JSON object');\n }\n\n return data;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith('[translations]')) throw error;\n return unreadable('could not be read', error);\n }\n}\n\n/**\n * The pre-CDN global file, sliced to one language.\n *\n * Only reached when `translations/common/<locale>.json` is missing, which is\n * the state of the bucket until the sync has run once.\n */\nasync function readLegacyGlobal(locale: string): Promise<Messages | null> {\n try {\n const data = await cdn.get(LEGACY_GLOBAL_FILE, { timeout: 5000 }).json<TranslationMessages>();\n const forLocale = data?.[`${locale}.trans`];\n return isPlainObject(forLocale) ? forLocale : null;\n } catch {\n console.warn('[translations] the legacy global file could not be read either');\n return null;\n }\n}\n\nexport const translations = {\n /**\n * The platform's copy for `locale`.\n *\n * One file, so one request. See the file comment for why the merchant's own\n * wording is not merged in here yet and what it is waiting on.\n */\n get: async (locale: string): Promise<TranslationMessages | null> => {\n const common = await readLocaleFile(commonTranslationsPath(locale));\n const base = common ?? (await readLegacyGlobal(locale));\n if (!base) return null;\n\n // Still wrapped in the `<locale>.trans` shape the rest of the engine reads.\n // `createI18nInstance` slices by that key and so does the SDK bridge in\n // `I18nProvider`; changing the envelope here would be a second change for\n // no gain, since one language is all any of them ever take out of it.\n return { [`${locale}.trans`]: base as Record<string, string> };\n },\n\n /**\n * This merchant's own wording for `locale`, or `null` if they have none.\n *\n * Only worth calling when `settings.languages[<ISO>].has_custom_translations`\n * says there is something to get. Most stores have never customised a word,\n * and a miss here is an uncached round trip — `cf-cache-status: DYNAMIC` on a\n * 404 — on the critical path of an SSR render. The flag is what makes this\n * free for everyone who does not use it.\n *\n * Returned unwrapped, unlike {@link translations.get}: this is merged into\n * that one's messages rather than handed to i18next on its own.\n */\n forStore: async (storeId: string | number, locale: string): Promise<Messages | null> =>\n // `failLoudly`, unlike the platform file: this is only ever called because\n // the settings said overrides exist, so a 500, a timeout or a body that is\n // not JSON is a failure to read them — not a store that has none. Returning\n // `null` there would cache \"no overrides\" as a success, skip the query's\n // retry, and serve Salla's wording in place of the merchant's until the\n // entry expired. A 404 still means absent, and `rootBeforeLoad` catches the\n // throw and keeps the platform copy, so the worst case is unchanged.\n readLocaleFile(storeTranslationsPath(storeId, locale), { failLoudly: true }),\n\n /**\n * The platform's copy for `locale` with this merchant's wording laid over it.\n *\n * Takes the two as values rather than fetching them, so the caller decides\n * whether the second request happens at all and both stay separately cached.\n */\n /**\n * The platform's copy for `locale` with this merchant's wording over it.\n *\n * Delegates to `composeMessages`, which every other reader of these two\n * entries also uses — see `api/messages.ts` for why there is exactly one.\n */\n merge: (\n common: TranslationMessages | null,\n overrides: Messages | null,\n locale: string\n ): TranslationMessages | null => composeMessages(common, overrides, locale) ?? null,\n\n queries: {\n /**\n * @param locale taken as an argument rather than read from the twilight\n * context, and that is load-bearing. This key is built on the server, on\n * hydration, and again lazily from the context accessor; if any of the\n * three read a locale the others had not been given yet, the hydrated page\n * would miss the dehydrated entry and refetch both files it was just\n * handed. Every caller already has the locale in hand.\n *\n * The store is deliberately **not** in the key. One document serves one\n * store — a request that names a different one is redirected with\n * `reloadDocument`, so the client never changes store under a live cache —\n * and adding a value that resolves from the request on the server and from\n * the injected env on the client is how a key stops matching across\n * hydration.\n */\n byLocale: (locale: string) =>\n queryOptions({\n queryKey: translationsQueryKey(locale),\n queryFn: () => translations.get(locale),\n }),\n\n /**\n * This merchant's overrides, cached apart from the platform's copy.\n *\n * Its own entry rather than a wider `byLocale` key, so the common file is\n * fetched and dehydrated once per language whatever the store does, and a\n * store with no overrides never has an entry at all. Both sides compute the\n * key from the settings payload, so the hydrated page finds what the server\n * dehydrated instead of refetching it.\n */\n byStore: (storeId: string | number, locale: string) =>\n queryOptions({\n queryKey: storeTranslationsQueryKey(storeId, locale),\n queryFn: () => translations.forStore(storeId, locale),\n }),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configureNavigation, UnauthorizedError, NavigationProvider, resolveRelativePath } from './chunk-
|
|
1
|
+
import { configureNavigation, UnauthorizedError, NavigationProvider, resolveRelativePath } from './chunk-PLDWDVOP.js';
|
|
2
2
|
import { LinkProvider } from './chunk-EDCNCBSC.js';
|
|
3
3
|
import { useIsNativeApp } from './chunk-BZ2QSBXM.js';
|
|
4
4
|
import { onSallaEvent } from './chunk-MZPX4EPS.js';
|
|
@@ -214,5 +214,5 @@ function TanStackNavigationProvider({ children }) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
export { NavigationSetup, TanStackLinkAdapter, TanStackNavigationProvider, createTanStackLinkAdapter, documentRedirectHref, requestHostOf };
|
|
217
|
-
//# sourceMappingURL=chunk-
|
|
218
|
-
//# sourceMappingURL=chunk-
|
|
217
|
+
//# sourceMappingURL=chunk-T4PRV2MJ.js.map
|
|
218
|
+
//# sourceMappingURL=chunk-T4PRV2MJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tanstack/link.tsx","../src/tanstack/native-app-events.tsx","../src/utils/request-host.ts","../src/tanstack/navigation.tsx"],"names":["TanStackLink","tanstackNotFound","tanstackRedirect","useParams","jsx"],"mappings":";;;;;;;;;;;;AAWO,SAAS,mBAAA,CAAoB,aAAqB,MAAA,EAAiB;AAExE,EAAA,IAAI,CAAC,QAAA,CAAS,MAAM,CAAA,IAAK,CAAC,WAAA,CAAY,UAAA,CAAW,GAAG,CAAA,IAAK,WAAA,CAAY,UAAA,CAAW,IAAI,CAAA,EAAG;AACrF,IAAA,OAAO,WAAA;AAAA,EACT;AACA,EAAA,MAA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,UAAU,EAAE,MAAA,EAAQ,OAAO,CAAA;AAC9C,EAAA,MAAM,UAAA,GAAa,WAAA;AAAA,IACjB,CAAC,EAAA,EAAY,IAAA,KACX,QAAA,CAAS,EAAE,EAAA,EAAI,mBAAA,CAAoB,EAAA,EAAI,MAAM,CAAA,EAAG,OAAA,EAAS,IAAA,EAAM,SAAS,CAAA;AAAA,IAC1E,CAAC,UAAU,MAAM;AAAA,GACnB;AAEA,EAAA,uBACE,IAAA,CAAC,kBAAA,EAAA,EAAmB,QAAA,EAAU,UAAA,EAC5B,QAAA,EAAA;AAAA,oBAAAC,GAAAA,CAAC,mBAAgB,MAAA,EAAgB,CAAA;AAAA,oBACjCA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA,GAAA,EACxD,CAAA;AAEJ;AAGO,SAAS,0BAAA,CAA2B,EAAE,QAAA,EAAS,EAA4B;AAChF,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,uBACEA,GAAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,CAAC,EAAA,EAAY,IAAA,KAA2B,QAAA,CAAS,EAAE,EAAA,EAAI,OAAA,EAAS,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,MAEzF,QAAA,kBAAAA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA;AAAA,GACxD;AAEJ","file":"chunk-YD7DCIWM.js","sourcesContent":["import { forwardRef, createElement } from 'react';\nimport { Link as TanStackLink, useParams } from '@tanstack/react-router';\nimport { isLocale } from '../providers/locale-constants';\nimport type { BaseLinkProps } from '../components/common/Link.types';\n\n/**\n * Routes live under an optional `/{-$locale}` param, so a bare `to=\"/brands\"`\n * resolves with the locale omitted and the $locale loader bounces the user to\n * the fallback locale. Prefix the current locale onto internal paths that\n * don't already carry one.\n */\nexport function localizeDestination(destination: string, locale?: string) {\n // On the not-found page a first segment that is no language binds as the locale (`/p1-x`).\n if (!isLocale(locale) || !destination.startsWith('/') || destination.startsWith('//')) {\n return destination;\n }\n const firstSegment = destination.split('/')[1]?.split(/[?#]/)[0];\n if (isLocale(firstSegment)) return destination;\n return destination === '/' ? `/${locale}` : `/${locale}${destination}`;\n}\n\n/**\n * TanStack Router Link adapter.\n * Translates framework-agnostic props to TanStack Router Link props.\n */\nexport const TanStackLinkAdapter = forwardRef<HTMLAnchorElement, BaseLinkProps>(\n (\n {\n to,\n href,\n children,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload,\n replace,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref\n ) => {\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const destination = localizeDestination(to ?? href ?? '/', locale);\n\n // `#` is how a block says it has nowhere to go, such as a banner with no URL. An anchor with\n // no href keeps the theme's `a` styles, and the router can neither preload nor follow it.\n if (destination === '#') {\n return createElement(\n 'a',\n { ref, className, style, title, onClick, 'aria-label': ariaLabel, ...rest },\n children\n );\n }\n\n return createElement(\n TanStackLink,\n {\n ref,\n to: destination,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload: preload === 'intent' || preload === false ? preload : undefined,\n replace,\n 'aria-label': ariaLabel,\n ...(rest as Record<string, unknown>),\n },\n children\n );\n }\n);\n\nTanStackLinkAdapter.displayName = 'TanStackLinkAdapter';\n\n/**\n * Create a TanStack Router Link adapter component.\n */\nexport function createTanStackLinkAdapter() {\n return TanStackLinkAdapter;\n}\n","import { useEffect } from 'react';\nimport { useRouter } from '@tanstack/react-router';\nimport { resolveRelativePath } from '../providers/NavigationProvider';\nimport { useTwilight } from '../providers/twilight-context';\nimport { isLocale } from '../providers/locale-constants';\nimport { getTwilightContext } from '../twilight/context';\nimport { useIsNativeApp } from '../native-app';\nimport { onSallaEvent } from '../utils/sdk-helpers';\nimport { hasStoreUrlBase } from '../utils/store-base';\nimport { localizeDestination } from './link';\n\nconst UI_UPDATE_EVENT = 'mobile::ui.update';\nconst OPEN_ORDER_EVENT = 'mobile::open.order';\nconst NAVIGATE_TO_EVENT = 'mobile::navigate.to';\n\n/**\n * Events the native app sends into its webview. `NavigationSetup` mounts this once, so a\n * theme adds no listener of its own:\n *\n * - `mobile::ui.update` re-runs the route loaders and refetches what is on screen.\n * - `mobile::open.order` `{ id }` opens that order, with a fresh cart.\n * - `mobile::navigate.to` `{ url }` opens a notification deep link in-app. Only a link to\n * this store is followed (`deepLinkPath`), so `javascript:`, off-site and other stores'\n * URLs are dropped.\n *\n * Nothing is mounted outside the app (`useIsNativeApp()`), so a browser runs none of it.\n */\nexport function NativeAppEvents({ locale }: { locale?: string }) {\n return useIsNativeApp() ? <Listeners locale={locale} /> : null;\n}\n\nfunction Listeners({ locale }: { locale?: string }) {\n useNativeAppEvents(locale);\n return null;\n}\n\n/** The listeners themselves. `NativeAppEvents` mounts them inside the app only. */\nexport function useNativeAppEvents(locale?: string): void {\n const router = useRouter();\n const { store } = useTwilight();\n const storeUrl = store?.url;\n const username = store?.username;\n\n useEffect(() => {\n // `href`, not `to`: the router parses the query and the hash out of it.\n const open = (path: string) =>\n void router.navigate({ href: localizeDestination(path, locale) });\n\n const refresh = () => {\n void Promise.allSettled([\n router.invalidate(),\n getTwilightContext().queryClient?.refetchQueries({ type: 'active' }),\n ]);\n };\n const openOrder = (data?: unknown) => {\n const rawId = (data as { id?: unknown } | undefined)?.id;\n if (typeof rawId !== 'string' && typeof rawId !== 'number') return;\n\n const id = String(rawId).trim();\n if (!id) return;\n\n void getTwilightContext().queryClient?.invalidateQueries({ queryKey: ['cart'] });\n open(`/account/orders/${encodeURIComponent(id)}`);\n };\n const navigateTo = (data?: unknown) => {\n const url = (data as { url?: unknown } | undefined)?.url;\n if (typeof url !== 'string' || !url.trim() || !storeUrl) return;\n\n const path = deepLinkPath(url.trim(), storeUrl, username);\n if (path) void router.navigate({ href: inLocale(path, locale) });\n };\n\n const offs = [\n onSallaEvent(UI_UPDATE_EVENT, refresh),\n onSallaEvent(OPEN_ORDER_EVENT, openOrder),\n onSallaEvent(NAVIGATE_TO_EVENT, navigateTo),\n ];\n return () => offs.forEach((off) => off());\n }, [router, locale, storeUrl, username]);\n}\n\n/** A URL that names its host: `https://…` or `//…`. Anything else is a path of this app. */\nfunction isAbsoluteUrl(url: string): boolean {\n if (url.startsWith('//')) return true;\n try {\n // Without a base, only a URL with its own scheme parses.\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The application path of a deep link to this store, or null for any other link.\n *\n * It passes the test a tapped link does (`resolveRelativePath`: the store's origin, the\n * username taken off), and one more. On a shared host that origin is every store's, so\n * an absolute link has to carry this store's username: without it, another store's\n * `/ar/offers` would open this store's offers.\n */\nfunction deepLinkPath(url: string, storeUrl: string, username?: string): string | null {\n const path = resolveRelativePath(url, storeUrl, username);\n if (!path || !isAbsoluteUrl(url)) return path;\n\n // Both parse: `resolveRelativePath` returns null when either does not.\n const { pathname } = new URL(url, window.location.href);\n return hasStoreUrlBase(pathname, new URL(storeUrl).pathname, username) ? path : null;\n}\n\n/**\n * A deep link in the locale the visitor is browsing in. A notification is written in one\n * language and opened in whichever is on screen, so the link's own locale gives way.\n *\n * The prefix is written here, not by `localizeDestination`: that one leaves a path alone\n * when it already starts with a locale, and would take the slug of `/ar/en/p456` for one.\n */\nfunction inLocale(path: string, locale?: string): string {\n const first = path.split('/')[1]?.split(/[?#]/)[0];\n const own = isLocale(first) ? path.slice(first.length + 1) : path;\n const rest = own.startsWith('/') ? own : `/${own}`;\n\n if (!locale) return rest;\n return rest === '/' ? `/${locale}` : `/${locale}${rest}`;\n}\n","/**\n * What the request itself is enough to describe: its host.\n *\n * Small, and deliberately its own module rather than a helper inside the\n * middleware. This value decides two things — which store a live storefront is,\n * and whether the request is allowed to name a store at all — so it is worth\n * testing directly instead of only through the wiring that calls it.\n */\nimport { isLoopback } from './cookies';\n\n/** The part of a `Request` this needs, so a test does not have to build a whole one. */\nexport interface HostSource {\n url: string;\n headers: { get(name: string): string | null };\n}\n\n/**\n * The host this request arrived on, with its port when it has one.\n *\n * Taken from the request URL, which in a Worker is the address the platform\n * actually routed on, and from the `Host` header only when that fails.\n *\n * **`X-Forwarded-Host` is deliberately not consulted.** A client can set it, and\n * this value gates `allowsRequestStoreId` — so honouring it would be a way to\n * talk a merchant's own domain into behaving like the preview host, and from\n * there into serving a stranger's shop. The dispatcher strips that header today;\n * a theme must not be one edit to another repository's allowlist away from a\n * spoofable identity.\n */\nexport function requestHostOf(request: HostSource): string | null {\n try {\n const fromUrl = new URL(request.url).host;\n if (fromUrl) return fromUrl;\n } catch {\n /* an unparseable URL falls through to the header */\n }\n\n return request.headers.get('Host')?.trim() || null;\n}\n\n/** The origin a browser reached this host on: `http` for a dev server, `https` otherwise. */\nexport function requestOriginOf(host: string): string {\n return `${isLoopback(host.replace(/:\\d+$/, '')) ? 'http' : 'https'}://${host}`;\n}\n","import {\n useNavigate,\n useParams,\n redirect as tanstackRedirect,\n notFound as tanstackNotFound,\n} from '@tanstack/react-router';\nimport {\n NavigationProvider,\n configureNavigation,\n type NavigateOptions,\n} from '../providers/NavigationProvider';\nimport { LinkProvider } from '../providers/LinkProvider';\nimport { TanStackLinkAdapter, localizeDestination } from './link';\nimport { NativeAppEvents } from './native-app-events';\nimport { useCallback, type ReactNode } from 'react';\nimport { UnauthorizedError, type RedirectOptions } from '../providers/NavigationProvider';\nimport { getRequestStore, getTwilightContext } from '../twilight/context';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from '../utils/store-identity';\nimport { loginRedirectHref } from '../utils/store-base';\nimport { requestOriginOf } from '../utils/request-host';\n\n/**\n * Where a document redirect (`reloadDocument`) may go: an http(s) URL, or a path on this host. A\n * protocol-relative `//host` or any other scheme is refused here, as an error the caller made:\n * the router throws on those too, and a page that cannot redirect safely must not try.\n */\nexport function documentRedirectHref(target: string): string {\n if (target.startsWith('/') && !target.startsWith('//')) return target;\n const url = new URL(target);\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n throw new Error(`A document redirect needs an http(s) URL, not ${url.protocol}`);\n }\n return url.href;\n}\n\nfunction currentOrigin(): string | null {\n if (typeof window !== 'undefined') return window.location.origin;\n const host = getRequestStore().requestHost;\n return host ? requestOriginOf(host) : null;\n}\n\nconfigureNavigation({\n notFound: (message?: string) => {\n throw tanstackNotFound({ data: message });\n },\n redirect: (path: string, opts?: RedirectOptions) => {\n if (opts?.reloadDocument) {\n // `href`, not `to`: the router neither matches it nor adds the store base to it.\n const href = documentRedirectHref(path);\n throw tanstackRedirect({\n href,\n reloadDocument: true,\n replace: opts.replace,\n statusCode: opts.statusCode,\n });\n }\n throw tanstackRedirect({ to: path, replace: opts?.replace, statusCode: opts?.statusCode });\n },\n unauthorized: (message?: string) => {\n const origin = currentOrigin();\n const { pathname, searchStr } = getTwilightContext().location;\n const href =\n origin &&\n loginRedirectHref({\n pathname,\n searchStr,\n origin,\n base: resolveStoreBase(),\n baseFollowsLocale: resolveStoreBaseFollowsLocale(),\n });\n // A full load, because the SDK only reads `intended_to` when a page starts.\n if (href) throw tanstackRedirect({ href, reloadDocument: true, replace: true });\n throw new UnauthorizedError(message);\n },\n});\n\n/**\n * TanStack navigation setup - wraps children with NavigationProvider and LinkProvider.\n * Called by TwilightProvider when client.framework === 'tanstack'.\n */\nexport function NavigationSetup({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const navigateFn = useCallback(\n (to: string, opts?: NavigateOptions) =>\n navigate({ to: localizeDestination(to, locale), replace: opts?.replace }),\n [navigate, locale]\n );\n\n return (\n <NavigationProvider navigate={navigateFn}>\n <NativeAppEvents locale={locale} />\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n\n/** @deprecated Use NavigationSetup instead */\nexport function TanStackNavigationProvider({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n return (\n <NavigationProvider\n navigate={(to: string, opts?: NavigateOptions) => navigate({ to, replace: opts?.replace })}\n >\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/tanstack/link.tsx","../src/tanstack/native-app-events.tsx","../src/utils/request-host.ts","../src/tanstack/navigation.tsx"],"names":["TanStackLink","tanstackNotFound","tanstackRedirect","useParams","jsx"],"mappings":";;;;;;;;;;;;AAWO,SAAS,mBAAA,CAAoB,aAAqB,MAAA,EAAiB;AAExE,EAAA,IAAI,CAAC,QAAA,CAAS,MAAM,CAAA,IAAK,CAAC,WAAA,CAAY,UAAA,CAAW,GAAG,CAAA,IAAK,WAAA,CAAY,UAAA,CAAW,IAAI,CAAA,EAAG;AACrF,IAAA,OAAO,WAAA;AAAA,EACT;AACA,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,EAAG,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,CAAA;AAC/D,EAAA,IAAI,QAAA,CAAS,YAAY,CAAA,EAAG,OAAO,WAAA;AACnC,EAAA,OAAO,WAAA,KAAgB,MAAM,CAAA,CAAA,EAAI,MAAM,KAAK,CAAA,CAAA,EAAI,MAAM,GAAG,WAAW,CAAA,CAAA;AACtE;AAMO,IAAM,mBAAA,GAAsB,UAAA;AAAA,EACjC,CACE;AAAA,IACE,EAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA,EAAc,SAAA;AAAA,IACd,GAAG;AAAA,KAEL,GAAA,KACG;AACH,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,UAAU,EAAE,MAAA,EAAQ,OAAO,CAAA;AAC9C,IAAA,MAAM,WAAA,GAAc,mBAAA,CAAoB,EAAA,IAAM,IAAA,IAA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EAAI,OAAA,EAAS,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,MAEzF,QAAA,kBAAAA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA;AAAA,GACxD;AAEJ","file":"chunk-T4PRV2MJ.js","sourcesContent":["import { forwardRef, createElement } from 'react';\nimport { Link as TanStackLink, useParams } from '@tanstack/react-router';\nimport { isLocale } from '../providers/locale-constants';\nimport type { BaseLinkProps } from '../components/common/Link.types';\n\n/**\n * Routes live under an optional `/{-$locale}` param, so a bare `to=\"/brands\"`\n * resolves with the locale omitted and the $locale loader bounces the user to\n * the fallback locale. Prefix the current locale onto internal paths that\n * don't already carry one.\n */\nexport function localizeDestination(destination: string, locale?: string) {\n // On the not-found page a first segment that is no language binds as the locale (`/p1-x`).\n if (!isLocale(locale) || !destination.startsWith('/') || destination.startsWith('//')) {\n return destination;\n }\n const firstSegment = destination.split('/')[1]?.split(/[?#]/)[0];\n if (isLocale(firstSegment)) return destination;\n return destination === '/' ? `/${locale}` : `/${locale}${destination}`;\n}\n\n/**\n * TanStack Router Link adapter.\n * Translates framework-agnostic props to TanStack Router Link props.\n */\nexport const TanStackLinkAdapter = forwardRef<HTMLAnchorElement, BaseLinkProps>(\n (\n {\n to,\n href,\n children,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload,\n replace,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref\n ) => {\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const destination = localizeDestination(to ?? href ?? '/', locale);\n\n // `#` is how a block says it has nowhere to go, such as a banner with no URL. An anchor with\n // no href keeps the theme's `a` styles, and the router can neither preload nor follow it.\n if (destination === '#') {\n return createElement(\n 'a',\n { ref, className, style, title, onClick, 'aria-label': ariaLabel, ...rest },\n children\n );\n }\n\n return createElement(\n TanStackLink,\n {\n ref,\n to: destination,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload: preload === 'intent' || preload === false ? preload : undefined,\n replace,\n 'aria-label': ariaLabel,\n ...(rest as Record<string, unknown>),\n },\n children\n );\n }\n);\n\nTanStackLinkAdapter.displayName = 'TanStackLinkAdapter';\n\n/**\n * Create a TanStack Router Link adapter component.\n */\nexport function createTanStackLinkAdapter() {\n return TanStackLinkAdapter;\n}\n","import { useEffect } from 'react';\nimport { useRouter } from '@tanstack/react-router';\nimport { resolveRelativePath } from '../providers/NavigationProvider';\nimport { useTwilight } from '../providers/twilight-context';\nimport { isLocale } from '../providers/locale-constants';\nimport { getTwilightContext } from '../twilight/context';\nimport { useIsNativeApp } from '../native-app';\nimport { onSallaEvent } from '../utils/sdk-helpers';\nimport { hasStoreUrlBase } from '../utils/store-base';\nimport { localizeDestination } from './link';\n\nconst UI_UPDATE_EVENT = 'mobile::ui.update';\nconst OPEN_ORDER_EVENT = 'mobile::open.order';\nconst NAVIGATE_TO_EVENT = 'mobile::navigate.to';\n\n/**\n * Events the native app sends into its webview. `NavigationSetup` mounts this once, so a\n * theme adds no listener of its own:\n *\n * - `mobile::ui.update` re-runs the route loaders and refetches what is on screen.\n * - `mobile::open.order` `{ id }` opens that order, with a fresh cart.\n * - `mobile::navigate.to` `{ url }` opens a notification deep link in-app. Only a link to\n * this store is followed (`deepLinkPath`), so `javascript:`, off-site and other stores'\n * URLs are dropped.\n *\n * Nothing is mounted outside the app (`useIsNativeApp()`), so a browser runs none of it.\n */\nexport function NativeAppEvents({ locale }: { locale?: string }) {\n return useIsNativeApp() ? <Listeners locale={locale} /> : null;\n}\n\nfunction Listeners({ locale }: { locale?: string }) {\n useNativeAppEvents(locale);\n return null;\n}\n\n/** The listeners themselves. `NativeAppEvents` mounts them inside the app only. */\nexport function useNativeAppEvents(locale?: string): void {\n const router = useRouter();\n const { store } = useTwilight();\n const storeUrl = store?.url;\n const username = store?.username;\n\n useEffect(() => {\n // `href`, not `to`: the router parses the query and the hash out of it.\n const open = (path: string) =>\n void router.navigate({ href: localizeDestination(path, locale) });\n\n const refresh = () => {\n void Promise.allSettled([\n router.invalidate(),\n getTwilightContext().queryClient?.refetchQueries({ type: 'active' }),\n ]);\n };\n const openOrder = (data?: unknown) => {\n const rawId = (data as { id?: unknown } | undefined)?.id;\n if (typeof rawId !== 'string' && typeof rawId !== 'number') return;\n\n const id = String(rawId).trim();\n if (!id) return;\n\n void getTwilightContext().queryClient?.invalidateQueries({ queryKey: ['cart'] });\n open(`/account/orders/${encodeURIComponent(id)}`);\n };\n const navigateTo = (data?: unknown) => {\n const url = (data as { url?: unknown } | undefined)?.url;\n if (typeof url !== 'string' || !url.trim() || !storeUrl) return;\n\n const path = deepLinkPath(url.trim(), storeUrl, username);\n if (path) void router.navigate({ href: inLocale(path, locale) });\n };\n\n const offs = [\n onSallaEvent(UI_UPDATE_EVENT, refresh),\n onSallaEvent(OPEN_ORDER_EVENT, openOrder),\n onSallaEvent(NAVIGATE_TO_EVENT, navigateTo),\n ];\n return () => offs.forEach((off) => off());\n }, [router, locale, storeUrl, username]);\n}\n\n/** A URL that names its host: `https://…` or `//…`. Anything else is a path of this app. */\nfunction isAbsoluteUrl(url: string): boolean {\n if (url.startsWith('//')) return true;\n try {\n // Without a base, only a URL with its own scheme parses.\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The application path of a deep link to this store, or null for any other link.\n *\n * It passes the test a tapped link does (`resolveRelativePath`: the store's origin, the\n * username taken off), and one more. On a shared host that origin is every store's, so\n * an absolute link has to carry this store's username: without it, another store's\n * `/ar/offers` would open this store's offers.\n */\nfunction deepLinkPath(url: string, storeUrl: string, username?: string): string | null {\n const path = resolveRelativePath(url, storeUrl, username);\n if (!path || !isAbsoluteUrl(url)) return path;\n\n // Both parse: `resolveRelativePath` returns null when either does not.\n const { pathname } = new URL(url, window.location.href);\n return hasStoreUrlBase(pathname, new URL(storeUrl).pathname, username) ? path : null;\n}\n\n/**\n * A deep link in the locale the visitor is browsing in. A notification is written in one\n * language and opened in whichever is on screen, so the link's own locale gives way.\n *\n * The prefix is written here, not by `localizeDestination`: that one leaves a path alone\n * when it already starts with a locale, and would take the slug of `/ar/en/p456` for one.\n */\nfunction inLocale(path: string, locale?: string): string {\n const first = path.split('/')[1]?.split(/[?#]/)[0];\n const own = isLocale(first) ? path.slice(first.length + 1) : path;\n const rest = own.startsWith('/') ? own : `/${own}`;\n\n if (!locale) return rest;\n return rest === '/' ? `/${locale}` : `/${locale}${rest}`;\n}\n","/**\n * What the request itself is enough to describe: its host.\n *\n * Small, and deliberately its own module rather than a helper inside the\n * middleware. This value decides two things — which store a live storefront is,\n * and whether the request is allowed to name a store at all — so it is worth\n * testing directly instead of only through the wiring that calls it.\n */\nimport { isLoopback } from './cookies';\n\n/** The part of a `Request` this needs, so a test does not have to build a whole one. */\nexport interface HostSource {\n url: string;\n headers: { get(name: string): string | null };\n}\n\n/**\n * The host this request arrived on, with its port when it has one.\n *\n * Taken from the request URL, which in a Worker is the address the platform\n * actually routed on, and from the `Host` header only when that fails.\n *\n * **`X-Forwarded-Host` is deliberately not consulted.** A client can set it, and\n * this value gates `allowsRequestStoreId` — so honouring it would be a way to\n * talk a merchant's own domain into behaving like the preview host, and from\n * there into serving a stranger's shop. The dispatcher strips that header today;\n * a theme must not be one edit to another repository's allowlist away from a\n * spoofable identity.\n */\nexport function requestHostOf(request: HostSource): string | null {\n try {\n const fromUrl = new URL(request.url).host;\n if (fromUrl) return fromUrl;\n } catch {\n /* an unparseable URL falls through to the header */\n }\n\n return request.headers.get('Host')?.trim() || null;\n}\n\n/** The origin a browser reached this host on: `http` for a dev server, `https` otherwise. */\nexport function requestOriginOf(host: string): string {\n return `${isLoopback(host.replace(/:\\d+$/, '')) ? 'http' : 'https'}://${host}`;\n}\n","import {\n useNavigate,\n useParams,\n redirect as tanstackRedirect,\n notFound as tanstackNotFound,\n} from '@tanstack/react-router';\nimport {\n NavigationProvider,\n configureNavigation,\n type NavigateOptions,\n} from '../providers/NavigationProvider';\nimport { LinkProvider } from '../providers/LinkProvider';\nimport { TanStackLinkAdapter, localizeDestination } from './link';\nimport { NativeAppEvents } from './native-app-events';\nimport { useCallback, type ReactNode } from 'react';\nimport { UnauthorizedError, type RedirectOptions } from '../providers/NavigationProvider';\nimport { getRequestStore, getTwilightContext } from '../twilight/context';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from '../utils/store-identity';\nimport { loginRedirectHref } from '../utils/store-base';\nimport { requestOriginOf } from '../utils/request-host';\n\n/**\n * Where a document redirect (`reloadDocument`) may go: an http(s) URL, or a path on this host. A\n * protocol-relative `//host` or any other scheme is refused here, as an error the caller made:\n * the router throws on those too, and a page that cannot redirect safely must not try.\n */\nexport function documentRedirectHref(target: string): string {\n if (target.startsWith('/') && !target.startsWith('//')) return target;\n const url = new URL(target);\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n throw new Error(`A document redirect needs an http(s) URL, not ${url.protocol}`);\n }\n return url.href;\n}\n\nfunction currentOrigin(): string | null {\n if (typeof window !== 'undefined') return window.location.origin;\n const host = getRequestStore().requestHost;\n return host ? requestOriginOf(host) : null;\n}\n\nconfigureNavigation({\n notFound: (message?: string) => {\n throw tanstackNotFound({ data: message });\n },\n redirect: (path: string, opts?: RedirectOptions) => {\n if (opts?.reloadDocument) {\n // `href`, not `to`: the router neither matches it nor adds the store base to it.\n const href = documentRedirectHref(path);\n throw tanstackRedirect({\n href,\n reloadDocument: true,\n replace: opts.replace,\n statusCode: opts.statusCode,\n });\n }\n throw tanstackRedirect({ to: path, replace: opts?.replace, statusCode: opts?.statusCode });\n },\n unauthorized: (message?: string) => {\n const origin = currentOrigin();\n const { pathname, searchStr } = getTwilightContext().location;\n const href =\n origin &&\n loginRedirectHref({\n pathname,\n searchStr,\n origin,\n base: resolveStoreBase(),\n baseFollowsLocale: resolveStoreBaseFollowsLocale(),\n });\n // A full load, because the SDK only reads `intended_to` when a page starts.\n if (href) throw tanstackRedirect({ href, reloadDocument: true, replace: true });\n throw new UnauthorizedError(message);\n },\n});\n\n/**\n * TanStack navigation setup - wraps children with NavigationProvider and LinkProvider.\n * Called by TwilightProvider when client.framework === 'tanstack'.\n */\nexport function NavigationSetup({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const navigateFn = useCallback(\n (to: string, opts?: NavigateOptions) =>\n navigate({ to: localizeDestination(to, locale), replace: opts?.replace }),\n [navigate, locale]\n );\n\n return (\n <NavigationProvider navigate={navigateFn}>\n <NativeAppEvents locale={locale} />\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n\n/** @deprecated Use NavigationSetup instead */\nexport function TanStackNavigationProvider({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n return (\n <NavigationProvider\n navigate={(to: string, opts?: NavigateOptions) => navigate({ to, replace: opts?.replace })}\n >\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n"]}
|
|
@@ -25,6 +25,7 @@ function reorder(order, from, to) {
|
|
|
25
25
|
var drawer = null;
|
|
26
26
|
function useLiveBlockList(onList) {
|
|
27
27
|
useEffect(() => {
|
|
28
|
+
if (!onList) return;
|
|
28
29
|
drawer = onList;
|
|
29
30
|
return () => {
|
|
30
31
|
if (drawer === onList) drawer = null;
|
|
@@ -38,5 +39,5 @@ function drawLiveBlocks(blocks) {
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export { drawLiveBlocks, moveLiveBlock, reorder, useLiveBlockList, useLiveBlockMoves };
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-TJK4DVQM.js.map
|
|
43
|
+
//# sourceMappingURL=chunk-TJK4DVQM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/live-editor/moves.ts"],"names":[],"mappings":";;;AAYA,IAAI,KAAA,GAAsB,IAAA;AAGnB,SAAS,kBAAkB,MAAA,EAAqB;AACrD,EAAA,S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A,CAAO,MAAM,CAAA;AACb,EAAA,OAAO,IAAA;AACT","file":"chunk-TJK4DVQM.js","sourcesContent":["/**\n * Moving a home block in the theme editor's preview without reloading it: the\n * editor saves the new order, and the home page shows it right away, the way\n * the twig themes' `live-themes-editor.js` moves a section on the page.\n */\n\nimport { useEffect } from 'react';\nimport type { HomeComponentData } from '../../types';\n\ntype Mover = (from: number, to: number) => void;\n\n/** The home page on screen, if any; it alone knows the order its blocks render in. */\nlet mover: Mover | null = null;\n\n/** Lets the bar move the page's blocks while the page is mounted. */\nexport function useLiveBlockMoves(onMove: Mover): void {\n useEffect(() => {\n mover = onMove;\n return () => {\n if (mover === onMove) mover = null;\n };\n }, [onMove]);\n}\n\n/** Moves the block rendered at `from` to `to`; `false` when no home page is on screen. */\nexport function moveLiveBlock(from: number, to: number): boolean {\n if (!mover) return false;\n mover(from, to);\n return true;\n}\n\n/** `order` with the entry at `from` moved to `to`; as it is when either is out of range. */\nexport function reorder(order: readonly number[], from: number, to: number): number[] {\n const next = [...order];\n if (from === to || from < 0 || to < 0 || from >= next.length || to >= next.length) return next;\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n return next;\n}\n\ntype Drawer = (blocks: HomeComponentData[]) => void;\n\n/** The home page on screen, if any, to draw a fresh list of blocks in place. */\nlet drawer: Drawer | null = null;\n\n/** Lets the design studio draw the page's blocks again, as it saved them, while the page is mounted; `null` refuses. */\nexport function useLiveBlockList(onList: Drawer | null): void {\n useEffect(() => {\n if (!onList) return;\n drawer = onList;\n return () => {\n if (drawer === onList) drawer = null;\n };\n }, [onList]);\n}\n\n/** Draws `blocks` on the home page in place of the ones it loaded; `false` when no home page is on screen. */\nexport function drawLiveBlocks(blocks: HomeComponentData[]): boolean {\n if (!drawer) return false;\n drawer(blocks);\n return true;\n}\n"]}
|
|
@@ -147,7 +147,7 @@ function takeFrameReport(message) {
|
|
|
147
147
|
async function answerLookup(message) {
|
|
148
148
|
const { requestId, source, query } = message;
|
|
149
149
|
try {
|
|
150
|
-
const { lookupInStore } = await import('./store-lookup-
|
|
150
|
+
const { lookupInStore } = await import('./store-lookup-RAKQFOTD.js');
|
|
151
151
|
sendToEditor({ kind: "lookup-result", requestId, items: await lookupInStore(source, query) });
|
|
152
152
|
} catch (error) {
|
|
153
153
|
sendToEditor({
|
|
@@ -500,5 +500,5 @@ function useDevLayoutBlocks(components) {
|
|
|
500
500
|
var useDevHomeBlocks = import.meta.env.DEV ? useDevLayoutBlocks : (components) => components;
|
|
501
501
|
|
|
502
502
|
export { blockPath, devSettingsStore, useDevEditorMeta, useDevHomeBlocks, useDevReportSettingsFetchedAt, useDevSettingsOverrides, useDevSettingsState };
|
|
503
|
-
//# sourceMappingURL=chunk-
|
|
504
|
-
//# sourceMappingURL=chunk-
|
|
503
|
+
//# sourceMappingURL=chunk-UKLMGZZ2.js.map
|
|
504
|
+
//# sourceMappingURL=chunk-UKLMGZZ2.js.map
|