@salla.sa/twilight-theme-engine 1.0.58 → 1.0.60
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-MTD46H63.js → AddToCartForm-GFAJUB4Y.js} +3 -3
- package/dist/{AddToCartForm-MTD46H63.js.map → AddToCartForm-GFAJUB4Y.js.map} +1 -1
- package/dist/{BlogAuthorPage-BT5BGQQJ.js → BlogAuthorPage-WWA75UTA.js} +15 -15
- package/dist/{BlogAuthorPage-BT5BGQQJ.js.map → BlogAuthorPage-WWA75UTA.js.map} +1 -1
- package/dist/{BlogCategoryPage-IDHUIFVG.js → BlogCategoryPage-VGIAMWPH.js} +15 -15
- package/dist/{BlogCategoryPage-IDHUIFVG.js.map → BlogCategoryPage-VGIAMWPH.js.map} +1 -1
- package/dist/{BlogPage-VSZPR4AD.js → BlogPage-5MW4WSOH.js} +13 -13
- package/dist/{BlogPage-VSZPR4AD.js.map → BlogPage-5MW4WSOH.js.map} +1 -1
- package/dist/{BlogSinglePage-3FWJ6UTQ.js → BlogSinglePage-67E3PVMP.js} +13 -13
- package/dist/{BlogSinglePage-3FWJ6UTQ.js.map → BlogSinglePage-67E3PVMP.js.map} +1 -1
- package/dist/{BlogTagPage-TIPPV2WW.js → BlogTagPage-EEOIAALL.js} +15 -15
- package/dist/{BlogTagPage-TIPPV2WW.js.map → BlogTagPage-EEOIAALL.js.map} +1 -1
- package/dist/{BrandsPage-LEXRPFVK.js → BrandsPage-SNVIBZGR.js} +13 -13
- package/dist/{BrandsPage-LEXRPFVK.js.map → BrandsPage-SNVIBZGR.js.map} +1 -1
- package/dist/{Breadcrumb-Q3P72LPT.js → Breadcrumb-4I2HVAFR.js} +13 -13
- package/dist/{Breadcrumb-Q3P72LPT.js.map → Breadcrumb-4I2HVAFR.js.map} +1 -1
- package/dist/{CartItem-LJYCK3UP.js → CartItem-A7Y6MZXS.js} +13 -13
- package/dist/{CartItem-LJYCK3UP.js.map → CartItem-A7Y6MZXS.js.map} +1 -1
- package/dist/{CartSummary-645YDH2N.js → CartSummary-MUCVTNKG.js} +13 -13
- package/dist/{CartSummary-645YDH2N.js.map → CartSummary-MUCVTNKG.js.map} +1 -1
- package/dist/{Copyright-N5323WE7.js → Copyright-VJYMP42V.js} +3 -3
- package/dist/{Copyright-N5323WE7.js.map → Copyright-VJYMP42V.js.map} +1 -1
- package/dist/{CustomerLayout-LB2EWG2P.js → CustomerLayout-L3Y2TIPF.js} +13 -13
- package/dist/{CustomerLayout-LB2EWG2P.js.map → CustomerLayout-L3Y2TIPF.js.map} +1 -1
- package/dist/{Footer-TTYS7K4V.js → Footer-OQFU25J4.js} +13 -13
- package/dist/{Footer-TTYS7K4V.js.map → Footer-OQFU25J4.js.map} +1 -1
- package/dist/{Header-26PWNGDF.js → Header-QNNAHZJL.js} +6 -6
- package/dist/{Header-26PWNGDF.js.map → Header-QNNAHZJL.js.map} +1 -1
- package/dist/{LoyaltyPage-F4QVHJAH.js → LoyaltyPage-IULR2XKZ.js} +14 -14
- package/dist/{LoyaltyPage-F4QVHJAH.js.map → LoyaltyPage-IULR2XKZ.js.map} +1 -1
- package/dist/{MainMenu-SACYMDKQ.js → MainMenu-3KKSHFCS.js} +7 -7
- package/dist/{MainMenu-SACYMDKQ.js.map → MainMenu-3KKSHFCS.js.map} +1 -1
- package/dist/{MasterLayout-MVY5N7G6.js → MasterLayout-HJWMQHWO.js} +13 -13
- package/dist/{MasterLayout-MVY5N7G6.js.map → MasterLayout-HJWMQHWO.js.map} +1 -1
- package/dist/{MobileMenu-DBIJRXTA.js → MobileMenu-DBJ23EKX.js} +14 -14
- package/dist/{MobileMenu-DBIJRXTA.js.map → MobileMenu-DBJ23EKX.js.map} +1 -1
- package/dist/{NotificationsPage-TMGF4BQM.js → NotificationsPage-PUS3WBU6.js} +13 -13
- package/dist/{NotificationsPage-TMGF4BQM.js.map → NotificationsPage-PUS3WBU6.js.map} +1 -1
- package/dist/{OrderSinglePage-NCQR6ADR.js → OrderSinglePage-4CK6OT6U.js} +14 -14
- package/dist/{OrderSinglePage-NCQR6ADR.js.map → OrderSinglePage-4CK6OT6U.js.map} +1 -1
- package/dist/{OrdersPage-O2LSXL4W.js → OrdersPage-EGIDHSYS.js} +14 -14
- package/dist/{OrdersPage-O2LSXL4W.js.map → OrdersPage-EGIDHSYS.js.map} +1 -1
- package/dist/{PageSingle-745SGJUG.js → PageSingle-ORPH52QX.js} +3 -3
- package/dist/{PageSingle-745SGJUG.js.map → PageSingle-ORPH52QX.js.map} +1 -1
- package/dist/{ProductDetails-AHYFTGM6.js → ProductDetails-RY6PNKKJ.js} +3 -3
- package/dist/{ProductDetails-AHYFTGM6.js.map → ProductDetails-RY6PNKKJ.js.map} +1 -1
- package/dist/{ProfilePage-5JUXB5SB.js → ProfilePage-IO2MDE53.js} +13 -13
- package/dist/{ProfilePage-5JUXB5SB.js.map → ProfilePage-IO2MDE53.js.map} +1 -1
- package/dist/{SeoCartWidget-XPPMBCQB.js → SeoCartWidget-TPSVEGMI.js} +13 -13
- package/dist/{SeoCartWidget-XPPMBCQB.js.map → SeoCartWidget-TPSVEGMI.js.map} +1 -1
- package/dist/{SettingsPage-NFSZ4CKO.js → SettingsPage-ZTD4ALAA.js} +13 -13
- package/dist/{SettingsPage-NFSZ4CKO.js.map → SettingsPage-ZTD4ALAA.js.map} +1 -1
- package/dist/{StoreClosedNotification-5XWRDBPA.js → StoreClosedNotification-52REE2T5.js} +14 -14
- package/dist/{StoreClosedNotification-5XWRDBPA.js.map → StoreClosedNotification-52REE2T5.js.map} +1 -1
- package/dist/{TestimonialsPage-JHGMJMGG.js → TestimonialsPage-QDBHJADT.js} +3 -3
- package/dist/{TestimonialsPage-JHGMJMGG.js.map → TestimonialsPage-QDBHJADT.js.map} +1 -1
- package/dist/{ThankYouPage-CYCVSBAO.js → ThankYouPage-IRLZI3HI.js} +13 -13
- package/dist/{ThankYouPage-CYCVSBAO.js.map → ThankYouPage-IRLZI3HI.js.map} +1 -1
- package/dist/{WalletPage-2JZ32SNZ.js → WalletPage-ZTSSGFMO.js} +14 -14
- package/dist/{WalletPage-2JZ32SNZ.js.map → WalletPage-ZTSSGFMO.js.map} +1 -1
- package/dist/{WishlistPage-N3K6MBMC.js → WishlistPage-OADS7B5J.js} +15 -15
- package/dist/{WishlistPage-N3K6MBMC.js.map → WishlistPage-OADS7B5J.js.map} +1 -1
- package/dist/api/apps.js +4 -4
- package/dist/api/brands.js +5 -5
- package/dist/api/cart.js +5 -5
- package/dist/api/category.js +5 -5
- package/dist/api/client.js +3 -3
- package/dist/api/home.js +4 -4
- package/dist/api/loyalty.js +5 -5
- package/dist/api/menu.js +4 -4
- package/dist/api/messages.d.ts +58 -0
- package/dist/api/messages.d.ts.map +1 -0
- package/dist/api/notification.js +4 -4
- package/dist/api/order.js +5 -5
- package/dist/api/page.js +5 -5
- package/dist/api/product.js +5 -5
- package/dist/api/profile.js +3 -3
- package/dist/api/store.js +4 -4
- package/dist/api/translations-key.d.ts +17 -0
- package/dist/api/translations-key.d.ts.map +1 -1
- package/dist/api/translations.d.ts +49 -0
- package/dist/api/translations.d.ts.map +1 -1
- package/dist/api/translations.js +4 -4
- package/dist/api/user.js +4 -4
- package/dist/api/wishlist.js +6 -6
- package/dist/{chunk-UOALND7V.js → chunk-6DVYW7OA.js} +4 -4
- package/dist/{chunk-UOALND7V.js.map → chunk-6DVYW7OA.js.map} +1 -1
- package/dist/chunk-6EES4C7J.js +14 -0
- package/dist/{chunk-3H27IEME.js.map → chunk-6EES4C7J.js.map} +1 -1
- package/dist/{chunk-7BWZYECG.js → chunk-6LIGRH4O.js} +5 -5
- package/dist/{chunk-7BWZYECG.js.map → chunk-6LIGRH4O.js.map} +1 -1
- package/dist/{chunk-36PDYP56.js → chunk-ANWDPISS.js} +15 -15
- package/dist/{chunk-36PDYP56.js.map → chunk-ANWDPISS.js.map} +1 -1
- package/dist/{chunk-YJ6ZSGQY.js → chunk-AODO3GFK.js} +3 -3
- package/dist/{chunk-YJ6ZSGQY.js.map → chunk-AODO3GFK.js.map} +1 -1
- package/dist/{chunk-675NJ2XP.js → chunk-AVUX6GAG.js} +4 -4
- package/dist/{chunk-675NJ2XP.js.map → chunk-AVUX6GAG.js.map} +1 -1
- package/dist/{chunk-F4MMWEII.js → chunk-BHU25UEW.js} +4 -4
- package/dist/{chunk-F4MMWEII.js.map → chunk-BHU25UEW.js.map} +1 -1
- package/dist/{chunk-JBNI5ZVG.js → chunk-CUX7O42G.js} +3 -3
- package/dist/{chunk-JBNI5ZVG.js.map → chunk-CUX7O42G.js.map} +1 -1
- package/dist/{chunk-WFSOVIYU.js → chunk-GX3EDS32.js} +6 -6
- package/dist/{chunk-WFSOVIYU.js.map → chunk-GX3EDS32.js.map} +1 -1
- package/dist/{chunk-2KU5ANFZ.js → chunk-GXXWHVLS.js} +5 -5
- package/dist/{chunk-2KU5ANFZ.js.map → chunk-GXXWHVLS.js.map} +1 -1
- package/dist/{chunk-TJGYL7GD.js → chunk-GZKCZ6X7.js} +5 -5
- package/dist/{chunk-TJGYL7GD.js.map → chunk-GZKCZ6X7.js.map} +1 -1
- package/dist/{chunk-BZ7ZIO33.js → chunk-HAV32VZS.js} +3 -3
- package/dist/{chunk-BZ7ZIO33.js.map → chunk-HAV32VZS.js.map} +1 -1
- package/dist/{chunk-YJJZN5UP.js → chunk-HF6RCUMD.js} +4 -4
- package/dist/{chunk-YJJZN5UP.js.map → chunk-HF6RCUMD.js.map} +1 -1
- package/dist/{chunk-BFZ47MS5.js → chunk-ICPO2ELD.js} +3 -3
- package/dist/{chunk-BFZ47MS5.js.map → chunk-ICPO2ELD.js.map} +1 -1
- package/dist/{chunk-J2GGMK3X.js → chunk-IFWQTDEY.js} +6 -6
- package/dist/{chunk-J2GGMK3X.js.map → chunk-IFWQTDEY.js.map} +1 -1
- package/dist/{chunk-MQBGRVOJ.js → chunk-J7BQY4ZK.js} +4 -4
- package/dist/{chunk-MQBGRVOJ.js.map → chunk-J7BQY4ZK.js.map} +1 -1
- package/dist/{chunk-RJAV554G.js → chunk-JDDQHFIW.js} +4 -4
- package/dist/{chunk-RJAV554G.js.map → chunk-JDDQHFIW.js.map} +1 -1
- package/dist/{chunk-2OX3JML4.js → chunk-K34A2LBY.js} +4 -4
- package/dist/{chunk-2OX3JML4.js.map → chunk-K34A2LBY.js.map} +1 -1
- package/dist/{chunk-RBVFIPX2.js → chunk-KRCPBXFJ.js} +4 -4
- package/dist/{chunk-RBVFIPX2.js.map → chunk-KRCPBXFJ.js.map} +1 -1
- package/dist/{chunk-YSFWVMBA.js → chunk-KZMUU5ZD.js} +3 -3
- package/dist/{chunk-YSFWVMBA.js.map → chunk-KZMUU5ZD.js.map} +1 -1
- package/dist/{chunk-3R7YKSO6.js → chunk-NK2V2SW5.js} +5 -5
- package/dist/{chunk-3R7YKSO6.js.map → chunk-NK2V2SW5.js.map} +1 -1
- package/dist/{chunk-WIAPOLEA.js → chunk-NKLKKZM6.js} +3 -3
- package/dist/{chunk-WIAPOLEA.js.map → chunk-NKLKKZM6.js.map} +1 -1
- package/dist/{chunk-K4YT7TOV.js → chunk-NOB7OWFA.js} +3 -3
- package/dist/{chunk-K4YT7TOV.js.map → chunk-NOB7OWFA.js.map} +1 -1
- package/dist/{chunk-PSRSWHML.js → chunk-NYD5Z4RJ.js} +4 -4
- package/dist/{chunk-PSRSWHML.js.map → chunk-NYD5Z4RJ.js.map} +1 -1
- package/dist/{chunk-SOPK72TP.js → chunk-OGQXRBCR.js} +44 -5
- package/dist/chunk-OGQXRBCR.js.map +1 -0
- package/dist/{chunk-LKRI35NZ.js → chunk-R2ULWW5T.js} +38 -16
- package/dist/chunk-R2ULWW5T.js.map +1 -0
- package/dist/{chunk-O2YV5DAL.js → chunk-R3TPJHLI.js} +4 -4
- package/dist/{chunk-O2YV5DAL.js.map → chunk-R3TPJHLI.js.map} +1 -1
- package/dist/{chunk-JDROOL5C.js → chunk-RLSYCDI4.js} +3 -3
- package/dist/{chunk-JDROOL5C.js.map → chunk-RLSYCDI4.js.map} +1 -1
- package/dist/{chunk-GLRXYGYI.js → chunk-S7JSNUU2.js} +3 -3
- package/dist/{chunk-GLRXYGYI.js.map → chunk-S7JSNUU2.js.map} +1 -1
- package/dist/{chunk-S7XYSF4X.js → chunk-T26Y47JL.js} +4 -4
- package/dist/{chunk-S7XYSF4X.js.map → chunk-T26Y47JL.js.map} +1 -1
- package/dist/{chunk-VO5ODVVL.js → chunk-T63KKKW2.js} +4 -4
- package/dist/{chunk-VO5ODVVL.js.map → chunk-T63KKKW2.js.map} +1 -1
- package/dist/{chunk-XDB2POG3.js → chunk-UQAUDOI7.js} +7 -7
- package/dist/{chunk-XDB2POG3.js.map → chunk-UQAUDOI7.js.map} +1 -1
- package/dist/{chunk-TX6ZP4FF.js → chunk-VRV5F6G7.js} +3 -3
- package/dist/{chunk-TX6ZP4FF.js.map → chunk-VRV5F6G7.js.map} +1 -1
- package/dist/{chunk-HVHFTVZT.js → chunk-WPHI6Q6N.js} +4 -4
- package/dist/{chunk-HVHFTVZT.js.map → chunk-WPHI6Q6N.js.map} +1 -1
- package/dist/{chunk-YNY5P2DG.js → chunk-X7P2WSNU.js} +3 -3
- package/dist/{chunk-YNY5P2DG.js.map → chunk-X7P2WSNU.js.map} +1 -1
- package/dist/{chunk-KTOKX3GC.js → chunk-YGDAYFQY.js} +3 -3
- package/dist/{chunk-KTOKX3GC.js.map → chunk-YGDAYFQY.js.map} +1 -1
- package/dist/{chunk-HOE2P2HU.js → chunk-YGSU36MZ.js} +3 -3
- package/dist/{chunk-HOE2P2HU.js.map → chunk-YGSU36MZ.js.map} +1 -1
- package/dist/chunk-ZOZLNUNA.js +130 -0
- package/dist/chunk-ZOZLNUNA.js.map +1 -0
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +11 -11
- package/dist/components/home/index.js +14 -14
- package/dist/components/layout/index.js +5 -5
- package/dist/components/product/index.js +12 -12
- package/dist/components/store/index.js +13 -13
- package/dist/document-class-SX2LHILG.js +25 -0
- package/dist/{document-class-YYEVAIVJ.js.map → document-class-SX2LHILG.js.map} +1 -1
- package/dist/hooks/index.js +11 -11
- package/dist/hooks/useGtm.js +11 -11
- package/dist/hooks/useMoney.js +11 -11
- package/dist/hooks/useStore.js +11 -11
- package/dist/hooks/useUser.js +5 -5
- package/dist/index.js +11 -11
- package/dist/{navigation-MVKZENRD.js → navigation-7WGWEDLB.js} +4 -4
- package/dist/{navigation-MVKZENRD.js.map → navigation-7WGWEDLB.js.map} +1 -1
- package/dist/{navigation-4VEQUXHI.js → navigation-Z6JMJ4FZ.js} +5 -5
- package/dist/{navigation-4VEQUXHI.js.map → navigation-Z6JMJ4FZ.js.map} +1 -1
- package/dist/{not-found-JGDH4AQ3.js → not-found-CDXSWL7T.js} +14 -14
- package/dist/{not-found-JGDH4AQ3.js.map → not-found-CDXSWL7T.js.map} +1 -1
- package/dist/providers/index.js +11 -11
- package/dist/routes/account/orders.js +6 -6
- package/dist/routes/account.js +15 -15
- package/dist/routes/blog.js +10 -10
- package/dist/routes/brands.js +6 -6
- package/dist/routes/cart.js +19 -19
- package/dist/routes/home.js +16 -16
- package/dist/routes/index.js +3 -3
- package/dist/routes/loyalty.js +6 -6
- package/dist/routes/page.js +6 -6
- package/dist/routes/product-listing.js +16 -16
- package/dist/routes/product.js +14 -14
- 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 +6 -6
- package/dist/skeleton.js +16 -16
- package/dist/tanstack/router.d.ts.map +1 -1
- package/dist/tanstack.js +15 -15
- package/dist/twilight/context.d.ts.map +1 -1
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/vite/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-3H27IEME.js +0 -14
- package/dist/chunk-IE2FU6BR.js +0 -83
- package/dist/chunk-IE2FU6BR.js.map +0 -1
- package/dist/chunk-LKRI35NZ.js.map +0 -1
- package/dist/chunk-SOPK72TP.js.map +0 -1
- package/dist/document-class-YYEVAIVJ.js +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/twilight/ensure-context.ts","../src/tanstack/head.ts"],"names":[],"mappings":";;;AAiBA,SAAS,aAAa,MAAA,EAAuE;AAC3F,EAAA,MAAM,WAAW,MAAA,EAAQ,QAAA;AACzB,EAAA,OAAO,WAAY,QAAA,GAA4B,MAAA;AACjD;AAEA,SAAS,UAAA,CAAW,QAA6C,GAAA,EAAiC;AAChG,EAAA,MAAM,KAAA,GAAQ,SAAS,GAAG,CAAA;AAC1B,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,GAAQ,KAAA,GAAQ,MAAA;AACtD;AAEA,SAAS,aAAa,MAAA,EAAuE;AAC3F,EAAA,MAAM,WAAW,MAAA,EAAQ,YAAA;AACzB,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,GAAK,QAAA,GAA4B,MAAA;AAChE;AAEA,SAAS,gBAAgB,MAAA,EAAsE;AAC7F,EAAA,MAAM,WAAW,MAAA,EAAQ,YAAA;AACzB,EAAA,OAAO,YAAY,OAAO,QAAA,KAAa,QAAA,IAAY,MAAA,IAAU,WAAW,QAAA,GAAW,MAAA;AACrF;AAmBO,SAAS,iCACd,OAAA,EACS;AACT,EAAA,IAAI,mBAAA,IAAuB,OAAO,IAAA;AAElC,EAAA,MAAM,SAAA,GAAY,UAAU,CAAC,CAAA;AAC7B,EAAA,IAAI,CAAC,WAAW,OAAO,KAAA;AAEvB,EAAA,MAAM,gBAAgB,SAAA,CAAU,mBAAA;AAChC,EAAA,MAAM,WAAW,SAAA,CAAU,OAAA;AAE3B,EAAA,MAAM,QAAA,GAAW,YAAA,CAAa,aAAa,CAAA,IAAK,aAAa,QAAQ,CAAA;AACrE,EAAA,MAAM,SAAS,UAAA,CAAW,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KAAA,EAAO,MAAA,EAAQ,OAAA,EAAQ;AACxC;AA6BO,SAAS,QAAA,CACd,OACA,MAAA,EAC4D;AAC5D,EAAA,OAAO,CAAC,GAAA,KAAqB;AAC3B,IAAA,MAAM,aAAa,GAAA,CAAI,UAAA;AAEvB,IAAA,IAAI,CAAC,UAAA,EAAY,OAAO,EAAC;AAKzB,IAAA,gCAAA,CAAiC,IAAI,OAAO,CAAA;AAE5C,IAAA,IAAI;AACF,MAAA,MAAM,UAAU,kBAAA,EAAmB;AACnC,MAAA,MAAM,MAAA,GAAS,KAAA,CAAM,IAAA,CAAK,OAAA,EAAS,UAAe,CAAA;AAClD,MAAA,MAAM,cAAc,MAAA,GAAS,MAAA,CAAO,MAAA,EAAQ,OAAA,EAAS,UAAe,CAAA,GAAI,MAAA;AAExE,MAAA,OAAO,oBAAoB,WAAW,CAAA;AAAA,IACxC,SAAS,KAAA,EAAO;AAKd,MAAA,IAAI,KAAA,YAAiB,aAAA,EAAe,OAAO,EAAC;AAC5C,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF,CAAA;AACF","file":"chunk-WIAPOLEA.js","sourcesContent":["import type { StoreContext } from '../api/store';\nimport type { AppSnippet, AppSettings } from '../api/apps';\nimport { hasTwilightSettings, updateTwilightContext } from './context';\n\n/**\n * The slice of a router match we can recover store settings from.\n *\n * TanStack resolves `match.context` (which spreads `__beforeLoadContext` over the\n * parent context) immediately before it invokes `route.options.head()`, so both\n * fields are populated by the time any head function runs — including during\n * client hydration, when the twilight module store may still be empty.\n */\nexport interface TwilightContextMatch {\n context?: Record<string, unknown>;\n __beforeLoadContext?: Record<string, unknown>;\n}\n\nfunction readSettings(source: Record<string, unknown> | undefined): StoreContext | undefined {\n const settings = source?.settings;\n return settings ? (settings as StoreContext) : undefined;\n}\n\nfunction readString(source: Record<string, unknown> | undefined, key: string): string | undefined {\n const value = source?.[key];\n return typeof value === 'string' && value ? value : undefined;\n}\n\nfunction readSnippets(source: Record<string, unknown> | undefined): AppSnippet[] | undefined {\n const snippets = source?.appsSnippets;\n return Array.isArray(snippets) ? (snippets as AppSnippet[]) : undefined;\n}\n\nfunction readAppSettings(source: Record<string, unknown> | undefined): AppSettings | undefined {\n const settings = source?.appsSettings as AppSettings | undefined;\n return settings && typeof settings === 'object' && 'apps' in settings ? settings : undefined;\n}\n\n/**\n * Seeds the twilight module store from the router matches when it is empty.\n *\n * Head functions read store settings through `getTwilightContext()`, whose\n * `settings` getter **throws** a `SettingsError` when the store has not been\n * populated. TanStack re-runs every matched route's head function during client\n * hydration, and a throw there aborts hydration outright: React then discards\n * the server-rendered tree and re-renders from scratch, which blanks the page.\n *\n * `hydrateTwilightContext` normally populates the store first, but it is a\n * single best-effort pass — if it bails (missing root match, missing settings,\n * or a duplicated module instance holding a different store) every head\n * function downstream throws. Seeding from the match TanStack already resolved\n * removes that dependency at the point of use.\n *\n * @returns whether the store has settings after the attempt.\n */\nexport function ensureTwilightContextFromMatches(\n matches: readonly TwilightContextMatch[] | undefined\n): boolean {\n if (hasTwilightSettings()) return true;\n\n const rootMatch = matches?.[0];\n if (!rootMatch) return false;\n\n const beforeLoadCtx = rootMatch.__beforeLoadContext;\n const matchCtx = rootMatch.context;\n\n const settings = readSettings(beforeLoadCtx) ?? readSettings(matchCtx);\n const locale = readString(beforeLoadCtx, 'locale') ?? readString(matchCtx, 'locale');\n if (!settings || !locale) return false;\n\n const authToken =\n readString(beforeLoadCtx, 'authToken') ?? readString(matchCtx, 'authToken') ?? null;\n const appsSnippets = readSnippets(beforeLoadCtx) ?? readSnippets(matchCtx);\n const appsSettings = readAppSettings(beforeLoadCtx) ?? readAppSettings(matchCtx);\n\n updateTwilightContext({ settings, locale, authToken, appsSnippets, appsSettings });\n return true;\n}\n","import type { HeadDescriptor, OpenGraphImage } from '../utils/head';\nimport type { TwilightContext } from '../twilight/context';\nimport { getTwilightContext } from '../twilight/context';\nimport type { TwilightContextMatch } from '../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../twilight/ensure-context';\nimport { SettingsError } from '../utils/errors';\n\ntype OgImagesInput = string | OpenGraphImage | Array<string | OpenGraphImage> | undefined;\n\nfunction normalizeOgImages(images: OgImagesInput): OpenGraphImage[] {\n if (!images) return [];\n const arr = Array.isArray(images) ? images : [images];\n return arr.map((img) => (typeof img === 'string' ? { url: img } : img));\n}\n\nexport function tanstackHeadAdapter(descriptor: HeadDescriptor) {\n const meta: Array<Record<string, unknown>> = [];\n const links: Array<Record<string, unknown>> = [];\n const scripts: Array<Record<string, unknown>> = [];\n const styles: Record<string, unknown>[] = [];\n\n if (descriptor.title) meta.push({ title: descriptor.title });\n if (descriptor.description) meta.push({ name: 'description', content: descriptor.description });\n\n if (descriptor.keywords) {\n const kw = Array.isArray(descriptor.keywords)\n ? descriptor.keywords.join(', ')\n : descriptor.keywords;\n meta.push({ name: 'keywords', content: kw });\n }\n\n if (descriptor.robots) meta.push({ name: 'robots', content: descriptor.robots });\n\n // Open Graph\n const og = descriptor.openGraph;\n if (og) {\n if (og.siteName) meta.push({ property: 'og:site_name', content: og.siteName });\n if (og.type) meta.push({ property: 'og:type', content: og.type });\n if (og.title) meta.push({ property: 'og:title', content: og.title });\n if (og.description) meta.push({ property: 'og:description', content: og.description });\n if (og.url) meta.push({ property: 'og:url', content: og.url });\n if (og.locale) meta.push({ property: 'og:locale', content: og.locale });\n for (const alt of og.alternateLocale ?? []) {\n meta.push({ property: 'og:locale:alternate', content: alt });\n }\n for (const img of normalizeOgImages(og.images)) {\n meta.push({ property: 'og:image', content: img.url });\n if (img.width != null) meta.push({ property: 'og:image:width', content: String(img.width) });\n if (img.height != null)\n meta.push({ property: 'og:image:height', content: String(img.height) });\n if (img.alt) meta.push({ property: 'og:image:alt', content: img.alt });\n }\n if (og.publishedTime)\n meta.push({ property: 'article:published_time', content: og.publishedTime });\n if (og.modifiedTime) meta.push({ property: 'article:modified_time', content: og.modifiedTime });\n }\n\n // Twitter Card\n const tw = descriptor.twitter;\n if (tw) {\n if (tw.card) meta.push({ name: 'twitter:card', content: tw.card });\n if (tw.title) meta.push({ name: 'twitter:title', content: tw.title });\n if (tw.description) meta.push({ name: 'twitter:description', content: tw.description });\n if (tw.site) meta.push({ name: 'twitter:site', content: tw.site });\n if (tw.creator) meta.push({ name: 'twitter:creator', content: tw.creator });\n if (tw.url) meta.push({ name: 'twitter:url', content: tw.url });\n const twImages = tw.images ? (Array.isArray(tw.images) ? tw.images : [tw.images]) : [];\n for (const img of twImages) {\n meta.push({ name: 'twitter:image', content: img });\n }\n }\n\n // Canonical\n if (descriptor.canonical) links.push({ rel: 'canonical', href: descriptor.canonical });\n\n // hreflang alternates (React requires camelCase: hrefLang)\n for (const alt of descriptor.alternateLanguages ?? []) {\n links.push({ rel: 'alternate', hrefLang: alt.hreflang, href: alt.href });\n }\n\n // JSON-LD\n if (descriptor.jsonLd) {\n scripts.push({ type: 'application/ld+json', children: JSON.stringify(descriptor.jsonLd) });\n }\n\n // Escape hatches\n for (const m of descriptor.meta ?? []) {\n const { httpEquiv, ...rest } = m as typeof m & { httpEquiv?: string };\n meta.push(httpEquiv ? { httpEquiv, ...rest } : rest);\n }\n for (const l of descriptor.links ?? []) links.push(l);\n for (const s of descriptor.styles ?? []) styles.push(s as unknown as Record<string, unknown>);\n\n // Import maps must be emitted before module scripts that rely on bare specifiers.\n for (const im of descriptor.importMap ?? []) {\n scripts.push({ type: 'importmap', children: JSON.stringify(im) });\n }\n for (const s of descriptor.scripts ?? []) scripts.push(s);\n\n return { meta, links, styles, scripts };\n}\n\n// ============================================================================\n// withHead - Simplified head callback wrapper for TanStack Router\n// ============================================================================\n\n/**\n * Minimal shape we need from TanStack Router's AssetFnContextOptions.\n * `loaderData` feeds the route's own head function; `matches` is the recovery\n * source for store settings when the twilight module store is not populated yet\n * (see `ensureTwilightContextFromMatches`).\n */\ntype HeadContext = {\n loaderData?: unknown;\n matches?: readonly TwilightContextMatch[];\n};\n\n/**\n * Wraps a route module's head function for TanStack Router.\n *\n * @example\n * ```typescript\n * head: withHead(Offers)\n * head: withHead(Product, (result, ctx) => ({\n * ...result,\n * title: `${result.title} | ${ctx.settings?.store?.name}`,\n * }))\n * ```\n */\nexport function withHead<T>(\n route: { head: (ctx: TwilightContext, data: T) => HeadDescriptor },\n extend?: (result: HeadDescriptor, _ctx: TwilightContext, data: T) => HeadDescriptor\n): (_ctx: Record<string, unknown>) => Record<string, unknown> {\n return (ctx: HeadContext) => {\n const loaderData = ctx.loaderData;\n\n if (!loaderData) return {};\n\n // TanStack re-runs every matched route's head() during client hydration,\n // where the twilight module store can still be empty. Recover it from the\n // match context TanStack has already resolved before giving up.\n ensureTwilightContextFromMatches(ctx.matches);\n\n try {\n const context = getTwilightContext();\n const result = route.head(context, loaderData as T);\n const finalResult = extend ? extend(result, context, loaderData as T) : result;\n\n return tanstackHeadAdapter(finalResult);\n } catch (error) {\n // A head function must never throw: TanStack surfaces the throw as a\n // hydration error, React then discards the server-rendered tree and the\n // storefront renders blank. Dropping this route's head tags degrades\n // gracefully — the server-rendered ones stay in the document.\n if (error instanceof SettingsError) return {};\n throw error;\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/twilight/ensure-context.ts","../src/tanstack/head.ts"],"names":[],"mappings":";;;AAiBA,SAAS,aAAa,MAAA,EAAuE;AAC3F,EAAA,MAAM,WAAW,MAAA,EAAQ,QAAA;AACzB,EAAA,OAAO,WAAY,QAAA,GAA4B,MAAA;AACjD;AAEA,SAAS,UAAA,CAAW,QAA6C,GAAA,EAAiC;AAChG,EAAA,MAAM,KAAA,GAAQ,SAAS,GAAG,CAAA;AAC1B,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,GAAQ,KAAA,GAAQ,MAAA;AACtD;AAEA,SAAS,aAAa,MAAA,EAAuE;AAC3F,EAAA,MAAM,WAAW,MAAA,EAAQ,YAAA;AACzB,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,GAAK,QAAA,GAA4B,MAAA;AAChE;AA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KKZM6.js","sourcesContent":["import type { StoreContext } from '../api/store';\nimport type { AppSnippet, AppSettings } from '../api/apps';\nimport { hasTwilightSettings, updateTwilightContext } from './context';\n\n/**\n * The slice of a router match we can recover store settings from.\n *\n * TanStack resolves `match.context` (which spreads `__beforeLoadContext` over the\n * parent context) immediately before it invokes `route.options.head()`, so both\n * fields are populated by the time any head function runs — including during\n * client hydration, when the twilight module store may still be empty.\n */\nexport interface TwilightContextMatch {\n context?: Record<string, unknown>;\n __beforeLoadContext?: Record<string, unknown>;\n}\n\nfunction readSettings(source: Record<string, unknown> | undefined): StoreContext | undefined {\n const settings = source?.settings;\n return settings ? (settings as StoreContext) : undefined;\n}\n\nfunction readString(source: Record<string, unknown> | undefined, key: string): string | undefined {\n const value = source?.[key];\n return typeof value === 'string' && value ? value : undefined;\n}\n\nfunction readSnippets(source: Record<string, unknown> | undefined): AppSnippet[] | undefined {\n const snippets = source?.appsSnippets;\n return Array.isArray(snippets) ? (snippets as AppSnippet[]) : undefined;\n}\n\nfunction readAppSettings(source: Record<string, unknown> | undefined): AppSettings | undefined {\n const settings = source?.appsSettings as AppSettings | undefined;\n return settings && typeof settings === 'object' && 'apps' in settings ? settings : undefined;\n}\n\n/**\n * Seeds the twilight module store from the router matches when it is empty.\n *\n * Head functions read store settings through `getTwilightContext()`, whose\n * `settings` getter **throws** a `SettingsError` when the store has not been\n * populated. TanStack re-runs every matched route's head function during client\n * hydration, and a throw there aborts hydration outright: React then discards\n * the server-rendered tree and re-renders from scratch, which blanks the page.\n *\n * `hydrateTwilightContext` normally populates the store first, but it is a\n * single best-effort pass — if it bails (missing root match, missing settings,\n * or a duplicated module instance holding a different store) every head\n * function downstream throws. Seeding from the match TanStack already resolved\n * removes that dependency at the point of use.\n *\n * @returns whether the store has settings after the attempt.\n */\nexport function ensureTwilightContextFromMatches(\n matches: readonly TwilightContextMatch[] | undefined\n): boolean {\n if (hasTwilightSettings()) return true;\n\n const rootMatch = matches?.[0];\n if (!rootMatch) return false;\n\n const beforeLoadCtx = rootMatch.__beforeLoadContext;\n const matchCtx = rootMatch.context;\n\n const settings = readSettings(beforeLoadCtx) ?? readSettings(matchCtx);\n const locale = readString(beforeLoadCtx, 'locale') ?? readString(matchCtx, 'locale');\n if (!settings || !locale) return false;\n\n const authToken =\n readString(beforeLoadCtx, 'authToken') ?? readString(matchCtx, 'authToken') ?? null;\n const appsSnippets = readSnippets(beforeLoadCtx) ?? readSnippets(matchCtx);\n const appsSettings = readAppSettings(beforeLoadCtx) ?? readAppSettings(matchCtx);\n\n updateTwilightContext({ settings, locale, authToken, appsSnippets, appsSettings });\n return true;\n}\n","import type { HeadDescriptor, OpenGraphImage } from '../utils/head';\nimport type { TwilightContext } from '../twilight/context';\nimport { getTwilightContext } from '../twilight/context';\nimport type { TwilightContextMatch } from '../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../twilight/ensure-context';\nimport { SettingsError } from '../utils/errors';\n\ntype OgImagesInput = string | OpenGraphImage | Array<string | OpenGraphImage> | undefined;\n\nfunction normalizeOgImages(images: OgImagesInput): OpenGraphImage[] {\n if (!images) return [];\n const arr = Array.isArray(images) ? images : [images];\n return arr.map((img) => (typeof img === 'string' ? { url: img } : img));\n}\n\nexport function tanstackHeadAdapter(descriptor: HeadDescriptor) {\n const meta: Array<Record<string, unknown>> = [];\n const links: Array<Record<string, unknown>> = [];\n const scripts: Array<Record<string, unknown>> = [];\n const styles: Record<string, unknown>[] = [];\n\n if (descriptor.title) meta.push({ title: descriptor.title });\n if (descriptor.description) meta.push({ name: 'description', content: descriptor.description });\n\n if (descriptor.keywords) {\n const kw = Array.isArray(descriptor.keywords)\n ? descriptor.keywords.join(', ')\n : descriptor.keywords;\n meta.push({ name: 'keywords', content: kw });\n }\n\n if (descriptor.robots) meta.push({ name: 'robots', content: descriptor.robots });\n\n // Open Graph\n const og = descriptor.openGraph;\n if (og) {\n if (og.siteName) meta.push({ property: 'og:site_name', content: og.siteName });\n if (og.type) meta.push({ property: 'og:type', content: og.type });\n if (og.title) meta.push({ property: 'og:title', content: og.title });\n if (og.description) meta.push({ property: 'og:description', content: og.description });\n if (og.url) meta.push({ property: 'og:url', content: og.url });\n if (og.locale) meta.push({ property: 'og:locale', content: og.locale });\n for (const alt of og.alternateLocale ?? []) {\n meta.push({ property: 'og:locale:alternate', content: alt });\n }\n for (const img of normalizeOgImages(og.images)) {\n meta.push({ property: 'og:image', content: img.url });\n if (img.width != null) meta.push({ property: 'og:image:width', content: String(img.width) });\n if (img.height != null)\n meta.push({ property: 'og:image:height', content: String(img.height) });\n if (img.alt) meta.push({ property: 'og:image:alt', content: img.alt });\n }\n if (og.publishedTime)\n meta.push({ property: 'article:published_time', content: og.publishedTime });\n if (og.modifiedTime) meta.push({ property: 'article:modified_time', content: og.modifiedTime });\n }\n\n // Twitter Card\n const tw = descriptor.twitter;\n if (tw) {\n if (tw.card) meta.push({ name: 'twitter:card', content: tw.card });\n if (tw.title) meta.push({ name: 'twitter:title', content: tw.title });\n if (tw.description) meta.push({ name: 'twitter:description', content: tw.description });\n if (tw.site) meta.push({ name: 'twitter:site', content: tw.site });\n if (tw.creator) meta.push({ name: 'twitter:creator', content: tw.creator });\n if (tw.url) meta.push({ name: 'twitter:url', content: tw.url });\n const twImages = tw.images ? (Array.isArray(tw.images) ? tw.images : [tw.images]) : [];\n for (const img of twImages) {\n meta.push({ name: 'twitter:image', content: img });\n }\n }\n\n // Canonical\n if (descriptor.canonical) links.push({ rel: 'canonical', href: descriptor.canonical });\n\n // hreflang alternates (React requires camelCase: hrefLang)\n for (const alt of descriptor.alternateLanguages ?? []) {\n links.push({ rel: 'alternate', hrefLang: alt.hreflang, href: alt.href });\n }\n\n // JSON-LD\n if (descriptor.jsonLd) {\n scripts.push({ type: 'application/ld+json', children: JSON.stringify(descriptor.jsonLd) });\n }\n\n // Escape hatches\n for (const m of descriptor.meta ?? []) {\n const { httpEquiv, ...rest } = m as typeof m & { httpEquiv?: string };\n meta.push(httpEquiv ? { httpEquiv, ...rest } : rest);\n }\n for (const l of descriptor.links ?? []) links.push(l);\n for (const s of descriptor.styles ?? []) styles.push(s as unknown as Record<string, unknown>);\n\n // Import maps must be emitted before module scripts that rely on bare specifiers.\n for (const im of descriptor.importMap ?? []) {\n scripts.push({ type: 'importmap', children: JSON.stringify(im) });\n }\n for (const s of descriptor.scripts ?? []) scripts.push(s);\n\n return { meta, links, styles, scripts };\n}\n\n// ============================================================================\n// withHead - Simplified head callback wrapper for TanStack Router\n// ============================================================================\n\n/**\n * Minimal shape we need from TanStack Router's AssetFnContextOptions.\n * `loaderData` feeds the route's own head function; `matches` is the recovery\n * source for store settings when the twilight module store is not populated yet\n * (see `ensureTwilightContextFromMatches`).\n */\ntype HeadContext = {\n loaderData?: unknown;\n matches?: readonly TwilightContextMatch[];\n};\n\n/**\n * Wraps a route module's head function for TanStack Router.\n *\n * @example\n * ```typescript\n * head: withHead(Offers)\n * head: withHead(Product, (result, ctx) => ({\n * ...result,\n * title: `${result.title} | ${ctx.settings?.store?.name}`,\n * }))\n * ```\n */\nexport function withHead<T>(\n route: { head: (ctx: TwilightContext, data: T) => HeadDescriptor },\n extend?: (result: HeadDescriptor, _ctx: TwilightContext, data: T) => HeadDescriptor\n): (_ctx: Record<string, unknown>) => Record<string, unknown> {\n return (ctx: HeadContext) => {\n const loaderData = ctx.loaderData;\n\n if (!loaderData) return {};\n\n // TanStack re-runs every matched route's head() during client hydration,\n // where the twilight module store can still be empty. Recover it from the\n // match context TanStack has already resolved before giving up.\n ensureTwilightContextFromMatches(ctx.matches);\n\n try {\n const context = getTwilightContext();\n const result = route.head(context, loaderData as T);\n const finalResult = extend ? extend(result, context, loaderData as T) : result;\n\n return tanstackHeadAdapter(finalResult);\n } catch (error) {\n // A head function must never throw: TanStack surfaces the throw as a\n // hydration error, React then discards the server-rendered tree and the\n // storefront renders blank. Dropping this route's head tags degrades\n // gracefully — the server-rendered ones stay in the document.\n if (error instanceof SettingsError) return {};\n throw error;\n }\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api } from './chunk-
|
|
1
|
+
import { api } from './chunk-BHU25UEW.js';
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
var home = {
|
|
@@ -15,5 +15,5 @@ var home = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export { home };
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
19
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-NOB7OWFA.js.map
|
|
19
|
+
//# sourceMappingURL=chunk-NOB7OWFA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/home.ts"],"names":[],"mappings":";;;AAIO,IAAM,IAAA,GAAO;AAAA,EAClB,YAAY,YAA0C;AACpD,IAAA,MAAM,EAAE,MAAK,GAAI,MAAM,IAAI,GAAA,CAAI,gBAAgB,EAAE,IAAA,EAAoC;AACrF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,UAAA,EAAY,MACV,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAY,CAAA;AAAA,MAC/B,OAAA,EAAS,MAAM,IAAA,CAAK,UAAA;AAAW,KAChC;AAAA;AAEP","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/api/home.ts"],"names":[],"mappings":";;;AAIO,IAAM,IAAA,GAAO;AAAA,EAClB,YAAY,YAA0C;AACpD,IAAA,MAAM,EAAE,MAAK,GAAI,MAAM,IAAI,GAAA,CAAI,gBAAgB,EAAE,IAAA,EAAoC;AACrF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,UAAA,EAAY,MACV,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAY,CAAA;AAAA,MAC/B,OAAA,EAAS,MAAM,IAAA,CAAK,UAAA;AAAW,KAChC;AAAA;AAEP","file":"chunk-NOB7OWFA.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { HomeComponentData } from '../types';\n\nexport const home = {\n components: async (): Promise<HomeComponentData[]> => {\n const { data } = await api.get('component/list').json<{ data: HomeComponentData[] }>();\n return data ?? [];\n },\n\n queries: {\n components: () =>\n queryOptions({\n queryKey: ['home', 'components'],\n queryFn: () => home.components(),\n }),\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useOpeningHours } from './chunk-
|
|
2
|
-
import { useIsProduct } from './chunk-
|
|
1
|
+
import { useOpeningHours } from './chunk-ANWDPISS.js';
|
|
2
|
+
import { useIsProduct } from './chunk-RLSYCDI4.js';
|
|
3
3
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
4
4
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
5
5
|
import { useState } from 'react';
|
|
@@ -54,5 +54,5 @@ function StoreClosedNotification(_props) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export { StoreClosedNotification };
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-NYD5Z4RJ.js.map
|
|
58
|
+
//# sourceMappingURL=chunk-NYD5Z4RJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/store/StoreClosedNotification.tsx"],"names":[],"mappings":";;;;;;;AAsBO,SAAS,wBAAwB,MAAA,EAAsC;AAC5E,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,QAAQ,SAAA,EAAW,iBAAA,KAAsB,eAAA,CAAgB,KAAA,CAAM,UAAU,aAAa,CAAA;AAC9F,EAAA,MAAM,CAAC,SA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AAA,QACZ,cAAA,EAAgB,QAAA;AAAA,QAChB,QAAA,EAAU;AAAA,OACZ;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,IAAA,EAAK,GAAA;AAAA,YACL,EAAA,EAAG,cAAA;AAAA,YACH,OAAA,EAAS,WAAA;AAAA,YACT,KAAA,EAAO,EAAE,QAAA,EAAU,UAAA,EAAY,MAAM,EAAA,EAAI,KAAA,EAAO,MAAA,EAAQ,cAAA,EAAgB,MAAA,EAAO;AAAA,YAE/E,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,cAAA,EAAe;AAAA;AAAA,SAC9B;AAAA,wBACA,GAAA,CAAC,GAAA,EAAA,EAAE,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAA,EAAG,SAAA,EAAW,QAAA,EAAU,IAAA,EAAM,CAAA,EAAE,EACjD,QAAA,EAAA,CAAA,CAAE,2BAAA,EAA6B;AAAA,UAC9B,YAAA,EAAc,qPAAkD,iBAAiB,CAAA,CAAA,CAAA;AAAA,UACjF,QAAA,EAAU;AAAA,SACX,CAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-NYD5Z4RJ.js","sourcesContent":["import { useState } from 'react';\nimport { useIsProduct } from '../../providers/NavigationProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useOpeningHours } from '../../hooks/useOpeningHours';\nimport { useTranslation } from '../../providers/I18nProvider';\n\nexport interface StoreClosedNotificationProps {\n /** Whether to show the notification (defaults to true when store is closed on product page) */\n show?: boolean;\n}\n\n/**\n * StoreClosedNotification - Shows a notification bar when the store is closed.\n *\n * Mirrors PHP ReceivingOrdersTimesWidget:\n * - Only shows on product pages\n * - Only shows when store is closed for receiving orders\n * - Displays when the store will open next\n * - Has a close button to dismiss\n *\n * Injected via hook registry at body:start.\n */\nexport function StoreClosedNotification(_props: StoreClosedNotificationProps) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const { isOpen, isEnabled, nextOpenFormatted } = useOpeningHours(store.settings?.opening_hours);\n const [dismissed, setDismissed] = useState(false);\n\n // Check if we're on a product page\n const isProductPage = useIsProduct();\n\n // Conditions: product page, opening hours enabled, store closed, not dismissed\n if (!isProductPage || !isEnabled || isOpen || dismissed || !nextOpenFormatted) {\n return null;\n }\n\n const handleClose = (e: React.MouseEvent) => {\n e.preventDefault();\n setDismissed(true);\n };\n\n return (\n <div\n className=\"store-notify\"\n id=\"store-closed-notification\"\n data-testid=\"store-closed-notification\"\n style={{\n backgroundColor: '#d63031',\n color: '#fff',\n padding: '10px 15px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <a\n href=\"#\"\n id=\"notify-close\"\n onClick={handleClose}\n style={{ position: 'absolute', left: 15, color: '#fff', textDecoration: 'none' }}\n >\n <i className=\"sicon-cancel\" />\n </a>\n <p style={{ margin: 0, textAlign: 'center', flex: 1 }}>\n {t('store.closed_notification', {\n defaultValue: `المتجر حاليا مغلق لاستقبال الطلبات وسيتم فتحه (${nextOpenFormatted})`,\n nextOpen: nextOpenFormatted,\n })}\n </p>\n </div>\n );\n}\n"]}
|
|
@@ -7,6 +7,43 @@ import { initReactI18next } from 'react-i18next';
|
|
|
7
7
|
function translationsQueryKey(locale) {
|
|
8
8
|
return ["translations", locale];
|
|
9
9
|
}
|
|
10
|
+
function storeTranslationsQueryKey(storeId, locale) {
|
|
11
|
+
return ["translations", String(storeId), locale];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/api/messages.ts
|
|
15
|
+
function isPlainObject(value) {
|
|
16
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17
|
+
}
|
|
18
|
+
function mergeMessages(base, overrides) {
|
|
19
|
+
const merged = { ...base };
|
|
20
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
21
|
+
const existing = merged[key];
|
|
22
|
+
merged[key] = isPlainObject(existing) && isPlainObject(value) ? mergeMessages(existing, value) : value;
|
|
23
|
+
}
|
|
24
|
+
return merged;
|
|
25
|
+
}
|
|
26
|
+
function cachedOverrides(queryClient, locale) {
|
|
27
|
+
const entries = queryClient.getQueriesData({ queryKey: ["translations"] });
|
|
28
|
+
for (const [key, data] of entries) {
|
|
29
|
+
if (key.length === 3 && key[2] === locale && isPlainObject(data)) {
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
function messagesForLocale(queryClient, locale) {
|
|
36
|
+
const common = queryClient?.getQueryData(translationsQueryKey(locale));
|
|
37
|
+
const overrides = queryClient ? cachedOverrides(queryClient, locale) : void 0;
|
|
38
|
+
return composeMessages(common, overrides, locale);
|
|
39
|
+
}
|
|
40
|
+
function composeMessages(common, overrides, locale) {
|
|
41
|
+
if (!overrides || Object.keys(overrides).length === 0) return common ?? void 0;
|
|
42
|
+
const base = common?.[`${locale}.trans`];
|
|
43
|
+
return {
|
|
44
|
+
[`${locale}.trans`]: mergeMessages(isPlainObject(base) ? base : {}, overrides)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
10
47
|
|
|
11
48
|
// src/utils/errors.ts
|
|
12
49
|
var SettingsError = class extends Error {
|
|
@@ -191,8 +228,10 @@ function getTwilightContext() {
|
|
|
191
228
|
},
|
|
192
229
|
get i18n() {
|
|
193
230
|
if (!data.i18n) {
|
|
194
|
-
|
|
195
|
-
|
|
231
|
+
data.i18n = createI18nInstance(
|
|
232
|
+
data.locale,
|
|
233
|
+
messagesForLocale(data.queryClient, data.locale)
|
|
234
|
+
);
|
|
196
235
|
}
|
|
197
236
|
return data.i18n;
|
|
198
237
|
},
|
|
@@ -214,6 +253,6 @@ function getTwilightContext() {
|
|
|
214
253
|
};
|
|
215
254
|
}
|
|
216
255
|
|
|
217
|
-
export { SettingsError, createI18nInstance, getRequestStore, getTwilightContext, hasTwilightSettings, runWithTwilightContext, subscribeTwilight, translationsQueryKey, updateTwilightContext };
|
|
218
|
-
//# sourceMappingURL=chunk-
|
|
219
|
-
//# sourceMappingURL=chunk-
|
|
256
|
+
export { SettingsError, composeMessages, createI18nInstance, getRequestStore, getTwilightContext, hasTwilightSettings, isPlainObject, messagesForLocale, runWithTwilightContext, storeTranslationsQueryKey, subscribeTwilight, translationsQueryKey, updateTwilightContext };
|
|
257
|
+
//# sourceMappingURL=chunk-OGQXRBCR.js.map
|
|
258
|
+
//# sourceMappingURL=chunk-OGQXRBCR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/translations-key.ts","../src/api/messages.ts","../src/utils/errors.ts","../src/providers/i18n-factory.ts","../src/twilight/context.ts"],"names":[],"mappings":";;;;;;AAwBO,SAAS,qBAAqB,MAAA,EAAkC;AACrE,EAAA,OAAO,CAAC,gBAAgB,MAAM,CAAA;AAChC;AAkBO,SAAS,yBAAA,CACd,SACA,MAAA,EAC0B;AAC1B,EAAA,OAAO,CAAC,cAAA,EAAgB,MAAA,CAAO,OAAO,GAAG,MAAM,CAAA;AACjD;;;ACrBO,SAAS,cAAc,KAAA,EAAmC;AAC/D,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAgBO,SAAS,aAAA,CAAc,MAAgB,SAAA,EAA+B;AAC3E,EAAA,MAAM,MAAA,GAAmB,EAAE,GAAG,IAAA,EAAK;AAEnC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,SAAS,CAAA,EAAG;AACpD,IAAA,MAAM,QAAA,GAAW,OAAO,GAAG,CAAA;AAC3B,IAAA,MAAA,CAAO,GAAG,CAAA,GACR,aAAA,CAAc,QAAQ,CAAA,IAAK,aAAA,CAAc,KAAK,CAAA,GAAI,aAAA,CAAc,QAAA,EAAU,KAAK,CAAA,GAAI,KAAA;AAAA,EACvF;A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verview The translations query key, on its own, importing nothing.\n *\n * Three places read the cached translations — `rootBeforeLoad`, the hydration\n * path in `tanstack/router.tsx`, and the lazy `i18n` accessor in\n * `twilight/context.ts` — and all three have to agree on the key or the\n * hydrated page misses the entry it was just handed and refetches. One\n * definition is the only way to keep that true.\n *\n * It lives here rather than in `api/translations.ts`, where it would naturally\n * sit, because **`twilight/context.ts` cannot afford that module's imports**.\n * `api/translations` pulls in `api/client`, which pulls in `ky`; `context.ts`\n * is imported directly by tests that mock `ky`, and adding that edge made six\n * of them stop being mocked and start issuing real requests to `api.salla.dev`\n * (`tests/routes/rootBeforeLoad.test.ts`, bisected to exactly this import). A\n * leaf module with no imports of its own cannot do that to anyone.\n */\n\n/**\n * @param locale is part of the key because each file on the CDN holds one\n * language. The global file this replaced carried every language and was\n * sliced after the cache, so a key without the locale was correct then and is\n * a wrong-language bug now: `/ar` → `/en` would reuse the Arabic entry.\n */\nexport function translationsQueryKey(locale: string): [string, string] {\n return ['translations', locale];\n}\n\n/**\n * The merchant's own wording for one store and one language.\n *\n * Separate from {@link translationsQueryKey} rather than folded into it,\n * because the two files have different lifetimes and different audiences: the\n * platform's copy is the same object for every store on the CDN, and this one\n * is a single merchant's overrides. Keeping them apart means a store with no\n * overrides never invalidates, refetches or dehydrates anything on its account.\n *\n * @param storeId is `settings.store.id` — the Optimus-encoded numeric id, which\n * is what names the object. It is safe in a key even though the locale-only key\n * deliberately avoids naming a store: that warning is about a store *resolved\n * from the request*, which differs between server and client. This one is read\n * out of the settings payload, so both sides compute it from the same\n * dehydrated data and agree.\n */\nexport function storeTranslationsQueryKey(\n storeId: string | number,\n locale: string\n): [string, string, string] {\n return ['translations', String(storeId), locale];\n}\n","/**\n * @fileoverview Composing one language's messages out of the query cache.\n *\n * **There are three places that build an i18n instance**, and they have to\n * agree on more than the key: `rootBeforeLoad`, the hydration path in\n * `tanstack/router.tsx`, and the lazy `i18n` accessor in `twilight/context.ts`.\n * When the platform's copy was the only source, agreeing on\n * `translationsQueryKey` was enough. It is not any more — a merchant's own\n * wording is a second cache entry, and a reader that knows about one and not\n * the other renders different text from the page beside it.\n *\n * That is exactly what shipped in #366: the server rendered the merchant's\n * words and hydration replaced them with the platform's, because only\n * `rootBeforeLoad` had been taught to merge. Greptile caught it. This module is\n * the single answer to \"what are the messages for this locale\", so the next\n * source cannot be added to one reader and forgotten in two.\n *\n * It lives beside `translations-key.ts` and imports nothing at runtime for the\n * same reason that file does: `twilight/context.ts` cannot afford\n * `api/translations`, which pulls in `api/client` and therefore `ky`, and tests\n * that mock `ky` stop being mocked the moment that edge exists.\n */\nimport type { QueryClient } from '@tanstack/react-query';\nimport { translationsQueryKey } from './translations-key';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\nexport type Messages = Record<string, unknown>;\n\nexport function isPlainObject(value: unknown): value is Messages {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * `overrides` laid over `base`, one leaf at a time.\n *\n * Recursive rather than a spread, because both files are nested by group\n * (`common.errors.500`) and a top-level spread would make a merchant who\n * overrode one string inside `common` lose every other string in it. The\n * merchant's value wins at the leaf, and a group they never touched is left\n * exactly as the platform sent it.\n *\n * A type conflict — one side an object where the other is a string — resolves\n * to the merchant's value. It is the more specific of the two and there is no\n * sensible way to merge a string into a group; the alternative, keeping the\n * platform's, would mean a merchant's edit silently doing nothing.\n */\nexport function mergeMessages(base: Messages, overrides: Messages): Messages {\n const merged: Messages = { ...base };\n\n for (const [key, value] of Object.entries(overrides)) {\n const existing = merged[key];\n merged[key] =\n isPlainObject(existing) && isPlainObject(value) ? mergeMessages(existing, value) : value;\n }\n\n return merged;\n}\n\n/**\n * This store's overrides for `locale`, if any were fetched into the cache.\n *\n * Found by **shape** rather than by asking the settings for a store id, and\n * that is deliberate: the two readers that were missing the merge have a\n * `queryClient` and a locale between them and nothing else, and reaching for\n * `api/store` from `twilight/context.ts` would drag `ky` in through the back\n * door. One document serves one store — a request naming a different one is\n * redirected with `reloadDocument` — so at most one such entry per locale\n * exists, and matching `['translations', <anything>, <locale>]` cannot pick up\n * somebody else's.\n */\nfunction cachedOverrides(queryClient: QueryClient, locale: string): Messages | undefined {\n const entries = queryClient.getQueriesData<Messages>({ queryKey: ['translations'] });\n\n for (const [key, data] of entries) {\n if (key.length === 3 && key[2] === locale && isPlainObject(data)) {\n return data;\n }\n }\n\n return undefined;\n}\n\n/**\n * The messages for `locale`: the platform's copy with this merchant's over it.\n *\n * Reads only — whoever wants the merchant's file in the cache has to have put\n * it there, which `rootBeforeLoad` does and only when the settings say there is\n * one. A reader that runs without it simply gets the platform's copy, which is\n * the same thing it got before any of this existed.\n */\nexport function messagesForLocale(\n queryClient: QueryClient | undefined,\n locale: string\n): TranslationMessages | undefined {\n const common = queryClient?.getQueryData<TranslationMessages>(translationsQueryKey(locale));\n const overrides = queryClient ? cachedOverrides(queryClient, locale) : undefined;\n\n return composeMessages(common, overrides, locale);\n}\n\n/**\n * The same composition from values rather than from the cache.\n *\n * `rootBeforeLoad` has both in hand already — it just awaited them — so it\n * composes directly instead of reading back what it put in.\n */\nexport function composeMessages(\n common: TranslationMessages | null | undefined,\n overrides: Messages | null | undefined,\n locale: string\n): TranslationMessages | undefined {\n if (!overrides || Object.keys(overrides).length === 0) return common ?? undefined;\n\n const base = common?.[`${locale}.trans`];\n\n return {\n [`${locale}.trans`]: mergeMessages(isPlainObject(base) ? base : {}, overrides) as Record<\n string,\n string\n >,\n };\n}\n","export class SettingsError extends Error {\n constructor(message?: string) {\n super(message ?? 'Store settings could not be loaded.');\n this.name = 'SettingsError';\n }\n}\n","import { createInstance, type i18n as I18nInstance } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nexport type TranslationMessages = Record<string, Record<string, string>>;\n\n/**\n * Creates a new i18next instance for the given locale.\n *\n * @param locale - Active locale code, e.g. `'ar'`\n * @param translations - App translations from the Salla API (store-specific)\n * @param themeTranslations - Bundled theme translations (static defaults)\n */\nexport function createI18nInstance(\n locale: string,\n translations?: TranslationMessages,\n themeTranslations?: TranslationMessages\n): I18nInstance {\n const instance = createInstance();\n const transKey = `${locale}.trans`;\n\n instance.use(initReactI18next).init({\n lng: locale,\n fallbackLng: locale,\n ns: ['app', 'theme'],\n defaultNS: 'app',\n fallbackNS: 'theme',\n resources: {\n [locale]: {\n app: translations?.[transKey] ?? {},\n theme: themeTranslations?.[transKey] ?? {},\n },\n },\n interpolation: { escapeValue: false },\n react: { useSuspense: false },\n keySeparator: '.',\n nsSeparator: false,\n });\n\n return instance;\n}\n\n/**\n * Creates i18n instance for testing\n * @param locale - Locale code (default: 'ar')\n * @param translations - Optional translations\n */\nexport function createTestI18n(locale = 'ar', translations?: TranslationMessages): I18nInstance {\n return createI18nInstance(locale, translations);\n}\n","import type { QueryClient } from '@tanstack/react-query';\nimport type { i18n } from 'i18next';\nimport type { StoreContext } from '../api/store';\nimport type { AppSnippet, AppSettings } from '../api/apps';\nimport { FALLBACK_LOCALE, getLanguageInfo } from '../providers/locale-constants';\nimport { createI18nInstance } from '../providers/i18n-factory';\nimport { messagesForLocale } from '../api/messages';\nimport { SettingsError } from '../utils/errors';\nimport type { ActiveScope } from '../utils/cookies';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface TwilightLocation<TSearch = Record<string, unknown>> {\n href: string;\n pathname: string;\n search: TSearch;\n searchStr: string;\n state: Record<string, unknown>;\n hash: string;\n}\n\nexport interface PageContext {\n slug: string;\n id?: string | number;\n title: string;\n url?: string;\n parent?: { id: string | number; name: string; url: string } | null;\n breadcrumbs?: { name: string; url: string }[];\n}\n\nexport interface TwilightContext {\n queryClient: QueryClient;\n settings: StoreContext;\n locale: string;\n routeId: string;\n location: TwilightLocation;\n authToken: string | null;\n /**\n * The selected market and, once bullet delivery confirmed one, its branch\n * allocation — the full object the SDK sends as `s-scope-*` headers. Seeded from\n * the `scope` cookie on the server; see {@link ActiveScope}.\n */\n scope: ActiveScope | null;\n /** `scope.id`, kept for callers that only need the market. */\n scopeId: string | null;\n /**\n * Which store this request is for, when something other than the hostname says\n * so — the `?storeId=` a preview was opened with, or the cookie remembering it.\n *\n * Null on a live storefront, where the hostname is the answer and there is\n * nothing to carry. See {@link resolveRequestStoreId}.\n */\n storeId: string | null;\n /**\n * Which store the first segment of this request's path named, on a host where\n * the store is the root of every URL: `mtgr-alaatr-2` for\n * `https://preview.salla.design/mtgr-alaatr-2/cart`.\n *\n * Null whenever something else named the store, and on every merchant domain.\n * See {@link resolveRequestStoreBase}.\n */\n storeBase: string | null;\n /**\n * Which version of the theme's settings this request asked for — the\n * `?versionId=` an editor preview or a local dev session was opened with, or\n * the cookie remembering it.\n *\n * Null on an ordinary storefront visit, which is the common case: nothing\n * named a version, so the store's live one is what the API answers with. See\n * {@link resolveRequestVersionId}.\n */\n versionId: string | null;\n /**\n * The host this request arrived on, captured server-side.\n *\n * A theme worker is deployed with no vars and no bindings, so the request is\n * the only thing that knows which storefront it is serving. On the client this\n * is `window.location.host`; on the server nothing else has it.\n */\n requestHost: string | null;\n i18n: i18n;\n dir: 'ltr' | 'rtl';\n page?: PageContext;\n /** Installed apps' snippets, fetched in rootBeforeLoad so AppsSnippets can render CDN\n * <script> tags during SSR (React Query isn't dehydrated here, so useQuery has no SSR data). */\n appsSnippets?: AppSnippet[];\n /** Per-app public `app.*` buckets, fetched in rootBeforeLoad so rootHead can install the\n * `Salla.appScope` factory inline at parse time — ahead of the snippets' onReady callbacks. */\n appsSettings?: AppSettings;\n extras?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Internal Store\n// ============================================================================\n\nconst DEFAULT_LOCATION: TwilightLocation = {\n href: '',\n pathname: '',\n search: {},\n searchStr: '',\n state: {},\n hash: '',\n};\n\ninterface ContextData {\n queryClient: QueryClient;\n settings: StoreContext | null;\n locale: string;\n routeId: string;\n location: TwilightLocation;\n authToken: string | null;\n scope: ActiveScope | null;\n storeId: string | null;\n storeBase: string | null;\n versionId: string | null;\n requestHost: string | null;\n i18n?: i18n;\n page?: PageContext;\n appsSnippets?: AppSnippet[];\n appsSettings?: AppSettings;\n extras?: Record<string, unknown>;\n}\n\nconst DEFAULT_DATA: ContextData = {\n queryClient: null as unknown as QueryClient,\n settings: null,\n locale: FALLBACK_LOCALE,\n routeId: '',\n location: { ...DEFAULT_LOCATION },\n authToken: null,\n scope: null,\n storeId: null,\n storeBase: null,\n versionId: null,\n requestHost: null,\n i18n: undefined,\n page: undefined,\n};\n\n// ============================================================================\n// Storage: AsyncLocalStorage (server) or module-level store (client)\n// ============================================================================\n\ntype AsyncLocalStore<T> = { getStore(): T | undefined; run(val: T, fn: () => unknown): unknown };\n\n// Initialize ALS at module load time for SSR — no race condition\nlet _als: AsyncLocalStore<ContextData> | null = null;\nif (typeof window === 'undefined') {\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const { AsyncLocalStorage } = require('node:async_hooks') as {\n AsyncLocalStorage: new <T>() => AsyncLocalStore<T>;\n };\n _als = new AsyncLocalStorage<ContextData>();\n } catch {\n _als = null;\n }\n}\n\nconst clientStore: ContextData = { ...DEFAULT_DATA };\n\nfunction getTwilightStore(): ContextData {\n if (_als) {\n const store = _als.getStore();\n if (!store)\n throw new Error('[Twilight] No request context. Wrap with runWithTwilightContext().');\n return store;\n }\n return clientStore;\n}\n\nfunction writableStore(): ContextData {\n if (_als) {\n const store = _als.getStore();\n if (store) return store;\n }\n return clientStore;\n}\n\nfunction mergeIntoStore(store: ContextData, partial: Partial<TwilightContext>): void {\n if ('queryClient' in partial && partial.queryClient) store.queryClient = partial.queryClient;\n if ('settings' in partial && partial.settings != null) store.settings = partial.settings;\n if ('locale' in partial && partial.locale != null) store.locale = partial.locale;\n if ('routeId' in partial && partial.routeId != null) store.routeId = partial.routeId;\n if ('location' in partial && partial.location != null)\n store.location = { ...store.location, ...partial.location };\n if ('authToken' in partial && partial.authToken !== undefined)\n store.authToken = partial.authToken ?? null;\n if ('scope' in partial && partial.scope !== undefined) store.scope = partial.scope ?? null;\n else if ('scopeId' in partial && partial.scopeId !== undefined)\n store.scope = partial.scopeId == null ? null : { id: partial.scopeId };\n if ('storeId' in partial && partial.storeId !== undefined)\n store.storeId = partial.storeId ?? null;\n if ('storeBase' in partial && partial.storeBase !== undefined)\n store.storeBase = partial.storeBase ?? null;\n if ('versionId' in partial && partial.versionId !== undefined)\n store.versionId = partial.versionId ?? null;\n if ('requestHost' in partial && partial.requestHost !== undefined)\n store.requestHost = partial.requestHost ?? null;\n if ('i18n' in partial && partial.i18n != null) store.i18n = partial.i18n;\n if ('page' in partial) store.page = partial.page;\n if ('appsSnippets' in partial) store.appsSnippets = partial.appsSnippets;\n if ('appsSettings' in partial) store.appsSettings = partial.appsSettings;\n if ('extras' in partial) store.extras = partial.extras;\n}\n\n// ============================================================================\n// Public API\n// ============================================================================\n\nexport function runWithTwilightContext<T>(partial: Partial<TwilightContext>, fn: () => T): T {\n if (_als) {\n const data: ContextData = { ...DEFAULT_DATA };\n mergeIntoStore(data, partial);\n return _als.run(data, fn) as T;\n }\n mergeIntoStore(clientStore, partial);\n return fn();\n}\n\n// Client-only subscription so React consumers (useRouteId/useIsHome/…) re-render\n// when navigation mutates the module store. Mirrors hooks/useWishlist.ts.\nconst listeners = new Set<() => void>();\n\nexport function subscribeTwilight(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nexport function updateTwilightContext(partial: Partial<TwilightContext>): void {\n mergeIntoStore(getTwilightStore(), partial);\n // Server uses AsyncLocalStorage and has no React subscribers; notify on client only.\n if (typeof window !== 'undefined') {\n for (const listener of listeners) listener();\n }\n}\n\n/**\n * Whether store settings are available, without throwing.\n *\n * `getTwilightContext().settings` throws a `SettingsError` when the store is\n * empty, which is fatal inside a head function during hydration. Callers that\n * need to *test* availability must use this instead of a try/catch around the\n * getter. Returns false when there is no request context at all (server-side\n * calls outside `runWithTwilightContext`).\n */\nexport function hasTwilightSettings(): boolean {\n try {\n return getTwilightStore().settings != null;\n } catch {\n return false;\n }\n}\n\n/** What a request addressed, as opposed to what it is. */\nexport interface RequestAddressing {\n storeId: string | null;\n storeBase: string | null;\n versionId: string | null;\n requestHost: string | null;\n}\n\n/**\n * What this request named and the host it arrived on, without throwing.\n *\n * Separate from {@link getTwilightContext} because store identity is read while\n * deciding *what to fetch* — before there is a context worth having — and on the\n * server outside a request the getter throws. A caller asking \"which store?\" has\n * a sane answer for \"none named\"; it has none for an exception.\n *\n * The version rides along rather than getting an accessor of its own: it is read\n * at the same moment, for the same reason, and by the same callers, and a second\n * copy of this try/catch would be a second thing to remember to widen.\n */\nexport function getRequestStore(): RequestAddressing {\n try {\n const data = getTwilightStore();\n return {\n storeId: data.storeId,\n storeBase: data.storeBase,\n versionId: data.versionId,\n requestHost: data.requestHost,\n };\n } catch {\n return { storeId: null, storeBase: null, versionId: null, requestHost: null };\n }\n}\n\nexport function getTwilightContext(): TwilightContext {\n const data = getTwilightStore();\n return {\n get queryClient() {\n return data.queryClient;\n },\n get settings() {\n if (!data.settings) throw new SettingsError();\n return data.settings;\n },\n get locale() {\n return data.locale;\n },\n get routeId() {\n return data.routeId;\n },\n get location() {\n return data.location;\n },\n get authToken() {\n return data.authToken;\n },\n get scope() {\n return data.scope;\n },\n get scopeId() {\n return data.scope?.id ?? null;\n },\n get storeId() {\n return data.storeId;\n },\n get storeBase() {\n return data.storeBase;\n },\n get versionId() {\n return data.versionId;\n },\n get requestHost() {\n return data.requestHost;\n },\n get i18n() {\n if (!data.i18n) {\n // Composed the same way as `rootBeforeLoad` and the hydration path —\n // the platform's copy with this merchant's over it. See\n // `api/messages.ts`: this accessor reading one entry while the others\n // read two is precisely the drift that module exists to stop.\n data.i18n = createI18nInstance(\n data.locale,\n messagesForLocale(data.queryClient, data.locale)\n );\n }\n return data.i18n;\n },\n get dir() {\n return getLanguageInfo(data.locale).dir;\n },\n get page() {\n return data.page;\n },\n get appsSnippets() {\n return data.appsSnippets;\n },\n get appsSettings() {\n return data.appsSettings;\n },\n get extras() {\n return data.extras;\n },\n };\n}\n\n/** @internal Reset store for testing */\nexport function resetForTesting(): void {\n Object.assign(writableStore(), { ...DEFAULT_DATA });\n}\n"]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ErrorPage } from './chunk-Z4Y55HWX.js';
|
|
2
|
-
import { ensureTwilightContextFromMatches, tanstackHeadAdapter } from './chunk-
|
|
3
|
-
import { dispatchRouteChanged } from './chunk-
|
|
2
|
+
import { ensureTwilightContextFromMatches, tanstackHeadAdapter } from './chunk-NKLKKZM6.js';
|
|
3
|
+
import { dispatchRouteChanged } from './chunk-S7JSNUU2.js';
|
|
4
4
|
import { resolveHead, mergeHead, setHeadAdapter } from './chunk-B3EFOE57.js';
|
|
5
|
-
import { store } from './chunk-
|
|
6
|
-
import { translations } from './chunk-
|
|
5
|
+
import { store } from './chunk-GXXWHVLS.js';
|
|
6
|
+
import { translations } from './chunk-ZOZLNUNA.js';
|
|
7
7
|
import { buildBaseHead } from './chunk-TZ3E5BN4.js';
|
|
8
|
-
import { shouldDehydrateQuery } from './chunk-
|
|
9
|
-
import { apps } from './chunk-
|
|
10
|
-
import { renderThemeHookSlotsScript, renderAppScopeInstallScript } from './chunk-
|
|
11
|
-
import { RedirectError, NotFoundError, UnauthorizedError } from './chunk-
|
|
8
|
+
import { shouldDehydrateQuery } from './chunk-NK2V2SW5.js';
|
|
9
|
+
import { apps } from './chunk-X7P2WSNU.js';
|
|
10
|
+
import { renderThemeHookSlotsScript, renderAppScopeInstallScript } from './chunk-YGDAYFQY.js';
|
|
11
|
+
import { RedirectError, NotFoundError, UnauthorizedError } from './chunk-RLSYCDI4.js';
|
|
12
12
|
import { RouteId } from './chunk-TFB3QXYH.js';
|
|
13
|
-
import { renderRuntimeEnvScript, escapeForInlineScript, resolveStoreBase, readEnv, syncSdkLocale, resolveStoreBaseRedirect } from './chunk-
|
|
13
|
+
import { renderRuntimeEnvScript, escapeForInlineScript, resolveStoreBase, readEnv, syncSdkLocale, resolveStoreBaseRedirect } from './chunk-VRV5F6G7.js';
|
|
14
14
|
import { AUTH_TOKEN_COOKIE_NAME, syncScopeCookie, extractTokenFromCookies, prefixStoreBase, stripStoreBase } from './chunk-XTMHHLNK.js';
|
|
15
|
-
import { getTwilightContext, SettingsError, updateTwilightContext, createI18nInstance,
|
|
15
|
+
import { getTwilightContext, SettingsError, updateTwilightContext, createI18nInstance, messagesForLocale } from './chunk-OGQXRBCR.js';
|
|
16
16
|
import { useDocumentClass } from './chunk-JWXJPJBO.js';
|
|
17
17
|
import { toReactProps, mergeElementAttrs } from './chunk-CW625T2E.js';
|
|
18
18
|
import { FALLBACK_LOCALE, getLanguageInfo } from './chunk-T72DAX7R.js';
|
|
@@ -32,6 +32,23 @@ var readServerCookieToken = createIsomorphicFn().server(() => {
|
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
}).client(() => null);
|
|
35
|
+
async function withMerchantTranslations(queryClient, settings, locale, common) {
|
|
36
|
+
const wanted = locale.toLowerCase();
|
|
37
|
+
const language = settings.languages?.find(
|
|
38
|
+
(entry) => (entry.iso_code ?? entry.code)?.toLowerCase() === wanted
|
|
39
|
+
);
|
|
40
|
+
const storeId = settings.store?.id;
|
|
41
|
+
if (!language?.has_custom_translations || !storeId) return common;
|
|
42
|
+
try {
|
|
43
|
+
const overrides = await queryClient.ensureQueryData(
|
|
44
|
+
translations.queries.byStore(storeId, locale)
|
|
45
|
+
);
|
|
46
|
+
return translations.merge(common, overrides, locale);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.warn("[salla] merchant translations could not be read; using the platform copy", error);
|
|
49
|
+
return common;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
35
52
|
async function rootBeforeLoad(ctx) {
|
|
36
53
|
const locale = ctx.params.locale || FALLBACK_LOCALE;
|
|
37
54
|
const { dir } = getLanguageInfo(locale);
|
|
@@ -71,7 +88,13 @@ async function rootBeforeLoad(ctx) {
|
|
|
71
88
|
if (storeBaseHref) {
|
|
72
89
|
throw redirect({ href: storeBaseHref, reloadDocument: true, replace: true });
|
|
73
90
|
}
|
|
74
|
-
const
|
|
91
|
+
const messages = await withMerchantTranslations(
|
|
92
|
+
ctx.context.queryClient,
|
|
93
|
+
settingsResult,
|
|
94
|
+
locale,
|
|
95
|
+
translationsResult
|
|
96
|
+
);
|
|
97
|
+
const i18n = createI18nInstance(locale, messages ?? void 0);
|
|
75
98
|
let existingToken = null;
|
|
76
99
|
try {
|
|
77
100
|
existingToken = getTwilightContext().authToken;
|
|
@@ -420,7 +443,7 @@ function resolveRouteId(tanstackId) {
|
|
|
420
443
|
return TANSTACK_ROUTE_ID_MAP[tanstackId] ?? tanstackId;
|
|
421
444
|
}
|
|
422
445
|
var LazyNotFoundPage = lazy(
|
|
423
|
-
() => import('./not-found-
|
|
446
|
+
() => import('./not-found-CDXSWL7T.js').then((m) => ({ default: m.NotFoundPage }))
|
|
424
447
|
);
|
|
425
448
|
function StoreUnavailablePage() {
|
|
426
449
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
@@ -528,8 +551,7 @@ function hydrateTwilightContext(router, queryClient) {
|
|
|
528
551
|
);
|
|
529
552
|
return;
|
|
530
553
|
}
|
|
531
|
-
const
|
|
532
|
-
const i18n = createI18nInstance(locale, translations2);
|
|
554
|
+
const i18n = createI18nInstance(locale, messagesForLocale(queryClient, locale));
|
|
533
555
|
const location = router.state?.location ? {
|
|
534
556
|
href: router.state.location.href,
|
|
535
557
|
pathname: router.state.location.pathname,
|
|
@@ -749,5 +771,5 @@ function tanstackDocumentAdapter(descriptor) {
|
|
|
749
771
|
}
|
|
750
772
|
|
|
751
773
|
export { RouteDocumentSync, TanStackDocumentSync, createRouter, createTwilightRootRoute, rootHead, tanstackDocumentAdapter, useTanstackDocumentAttrs };
|
|
752
|
-
//# sourceMappingURL=chunk-
|
|
753
|
-
//# sourceMappingURL=chunk-
|
|
774
|
+
//# sourceMappingURL=chunk-R2ULWW5T.js.map
|
|
775
|
+
//# sourceMappingURL=chunk-R2ULWW5T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/routes/root/beforeLoad.ts","../src/routes/root/head.ts","../src/tanstack/store-base.ts","../src/tanstack/router.tsx","../src/tanstack/document-class.ts"],"names":["store","createTanStackRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAM,qBAAA,GAAwB,kBAAA,EAAmB,CAC9C,MAAA,CAAO,MAAqB;AAC3B,EAAA,IAAI;AACF,IAAA,OAAO,SAAA,CAAU,sBAAsB,CAAA,IAAK,IAAA;AAAA,EAC9C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF,CAAC,CAAA,CACA,MAAA,CAAO,MAAqB,IAAI,CAAA;AAkCnC,eAAe,wBAAA,CACb,WAAA,EACA,QAAA,EACA,MAAA,EACA,MAAA,EACuD;AACvD,EAAA,MAAM,MAAA,GAAS,OAAO,WAAA,EAAY;AAClC,EAAA,MAAM,QAAA,GAAW,SAAS,SAAA,EAAW,IAAA;AAAA,IACnC,CAAC,KAAA,KAAA,CAAW,KAAA,CAAM,YAAY,KAAA,CAAM,IAAA,GAAO,aAAY,KAAM;AAAA,GAC/D;AACA,EAAA,MAAM,OAAA,GAAU,SAAS,KAAA,EAAO,EAAA;AAEhC,EAAA,IAAI,CAAC,QAAA,EAAU,uBAAA,IAA2B,CAAC,SAAS,OAAO,MAAA;AAE3D,EAAA,IAAI;AACF,IAAA,MAAM,SAAA,GAAY,MAAM,WAAA,CAAY,eAAA;AAAA,MAClC,YAAA,CAAa,OAAA,CAAQ,OAAA,CAAQ,OAAA,EAAS,MAAM;AAAA,KAC9C;AAEA,IAAA,OAAO,YAAA,CAAa,KAAA,CAAM,MAAA,EAAQ,SAAA,EAAW,MAAM,CAAA;AAAA,EACrD,SAAS,KAAA,EAAO;AACd,IAAA,OAAA,CAAQ,IAAA,CAAK,4EAA4E,KAAK,CAAA;AAC9F,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,eAAsB,eAAe,GAAA,EA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,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-R2ULWW5T.js","sourcesContent":["import type { QueryClient } from '@tanstack/react-query';\nimport { redirect } from '@tanstack/react-router';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } 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 { 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 extractTokenFromCookies,\n syncScopeCookie,\n} from '../../utils/cookies';\nimport { syncSdkLocale } from '../../utils/sdk-helpers';\nimport { SettingsError } from '../../utils/errors';\nimport { resolveStoreBaseRedirect } from '../../utils/store-identity';\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\nexport interface BeforeLoadResult {\n settings: StoreContext;\n locale: string;\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}\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\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 const [settingsResult, translationsResult, snippetsResult, appSettingsResult] = await Promise.all(\n [\n ctx.context.queryClient.ensureQueryData(storeApi.queries.settings()),\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 ]\n );\n\n if (!settingsResult) {\n throw new SettingsError('Failed to load store settings. Make sure VITE_STORE_DOMAIN is set.');\n }\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 // 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' && window.salla && 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 });\n\n return {\n settings: settingsResult,\n locale,\n dir,\n authToken,\n appsSnippets: snippetsResult,\n appsSettings: appSettingsResult,\n };\n}\n","import type { HeadDescriptor, HeadResult } from '../../utils/head';\nimport { mergeHead, resolveHead } from '../../utils/head';\nimport { buildBaseHead } from '../../utils/baseHead';\nimport { FALLBACK_LOCALE } from '../../providers/locale-constants';\nimport { getTwilightContext } from '../../twilight/context';\nimport type { TwilightContextMatch } from '../../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../../twilight/ensure-context';\nimport type { StoreContext } from '../../api/store';\nimport type { AppSnippet } from '../../api/apps';\nimport { SettingsError } from '../../utils/errors';\nimport { renderAppScopeInstallScript } from '../../utils/app-scope';\nimport { renderThemeHookSlotsScript } from '../../utils/theme-hook-slots';\nimport { escapeForInlineScript } from '../../utils/inline-script';\nimport { readEnv, renderRuntimeEnvScript } from '../../utils/runtime-env';\n\nconst SALLA_ICONS_CSS_URL = 'https://cdn.assets.salla.network/static/fonts/sallaicons.css?v=2.0.5';\nconst LIT_VERSION = '3.3.3';\nconst LIT_CDN_BASE = `https://cdn.assets.salla.network/static/lit/${LIT_VERSION}`;\n\n/** Bare-specifier map for the lit build the engine's `<salla-*>` web components resolve against. */\nconst LIT_IMPORTS: Record<string, string> = {\n lit: `${LIT_CDN_BASE}/lit.js`,\n 'lit/': `${LIT_CDN_BASE}/`,\n 'lit-html': `${LIT_CDN_BASE}/lit-html/lit-html.js`,\n 'lit-html/': `${LIT_CDN_BASE}/lit-html/`,\n 'lit-element': `${LIT_CDN_BASE}/lit-element/lit-element.js`,\n 'lit-element/': `${LIT_CDN_BASE}/lit-element/`,\n '@lit/reactive-element': `${LIT_CDN_BASE}/reactive-element/reactive-element.js`,\n '@lit/reactive-element/': `${LIT_CDN_BASE}/reactive-element/`,\n};\n\nconst TWILIGHT_RELEASE_CDN = 'https://cdn.salla.network/js/twilight';\nconst TWILIGHT_DEV_CDN = 'https://cdn.assets.salla.network/dev/@salla.sa/twilight';\n// The oldest Twilight release this engine works with. Raise it whenever the engine\n// starts relying on something newer; the reason lives in that commit. Today's floor:\n// components ship their own CSS, which themes no longer compile (SallaApp/twilight#2107).\nconst MIN_TWILIGHT_VERSION = '2.14.538';\n// Last resort when no override and no platform pin, and the substitute for a pin below the floor.\nconst DEFAULT_TWILIGHT_VERSION = '2.14.584';\nconst releaseUrl = (version: string): string =>\n `${TWILIGHT_RELEASE_CDN}/${version}/twilight.esm.js`;\n// The head is built more than once per request (early hints, then the page); say it once.\nconst warnedPins = new Set<string>();\n\n/** `x.y.z` release pins only; dev shas and other strings are loaded as given. */\nfunction belowMinimum(version: string): boolean {\n return (\n /^\\d+\\.\\d+\\.\\d+$/.test(version) &&\n version.localeCompare(MIN_TWILIGHT_VERSION, undefined, { numeric: true }) < 0\n );\n}\n\n/**\n * Which twilight.esm.js the storefront loads, in priority order:\n * 1. `VITE_TWILIGHT_URL` — full local/deployment override.\n * 2. `VITE_TWILIGHT_VERSION` — dev-CDN build override.\n * 3. `theme.twilight.version` from the settings endpoint — the platform-pinned\n * release used when no environment override is configured.\n * 4. The engine's default release, also used when the pin is below the engine minimum.\n */\nexport function resolveTwilightSdkUrl(settings?: StoreContext): string {\n const urlOverride = readEnv('VITE_TWILIGHT_URL');\n if (urlOverride) return urlOverride;\n\n const versionOverride = readEnv('VITE_TWILIGHT_VERSION');\n if (versionOverride) return `${TWILIGHT_DEV_CDN}/${versionOverride}/twilight.esm.js`;\n\n const pinnedVersion = settings?.theme?.twilight?.version;\n if (pinnedVersion && belowMinimum(pinnedVersion)) {\n if (!warnedPins.has(pinnedVersion)) {\n warnedPins.add(pinnedVersion);\n console.warn(\n `[twilight] theme.twilight.version ${pinnedVersion} is below the engine minimum ${MIN_TWILIGHT_VERSION}; loading ${DEFAULT_TWILIGHT_VERSION} instead`\n );\n }\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n }\n if (pinnedVersion) return releaseUrl(pinnedVersion);\n\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n}\n\nconst MEDIA_SWAP_SCRIPT = `\n(function(){var e=function(t){var l=document.getElementById(t);if(l){if(l.sheet||\"all\"===l.media)l.media=\"all\";else l.onload=function(){this.media=\"all\"}}};e(\"salla-theme-font\");e(\"salla-icons-css\")})();\n`.trim();\n\nconst LOADING_CSS = `\n.loading-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:9999}\n.loading-spinner{animation:spin 1s linear infinite;border-radius:9999px;height:3rem;width:3rem;border-bottom:2px solid var(--color-primary,#000)}\n@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}\nhtml,body{margin:0;padding:0;height:100%}\n`.trim();\n\nconst SALLA_INIT_SCRIPT = `\nwindow.salla = window.Salla = window.Salla || window.salla || {};\nwindow.Salla.onReady = window.Salla.onReady || function(callback) {\n return new Promise(function(resolve) {\n if (window.Salla.status === 'ready') {\n var config = window.salla && window.salla.config && window.salla.config.all();\n resolve(callback ? callback(config) : config);\n } else {\n window.addEventListener('twilight::initiated', function(event) {\n resolve(callback ? callback(event.detail) : event.detail);\n }, { once: true });\n }\n });\n};\n`.trim();\n\n/**\n * Distinct snippet-host origins to `preconnect` (warm DNS/TCP/TLS during parse). From the real\n * URLs (dev/prod-correct), deduped and capped at 4. No `crossOrigin`: snippets are no-cors fetches.\n */\nexport function snippetPreconnectOrigins(snippets: readonly AppSnippet[] | undefined): string[] {\n if (!snippets?.length) return [];\n const origins = new Set<string>();\n for (const app of snippets) {\n if (app.status !== 'enabled') continue;\n for (const s of app.snippets) {\n if (!s.url) continue;\n try {\n origins.add(new URL(s.url).origin);\n } catch {\n /* skip a malformed snippet url rather than breaking the head */\n }\n if (origins.size >= 4) return [...origins];\n }\n }\n return [...origins];\n}\n\nexport function rootHead(ctx: {\n params: Record<string, string>;\n matches?: readonly TwilightContextMatch[];\n}): HeadResult {\n // Re-run on the client during hydration, where the twilight module store may\n // still be empty. Recover it from the resolved match context so the head is\n // built from real settings instead of falling through to 'Store Unavailable'.\n ensureTwilightContextFromMatches(ctx.matches);\n\n let settings: StoreContext | undefined;\n try {\n settings = getTwilightContext().settings;\n } catch (e) {\n if (e instanceof SettingsError) {\n return resolveHead({\n title: 'Store Unavailable',\n });\n }\n throw e;\n }\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n const parts = deriveHeadParts(settings);\n\n return resolveHead(\n mergeHead(buildBaseHead(settings, locale), {\n meta: buildRootMeta(parts),\n links: buildRootLinks(parts),\n styles: buildRootStyles(parts),\n importMap: [{ imports: LIT_IMPORTS }],\n scripts: buildRootScripts(parts),\n })\n );\n}\n\n/** Everything the root head's tag builders read, derived once from the store settings. */\ninterface RootHeadParts {\n store: StoreContext['store'] | undefined;\n favicon?: string;\n primaryColor?: string;\n fontUrl?: string;\n fontUrlWithDisplay?: string;\n isGoogleFont?: boolean;\n fontFamilyName?: string;\n customJs?: string;\n customCss?: string;\n isCustomCssUrl?: boolean;\n isCustomJsUrl?: boolean;\n twilightSdkUrl: string;\n snippetPreconnects: Array<{ rel: 'preconnect'; href: string }>;\n appScopeInstallScript: string;\n themeHookSlotsScript: string | null;\n runtimeEnvScript: string | null;\n}\n\n/** Google Fonts only honours `display=swap` as a query param; other hosts get the @font-face\n * override instead (see buildRootStyles). */\nfunction deriveFontParts(theme?: StoreContext['theme']) {\n const font = theme?.font;\n const fontUrl = font?.url || font?.path;\n const isGoogleFont = fontUrl?.includes('fonts.googleapis.com');\n const needsDisplay = Boolean(isGoogleFont && fontUrl && !fontUrl.includes('display='));\n const separator = fontUrl?.includes('?') ? '&' : '?';\n\n return {\n fontUrl,\n isGoogleFont,\n fontFamilyName: font?.family_name,\n fontUrlWithDisplay: needsDisplay ? `${fontUrl}${separator}display=swap` : fontUrl,\n };\n}\n\n/** Theme customization JS/CSS, each either a URL to load or an inline blob to embed. */\nfunction deriveCustomizationParts(theme?: StoreContext['theme']) {\n const customization = theme?.customization;\n const customJs = customization?.js?.trim();\n const customCss = customization?.css?.trim();\n const isUrl = (value?: string): boolean =>\n Boolean(value?.startsWith('http') || value?.startsWith('//'));\n\n return {\n customJs,\n customCss,\n isCustomCssUrl: isUrl(customCss),\n isCustomJsUrl: isUrl(customJs),\n };\n}\n\nfunction deriveHeadParts(settings?: StoreContext): RootHeadParts {\n const store = settings?.store;\n\n return {\n store,\n favicon: store?.icon,\n primaryColor: settings?.theme?.color?.primary,\n ...deriveFontParts(settings?.theme),\n ...deriveCustomizationParts(settings?.theme),\n twilightSdkUrl: resolveTwilightSdkUrl(settings),\n // Warm the connection to the snippet host(s) during head parse, so the body's deferred\n // `<script src>` snippet tags fetch off an already-open socket instead of DNS+TCP+TLS.\n snippetPreconnects: snippetPreconnectOrigins(getTwilightContext().appsSnippets).map((href) => ({\n rel: 'preconnect' as const,\n href,\n })),\n // Install `Salla.appScope` inline at parse time, before the SDK is ready — else a snippet's\n // onReady callback calls it too early and throws. Always emitted, even when the settings\n // prefetch failed: the CDN snippet tags ship regardless (they come from the *snippets*\n // endpoint), so the factory has to exist for them. `installAppScope` then seeds the real\n // buckets into this install once the client query resolves.\n appScopeInstallScript: renderAppScopeInstallScript(\n getTwilightContext().appsSettings ?? { apps: {} }\n ),\n // Whitelist the theme's own hook slots at parse time too, for the same reason: apps register\n // their `onReady` callbacks from parser-inserted snippet tags, long before React hydrates.\n themeHookSlotsScript: renderThemeHookSlotsScript(),\n // Env this render resolved (worker `vars` live in server-only `process.env`), handed to the\n // client so it doesn't silently fall back to the production defaults. Re-rendered on the\n // client during hydration, where it resolves to the same values or to nothing.\n runtimeEnvScript: renderRuntimeEnvScript(),\n };\n}\n\nfunction buildRootMeta(p: RootHeadParts): NonNullable<HeadDescriptor['meta']> {\n return [\n { name: 'robots', content: 'index, follow' },\n { name: 'msapplication-TileColor', content: '#ffffff' },\n ...(p.favicon ? [{ name: 'msapplication-TileImage', content: p.favicon }] : []),\n ...(p.primaryColor\n ? [\n { name: 'theme-color', content: p.primaryColor },\n { name: 'msapplication-navbutton-color', content: p.primaryColor },\n { name: 'apple-mobile-web-app-status-bar-style', content: p.primaryColor },\n ]\n : []),\n ];\n}\n\nfunction buildRootLinks(p: RootHeadParts): NonNullable<HeadDescriptor['links']> {\n return [\n { rel: 'preconnect', href: 'https://api.salla.dev' },\n { rel: 'preconnect', href: 'https://cdn.salla.sa' },\n { rel: 'preconnect', href: 'https://cdn.assets.salla.network', crossOrigin: 'anonymous' },\n // Warm the installed apps' CDN snippet host(s) — see snippetPreconnectOrigins.\n ...p.snippetPreconnects,\n ...(p.fontUrl\n ? [\n {\n rel: 'preconnect' as const,\n href: 'https://fonts.gstatic.com',\n crossOrigin: 'anonymous' as const,\n },\n ]\n : []),\n { rel: 'modulepreload', href: p.twilightSdkUrl },\n { rel: 'modulepreload', href: `${LIT_CDN_BASE}/lit.js` },\n ...(p.fontUrlWithDisplay\n ? [\n {\n id: 'salla-theme-font',\n rel: 'stylesheet',\n href: p.fontUrlWithDisplay,\n media: 'print',\n },\n ]\n : []),\n ...(p.fontUrlWithDisplay && !p.isGoogleFont && p.fontFamilyName\n ? [\n {\n id: 'salla-font-display-override',\n rel: 'preload',\n as: 'style',\n href: p.fontUrlWithDisplay,\n },\n ]\n : []),\n ...(p.favicon ? [{ rel: 'icon', href: p.favicon }] : []),\n ...(p.favicon\n ? [{ id: 'salla-apple-icon', rel: 'apple-touch-icon-precomposed', href: p.favicon }]\n : []),\n ...(p.isCustomCssUrl && p.customCss\n ? [{ id: 'salla-custom-css', rel: 'stylesheet', href: p.customCss }]\n : []),\n {\n id: 'salla-icons-css',\n rel: 'stylesheet',\n href: SALLA_ICONS_CSS_URL,\n media: 'print',\n },\n // {\n // id: 'intl-tel-input-css',\n // rel: 'stylesheet',\n // href: 'https://cdn.jsdelivr.net/npm/intl-tel-input@26.8.0/build/css/intlTelInput.css',\n // },\n ...(p.isCustomJsUrl && p.customJs\n ? [{ id: 'salla-custom-js-preload', rel: 'preload', as: 'script', href: p.customJs }]\n : []),\n ];\n}\n\nfunction buildRootStyles(p: RootHeadParts): NonNullable<HeadDescriptor['styles']> {\n return [\n { id: 'twilight-loading', children: LOADING_CSS },\n ...(!p.isGoogleFont && p.fontFamilyName\n ? [\n {\n id: 'salla-font-display-swap',\n children: `@font-face{font-family:\"${p.fontFamilyName}\";font-display:swap;src:local(\"${p.fontFamilyName}\")}`,\n },\n ]\n : []),\n ...(!p.isCustomCssUrl && p.customCss\n ? [{ id: 'salla-custom-css', children: p.customCss }]\n : []),\n ];\n}\n\nfunction buildRootScripts(p: RootHeadParts): NonNullable<HeadDescriptor['scripts']> {\n return [\n // First: the API base / store identifier this render used, so the hydrated client\n // resolves the same ones (worker `vars` never reach the browser bundle on their own).\n ...(p.runtimeEnvScript ? [{ id: 'salla-runtime-env', children: p.runtimeEnvScript }] : []),\n { id: 'twilight-init', children: SALLA_INIT_SCRIPT },\n // After twilight-init (which defines window.Salla) and before the SDK module, so the\n // appScope factory exists ahead of any snippet's onReady callback firing.\n { id: 'salla-app-scope', children: p.appScopeInstallScript },\n // Arms the hook-slot whitelist push here, so its `twilight::initiated` listener is\n // registered before any app snippet's — listeners fire in registration order.\n ...(p.themeHookSlotsScript\n ? [{ id: 'salla-theme-hook-slots', children: p.themeHookSlotsScript }]\n : []),\n { id: 'salla-async-css', children: MEDIA_SWAP_SCRIPT },\n { id: 'salla-sdk', type: 'module', src: p.twilightSdkUrl },\n ...(p.store?.settings?.ticketing_system_enabled\n ? [\n {\n id: 'salla-ticketing-script',\n src: 'https://cdn.assets.salla.network/latest/@salla.sa/ui-store-ticketing-system/ticketing-system.es.js',\n type: 'module',\n },\n ]\n : []),\n ...(p.customJs ? [buildCustomJsScript(p.customJs, Boolean(p.isCustomJsUrl))] : []),\n ];\n}\n\n/** A URL customization is loaded after SDK init; an inline one is wrapped so a syntax/runtime\n * error in partner JS warns instead of taking the page down. */\nfunction buildCustomJsScript(customJs: string, isUrl: boolean) {\n return {\n id: 'salla-custom-js',\n children: isUrl\n ? `document.addEventListener('twilight::initiated',function(){var s=document.createElement('script');s.src=${escapeForInlineScript(JSON.stringify(customJs))};s.async=true;document.head.appendChild(s)},{once:true});`\n : `try { ${customJs} } catch(e) { console.warn(\"[ThemeCustomization] Custom JS error:\", e); }`,\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 { prefixStoreBase, stripStoreBase } from '../utils/store-base';\n\n/** A rewrite that serves the application from `/<base>`. */\nexport function storeBaseRewrite(base: string): LocationRewrite {\n return {\n input: ({ url }) => {\n url.pathname = stripStoreBase(url.pathname, base);\n return url;\n },\n output: ({ url }) => {\n url.pathname = prefixStoreBase(url.pathname, base);\n return url;\n },\n };\n}\n","import type { ReactNode } from 'react';\nimport { lazy, Suspense } from 'react';\nimport {\n createRouter as createTanStackRouter,\n createRootRouteWithContext,\n} from '@tanstack/react-router';\nimport type { 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 { updateTwilightContext, type TwilightLocation } from '../twilight/context';\nimport { dispatchRouteChanged } from '../utils/sdk-events';\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 { UnauthorizedError, NotFoundError, RedirectError } 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 } from '../utils/store-identity';\nimport { storeBaseRewrite } from './store-base';\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\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\n '/{-$locale}/logout': RouteId.LOGOUT,\n '/{-$locale}/loyalty': RouteId.LOYALTY,\n '/{-$locale}/testimonials': RouteId.TESTIMONIALS,\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 = lazy(() =>\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 <ErrorPage code={400} message={message} />;\n }\n\n return <ErrorPage code={500} message={message} />;\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 hydrateTwilightContext(router: AnyRouter, queryClient: QueryClient): void {\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\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 location = router.state?.location\n ? {\n href: router.state.location.href,\n pathname: router.state.location.pathname,\n search: router.state.location.search as Record<string, unknown>,\n searchStr: router.state.location.searchStr,\n state: router.state.location.state as unknown as Record<string, unknown>,\n hash: router.state.location.hash,\n }\n : undefined;\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 });\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 the first segment of every\n // URL. 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) } : {}),\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 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 // 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', () => {\n const matches = router.state?.matches;\n if (!matches) return;\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 if (page) {\n updateTwilightContext({ page });\n // Set page config for SDK\n const salla = window.salla;\n salla?.config?.set?.('page', {\n ...page,\n url: page.url ?? router.state.location.pathname + router.state.location.searchStr,\n });\n }\n });\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 } 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}/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}/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}/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};\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 let routeClass: string | null = null;\n for (let i = matches.length - 1; i >= 0; i--) {\n const id = matches[i].routeId;\n if (id in ROUTE_CLASS_MAP) {\n routeClass = ROUTE_CLASS_MAP[id];\n break;\n }\n }\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 }\n\n let routeClass: string | null = null;\n for (let i = matches.length - 1; i >= 0; i--) {\n const id = matches[i].routeId;\n if (id in ROUTE_CLASS_MAP) {\n routeClass = ROUTE_CLASS_MAP[id];\n break;\n }\n }\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,6 +1,6 @@
|
|
|
1
|
-
import { useDate } from './chunk-
|
|
1
|
+
import { useDate } from './chunk-ANWDPISS.js';
|
|
2
2
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
3
|
-
import { Image } from './chunk-
|
|
3
|
+
import { Image } from './chunk-CUX7O42G.js';
|
|
4
4
|
import { Link } from './chunk-AXW67SY7.js';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -61,5 +61,5 @@ function BlogListLayout({
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export { BlogArticleCard, BlogListLayout };
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-R3TPJHLI.js.map
|
|
65
|
+
//# sourceMappingURL=chunk-R3TPJHLI.js.map
|