@salla.sa/twilight-theme-engine 1.0.138 → 1.0.140
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-P3IXCYO7.js → AddToCartForm-EPTN5O3X.js} +3 -3
- package/dist/{AddToCartForm-P3IXCYO7.js.map → AddToCartForm-EPTN5O3X.js.map} +1 -1
- package/dist/{BlogAuthorPage-UJYMW4ZL.js → BlogAuthorPage-PGFINJSP.js} +16 -16
- package/dist/{BlogAuthorPage-UJYMW4ZL.js.map → BlogAuthorPage-PGFINJSP.js.map} +1 -1
- package/dist/{BlogCategoryPage-3XO42UFX.js → BlogCategoryPage-ZVRRHTKJ.js} +16 -16
- package/dist/{BlogCategoryPage-3XO42UFX.js.map → BlogCategoryPage-ZVRRHTKJ.js.map} +1 -1
- package/dist/{BlogPage-5SQNDQ7L.js → BlogPage-5SRGR7NK.js} +14 -14
- package/dist/{BlogPage-5SQNDQ7L.js.map → BlogPage-5SRGR7NK.js.map} +1 -1
- package/dist/{BlogSinglePage-XSRKZYUI.js → BlogSinglePage-6A5J2BKK.js} +14 -14
- package/dist/{BlogSinglePage-XSRKZYUI.js.map → BlogSinglePage-6A5J2BKK.js.map} +1 -1
- package/dist/{BlogTagPage-CFXWHUJR.js → BlogTagPage-DAA3ZO76.js} +16 -16
- package/dist/{BlogTagPage-CFXWHUJR.js.map → BlogTagPage-DAA3ZO76.js.map} +1 -1
- package/dist/{BrandsPage-APYVP4M2.js → BrandsPage-JABKRWP2.js} +15 -15
- package/dist/{BrandsPage-APYVP4M2.js.map → BrandsPage-JABKRWP2.js.map} +1 -1
- package/dist/{Breadcrumb-M4DBOMXW.js → Breadcrumb-SCJZW4RO.js} +14 -14
- package/dist/{Breadcrumb-M4DBOMXW.js.map → Breadcrumb-SCJZW4RO.js.map} +1 -1
- package/dist/{CartItem-BXZDBDLA.js → CartItem-3KFTPQVF.js} +14 -14
- package/dist/{CartItem-BXZDBDLA.js.map → CartItem-3KFTPQVF.js.map} +1 -1
- package/dist/{CartSummary-NT7N6ERQ.js → CartSummary-I64SD4QX.js} +14 -14
- package/dist/{CartSummary-NT7N6ERQ.js.map → CartSummary-I64SD4QX.js.map} +1 -1
- package/dist/{Copyright-IJDVQWOS.js → Copyright-3TREUCAK.js} +3 -3
- package/dist/{Copyright-IJDVQWOS.js.map → Copyright-3TREUCAK.js.map} +1 -1
- package/dist/{CustomerLayout-UNEDHUO2.js → CustomerLayout-BH74QWRI.js} +14 -14
- package/dist/{CustomerLayout-UNEDHUO2.js.map → CustomerLayout-BH74QWRI.js.map} +1 -1
- package/dist/{Footer-QX5BCDUK.js → Footer-DSSOB3ZW.js} +4 -4
- package/dist/{Footer-QX5BCDUK.js.map → Footer-DSSOB3ZW.js.map} +1 -1
- package/dist/{Header-EAOIXJNS.js → Header-UWUS34D6.js} +8 -8
- package/dist/{Header-EAOIXJNS.js.map → Header-UWUS34D6.js.map} +1 -1
- package/dist/LatestProducts-VLSTOKEB.js +107 -0
- package/dist/LatestProducts-VLSTOKEB.js.map +1 -0
- package/dist/{LoyaltyPage-3VOLW5OQ.js → LoyaltyPage-3FAD5MJ6.js} +14 -14
- package/dist/{LoyaltyPage-3VOLW5OQ.js.map → LoyaltyPage-3FAD5MJ6.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-IMHJHCZV.js → LoyaltyPointsPage-A4CTI55P.js} +6 -6
- package/dist/{LoyaltyPointsPage-IMHJHCZV.js.map → LoyaltyPointsPage-A4CTI55P.js.map} +1 -1
- package/dist/{MainMenu-ML6OQT53.js → MainMenu-C7TWXVL5.js} +6 -6
- package/dist/MainMenu-C7TWXVL5.js.map +1 -0
- package/dist/{MasterLayout-UCQA73I3.js → MasterLayout-MZY44RTA.js} +14 -14
- package/dist/{MasterLayout-UCQA73I3.js.map → MasterLayout-MZY44RTA.js.map} +1 -1
- package/dist/{MobileMenu-5JHOT4DP.js → MobileMenu-KNDN34HO.js} +15 -15
- package/dist/{MobileMenu-5JHOT4DP.js.map → MobileMenu-KNDN34HO.js.map} +1 -1
- package/dist/NoContent-7A7OR2NZ.js +6 -0
- package/dist/NoContent-7A7OR2NZ.js.map +1 -0
- package/dist/{NotificationsPage-C373Z2KC.js → NotificationsPage-LKUTYWPR.js} +14 -14
- package/dist/{NotificationsPage-C373Z2KC.js.map → NotificationsPage-LKUTYWPR.js.map} +1 -1
- package/dist/{OrderSinglePage-YYTU72JY.js → OrderSinglePage-VDALCKJL.js} +15 -15
- package/dist/{OrderSinglePage-YYTU72JY.js.map → OrderSinglePage-VDALCKJL.js.map} +1 -1
- package/dist/{OrdersPage-2F43AA76.js → OrdersPage-TOSCY6ML.js} +14 -14
- package/dist/{OrdersPage-2F43AA76.js.map → OrdersPage-TOSCY6ML.js.map} +1 -1
- package/dist/{PageSingle-2FIESLYJ.js → PageSingle-56SRDA4Q.js} +3 -3
- package/dist/{PageSingle-2FIESLYJ.js.map → PageSingle-56SRDA4Q.js.map} +1 -1
- package/dist/{ProductDetails-TNULRGXM.js → ProductDetails-YYU7TJSU.js} +4 -4
- package/dist/{ProductDetails-TNULRGXM.js.map → ProductDetails-YYU7TJSU.js.map} +1 -1
- package/dist/{ProfilePage-4VSU6H3S.js → ProfilePage-CTGBAD2A.js} +14 -14
- package/dist/{ProfilePage-4VSU6H3S.js.map → ProfilePage-CTGBAD2A.js.map} +1 -1
- package/dist/{ReviewsPage-65CYIATI.js → ReviewsPage-RJ5VQVB2.js} +3 -3
- package/dist/{ReviewsPage-65CYIATI.js.map → ReviewsPage-RJ5VQVB2.js.map} +1 -1
- package/dist/{SeoCartWidget-UHJJLLCU.js → SeoCartWidget-VL5TD2FU.js} +14 -14
- package/dist/{SeoCartWidget-UHJJLLCU.js.map → SeoCartWidget-VL5TD2FU.js.map} +1 -1
- package/dist/{SettingsPage-2JHRIGFS.js → SettingsPage-ZHDB3YZS.js} +14 -14
- package/dist/{SettingsPage-2JHRIGFS.js.map → SettingsPage-ZHDB3YZS.js.map} +1 -1
- package/dist/{StoreClosedNotification-ADSYNO7O.js → StoreClosedNotification-VP2ACWD6.js} +15 -15
- package/dist/{StoreClosedNotification-ADSYNO7O.js.map → StoreClosedNotification-VP2ACWD6.js.map} +1 -1
- package/dist/{TestimonialsPage-PYFKXCQP.js → TestimonialsPage-V2RWUVZD.js} +3 -3
- package/dist/{TestimonialsPage-PYFKXCQP.js.map → TestimonialsPage-V2RWUVZD.js.map} +1 -1
- package/dist/{ThankYouPage-VHUAKQF7.js → ThankYouPage-NJKASZ2R.js} +14 -14
- package/dist/{ThankYouPage-VHUAKQF7.js.map → ThankYouPage-NJKASZ2R.js.map} +1 -1
- package/dist/{WalletPage-NG2DJAUE.js → WalletPage-N4FDKDK3.js} +15 -15
- package/dist/{WalletPage-NG2DJAUE.js.map → WalletPage-N4FDKDK3.js.map} +1 -1
- package/dist/{WishlistPage-GFOKEWL3.js → WishlistPage-JCOG3KOV.js} +16 -16
- package/dist/{WishlistPage-GFOKEWL3.js.map → WishlistPage-JCOG3KOV.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/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-MWAXFBGG.js → chunk-2AS6KREO.js} +3 -3
- package/dist/{chunk-MWAXFBGG.js.map → chunk-2AS6KREO.js.map} +1 -1
- package/dist/{NoContent-63TMCPGY.js → chunk-33FWLJXY.js} +2 -4
- package/dist/chunk-33FWLJXY.js.map +1 -0
- package/dist/{chunk-35D6CKKX.js → chunk-33R2PXOK.js} +4 -4
- package/dist/{chunk-35D6CKKX.js.map → chunk-33R2PXOK.js.map} +1 -1
- package/dist/{chunk-OSYUGCRG.js → chunk-3CKMMFUF.js} +4 -4
- package/dist/{chunk-OSYUGCRG.js.map → chunk-3CKMMFUF.js.map} +1 -1
- package/dist/{chunk-SAYYMA6E.js → chunk-444GCMTZ.js} +21 -9
- package/dist/chunk-444GCMTZ.js.map +1 -0
- package/dist/{chunk-PBFLXHKM.js → chunk-5NTD7WXX.js} +3 -3
- package/dist/{chunk-PBFLXHKM.js.map → chunk-5NTD7WXX.js.map} +1 -1
- package/dist/{chunk-FVHAKOEH.js → chunk-7DRXAR76.js} +3 -3
- package/dist/{chunk-FVHAKOEH.js.map → chunk-7DRXAR76.js.map} +1 -1
- package/dist/{chunk-U6EB7GM3.js → chunk-7PFJOTZS.js} +4 -4
- package/dist/{chunk-U6EB7GM3.js.map → chunk-7PFJOTZS.js.map} +1 -1
- package/dist/{chunk-P43VADN7.js → chunk-ABVHWJPY.js} +10 -3
- package/dist/chunk-ABVHWJPY.js.map +1 -0
- package/dist/{chunk-S7FNMT24.js → chunk-AEM5UEH6.js} +3 -3
- package/dist/{chunk-S7FNMT24.js.map → chunk-AEM5UEH6.js.map} +1 -1
- package/dist/{chunk-HG75MP47.js → chunk-ATL7CYF2.js} +3 -3
- package/dist/{chunk-HG75MP47.js.map → chunk-ATL7CYF2.js.map} +1 -1
- package/dist/{chunk-KLVEKLFL.js → chunk-AZT4TALZ.js} +5 -5
- package/dist/{chunk-KLVEKLFL.js.map → chunk-AZT4TALZ.js.map} +1 -1
- package/dist/{chunk-S5ZKI3TY.js → chunk-BPM6LSOV.js} +4 -4
- package/dist/{chunk-S5ZKI3TY.js.map → chunk-BPM6LSOV.js.map} +1 -1
- package/dist/{chunk-JXLZTGQN.js → chunk-CU2DV3Z4.js} +3 -3
- package/dist/{chunk-JXLZTGQN.js.map → chunk-CU2DV3Z4.js.map} +1 -1
- package/dist/chunk-F3SXHQU4.js +206 -0
- package/dist/chunk-F3SXHQU4.js.map +1 -0
- package/dist/{chunk-WC2ZDV4J.js → chunk-GIYRCRS6.js} +3 -3
- package/dist/{chunk-WC2ZDV4J.js.map → chunk-GIYRCRS6.js.map} +1 -1
- package/dist/{chunk-5FEFYFTS.js → chunk-IK7CQSEA.js} +3 -3
- package/dist/{chunk-5FEFYFTS.js.map → chunk-IK7CQSEA.js.map} +1 -1
- package/dist/{chunk-UXS3QCHM.js → chunk-J4EFCWMM.js} +14 -14
- package/dist/{chunk-UXS3QCHM.js.map → chunk-J4EFCWMM.js.map} +1 -1
- package/dist/{chunk-TK6A4UON.js → chunk-LB4U7GI3.js} +4 -4
- package/dist/{chunk-TK6A4UON.js.map → chunk-LB4U7GI3.js.map} +1 -1
- package/dist/{chunk-LMMDVLAB.js → chunk-LCRHHSBP.js} +7 -5
- package/dist/chunk-LCRHHSBP.js.map +1 -0
- package/dist/{chunk-EGJ2SV6O.js → chunk-LGXEXLX3.js} +12 -12
- package/dist/chunk-LGXEXLX3.js.map +1 -0
- package/dist/{chunk-GJFK3SU5.js → chunk-MBU4LSRZ.js} +4 -4
- package/dist/{chunk-GJFK3SU5.js.map → chunk-MBU4LSRZ.js.map} +1 -1
- package/dist/{chunk-EJ66I5SH.js → chunk-MJ3DLAC3.js} +4 -4
- package/dist/{chunk-EJ66I5SH.js.map → chunk-MJ3DLAC3.js.map} +1 -1
- package/dist/{chunk-DMS6PZXN.js → chunk-MOAMYULW.js} +4 -4
- package/dist/{chunk-DMS6PZXN.js.map → chunk-MOAMYULW.js.map} +1 -1
- package/dist/{chunk-3QR6T7KW.js → chunk-N36TVQP2.js} +6 -201
- package/dist/chunk-N36TVQP2.js.map +1 -0
- package/dist/{chunk-VFQNVPFH.js → chunk-NRPYHHRQ.js} +7 -7
- package/dist/{chunk-VFQNVPFH.js.map → chunk-NRPYHHRQ.js.map} +1 -1
- package/dist/{chunk-6KZUGNCS.js → chunk-NUTURBAK.js} +3 -3
- package/dist/{chunk-6KZUGNCS.js.map → chunk-NUTURBAK.js.map} +1 -1
- package/dist/{chunk-EOQPV6KS.js → chunk-O2RXB3P3.js} +7 -7
- package/dist/{chunk-EOQPV6KS.js.map → chunk-O2RXB3P3.js.map} +1 -1
- package/dist/{chunk-HEWFF3KI.js → chunk-OEM2SFJE.js} +3 -3
- package/dist/{chunk-HEWFF3KI.js.map → chunk-OEM2SFJE.js.map} +1 -1
- package/dist/{chunk-A7KXUBPT.js → chunk-OJMG3NAF.js} +3 -3
- package/dist/{chunk-A7KXUBPT.js.map → chunk-OJMG3NAF.js.map} +1 -1
- package/dist/{chunk-TVAXTMMQ.js → chunk-QQWJNRSI.js} +3 -3
- package/dist/{chunk-TVAXTMMQ.js.map → chunk-QQWJNRSI.js.map} +1 -1
- package/dist/{chunk-6EOAIIHL.js → chunk-RUUQ5OVU.js} +3 -3
- package/dist/{chunk-6EOAIIHL.js.map → chunk-RUUQ5OVU.js.map} +1 -1
- package/dist/{chunk-R73HXW5D.js → chunk-SCBSKIBA.js} +4 -4
- package/dist/{chunk-R73HXW5D.js.map → chunk-SCBSKIBA.js.map} +1 -1
- package/dist/{chunk-ITZ543CK.js → chunk-SOLUKKTW.js} +3 -3
- package/dist/{chunk-ITZ543CK.js.map → chunk-SOLUKKTW.js.map} +1 -1
- package/dist/{chunk-TWLJ2RII.js → chunk-TDIENKPW.js} +4 -4
- package/dist/{chunk-TWLJ2RII.js.map → chunk-TDIENKPW.js.map} +1 -1
- package/dist/{chunk-5MNGLNIJ.js → chunk-UXJAZ5JP.js} +3 -3
- package/dist/{chunk-5MNGLNIJ.js.map → chunk-UXJAZ5JP.js.map} +1 -1
- package/dist/{chunk-JFKHKDSK.js → chunk-VNZ6VI2O.js} +3 -3
- package/dist/{chunk-JFKHKDSK.js.map → chunk-VNZ6VI2O.js.map} +1 -1
- package/dist/{chunk-OXBMZSKL.js → chunk-VXMWMGBQ.js} +4 -4
- package/dist/{chunk-OXBMZSKL.js.map → chunk-VXMWMGBQ.js.map} +1 -1
- package/dist/{chunk-YPRSS27D.js → chunk-XMSZSSTZ.js} +4 -4
- package/dist/{chunk-YPRSS27D.js.map → chunk-XMSZSSTZ.js.map} +1 -1
- package/dist/{chunk-R4BPODDJ.js → chunk-YRIMECFU.js} +3 -3
- package/dist/{chunk-R4BPODDJ.js.map → chunk-YRIMECFU.js.map} +1 -1
- package/dist/{chunk-CJZ3MJ3Y.js → chunk-ZNA3SWRP.js} +7 -7
- package/dist/{chunk-CJZ3MJ3Y.js.map → chunk-ZNA3SWRP.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 +12 -12
- package/dist/components/home/HomePageRenderer.d.ts +3 -1
- package/dist/components/home/HomePageRenderer.d.ts.map +1 -1
- package/dist/components/home/LatestProducts.d.ts +13 -0
- package/dist/components/home/LatestProducts.d.ts.map +1 -0
- package/dist/components/home/index.js +17 -16
- package/dist/components/home/lazy.d.ts +1 -0
- package/dist/components/home/lazy.d.ts.map +1 -1
- package/dist/components/home/register.d.ts.map +1 -1
- package/dist/components/layout/index.js +4 -4
- package/dist/components/navigation/MainMenu.d.ts.map +1 -1
- package/dist/components/product/index.js +14 -13
- package/dist/components/store/index.js +13 -13
- package/dist/dev/editor/index.js +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/{document-class-IGGYSGCU.js → document-class-B4WBGWSA.js} +11 -11
- package/dist/{document-class-IGGYSGCU.js.map → document-class-B4WBGWSA.js.map} +1 -1
- package/dist/hooks/index.js +12 -12
- package/dist/hooks/useGtm.js +12 -12
- package/dist/hooks/useMoney.js +12 -12
- package/dist/hooks/useStore.js +12 -12
- package/dist/hooks/useUser.js +3 -3
- package/dist/index.js +12 -12
- package/dist/{navigation-MJYWGH7A.js → navigation-MBQKDV5V.js} +5 -5
- package/dist/{navigation-MJYWGH7A.js.map → navigation-MBQKDV5V.js.map} +1 -1
- package/dist/{navigation-FUHRDRAN.js → navigation-VPRCR725.js} +4 -4
- package/dist/{navigation-FUHRDRAN.js.map → navigation-VPRCR725.js.map} +1 -1
- package/dist/{not-found-VVI6BXAZ.js → not-found-OIZGDR7G.js} +15 -15
- package/dist/{not-found-VVI6BXAZ.js.map → not-found-OIZGDR7G.js.map} +1 -1
- package/dist/providers/index.js +12 -12
- 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 +21 -20
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home/HomePage.d.ts.map +1 -1
- package/dist/routes/home.js +18 -17
- package/dist/routes/index.js +3 -3
- package/dist/routes/loyalty.js +5 -5
- package/dist/routes/page.js +4 -4
- package/dist/routes/product-listing.js +19 -18
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +17 -16
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/root/beforeLoad.d.ts.map +1 -1
- package/dist/routes/seo-redirects.js +3 -3
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +4 -4
- package/dist/skeleton.js +18 -17
- package/dist/{store-lookup-2P7PQVXE.js → store-lookup-HMU7QMSC.js} +8 -8
- package/dist/{store-lookup-2P7PQVXE.js.map → store-lookup-HMU7QMSC.js.map} +1 -1
- package/dist/tanstack/link.d.ts.map +1 -1
- package/dist/tanstack.js +11 -11
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/tailwind/components/home/HomePageRenderer.tsx.txt +14 -3
- package/tailwind/components/home/LatestProducts.tsx.txt +63 -0
- package/tailwind/components/home/lazy.ts.txt +4 -0
- package/tailwind/components/home/register.ts.txt +2 -0
- package/tailwind/components/navigation/MainMenu.tsx.txt +2 -1
- package/tailwind/routes/home/HomePage.tsx.txt +6 -0
- package/tailwind/routes/root/beforeLoad.ts.txt +4 -2
- package/dist/MainMenu-ML6OQT53.js.map +0 -1
- package/dist/NoContent-63TMCPGY.js.map +0 -1
- package/dist/chunk-3QR6T7KW.js.map +0 -1
- package/dist/chunk-EGJ2SV6O.js.map +0 -1
- package/dist/chunk-LMMDVLAB.js.map +0 -1
- package/dist/chunk-P43VADN7.js.map +0 -1
- package/dist/chunk-SAYYMA6E.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tanstack/search.ts","../src/routes/root/beforeLoad.ts","../src/tanstack/store-base.ts","../src/tanstack/router.tsx","../src/tanstack/document-class.ts"],"names":["tanstackNotFound","createTanStackRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,MAAA,GAAS,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAyB,GAAA,CAAI,QAAA,CAAS,IAAI,CAAA,IAAK,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAGtF,SAAS,gBAAgB,MAAA,EAAyC;AACvE,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA;AACrC,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,MAAA,CAAO,MAAM,CAAA;AACnC,EAAA,IAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,uBAAuB,MAAM,CAAA;AAEvD,EAAA,MAAM,IAAA,GAAO,sBAAA;AAAA,IACX,MAAA,CAAO,WAAA,CAAY,OAAA,CAAQ,MAAA,CAAO,CAAC,UAAU,CAAC,MAAA,CAAO,KAAK,CAAC,CAAC;AAAA,GAC9D;AACA,EAAA,MAAM,WAAW,KAAA,CAAM,OAAA;AAAA,IAAQ,CAAC,CAAC,GAAA,EAAK,MAAM,MAC1C,MAAA,CAAO,GAAA;AAAA,MACL,CAAC,KAAA,KACC,CAAA,EAAG,kBAAA,CAAmB,GAAG,CAAC,CAAA,CAAA,EAAI,kBAAA,CAAmB,OAAO,KAAA,KAAU,WAAW,KAAA,GAAQ,IAAA,CAAK,SAAA,CAAU,KAA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W,EAAE,GAAI,EAAE,CAAA;AAClE,EAAA,OAAO,IAAA;AACT;AA0BO,SAAS,wBAAA,GAGd;AACA,EAAA,MAAM,OAAA,GAAU,eAAe,EAAE,MAAA,EAAQ,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,CAAA;AAE3D,EAAA,MAAM,kBAAkB,OAAA,CAAQ,GAAA;AAAA,IAC9B,CAAC,CAAA,KAAO,CAAA,CAAE,UAAA,EAAoD,aAAA,EAAe,QAAQ;AAAC,GACxF;AACA,EAAA,MAAM,kBAAkB,OAAA,CAAQ,GAAA;AAAA,IAC9B,CAAC,CAAA,KAAO,CAAA,CAAE,UAAA,EAAoD,aAAA,EAAe,QAAQ;AAAC,GACxF;AAEA,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,YAAA,CAAa,iBAAA,CAAkB,eAAe,CAAC,CAAA;AAAA,IAC1D,SAAA,EAAW,YAAA,CAAa,iBAAA,CAAkB,eAAe,CAAC;AAAA,GAC5D;AACF;AAKO,SAAS,wBAAwB,UAAA,EAGtC;AACA,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,aAAa,iBAAA,CAAkB,CAAC,WAAW,IAAA,IAAQ,EAAE,CAAC,CAAC,CAAA;AAAA,IAClE,SAAA,EAAW,aAAa,iBAAA,CAAkB,CAAC,WAAW,IAAA,IAAQ,EAAE,CAAC,CAAC;AAAA,GACpE;AACF","file":"chunk-EGJ2SV6O.js","sourcesContent":["import { defaultStringifySearch } from '@tanstack/react-router';\n\nconst isList = ([key, value]: [string, unknown]) => key.endsWith('[]') && Array.isArray(value);\n\n/** The router's query serialiser, writing `[]` keys back as repeated keys, as `<salla-filters>` does. */\nexport function stringifySearch(search: Record<string, unknown>): string {\n const entries = Object.entries(search);\n const lists = entries.filter(isList) as [string, unknown[]][];\n if (!lists.length) return defaultStringifySearch(search);\n\n const rest = defaultStringifySearch(\n Object.fromEntries(entries.filter((entry) => !isList(entry)))\n );\n const repeated = lists.flatMap(([key, values]) =>\n values.map(\n (value) =>\n `${encodeURIComponent(key)}=${encodeURIComponent(typeof value === 'string' ? value : JSON.stringify(value))}`\n )\n );\n return `${rest || '?'}${rest ? '&' : ''}${repeated.join('&')}`;\n}\n","import type { QueryClient } from '@tanstack/react-query';\nimport { redirect } from '@tanstack/react-router';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport {\n getCookie,\n getRequestHeader,\n getRequestUrl,\n setCookie,\n} from '@tanstack/react-start/server';\nimport type { StoreContext } from '../../api/store';\nimport { store as storeApi } from '../../api/store';\nimport { apps, type AppSnippet, type AppSettings } from '../../api/apps';\nimport { translations } from '../../api/translations';\nimport { advertisement } from '../../api/advertisement';\nimport { FALLBACK_LOCALE, getLanguageInfo } from '../../providers/locale-constants';\nimport { createI18nInstance } from '../../providers/i18n-factory';\nimport type { TwilightLocation } from '../../twilight/context';\nimport { getTwilightContext, updateTwilightContext } from '../../twilight/context';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n extractScopeFromCookies,\n extractScopeFromUrl,\n extractTokenFromCookies,\n resolveRequestScope,\n sameScope,\n SCOPE_COOKIE_MAX_AGE,\n SCOPE_COOKIE_NAME,\n syncScopeCookie,\n type ActiveScope,\n} from '../../utils/cookies';\nimport { syncSdkLocale, syncSdkThemeVersion } from '../../utils/sdk-helpers';\nimport { SettingsError } from '../../utils/errors';\nimport {\n currentHost,\n resolveStoreBase,\n resolveStoreBaseFollowsLocale,\n resolveStoreBaseRedirect,\n} from '../../utils/store-identity';\nimport { persistLanguageCookie, readCookieHeader } from '../../utils/language-cookie';\nimport { decideSharedHostLanguage } from '../../utils/shared-host-language';\nimport { prefixStoreBase } from '../../utils/store-base';\nimport { preloadServerComponents } from '../../utils/lazy-component';\nimport {\n ownerCookieMatches,\n ownerLinkMatches,\n showsMaintenancePage,\n VIEW_AS_OWNER_COOKIE_NAME,\n} from '../../utils/maintenance';\n\n// Reads the `token` cookie from the incoming request on the SERVER. twilightMiddleware\n// extracts the same cookie into a custom ALS, but that ALS does NOT propagate to the\n// route's beforeLoad / React SSR render (they run in a different async scope), so the\n// token must be read again here from the framework's own request context. On the client\n// this is a no-op (the cookie is read from document.cookie below instead). The server\n// import is stripped from the client bundle by createIsomorphicFn.\nconst readServerCookieToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The market the settings were answered for, when the request asked with another one and\n * its address did not switch market; null otherwise.\n *\n * That is a market's own domain (`us.store.com`): the API serves the market the domain is\n * pinned to, whatever the `scope` cookie remembers from an earlier visit. The page has to\n * take that market over, or the SDK keeps sending the remembered one and creates the\n * guest's cart in it, which every request answered for the domain's market then refuses\n * (TD-17588). A request that asked with no scope has nothing stale to correct. The branch\n * is dropped with the market it belonged to; the type is store-wide, so it is the\n * answer's, else the requested one.\n */\nexport function hostPinnedScope(\n url: string,\n requested: ActiveScope | null,\n settings: StoreContext\n): ActiveScope | null {\n if (!requested || extractScopeFromUrl(url)) return null;\n const answered = settings.store?.scope;\n if (answered?.id == null || String(answered.id) === requested.id) return null;\n const type = answered.type ?? requested.type;\n return type ? { id: String(answered.id), type } : { id: String(answered.id) };\n}\n\n/**\n * The scope to write to the `scope` cookie for this request, or null to leave the cookie\n * as it is.\n *\n * The market a market's own domain answered with, over a remembered one; see\n * {@link hostPinnedScope}.\n *\n * Otherwise only for a market a `?scope=` URL switched to, and only when the settings were\n * answered for it: the API falls back to another market when it does not accept the\n * requested one, and Twig keeps the previous choice then too, rather than recording one\n * the page is not showing. Its type is the one the settings answered with: a URL names\n * only the id, and the store-wide type is assumed until the answer says otherwise (a\n * store browsing by branch or city), so later requests send the type the API matches\n * against.\n */\nexport function scopeCookieUpdate(\n url: string,\n cookieHeader: string | null,\n settings: StoreContext\n): ActiveScope | null {\n const pinned = hostPinnedScope(url, extractScopeFromCookies(cookieHeader), settings);\n if (pinned) return pinned;\n if (!extractScopeFromUrl(url)) return null;\n const scope = resolveRequestScope(url, cookieHeader);\n const answered = settings.store?.scope;\n if (!scope || answered?.id == null || String(answered.id) !== scope.id) return null;\n const typed = answered.type ? { ...scope, type: answered.type } : scope;\n return sameScope(extractScopeFromCookies(cookieHeader), typed) ? null : typed;\n}\n\n/** The request's scope with the type its settings answered with, or null when that changes nothing. */\nfunction withAnsweredType(scope: ActiveScope | null, settings: StoreContext): ActiveScope | null {\n const answered = settings.store?.scope;\n if (!scope || !answered?.type || String(answered.id) !== scope.id) return null;\n return answered.type === scope.type ? null : { ...scope, type: answered.type };\n}\n\n/**\n * Gives the request the scope its settings answered with, for the rest of this render:\n * the market a market's own domain is pinned to when the request asked with another (see\n * {@link hostPinnedScope}; only with the page `url`), else the same scope with the type\n * the answer named. Files the settings and ads under the key the corrected scope makes, so\n * the browser — which reads the corrected scope from the cookie (see\n * {@link scopeCookieUpdate}) — finds them dehydrated instead of fetching them again. The\n * entry under the assumed scope's key is removed, so the page carries them once.\n * Server-only; a no-op when there is nothing to correct.\n */\nexport function alignRequestScope(\n queryClient: QueryClient,\n settings: StoreContext,\n url?: string\n): void {\n let scope: ActiveScope | null;\n try {\n scope = getTwilightContext().scope;\n } catch {\n return;\n }\n const aligned =\n (url === undefined ? null : hostPinnedScope(url, scope, settings)) ??\n withAnsweredType(scope, settings);\n if (!aligned) return;\n const assumedKey = storeApi.queries.settings().queryKey;\n const assumedAdsKey = advertisement.queries.list().queryKey;\n updateTwilightContext({ scope: aligned });\n queryClient.setQueryData(storeApi.queries.settings().queryKey, settings);\n // Moved, not copied: both would be dehydrated, sending the settings twice.\n queryClient.removeQueries({ queryKey: assumedKey, exact: true });\n const ads = queryClient.getQueryData(assumedAdsKey);\n if (ads) queryClient.setQueryData(advertisement.queries.list().queryKey, ads);\n queryClient.removeQueries({ queryKey: assumedAdsKey, exact: true });\n}\n\n/**\n * Writes {@link scopeCookieUpdate} to the response. Read from the request itself rather\n * than the middleware's context, for the same reason as {@link readServerCookieToken}.\n * Server-only.\n */\nexport const persistRequestScope = createIsomorphicFn()\n .server((settings: StoreContext): void => {\n let scope: ActiveScope | null;\n try {\n scope = scopeCookieUpdate(\n String(getRequestUrl()),\n getRequestHeader('cookie') ?? null,\n settings\n );\n } catch {\n // Outside a request (prerender): there is no response to write to.\n return;\n }\n if (!scope) return;\n setCookie(SCOPE_COOKIE_NAME, JSON.stringify(scope), {\n path: '/',\n maxAge: SCOPE_COOKIE_MAX_AGE,\n sameSite: 'lax',\n });\n })\n .client((): void => {});\n\n/** The request's cookie header: the framework's on the server, the document's in the browser. */\nconst requestCookies = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getRequestHeader('cookie') ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => (typeof document !== 'undefined' ? document.cookie : null));\n\n/** Remembers the owner view for the rest of this browser session; see {@link VIEW_AS_OWNER_COOKIE_NAME}. */\nconst rememberOwnerView = createIsomorphicFn()\n .server((storeId: string): void => {\n try {\n setCookie(VIEW_AS_OWNER_COOKIE_NAME, storeId, { path: '/', sameSite: 'lax' });\n } catch {\n // Outside a request (prerender): there is no response to write to.\n }\n })\n .client((storeId: string): void => {\n document.cookie = `${VIEW_AS_OWNER_COOKIE_NAME}=${storeId}; path=/; SameSite=Lax`;\n });\n\n/**\n * Whether this visitor sees the maintenance page instead of the store, deciding and\n * remembering the merchant's owner view on the way.\n *\n * Twig's backend lets the merchant into their closed store when the dashboard's link\n * brings them (`?utm_source=dashboard&identifier=<store id>`), and keeps that in the\n * session. Here the link grants a session cookie, and the cookie or the link is the\n * owner view. A customer gets the maintenance page, and `twilightMiddleware` turns the\n * render into a 503 (see `withMaintenanceStatus`).\n *\n * The preview host is let through whoever is looking, so the dashboard's theme editor\n * renders a closed or not-yet-launched store; see {@link showsMaintenancePage}. The host\n * is the request's on the server and the browser's own in the browser, so a navigation\n * inside the editor's frame, which carries no owner link, is decided the same way as the\n * first load.\n */\nexport function resolveMaintenance(href: string, settings: StoreContext): boolean {\n const fromLink = ownerLinkMatches(href, settings);\n const storeId = settings.store?.id;\n if (fromLink && storeId != null) rememberOwnerView(String(storeId));\n const viewAsOwner = fromLink || ownerCookieMatches(requestCookies(), settings);\n return showsMaintenancePage(settings, viewAsOwner, currentHost());\n}\n\n/** The URL of the request being rendered; null outside one (a prerender) and in the browser. */\nconst serverRequestUrl = createIsomorphicFn()\n .server((): string | null => {\n try {\n return String(getRequestUrl());\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/** On the server, once the settings are in: {@link alignRequestScope}, then {@link persistRequestScope}. */\nfunction settleRequestScope(queryClient: QueryClient, settings: StoreContext): void {\n if (typeof window !== 'undefined') return;\n alignRequestScope(queryClient, settings, serverRequestUrl() ?? undefined);\n persistRequestScope(settings);\n}\n\n/**\n * On a Salla shared host the address carries no language, so `locale` here is a virtual\n * one (`?lang=`, then the `s-lang` cookie, then the fallback). Once the settings say what\n * the store offers: remembers a language `?lang=` asked for, takes `?lang=` off the URL, and\n * sends a visitor whose language the store does not offer to the store's default. A full\n * load, because the router handling this request resolved its locale before it knew. See\n * `decideSharedHostLanguage` for the rules, and why none of them can loop.\n *\n * A no-op everywhere else.\n */\nfunction settleSharedHostLanguage(\n settings: StoreContext,\n locale: string,\n location: TwilightLocation\n): void {\n const base = resolveStoreBase();\n if (!base || !resolveStoreBaseFollowsLocale()) return;\n\n // The router's href has the virtual locale in it and no store segment; the browser's has\n // the store segment and no locale.\n const url = new URL(location.href, 'http://shared-host.invalid');\n const decision = decideSharedHostLanguage({\n settings,\n locale,\n href: `${prefixStoreBase(url.pathname, base, true)}${url.search}${url.hash}`,\n cookieHeader: readCookieHeader(),\n });\n\n if (decision.cookie) persistLanguageCookie(decision.cookie);\n if (decision.redirectTo) {\n throw redirect({ href: decision.redirectTo, reloadDocument: true, replace: true });\n }\n}\n\nexport interface BeforeLoadResult {\n settings: StoreContext;\n locale: string;\n /**\n * Whether this page is on a Salla shared host, where the address carries no language.\n * The generated locale layout reads it: it must not redirect between locale-less and\n * locale-bearing paths there, because the router strips the locale from every address.\n */\n storeBaseFollowsLocale: boolean;\n dir: 'ltr' | 'rtl';\n authToken: string | null;\n /** Installed apps' snippets, threaded through the beforeLoad context (and recovered on the\n * client via ensureTwilightContextFromMatches) so AppsSnippets can render CDN tags in SSR. */\n appsSnippets?: AppSnippet[];\n /** Per-app public `app.*` buckets, threaded the same way so rootHead can install the\n * `Salla.appScope` factory inline in the SSR head. */\n appsSettings?: AppSettings;\n /** This visitor sees the maintenance page, not the store; see {@link resolveMaintenance}. */\n maintenance: boolean;\n}\n\n/**\n * The platform's copy for `locale`, with this merchant's own wording over it.\n *\n * Returns the platform's copy untouched — and makes no request — unless the\n * settings say this language has overrides. That gate is the whole reason this\n * is affordable: the object 404s for most stores, uncached, on the critical\n * path of an SSR render.\n *\n * The entry is found by ISO code rather than by index or key. The API sends\n * `languages` as an object keyed by **upper-case** ISO, and `storeApi` converts\n * it to an array on the way through (`languagesToArray`), so neither the\n * upper-case key nor a position is available here — and matching case-sensitively\n * on `code` would be a lookup that misses silently, leaving the flag absent and\n * the feature simply never running.\n *\n * Nothing about this is fatal. A failed override read leaves the platform's\n * copy in place, which is a storefront in the words Salla ships rather than a\n * storefront that did not render.\n */\nasync function withMerchantTranslations(\n queryClient: QueryClient,\n settings: StoreContext,\n locale: string,\n common: Awaited<ReturnType<typeof translations.get>>\n): Promise<Awaited<ReturnType<typeof translations.get>>> {\n const wanted = locale.toLowerCase();\n const language = settings.languages?.find(\n (entry) => (entry.iso_code ?? entry.code)?.toLowerCase() === wanted\n );\n const storeId = settings.store?.id;\n\n if (!language?.has_custom_translations || !storeId) return common;\n\n try {\n const overrides = await queryClient.ensureQueryData(\n translations.queries.byStore(storeId, locale)\n );\n\n return translations.merge(common, overrides, locale);\n } catch (error) {\n console.warn('[salla] merchant translations could not be read; using the platform copy', error);\n return common;\n }\n}\n\n/**\n * What the root route throws when the settings did not load: their own failure, which\n * says why. When it says no store has this identifier, that is recorded first, and\n * `twilightMiddleware` answers with Twig's 410 page instead of the render.\n */\nfunction settingsFailureToThrow(failure: unknown): SettingsError {\n if (!(failure instanceof SettingsError)) return new SettingsError();\n if (failure.reason === 'not-found') updateTwilightContext({ storeNotFound: true });\n return failure;\n}\n\nexport async function rootBeforeLoad(ctx: {\n params: Record<string, string>;\n location: TwilightLocation;\n context: {\n queryClient: QueryClient;\n setLocation?: (location: Partial<TwilightLocation>) => void;\n };\n serverContext?: {\n authToken?: string | null;\n };\n}): Promise<BeforeLoadResult> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n const { dir } = getLanguageInfo(locale);\n\n if (ctx.context.setLocation) {\n ctx.context.setLocation(ctx.location);\n }\n\n // Set locale in context before any API calls so interceptor uses correct locale\n updateTwilightContext({ locale });\n\n // Re-assert the locale on the Salla SDK on every navigation. The SDK's axios\n // accept-language header drifts off the route locale (navigator.language default,\n // account-language override on profile fetch — see syncSdkLocale), which makes\n // SDK API calls (e.g. the cart's salla.api.cart.details) return wrong-locale data.\n syncSdkLocale(locale);\n\n // Mirror the SDK's selected branch into the `scope` cookie. The SDK persists the\n // selection in localStorage ONLY, so the server — which can only see cookies —\n // would otherwise compute scope=null for every visitor who picked a branch, and\n // the dehydrated settings query (keyed on the scope) would never match on the\n // client. No-op on the server and while the SDK storage API is still hydrating.\n syncScopeCookie();\n\n // On the server, the lazy components load beside the requests below, so none suspends in\n // the render: a fresh isolate otherwise streamed every block after the shell.\n const componentsLoaded = preloadServerComponents();\n\n // Kept until the rest have settled, as a missing answer always was, then thrown:\n // it says why the store did not load.\n let settingsFailure: unknown;\n const [settingsResult, translationsResult, snippetsResult, appSettingsResult] = await Promise.all(\n [\n ctx.context.queryClient.ensureQueryData(storeApi.queries.settings()).catch((error): null => {\n settingsFailure = error;\n return null;\n }),\n ctx.context.queryClient.ensureQueryData(translations.queries.byLocale(locale)),\n // Snippets → SSR CDN <script> tags (AppsSnippets.ssrCdnScripts). Non-fatal + logged:\n // on failure AppsSnippets falls back to its own client-side query for the same data,\n // so the tags render a paint later instead of being lost for the page load.\n ctx.context.queryClient.ensureQueryData(apps.queries.snippets()).catch((error): undefined => {\n console.warn('[salla] apps/snippets prefetch failed; rendering no CDN snippet tags', error);\n return undefined;\n }),\n // Buckets → rootHead installs `Salla.appScope` inline in the SSR head (before any snippet\n // onReady runs). Non-fatal + logged: the head installs the factory either way, and the\n // client query seeds the buckets into that install once it resolves.\n ctx.context.queryClient.ensureQueryData(apps.queries.settings()).catch((error): undefined => {\n console.warn(\n '[salla] apps/snippets/settings prefetch failed; appScope buckets unseeded',\n error\n );\n return undefined;\n }),\n // Ads → the header's announcement bar renders on the server, so it no longer pushes the\n // page down when it arrives. Non-fatal: the bar then loads on the client, as before.\n ctx.context.queryClient\n .ensureQueryData(advertisement.queries.list())\n .catch((error): undefined => {\n console.warn('[salla] advertisements prefetch failed; the ad bar loads late', error);\n return undefined;\n }),\n ]\n );\n\n await componentsLoaded;\n if (!settingsResult) throw settingsFailureToThrow(settingsFailure);\n\n // Settings answered for another market name another theme version; the SDK only\n // read its `s-version-id` at init — see syncSdkThemeVersion.\n syncSdkThemeVersion(settingsResult.headers);\n\n settleRequestScope(ctx.context.queryClient, settingsResult);\n\n // On a host where the store is the root of every URL, a page has one address:\n // `/<username>/…`. A request that found its store some other way (`?storeId=`,\n // the preview cookie, `VITE_STORE_DOMAIN`) is sent there now that the settings\n // say what the username is. A full load rather than a client navigation, because\n // the router handling this request was built without that root.\n const storeBaseHref = resolveStoreBaseRedirect(settingsResult.store?.username, ctx.location.href);\n if (storeBaseHref) {\n throw redirect({ href: storeBaseHref, reloadDocument: true, replace: true });\n }\n\n // Before the maintenance decision: its redirect keeps every other query parameter, so the\n // owner link (`?utm_source=dashboard&identifier=`) still reaches the request that follows.\n settleSharedHostLanguage(settingsResult, locale, ctx.location);\n\n const maintenance = resolveMaintenance(ctx.location.href, settingsResult);\n\n // The merchant's own wording, laid over the platform's — but only when the\n // settings say this language has any.\n //\n // Sequenced after the `Promise.all` on purpose: the object is keyed by\n // `settings.store.id`, which the settings query is what produces, so this\n // cannot join the batch above. The cost of a second round trip is why it is\n // gated rather than always fetched — see `api/translations.ts` for the two\n // corrections that shape led to.\n const messages = await withMerchantTranslations(\n ctx.context.queryClient,\n settingsResult,\n locale,\n translationsResult\n );\n\n // Create i18n instance with loaded translations\n const i18n = createI18nInstance(locale, messages ?? undefined);\n\n // Resolve authToken with fallback chain:\n // 1. SSR context (from middleware extracting cookies on server)\n // 2. The twilight context token. On the SERVER this is the token twilightMiddleware\n // extracted from the `token` cookie into the request ALS — reading it here is\n // essential, otherwise this loader's updateTwilightContext() below would\n // overwrite the middleware's token with null and every SSR render (e.g. the\n // account hub) would be unauthenticated. On the CLIENT it's the clientStore\n // token from hydration or a previous navigation.\n // 3. The `token` cookie read directly — client fallback when clientStore is empty\n // and salla.storage hasn't hydrated yet.\n // 4. Salla SDK storage (salla.storage.get('token'))\n let existingToken: string | null = null;\n try {\n existingToken = getTwilightContext().authToken;\n } catch {\n // No request context (e.g. server call outside the middleware ALS) — fall through.\n existingToken = null;\n }\n const cookieToken =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n const sallaToken =\n typeof window !== 'undefined' && typeof window.salla?.storage?.get === 'function'\n ? (window.salla.storage.get(AUTH_TOKEN_COOKIE_NAME) as string | null)\n : null;\n const serverCookieToken = readServerCookieToken();\n const authToken =\n ctx.serverContext?.authToken ??\n serverCookieToken ??\n existingToken ??\n cookieToken ??\n sallaToken ??\n null;\n\n updateTwilightContext({\n queryClient: ctx.context.queryClient,\n settings: settingsResult,\n locale,\n location: ctx.location,\n i18n,\n authToken,\n appsSnippets: snippetsResult,\n appsSettings: appSettingsResult,\n maintenance,\n });\n\n return {\n settings: settingsResult,\n locale,\n storeBaseFollowsLocale: resolveStoreBaseFollowsLocale(),\n dir,\n authToken,\n appsSnippets: snippetsResult,\n appsSettings: appSettingsResult,\n maintenance,\n };\n}\n","/**\n * @fileoverview The store segment, carried by the router instead of the route tree.\n *\n * TanStack Router rewrites every location it reads and every one it writes:\n * `input` runs before a URL is matched, and `output` before an href is rendered,\n * pushed to history or sent as a redirect's `Location`. So on a host where the\n * store is the root, the route tree stays `/{-$locale}/cart` and\n * `<Link to=\"/cart\">` renders `/mtgr-alaatr-2/cart` by itself.\n *\n * Why not the router's `basepath`: TanStack Start overwrites it from the build on\n * both sides (`router.update({ basepath })` per request on the server, and in\n * `hydrateStart` on the client). `rewrite` is a separate option that the router\n * composes with that basepath, so it survives. Server functions are dispatched on\n * the raw URL before the router runs, and assets are root-absolute, so neither\n * moves. See `docs/store-base-path.md`.\n */\nimport type { LocationRewrite } from '@tanstack/react-router';\nimport { isLocale } from '../providers/locale-constants';\nimport { readCookieHeader, readPageSearch } from '../utils/language-cookie';\nimport { hasLanguageParam, virtualLocale, withLanguageParam } from '../utils/shared-host-language';\nimport { prefixStoreBase, stripStoreBase } from '../utils/store-base';\n\n/**\n * A rewrite that serves the application from `/<base>`.\n *\n * With `followsLocale` (a Salla shared host) the address carries no language, but the\n * route tree still has its `/{-$locale}` segment, so the language is a *virtual* one:\n * `input` puts it in front of the path (`/dev-x/cart` → `/ar/cart`, from `?lang=`, then\n * the `s-lang` cookie, then the fallback) and `output` takes it off again. The old\n * address, `/ar/dev-x/cart`, is still understood and keeps its own language.\n *\n * A link keeps `?lang=` for as long as the page it is on carries one (see `output`), so a\n * visitor whose browser blocks the cookie does not lose the language on the next page.\n */\nexport function storeBaseRewrite(base: string, followsLocale = false): LocationRewrite {\n return {\n input: ({ url }) => {\n if (!followsLocale) {\n url.pathname = stripStoreBase(url.pathname, base);\n return url;\n }\n\n const [, first, second] = url.pathname.split('/');\n if (isLocale(first) && second === base) {\n url.pathname = stripStoreBase(url.pathname, base, true);\n return url;\n }\n\n const stripped = stripStoreBase(url.pathname, base);\n // Not under the store segment: nothing to put a language in front of.\n if (stripped === url.pathname) return url;\n\n const locale = virtualLocale(url.search, readCookieHeader());\n url.pathname = stripped === '/' ? `/${locale}` : `/${locale}${stripped}`;\n return url;\n },\n output: ({ url }) => {\n if (!followsLocale) {\n url.pathname = prefixStoreBase(url.pathname, base);\n return url;\n }\n\n const [, leading] = url.pathname.split('/');\n url.pathname = prefixStoreBase(url.pathname, base, true);\n\n // While the page's own address still carries `?lang=`, the cookie has not been confirmed\n // (a browser that blocks it never does), so a link that dropped its language would open in\n // another one. Such a link keeps naming its language, until a request arrives with the\n // cookie and `rootBeforeLoad` takes `?lang=` off the address.\n const page = readPageSearch();\n if (hasLanguageParam(page) && !hasLanguageParam(url.search)) {\n url.search = withLanguageParam(\n url.search,\n isLocale(leading) ? leading : virtualLocale(page, null)\n );\n }\n return url;\n },\n };\n}\n","import type { ReactNode } from 'react';\nimport { Suspense } from 'react';\nimport {\n createRouter as createTanStackRouter,\n createRootRouteWithContext,\n notFound as tanstackNotFound,\n} from '@tanstack/react-router';\nimport type { AnyRoute, BlockerFn, HistoryLocation, RouterHistory } from '@tanstack/react-router';\nimport { QueryClient } from '@tanstack/react-query';\nimport { shouldDehydrateQuery } from '../api/product';\nimport { PageSkeleton } from '@salla.sa/twilight-components-react/skeletons';\nimport { setHeadAdapter } from '../utils/head';\nimport { tanstackHeadAdapter } from './head';\nimport { stringifySearch } from './search';\nimport {\n updateTwilightContext,\n type PageContext,\n type TwilightLocation,\n} from '../twilight/context';\nimport type { Product } from '../types';\nimport { dispatchProductViewed, dispatchRouteChanged } from '../utils/sdk-events';\nimport { needsDocumentLoad, subscribeSnippetPageTargets } from '../utils/snippet-page-compat';\nimport { rootBeforeLoad, type BeforeLoadResult } from '../routes/root/beforeLoad';\nimport { rootHead } from '../routes/root/head';\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query';\nimport type { AnyRouter } from '@tanstack/react-router';\nimport { RouteId, type RouteIdType } from '../router/route-ids';\nimport {\n UnauthorizedError,\n NotFoundError,\n RedirectError,\n isMissingResource,\n responseStatusOf,\n} from '../providers/NavigationProvider';\nimport { ErrorPage } from '../components/common/ErrorPage';\nimport type { StoreContext } from '../api/store';\nimport type { AppSnippet, AppSettings } from '../api/apps';\nimport { createI18nInstance } from '../providers/i18n-factory';\nimport { messagesForLocale } from '../api/messages';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from '../utils/store-identity';\nimport { storeBaseRewrite } from './store-base';\nimport { lazyComponent } from '../utils/lazy-component';\n\n/**\n * Initial router context passed from createRouter to beforeLoad.\n */\nexport interface RouterInitialContext {\n queryClient: QueryClient;\n setLocation: (_location: Partial<TwilightLocation>) => void;\n}\n\n/**\n * TanStack Router ID Mapping\n *\n * Maps TanStack's auto-generated path-based route IDs to semantic RouteId constants.\n * This mapping is TanStack-specific because different frameworks generate route IDs differently:\n *\n * - TanStack: Uses file path as ID (e.g., '/{-$locale}/cart')\n * - Next.js: Uses file path without locale (e.g., '/cart')\n *\n * The mapping enables hooks like useIsHome(), useIsProduct() to work consistently\n * across frameworks while each framework has its own ID generation strategy.\n */\nexport const TANSTACK_ROUTE_ID_MAP: Record<string, RouteIdType> = {\n '/{-$locale}/': RouteId.INDEX,\n '/{-$locale}/cart': RouteId.CART,\n '/{-$locale}/search': RouteId.SEARCH,\n\n '/{-$locale}/latest-products': RouteId.PRODUCT_INDEX_LATEST,\n '/{-$locale}/most-sales-products': RouteId.PRODUCT_INDEX_SALES,\n '/{-$locale}/offers': RouteId.PRODUCT_INDEX_OFFERS,\n '/{-$locale}/products': RouteId.PRODUCT_INDEX,\n\n '/{-$locale}/$slug/c{$id}': RouteId.PRODUCT_INDEX,\n '/{-$locale}/$slug/p{$id}': RouteId.PRODUCT_SINGLE,\n '/{-$locale}/$slug/brand-{$id}': RouteId.BRANDS_SINGLE,\n '/{-$locale}/$slug/tag-{$id}': RouteId.PRODUCT_INDEX_TAG,\n '/{-$locale}/$slug/page-{$id}': RouteId.PAGE_SINGLE,\n\n '/{-$locale}/blog': RouteId.BLOG_INDEX,\n '/{-$locale}/blog/$slug/a-{$id}': RouteId.BLOG_SINGLE,\n '/{-$locale}/blog/$slug/c-{$id}': RouteId.BLOG_INDEX_CATEGORY,\n '/{-$locale}/blog/$slug/tag-{$id}': RouteId.BLOG_INDEX_TAG,\n '/{-$locale}/blog/author/$id': RouteId.BLOG_INDEX_AUTHOR,\n\n '/{-$locale}/brands': RouteId.BRANDS_INDEX,\n '/{-$locale}/brands/$id': RouteId.BRANDS_SINGLE,\n '/{-$locale}/tags/$id': RouteId.PRODUCT_INDEX_TAG,\n\n '/{-$locale}/profile': RouteId.CUSTOMER_PROFILE,\n '/{-$locale}/wishlist': RouteId.CUSTOMER_WISHLIST,\n '/{-$locale}/wallet': RouteId.CUSTOMER_WALLET,\n '/{-$locale}/notifications': RouteId.CUSTOMER_NOTIFICATIONS,\n '/{-$locale}/settings': RouteId.CUSTOMER_SETTINGS,\n '/{-$locale}/orders': RouteId.CUSTOMER_ORDERS_INDEX,\n '/{-$locale}/order/$id': RouteId.CUSTOMER_ORDERS_SINGLE,\n '/{-$locale}/pending-orders': RouteId.CUSTOMER_ORDERS_INDEX_PENDING,\n '/{-$locale}/account/pending_orders': RouteId.CUSTOMER_ORDERS_INDEX_PENDING,\n '/{-$locale}/account/rating': RouteId.CUSTOMER_ORDERS_INDEX,\n\n '/{-$locale}/logout': RouteId.LOGOUT,\n '/{-$locale}/loyalty': RouteId.LOYALTY,\n '/{-$locale}/loyalty_points': RouteId.CUSTOMER_LOYALTY_POINTS,\n '/{-$locale}/testimonials': RouteId.TESTIMONIALS,\n '/{-$locale}/reviews': RouteId.REVIEWS,\n '/{-$locale}/thankyou/$orderId': RouteId.THANK_YOU,\n};\n\n/**\n * Resolves a TanStack route ID to a semantic RouteId constant.\n * Falls back to the original ID if no mapping exists.\n * @internal Exported for testing\n */\nexport function resolveRouteId(tanstackId: string): string {\n return TANSTACK_ROUTE_ID_MAP[tanstackId] ?? tanstackId;\n}\n\n// Lazy load NotFoundPage for code splitting\nconst LazyNotFoundPage = lazyComponent(() =>\n import('../routes/not-found').then((m) => ({ default: m.NotFoundPage }))\n);\n\n/**\n * Error component shown when the root route fails to load.\n * This renders a minimal HTML page with error details.\n */\nfunction StoreUnavailablePage() {\n return (\n <>\n <div\n style={{\n position: 'fixed',\n inset: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: '#f9fafb',\n }}\n >\n <div style={{ textAlign: 'center', padding: '2rem' }}>\n <h1 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>\n Store is temporarily unavailable\n </h1>\n <p style={{ color: '#6b7280' }}>\n We're having trouble loading the store. Please try again in a moment.\n </p>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n style={{\n marginTop: '1rem',\n padding: '0.75rem 1.5rem',\n fontSize: '1rem',\n border: 'none',\n borderRadius: '0.5rem',\n background: '#111827',\n color: '#fff',\n cursor: 'pointer',\n }}\n >\n Retry\n </button>\n </div>\n </div>\n </>\n );\n}\n\nfunction RootErrorComponent({ error: _error }: { error: Error }) {\n return (\n <html lang=\"ar\" dir=\"rtl\">\n <head>\n <meta charSet=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>Store Unavailable</title>\n </head>\n <body style={{ margin: 0, fontFamily: 'sans-serif' }}>\n <StoreUnavailablePage />\n </body>\n </html>\n );\n}\n\n/**\n * Creates the root route pre-configured with RouterInitialContext.\n * beforeLoad will fetch settings/translations, loader returns serializable data.\n *\n * @example\n * ```ts\n * export const Route = createTwilightRootRoute()({ shellComponent });\n * ```\n */\nexport function createTwilightRootRoute() {\n const factory = createRootRouteWithContext<RouterInitialContext>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TanStack Router factory expects `any` for spread options\n return (options: any) =>\n factory({\n beforeLoad: rootBeforeLoad,\n head: rootHead,\n errorComponent: RootErrorComponent,\n ...options,\n });\n}\n\n/**\n * Default error component for route-level errors.\n */\nexport function DefaultErrorComponent({ error }: { error: unknown }) {\n if (error instanceof RedirectError) {\n return null;\n }\n\n if (error instanceof NotFoundError) {\n return <ErrorPage code={404} message={error.message} />;\n }\n\n if (error instanceof UnauthorizedError) {\n return <ErrorPage code={401} message={error.message} showAction={false} />;\n }\n\n const message =\n error instanceof Error\n ? error.message\n : error &&\n typeof error === 'object' &&\n 'message' in error &&\n typeof error.message === 'string'\n ? error.message\n : undefined;\n\n if (error && typeof error === 'object' && 'response' in error) {\n return responseErrorPage(error, message);\n }\n\n return <ErrorPage code={500} message={message} />;\n}\n\n/**\n * An error that carries an HTTP response. ky's own message names the API request\n * (\"Request failed with status code 410 Gone: GET https://api.salla.dev/…\"), which\n * is not a shopper's to read; an error a theme or the SDK made itself keeps its\n * message.\n */\nfunction responseErrorPage(error: object, message: string | undefined) {\n if (isMissingResource(error)) return <ErrorPage code={404} />;\n if (isHttpError(error)) {\n return <ErrorPage code={(responseStatusOf(error) ?? 500) >= 500 ? 500 : 400} />;\n }\n return <ErrorPage code={400} message={message} />;\n}\n\n/** An error ky threw for a non-2xx answer, as opposed to one carrying a response for its own reasons. */\nfunction isHttpError(error: object): boolean {\n return (error as { name?: unknown }).name === 'HTTPError';\n}\n\nconst MISSING_AS_NOT_FOUND = Symbol.for('salla.twilight.missingResourceAsNotFound');\n\ntype MarkedOnError = ((error: unknown) => void) & { [MISSING_AS_NOT_FOUND]?: true };\n\n/**\n * Every route but the root answers an API 404/410 its `loader` or `beforeLoad` let\n * escape with the not-found page and a 404, instead of the error page and a 500.\n *\n * The engine's own loaders already say so through `orThrow`; a theme's need not. Theme\n * 427703943 fetches `category.queries.detail` in its own `/category/$id` loader, so a\n * deleted category was a 500 that printed the API URL. TanStack hands a loader's error\n * to the route's `onError` and honours a `notFound()` thrown from there, on the server\n * (the status follows) and in the browser alike; the router has no default for it, so\n * each route gets one, after its own.\n *\n * The root is left alone: its `beforeLoad` failing means the store cannot be served at\n * all (\"Store Unavailable\", or Twig's 410 page when no store has the identifier).\n * Routes are built once per isolate and `createRouter` runs per request, hence the mark.\n */\nexport function answerMissingResourcesWithNotFound(router: AnyRouter): void {\n for (const route of Object.values(router.routesById) as AnyRoute[]) {\n if (route.isRoot) continue;\n const own = route.options.onError as MarkedOnError | undefined;\n if (own?.[MISSING_AS_NOT_FOUND]) continue;\n\n const onError: MarkedOnError = (error) => {\n own?.(error);\n if (isMissingResource(error)) throw tanstackNotFound();\n };\n onError[MISSING_AS_NOT_FOUND] = true;\n route.options.onError = onError;\n }\n}\n\n/**\n * SSR integration for Twilight context — mirrors TanStack Query's\n * `setupRouterSsrQueryIntegration` pattern.\n *\n * On the **server**: wraps `router.options.dehydrate` to include twilight\n * context data (settings, locale, location, authToken) alongside the router state.\n *\n * On the **client**: wraps `router.options.hydrate` to populate the module-level\n * store from the root match's `__beforeLoadContext` BEFORE head functions re-run.\n * TanStack's `hydrate()` calls `router.options.hydrate()` at line 114 of\n * `ssr-client.ts`, right before it re-evaluates head functions (line 120+).\n * By populating the store here, `getTwilightContext().settings` is available\n * to `rootHead()` and all child head functions during client hydration.\n */\nfunction setupTwilightSsrIntegration(router: AnyRouter, queryClient: QueryClient): void {\n if (typeof window === 'undefined') {\n // Server: also populate twilightCtx from root match context on dehydrate\n return;\n }\n\n // Client: hook into router.options.hydrate to populate the module store\n // from the root match's __beforeLoadContext (set by rootBeforeLoad on the server)\n const ogHydrate = router.options.hydrate;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router.options.hydrate = async (dehydratedData: any) => {\n await ogHydrate?.(dehydratedData);\n hydrateTwilightContext(router, queryClient);\n };\n}\n\nfunction warnHydrationBail(reason: string): void {\n // Silent failure here is what blanks the storefront: every head function that\n // runs next reads `getTwilightContext().settings`, which throws when the store\n // is empty. `ensureTwilightContextFromMatches` recovers at the point of use,\n // but the bail still signals a regression worth seeing in dev.\n if (import.meta.env?.DEV) {\n console.warn(`[Twilight] Could not hydrate twilight context: ${reason}`);\n }\n}\n\nfunction routerLocation(router: AnyRouter): TwilightLocation | undefined {\n const loc = router.state?.location;\n if (!loc) return undefined;\n return {\n href: loc.href,\n pathname: loc.pathname,\n search: loc.search as Record<string, unknown>,\n searchStr: loc.searchStr,\n state: loc.state as unknown as Record<string, unknown>,\n hash: loc.hash,\n };\n}\n\nfunction hydrateTwilightContext(router: AnyRouter, queryClient: QueryClient): void {\n const location = routerLocation(router);\n // A direct load can hydrate before its matches exist.\n if (location) updateTwilightContext({ location });\n\n const rootMatch = router.state?.matches?.[0];\n if (!rootMatch) {\n warnHydrationBail('no root match in router state');\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const beforeLoadCtx = (rootMatch as any).__beforeLoadContext as BeforeLoadResult | undefined;\n const matchCtx = rootMatch.context as Record<string, unknown> | undefined;\n\n const settings = (beforeLoadCtx?.settings ?? matchCtx?.settings) as StoreContext | undefined;\n const locale = (beforeLoadCtx?.locale ?? matchCtx?.locale) as string | undefined;\n const authToken = (beforeLoadCtx?.authToken ?? matchCtx?.authToken) as string | null;\n // Recover snippets here too: this is the primary hydration pass and populates settings, so the\n // best-effort ensureTwilightContextFromMatches fallback then short-circuits — if we skipped\n // appsSnippets here it would never reach the client store, and AppsSnippets' SSR-rendered CDN\n // tags would mismatch on hydration.\n const appsSnippets =\n beforeLoadCtx?.appsSnippets ?? (matchCtx?.appsSnippets as AppSnippet[] | undefined);\n // Recover appScope buckets too (like appsSnippets): this primary pass populates settings, so the\n // ensure-context fallback short-circuits — keep the client store in parity for head/install.\n const appsSettings =\n beforeLoadCtx?.appsSettings ?? (matchCtx?.appsSettings as AppSettings | undefined);\n // The maintenance decision too, for the same parity: the server rendered the maintenance\n // page from it, and the provider reads it on the client.\n const maintenance = (beforeLoadCtx?.maintenance ?? matchCtx?.maintenance) === true;\n\n if (!settings || !locale) {\n warnHydrationBail(\n `root match carried no ${!settings ? 'settings' : 'locale'} (beforeLoadContext and context both empty)`\n );\n return;\n }\n\n // Composed by the shared helper rather than read straight off one key.\n // There are two entries now — the platform's copy and this merchant's — and\n // reading only the first is how the server rendered the merchant's wording\n // and hydration replaced it with Salla's (Greptile's P1 on #366).\n const i18n = createI18nInstance(locale, messagesForLocale(queryClient, locale));\n\n const matches = router.state?.matches;\n const page = matches?.reduceRight(\n (found, m) => found ?? ((m as any).loaderData?.page ? (m as any).loaderData.page : null),\n null as any\n );\n\n // Resolve routeId on the initial load too — `onResolved` only fires on later\n // navigations, so without this the store keeps the empty default until the\n // first SPA navigation (breaks useRouteId/useIsHome on first paint/refresh).\n const leafMatch = matches?.[matches.length - 1];\n const routeId = leafMatch?.routeId ? resolveRouteId(leafMatch.routeId as string) : undefined;\n\n updateTwilightContext({\n queryClient,\n settings,\n locale,\n i18n,\n authToken,\n location,\n page,\n routeId,\n appsSnippets,\n appsSettings,\n maintenance,\n });\n}\n\ninterface PageLoaderData {\n page?: PageContext;\n product?: Product;\n}\n\n/** The navigation that last reported a product view: onLoad and onRendered both sync each one. */\nlet lastProductView: string | undefined;\n\n/** Publishes the deepest match's loader `page` to the twilight context and `salla.config`. */\nfunction syncPageFromMatches(router: AnyRouter): void {\n const matches = router.state?.matches;\n if (!matches) return;\n const data = matches.reduceRight<PageLoaderData | null>((found, m) => {\n const loaderData = (m as { loaderData?: PageLoaderData }).loaderData;\n return found ?? (loaderData?.page ? loaderData : null);\n }, null);\n const page = data?.page;\n if (!page) return;\n updateTwilightContext({ page });\n const sdkPage = {\n ...page,\n url: page.url ?? router.state.location.pathname + router.state.location.searchStr,\n };\n const push = () => window.salla?.config?.set?.('page', sdkPage);\n // The SDK script can run after hydration; it must have the page before it is ready.\n if (window.salla?.config?.set) push();\n else window.addEventListener('salla::created', push, { once: true });\n\n const view = router.state.location.state?.key ?? router.state.location.href;\n if (page.slug !== RouteId.PRODUCT_SINGLE || !data.product) {\n lastProductView = undefined;\n } else if (view !== lastProductView) {\n lastProductView = view;\n dispatchProductViewed(data.product);\n }\n}\n\n/** `/products` picks its list from `?source=`, the latest by default; as the listing loader names its page. */\nconst PRODUCTS_SOURCE_SLUGS: Record<string, string> = {\n latest: RouteId.PRODUCT_INDEX_LATEST,\n sales: RouteId.PRODUCT_INDEX_SALES,\n offers: RouteId.PRODUCT_INDEX_OFFERS,\n reorder: RouteId.PRODUCT_INDEX,\n};\n\n/** The page slug a history location renders: its route's semantic id, as `page.slug` reads. */\nfunction slugFor(router: AnyRouter, location: HistoryLocation): string | undefined {\n const { pathname, search } = router.parseLocation(location);\n const [, , found] = router.getMatchedRoutes(pathname);\n if (!found) return undefined;\n if (found.id === '/{-$locale}/products') {\n return PRODUCTS_SOURCE_SLUGS[String(search?.source)] ?? RouteId.PRODUCT_INDEX_LATEST;\n }\n return resolveRouteId(found.id);\n}\n\n/**\n * Compatibility mode for Twig-era app snippets (see `snippet-page-compat`): a navigation that\n * enters or leaves a page one of them targets loads the document fully instead of rendering in\n * place, so the snippet runs on the page it was written for. Query-only changes (filters, sort)\n * stay in place, as they did on Twig, unless the query picks another page (`/products?source=`).\n */\nfunction blockForSnippetPages(router: AnyRouter): void {\n const blockerFn: BlockerFn = ({ currentLocation, nextLocation, action }) => {\n const from = slugFor(router, currentLocation);\n const to = slugFor(router, nextLocation);\n if (currentLocation.pathname === nextLocation.pathname && from === to) return false;\n if (!needsDocumentLoad(from, to)) return false;\n if (action === 'PUSH' || action === 'REPLACE') {\n // The router's own navigation, so a path on this store; checked anyway, so the browser is\n // never sent off the store's origin.\n const url = new URL(nextLocation.href, window.location.origin);\n if (url.origin !== window.location.origin) return false;\n // Blocked: the router stays put, and the browser loads the address instead.\n if (action === 'PUSH') window.location.assign(url.href);\n else window.location.replace(url.href);\n return true;\n }\n // Back/forward: the address bar already shows the target (a block would step it back),\n // so load it, and hold the router until the document goes.\n window.location.reload();\n return new Promise<never>(() => {});\n };\n // Only while some snippet needs it: a blocker makes every history push wait a tick.\n let unblock: (() => void) | undefined;\n subscribeSnippetPageTargets((active) => {\n if (active && !unblock) {\n unblock = router.history.block({ blockerFn, enableBeforeUnload: false });\n } else if (!active && unblock) {\n unblock();\n unblock = undefined;\n }\n });\n}\n\n/**\n * Options for creating the TanStack Router instance.\n */\nexport interface CreateRouterOptions {\n defaultPendingComponent?: (() => ReactNode) | false;\n defaultPendingMs?: number;\n defaultPendingMinMs?: number;\n defaultStaleTime?: number;\n history?: RouterHistory;\n}\n\n/**\n * Creates and configures the TanStack Router instance for the Twilight theme.\n *\n * This router is pre-configured with:\n * - Route tree generated by the TanStack Router plugin\n * - Intent-based preload for better performance\n * - Scroll restoration for better UX\n * - Locale-aware default NotFoundPage (redirects `/cart` → `/ar/cart`)\n * - Trailing slash normalization for consistent URL handling\n * - Page skeleton shown during route transitions (via `defaultPendingComponent`)\n * - SSR query integration for Cloudflare compatibility\n *\n * @param routeTree - The generated route tree from the consuming project\n * @param options - Optional overrides for pending component behavior\n * @returns Configured TanStack Router instance\n */\nexport function createRouter(routeTree: any, options?: CreateRouterOptions) {\n setHeadAdapter(tanstackHeadAdapter);\n\n const {\n defaultPendingComponent: pendingOpt,\n defaultPendingMs = 100,\n defaultPendingMinMs = 200,\n defaultStaleTime = Infinity,\n history,\n } = options ?? {};\n\n const pendingComponent =\n pendingOpt === false ? undefined : (pendingOpt ?? (() => <PageSkeleton />));\n\n const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60_000,\n gcTime: 5 * 60_000,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n mutations: {\n retry: 0,\n },\n dehydrate: {\n shouldDehydrateQuery,\n },\n },\n });\n\n // Store queryClient in the holder for access by loaders via getTwilightContext()\n updateTwilightContext({ queryClient });\n\n // On a host that serves many stores, the store is a segment of every URL: the\n // first one on the preview host, the one after the locale on a Salla shared\n // host. The router carries it instead of the route tree: it is stripped before\n // matching and added to every href the router builds. Decided per request on\n // the server, and taken from what SSR published in the browser.\n const storeBase = resolveStoreBase();\n\n const router = createTanStackRouter({\n routeTree,\n ...(history ? { history } : {}),\n ...(storeBase ? { rewrite: storeBaseRewrite(storeBase, resolveStoreBaseFollowsLocale()) } : {}),\n context: {\n queryClient,\n setLocation: (location: Partial<TwilightLocation>) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n updateTwilightContext({ location } as any);\n },\n },\n defaultPreload: 'intent',\n scrollRestoration: true,\n scrollRestorationBehavior: 'instant',\n trailingSlash: 'never',\n stringifySearch,\n defaultStaleTime,\n defaultNotFoundComponent: () => (\n <Suspense fallback={<PageSkeleton />}>\n <LazyNotFoundPage />\n </Suspense>\n ),\n defaultPendingComponent: pendingComponent,\n defaultPendingMs,\n defaultPendingMinMs,\n defaultErrorComponent: DefaultErrorComponent,\n });\n\n answerMissingResourcesWithNotFound(router);\n\n // Setup SSR query integration (native, with incremental streaming)\n setupRouterSsrQueryIntegration({ router, queryClient });\n\n // Setup Twilight SSR integration — populates the module store from\n // dehydrated match context BEFORE head functions re-run on the client.\n // This mirrors how setupRouterSsrQueryIntegration hydrates QueryClient.\n setupTwilightSsrIntegration(router, queryClient);\n\n // Subscribe to navigation events to sync location and routeId\n function syncNavigationState() {\n const state = router?.state;\n if (!state?.location) return;\n\n const loc = state.location;\n updateTwilightContext({\n location: {\n href: loc.href,\n pathname: loc.pathname,\n search: loc.search as Record<string, unknown>,\n searchStr: loc.searchStr,\n state: loc.state as unknown as Record<string, unknown>,\n hash: loc.hash,\n },\n });\n\n const matches = state.matches;\n const leafMatch = matches[matches.length - 1];\n if (leafMatch?.routeId) {\n const semanticId = resolveRouteId(leafMatch.routeId as string);\n updateTwilightContext({ routeId: semanticId });\n }\n\n const rootMatch = state.matches[0];\n if (rootMatch?.context) {\n const ctx = rootMatch.context as BeforeLoadResult;\n if (ctx?.settings) {\n updateTwilightContext({ settings: ctx.settings, locale: ctx.locale });\n }\n }\n }\n\n // Extract page from matches as soon as loaders complete (before components mount),\n // so useTwilightInit's useEffect sees page data when it calls sdk.init().\n router.subscribe('onLoad', () => syncPageFromMatches(router));\n // A direct load resolves through hydration, which emits no onLoad; its first render does emit onRendered.\n router.subscribe('onRendered', () => syncPageFromMatches(router));\n\n if (typeof window !== 'undefined') blockForSnippetPages(router);\n\n // Sync location, routeId, and settings after navigation fully resolves\n router.subscribe('onResolved', () => {\n syncNavigationState();\n dispatchRouteChanged();\n });\n\n return router;\n}\n\ndeclare module '@tanstack/react-router' {\n interface Register {\n router: ReturnType<typeof createRouter>;\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Required by TanStack Router module augmentation pattern\n interface RouterContext extends RouterInitialContext {}\n}\n","import { useRouterState } from '@tanstack/react-router';\nimport {\n mergeElementAttrs,\n toReactProps,\n type DocumentElementDescriptor,\n} from '../utils/document-class';\nimport { useDocumentClass } from '../hooks/useDocumentClass';\nimport { updateTwilightContext, type PageContext } from '../twilight/context';\nimport { resolveRouteId } from './router';\n\n// ============================================================================\n// Route → body class map (mirrors PHP Route2Class::generateClassString)\n// Keyed by TanStack Router route ID (the path passed to createFileRoute).\n// null = intentionally classless (e.g. root layout routes).\n// ============================================================================\n\nconst ROUTE_CLASS_MAP: Record<string, string | null> = {\n '/{-$locale}/': 'index',\n '/{-$locale}/cart': 'cart',\n '/{-$locale}/$slug/c{$id}': 'product-index',\n '/{-$locale}/offers': 'product-index-offers',\n '/{-$locale}/products': 'product-index',\n '/{-$locale}/latest-products': 'product-index-latest',\n '/{-$locale}/most-sales-products': 'product-index-sales',\n '/{-$locale}/search': 'product-index-search',\n '/{-$locale}/$slug/tag-{$id}': 'product-index-tag',\n '/{-$locale}/tags/$id': 'product-index-tag',\n '/{-$locale}/$slug/p{$id}': 'product-single',\n '/{-$locale}/$slug/page-{$id}': 'page-single',\n '/{-$locale}/page/$slug': 'page-single',\n '/{-$locale}/p/$slug': 'page-single',\n '/{-$locale}/thankyou/$orderId': 'thank-you',\n '/{-$locale}/orders': 'customer-orders-index',\n '/{-$locale}/pending-orders': 'customer-orders-index-pending', // redirect to /account/orders?status=pending\n '/{-$locale}/account/pending_orders': 'customer-orders-index-pending',\n '/{-$locale}/account/rating': 'customer-orders-index', // redirect to /account/orders\n '/{-$locale}/order/$id': 'customer-orders-single',\n '/{-$locale}/profile': 'customer-profile',\n '/{-$locale}/wallet': 'customer-wallet',\n '/{-$locale}/wishlist': 'customer-wishlist',\n '/{-$locale}/notifications': 'customer-notifications',\n '/{-$locale}/testimonials': 'testimonials',\n '/{-$locale}/reviews': 'reviews',\n '/{-$locale}/brands': 'brands-index',\n '/{-$locale}/brands/$id': 'brands-single',\n '/{-$locale}/$slug/brand-{$id}': 'brands-single',\n '/{-$locale}/blog': 'blog-index',\n '/{-$locale}/blog/$slug/a-{$id}': 'blog-single',\n '/{-$locale}/blog/$slug/c-{$id}': 'blog-index-category',\n '/{-$locale}/blog/$slug/tag-{$id}': 'blog-index-tag',\n '/{-$locale}/blog/author/$id': 'blog-index-author',\n '/{-$locale}/loyalty': 'loyalty',\n '/{-$locale}/loyalty_points': 'customer-loyalty-points',\n};\n\n/** `/products?source=` keeps the Twig class of the old listing URL. */\nconst PRODUCTS_SOURCE_CLASS: Record<string, string> = {\n latest: 'product-index-latest',\n sales: 'product-index-sales',\n offers: 'product-index-offers',\n};\n\nfunction routeClassOf(matches: Array<{ routeId: string; search?: unknown }>): string | null {\n for (let i = matches.length - 1; i >= 0; i--) {\n const { routeId, search } = matches[i];\n if (routeId === '/{-$locale}/products') {\n const source = (search as { source?: unknown } | undefined)?.source;\n return typeof source === 'string' && Object.hasOwn(PRODUCTS_SOURCE_CLASS, source)\n ? PRODUCTS_SOURCE_CLASS[source]\n : 'product-index';\n }\n if (routeId in ROUTE_CLASS_MAP) return ROUTE_CLASS_MAP[routeId];\n }\n return null;\n}\n\n// ============================================================================\n// RouteDocumentSync — resolves body class from active route ID at runtime.\n// ============================================================================\n\n/**\n * Applies the per-route body class by looking up the deepest active route ID\n * in the built-in route→class map.\n *\n * For custom routes not in the built-in map, use `useDocumentClass` directly\n * inside your route component.\n *\n * Note: This will throw if rendered outside a TanStack Router context.\n * Use TanStackDocumentSync for safe usage inside TwilightProvider.\n */\nexport function RouteDocumentSync(): null {\n const matches = useRouterState({ select: (s) => s.matches });\n\n const routeClass = routeClassOf(matches);\n\n useDocumentClass(routeClass ? { body: { class: routeClass } } : {});\n return null;\n}\n\n/**\n * Safe version of RouteDocumentSync for use in TwilightProvider.\n * Handles being rendered outside a TanStack Router context gracefully.\n * Uses a wrapper component pattern to conditionally render hooks.\n */\nexport function TanStackDocumentSync(): null {\n const matches = useRouterState({ select: (s) => s.matches }) || [];\n\n // On the server routeId is never synced (onResolved is client-only), so useIsHome()\n // etc. disagree with the client and cause hydration mismatches. Sync it here — this\n // renders before the layout. Client already has it from onResolved.\n if (typeof window === 'undefined') {\n const leaf = matches[matches.length - 1];\n if (leaf?.routeId) {\n updateTwilightContext({ routeId: resolveRouteId(leaf.routeId as string) });\n }\n // The deepest loader's page, which the client syncs on load (`syncPageFromMatches`).\n const page = matches.reduceRight<PageContext | undefined>(\n (found, match) => found ?? (match.loaderData as { page?: PageContext } | undefined)?.page,\n undefined\n );\n if (page) updateTwilightContext({ page });\n }\n\n const routeClass = routeClassOf(matches);\n\n useDocumentClass(routeClass ? { body: { class: routeClass } } : {});\n return null;\n}\n\n// ============================================================================\n// Type augmentation — extend TanStack Router's staticData type\n// ============================================================================\n\ndeclare module '@tanstack/react-router' {\n interface StaticDataRouteOption {\n documentAttrs?: DocumentElementDescriptor;\n }\n}\n\nexport interface TanstackRouteStaticData {\n documentAttrs?: DocumentElementDescriptor;\n}\n\n// ============================================================================\n// useTanstackDocumentAttrs — for TanStack Start SSR root layouts\n// ============================================================================\n\n/**\n * Read and merge `<body>` / `<html>` attributes from all currently active\n * route matches (via `staticData.documentAttrs`).\n *\n * Returns React-ready prop objects ready to spread onto `<html>` and `<body>`.\n */\nexport function useTanstackDocumentAttrs(): {\n bodyAttrs: Record<string, string>;\n htmlAttrs: Record<string, string>;\n} {\n const matches = useRouterState({ select: (s) => s.matches });\n\n const bodyDescriptors = matches.map(\n (m) => (m.staticData as TanstackRouteStaticData | undefined)?.documentAttrs?.body ?? {}\n );\n const htmlDescriptors = matches.map(\n (m) => (m.staticData as TanstackRouteStaticData | undefined)?.documentAttrs?.html ?? {}\n );\n\n return {\n bodyAttrs: toReactProps(mergeElementAttrs(bodyDescriptors)),\n htmlAttrs: toReactProps(mergeElementAttrs(htmlDescriptors)),\n };\n}\n\n/**\n * Pure adapter: converts a `DocumentElementDescriptor` to React-ready props.\n */\nexport function tanstackDocumentAdapter(descriptor: DocumentElementDescriptor): {\n bodyAttrs: Record<string, string>;\n htmlAttrs: Record<string, string>;\n} {\n return {\n bodyAttrs: toReactProps(mergeElementAttrs([descriptor.body ?? {}])),\n htmlAttrs: toReactProps(mergeElementAttrs([descriptor.html ?? {}])),\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;;AAWA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,MACpC,GAAG,IAAA;AAAA,MACH,MAAM,IAAA,CAAK,IAAA,EAAM,QAAQ,OAAA,EAAS,EAAE,KAAK,IAAA,CAAK;AAAA,KAChD,CAAE,CAAA;AAAA,IACF,IAAA,EAAM,EAAE,IAAA,EAAM,OAAA,CAAQ,KAAA;AAAM,GAC9B;AACA,EAAA,OAAO,MAAA;AACT;ACdO,IAAM,YAAA,GAAe,IAAA,CAAK,SAASA,aAAAA,GAAe;AACvD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAI,SAAA,EAAU,uCAAA,EACb,8BAAC,KAAA,EAAA,EAAM,SAAA,EAAU,2BAA0B,CA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,GAAQ,IAAI,QAAA,EAAU,KAAA;AAC5B,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AAEpB,EAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,IAAA,EAAM,KAAA,IAAS,KAAA,CAAM,IAAA;AACzC,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,IAAA,EAAM,WAAA,IAAe,KAAA,CAAM,WAAA;AACrD,EAAA,MAAM,QAAA,GAAW,MAAM,IAAA,EAAM,QAAA;AAE7B,EAAA,MAAM,GAAA,GAAM,aAAa,GAAA,CAAI,QAAA,EAAU,IAAI,QAAA,CAAS,QAAQ,KAAK,KAAA,CAAM,GAAA;AAEvE,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA,EAAW,GAAA;AAAA,IACX,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,SAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM,IAAA;AAAA,MACd;AAAA,KACF;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,qBAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM;AAAA,KAChB;AAAA,IACA,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AACF;AAEO,IAAM,IAAA,GAAO,EAAE,EAAA,EAAI,OAAA,CAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,WAAW,QAAA","file":"chunk-LMMDVLAB.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { home } from '../../api/home';\nimport type { HomeComponentData } from '../../types';\nimport { RouteId } from '../../router/route-ids';\n\nexport interface HomeLoaderData {\n locale: string;\n components: HomeComponentData[];\n page: { slug: string };\n}\n\nexport async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {\n const { queryClient } = getTwilightContext();\n const components = await queryClient.ensureQueryData(home.queries.components());\n const result = {\n locale: ctx?.locale || 'ar',\n components: components.map((comp) => ({\n ...comp,\n path: comp.path?.replace('home.', '') || comp.path,\n })),\n page: { slug: RouteId.INDEX },\n };\n return result;\n}\n","import { memo, useCallback, useState } from 'react';\nimport { useDevHomeBlocks } from '../../dev/dev-settings-store';\nimport { HookSlot } from '../../hooks';\nimport { HomeComponentRenderer, ReorderProducts } from '../../components/home';\nimport { reorder, useLiveBlockMoves } from '../../components/live-editor/moves';\nimport type { HomePageProps } from './types';\nimport type { HomeComponentData } from '../../types';\nimport { Pulse } from '@salla.sa/twilight-components-react';\n\nexport const HomeSkeleton = memo(function HomeSkeleton() {\n return (\n <>\n <div className=\"s-block container skeleton-block-hero\">\n <Pulse className=\"h-64 sm:h-80 rounded-md\" />\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n </>\n );\n});\n\n/** The blocks' places in the store's order: 0, 1, 2… */\nconst storeOrder = (blocks: readonly unknown[]) => Array.from(blocks, (_, at) => at);\n\nexport const HomePage = memo(function HomePage({ components = [] }: HomePageProps) {\n // Dev-mode only: the dev editor's layout replaces the store's blocks while it\n // is on. No-op passthrough in production builds.\n const renderedComponents = useDevHomeBlocks(components);\n // The theme editor's preview moves blocks in place while the editor saves the\n // order; blocks from the server (a new page, a reload) start over from theirs.\n const [moved, setMoved] = useState<{ source: HomeComponentData[]; order: number[] } | null>(null);\n const order = moved?.source === renderedComponents ? moved.order : null;\n const onMove = useCallback(\n (from: number, to: number) =>\n setMoved((prev) => ({\n source: renderedComponents,\n order: reorder(\n prev?.source === renderedComponents ? prev.order : storeOrder(renderedComponents),\n from,\n to\n ),\n })),\n [renderedComponents]\n );\n useLiveBlockMoves(onMove);\n const placed = order ?? storeOrder(renderedComponents);\n\n return (\n <>\n <HookSlot name=\"home:start\" />\n <HookSlot name=\"home:content\" />\n {placed.map((at, index) => {\n const data = renderedComponents[at];\n // `data.key` is the twilight.json catalog id, shared by every placement\n // of that block. Platform blocks send null. The block's place in the\n // store's order is unique and stays with it when the preview moves it, so\n // a move keeps its state; a dev layout block keeps its own id.\n return <HomeComponentRenderer key={data.__dev_id ?? at} data={data} index={index} />;\n })}\n <HookSlot name=\"home:end\" />\n <ReorderProducts />\n </>\n );\n});\n\nexport { HomePage as default };\n","import type { HeadDescriptor } from '../../utils/head';\nimport { buildHreflangAlternates, storePageUrl } from '../../utils/baseHead';\nimport type { HomeLoaderData } from './loader';\nimport { homeLoader } from './loader';\nimport type { TwilightContext } from '../../twilight/context';\nimport { HomePage } from './HomePage';\nimport { RouteId } from '../../router/route-ids';\n\nexport { HomeSkeleton } from './HomePage';\nexport { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';\nexport { registerHomeComponentConfig } from '../../components/home';\nexport type { HomePageProps } from './types';\nexport type { HomeLoaderData } from './loader';\nexport type {\n HomeComponentsProps,\n AnyHomeComponent,\n HomeComponentConfig,\n} from '../../components/home';\n\nfunction loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {\n return homeLoader({ locale: _ctx?.locale });\n}\n\nfunction head(ctx: TwilightContext): HeadDescriptor {\n const store = ctx.settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title ?? store.name;\n const description = store.meta?.description ?? store.description;\n const keywords = store.meta?.keywords;\n // `/ar`, like Twig, where store.url reads `/ar/`.\n const url = storePageUrl(ctx.settings, ctx.location.pathname) ?? store.url;\n\n return {\n title,\n description,\n keywords,\n canonical: url,\n openGraph: {\n type: 'website',\n title,\n description,\n images: store.logo,\n url,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: store.logo,\n },\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n}\n\nexport const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;\n\nexport { homeLoader };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tanstack/link.tsx","../src/tanstack/native-app-events.tsx","../src/utils/request-host.ts","../src/tanstack/navigation.tsx"],"names":["TanStackLink","tanstackNotFound","tanstackRedirect","useParams","jsx"],"mappings":";;;;;;;;;;;;AAWO,SAAS,mBAAA,CAAoB,aAAqB,MAAA,EAAiB;AACxE,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,CAAY,UAAA,CAAW,GAAG,CAAA,IAAK,WAAA,CAAY,UAAA,CAAW,IAAI,CAAA,EAAG,OAAO,WAAA;AACpF,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,EAAG,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,CAAA;AAC/D,EAAA,IAAI,QAAA,CAAS,YAAY,CAAA,EAAG,OAAO,WAAA;AACnC,EAAA,OAAO,WAAA,KAAgB,MAAM,CAAA,CAAA,EAAI,MAAM,KAAK,CAAA,CAAA,EAAI,MAAM,GAAG,WAAW,CAAA,CAAA;AACtE;AAMO,IAAM,mBAAA,GAAsB,UAAA;AAAA,EACjC,CACE;AAAA,IACE,EAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA,EAAc,SAAA;AAAA,IACd,GAAG;AAAA,KAEL,GAAA,KACG;AACH,IAAA,MAAM,EAAE,MAAA,EAAO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AAU,UAAA,EAC5B,QAAA,EAAA;AAAA,oBAAAC,GAAAA,CAAC,mBAAgB,MAAA,EAAgB,CAAA;AAAA,oBACjCA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA,GAAA,EACxD,CAAA;AAEJ;AAGO,SAAS,0BAAA,CAA2B,EAAE,QAAA,EAAS,EAA4B;AAChF,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,uBACEA,GAAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,CAAC,EAAA,EAAY,IAAA,KAA2B,QAAA,CAAS,EAAE,EAAA,EAAI,OAAA,EAAS,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,MAEzF,QAAA,kBAAAA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA;AAAA,GACxD;AAEJ","file":"chunk-P43VADN7.js","sourcesContent":["import { forwardRef, createElement } from 'react';\nimport { Link as TanStackLink, useParams } from '@tanstack/react-router';\nimport { isLocale } from '../providers/locale-constants';\nimport type { BaseLinkProps } from '../components/common/Link.types';\n\n/**\n * Routes live under an optional `/{-$locale}` param, so a bare `to=\"/brands\"`\n * resolves with the locale omitted and the $locale loader bounces the user to\n * the fallback locale. Prefix the current locale onto internal paths that\n * don't already carry one.\n */\nexport function localizeDestination(destination: string, locale?: string) {\n if (!locale || !destination.startsWith('/') || destination.startsWith('//')) return destination;\n const firstSegment = destination.split('/')[1]?.split(/[?#]/)[0];\n if (isLocale(firstSegment)) return destination;\n return destination === '/' ? `/${locale}` : `/${locale}${destination}`;\n}\n\n/**\n * TanStack Router Link adapter.\n * Translates framework-agnostic props to TanStack Router Link props.\n */\nexport const TanStackLinkAdapter = forwardRef<HTMLAnchorElement, BaseLinkProps>(\n (\n {\n to,\n href,\n children,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload,\n replace,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref\n ) => {\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const destination = localizeDestination(to ?? href ?? '/', locale);\n\n return createElement(\n TanStackLink,\n {\n ref,\n to: destination,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload: preload === 'intent' || preload === false ? preload : undefined,\n replace,\n 'aria-label': ariaLabel,\n ...(rest as Record<string, unknown>),\n },\n children\n );\n }\n);\n\nTanStackLinkAdapter.displayName = 'TanStackLinkAdapter';\n\n/**\n * Create a TanStack Router Link adapter component.\n */\nexport function createTanStackLinkAdapter() {\n return TanStackLinkAdapter;\n}\n","import { useEffect } from 'react';\nimport { useRouter } from '@tanstack/react-router';\nimport { resolveRelativePath } from '../providers/NavigationProvider';\nimport { useTwilight } from '../providers/twilight-context';\nimport { isLocale } from '../providers/locale-constants';\nimport { getTwilightContext } from '../twilight/context';\nimport { useIsNativeApp } from '../native-app';\nimport { onSallaEvent } from '../utils/sdk-helpers';\nimport { hasStoreUrlBase } from '../utils/store-base';\nimport { localizeDestination } from './link';\n\nconst UI_UPDATE_EVENT = 'mobile::ui.update';\nconst OPEN_ORDER_EVENT = 'mobile::open.order';\nconst NAVIGATE_TO_EVENT = 'mobile::navigate.to';\n\n/**\n * Events the native app sends into its webview. `NavigationSetup` mounts this once, so a\n * theme adds no listener of its own:\n *\n * - `mobile::ui.update` re-runs the route loaders and refetches what is on screen.\n * - `mobile::open.order` `{ id }` opens that order, with a fresh cart.\n * - `mobile::navigate.to` `{ url }` opens a notification deep link in-app. Only a link to\n * this store is followed (`deepLinkPath`), so `javascript:`, off-site and other stores'\n * URLs are dropped.\n *\n * Nothing is mounted outside the app (`useIsNativeApp()`), so a browser runs none of it.\n */\nexport function NativeAppEvents({ locale }: { locale?: string }) {\n return useIsNativeApp() ? <Listeners locale={locale} /> : null;\n}\n\nfunction Listeners({ locale }: { locale?: string }) {\n useNativeAppEvents(locale);\n return null;\n}\n\n/** The listeners themselves. `NativeAppEvents` mounts them inside the app only. */\nexport function useNativeAppEvents(locale?: string): void {\n const router = useRouter();\n const { store } = useTwilight();\n const storeUrl = store?.url;\n const username = store?.username;\n\n useEffect(() => {\n // `href`, not `to`: the router parses the query and the hash out of it.\n const open = (path: string) =>\n void router.navigate({ href: localizeDestination(path, locale) });\n\n const refresh = () => {\n void Promise.allSettled([\n router.invalidate(),\n getTwilightContext().queryClient?.refetchQueries({ type: 'active' }),\n ]);\n };\n const openOrder = (data?: unknown) => {\n const rawId = (data as { id?: unknown } | undefined)?.id;\n if (typeof rawId !== 'string' && typeof rawId !== 'number') return;\n\n const id = String(rawId).trim();\n if (!id) return;\n\n void getTwilightContext().queryClient?.invalidateQueries({ queryKey: ['cart'] });\n open(`/account/orders/${encodeURIComponent(id)}`);\n };\n const navigateTo = (data?: unknown) => {\n const url = (data as { url?: unknown } | undefined)?.url;\n if (typeof url !== 'string' || !url.trim() || !storeUrl) return;\n\n const path = deepLinkPath(url.trim(), storeUrl, username);\n if (path) void router.navigate({ href: inLocale(path, locale) });\n };\n\n const offs = [\n onSallaEvent(UI_UPDATE_EVENT, refresh),\n onSallaEvent(OPEN_ORDER_EVENT, openOrder),\n onSallaEvent(NAVIGATE_TO_EVENT, navigateTo),\n ];\n return () => offs.forEach((off) => off());\n }, [router, locale, storeUrl, username]);\n}\n\n/** A URL that names its host: `https://…` or `//…`. Anything else is a path of this app. */\nfunction isAbsoluteUrl(url: string): boolean {\n if (url.startsWith('//')) return true;\n try {\n // Without a base, only a URL with its own scheme parses.\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The application path of a deep link to this store, or null for any other link.\n *\n * It passes the test a tapped link does (`resolveRelativePath`: the store's origin, the\n * username taken off), and one more. On a shared host that origin is every store's, so\n * an absolute link has to carry this store's username: without it, another store's\n * `/ar/offers` would open this store's offers.\n */\nfunction deepLinkPath(url: string, storeUrl: string, username?: string): string | null {\n const path = resolveRelativePath(url, storeUrl, username);\n if (!path || !isAbsoluteUrl(url)) return path;\n\n // Both parse: `resolveRelativePath` returns null when either does not.\n const { pathname } = new URL(url, window.location.href);\n return hasStoreUrlBase(pathname, new URL(storeUrl).pathname, username) ? path : null;\n}\n\n/**\n * A deep link in the locale the visitor is browsing in. A notification is written in one\n * language and opened in whichever is on screen, so the link's own locale gives way.\n *\n * The prefix is written here, not by `localizeDestination`: that one leaves a path alone\n * when it already starts with a locale, and would take the slug of `/ar/en/p456` for one.\n */\nfunction inLocale(path: string, locale?: string): string {\n const first = path.split('/')[1]?.split(/[?#]/)[0];\n const own = isLocale(first) ? path.slice(first.length + 1) : path;\n const rest = own.startsWith('/') ? own : `/${own}`;\n\n if (!locale) return rest;\n return rest === '/' ? `/${locale}` : `/${locale}${rest}`;\n}\n","/**\n * What the request itself is enough to describe: its host.\n *\n * Small, and deliberately its own module rather than a helper inside the\n * middleware. This value decides two things — which store a live storefront is,\n * and whether the request is allowed to name a store at all — so it is worth\n * testing directly instead of only through the wiring that calls it.\n */\nimport { isLoopback } from './cookies';\n\n/** The part of a `Request` this needs, so a test does not have to build a whole one. */\nexport interface HostSource {\n url: string;\n headers: { get(name: string): string | null };\n}\n\n/**\n * The host this request arrived on, with its port when it has one.\n *\n * Taken from the request URL, which in a Worker is the address the platform\n * actually routed on, and from the `Host` header only when that fails.\n *\n * **`X-Forwarded-Host` is deliberately not consulted.** A client can set it, and\n * this value gates `allowsRequestStoreId` — so honouring it would be a way to\n * talk a merchant's own domain into behaving like the preview host, and from\n * there into serving a stranger's shop. The dispatcher strips that header today;\n * a theme must not be one edit to another repository's allowlist away from a\n * spoofable identity.\n */\nexport function requestHostOf(request: HostSource): string | null {\n try {\n const fromUrl = new URL(request.url).host;\n if (fromUrl) return fromUrl;\n } catch {\n /* an unparseable URL falls through to the header */\n }\n\n return request.headers.get('Host')?.trim() || null;\n}\n\n/** The origin a browser reached this host on: `http` for a dev server, `https` otherwise. */\nexport function requestOriginOf(host: string): string {\n return `${isLoopback(host.replace(/:\\d+$/, '')) ? 'http' : 'https'}://${host}`;\n}\n","import {\n useNavigate,\n useParams,\n redirect as tanstackRedirect,\n notFound as tanstackNotFound,\n} from '@tanstack/react-router';\nimport {\n NavigationProvider,\n configureNavigation,\n type NavigateOptions,\n} from '../providers/NavigationProvider';\nimport { LinkProvider } from '../providers/LinkProvider';\nimport { TanStackLinkAdapter, localizeDestination } from './link';\nimport { NativeAppEvents } from './native-app-events';\nimport { useCallback, type ReactNode } from 'react';\nimport { UnauthorizedError, type RedirectOptions } from '../providers/NavigationProvider';\nimport { getRequestStore, getTwilightContext } from '../twilight/context';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from '../utils/store-identity';\nimport { loginRedirectHref } from '../utils/store-base';\nimport { requestOriginOf } from '../utils/request-host';\n\nfunction currentOrigin(): string | null {\n if (typeof window !== 'undefined') return window.location.origin;\n const host = getRequestStore().requestHost;\n return host ? requestOriginOf(host) : null;\n}\n\nconfigureNavigation({\n notFound: (message?: string) => {\n throw tanstackNotFound({ data: message });\n },\n redirect: (path: string, opts?: RedirectOptions) => {\n throw tanstackRedirect({ to: path, replace: opts?.replace, statusCode: opts?.statusCode });\n },\n unauthorized: (message?: string) => {\n const origin = currentOrigin();\n const { pathname, searchStr } = getTwilightContext().location;\n const href =\n origin &&\n loginRedirectHref({\n pathname,\n searchStr,\n origin,\n base: resolveStoreBase(),\n baseFollowsLocale: resolveStoreBaseFollowsLocale(),\n });\n // A full load, because the SDK only reads `intended_to` when a page starts.\n if (href) throw tanstackRedirect({ href, reloadDocument: true, replace: true });\n throw new UnauthorizedError(message);\n },\n});\n\n/**\n * TanStack navigation setup - wraps children with NavigationProvider and LinkProvider.\n * Called by TwilightProvider when client.framework === 'tanstack'.\n */\nexport function NavigationSetup({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const navigateFn = useCallback(\n (to: string, opts?: NavigateOptions) =>\n navigate({ to: localizeDestination(to, locale), replace: opts?.replace }),\n [navigate, locale]\n );\n\n return (\n <NavigationProvider navigate={navigateFn}>\n <NativeAppEvents locale={locale} />\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n\n/** @deprecated Use NavigationSetup instead */\nexport function TanStackNavigationProvider({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n return (\n <NavigationProvider\n navigate={(to: string, opts?: NavigateOptions) => navigate({ to, replace: opts?.replace })}\n >\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/home/ProductsSlider.tsx","../src/components/home/StoreFeatures.tsx","../src/components/home/FixedBanner.tsx","../src/components/home/FixedProducts.tsx","../src/components/home/FeaturedProductsStyle1.tsx","../src/components/home/FeaturedProductsStyle2.tsx","../src/components/home/FeaturedProductsStyle3.tsx","../src/components/home/ParallaxBackground.tsx","../src/components/home/PhotosSlider.tsx","../src/components/home/SquarePhotos.tsx","../src/components/home/Youtube.tsx","../src/components/home/BundleComponent.tsx","../src/components/home/lazy.ts","../src/components/home/register.ts","../src/components/home/ComponentErrorBoundary.tsx","../src/components/home/HomePageRenderer.tsx","../src/components/home/PageBlocks.tsx","../src/components/home/reorder-hooks.ts","../src/components/home/ReorderProducts.tsx"],"names":["product","StoreFeatures","jsx","memo","FixedBanner","Fragment","jsxs","Suspense","FeaturedProductsStyle1","useCallback","FeaturedProductsStyle2","useState","SallaButton","SallaProductsSlider","FeaturedProductsStyle3","ParallaxBackground","PhotosSlider","SquarePhotos","Youtube","BundleComponent","useEffect","FallbackComponent","ProductsSliderSkeleton","FixedProductsSkeleton","HomeComponentRenderer","Component","PageBlocks","useQuery","ReorderProducts","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;AA6BO,SAAS,cAAA,CAAe,EAAE,IAAA,EAAK,EAAwB;AAC5D,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM;AAAA,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AAU,KAAA,EAAO,QAAA,EAAU,QAAA,CAAS,SAAS,CAAA;AAC9E,EAAA,MAAM,KAAA,GAAQ,EAAE,yBAAyB,CAAA;AACzC,EAAA,iBAAA,CAAkB,OAAO,CAAA;AAEzB,EAAA,MAAM,IAAA,GAAOC,OAAAA;AAAA,IACX,OAAO;AAAA,MACL,IAAA,EAAM,iBAAA;AAAA,MACN,KAAA;AAAA,MACA,eAAA,EAAiB,0BAAA;AAAA,MACjB,QAAA,EAAU,EAAE,MAAA,EAAQ,SAAA;AAAU,KAChC,CAAA;AAAA,IACA,CAAC,KAAK;AAAA,GACR;AAEA,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AAErB,EAAA,uBACE3B,GAAAA,CAAC,KAAA,EAAA,EAAI,EAAA,EAAG,mBAAkB,aAAA,EAAY,SAAA,EACpC,QAAA,kBAAAA,GAAAA,CAAC,yBAAsB,IAAA,EAAY,KAAA,EAAO,EAAA,EAAI,QAAA,EAAU,OAAO,CAAA,EACjE,CAAA;AAEJ,CAAC","file":"chunk-SAYYMA6E.js","sourcesContent":["import { Suspense, useCallback, useMemo } from 'react';\nimport { product, ProductsListSource } from '../../api/product';\nimport { ProductCard } from '../../components/product';\nimport { ProductsSliderSkeleton, SallaProductsSlider } from '@salla.sa/twilight-components-react';\nimport { useTranslation } from '../../providers/I18nProvider';\n\ninterface ProductsSourceConfig {\n source: ProductsListSource;\n source_value?: number | number[] | null;\n}\n\nexport interface ProductsSliderProps {\n data: {\n products: ProductsSourceConfig;\n title?: string;\n display_all_url?: string;\n position?: number;\n priority?: boolean;\n show_controls?: boolean;\n controls_outer?: boolean;\n loop?: boolean;\n centered?: boolean;\n slides_per_view?: number | 'auto';\n direction?: 'rtl' | 'ltr';\n autoplay?: boolean;\n [key: string]: unknown;\n };\n}\n\nexport function ProductsSlider({ data }: ProductsSliderProps) {\n const { t } = useTranslation();\n const {\n products,\n title,\n display_all_url: displayAllUrl,\n position = 1,\n priority = false,\n show_controls: showControls,\n controls_outer: controlsOuter,\n loop,\n centered,\n slides_per_view: slidesPerView,\n direction,\n autoplay,\n } = data;\n\n const sliderProps = useMemo(\n () => ({\n id: `slider-${position}`,\n displayAllTitle: t('blocks.home.display_all', 'View All'),\n ...(showControls !== undefined && { showControls }),\n ...(controlsOuter !== undefined && { controlsOuter }),\n ...(loop !== undefined && { loop }),\n ...(centered !== undefined && { centered }),\n ...(slidesPerView !== undefined && { slidesPerView }),\n ...(direction !== undefined && { direction }),\n }),\n [position, t, showControls, controlsOuter, loop, centered, slidesPerView, direction]\n );\n\n const loader = useCallback(\n () =>\n product.list({\n source: products.source,\n sourceValue: products.source_value,\n }),\n [products.source, products.source_value]\n );\n\n return (\n <Suspense fallback={<ProductsSliderSkeleton />}>\n <SallaProductsSlider\n id={`best-offers-${position}-slider`}\n loader={loader}\n sliderProps={sliderProps}\n {...(displayAllUrl ? { displayAllUrl } : {})}\n {...(title ? { blockTitle: title } : {})}\n {...(autoplay !== undefined ? { autoplay } : {})}\n skeleton={<ProductsSliderSkeleton />}\n >\n {(product, index) => (\n <ProductCard product={product} imagePriority={priority && index < 2} />\n )}\n </SallaProductsSlider>\n </Suspense>\n );\n}\n","import { memo } from 'react';\nimport type { Feature } from '../../types';\n\nexport interface StoreFeaturesProps {\n data: {\n features: Feature[];\n [key: string]: unknown;\n };\n}\n\nexport const StoreFeatures = memo(function StoreFeatures({ data }: StoreFeaturesProps) {\n const { features } = data;\n\n if (!features.length) return null;\n\n return (\n <>\n <div className=\"grid grid-cols-[repeat(2,minmax(0,1fr))] md:grid-cols-[repeat(3,minmax(0,1fr))] gap-4 sm:gap-6 xl:gap-8\">\n {features.map((feature) => (\n <div\n key={`${feature.icon}:${feature.title}:${feature.description ?? ''}`}\n className=\"s-block--features__item\"\n >\n <div className=\"feature-icon\">\n <i className={feature.icon}></i>\n </div>\n <h2>{feature.title}</h2>\n <p>{feature.description}</p>\n </div>\n ))}\n </div>\n </>\n );\n});\n","import { memo } from 'react';\nimport { Link } from '../common';\n\nexport interface FixedBannerComponentProps {\n data: {\n image: {\n url: string;\n alt?: string;\n small_url?: string;\n };\n url?: string;\n title?: string;\n position?: number;\n [key: string]: unknown;\n };\n priority?: boolean;\n}\n\nexport const FixedBanner = memo(function FixedBanner(props: FixedBannerComponentProps) {\n const { data, priority = false } = props;\n const image = data.image?.url;\n\n if (!image) {\n return null;\n }\n\n const url = data.url;\n const altText = data.image.alt?.trim() ? data.image.alt : data.title || 'fixed banner';\n\n const imgProps = priority\n ? {\n loading: 'eager' as const,\n fetchPriority: 'high' as const,\n decoding: 'sync' as const,\n }\n : {\n loading: 'lazy' as const,\n decoding: 'async' as const,\n };\n\n const smallUrl = data.image.small_url;\n\n return (\n <>\n <div className=\"container\">\n <Link\n to={url || '#'}\n className=\"banner banner--fixed overflow-hidden\"\n aria-label={`Banner ${altText}`}\n >\n <picture>\n {smallUrl && <source media=\"(max-width: 767px)\" srcSet={smallUrl} />}\n <img\n width=\"1200\"\n height=\"300\"\n src={image}\n alt={altText}\n style={{ maxWidth: '100%', objectFit: 'contain' }}\n loading={imgProps.loading}\n decoding={imgProps.decoding}\n {...(priority && { fetchPriority: imgProps.fetchPriority })}\n />\n </picture>\n </Link>\n </div>\n </>\n );\n});\n","import { Suspense } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { FixedProductsSkeleton } from '@salla.sa/twilight-components-react';\nimport { Link } from '../common';\nimport { product, ProductsListSource } from '../../api/product';\nimport { ProductCard } from '../../components/product';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\n\nexport interface FixedProductsProps {\n data: {\n products: { source: ProductsListSource; source_value?: number[] | null };\n title?: string;\n limit?: number | string;\n display_all_url?: string | null;\n key?: string | null;\n isVertical?: boolean;\n position?: number;\n [key: string]: unknown;\n };\n}\n\nexport function FixedProducts({ data }: FixedProductsProps) {\n const { t } = useTranslation();\n const { theme } = useTwilight();\n\n const title = data.title;\n // The merchant's product count: a number, or the same as a string. Anything that\n // isn't a positive whole number falls back to what the API returns.\n const parsedLimit = Number(data.limit);\n const limit = Number.isInteger(parsedLimit) && parsedLimit > 0 ? parsedLimit : undefined;\n // Matches Twig Raed: `theme.settings.get('vertical_fixed_products', true)`.\n const isVertical = data.isVertical ?? theme.settings.vertical_fixed_products ?? true;\n\n const { data: result, isLoading } = useQuery(\n product.queries.list({\n source: data.products.source,\n sourceValue: data.products?.source_value,\n perPage: limit,\n })\n );\n\n const products = result?.items ?? [];\n\n if (isLoading) {\n return <FixedProductsSkeleton />;\n }\n\n if (!products.length) return null;\n\n return (\n <Suspense fallback={<FixedProductsSkeleton />}>\n {title && (\n <div className=\"s-block__title\">\n <div className=\"right-side\">\n <h2>{title}</h2>\n </div>\n {data.display_all_url && (\n <Link to={data.display_all_url} className=\"s-block__display-all\">\n {t('blocks.home.display_all', 'View All')}\n <i className=\"sicon-arrow-left\"></i>\n </Link>\n )}\n </div>\n )}\n <div\n className={\n 's-products-list-wrapper ' +\n (isVertical ? 's-products-list-vertical-cards' : 's-products-list-horizontal-cards')\n }\n >\n {products.slice(0, limit).map((product) => (\n <ProductCard\n key={product.id}\n product={product}\n layout={isVertical ? 'vertical' : 'horizontal'}\n />\n ))}\n </div>\n </Suspense>\n );\n}\n","import { memo, useState, useCallback } from 'react';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport type { Product } from '../../types';\n\ninterface SectionItem {\n title?: string;\n name?: string;\n type?: string;\n id?: string;\n products?: Product[];\n limit?: number;\n}\n\ninterface MainProduct {\n id?: string;\n title?: string;\n value?: string;\n product?: Product;\n}\n\nexport interface FeaturedProductsStyle1Props {\n data: {\n items: SectionItem[];\n main_product?: MainProduct;\n position?: number;\n [key: string]: unknown;\n };\n}\n\nexport const FeaturedProductsStyle1 = memo(function FeaturedProductsStyle1({\n data,\n}: FeaturedProductsStyle1Props) {\n const items = data.items || [];\n const mainProduct = data.main_product;\n\n const [activeTab, setActiveTab] = useState<string>(items[0]?.id || '');\n const [isAnimating, setIsAnimating] = useState(false);\n\n const handleTabClick = useCallback(\n (tabId: string) => {\n if (tabId === activeTab) return;\n setIsAnimating(true);\n setActiveTab(tabId);\n setTimeout(() => setIsAnimating(false), 100);\n },\n [activeTab]\n );\n\n if (!items.length) return null;\n\n const hasMultipleSections = items.length > 1;\n\n return (\n <>\n <div className=\"s-block__title\">\n <div className=\"right-side\">\n <h2>{mainProduct?.title}</h2>\n </div>\n {hasMultipleSections && (\n <div className=\"tabs hide-scroll hidden lg:flex\">\n {items.map((section) => (\n <SallaButton\n key={section.id}\n shape=\"link\"\n onClick={() => handleTabClick(section.id || '')}\n className={`tab-trigger ${activeTab === section.id ? 'is-active' : ''}`}\n >\n {section.title || section.name}\n </SallaButton>\n ))}\n </div>\n )}\n </div>\n\n <div className={`grid grid-cols-1 gap-8 ${mainProduct?.product ? 'lg:grid-cols-2' : ''}`}>\n {mainProduct?.product && (\n <div className=\"flex flex-col\">\n <custom-salla-product-card\n shadow-on-hover\n product={JSON.stringify(mainProduct.product)}\n isSpecial\n ></custom-salla-product-card>\n </div>\n )}\n <div className=\"flex flex-col\">\n {hasMultipleSections && (\n <div className=\"tabs mb-4 sm:mb-8 hide-scroll lg:hidden\">\n {items.map((section) => (\n <SallaButton\n key={section.id}\n shape=\"link\"\n onClick={() => handleTabClick(section.id || '')}\n className={`tab-trigger ${activeTab === section.id ? 'is-active' : ''}`}\n >\n {section.title || section.name}\n </SallaButton>\n ))}\n </div>\n )}\n\n <div className=\"tabs-wrapper flex flex-1\">\n {items.map((section) => {\n const isActive = activeTab === section.id;\n return (\n <div\n key={section.id}\n className={`tabs__item grid-cols-2 ${mainProduct?.product ? '' : 'lg:grid-cols-4'} ${isActive ? 'is-active' : ''} ${isAnimating && isActive ? 'opacity-0 translate-y-3' : ''} ${!isAnimating && isActive ? 'opacity-100 translate-y-0' : ''}`}\n >\n {section.products\n ?.slice(0, mainProduct?.product ? 4 : 8)\n .map((product, productIndex) => (\n <custom-salla-product-card\n key={product.id || productIndex}\n product={JSON.stringify(product)}\n ></custom-salla-product-card>\n ))}\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </>\n );\n});\n","import { memo, useState, useCallback } from 'react';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { SallaProductsList } from '@salla.sa/twilight-components-react';\nimport { SallaProductsSlider } from '@salla.sa/twilight-components-react';\nimport { product, ProductsListSource } from '../../api/product';\nimport { ProductCard } from '../../components/product';\nimport { useTwilight } from '../../providers/TwilightProvider';\n\ninterface ProductSource {\n source: ProductsListSource;\n limit?: number;\n source_value?: number | number[];\n}\n\ninterface SectionItem {\n title?: string;\n name?: string;\n type?: string;\n id?: string;\n products: ProductSource;\n limit?: number;\n}\n\nexport interface FeaturedProductsStyle2Props {\n data: {\n items: SectionItem[];\n position?: number;\n is_slider?: boolean;\n [key: string]: unknown;\n };\n}\n\n// Like Twig Raed, the grid honors `vertical_fixed_products`; the slider never does.\nexport const FeaturedProductsStyle2 = memo(function FeaturedProductsStyle2({\n data,\n}: FeaturedProductsStyle2Props) {\n const { theme } = useTwilight();\n const items = data.items || [];\n const isSlider = data.is_slider ?? true;\n const cardLayout = (theme.settings.vertical_fixed_products ?? true) ? 'vertical' : 'horizontal';\n\n const [activeTab, setActiveTab] = useState<string>(items[0]?.id || '');\n const [isAnimating, setIsAnimating] = useState(false);\n\n const handleTabClick = useCallback(\n (tabId: string) => {\n if (tabId === activeTab) return;\n setIsAnimating(true);\n setActiveTab(tabId);\n setTimeout(() => setIsAnimating(false), 100);\n },\n [activeTab]\n );\n\n const loader = useCallback(\n (source: ProductsListSource, value?: number | number[], limit?: number) => {\n return () =>\n product.list({\n source: source,\n sourceValue: value,\n perPage: limit,\n });\n },\n []\n );\n\n if (!items.length) return null;\n\n const hasMultipleSections = items.length > 1;\n\n return (\n <>\n <div className=\"container\">\n {hasMultipleSections && (\n <div className=\"tabs hide-scroll\">\n {items.map((section) => (\n <SallaButton\n key={section.id}\n fill=\"outline\"\n onClick={() => handleTabClick(section.id || '')}\n className={`tab-trigger ${activeTab === section.id ? 'is-active' : ''}`}\n >\n {section.title || section.name}\n </SallaButton>\n ))}\n </div>\n )}\n\n <div className=\"tabs-wrapper\">\n {items.map((section) => {\n const isActive = activeTab === section.id;\n return (\n <div\n key={section.id}\n className={`tabs__item ${isActive ? 'is-active' : ''} ${isAnimating && isActive ? 'opacity-0 translate-y-3' : ''} ${!isAnimating && isActive ? 'opacity-100 translate-y-0' : ''}`}\n >\n {isSlider ? (\n <SallaProductsSlider\n loader={loader(\n section.products.source,\n section.products?.source_value,\n section.products?.limit\n )}\n sliderProps={{ id: `section-${section.id}-slider` }}\n >\n {(product) => (\n <ProductCard className=\"s-products-slider-card\" product={product} />\n )}\n </SallaProductsSlider>\n ) : (\n <SallaProductsList\n loader={loader(\n section.products.source,\n section.products?.source_value,\n section.products?.limit\n )}\n itemsClassName={`s-products-list-${cardLayout}-cards`}\n >\n {(products) =>\n products.map((product) => (\n <ProductCard key={product.id} product={product} layout={cardLayout} />\n ))\n }\n </SallaProductsList>\n )}\n </div>\n );\n })}\n </div>\n </div>\n </>\n );\n});\n","import { memo } from 'react';\nimport { ProductCard } from '../product/ProductCard';\nimport type { Product } from '../../types';\n\ninterface SectionItem {\n title?: string;\n name?: string;\n type?: string;\n products?: Product[];\n featured_product?: Product;\n limit?: number;\n id?: string;\n}\n\nexport interface FeaturedProductsStyle3Props {\n data: {\n items: SectionItem[];\n position?: number;\n [key: string]: unknown;\n };\n}\n\nexport const FeaturedProductsStyle3 = memo(function FeaturedProductsStyle3({\n data,\n}: FeaturedProductsStyle3Props) {\n const items = data.items || [];\n\n if (!items.length) return null;\n\n return (\n <>\n <div className=\"inner\">\n {items.map((section, sectionIndex) => (\n <div key={section.id || sectionIndex}>\n <div className=\"s-block__title\">\n <h2>{section.title}</h2>\n </div>\n <div className=\"flex-1 grid lg:grid-cols-2 gap-4 sm:gap-8\">\n {section.featured_product ? (\n <>\n <ProductCard product={section.featured_product} layout=\"fullImage\" withShadow />\n <div className=\"grid gap-4 sm:gap-8\">\n {section.products?.slice(0, 3).map((product, idx) => (\n <ProductCard\n key={product.id}\n product={product}\n layout=\"minimal\"\n withShadow\n index={idx}\n />\n ))}\n </div>\n </>\n ) : (\n section.products?.map((product, idx) => (\n <ProductCard\n key={product.id}\n product={product}\n layout=\"minimal\"\n withShadow\n index={idx}\n />\n ))\n )}\n </div>\n </div>\n ))}\n </div>\n </>\n );\n});\n","import { memo } from 'react';\nimport { Link } from '../common';\n\ninterface ImageData {\n url?: string;\n}\n\nexport interface ParallaxBackgroundProps {\n data: {\n image: ImageData;\n url?: string;\n title?: string;\n link_text?: string;\n is_opacity?: boolean;\n position?: number;\n [key: string]: unknown;\n };\n}\n\nexport const ParallaxBackground = memo(function ParallaxBackground({\n data,\n}: ParallaxBackgroundProps) {\n const { image, url, title, link_text: linkText, is_opacity: isOpacity = false } = data;\n\n if (!image?.url) return null;\n\n return (\n <>\n <div className=\"full-banner-entry\" style={{ backgroundImage: `url(${image.url})` }}>\n <div\n className={`overlay h-full w-full ${isOpacity ? 'bg-black' : ''} opacity-60 absolute top-0 left-0`}\n ></div>\n <div className=\"flex h-full items-center justify-center p-5 xs:p-11 relative\">\n <div>\n {title && <h2 className=\"text-2xl font-bold leading-12\">{title}</h2>}\n\n {url && linkText && (\n <Link\n to={url}\n className=\"inline-block text-white text-sm border rounded-md font-bold px-8 py-4\"\n >\n {linkText}\n </Link>\n )}\n </div>\n </div>\n </div>\n </>\n );\n});\n","import { memo } from 'react';\nimport { SallaSlider } from '@salla.sa/twilight-components-react/slider';\nimport { Link, Image } from '../common';\n\ninterface PhotoItem {\n id?: string | number;\n url?: string;\n link_type?: string;\n image?: string;\n}\n\nexport interface PhotosSliderProps {\n data: {\n items: PhotoItem[];\n position?: number;\n is_repeated?: boolean;\n [key: string]: unknown;\n };\n}\n\nexport const PhotosSlider = memo(function PhotosSlider({ data }: PhotosSliderProps) {\n const items = data.items || [];\n const position = data.position ?? 1;\n\n if (!items.length) return null;\n\n return (\n <>\n <SallaSlider\n type=\"carousel\"\n className=\"home-slider photos-slider\"\n centered\n autoPlay\n pagination\n id={`photos-${position}-slider`}\n sliderConfig={{ watchOverflow: true }}\n >\n <div slot=\"items\">\n {items.map((item, index) => (\n <div\n key={item.id ?? `${item.url ?? ''}:${item.image ?? ''}`}\n className=\"swiper-slide\"\n style={{ aspectRatio: '1200/300' }}\n >\n <Link to={item.url || '#'}>\n <Image\n src={item.image}\n className=\"w-full h-full object-contain rounded-md\"\n alt={`image-slider-${index}`}\n width={1200}\n height={300}\n priority={index === 0}\n />\n </Link>\n </div>\n ))}\n </div>\n </SallaSlider>\n </>\n );\n});\n","import { memo } from 'react';\nimport { Link } from '../common';\n\ninterface ImageData {\n url?: string;\n alt?: string;\n}\n\ninterface SquarePhotoItem {\n id?: string | number;\n url?: string;\n link_type?: string;\n /** The Store API sends the URL itself to the engine; Twig gets `{ url, alt }`. */\n image?: string | ImageData;\n text?: string;\n}\n\nconst imageUrl = (item: SquarePhotoItem) =>\n typeof item.image === 'string' ? item.image : item.image?.url;\n\nexport interface SquarePhotosProps {\n data: {\n title?: string;\n items: SquarePhotoItem[];\n position?: number;\n [key: string]: unknown;\n };\n}\n\nexport const SquarePhotos = memo(function SquarePhotos({ data }: SquarePhotosProps) {\n const items = data.items || [];\n const title = data.title;\n\n if (!items.length) return null;\n\n const gridCols =\n items.length <= 3 ? `one-row md:grid-cols-${items.length}` : 'md:grid-cols-3 two-row';\n\n return (\n <>\n {title && (\n <div className=\"s-block__title\">\n <div className=\"right-side\">\n <h2>{title}</h2>\n </div>\n </div>\n )}\n\n <div className={`grid ${gridCols} grid-flow-row gap-3 sm:gap-8`}>\n {items.map((item) => (\n <Link\n {...(item.link_type === 'external_link' ? { target: '_blank' } : {})}\n key={item.id ?? imageUrl(item) ?? item.url}\n className={`banner-entry square-photos ${item.text ? 'has-overlay with-hover' : ''}`}\n style={{ backgroundImage: `url(${imageUrl(item)})` }}\n to={item.url || '#'}\n >\n {item.text && (\n <h3 className=\"text-with-border\">\n <span>{item.text}</span>\n </h3>\n )}\n </Link>\n ))}\n </div>\n </>\n );\n});\n","import { memo, useEffect, useState } from 'react';\n\nexport interface YoutubeProps {\n data: {\n youtube_id: string;\n position?: number;\n [key: string]: unknown;\n };\n}\n\nexport const Youtube = memo(function Youtube({ data }: YoutubeProps) {\n const { youtube_id: youtubeId } = data;\n const [isLoaded, setIsLoaded] = useState(false);\n\n useEffect(() => {\n if (!youtubeId) return;\n\n // Lazy load the lite-youtube web component\n let mounted = true;\n import('@justinribeiro/lite-youtube')\n .then(() => {\n if (mounted) setIsLoaded(true);\n })\n .catch((err) => {\n console.error('Failed to load lite-youtube:', err);\n });\n\n return () => {\n mounted = false;\n };\n }, [youtubeId]);\n\n if (!youtubeId) return null;\n\n return (\n <>\n <div className=\"container\">\n <div className=\"videoWrapper\">\n {isLoaded ? (\n <lite-youtube videoid={youtubeId} params=\"rel=0\"></lite-youtube>\n ) : (\n <div className=\"animate-pulse bg-gray-200 w-full h-full min-h-[300px] rounded\" />\n )}\n </div>\n </div>\n </>\n );\n});\n","import { memo, useState, useEffect, type CSSProperties } from 'react';\n\n// Placeholder hints a bundle declares per component under `props` in its\n// twilight-bundle.json; the store API passes them as `component_props`. Each maps 1:1 to an\n// attribute on <salla-custom-component>, which reserves the component's space until the\n// bundle renders.\n// @see https://github.com/SallaApp/twilight-bundles/blob/master/packages/starter-kit/README.md#component-skeleton--placeholder\nconst SIZE_PROPS = ['min-height', 'height', 'width', 'aspect-ratio'] as const;\nconst SKELETON_PROPS: readonly string[] = [...SIZE_PROPS, 'skeleton-style'];\n\ntype SkeletonProps = Record<string, string>;\n\nexport interface BundleComponentProps {\n data: {\n component_name: string;\n bundle_id: string;\n component_props?: SkeletonProps;\n [key: string]: unknown;\n };\n}\n\nfunction pickSkeletonProps(props: unknown): SkeletonProps {\n if (!props || typeof props !== 'object') return {};\n return Object.fromEntries(\n Object.entries(props).filter(\n ([name, value]) =>\n SKELETON_PROPS.includes(name) && typeof value === 'string' && value.trim() !== ''\n )\n ) as SkeletonProps;\n}\n\n// Until mount there is no <salla-custom-component>, so hold the same footprint with a plain\n// block — otherwise the server HTML has nothing here and the page shifts once it mounts.\nfunction reservedSizeStyle(props: SkeletonProps): CSSProperties | undefined {\n const sizes = SIZE_PROPS.filter((name) => props[name]);\n if (!sizes.length) return undefined;\n return Object.fromEntries(\n sizes.map((name) => [\n name.replace(/-([a-z])/g, (_, char: string) => char.toUpperCase()),\n props[name],\n ])\n ) as CSSProperties;\n}\n\nexport const BundleComponent = memo(function BundleComponent(props: BundleComponentProps) {\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const {\n component_name: componentName,\n bundle_id: bundleId,\n component_props: componentProps,\n ...rest\n } = props.data;\n const skeletonProps = pickSkeletonProps(componentProps);\n\n if (!mounted) {\n const style = reservedSizeStyle(skeletonProps);\n return style ? <div aria-hidden=\"true\" style={style} /> : null;\n }\n\n const config = JSON.stringify(rest);\n\n return (\n <>\n <salla-custom-component\n component-name={componentName}\n bundle-id={bundleId}\n config={config}\n {...skeletonProps}\n suppressHydrationWarning\n />\n </>\n );\n});\n","import { lazyComponent } from '../../utils/lazy-component';\n\nexport { ProductsSlider as LazyProductsSlider } from './ProductsSlider';\nexport { StoreFeatures as LazyStoreFeatures } from './StoreFeatures';\nexport { FixedBanner as LazyFixedBanner } from './FixedBanner';\nexport { FixedProducts as LazyFixedProducts } from './FixedProducts';\nexport { FeaturedProductsStyle1 as LazyFeaturedProductsStyle1 } from './FeaturedProductsStyle1';\nexport { FeaturedProductsStyle2 as LazyFeaturedProductsStyle2 } from './FeaturedProductsStyle2';\nexport { FeaturedProductsStyle3 as LazyFeaturedProductsStyle3 } from './FeaturedProductsStyle3';\nexport { ParallaxBackground as LazyParallaxBackground } from './ParallaxBackground';\nexport { PhotosSlider as LazyPhotosSlider } from './PhotosSlider';\nexport { SquarePhotos as LazySquarePhotos } from './SquarePhotos';\nexport const LazyTestimonials = lazyComponent(() =>\n import('./Testimonials').then((m) => ({ default: m.Testimonials }))\n);\nexport { Youtube as LazyYoutube } from './Youtube';\nexport { BundleComponent as LazyBundleComponent } from './BundleComponent';\n","import {\n LazyProductsSlider,\n LazyStoreFeatures,\n LazyFixedBanner,\n LazyFixedProducts,\n LazyFeaturedProductsStyle1,\n LazyFeaturedProductsStyle2,\n LazyFeaturedProductsStyle3,\n LazyParallaxBackground,\n LazyPhotosSlider,\n LazySquarePhotos,\n LazyTestimonials,\n LazyYoutube,\n LazyBundleComponent,\n} from './lazy';\nimport type { AnyHomeComponent } from './types';\nimport { registry } from '../ComponentRegistry';\n\nexport const DefaultHomeComponents: Record<string, AnyHomeComponent | null> = {\n 'fixed-banner': LazyFixedBanner,\n 'photos-slider': LazyPhotosSlider,\n testimonial: LazyTestimonials,\n 'store-features': LazyStoreFeatures,\n youtube: LazyYoutube,\n 'square-photos': LazySquarePhotos,\n 'fixed-products': LazyFixedProducts,\n 'products-slider': LazyProductsSlider,\n 'parallax-background': LazyParallaxBackground,\n 'featured-products:style1': LazyFeaturedProductsStyle1,\n 'featured-products:style2': LazyFeaturedProductsStyle2,\n 'featured-products:style3': LazyFeaturedProductsStyle3,\n 'bundle-component': LazyBundleComponent,\n};\n\nexport function registerHomeComponents(\n components: Record<string, AnyHomeComponent | null> = DefaultHomeComponents,\n prefix = 'home:'\n): void {\n Object.entries(components).forEach(([path, component]) => {\n if (component) {\n registry.register(`${prefix}${path}`, component);\n }\n });\n}\n","import { Component, type ReactNode, type ErrorInfo } from 'react';\nimport { TwilightContext } from '../../providers/twilight-context';\nimport type { TwilightContextValue } from '../../types/twilight';\nimport type { HomeComponentData } from '../../types';\n\ninterface ComponentErrorBoundaryProps {\n children: ReactNode;\n data: HomeComponentData;\n position: number;\n}\n\ninterface ComponentErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n\nfunction DevelopmentErrorCard({ error, data }: { error: Error; data: HomeComponentData }) {\n return (\n <section\n dir=\"ltr\"\n className=\"s-block container overflow-hidden bg-red-50 border border-red-300 p-4\"\n >\n <p className=\"text-red-800 text-sm font-bold\">Home Component Error: {data.path}</p>\n <p className=\"text-red-700 text-sm mt-2\">{error.message}</p>\n <details className=\"mt-2\">\n <summary className=\"text-xs cursor-pointer text-red-600\">Stack Trace</summary>\n <pre className=\"text-xs mt-1 overflow-auto max-h-32 text-red-700\">{error.stack}</pre>\n </details>\n <details className=\"mt-2\">\n <summary className=\"text-xs cursor-pointer text-red-600\">Component Data</summary>\n <pre className=\"text-xs mt-1 overflow-auto max-h-32 text-red-700\">\n {JSON.stringify(data, null, 2)}\n </pre>\n </details>\n </section>\n );\n}\n\nexport class ComponentErrorBoundary extends Component<\n ComponentErrorBoundaryProps,\n ComponentErrorBoundaryState\n> {\n static contextType = TwilightContext;\n\n declare context: TwilightContextValue | null;\n\n constructor(props: ComponentErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error): ComponentErrorBoundaryState {\n return { hasError: true, error };\n }\n\n // Blocks are keyed by position, so a replacement block at the same position reuses\n // this boundary. An error belongs to the block that threw it, not the position.\n componentDidUpdate(prevProps: ComponentErrorBoundaryProps): void {\n if (this.state.hasError && prevProps.data !== this.props.data) {\n this.setState({ hasError: false, error: null });\n }\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n if (!this.context) {\n console.error('[ComponentErrorBoundary] Must be used within TwilightProvider');\n return;\n }\n const { log } = this.context;\n const { data, position } = this.props;\n\n log.groupCollapsed(`HomeComponent Error: ${data.path || 'unknown'}`);\n log.error('ERROR', error.message);\n log.label('COMPONENT', data.path || 'unknown');\n log.label('POSITION', position);\n log.label('URL', typeof window !== 'undefined' ? window.location.href : 'SSR');\n log.label('TIME', new Date().toISOString());\n log.trace('STACK TRACE', error.stack || '');\n log.trace('COMPONENT STACK', errorInfo.componentStack || '');\n log.dir('COMPONENT DATA', data);\n log.groupEnd();\n }\n\n render(): ReactNode {\n const { hasError, error } = this.state;\n const { children, data } = this.props;\n\n if (hasError && error) {\n if (process.env.NODE_ENV === 'production') {\n return null;\n }\n\n return <DevelopmentErrorCard error={error} data={data} />;\n }\n\n return children;\n }\n}\n","import { memo, useEffect, useRef, type ReactNode } from 'react';\nimport { registry } from '../ComponentRegistry';\nimport { RenderWhenVisible } from '../common';\nimport { ComponentErrorBoundary } from './ComponentErrorBoundary';\nimport type { AnyHomeComponent } from './index';\nimport type { HomeComponentData } from '../../types';\nimport {\n BackgroundSliderSkeleton,\n BulletDeliverySkeleton,\n FixedProductsSkeleton,\n ListSkeleton,\n ProductsSliderSkeleton,\n Pulse,\n ReviewItemSkeleton,\n SliderSkeleton,\n} from '@salla.sa/twilight-components-react';\n\nfunction SquareGridSkeleton() {\n return (\n <div className=\"s-block container grid grid-cols-2 sm:grid-cols-4 gap-4 py-8\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"aspect-square\" />\n ))}\n </div>\n );\n}\n\nexport type HomeComponentsProps = {\n data: HomeComponentData & {\n position?: number;\n [key: string]: unknown;\n };\n};\n\n/**\n * Fallback component for unknown/unregistered components\n * Only shows in development mode\n */\nconst FallbackComponent = memo(function FallbackComponent({ data }: HomeComponentsProps) {\n if (process.env.NODE_ENV === 'production') return null;\n\n return (\n <section\n dir=\"ltr\"\n className=\"s-block container overflow-hidden bg-yellow-50 border border-yellow-200 p-4\"\n >\n <p className=\"text-yellow-800 text-sm\">\n <strong>Unknown component:</strong> {data.path}\n </p>\n <p className=\"text-yellow-700 text-xs mt-1\">\n Register it in setup.ts: <code>registry.register('home:{data.path}', YourComponent)</code>\n </p>\n <details className=\"mt-2\">\n <summary className=\"text-xs cursor-pointer\">Component Data</summary>\n <pre className=\"text-xs mt-1 overflow-auto max-h-32\">{JSON.stringify(data, null, 2)}</pre>\n </details>\n </section>\n );\n});\n\n/**\n * Get the React component for a given home component path\n * Looks up from registry only - theme must register components\n */\nfunction getComponentByPath(data: HomeComponentData): AnyHomeComponent {\n const { path, view_style: viewStyle } = data;\n\n // 1. Check for view_style variant first\n if (viewStyle) {\n const variantKey = `home:${path}:${viewStyle}`;\n const variant = registry.resolve(variantKey);\n if (variant) {\n return variant as AnyHomeComponent;\n }\n }\n\n // 2. Check registry for component\n const registryKey = `home:${path}`;\n const component = registry.resolve(registryKey);\n if (component) {\n return component as AnyHomeComponent;\n }\n\n // 3. Fallback for unknown components\n return FallbackComponent;\n}\n\n/** Same breakpoint and rules the Store injects for Twig themes (`ComponentVisibilityStyles`). */\nconst CHANNEL_VISIBILITY_CSS =\n '@media (max-width:767.98px){.s-hide-on-mobile{display:none!important}}' +\n '@media (min-width:768px){.s-hide-on-desktop{display:none!important}}';\n\n/**\n * Hide class for the merchant's per-channel pick. A missing key, or one that\n * hides on both channels, means visible everywhere: hiding a block outright\n * is the `is_visible` toggle's job, and stores without the feature send no key.\n */\nexport function channelVisibilityClass(data: HomeComponentData): string {\n const raw = data.channel_visibility;\n if (!raw || typeof raw !== 'object') return '';\n const desktop = raw.desktop !== false;\n const mobile = raw.mobile !== false;\n if (desktop && !mobile) return 's-hide-on-mobile';\n if (mobile && !desktop) return 's-hide-on-desktop';\n return '';\n}\n\n/**\n * Render-shell config for a home block: the values the lazy-load wrapper\n * (`RenderWhenVisible`) needs *before* the block mounts — reserved height, the\n * skeleton placeholder, and the wrapper's className/id.\n *\n * Themes register config for blocks they own via `registerHomeComponentConfig`;\n * the engine knows nothing about theme-specific blocks.\n */\nexport type HomeComponentConfig = {\n height?: string;\n className?: string | ((data: HomeComponentData) => string);\n id?: string | ((data: HomeComponentData) => string);\n placeholder?: ReactNode;\n /** Mount on page load instead of when the block nears the viewport. */\n renderOnMount?: boolean;\n};\n\nconst COMPONENT_CONFIG: Record<string, HomeComponentConfig> = {\n 'products-slider': { height: '450px', placeholder: <ProductsSliderSkeleton /> },\n 'fixed-products': { height: '450px', placeholder: <FixedProductsSkeleton /> },\n 'featured-products': {\n height: '450px',\n placeholder: <ProductsSliderSkeleton />,\n className: (data) => {\n const style = data.view_style;\n if (style === 'style1')\n return 's-block s-block--featured-products s-block-tabs s-block--special-products container tabs-initialized';\n if (style === 'style2')\n return `s-block s-block--featured-products s-block-tabs s-block--tabs-produtcs s-block--full-bg tabs-initialized ${data.is_slider ? 'as-slider' : 'as-grid'} bg-gray-100 py-8 sm:py-16`;\n if (style === 'style3')\n return `s-block s-block--featured-products s-block--features-products${Array.isArray(data.items) && data.items.length > 1 ? ' two-cols' : ''} container`;\n return 's-block s-block--featured-products container overflow-hidden';\n },\n id: (data) => `featured-products-${data.view_style}-${data.position ?? 0}`,\n },\n testimonial: { height: '350px', placeholder: <ReviewItemSkeleton /> },\n 'store-features': { height: '200px', placeholder: <BulletDeliverySkeleton /> },\n 'parallax-background': { height: '500px', placeholder: <BackgroundSliderSkeleton /> },\n 'fixed-banner': { height: '350px', placeholder: <BackgroundSliderSkeleton /> },\n 'photos-slider': {\n height: 'clamp(130px, 30vw, 350px)',\n placeholder: <SliderSkeleton />,\n className: (data) =>\n `s-block s-block--photos-slider${data.is_repeated ? ' repeated-block' : ''}`,\n },\n 'square-photos': { height: '250px', placeholder: <SquareGridSkeleton /> },\n youtube: { height: '350px', placeholder: <SliderSkeleton /> },\n 'bundle-component': {\n // As in Twig: reserve nothing, the bundle grows the block from 0.\n height: '0px',\n placeholder: <></>,\n className: (data) => `s-block s-block--bundle-${data.component_name}`,\n // As in Twig, where merchant scripts wait a limited time for the bundle's markup.\n renderOnMount: true,\n },\n 'main-links': {\n height: '200px',\n placeholder: <ListSkeleton />,\n className: (data) => {\n const mergeWithTop = data.merge_links_with_top_component;\n const position = data.position;\n return [\n 's-block',\n 's-block--main-links',\n mergeWithTop && position ? 'merge-with-top-component' : '',\n !data.title && mergeWithTop ? 'merged-has-no-title' : '',\n ]\n .filter(Boolean)\n .join(' ');\n },\n },\n 'square-links': { height: '200px', placeholder: <SquareGridSkeleton /> },\n};\n\n/**\n * Theme-registered render-shell config, keyed by home component path. Themes own\n * the display of their blocks by registering config here; at render time a path's\n * theme entry replaces (not field-merges) the engine's built-in `COMPONENT_CONFIG`\n * entry for that path.\n */\nconst themeComponentConfig: Record<string, HomeComponentConfig> = {};\n\n/**\n * Register render-shell config for home blocks a theme owns (height, placeholder,\n * className, id). Merges by path and overwrites existing keys, so it is safe to\n * call more than once and idempotent for the same keys.\n */\nexport function registerHomeComponentConfig(config: Record<string, HomeComponentConfig>): void {\n Object.assign(themeComponentConfig, config);\n}\n\n/**\n * Resolve a block's render-shell config: theme-registered config takes precedence\n * over the engine's built-in config; returns `undefined` when neither defines the\n * path so the renderer can apply generic defaults.\n */\nfunction resolveComponentConfig(path: string): HomeComponentConfig | undefined {\n return themeComponentConfig[path] ?? COMPONENT_CONFIG[path];\n}\n\n/**\n * What the theme editor addresses a block by: the dev editor's layout id (less\n * the remount suffix), its row id, or the uuid of one not saved yet. The layout\n * id comes first: a customized layout keeps the store blocks' row ids among\n * their fields, and duplicates share them. A built-in block (fixed products,\n * YouTube, …) has neither id nor key, so it goes by its path, which the\n * editor matches to the block's slug; the bar says which copy.\n */\nfunction liveBlockIdOf(data: HomeComponentData): string | undefined {\n const devId = typeof data.__dev_id === 'string' ? data.__dev_id.replace(/~\\d+$/, '') : undefined;\n const id = devId ?? data.id ?? data.key;\n if (typeof id === 'number' || (typeof id === 'string' && id)) return String(id);\n return data.path || undefined;\n}\n\n/**\n * Memoized component renderer with scroll-based lazy loading\n * Components only mount when scrolled into view - preventing API calls until needed\n */\nexport const HomeComponentRenderer = memo(function HomeComponentRenderer({\n data,\n index,\n priority,\n}: {\n data: HomeComponentData;\n index: number;\n /** Mount right away with eager images. Defaults to the first three blocks of the page. */\n priority?: boolean;\n}) {\n const renderCountRef = useRef(0);\n renderCountRef.current += 1;\n\n if (process.env.NODE_ENV === 'development') {\n console.log(\n `[HomeComponentRenderer] RENDER: path=${data.path}, index=${index}, renderCount=${renderCountRef.current}`\n );\n }\n\n useEffect(() => {\n console.log(\n `[HomeComponentRenderer] MOUNT: path=${data.path}, index=${index}, renderCount=${renderCountRef.current}`\n );\n return () => {\n console.log(`[HomeComponentRenderer] UNMOUNT: path=${data.path}, index=${index}`);\n };\n }, [data.path, index]);\n\n const isFirstComponent = priority ?? index <= 2;\n const Component = getComponentByPath(data);\n\n const config = resolveComponentConfig(data.path);\n\n const resolvedClassName = config?.className\n ? typeof config.className === 'function'\n ? config.className(data)\n : config.className\n : `s-block s-block--${data.path}`;\n const hideClass = channelVisibilityClass(data);\n const resolvedId = config?.id\n ? typeof config.id === 'function'\n ? config.id(data)\n : config.id\n : undefined;\n const liveBlockId = liveBlockIdOf(data);\n const height = config?.height || '400px';\n // A theme's config replaces the engine's, but keeps its mount timing unless the theme sets one.\n const renderOnMount = config?.renderOnMount ?? COMPONENT_CONFIG[data.path]?.renderOnMount;\n\n const content = (\n <ComponentErrorBoundary data={data} position={index + 1}>\n <Component data={{ ...data, position: index + 1, priority: isFirstComponent }} />\n </ComponentErrorBoundary>\n );\n\n return (\n <>\n {hideClass && (\n <style href=\"twilight-channel-visibility\" precedence=\"default\">\n {CHANNEL_VISIBILITY_CSS}\n </style>\n )}\n <RenderWhenVisible\n rootMargin=\"50px\"\n className={hideClass ? `${resolvedClassName} ${hideClass}` : resolvedClassName}\n id={resolvedId}\n estimatedHeight={height}\n renderOnMount={isFirstComponent || renderOnMount === true}\n placeholder={config?.placeholder ?? <ProductsSliderSkeleton />}\n // Dev only: lets the theme editor scroll the preview to a block.\n blockIndex={import.meta.env.DEV ? index : undefined}\n liveBlockId={liveBlockId}\n >\n {content}\n </RenderWhenVisible>\n </>\n );\n});\n","import { memo } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { home, type BlockScope } from '../../api/home';\nimport { HomeComponentRenderer } from './HomePageRenderer';\n\nexport interface PageBlocksProps {\n /** The page hook the merchant placed the blocks at, e.g. `product.single.before_customer_reviews`. */\n hook: string;\n /** The product, category or page being shown. */\n scope: BlockScope;\n}\n\n/** Draws the blocks placed at a product, category or page hook, loaded in the browser. */\nexport const PageBlocks = memo(function PageBlocks({ hook, scope }: PageBlocksProps) {\n const { data: blocks = [] } = useQuery(home.queries.blocks(hook, scope));\n\n return (\n <>\n {blocks.map((data, index) => (\n <HomeComponentRenderer key={index} data={data} index={index} priority={false} />\n ))}\n </>\n );\n});\n","import { useEffect } from 'react';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { whenSallaLoaded } from '../../utils/sdk-helpers';\n\ninterface ReorderLabels {\n /** The add button's text in a reorder list. */\n add: string;\n /** Its text for an out-of-stock product. */\n outOfStock: string;\n}\n\nlet registered = false;\n\n/**\n * Twig's ReorderProductsWidget script: inside a reorder list the add button reads the block's\n * title and adds the product as the customer last ordered it. The SDK has no way to remove a\n * hook, so it is registered once per page load.\n */\nfunction registerReorderHooks(labels: ReorderLabels): void {\n if (registered) return;\n registered = true;\n whenSallaLoaded((sdk) => {\n sdk.hooks?.registerHook?.('salla-add-product-button', 'componentDidLoad', (component) => {\n if (!component.host?.closest('[source=\"reorder\"], [data-source=\"reorder\"]')) return;\n const isOutOfStock =\n component.productStatus === 'out' || component.productStatus === 'out-and-notify';\n const setLabel = () => component.btn?.setText(isOutOfStock ? labels.outOfStock : labels.add);\n setLabel();\n sdk.lang?.onLoaded?.(setLabel);\n if (isOutOfStock) return;\n component.addProductToCart = async (event: Event) => {\n event.preventDefault();\n // The click lands on the inner button, which has no product-id; without one the SDK uses the page's.\n const productId = component.productId ?? component.host.getAttribute('product-id');\n await sdk.order.api.reorderProduct?.(productId ?? undefined);\n };\n });\n });\n}\n\n/**\n * Inside an element with `data-source=\"reorder\"`, make each add button read \"order again\" and\n * add the product as the customer last ordered it, as Twig's reorder block and page do.\n */\nexport function useReorderButtons(enabled: boolean): void {\n const { t } = useTranslation();\n const add = t('pages.orders.repurchase');\n const outOfStock = t('pages.products.out_of_stock');\n useEffect(() => {\n if (enabled) registerReorderHooks({ add, outOfStock });\n }, [enabled, add, outOfStock]);\n}\n","import { memo, useMemo } from 'react';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { getTwilightContext } from '../../twilight/context';\nimport type { HomeComponentData } from '../../types';\nimport { HomeComponentRenderer } from './HomePageRenderer';\nimport { useReorderButtons } from './reorder-hooks';\n\n/**\n * Twig's \"order again\" block (the Store app's ReorderProductsWidget): on the home page, for a\n * signed-in customer of a store with Reorder on, the products they ordered before, drawn by the\n * theme's own `products-slider` like the home's other product rows.\n */\nexport const ReorderProducts = memo(function ReorderProducts() {\n const { t } = useTranslation();\n const { authToken, settings } = getTwilightContext();\n // The platform lists `reorder` in the store's features exactly when the Reorder setting is on.\n const enabled = !!authToken && !!settings?.store?.features?.includes('reorder');\n const title = t('pages.orders.repurchase');\n useReorderButtons(enabled);\n\n const data = useMemo<HomeComponentData>(\n () => ({\n path: 'products-slider',\n title,\n display_all_url: '/products?source=reorder',\n products: { source: 'reorder' },\n }),\n [title]\n );\n\n if (!enabled) return null;\n\n return (\n <div id=\"reorder-section\" data-source=\"reorder\">\n <HomeComponentRenderer data={data} index={-1} priority={false} />\n </div>\n );\n});\n"]}
|