@salla.sa/twilight-theme-engine 1.0.210 → 1.0.212
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-EG7HATAR.js → AddToCartForm-6B45JALK.js} +3 -3
- package/dist/{AddToCartForm-EG7HATAR.js.map → AddToCartForm-6B45JALK.js.map} +1 -1
- package/dist/{BlogAuthorPage-HTOIPQQ4.js → BlogAuthorPage-NUIE33SI.js} +19 -19
- package/dist/{BlogAuthorPage-HTOIPQQ4.js.map → BlogAuthorPage-NUIE33SI.js.map} +1 -1
- package/dist/{BlogCategoryPage-UAHYSE7T.js → BlogCategoryPage-NI7GRGIT.js} +19 -19
- package/dist/{BlogCategoryPage-UAHYSE7T.js.map → BlogCategoryPage-NI7GRGIT.js.map} +1 -1
- package/dist/{BlogPage-YGVOS4NV.js → BlogPage-EMGJ3RSW.js} +17 -17
- package/dist/{BlogPage-YGVOS4NV.js.map → BlogPage-EMGJ3RSW.js.map} +1 -1
- package/dist/{BlogSinglePage-3YH2K6NA.js → BlogSinglePage-27XZ6GHV.js} +17 -17
- package/dist/{BlogSinglePage-3YH2K6NA.js.map → BlogSinglePage-27XZ6GHV.js.map} +1 -1
- package/dist/{BlogTagPage-43GOS5A6.js → BlogTagPage-6NTZP2JR.js} +19 -19
- package/dist/{BlogTagPage-43GOS5A6.js.map → BlogTagPage-6NTZP2JR.js.map} +1 -1
- package/dist/{BrandsPage-COEINBDY.js → BrandsPage-CD556YCT.js} +18 -18
- package/dist/{BrandsPage-COEINBDY.js.map → BrandsPage-CD556YCT.js.map} +1 -1
- package/dist/{Breadcrumb-W4E43JGX.js → Breadcrumb-DH25AXCC.js} +17 -17
- package/dist/{Breadcrumb-W4E43JGX.js.map → Breadcrumb-DH25AXCC.js.map} +1 -1
- package/dist/{CanvasOverlay-G2LSKB6E.js → CanvasOverlay-32RQIQKU.js} +3 -3
- package/dist/{CanvasOverlay-G2LSKB6E.js.map → CanvasOverlay-32RQIQKU.js.map} +1 -1
- package/dist/{CartItem-EBTOA2JO.js → CartItem-ZCL5CW3F.js} +17 -17
- package/dist/{CartItem-EBTOA2JO.js.map → CartItem-ZCL5CW3F.js.map} +1 -1
- package/dist/{CartSummary-WOZKSBAB.js → CartSummary-HFPWKARM.js} +17 -17
- package/dist/{CartSummary-WOZKSBAB.js.map → CartSummary-HFPWKARM.js.map} +1 -1
- package/dist/{Copyright-2656CBLY.js → Copyright-4J2OAPEG.js} +3 -3
- package/dist/{Copyright-2656CBLY.js.map → Copyright-4J2OAPEG.js.map} +1 -1
- package/dist/{CustomerLayout-FBO4W4Z5.js → CustomerLayout-4RSNDRPC.js} +17 -17
- package/dist/{CustomerLayout-FBO4W4Z5.js.map → CustomerLayout-4RSNDRPC.js.map} +1 -1
- package/dist/{Footer-P3773ZM6.js → Footer-GQMU5B7W.js} +3 -3
- package/dist/{Footer-P3773ZM6.js.map → Footer-GQMU5B7W.js.map} +1 -1
- package/dist/GoogleTag-2RBGGJG3.js +15 -0
- package/dist/{GoogleTag-OPCZNE4C.js.map → GoogleTag-2RBGGJG3.js.map} +1 -1
- package/dist/{Header-DSAOP3FS.js → Header-KYCJOGUR.js} +8 -8
- package/dist/{Header-DSAOP3FS.js.map → Header-KYCJOGUR.js.map} +1 -1
- package/dist/{LatestProducts-GCFPSGAG.js → LatestProducts-JTKG7N7C.js} +19 -19
- package/dist/{LatestProducts-GCFPSGAG.js.map → LatestProducts-JTKG7N7C.js.map} +1 -1
- package/dist/{LoyaltyPage-TL6BMGCI.js → LoyaltyPage-DLNKNRPG.js} +17 -17
- package/dist/{LoyaltyPage-TL6BMGCI.js.map → LoyaltyPage-DLNKNRPG.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-2XEY2ZLT.js → LoyaltyPointsPage-JUPZGVJG.js} +6 -6
- package/dist/{LoyaltyPointsPage-2XEY2ZLT.js.map → LoyaltyPointsPage-JUPZGVJG.js.map} +1 -1
- package/dist/{MainMenu-75YH3CH4.js → MainMenu-YU3QUJ3J.js} +5 -5
- package/dist/{MainMenu-75YH3CH4.js.map → MainMenu-YU3QUJ3J.js.map} +1 -1
- package/dist/{MasterLayout-65LIO6OE.js → MasterLayout-27562HUX.js} +17 -17
- package/dist/{MasterLayout-65LIO6OE.js.map → MasterLayout-27562HUX.js.map} +1 -1
- package/dist/{MobileMenu-YWQ7BHEF.js → MobileMenu-CSSJWHOF.js} +18 -18
- package/dist/{MobileMenu-YWQ7BHEF.js.map → MobileMenu-CSSJWHOF.js.map} +1 -1
- package/dist/{NotificationsPage-3UQ3APM2.js → NotificationsPage-XUQXWPRU.js} +17 -17
- package/dist/{NotificationsPage-3UQ3APM2.js.map → NotificationsPage-XUQXWPRU.js.map} +1 -1
- package/dist/{OrderSinglePage-GUEL6HB7.js → OrderSinglePage-Q76JD52G.js} +20 -20
- package/dist/{OrderSinglePage-GUEL6HB7.js.map → OrderSinglePage-Q76JD52G.js.map} +1 -1
- package/dist/{OrdersPage-EOD6GG4U.js → OrdersPage-3MDI2IPJ.js} +17 -17
- package/dist/{OrdersPage-EOD6GG4U.js.map → OrdersPage-3MDI2IPJ.js.map} +1 -1
- package/dist/{PageSingle-EOLJMQHB.js → PageSingle-YDCMHODA.js} +3 -3
- package/dist/{PageSingle-EOLJMQHB.js.map → PageSingle-YDCMHODA.js.map} +1 -1
- package/dist/{ProductDetails-RM7MPTMF.js → ProductDetails-2EVEP5SX.js} +5 -5
- package/dist/{ProductDetails-RM7MPTMF.js.map → ProductDetails-2EVEP5SX.js.map} +1 -1
- package/dist/{ProfilePage-XUF24BHS.js → ProfilePage-LAXMD2WO.js} +17 -17
- package/dist/{ProfilePage-XUF24BHS.js.map → ProfilePage-LAXMD2WO.js.map} +1 -1
- package/dist/{ReviewsPage-OUUEO3XC.js → ReviewsPage-HPTWKBPH.js} +3 -3
- package/dist/{ReviewsPage-OUUEO3XC.js.map → ReviewsPage-HPTWKBPH.js.map} +1 -1
- package/dist/{SeoCartWidget-TKQPPASG.js → SeoCartWidget-KBEVGXJI.js} +17 -17
- package/dist/{SeoCartWidget-TKQPPASG.js.map → SeoCartWidget-KBEVGXJI.js.map} +1 -1
- package/dist/{SettingsPage-VIRPJ2FB.js → SettingsPage-Q52PZLUI.js} +17 -17
- package/dist/{SettingsPage-VIRPJ2FB.js.map → SettingsPage-Q52PZLUI.js.map} +1 -1
- package/dist/{StoreClosedNotification-SXRGM42Z.js → StoreClosedNotification-PTZVNCCV.js} +18 -18
- package/dist/{StoreClosedNotification-SXRGM42Z.js.map → StoreClosedNotification-PTZVNCCV.js.map} +1 -1
- package/dist/{TestimonialsPage-MFRJFBBZ.js → TestimonialsPage-BZEUUKNO.js} +3 -3
- package/dist/{TestimonialsPage-MFRJFBBZ.js.map → TestimonialsPage-BZEUUKNO.js.map} +1 -1
- package/dist/{ThankYouPage-M656TZDL.js → ThankYouPage-RFY2WWN5.js} +17 -17
- package/dist/{ThankYouPage-M656TZDL.js.map → ThankYouPage-RFY2WWN5.js.map} +1 -1
- package/dist/{WalletPage-RYZACLWW.js → WalletPage-MF2DTE3D.js} +18 -18
- package/dist/{WalletPage-RYZACLWW.js.map → WalletPage-MF2DTE3D.js.map} +1 -1
- package/dist/{WebMcpTools-75A7UJP2.js → WebMcpTools-FRDG7FRV.js} +5 -5
- package/dist/{WebMcpTools-75A7UJP2.js.map → WebMcpTools-FRDG7FRV.js.map} +1 -1
- package/dist/{WishlistPage-ICTLFZPO.js → WishlistPage-K2MI4KFF.js} +19 -19
- package/dist/{WishlistPage-ICTLFZPO.js.map → WishlistPage-K2MI4KFF.js.map} +1 -1
- package/dist/api/advertisement.js +2 -2
- package/dist/api/apps.js +2 -2
- package/dist/api/blog.js +3 -3
- package/dist/api/brands.js +3 -3
- package/dist/api/cart.js +3 -3
- package/dist/api/category.js +3 -3
- package/dist/api/client.js +1 -1
- package/dist/api/custom-url.js +2 -2
- package/dist/api/home.js +2 -2
- package/dist/api/loyalty.js +3 -3
- package/dist/api/menu.js +2 -2
- package/dist/api/notification.js +2 -2
- package/dist/api/order.js +3 -3
- package/dist/api/page.js +3 -3
- package/dist/api/product.js +3 -3
- package/dist/api/profile.js +1 -1
- package/dist/api/store.js +2 -2
- package/dist/api/translations.js +2 -2
- package/dist/api/user.js +2 -2
- package/dist/api/wallet.js +2 -2
- package/dist/api/wishlist.js +4 -4
- package/dist/{chunk-MUJEGFLE.js → chunk-2DUC5HPY.js} +3 -3
- package/dist/{chunk-MUJEGFLE.js.map → chunk-2DUC5HPY.js.map} +1 -1
- package/dist/{chunk-AVJSCOYE.js → chunk-4IISS5KO.js} +3 -3
- package/dist/{chunk-AVJSCOYE.js.map → chunk-4IISS5KO.js.map} +1 -1
- package/dist/{chunk-YXSKW2QR.js → chunk-5B23EENL.js} +3 -3
- package/dist/{chunk-YXSKW2QR.js.map → chunk-5B23EENL.js.map} +1 -1
- package/dist/{chunk-VBXLB7A2.js → chunk-6FAUK2WT.js} +4 -4
- package/dist/{chunk-VBXLB7A2.js.map → chunk-6FAUK2WT.js.map} +1 -1
- package/dist/{chunk-H3PNVKBQ.js → chunk-6KARAWOF.js} +4 -4
- package/dist/{chunk-H3PNVKBQ.js.map → chunk-6KARAWOF.js.map} +1 -1
- package/dist/{chunk-YB6QLCDQ.js → chunk-6RWMVAOC.js} +5 -5
- package/dist/{chunk-YB6QLCDQ.js.map → chunk-6RWMVAOC.js.map} +1 -1
- package/dist/{chunk-GTNCHLXK.js → chunk-7326LK5W.js} +3 -3
- package/dist/{chunk-GTNCHLXK.js.map → chunk-7326LK5W.js.map} +1 -1
- package/dist/{chunk-NAZ7AXD3.js → chunk-7CZXUN6C.js} +5 -5
- package/dist/{chunk-NAZ7AXD3.js.map → chunk-7CZXUN6C.js.map} +1 -1
- package/dist/{chunk-FD4QTGWX.js → chunk-7XEF3ITQ.js} +3 -3
- package/dist/{chunk-FD4QTGWX.js.map → chunk-7XEF3ITQ.js.map} +1 -1
- package/dist/{chunk-TZ3DCT3S.js → chunk-BUXWWPX4.js} +3 -3
- package/dist/{chunk-TZ3DCT3S.js.map → chunk-BUXWWPX4.js.map} +1 -1
- package/dist/{chunk-Z7SE66QV.js → chunk-C2MAZFIT.js} +3 -3
- package/dist/{chunk-Z7SE66QV.js.map → chunk-C2MAZFIT.js.map} +1 -1
- package/dist/{chunk-OVYHHD2Q.js → chunk-CBZR37Z7.js} +3 -3
- package/dist/{chunk-OVYHHD2Q.js.map → chunk-CBZR37Z7.js.map} +1 -1
- package/dist/{chunk-WFTPOJUF.js → chunk-DGPHTEZE.js} +4 -4
- package/dist/{chunk-WFTPOJUF.js.map → chunk-DGPHTEZE.js.map} +1 -1
- package/dist/{chunk-3CZYFTKP.js → chunk-DIYLHIAT.js} +3 -3
- package/dist/{chunk-3CZYFTKP.js.map → chunk-DIYLHIAT.js.map} +1 -1
- package/dist/{chunk-XHXOKYMY.js → chunk-E22CFO2G.js} +4 -4
- package/dist/{chunk-XHXOKYMY.js.map → chunk-E22CFO2G.js.map} +1 -1
- package/dist/{chunk-MDI42JZX.js → chunk-E42GOEFC.js} +4 -4
- package/dist/{chunk-MDI42JZX.js.map → chunk-E42GOEFC.js.map} +1 -1
- package/dist/{chunk-UBU4OIGW.js → chunk-EJNBREFC.js} +2 -2
- package/dist/{chunk-UBU4OIGW.js.map → chunk-EJNBREFC.js.map} +1 -1
- package/dist/{chunk-4EAQH3WA.js → chunk-ENA4XT5H.js} +4 -4
- package/dist/{chunk-4EAQH3WA.js.map → chunk-ENA4XT5H.js.map} +1 -1
- package/dist/{chunk-QD3RBSKF.js → chunk-F27WIIXS.js} +14 -14
- package/dist/{chunk-QD3RBSKF.js.map → chunk-F27WIIXS.js.map} +1 -1
- package/dist/{chunk-V323S3U7.js → chunk-GAZBRWMD.js} +4 -4
- package/dist/{chunk-V323S3U7.js.map → chunk-GAZBRWMD.js.map} +1 -1
- package/dist/{chunk-P5AFKVVA.js → chunk-HMPWFSWG.js} +4 -4
- package/dist/{chunk-P5AFKVVA.js.map → chunk-HMPWFSWG.js.map} +1 -1
- package/dist/{chunk-6O2TYPUP.js → chunk-HYARGOSU.js} +3 -3
- package/dist/{chunk-6O2TYPUP.js.map → chunk-HYARGOSU.js.map} +1 -1
- package/dist/{chunk-E5HVD4JY.js → chunk-HZECUTW5.js} +4 -4
- package/dist/{chunk-E5HVD4JY.js.map → chunk-HZECUTW5.js.map} +1 -1
- package/dist/{chunk-NSCZTGJU.js → chunk-IIWQCEAD.js} +3 -3
- package/dist/{chunk-NSCZTGJU.js.map → chunk-IIWQCEAD.js.map} +1 -1
- package/dist/{chunk-6QEKTZWT.js → chunk-IOQLDBXY.js} +6 -6
- package/dist/{chunk-6QEKTZWT.js.map → chunk-IOQLDBXY.js.map} +1 -1
- package/dist/{chunk-FY36SODO.js → chunk-JBKUYGDE.js} +3 -3
- package/dist/{chunk-FY36SODO.js.map → chunk-JBKUYGDE.js.map} +1 -1
- package/dist/{chunk-5DRX6ZKG.js → chunk-JR5EDVZU.js} +3 -3
- package/dist/{chunk-5DRX6ZKG.js.map → chunk-JR5EDVZU.js.map} +1 -1
- package/dist/{chunk-YUTDUIB5.js → chunk-JY4EI4ZA.js} +3 -3
- package/dist/{chunk-YUTDUIB5.js.map → chunk-JY4EI4ZA.js.map} +1 -1
- package/dist/{chunk-KYOGYOMA.js → chunk-K5EIRY5R.js} +4 -4
- package/dist/{chunk-KYOGYOMA.js.map → chunk-K5EIRY5R.js.map} +1 -1
- package/dist/{chunk-V6ZHJMFD.js → chunk-KM3KK4KZ.js} +4 -4
- package/dist/{chunk-V6ZHJMFD.js.map → chunk-KM3KK4KZ.js.map} +1 -1
- package/dist/{chunk-I6FORV4B.js → chunk-KUROVEJP.js} +3 -3
- package/dist/{chunk-I6FORV4B.js.map → chunk-KUROVEJP.js.map} +1 -1
- package/dist/{chunk-AUFCS374.js → chunk-KVEINIFK.js} +4 -4
- package/dist/{chunk-AUFCS374.js.map → chunk-KVEINIFK.js.map} +1 -1
- package/dist/{chunk-7IL5RSR5.js → chunk-LC3M4HW7.js} +3 -3
- package/dist/{chunk-7IL5RSR5.js.map → chunk-LC3M4HW7.js.map} +1 -1
- package/dist/{chunk-EWK6SZPV.js → chunk-OVRXYL5B.js} +4 -4
- package/dist/{chunk-EWK6SZPV.js.map → chunk-OVRXYL5B.js.map} +1 -1
- package/dist/{chunk-Q7FJ4XKY.js → chunk-P3E64ITB.js} +7 -7
- package/dist/{chunk-Q7FJ4XKY.js.map → chunk-P3E64ITB.js.map} +1 -1
- package/dist/{chunk-5ZARPSEZ.js → chunk-P5BIPOJ4.js} +3 -3
- package/dist/{chunk-5ZARPSEZ.js.map → chunk-P5BIPOJ4.js.map} +1 -1
- package/dist/{chunk-3FGCLNM6.js → chunk-PWUOIH5V.js} +7 -7
- package/dist/{chunk-3FGCLNM6.js.map → chunk-PWUOIH5V.js.map} +1 -1
- package/dist/{chunk-EEZQQMD4.js → chunk-RFPIGVAO.js} +4 -4
- package/dist/{chunk-EEZQQMD4.js.map → chunk-RFPIGVAO.js.map} +1 -1
- package/dist/{chunk-5XM72SGI.js → chunk-SF5AFS3A.js} +4 -4
- package/dist/{chunk-5XM72SGI.js.map → chunk-SF5AFS3A.js.map} +1 -1
- package/dist/{chunk-VRXZFMMN.js → chunk-SIDYR6LZ.js} +4 -4
- package/dist/{chunk-VRXZFMMN.js.map → chunk-SIDYR6LZ.js.map} +1 -1
- package/dist/{chunk-P3OYCAO3.js → chunk-SL4VKTNK.js} +5 -5
- package/dist/{chunk-P3OYCAO3.js.map → chunk-SL4VKTNK.js.map} +1 -1
- package/dist/{chunk-6H6QX2XF.js → chunk-TH6HPT3K.js} +7 -7
- package/dist/{chunk-6H6QX2XF.js.map → chunk-TH6HPT3K.js.map} +1 -1
- package/dist/{chunk-WOIUGEN7.js → chunk-UM3G3Q25.js} +3 -3
- package/dist/{chunk-WOIUGEN7.js.map → chunk-UM3G3Q25.js.map} +1 -1
- package/dist/{chunk-6DTT6DFS.js → chunk-V4ZRPTFE.js} +20 -20
- package/dist/chunk-V4ZRPTFE.js.map +1 -0
- package/dist/{chunk-DBFVTN4C.js → chunk-VIUK32MB.js} +3 -3
- package/dist/{chunk-DBFVTN4C.js.map → chunk-VIUK32MB.js.map} +1 -1
- package/dist/{chunk-7557N22C.js → chunk-XCWRUMLQ.js} +4 -4
- package/dist/{chunk-7557N22C.js.map → chunk-XCWRUMLQ.js.map} +1 -1
- package/dist/{chunk-SD3XCDUI.js → chunk-Y7SL553A.js} +3 -3
- package/dist/{chunk-SD3XCDUI.js.map → chunk-Y7SL553A.js.map} +1 -1
- package/dist/{chunk-G4XPYZ4D.js → chunk-YZVWVS3N.js} +3 -3
- package/dist/{chunk-G4XPYZ4D.js.map → chunk-YZVWVS3N.js.map} +1 -1
- package/dist/{chunk-CTU6VJN7.js → chunk-ZC5TVFLI.js} +3 -3
- package/dist/{chunk-CTU6VJN7.js.map → chunk-ZC5TVFLI.js.map} +1 -1
- package/dist/{chunk-XTJ45UWF.js → chunk-ZLKCJBF7.js} +5 -5
- package/dist/{chunk-XTJ45UWF.js.map → chunk-ZLKCJBF7.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 +15 -15
- package/dist/components/home/index.js +20 -20
- package/dist/components/layout/index.js +4 -4
- package/dist/components/product/index.js +17 -17
- package/dist/components/store/index.js +16 -16
- package/dist/components/tracking/index.js +6 -6
- package/dist/{custom-urls-762MPX4D.js → custom-urls-QAOALCNQ.js} +7 -7
- package/dist/{custom-urls-762MPX4D.js.map → custom-urls-QAOALCNQ.js.map} +1 -1
- package/dist/dev/editor/index.js +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/{document-class-FVT5XMGM.js → document-class-SMU7XYXA.js} +17 -17
- package/dist/{document-class-FVT5XMGM.js.map → document-class-SMU7XYXA.js.map} +1 -1
- package/dist/hooks/index.js +15 -15
- package/dist/hooks/useGtm.js +15 -15
- package/dist/hooks/useMoney.d.ts.map +1 -1
- package/dist/hooks/useMoney.js +15 -15
- package/dist/hooks/useStore.js +15 -15
- package/dist/hooks/useUser.js +3 -3
- package/dist/index.js +15 -15
- package/dist/{navigation-TG3EJBXL.js → navigation-2SB3WXJN.js} +4 -4
- package/dist/{navigation-TG3EJBXL.js.map → navigation-2SB3WXJN.js.map} +1 -1
- package/dist/{navigation-GU5SVIEI.js → navigation-DAGDU4UL.js} +5 -5
- package/dist/{navigation-GU5SVIEI.js.map → navigation-DAGDU4UL.js.map} +1 -1
- package/dist/{not-found-SPUNA3MH.js → not-found-25S7XQ6X.js} +18 -18
- package/dist/{not-found-SPUNA3MH.js.map → not-found-25S7XQ6X.js.map} +1 -1
- package/dist/providers/index.js +15 -15
- package/dist/routes/account/orders.js +4 -4
- package/dist/routes/account.js +13 -13
- package/dist/routes/blog.js +8 -8
- package/dist/routes/brands.js +4 -4
- package/dist/routes/cart.js +25 -25
- package/dist/routes/home.js +21 -21
- package/dist/routes/index.js +8 -8
- package/dist/routes/loyalty.js +5 -5
- package/dist/routes/page.js +4 -4
- package/dist/routes/product-listing.js +25 -25
- package/dist/routes/product.js +24 -24
- package/dist/routes/seo-redirects.js +8 -8
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +4 -4
- package/dist/skeleton.js +23 -23
- package/dist/{store-lookup-5SQT7FXZ.js → store-lookup-ZSSUTV64.js} +8 -8
- package/dist/{store-lookup-5SQT7FXZ.js.map → store-lookup-ZSSUTV64.js.map} +1 -1
- package/dist/tanstack.js +17 -17
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/tailwind/routes/account/orders/single/OrderItemRow.tsx.txt +2 -2
- package/dist/GoogleTag-OPCZNE4C.js +0 -15
- package/dist/chunk-6DTT6DFS.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { lazyComponent } from './chunk-TLHZBTPZ.js';
|
|
|
2
2
|
|
|
3
3
|
// src/components/common/lazy.ts
|
|
4
4
|
var LazyBreadcrumb = lazyComponent(
|
|
5
|
-
() => import('./Breadcrumb-
|
|
5
|
+
() => import('./Breadcrumb-DH25AXCC.js').then((m) => ({ default: m.Breadcrumb }))
|
|
6
6
|
);
|
|
7
7
|
var LazyNoContent = lazyComponent(
|
|
8
8
|
() => import('./NoContent-7YUWEXI2.js').then((m) => ({ default: m.NoContent }))
|
|
@@ -18,5 +18,5 @@ var LazyErrorPage = lazyComponent(
|
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
export { LazyBreadcrumb, LazyCurrencySymbol, LazyErrorPage, LazyNoContent, LazyRenderWhenVisible };
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-CBZR37Z7.js.map
|
|
22
|
+
//# sourceMappingURL=chunk-CBZR37Z7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/common/lazy.ts"],"names":[],"mappings":";;;AASO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE;AAEO,IAAM,aAAA,GAAgB,aAAA;AAAA,EAAc,MACzC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D;AAEO,IAAM,qBAAA,GAAwB,aAAA;AAAA,EAAc,MACjD,OAAO,iCAAqB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,iBAAA,EAAkB,CAAE;AAC9E;AAEO,IAAM,kBAAA,GAAqB,aAAA;AAAA,EAAc,MAC9C,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE;AAEO,IAAM,aAAA,GAAgB,aAAA;AAAA,EAAc,MACzC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/components/common/lazy.ts"],"names":[],"mappings":";;;AASO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE;AAEO,IAAM,aAAA,GAAgB,aAAA;AAAA,EAAc,MACzC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D;AAEO,IAAM,qBAAA,GAAwB,aAAA;AAAA,EAAc,MACjD,OAAO,iCAAqB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,iBAAA,EAAkB,CAAE;AAC9E;AAEO,IAAM,kBAAA,GAAqB,aAAA;AAAA,EAAc,MAC9C,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE;AAEO,IAAM,aAAA,GAAgB,aAAA;AAAA,EAAc,MACzC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D","file":"chunk-CBZR37Z7.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded common components\n * Use these for code-splitting non-critical components\n *\n * NOTE: Skeleton components are sourced from @salla.sa/twilight-components-react\n * because they must render instantly during route transitions.\n */\nexport const LazyBreadcrumb = lazyComponent(() =>\n import('./Breadcrumb').then((m) => ({ default: m.Breadcrumb }))\n);\n\nexport const LazyNoContent = lazyComponent(() =>\n import('./NoContent').then((m) => ({ default: m.NoContent }))\n);\n\nexport const LazyRenderWhenVisible = lazyComponent(() =>\n import('./RenderWhenVisible').then((m) => ({ default: m.RenderWhenVisible }))\n);\n\nexport const LazyCurrencySymbol = lazyComponent(() =>\n import('./CurrencySymbol').then((m) => ({ default: m.CurrencySymbol }))\n);\n\nexport const LazyErrorPage = lazyComponent(() =>\n import('./ErrorPage').then((m) => ({ default: m.ErrorPage }))\n);\n"]}
|
|
@@ -12,10 +12,10 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
12
12
|
|
|
13
13
|
// src/components/product/lazy.ts
|
|
14
14
|
var LazyProductDetails = lazyComponent(
|
|
15
|
-
() => import('./ProductDetails-
|
|
15
|
+
() => import('./ProductDetails-2EVEP5SX.js').then((m) => ({ default: m.ProductDetails }))
|
|
16
16
|
);
|
|
17
17
|
var LazyAddToCartForm = lazyComponent(
|
|
18
|
-
() => import('./AddToCartForm-
|
|
18
|
+
() => import('./AddToCartForm-6B45JALK.js').then((m) => ({ default: m.AddToCartForm }))
|
|
19
19
|
);
|
|
20
20
|
var PRODUCT_GALLERY_KEY = "product:gallery";
|
|
21
21
|
function legacyGalleryMedia(images) {
|
|
@@ -204,5 +204,5 @@ function ThumbSlide({ image, index }) {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
export { LazyAddToCartForm, LazyProductDetails, ProductGallery };
|
|
207
|
-
//# sourceMappingURL=chunk-
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
207
|
+
//# sourceMappingURL=chunk-DGPHTEZE.js.map
|
|
208
|
+
//# sourceMappingURL=chunk-DGPHTEZE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/product/lazy.ts","../src/components/product/ProductGallery.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,aAAA;AAAA,EAAc,MAC9C,OAAO,8BAAkB,CAAA,CA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BAAA,GAAoB,aAAA,GAAgB,EAAE,CAAA,CAAA;AAAA,MACpH,gBAAc,KAAA,CAAM,GAAA;AAAA,MAEpB,QAAA,kBAAA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,KAAK,KAAA,CAAM,GAAA;AAAA,UACX,GAAA,EAAK,MAAM,GAAA,IAAO,EAAA;AAAA,UAClB,SAAA,EAAU,mEAAA;AAAA,UACV,OAAO,KAAA,CAAM,GAAA;AAAA,UACb,UAAU,KAAA,GAAQ,CAAA;AAAA,UAClB,SAAA,EAAS;AAAA;AAAA;AACX;AAAA,GACF;AAEJ","file":"chunk-WFTPOJUF.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\nexport const LazyProductDetails = lazyComponent(() =>\n import('./ProductDetails').then((m) => ({ default: m.ProductDetails }))\n);\n\nexport const LazyAddToCartForm = lazyComponent(() =>\n import('./AddToCartForm').then((m) => ({ default: m.AddToCartForm }))\n);\n","import { SallaSlider } from '@salla.sa/twilight-components-react/slider';\nimport { Suspense, useEffect, useMemo, useState } from 'react';\nimport { registry } from '../ComponentRegistry';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { Product, ProductImage } from '../../types';\nimport { Image } from '../common/Image';\nimport { ImageModal } from '../modal';\nimport { isNativeApp } from '../../native-app';\nimport { useRenderProbe } from '../../utils/render-probe';\n\nconst PRODUCT_GALLERY_KEY = 'product:gallery';\n\nexport interface ProductGalleryProps {\n product: Product;\n}\n\ntype ImagePreview = { src: string; alt: string };\ntype GalleryMedia = { url: string; type: 'image' | 'video' | '3d-image' };\n\n/**\n * The engine's own `mobile::gallery.open` payload from before `salla.mobile.openGallery`: a video's\n * link and a 3D model's file go in `url`, with no ids. Sent when the SDK has no `openGallery`\n * (Twilight before 2.14.569) or declines inside the app, so those stores keep the gallery they had.\n */\nfunction legacyGalleryMedia(images: ProductImage[]): GalleryMedia[] {\n return images.flatMap<GalleryMedia>((image) => {\n if (image.three_d_image_url) return [{ url: image.three_d_image_url, type: '3d-image' }];\n if (image.video_url) return [{ url: image.video_url, type: 'video' }];\n return image.url ? [{ url: image.url, type: 'image' }] : [];\n });\n}\n\nfunction ProductGalleryContent({ product }: ProductGalleryProps) {\n const { t } = useTranslation();\n const { theme } = useTwilight();\n const sliderId = `details-slider-${product.id}`;\n const objectFit = theme.settings.slider_background_size ?? 'cover';\n\n // Clicking an image opens an in-app lightbox instead of navigating to the CDN URL.\n const [preview, setPreview] = useState<ImagePreview | null>(null);\n\n useEffect(() => {\n const raf = requestAnimationFrame(() => {\n const el = document.getElementById(sliderId);\n if (!el?.parentElement) return;\n const { parentElement, nextSibling } = el;\n parentElement.removeChild(el);\n parentElement.insertBefore(el, nextSibling);\n });\n return () => cancelAnimationFrame(raf);\n }, [sliderId]);\n\n // The product-details API only returns `image` (singular).\n // Fall back so the main image always renders even without the full gallery array.\n const images: ProductImage[] =\n product.images && product.images.length > 0\n ? product.images\n : product.image?.url\n ? [product.image]\n : [];\n\n const hasManyImages = images.length > 1;\n const openNativeGallery = (selected: ProductImage) => {\n if (!isNativeApp()) return false;\n if (window.salla?.mobile?.openGallery?.(images, selected)) return true;\n window.salla?.event.dispatch('mobile::gallery.open', { images: legacyGalleryMedia(images) });\n return true;\n };\n\n return (\n <div className=\"sidebar md:sticky top-24 w-full md:!w-2/4 rtl:ml-8 ltr:mr-8 pb-8 md:pb-16 overflow-hidden shrink-0\">\n <SallaSlider\n id={sliderId}\n className=\"details-slider rounded-md image-slider\"\n type=\"thumbs\"\n loop={false}\n autoHeight\n listenToThumbnailsOption\n showThumbsControls={false}\n sliderConfig={{ watchOverflow: true, autoHeight: true }}\n >\n {product.promotion_title && (\n <div className=\"promotion-title\">{product.promotion_title}</div>\n )}\n\n {product.calories && (\n <div className=\"absolute z-[2] top-4 rtl:left-4 ltr:right-4 bg-white shadow-sm flex flex-col justify-center items-center rounded-full w-20 h-20 md:w-24 md:h-24\">\n <span className=\"text-red-500 text-xl leading-none font-bold\">{product.calories}</span>\n <span className=\"text-xs text-gray-500\">\n {t('pages.products.calories', 'Calories')}\n </span>\n </div>\n )}\n\n <div slot=\"items\">\n {images.map((image, index) => (\n <ImageSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n product={product}\n index={index}\n objectFit={objectFit}\n onPreview={setPreview}\n onNativeOpen={openNativeGallery}\n />\n ))}\n </div>\n\n {hasManyImages && (\n <div slot=\"thumbs\">\n {images.map((image, index) => (\n <ThumbSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n index={index}\n />\n ))}\n </div>\n )}\n </SallaSlider>\n\n <Suspense fallback={null}>\n <ImageModal\n isOpen={!!preview}\n onClose={() => setPreview(null)}\n src={preview?.src ?? ''}\n alt={preview?.alt}\n />\n </Suspense>\n </div>\n );\n}\n\nexport function ProductGallery(props: ProductGalleryProps) {\n useRenderProbe('ProductGallery');\n const Component = useMemo(() => {\n const resolved = registry.resolve<ProductGalleryProps>(PRODUCT_GALLERY_KEY);\n // A theme that seeds the key with this component (register + override) would\n // otherwise recurse into itself when it has not actually overridden anything.\n return resolved === ProductGallery ? null : resolved;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductGalleryContent {...props} />;\n}\n\nfunction ImageSlide({\n image,\n product,\n index,\n objectFit,\n onPreview,\n onNativeOpen,\n}: {\n image: ProductImage;\n product: Product;\n index: number;\n objectFit: 'cover' | 'contain';\n onPreview: (preview: ImagePreview) => void;\n onNativeOpen: (image: ProductImage) => boolean;\n}) {\n const [loaded, setLoaded] = useState(false);\n const isVideo = Boolean(image.video_url);\n\n if (image.three_d_image_url) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: model-viewer is an interactive web component.\n <model-viewer\n style={{ minHeight: '500px' }}\n className=\"swiper-slide model-entry w-full h-full\"\n loading=\"lazy\"\n camera-controls\n touch-action=\"pan-y\"\n auto-rotate\n poster={image.url || undefined}\n src={image.three_d_image_url}\n shadow-intensity=\"1\"\n alt={image.alt}\n onClick={() => onNativeOpen(image)}\n ></model-viewer>\n );\n }\n\n return (\n <a\n data-fslightbox={`product_${product.id}`}\n data-img-id={image.id}\n data-slid-index={index}\n {...(image.video_url ? { 'data-video-src': image.video_url } : {})}\n data-caption={image.alt}\n data-infinite=\"false\"\n data-type={image.video_url ? 'youtube' : 'image'}\n href={image.video_url || image.url}\n // FsLightbox isn't loaded in this React theme, so the bare href would leave the SPA.\n // Open images in an in-app lightbox; let videos open in a new tab.\n {...(isVideo ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n onClick={(event) => {\n if (onNativeOpen(image)) {\n event.preventDefault();\n return;\n }\n if (isVideo || !image.url) return;\n event.preventDefault();\n onPreview({ src: image.url, alt: image.alt || product.name });\n }}\n aria-label={product.name}\n className={`swiper-slide magnify-wrapper homeslider__slide ${image.video_url ? 'video-entry' : ''}`}\n >\n <div className={`w-full ${loaded ? '' : 'aspect-square bg-gray-100 animate-pulse'}`}>\n <Image\n id={String(image.id)}\n src={image.url}\n alt={image.alt || product.name}\n className={`h-full w-full object-${objectFit}`}\n aspectRatio=\"1/1\"\n priority={index === 0}\n noWrapper\n onLoad={() => setLoaded(true)}\n />\n </div>\n </a>\n );\n}\n\nfunction ThumbSlide({ image, index }: { image: ProductImage; index: number }) {\n return (\n <div\n className={`slide--one-fourth ${image.video_url ? 'video-entry' : ''} ${image.three_d_image_url ? 'model-entry' : ''}`}\n data-caption={image.alt}\n >\n <Image\n src={image.url}\n alt={image.alt || ''}\n className=\"object-cover w-full h-full bg-gray-100 rounded-md overflow-hidden\"\n title={image.alt}\n priority={index < 5}\n noWrapper\n />\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/product/lazy.ts","../src/components/product/ProductGallery.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,aAAA;AAAA,EAAc,MAC9C,OAAO,8BAAkB,CAAA,CAAE,IAA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AAoB,aAAA,GAAgB,EAAE,CAAA,CAAA;AAAA,MACpH,gBAAc,KAAA,CAAM,GAAA;AAAA,MAEpB,QAAA,kBAAA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,KAAK,KAAA,CAAM,GAAA;AAAA,UACX,GAAA,EAAK,MAAM,GAAA,IAAO,EAAA;AAAA,UAClB,SAAA,EAAU,mEAAA;AAAA,UACV,OAAO,KAAA,CAAM,GAAA;AAAA,UACb,UAAU,KAAA,GAAQ,CAAA;AAAA,UAClB,SAAA,EAAS;AAAA;AAAA;AACX;AAAA,GACF;AAEJ","file":"chunk-DGPHTEZE.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\nexport const LazyProductDetails = lazyComponent(() =>\n import('./ProductDetails').then((m) => ({ default: m.ProductDetails }))\n);\n\nexport const LazyAddToCartForm = lazyComponent(() =>\n import('./AddToCartForm').then((m) => ({ default: m.AddToCartForm }))\n);\n","import { SallaSlider } from '@salla.sa/twilight-components-react/slider';\nimport { Suspense, useEffect, useMemo, useState } from 'react';\nimport { registry } from '../ComponentRegistry';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { Product, ProductImage } from '../../types';\nimport { Image } from '../common/Image';\nimport { ImageModal } from '../modal';\nimport { isNativeApp } from '../../native-app';\nimport { useRenderProbe } from '../../utils/render-probe';\n\nconst PRODUCT_GALLERY_KEY = 'product:gallery';\n\nexport interface ProductGalleryProps {\n product: Product;\n}\n\ntype ImagePreview = { src: string; alt: string };\ntype GalleryMedia = { url: string; type: 'image' | 'video' | '3d-image' };\n\n/**\n * The engine's own `mobile::gallery.open` payload from before `salla.mobile.openGallery`: a video's\n * link and a 3D model's file go in `url`, with no ids. Sent when the SDK has no `openGallery`\n * (Twilight before 2.14.569) or declines inside the app, so those stores keep the gallery they had.\n */\nfunction legacyGalleryMedia(images: ProductImage[]): GalleryMedia[] {\n return images.flatMap<GalleryMedia>((image) => {\n if (image.three_d_image_url) return [{ url: image.three_d_image_url, type: '3d-image' }];\n if (image.video_url) return [{ url: image.video_url, type: 'video' }];\n return image.url ? [{ url: image.url, type: 'image' }] : [];\n });\n}\n\nfunction ProductGalleryContent({ product }: ProductGalleryProps) {\n const { t } = useTranslation();\n const { theme } = useTwilight();\n const sliderId = `details-slider-${product.id}`;\n const objectFit = theme.settings.slider_background_size ?? 'cover';\n\n // Clicking an image opens an in-app lightbox instead of navigating to the CDN URL.\n const [preview, setPreview] = useState<ImagePreview | null>(null);\n\n useEffect(() => {\n const raf = requestAnimationFrame(() => {\n const el = document.getElementById(sliderId);\n if (!el?.parentElement) return;\n const { parentElement, nextSibling } = el;\n parentElement.removeChild(el);\n parentElement.insertBefore(el, nextSibling);\n });\n return () => cancelAnimationFrame(raf);\n }, [sliderId]);\n\n // The product-details API only returns `image` (singular).\n // Fall back so the main image always renders even without the full gallery array.\n const images: ProductImage[] =\n product.images && product.images.length > 0\n ? product.images\n : product.image?.url\n ? [product.image]\n : [];\n\n const hasManyImages = images.length > 1;\n const openNativeGallery = (selected: ProductImage) => {\n if (!isNativeApp()) return false;\n if (window.salla?.mobile?.openGallery?.(images, selected)) return true;\n window.salla?.event.dispatch('mobile::gallery.open', { images: legacyGalleryMedia(images) });\n return true;\n };\n\n return (\n <div className=\"sidebar md:sticky top-24 w-full md:!w-2/4 rtl:ml-8 ltr:mr-8 pb-8 md:pb-16 overflow-hidden shrink-0\">\n <SallaSlider\n id={sliderId}\n className=\"details-slider rounded-md image-slider\"\n type=\"thumbs\"\n loop={false}\n autoHeight\n listenToThumbnailsOption\n showThumbsControls={false}\n sliderConfig={{ watchOverflow: true, autoHeight: true }}\n >\n {product.promotion_title && (\n <div className=\"promotion-title\">{product.promotion_title}</div>\n )}\n\n {product.calories && (\n <div className=\"absolute z-[2] top-4 rtl:left-4 ltr:right-4 bg-white shadow-sm flex flex-col justify-center items-center rounded-full w-20 h-20 md:w-24 md:h-24\">\n <span className=\"text-red-500 text-xl leading-none font-bold\">{product.calories}</span>\n <span className=\"text-xs text-gray-500\">\n {t('pages.products.calories', 'Calories')}\n </span>\n </div>\n )}\n\n <div slot=\"items\">\n {images.map((image, index) => (\n <ImageSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n product={product}\n index={index}\n objectFit={objectFit}\n onPreview={setPreview}\n onNativeOpen={openNativeGallery}\n />\n ))}\n </div>\n\n {hasManyImages && (\n <div slot=\"thumbs\">\n {images.map((image, index) => (\n <ThumbSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n index={index}\n />\n ))}\n </div>\n )}\n </SallaSlider>\n\n <Suspense fallback={null}>\n <ImageModal\n isOpen={!!preview}\n onClose={() => setPreview(null)}\n src={preview?.src ?? ''}\n alt={preview?.alt}\n />\n </Suspense>\n </div>\n );\n}\n\nexport function ProductGallery(props: ProductGalleryProps) {\n useRenderProbe('ProductGallery');\n const Component = useMemo(() => {\n const resolved = registry.resolve<ProductGalleryProps>(PRODUCT_GALLERY_KEY);\n // A theme that seeds the key with this component (register + override) would\n // otherwise recurse into itself when it has not actually overridden anything.\n return resolved === ProductGallery ? null : resolved;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductGalleryContent {...props} />;\n}\n\nfunction ImageSlide({\n image,\n product,\n index,\n objectFit,\n onPreview,\n onNativeOpen,\n}: {\n image: ProductImage;\n product: Product;\n index: number;\n objectFit: 'cover' | 'contain';\n onPreview: (preview: ImagePreview) => void;\n onNativeOpen: (image: ProductImage) => boolean;\n}) {\n const [loaded, setLoaded] = useState(false);\n const isVideo = Boolean(image.video_url);\n\n if (image.three_d_image_url) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: model-viewer is an interactive web component.\n <model-viewer\n style={{ minHeight: '500px' }}\n className=\"swiper-slide model-entry w-full h-full\"\n loading=\"lazy\"\n camera-controls\n touch-action=\"pan-y\"\n auto-rotate\n poster={image.url || undefined}\n src={image.three_d_image_url}\n shadow-intensity=\"1\"\n alt={image.alt}\n onClick={() => onNativeOpen(image)}\n ></model-viewer>\n );\n }\n\n return (\n <a\n data-fslightbox={`product_${product.id}`}\n data-img-id={image.id}\n data-slid-index={index}\n {...(image.video_url ? { 'data-video-src': image.video_url } : {})}\n data-caption={image.alt}\n data-infinite=\"false\"\n data-type={image.video_url ? 'youtube' : 'image'}\n href={image.video_url || image.url}\n // FsLightbox isn't loaded in this React theme, so the bare href would leave the SPA.\n // Open images in an in-app lightbox; let videos open in a new tab.\n {...(isVideo ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n onClick={(event) => {\n if (onNativeOpen(image)) {\n event.preventDefault();\n return;\n }\n if (isVideo || !image.url) return;\n event.preventDefault();\n onPreview({ src: image.url, alt: image.alt || product.name });\n }}\n aria-label={product.name}\n className={`swiper-slide magnify-wrapper homeslider__slide ${image.video_url ? 'video-entry' : ''}`}\n >\n <div className={`w-full ${loaded ? '' : 'aspect-square bg-gray-100 animate-pulse'}`}>\n <Image\n id={String(image.id)}\n src={image.url}\n alt={image.alt || product.name}\n className={`h-full w-full object-${objectFit}`}\n aspectRatio=\"1/1\"\n priority={index === 0}\n noWrapper\n onLoad={() => setLoaded(true)}\n />\n </div>\n </a>\n );\n}\n\nfunction ThumbSlide({ image, index }: { image: ProductImage; index: number }) {\n return (\n <div\n className={`slide--one-fourth ${image.video_url ? 'video-entry' : ''} ${image.three_d_image_url ? 'model-entry' : ''}`}\n data-caption={image.alt}\n >\n <Image\n src={image.url}\n alt={image.alt || ''}\n className=\"object-cover w-full h-full bg-gray-100 rounded-md overflow-hidden\"\n title={image.alt}\n priority={index < 5}\n noWrapper\n />\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { filesCdn, cdn } from './chunk-
|
|
1
|
+
import { filesCdn, cdn } from './chunk-LC3M4HW7.js';
|
|
2
2
|
import { storeTranslationsQueryKey, translationsQueryKey, composeMessages, isPlainObject } from './chunk-MWUAHDQL.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -126,5 +126,5 @@ var translations = {
|
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
export { commonTranslationsPath, storeTranslationsPath, translations };
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-DIYLHIAT.js.map
|
|
130
|
+
//# sourceMappingURL=chunk-DIYLHIAT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/translations.ts"],"names":[],"mappings":";;;;AAiEA,IAAM,kBAAA,GAAqB,sBAAA;AAGpB,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,OAAO,uBAAuB,MAAM,CAAA,KAAA,CAAA;AACtC;AAWO,SAAS,qBAAA,CAAsB,SAA0B,MAAA,EAAwB;AACtF,EAAA,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,KAAA,CAAA;AAC1C;AAUA,eAAe,eACb,IAAA,EACA,EAAE,aAAa,KAAA,EAAM,GAA8B,EAAC,EAC1B;AAE1B,EAAA,MAAM,UAAA,GAAa,CAAC,MAAA,EAAgB,KAAA,KAA0B;AAC5D,IAAA,IAAI,UAAA,EAAY,MAAM,IAAI,KAAA,CAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,EAAI,EAAE,KAAA,EAAO,CAAA;AAC9E,IAAA,OAAA,CAAQ,IAAA,CAAK,gBAAA,EAAkB,MAAA,EAAQ,IAAA,EAAM,SAAS,EAAE,CAAA;AACxD,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,QAAA,GAAW,MAAM,QAAA,CAAS,GAAA,CAAI,IAAA,EAAM,EAAE,eAAA,EAAiB,KAAA,EAAO,OAAA,EAAS,GAAA,EAAM,CAAA;AACn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":"chunk-3CZYFTKP.js","sourcesContent":["/**\n * @fileoverview Where a storefront's words come from.\n *\n * Two files, merged: the platform's copy for this language, and the merchant's\n * own edits for this language and this store. Both are plain JSON objects on\n * the uploader's CDN, one per language.\n *\n * ```\n * https://cdn.files.salla.network/translations/common/<locale>.json the platform's\n * https://cdn.files.salla.network/translations/<storeId>/<locale>.json the merchant's\n * ```\n *\n * **What this replaces, and why.** Until now the engine read a single global\n * file, `cdn.salla.network/js/translations.json`, holding every language keyed\n * `\"<locale>.trans\"`. Nothing publishes that file: it is an object last written\n * on 2026-03-26, carrying only `ar` and `en` where the platform has 39 locales,\n * 405 keys behind `Languages-Module` and 959 English strings textually\n * different from it. So every React storefront has been serving copy from\n * March, and a key added since has never reached one. It also carried no\n * merchant overrides at all — a merchant editing their theme's wording in the\n * Dashboard changed nothing on a React theme.\n *\n * **Merchant overrides are read, and only when there are any.** Getting here\n * took two corrections worth keeping.\n *\n * The first is the address. A merchant's own wording lives at\n * `translations/<storeId>/<locale>.json`, keyed by `store()->getRouteKey()` —\n * the Optimus-encoded numeric id. An early version addressed it with\n * `resolveStoreIdentifier()`, on the claim that the two are the same string.\n * That is true of the `store-identifier` *header*, which accepts a host, a\n * username or an id, and false of the R2 key: on a custom domain the resolver\n * returns `reefperfumes.com` and on a shared host a username like\n * `mtgr-alaatr-2`. Both 404, both then read as \"this store has no overrides\",\n * and the merchant's wording silently never appears — so the feature would have\n * worked under `?storeId=` alone, which is preview and localhost. It is\n * `settings.store.id` now, which is known only after the settings query.\n *\n * The second is when to ask at all. Most stores have never customised a word,\n * and a miss is an uncached round trip (`cf-cache-status: DYNAMIC` on the 404)\n * on the critical path of every SSR render. So the request is made only when\n * `settings.languages[<ISO>].has_custom_translations` says there is something\n * to get — a flag `Languages-Module` writes when a merchant saves a\n * translation. A store without overrides pays nothing, which is what made this\n * shippable at all.\n *\n * ⚠️ The flag is written on save, so a store whose wording predates it reads as\n * `false` until someone edits a translation or the backfill runs. That is a\n * store keeping today's behaviour, not a regression — React themes have never\n * read merchant overrides — but it does mean the feature is only as complete as\n * the backfill.\n *\n * **Rollout is by fallback, not by flag.** `translations/common/` is written by\n * a sync in the theme build service that may not have run yet, and a hard switch\n * would leave every storefront with no platform strings at all. A missing common\n * file therefore falls back to the old global one, which is exactly today's\n * behaviour — so this is safe to ship before the bucket is populated, and stops\n * using the fallback on its own once it is.\n */\nimport { queryOptions } from '@tanstack/react-query';\nimport { cdn, filesCdn } from './client';\nimport { storeTranslationsQueryKey, translationsQueryKey } from './translations-key';\nimport { composeMessages, isPlainObject, type Messages } from './messages';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\n/** The global file this used to be the only reader of. See the file comment. */\nconst LEGACY_GLOBAL_FILE = 'js/translations.json';\n\n/** One language of platform copy, shared by every store. */\nexport function commonTranslationsPath(locale: string): string {\n return `translations/common/${locale}.json`;\n}\n\n/**\n * One language of a single merchant's own wording.\n *\n * `storeId` is `settings.store.id`, which is the value `Languages-Module` names\n * the object with (`store()->getRouteKey()`, the Optimus-encoded numeric id).\n * It is **not** `resolveStoreIdentifier()`: that returns a hostname on a custom\n * domain and a username on a shared host, both of which 404 here and would read\n * as \"this merchant has no overrides\" — silently, on every store but a preview.\n */\nexport function storeTranslationsPath(storeId: string | number, locale: string): string {\n return `translations/${storeId}/${locale}.json`;\n}\n\n/**\n * Reads one language file, or `null` when there is nothing to read.\n *\n * A 404 is the ordinary answer, not a failure: most stores have never had a\n * word customised, so their file does not exist. Distinguishing it from a real\n * error matters only for the log — both end in `null` — but a warning on every\n * page load of every uncustomised store is a warning nobody will read.\n */\nasync function readLocaleFile(\n path: string,\n { failLoudly = false }: { failLoudly?: boolean } = {}\n): Promise<Messages | null> {\n /** A 404 always means \"absent\"; everything else is a failure to read. */\n const unreadable = (reason: string, cause?: unknown): null => {\n if (failLoudly) throw new Error(`[translations] ${path}: ${reason}`, { cause });\n console.warn('[translations]', reason, path, cause ?? '');\n return null;\n };\n\n try {\n const response = await filesCdn.get(path, { throwHttpErrors: false, timeout: 5000 });\n if (response.status === 404) return null;\n\n if (!response.ok) {\n return unreadable(`answered ${response.status}`);\n }\n\n const data: unknown = await response.json();\n if (!isPlainObject(data)) {\n return unreadable('is not a JSON object');\n }\n\n return data;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith('[translations]')) throw error;\n return unreadable('could not be read', error);\n }\n}\n\n/**\n * The pre-CDN global file, sliced to one language.\n *\n * Only reached when `translations/common/<locale>.json` is missing, which is\n * the state of the bucket until the sync has run once.\n */\nasync function readLegacyGlobal(locale: string): Promise<Messages | null> {\n try {\n const data = await cdn.get(LEGACY_GLOBAL_FILE, { timeout: 5000 }).json<TranslationMessages>();\n const forLocale = data?.[`${locale}.trans`];\n return isPlainObject(forLocale) ? forLocale : null;\n } catch {\n console.warn('[translations] the legacy global file could not be read either');\n return null;\n }\n}\n\nexport const translations = {\n /**\n * The platform's copy for `locale`.\n *\n * One file, so one request. See the file comment for why the merchant's own\n * wording is not merged in here yet and what it is waiting on.\n */\n get: async (locale: string): Promise<TranslationMessages | null> => {\n const common = await readLocaleFile(commonTranslationsPath(locale));\n const base = common ?? (await readLegacyGlobal(locale));\n if (!base) return null;\n\n // Still wrapped in the `<locale>.trans` shape the rest of the engine reads.\n // `createI18nInstance` slices by that key and so does the SDK bridge in\n // `I18nProvider`; changing the envelope here would be a second change for\n // no gain, since one language is all any of them ever take out of it.\n return { [`${locale}.trans`]: base as Record<string, string> };\n },\n\n /**\n * This merchant's own wording for `locale`, or `null` if they have none.\n *\n * Only worth calling when `settings.languages[<ISO>].has_custom_translations`\n * says there is something to get. Most stores have never customised a word,\n * and a miss here is an uncached round trip — `cf-cache-status: DYNAMIC` on a\n * 404 — on the critical path of an SSR render. The flag is what makes this\n * free for everyone who does not use it.\n *\n * Returned unwrapped, unlike {@link translations.get}: this is merged into\n * that one's messages rather than handed to i18next on its own.\n */\n forStore: async (storeId: string | number, locale: string): Promise<Messages | null> =>\n // `failLoudly`, unlike the platform file: this is only ever called because\n // the settings said overrides exist, so a 500, a timeout or a body that is\n // not JSON is a failure to read them — not a store that has none. Returning\n // `null` there would cache \"no overrides\" as a success, skip the query's\n // retry, and serve Salla's wording in place of the merchant's until the\n // entry expired. A 404 still means absent, and `rootBeforeLoad` catches the\n // throw and keeps the platform copy, so the worst case is unchanged.\n readLocaleFile(storeTranslationsPath(storeId, locale), { failLoudly: true }),\n\n /**\n * The platform's copy for `locale` with this merchant's wording laid over it.\n *\n * Takes the two as values rather than fetching them, so the caller decides\n * whether the second request happens at all and both stay separately cached.\n */\n /**\n * The platform's copy for `locale` with this merchant's wording over it.\n *\n * Delegates to `composeMessages`, which every other reader of these two\n * entries also uses — see `api/messages.ts` for why there is exactly one.\n */\n merge: (\n common: TranslationMessages | null,\n overrides: Messages | null,\n locale: string\n ): TranslationMessages | null => composeMessages(common, overrides, locale) ?? null,\n\n queries: {\n /**\n * @param locale taken as an argument rather than read from the twilight\n * context, and that is load-bearing. This key is built on the server, on\n * hydration, and again lazily from the context accessor; if any of the\n * three read a locale the others had not been given yet, the hydrated page\n * would miss the dehydrated entry and refetch both files it was just\n * handed. Every caller already has the locale in hand.\n *\n * The store is deliberately **not** in the key. One document serves one\n * store — a request that names a different one is redirected with\n * `reloadDocument`, so the client never changes store under a live cache —\n * and adding a value that resolves from the request on the server and from\n * the injected env on the client is how a key stops matching across\n * hydration.\n */\n byLocale: (locale: string) =>\n queryOptions({\n queryKey: translationsQueryKey(locale),\n queryFn: () => translations.get(locale),\n }),\n\n /**\n * This merchant's overrides, cached apart from the platform's copy.\n *\n * Its own entry rather than a wider `byLocale` key, so the common file is\n * fetched and dehydrated once per language whatever the store does, and a\n * store with no overrides never has an entry at all. Both sides compute the\n * key from the settings payload, so the hydrated page finds what the server\n * dehydrated instead of refetching it.\n */\n byStore: (storeId: string | number, locale: string) =>\n queryOptions({\n queryKey: storeTranslationsQueryKey(storeId, locale),\n queryFn: () => translations.forStore(storeId, locale),\n }),\n },\n};\n"]}
|
|
1
|
+
{"version":3,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;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzC,cAAA,CAAe,sBAAsB,OAAA,EAAS,MAAM,GAAG,EAAE,UAAA,EAAY,MAAM;AAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc7E,KAAA,EAAO,CACL,MAAA,EACA,SAAA,EACA,WAC+B,eAAA,CAAgB,MAAA,EAAQ,SAAA,EAAW,MAAM,CAAA,IAAK,IAAA;AAAA,EAE/E,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBP,QAAA,EAAU,CAAC,MAAA,KACT,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,qBAAqB,MAAM,CAAA;AAAA,MACrC,OAAA,EAAS,MAAM,YAAA,CAAa,GAAA,CAAI,MAAM;AAAA,KACvC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWH,OAAA,EAAS,CAAC,OAAA,EAA0B,MAAA,KAClC,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,yBAAA,CAA0B,OAAA,EAAS,MAAM,CAAA;AAAA,MACnD,OAAA,EAAS,MAAM,YAAA,CAAa,QAAA,CAAS,SAAS,MAAM;AAAA,KACrD;AAAA;AAEP","file":"chunk-DIYLHIAT.js","sourcesContent":["/**\n * @fileoverview Where a storefront's words come from.\n *\n * Two files, merged: the platform's copy for this language, and the merchant's\n * own edits for this language and this store. Both are plain JSON objects on\n * the uploader's CDN, one per language.\n *\n * ```\n * https://cdn.files.salla.network/translations/common/<locale>.json the platform's\n * https://cdn.files.salla.network/translations/<storeId>/<locale>.json the merchant's\n * ```\n *\n * **What this replaces, and why.** Until now the engine read a single global\n * file, `cdn.salla.network/js/translations.json`, holding every language keyed\n * `\"<locale>.trans\"`. Nothing publishes that file: it is an object last written\n * on 2026-03-26, carrying only `ar` and `en` where the platform has 39 locales,\n * 405 keys behind `Languages-Module` and 959 English strings textually\n * different from it. So every React storefront has been serving copy from\n * March, and a key added since has never reached one. It also carried no\n * merchant overrides at all — a merchant editing their theme's wording in the\n * Dashboard changed nothing on a React theme.\n *\n * **Merchant overrides are read, and only when there are any.** Getting here\n * took two corrections worth keeping.\n *\n * The first is the address. A merchant's own wording lives at\n * `translations/<storeId>/<locale>.json`, keyed by `store()->getRouteKey()` —\n * the Optimus-encoded numeric id. An early version addressed it with\n * `resolveStoreIdentifier()`, on the claim that the two are the same string.\n * That is true of the `store-identifier` *header*, which accepts a host, a\n * username or an id, and false of the R2 key: on a custom domain the resolver\n * returns `reefperfumes.com` and on a shared host a username like\n * `mtgr-alaatr-2`. Both 404, both then read as \"this store has no overrides\",\n * and the merchant's wording silently never appears — so the feature would have\n * worked under `?storeId=` alone, which is preview and localhost. It is\n * `settings.store.id` now, which is known only after the settings query.\n *\n * The second is when to ask at all. Most stores have never customised a word,\n * and a miss is an uncached round trip (`cf-cache-status: DYNAMIC` on the 404)\n * on the critical path of every SSR render. So the request is made only when\n * `settings.languages[<ISO>].has_custom_translations` says there is something\n * to get — a flag `Languages-Module` writes when a merchant saves a\n * translation. A store without overrides pays nothing, which is what made this\n * shippable at all.\n *\n * ⚠️ The flag is written on save, so a store whose wording predates it reads as\n * `false` until someone edits a translation or the backfill runs. That is a\n * store keeping today's behaviour, not a regression — React themes have never\n * read merchant overrides — but it does mean the feature is only as complete as\n * the backfill.\n *\n * **Rollout is by fallback, not by flag.** `translations/common/` is written by\n * a sync in the theme build service that may not have run yet, and a hard switch\n * would leave every storefront with no platform strings at all. A missing common\n * file therefore falls back to the old global one, which is exactly today's\n * behaviour — so this is safe to ship before the bucket is populated, and stops\n * using the fallback on its own once it is.\n */\nimport { queryOptions } from '@tanstack/react-query';\nimport { cdn, filesCdn } from './client';\nimport { storeTranslationsQueryKey, translationsQueryKey } from './translations-key';\nimport { composeMessages, isPlainObject, type Messages } from './messages';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\n/** The global file this used to be the only reader of. See the file comment. */\nconst LEGACY_GLOBAL_FILE = 'js/translations.json';\n\n/** One language of platform copy, shared by every store. */\nexport function commonTranslationsPath(locale: string): string {\n return `translations/common/${locale}.json`;\n}\n\n/**\n * One language of a single merchant's own wording.\n *\n * `storeId` is `settings.store.id`, which is the value `Languages-Module` names\n * the object with (`store()->getRouteKey()`, the Optimus-encoded numeric id).\n * It is **not** `resolveStoreIdentifier()`: that returns a hostname on a custom\n * domain and a username on a shared host, both of which 404 here and would read\n * as \"this merchant has no overrides\" — silently, on every store but a preview.\n */\nexport function storeTranslationsPath(storeId: string | number, locale: string): string {\n return `translations/${storeId}/${locale}.json`;\n}\n\n/**\n * Reads one language file, or `null` when there is nothing to read.\n *\n * A 404 is the ordinary answer, not a failure: most stores have never had a\n * word customised, so their file does not exist. Distinguishing it from a real\n * error matters only for the log — both end in `null` — but a warning on every\n * page load of every uncustomised store is a warning nobody will read.\n */\nasync function readLocaleFile(\n path: string,\n { failLoudly = false }: { failLoudly?: boolean } = {}\n): Promise<Messages | null> {\n /** A 404 always means \"absent\"; everything else is a failure to read. */\n const unreadable = (reason: string, cause?: unknown): null => {\n if (failLoudly) throw new Error(`[translations] ${path}: ${reason}`, { cause });\n console.warn('[translations]', reason, path, cause ?? '');\n return null;\n };\n\n try {\n const response = await filesCdn.get(path, { throwHttpErrors: false, timeout: 5000 });\n if (response.status === 404) return null;\n\n if (!response.ok) {\n return unreadable(`answered ${response.status}`);\n }\n\n const data: unknown = await response.json();\n if (!isPlainObject(data)) {\n return unreadable('is not a JSON object');\n }\n\n return data;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith('[translations]')) throw error;\n return unreadable('could not be read', error);\n }\n}\n\n/**\n * The pre-CDN global file, sliced to one language.\n *\n * Only reached when `translations/common/<locale>.json` is missing, which is\n * the state of the bucket until the sync has run once.\n */\nasync function readLegacyGlobal(locale: string): Promise<Messages | null> {\n try {\n const data = await cdn.get(LEGACY_GLOBAL_FILE, { timeout: 5000 }).json<TranslationMessages>();\n const forLocale = data?.[`${locale}.trans`];\n return isPlainObject(forLocale) ? forLocale : null;\n } catch {\n console.warn('[translations] the legacy global file could not be read either');\n return null;\n }\n}\n\nexport const translations = {\n /**\n * The platform's copy for `locale`.\n *\n * One file, so one request. See the file comment for why the merchant's own\n * wording is not merged in here yet and what it is waiting on.\n */\n get: async (locale: string): Promise<TranslationMessages | null> => {\n const common = await readLocaleFile(commonTranslationsPath(locale));\n const base = common ?? (await readLegacyGlobal(locale));\n if (!base) return null;\n\n // Still wrapped in the `<locale>.trans` shape the rest of the engine reads.\n // `createI18nInstance` slices by that key and so does the SDK bridge in\n // `I18nProvider`; changing the envelope here would be a second change for\n // no gain, since one language is all any of them ever take out of it.\n return { [`${locale}.trans`]: base as Record<string, string> };\n },\n\n /**\n * This merchant's own wording for `locale`, or `null` if they have none.\n *\n * Only worth calling when `settings.languages[<ISO>].has_custom_translations`\n * says there is something to get. Most stores have never customised a word,\n * and a miss here is an uncached round trip — `cf-cache-status: DYNAMIC` on a\n * 404 — on the critical path of an SSR render. The flag is what makes this\n * free for everyone who does not use it.\n *\n * Returned unwrapped, unlike {@link translations.get}: this is merged into\n * that one's messages rather than handed to i18next on its own.\n */\n forStore: async (storeId: string | number, locale: string): Promise<Messages | null> =>\n // `failLoudly`, unlike the platform file: this is only ever called because\n // the settings said overrides exist, so a 500, a timeout or a body that is\n // not JSON is a failure to read them — not a store that has none. Returning\n // `null` there would cache \"no overrides\" as a success, skip the query's\n // retry, and serve Salla's wording in place of the merchant's until the\n // entry expired. A 404 still means absent, and `rootBeforeLoad` catches the\n // throw and keeps the platform copy, so the worst case is unchanged.\n readLocaleFile(storeTranslationsPath(storeId, locale), { failLoudly: true }),\n\n /**\n * The platform's copy for `locale` with this merchant's wording laid over it.\n *\n * Takes the two as values rather than fetching them, so the caller decides\n * whether the second request happens at all and both stay separately cached.\n */\n /**\n * The platform's copy for `locale` with this merchant's wording over it.\n *\n * Delegates to `composeMessages`, which every other reader of these two\n * entries also uses — see `api/messages.ts` for why there is exactly one.\n */\n merge: (\n common: TranslationMessages | null,\n overrides: Messages | null,\n locale: string\n ): TranslationMessages | null => composeMessages(common, overrides, locale) ?? null,\n\n queries: {\n /**\n * @param locale taken as an argument rather than read from the twilight\n * context, and that is load-bearing. This key is built on the server, on\n * hydration, and again lazily from the context accessor; if any of the\n * three read a locale the others had not been given yet, the hydrated page\n * would miss the dehydrated entry and refetch both files it was just\n * handed. Every caller already has the locale in hand.\n *\n * The store is deliberately **not** in the key. One document serves one\n * store — a request that names a different one is redirected with\n * `reloadDocument`, so the client never changes store under a live cache —\n * and adding a value that resolves from the request on the server and from\n * the injected env on the client is how a key stops matching across\n * hydration.\n */\n byLocale: (locale: string) =>\n queryOptions({\n queryKey: translationsQueryKey(locale),\n queryFn: () => translations.get(locale),\n }),\n\n /**\n * This merchant's overrides, cached apart from the platform's copy.\n *\n * Its own entry rather than a wider `byLocale` key, so the common file is\n * fetched and dehydrated once per language whatever the store does, and a\n * store with no overrides never has an entry at all. Both sides compute the\n * key from the settings payload, so the hydrated page finds what the server\n * dehydrated instead of refetching it.\n */\n byStore: (storeId: string | number, locale: string) =>\n queryOptions({\n queryKey: storeTranslationsQueryKey(storeId, locale),\n queryFn: () => translations.forStore(storeId, locale),\n }),\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { orThrow } from './chunk-
|
|
2
|
-
import { getActiveScope, api } from './chunk-
|
|
1
|
+
import { orThrow } from './chunk-KUROVEJP.js';
|
|
2
|
+
import { getActiveScope, api } from './chunk-LC3M4HW7.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-E22CFO2G.js.map
|
|
30
|
+
//# sourceMappingURL=chunk-E22CFO2G.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/category.ts"],"names":[],"mappings":";;;;AAKO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,EAAA,KAAkC;AAC7C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,WAAA,EAAc,EAAE,CAAA,CAAE,CAAA,CAAE,IAAA,EAAyB;AAC5E,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,EAAA,KAAkC,QAAQ,QAAA,CAAS,IAAA,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-
|
|
1
|
+
{"version":3,"sources":["../src/api/category.ts"],"names":[],"mappings":";;;;AAKO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,EAAA,KAAkC;AAC7C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,WAAA,EAAc,EAAE,CAAA,CAAE,CAAA,CAAE,IAAA,EAAyB;AAC5E,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,EAAA,KAAkC,QAAQ,QAAA,CAAS,IAAA,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-E22CFO2G.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,5 +1,5 @@
|
|
|
1
|
-
import { GTM_PAGE_DATA_WAIT_MS, whenGtmPageData } from './chunk-
|
|
2
|
-
import { DATA_LAYER_PROXY_SCRIPT } from './chunk-
|
|
1
|
+
import { GTM_PAGE_DATA_WAIT_MS, whenGtmPageData } from './chunk-HZECUTW5.js';
|
|
2
|
+
import { DATA_LAYER_PROXY_SCRIPT } from './chunk-JBKUYGDE.js';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
function containerScript(gtmId) {
|
|
@@ -63,5 +63,5 @@ function GoogleTagBody({ gtmIds }) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export { GTM_LOAD_DELAY_MS, GoogleTagBody };
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-E42GOEFC.js.map
|
|
67
|
+
//# sourceMappingURL=chunk-E42GOEFC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tracking/GoogleTag.tsx"],"names":[],"mappings":";;;;AAUA,SAAS,gBAAgB,KAAA,EAAuB;AAC9C,EAAA,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA,wCAAA,EAIiC,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA,EAAA,CAAA;AAC/D;AAGA,SAAS,UAAU,MAAA,EAAmC;AACpD,EAAA,OAAO,CAAC,yBAAyB,GAAG,MAAA,CAAO,IAAI,eAAe,CAAC,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA;AAC5E;AAEA,IAAM,qBAAqB,CAAC,aAAA,EAAe,SAAA,EAAW,YAAA,EAAc,UAAU,OAAO,CAAA;AAG9E,IAAM,i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{ GTM_PAGE_DATA_WAIT_MS, whenGtmPageData } from '../../lib/analytics/gtm-page';\n\nexport interface GoogleTagBodyProps {\n /** GTM container IDs; every one is loaded, as on Twig. Empty or missing renders nothing. */\n gtmIds?: string[];\n}\n\n/** One container's loader, Google's snippet. */\nfunction containerScript(gtmId: string): string {\n return `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\nnew Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\nj=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n})(window,document,'script','dataLayer',${JSON.stringify(gtmId)});`;\n}\n\n/** Every container, in the settings' order: Salla's first, then the merchant's own. */\nfunction gtmScript(gtmIds: readonly string[]): string {\n return [DATA_LAYER_PROXY_SCRIPT, ...gtmIds.map(containerScript)].join('\\n');\n}\n\nconst INTERACTION_EVENTS = ['pointerdown', 'keydown', 'touchstart', 'scroll', 'wheel'] as const;\n\n/** How long after `load` GTM waits for a visitor who never interacts. */\nexport const GTM_LOAD_DELAY_MS = 4000;\n\n/** Distinct container ids, in order. */\nfunction containerIds(gtmIds: readonly string[] | undefined): string[] {\n return [...new Set((gtmIds ?? []).map((id) => id?.trim()).filter(Boolean))];\n}\n\n/**\n * Injects GTM on the first interaction or GTM_LOAD_DELAY_MS after `load`, off the page's load\n * path, once the first page's data is in the data layer (at most GTM_PAGE_DATA_WAIT_MS later).\n */\nexport function GoogleTagBody({ gtmIds }: GoogleTagBodyProps): null {\n const ids = containerIds(gtmIds);\n const idsKey = ids.join(',');\n\n useEffect(() => {\n const containers = idsKey ? idsKey.split(',') : [];\n if (!containers.length) return;\n\n let timer: number | undefined;\n let pageDataTimer: number | undefined;\n let cancelled = false;\n const stopWaiting = () => {\n window.clearTimeout(timer);\n window.removeEventListener('load', onLoad);\n INTERACTION_EVENTS.forEach((type) => window.removeEventListener(type, inject));\n };\n function append() {\n window.clearTimeout(pageDataTimer);\n if (cancelled || document.getElementById('gtm-script')) return;\n const script = document.createElement('script');\n script.id = 'gtm-script';\n script.textContent = gtmScript(containers);\n document.head.appendChild(script);\n }\n function inject() {\n stopWaiting();\n // A container's tags read the page's data when `gtm.js` fires, as on Twig.\n pageDataTimer = window.setTimeout(append, GTM_PAGE_DATA_WAIT_MS);\n void whenGtmPageData().then(append);\n }\n function onLoad() {\n timer = window.setTimeout(inject, GTM_LOAD_DELAY_MS);\n }\n\n INTERACTION_EVENTS.forEach((type) =>\n window.addEventListener(type, inject, { once: true, passive: true })\n );\n if (document.readyState === 'complete') onLoad();\n else window.addEventListener('load', onLoad, { once: true });\n\n return () => {\n cancelled = true;\n stopWaiting();\n window.clearTimeout(pageDataTimer);\n document.getElementById('gtm-script')?.remove();\n };\n }, [idsKey]);\n\n return null;\n}\n"]}
|
|
@@ -227,5 +227,5 @@ function useCanvasHost() {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
export { matchBlocks, postToCanvas, takeCanvasCommands, useCanvasHost };
|
|
230
|
-
//# sourceMappingURL=chunk-
|
|
231
|
-
//# sourceMappingURL=chunk-
|
|
230
|
+
//# sourceMappingURL=chunk-EJNBREFC.js.map
|
|
231
|
+
//# sourceMappingURL=chunk-EJNBREFC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/live-editor/canvas.ts"],"names":[],"mappings":";;;;;;;AAcA,IAAM,KAAA,GAAQ,cAAA;AACd,IAAM,IAAA,GAAO,mBAAA;AAGN,IAAM,cAAA,GAAiB;AAAA,EAC5B,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,4BAAA;AAAA,EACA;AACF,CAAA;AAmCA,IAAM,QAAQ,CAAC,KAAA,KACb,OAAO,KAAA,KAAU,QAAA,IAAY,QAAQ,KAAA,GAAQ,IAAA;AAE/C,IAAM,SAAS,CAAC,KAAA,KACd,UAAU,MAAA,IAAU,KAAA,KAAU,SAAS,KAAA,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AAa,MAAA,EAAQ,EAAE,IAAA,EAAM,OAAA,EAAS,GAAA,EAAK,CAAC,GAAG,UAAU,CAAA,EAAG,CAAA;AAChF,IAAA,MAAA,CAAO,gBAAA,CAAiB,WAAW,SAAS,CAAA;AAC5C,IAAA,IAAI,QAAA,CAAS,UAAA,KAAe,UAAA,EAAY,KAAA,EAAM;AAAA,gBAClC,gBAAA,CAAiB,MAAA,EAAQ,OAAO,EAAE,IAAA,EAAM,MAAM,CAAA;AAC1D,IAAA,OAAO,MAAM;AACX,MAAA,MAAA,CAAO,mBAAA,CAAoB,WAAW,SAAS,CAAA;AAC/C,MAAA,MAAA,CAAO,mBAAA,CAAoB,QAAQ,KAAK,CAAA;AAAA,IAC1C,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,IAAA;AACT","file":"chunk-UBU4OIGW.js","sourcesContent":["/**\n * The storefront's side of the design studio's canvas mode: the studio frames\n * the store and draws its own cards and panels, and the store outlines what the\n * merchant points at and reports what is picked. The same `postMessage`\n * protocol the twig themes' `live-themes-editor.js` speaks in canvas mode.\n */\n\nimport { useEffect, useState } from 'react';\nimport { isEditorFrame } from '../../dev/schema-types';\nimport { getTwilightContext } from '../../twilight/context';\nimport { parentOrigin } from './frame';\nimport { drawLiveBlocks } from './moves';\nimport { getRedrawer, type Redrawer } from './redrawer';\n\nconst CHILD = 'salla-canvas';\nconst HOST = 'salla-canvas-host';\n\n/** Where the studio runs; it alone turns canvas mode on. */\nexport const CANVAS_ORIGINS = [\n 'https://s.salla.sa',\n 'https://s.salla.dev',\n 'https://s.beta.salla.group',\n 'http://localhost:9000',\n] as const;\n\nexport type CanvasRole = 'component' | 'header' | 'footer';\n\n/** The header's or footer's own logo or menu, picked on its own. */\nexport type CanvasPart = 'logo' | 'menu';\n\n/**\n * A home block as the studio lists it, in page order. The storefront's blocks\n * carry no row id, so the studio's list names them: `eid` is what the studio\n * calls the block, matched to the page by its uuid (`key`) or its `slug`.\n */\nexport interface CanvasBlock {\n eid: string;\n key?: string | null;\n slug?: string | null;\n title?: string | null;\n}\n\nexport type CanvasCommand =\n | { type: 'select'; eid: string; part?: CanvasPart }\n | { type: 'deselect' }\n | { type: 'move'; eid: string; direction: 'up' | 'down' }\n /** Lays the blocks out in this order without saving it. */\n | { type: 'order'; eids: string[] }\n /** Holds a block's place with a box named `label` until the page draws it; no label takes the box off. */\n | { type: 'adding'; label: string | null; anchor: string | null; place: 'before' | 'after' };\n\nexport interface CanvasHost {\n /** The studio's origin once it has spoken, else `null`: the page is not in canvas mode. */\n origin: string | null;\n enabled: boolean;\n blocks: CanvasBlock[] | null;\n}\n\nconst asEid = (value: unknown): string | null =>\n typeof value === 'string' && value ? value : null;\n\nconst asPart = (value: unknown): CanvasPart | undefined =>\n value === 'logo' || value === 'menu' ? value : undefined;\n\nfunction asBlocks(value: unknown): CanvasBlock[] | null {\n if (!Array.isArray(value)) return null;\n return value.flatMap((item) => {\n const block = item as Partial<CanvasBlock> | null;\n const eid = asEid(block?.eid);\n if (!eid) return [];\n return [\n {\n eid,\n key: typeof block?.key === 'string' ? block.key : null,\n slug: typeof block?.slug === 'string' ? block.slug : null,\n title: typeof block?.title === 'string' ? block.title : null,\n },\n ];\n });\n}\n\n/** The command a studio message carries, if it is a well-formed one. */\nexport function readCommand(data: Record<string, unknown>): CanvasCommand | null {\n switch (data.type) {\n case 'select': {\n const eid = asEid(data.eid);\n return eid ? { type: 'select', eid, part: asPart(data.part) } : null;\n }\n case 'deselect':\n return { type: 'deselect' };\n case 'move': {\n const eid = asEid(data.eid);\n const direction =\n data.direction === 'up' || data.direction === 'down' ? data.direction : null;\n return eid && direction ? { type: 'move', eid, direction } : null;\n }\n case 'order':\n return Array.isArray(data.eids)\n ? { type: 'order', eids: data.eids.flatMap((eid) => asEid(eid) ?? []) }\n : null;\n case 'adding':\n return {\n type: 'adding',\n label: typeof data.label === 'string' ? data.label : null,\n anchor: asEid(data.anchor),\n place: data.place === 'before' ? 'before' : 'after',\n };\n default:\n return null;\n }\n}\n\n/** The engine's name for a studio block: its uuid, or its slug spelled as the storefront's path. */\nconst refOf = (block: CanvasBlock): string => block.key || block.slug?.replace(/_/g, '-') || '';\n\n/**\n * The studio block each page block is, by page order: copies of one component\n * share a uuid, so the n-th on the page is the n-th in the list. `refs` are\n * the page blocks' `data-live-block` values; `null` where none matches, and\n * for every copy of a ref the page and the list count differently, where the\n * n-th could be another row.\n */\nexport function matchBlocks(\n refs: readonly string[],\n blocks: readonly CanvasBlock[]\n): (CanvasBlock | null)[] {\n const names = (block: CanvasBlock, ref: string) => block.eid === ref || refOf(block) === ref;\n const used = new Set<number>();\n return refs.map((ref) => {\n const onPage = refs.filter((each) => each === ref).length;\n if (blocks.filter((block) => names(block, ref)).length !== onPage) return null;\n const at = blocks.findIndex((block, index) => !used.has(index) && names(block, ref));\n if (at === -1) return null;\n used.add(at);\n return blocks[at];\n });\n}\n\n/** Sends `message` to the studio, or, before it has spoken, to whichever allowed origin frames the page. */\nexport function postToCanvas(origin: string | null, message: Record<string, unknown>): void {\n const data = { source: CHILD, v: 1, ...message };\n if (origin) {\n window.parent.postMessage(data, origin);\n return;\n }\n let parent: string | null = null;\n try {\n parent = parentOrigin();\n } catch {\n parent = null;\n }\n const targets: readonly string[] = parent ? [parent] : CANVAS_ORIGINS;\n for (const target of targets) {\n if ((CANVAS_ORIGINS as readonly string[]).includes(target))\n window.parent.postMessage(data, target);\n }\n}\n\n/** What the page redraws in place when the studio saves, as `hello` tells it. */\nexport const CANVAS_CAN = ['refresh', 'adding', 'redraw'] as const;\n\nexport type { Redrawer };\n\nlet lastDraw: Promise<unknown> = Promise.resolve();\n\n// Under the studio's own wait, so the page answers before the studio gives up on it.\nconst DRAW_LIMIT = 15_000;\n\n/**\n * Draws the home page again from what the studio just saved, without reloading it: its\n * blocks fetched afresh, spelled as the home loader spells them. Fails off the home page.\n */\nexport function redrawPage(): Promise<void> {\n // One at a time: the query cache would hand this save a fetch started before it.\n const draw = lastDraw.then(drawAfresh);\n lastDraw = draw.catch(() => undefined);\n return draw;\n}\n\nconst NO_HOME = 'no home page';\n\n/** `work`, or a failure once it runs past the studio's wait; `stop` calls off what it left running. */\nfunction withinLimit<T>(work: Promise<T>, stop: () => void): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const tooLong = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n stop();\n reject(new Error('redraw took too long'));\n }, DRAW_LIMIT);\n });\n return Promise.race([work, tooLong]).finally(() => clearTimeout(timer));\n}\n\nasync function drawAfresh(): Promise<void> {\n const { home } = await import('../../api/home');\n const { queryClient } = getTwilightContext();\n const components = home.queries.components();\n const blocks = await withinLimit(\n queryClient.fetchQuery({ ...components, staleTime: 0 }),\n // Its fetch is called off too, or the next redraw would be handed it.\n () => void queryClient.cancelQueries({ queryKey: components.queryKey })\n );\n const drawn = drawLiveBlocks(\n blocks.map((block) => ({ ...block, path: block.path?.replace('home.', '') || block.path }))\n );\n if (!drawn) throw new Error(NO_HOME);\n}\n\n/**\n * Draws the whole page again from what the studio just saved, on any page, without reloading\n * it: the store's settings and everything else the page fetched, fetched afresh, then the\n * route's loaders run again with them. Theme settings, colours, fonts, the logo, custom CSS,\n * the header, the footer and every block follow. Fails without a router to run the loaders.\n */\nexport function redrawAll(router: Redrawer): Promise<void> {\n const draw = lastDraw.then(() => drawEverything(router));\n lastDraw = draw.catch(() => undefined);\n return draw;\n}\n\nasync function drawEverything(router: Redrawer): Promise<void> {\n if (!router) throw new Error('no router');\n const { queryClient } = getTwilightContext();\n const stop = () => void queryClient.cancelQueries();\n // The settings decide the rest, and the root loader reads them from the cache, with no\n // observer of its own: fetched first, and a failure there is the redraw's.\n await withinLimit(\n queryClient.refetchQueries({ queryKey: ['store', 'settings'] }, { throwOnError: true }),\n stop\n );\n // Inactive ones too: a loader reads its query from the cache as well.\n await withinLimit(queryClient.invalidateQueries({ refetchType: 'all' }), stop);\n await withinLimit(router.invalidate(), stop);\n}\n\n// Draws the page again for the section the studio saved, the whole page off home; false for a refresh that names none.\nfunction refreshFor(studio: string, data: Record<string, unknown>, router: Redrawer): boolean {\n const eid = asEid(data.eid);\n if (!eid) {\n postToCanvas(studio, { type: 'refresh-failed', eid: String(data.eid ?? '') });\n return false;\n }\n redrawPage()\n .catch((error: unknown) =>\n error instanceof Error && error.message === NO_HOME\n ? redrawAll(router)\n : Promise.reject(error)\n )\n .then(\n () => {\n if (data.select === true) deliver({ type: 'select', eid });\n postToCanvas(studio, { type: 'refreshed', eid });\n },\n () => postToCanvas(studio, { type: 'refresh-failed', eid })\n );\n return true;\n}\n\n// Anything else saved (theme settings, the identity, the header or footer, a page's blocks): the whole page.\nfunction redrawFor(studio: string, _data: Record<string, unknown>, router: Redrawer): boolean {\n redrawAll(router).then(\n () => postToCanvas(studio, { type: 'redrawn' }),\n () => postToCanvas(studio, { type: 'redraw-failed' })\n );\n return true;\n}\n\n/** What the page draws again for each save the studio tells it of; true once it is under way. */\nconst SAVES = new Map<\n string,\n (studio: string, data: Record<string, unknown>, router: Redrawer) => boolean\n>([\n ['refresh', refreshFor],\n ['redraw', redrawFor],\n]);\n\n/** The overlay on screen takes the studio's commands; ones sent before it mounted wait for it. */\nlet handler: ((command: CanvasCommand) => void) | null = null;\nlet queued: CanvasCommand[] = [];\n\nfunction deliver(command: CanvasCommand): void {\n if (handler) handler(command);\n else queued.push(command);\n}\n\n/** Hands the studio's commands to `fn` while it is set, the waiting ones first. */\nexport function takeCanvasCommands(fn: (command: CanvasCommand) => void): () => void {\n handler = fn;\n const waiting = queued;\n queued = [];\n waiting.forEach(fn);\n return () => {\n if (handler === fn) handler = null;\n };\n}\n\n/**\n * Says hello to the studio once the page has loaded, and follows what it asks\n * for. Off for shoppers, for the theme editor (which never answers) and for the\n * engine's own dev editor, which keep the live editor bar.\n */\nexport function useCanvasHost(): CanvasHost {\n const [host, setHost] = useState<CanvasHost>({ origin: null, enabled: false, blocks: null });\n useEffect(() => {\n if (window.self === window.top || (import.meta.env.DEV && isEditorFrame())) return;\n let origin: string | null = null;\n\n const onMessage = (event: MessageEvent) => {\n if (event.source !== window.parent) return;\n const data = (event.data ?? {}) as Record<string, unknown>;\n // The studio saved on the server and wants the page drawn again, as the twig preview does.\n if (data.action === 'preview::reload') {\n if (origin && event.origin === origin) window.location.reload();\n return;\n }\n if (data.source !== HOST) return;\n if (!origin) {\n if (!(CANVAS_ORIGINS as readonly string[]).includes(event.origin)) return;\n origin = event.origin;\n } else if (event.origin !== origin) return;\n const studio = origin;\n\n // Something saved: the page is drawn again in place.\n const onSave = SAVES.get(String(data.type));\n if (onSave) {\n // No router outside the app (a page rendered on its own): the studio then reloads it.\n if (onSave(studio, data, getRedrawer()))\n setHost((prev) => (prev.origin ? prev : { ...prev, origin: studio }));\n } else if (data.type === 'enable') {\n const blocks = asBlocks(data.blocks);\n setHost((prev) => ({ origin: studio, enabled: true, blocks: blocks ?? prev.blocks }));\n } else if (data.type === 'disable') {\n queued = [];\n setHost((prev) => ({ ...prev, origin: studio, enabled: false }));\n } else {\n setHost((prev) => (prev.origin ? prev : { ...prev, origin: studio }));\n const command = readCommand(data);\n if (command) deliver(command);\n }\n };\n\n const hello = () => postToCanvas(origin, { type: 'hello', can: [...CANVAS_CAN] });\n window.addEventListener('message', onMessage);\n if (document.readyState === 'complete') hello();\n else window.addEventListener('load', hello, { once: true });\n return () => {\n window.removeEventListener('message', onMessage);\n window.removeEventListener('load', hello);\n };\n }, []);\n\n return host;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/live-editor/canvas.ts"],"names":[],"mappings":";;;;;;;AAcA,IAAM,KAAA,GAAQ,cAAA;AACd,IAAM,IAAA,GAAO,mBAAA;AAGN,IAAM,cAAA,GAAiB;AAAA,EAC5B,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,4BAAA;AAAA,EACA;AACF,CAAA;AAmCA,IAAM,QAAQ,CAAC,KAAA,KACb,OAAO,KAAA,KAAU,QAAA,IAAY,QAAQ,KAAA,GAAQ,IA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,CAAA;AAAA,MAC9B;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,KAAA,GAAQ,MAAM,YAAA,CAAa,MAAA,EAAQ,EAAE,IAAA,EAAM,OAAA,EAAS,GAAA,EAAK,CAAC,GAAG,UAAU,CAAA,EAAG,CAAA;AAChF,IAAA,MAAA,CAAO,gBAAA,CAAiB,WAAW,SAAS,CAAA;AAC5C,IAAA,IAAI,QAAA,CAAS,UAAA,KAAe,UAAA,EAAY,KAAA,EAAM;AAAA,gBAClC,gBAAA,CAAiB,MAAA,EAAQ,OAAO,EAAE,IAAA,EAAM,MAAM,CAAA;AAC1D,IAAA,OAAO,MAAM;AACX,MAAA,MAAA,CAAO,mBAAA,CAAoB,WAAW,SAAS,CAAA;AAC/C,MAAA,MAAA,CAAO,mBAAA,CAAoB,QAAQ,KAAK,CAAA;AAAA,IAC1C,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,IAAA;AACT","file":"chunk-EJNBREFC.js","sourcesContent":["/**\n * The storefront's side of the design studio's canvas mode: the studio frames\n * the store and draws its own cards and panels, and the store outlines what the\n * merchant points at and reports what is picked. The same `postMessage`\n * protocol the twig themes' `live-themes-editor.js` speaks in canvas mode.\n */\n\nimport { useEffect, useState } from 'react';\nimport { isEditorFrame } from '../../dev/schema-types';\nimport { getTwilightContext } from '../../twilight/context';\nimport { parentOrigin } from './frame';\nimport { drawLiveBlocks } from './moves';\nimport { getRedrawer, type Redrawer } from './redrawer';\n\nconst CHILD = 'salla-canvas';\nconst HOST = 'salla-canvas-host';\n\n/** Where the studio runs; it alone turns canvas mode on. */\nexport const CANVAS_ORIGINS = [\n 'https://s.salla.sa',\n 'https://s.salla.dev',\n 'https://s.beta.salla.group',\n 'http://localhost:9000',\n] as const;\n\nexport type CanvasRole = 'component' | 'header' | 'footer';\n\n/** The header's or footer's own logo or menu, picked on its own. */\nexport type CanvasPart = 'logo' | 'menu';\n\n/**\n * A home block as the studio lists it, in page order. The storefront's blocks\n * carry no row id, so the studio's list names them: `eid` is what the studio\n * calls the block, matched to the page by its uuid (`key`) or its `slug`.\n */\nexport interface CanvasBlock {\n eid: string;\n key?: string | null;\n slug?: string | null;\n title?: string | null;\n}\n\nexport type CanvasCommand =\n | { type: 'select'; eid: string; part?: CanvasPart }\n | { type: 'deselect' }\n | { type: 'move'; eid: string; direction: 'up' | 'down' }\n /** Lays the blocks out in this order without saving it. */\n | { type: 'order'; eids: string[] }\n /** Holds a block's place with a box named `label` until the page draws it; no label takes the box off. */\n | { type: 'adding'; label: string | null; anchor: string | null; place: 'before' | 'after' };\n\nexport interface CanvasHost {\n /** The studio's origin once it has spoken, else `null`: the page is not in canvas mode. */\n origin: string | null;\n enabled: boolean;\n blocks: CanvasBlock[] | null;\n}\n\nconst asEid = (value: unknown): string | null =>\n typeof value === 'string' && value ? value : null;\n\nconst asPart = (value: unknown): CanvasPart | undefined =>\n value === 'logo' || value === 'menu' ? value : undefined;\n\nfunction asBlocks(value: unknown): CanvasBlock[] | null {\n if (!Array.isArray(value)) return null;\n return value.flatMap((item) => {\n const block = item as Partial<CanvasBlock> | null;\n const eid = asEid(block?.eid);\n if (!eid) return [];\n return [\n {\n eid,\n key: typeof block?.key === 'string' ? block.key : null,\n slug: typeof block?.slug === 'string' ? block.slug : null,\n title: typeof block?.title === 'string' ? block.title : null,\n },\n ];\n });\n}\n\n/** The command a studio message carries, if it is a well-formed one. */\nexport function readCommand(data: Record<string, unknown>): CanvasCommand | null {\n switch (data.type) {\n case 'select': {\n const eid = asEid(data.eid);\n return eid ? { type: 'select', eid, part: asPart(data.part) } : null;\n }\n case 'deselect':\n return { type: 'deselect' };\n case 'move': {\n const eid = asEid(data.eid);\n const direction =\n data.direction === 'up' || data.direction === 'down' ? data.direction : null;\n return eid && direction ? { type: 'move', eid, direction } : null;\n }\n case 'order':\n return Array.isArray(data.eids)\n ? { type: 'order', eids: data.eids.flatMap((eid) => asEid(eid) ?? []) }\n : null;\n case 'adding':\n return {\n type: 'adding',\n label: typeof data.label === 'string' ? data.label : null,\n anchor: asEid(data.anchor),\n place: data.place === 'before' ? 'before' : 'after',\n };\n default:\n return null;\n }\n}\n\n/** The engine's name for a studio block: its uuid, or its slug spelled as the storefront's path. */\nconst refOf = (block: CanvasBlock): string => block.key || block.slug?.replace(/_/g, '-') || '';\n\n/**\n * The studio block each page block is, by page order: copies of one component\n * share a uuid, so the n-th on the page is the n-th in the list. `refs` are\n * the page blocks' `data-live-block` values; `null` where none matches, and\n * for every copy of a ref the page and the list count differently, where the\n * n-th could be another row.\n */\nexport function matchBlocks(\n refs: readonly string[],\n blocks: readonly CanvasBlock[]\n): (CanvasBlock | null)[] {\n const names = (block: CanvasBlock, ref: string) => block.eid === ref || refOf(block) === ref;\n const used = new Set<number>();\n return refs.map((ref) => {\n const onPage = refs.filter((each) => each === ref).length;\n if (blocks.filter((block) => names(block, ref)).length !== onPage) return null;\n const at = blocks.findIndex((block, index) => !used.has(index) && names(block, ref));\n if (at === -1) return null;\n used.add(at);\n return blocks[at];\n });\n}\n\n/** Sends `message` to the studio, or, before it has spoken, to whichever allowed origin frames the page. */\nexport function postToCanvas(origin: string | null, message: Record<string, unknown>): void {\n const data = { source: CHILD, v: 1, ...message };\n if (origin) {\n window.parent.postMessage(data, origin);\n return;\n }\n let parent: string | null = null;\n try {\n parent = parentOrigin();\n } catch {\n parent = null;\n }\n const targets: readonly string[] = parent ? [parent] : CANVAS_ORIGINS;\n for (const target of targets) {\n if ((CANVAS_ORIGINS as readonly string[]).includes(target))\n window.parent.postMessage(data, target);\n }\n}\n\n/** What the page redraws in place when the studio saves, as `hello` tells it. */\nexport const CANVAS_CAN = ['refresh', 'adding', 'redraw'] as const;\n\nexport type { Redrawer };\n\nlet lastDraw: Promise<unknown> = Promise.resolve();\n\n// Under the studio's own wait, so the page answers before the studio gives up on it.\nconst DRAW_LIMIT = 15_000;\n\n/**\n * Draws the home page again from what the studio just saved, without reloading it: its\n * blocks fetched afresh, spelled as the home loader spells them. Fails off the home page.\n */\nexport function redrawPage(): Promise<void> {\n // One at a time: the query cache would hand this save a fetch started before it.\n const draw = lastDraw.then(drawAfresh);\n lastDraw = draw.catch(() => undefined);\n return draw;\n}\n\nconst NO_HOME = 'no home page';\n\n/** `work`, or a failure once it runs past the studio's wait; `stop` calls off what it left running. */\nfunction withinLimit<T>(work: Promise<T>, stop: () => void): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const tooLong = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n stop();\n reject(new Error('redraw took too long'));\n }, DRAW_LIMIT);\n });\n return Promise.race([work, tooLong]).finally(() => clearTimeout(timer));\n}\n\nasync function drawAfresh(): Promise<void> {\n const { home } = await import('../../api/home');\n const { queryClient } = getTwilightContext();\n const components = home.queries.components();\n const blocks = await withinLimit(\n queryClient.fetchQuery({ ...components, staleTime: 0 }),\n // Its fetch is called off too, or the next redraw would be handed it.\n () => void queryClient.cancelQueries({ queryKey: components.queryKey })\n );\n const drawn = drawLiveBlocks(\n blocks.map((block) => ({ ...block, path: block.path?.replace('home.', '') || block.path }))\n );\n if (!drawn) throw new Error(NO_HOME);\n}\n\n/**\n * Draws the whole page again from what the studio just saved, on any page, without reloading\n * it: the store's settings and everything else the page fetched, fetched afresh, then the\n * route's loaders run again with them. Theme settings, colours, fonts, the logo, custom CSS,\n * the header, the footer and every block follow. Fails without a router to run the loaders.\n */\nexport function redrawAll(router: Redrawer): Promise<void> {\n const draw = lastDraw.then(() => drawEverything(router));\n lastDraw = draw.catch(() => undefined);\n return draw;\n}\n\nasync function drawEverything(router: Redrawer): Promise<void> {\n if (!router) throw new Error('no router');\n const { queryClient } = getTwilightContext();\n const stop = () => void queryClient.cancelQueries();\n // The settings decide the rest, and the root loader reads them from the cache, with no\n // observer of its own: fetched first, and a failure there is the redraw's.\n await withinLimit(\n queryClient.refetchQueries({ queryKey: ['store', 'settings'] }, { throwOnError: true }),\n stop\n );\n // Inactive ones too: a loader reads its query from the cache as well.\n await withinLimit(queryClient.invalidateQueries({ refetchType: 'all' }), stop);\n await withinLimit(router.invalidate(), stop);\n}\n\n// Draws the page again for the section the studio saved, the whole page off home; false for a refresh that names none.\nfunction refreshFor(studio: string, data: Record<string, unknown>, router: Redrawer): boolean {\n const eid = asEid(data.eid);\n if (!eid) {\n postToCanvas(studio, { type: 'refresh-failed', eid: String(data.eid ?? '') });\n return false;\n }\n redrawPage()\n .catch((error: unknown) =>\n error instanceof Error && error.message === NO_HOME\n ? redrawAll(router)\n : Promise.reject(error)\n )\n .then(\n () => {\n if (data.select === true) deliver({ type: 'select', eid });\n postToCanvas(studio, { type: 'refreshed', eid });\n },\n () => postToCanvas(studio, { type: 'refresh-failed', eid })\n );\n return true;\n}\n\n// Anything else saved (theme settings, the identity, the header or footer, a page's blocks): the whole page.\nfunction redrawFor(studio: string, _data: Record<string, unknown>, router: Redrawer): boolean {\n redrawAll(router).then(\n () => postToCanvas(studio, { type: 'redrawn' }),\n () => postToCanvas(studio, { type: 'redraw-failed' })\n );\n return true;\n}\n\n/** What the page draws again for each save the studio tells it of; true once it is under way. */\nconst SAVES = new Map<\n string,\n (studio: string, data: Record<string, unknown>, router: Redrawer) => boolean\n>([\n ['refresh', refreshFor],\n ['redraw', redrawFor],\n]);\n\n/** The overlay on screen takes the studio's commands; ones sent before it mounted wait for it. */\nlet handler: ((command: CanvasCommand) => void) | null = null;\nlet queued: CanvasCommand[] = [];\n\nfunction deliver(command: CanvasCommand): void {\n if (handler) handler(command);\n else queued.push(command);\n}\n\n/** Hands the studio's commands to `fn` while it is set, the waiting ones first. */\nexport function takeCanvasCommands(fn: (command: CanvasCommand) => void): () => void {\n handler = fn;\n const waiting = queued;\n queued = [];\n waiting.forEach(fn);\n return () => {\n if (handler === fn) handler = null;\n };\n}\n\n/**\n * Says hello to the studio once the page has loaded, and follows what it asks\n * for. Off for shoppers, for the theme editor (which never answers) and for the\n * engine's own dev editor, which keep the live editor bar.\n */\nexport function useCanvasHost(): CanvasHost {\n const [host, setHost] = useState<CanvasHost>({ origin: null, enabled: false, blocks: null });\n useEffect(() => {\n if (window.self === window.top || (import.meta.env.DEV && isEditorFrame())) return;\n let origin: string | null = null;\n\n const onMessage = (event: MessageEvent) => {\n if (event.source !== window.parent) return;\n const data = (event.data ?? {}) as Record<string, unknown>;\n // The studio saved on the server and wants the page drawn again, as the twig preview does.\n if (data.action === 'preview::reload') {\n if (origin && event.origin === origin) window.location.reload();\n return;\n }\n if (data.source !== HOST) return;\n if (!origin) {\n if (!(CANVAS_ORIGINS as readonly string[]).includes(event.origin)) return;\n origin = event.origin;\n } else if (event.origin !== origin) return;\n const studio = origin;\n\n // Something saved: the page is drawn again in place.\n const onSave = SAVES.get(String(data.type));\n if (onSave) {\n // No router outside the app (a page rendered on its own): the studio then reloads it.\n if (onSave(studio, data, getRedrawer()))\n setHost((prev) => (prev.origin ? prev : { ...prev, origin: studio }));\n } else if (data.type === 'enable') {\n const blocks = asBlocks(data.blocks);\n setHost((prev) => ({ origin: studio, enabled: true, blocks: blocks ?? prev.blocks }));\n } else if (data.type === 'disable') {\n queued = [];\n setHost((prev) => ({ ...prev, origin: studio, enabled: false }));\n } else {\n setHost((prev) => (prev.origin ? prev : { ...prev, origin: studio }));\n const command = readCommand(data);\n if (command) deliver(command);\n }\n };\n\n const hello = () => postToCanvas(origin, { type: 'hello', can: [...CANVAS_CAN] });\n window.addEventListener('message', onMessage);\n if (document.readyState === 'complete') hello();\n else window.addEventListener('load', hello, { once: true });\n return () => {\n window.removeEventListener('message', onMessage);\n window.removeEventListener('load', hello);\n };\n }, []);\n\n return host;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { orThrow } from './chunk-
|
|
2
|
-
import { api } from './chunk-
|
|
1
|
+
import { orThrow } from './chunk-KUROVEJP.js';
|
|
2
|
+
import { api } from './chunk-LC3M4HW7.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var brand = {
|
|
@@ -25,5 +25,5 @@ var brand = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export { brand };
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-ENA4XT5H.js.map
|
|
29
|
+
//# sourceMappingURL=chunk-ENA4XT5H.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/brands.ts"],"names":[],"mappings":";;;;AAMO,IAAM,KAAA,GAAQ;AAAA,EACnB,IAAA,EAAM,OAAO,IAAA,KAAmD;AAC9D,IAAA,MAAM,EAAE,IAAA,EAAM,MAAA,EAAO,GAAI,MAAM,GAAA,CAC5B,GAAA,CAAI,IAAA,GAAO,CAAA,YAAA,EAAe,IAAI,CAAA,CAAA,GAAK,QAAQ,EAC3C,IAAA,EAAoD;AACvD,IAAA,OAAO,EAAE,OAAO,IAAA,IAAQ,IAAI,IAAA,EAAM,MAAA,EAAQ,QAAQ,IAAA,EAAK;AAAA,EACzD,CAAA;AAAA,EAEA,IAAA,EAAM,OAAO,EAAA,KAA+B;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,OAAA,EAAU,EAAE,CAAA,CAAE,CAAA,CAAE,IAAA,EAAsB;AACrE,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,EAAA,KAA+B,QAAQ,KAAA,CAAM,IAAA,CAAK,EAAE,CAAC,CAAA;AAAA,EAEnE,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,CAAC,IAAA,KACL,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,QAAA,EAAU,MAAA,EAAQ,QAAQ,CAAC,CAAA;AAAA,MACtC,OAAA,EAAS,MAAM,KAAA,CAAM,IAAA,CAAK,IAAI;AAAA,KAC/B,CAAA;AAAA,IACH,MAAA,EAAQ,CAAC,EAAA,KACP,YAAA,CAAa;AA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S,MAAM,KAAA,CAAM,IAAA,CAAK,EAAE;AAAA,KAC7B;AAAA;AAEP","file":"chunk-ENA4XT5H.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Brand } from '../routes/brands/types';\nimport type { PaginatedResult, Pagination } from './types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const brand = {\n list: async (page?: number): Promise<PaginatedResult<Brand>> => {\n const { data, cursor } = await api\n .get(page ? `brands?page=${page}` : 'brands')\n .json<{ data: Brand[] | null; cursor?: Pagination }>();\n return { items: data ?? [], next: cursor?.next ?? null };\n },\n\n find: async (id: string): Promise<Brand> => {\n const { data } = await api.get(`brands/${id}`).json<{ data: Brand }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Brand> => orThrow(brand.find(id)),\n\n queries: {\n list: (page?: number) =>\n queryOptions({\n queryKey: ['brands', 'list', page ?? 1],\n queryFn: () => brand.list(page),\n }),\n detail: (id: string) =>\n queryOptions({\n queryKey: ['brands', 'detail', id],\n queryFn: () => brand.find(id),\n }),\n },\n};\n"]}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { ErrorPage } from './chunk-Z4Y55HWX.js';
|
|
2
2
|
import { tanstackHeadAdapter } from './chunk-UTK43AS4.js';
|
|
3
|
-
import { translations } from './chunk-
|
|
4
|
-
import { parseFiltersFromSearch } from './chunk-
|
|
5
|
-
import { dispatchRouteChanging, dispatchRouteChanged, dispatchPageViewed, setAnalyticsPage, dispatchProductViewed, dispatchProductsFetched, dispatchCartViewed } from './chunk-
|
|
6
|
-
import { reportOrderCompleted, reportGtmPageView, gtmPageEcommerce } from './chunk-
|
|
3
|
+
import { translations } from './chunk-DIYLHIAT.js';
|
|
4
|
+
import { parseFiltersFromSearch } from './chunk-OVRXYL5B.js';
|
|
5
|
+
import { dispatchRouteChanging, dispatchRouteChanged, dispatchPageViewed, setAnalyticsPage, dispatchProductViewed, dispatchProductsFetched, dispatchCartViewed } from './chunk-UM3G3Q25.js';
|
|
6
|
+
import { reportOrderCompleted, reportGtmPageView, gtmPageEcommerce } from './chunk-HZECUTW5.js';
|
|
7
7
|
import { PRODUCT_SLUG_ROUTE_ID, CATEGORY_SLUG_ROUTE_ID } from './chunk-NV4PF3O3.js';
|
|
8
|
-
import { store, readPageSearch, readCookieHeader, persistLanguageCookie } from './chunk-
|
|
9
|
-
import { shouldDehydrateQuery } from './chunk-
|
|
10
|
-
import { rootHead } from './chunk-
|
|
8
|
+
import { store, readPageSearch, readCookieHeader, persistLanguageCookie } from './chunk-4IISS5KO.js';
|
|
9
|
+
import { shouldDehydrateQuery } from './chunk-K5EIRY5R.js';
|
|
10
|
+
import { rootHead } from './chunk-2DUC5HPY.js';
|
|
11
11
|
import { setRedrawer } from './chunk-ZF2YZB7F.js';
|
|
12
12
|
import { setHeadAdapter } from './chunk-GD26FI4J.js';
|
|
13
|
-
import { apps } from './chunk-
|
|
13
|
+
import { apps } from './chunk-7326LK5W.js';
|
|
14
14
|
import { VIEW_AS_OWNER_COOKIE_NAME, ownerLinkMatches, ownerCookieMatches, showsMaintenancePage } from './chunk-O7JTXTGP.js';
|
|
15
15
|
import { composeRewrites, productKeyRewrite, singleSegmentPages } from './chunk-SDBR4X3K.js';
|
|
16
|
-
import { RedirectError, NotFoundError, UnauthorizedError, isMissingResource, responseStatusOf } from './chunk-
|
|
16
|
+
import { RedirectError, NotFoundError, UnauthorizedError, isMissingResource, responseStatusOf } from './chunk-KUROVEJP.js';
|
|
17
17
|
import { RouteId } from './chunk-OUW6WESU.js';
|
|
18
18
|
import { useDocumentClass } from './chunk-JWXJPJBO.js';
|
|
19
19
|
import { toReactProps, mergeElementAttrs } from './chunk-CW625T2E.js';
|
|
20
|
-
import { advertisement } from './chunk-
|
|
21
|
-
import { LazyErrorPage } from './chunk-
|
|
20
|
+
import { advertisement } from './chunk-HYARGOSU.js';
|
|
21
|
+
import { LazyErrorPage } from './chunk-CBZR37Z7.js';
|
|
22
22
|
import { syncSdkLocale, syncSdkThemeVersion } from './chunk-MZPX4EPS.js';
|
|
23
23
|
import { AUTH_TOKEN_COOKIE_NAME, SCOPE_COOKIE_NAME, SCOPE_COOKIE_MAX_AGE, extractScopeFromCookies, extractScopeFromUrl, resolveRequestScope, sameScope, resolveStoreBase, resolveStoreBaseFollowsLocale, syncScopeCookie, extractTokenFromCookies, prefixStoreBase, hasLanguageParam, withLanguageParam, virtualLocale, stripStoreBase, resolveStoreBaseRedirect, resolveStoppedDomainRedirect, resolveOwnDomainRedirect, resolveMarketDomainRedirect, decideSharedHostLanguage, currentHost } from './chunk-4OZIBANF.js';
|
|
24
24
|
import { updateTwilightContext, createI18nInstance, getTwilightContext, SettingsError, messagesForLocale } from './chunk-MWUAHDQL.js';
|
|
@@ -388,7 +388,7 @@ function resolveRouteId(tanstackId) {
|
|
|
388
388
|
return TANSTACK_ROUTE_ID_MAP[tanstackId] ?? tanstackId;
|
|
389
389
|
}
|
|
390
390
|
var LazyNotFoundPage = lazyComponent(
|
|
391
|
-
() => import('./not-found-
|
|
391
|
+
() => import('./not-found-25S7XQ6X.js').then((m) => ({ default: m.NotFoundPage }))
|
|
392
392
|
);
|
|
393
393
|
function StoreUnavailablePage() {
|
|
394
394
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
@@ -881,5 +881,5 @@ function tanstackDocumentAdapter(descriptor) {
|
|
|
881
881
|
}
|
|
882
882
|
|
|
883
883
|
export { RouteDocumentSync, TanStackDocumentSync, createRouter, createTwilightRootRoute, tanstackDocumentAdapter, useTanstackDocumentAttrs };
|
|
884
|
-
//# sourceMappingURL=chunk-
|
|
885
|
-
//# sourceMappingURL=chunk-
|
|
884
|
+
//# sourceMappingURL=chunk-F27WIIXS.js.map
|
|
885
|
+
//# sourceMappingURL=chunk-F27WIIXS.js.map
|