@salla.sa/twilight-theme-engine 1.0.171 → 1.0.172
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-PETEJAYF.js → AddToCartForm-CP2DUQXQ.js} +3 -3
- package/dist/{AddToCartForm-PETEJAYF.js.map → AddToCartForm-CP2DUQXQ.js.map} +1 -1
- package/dist/{BlogAuthorPage-NR6WFTJN.js → BlogAuthorPage-D7HGCT6L.js} +28 -28
- package/dist/{BlogAuthorPage-NR6WFTJN.js.map → BlogAuthorPage-D7HGCT6L.js.map} +1 -1
- package/dist/{BlogCategoryPage-26LL6UCQ.js → BlogCategoryPage-L62HDZ5U.js} +28 -28
- package/dist/{BlogCategoryPage-26LL6UCQ.js.map → BlogCategoryPage-L62HDZ5U.js.map} +1 -1
- package/dist/{BlogPage-EUR36YGA.js → BlogPage-GVPHDXM7.js} +26 -26
- package/dist/{BlogPage-EUR36YGA.js.map → BlogPage-GVPHDXM7.js.map} +1 -1
- package/dist/{BlogSinglePage-VDYX5UEI.js → BlogSinglePage-JI6PF2PZ.js} +26 -26
- package/dist/{BlogSinglePage-VDYX5UEI.js.map → BlogSinglePage-JI6PF2PZ.js.map} +1 -1
- package/dist/{BlogTagPage-XYG6L57H.js → BlogTagPage-4CPVSK4N.js} +28 -28
- package/dist/{BlogTagPage-XYG6L57H.js.map → BlogTagPage-4CPVSK4N.js.map} +1 -1
- package/dist/{BrandsPage-7U3H5FTY.js → BrandsPage-RQWFJ2NA.js} +27 -27
- package/dist/{BrandsPage-7U3H5FTY.js.map → BrandsPage-RQWFJ2NA.js.map} +1 -1
- package/dist/{Breadcrumb-B4MCXUPV.js → Breadcrumb-YWYMZOVS.js} +26 -26
- package/dist/{Breadcrumb-B4MCXUPV.js.map → Breadcrumb-YWYMZOVS.js.map} +1 -1
- package/dist/{CartItem-OMALYDHX.js → CartItem-SSRM47RB.js} +26 -26
- package/dist/{CartItem-OMALYDHX.js.map → CartItem-SSRM47RB.js.map} +1 -1
- package/dist/{CartSummary-H4UOGIV4.js → CartSummary-PQAVSCO6.js} +26 -26
- package/dist/{CartSummary-H4UOGIV4.js.map → CartSummary-PQAVSCO6.js.map} +1 -1
- package/dist/{Copyright-KREJU4IH.js → Copyright-C7YFU4K6.js} +3 -3
- package/dist/{Copyright-KREJU4IH.js.map → Copyright-C7YFU4K6.js.map} +1 -1
- package/dist/{CustomerLayout-Q7XCXKFQ.js → CustomerLayout-VIL3OD2W.js} +26 -26
- package/dist/{CustomerLayout-Q7XCXKFQ.js.map → CustomerLayout-VIL3OD2W.js.map} +1 -1
- package/dist/{Footer-FCL3CXYR.js → Footer-AXZR5QCB.js} +4 -4
- package/dist/{Footer-FCL3CXYR.js.map → Footer-AXZR5QCB.js.map} +1 -1
- package/dist/GoogleTag-SQNIYE2R.js +15 -0
- package/dist/{GoogleTag-WPDIRBEA.js.map → GoogleTag-SQNIYE2R.js.map} +1 -1
- package/dist/{Header-FC46PPV3.js → Header-HQEUET4K.js} +11 -11
- package/dist/{Header-FC46PPV3.js.map → Header-HQEUET4K.js.map} +1 -1
- package/dist/{LatestProducts-MY2R7KLG.js → LatestProducts-EBOFCBJF.js} +28 -28
- package/dist/{LatestProducts-MY2R7KLG.js.map → LatestProducts-EBOFCBJF.js.map} +1 -1
- package/dist/{LoyaltyPage-KNHXLI2H.js → LoyaltyPage-ID76YGAK.js} +26 -26
- package/dist/{LoyaltyPage-KNHXLI2H.js.map → LoyaltyPage-ID76YGAK.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-KFFVWV3X.js → LoyaltyPointsPage-M5MKSV2D.js} +8 -8
- package/dist/{LoyaltyPointsPage-KFFVWV3X.js.map → LoyaltyPointsPage-M5MKSV2D.js.map} +1 -1
- package/dist/{MainMenu-BCFJTGHV.js → MainMenu-LFQMBMIR.js} +7 -7
- package/dist/{MainMenu-BCFJTGHV.js.map → MainMenu-LFQMBMIR.js.map} +1 -1
- package/dist/{MasterLayout-C7EQFCEL.js → MasterLayout-ADXPSCW3.js} +26 -26
- package/dist/{MasterLayout-C7EQFCEL.js.map → MasterLayout-ADXPSCW3.js.map} +1 -1
- package/dist/{MobileMenu-2H3JR4CV.js → MobileMenu-FXHIFTL2.js} +27 -27
- package/dist/{MobileMenu-2H3JR4CV.js.map → MobileMenu-FXHIFTL2.js.map} +1 -1
- package/dist/{NotificationsPage-MMPYLBWF.js → NotificationsPage-773KMXJD.js} +26 -26
- package/dist/{NotificationsPage-MMPYLBWF.js.map → NotificationsPage-773KMXJD.js.map} +1 -1
- package/dist/{OrderSinglePage-W2NSO2WY.js → OrderSinglePage-PBB65273.js} +27 -27
- package/dist/{OrderSinglePage-W2NSO2WY.js.map → OrderSinglePage-PBB65273.js.map} +1 -1
- package/dist/{OrdersPage-JPE2QR43.js → OrdersPage-Z7HUNA2Y.js} +26 -26
- package/dist/{OrdersPage-JPE2QR43.js.map → OrdersPage-Z7HUNA2Y.js.map} +1 -1
- package/dist/{PageSingle-SANFW4M5.js → PageSingle-DHFALRVZ.js} +6 -6
- package/dist/{PageSingle-SANFW4M5.js.map → PageSingle-DHFALRVZ.js.map} +1 -1
- package/dist/{ProductDetails-NQPSWMP6.js → ProductDetails-BTXBZ34L.js} +7 -7
- package/dist/{ProductDetails-NQPSWMP6.js.map → ProductDetails-BTXBZ34L.js.map} +1 -1
- package/dist/{ProfilePage-GS2B2L6I.js → ProfilePage-GCYX2QCK.js} +26 -26
- package/dist/{ProfilePage-GS2B2L6I.js.map → ProfilePage-GCYX2QCK.js.map} +1 -1
- package/dist/{ReviewsPage-S2I5RFIF.js → ReviewsPage-QQBVPWAF.js} +3 -3
- package/dist/{ReviewsPage-S2I5RFIF.js.map → ReviewsPage-QQBVPWAF.js.map} +1 -1
- package/dist/{SeoCartWidget-GW2TAGXD.js → SeoCartWidget-QATYFQFL.js} +26 -26
- package/dist/{SeoCartWidget-GW2TAGXD.js.map → SeoCartWidget-QATYFQFL.js.map} +1 -1
- package/dist/{SettingsPage-3BVO7ZUK.js → SettingsPage-XZ3VHCJQ.js} +26 -26
- package/dist/{SettingsPage-3BVO7ZUK.js.map → SettingsPage-XZ3VHCJQ.js.map} +1 -1
- package/dist/{StoreClosedNotification-IQ5DNN6D.js → StoreClosedNotification-DFZZGA3U.js} +27 -27
- package/dist/{StoreClosedNotification-IQ5DNN6D.js.map → StoreClosedNotification-DFZZGA3U.js.map} +1 -1
- package/dist/{TestimonialsPage-CJJ7EHJ2.js → TestimonialsPage-V4PU2CFU.js} +6 -6
- package/dist/{TestimonialsPage-CJJ7EHJ2.js.map → TestimonialsPage-V4PU2CFU.js.map} +1 -1
- package/dist/{ThankYouPage-ASQROE5J.js → ThankYouPage-2WXIQUAZ.js} +26 -26
- package/dist/{ThankYouPage-ASQROE5J.js.map → ThankYouPage-2WXIQUAZ.js.map} +1 -1
- package/dist/{WalletPage-22CVWSRV.js → WalletPage-EJQJ7UVB.js} +27 -27
- package/dist/{WalletPage-22CVWSRV.js.map → WalletPage-EJQJ7UVB.js.map} +1 -1
- package/dist/{WebMcpTools-3YNG5IF6.js → WebMcpTools-ZKQZFUOT.js} +9 -9
- package/dist/{WebMcpTools-3YNG5IF6.js.map → WebMcpTools-ZKQZFUOT.js.map} +1 -1
- package/dist/{WishlistPage-NTHBN65W.js → WishlistPage-ECQXUNQ7.js} +28 -28
- package/dist/{WishlistPage-NTHBN65W.js.map → WishlistPage-ECQXUNQ7.js.map} +1 -1
- package/dist/api/advertisement.js +4 -4
- package/dist/api/apps.js +4 -4
- package/dist/api/blog.js +6 -6
- package/dist/api/brands.js +6 -6
- package/dist/api/cart.js +6 -6
- package/dist/api/category.js +6 -6
- package/dist/api/client.js +3 -3
- package/dist/api/custom-url.js +4 -4
- package/dist/api/home.js +4 -4
- package/dist/api/loyalty.js +6 -6
- package/dist/api/menu.js +4 -4
- package/dist/api/notification.js +4 -4
- package/dist/api/order.js +6 -6
- package/dist/api/page.js +6 -6
- package/dist/api/product.js +6 -6
- package/dist/api/profile.js +3 -3
- package/dist/api/store.js +5 -5
- package/dist/api/translations.js +4 -4
- package/dist/api/user.js +4 -4
- package/dist/api/wallet.js +4 -4
- package/dist/api/wishlist.js +7 -7
- package/dist/{chunk-A7J4RNOU.js → chunk-2KQTNVBK.js} +4 -4
- package/dist/{chunk-A7J4RNOU.js.map → chunk-2KQTNVBK.js.map} +1 -1
- package/dist/{chunk-DY7RGAJK.js → chunk-3CPDJUBA.js} +17 -17
- package/dist/{chunk-DY7RGAJK.js.map → chunk-3CPDJUBA.js.map} +1 -1
- package/dist/{chunk-LX2IWLNL.js → chunk-4OLFJ6FD.js} +3 -3
- package/dist/{chunk-LX2IWLNL.js.map → chunk-4OLFJ6FD.js.map} +1 -1
- package/dist/{chunk-7JPLL464.js → chunk-4RUBZXPF.js} +3 -3
- package/dist/{chunk-7JPLL464.js.map → chunk-4RUBZXPF.js.map} +1 -1
- package/dist/{chunk-P2RT7RII.js → chunk-6L27TXQZ.js} +5 -2
- package/dist/chunk-6L27TXQZ.js.map +1 -0
- package/dist/{chunk-UODKURVP.js → chunk-6QWV7LNB.js} +4 -4
- package/dist/{chunk-UODKURVP.js.map → chunk-6QWV7LNB.js.map} +1 -1
- package/dist/{chunk-T4QPJAKY.js → chunk-6URDFA6Q.js} +4 -4
- package/dist/{chunk-T4QPJAKY.js.map → chunk-6URDFA6Q.js.map} +1 -1
- package/dist/{chunk-K2PXOXWW.js → chunk-72I3BHQT.js} +5 -5
- package/dist/{chunk-K2PXOXWW.js.map → chunk-72I3BHQT.js.map} +1 -1
- package/dist/{chunk-4G3EWEDW.js → chunk-7FZ4VUQD.js} +5 -5
- package/dist/{chunk-4G3EWEDW.js.map → chunk-7FZ4VUQD.js.map} +1 -1
- package/dist/{chunk-QA7QOYRI.js → chunk-A66EW3NM.js} +5 -5
- package/dist/{chunk-QA7QOYRI.js.map → chunk-A66EW3NM.js.map} +1 -1
- package/dist/{chunk-RMXQMMZR.js → chunk-A6VWDMFG.js} +4 -4
- package/dist/{chunk-RMXQMMZR.js.map → chunk-A6VWDMFG.js.map} +1 -1
- package/dist/{chunk-X5RYXRGW.js → chunk-BCBA2ZV3.js} +3 -3
- package/dist/{chunk-X5RYXRGW.js.map → chunk-BCBA2ZV3.js.map} +1 -1
- package/dist/{chunk-LZRC4FX5.js → chunk-BFWYWHF2.js} +4 -4
- package/dist/{chunk-LZRC4FX5.js.map → chunk-BFWYWHF2.js.map} +1 -1
- package/dist/{chunk-ZNIDTHQR.js → chunk-D4C66U4G.js} +4 -4
- package/dist/{chunk-ZNIDTHQR.js.map → chunk-D4C66U4G.js.map} +1 -1
- package/dist/{chunk-7GKF7ID7.js → chunk-DA5KIZCN.js} +3 -3
- package/dist/{chunk-7GKF7ID7.js.map → chunk-DA5KIZCN.js.map} +1 -1
- package/dist/{chunk-CYDUDCPL.js → chunk-DDUYTOOW.js} +7 -7
- package/dist/{chunk-CYDUDCPL.js.map → chunk-DDUYTOOW.js.map} +1 -1
- package/dist/{chunk-42LVDS2S.js → chunk-DSV5O5P5.js} +6 -6
- package/dist/{chunk-42LVDS2S.js.map → chunk-DSV5O5P5.js.map} +1 -1
- package/dist/{chunk-4ALVJNVW.js → chunk-DSZZCRH3.js} +4 -4
- package/dist/{chunk-4ALVJNVW.js.map → chunk-DSZZCRH3.js.map} +1 -1
- package/dist/{chunk-7WLTRGGX.js → chunk-E2DFCIP6.js} +4 -4
- package/dist/{chunk-7WLTRGGX.js.map → chunk-E2DFCIP6.js.map} +1 -1
- package/dist/{chunk-3T5KKY6Z.js → chunk-ETQVMUK2.js} +5 -5
- package/dist/{chunk-3T5KKY6Z.js.map → chunk-ETQVMUK2.js.map} +1 -1
- package/dist/{chunk-YTL7DNHA.js → chunk-F3L26JYO.js} +3 -3
- package/dist/{chunk-YTL7DNHA.js.map → chunk-F3L26JYO.js.map} +1 -1
- package/dist/{chunk-6XVH5SDL.js → chunk-F6GOQAYU.js} +3 -3
- package/dist/{chunk-6XVH5SDL.js.map → chunk-F6GOQAYU.js.map} +1 -1
- package/dist/{chunk-T6DHTOH6.js → chunk-FFN6BITL.js} +3 -3
- package/dist/{chunk-T6DHTOH6.js.map → chunk-FFN6BITL.js.map} +1 -1
- package/dist/{chunk-RJWJLHVI.js → chunk-GB7T5KAR.js} +4 -4
- package/dist/{chunk-RJWJLHVI.js.map → chunk-GB7T5KAR.js.map} +1 -1
- package/dist/{chunk-EGZYS5RY.js → chunk-GDLDGRT3.js} +5 -5
- package/dist/{chunk-EGZYS5RY.js.map → chunk-GDLDGRT3.js.map} +1 -1
- package/dist/{chunk-AB7KTJYY.js → chunk-GHKOMS3G.js} +3 -3
- package/dist/{chunk-AB7KTJYY.js.map → chunk-GHKOMS3G.js.map} +1 -1
- package/dist/{chunk-2WZEBALV.js → chunk-GV3BBFU2.js} +3 -3
- package/dist/{chunk-2WZEBALV.js.map → chunk-GV3BBFU2.js.map} +1 -1
- package/dist/{chunk-2C4FCBWZ.js → chunk-H6TNEM3F.js} +3 -3
- package/dist/{chunk-2C4FCBWZ.js.map → chunk-H6TNEM3F.js.map} +1 -1
- package/dist/{chunk-MWAJ77KY.js → chunk-I2A2IK4A.js} +3 -3
- package/dist/{chunk-MWAJ77KY.js.map → chunk-I2A2IK4A.js.map} +1 -1
- package/dist/{chunk-BWEYNJCK.js → chunk-IAT5BQJM.js} +3 -3
- package/dist/{chunk-BWEYNJCK.js.map → chunk-IAT5BQJM.js.map} +1 -1
- package/dist/{chunk-HCGFF7EK.js → chunk-IEC6Z7GX.js} +8 -8
- package/dist/{chunk-HCGFF7EK.js.map → chunk-IEC6Z7GX.js.map} +1 -1
- package/dist/{chunk-X3R5BZ4A.js → chunk-JCLVC5V5.js} +6 -6
- package/dist/{chunk-X3R5BZ4A.js.map → chunk-JCLVC5V5.js.map} +1 -1
- package/dist/{chunk-WXXGBZJH.js → chunk-KDIG3QCW.js} +3 -3
- package/dist/{chunk-WXXGBZJH.js.map → chunk-KDIG3QCW.js.map} +1 -1
- package/dist/{chunk-LAXSKYAW.js → chunk-LS5SOPM5.js} +4 -4
- package/dist/{chunk-LAXSKYAW.js.map → chunk-LS5SOPM5.js.map} +1 -1
- package/dist/{chunk-3XMBFMP2.js → chunk-M6JRG7YP.js} +4 -4
- package/dist/{chunk-3XMBFMP2.js.map → chunk-M6JRG7YP.js.map} +1 -1
- package/dist/{chunk-J3V5EAHP.js → chunk-MBO6R4YT.js} +3 -3
- package/dist/{chunk-J3V5EAHP.js.map → chunk-MBO6R4YT.js.map} +1 -1
- package/dist/{chunk-I53FQCLP.js → chunk-NCFKY53L.js} +3 -3
- package/dist/{chunk-I53FQCLP.js.map → chunk-NCFKY53L.js.map} +1 -1
- package/dist/{chunk-XS2YRI53.js → chunk-NHDAX2TV.js} +5 -5
- package/dist/{chunk-XS2YRI53.js.map → chunk-NHDAX2TV.js.map} +1 -1
- package/dist/{chunk-MDFCCC26.js → chunk-NTWKO5UW.js} +3 -3
- package/dist/{chunk-MDFCCC26.js.map → chunk-NTWKO5UW.js.map} +1 -1
- package/dist/{chunk-IG47QC5P.js → chunk-NYTFXIO6.js} +6 -6
- package/dist/{chunk-IG47QC5P.js.map → chunk-NYTFXIO6.js.map} +1 -1
- package/dist/{chunk-6ESD4JC7.js → chunk-OQKEG3IV.js} +7 -7
- package/dist/{chunk-6ESD4JC7.js.map → chunk-OQKEG3IV.js.map} +1 -1
- package/dist/{chunk-EVI27KXN.js → chunk-PANEYT2O.js} +4 -4
- package/dist/{chunk-EVI27KXN.js.map → chunk-PANEYT2O.js.map} +1 -1
- package/dist/{chunk-NCB6RRC7.js → chunk-PEBZUSYL.js} +6 -6
- package/dist/{chunk-NCB6RRC7.js.map → chunk-PEBZUSYL.js.map} +1 -1
- package/dist/{chunk-YHNR22Z6.js → chunk-QOII3EJK.js} +4 -4
- package/dist/{chunk-YHNR22Z6.js.map → chunk-QOII3EJK.js.map} +1 -1
- package/dist/{chunk-OS2BPZSU.js → chunk-RBXU5NIL.js} +3 -3
- package/dist/{chunk-OS2BPZSU.js.map → chunk-RBXU5NIL.js.map} +1 -1
- package/dist/{chunk-7WYU4NWU.js → chunk-RD2WI3B6.js} +6 -6
- package/dist/{chunk-7WYU4NWU.js.map → chunk-RD2WI3B6.js.map} +1 -1
- package/dist/{chunk-IOI2O5S3.js → chunk-SAEDRRJ6.js} +6 -6
- package/dist/{chunk-IOI2O5S3.js.map → chunk-SAEDRRJ6.js.map} +1 -1
- package/dist/{chunk-6YNBBQM5.js → chunk-SHYXOSWF.js} +5 -5
- package/dist/{chunk-6YNBBQM5.js.map → chunk-SHYXOSWF.js.map} +1 -1
- package/dist/{chunk-JDTETNQF.js → chunk-SROBTJSP.js} +3 -3
- package/dist/{chunk-JDTETNQF.js.map → chunk-SROBTJSP.js.map} +1 -1
- package/dist/{chunk-WLMBEK27.js → chunk-TKXBXR7Y.js} +5 -5
- package/dist/{chunk-WLMBEK27.js.map → chunk-TKXBXR7Y.js.map} +1 -1
- package/dist/{chunk-67TWW55N.js → chunk-TY7AQ3IH.js} +8 -8
- package/dist/{chunk-67TWW55N.js.map → chunk-TY7AQ3IH.js.map} +1 -1
- package/dist/{chunk-GDHS4DZP.js → chunk-VMR6LIIM.js} +3 -3
- package/dist/{chunk-GDHS4DZP.js.map → chunk-VMR6LIIM.js.map} +1 -1
- package/dist/{chunk-OBURHVLL.js → chunk-VMZKY2FW.js} +3 -3
- package/dist/{chunk-OBURHVLL.js.map → chunk-VMZKY2FW.js.map} +1 -1
- package/dist/{chunk-TLY2QNEB.js → chunk-XCBGONNP.js} +3 -3
- package/dist/{chunk-TLY2QNEB.js.map → chunk-XCBGONNP.js.map} +1 -1
- package/dist/{chunk-IK5JWEHS.js → chunk-XFLTOO57.js} +3 -3
- package/dist/{chunk-IK5JWEHS.js.map → chunk-XFLTOO57.js.map} +1 -1
- package/dist/{chunk-4EFED5UW.js → chunk-XKUECSMV.js} +5 -5
- package/dist/{chunk-4EFED5UW.js.map → chunk-XKUECSMV.js.map} +1 -1
- package/dist/{chunk-PA43DJCF.js → chunk-XVPNLGXR.js} +4 -4
- package/dist/{chunk-PA43DJCF.js.map → chunk-XVPNLGXR.js.map} +1 -1
- package/dist/{chunk-R3NACW4I.js → chunk-YJAP3PYT.js} +3 -3
- package/dist/{chunk-R3NACW4I.js.map → chunk-YJAP3PYT.js.map} +1 -1
- package/dist/{chunk-N2VUTPHF.js → chunk-YUUPU6SH.js} +23 -23
- package/dist/{chunk-N2VUTPHF.js.map → chunk-YUUPU6SH.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 +24 -24
- package/dist/components/home/index.js +29 -29
- package/dist/components/layout/index.js +6 -6
- package/dist/components/product/index.js +26 -26
- package/dist/components/store/index.js +25 -25
- package/dist/components/toast/index.js +4 -4
- package/dist/components/tracking/index.js +9 -9
- package/dist/custom-urls-OIEI6T6D.js +17 -0
- package/dist/{custom-urls-POOMPFX5.js.map → custom-urls-OIEI6T6D.js.map} +1 -1
- package/dist/dev/editor/index.js +2 -2
- package/dist/dev/index.js +2 -2
- package/dist/document-class-OFNFFQNY.js +38 -0
- package/dist/{document-class-FHIN3OV7.js.map → document-class-OFNFFQNY.js.map} +1 -1
- package/dist/hooks/index.js +24 -24
- package/dist/hooks/useComments.js +3 -3
- package/dist/hooks/useGtm.js +24 -24
- package/dist/hooks/useMoney.js +24 -24
- package/dist/hooks/useProduct.js +3 -3
- package/dist/hooks/useStore.js +24 -24
- package/dist/hooks/useUser.js +5 -5
- package/dist/hooks/useWishlist.js +3 -3
- package/dist/index.js +24 -24
- package/dist/native-app/index.js +3 -3
- package/dist/navigation-YNFU2YYA.js +15 -0
- package/dist/{navigation-ACX35Z2D.js.map → navigation-YNFU2YYA.js.map} +1 -1
- package/dist/{navigation-ZI4V7VVT.js → navigation-ZY2WYGUG.js} +7 -7
- package/dist/{navigation-ZI4V7VVT.js.map → navigation-ZY2WYGUG.js.map} +1 -1
- package/dist/{not-found-BU3HNWPG.js → not-found-CM73EXBK.js} +27 -27
- package/dist/{not-found-BU3HNWPG.js.map → not-found-CM73EXBK.js.map} +1 -1
- package/dist/providers/index.js +24 -24
- package/dist/routes/account/orders.js +8 -8
- package/dist/routes/account.js +17 -17
- package/dist/routes/blog.js +12 -12
- package/dist/routes/brands.js +8 -8
- package/dist/routes/cart.js +33 -33
- package/dist/routes/home.js +30 -30
- package/dist/routes/index.js +12 -12
- package/dist/routes/loyalty.js +9 -9
- package/dist/routes/page.js +8 -8
- package/dist/routes/product-listing.js +34 -34
- package/dist/routes/product.js +33 -33
- package/dist/routes/seo-redirects.js +12 -12
- package/dist/routes/testimonials.js +4 -4
- package/dist/routes/thank-you.js +8 -8
- package/dist/skeleton.js +30 -30
- package/dist/{store-lookup-2OPAQNAM.js → store-lookup-3IS33A5S.js} +11 -11
- package/dist/{store-lookup-2OPAQNAM.js.map → store-lookup-3IS33A5S.js.map} +1 -1
- package/dist/tanstack/templates/locale-wrapper.d.ts.map +1 -1
- package/dist/tanstack.js +23 -23
- package/dist/utils/baseHead.js +2 -2
- package/dist/utils/index.js +6 -6
- package/dist/utils/shared-host-language.d.ts +1 -1
- package/dist/utils/shared-host-language.d.ts.map +1 -1
- package/dist/vite/index.js +16 -10
- package/dist/vite/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/GoogleTag-WPDIRBEA.js +0 -15
- package/dist/chunk-P2RT7RII.js.map +0 -1
- package/dist/custom-urls-POOMPFX5.js +0 -17
- package/dist/document-class-FHIN3OV7.js +0 -38
- package/dist/navigation-ACX35Z2D.js +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractTokenFromCookies, isPreviewHost } from './chunk-
|
|
1
|
+
import { extractTokenFromCookies, isPreviewHost } from './chunk-6L27TXQZ.js';
|
|
2
2
|
|
|
3
3
|
// src/utils/maintenance.ts
|
|
4
4
|
var VIEW_AS_OWNER_COOKIE_NAME = "salla_view_as";
|
|
@@ -73,5 +73,5 @@ function withOwnerMaintenanceButton(settings, buttonTitle) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export { MAINTENANCE_EVIDENCE_HEADER, VIEW_AS_OWNER_COOKIE_NAME, isNotLaunchedNotice, maintenanceEvidence, maintenanceEvidenceHeader, ownerCookieMatches, ownerLinkMatches, showsMaintenancePage, withOwnerMaintenanceButton, withoutMaintenanceOnPreviewHost };
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-FFN6BITL.js.map
|
|
77
|
+
//# sourceMappingURL=chunk-FFN6BITL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/maintenance.ts"],"names":[],"mappings":";;;AAgBO,IAAM,yBAAA,GAA4B;AAEzC,IAAM,aAAA,GAAgB,CAAC,WAAA,EAAa,QAAQ,CAAA;AAG5C,SAAS,UAAU,QAAA,EAA0D;AAC3E,EAAA,MAAM,EAAA,GAAK,UAAU,KAAA,EAAO,EAAA;AAC5B,EAAA,OAAO,EAAA,IAAM,IAAA,GAAO,IAAA,GAAO,MAAA,CAAO,EAAE,CAAA;AACtC;AAOO,SAAS,gBAAA,CAAiB,MAAc,QAAA,EAAoD;AACjG,EAAA,MAAM,OAAA,GAAU,UAAU,QAAQ,CAAA;AAClC,EAAA,IAAI,CAAC,SAAS,OAAO,KAAA;AACrB,EAAA,IAAI,MAAA;AACJ,EAAA,IAAI;AACF,IAAA,MAAA,GAAS,IAAI,GAAA,CAAI,IAAA,EAAM,kBAAkB,CAAA,CAAE,YAAA;AAAA,EAC7C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,GAAA,CAAI,YAAY,CAAA;AACtC,EAAA,OAAO,MAAA,IAAU,QAAQ,aAAA,CAAc,QAAA,CAAS,MAAM,CAAA,IAAK,MAAA,CAAO,GAAA,CAAI,YAAY,CAAA,KAAM,OAAA;AAC1F;AAGO,SAAS,kBAAA,CACd,cACA,QAAA,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AAY;AAAA;AACd,GACF;AACF","file":"chunk-T6DHTOH6.js","sourcesContent":["import type { StoreContext } from '../api/store';\nimport type { MaintenanceDetails } from '../types';\nimport { extractTokenFromCookies, isPreviewHost } from './cookies';\n\n/**\n * Remembers that this browser is the merchant looking at their own closed store.\n *\n * The dashboard's \"view store\" link carries `?utm_source=dashboard&identifier=<store id>`\n * (`portal` for the partners portal). Twig's backend checks that once, keeps\n * `view-as: owner` in the PHP session and lets every later request through; this\n * cookie is that session entry. No `max-age`: a session cookie, as the PHP session\n * was, so closing the browser ends the owner view.\n *\n * The value is the store id the bypass was granted for, checked against the store\n * the settings answer about, so one store's cookie opens no other store.\n */\nexport const VIEW_AS_OWNER_COOKIE_NAME = 'salla_view_as';\n\nconst OWNER_SOURCES = ['dashboard', 'portal'];\n\n/** The id as the URL and the cookie spell it, or null when the settings name none. */\nfunction storeIdOf(settings: StoreContext | null | undefined): string | null {\n const id = settings?.store?.id;\n return id == null ? null : String(id);\n}\n\n/**\n * Whether `href` is the dashboard's link into the merchant's own store:\n * `utm_source` is `dashboard` or `portal`, and `identifier` is this store's id.\n * The backend's own rule, translated.\n */\nexport function ownerLinkMatches(href: string, settings: StoreContext | null | undefined): boolean {\n const storeId = storeIdOf(settings);\n if (!storeId) return false;\n let params: URLSearchParams;\n try {\n params = new URL(href, 'http://localhost').searchParams;\n } catch {\n return false;\n }\n const source = params.get('utm_source');\n return source != null && OWNER_SOURCES.includes(source) && params.get('identifier') === storeId;\n}\n\n/** Whether the cookie remembers an owner view of this store. */\nexport function ownerCookieMatches(\n cookieHeader: string | null,\n settings: StoreContext | null | undefined\n): boolean {\n const storeId = storeIdOf(settings);\n return !!storeId && extractTokenFromCookies(cookieHeader, VIEW_AS_OWNER_COOKIE_NAME) === storeId;\n}\n\n/**\n * Whether this visitor gets the maintenance page instead of the store.\n *\n * True only when the settings say the store is closed and nothing lets the visitor\n * through: neither an owner view (the link or the cookie), nor a session the\n * backend marks `theme.mode === 'preview'`, nor the hosted preview host.\n *\n * The host is what lets the dashboard's theme editor through. The editor frames\n * this storefront on the preview host, and that request has none of the other\n * three: its URL carries no owner link, the owner cookie is `SameSite=Lax` and a\n * cross-site frame neither stores nor sends it, and `theme.mode` is only ever\n * `preview` from a PHP session, which the worker's sessionless API call has not got.\n * The Twig storefront exempts its preview hosts the same way (`CheckStoreStatus`\n * skips `hasCustomDomain()`), and for the same reasons: a merchant customising a\n * store that is closed, or not launched yet, still has to see what they are\n * customising. A merchant's own domain is never a preview host, so a customer of a\n * closed store still gets the page.\n *\n * Loopback is not exempt: on a dev server a closed store shows the maintenance page\n * on purpose, so a theme author can see and test it (see `MaintenanceDevBar`).\n *\n * @param host - the host the request arrived on; see {@link isPreviewHost}. Required\n * rather than optional: a caller that forgot it would quietly bring the editor bug back.\n */\nexport function showsMaintenancePage(\n settings: StoreContext | null | undefined,\n viewAsOwner: boolean,\n host: string | null | undefined\n): boolean {\n return (\n settings?.maintenance === true &&\n !viewAsOwner &&\n settings.theme?.mode !== 'preview' &&\n !isPreviewHost(host)\n );\n}\n\n/**\n * The settings the Salla SDK is initialised with, told the store is open when the\n * page is on the preview host.\n *\n * {@link showsMaintenancePage} lets the preview host render a closed store, but the\n * settings still say `maintenance: true`, and the SDK reads that to draw its\n * merchant maintenance bar. In the theme editor that bar would sit over the very\n * page being customised, offering a \"turn off maintenance\" button to everyone who\n * looks at the preview, a reviewer included. Twig's editor shows no bar either:\n * `CheckStoreStatus` returns before it adds one. The bar is all the SDK uses the flag\n * for, and the maintenance page is decided elsewhere, so nothing else changes.\n */\nexport function withoutMaintenanceOnPreviewHost<T extends Pick<StoreContext, 'maintenance'>>(\n settings: T,\n host: string | null | undefined\n): T {\n if (settings.maintenance !== true || !isPreviewHost(host)) return settings;\n return { ...settings, maintenance: false };\n}\n\n/**\n * The response header the maintenance page carries saying which settings decided it.\n *\n * Theme workers write no logs, so the evidence travels on the answer, where a request\n * for the page reads it with the answer's own `x-trace-id`.\n * The backend sets `maintenance` from store-wide state alone (closed, not launched,\n * or the market in maintenance), so `request-id` and `trace` find the settings\n * request it logged, and `cache`/`age` say whether this was a cached copy of one.\n */\nexport const MAINTENANCE_EVIDENCE_HEADER = 'x-twilight-maintenance';\n\n/**\n * What the maintenance decision rested on, as `key=value` pairs. Ids and the API's\n * own header values only: nothing a visitor typed, nothing that identifies them.\n */\nexport function maintenanceEvidence(\n settings: StoreContext | null | undefined\n): Record<string, string> {\n const evidence: Record<string, string> = {};\n if (!settings) return evidence;\n for (const [key, read] of EVIDENCE) {\n const value = read(settings);\n if (value != null && value !== '') evidence[key] = String(value);\n }\n return evidence;\n}\n\nconst EVIDENCE: [string, (settings: StoreContext) => unknown][] = [\n ['store', (s) => s.store?.id],\n ['scope', (s) => s.store?.scope?.id],\n ['requested-scope', (s) => s.requestedScopeId],\n ['mode', (s) => s.theme?.mode],\n ['request-id', (s) => s.answer?.requestId],\n ['trace', (s) => s.answer?.traceId],\n ['cache', (s) => s.answer?.cacheStatus],\n ['age', (s) => s.answer?.age],\n];\n\n/** {@link maintenanceEvidence} as one header value: `store=1; scope=2; cache=HIT`. */\nexport function maintenanceEvidenceHeader(evidence: Record<string, string>): string {\n return Object.entries(evidence)\n .map(([key, value]) => `${key}=${value.replace(/[^\\x21-\\x7e]/g, '')}`)\n .join('; ');\n}\n\n// todo:: drop both once the backend sends `dashboard_url` (or the filled `button_*`) in the\n// settings; until then this mirrors `config('salla.app.dashboard_url')` and the path Twig's\n// `StoreStatusAlertWidget` appends for the owner.\nconst DASHBOARD_URL = 'https://s.salla.sa';\n\n/** The dashboard page where the merchant turns maintenance mode off, as the backend links it. */\nexport const MAINTENANCE_SETTINGS_URL = `${DASHBOARD_URL}/channel/settings?legacy=0#maintenance-mode`;\n\n/**\n * Whether the notice is the one the backend sends for a store that has not launched yet.\n *\n * The settings carry no `launched` flag: a store whose `store::launched` setting is `0`\n * gets `maintenance: true` and `StoreStatusAlertWidget::getData(true)`, the merchant's\n * \"finish launching\" notice, whose button goes to the dashboard's root, and it goes\n * there for every visitor. A closed store's notice links nowhere for a customer and to\n * {@link MAINTENANCE_SETTINGS_URL} for the owner, so the bare dashboard URL tells them\n * apart, as Twig's `CheckStoreStatus` does by rendering `construction` instead of\n * `maintenance`.\n */\n// todo:: read the backend's own flag once the settings send one.\nexport function isNotLaunchedNotice(details: MaintenanceDetails | null | undefined): boolean {\n return details?.button_url?.replace(/\\/+$/, '') === DASHBOARD_URL;\n}\n\n/**\n * The button on the SDK's merchant maintenance bar. The API fills the `button_*`\n * fields only inside Twig's owner session, which the engine's settings request has\n * none of, so the SDK, handed the settings as they are, draws an empty button. The\n * SDK renders only in the store view, so `maintenance: true` there means the owner\n * (or a session the backend marks `theme.mode === 'preview'`, where the SDK mounts\n * no bar; the preview host never gets here, see {@link withoutMaintenanceOnPreviewHost}):\n * the three fields get what Twig's owner branch gives them. The merchant's own title\n * and message stay as they are.\n */\nexport function withOwnerMaintenanceButton<\n T extends Pick<StoreContext, 'maintenance' | 'maintenance_details'>,\n>(settings: T, buttonTitle: string): T {\n const details = settings.maintenance_details;\n if (settings.maintenance !== true || details?.button_title) return settings;\n return {\n ...settings,\n maintenance_details: {\n ...details,\n button_title: buttonTitle,\n button_full_title: buttonTitle,\n button_url: MAINTENANCE_SETTINGS_URL,\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/maintenance.ts"],"names":[],"mappings":";;;AAgBO,IAAM,yBAAA,GAA4B;AAEzC,IAAM,aAAA,GAAgB,CAAC,WAAA,EAAa,QAAQ,CAAA;AAG5C,SAAS,UAAU,QAAA,EAA0D;AAC3E,EAAA,MAAM,EAAA,GAAK,UAAU,KAAA,EAAO,EAAA;AAC5B,EAAA,OAAO,EAAA,IAAM,IAAA,GAAO,IAAA,GAAO,MAAA,CAAO,EAAE,CAAA;AACtC;AAOO,SAAS,gBAAA,CAAiB,MAAc,QAAA,EAAoD;AACjG,EAAA,MAAM,OAAA,GAAU,UAAU,QAAQ,CAAA;AAClC,EAAA,IAAI,CAA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AC3F,EAAA,OAAO,OAAA,EAAS,UAAA,EAAY,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA,KAAM,aAAA;AACtD;AAYO,SAAS,0BAAA,CAEd,UAAa,WAAA,EAAwB;AACrC,EAAA,MAAM,UAAU,QAAA,CAAS,mBAAA;AACzB,EAAA,IAAI,QAAA,CAAS,WAAA,KAAgB,IAAA,IAAQ,OAAA,EAAS,cAAc,OAAO,QAAA;AACnE,EAAA,OAAO;AAAA,IACL,GAAG,QAAA;AAAA,IACH,mBAAA,EAAqB;AAAA,MACnB,GAAG,OAAA;AAAA,MACH,YAAA,EAAc,WAAA;AAAA,MACd,iBAAA,EAAmB,WAAA;AAAA,MACnB,UAAA,EAAY;AAAA;AACd,GACF;AACF","file":"chunk-FFN6BITL.js","sourcesContent":["import type { StoreContext } from '../api/store';\nimport type { MaintenanceDetails } from '../types';\nimport { extractTokenFromCookies, isPreviewHost } from './cookies';\n\n/**\n * Remembers that this browser is the merchant looking at their own closed store.\n *\n * The dashboard's \"view store\" link carries `?utm_source=dashboard&identifier=<store id>`\n * (`portal` for the partners portal). Twig's backend checks that once, keeps\n * `view-as: owner` in the PHP session and lets every later request through; this\n * cookie is that session entry. No `max-age`: a session cookie, as the PHP session\n * was, so closing the browser ends the owner view.\n *\n * The value is the store id the bypass was granted for, checked against the store\n * the settings answer about, so one store's cookie opens no other store.\n */\nexport const VIEW_AS_OWNER_COOKIE_NAME = 'salla_view_as';\n\nconst OWNER_SOURCES = ['dashboard', 'portal'];\n\n/** The id as the URL and the cookie spell it, or null when the settings name none. */\nfunction storeIdOf(settings: StoreContext | null | undefined): string | null {\n const id = settings?.store?.id;\n return id == null ? null : String(id);\n}\n\n/**\n * Whether `href` is the dashboard's link into the merchant's own store:\n * `utm_source` is `dashboard` or `portal`, and `identifier` is this store's id.\n * The backend's own rule, translated.\n */\nexport function ownerLinkMatches(href: string, settings: StoreContext | null | undefined): boolean {\n const storeId = storeIdOf(settings);\n if (!storeId) return false;\n let params: URLSearchParams;\n try {\n params = new URL(href, 'http://localhost').searchParams;\n } catch {\n return false;\n }\n const source = params.get('utm_source');\n return source != null && OWNER_SOURCES.includes(source) && params.get('identifier') === storeId;\n}\n\n/** Whether the cookie remembers an owner view of this store. */\nexport function ownerCookieMatches(\n cookieHeader: string | null,\n settings: StoreContext | null | undefined\n): boolean {\n const storeId = storeIdOf(settings);\n return !!storeId && extractTokenFromCookies(cookieHeader, VIEW_AS_OWNER_COOKIE_NAME) === storeId;\n}\n\n/**\n * Whether this visitor gets the maintenance page instead of the store.\n *\n * True only when the settings say the store is closed and nothing lets the visitor\n * through: neither an owner view (the link or the cookie), nor a session the\n * backend marks `theme.mode === 'preview'`, nor the hosted preview host.\n *\n * The host is what lets the dashboard's theme editor through. The editor frames\n * this storefront on the preview host, and that request has none of the other\n * three: its URL carries no owner link, the owner cookie is `SameSite=Lax` and a\n * cross-site frame neither stores nor sends it, and `theme.mode` is only ever\n * `preview` from a PHP session, which the worker's sessionless API call has not got.\n * The Twig storefront exempts its preview hosts the same way (`CheckStoreStatus`\n * skips `hasCustomDomain()`), and for the same reasons: a merchant customising a\n * store that is closed, or not launched yet, still has to see what they are\n * customising. A merchant's own domain is never a preview host, so a customer of a\n * closed store still gets the page.\n *\n * Loopback is not exempt: on a dev server a closed store shows the maintenance page\n * on purpose, so a theme author can see and test it (see `MaintenanceDevBar`).\n *\n * @param host - the host the request arrived on; see {@link isPreviewHost}. Required\n * rather than optional: a caller that forgot it would quietly bring the editor bug back.\n */\nexport function showsMaintenancePage(\n settings: StoreContext | null | undefined,\n viewAsOwner: boolean,\n host: string | null | undefined\n): boolean {\n return (\n settings?.maintenance === true &&\n !viewAsOwner &&\n settings.theme?.mode !== 'preview' &&\n !isPreviewHost(host)\n );\n}\n\n/**\n * The settings the Salla SDK is initialised with, told the store is open when the\n * page is on the preview host.\n *\n * {@link showsMaintenancePage} lets the preview host render a closed store, but the\n * settings still say `maintenance: true`, and the SDK reads that to draw its\n * merchant maintenance bar. In the theme editor that bar would sit over the very\n * page being customised, offering a \"turn off maintenance\" button to everyone who\n * looks at the preview, a reviewer included. Twig's editor shows no bar either:\n * `CheckStoreStatus` returns before it adds one. The bar is all the SDK uses the flag\n * for, and the maintenance page is decided elsewhere, so nothing else changes.\n */\nexport function withoutMaintenanceOnPreviewHost<T extends Pick<StoreContext, 'maintenance'>>(\n settings: T,\n host: string | null | undefined\n): T {\n if (settings.maintenance !== true || !isPreviewHost(host)) return settings;\n return { ...settings, maintenance: false };\n}\n\n/**\n * The response header the maintenance page carries saying which settings decided it.\n *\n * Theme workers write no logs, so the evidence travels on the answer, where a request\n * for the page reads it with the answer's own `x-trace-id`.\n * The backend sets `maintenance` from store-wide state alone (closed, not launched,\n * or the market in maintenance), so `request-id` and `trace` find the settings\n * request it logged, and `cache`/`age` say whether this was a cached copy of one.\n */\nexport const MAINTENANCE_EVIDENCE_HEADER = 'x-twilight-maintenance';\n\n/**\n * What the maintenance decision rested on, as `key=value` pairs. Ids and the API's\n * own header values only: nothing a visitor typed, nothing that identifies them.\n */\nexport function maintenanceEvidence(\n settings: StoreContext | null | undefined\n): Record<string, string> {\n const evidence: Record<string, string> = {};\n if (!settings) return evidence;\n for (const [key, read] of EVIDENCE) {\n const value = read(settings);\n if (value != null && value !== '') evidence[key] = String(value);\n }\n return evidence;\n}\n\nconst EVIDENCE: [string, (settings: StoreContext) => unknown][] = [\n ['store', (s) => s.store?.id],\n ['scope', (s) => s.store?.scope?.id],\n ['requested-scope', (s) => s.requestedScopeId],\n ['mode', (s) => s.theme?.mode],\n ['request-id', (s) => s.answer?.requestId],\n ['trace', (s) => s.answer?.traceId],\n ['cache', (s) => s.answer?.cacheStatus],\n ['age', (s) => s.answer?.age],\n];\n\n/** {@link maintenanceEvidence} as one header value: `store=1; scope=2; cache=HIT`. */\nexport function maintenanceEvidenceHeader(evidence: Record<string, string>): string {\n return Object.entries(evidence)\n .map(([key, value]) => `${key}=${value.replace(/[^\\x21-\\x7e]/g, '')}`)\n .join('; ');\n}\n\n// todo:: drop both once the backend sends `dashboard_url` (or the filled `button_*`) in the\n// settings; until then this mirrors `config('salla.app.dashboard_url')` and the path Twig's\n// `StoreStatusAlertWidget` appends for the owner.\nconst DASHBOARD_URL = 'https://s.salla.sa';\n\n/** The dashboard page where the merchant turns maintenance mode off, as the backend links it. */\nexport const MAINTENANCE_SETTINGS_URL = `${DASHBOARD_URL}/channel/settings?legacy=0#maintenance-mode`;\n\n/**\n * Whether the notice is the one the backend sends for a store that has not launched yet.\n *\n * The settings carry no `launched` flag: a store whose `store::launched` setting is `0`\n * gets `maintenance: true` and `StoreStatusAlertWidget::getData(true)`, the merchant's\n * \"finish launching\" notice, whose button goes to the dashboard's root, and it goes\n * there for every visitor. A closed store's notice links nowhere for a customer and to\n * {@link MAINTENANCE_SETTINGS_URL} for the owner, so the bare dashboard URL tells them\n * apart, as Twig's `CheckStoreStatus` does by rendering `construction` instead of\n * `maintenance`.\n */\n// todo:: read the backend's own flag once the settings send one.\nexport function isNotLaunchedNotice(details: MaintenanceDetails | null | undefined): boolean {\n return details?.button_url?.replace(/\\/+$/, '') === DASHBOARD_URL;\n}\n\n/**\n * The button on the SDK's merchant maintenance bar. The API fills the `button_*`\n * fields only inside Twig's owner session, which the engine's settings request has\n * none of, so the SDK, handed the settings as they are, draws an empty button. The\n * SDK renders only in the store view, so `maintenance: true` there means the owner\n * (or a session the backend marks `theme.mode === 'preview'`, where the SDK mounts\n * no bar; the preview host never gets here, see {@link withoutMaintenanceOnPreviewHost}):\n * the three fields get what Twig's owner branch gives them. The merchant's own title\n * and message stay as they are.\n */\nexport function withOwnerMaintenanceButton<\n T extends Pick<StoreContext, 'maintenance' | 'maintenance_details'>,\n>(settings: T, buttonTitle: string): T {\n const details = settings.maintenance_details;\n if (settings.maintenance !== true || details?.button_title) return settings;\n return {\n ...settings,\n maintenance_details: {\n ...details,\n button_title: buttonTitle,\n button_full_title: buttonTitle,\n button_url: MAINTENANCE_SETTINGS_URL,\n },\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { rememberProductPreview } from './chunk-
|
|
2
|
-
import { getActiveScope, api } from './chunk-
|
|
1
|
+
import { rememberProductPreview } from './chunk-E2DFCIP6.js';
|
|
2
|
+
import { getActiveScope, api } from './chunk-XKUECSMV.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var wishlist = {
|
|
@@ -31,5 +31,5 @@ var wishlist = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export { wishlist };
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-GB7T5KAR.js.map
|
|
35
|
+
//# sourceMappingURL=chunk-GB7T5KAR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/wishlist.ts"],"names":[],"mappings":";;;;AAmBO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,MAAA,GAA6B,EAAC,KAAmC;AAC5E,IAAA,MAAM,EAAE,IAAA,GAAO,CAAA,EAAG,UAAU,EAAA,EAAI,UAAA,EAAY,QAAO,GAAI,MAAA;AAEvD,IAAA,MAAM,YAAA,GAAe,IAAI,eAAA,EAAgB;AACzC,IAAA,YAAA,CAAa,GAAA,CAAI,UAAU,UAAU,CAAA;AACrC,IAAA,YAAA,CAAa,GAAA,CAAI,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAC,CAAA;AACrC,IAAA,YAAA,CAAa,GAAA,CAAI,UAAA,EAAY,MAAA,CAAO,OAAO,CAAC,CAAA;AAE5C,IAAA,IAAI,eAAe,MAAA,EAAW;AAC5B,MAAA,YAAA,CAAa,GAAA,CAAI,YAAA,EAAc,UAAA,GAAa,GAAA,GAAM,GAAG,CAAA;AAAA,IACvD;AAEA,IAAA,MAAM,UAAmC,EAAC;AAC1C,IAAA,IAAI,MAAA,UAAgB,MAAA,GA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A,CAAO,OAAO,CAAC,CAAA;AAE5C,IAAA,IAAI,eAAe,MAAA,EAAW;AAC5B,MAAA,YAAA,CAAa,GAAA,CAAI,YAAA,EAAc,UAAA,GAAa,GAAA,GAAM,GAAG,CAAA;AAAA,IACvD;AAEA,IAAA,MAAM,UAAmC,EAAC;AAC1C,IAAA,IAAI,MAAA,UAAgB,MAAA,GAAS,MAAA;AAE7B,IAAA,MAAM,QAAA,GAAW,MAAM,GAAA,CACpB,GAAA,CAAI,CAAA,SAAA,EAAY,YAAA,CAAa,QAAA,EAAU,CAAA,CAAA,EAAI,OAAc,CAAA,CACzD,IAAA,EAA2B;AAE9B,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,IAAA,IAAQ,EAAC;AAChC,IAAA,KAAA,MAAW,IAAA,IAAQ,KAAA,EAAO,sBAAA,CAAuB,IAAI,CAAA;AAErD,IAAA,OAAO;AAAA,MACL,KAAA;AAAA,MACA,IAAA,EAAM,QAAA,CAAS,MAAA,EAAQ,IAAA,IAAQ;AAAA,KACjC;AAAA,EACF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,CAAC,MAAA,KACL,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,UAAA,EAAY,MAAA,EAAQ,QAAQ,EAAE,KAAA,EAAO,cAAA,EAAe,EAAG,CAAA;AAAA,MAClE,OAAA,EAAS,CAAC,EAAE,MAAA,EAAO,KAAM,QAAA,CAAS,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAC7D;AAAA;AAEP","file":"chunk-GB7T5KAR.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport {\n rememberProductPreview,\n type ProductsListResult,\n type ProductsListResponse,\n} from './product';\n\nexport interface WishlistListParams {\n page?: number;\n perPage?: number;\n filterable?: boolean;\n signal?: AbortSignal;\n}\n\n/**\n * Wishlist API — page-based pagination only.\n * Kept separate from product.list to avoid mixing cursor and page pagination strategies.\n */\nexport const wishlist = {\n list: async (params: WishlistListParams = {}): Promise<ProductsListResult> => {\n const { page = 1, perPage = 15, filterable, signal } = params;\n\n const searchParams = new URLSearchParams();\n searchParams.set('source', 'wishlist');\n searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n if (filterable !== undefined) {\n searchParams.set('filterable', filterable ? '1' : '0');\n }\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`products?${searchParams.toString()}`, options as any)\n .json<ProductsListResponse>();\n\n const items = response.data ?? [];\n for (const item of items) rememberProductPreview(item);\n\n return {\n items,\n next: response.cursor?.next ?? null,\n };\n },\n\n queries: {\n list: (params: Omit<WishlistListParams, 'signal'>) =>\n queryOptions({\n queryKey: ['wishlist', 'list', params, { scope: getActiveScope() }],\n queryFn: ({ signal }) => wishlist.list({ ...params, signal }),\n }),\n },\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { dispatchProductsFetched } from './chunk-
|
|
2
|
-
import { product } from './chunk-
|
|
3
|
-
import { onSallaEvent } from './chunk-
|
|
1
|
+
import { dispatchProductsFetched } from './chunk-PANEYT2O.js';
|
|
2
|
+
import { product } from './chunk-E2DFCIP6.js';
|
|
3
|
+
import { onSallaEvent } from './chunk-F6GOQAYU.js';
|
|
4
4
|
import { useState, useEffect, useCallback } from 'react';
|
|
5
5
|
|
|
6
6
|
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
@@ -71,5 +71,5 @@ function useAppliedFilters(source, sort, enabled) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
export { parseFiltersFromSearch, useAppliedFilters };
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
74
|
+
//# sourceMappingURL=chunk-GDLDGRT3.js.map
|
|
75
|
+
//# sourceMappingURL=chunk-GDLDGRT3.js.map
|
|
@@ -1 +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product';\nimport type { ProductListFilters } from '../../api/product';\nimport type { Product } from '../../types';\nimport type { ProductListLoaderData } from './types';\nimport { onSallaEvent } from '../../utils/sdk-helpers';\nimport { dispatchProductsFetched } from '../../utils/sdk-events';\n\ntype Source = ProductListLoaderData['source'];\ntype Node = Record<string, unknown>;\n\n/** Path segments that would reach the shared prototype chain if used as object keys. */\nconst UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype']);\n\n/**\n * Reads the `filters[...]` selection `<salla-filters>` writes to the address bar\n * (`filters[k]=v`, `filters[k][]=v`, `filters[k][sub]=v`) back into an object, so a\n * filtered link can be opened directly.\n *\n * The keys come straight from the URL, so nodes are null-prototype objects and any\n * `__proto__` / `constructor` / `prototype` segment drops the whole entry — a crafted\n * `?filters[__proto__][x]=1` must never reach `Object.prototype`.\n */\nexport function parseFiltersFromSearch(search: string): ProductListFilters | null {\n const out: Node = Object.create(null);\n new URLSearchParams(search).forEach((value, rawKey) => {\n if (!rawKey.startsWith('filters[')) return;\n const path = [...rawKey.matchAll(/\\[([^\\]]*)\\]/g)].map((m) => m[1]);\n const isList = path[path.length - 1] === '';\n const keys = isList ? path.slice(0, -1) : path;\n if (!keys.length || keys.includes('') || keys.some((key) => UNSAFE_KEYS.has(key))) return;\n\n let node = out;\n keys.slice(0, -1).forEach((key) => {\n const existing = node[key];\n if (typeof existing !== 'object' || existing === null || Array.isArray(existing)) {\n node[key] = Object.create(null);\n }\n node = node[key] as Node;\n });\n const leaf = keys[keys.length - 1];\n if (isList) {\n node[leaf] = [...(Array.isArray(node[leaf]) ? (node[leaf] as string[]) : []), value];\n } else {\n node[leaf] = value;\n }\n });\n return Object.keys(out).length ? (out as ProductListFilters) : null;\n}\n\ninterface FilteredPage {\n items: Product[];\n next: string | null;\n}\n\nexport type AppliedFiltersStatus = 'idle' | 'loading' | 'ready' | 'error';\n\n/**\n * Applies the `<salla-filters>` selection to the product list.\n *\n * The filters component only rewrites the address bar (`history.pushState`, invisible\n * to the router) and emits `salla-filters::changed`; nothing re-queries the list, so\n * the route's loader output — fetched without filters — kept showing. This listens\n * for that event (and for a filtered URL on first load) and fetches the first page\n * with the selection.\n *\n * Each fetched page is stored with the selection that produced it, so `page` is only\n * ever the page for the *current* selection. Until it arrives `status` is `loading`\n * (and `lastPage` is the previous selection's page, for a dimmed placeholder); if the\n * request fails `status` is `error` and `retry` re-runs it — the old products never\n * pass for the new selection.\n */\nexport function useAppliedFilters(\n source: Source,\n sort: string,\n enabled: boolean\n): {\n filters: ProductListFilters | null;\n page: FilteredPage | null;\n lastPage: FilteredPage | null;\n status: AppliedFiltersStatus;\n retry: () => void;\n} {\n const [filters, setFilters] = useState<ProductListFilters | null>(null);\n const [result, setResult] = useState<{ key: string; page: FilteredPage } | null>(null);\n const [failedKey, setFailedKey] = useState<string | null>(null);\n const [attempt, setAttempt] = useState(0);\n\n useEffect(() => {\n if (!enabled) return;\n setFilters(parseFiltersFromSearch(window.location.search));\n const onChanged = (...args: unknown[]) => {\n const next = args[0] as ProductListFilters | undefined;\n setFilters(next && Object.keys(next).length ? { ...next } : null);\n };\n return onSallaEvent('salla-filters::changed', onChanged);\n }, [enabled, source.type, source.value]);\n\n const key = filters ? JSON.stringify([source.type, source.value, sort, filters]) : '';\n\n useEffect(() => {\n if (!filters) return;\n const controller = new AbortController();\n setFailedKey(null);\n product\n .list({\n source: source.type,\n sourceValue: source.value,\n sort,\n filterable: true,\n filters,\n signal: controller.signal,\n })\n .then((res) => {\n setResult({ key, page: { items: res.items, next: res.next } });\n dispatchProductsFetched(res, source);\n })\n .catch(() => {\n // Aborted by a newer selection (its own effect run owns the state now), or failed.\n if (!controller.signal.aborted) setFailedKey(key);\n });\n return () => controller.abort();\n // `key` already encodes filters + source + sort.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key, attempt]);\n\n const retry = useCallback(() => setAttempt((n) => n + 1), []);\n\n if (!filters) return { filters: null, page: null, lastPage: null, status: 'idle', retry };\n\n const page = result?.key === key ? result.page : null;\n const status: AppliedFiltersStatus = page ? 'ready' : failedKey === key ? 'error' : 'loading';\n return { filters, page, lastPage: result?.page ?? null, status, retry };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSallaSDK, whenSallaReady } from './chunk-
|
|
1
|
+
import { getSallaSDK, whenSallaReady } from './chunk-F6GOQAYU.js';
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
function isNativeApp() {
|
|
@@ -54,5 +54,5 @@ function useNativeStatusBarColor() {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export { hapticImpact, isNativeApp, nativeAppVersion, openNativeBrowser, openNativeSheet, useIsNativeApp, useNativeAppVersion, useNativeStatusBarColor };
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-GHKOMS3G.js.map
|
|
58
|
+
//# sourceMappingURL=chunk-GHKOMS3G.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/native-app/index.ts"],"names":[],"mappings":";;;AAQO,SAAS,WAAA,GAAuB;AACrC,EAAA,OAAO,OAAA,CAAQ,WAAA,EAAY,EAAG,MAAA,EAAQ,aAAa,CAAA;AACrD;AAOO,SAAS,cAAA,GAA0B;AACxC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,KAAK,CAAA;AAExC,EAAA,SAAA,CAAU,MAAM,eAAe,MAAM,QAAA,CAAS,aAAa,CAAC,CAAA,EAAG,EAAE,CAAA;AAEjE,EAAA,OAAO,KAAA;AACT;AAOO,SAAS,gBAAA,GAAkC;AAChD,EAAA,IAAI,CAAC,WAAA,EAAY,EAAG,OAAO,IAAA;AAC3B,EAAA,MAAM,SAAA,GAAa,aAAY,EAAgD,SAAA;AAC/E,EAAA,OAAO,SAAA,EAAW,cAAA,EAAgB,kBAAA,GAAqB,KAAK,GAAG,eAAA,IAAmB,IAAA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EAAA,WAAA,IAAe,MAAA,EAAQ,MAAA,GAAS,iBAAiB,EAAE,WAAA,EAAa,QAAQ,CAAA;AAC1E;AAOA,SAAS,SAAS,GAAA,EAA4B;AAC5C,EAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,KAAA,CAAM,oDAAoD,CAAA;AAC5E,EAAA,IAAI,CAAC,SAAS,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC,CAAA,KAAM,GAAG,OAAO,IAAA;AAC7C,EAAA,OAAO,CAAA,CAAA,EAAI,MACR,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,CACV,GAAA,CAAI,CAAC,OAAA,KAAY,MAAA,CAAO,OAAO,EAAE,QAAA,CAAS,EAAE,EAAE,QAAA,CAAS,CAAA,EAAG,GAAG,CAAC,CAAA,CAC9D,IAAA,CAAK,EAAE,CAAC,CAAA,CAAA;AACb;AAWO,SAAS,uBAAA,GAAiE;AAC/E,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAmB,IAAI,CAAA;AACrD,EAAA,MAAM,QAAQ,cAAA,EAAe;AAE7B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,KAAA,IAAS,CAAC,OAAA,EAAS;AACxB,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,gBAAA,CAAiB,OAAO,EAAE,eAAe,CAAA;AAChE,IAAA,IAAI,KAAA,eAAmB,EAAG,KAAA,CAAM,SAAS,yBAAA,EAA2B,EAAE,OAAO,CAAA;AAAA,EAC/E,CAAA,EAAG,CAAC,KAAA,EAAO,OAAO,CAAC,CAAA;AAEnB,EAAA,OAAO,UAAA;AACT","file":"chunk-GHKOMS3G.js","sourcesContent":["import { useEffect, useState, type RefCallback } from 'react';\nimport { getSallaSDK, whenSallaReady } from '../utils/sdk-helpers';\n\n/**\n * True inside the Salla native app's webview, read at call time: the SDK's\n * `salla.mobile.isEnabled()`. False on the server and until the SDK has loaded, so call it\n * from an event handler or an effect, and use {@link useIsNativeApp} to decide what to render.\n */\nexport function isNativeApp(): boolean {\n return Boolean(getSallaSDK()?.mobile?.isEnabled?.());\n}\n\n/**\n * {@link isNativeApp} as state, for a render decision. False on the server and on the first\n * client render, then true once the SDK is ready inside the app: an app that identifies\n * itself through its config has not said so before `init`.\n */\nexport function useIsNativeApp(): boolean {\n const [inApp, setInApp] = useState(false);\n\n useEffect(() => whenSallaReady(() => setInApp(isNativeApp())), []);\n\n return inApp;\n}\n\n/**\n * The native app's release (`5.4.19`), the `s-app-version` it loaded the page with, or null\n * outside the app. The SDK keeps it in its analytics context, where it also learns that this\n * is the app. Read at call time like {@link isNativeApp}; render with {@link useNativeAppVersion}.\n */\nexport function nativeAppVersion(): string | null {\n if (!isNativeApp()) return null;\n const analytics = (getSallaSDK() as { analytics?: SdkAnalytics } | undefined)?.analytics;\n return analytics?.jitsuAnalytics?.getContextProperty?.('app')?.app_release_tag || null;\n}\n\ntype SdkAnalytics = {\n jitsuAnalytics?: {\n getContextProperty?: (key: 'app') => { app_release_tag?: string } | undefined;\n };\n};\n\n/** {@link nativeAppVersion} as state: null on the server and until the SDK is ready in the app. */\nexport function useNativeAppVersion(): string | null {\n const [version, setVersion] = useState<string | null>(null);\n\n useEffect(() => whenSallaReady(() => setVersion(nativeAppVersion())), []);\n\n return version;\n}\n\n/** The native app's own pickers that replace the store's web modals. */\nexport type NativeSheet = 'language' | 'currency';\n\n/**\n * Inside the Salla app, opens the app's own language or currency sheet\n * (`mobile::language.open` / `mobile::currency.open`) and returns `true`; the app\n * applies the choice and reloads. Outside the app it does nothing and returns\n * `false`, so a caller opens the web modal instead:\n *\n * ```ts\n * if (!openNativeSheet('currency')) salla.event.dispatch('localization::open');\n * ```\n */\nexport function openNativeSheet(sheet: NativeSheet): boolean {\n if (!isNativeApp()) return false;\n const sdk = getSallaSDK();\n const open = sheet === 'language' ? sdk?.mobile?.openLanguages : sdk?.mobile?.openCurrencies;\n if (typeof open === 'function') open.call(sdk?.mobile);\n // An SDK without the methods still forwards an emitted `mobile::*` event to the app.\n else sdk?.event.dispatch(`mobile::${sheet}.open`, {});\n return true;\n}\n\n/**\n * Inside the Salla app, hands `url` to the app to open in the device's browser\n * (`mobile::browser.open`) and returns `true`; a page off the store would\n * otherwise load inside the app with no way back. Outside the app it does nothing\n * and returns `false`. The engine's link interceptor calls it for every tap on a\n * link that leaves the store.\n */\nexport function openNativeBrowser(url: string): boolean {\n if (!isNativeApp()) return false;\n const sdk = getSallaSDK();\n if (typeof sdk?.mobile?.openBrowser === 'function') sdk.mobile.openBrowser(url);\n else sdk?.event.dispatch('mobile::browser.open', { url });\n return true;\n}\n\nexport type HapticImpact = 'light' | 'medium' | 'heavy';\n\n/** Asks the native app for a tap vibration. The SDK ignores it outside the app. */\nexport function hapticImpact(impact: HapticImpact): void {\n getSallaSDK()?.mobile?.action?.('haptic.impact', { impact_type: impact });\n}\n\n/**\n * `rgb(232, 245, 255)`, what `getComputedStyle` returns, as `#e8f5ff`. A partial alpha is\n * dropped. A fully transparent colour is no colour at all: an element with no background\n * of its own computes to `rgba(0, 0, 0, 0)`, which would otherwise read as black.\n */\nfunction rgbToHex(rgb: string): string | null {\n const match = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)/);\n if (!match || Number(match[4]) === 0) return null;\n return `#${match\n .slice(1, 4)\n .map((channel) => Number(channel).toString(16).padStart(2, '0'))\n .join('')}`;\n}\n\n/**\n * Tells the native app to paint its status bar with the rendered background of the element\n * the returned ref is attached to. The colour is read from the DOM, because a theme's tint\n * is often a relative CSS colour (`hsl(from …)`) with no hex to pass. Does nothing outside\n * the app, and for an element with no background of its own.\n *\n * The ref is a callback, kept in state, so an element that mounts after the app has been\n * recognised still reports its colour.\n */\nexport function useNativeStatusBarColor<T extends HTMLElement>(): RefCallback<T> {\n const [element, setElement] = useState<T | null>(null);\n const inApp = useIsNativeApp();\n\n useEffect(() => {\n if (!inApp || !element) return;\n const color = rgbToHex(getComputedStyle(element).backgroundColor);\n if (color) getSallaSDK()?.event.dispatch('mobile::statusbar.color', { color });\n }, [inApp, element]);\n\n return setElement;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api } from './chunk-
|
|
1
|
+
import { api } from './chunk-XKUECSMV.js';
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
var customUrl = {
|
|
@@ -20,5 +20,5 @@ var customUrl = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export { customUrl };
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-GV3BBFU2.js.map
|
|
24
|
+
//# sourceMappingURL=chunk-GV3BBFU2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/custom-url.ts"],"names":[],"mappings":";;;AAeO,IAAM,SAAA,GAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvB,OAAA,EAAS,OAAO,IAAA,KAA2C;AACzD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,IACpB,GAAA,CAAI,aAAA,EAAe,EAAE,YAAA,EAAc,EAAE,OAAA,EAAS,IAAA,EAAK,EAAG,EACtD,IAAA,EAAgC;AACnC,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,CAAC,IAAA,KACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,aAAA,EAAe,SAAA,EAAW,IAAI,CAAA;AAAA,MACzC,OAAA,EAAS,MAAM,SAAA,CAAU,OAAA,CAAQ,IAAI;AAAA,KACtC;AAAA;AAEP","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/api/custom-url.ts"],"names":[],"mappings":";;;AAeO,IAAM,SAAA,GAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvB,OAAA,EAAS,OAAO,IAAA,KAA2C;AACzD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,IACpB,GAAA,CAAI,aAAA,EAAe,EAAE,YAAA,EAAc,EAAE,OAAA,EAAS,IAAA,EAAK,EAAG,EACtD,IAAA,EAAgC;AACnC,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,CAAC,IAAA,KACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,aAAA,EAAe,SAAA,EAAW,IAAI,CAAA;AAAA,MACzC,OAAA,EAAS,MAAM,SAAA,CAAU,OAAA,CAAQ,IAAI;AAAA,KACtC;AAAA;AAEP","file":"chunk-GV3BBFU2.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\n\n/** What a merchant's custom URL names (Dashboard → SEO → custom links). */\nexport type CustomUrlType = 'product' | 'category' | 'brand' | 'tag' | 'page' | 'custom';\n\n/**\n * Where a custom URL leads, as the Store's catch-all redirects it: the item's own URL, or, for a\n * `custom` row, the merchant's absolute URL.\n */\nexport interface CustomUrlTarget {\n url: string;\n type: CustomUrlType;\n}\n\nexport const customUrl = {\n /**\n * The custom URL saved for `path` (no store base, no language segment), looked up as the\n * Store's catch-all does (`GET custom-urls?keyword=`, Store-Module#1798). A path with none\n * answers 404, and a store whose plan has no custom URLs 403.\n */\n resolve: async (path: string): Promise<CustomUrlTarget> => {\n const { data } = await api\n .get('custom-urls', { searchParams: { keyword: path } })\n .json<{ data: CustomUrlTarget }>();\n return data;\n },\n\n queries: {\n resolve: (path: string) =>\n queryOptions({\n queryKey: ['custom-urls', 'resolve', path],\n queryFn: () => customUrl.resolve(path),\n }),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { filesCdn, cdn } from './chunk-
|
|
1
|
+
import { filesCdn, cdn } from './chunk-XKUECSMV.js';
|
|
2
2
|
import { storeTranslationsQueryKey, translationsQueryKey, composeMessages, isPlainObject } from './chunk-AWV3WEKH.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-H6TNEM3F.js.map
|
|
130
|
+
//# sourceMappingURL=chunk-H6TNEM3F.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,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,CAAA;AACxD,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,QAAA,GAAW,MAAM,QAAA,CAAS,GAAA,CAAI,IAAA,EAAM,EAAE,eAAA,EAAiB,KAAA,EAAO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AS,MAAM;AAAA,KACrD;AAAA;AAEP","file":"chunk-2C4FCBWZ.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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OAAA,EAA0B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzC,cAAA,CAAe,sBAAsB,OAAA,EAAS,MAAM,GAAG,EAAE,UAAA,EAAY,MAAM;AAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc7E,KAAA,EAAO,CACL,MAAA,EACA,SAAA,EACA,WAC+B,eAAA,CAAgB,MAAA,EAAQ,SAAA,EAAW,MAAM,CAAA,IAAK,IAAA;AAAA,EAE/E,OAAA,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-H6TNEM3F.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 { escapeForInlineScript } from './chunk-
|
|
1
|
+
import { escapeForInlineScript } from './chunk-6L27TXQZ.js';
|
|
2
2
|
|
|
3
3
|
// src/utils/app-scope.ts
|
|
4
4
|
var isBrowser = typeof window !== "undefined";
|
|
@@ -132,5 +132,5 @@ function renderThemeHookSlotsScript(names = getRegisteredThemeHookSlots()) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export { applyAppScopeMocks, applyThemeHookSlots, installAppScope, registerThemeHookSlots, renderAppScopeInstallScript, renderThemeHookSlotsScript };
|
|
135
|
-
//# sourceMappingURL=chunk-
|
|
136
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-I2A2IK4A.js.map
|
|
136
|
+
//# sourceMappingURL=chunk-I2A2IK4A.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/app-scope.ts","../src/utils/theme-hook-slots.ts"],"names":[],"mappings":";;;AAGA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AA2B7B,IAAM,qBAAA,GAAgD,CAAC,CAAA,EAAG,MAAA,KAAW;AAC1E,EAAA,MAAM,QAAA,GAAW,CAAC,GAAA,KAChB,OAAO,QAAQ,QAAA,IAAY,GAAA,CAAI,OAAA,CAAQ,MAAM,CAAA,KAAM,CAAA;AACrD,EAAA,MAAM,SAAA,GAAY,CAAC,GAAA,KAAwB,GAAA,CAAI,MAAM,CAAC,CAAA;AACtD,EAAA,MAAM,YAAY,MAA+B,CAAA,CAAE,KAAA,IAAS,CAAA,CAAE,SAAS,EAAC;AACxE,EAAA,MAAM,UAAA,GAAa,MAChB,SAAA,EAAU,CAAE,UAAsC,EAAC;AACtD,EAAA,MAAM,WAAA,GAAc,CAAC,GAAA,EAA8B,IAAA,KAAmC;AACpF,IAAA,MAAM,MAAA,GAAS,IAAI,IAAc,CAAA;AACjC,IAAA,OAAO,OAAO,MAAA,KAAW,UAAA,GAAa,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA;AAAA,EAC3D,CAAA;AAEA,EAAA,MAAM,cAAA,GAAiB,CAAC,OAAA,KAA8B;AACpD,IAAA,MAAM,MAAA,GAAS,MAAqB,MAAA,CAAO,OAAO,IAAI,MAAA,CAAO,OAAO,KAAK,EAAC;AAE1E,IAAA,MAAM,SAAA,GAAY,CAAC,GAAA,EAAa,QAAA,KAAgC;AAC9D,MAAA,IAAI,QAAA,CAAS,GAAG,CAAA,EAAG;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A,MAAA,CAAO,gBAAA,CAAiB,uBAAuB,MAAM,KAAK,WAAU,EAAG,EAAE,IAAA,EAAM,IAAA,EAAM,CAAA;AACvF;AAGO,SAAS,2BAAA,GAAwC;AACtD,EAAA,OAAO,CAAC,GAAG,UAAU,CAAA;AACvB;AAeO,SAAS,0BAAA,CAA2B,KAAA,GAAkB,2BAAA,EAA4B,EAAG;AAC1F,EAAA,IAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,IAAA;AAC1B,EAAA,MAAM,IAAA,GAAO,qBAAA,CAAsB,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA;AACxD,EAAA,OACE,wUASM,IAAI,CAAA,EAAA,CAAA;AAEd","file":"chunk-MWAJ77KY.js","sourcesContent":["import type { SallaSDK } from '../types/salla-sdk';\nimport { escapeForInlineScript } from './inline-script';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/** One app's private `app.*` bag, keyed without the `app.` prefix (`app.color` → `color`). */\nexport type AppConfigBag = Record<string, unknown>;\n\n/** One public `app.*` bucket per app, keyed by appScopeId. Everything else is read from the\n * real `salla.config` at runtime. */\nexport interface AppScopeContexts {\n apps: Record<string, AppConfigBag>;\n}\n\n/** Builds the `scopeId → sandboxed SDK` factory over a live bucket bag. */\nexport type AppScopeFactoryBuilder = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n w: any,\n appCtx: Record<string, AppConfigBag>\n) => (scopeId: string) => SallaSDK;\n\n/**\n * The sandbox itself: proxies that resolve `app.*` against the app's own bucket and pass\n * everything else through to the real SDK.\n *\n * MUST stay self-contained (only `Object`/`Proxy` and its two arguments): it is serialized via\n * `.toString()` next to {@link appScopeBootstrap} and handed in as an argument, so anything it\n * closed over at module scope would be undefined in the inline head copy. Split out from the\n * bootstrap purely to keep both halves reviewable.\n */\nexport const createAppScopeFactory: AppScopeFactoryBuilder = (w, appCtx) => {\n const isAppKey = (key: unknown): key is string =>\n typeof key === 'string' && key.indexOf('app.') === 0;\n const bucketKey = (key: string): string => key.slice(4);\n const realSalla = (): Record<string, unknown> => w.salla || w.Salla || {};\n const realConfig = (): Record<string, unknown> =>\n (realSalla().config as Record<string, unknown>) || {};\n const passthrough = (obj: Record<string, unknown>, prop: string | symbol): unknown => {\n const member = obj[prop as string];\n return typeof member === 'function' ? member.bind(obj) : member;\n };\n\n const createAppScope = (scopeId: string): SallaSDK => {\n const bucket = (): AppConfigBag => (appCtx[scopeId] = appCtx[scopeId] || {});\n\n const getConfig = (key: string, fallback?: unknown): unknown => {\n if (isAppKey(key)) {\n const sub = bucketKey(key);\n const b = bucket();\n // `app.*` miss returns the caller default, never the real config — a missing app\n // setting must not resolve to a same-named global.\n return sub in b ? b[sub] : fallback;\n }\n const cfg = realConfig();\n return typeof cfg.get === 'function'\n ? (cfg.get as (k: string, d?: unknown) => unknown)(key, fallback)\n : fallback;\n };\n\n const setConfig = (key: string, value: unknown): unknown => {\n if (isAppKey(key)) {\n bucket()[bucketKey(key)] = value;\n return value;\n }\n const cfg = realConfig();\n return typeof cfg.set === 'function'\n ? (cfg.set as (k: string, v: unknown) => unknown)(key, value)\n : value;\n };\n\n const hasConfig = (key: string): boolean =>\n isAppKey(key) ? bucketKey(key) in bucket() : key in realConfig();\n\n const configProxy = new Proxy({} as Record<string, unknown>, {\n get(_t, prop) {\n if (prop === 'get') return getConfig;\n if (prop === 'set') return setConfig;\n if (prop === 'has') return hasConfig;\n if (isAppKey(prop)) return getConfig(prop);\n return passthrough(realConfig(), prop);\n },\n set(_t, prop, value) {\n setConfig(prop as string, value);\n return true;\n },\n has(_t, prop) {\n return hasConfig(prop as string);\n },\n });\n\n return new Proxy({} as Record<string, unknown>, {\n get(_t, prop) {\n return prop === 'config' ? configProxy : passthrough(realSalla(), prop);\n },\n set(_t, prop, value) {\n // Reassigning `salla.config` wholesale would escape the sandbox; swallow it.\n if (prop === 'config') return true;\n realSalla()[prop as string] = value;\n return true;\n },\n }) as unknown as SallaSDK;\n };\n\n return createAppScope;\n};\n\n/**\n * Installs `window.Salla.appScope`, seeded with `contexts` and sandboxed by `makeFactory`.\n *\n * MUST stay self-contained (only `window`/`Object` and its arguments): it's serialized via\n * `.toString()` and inlined into the SSR head so the factory exists at parse time — before the\n * SDK init/hydration a CDN snippet's `onReady` races, else it throws `Salla.appScope is not a\n * function`. `makeFactory` is passed in rather than imported for exactly that reason. Also\n * called directly by `installAppScope` (tests/fallback).\n *\n * Idempotent: the factory is first-write-wins, while buckets are merged per scope (also\n * first-write-wins) so a later call can seed scopes the first one had no data for. `appCtx` is\n * closure-private (namespacing, not security: buckets are public-only and the boundary is\n * server-side).\n */\nexport function appScopeBootstrap(\n contexts: AppScopeContexts,\n makeFactory: AppScopeFactoryBuilder\n): void {\n if (typeof window === 'undefined') return;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const w = window as any;\n const Salla = (w.Salla = w.Salla || {});\n if (Salla.appScope) {\n // Already installed (normally by the inline head copy). The factory is first-write-wins,\n // but buckets are not: the head may have installed with none of them — the settings\n // endpoint can fail or lag behind the snippets one — so hand them to the existing install.\n if (Salla.__appScopeSeed) Salla.__appScopeSeed(contexts);\n return;\n }\n\n // Live bag + pristine snapshot (for mock overlays). Copy, don't alias: a snippet may\n // `config.set('app.x')` and the payload can be a cached response.\n const appCtx: Record<string, AppConfigBag> = {};\n const base: Record<string, AppConfigBag> = {};\n // Which scopes already got their real bucket, so a later seed can't overwrite one.\n const seeded: Record<string, boolean> = {};\n const seed = (next: AppScopeContexts): void => {\n const bags = (next && next.apps) || {};\n Object.keys(bags).forEach((scopeId) => {\n if (seeded[scopeId]) return;\n seeded[scopeId] = true;\n appCtx[scopeId] = Object.assign({}, appCtx[scopeId] || {}, bags[scopeId] || {});\n base[scopeId] = Object.assign({}, appCtx[scopeId]);\n });\n };\n seed(contexts);\n\n const createAppScope = makeFactory(w, appCtx);\n Salla.appScope = (scopeId: string): SallaSDK => createAppScope(scopeId);\n\n // Fill in buckets for scopes not seeded yet (first-write-wins per scope). Lets the head\n // install the factory unconditionally — at parse time, before any snippet's onReady — and\n // still pick up buckets that only the client managed to fetch.\n Salla.__appScopeSeed = (next: AppScopeContexts): void => seed(next);\n\n // Overlay preview mocks onto an app's pristine baseline, so fields the partner did not mock\n // keep their real values. Returns false for an unknown scope or before install.\n Salla.__appScopeMock = (scopeId: string, mocks: AppConfigBag): boolean => {\n if (!(scopeId in base)) return false;\n appCtx[scopeId] = Object.assign({}, base[scopeId], mocks);\n return true;\n };\n}\n\n/** Overlay preview mocks onto one app's bucket (over its pristine values). Delegates to the\n * bootstrap's `__appScopeMock`, so it works for both install paths. False if unknown/uninstalled. */\nexport function applyAppScopeMocks(appScopeId: string, mocks: AppConfigBag): boolean {\n if (!isBrowser) return false;\n const mock = (window.Salla as unknown as { __appScopeMock?: MockApplier } | undefined)\n ?.__appScopeMock;\n return mock?.(appScopeId, mocks) ?? false;\n}\n\ntype MockApplier = (appScopeId: string, mocks: AppConfigBag) => boolean;\n\n/** Serialize the installer into an inline `<script>` body seeded with `contexts` — both halves\n * via `.toString()`, hence their self-contained requirement. See `rootHead`. */\nexport function renderAppScopeInstallScript(contexts: AppScopeContexts): string {\n // Bucket values are partner-set, so escape the JSON seed against a `</script>` breakout.\n // The function sources have no `<`, so they need no escaping.\n const json = escapeForInlineScript(JSON.stringify(contexts));\n return `(${appScopeBootstrap.toString()})(${json},${createAppScopeFactory.toString()});`;\n}\n\n/** Install `Salla.appScope` on the client, or seed buckets into the inline SSR head copy that\n * already installed it. No-op on the server. Fallback for unseeded loads + the unit-test entry\n * point. */\nexport function installAppScope(contexts: AppScopeContexts): void {\n if (!isBrowser) return;\n appScopeBootstrap(contexts, createAppScopeFactory);\n}\n","import { escapeForInlineScript } from './inline-script';\n\nconst registered = new Set<string>();\n\nlet retryArmed = false;\n\n/**\n * Declare hook slots the theme renders itself so apps may mount into them.\n *\n * The SDK rejects `mount()` for any name absent from its `_themeSlots` whitelist, so a theme\n * rendering its own `<salla-hook>` must register the name. Call at module scope; the engine\n * applies the names via {@link applyThemeHookSlots}.\n */\nexport function registerThemeHookSlots(...names: string[]): void {\n for (const name of names) registered.add(name);\n}\n\n/** Push the registered names in. Returns false if the SDK hasn't exposed the list yet. */\nfunction pushSlots(): boolean {\n const slots = window.salla?.hooks?._themeSlots;\n if (!Array.isArray(slots)) return false;\n for (const name of registered) if (!slots.includes(name)) slots.push(name);\n return true;\n}\n\n/**\n * Push every registered slot name into the SDK whitelist. Idempotent. Engine-only.\n *\n * The SDK's hooks module may attach after this runs, so a first no-op falls back to a\n * one-shot retry on `twilight::initiated` — still before apps mount from their own onReady.\n *\n * This is only the late backstop: the whitelist is primarily seeded at parse time by the\n * inline head script from {@link renderThemeHookSlotsScript}, because an app's snippet\n * registers its `onReady` callback before React ever hydrates.\n */\nexport function applyThemeHookSlots(): void {\n if (typeof window === 'undefined' || registered.size === 0) return;\n if (pushSlots() || retryArmed) return;\n\n retryArmed = true;\n window.addEventListener('twilight::initiated', () => void pushSlots(), { once: true });\n}\n\n/** The slot names registered so far. Read by `rootHead` when rendering the inline script. */\nexport function getRegisteredThemeHookSlots(): string[] {\n return [...registered];\n}\n\n/**\n * Serialize the whitelist push into an inline head `<script>` body, so the slots are\n * registered at parse time.\n *\n * Ordering is the whole point: CDN snippets are parser-inserted `<script defer>` tags in the\n * body, so an app's `Salla.onReady` callback is registered long before React hydrates and runs\n * {@link applyThemeHookSlots}. Whichever `twilight::initiated` listener was added first runs\n * first, so the push must be armed from the head — otherwise the SDK rejects the app's\n * `hooks.mount()` with \"Hook <name> is not allowed\" and the app never renders.\n *\n * Returns null when the theme registered no slots. Kept self-contained (only `window`) since\n * it ships as raw source, not as a bundled module.\n */\nexport function renderThemeHookSlotsScript(names: string[] = getRegisteredThemeHookSlots()) {\n if (!names.length) return null;\n const json = escapeForInlineScript(JSON.stringify(names));\n return (\n `(function(names){` +\n `var w=window;` +\n `function push(){` +\n `var h=w.salla&&w.salla.hooks;var slots=h&&h._themeSlots;` +\n `if(!Array.isArray(slots))return false;` +\n `for(var i=0;i<names.length;i++)if(slots.indexOf(names[i])<0)slots.push(names[i]);` +\n `return true}` +\n `if(push())return;` +\n `w.addEventListener('twilight::initiated',function(){push()},{once:true})` +\n `})(${json});`\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/app-scope.ts","../src/utils/theme-hook-slots.ts"],"names":[],"mappings":";;;AAGA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AA2B7B,IAAM,qBAAA,GAAgD,CAAC,CAAA,EAAG,MAAA,KAAW;AAC1E,EAAA,MAAM,QAAA,GAAW,CAAC,GAAA,KAChB,OAAO,QAAQ,QAAA,IAAY,GAAA,CAAI,OAAA,CAAQ,MAAM,CAAA,KAAM,CAAA;AACrD,EAAA,MAAM,SAAA,GAAY,CAAC,GAAA,KAAwB,GAAA,CAAI,MAAM,CAAC,CAAA;AACtD,EAAA,MAAM,YAAY,MAA+B,CAAA,CAAE,KAAA,IAAS,CAAA,CAAE,SAAS,EAAC;AACxE,EAAA,MAAM,UAAA,GAAa,MAChB,SAAA,EAAU,CAAE,UAAsC,EAAC;AACtD,EAAA,MAAM,WAAA,GAAc,CAAC,GAAA,EAA8B,IAAA,KAAmC;AACpF,IAAA,MAAM,MAAA,GAAS,IAAI,IAAc,CAAA;AACjC,IAAA,OAAO,OAAO,MAAA,KAAW,UAAA,GAAa,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA;AAAA,EAC3D,CAAA;AAEA,EAAA,MAAM,cAAA,GAAiB,CAAC,OAAA,KAA8B;AACpD,IAAA,MAAM,MAAA,GAAS,MAAqB,MAAA,CAAO,OAAO,IAAI,MAAA,CAAO,OAAO,KAAK,EAAC;AAE1E,IAAA,MAAM,SAAA,GAAY,CAAC,GAAA,EAAa,QAAA,KAAgC;AAC9D,MAAA,IAAI,QAAA,CAAS,GAAG,CAAA,EAAG;AACjB,QAAA,MAAM,GAAA,GAAM,UAAU,GAAG,CAAA;AACzB,QAAA,MAAM,IAA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AA,EAAM,IAAA,EAAM,CAAA;AACvF;AAGO,SAAS,2BAAA,GAAwC;AACtD,EAAA,OAAO,CAAC,GAAG,UAAU,CAAA;AACvB;AAeO,SAAS,0BAAA,CAA2B,KAAA,GAAkB,2BAAA,EAA4B,EAAG;AAC1F,EAAA,IAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,IAAA;AAC1B,EAAA,MAAM,IAAA,GAAO,qBAAA,CAAsB,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA;AACxD,EAAA,OACE,wUASM,IAAI,CAAA,EAAA,CAAA;AAEd","file":"chunk-I2A2IK4A.js","sourcesContent":["import type { SallaSDK } from '../types/salla-sdk';\nimport { escapeForInlineScript } from './inline-script';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/** One app's private `app.*` bag, keyed without the `app.` prefix (`app.color` → `color`). */\nexport type AppConfigBag = Record<string, unknown>;\n\n/** One public `app.*` bucket per app, keyed by appScopeId. Everything else is read from the\n * real `salla.config` at runtime. */\nexport interface AppScopeContexts {\n apps: Record<string, AppConfigBag>;\n}\n\n/** Builds the `scopeId → sandboxed SDK` factory over a live bucket bag. */\nexport type AppScopeFactoryBuilder = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n w: any,\n appCtx: Record<string, AppConfigBag>\n) => (scopeId: string) => SallaSDK;\n\n/**\n * The sandbox itself: proxies that resolve `app.*` against the app's own bucket and pass\n * everything else through to the real SDK.\n *\n * MUST stay self-contained (only `Object`/`Proxy` and its two arguments): it is serialized via\n * `.toString()` next to {@link appScopeBootstrap} and handed in as an argument, so anything it\n * closed over at module scope would be undefined in the inline head copy. Split out from the\n * bootstrap purely to keep both halves reviewable.\n */\nexport const createAppScopeFactory: AppScopeFactoryBuilder = (w, appCtx) => {\n const isAppKey = (key: unknown): key is string =>\n typeof key === 'string' && key.indexOf('app.') === 0;\n const bucketKey = (key: string): string => key.slice(4);\n const realSalla = (): Record<string, unknown> => w.salla || w.Salla || {};\n const realConfig = (): Record<string, unknown> =>\n (realSalla().config as Record<string, unknown>) || {};\n const passthrough = (obj: Record<string, unknown>, prop: string | symbol): unknown => {\n const member = obj[prop as string];\n return typeof member === 'function' ? member.bind(obj) : member;\n };\n\n const createAppScope = (scopeId: string): SallaSDK => {\n const bucket = (): AppConfigBag => (appCtx[scopeId] = appCtx[scopeId] || {});\n\n const getConfig = (key: string, fallback?: unknown): unknown => {\n if (isAppKey(key)) {\n const sub = bucketKey(key);\n const b = bucket();\n // `app.*` miss returns the caller default, never the real config — a missing app\n // setting must not resolve to a same-named global.\n return sub in b ? b[sub] : fallback;\n }\n const cfg = realConfig();\n return typeof cfg.get === 'function'\n ? (cfg.get as (k: string, d?: unknown) => unknown)(key, fallback)\n : fallback;\n };\n\n const setConfig = (key: string, value: unknown): unknown => {\n if (isAppKey(key)) {\n bucket()[bucketKey(key)] = value;\n return value;\n }\n const cfg = realConfig();\n return typeof cfg.set === 'function'\n ? (cfg.set as (k: string, v: unknown) => unknown)(key, value)\n : value;\n };\n\n const hasConfig = (key: string): boolean =>\n isAppKey(key) ? bucketKey(key) in bucket() : key in realConfig();\n\n const configProxy = new Proxy({} as Record<string, unknown>, {\n get(_t, prop) {\n if (prop === 'get') return getConfig;\n if (prop === 'set') return setConfig;\n if (prop === 'has') return hasConfig;\n if (isAppKey(prop)) return getConfig(prop);\n return passthrough(realConfig(), prop);\n },\n set(_t, prop, value) {\n setConfig(prop as string, value);\n return true;\n },\n has(_t, prop) {\n return hasConfig(prop as string);\n },\n });\n\n return new Proxy({} as Record<string, unknown>, {\n get(_t, prop) {\n return prop === 'config' ? configProxy : passthrough(realSalla(), prop);\n },\n set(_t, prop, value) {\n // Reassigning `salla.config` wholesale would escape the sandbox; swallow it.\n if (prop === 'config') return true;\n realSalla()[prop as string] = value;\n return true;\n },\n }) as unknown as SallaSDK;\n };\n\n return createAppScope;\n};\n\n/**\n * Installs `window.Salla.appScope`, seeded with `contexts` and sandboxed by `makeFactory`.\n *\n * MUST stay self-contained (only `window`/`Object` and its arguments): it's serialized via\n * `.toString()` and inlined into the SSR head so the factory exists at parse time — before the\n * SDK init/hydration a CDN snippet's `onReady` races, else it throws `Salla.appScope is not a\n * function`. `makeFactory` is passed in rather than imported for exactly that reason. Also\n * called directly by `installAppScope` (tests/fallback).\n *\n * Idempotent: the factory is first-write-wins, while buckets are merged per scope (also\n * first-write-wins) so a later call can seed scopes the first one had no data for. `appCtx` is\n * closure-private (namespacing, not security: buckets are public-only and the boundary is\n * server-side).\n */\nexport function appScopeBootstrap(\n contexts: AppScopeContexts,\n makeFactory: AppScopeFactoryBuilder\n): void {\n if (typeof window === 'undefined') return;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const w = window as any;\n const Salla = (w.Salla = w.Salla || {});\n if (Salla.appScope) {\n // Already installed (normally by the inline head copy). The factory is first-write-wins,\n // but buckets are not: the head may have installed with none of them — the settings\n // endpoint can fail or lag behind the snippets one — so hand them to the existing install.\n if (Salla.__appScopeSeed) Salla.__appScopeSeed(contexts);\n return;\n }\n\n // Live bag + pristine snapshot (for mock overlays). Copy, don't alias: a snippet may\n // `config.set('app.x')` and the payload can be a cached response.\n const appCtx: Record<string, AppConfigBag> = {};\n const base: Record<string, AppConfigBag> = {};\n // Which scopes already got their real bucket, so a later seed can't overwrite one.\n const seeded: Record<string, boolean> = {};\n const seed = (next: AppScopeContexts): void => {\n const bags = (next && next.apps) || {};\n Object.keys(bags).forEach((scopeId) => {\n if (seeded[scopeId]) return;\n seeded[scopeId] = true;\n appCtx[scopeId] = Object.assign({}, appCtx[scopeId] || {}, bags[scopeId] || {});\n base[scopeId] = Object.assign({}, appCtx[scopeId]);\n });\n };\n seed(contexts);\n\n const createAppScope = makeFactory(w, appCtx);\n Salla.appScope = (scopeId: string): SallaSDK => createAppScope(scopeId);\n\n // Fill in buckets for scopes not seeded yet (first-write-wins per scope). Lets the head\n // install the factory unconditionally — at parse time, before any snippet's onReady — and\n // still pick up buckets that only the client managed to fetch.\n Salla.__appScopeSeed = (next: AppScopeContexts): void => seed(next);\n\n // Overlay preview mocks onto an app's pristine baseline, so fields the partner did not mock\n // keep their real values. Returns false for an unknown scope or before install.\n Salla.__appScopeMock = (scopeId: string, mocks: AppConfigBag): boolean => {\n if (!(scopeId in base)) return false;\n appCtx[scopeId] = Object.assign({}, base[scopeId], mocks);\n return true;\n };\n}\n\n/** Overlay preview mocks onto one app's bucket (over its pristine values). Delegates to the\n * bootstrap's `__appScopeMock`, so it works for both install paths. False if unknown/uninstalled. */\nexport function applyAppScopeMocks(appScopeId: string, mocks: AppConfigBag): boolean {\n if (!isBrowser) return false;\n const mock = (window.Salla as unknown as { __appScopeMock?: MockApplier } | undefined)\n ?.__appScopeMock;\n return mock?.(appScopeId, mocks) ?? false;\n}\n\ntype MockApplier = (appScopeId: string, mocks: AppConfigBag) => boolean;\n\n/** Serialize the installer into an inline `<script>` body seeded with `contexts` — both halves\n * via `.toString()`, hence their self-contained requirement. See `rootHead`. */\nexport function renderAppScopeInstallScript(contexts: AppScopeContexts): string {\n // Bucket values are partner-set, so escape the JSON seed against a `</script>` breakout.\n // The function sources have no `<`, so they need no escaping.\n const json = escapeForInlineScript(JSON.stringify(contexts));\n return `(${appScopeBootstrap.toString()})(${json},${createAppScopeFactory.toString()});`;\n}\n\n/** Install `Salla.appScope` on the client, or seed buckets into the inline SSR head copy that\n * already installed it. No-op on the server. Fallback for unseeded loads + the unit-test entry\n * point. */\nexport function installAppScope(contexts: AppScopeContexts): void {\n if (!isBrowser) return;\n appScopeBootstrap(contexts, createAppScopeFactory);\n}\n","import { escapeForInlineScript } from './inline-script';\n\nconst registered = new Set<string>();\n\nlet retryArmed = false;\n\n/**\n * Declare hook slots the theme renders itself so apps may mount into them.\n *\n * The SDK rejects `mount()` for any name absent from its `_themeSlots` whitelist, so a theme\n * rendering its own `<salla-hook>` must register the name. Call at module scope; the engine\n * applies the names via {@link applyThemeHookSlots}.\n */\nexport function registerThemeHookSlots(...names: string[]): void {\n for (const name of names) registered.add(name);\n}\n\n/** Push the registered names in. Returns false if the SDK hasn't exposed the list yet. */\nfunction pushSlots(): boolean {\n const slots = window.salla?.hooks?._themeSlots;\n if (!Array.isArray(slots)) return false;\n for (const name of registered) if (!slots.includes(name)) slots.push(name);\n return true;\n}\n\n/**\n * Push every registered slot name into the SDK whitelist. Idempotent. Engine-only.\n *\n * The SDK's hooks module may attach after this runs, so a first no-op falls back to a\n * one-shot retry on `twilight::initiated` — still before apps mount from their own onReady.\n *\n * This is only the late backstop: the whitelist is primarily seeded at parse time by the\n * inline head script from {@link renderThemeHookSlotsScript}, because an app's snippet\n * registers its `onReady` callback before React ever hydrates.\n */\nexport function applyThemeHookSlots(): void {\n if (typeof window === 'undefined' || registered.size === 0) return;\n if (pushSlots() || retryArmed) return;\n\n retryArmed = true;\n window.addEventListener('twilight::initiated', () => void pushSlots(), { once: true });\n}\n\n/** The slot names registered so far. Read by `rootHead` when rendering the inline script. */\nexport function getRegisteredThemeHookSlots(): string[] {\n return [...registered];\n}\n\n/**\n * Serialize the whitelist push into an inline head `<script>` body, so the slots are\n * registered at parse time.\n *\n * Ordering is the whole point: CDN snippets are parser-inserted `<script defer>` tags in the\n * body, so an app's `Salla.onReady` callback is registered long before React hydrates and runs\n * {@link applyThemeHookSlots}. Whichever `twilight::initiated` listener was added first runs\n * first, so the push must be armed from the head — otherwise the SDK rejects the app's\n * `hooks.mount()` with \"Hook <name> is not allowed\" and the app never renders.\n *\n * Returns null when the theme registered no slots. Kept self-contained (only `window`) since\n * it ships as raw source, not as a bundled module.\n */\nexport function renderThemeHookSlotsScript(names: string[] = getRegisteredThemeHookSlots()) {\n if (!names.length) return null;\n const json = escapeForInlineScript(JSON.stringify(names));\n return (\n `(function(names){` +\n `var w=window;` +\n `function push(){` +\n `var h=w.salla&&w.salla.hooks;var slots=h&&h._themeSlots;` +\n `if(!Array.isArray(slots))return false;` +\n `for(var i=0;i<names.length;i++)if(slots.indexOf(names[i])<0)slots.push(names[i]);` +\n `return true}` +\n `if(push())return;` +\n `w.addEventListener('twilight::initiated',function(){push()},{once:true})` +\n `})(${json});`\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api } from './chunk-
|
|
1
|
+
import { api } from './chunk-XKUECSMV.js';
|
|
2
2
|
|
|
3
3
|
// src/api/wallet.ts
|
|
4
4
|
var wallet = {
|
|
@@ -20,5 +20,5 @@ var wallet = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export { wallet };
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-IAT5BQJM.js.map
|
|
24
|
+
//# sourceMappingURL=chunk-IAT5BQJM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/wallet.ts"],"names":[],"mappings":";;;AAgCO,IAAM,MAAA,GAAS;AAAA,EACpB,IAAA,EAAM,OAAO,MAAA,GAA2B,EAAC,KAAiC;AACxE,IAAA,MAAM,EAAE,IAAA,GAAO,CAAA,EAAG,OAAA,GAAU,EAAA,EAAI,QAAO,GAAI,MAAA;AAE3C,IAAA,MAAM,YAAA,GAAe,IAAI,eAAA,EAAgB;AACzC,IAAA,YAAA,CAAa,GAAA,CAAI,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAC,CAAA;AACrC,IAAA,YAAA,CAAa,GAAA,CAAI,UAAA,EAAY,MAAA,CAAO,OAAO,CAAC,CAAA;AAE5C,IAAA,MAAM,UAAmC,EAAC;AAC1C,IAAA,IAAI,MAAA,UAAgB,MAAA,GAAS,MAAA;AAE7B,IAAA,MAAM,QAAA,GAAW,MAAM,GAAA,CACpB,GAAA,CAAI,CAAA,eAAA,EAAkB,YAAA,CAAa,QAAA,EAAU,CAAA,CAAA,EAAI,OAAc,CAAA,CAC/D,IAAA,EAAsE;AAEzE,IAAA,MAAM,YAAA,GAAe,SAAS,IAAA,CAAK,YAAA;AAEnC,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,YAAA,CAAa,IAAA,IAAQ,EAAC;AAAA,MAC7B,MAAM,YAAA,CAAa,aAAA;AAAA,MACnB,OAAA,EAAS,SAAS,IAAA,CAAK;AAAA,KACzB;AAAA,EACF;AACF","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/api/wallet.ts"],"names":[],"mappings":";;;AAgCO,IAAM,MAAA,GAAS;AAAA,EACpB,IAAA,EAAM,OAAO,MAAA,GAA2B,EAAC,KAAiC;AACxE,IAAA,MAAM,EAAE,IAAA,GAAO,CAAA,EAAG,OAAA,GAAU,EAAA,EAAI,QAAO,GAAI,MAAA;AAE3C,IAAA,MAAM,YAAA,GAAe,IAAI,eAAA,EAAgB;AACzC,IAAA,YAAA,CAAa,GAAA,CAAI,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAC,CAAA;AACrC,IAAA,YAAA,CAAa,GAAA,CAAI,UAAA,EAAY,MAAA,CAAO,OAAO,CAAC,CAAA;AAE5C,IAAA,MAAM,UAAmC,EAAC;AAC1C,IAAA,IAAI,MAAA,UAAgB,MAAA,GAAS,MAAA;AAE7B,IAAA,MAAM,QAAA,GAAW,MAAM,GAAA,CACpB,GAAA,CAAI,CAAA,eAAA,EAAkB,YAAA,CAAa,QAAA,EAAU,CAAA,CAAA,EAAI,OAAc,CAAA,CAC/D,IAAA,EAAsE;AAEzE,IAAA,MAAM,YAAA,GAAe,SAAS,IAAA,CAAK,YAAA;AAEnC,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,YAAA,CAAa,IAAA,IAAQ,EAAC;AAAA,MAC7B,MAAM,YAAA,CAAa,aAAA;AAAA,MACnB,OAAA,EAAS,SAAS,IAAA,CAAK;AAAA,KACzB;AAAA,EACF;AACF","file":"chunk-IAT5BQJM.js","sourcesContent":["import { api } from './client';\n\nexport interface TransactionItem {\n id: number;\n order_id: number;\n transaction_type: string;\n action_type: string;\n type: string;\n title: string;\n description: string;\n amount: number;\n created_at: number;\n expired_at: number;\n}\n\nexport interface WalletListParams {\n page?: number;\n perPage?: number;\n signal?: AbortSignal;\n}\n\nexport interface WalletListResponse {\n data: TransactionItem[];\n next_page_url: string | null;\n}\n\nexport interface WalletListResult {\n items: TransactionItem[];\n next: string | null;\n balance: number;\n}\n\nexport const wallet = {\n list: async (params: WalletListParams = {}): Promise<WalletListResult> => {\n const { page = 1, perPage = 10, signal } = params;\n\n const searchParams = new URLSearchParams();\n searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`balance/wallet?${searchParams.toString()}`, options as any)\n .json<{ data: { transactions: WalletListResponse; balance: number } }>();\n\n const transactions = response.data.transactions;\n\n return {\n items: transactions.data ?? [],\n next: transactions.next_page_url,\n balance: response.data.balance,\n };\n },\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { order } from './chunk-
|
|
2
|
-
import { buildHreflangAlternates } from './chunk-
|
|
3
|
-
import { unauthorized, orUnauthorized, orThrow } from './chunk-
|
|
1
|
+
import { order } from './chunk-XVPNLGXR.js';
|
|
2
|
+
import { buildHreflangAlternates } from './chunk-NTWKO5UW.js';
|
|
3
|
+
import { unauthorized, orUnauthorized, orThrow } from './chunk-72I3BHQT.js';
|
|
4
4
|
import { RouteId } from './chunk-OUW6WESU.js';
|
|
5
|
-
import { getAuthToken } from './chunk-
|
|
5
|
+
import { getAuthToken } from './chunk-XKUECSMV.js';
|
|
6
6
|
import { getTwilightContext } from './chunk-AWV3WEKH.js';
|
|
7
7
|
import { lazyComponent } from './chunk-VYGA5AT5.js';
|
|
8
8
|
|
|
@@ -56,10 +56,10 @@ async function orderSingleLoader({
|
|
|
56
56
|
|
|
57
57
|
// src/routes/account/orders/index.tsx
|
|
58
58
|
var LazyOrdersPage = lazyComponent(
|
|
59
|
-
() => import('./OrdersPage-
|
|
59
|
+
() => import('./OrdersPage-Z7HUNA2Y.js').then((m) => ({ default: m.OrdersPage }))
|
|
60
60
|
);
|
|
61
61
|
var LazyOrderSinglePage = lazyComponent(
|
|
62
|
-
() => import('./OrderSinglePage-
|
|
62
|
+
() => import('./OrderSinglePage-PBB65273.js').then((m) => ({ default: m.OrderSinglePage }))
|
|
63
63
|
);
|
|
64
64
|
var OrdersPage = LazyOrdersPage;
|
|
65
65
|
var OrderSinglePage = LazyOrderSinglePage;
|
|
@@ -106,5 +106,5 @@ var OrderSingle = {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
export { OrderSingle, OrderSinglePage, Orders, OrdersPage, orderSingleLoader, ordersLoader };
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
110
|
-
//# sourceMappingURL=chunk-
|
|
109
|
+
//# sourceMappingURL=chunk-IEC6Z7GX.js.map
|
|
110
|
+
//# sourceMappingURL=chunk-IEC6Z7GX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/account/orders/loader.ts","../src/routes/account/orders/index.tsx"],"names":[],"mappings":";;;;;;;;;AAQA,eAAsB,YAAA,CACpB,KACA,MAAA,EAI0B;AAC1B,EAAA,IAAI,CAAC,YAAA,EAAa,EAAG,MAAM,YAAA,EAAa;AACxC,EAAA,MAAM,QAAQ,GAAA,CAAI,KAAA;AAClB,EAAA,MAAM,SAAA,GAAY,OAAO,MAAA,KAAW,SAAA;AACpC,EAAA,MAAM,WAAW,MAAM,cAAA;AAAA,IACrB,MAAM,IAAA,CAAK;AAAA;AAAA,MAET,QAAQ,KAAA,EAAO,MAAA;AAAA,MACf,GAAI,IAAI,UAAA,GAAa,EAAE,YAAY,GAAA,CAAI,UAAA,KAAe;AAAC,KACxD;AAAA,GACH;AACA,EAAA,MAAM,IAAA,GAAO,oBAAmB,CAAE,IAAA;AAClC,EAAA,MAAM,QAAA,GAA4B;AAAA,IAChC,IAAA,EAAM;AAAA,MACJ,KAAA,EAAO,YAAY,IAAA,CAAK,CAAA,CAAE,8BAA8B,CAAA,GAAI,IAAA,CAAK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A,EAAA,OAAO,IAAA;AACT;AAEA,SAAS,eAAA,CAAgB,KAAsB,IAAA,EAA4C;AACzF,EAAA,MAAM,IAAA,GAAuB;AAAA,IAC3B,KAAA,EAAO,KAAK,IAAA,CAAK,KAAA;AAAA,IACjB,WAAA,EAAa,KAAK,IAAA,CAAK,WAAA;AAAA,IACvB,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AAEA,EAAA,OAAO,IAAA;AACT;AAEO,IAAM,MAAA,GAAS;AAAA,EACpB,IAAI,OAAA,CAAQ,qBAAA;AAAA,EACZ,MAAA,EAAQ,sBAAA;AAAA,EACR,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW;AACb;AACO,IAAM,WAAA,GAAc;AAAA,EACzB,IAAI,OAAA,CAAQ,sBAAA;AAAA,EACZ,MAAA,EAAQ,2BAAA;AAAA,EACR,IAAA,EAAM,eAAA;AAAA,EACN,SAAA,EAAW;AACb","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/routes/account/orders/loader.ts","../src/routes/account/orders/index.tsx"],"names":[],"mappings":";;;;;;;;;AAQA,eAAsB,YAAA,CACpB,KACA,MAAA,EAI0B;AAC1B,EAAA,IAAI,CAAC,YAAA,EAAa,EAAG,MAAM,YAAA,EAAa;AACxC,EAAA,MAAM,QAAQ,GAAA,CAAI,KAAA;AAClB,EAAA,MAAM,SAAA,GAAY,OAAO,MAAA,KAAW,SAAA;AACpC,EAAA,MAAM,WAAW,MAAM,cAAA;AAAA,IACrB,MAAM,IAAA,CAAK;AAAA;AAAA,MAET,QAAQ,KAAA,EAAO,MAAA;AAAA,MACf,GAAI,IAAI,UAAA,GAAa,EAAE,YAAY,GAAA,CAAI,UAAA,KAAe;AAAC,KACxD;AAAA,GACH;AACA,EAAA,MAAM,IAAA,GAAO,oBAAmB,CAAE,IAAA;AAClC,EAAA,MAAM,QAAA,GAA4B;AAAA,IAChC,IAAA,EA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,GAAG,CAAA;AACpC,IAAA,OAAO,EAAE,GAAG,IAAA,EAAM,GAAG,KAAA,EAAM;AAAA,EAC7B;AACA,EAAA,OAAO,IAAA;AACT;AAEA,SAAS,eAAA,CAAgB,KAAsB,IAAA,EAA4C;AACzF,EAAA,MAAM,IAAA,GAAuB;AAAA,IAC3B,KAAA,EAAO,KAAK,IAAA,CAAK,KAAA;AAAA,IACjB,WAAA,EAAa,KAAK,IAAA,CAAK,WAAA;AAAA,IACvB,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AAEA,EAAA,OAAO,IAAA;AACT;AAEO,IAAM,MAAA,GAAS;AAAA,EACpB,IAAI,OAAA,CAAQ,qBAAA;AAAA,EACZ,MAAA,EAAQ,sBAAA;AAAA,EACR,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW;AACb;AACO,IAAM,WAAA,GAAc;AAAA,EACzB,IAAI,OAAA,CAAQ,sBAAA;AAAA,EACZ,MAAA,EAAQ,2BAAA;AAAA,EACR,IAAA,EAAM,eAAA;AAAA,EACN,SAAA,EAAW;AACb","file":"chunk-IEC6Z7GX.js","sourcesContent":["import { order } from '../../../api/order';\nimport { getTwilightContext } from '../../../twilight/context';\nimport { RouteId } from '../../../router/route-ids';\nimport { orThrow, orUnauthorized, unauthorized } from '../../../providers/NavigationProvider';\nimport { getAuthToken } from '../../../api/client';\nimport type { OrdersPageProps, OrderSinglePageProps, OrdersQuery } from './types';\nimport type { IdParams } from '../../types';\n\nexport async function ordersLoader(\n ctx: { query?: OrdersQuery; with_items?: boolean | number },\n extend?: (\n data: OrdersPageProps,\n ctx: { params: Record<string, never> }\n ) => Promise<Record<string, unknown>> | Record<string, unknown>\n): Promise<OrdersPageProps> {\n if (!getAuthToken()) throw unauthorized();\n const query = ctx.query;\n const isPending = query?.status === 'pending';\n const response = await orUnauthorized(\n order.list({\n // Only decides the empty state; <salla-orders> applies its own review filter (`?tab=waiting`).\n status: query?.status,\n ...(ctx.with_items ? { with_items: ctx.with_items } : {}),\n })\n );\n const i18n = getTwilightContext().i18n;\n const pageData: OrdersPageProps = {\n page: {\n title: isPending ? i18n.t('common.titles.pending_orders') : i18n.t('common.titles.orders'),\n slug: RouteId.CUSTOMER_ORDERS_INDEX,\n },\n orders: response.data,\n cursor: response.cursor,\n query,\n };\n\n if (extend) {\n const extra = await extend(pageData, { params: {} });\n return { ...pageData, ...extra } as OrdersPageProps;\n }\n return pageData;\n}\n\nexport async function orderSingleLoader({\n params,\n}: {\n params: IdParams;\n}): Promise<OrderSinglePageProps> {\n if (!getAuthToken()) throw unauthorized();\n const [data, componentsOrder] = await Promise.all([\n order.findOrThrow(params.id),\n orThrow(orUnauthorized(order.findForComponents(params.id))),\n ]);\n const i18n = getTwilightContext().i18n;\n return {\n page: {\n slug: RouteId.CUSTOMER_ORDERS_SINGLE,\n id: String(params.id),\n title: i18n\n .t('pages.orders.order_details')\n .replace(':id', String(data.order.reference_id ?? params.id)),\n },\n order: data.order,\n componentsOrder,\n };\n}\n","import type { HeadDescriptor } from '../../../utils/head';\nimport { buildHreflangAlternates } from '../../../utils/baseHead';\n\nimport { ordersLoader, orderSingleLoader } from './loader';\nimport type { OrdersPageProps, OrderSinglePageProps, OrdersSearchParams } from './types';\nimport type { IdParams } from '../../types';\nimport type { TwilightContext } from '../../../twilight/context';\nimport { RouteId } from '../../../router/route-ids';\n\n// Lazy-load components for code-splitting\nconst LazyOrdersPage = lazyComponent(() =>\n import('./OrdersPage').then((m) => ({ default: m.OrdersPage }))\n);\nconst LazyOrderSinglePage = lazyComponent(() =>\n import('./OrderSinglePage').then((m) => ({ default: m.OrderSinglePage }))\n);\n\nexport const OrdersPage = LazyOrdersPage;\nexport const OrderSinglePage = LazyOrderSinglePage;\nexport { ordersLoader, orderSingleLoader } from './loader';\nexport type {\n OrdersPageProps,\n OrderSinglePageProps,\n OrdersSearchParams,\n OrdersQuery,\n} from './types';\nimport { lazyComponent } from '../../../utils/lazy-component';\n\nasync function ordersLoaderWithExtend(\n ctx: { search?: OrdersSearchParams; locale?: string; with_items?: boolean | number },\n extend?: (\n data: OrdersPageProps,\n ctx: { params: Record<string, never> }\n ) => Promise<Record<string, unknown>> | Record<string, unknown>\n): Promise<OrdersPageProps> {\n const query = ctx.search;\n // ordersLoader already merges the result of `extend`; calling it again here ran it twice.\n return ordersLoader({ query, with_items: ctx.with_items }, extend);\n}\n\nfunction ordersHead(ctx: TwilightContext, data: OrdersPageProps): HeadDescriptor {\n const isPending = data.query?.status === 'pending';\n const base: HeadDescriptor = {\n title: ctx.i18n.t(isPending ? 'common.titles.pending_orders' : 'common.titles.orders'),\n description: data.page.description,\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n\n return base;\n}\n\nasync function orderSingleLoaderWithExtend(\n ctx: { params: IdParams; locale?: string },\n extend?: (\n data: OrderSinglePageProps,\n ctx: { params: IdParams }\n ) => Promise<Record<string, unknown>> | Record<string, unknown>\n): Promise<OrderSinglePageProps> {\n const data = await orderSingleLoader({ params: ctx.params });\n\n if (extend) {\n const extra = await extend(data, ctx);\n return { ...data, ...extra } as OrderSinglePageProps;\n }\n return data;\n}\n\nfunction orderSingleHead(ctx: TwilightContext, data: OrderSinglePageProps): HeadDescriptor {\n const base: HeadDescriptor = {\n title: data.page.title,\n description: data.page.description,\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n\n return base;\n}\n\nexport const Orders = {\n id: RouteId.CUSTOMER_ORDERS_INDEX,\n loader: ordersLoaderWithExtend,\n head: ordersHead,\n Component: LazyOrdersPage,\n} as const;\nexport const OrderSingle = {\n id: RouteId.CUSTOMER_ORDERS_SINGLE,\n loader: orderSingleLoaderWithExtend,\n head: orderSingleHead,\n Component: LazyOrderSinglePage,\n} as const;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { registry } from './chunk-Y32RHCOH.js';
|
|
2
2
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
3
|
-
import { Image } from './chunk-
|
|
3
|
+
import { Image } from './chunk-F3L26JYO.js';
|
|
4
4
|
import { LazyImageModal } from './chunk-KYMWEUN2.js';
|
|
5
|
-
import { isNativeApp } from './chunk-
|
|
5
|
+
import { isNativeApp } from './chunk-GHKOMS3G.js';
|
|
6
6
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
7
7
|
import { lazyComponent } from './chunk-VYGA5AT5.js';
|
|
8
8
|
import { SallaSlider } from '@salla.sa/twilight-components-react/slider';
|
|
@@ -11,10 +11,10 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
11
11
|
|
|
12
12
|
// src/components/product/lazy.ts
|
|
13
13
|
var LazyProductDetails = lazyComponent(
|
|
14
|
-
() => import('./ProductDetails-
|
|
14
|
+
() => import('./ProductDetails-BTXBZ34L.js').then((m) => ({ default: m.ProductDetails }))
|
|
15
15
|
);
|
|
16
16
|
var LazyAddToCartForm = lazyComponent(
|
|
17
|
-
() => import('./AddToCartForm-
|
|
17
|
+
() => import('./AddToCartForm-CP2DUQXQ.js').then((m) => ({ default: m.AddToCartForm }))
|
|
18
18
|
);
|
|
19
19
|
var PRODUCT_GALLERY_KEY = "product:gallery";
|
|
20
20
|
function legacyGalleryMedia(images) {
|
|
@@ -202,5 +202,5 @@ function ThumbSlide({ image, index }) {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
export { LazyAddToCartForm, LazyProductDetails, ProductGallery };
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
206
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-JCLVC5V5.js.map
|
|
206
|
+
//# sourceMappingURL=chunk-JCLVC5V5.js.map
|