@salla.sa/twilight-theme-engine 1.0.110 → 1.0.112
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-JKGAATX3.js → AddToCartForm-TE3GVAWH.js} +3 -3
- package/dist/{AddToCartForm-JKGAATX3.js.map → AddToCartForm-TE3GVAWH.js.map} +1 -1
- package/dist/{BlogAuthorPage-GM2T2QPS.js → BlogAuthorPage-2SDU4OWN.js} +28 -28
- package/dist/{BlogAuthorPage-GM2T2QPS.js.map → BlogAuthorPage-2SDU4OWN.js.map} +1 -1
- package/dist/{BlogCategoryPage-KSC5UCJY.js → BlogCategoryPage-FIVKW3XC.js} +28 -28
- package/dist/{BlogCategoryPage-KSC5UCJY.js.map → BlogCategoryPage-FIVKW3XC.js.map} +1 -1
- package/dist/{BlogPage-5QTDYSZR.js → BlogPage-ACG6RRFH.js} +26 -26
- package/dist/{BlogPage-5QTDYSZR.js.map → BlogPage-ACG6RRFH.js.map} +1 -1
- package/dist/{BlogSinglePage-JKRNJ3P7.js → BlogSinglePage-6UKPKSWI.js} +26 -26
- package/dist/{BlogSinglePage-JKRNJ3P7.js.map → BlogSinglePage-6UKPKSWI.js.map} +1 -1
- package/dist/{BlogTagPage-JTOBAXV2.js → BlogTagPage-NIYLXK4A.js} +28 -28
- package/dist/{BlogTagPage-JTOBAXV2.js.map → BlogTagPage-NIYLXK4A.js.map} +1 -1
- package/dist/{BrandsPage-6IEMAQ3V.js → BrandsPage-WUP47ULO.js} +27 -27
- package/dist/{BrandsPage-6IEMAQ3V.js.map → BrandsPage-WUP47ULO.js.map} +1 -1
- package/dist/{Breadcrumb-267KWOPY.js → Breadcrumb-O2QYMZF5.js} +26 -26
- package/dist/{Breadcrumb-267KWOPY.js.map → Breadcrumb-O2QYMZF5.js.map} +1 -1
- package/dist/{CartItem-BUP3WUZC.js → CartItem-PEZFT565.js} +26 -26
- package/dist/{CartItem-BUP3WUZC.js.map → CartItem-PEZFT565.js.map} +1 -1
- package/dist/{CartSummary-U3MOISSP.js → CartSummary-CKYQASQD.js} +26 -26
- package/dist/{CartSummary-U3MOISSP.js.map → CartSummary-CKYQASQD.js.map} +1 -1
- package/dist/{Copyright-FSNCI3EE.js → Copyright-5BVWX3J2.js} +3 -3
- package/dist/{Copyright-FSNCI3EE.js.map → Copyright-5BVWX3J2.js.map} +1 -1
- package/dist/{CustomerLayout-JCOMMGZ7.js → CustomerLayout-K6MDTJAK.js} +26 -26
- package/dist/{CustomerLayout-JCOMMGZ7.js.map → CustomerLayout-K6MDTJAK.js.map} +1 -1
- package/dist/{Footer-VP3IBUMQ.js → Footer-VG7H4NDU.js} +4 -4
- package/dist/{Footer-VP3IBUMQ.js.map → Footer-VG7H4NDU.js.map} +1 -1
- package/dist/Header-77E24UCH.js +22 -0
- package/dist/{Header-3YOZ7XLJ.js.map → Header-77E24UCH.js.map} +1 -1
- package/dist/{LoyaltyPage-5X42RIJQ.js → LoyaltyPage-TZ2ZCN7D.js} +26 -26
- package/dist/{LoyaltyPage-5X42RIJQ.js.map → LoyaltyPage-TZ2ZCN7D.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-67KYJN2Z.js → LoyaltyPointsPage-SNNE2LPO.js} +9 -9
- package/dist/{LoyaltyPointsPage-67KYJN2Z.js.map → LoyaltyPointsPage-SNNE2LPO.js.map} +1 -1
- package/dist/{MainMenu-FYIK55JU.js → MainMenu-OLTQHNRC.js} +8 -8
- package/dist/{MainMenu-FYIK55JU.js.map → MainMenu-OLTQHNRC.js.map} +1 -1
- package/dist/MaintenancePage-7Y4QA5LD.js +7 -0
- package/dist/{MaintenancePage-UBJ5Q3L5.js.map → MaintenancePage-7Y4QA5LD.js.map} +1 -1
- package/dist/MasterLayout-2YXSDPYR.js +54 -0
- package/dist/{MasterLayout-UMZHQTU2.js.map → MasterLayout-2YXSDPYR.js.map} +1 -1
- package/dist/{MobileMenu-FFPJYJ7F.js → MobileMenu-3GTTROW7.js} +27 -27
- package/dist/{MobileMenu-FFPJYJ7F.js.map → MobileMenu-3GTTROW7.js.map} +1 -1
- package/dist/{NotificationsPage-HKJN6ME2.js → NotificationsPage-CLFV2RZP.js} +26 -26
- package/dist/{NotificationsPage-HKJN6ME2.js.map → NotificationsPage-CLFV2RZP.js.map} +1 -1
- package/dist/{OrderSinglePage-ASYL4SMQ.js → OrderSinglePage-G23VZHUU.js} +27 -27
- package/dist/{OrderSinglePage-ASYL4SMQ.js.map → OrderSinglePage-G23VZHUU.js.map} +1 -1
- package/dist/{OrdersPage-IQXHFGLQ.js → OrdersPage-3IOOHWHB.js} +26 -26
- package/dist/{OrdersPage-IQXHFGLQ.js.map → OrdersPage-3IOOHWHB.js.map} +1 -1
- package/dist/{PageSingle-B4WQVQVQ.js → PageSingle-H4YBIV6N.js} +7 -7
- package/dist/{PageSingle-B4WQVQVQ.js.map → PageSingle-H4YBIV6N.js.map} +1 -1
- package/dist/{ProductDetails-WSEGLJSW.js → ProductDetails-DVMOV456.js} +8 -8
- package/dist/{ProductDetails-WSEGLJSW.js.map → ProductDetails-DVMOV456.js.map} +1 -1
- package/dist/{ProfilePage-6GNEI6OV.js → ProfilePage-PB5GTUML.js} +26 -26
- package/dist/{ProfilePage-6GNEI6OV.js.map → ProfilePage-PB5GTUML.js.map} +1 -1
- package/dist/{ReviewsPage-JP4LZI4A.js → ReviewsPage-RVUZDDRM.js} +3 -3
- package/dist/{ReviewsPage-JP4LZI4A.js.map → ReviewsPage-RVUZDDRM.js.map} +1 -1
- package/dist/{SeoCartWidget-KCB4E65P.js → SeoCartWidget-WV4KPH2S.js} +26 -26
- package/dist/{SeoCartWidget-KCB4E65P.js.map → SeoCartWidget-WV4KPH2S.js.map} +1 -1
- package/dist/{SettingsPage-UFGVJOI2.js → SettingsPage-GOSZA5LT.js} +26 -26
- package/dist/{SettingsPage-UFGVJOI2.js.map → SettingsPage-GOSZA5LT.js.map} +1 -1
- package/dist/StoreClosedNotification-DJ7OAWQC.js +55 -0
- package/dist/{StoreClosedNotification-Q4QPPYEH.js.map → StoreClosedNotification-DJ7OAWQC.js.map} +1 -1
- package/dist/{TestimonialsPage-K5PHW7WD.js → TestimonialsPage-JQTZ6YJH.js} +7 -7
- package/dist/{TestimonialsPage-K5PHW7WD.js.map → TestimonialsPage-JQTZ6YJH.js.map} +1 -1
- package/dist/{ThankYouPage-DSDAYYJN.js → ThankYouPage-LPVQDOLE.js} +26 -26
- package/dist/{ThankYouPage-DSDAYYJN.js.map → ThankYouPage-LPVQDOLE.js.map} +1 -1
- package/dist/{WalletPage-3LWCFG25.js → WalletPage-HEQOSBJH.js} +27 -27
- package/dist/{WalletPage-3LWCFG25.js.map → WalletPage-HEQOSBJH.js.map} +1 -1
- package/dist/{WishlistPage-LF4A2H3I.js → WishlistPage-OLQQJD5V.js} +28 -28
- package/dist/{WishlistPage-LF4A2H3I.js.map → WishlistPage-OLQQJD5V.js.map} +1 -1
- package/dist/api/advertisement.js +5 -5
- package/dist/api/apps.js +5 -5
- package/dist/api/blog.js +7 -7
- package/dist/api/brands.js +7 -7
- package/dist/api/cart.js +7 -7
- package/dist/api/category.js +7 -7
- package/dist/api/client.js +4 -4
- package/dist/api/home.js +5 -5
- package/dist/api/loyalty.js +7 -7
- package/dist/api/menu.js +5 -5
- package/dist/api/notification.js +5 -5
- package/dist/api/order.js +7 -7
- package/dist/api/page.js +7 -7
- package/dist/api/product.js +7 -7
- package/dist/api/profile.js +4 -4
- package/dist/api/store.d.ts.map +1 -1
- package/dist/api/store.js +5 -5
- package/dist/api/translations.js +5 -5
- package/dist/api/user.js +5 -5
- package/dist/api/wallet.js +5 -5
- package/dist/api/wishlist.js +8 -8
- package/dist/chunk-2BBIVHKI.js +14 -0
- package/dist/{chunk-D6XIFBYA.js.map → chunk-2BBIVHKI.js.map} +1 -1
- package/dist/{chunk-X2JCU7GY.js → chunk-3GDJMMMS.js} +3 -3
- package/dist/{chunk-X2JCU7GY.js.map → chunk-3GDJMMMS.js.map} +1 -1
- package/dist/{chunk-ZDKQL2E4.js → chunk-4TM54PZO.js} +4 -4
- package/dist/{chunk-ZDKQL2E4.js.map → chunk-4TM54PZO.js.map} +1 -1
- package/dist/{chunk-ZRT6L6TC.js → chunk-5CEVDCMY.js} +3 -3
- package/dist/{chunk-ZRT6L6TC.js.map → chunk-5CEVDCMY.js.map} +1 -1
- package/dist/{chunk-I7WSIN27.js → chunk-5FJFN3IW.js} +3 -3
- package/dist/{chunk-I7WSIN27.js.map → chunk-5FJFN3IW.js.map} +1 -1
- package/dist/{chunk-6NV6T24C.js → chunk-5G6PD6P2.js} +4 -4
- package/dist/{chunk-6NV6T24C.js.map → chunk-5G6PD6P2.js.map} +1 -1
- package/dist/{chunk-FNM2OUPD.js → chunk-6D3OWIEC.js} +11 -6
- package/dist/chunk-6D3OWIEC.js.map +1 -0
- package/dist/{chunk-G3VAJVY5.js → chunk-6HSMXFAW.js} +15 -9
- package/dist/chunk-6HSMXFAW.js.map +1 -0
- package/dist/{chunk-SCSJROJX.js → chunk-6XTOZHW4.js} +8 -8
- package/dist/{chunk-SCSJROJX.js.map → chunk-6XTOZHW4.js.map} +1 -1
- package/dist/{chunk-VIR6L7KJ.js → chunk-73CUZ7LC.js} +5 -4
- package/dist/chunk-73CUZ7LC.js.map +1 -0
- package/dist/{chunk-FMSRB2TT.js → chunk-74W2O47D.js} +4 -4
- package/dist/{chunk-FMSRB2TT.js.map → chunk-74W2O47D.js.map} +1 -1
- package/dist/{chunk-56OZRZIZ.js → chunk-75TXHISE.js} +4 -4
- package/dist/{chunk-56OZRZIZ.js.map → chunk-75TXHISE.js.map} +1 -1
- package/dist/{chunk-YYMKDBZV.js → chunk-7AIDISU2.js} +3 -3
- package/dist/{chunk-YYMKDBZV.js.map → chunk-7AIDISU2.js.map} +1 -1
- package/dist/{chunk-EJLVOWXU.js → chunk-7EZZR4WA.js} +5 -5
- package/dist/{chunk-EJLVOWXU.js.map → chunk-7EZZR4WA.js.map} +1 -1
- package/dist/{chunk-GAGTCI3J.js → chunk-7QHK77KL.js} +5 -5
- package/dist/{chunk-GAGTCI3J.js.map → chunk-7QHK77KL.js.map} +1 -1
- package/dist/{chunk-QRHXAKJ3.js → chunk-7VNVCHID.js} +8 -3
- package/dist/chunk-7VNVCHID.js.map +1 -0
- package/dist/{chunk-MEMJOJO4.js → chunk-BVMHRVCG.js} +3 -3
- package/dist/{chunk-MEMJOJO4.js.map → chunk-BVMHRVCG.js.map} +1 -1
- package/dist/{chunk-VFXAHTB3.js → chunk-CDOGKC7B.js} +7 -7
- package/dist/{chunk-VFXAHTB3.js.map → chunk-CDOGKC7B.js.map} +1 -1
- package/dist/{chunk-Z4UTYKKV.js → chunk-CGHCXWV2.js} +4 -4
- package/dist/{chunk-Z4UTYKKV.js.map → chunk-CGHCXWV2.js.map} +1 -1
- package/dist/{chunk-ALAHGZPN.js → chunk-CZEYFBMN.js} +4 -4
- package/dist/{chunk-ALAHGZPN.js.map → chunk-CZEYFBMN.js.map} +1 -1
- package/dist/{chunk-3DNVQVNY.js → chunk-D3PO3ICA.js} +3 -3
- package/dist/{chunk-3DNVQVNY.js.map → chunk-D3PO3ICA.js.map} +1 -1
- package/dist/{chunk-XU33IHQA.js → chunk-DE7OGVOT.js} +8 -8
- package/dist/{chunk-XU33IHQA.js.map → chunk-DE7OGVOT.js.map} +1 -1
- package/dist/{chunk-FJQD3LTR.js → chunk-DGTFJWBV.js} +4 -4
- package/dist/{chunk-FJQD3LTR.js.map → chunk-DGTFJWBV.js.map} +1 -1
- package/dist/{chunk-7ZBSIOVM.js → chunk-DILJT76E.js} +7 -7
- package/dist/{chunk-7ZBSIOVM.js.map → chunk-DILJT76E.js.map} +1 -1
- package/dist/{chunk-4INSECDW.js → chunk-EHTLXK5F.js} +5 -5
- package/dist/{chunk-4INSECDW.js.map → chunk-EHTLXK5F.js.map} +1 -1
- package/dist/{chunk-POI4G5EA.js → chunk-FHU2MXZA.js} +4 -4
- package/dist/{chunk-POI4G5EA.js.map → chunk-FHU2MXZA.js.map} +1 -1
- package/dist/{chunk-OMY65JIW.js → chunk-GFZEZQ45.js} +4 -4
- package/dist/{chunk-OMY65JIW.js.map → chunk-GFZEZQ45.js.map} +1 -1
- package/dist/{chunk-2MHMQOMJ.js → chunk-J5DGBS7Q.js} +3 -3
- package/dist/{chunk-2MHMQOMJ.js.map → chunk-J5DGBS7Q.js.map} +1 -1
- package/dist/{chunk-IAHWLUFK.js → chunk-JVAFKLXJ.js} +3 -3
- package/dist/{chunk-IAHWLUFK.js.map → chunk-JVAFKLXJ.js.map} +1 -1
- package/dist/{chunk-OSAFBMRT.js → chunk-JYGIC54K.js} +3 -3
- package/dist/{chunk-OSAFBMRT.js.map → chunk-JYGIC54K.js.map} +1 -1
- package/dist/{chunk-LZZ6EESI.js → chunk-JYV25VNZ.js} +3 -3
- package/dist/{chunk-LZZ6EESI.js.map → chunk-JYV25VNZ.js.map} +1 -1
- package/dist/{chunk-S67SB2O2.js → chunk-KXCMUORW.js} +7 -7
- package/dist/{chunk-S67SB2O2.js.map → chunk-KXCMUORW.js.map} +1 -1
- package/dist/{chunk-E5PEYI5I.js → chunk-KXD4WUYA.js} +6 -6
- package/dist/{chunk-E5PEYI5I.js.map → chunk-KXD4WUYA.js.map} +1 -1
- package/dist/{chunk-BFA2U7P3.js → chunk-M46EKE7R.js} +5 -5
- package/dist/{chunk-BFA2U7P3.js.map → chunk-M46EKE7R.js.map} +1 -1
- package/dist/{chunk-72DGJN4Q.js → chunk-NFRSUW4L.js} +23 -23
- package/dist/{chunk-72DGJN4Q.js.map → chunk-NFRSUW4L.js.map} +1 -1
- package/dist/{chunk-7T5UR3XD.js → chunk-NQRA3MRH.js} +4 -4
- package/dist/{chunk-7T5UR3XD.js.map → chunk-NQRA3MRH.js.map} +1 -1
- package/dist/{chunk-MJ7TL42D.js → chunk-OKCNKVB5.js} +4 -4
- package/dist/{chunk-MJ7TL42D.js.map → chunk-OKCNKVB5.js.map} +1 -1
- package/dist/{chunk-TMMK2VYE.js → chunk-OM2GRPDH.js} +3 -3
- package/dist/{chunk-TMMK2VYE.js.map → chunk-OM2GRPDH.js.map} +1 -1
- package/dist/{chunk-CFARTPUQ.js → chunk-OU2KIHZI.js} +3 -3
- package/dist/{chunk-CFARTPUQ.js.map → chunk-OU2KIHZI.js.map} +1 -1
- package/dist/{chunk-WD576F4S.js → chunk-P7A24TSM.js} +3 -3
- package/dist/{chunk-WD576F4S.js.map → chunk-P7A24TSM.js.map} +1 -1
- package/dist/{chunk-MVBMVM22.js → chunk-PCEKL6S3.js} +7 -7
- package/dist/{chunk-MVBMVM22.js.map → chunk-PCEKL6S3.js.map} +1 -1
- package/dist/{chunk-WN35SBLD.js → chunk-QQTY4PDC.js} +3 -3
- package/dist/{chunk-WN35SBLD.js.map → chunk-QQTY4PDC.js.map} +1 -1
- package/dist/{chunk-6Z6BGS7P.js → chunk-SW4WGOLU.js} +3 -3
- package/dist/{chunk-6Z6BGS7P.js.map → chunk-SW4WGOLU.js.map} +1 -1
- package/dist/{chunk-PF2WSBJ7.js → chunk-UHXL4VZS.js} +4 -4
- package/dist/{chunk-PF2WSBJ7.js.map → chunk-UHXL4VZS.js.map} +1 -1
- package/dist/{chunk-E7AO2Q32.js → chunk-V3NOBNNU.js} +3 -3
- package/dist/{chunk-E7AO2Q32.js.map → chunk-V3NOBNNU.js.map} +1 -1
- package/dist/{chunk-YSYA64WS.js → chunk-VDV26OPG.js} +21 -18
- package/dist/chunk-VDV26OPG.js.map +1 -0
- package/dist/{chunk-PKJJ6Z7A.js → chunk-W6LB5TRO.js} +4 -4
- package/dist/{chunk-PKJJ6Z7A.js.map → chunk-W6LB5TRO.js.map} +1 -1
- package/dist/{chunk-K7U46BT2.js → chunk-WBL7MSKQ.js} +4 -4
- package/dist/{chunk-K7U46BT2.js.map → chunk-WBL7MSKQ.js.map} +1 -1
- package/dist/{chunk-LU5DRXS5.js → chunk-WBXIDILF.js} +4 -4
- package/dist/{chunk-LU5DRXS5.js.map → chunk-WBXIDILF.js.map} +1 -1
- package/dist/{chunk-6T7FUHJY.js → chunk-YWDMDW2K.js} +5 -5
- package/dist/{chunk-6T7FUHJY.js.map → chunk-YWDMDW2K.js.map} +1 -1
- package/dist/{chunk-WRYCOIYC.js → chunk-Z5EAIRR3.js} +9 -9
- package/dist/{chunk-WRYCOIYC.js.map → chunk-Z5EAIRR3.js.map} +1 -1
- package/dist/{chunk-CA3QVM6Y.js → chunk-ZGVBXJQO.js} +5 -5
- package/dist/{chunk-CA3QVM6Y.js.map → chunk-ZGVBXJQO.js.map} +1 -1
- package/dist/{chunk-TL256OK3.js → chunk-ZMXHQKZS.js} +4 -4
- package/dist/{chunk-TL256OK3.js.map → chunk-ZMXHQKZS.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 +28 -28
- package/dist/components/layout/Footer.d.ts.map +1 -1
- package/dist/components/layout/Header.d.ts.map +1 -1
- package/dist/components/layout/index.js +7 -7
- package/dist/components/product/index.js +25 -25
- package/dist/components/store/index.js +26 -26
- package/dist/components/toast/index.js +5 -5
- package/dist/dev/editor/index.js +3 -3
- package/dist/dev/index.js +3 -3
- package/dist/document-class-ODK66AC7.js +29 -0
- package/dist/{document-class-5BRFPS6J.js.map → document-class-ODK66AC7.js.map} +1 -1
- package/dist/hooks/index.js +24 -24
- package/dist/hooks/useComments.js +4 -4
- package/dist/hooks/useGtm.js +24 -24
- package/dist/hooks/useMoney.js +24 -24
- package/dist/hooks/useProduct.js +4 -4
- package/dist/hooks/useStore.js +24 -24
- package/dist/hooks/useUser.js +6 -6
- package/dist/hooks/useWishlist.js +4 -4
- package/dist/index.js +24 -24
- package/dist/native-app/index.js +4 -4
- package/dist/{navigation-NM4AO2OX.js → navigation-PALPE7RN.js} +8 -8
- package/dist/{navigation-NM4AO2OX.js.map → navigation-PALPE7RN.js.map} +1 -1
- package/dist/navigation-ZTRVRY6C.js +14 -0
- package/dist/{navigation-S5EUYOVI.js.map → navigation-ZTRVRY6C.js.map} +1 -1
- package/dist/{not-found-NO54GPIK.js → not-found-7BJGV2CA.js} +27 -27
- package/dist/{not-found-NO54GPIK.js.map → not-found-7BJGV2CA.js.map} +1 -1
- package/dist/providers/index.js +24 -24
- package/dist/routes/account/orders.js +9 -9
- package/dist/routes/account.js +18 -18
- package/dist/routes/blog.js +13 -13
- package/dist/routes/brands.js +9 -9
- package/dist/routes/cart.js +32 -32
- package/dist/routes/home.js +29 -29
- package/dist/routes/index.js +7 -7
- package/dist/routes/loyalty.js +10 -10
- package/dist/routes/page.js +9 -9
- package/dist/routes/product-listing.js +30 -30
- package/dist/routes/product.js +28 -28
- package/dist/routes/root/beforeLoad.d.ts.map +1 -1
- package/dist/routes/seo-redirects.js +7 -7
- package/dist/routes/testimonials.js +5 -5
- package/dist/routes/thank-you.js +9 -9
- package/dist/skeleton.js +29 -29
- package/dist/{store-lookup-LVKWUL6Z.js → store-lookup-6QB4WMID.js} +12 -12
- package/dist/{store-lookup-LVKWUL6Z.js.map → store-lookup-6QB4WMID.js.map} +1 -1
- package/dist/tanstack/middleware/store-not-found.d.ts +10 -0
- package/dist/tanstack/middleware/store-not-found.d.ts.map +1 -0
- package/dist/tanstack/middleware/twilight.d.ts +13 -0
- package/dist/tanstack/middleware/twilight.d.ts.map +1 -1
- package/dist/tanstack.js +99 -22
- package/dist/tanstack.js.map +1 -1
- package/dist/twilight/context.d.ts +5 -0
- package/dist/twilight/context.d.ts.map +1 -1
- package/dist/utils/baseHead.js +3 -3
- package/dist/utils/errors.d.ts +4 -3
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/index.js +7 -7
- package/dist/vite/index.js +5 -5
- package/package.json +1 -1
- package/tailwind/components/layout/Footer.tsx.txt +10 -5
- package/tailwind/components/layout/Header.tsx.txt +12 -1
- package/tailwind/routes/root/beforeLoad.ts.txt +12 -3
- package/dist/Header-3YOZ7XLJ.js +0 -22
- package/dist/MaintenancePage-UBJ5Q3L5.js +0 -7
- package/dist/MasterLayout-UMZHQTU2.js +0 -54
- package/dist/StoreClosedNotification-Q4QPPYEH.js +0 -55
- package/dist/chunk-D6XIFBYA.js +0 -14
- package/dist/chunk-FNM2OUPD.js.map +0 -1
- package/dist/chunk-G3VAJVY5.js.map +0 -1
- package/dist/chunk-QRHXAKJ3.js.map +0 -1
- package/dist/chunk-VIR6L7KJ.js.map +0 -1
- package/dist/chunk-YSYA64WS.js.map +0 -1
- package/dist/document-class-5BRFPS6J.js +0 -29
- package/dist/navigation-S5EUYOVI.js +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev/dev-settings-store.ts"],"names":["block"],"mappings":";;;;AA4CA,IAAM,kBAAA,GAAqB,uBAAA;AAE3B,IAAM,aAAA,GAAgB,GAAA;AAEtB,IAAM,YAAA,GAAe,kBAAA;AAErB,IAAM,aAAA,GAAgB,iBAAA;AAEtB,IAAM,aAAA,GAAgB,GAAA;AACtB,IAAM,cAAA,GAAiB,IAAA;AAgBvB,IAAM,cAAA,uBAAqB,GAAA,EAA2B;AAetD,SAAS,QAAA,CAAS,QAAQ,CAAA,EAAW;AACnC,EAAA,MAAM,SAAS,UAAA,CAAW,MAAA,CAAO,gBAAgB,IAAI,UAAA,CAAW,KAAK,CAAC,CAAA;AACtE,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,MAAA,EAAQ,CAAC,MAAM,CAAA,CAAE,QAAA,CAAS,EAAE,CAAA,CAAE,SAAS,CAAA,EAAG,GAAG,CAAC,CAAA,CAAE,KAAK,EAAE,CAAA;AAC3E;AAEA,IAAI,KAAA;AAQJ,SAAS,OAAA,GAAkB;AACzB,EAAA,KAAA,KAAU,QAAA,EAAS;AACnB,EAAA,OAAO,KAAA;AACT;AAEA,IAAI,UAAA;AACJ,IAAI,SAAA,GAA6B,mBAAA;AAGjC,SAAS,QAAA,GAA4B;AACnC,EAAA,MAAM,GAAA,GAAO,WAAuC,kBAAkB,CAAA;AACtE,EAAA,IAAI,Q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CAAC,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,UAAA,EAAY,SAAS,CAAC,CAAA;AAC5B;AAEO,IAAM,mBACX,MAAA,CAAA,IAAA,CAAY,GAAA,CAAI,GAAA,GAAM,kBAAA,GAAqB,CAAC,UAAA,KAAe","file":"chunk-FMSRB2TT.js","sourcesContent":["/**\n * Client-side store for the dev editor: theme-setting overrides and a dev-owned\n * home layout. Saved to `twilight.preview.json` through the dev server (see\n * `twilight-schema.plugin.ts`), not to localStorage, for three reasons: the\n * server render can read a file, so the page hydrates with the edited layout\n * instead of flashing the store's; the state survives a port or browser\n * change; and the developer can open, diff or delete it.\n *\n * The saved state reaches this module through `virtual:twilight/schema`, which\n * the root route imports on both sides before anything renders and which puts\n * it on `globalThis[DEV_PREVIEW_GLOBAL]`. Server snapshots read that value\n * (the server's modules are re-run after each save); the browser copies it once\n * and then owns the state.\n *\n * The theme editor (`/__twilight/editor`) frames the storefront, so two copies\n * of this store run side by side. Edits reach every copy on the origin at once\n * over a `BroadcastChannel` (the file save is debounced), and only the copy\n * that made an edit saves it. Everything else between an editor and its frame\n * (the home page's blocks, the store base, scroll-to-block) goes by\n * `postMessage` to that one window, so another storefront tab never answers.\n */\n\nimport { useEffect, useMemo, useRef, useSyncExternalStore } from 'react';\nimport {\n DEV_LOOKUP_TIMEOUT_MS,\n DEV_PREVIEW_ENDPOINT,\n DEV_PREVIEW_EVENT,\n DEV_PREVIEW_GLOBAL,\n EMPTY_PREVIEW_STATE,\n isEditorFrame,\n normalizePreviewState,\n type DevLookupItem,\n type DevLookupSource,\n type DevPreviewBlock,\n type DevPreviewState,\n type DevSchema,\n} from './schema-types';\nimport { resolveStoreBase } from '../utils/store-identity';\n\nexport type DevSettingsState = DevPreviewState;\nexport type DevSaveStatus = 'idle' | 'saving' | 'saved' | 'error';\ntype LiveBlocks = { path?: string }[];\n\n/** Where the old localStorage-backed widget kept its state; migrated once. */\nconst LEGACY_STORAGE_KEY = 'twilight:dev-settings';\n/** Batch keystrokes into one write. */\nconst SAVE_DELAY_MS = 250;\n/** Same-browser channel every copy of the store listens on, for edits. */\nconst CHANNEL_NAME = 'twilight:preview';\n/** Envelope type of the editor ↔ frame `postMessage`s. */\nconst FRAME_MESSAGE = 'twilight:editor';\n/** How long the frame keeps looking for a block that is still rendering (just added, say). */\nconst FOCUS_WAIT_MS = 2000;\nconst FOCUS_FLASH_MS = 1200;\n\n/** Editor ↔ the storefront it frames. */\ntype FrameMessage =\n | { kind: 'live-blocks'; blocks: LiveBlocks | null }\n | { kind: 'frame-info'; base: string | null }\n | { kind: 'request-live-blocks' }\n | { kind: 'focus-block'; index: number }\n | { kind: 'lookup'; requestId: string; source: DevLookupSource; query: string }\n | { kind: 'lookup-result'; requestId: string; items?: DevLookupItem[]; error?: string };\n\ninterface PendingLookup {\n resolve: (items: DevLookupItem[]) => void;\n reject: (error: Error) => void;\n timer: ReturnType<typeof setTimeout>;\n}\nconst pendingLookups = new Map<string, PendingLookup>();\n\n/** What the editor shows besides the saved state. */\nexport interface DevEditorMeta {\n /** The blocks the framed home page shows; `null` when it is not on the home page. */\n liveBlocks: LiveBlocks | null;\n saveStatus: DevSaveStatus;\n /** The frame's store segment; `undefined` until the frame has said. */\n frameBase: string | null | undefined;\n}\n\n/**\n * A short random hex id. `getRandomValues`, not `randomUUID`: the latter only\n * exists in secure contexts, and the dev server may be opened on a LAN address.\n */\nfunction randomId(bytes = 6): string {\n const values = globalThis.crypto.getRandomValues(new Uint8Array(bytes));\n return Array.from(values, (b) => b.toString(16).padStart(2, '0')).join('');\n}\n\nlet tabId: string | undefined;\n\n/**\n * Sent with every save so this tab can ignore its own broadcast. Made on first\n * use, never at module load: Cloudflare Workers refuse random values in global\n * scope, and this module is in the worker bundle (its use is dev-only, its\n * top level is not).\n */\nfunction myTabId(): string {\n tabId ??= randomId();\n return tabId;\n}\n\nlet seedSource: unknown;\nlet seedState: DevPreviewState = EMPTY_PREVIEW_STATE;\n\n/** The saved file as this page loaded it, normalized once per value so snapshots keep their identity. */\nfunction readSeed(): DevPreviewState {\n const raw = (globalThis as Record<string, unknown>)[DEV_PREVIEW_GLOBAL];\n if (raw !== seedSource) {\n seedSource = raw;\n seedState = normalizePreviewState(raw) ?? EMPTY_PREVIEW_STATE;\n }\n return seedState;\n}\n\n// The widget (bundled into the `/dev` entry) and the theme merge (bundled into\n// the engine index via `useTwilightInit`) import this module from two different\n// chunks, so each would otherwise get its OWN copy of the state — the widget\n// would enable a store the merge never reads. Back the state with a single\n// globalThis-keyed instance so every copy shares one source of truth. Dev-only,\n// so a global is acceptable (and lazy, so the module stays side-effect free and\n// tree-shakes out of production).\ninterface DevStoreSingleton {\n state: DevPreviewState;\n listeners: Set<() => void>;\n /** This page's own home blocks, when it is a storefront on its home page. Never saved. */\n ownBlocks: LiveBlocks | null;\n meta: DevEditorMeta;\n metaListeners: Set<() => void>;\n saveTimer: ReturnType<typeof setTimeout> | undefined;\n /** An edit that has not been sent yet. */\n dirty: boolean;\n /** A save request on its way; the next one waits for it, so saves land in order. */\n inFlight: boolean;\n /** The old localStorage copy is removed only once the file has the migrated values. */\n legacyPending: boolean;\n channel: BroadcastChannel | null;\n /** In the editor: the storefront frame's window. */\n getFrame: (() => Window | null) | null;\n /** Detach this copy's listeners and channel. A page keeps one copy for good; tests swap them. */\n dispose: () => void;\n}\n\nconst SINGLETON_KEY = '__twilightDevSettingsStore__';\n\nfunction singleton(): DevStoreSingleton {\n const g = globalThis as unknown as Record<string, DevStoreSingleton | undefined>;\n let s = g[SINGLETON_KEY];\n if (!s) {\n const seeded = (globalThis as Record<string, unknown>)[DEV_PREVIEW_GLOBAL] != null;\n s = {\n state: readSeed(),\n listeners: new Set(),\n ownBlocks: null,\n meta: { liveBlocks: null, saveStatus: 'idle', frameBase: undefined },\n metaListeners: new Set(),\n saveTimer: undefined,\n dirty: false,\n inFlight: false,\n legacyPending: false,\n channel: null,\n getFrame: null,\n dispose: () => {},\n };\n g[SINGLETON_KEY] = s;\n if (typeof window !== 'undefined') setUpBrowser(s, seeded);\n }\n return s;\n}\n\nfunction setUpBrowser(s: DevStoreSingleton, seeded: boolean): void {\n const listeners = new AbortController();\n const { signal } = listeners;\n if (!seeded) migrateLegacy(s);\n listenForOtherTabs();\n s.channel = openChannel();\n listenForFrameMessages(s, signal);\n window.addEventListener('pagehide', () => flushOnExit(s), { signal });\n s.dispose = () => {\n listeners.abort();\n s.channel?.close();\n clearTimeout(s.saveTimer);\n };\n if (isEditorFrame()) sendToEditor({ kind: 'frame-info', base: resolveStoreBase() });\n}\n\n/** Carry the old widget's settings over; its per-block patches don't map to a layout. */\nfunction migrateLegacy(s: DevStoreSingleton): void {\n try {\n const raw = window.localStorage.getItem(LEGACY_STORAGE_KEY);\n if (!raw) return;\n const legacy = normalizePreviewState(JSON.parse(raw));\n if (!legacy) return;\n s.state = { enabled: legacy.enabled, settings: legacy.settings, layout: null };\n s.legacyPending = true;\n scheduleSave(s);\n } catch {\n // Storage blocked or the old value is corrupt: nothing worth keeping.\n }\n}\n\n/** Vite's HMR client, typed locally: the engine's `ImportMeta` must not clash with `vite/client`. */\ninterface HotContext {\n on(event: string, cb: (payload: { state?: unknown; from?: unknown }) => void): void;\n}\n\n/**\n * Take a state another copy committed. Not while this copy has an edit of its\n * own waiting to be saved: that edit is newer, and saving it will tell the rest.\n */\nfunction receive(raw: unknown): void {\n const s = singleton();\n if (s.dirty || s.inFlight || s.saveTimer) return;\n const next = normalizePreviewState(raw);\n if (next && JSON.stringify(next) !== JSON.stringify(s.state)) emit(next);\n}\n\n/** Tabs in another browser hear about a save from the dev server. */\nfunction listenForOtherTabs(): void {\n const hot = (import.meta as ImportMeta & { hot?: HotContext }).hot;\n if (!hot) return;\n hot.on(DEV_PREVIEW_EVENT, (payload) => {\n if (payload?.from !== myTabId()) receive(payload?.state);\n });\n}\n\nfunction openChannel(): BroadcastChannel | null {\n if (typeof BroadcastChannel === 'undefined') return null;\n const channel = new BroadcastChannel(CHANNEL_NAME);\n channel.onmessage = ({ data }: MessageEvent<{ state?: unknown; from?: string }>) => {\n if (data && data.from !== myTabId()) receive(data.state);\n };\n return channel;\n}\n\nfunction sendToEditor(message: FrameMessage): void {\n if (isEditorFrame())\n window.parent.postMessage({ type: FRAME_MESSAGE, message }, window.location.origin);\n}\n\nfunction sendToFrame(message: FrameMessage): void {\n singleton().getFrame?.()?.postMessage({ type: FRAME_MESSAGE, message }, window.location.origin);\n}\n\nfunction reportToEditor(s: DevStoreSingleton): void {\n sendToEditor({ kind: 'frame-info', base: resolveStoreBase() });\n sendToEditor({ kind: 'live-blocks', blocks: s.ownBlocks });\n}\n\n/**\n * The editor ↔ frame conversation. A frame only takes requests from its own\n * parent; an editor only takes reports from the frame it shows.\n */\nfunction listenForFrameMessages(s: DevStoreSingleton, signal: AbortSignal): void {\n window.addEventListener(\n 'message',\n (event: MessageEvent) => {\n if (event.origin !== window.location.origin || event.data?.type !== FRAME_MESSAGE) return;\n const message = event.data.message as FrameMessage;\n if (window.parent !== window && event.source === window.parent) {\n if (message.kind === 'request-live-blocks') reportToEditor(s);\n else if (message.kind === 'focus-block') scrollToBlock(message.index);\n else if (message.kind === 'lookup') void answerLookup(message);\n return;\n }\n const frame = s.getFrame?.();\n if (!frame || event.source !== frame) return;\n if (message.kind === 'lookup-result') settleLookup(message);\n else if (message.kind === 'live-blocks') setMeta({ liveBlocks: message.blocks });\n else if (message.kind === 'frame-info') setMeta({ frameBase: message.base });\n },\n { signal }\n );\n}\n\n/** In the frame: look the request up in the store and send back what was found, or why not. */\nasync function answerLookup(message: Extract<FrameMessage, { kind: 'lookup' }>): Promise<void> {\n const { requestId, source, query } = message;\n try {\n const { lookupInStore } = await import('./store-lookup');\n sendToEditor({ kind: 'lookup-result', requestId, items: await lookupInStore(source, query) });\n } catch (error) {\n sendToEditor({\n kind: 'lookup-result',\n requestId,\n error: error instanceof Error ? error.message : 'lookup failed',\n });\n }\n}\n\nfunction settleLookup(message: Extract<FrameMessage, { kind: 'lookup-result' }>): void {\n const pending = pendingLookups.get(message.requestId);\n if (!pending) return;\n pendingLookups.delete(message.requestId);\n clearTimeout(pending.timer);\n if (message.items) pending.resolve(message.items);\n else pending.reject(new Error(message.error ?? 'lookup failed'));\n}\n\n/**\n * In the editor's frame: bring a home block into view and flash an outline on\n * it. Dev-only editor chrome, so it styles the element directly rather than\n * through the theme's React tree. A block added a moment ago may not be in the\n * DOM yet, so look for it for a little while.\n */\nfunction scrollToBlock(index: number): void {\n const started = Date.now();\n const find = () => {\n const el = document.querySelector<HTMLElement>(`[data-home-block=\"${index}\"]`);\n if (!el) {\n if (Date.now() - started < FOCUS_WAIT_MS) requestAnimationFrame(find);\n return;\n }\n const { outline, outlineOffset, scrollMarginTop } = el.style;\n // Clear a sticky header, which would otherwise cover the block's top.\n el.style.scrollMarginTop = '80px';\n el.scrollIntoView({ behavior: 'smooth', block: 'start' });\n el.style.outline = '2px solid #0d9488';\n el.style.outlineOffset = '-2px';\n setTimeout(() => {\n el.style.outline = outline;\n el.style.outlineOffset = outlineOffset;\n el.style.scrollMarginTop = scrollMarginTop;\n }, FOCUS_FLASH_MS);\n };\n find();\n}\n\nfunction emit(next: DevPreviewState): void {\n const s = singleton();\n s.state = next;\n s.listeners.forEach((l) => l());\n}\n\nfunction setMeta(patch: Partial<DevEditorMeta>): void {\n const s = singleton();\n s.meta = { ...s.meta, ...patch };\n s.metaListeners.forEach((l) => l());\n}\n\nfunction saveRequest(s: DevStoreSingleton, keepalive = false): Promise<Response> {\n return fetch(DEV_PREVIEW_ENDPOINT, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ state: s.state, from: myTabId() }),\n keepalive,\n });\n}\n\n/** Send the current state, one request at a time; edits made meanwhile go in the next one. */\nasync function flush(s: DevStoreSingleton): Promise<void> {\n if (s.inFlight || !s.dirty) return;\n s.inFlight = true;\n s.dirty = false;\n let failed = false;\n try {\n const res = await saveRequest(s);\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n if (s.legacyPending) {\n s.legacyPending = false;\n try {\n window.localStorage.removeItem(LEGACY_STORAGE_KEY);\n } catch {\n // Storage went away; the file has the values now either way.\n }\n }\n if (!s.dirty && !s.saveTimer) setMeta({ saveStatus: 'saved' });\n } catch (error) {\n // Still unsaved: another tab's state must not replace it, and leaving the\n // page still sends it. Edits made while this request was out are sent once\n // more; the failed one alone waits for the next edit, so nothing loops.\n failed = !s.dirty;\n s.dirty = true;\n setMeta({ saveStatus: 'error' });\n console.error('[twilight-react:preview] could not save twilight.preview.json', error);\n } finally {\n s.inFlight = false;\n if (!failed && s.dirty && !s.saveTimer) void flush(s);\n }\n}\n\nfunction scheduleSave(s: DevStoreSingleton): void {\n if (typeof window === 'undefined' || typeof fetch === 'undefined') return;\n s.dirty = true;\n clearTimeout(s.saveTimer);\n setMeta({ saveStatus: 'saving' });\n s.saveTimer = setTimeout(() => {\n s.saveTimer = undefined;\n void flush(s);\n }, SAVE_DELAY_MS);\n}\n\n/** Closing or reloading the editor must not drop the last edit: send it on the way out. */\nfunction flushOnExit(s: DevStoreSingleton): void {\n if (!s.dirty) return;\n clearTimeout(s.saveTimer);\n s.saveTimer = undefined;\n s.dirty = false;\n void saveRequest(s, true).catch(() => {});\n}\n\nfunction commit(next: DevPreviewState): void {\n const s = singleton();\n emit(next);\n try {\n s.channel?.postMessage({ state: next, from: myTabId() });\n } catch {\n // A value that can't be cloned: the other copies pick it up from the save instead.\n }\n scheduleSave(s);\n}\n\nfunction newBlockId(): string {\n return `b-${randomId()}`;\n}\n\n/** Home loader spelling of a twilight.json path. */\nexport function blockPath(path: string): string {\n return path.replace(/^home\\./, '');\n}\n\nfunction updateLayout(update: (layout: DevPreviewBlock[]) => DevPreviewBlock[]): void {\n const { state } = singleton();\n commit({ ...state, layout: update(state.layout ?? []) });\n}\n\n/** A new block for a twilight.json component, filled with its defaults. */\nfunction blockFor(schema: DevSchema, path: string): DevPreviewBlock {\n const component = schema.components.find((c) => c.path === path);\n const defaults = schema.blockDefaults?.[path] ?? schema.componentDefaults[path] ?? {};\n return {\n id: newBlockId(),\n path: blockPath(path),\n fields: { ...(component?.key ? { key: component.key } : {}), ...defaults },\n };\n}\n\nexport const devSettingsStore = {\n get: (): DevPreviewState => singleton().state,\n /** What the server rendered: the saved file as of this page load. */\n getServer: (): DevPreviewState => readSeed(),\n subscribe(listener: () => void): () => void {\n const s = singleton();\n s.listeners.add(listener);\n return () => {\n s.listeners.delete(listener);\n };\n },\n /** Turn overrides on, seeding any unset setting with its twilight.json default. */\n enable(schema: DevSchema): void {\n const { state } = singleton();\n commit({\n ...state,\n enabled: true,\n settings: { ...schema.settingsDefaults, ...state.settings },\n });\n },\n disable(): void {\n commit({ ...singleton().state, enabled: false });\n },\n setSetting(id: string, value: unknown): void {\n const { state } = singleton();\n commit({ ...state, settings: { ...state.settings, [id]: value } });\n },\n /** Restore every setting to its twilight.json default (keeps enabled and the layout). */\n resetSettings(schema: DevSchema): void {\n commit({ ...singleton().state, settings: { ...schema.settingsDefaults } });\n },\n\n // ── Editor ↔ frame ───────────────────────────────────────────────────────\n\n /** The editor tells the store which window is its storefront frame. */\n connectFrame(getFrame: () => Window | null): () => void {\n const s = singleton();\n s.getFrame = getFrame;\n return () => {\n if (s.getFrame === getFrame) s.getFrame = null;\n };\n },\n /** A storefront's home page reports its blocks (`null` when it leaves); in the editor's frame they go to the editor. Not saved. */\n setLiveBlocks(blocks: LiveBlocks | null): void {\n const s = singleton();\n s.ownBlocks = blocks;\n sendToEditor({ kind: 'live-blocks', blocks });\n },\n /** Ask the frame for its home page's blocks and its store base. */\n requestLiveBlocks(): void {\n sendToFrame({ kind: 'request-live-blocks' });\n },\n /**\n * Search the dev store through the editor's frame. Rejects when there is no\n * frame, it doesn't answer in time, or the store refuses; pickers then fall\n * back to samples.\n */\n lookup(source: DevLookupSource, query: string): Promise<DevLookupItem[]> {\n const frame = singleton().getFrame?.();\n if (!frame) return Promise.reject(new Error('no storefront frame'));\n const requestId = randomId();\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n pendingLookups.delete(requestId);\n reject(new Error('the storefront did not answer'));\n }, DEV_LOOKUP_TIMEOUT_MS);\n pendingLookups.set(requestId, { resolve, reject, timer });\n sendToFrame({ kind: 'lookup', requestId, source, query });\n });\n },\n /** Scroll the editor's frame to the home block at `index`. */\n focusBlock(index: number): void {\n sendToFrame({ kind: 'focus-block', index });\n },\n getMeta: (): DevEditorMeta => singleton().meta,\n subscribeMeta(listener: () => void): () => void {\n const s = singleton();\n s.metaListeners.add(listener);\n return () => {\n s.metaListeners.delete(listener);\n };\n },\n\n // ── Home layout ──────────────────────────────────────────────────────────\n\n /**\n * Take over the home layout. Starts from the blocks the home page showed (the\n * frame's in the editor; an empty page stays empty), otherwise from every\n * twilight.json component.\n */\n customizeLayout(schema: DevSchema): void {\n const s = singleton();\n const live = s.meta.liveBlocks ?? s.ownBlocks;\n const layout: DevPreviewBlock[] =\n live !== null\n ? live\n .filter((block): block is { path: string } => typeof block.path === 'string')\n .filter((block) => block.path !== '')\n .map(({ path, ...fields }) => ({ id: newBlockId(), path: blockPath(path), fields }))\n : schema.components.map((component) => blockFor(schema, component.path));\n commit({ ...s.state, enabled: true, layout });\n },\n startEmptyLayout(): void {\n commit({ ...singleton().state, enabled: true, layout: [] });\n },\n /** Back to the store's own blocks. */\n clearLayout(): void {\n commit({ ...singleton().state, layout: null });\n },\n /** Insert a twilight.json component at `at` (default: the end); returns the new block's id. */\n addBlock(schema: DevSchema, path: string, at?: number): string {\n const block = blockFor(schema, path);\n updateLayout((layout) => {\n const next = [...layout];\n next.splice(at ?? next.length, 0, block);\n return next;\n });\n return block.id;\n },\n removeBlock(id: string): void {\n updateLayout((layout) => layout.filter((block) => block.id !== id));\n },\n duplicateBlock(id: string): void {\n updateLayout((layout) => {\n const index = layout.findIndex((block) => block.id === id);\n if (index === -1) return layout;\n const copy = { ...layout[index], id: newBlockId(), fields: { ...layout[index].fields } };\n return [...layout.slice(0, index + 1), copy, ...layout.slice(index + 1)];\n });\n },\n /** Move a block to index `to` (its position after the move). */\n moveBlock(id: string, to: number): void {\n updateLayout((layout) => {\n const from = layout.findIndex((block) => block.id === id);\n if (from === -1) return layout;\n const target = Math.max(0, Math.min(to, layout.length - 1));\n if (target === from) return layout;\n const next = [...layout];\n const [block] = next.splice(from, 1);\n next.splice(target, 0, block);\n return next;\n });\n },\n setBlockField(id: string, fieldId: string, value: unknown): void {\n updateLayout((layout) =>\n layout.map((block) =>\n block.id === id ? { ...block, fields: { ...block.fields, [fieldId]: value } } : block\n )\n );\n },\n};\n\nconst SERVER_META: DevEditorMeta = { liveBlocks: null, saveStatus: 'idle', frameBase: undefined };\n\n/** The frame's blocks and store base, and the save status, for the editor. */\nexport function useDevEditorMeta(): DevEditorMeta {\n return useSyncExternalStore(\n devSettingsStore.subscribeMeta,\n devSettingsStore.getMeta,\n () => SERVER_META\n );\n}\n\n/** Raw store subscription. */\nexport function useDevSettingsState(): DevPreviewState {\n return useSyncExternalStore(\n devSettingsStore.subscribe,\n devSettingsStore.get,\n devSettingsStore.getServer\n );\n}\n\n/**\n * Overrides for SSR-rendered consumers (the theme). The server and the first\n * browser render both read the saved file, so they agree and nothing flashes.\n *\n * Which hook this is gets decided once, when the module loads: in production\n * `import.meta.env.DEV` is a static `false`, so only the empty one survives\n * bundling and the store subscription (and the whole store module, which has\n * no other prod consumer) is dead-code-eliminated. No hook is ever called\n * conditionally.\n */\nexport const useDevSettingsOverrides: () => DevPreviewState = import.meta.env.DEV\n ? useDevSettingsState\n : () => EMPTY_PREVIEW_STATE;\n\n/** A rendered home block; `__dev_id` keys a dev-layout block across reorders. */\nexport type DevHomeBlock<T> = T & { __dev_id?: string };\n\n/**\n * Whether a list in a block's fields gained, lost or reordered items. Blocks\n * often hand their items to a web component that takes them once when it\n * starts (a slider moves its slides into its own track), so such a change\n * never reaches the page until the block mounts again. Editing an item's\n * values is not one: the nodes stay put and update in place.\n */\nexport function listsReshaped(\n before: Record<string, unknown>,\n after: Record<string, unknown>\n): boolean {\n for (const key of new Set([...Object.keys(before), ...Object.keys(after)])) {\n const a = before[key];\n const b = after[key];\n if (!Array.isArray(a) && !Array.isArray(b)) continue;\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return true;\n const aItems = a.map((item) => JSON.stringify(item));\n const bItems = b.map((item) => JSON.stringify(item));\n const moved = aItems.some((item, i) => item !== bItems[i]);\n if (moved && [...aItems].sort().join('\\n') === [...bItems].sort().join('\\n')) return true;\n }\n return false;\n}\n\n/**\n * The home page's blocks: the dev layout when one is saved and enabled, else\n * the store's own blocks untouched. Also reports the store's blocks to the\n * editor so \"Customize\" can start from what the page showed, and withdraws\n * them when the page goes.\n *\n * Same production story as {@link useDevSettingsOverrides}: chosen once at\n * module load, so production keeps only the passthrough.\n */\nfunction useDevLayoutBlocks<T extends { path?: string }>(components: T[]): DevHomeBlock<T>[] {\n const overrides = useDevSettingsState();\n // Per block: the fields last rendered, and how often its lists were reshaped.\n const seen = useRef(new Map<string, { fields: Record<string, unknown>; mounts: number }>());\n useEffect(() => {\n devSettingsStore.setLiveBlocks(components);\n return () => devSettingsStore.setLiveBlocks(null);\n }, [components]);\n return useMemo(() => {\n if (!overrides.enabled || !overrides.layout) return components;\n return overrides.layout.map((block) => {\n const last = seen.current.get(block.id);\n const mounts =\n (last?.mounts ?? 0) + (last && listsReshaped(last.fields, block.fields) ? 1 : 0);\n seen.current.set(block.id, { fields: block.fields, mounts });\n // A new key mounts the block again, so a reshaped list reaches the page.\n const devId = mounts ? `${block.id}~${mounts}` : block.id;\n return { ...block.fields, path: block.path, __dev_id: devId } as DevHomeBlock<T>;\n });\n }, [components, overrides]);\n}\n\nexport const useDevHomeBlocks: <T extends { path?: string }>(components: T[]) => DevHomeBlock<T>[] =\n import.meta.env.DEV ? useDevLayoutBlocks : (components) => components;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev/dev-settings-store.ts"],"names":["block"],"mappings":";;;;AA4CA,IAAM,kBAAA,GAAqB,uBAAA;AAE3B,IAAM,aAAA,G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CAAU,OAAA,IAAW,CAAC,SAAA,CAAU,QAAQ,OAAO,UAAA;AACpD,IAAA,OAAO,SAAA,CAAU,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,KAAU;AACrC,MAAA,MAAM,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,MAAM,EAAE,CAAA;AACtC,MAAA,MAAM,MAAA,GAAA,CACH,IAAA,EAAM,MAAA,IAAU,CAAA,KAAM,IAAA,IAAQ,aAAA,CAAc,IAAA,CAAK,MAAA,EAAQ,KAAA,CAAM,MAAM,CAAA,GAAI,CAAA,GAAI,CAAA,CAAA;AAChF,MAAA,IAAA,CAAK,OAAA,CAAQ,IAAI,KAAA,CAAM,EAAA,EAAI,EAAE,MAAA,EAAQ,KAAA,CAAM,MAAA,EAAQ,MAAA,EAAQ,CAAA;AAE3D,MAAA,MAAM,KAAA,GAAQ,SAAS,CAAA,EAAG,KAAA,CAAM,EAAE,CAAA,CAAA,EAAI,MAAM,KAAK,KAAA,CAAM,EAAA;AACvD,MAAA,OAAO,EAAE,GAAG,KAAA,CAAM,MAAA,EAAQ,MAAM,KAAA,CAAM,IAAA,EAAM,UAAU,KAAA,EAAM;AAAA,IAC9D,CAAC,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,UAAA,EAAY,SAAS,CAAC,CAAA;AAC5B;AAEO,IAAM,mBACX,MAAA,CAAA,IAAA,CAAY,GAAA,CAAI,GAAA,GAAM,kBAAA,GAAqB,CAAC,UAAA,KAAe","file":"chunk-74W2O47D.js","sourcesContent":["/**\n * Client-side store for the dev editor: theme-setting overrides and a dev-owned\n * home layout. Saved to `twilight.preview.json` through the dev server (see\n * `twilight-schema.plugin.ts`), not to localStorage, for three reasons: the\n * server render can read a file, so the page hydrates with the edited layout\n * instead of flashing the store's; the state survives a port or browser\n * change; and the developer can open, diff or delete it.\n *\n * The saved state reaches this module through `virtual:twilight/schema`, which\n * the root route imports on both sides before anything renders and which puts\n * it on `globalThis[DEV_PREVIEW_GLOBAL]`. Server snapshots read that value\n * (the server's modules are re-run after each save); the browser copies it once\n * and then owns the state.\n *\n * The theme editor (`/__twilight/editor`) frames the storefront, so two copies\n * of this store run side by side. Edits reach every copy on the origin at once\n * over a `BroadcastChannel` (the file save is debounced), and only the copy\n * that made an edit saves it. Everything else between an editor and its frame\n * (the home page's blocks, the store base, scroll-to-block) goes by\n * `postMessage` to that one window, so another storefront tab never answers.\n */\n\nimport { useEffect, useMemo, useRef, useSyncExternalStore } from 'react';\nimport {\n DEV_LOOKUP_TIMEOUT_MS,\n DEV_PREVIEW_ENDPOINT,\n DEV_PREVIEW_EVENT,\n DEV_PREVIEW_GLOBAL,\n EMPTY_PREVIEW_STATE,\n isEditorFrame,\n normalizePreviewState,\n type DevLookupItem,\n type DevLookupSource,\n type DevPreviewBlock,\n type DevPreviewState,\n type DevSchema,\n} from './schema-types';\nimport { resolveStoreBase } from '../utils/store-identity';\n\nexport type DevSettingsState = DevPreviewState;\nexport type DevSaveStatus = 'idle' | 'saving' | 'saved' | 'error';\ntype LiveBlocks = { path?: string }[];\n\n/** Where the old localStorage-backed widget kept its state; migrated once. */\nconst LEGACY_STORAGE_KEY = 'twilight:dev-settings';\n/** Batch keystrokes into one write. */\nconst SAVE_DELAY_MS = 250;\n/** Same-browser channel every copy of the store listens on, for edits. */\nconst CHANNEL_NAME = 'twilight:preview';\n/** Envelope type of the editor ↔ frame `postMessage`s. */\nconst FRAME_MESSAGE = 'twilight:editor';\n/** How long the frame keeps looking for a block that is still rendering (just added, say). */\nconst FOCUS_WAIT_MS = 2000;\nconst FOCUS_FLASH_MS = 1200;\n\n/** Editor ↔ the storefront it frames. */\ntype FrameMessage =\n | { kind: 'live-blocks'; blocks: LiveBlocks | null }\n | { kind: 'frame-info'; base: string | null }\n | { kind: 'request-live-blocks' }\n | { kind: 'focus-block'; index: number }\n | { kind: 'lookup'; requestId: string; source: DevLookupSource; query: string }\n | { kind: 'lookup-result'; requestId: string; items?: DevLookupItem[]; error?: string };\n\ninterface PendingLookup {\n resolve: (items: DevLookupItem[]) => void;\n reject: (error: Error) => void;\n timer: ReturnType<typeof setTimeout>;\n}\nconst pendingLookups = new Map<string, PendingLookup>();\n\n/** What the editor shows besides the saved state. */\nexport interface DevEditorMeta {\n /** The blocks the framed home page shows; `null` when it is not on the home page. */\n liveBlocks: LiveBlocks | null;\n saveStatus: DevSaveStatus;\n /** The frame's store segment; `undefined` until the frame has said. */\n frameBase: string | null | undefined;\n}\n\n/**\n * A short random hex id. `getRandomValues`, not `randomUUID`: the latter only\n * exists in secure contexts, and the dev server may be opened on a LAN address.\n */\nfunction randomId(bytes = 6): string {\n const values = globalThis.crypto.getRandomValues(new Uint8Array(bytes));\n return Array.from(values, (b) => b.toString(16).padStart(2, '0')).join('');\n}\n\nlet tabId: string | undefined;\n\n/**\n * Sent with every save so this tab can ignore its own broadcast. Made on first\n * use, never at module load: Cloudflare Workers refuse random values in global\n * scope, and this module is in the worker bundle (its use is dev-only, its\n * top level is not).\n */\nfunction myTabId(): string {\n tabId ??= randomId();\n return tabId;\n}\n\nlet seedSource: unknown;\nlet seedState: DevPreviewState = EMPTY_PREVIEW_STATE;\n\n/** The saved file as this page loaded it, normalized once per value so snapshots keep their identity. */\nfunction readSeed(): DevPreviewState {\n const raw = (globalThis as Record<string, unknown>)[DEV_PREVIEW_GLOBAL];\n if (raw !== seedSource) {\n seedSource = raw;\n seedState = normalizePreviewState(raw) ?? EMPTY_PREVIEW_STATE;\n }\n return seedState;\n}\n\n// The widget (bundled into the `/dev` entry) and the theme merge (bundled into\n// the engine index via `useTwilightInit`) import this module from two different\n// chunks, so each would otherwise get its OWN copy of the state — the widget\n// would enable a store the merge never reads. Back the state with a single\n// globalThis-keyed instance so every copy shares one source of truth. Dev-only,\n// so a global is acceptable (and lazy, so the module stays side-effect free and\n// tree-shakes out of production).\ninterface DevStoreSingleton {\n state: DevPreviewState;\n listeners: Set<() => void>;\n /** This page's own home blocks, when it is a storefront on its home page. Never saved. */\n ownBlocks: LiveBlocks | null;\n meta: DevEditorMeta;\n metaListeners: Set<() => void>;\n saveTimer: ReturnType<typeof setTimeout> | undefined;\n /** An edit that has not been sent yet. */\n dirty: boolean;\n /** A save request on its way; the next one waits for it, so saves land in order. */\n inFlight: boolean;\n /** The old localStorage copy is removed only once the file has the migrated values. */\n legacyPending: boolean;\n channel: BroadcastChannel | null;\n /** In the editor: the storefront frame's window. */\n getFrame: (() => Window | null) | null;\n /** Detach this copy's listeners and channel. A page keeps one copy for good; tests swap them. */\n dispose: () => void;\n}\n\nconst SINGLETON_KEY = '__twilightDevSettingsStore__';\n\nfunction singleton(): DevStoreSingleton {\n const g = globalThis as unknown as Record<string, DevStoreSingleton | undefined>;\n let s = g[SINGLETON_KEY];\n if (!s) {\n const seeded = (globalThis as Record<string, unknown>)[DEV_PREVIEW_GLOBAL] != null;\n s = {\n state: readSeed(),\n listeners: new Set(),\n ownBlocks: null,\n meta: { liveBlocks: null, saveStatus: 'idle', frameBase: undefined },\n metaListeners: new Set(),\n saveTimer: undefined,\n dirty: false,\n inFlight: false,\n legacyPending: false,\n channel: null,\n getFrame: null,\n dispose: () => {},\n };\n g[SINGLETON_KEY] = s;\n if (typeof window !== 'undefined') setUpBrowser(s, seeded);\n }\n return s;\n}\n\nfunction setUpBrowser(s: DevStoreSingleton, seeded: boolean): void {\n const listeners = new AbortController();\n const { signal } = listeners;\n if (!seeded) migrateLegacy(s);\n listenForOtherTabs();\n s.channel = openChannel();\n listenForFrameMessages(s, signal);\n window.addEventListener('pagehide', () => flushOnExit(s), { signal });\n s.dispose = () => {\n listeners.abort();\n s.channel?.close();\n clearTimeout(s.saveTimer);\n };\n if (isEditorFrame()) sendToEditor({ kind: 'frame-info', base: resolveStoreBase() });\n}\n\n/** Carry the old widget's settings over; its per-block patches don't map to a layout. */\nfunction migrateLegacy(s: DevStoreSingleton): void {\n try {\n const raw = window.localStorage.getItem(LEGACY_STORAGE_KEY);\n if (!raw) return;\n const legacy = normalizePreviewState(JSON.parse(raw));\n if (!legacy) return;\n s.state = { enabled: legacy.enabled, settings: legacy.settings, layout: null };\n s.legacyPending = true;\n scheduleSave(s);\n } catch {\n // Storage blocked or the old value is corrupt: nothing worth keeping.\n }\n}\n\n/** Vite's HMR client, typed locally: the engine's `ImportMeta` must not clash with `vite/client`. */\ninterface HotContext {\n on(event: string, cb: (payload: { state?: unknown; from?: unknown }) => void): void;\n}\n\n/**\n * Take a state another copy committed. Not while this copy has an edit of its\n * own waiting to be saved: that edit is newer, and saving it will tell the rest.\n */\nfunction receive(raw: unknown): void {\n const s = singleton();\n if (s.dirty || s.inFlight || s.saveTimer) return;\n const next = normalizePreviewState(raw);\n if (next && JSON.stringify(next) !== JSON.stringify(s.state)) emit(next);\n}\n\n/** Tabs in another browser hear about a save from the dev server. */\nfunction listenForOtherTabs(): void {\n const hot = (import.meta as ImportMeta & { hot?: HotContext }).hot;\n if (!hot) return;\n hot.on(DEV_PREVIEW_EVENT, (payload) => {\n if (payload?.from !== myTabId()) receive(payload?.state);\n });\n}\n\nfunction openChannel(): BroadcastChannel | null {\n if (typeof BroadcastChannel === 'undefined') return null;\n const channel = new BroadcastChannel(CHANNEL_NAME);\n channel.onmessage = ({ data }: MessageEvent<{ state?: unknown; from?: string }>) => {\n if (data && data.from !== myTabId()) receive(data.state);\n };\n return channel;\n}\n\nfunction sendToEditor(message: FrameMessage): void {\n if (isEditorFrame())\n window.parent.postMessage({ type: FRAME_MESSAGE, message }, window.location.origin);\n}\n\nfunction sendToFrame(message: FrameMessage): void {\n singleton().getFrame?.()?.postMessage({ type: FRAME_MESSAGE, message }, window.location.origin);\n}\n\nfunction reportToEditor(s: DevStoreSingleton): void {\n sendToEditor({ kind: 'frame-info', base: resolveStoreBase() });\n sendToEditor({ kind: 'live-blocks', blocks: s.ownBlocks });\n}\n\n/**\n * The editor ↔ frame conversation. A frame only takes requests from its own\n * parent; an editor only takes reports from the frame it shows.\n */\nfunction listenForFrameMessages(s: DevStoreSingleton, signal: AbortSignal): void {\n window.addEventListener(\n 'message',\n (event: MessageEvent) => {\n if (event.origin !== window.location.origin || event.data?.type !== FRAME_MESSAGE) return;\n const message = event.data.message as FrameMessage;\n if (window.parent !== window && event.source === window.parent) {\n if (message.kind === 'request-live-blocks') reportToEditor(s);\n else if (message.kind === 'focus-block') scrollToBlock(message.index);\n else if (message.kind === 'lookup') void answerLookup(message);\n return;\n }\n const frame = s.getFrame?.();\n if (!frame || event.source !== frame) return;\n if (message.kind === 'lookup-result') settleLookup(message);\n else if (message.kind === 'live-blocks') setMeta({ liveBlocks: message.blocks });\n else if (message.kind === 'frame-info') setMeta({ frameBase: message.base });\n },\n { signal }\n );\n}\n\n/** In the frame: look the request up in the store and send back what was found, or why not. */\nasync function answerLookup(message: Extract<FrameMessage, { kind: 'lookup' }>): Promise<void> {\n const { requestId, source, query } = message;\n try {\n const { lookupInStore } = await import('./store-lookup');\n sendToEditor({ kind: 'lookup-result', requestId, items: await lookupInStore(source, query) });\n } catch (error) {\n sendToEditor({\n kind: 'lookup-result',\n requestId,\n error: error instanceof Error ? error.message : 'lookup failed',\n });\n }\n}\n\nfunction settleLookup(message: Extract<FrameMessage, { kind: 'lookup-result' }>): void {\n const pending = pendingLookups.get(message.requestId);\n if (!pending) return;\n pendingLookups.delete(message.requestId);\n clearTimeout(pending.timer);\n if (message.items) pending.resolve(message.items);\n else pending.reject(new Error(message.error ?? 'lookup failed'));\n}\n\n/**\n * In the editor's frame: bring a home block into view and flash an outline on\n * it. Dev-only editor chrome, so it styles the element directly rather than\n * through the theme's React tree. A block added a moment ago may not be in the\n * DOM yet, so look for it for a little while.\n */\nfunction scrollToBlock(index: number): void {\n const started = Date.now();\n const find = () => {\n const el = document.querySelector<HTMLElement>(`[data-home-block=\"${index}\"]`);\n if (!el) {\n if (Date.now() - started < FOCUS_WAIT_MS) requestAnimationFrame(find);\n return;\n }\n const { outline, outlineOffset, scrollMarginTop } = el.style;\n // Clear a sticky header, which would otherwise cover the block's top.\n el.style.scrollMarginTop = '80px';\n el.scrollIntoView({ behavior: 'smooth', block: 'start' });\n el.style.outline = '2px solid #0d9488';\n el.style.outlineOffset = '-2px';\n setTimeout(() => {\n el.style.outline = outline;\n el.style.outlineOffset = outlineOffset;\n el.style.scrollMarginTop = scrollMarginTop;\n }, FOCUS_FLASH_MS);\n };\n find();\n}\n\nfunction emit(next: DevPreviewState): void {\n const s = singleton();\n s.state = next;\n s.listeners.forEach((l) => l());\n}\n\nfunction setMeta(patch: Partial<DevEditorMeta>): void {\n const s = singleton();\n s.meta = { ...s.meta, ...patch };\n s.metaListeners.forEach((l) => l());\n}\n\nfunction saveRequest(s: DevStoreSingleton, keepalive = false): Promise<Response> {\n return fetch(DEV_PREVIEW_ENDPOINT, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ state: s.state, from: myTabId() }),\n keepalive,\n });\n}\n\n/** Send the current state, one request at a time; edits made meanwhile go in the next one. */\nasync function flush(s: DevStoreSingleton): Promise<void> {\n if (s.inFlight || !s.dirty) return;\n s.inFlight = true;\n s.dirty = false;\n let failed = false;\n try {\n const res = await saveRequest(s);\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n if (s.legacyPending) {\n s.legacyPending = false;\n try {\n window.localStorage.removeItem(LEGACY_STORAGE_KEY);\n } catch {\n // Storage went away; the file has the values now either way.\n }\n }\n if (!s.dirty && !s.saveTimer) setMeta({ saveStatus: 'saved' });\n } catch (error) {\n // Still unsaved: another tab's state must not replace it, and leaving the\n // page still sends it. Edits made while this request was out are sent once\n // more; the failed one alone waits for the next edit, so nothing loops.\n failed = !s.dirty;\n s.dirty = true;\n setMeta({ saveStatus: 'error' });\n console.error('[twilight-react:preview] could not save twilight.preview.json', error);\n } finally {\n s.inFlight = false;\n if (!failed && s.dirty && !s.saveTimer) void flush(s);\n }\n}\n\nfunction scheduleSave(s: DevStoreSingleton): void {\n if (typeof window === 'undefined' || typeof fetch === 'undefined') return;\n s.dirty = true;\n clearTimeout(s.saveTimer);\n setMeta({ saveStatus: 'saving' });\n s.saveTimer = setTimeout(() => {\n s.saveTimer = undefined;\n void flush(s);\n }, SAVE_DELAY_MS);\n}\n\n/** Closing or reloading the editor must not drop the last edit: send it on the way out. */\nfunction flushOnExit(s: DevStoreSingleton): void {\n if (!s.dirty) return;\n clearTimeout(s.saveTimer);\n s.saveTimer = undefined;\n s.dirty = false;\n void saveRequest(s, true).catch(() => {});\n}\n\nfunction commit(next: DevPreviewState): void {\n const s = singleton();\n emit(next);\n try {\n s.channel?.postMessage({ state: next, from: myTabId() });\n } catch {\n // A value that can't be cloned: the other copies pick it up from the save instead.\n }\n scheduleSave(s);\n}\n\nfunction newBlockId(): string {\n return `b-${randomId()}`;\n}\n\n/** Home loader spelling of a twilight.json path. */\nexport function blockPath(path: string): string {\n return path.replace(/^home\\./, '');\n}\n\nfunction updateLayout(update: (layout: DevPreviewBlock[]) => DevPreviewBlock[]): void {\n const { state } = singleton();\n commit({ ...state, layout: update(state.layout ?? []) });\n}\n\n/** A new block for a twilight.json component, filled with its defaults. */\nfunction blockFor(schema: DevSchema, path: string): DevPreviewBlock {\n const component = schema.components.find((c) => c.path === path);\n const defaults = schema.blockDefaults?.[path] ?? schema.componentDefaults[path] ?? {};\n return {\n id: newBlockId(),\n path: blockPath(path),\n fields: { ...(component?.key ? { key: component.key } : {}), ...defaults },\n };\n}\n\nexport const devSettingsStore = {\n get: (): DevPreviewState => singleton().state,\n /** What the server rendered: the saved file as of this page load. */\n getServer: (): DevPreviewState => readSeed(),\n subscribe(listener: () => void): () => void {\n const s = singleton();\n s.listeners.add(listener);\n return () => {\n s.listeners.delete(listener);\n };\n },\n /** Turn overrides on, seeding any unset setting with its twilight.json default. */\n enable(schema: DevSchema): void {\n const { state } = singleton();\n commit({\n ...state,\n enabled: true,\n settings: { ...schema.settingsDefaults, ...state.settings },\n });\n },\n disable(): void {\n commit({ ...singleton().state, enabled: false });\n },\n setSetting(id: string, value: unknown): void {\n const { state } = singleton();\n commit({ ...state, settings: { ...state.settings, [id]: value } });\n },\n /** Restore every setting to its twilight.json default (keeps enabled and the layout). */\n resetSettings(schema: DevSchema): void {\n commit({ ...singleton().state, settings: { ...schema.settingsDefaults } });\n },\n\n // ── Editor ↔ frame ───────────────────────────────────────────────────────\n\n /** The editor tells the store which window is its storefront frame. */\n connectFrame(getFrame: () => Window | null): () => void {\n const s = singleton();\n s.getFrame = getFrame;\n return () => {\n if (s.getFrame === getFrame) s.getFrame = null;\n };\n },\n /** A storefront's home page reports its blocks (`null` when it leaves); in the editor's frame they go to the editor. Not saved. */\n setLiveBlocks(blocks: LiveBlocks | null): void {\n const s = singleton();\n s.ownBlocks = blocks;\n sendToEditor({ kind: 'live-blocks', blocks });\n },\n /** Ask the frame for its home page's blocks and its store base. */\n requestLiveBlocks(): void {\n sendToFrame({ kind: 'request-live-blocks' });\n },\n /**\n * Search the dev store through the editor's frame. Rejects when there is no\n * frame, it doesn't answer in time, or the store refuses; pickers then fall\n * back to samples.\n */\n lookup(source: DevLookupSource, query: string): Promise<DevLookupItem[]> {\n const frame = singleton().getFrame?.();\n if (!frame) return Promise.reject(new Error('no storefront frame'));\n const requestId = randomId();\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n pendingLookups.delete(requestId);\n reject(new Error('the storefront did not answer'));\n }, DEV_LOOKUP_TIMEOUT_MS);\n pendingLookups.set(requestId, { resolve, reject, timer });\n sendToFrame({ kind: 'lookup', requestId, source, query });\n });\n },\n /** Scroll the editor's frame to the home block at `index`. */\n focusBlock(index: number): void {\n sendToFrame({ kind: 'focus-block', index });\n },\n getMeta: (): DevEditorMeta => singleton().meta,\n subscribeMeta(listener: () => void): () => void {\n const s = singleton();\n s.metaListeners.add(listener);\n return () => {\n s.metaListeners.delete(listener);\n };\n },\n\n // ── Home layout ──────────────────────────────────────────────────────────\n\n /**\n * Take over the home layout. Starts from the blocks the home page showed (the\n * frame's in the editor; an empty page stays empty), otherwise from every\n * twilight.json component.\n */\n customizeLayout(schema: DevSchema): void {\n const s = singleton();\n const live = s.meta.liveBlocks ?? s.ownBlocks;\n const layout: DevPreviewBlock[] =\n live !== null\n ? live\n .filter((block): block is { path: string } => typeof block.path === 'string')\n .filter((block) => block.path !== '')\n .map(({ path, ...fields }) => ({ id: newBlockId(), path: blockPath(path), fields }))\n : schema.components.map((component) => blockFor(schema, component.path));\n commit({ ...s.state, enabled: true, layout });\n },\n startEmptyLayout(): void {\n commit({ ...singleton().state, enabled: true, layout: [] });\n },\n /** Back to the store's own blocks. */\n clearLayout(): void {\n commit({ ...singleton().state, layout: null });\n },\n /** Insert a twilight.json component at `at` (default: the end); returns the new block's id. */\n addBlock(schema: DevSchema, path: string, at?: number): string {\n const block = blockFor(schema, path);\n updateLayout((layout) => {\n const next = [...layout];\n next.splice(at ?? next.length, 0, block);\n return next;\n });\n return block.id;\n },\n removeBlock(id: string): void {\n updateLayout((layout) => layout.filter((block) => block.id !== id));\n },\n duplicateBlock(id: string): void {\n updateLayout((layout) => {\n const index = layout.findIndex((block) => block.id === id);\n if (index === -1) return layout;\n const copy = { ...layout[index], id: newBlockId(), fields: { ...layout[index].fields } };\n return [...layout.slice(0, index + 1), copy, ...layout.slice(index + 1)];\n });\n },\n /** Move a block to index `to` (its position after the move). */\n moveBlock(id: string, to: number): void {\n updateLayout((layout) => {\n const from = layout.findIndex((block) => block.id === id);\n if (from === -1) return layout;\n const target = Math.max(0, Math.min(to, layout.length - 1));\n if (target === from) return layout;\n const next = [...layout];\n const [block] = next.splice(from, 1);\n next.splice(target, 0, block);\n return next;\n });\n },\n setBlockField(id: string, fieldId: string, value: unknown): void {\n updateLayout((layout) =>\n layout.map((block) =>\n block.id === id ? { ...block, fields: { ...block.fields, [fieldId]: value } } : block\n )\n );\n },\n};\n\nconst SERVER_META: DevEditorMeta = { liveBlocks: null, saveStatus: 'idle', frameBase: undefined };\n\n/** The frame's blocks and store base, and the save status, for the editor. */\nexport function useDevEditorMeta(): DevEditorMeta {\n return useSyncExternalStore(\n devSettingsStore.subscribeMeta,\n devSettingsStore.getMeta,\n () => SERVER_META\n );\n}\n\n/** Raw store subscription. */\nexport function useDevSettingsState(): DevPreviewState {\n return useSyncExternalStore(\n devSettingsStore.subscribe,\n devSettingsStore.get,\n devSettingsStore.getServer\n );\n}\n\n/**\n * Overrides for SSR-rendered consumers (the theme). The server and the first\n * browser render both read the saved file, so they agree and nothing flashes.\n *\n * Which hook this is gets decided once, when the module loads: in production\n * `import.meta.env.DEV` is a static `false`, so only the empty one survives\n * bundling and the store subscription (and the whole store module, which has\n * no other prod consumer) is dead-code-eliminated. No hook is ever called\n * conditionally.\n */\nexport const useDevSettingsOverrides: () => DevPreviewState = import.meta.env.DEV\n ? useDevSettingsState\n : () => EMPTY_PREVIEW_STATE;\n\n/** A rendered home block; `__dev_id` keys a dev-layout block across reorders. */\nexport type DevHomeBlock<T> = T & { __dev_id?: string };\n\n/**\n * Whether a list in a block's fields gained, lost or reordered items. Blocks\n * often hand their items to a web component that takes them once when it\n * starts (a slider moves its slides into its own track), so such a change\n * never reaches the page until the block mounts again. Editing an item's\n * values is not one: the nodes stay put and update in place.\n */\nexport function listsReshaped(\n before: Record<string, unknown>,\n after: Record<string, unknown>\n): boolean {\n for (const key of new Set([...Object.keys(before), ...Object.keys(after)])) {\n const a = before[key];\n const b = after[key];\n if (!Array.isArray(a) && !Array.isArray(b)) continue;\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return true;\n const aItems = a.map((item) => JSON.stringify(item));\n const bItems = b.map((item) => JSON.stringify(item));\n const moved = aItems.some((item, i) => item !== bItems[i]);\n if (moved && [...aItems].sort().join('\\n') === [...bItems].sort().join('\\n')) return true;\n }\n return false;\n}\n\n/**\n * The home page's blocks: the dev layout when one is saved and enabled, else\n * the store's own blocks untouched. Also reports the store's blocks to the\n * editor so \"Customize\" can start from what the page showed, and withdraws\n * them when the page goes.\n *\n * Same production story as {@link useDevSettingsOverrides}: chosen once at\n * module load, so production keeps only the passthrough.\n */\nfunction useDevLayoutBlocks<T extends { path?: string }>(components: T[]): DevHomeBlock<T>[] {\n const overrides = useDevSettingsState();\n // Per block: the fields last rendered, and how often its lists were reshaped.\n const seen = useRef(new Map<string, { fields: Record<string, unknown>; mounts: number }>());\n useEffect(() => {\n devSettingsStore.setLiveBlocks(components);\n return () => devSettingsStore.setLiveBlocks(null);\n }, [components]);\n return useMemo(() => {\n if (!overrides.enabled || !overrides.layout) return components;\n return overrides.layout.map((block) => {\n const last = seen.current.get(block.id);\n const mounts =\n (last?.mounts ?? 0) + (last && listsReshaped(last.fields, block.fields) ? 1 : 0);\n seen.current.set(block.id, { fields: block.fields, mounts });\n // A new key mounts the block again, so a reshaped list reaches the page.\n const devId = mounts ? `${block.id}~${mounts}` : block.id;\n return { ...block.fields, path: block.path, __dev_id: devId } as DevHomeBlock<T>;\n });\n }, [components, overrides]);\n}\n\nexport const useDevHomeBlocks: <T extends { path?: string }>(components: T[]) => DevHomeBlock<T>[] =\n import.meta.env.DEV ? useDevLayoutBlocks : (components) => components;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { orThrow } from './chunk-
|
|
2
|
-
import { getActiveScope, api } from './chunk-
|
|
1
|
+
import { orThrow } from './chunk-KXD4WUYA.js';
|
|
2
|
+
import { getActiveScope, api } from './chunk-M46EKE7R.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var category = {
|
|
@@ -26,5 +26,5 @@ var category = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export { category };
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-75TXHISE.js.map
|
|
30
|
+
//# sourceMappingURL=chunk-75TXHISE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/category.ts"],"names":[],"mappings":";;;;AAKO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,E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CAAK,EAAE,CAAC,CAAA;AAAA,EAEzE,MAAM,YAAiC;AACrC,IAAA,MAAM,EAAE,MAAK,GAAI,MAAM,IAAI,GAAA,CAAI,YAAY,EAAE,IAAA,EAA2B;AACxE,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,EAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,YAAA,EAAc,QAAA,EAAU,EAAE,CAAA;AAAA,MACrC,OAAA,EAAS,MAAM,QAAA,CAAS,IAAA,CAAK,EAAE;AAAA,KAChC,CAAA;AAAA,IAEH,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,YAAA,EAAc,MAAA,EAAQ,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,QAAA,CAAS,IAAA;AAAK,KAC9B;AAAA;AAEP","file":"chunk-75TXHISE.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { Category } from '../types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const category = {\n find: async (id: string): Promise<Category> => {\n const { data } = await api.get(`categories/${id}`).json<{ data: Category }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Category> => orThrow(category.find(id)),\n\n list: async (): Promise<Category[]> => {\n const { data } = await api.get('categories').json<{ data: Category[] }>();\n return data ?? [];\n },\n\n queries: {\n detail: (id: string) =>\n queryOptions({\n queryKey: ['categories', 'detail', id],\n queryFn: () => category.find(id),\n }),\n\n list: () =>\n queryOptions({\n // Scope (branch) varies the API response — key must include it.\n queryKey: ['categories', 'list', { scope: getActiveScope() }],\n queryFn: () => category.list(),\n }),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSallaSDK, whenSallaReady } from './chunk-
|
|
1
|
+
import { getSallaSDK, whenSallaReady } from './chunk-3GDJMMMS.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-7AIDISU2.js.map
|
|
58
|
+
//# sourceMappingURL=chunk-7AIDISU2.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;AACpF;AASO,SAAS,mBAAA,GAAqC;AACnD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAwB,IAAI,CAAA;AAE1D,EAAA,SAAA,CAAU,MAAM,eAAe,MAAM,UAAA,CAAW,kBAAkB,CAAC,CAAA,EAAG,EA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A;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-7AIDISU2.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,6 +1,6 @@
|
|
|
1
|
-
import { getActiveCurrency } from './chunk-
|
|
2
|
-
import { whenSallaLoaded } from './chunk-
|
|
3
|
-
import { getTwilightContext } from './chunk-
|
|
1
|
+
import { getActiveCurrency } from './chunk-M46EKE7R.js';
|
|
2
|
+
import { whenSallaLoaded } from './chunk-3GDJMMMS.js';
|
|
3
|
+
import { getTwilightContext } from './chunk-7VNVCHID.js';
|
|
4
4
|
|
|
5
5
|
// src/utils/sdk-events.ts
|
|
6
6
|
function dispatchRouteChanged() {
|
|
@@ -36,5 +36,5 @@ function dispatchProductViewed(product) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export { dispatchProductViewed, dispatchRouteChanged };
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-7EZZR4WA.js.map
|
|
40
|
+
//# sourceMappingURL=chunk-7EZZR4WA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/sdk-events.ts"],"names":[],"mappings":";;;;;AA6BO,SAAS,oBAAA,GAA6B;AAC3C,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAEnC,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AACrB,EAAA,IAAI,CAAC,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU;AAE7B,EAAA,MAAM,MAAM,kBAAA,EAAmB;AAC/B,EAAA,KAAA,CAAM,MAAM,QAAA,CAAS,gBAAA,EAAkB,GAAA,CAAI,IAAA,IAAQ,EAAE,CAAA;AACvD;AAMO,SAAS,sBAAsB,OAAA,EAAwB;AAC5D,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,IAAK,CAAA;AACvC,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,EAAO,GAAA,IAAO,EAAA;AACpC,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,IAAI,OAAA,CAAQ,EAAA;AAAA,IACZ,MAAM,OAAA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AC5D,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,IAAK,CAAA;AACvC,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,EAAO,GAAA,IAAO,EAAA;AACpC,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,IAAI,OAAA,CAAQ,EAAA;AAAA,IACZ,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,UAAA,EAAY,OAAA,CAAQ,QAAA,GAAW,CAAC,EAAE,EAAA,EAAI,OAAA,CAAQ,QAAA,CAAS,EAAA,EAAI,MAAM,OAAA,CAAQ,QAAA,CAAS,IAAA,EAAM,IAAI,EAAC;AAAA,IAC7F,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAU,IAAA,IAAQ,EAAA;AAAA,IACpC,KAAA;AAAA,IACA,QAAA,EAAU,CAAA;AAAA,IACV,OAAA,EAAS,EAAA;AAAA,IACT,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAO,IAAA,IAAQ,EAAA;AAAA,IAC9B,KAAA;AAAA,IACA,QAAA,EAAU,iBAAA,CAAkB,OAAA,CAAQ,QAAQ,CAAA;AAAA,IAC5C,GAAA,EAAK,QAAQ,GAAA,IAAO,EAAA;AAAA,IACpB,KAAA,EAAO,KAAA;AAAA,IACP,KAAK,OAAA,CAAQ,GAAA;AAAA,IACb,SAAA,EAAW;AAAA,GACb;AAEA,EAAA,eAAA;AAAA,IACE,CAAC,GAAA,KAAQ,KAAK,GAAA,CAAI,SAAQ,CAAE,IAAA,CAAK,MAAM,GAAA,CAAI,MAAM,QAAA,CAAS,gBAAA,EAAkB,CAAC,OAAO,CAAC,CAAC;AAAA,GACxF;AACF","file":"chunk-7EZZR4WA.js","sourcesContent":["import { getTwilightContext } from '../twilight/context';\nimport type { PageContext } from '../twilight/context';\nimport type { Product } from '../types';\nimport { getActiveCurrency } from '../api/client';\nimport { whenSallaLoaded } from './sdk-helpers';\n\n/**\n * Payload dispatched via `salla.event.dispatch('route::changed', payload)`\n * after each client-side navigation completes.\n *\n * The page config fields are spread at root level. When the matched route\n * has no page data (e.g., 404, error boundary), an empty object is dispatched.\n *\n * @example\n * ```ts\n * salla.event.on('route::changed', (page: RouteChangedEvent) => {\n * console.log(page.slug, page.title, page.id);\n * });\n * ```\n */\nexport type RouteChangedEvent = PageContext;\n\n/**\n * Dispatch the `route::changed` Salla SDK event with the current page config.\n *\n * Framework-agnostic — reads from the twilight context store which is\n * populated by whichever framework adapter is active (TanStack, Next.js, etc.).\n * Each adapter should call this after navigation resolves.\n */\nexport function dispatchRouteChanged(): void {\n if (typeof window === 'undefined') return;\n\n const salla = window.salla;\n if (!salla?.event?.dispatch) return;\n\n const ctx = getTwilightContext();\n salla.event.dispatch('route::changed', ctx.page ?? {});\n}\n\n/**\n * Dispatch `Product Viewed`, which Twig's product page hands the SDK through `salla.init`'s\n * `events`: store analytics, pixels and apps that remember viewed products listen for it.\n */\nexport function dispatchProductViewed(product: Product): void {\n if (typeof window === 'undefined') return;\n const price = Number(product.price) || 0;\n const image = product.image?.url ?? '';\n const payload = {\n id: product.id,\n name: product.name,\n categories: product.category ? [{ id: product.category.id, name: product.category.name }] : [],\n category: product.category?.name ?? '',\n price,\n quantity: 1,\n variant: '',\n brand: product.brand?.name ?? '',\n image,\n currency: getActiveCurrency(product.currency),\n sku: product.sku ?? '',\n value: price,\n url: product.url,\n image_url: image,\n };\n // After init: analytics drops events until `salla.init` has merged the store's `jitsu` list.\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.event.dispatch('Product Viewed', [payload]))\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { advertisement, advertisementsFor } from './chunk-
|
|
1
|
+
import { advertisement, advertisementsFor } from './chunk-WBXIDILF.js';
|
|
2
2
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
3
|
-
import { whenSallaReady } from './chunk-
|
|
4
|
-
import { subscribeTwilight, getTwilightContext } from './chunk-
|
|
3
|
+
import { whenSallaReady } from './chunk-3GDJMMMS.js';
|
|
4
|
+
import { subscribeTwilight, getTwilightContext } from './chunk-7VNVCHID.js';
|
|
5
5
|
import { useSyncExternalStore, useState, useEffect } from 'react';
|
|
6
6
|
import { useQuery } from '@tanstack/react-query';
|
|
7
7
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -99,5 +99,5 @@ function PageAdvertisements() {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export { PageAdvertisements };
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-7QHK77KL.js.map
|
|
103
|
+
//# sourceMappingURL=chunk-7QHK77KL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/layout/PageAdvertisements.tsx"],"names":[],"mappings":";;;;;;;;AAOA,IAAM,eAAA,GAAkB,MAAM,kBAAA,EAAmB,CAAE,IAAA,EAAM,IAAA;AAGzD,IAAM,YAAA,GAAe,CAAC,EAAA,KAAe,CAAA,SAAA,EAAY,EAAE,CAAA,CAAA;AAGnD,IAAM,SAA0B,EAAC;AAGjC,IAAM,qBAAA,GACJ,uPAAA;AAEF,SAAS,YAAY,EAAA,EAAqB;AACxC,EAAA,IAAI;AACF,IAAA,OAAO,QAAQ,MAAA,CAAO,YAAA,CAAa,QAAQ,YAAA,CAAa,EAAE,CAAC,CAAC,CAAA;AAAA,EAC9D,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAEA,SAAS,QAAQ,EAAA,EAAkB;AACjC,EAAA,MAAM,OAAA,GAAU,OAAO,KAAA,EAAO,OAAA;AAC9B,EAAA,IAAI,OAAO,SAAS,GAAA,KAAQ,UAAA,UAAoB,GAAA,CAAI,YAAA,CAAa,EAAE,CAAA,EAAG,WAAW,CAAA;AAAA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,cACV,YAAA,EAAY,CAAA,CAAE,sBAAA,EAAwB,OAAO,CAAA;AAAA,cAC7C,OAAA,EAAS,MAAM,KAAA,CAAM,EAAA,CAAG,EAAE,CAAA;AAAA,cAG1B,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,2BAAA,EAA4B;AAAA;AAAA;AAC3C,SAAA,EACF;AAAA,OAAA;AAAA,MAhCK,EAAA,CAAG;AAAA,KAkCX,CAAA;AAAA,oBACD,GAAA,CAAC,QAAA,EAAA,EAAO,wBAAA,EAAwB,IAAA,EAAE,QAAA,EAAA,qBAAA,EAAsB;AAAA,GAAA,EAC1D,CAAA;AAEJ","file":"chunk-7QHK77KL.js","sourcesContent":["import { useEffect, useState, useSyncExternalStore } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { advertisement, advertisementsFor, type Advertisement } from '../../api/advertisement';\nimport { whenSallaReady } from '../../utils/sdk-helpers';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { getTwilightContext, subscribeTwilight } from '../../twilight/context';\n\nconst currentPageSlug = () => getTwilightContext().page?.slug;\n\n/** The key `<salla-advertisement>` marks a closed ad with, through `salla.storage` (store.js, JSON). */\nconst dismissedKey = (id: number) => `statusAd-${id}`;\n\n/** Stable while the query has no data, so the effect below doesn't rerun on every render. */\nconst NO_ADS: Advertisement[] = [];\n\n/** Hides the ads this visitor closed before the first paint; the effect then drops them. */\nconst HIDE_DISMISSED_SCRIPT =\n \"(function(){try{if(window.self!==window.top)return;document.currentScript.parentNode.querySelectorAll('.s-advertisement[data-id]').forEach(function(e){if(localStorage.getItem('statusAd-'+e.getAttribute('data-id')))e.hidden=true})}catch(e){}})();\";\n\nfunction isDismissed(id: number): boolean {\n try {\n return Boolean(window.localStorage.getItem(dismissedKey(id)));\n } catch {\n return false;\n }\n}\n\nfunction dismiss(id: number): void {\n const storage = window.salla?.storage;\n if (typeof storage?.set === 'function') storage.set(dismissedKey(id), 'dismissed');\n else {\n try {\n window.localStorage.setItem(dismissedKey(id), JSON.stringify('dismissed'));\n } catch {\n // Storage disabled: the ad hides for this page view only.\n }\n }\n}\n\ninterface ClientView {\n /** The theme editor's iframe, or the SDK's debug flag: every ad shows, closed or not. */\n preview: boolean;\n /** Inside the Salla mobile app, which shows no ads. */\n inApp: boolean;\n dismissed: Set<number>;\n}\n\n/**\n * The merchant's announcement bars, in place of `<salla-advertisement>`. Same data, rules and\n * markup, but rendered on the server (the ads are prefetched in the root `beforeLoad`), so the\n * bar is in the first paint instead of pushing the page down when the web component fetches it.\n */\nexport function PageAdvertisements() {\n const { t } = useTranslation();\n // The deepest route loader's `page`, the page `salla.config` reports.\n const pageSlug = useSyncExternalStore(subscribeTwilight, currentPageSlug, currentPageSlug);\n // The query's `retry: 0` only bounds the server wait; the browser may retry.\n const { data: ads = NO_ADS } = useQuery({ ...advertisement.queries.list(), retry: 2 });\n const [view, setView] = useState<ClientView | null>(null);\n\n useEffect(() => {\n const dismissed = new Set(ads.filter((ad) => isDismissed(ad.id)).map((ad) => ad.id));\n setView({ preview: window.self !== window.top, inApp: false, dismissed });\n return whenSallaReady((sdk) => {\n const config = sdk.config as { isMobileApp?: () => boolean; isDebug?: () => boolean };\n const inApp = Boolean(config?.isMobileApp?.());\n const debug = Boolean(config?.isDebug?.());\n if (inApp || debug) {\n setView((current) =>\n current ? { ...current, inApp, preview: current.preview || debug } : current\n );\n }\n });\n }, [ads]);\n\n if (view?.inApp) return null;\n const shown = view?.preview\n ? ads\n : advertisementsFor(ads, pageSlug).filter((ad) => !view?.dismissed.has(ad.id));\n if (!shown.length) return null;\n\n const close = (id: number) => {\n dismiss(id);\n setView((current) =>\n current ? { ...current, dismissed: new Set(current.dismissed).add(id) } : current\n );\n };\n\n return (\n <>\n {shown.map((ad) => (\n <div\n key={ad.id}\n className=\"s-advertisement\"\n data-id={ad.id}\n style={{ backgroundColor: ad.colors?.bg, color: ad.colors?.text }}\n >\n <div className=\"s-advertisement-content container flex justify-between items-center py-2.5\">\n <span className=\"s-advertisement-content-main flex-1 font-bold text-center text-sm\">\n {/* Rendered without an icon too, as the SDK does: its margin is part of the layout. */}\n <i\n className={`s-advertisement-content-icon inline-block align-middle me-2 text-base ${ad.icon ?? ''}`}\n />\n {ad.url ? (\n <a\n href={ad.url}\n target={ad.target ?? undefined}\n rel={ad.target === '_blank' ? 'noopener' : undefined}\n >\n {ad.description}\n </a>\n ) : (\n ad.description\n )}\n </span>\n <button\n type=\"button\"\n className=\"s-advertisement-action px-1\"\n aria-label={t('common.buttons.close', 'Close')}\n onClick={() => close(ad.id)}\n >\n {/* `inline-block`: before the icon CSS loads, an empty inline `<i>` leaves the button 0px tall. */}\n <i className=\"sicon-cancel inline-block\" />\n </button>\n </div>\n </div>\n ))}\n <script suppressHydrationWarning>{HIDE_DISMISSED_SCRIPT}</script>\n </>\n );\n}\n"]}
|
|
@@ -102,7 +102,8 @@ var DEFAULT_DATA = {
|
|
|
102
102
|
nativeAppHeaders: null,
|
|
103
103
|
i18n: void 0,
|
|
104
104
|
page: void 0,
|
|
105
|
-
maintenance: false
|
|
105
|
+
maintenance: false,
|
|
106
|
+
storeNotFound: false
|
|
106
107
|
};
|
|
107
108
|
function loadAsyncHooks() {
|
|
108
109
|
const proc = globalThis.process;
|
|
@@ -179,6 +180,7 @@ function mergeIntoStore(store, partial) {
|
|
|
179
180
|
if ("appsSnippets" in partial) store.appsSnippets = partial.appsSnippets;
|
|
180
181
|
if ("appsSettings" in partial) store.appsSettings = partial.appsSettings;
|
|
181
182
|
if ("maintenance" in partial) store.maintenance = partial.maintenance === true;
|
|
183
|
+
if ("storeNotFound" in partial) store.storeNotFound = partial.storeNotFound === true;
|
|
182
184
|
if ("extras" in partial) store.extras = partial.extras;
|
|
183
185
|
}
|
|
184
186
|
function runWithTwilightContext(partial, fn) {
|
|
@@ -301,6 +303,9 @@ function getTwilightContext() {
|
|
|
301
303
|
get maintenance() {
|
|
302
304
|
return data.maintenance;
|
|
303
305
|
},
|
|
306
|
+
get storeNotFound() {
|
|
307
|
+
return data.storeNotFound;
|
|
308
|
+
},
|
|
304
309
|
get extras() {
|
|
305
310
|
return data.extras;
|
|
306
311
|
}
|
|
@@ -308,5 +313,5 @@ function getTwilightContext() {
|
|
|
308
313
|
}
|
|
309
314
|
|
|
310
315
|
export { SettingsError, composeMessages, createI18nInstance, getRequestStore, getTwilightContext, hasTwilightSettings, isPlainObject, messagesForLocale, runWithTwilightContext, storeTranslationsQueryKey, subscribeTwilight, translationsQueryKey, updateTwilightContext };
|
|
311
|
-
//# sourceMappingURL=chunk-
|
|
312
|
-
//# sourceMappingURL=chunk-
|
|
316
|
+
//# sourceMappingURL=chunk-7VNVCHID.js.map
|
|
317
|
+
//# sourceMappingURL=chunk-7VNVCHID.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/translations-key.ts","../src/api/messages.ts","../src/utils/errors.ts","../src/providers/i18n-factory.ts","../src/twilight/context.ts"],"names":[],"mappings":";;;;;;AAwBO,SAAS,qBAAqB,MAAA,EAAkC;AACrE,EAAA,OAAO,CAAC,gBAAgB,MAAM,CAAA;AAChC;AAkBO,SAAS,yBAAA,CACd,SACA,MAAA,EAC0B;AAC1B,EAAA,OAAO,CAAC,cAAA,EAAgB,MAAA,CAAO,OAAO,GAAG,MAAM,CAAA;AACjD;;;ACrBO,SAAS,cAAc,KAAA,EAAmC;AAC/D,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAgBO,SAAS,aAAA,CAAc,MAAgB,SAAA,EAA+B;AAC3E,EAAA,MAAM,MAAA,GAAmB,EAAE,GAAG,IAAA,EAAK;AAEnC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,SAAS,CAAA,EAAG;AACpD,IAAA,MAAM,QAAA,GAAW,OAAO,GAAG,CAAA;AAC3B,IAAA,MA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d,CAAA;AAAA,IACA,IAAI,gBAAA,GAAmB;AACrB,MAAA,OAAO,IAAA,CAAK,gBAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,IAAA,GAAO;AACT,MAAA,IAAI,CAAC,KAAK,IAAA,EAAM;AAKd,QAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,UACV,IAAA,CAAK,MAAA;AAAA,UACL,iBAAA,CAAkB,IAAA,CAAK,WAAA,EAAa,IAAA,CAAK,MAAM;AAAA,SACjD;AAAA,MACF;AACA,MAAA,OAAO,IAAA,CAAK,IAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,GAAA,GAAM;AACR,MAAA,OAAO,eAAA,CAAgB,IAAA,CAAK,MAAM,CAAA,CAAE,GAAA;AAAA,IACtC,CAAA;AAAA,IACA,IAAI,IAAA,GAAO;AACT,MAAA,OAAO,IAAA,CAAK,IAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,YAAA,GAAe;AACjB,MAAA,OAAO,IAAA,CAAK,YAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,YAAA,GAAe;AACjB,MAAA,OAAO,IAAA,CAAK,YAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,WAAA,GAAc;AAChB,MAAA,OAAO,IAAA,CAAK,WAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,aAAA,GAAgB;AAClB,MAAA,OAAO,IAAA,CAAK,aAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,MAAA,GAAS;AACX,MAAA,OAAO,IAAA,CAAK,MAAA;AAAA,IACd;AAAA,GACF;AACF","file":"chunk-7VNVCHID.js","sourcesContent":["/**\n * @fileoverview The translations query key, on its own, importing nothing.\n *\n * Three places read the cached translations — `rootBeforeLoad`, the hydration\n * path in `tanstack/router.tsx`, and the lazy `i18n` accessor in\n * `twilight/context.ts` — and all three have to agree on the key or the\n * hydrated page misses the entry it was just handed and refetches. One\n * definition is the only way to keep that true.\n *\n * It lives here rather than in `api/translations.ts`, where it would naturally\n * sit, because **`twilight/context.ts` cannot afford that module's imports**.\n * `api/translations` pulls in `api/client`, which pulls in `ky`; `context.ts`\n * is imported directly by tests that mock `ky`, and adding that edge made six\n * of them stop being mocked and start issuing real requests to `api.salla.dev`\n * (`tests/routes/rootBeforeLoad.test.ts`, bisected to exactly this import). A\n * leaf module with no imports of its own cannot do that to anyone.\n */\n\n/**\n * @param locale is part of the key because each file on the CDN holds one\n * language. The global file this replaced carried every language and was\n * sliced after the cache, so a key without the locale was correct then and is\n * a wrong-language bug now: `/ar` → `/en` would reuse the Arabic entry.\n */\nexport function translationsQueryKey(locale: string): [string, string] {\n return ['translations', locale];\n}\n\n/**\n * The merchant's own wording for one store and one language.\n *\n * Separate from {@link translationsQueryKey} rather than folded into it,\n * because the two files have different lifetimes and different audiences: the\n * platform's copy is the same object for every store on the CDN, and this one\n * is a single merchant's overrides. Keeping them apart means a store with no\n * overrides never invalidates, refetches or dehydrates anything on its account.\n *\n * @param storeId is `settings.store.id` — the Optimus-encoded numeric id, which\n * is what names the object. It is safe in a key even though the locale-only key\n * deliberately avoids naming a store: that warning is about a store *resolved\n * from the request*, which differs between server and client. This one is read\n * out of the settings payload, so both sides compute it from the same\n * dehydrated data and agree.\n */\nexport function storeTranslationsQueryKey(\n storeId: string | number,\n locale: string\n): [string, string, string] {\n return ['translations', String(storeId), locale];\n}\n","/**\n * @fileoverview Composing one language's messages out of the query cache.\n *\n * **There are three places that build an i18n instance**, and they have to\n * agree on more than the key: `rootBeforeLoad`, the hydration path in\n * `tanstack/router.tsx`, and the lazy `i18n` accessor in `twilight/context.ts`.\n * When the platform's copy was the only source, agreeing on\n * `translationsQueryKey` was enough. It is not any more — a merchant's own\n * wording is a second cache entry, and a reader that knows about one and not\n * the other renders different text from the page beside it.\n *\n * That is exactly what shipped in #366: the server rendered the merchant's\n * words and hydration replaced them with the platform's, because only\n * `rootBeforeLoad` had been taught to merge. Greptile caught it. This module is\n * the single answer to \"what are the messages for this locale\", so the next\n * source cannot be added to one reader and forgotten in two.\n *\n * It lives beside `translations-key.ts` and imports nothing at runtime for the\n * same reason that file does: `twilight/context.ts` cannot afford\n * `api/translations`, which pulls in `api/client` and therefore `ky`, and tests\n * that mock `ky` stop being mocked the moment that edge exists.\n */\nimport type { QueryClient } from '@tanstack/react-query';\nimport { translationsQueryKey } from './translations-key';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\nexport type Messages = Record<string, unknown>;\n\nexport function isPlainObject(value: unknown): value is Messages {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * `overrides` laid over `base`, one leaf at a time.\n *\n * Recursive rather than a spread, because both files are nested by group\n * (`common.errors.500`) and a top-level spread would make a merchant who\n * overrode one string inside `common` lose every other string in it. The\n * merchant's value wins at the leaf, and a group they never touched is left\n * exactly as the platform sent it.\n *\n * A type conflict — one side an object where the other is a string — resolves\n * to the merchant's value. It is the more specific of the two and there is no\n * sensible way to merge a string into a group; the alternative, keeping the\n * platform's, would mean a merchant's edit silently doing nothing.\n */\nexport function mergeMessages(base: Messages, overrides: Messages): Messages {\n const merged: Messages = { ...base };\n\n for (const [key, value] of Object.entries(overrides)) {\n const existing = merged[key];\n merged[key] =\n isPlainObject(existing) && isPlainObject(value) ? mergeMessages(existing, value) : value;\n }\n\n return merged;\n}\n\n/**\n * This store's overrides for `locale`, if any were fetched into the cache.\n *\n * Found by **shape** rather than by asking the settings for a store id, and\n * that is deliberate: the two readers that were missing the merge have a\n * `queryClient` and a locale between them and nothing else, and reaching for\n * `api/store` from `twilight/context.ts` would drag `ky` in through the back\n * door. One document serves one store — a request naming a different one is\n * redirected with `reloadDocument` — so at most one such entry per locale\n * exists, and matching `['translations', <anything>, <locale>]` cannot pick up\n * somebody else's.\n */\nfunction cachedOverrides(queryClient: QueryClient, locale: string): Messages | undefined {\n const entries = queryClient.getQueriesData<Messages>({ queryKey: ['translations'] });\n\n for (const [key, data] of entries) {\n if (key.length === 3 && key[2] === locale && isPlainObject(data)) {\n return data;\n }\n }\n\n return undefined;\n}\n\n/**\n * The messages for `locale`: the platform's copy with this merchant's over it.\n *\n * Reads only — whoever wants the merchant's file in the cache has to have put\n * it there, which `rootBeforeLoad` does and only when the settings say there is\n * one. A reader that runs without it simply gets the platform's copy, which is\n * the same thing it got before any of this existed.\n */\nexport function messagesForLocale(\n queryClient: QueryClient | undefined,\n locale: string\n): TranslationMessages | undefined {\n const common = queryClient?.getQueryData<TranslationMessages>(translationsQueryKey(locale));\n const overrides = queryClient ? cachedOverrides(queryClient, locale) : undefined;\n\n return composeMessages(common, overrides, locale);\n}\n\n/**\n * The same composition from values rather than from the cache.\n *\n * `rootBeforeLoad` has both in hand already — it just awaited them — so it\n * composes directly instead of reading back what it put in.\n */\nexport function composeMessages(\n common: TranslationMessages | null | undefined,\n overrides: Messages | null | undefined,\n locale: string\n): TranslationMessages | undefined {\n if (!overrides || Object.keys(overrides).length === 0) return common ?? undefined;\n\n const base = common?.[`${locale}.trans`];\n\n return {\n [`${locale}.trans`]: mergeMessages(isPlainObject(base) ? base : {}, overrides) as Record<\n string,\n string\n >,\n };\n}\n","/**\n * Why a store's settings did not load:\n * - `no-store`: nothing named a store for this request;\n * - `timeout`: the Salla API did not answer in time;\n * - `not-found`: it answered that no store has that identifier;\n * - `http`: it answered with another error status;\n * - `network`: no answer arrived at all;\n * - `empty`: it answered without settings.\n */\nexport type SettingsErrorReason =\n 'no-store' | 'timeout' | 'not-found' | 'http' | 'network' | 'empty';\n\nexport interface SettingsErrorDetails {\n reason?: SettingsErrorReason;\n /** The API's status, when `reason` is `'http'` or `'not-found'`. */\n status?: number;\n}\n\nexport class SettingsError extends Error {\n /** Absent when nothing said why, e.g. `getTwilightContext().settings` read before they loaded. */\n readonly reason?: SettingsErrorReason;\n readonly status?: number;\n\n constructor(message?: string, details?: SettingsErrorDetails) {\n super(message ?? 'Store settings could not be loaded.');\n this.name = 'SettingsError';\n this.reason = details?.reason;\n this.status = details?.status;\n }\n}\n","import { createInstance, type i18n as I18nInstance } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nexport type TranslationMessages = Record<string, Record<string, string>>;\n\n/**\n * Creates a new i18next instance for the given locale.\n *\n * @param locale - Active locale code, e.g. `'ar'`\n * @param translations - App translations from the Salla API (store-specific)\n * @param themeTranslations - Bundled theme translations (static defaults)\n */\nexport function createI18nInstance(\n locale: string,\n translations?: TranslationMessages,\n themeTranslations?: TranslationMessages\n): I18nInstance {\n const instance = createInstance();\n const transKey = `${locale}.trans`;\n\n instance.use(initReactI18next).init({\n lng: locale,\n fallbackLng: locale,\n ns: ['app', 'theme'],\n defaultNS: 'app',\n fallbackNS: 'theme',\n resources: {\n [locale]: {\n app: translations?.[transKey] ?? {},\n theme: themeTranslations?.[transKey] ?? {},\n },\n },\n interpolation: { escapeValue: false },\n react: { useSuspense: false },\n keySeparator: '.',\n nsSeparator: false,\n });\n\n return instance;\n}\n\n/**\n * Creates i18n instance for testing\n * @param locale - Locale code (default: 'ar')\n * @param translations - Optional translations\n */\nexport function createTestI18n(locale = 'ar', translations?: TranslationMessages): I18nInstance {\n return createI18nInstance(locale, translations);\n}\n","import type { QueryClient } from '@tanstack/react-query';\nimport type { i18n } from 'i18next';\nimport type { StoreContext } from '../api/store';\nimport type { AppSnippet, AppSettings } from '../api/apps';\nimport { FALLBACK_LOCALE, getLanguageInfo } from '../providers/locale-constants';\nimport { createI18nInstance } from '../providers/i18n-factory';\nimport { messagesForLocale } from '../api/messages';\nimport { SettingsError } from '../utils/errors';\nimport type { ActiveScope } from '../utils/cookies';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface TwilightLocation<TSearch = Record<string, unknown>> {\n href: string;\n pathname: string;\n search: TSearch;\n searchStr: string;\n state: Record<string, unknown>;\n hash: string;\n}\n\nexport interface PageContext {\n slug: string;\n id?: string | number;\n title: string;\n url?: string;\n parent?: { id: string | number; name: string; url: string } | null;\n breadcrumbs?: { name: string; url: string }[];\n}\n\nexport interface TwilightContext {\n queryClient: QueryClient;\n settings: StoreContext;\n locale: string;\n routeId: string;\n location: TwilightLocation;\n authToken: string | null;\n /**\n * The selected market and, once bullet delivery confirmed one, its branch\n * allocation — the full object the SDK sends as `s-scope-*` headers. Seeded from\n * the `scope` cookie on the server; see {@link ActiveScope}.\n */\n scope: ActiveScope | null;\n /** `scope.id`, kept for callers that only need the market. */\n scopeId: string | null;\n /**\n * Which store this request is for, when something other than the hostname says\n * so — the `?storeId=` a preview was opened with, or the cookie remembering it.\n *\n * Null on a live storefront, where the hostname is the answer and there is\n * nothing to carry. See {@link resolveRequestStoreId}.\n */\n storeId: string | null;\n /**\n * Which store the first segment of this request's path named, on a host where\n * the store is the root of every URL: `mtgr-alaatr-2` for\n * `https://preview.salla.design/mtgr-alaatr-2/cart`.\n *\n * Null whenever something else named the store, and on every merchant domain.\n * See {@link resolveRequestStoreBase}.\n */\n storeBase: string | null;\n /**\n * Where {@link storeBase} sits in this request's paths: behind the locale on a\n * Salla shared host (`/ar/dev-x/cart`, named by the dispatcher), in front of it\n * everywhere else. See {@link resolveAddressedStore}.\n */\n storeBaseFollowsLocale: boolean;\n /**\n * Which version of the theme's settings this request asked for — the\n * `?versionId=` an editor preview or a local dev session was opened with, or\n * the cookie remembering it.\n *\n * Null on an ordinary storefront visit, which is the common case: nothing\n * named a version, so the store's live one is what the API answers with. See\n * {@link resolveRequestVersionId}.\n */\n versionId: string | null;\n /**\n * The host this request arrived on, captured server-side.\n *\n * A theme worker is deployed with no vars and no bindings, so the request is\n * the only thing that knows which storefront it is serving. On the client this\n * is `window.location.host`; on the server nothing else has it.\n */\n requestHost: string | null;\n /** The native app's `s-app-*` headers when the request came from its webview; see {@link readNativeAppHeaders}. */\n nativeAppHeaders: Record<string, string> | null;\n i18n: i18n;\n dir: 'ltr' | 'rtl';\n page?: PageContext;\n /** Installed apps' snippets, fetched in rootBeforeLoad so AppsSnippets can render CDN\n * <script> tags during SSR (React Query isn't dehydrated here, so useQuery has no SSR data). */\n appsSnippets?: AppSnippet[];\n /** Per-app public `app.*` buckets, fetched in rootBeforeLoad so rootHead can install the\n * `Salla.appScope` factory inline at parse time — ahead of the snippets' onReady callbacks. */\n appsSettings?: AppSettings;\n /**\n * This visitor sees the maintenance page, not the store. Decided in rootBeforeLoad\n * from `settings.maintenance` and the merchant's owner view; see `utils/maintenance`.\n */\n maintenance: boolean;\n /**\n * The Salla API answered that no store has the identifier this request named. Set by\n * rootBeforeLoad; `twilightMiddleware` answers with Twig's 410 page instead of the render.\n */\n storeNotFound: boolean;\n extras?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Internal Store\n// ============================================================================\n\nconst DEFAULT_LOCATION: TwilightLocation = {\n href: '',\n pathname: '',\n search: {},\n searchStr: '',\n state: {},\n hash: '',\n};\n\ninterface ContextData {\n queryClient: QueryClient;\n settings: StoreContext | null;\n locale: string;\n routeId: string;\n location: TwilightLocation;\n authToken: string | null;\n scope: ActiveScope | null;\n storeId: string | null;\n storeBase: string | null;\n storeBaseFollowsLocale: boolean;\n versionId: string | null;\n requestHost: string | null;\n nativeAppHeaders: Record<string, string> | null;\n i18n?: i18n;\n page?: PageContext;\n appsSnippets?: AppSnippet[];\n appsSettings?: AppSettings;\n maintenance: boolean;\n storeNotFound: boolean;\n extras?: Record<string, unknown>;\n}\n\nconst DEFAULT_DATA: ContextData = {\n queryClient: null as unknown as QueryClient,\n settings: null,\n locale: FALLBACK_LOCALE,\n routeId: '',\n location: { ...DEFAULT_LOCATION },\n authToken: null,\n scope: null,\n storeId: null,\n storeBase: null,\n storeBaseFollowsLocale: false,\n versionId: null,\n requestHost: null,\n nativeAppHeaders: null,\n i18n: undefined,\n page: undefined,\n maintenance: false,\n storeNotFound: false,\n};\n\n// ============================================================================\n// Storage: AsyncLocalStorage (server) or module-level store (client)\n// ============================================================================\n\ntype AsyncLocalStore<T> = { getStore(): T | undefined; run(val: T, fn: () => unknown): unknown };\n\n// Initialize ALS at module load time for SSR — no race condition\ntype AsyncHooks = { AsyncLocalStorage: new <T>() => AsyncLocalStore<T> };\n\n// workerd has no global `require`, so a bundled `require()` throws there; it does have\n// `process.getBuiltinModule` (so does Node >= 20.16), which keeps this out of the browser bundle.\nfunction loadAsyncHooks(): AsyncHooks | null {\n const proc = (globalThis as { process?: { getBuiltinModule?: (id: string) => unknown } }).process;\n try {\n const builtin = proc?.getBuiltinModule?.('node:async_hooks') as AsyncHooks | undefined;\n if (builtin?.AsyncLocalStorage) return builtin;\n } catch {\n /* fall through to require */\n }\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require('node:async_hooks') as AsyncHooks;\n } catch {\n return null;\n }\n}\n\nconst isServer = typeof window === 'undefined';\n// One instance per isolate, so a re-evaluated or duplicated copy of this module (dev\n// reloads, src next to dist) reads the scope the request middleware opened.\nconst ALS_KEY = Symbol.for('salla.twilight.context.als');\nlet _als: AsyncLocalStore<ContextData> | null = null;\nif (isServer) {\n const registry = globalThis as { [ALS_KEY]?: AsyncLocalStore<ContextData> };\n const hooks = registry[ALS_KEY] ? null : loadAsyncHooks();\n if (hooks) registry[ALS_KEY] = new hooks.AsyncLocalStorage<ContextData>();\n _als = registry[ALS_KEY] ?? null;\n}\n\n// Without request isolation every request would share `clientStore`: one visitor's\n// auth token and store settings rendered into another's page.\nfunction assertRequestIsolation(): void {\n if (isServer && !_als) {\n throw new Error(\n '[Twilight] AsyncLocalStorage is unavailable; refusing to share request state.'\n );\n }\n}\n\n// The browser's store, shared by every copy of this module on the page like the ALS above,\n// so a loader in one copy reads the location and token the router wrote through another.\nconst CLIENT_KEY = Symbol.for('salla.twilight.context.client');\nconst clientRegistry = globalThis as {\n [CLIENT_KEY]?: { store: ContextData; listeners: Set<() => void> };\n};\nconst clientShared = (clientRegistry[CLIENT_KEY] ??= {\n store: { ...DEFAULT_DATA },\n listeners: new Set<() => void>(),\n});\nconst clientStore: ContextData = clientShared.store;\n\nfunction getTwilightStore(): ContextData {\n assertRequestIsolation();\n if (_als) {\n const store = _als.getStore();\n if (!store)\n throw new Error('[Twilight] No request context. Wrap with runWithTwilightContext().');\n return store;\n }\n return clientStore;\n}\n\nfunction writableStore(): ContextData {\n if (_als) {\n const store = _als.getStore();\n if (store) return store;\n }\n return clientStore;\n}\n\nfunction mergeIntoStore(store: ContextData, partial: Partial<TwilightContext>): void {\n if ('queryClient' in partial && partial.queryClient) store.queryClient = partial.queryClient;\n if ('settings' in partial && partial.settings != null) store.settings = partial.settings;\n if ('locale' in partial && partial.locale != null) store.locale = partial.locale;\n if ('routeId' in partial && partial.routeId != null) store.routeId = partial.routeId;\n if ('location' in partial && partial.location != null)\n store.location = { ...store.location, ...partial.location };\n if ('authToken' in partial && partial.authToken !== undefined)\n store.authToken = partial.authToken ?? null;\n if ('scope' in partial && partial.scope !== undefined) store.scope = partial.scope ?? null;\n else if ('scopeId' in partial && partial.scopeId !== undefined)\n store.scope = partial.scopeId == null ? null : { id: partial.scopeId };\n if ('storeId' in partial && partial.storeId !== undefined)\n store.storeId = partial.storeId ?? null;\n if ('storeBase' in partial && partial.storeBase !== undefined)\n store.storeBase = partial.storeBase ?? null;\n if ('storeBaseFollowsLocale' in partial && partial.storeBaseFollowsLocale !== undefined)\n store.storeBaseFollowsLocale = partial.storeBaseFollowsLocale === true;\n if ('versionId' in partial && partial.versionId !== undefined)\n store.versionId = partial.versionId ?? null;\n if ('requestHost' in partial && partial.requestHost !== undefined)\n store.requestHost = partial.requestHost ?? null;\n if ('nativeAppHeaders' in partial && partial.nativeAppHeaders !== undefined)\n store.nativeAppHeaders = partial.nativeAppHeaders ?? null;\n if ('i18n' in partial && partial.i18n != null) store.i18n = partial.i18n;\n if ('page' in partial) store.page = partial.page;\n if ('appsSnippets' in partial) store.appsSnippets = partial.appsSnippets;\n if ('appsSettings' in partial) store.appsSettings = partial.appsSettings;\n if ('maintenance' in partial) store.maintenance = partial.maintenance === true;\n if ('storeNotFound' in partial) store.storeNotFound = partial.storeNotFound === true;\n if ('extras' in partial) store.extras = partial.extras;\n}\n\n// ============================================================================\n// Public API\n// ============================================================================\n\nexport function runWithTwilightContext<T>(partial: Partial<TwilightContext>, fn: () => T): T {\n assertRequestIsolation();\n if (_als) {\n const data: ContextData = { ...DEFAULT_DATA };\n mergeIntoStore(data, partial);\n return _als.run(data, fn) as T;\n }\n mergeIntoStore(clientStore, partial);\n return fn();\n}\n\n// Client-only subscription so React consumers (useRouteId/useIsHome/…) re-render\n// when navigation mutates the module store. Mirrors hooks/useWishlist.ts.\nconst listeners = clientShared.listeners;\n\nexport function subscribeTwilight(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nexport function updateTwilightContext(partial: Partial<TwilightContext>): void {\n mergeIntoStore(getTwilightStore(), partial);\n // Server uses AsyncLocalStorage and has no React subscribers; notify on client only.\n if (typeof window !== 'undefined') {\n for (const listener of listeners) listener();\n }\n}\n\n/**\n * Whether store settings are available, without throwing.\n *\n * `getTwilightContext().settings` throws a `SettingsError` when the store is\n * empty, which is fatal inside a head function during hydration. Callers that\n * need to *test* availability must use this instead of a try/catch around the\n * getter. Returns false when there is no request context at all (server-side\n * calls outside `runWithTwilightContext`).\n */\nexport function hasTwilightSettings(): boolean {\n try {\n return getTwilightStore().settings != null;\n } catch {\n return false;\n }\n}\n\n/** What a request addressed, as opposed to what it is. */\nexport interface RequestAddressing {\n storeId: string | null;\n storeBase: string | null;\n storeBaseFollowsLocale: boolean;\n versionId: string | null;\n requestHost: string | null;\n}\n\n/**\n * What this request named and the host it arrived on, without throwing.\n *\n * Separate from {@link getTwilightContext} because store identity is read while\n * deciding *what to fetch* — before there is a context worth having — and on the\n * server outside a request the getter throws. A caller asking \"which store?\" has\n * a sane answer for \"none named\"; it has none for an exception.\n *\n * The version rides along rather than getting an accessor of its own: it is read\n * at the same moment, for the same reason, and by the same callers, and a second\n * copy of this try/catch would be a second thing to remember to widen.\n */\nexport function getRequestStore(): RequestAddressing {\n try {\n const data = getTwilightStore();\n return {\n storeId: data.storeId,\n storeBase: data.storeBase,\n storeBaseFollowsLocale: data.storeBaseFollowsLocale,\n versionId: data.versionId,\n requestHost: data.requestHost,\n };\n } catch {\n return {\n storeId: null,\n storeBase: null,\n storeBaseFollowsLocale: false,\n versionId: null,\n requestHost: null,\n };\n }\n}\n\nexport function getTwilightContext(): TwilightContext {\n const data = getTwilightStore();\n return {\n get queryClient() {\n return data.queryClient;\n },\n get settings() {\n if (!data.settings) throw new SettingsError();\n return data.settings;\n },\n get locale() {\n return data.locale;\n },\n get routeId() {\n return data.routeId;\n },\n get location() {\n return data.location;\n },\n get authToken() {\n return data.authToken;\n },\n get scope() {\n return data.scope;\n },\n get scopeId() {\n return data.scope?.id ?? null;\n },\n get storeId() {\n return data.storeId;\n },\n get storeBase() {\n return data.storeBase;\n },\n get storeBaseFollowsLocale() {\n return data.storeBaseFollowsLocale;\n },\n get versionId() {\n return data.versionId;\n },\n get requestHost() {\n return data.requestHost;\n },\n get nativeAppHeaders() {\n return data.nativeAppHeaders;\n },\n get i18n() {\n if (!data.i18n) {\n // Composed the same way as `rootBeforeLoad` and the hydration path —\n // the platform's copy with this merchant's over it. See\n // `api/messages.ts`: this accessor reading one entry while the others\n // read two is precisely the drift that module exists to stop.\n data.i18n = createI18nInstance(\n data.locale,\n messagesForLocale(data.queryClient, data.locale)\n );\n }\n return data.i18n;\n },\n get dir() {\n return getLanguageInfo(data.locale).dir;\n },\n get page() {\n return data.page;\n },\n get appsSnippets() {\n return data.appsSnippets;\n },\n get appsSettings() {\n return data.appsSettings;\n },\n get maintenance() {\n return data.maintenance;\n },\n get storeNotFound() {\n return data.storeNotFound;\n },\n get extras() {\n return data.extras;\n },\n };\n}\n\n/** @internal Reset store for testing */\nexport function resetForTesting(): void {\n Object.assign(writableStore(), { ...DEFAULT_DATA });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
2
2
|
import { useAsyncFn } from './chunk-6BZ5TKEV.js';
|
|
3
|
-
import { whenSallaLoaded, onSallaEvent } from './chunk-
|
|
3
|
+
import { whenSallaLoaded, onSallaEvent } from './chunk-3GDJMMMS.js';
|
|
4
4
|
import { useSyncExternalStore, useCallback } from 'react';
|
|
5
5
|
|
|
6
6
|
var WISHLIST_STORAGE_KEY = "salla::wishlist";
|
|
@@ -126,5 +126,5 @@ function resetWishlistStore() {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export { resetWishlistStore, useWishlist };
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-BVMHRVCG.js.map
|
|
130
|
+
//# sourceMappingURL=chunk-BVMHRVCG.js.map
|