@salla.sa/twilight-theme-engine 1.0.56 → 1.0.58
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-QKJ72MFV.js → AddToCartForm-MTD46H63.js} +3 -3
- package/dist/{AddToCartForm-QKJ72MFV.js.map → AddToCartForm-MTD46H63.js.map} +1 -1
- package/dist/{BlogAuthorPage-75HKHV53.js → BlogAuthorPage-BT5BGQQJ.js} +15 -16
- package/dist/BlogAuthorPage-BT5BGQQJ.js.map +1 -0
- package/dist/{BlogCategoryPage-R7QE3DNT.js → BlogCategoryPage-IDHUIFVG.js} +15 -16
- package/dist/BlogCategoryPage-IDHUIFVG.js.map +1 -0
- package/dist/{BlogPage-OAEP7OOU.js → BlogPage-VSZPR4AD.js} +13 -14
- package/dist/BlogPage-VSZPR4AD.js.map +1 -0
- package/dist/{BlogSinglePage-NSCAOZMR.js → BlogSinglePage-3FWJ6UTQ.js} +13 -14
- package/dist/BlogSinglePage-3FWJ6UTQ.js.map +1 -0
- package/dist/{BlogTagPage-QNAZWE5P.js → BlogTagPage-TIPPV2WW.js} +15 -16
- package/dist/BlogTagPage-TIPPV2WW.js.map +1 -0
- package/dist/{BrandsPage-5JHLX2XO.js → BrandsPage-LEXRPFVK.js} +13 -14
- package/dist/BrandsPage-LEXRPFVK.js.map +1 -0
- package/dist/{Breadcrumb-A4FLPDBV.js → Breadcrumb-Q3P72LPT.js} +13 -14
- package/dist/Breadcrumb-Q3P72LPT.js.map +1 -0
- package/dist/{CartItem-VZKFYO57.js → CartItem-LJYCK3UP.js} +13 -14
- package/dist/CartItem-LJYCK3UP.js.map +1 -0
- package/dist/{CartSummary-7ZSG6I6S.js → CartSummary-645YDH2N.js} +13 -14
- package/dist/CartSummary-645YDH2N.js.map +1 -0
- package/dist/{Copyright-C4NN5NWB.js → Copyright-N5323WE7.js} +3 -3
- package/dist/{Copyright-C4NN5NWB.js.map → Copyright-N5323WE7.js.map} +1 -1
- package/dist/{CustomerLayout-3HW7J2BB.js → CustomerLayout-LB2EWG2P.js} +13 -14
- package/dist/CustomerLayout-LB2EWG2P.js.map +1 -0
- package/dist/{Footer-373V56WN.js → Footer-TTYS7K4V.js} +13 -14
- package/dist/{Footer-373V56WN.js.map → Footer-TTYS7K4V.js.map} +1 -1
- package/dist/{Header-F4H4CBCL.js → Header-26PWNGDF.js} +6 -6
- package/dist/{Header-F4H4CBCL.js.map → Header-26PWNGDF.js.map} +1 -1
- package/dist/{LoyaltyPage-UMWLPECY.js → LoyaltyPage-F4QVHJAH.js} +14 -15
- package/dist/LoyaltyPage-F4QVHJAH.js.map +1 -0
- package/dist/{MainMenu-DP2N74AL.js → MainMenu-SACYMDKQ.js} +7 -7
- package/dist/{MainMenu-DP2N74AL.js.map → MainMenu-SACYMDKQ.js.map} +1 -1
- package/dist/{MasterLayout-27XOOCFM.js → MasterLayout-MVY5N7G6.js} +13 -14
- package/dist/{MasterLayout-27XOOCFM.js.map → MasterLayout-MVY5N7G6.js.map} +1 -1
- package/dist/{MobileMenu-RDTHWQC3.js → MobileMenu-DBIJRXTA.js} +14 -15
- package/dist/MobileMenu-DBIJRXTA.js.map +1 -0
- package/dist/{NotificationsPage-KTZLNZHM.js → NotificationsPage-TMGF4BQM.js} +13 -14
- package/dist/NotificationsPage-TMGF4BQM.js.map +1 -0
- package/dist/{OrderSinglePage-PQ74PMJK.js → OrderSinglePage-NCQR6ADR.js} +14 -15
- package/dist/OrderSinglePage-NCQR6ADR.js.map +1 -0
- package/dist/{OrdersPage-7NGAJPK2.js → OrdersPage-O2LSXL4W.js} +14 -15
- package/dist/OrdersPage-O2LSXL4W.js.map +1 -0
- package/dist/{PageSingle-2OITZXHA.js → PageSingle-745SGJUG.js} +3 -3
- package/dist/{PageSingle-2OITZXHA.js.map → PageSingle-745SGJUG.js.map} +1 -1
- package/dist/{ProductDetails-CCN7LHV7.js → ProductDetails-AHYFTGM6.js} +3 -3
- package/dist/{ProductDetails-CCN7LHV7.js.map → ProductDetails-AHYFTGM6.js.map} +1 -1
- package/dist/{ProfilePage-FBAQ4YFY.js → ProfilePage-5JUXB5SB.js} +13 -14
- package/dist/ProfilePage-5JUXB5SB.js.map +1 -0
- package/dist/{SeoCartWidget-IZSJ6YTX.js → SeoCartWidget-XPPMBCQB.js} +13 -14
- package/dist/SeoCartWidget-XPPMBCQB.js.map +1 -0
- package/dist/{SettingsPage-RAEWPKMK.js → SettingsPage-NFSZ4CKO.js} +13 -14
- package/dist/SettingsPage-NFSZ4CKO.js.map +1 -0
- package/dist/{StoreClosedNotification-OALAFI4Y.js → StoreClosedNotification-5XWRDBPA.js} +14 -15
- package/dist/{StoreClosedNotification-OALAFI4Y.js.map → StoreClosedNotification-5XWRDBPA.js.map} +1 -1
- package/dist/{TestimonialsPage-RWIXMIR6.js → TestimonialsPage-JHGMJMGG.js} +3 -3
- package/dist/{TestimonialsPage-RWIXMIR6.js.map → TestimonialsPage-JHGMJMGG.js.map} +1 -1
- package/dist/{ThankYouPage-TLFQE3TA.js → ThankYouPage-CYCVSBAO.js} +13 -14
- package/dist/ThankYouPage-CYCVSBAO.js.map +1 -0
- package/dist/{WalletPage-EFOMPLFB.js → WalletPage-2JZ32SNZ.js} +14 -15
- package/dist/WalletPage-2JZ32SNZ.js.map +1 -0
- package/dist/{WishlistPage-D6WQCUIS.js → WishlistPage-N3K6MBMC.js} +15 -16
- package/dist/WishlistPage-N3K6MBMC.js.map +1 -0
- 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.d.ts +9 -0
- package/dist/api/client.d.ts.map +1 -1
- 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/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 +25 -0
- package/dist/api/translations-key.d.ts.map +1 -0
- package/dist/api/translations.d.ts +27 -4
- 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-WMSOSA74.js → chunk-2KU5ANFZ.js} +5 -5
- package/dist/{chunk-WMSOSA74.js.map → chunk-2KU5ANFZ.js.map} +1 -1
- package/dist/{chunk-QBIW266S.js → chunk-2OX3JML4.js} +4 -4
- package/dist/{chunk-QBIW266S.js.map → chunk-2OX3JML4.js.map} +1 -1
- package/dist/{chunk-NSSKTF6I.js → chunk-36PDYP56.js} +40 -19
- package/dist/chunk-36PDYP56.js.map +1 -0
- package/dist/chunk-3H27IEME.js +14 -0
- package/dist/{chunk-TUUBKHTD.js.map → chunk-3H27IEME.js.map} +1 -1
- package/dist/{chunk-BVB75J3R.js → chunk-3R7YKSO6.js} +5 -5
- package/dist/{chunk-BVB75J3R.js.map → chunk-3R7YKSO6.js.map} +1 -1
- package/dist/{chunk-XEQ6ILIP.js → chunk-675NJ2XP.js} +4 -4
- package/dist/{chunk-XEQ6ILIP.js.map → chunk-675NJ2XP.js.map} +1 -1
- package/dist/{chunk-OZV5P4VP.js → chunk-7BWZYECG.js} +5 -5
- package/dist/{chunk-OZV5P4VP.js.map → chunk-7BWZYECG.js.map} +1 -1
- package/dist/{chunk-PZL3JWM2.js → chunk-BFZ47MS5.js} +3 -3
- package/dist/{chunk-PZL3JWM2.js.map → chunk-BFZ47MS5.js.map} +1 -1
- package/dist/{chunk-NCGZMLBS.js → chunk-BZ7ZIO33.js} +3 -3
- package/dist/{chunk-NCGZMLBS.js.map → chunk-BZ7ZIO33.js.map} +1 -1
- package/dist/{chunk-O6XXHXC4.js → chunk-F4MMWEII.js} +9 -5
- package/dist/chunk-F4MMWEII.js.map +1 -0
- package/dist/{chunk-R6M6RM6U.js → chunk-GLRXYGYI.js} +3 -3
- package/dist/{chunk-R6M6RM6U.js.map → chunk-GLRXYGYI.js.map} +1 -1
- package/dist/{chunk-MENDTTOA.js → chunk-HOE2P2HU.js} +3 -3
- package/dist/{chunk-MENDTTOA.js.map → chunk-HOE2P2HU.js.map} +1 -1
- package/dist/{chunk-62SHHET3.js → chunk-HVHFTVZT.js} +4 -4
- package/dist/{chunk-62SHHET3.js.map → chunk-HVHFTVZT.js.map} +1 -1
- package/dist/chunk-IE2FU6BR.js +83 -0
- package/dist/chunk-IE2FU6BR.js.map +1 -0
- package/dist/{chunk-F5IEB43R.js → chunk-J2GGMK3X.js} +6 -6
- package/dist/{chunk-F5IEB43R.js.map → chunk-J2GGMK3X.js.map} +1 -1
- package/dist/{chunk-NQ5FQOE2.js → chunk-JBNI5ZVG.js} +3 -3
- package/dist/{chunk-NQ5FQOE2.js.map → chunk-JBNI5ZVG.js.map} +1 -1
- package/dist/{chunk-63GHZIAG.js → chunk-JDROOL5C.js} +3 -3
- package/dist/{chunk-63GHZIAG.js.map → chunk-JDROOL5C.js.map} +1 -1
- package/dist/{chunk-P4DUWQU4.js → chunk-K4YT7TOV.js} +3 -3
- package/dist/{chunk-P4DUWQU4.js.map → chunk-K4YT7TOV.js.map} +1 -1
- package/dist/{chunk-JD4J2ZB6.js → chunk-KTOKX3GC.js} +3 -3
- package/dist/{chunk-JD4J2ZB6.js.map → chunk-KTOKX3GC.js.map} +1 -1
- package/dist/{chunk-IVDXRPIG.js → chunk-LKRI35NZ.js} +15 -19
- package/dist/chunk-LKRI35NZ.js.map +1 -0
- package/dist/{chunk-7XBSSGRK.js → chunk-MQBGRVOJ.js} +4 -4
- package/dist/{chunk-7XBSSGRK.js.map → chunk-MQBGRVOJ.js.map} +1 -1
- package/dist/{chunk-MDIUVANI.js → chunk-O2YV5DAL.js} +4 -4
- package/dist/{chunk-MDIUVANI.js.map → chunk-O2YV5DAL.js.map} +1 -1
- package/dist/{chunk-GLJX3BH2.js → chunk-PSRSWHML.js} +4 -4
- package/dist/{chunk-GLJX3BH2.js.map → chunk-PSRSWHML.js.map} +1 -1
- package/dist/{chunk-A2ZO3IR7.js → chunk-RBVFIPX2.js} +4 -4
- package/dist/{chunk-A2ZO3IR7.js.map → chunk-RBVFIPX2.js.map} +1 -1
- package/dist/{chunk-BQ4CV7YX.js → chunk-RJAV554G.js} +4 -4
- package/dist/{chunk-BQ4CV7YX.js.map → chunk-RJAV554G.js.map} +1 -1
- package/dist/{chunk-UV5BRJH4.js → chunk-S7XYSF4X.js} +4 -4
- package/dist/{chunk-UV5BRJH4.js.map → chunk-S7XYSF4X.js.map} +1 -1
- package/dist/{chunk-PJWFEMBX.js → chunk-SOPK72TP.js} +9 -4
- package/dist/chunk-SOPK72TP.js.map +1 -0
- package/dist/{chunk-YGAU6PFQ.js → chunk-TJGYL7GD.js} +5 -5
- package/dist/{chunk-YGAU6PFQ.js.map → chunk-TJGYL7GD.js.map} +1 -1
- package/dist/{chunk-3FIWHGCZ.js → chunk-TX6ZP4FF.js} +3 -3
- package/dist/{chunk-3FIWHGCZ.js.map → chunk-TX6ZP4FF.js.map} +1 -1
- package/dist/{chunk-QKIQ3K24.js → chunk-UOALND7V.js} +4 -4
- package/dist/{chunk-QKIQ3K24.js.map → chunk-UOALND7V.js.map} +1 -1
- package/dist/{chunk-TIDHWQIS.js → chunk-VO5ODVVL.js} +4 -4
- package/dist/{chunk-TIDHWQIS.js.map → chunk-VO5ODVVL.js.map} +1 -1
- package/dist/{chunk-U43L4ZLH.js → chunk-WFSOVIYU.js} +6 -6
- package/dist/{chunk-U43L4ZLH.js.map → chunk-WFSOVIYU.js.map} +1 -1
- package/dist/{chunk-4D44TJ72.js → chunk-WIAPOLEA.js} +3 -3
- package/dist/{chunk-4D44TJ72.js.map → chunk-WIAPOLEA.js.map} +1 -1
- package/dist/{chunk-EPDF4ZU7.js → chunk-XDB2POG3.js} +7 -7
- package/dist/{chunk-EPDF4ZU7.js.map → chunk-XDB2POG3.js.map} +1 -1
- package/dist/{chunk-UIDPX3GA.js → chunk-YJ6ZSGQY.js} +3 -3
- package/dist/{chunk-UIDPX3GA.js.map → chunk-YJ6ZSGQY.js.map} +1 -1
- package/dist/{chunk-QM75GGXX.js → chunk-YJJZN5UP.js} +4 -4
- package/dist/{chunk-QM75GGXX.js.map → chunk-YJJZN5UP.js.map} +1 -1
- package/dist/{chunk-3MHDV5JS.js → chunk-YNY5P2DG.js} +3 -3
- package/dist/{chunk-3MHDV5JS.js.map → chunk-YNY5P2DG.js.map} +1 -1
- package/dist/{chunk-Z74NUTEI.js → chunk-YSFWVMBA.js} +3 -3
- package/dist/{chunk-Z74NUTEI.js.map → chunk-YSFWVMBA.js.map} +1 -1
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +11 -12
- package/dist/components/home/index.js +14 -15
- package/dist/components/layout/index.js +5 -5
- package/dist/components/product/index.js +12 -13
- package/dist/components/store/index.js +13 -14
- package/dist/components/store/index.js.map +1 -1
- package/dist/document-class-YYEVAIVJ.js +25 -0
- package/dist/{document-class-JZAILFK3.js.map → document-class-YYEVAIVJ.js.map} +1 -1
- package/dist/hooks/index.js +11 -12
- package/dist/hooks/registerDefaultHooks.d.ts.map +1 -1
- package/dist/hooks/useGtm.js +11 -12
- package/dist/hooks/useMoney.js +11 -12
- package/dist/hooks/useStore.js +11 -12
- package/dist/hooks/useUser.js +5 -5
- package/dist/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/dist/{navigation-JINL5V44.js → navigation-4VEQUXHI.js} +5 -5
- package/dist/{navigation-JINL5V44.js.map → navigation-4VEQUXHI.js.map} +1 -1
- package/dist/{navigation-ERMAPC4D.js → navigation-MVKZENRD.js} +4 -4
- package/dist/{navigation-ERMAPC4D.js.map → navigation-MVKZENRD.js.map} +1 -1
- package/dist/{not-found-OSTTTMCL.js → not-found-JGDH4AQ3.js} +14 -15
- package/dist/not-found-JGDH4AQ3.js.map +1 -0
- package/dist/providers/index.js +11 -12
- 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 -20
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home.js +16 -17
- 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/index.d.ts.map +1 -1
- package/dist/routes/product-listing.js +16 -17
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +19 -16
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/root/head.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 -17
- package/dist/tanstack/router.d.ts.map +1 -1
- package/dist/tanstack.js +15 -16
- package/dist/tanstack.js.map +1 -1
- package/dist/twilight/context.d.ts.map +1 -1
- package/dist/utils/fast-checkout.d.ts +16 -1
- package/dist/utils/fast-checkout.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/BlogAuthorPage-75HKHV53.js.map +0 -1
- package/dist/BlogCategoryPage-R7QE3DNT.js.map +0 -1
- package/dist/BlogPage-OAEP7OOU.js.map +0 -1
- package/dist/BlogSinglePage-NSCAOZMR.js.map +0 -1
- package/dist/BlogTagPage-QNAZWE5P.js.map +0 -1
- package/dist/BrandsPage-5JHLX2XO.js.map +0 -1
- package/dist/Breadcrumb-A4FLPDBV.js.map +0 -1
- package/dist/CartItem-VZKFYO57.js.map +0 -1
- package/dist/CartSummary-7ZSG6I6S.js.map +0 -1
- package/dist/CustomerLayout-3HW7J2BB.js.map +0 -1
- package/dist/LoyaltyPage-UMWLPECY.js.map +0 -1
- package/dist/MobileMenu-RDTHWQC3.js.map +0 -1
- package/dist/NotificationsPage-KTZLNZHM.js.map +0 -1
- package/dist/OrderSinglePage-PQ74PMJK.js.map +0 -1
- package/dist/OrdersPage-7NGAJPK2.js.map +0 -1
- package/dist/ProfilePage-FBAQ4YFY.js.map +0 -1
- package/dist/SeoCartWidget-IZSJ6YTX.js.map +0 -1
- package/dist/SettingsPage-RAEWPKMK.js.map +0 -1
- package/dist/ThankYouPage-TLFQE3TA.js.map +0 -1
- package/dist/WalletPage-EFOMPLFB.js.map +0 -1
- package/dist/WishlistPage-D6WQCUIS.js.map +0 -1
- package/dist/chunk-6IATCGID.js +0 -7
- package/dist/chunk-6IATCGID.js.map +0 -1
- package/dist/chunk-IVDXRPIG.js.map +0 -1
- package/dist/chunk-KT2MUSRN.js +0 -25
- package/dist/chunk-KT2MUSRN.js.map +0 -1
- package/dist/chunk-NSSKTF6I.js.map +0 -1
- package/dist/chunk-O6XXHXC4.js.map +0 -1
- package/dist/chunk-PJWFEMBX.js.map +0 -1
- package/dist/chunk-TUUBKHTD.js +0 -14
- package/dist/document-class-JZAILFK3.js +0 -26
- package/dist/not-found-OSTTTMCL.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { home } from './chunk-
|
|
1
|
+
import { home } from './chunk-K4YT7TOV.js';
|
|
2
2
|
import { buildHreflangAlternates } from './chunk-TZ3E5BN4.js';
|
|
3
|
-
import { HomeComponentRenderer } from './chunk-
|
|
3
|
+
import { HomeComponentRenderer } from './chunk-7BWZYECG.js';
|
|
4
4
|
import { useDevHomeComponentOverrides } from './chunk-2JV6WZ6O.js';
|
|
5
5
|
import { RouteId } from './chunk-TFB3QXYH.js';
|
|
6
|
-
import { getTwilightContext } from './chunk-
|
|
6
|
+
import { getTwilightContext } from './chunk-SOPK72TP.js';
|
|
7
7
|
import { HookSlot } from './chunk-Q7VWURUR.js';
|
|
8
8
|
import { memo } from 'react';
|
|
9
9
|
import { Pulse } from '@salla.sa/twilight-components-react';
|
|
@@ -84,5 +84,5 @@ function head(ctx) {
|
|
|
84
84
|
var Home = { id: RouteId.INDEX, loader, head, Component: HomePage };
|
|
85
85
|
|
|
86
86
|
export { Home, HomeSkeleton, homeLoader };
|
|
87
|
-
//# sourceMappingURL=chunk-
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
87
|
+
//# sourceMappingURL=chunk-TJGYL7GD.js.map
|
|
88
|
+
//# sourceMappingURL=chunk-TJGYL7GD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;AAWA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,MACpC,GAAG,IAAA;AAAA,MACH,MAAM,IAAA,CAAK,IAAA,EAAM,QAAQ,OAAA,EAAS,EAAE,KAAK,IAAA,CAAK;AAAA,KAChD,CAAE,CAAA;AAAA,IACF,IAAA,EAAM,EAAE,IAAA,EAAM,OAAA,CAAQ,KAAA;AAAM,GAC9B;AACA,EAAA,OAAO,MAAA;AACT;AChBO,IAAM,YAAA,GAAe,IAAA,CAAK,SAASA,aAAAA,GAAe;AACvD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAI,SAAA,EAAU,uCAAA,EACb,8BAAC,KAAA,EAAA,EAAM,SAAA,EAAU,2BAA0B,CAAA,EAC7C,CAAA;AAAA,oBACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,2CAAA,EACb,QAAA,EAAA;AAAA,sBAAA,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AA,GAAQ,IAAI,QAAA,EAAU,KAAA;AAC5B,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AAEpB,EAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,IAAA,EAAM,KAAA,IAAS,KAAA,CAAM,IAAA;AACzC,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,IAAA,EAAM,WAAA,IAAe,KAAA,CAAM,WAAA;AACrD,EAAA,MAAM,QAAA,GAAW,MAAM,IAAA,EAAM,QAAA;AAE7B,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAW,KAAA,CAAM,GAAA;AAAA,IACjB,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,SAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM,IAAA;AAAA,MACd,KAAK,KAAA,CAAM;AAAA,KACb;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,qBAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM;AAAA,KAChB;AAAA,IACA,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AACF;AAEO,IAAM,IAAA,GAAO,EAAE,EAAA,EAAI,OAAA,CAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,WAAW,QAAA","file":"chunk-TJGYL7GD.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { home } from '../../api/home';\nimport type { HomeComponentData } from '../../types';\nimport { RouteId } from '../../router/route-ids';\n\nexport interface HomeLoaderData {\n locale: string;\n components: HomeComponentData[];\n page: { slug: string };\n}\n\nexport async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {\n const { queryClient } = getTwilightContext();\n const components = await queryClient.ensureQueryData(home.queries.components());\n const result = {\n locale: ctx?.locale || 'ar',\n components: components.map((comp) => ({\n ...comp,\n path: comp.path?.replace('home.', '') || comp.path,\n })),\n page: { slug: RouteId.INDEX },\n };\n return result;\n}\n","import { memo } from 'react';\nimport { useDevHomeComponentOverrides } from '../../dev/dev-settings-store';\nimport { HookSlot } from '../../hooks';\nimport { HomeComponentRenderer } from '../../components/home';\nimport type { HomePageProps } from './types';\nimport { Pulse } from '@salla.sa/twilight-components-react';\n\nexport const HomeSkeleton = memo(function HomeSkeleton() {\n return (\n <>\n <div className=\"s-block container skeleton-block-hero\">\n <Pulse className=\"h-64 sm:h-80 rounded-md\" />\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n </>\n );\n});\n\nexport const HomePage = memo(function HomePage({ components = [] }: HomePageProps) {\n // Dev-mode only: overlay DevSettingsWidget component-field overrides onto the\n // blocks so edits render live. No-op passthrough in production builds.\n const renderedComponents = useDevHomeComponentOverrides(components);\n return (\n <>\n <HookSlot name=\"home:start\" />\n <HookSlot name=\"home:content\" />\n {renderedComponents.map((data, index) => (\n // `data.key` is the twilight.json catalog id, shared by every placement\n // of that block. Platform blocks send null. Position is unique.\n <HomeComponentRenderer key={index} data={data} index={index} />\n ))}\n <HookSlot name=\"home:end\" />\n </>\n );\n});\n\nexport { HomePage as default };\n","import type { HeadDescriptor } from '../../utils/head';\nimport { buildHreflangAlternates } from '../../utils/baseHead';\nimport type { HomeLoaderData } from './loader';\nimport { homeLoader } from './loader';\nimport type { TwilightContext } from '../../twilight/context';\nimport { HomePage } from './HomePage';\nimport { RouteId } from '../../router/route-ids';\n\nexport { HomeSkeleton } from './HomePage';\nexport { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';\nexport { registerHomeComponentConfig } from '../../components/home';\nexport type { HomePageProps } from './types';\nexport type { HomeLoaderData } from './loader';\nexport type {\n HomeComponentsProps,\n AnyHomeComponent,\n HomeComponentConfig,\n} from '../../components/home';\n\nfunction loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {\n return homeLoader({ locale: _ctx?.locale });\n}\n\nfunction head(ctx: TwilightContext): HeadDescriptor {\n const store = ctx.settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title ?? store.name;\n const description = store.meta?.description ?? store.description;\n const keywords = store.meta?.keywords;\n\n return {\n title,\n description,\n keywords,\n canonical: store.url,\n openGraph: {\n type: 'website',\n title,\n description,\n images: store.logo,\n url: store.url,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: store.logo,\n },\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n}\n\nexport const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;\n\nexport { homeLoader };\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hostIdentifiesStore, resolveRequestStoreBase, storeBaseRedirectHref } from './chunk-XTMHHLNK.js';
|
|
2
|
-
import { getRequestStore } from './chunk-
|
|
2
|
+
import { getRequestStore } from './chunk-SOPK72TP.js';
|
|
3
3
|
|
|
4
4
|
// src/utils/inline-script.ts
|
|
5
5
|
function escapeForInlineScript(value) {
|
|
@@ -97,5 +97,5 @@ function syncSdkLocale(locale) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export { escapeForInlineScript, getInjectedRuntimeEnv, getSallaSDK, getStoreIdentifier, readEnv, renderRuntimeEnvScript, resolveStoreBase, resolveStoreBaseRedirect, resolveStoreIdentifier, syncSdkLocale };
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
101
|
-
//# sourceMappingURL=chunk-
|
|
100
|
+
//# sourceMappingURL=chunk-TX6ZP4FF.js.map
|
|
101
|
+
//# sourceMappingURL=chunk-TX6ZP4FF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/inline-script.ts","../src/utils/runtime-env.ts","../src/utils/store-identity.ts","../src/utils/sdk-helpers.ts"],"names":[],"mappings":";;;;AAMO,SAAS,sBAAsB,KAAA,EAAuB;AAC3D,EAAA,OAAO,MACJ,OAAA,CAAQ,IAAA,EAAM,SAAS,CAAA,CACvB,OAAA,CAAQ,MAAM,SAAS,CAAA,CACvB,QAAQ,IAAA,EAAM,SAAS,EACvB,OAAA,CAAQ,SAAA,EAAW,SAAS,CAAA,CAC5B,OAAA,CAAQ,WAAW,SAAS,CAAA;AACjC;;;ACRA,IAAM,eAAA,GAAkB,uBAAA;AAsCjB,SAAS,QAAQ,GAAA,EAAiC;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,GAAQ,MAAA,CAAA,IAAA,CAAwE,GAAA,GACpF,GACF,CAAA;AACA,IAAA,IAAI,MAAM,OAAO,IAAA;AAAA,EACnB,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA,OAAO,OAAO,OAAA,KAAY,WAAA,GAAc,OAAA,CAAQ,GAAA,GAAM,GAAG,CAAA,GAAI,MAAA;AAC/D;AAOO,SAAS,iBAAA,GAAgC;AAC9C,EAAA,MAAM,WAAW,qBAAA,EAAsB;AACvC,EAAA,MAAM,EAAE,OAAA,EAAS,SAAA,EAAW,SAAA,EAAW,WAAA,KAAgB,eAAA,EAAgB;AACvE,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,QAAA,CAAS,OAAA,IAAW,OAAA,CAAQ,cAAc,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMnD,eAAA,EACE,QAAA,CAAS,eAAA,IACT,OAAA,IACA,SAAA,KACC,mBAAA,CAAoB,WAAW,CAAA,GAAI,WAAA,GAAc,IAAA,CAAA,IAClD,OAAA,CAAQ,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EAAsB;AAClD,EAAA,MAAM,MAAM,WAAA,EAAY;AACxB,EAAA,IAAI,CAAC,GAAA,IAAO,CAAC,MAAA,EAAQ;AACrB,EAAA,IAAI;AACF,IAAA,GAAA,CAAI,IAAA,EAAM,YAAY,MAAM,CAAA;AAC5B,IAAA,GAAA,CAAI,GAAA,EAAK,SAAA,GAAY,iBAAA,EAAmB,MAAM,CAAA;AAG9C,IAAA,GAAA,CAAI,MAAA,EAAQ,GAAA,GAAM,oBAAA,EAAsB,MAAM,CAAA;AAAA,EAChD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"chunk-3FIWHGCZ.js","sourcesContent":["/**\n * Escape a JSON-stringified value for safe embedding inside an inline `<script>` body.\n *\n * The head injects script bodies raw, so a `</script>` inside partner-set data would break out\n * of the tag; U+2028/U+2029 are line terminators in JS but not in JSON, so they must go too.\n */\nexport function escapeForInlineScript(value: string): string {\n return value\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n","import { escapeForInlineScript } from './inline-script';\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore } from './cookies';\n\n/** Where `rootHead` publishes the SSR-resolved env for the browser bundle to read. */\nconst RUNTIME_ENV_KEY = '__SALLA_RUNTIME_ENV__';\n\n/** The env values that must agree between the SSR render and the hydrated client. */\nexport interface RuntimeEnv {\n /** Store API base — `VITE_API_URL`. */\n apiBase?: string;\n /** Store identifier — `VITE_STORE_DOMAIN`. */\n storeIdentifier?: string;\n /**\n * The theme-settings version the request named, if any.\n *\n * Published for the same reason `storeIdentifier` is: the dispatcher strips\n * `?versionId=` on the way in, so by the time the browser has the page its own\n * URL no longer says which version it is showing. Without this the hydrated\n * client would ask the API about the store's live version and quietly replace\n * the draft it was handed.\n *\n * Absent — not empty — when nothing named one, so it drops out of the inline\n * script entirely rather than publishing a value that means \"live\".\n */\n versionId?: string;\n /**\n * The store segment at the root of this page's paths, when the store is\n * addressed that way — see `resolveStoreBase`.\n *\n * Published because the browser's address is not always the URL the server\n * read: the dispatcher removes `?storeId=` from the request it forwards but not\n * from the address bar, and a URL carrying it is never read for a segment. The\n * client builds its router from this, and a router that disagreed with the\n * server about the root would hydrate a different page.\n */\n storeBase?: string;\n}\n\n/**\n * A build-time `import.meta.env` var, falling back to the worker's runtime `process.env`\n * (wrangler `vars`, exposed via the `nodejs_compat_populate_process_env` flag).\n */\nexport function readEnv(key: string): string | undefined {\n try {\n const vite = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.[\n key\n ];\n if (vite) return vite;\n } catch {\n /* import.meta.env not available in all environments */\n }\n return typeof process !== 'undefined' ? process.env?.[key] : undefined;\n}\n\n/**\n * What this runtime resolves from its own env — server-side that includes the worker vars.\n * Prefers what the server already published, so re-rendering the head during hydration yields\n * the same script instead of dropping it.\n */\nexport function resolveRuntimeEnv(): RuntimeEnv {\n const injected = getInjectedRuntimeEnv();\n const { storeId, storeBase, versionId, requestHost } = getRequestStore();\n return {\n apiBase: injected.apiBase || readEnv('VITE_API_URL'),\n // The request outranks the build-time var here for the same reason it does\n // in `resolveStoreIdentifier`, and this is the copy that reaches the\n // browser: publish the store SSR actually rendered, or hydration resolves\n // again from a URL whose `?storeId=` the dispatcher has already stripped and\n // queries a different store than the markup it is hydrating.\n storeIdentifier:\n injected.storeIdentifier ||\n storeId ||\n storeBase ||\n (hostIdentifiesStore(requestHost) ? requestHost : null) ||\n readEnv('VITE_STORE_DOMAIN'),\n // Absent rather than empty when the path named no store, so it drops out of\n // the inline script, like `versionId`.\n storeBase: injected.storeBase || storeBase || undefined,\n // No env fallback on purpose. A store identifier has one because a build can\n // legitimately be pinned to a store; a version is something a request asks\n // for, and a build-time default would make every visitor of every store see\n // whichever draft was current when the theme was compiled.\n versionId: injected.versionId || versionId || undefined,\n };\n}\n\n/**\n * The env the SSR worker resolved, as handed to the browser by `rootHead`. Empty on the server\n * and on a client whose head carried nothing.\n *\n * Worker `vars` are *runtime* env: they live in `process.env` on the server only, while\n * `import.meta.env` is substituted at build time. A bundle built without those vars therefore\n * sees `undefined` in the browser and silently falls back to the production defaults — SSR\n * would render off the configured backend while every post-hydration fetch hits another one.\n */\nexport function getInjectedRuntimeEnv(): RuntimeEnv {\n const holder = globalThis as typeof globalThis & { [RUNTIME_ENV_KEY]?: RuntimeEnv };\n return holder[RUNTIME_ENV_KEY] ?? {};\n}\n\n/**\n * Inline head `<script>` body publishing the server-resolved env, or null when there is nothing\n * to publish (no overrides configured — the defaults already agree on both sides).\n */\nexport function renderRuntimeEnvScript(env: RuntimeEnv = resolveRuntimeEnv()): string | null {\n const set = Object.entries(env).filter(([, value]) => Boolean(value));\n if (!set.length) return null;\n const json = escapeForInlineScript(JSON.stringify(Object.fromEntries(set)));\n return `window.${RUNTIME_ENV_KEY}=${json};`;\n}\n","/**\n * @fileoverview Which store to ask about — the one answer, in one place.\n *\n * This lived in two places once. `api/store.ts` learned to read the store a\n * request names, and `utils/sdk-helpers.ts` — the copy `api/client.ts` actually\n * sets the `store-identifier` header from — did not. So the resolver that had\n * been taught the answer was consulted for a null check and thrown away, every\n * outgoing request carried an empty identifier, the API answered\n * `422 Store Identifier not found`, and every published theme rendered\n * \"Store Unavailable\" while its tests passed: the client's suite mocked the\n * resolver, and the resolver's suite never went near a request.\n *\n * Hence one module, imported by both. If a third place ever needs a store\n * identifier, it imports this — a second implementation is the bug, not a\n * refactor away from it.\n *\n * See `docs/store-identity.md` for the full picture, including the security\n * boundary on who may name a store.\n */\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore, resolveRequestStoreBase } from './cookies';\nimport { getInjectedRuntimeEnv, readEnv } from './runtime-env';\nimport { storeBaseRedirectHref } from './store-base';\n\n/**\n * Which store to ask about, in the order the answers can be trusted.\n *\n * A deployed theme worker is published with **no vars and no bindings** — the\n * script metadata carries `main_module`, compatibility settings, assets and tags\n * and nothing else — so `VITE_STORE_DOMAIN` exists only where a build baked it\n * in, which is local development. In production this function used to reach the\n * end of that chain and return the empty string, `store.settings` refused to\n * call with no identifier, and the root loader threw \"Store Unavailable\" — a\n * theme that renders its own failure page for every visitor of every store.\n *\n * The order:\n *\n * 1. what the caller passed, which is always deliberate;\n * 2. the store this request names — the `?storeId=` a preview was opened with,\n * then the cookie remembering it — seeded by `twilightMiddleware`, and only\n * on a host permitted to name one;\n * 3. the store the first segment of the path names, on those same hosts — its\n * username, which the API accepts as an identifier as readily as an id (see\n * {@link resolveStoreBase});\n * 4. what SSR already resolved and published, so the hydrated client asks about\n * the same store the server rendered instead of resolving again from a URL\n * that no longer names it;\n * 5. the request's own host, which *is* the identity of a live storefront —\n * but only when that host is a storefront. `preview.salla.design` and\n * `localhost` serve many stores, so their names identify none;\n * 6. `VITE_STORE_DOMAIN`, last, because a build-time constant is a development\n * convenience and must never outrank what the request actually said.\n *\n * Steps 2 and 3 never both answer: a path that names a store takes the place of\n * the cookie, and a URL carrying `?storeId=` is not read for a path segment.\n */\nexport function resolveStoreIdentifier(explicit?: string): string {\n if (explicit) return explicit;\n\n const { storeId, requestHost } = getRequestStore();\n if (storeId) return storeId;\n\n const storeBase = resolveStoreBase();\n if (storeBase) return storeBase;\n\n const injected = getInjectedRuntimeEnv().storeIdentifier;\n if (injected) return injected;\n\n if (hostIdentifiesStore(requestHost)) return requestHost as string;\n\n // The browser's own address, for a client render that reached neither of the\n // above — a live storefront, where the host is the store.\n const browserHost = typeof window !== 'undefined' ? window.location.host : null;\n if (hostIdentifiesStore(browserHost)) return browserHost as string;\n\n return readEnv('VITE_STORE_DOMAIN') || readEnv('STORE_DOMAIN') || '';\n}\n\n/**\n * The store segment at the root of this page's paths, or null when the store is\n * not addressed that way.\n *\n * On the server it is what `twilightMiddleware` read off the request. In the\n * browser it is what SSR published, because the address bar is not always the\n * URL the server rendered: on the preview host the dispatcher removes\n * `?storeId=` from the request it forwards and leaves it in the browser's, and a\n * URL carrying `storeId` is never read for a segment. Re-reading\n * `window.location` would, for `/ar?storeId=…`, route the page under a different\n * store than the one it was rendered for.\n *\n * The address bar is read only when SSR published nothing at all: a page the dev\n * server answered with its client shell instead of a render, where there is no\n * server decision to agree with.\n */\nexport function resolveStoreBase(): string | null {\n const { storeBase } = getRequestStore();\n if (storeBase) return storeBase;\n if (typeof window === 'undefined') return null;\n\n const published = getInjectedRuntimeEnv();\n if (published.storeBase) return published.storeBase;\n if (Object.keys(published).length > 0) return null;\n\n return resolveRequestStoreBase(window.location.href, window.location.host);\n}\n\n/**\n * The address this page should be loaded from instead, when the store is the root\n * of every URL on this host and this request did not use it; null otherwise.\n *\n * @param username - the store's username, from the settings the request loaded\n * @param href - the router's own href for the page, without any store segment\n *\n * See `storeBaseRedirectHref` for the rules. The host is the request's on the\n * server and the browser's own in the browser, so the decision is gated the same\n * way on both sides.\n */\nexport function resolveStoreBaseRedirect(\n username: string | null | undefined,\n href: string\n): string | null {\n const host =\n getRequestStore().requestHost ?? (typeof window !== 'undefined' ? window.location.host : null);\n return storeBaseRedirectHref({ host, base: resolveStoreBase(), username, href });\n}\n","export type { StoreContext } from '../api/store';\nimport { resolveStoreIdentifier } from './store-identity';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Which store to ask the API about — see {@link resolveStoreIdentifier}.\n *\n * A delegation, not a second implementation. This name is the one on the wire\n * (`api/client.ts` sets the `store-identifier` header from it) and the one\n * themes import from `@salla.sa/twilight-theme-engine/utils`, so it stays; what\n * it must never do again is answer differently from the resolver everything\n * else asks. It had its own copy of the order once, missing the store the\n * request names and preferring the build-time `VITE_STORE_DOMAIN` that a\n * deployed worker does not have — so every published theme sent an empty\n * identifier and rendered \"Store Unavailable\".\n */\nexport function getStoreIdentifier(explicit?: string): string {\n return resolveStoreIdentifier(explicit);\n}\n\n/**\n * Get Salla SDK instance if available\n */\nexport function getSallaSDK(): typeof window.salla | undefined {\n if (!isBrowser) return undefined;\n return window.salla;\n}\n\n/**\n * Push the active route locale onto the Salla SDK.\n *\n * Why this is needed (and why it must run on every navigation):\n * - The SDK seeds its locale from `navigator.language` — the theme sets no `s-lang`\n * cookie or `window.locale` — so an English browser starts the SDK in `en` even on\n * an `/ar` store.\n * - The SDK fixes its axios `accept-language` header ONCE, at init. `salla.lang.setLocale`\n * only swaps UI translations (it never touches the header), and `salla.init()` is a\n * no-op after `Salla.status === 'ready'`, so the header never refreshes on its own.\n * - `profile::info.fetched` (login / profile refresh on navigation) overrides the header\n * to the *account's* language.\n *\n * Net result without this: `salla.api.*` calls (cart/product details) return data in the\n * wrong locale — e.g. English cart item names on `/ar/cart` — intermittently, depending on\n * load order and whether a profile fetch ran. Re-asserting the URL locale here keeps the\n * header correct. No-op on the server and until the SDK exposes the methods.\n */\nexport function syncSdkLocale(locale: string): void {\n const sdk = getSallaSDK();\n if (!sdk || !locale) return;\n try {\n sdk.lang?.setLocale?.(locale);\n sdk.api?.setHeader?.('accept-language', locale);\n // The localization modal swaps `/${user.language_code}/` in the URL on submit;\n // the SDK never sets this locally, so without it the switch reloads the same page.\n sdk.config?.set?.('user.language_code', locale);\n } catch {\n // SDK partially loaded — the header is re-asserted on the next navigation.\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/inline-script.ts","../src/utils/runtime-env.ts","../src/utils/store-identity.ts","../src/utils/sdk-helpers.ts"],"names":[],"mappings":";;;;AAMO,SAAS,sBAAsB,KAAA,EAAuB;AAC3D,EAAA,OAAO,MACJ,OAAA,CAAQ,IAAA,EAAM,SAAS,CAAA,CACvB,OAAA,CAAQ,MAAM,SAAS,CAAA,CACvB,QAAQ,IAAA,EAAM,SAAS,EACvB,OAAA,CAAQ,SAAA,EAAW,SAAS,CAAA,CAC5B,OAAA,CAAQ,WAAW,SAAS,CAAA;AACjC;;;ACRA,IAAM,eAAA,GAAkB,uBAAA;AAsCjB,SAAS,QAAQ,GAAA,EAAiC;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,GAAQ,MAAA,CAAA,IA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AAwB,MAAA,CAAO,QAAA,CAAS,IAAA,EAAM,MAAA,CAAO,SAAS,IAAI,CAAA;AAC3E;AAaO,SAAS,wBAAA,CACd,UACA,IAAA,EACe;AACf,EAAA,MAAM,IAAA,GACJ,iBAAgB,CAAE,WAAA,KAAgB,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,QAAA,CAAS,IAAA,GAAO,IAAA,CAAA;AAC3F,EAAA,OAAO,qBAAA,CAAsB,EAAE,IAAA,EAAM,IAAA,EAAM,kBAAiB,EAAG,QAAA,EAAU,MAAM,CAAA;AACjF;;;ACzHA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AAc7B,SAAS,mBAAmB,QAAA,EAA2B;AAC5D,EAAA,OAAO,uBAAuB,QAAQ,CAAA;AACxC;AAKO,SAAS,WAAA,GAA+C;AAC7D,EAAA,IAAI,CAAC,WAAW,OAAO,MAAA;AACvB,EAAA,OAAO,MAAA,CAAO,KAAA;AAChB;AAoBO,SAAS,cAAc,MAAA,EAAsB;AAClD,EAAA,MAAM,MAAM,WAAA,EAAY;AACxB,EAAA,IAAI,CAAC,GAAA,IAAO,CAAC,MAAA,EAAQ;AACrB,EAAA,IAAI;AACF,IAAA,GAAA,CAAI,IAAA,EAAM,YAAY,MAAM,CAAA;AAC5B,IAAA,GAAA,CAAI,GAAA,EAAK,SAAA,GAAY,iBAAA,EAAmB,MAAM,CAAA;AAG9C,IAAA,GAAA,CAAI,MAAA,EAAQ,GAAA,GAAM,oBAAA,EAAsB,MAAM,CAAA;AAAA,EAChD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"chunk-TX6ZP4FF.js","sourcesContent":["/**\n * Escape a JSON-stringified value for safe embedding inside an inline `<script>` body.\n *\n * The head injects script bodies raw, so a `</script>` inside partner-set data would break out\n * of the tag; U+2028/U+2029 are line terminators in JS but not in JSON, so they must go too.\n */\nexport function escapeForInlineScript(value: string): string {\n return value\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n","import { escapeForInlineScript } from './inline-script';\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore } from './cookies';\n\n/** Where `rootHead` publishes the SSR-resolved env for the browser bundle to read. */\nconst RUNTIME_ENV_KEY = '__SALLA_RUNTIME_ENV__';\n\n/** The env values that must agree between the SSR render and the hydrated client. */\nexport interface RuntimeEnv {\n /** Store API base — `VITE_API_URL`. */\n apiBase?: string;\n /** Store identifier — `VITE_STORE_DOMAIN`. */\n storeIdentifier?: string;\n /**\n * The theme-settings version the request named, if any.\n *\n * Published for the same reason `storeIdentifier` is: the dispatcher strips\n * `?versionId=` on the way in, so by the time the browser has the page its own\n * URL no longer says which version it is showing. Without this the hydrated\n * client would ask the API about the store's live version and quietly replace\n * the draft it was handed.\n *\n * Absent — not empty — when nothing named one, so it drops out of the inline\n * script entirely rather than publishing a value that means \"live\".\n */\n versionId?: string;\n /**\n * The store segment at the root of this page's paths, when the store is\n * addressed that way — see `resolveStoreBase`.\n *\n * Published because the browser's address is not always the URL the server\n * read: the dispatcher removes `?storeId=` from the request it forwards but not\n * from the address bar, and a URL carrying it is never read for a segment. The\n * client builds its router from this, and a router that disagreed with the\n * server about the root would hydrate a different page.\n */\n storeBase?: string;\n}\n\n/**\n * A build-time `import.meta.env` var, falling back to the worker's runtime `process.env`\n * (wrangler `vars`, exposed via the `nodejs_compat_populate_process_env` flag).\n */\nexport function readEnv(key: string): string | undefined {\n try {\n const vite = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.[\n key\n ];\n if (vite) return vite;\n } catch {\n /* import.meta.env not available in all environments */\n }\n return typeof process !== 'undefined' ? process.env?.[key] : undefined;\n}\n\n/**\n * What this runtime resolves from its own env — server-side that includes the worker vars.\n * Prefers what the server already published, so re-rendering the head during hydration yields\n * the same script instead of dropping it.\n */\nexport function resolveRuntimeEnv(): RuntimeEnv {\n const injected = getInjectedRuntimeEnv();\n const { storeId, storeBase, versionId, requestHost } = getRequestStore();\n return {\n apiBase: injected.apiBase || readEnv('VITE_API_URL'),\n // The request outranks the build-time var here for the same reason it does\n // in `resolveStoreIdentifier`, and this is the copy that reaches the\n // browser: publish the store SSR actually rendered, or hydration resolves\n // again from a URL whose `?storeId=` the dispatcher has already stripped and\n // queries a different store than the markup it is hydrating.\n storeIdentifier:\n injected.storeIdentifier ||\n storeId ||\n storeBase ||\n (hostIdentifiesStore(requestHost) ? requestHost : null) ||\n readEnv('VITE_STORE_DOMAIN'),\n // Absent rather than empty when the path named no store, so it drops out of\n // the inline script, like `versionId`.\n storeBase: injected.storeBase || storeBase || undefined,\n // No env fallback on purpose. A store identifier has one because a build can\n // legitimately be pinned to a store; a version is something a request asks\n // for, and a build-time default would make every visitor of every store see\n // whichever draft was current when the theme was compiled.\n versionId: injected.versionId || versionId || undefined,\n };\n}\n\n/**\n * The env the SSR worker resolved, as handed to the browser by `rootHead`. Empty on the server\n * and on a client whose head carried nothing.\n *\n * Worker `vars` are *runtime* env: they live in `process.env` on the server only, while\n * `import.meta.env` is substituted at build time. A bundle built without those vars therefore\n * sees `undefined` in the browser and silently falls back to the production defaults — SSR\n * would render off the configured backend while every post-hydration fetch hits another one.\n */\nexport function getInjectedRuntimeEnv(): RuntimeEnv {\n const holder = globalThis as typeof globalThis & { [RUNTIME_ENV_KEY]?: RuntimeEnv };\n return holder[RUNTIME_ENV_KEY] ?? {};\n}\n\n/**\n * Inline head `<script>` body publishing the server-resolved env, or null when there is nothing\n * to publish (no overrides configured — the defaults already agree on both sides).\n */\nexport function renderRuntimeEnvScript(env: RuntimeEnv = resolveRuntimeEnv()): string | null {\n const set = Object.entries(env).filter(([, value]) => Boolean(value));\n if (!set.length) return null;\n const json = escapeForInlineScript(JSON.stringify(Object.fromEntries(set)));\n return `window.${RUNTIME_ENV_KEY}=${json};`;\n}\n","/**\n * @fileoverview Which store to ask about — the one answer, in one place.\n *\n * This lived in two places once. `api/store.ts` learned to read the store a\n * request names, and `utils/sdk-helpers.ts` — the copy `api/client.ts` actually\n * sets the `store-identifier` header from — did not. So the resolver that had\n * been taught the answer was consulted for a null check and thrown away, every\n * outgoing request carried an empty identifier, the API answered\n * `422 Store Identifier not found`, and every published theme rendered\n * \"Store Unavailable\" while its tests passed: the client's suite mocked the\n * resolver, and the resolver's suite never went near a request.\n *\n * Hence one module, imported by both. If a third place ever needs a store\n * identifier, it imports this — a second implementation is the bug, not a\n * refactor away from it.\n *\n * See `docs/store-identity.md` for the full picture, including the security\n * boundary on who may name a store.\n */\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore, resolveRequestStoreBase } from './cookies';\nimport { getInjectedRuntimeEnv, readEnv } from './runtime-env';\nimport { storeBaseRedirectHref } from './store-base';\n\n/**\n * Which store to ask about, in the order the answers can be trusted.\n *\n * A deployed theme worker is published with **no vars and no bindings** — the\n * script metadata carries `main_module`, compatibility settings, assets and tags\n * and nothing else — so `VITE_STORE_DOMAIN` exists only where a build baked it\n * in, which is local development. In production this function used to reach the\n * end of that chain and return the empty string, `store.settings` refused to\n * call with no identifier, and the root loader threw \"Store Unavailable\" — a\n * theme that renders its own failure page for every visitor of every store.\n *\n * The order:\n *\n * 1. what the caller passed, which is always deliberate;\n * 2. the store this request names — the `?storeId=` a preview was opened with,\n * then the cookie remembering it — seeded by `twilightMiddleware`, and only\n * on a host permitted to name one;\n * 3. the store the first segment of the path names, on those same hosts — its\n * username, which the API accepts as an identifier as readily as an id (see\n * {@link resolveStoreBase});\n * 4. what SSR already resolved and published, so the hydrated client asks about\n * the same store the server rendered instead of resolving again from a URL\n * that no longer names it;\n * 5. the request's own host, which *is* the identity of a live storefront —\n * but only when that host is a storefront. `preview.salla.design` and\n * `localhost` serve many stores, so their names identify none;\n * 6. `VITE_STORE_DOMAIN`, last, because a build-time constant is a development\n * convenience and must never outrank what the request actually said.\n *\n * Steps 2 and 3 never both answer: a path that names a store takes the place of\n * the cookie, and a URL carrying `?storeId=` is not read for a path segment.\n */\nexport function resolveStoreIdentifier(explicit?: string): string {\n if (explicit) return explicit;\n\n const { storeId, requestHost } = getRequestStore();\n if (storeId) return storeId;\n\n const storeBase = resolveStoreBase();\n if (storeBase) return storeBase;\n\n const injected = getInjectedRuntimeEnv().storeIdentifier;\n if (injected) return injected;\n\n if (hostIdentifiesStore(requestHost)) return requestHost as string;\n\n // The browser's own address, for a client render that reached neither of the\n // above — a live storefront, where the host is the store.\n const browserHost = typeof window !== 'undefined' ? window.location.host : null;\n if (hostIdentifiesStore(browserHost)) return browserHost as string;\n\n return readEnv('VITE_STORE_DOMAIN') || readEnv('STORE_DOMAIN') || '';\n}\n\n/**\n * The store segment at the root of this page's paths, or null when the store is\n * not addressed that way.\n *\n * On the server it is what `twilightMiddleware` read off the request. In the\n * browser it is what SSR published, because the address bar is not always the\n * URL the server rendered: on the preview host the dispatcher removes\n * `?storeId=` from the request it forwards and leaves it in the browser's, and a\n * URL carrying `storeId` is never read for a segment. Re-reading\n * `window.location` would, for `/ar?storeId=…`, route the page under a different\n * store than the one it was rendered for.\n *\n * The address bar is read only when SSR published nothing at all: a page the dev\n * server answered with its client shell instead of a render, where there is no\n * server decision to agree with.\n */\nexport function resolveStoreBase(): string | null {\n const { storeBase } = getRequestStore();\n if (storeBase) return storeBase;\n if (typeof window === 'undefined') return null;\n\n const published = getInjectedRuntimeEnv();\n if (published.storeBase) return published.storeBase;\n if (Object.keys(published).length > 0) return null;\n\n return resolveRequestStoreBase(window.location.href, window.location.host);\n}\n\n/**\n * The address this page should be loaded from instead, when the store is the root\n * of every URL on this host and this request did not use it; null otherwise.\n *\n * @param username - the store's username, from the settings the request loaded\n * @param href - the router's own href for the page, without any store segment\n *\n * See `storeBaseRedirectHref` for the rules. The host is the request's on the\n * server and the browser's own in the browser, so the decision is gated the same\n * way on both sides.\n */\nexport function resolveStoreBaseRedirect(\n username: string | null | undefined,\n href: string\n): string | null {\n const host =\n getRequestStore().requestHost ?? (typeof window !== 'undefined' ? window.location.host : null);\n return storeBaseRedirectHref({ host, base: resolveStoreBase(), username, href });\n}\n","export type { StoreContext } from '../api/store';\nimport { resolveStoreIdentifier } from './store-identity';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Which store to ask the API about — see {@link resolveStoreIdentifier}.\n *\n * A delegation, not a second implementation. This name is the one on the wire\n * (`api/client.ts` sets the `store-identifier` header from it) and the one\n * themes import from `@salla.sa/twilight-theme-engine/utils`, so it stays; what\n * it must never do again is answer differently from the resolver everything\n * else asks. It had its own copy of the order once, missing the store the\n * request names and preferring the build-time `VITE_STORE_DOMAIN` that a\n * deployed worker does not have — so every published theme sent an empty\n * identifier and rendered \"Store Unavailable\".\n */\nexport function getStoreIdentifier(explicit?: string): string {\n return resolveStoreIdentifier(explicit);\n}\n\n/**\n * Get Salla SDK instance if available\n */\nexport function getSallaSDK(): typeof window.salla | undefined {\n if (!isBrowser) return undefined;\n return window.salla;\n}\n\n/**\n * Push the active route locale onto the Salla SDK.\n *\n * Why this is needed (and why it must run on every navigation):\n * - The SDK seeds its locale from `navigator.language` — the theme sets no `s-lang`\n * cookie or `window.locale` — so an English browser starts the SDK in `en` even on\n * an `/ar` store.\n * - The SDK fixes its axios `accept-language` header ONCE, at init. `salla.lang.setLocale`\n * only swaps UI translations (it never touches the header), and `salla.init()` is a\n * no-op after `Salla.status === 'ready'`, so the header never refreshes on its own.\n * - `profile::info.fetched` (login / profile refresh on navigation) overrides the header\n * to the *account's* language.\n *\n * Net result without this: `salla.api.*` calls (cart/product details) return data in the\n * wrong locale — e.g. English cart item names on `/ar/cart` — intermittently, depending on\n * load order and whether a profile fetch ran. Re-asserting the URL locale here keeps the\n * header correct. No-op on the server and until the SDK exposes the methods.\n */\nexport function syncSdkLocale(locale: string): void {\n const sdk = getSallaSDK();\n if (!sdk || !locale) return;\n try {\n sdk.lang?.setLocale?.(locale);\n sdk.api?.setHeader?.('accept-language', locale);\n // The localization modal swaps `/${user.language_code}/` in the URL on submit;\n // the SDK never sets this locally, so without it the switch reloads the same page.\n sdk.config?.set?.('user.language_code', locale);\n } catch {\n // SDK partially loaded — the header is re-asserted on the next navigation.\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { user } from './chunk-
|
|
2
|
-
import { getTwilightContext } from './chunk-
|
|
1
|
+
import { user } from './chunk-YSFWVMBA.js';
|
|
2
|
+
import { getTwilightContext } from './chunk-SOPK72TP.js';
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
function useUser() {
|
|
@@ -13,5 +13,5 @@ function useUser() {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { useUser };
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-UOALND7V.js.map
|
|
17
|
+
//# sourceMappingURL=chunk-UOALND7V.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useUser.ts"],"names":[],"mappings":";;;;AAUO,SAAS,OAAA,GAAyB;AACvC,EAAA,MAAM,KAAA,GAAQ,oBAAmB,CAAE,SAAA;AAEnC,EAAA,MAAM,QAAQ,QAAA,CAAS;AAAA,IACrB,GAAG,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACxB,OAAA,EAAS,CAAC,CAAC,KAAA;AAAA,IACX,eAAA,EAAiB;AAAA,GAClB,CAAA;AAED,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,UAAA,EAAY,CAAC,CAAC,KAAA,EAAM;AACzC","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useUser.ts"],"names":[],"mappings":";;;;AAUO,SAAS,OAAA,GAAyB;AACvC,EAAA,MAAM,KAAA,GAAQ,oBAAmB,CAAE,SAAA;AAEnC,EAAA,MAAM,QAAQ,QAAA,CAAS;AAAA,IACrB,GAAG,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACxB,OAAA,EAAS,CAAC,CAAC,KAAA;AAAA,IACX,eAAA,EAAiB;AAAA,GAClB,CAAA;AAED,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,UAAA,EAAY,CAAC,CAAC,KAAA,EAAM;AACzC","file":"chunk-UOALND7V.js","sourcesContent":["import { useQuery, type UseQueryResult } from '@tanstack/react-query';\nimport { getTwilightContext } from '../twilight/context';\nimport { user } from '../api/user';\nimport type { User } from '../types';\n\nexport type UseUserReturn = UseQueryResult<User | null> & {\n /** True when an auth token exists (regardless of query state). */\n isLoggedIn: boolean;\n};\n\nexport function useUser(): UseUserReturn {\n const token = getTwilightContext().authToken;\n\n const query = useQuery({\n ...user.queries.current(),\n enabled: !!token,\n placeholderData: null,\n });\n\n return { ...query, isLoggedIn: !!token };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { orThrow } from './chunk-
|
|
2
|
-
import { api } from './chunk-
|
|
1
|
+
import { orThrow } from './chunk-JDROOL5C.js';
|
|
2
|
+
import { api } from './chunk-F4MMWEII.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var page = {
|
|
@@ -17,5 +17,5 @@ var page = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export { page };
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-VO5ODVVL.js.map
|
|
21
|
+
//# sourceMappingURL=chunk-VO5ODVVL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/page.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,IAAA,EAAM,OAAO,IAAA,KAA2C;AACtD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,MAAA,EAAS,IAAI,CAAA,CAAE,CAAA,CAAE,IAAA,EAAgC;AAChF,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,IAAA,KAA2C,QAAQ,IAAA,CAAK,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,EAEhF,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,IAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,OAAA,EAAS,QAAA,EAAU,IAAI,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,IAAA,CAAK,IAAA,CAAK,IAAI;AAAA,KAC9B;AAAA;AAEP","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/api/page.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,IAAA,EAAM,OAAO,IAAA,KAA2C;AACtD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,MAAA,EAAS,IAAI,CAAA,CAAE,CAAA,CAAE,IAAA,EAAgC;AAChF,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,IAAA,KAA2C,QAAQ,IAAA,CAAK,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,EAEhF,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,IAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,OAAA,EAAS,QAAA,EAAU,IAAI,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,IAAA,CAAK,IAAA,CAAK,IAAI;AAAA,KAC9B;AAAA;AAEP","file":"chunk-VO5ODVVL.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { ApiPageResponse } from '../routes/page/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const page = {\n find: async (slug: string): Promise<ApiPageResponse> => {\n const { data } = await api.get(`pages/${slug}`).json<{ data: ApiPageResponse }>();\n return data;\n },\n\n findOrThrow: (slug: string): Promise<ApiPageResponse> => orThrow(page.find(slug)),\n\n queries: {\n detail: (slug: string) =>\n queryOptions({\n queryKey: ['pages', 'detail', slug],\n queryFn: () => page.find(slug),\n }),\n },\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { registry } from './chunk-342EPVXN.js';
|
|
2
|
-
import { useMoney, useNumber } from './chunk-
|
|
2
|
+
import { useMoney, useNumber } from './chunk-36PDYP56.js';
|
|
3
3
|
import { useAsset } from './chunk-Z653O7MX.js';
|
|
4
4
|
import { useWishlist } from './chunk-GBWCXUPD.js';
|
|
5
5
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
6
|
-
import { Image } from './chunk-
|
|
6
|
+
import { Image } from './chunk-JBNI5ZVG.js';
|
|
7
7
|
import { LazyImageModal } from './chunk-CUG6VOLM.js';
|
|
8
8
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
9
9
|
import { lazy, memo, useCallback, useMemo, useState, useEffect, Suspense } from 'react';
|
|
@@ -13,10 +13,10 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
13
13
|
import { SallaSlider } from '@salla.sa/twilight-components-react/slider';
|
|
14
14
|
|
|
15
15
|
var LazyProductDetails = lazy(
|
|
16
|
-
() => import('./ProductDetails-
|
|
16
|
+
() => import('./ProductDetails-AHYFTGM6.js').then((m) => ({ default: m.ProductDetails }))
|
|
17
17
|
);
|
|
18
18
|
var LazyAddToCartForm = lazy(
|
|
19
|
-
() => import('./AddToCartForm-
|
|
19
|
+
() => import('./AddToCartForm-MTD46H63.js').then((m) => ({ default: m.AddToCartForm }))
|
|
20
20
|
);
|
|
21
21
|
var PRODUCT_CARD_KEY = "product:card";
|
|
22
22
|
var PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600];
|
|
@@ -414,5 +414,5 @@ function ThumbSlide({ image, index }) {
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
export { LazyAddToCartForm, LazyProductDetails, ProductCard, ProductGallery };
|
|
417
|
-
//# sourceMappingURL=chunk-
|
|
418
|
-
//# sourceMappingURL=chunk-
|
|
417
|
+
//# sourceMappingURL=chunk-WFSOVIYU.js.map
|
|
418
|
+
//# sourceMappingURL=chunk-WFSOVIYU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/product/lazy.ts","../src/components/product/ProductCard.tsx","../src/components/product/ProductGallery.tsx"],"names":["ProductCardContent","ProductCard","jsxs","jsx","useMemo"],"mappings":";;;;;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,IAAA;AAAA,EAAK,MACrC,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE;AAEO,IAAM,iBAAA,GAAoB,IAAA;AAAA,EAAK,MACpC,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE;ACKA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAEvD,IAAM,mBAAA,GAAsB,+BAAA;AAE5B,IAAM,wBAAA,GAA2B,iCAAA;AAoCjC,IAAM,kBAAA,GAAqB,IAAA,CAAK,SAASA,mBAAAA,CAAmB;AAAA,EAC1D,OAAA;AAAA,EACA,MAAA,GAAS,UAAA;AAAA,EACT,SAAA,GAAY,EAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,YAAA,GAAe,KAAA;AAAA,EACf,gBAAA,GAAmB,KAAA;AAAA,EACnB,KAAA,GAAQ,CAAA;AAAA,EACR,aAAA,GAAgB,KAAA;AAAA,EAChB;AACF,CAAA,EAAqB;AACnB,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,QAAA,EAAS;AAC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,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,KAAK,KAAA,CAAM,GAAA;AAAA,UACX,GAAA,EAAK,MAAM,GAAA,IAAO,EAAA;AAAA,UAClB,SAAA,EAAU,mEAAA;AAAA,UACV,OAAO,KAAA,CAAM,GAAA;AAAA,UACb,UAAU,KAAA,GAAQ,CAAA;AAAA,UAClB,SAAA,EAAS;AAAA;AAAA;AACX;AAAA,GACF;AAEJ","file":"chunk-U43L4ZLH.js","sourcesContent":["import { lazy } from 'react';\n\nexport const LazyProductDetails = lazy(() =>\n import('./ProductDetails').then((m) => ({ default: m.ProductDetails }))\n);\n\nexport const LazyAddToCartForm = lazy(() =>\n import('./AddToCartForm').then((m) => ({ default: m.AddToCartForm }))\n);\n","import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(product.id);\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(product.id);\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n fitImageHeight && isVertical ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n","import { SallaSlider } from '@salla.sa/twilight-components-react/slider';\nimport { Suspense, useEffect, useMemo, useState } from 'react';\nimport { registry } from '../ComponentRegistry';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { Product, ProductImage } from '../../types';\nimport { Image } from '../common/Image';\nimport { ImageModal } from '../modal';\n\nconst PRODUCT_GALLERY_KEY = 'product:gallery';\n\nexport interface ProductGalleryProps {\n product: Product;\n}\n\ntype ImagePreview = { src: string; alt: string };\ntype GalleryMedia = { url: string; type: 'image' | 'video' | '3d-image' };\n\nfunction ProductGalleryContent({ product }: ProductGalleryProps) {\n const { t } = useTranslation();\n const { theme } = useTwilight();\n const sliderId = `details-slider-${product.id}`;\n const objectFit = theme.settings.slider_background_size ?? 'cover';\n\n // Clicking an image opens an in-app lightbox instead of navigating to the CDN URL.\n const [preview, setPreview] = useState<ImagePreview | null>(null);\n\n useEffect(() => {\n const raf = requestAnimationFrame(() => {\n const el = document.getElementById(sliderId);\n if (!el?.parentElement) return;\n const { parentElement, nextSibling } = el;\n parentElement.removeChild(el);\n parentElement.insertBefore(el, nextSibling);\n });\n return () => cancelAnimationFrame(raf);\n }, [sliderId]);\n\n // The product-details API only returns `image` (singular).\n // Fall back so the main image always renders even without the full gallery array.\n const images: ProductImage[] =\n product.images && product.images.length > 0\n ? product.images\n : product.image?.url\n ? [product.image]\n : [];\n\n const hasManyImages = images.length > 1;\n const nativeGallery = images.flatMap<GalleryMedia>((image) => {\n if (image.three_d_image_url) return [{ url: image.three_d_image_url, type: '3d-image' }];\n if (image.video_url) return [{ url: image.video_url, type: 'video' }];\n return image.url ? [{ url: image.url, type: 'image' }] : [];\n });\n const openNativeGallery = () => {\n if (!window.salla?.mobile?.isEnabled?.()) return false;\n window.salla.event.dispatch('mobile::gallery.open', { images: nativeGallery });\n return true;\n };\n\n return (\n <div className=\"sidebar md:sticky top-24 w-full md:!w-2/4 rtl:ml-8 ltr:mr-8 pb-8 md:pb-16 overflow-hidden shrink-0\">\n <SallaSlider\n id={sliderId}\n className=\"details-slider rounded-md image-slider\"\n type=\"thumbs\"\n loop={false}\n autoHeight\n listenToThumbnailsOption\n showThumbsControls={false}\n sliderConfig={{ watchOverflow: true, autoHeight: true }}\n >\n {product.promotion_title && (\n <div className=\"promotion-title\">{product.promotion_title}</div>\n )}\n\n {product.calories && (\n <div className=\"absolute z-[2] top-4 rtl:left-4 ltr:right-4 bg-white shadow-sm flex flex-col justify-center items-center rounded-full w-20 h-20 md:w-24 md:h-24\">\n <span className=\"text-red-500 text-xl leading-none font-bold\">{product.calories}</span>\n <span className=\"text-xs text-gray-500\">\n {t('pages.products.calories', 'Calories')}\n </span>\n </div>\n )}\n\n <div slot=\"items\">\n {images.map((image, index) => (\n <ImageSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n product={product}\n index={index}\n objectFit={objectFit}\n onPreview={setPreview}\n onNativeOpen={openNativeGallery}\n />\n ))}\n </div>\n\n {hasManyImages && (\n <div slot=\"thumbs\">\n {images.map((image, index) => (\n <ThumbSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n index={index}\n />\n ))}\n </div>\n )}\n </SallaSlider>\n\n <Suspense fallback={null}>\n <ImageModal\n isOpen={!!preview}\n onClose={() => setPreview(null)}\n src={preview?.src ?? ''}\n alt={preview?.alt}\n />\n </Suspense>\n </div>\n );\n}\n\nexport function ProductGallery(props: ProductGalleryProps) {\n const Component = useMemo(() => {\n const resolved = registry.resolve<ProductGalleryProps>(PRODUCT_GALLERY_KEY);\n // A theme that seeds the key with this component (register + override) would\n // otherwise recurse into itself when it has not actually overridden anything.\n return resolved === ProductGallery ? null : resolved;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductGalleryContent {...props} />;\n}\n\nfunction ImageSlide({\n image,\n product,\n index,\n objectFit,\n onPreview,\n onNativeOpen,\n}: {\n image: ProductImage;\n product: Product;\n index: number;\n objectFit: 'cover' | 'contain';\n onPreview: (preview: ImagePreview) => void;\n onNativeOpen: () => boolean;\n}) {\n const [loaded, setLoaded] = useState(false);\n const isVideo = Boolean(image.video_url);\n\n if (image.three_d_image_url) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: model-viewer is an interactive web component.\n <model-viewer\n style={{ minHeight: '500px' }}\n className=\"swiper-slide model-entry w-full h-full\"\n loading=\"lazy\"\n camera-controls\n touch-action=\"pan-y\"\n auto-rotate\n poster={image.url || undefined}\n src={image.three_d_image_url}\n shadow-intensity=\"1\"\n alt={image.alt}\n onClick={onNativeOpen}\n ></model-viewer>\n );\n }\n\n return (\n <a\n data-fslightbox={`product_${product.id}`}\n data-img-id={image.id}\n data-slid-index={index}\n {...(image.video_url ? { 'data-video-src': image.video_url } : {})}\n data-caption={image.alt}\n data-infinite=\"false\"\n data-type={image.video_url ? 'youtube' : 'image'}\n href={image.video_url || image.url}\n // FsLightbox isn't loaded in this React theme, so the bare href would leave the SPA.\n // Open images in an in-app lightbox; let videos open in a new tab.\n {...(isVideo ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n onClick={(event) => {\n if (onNativeOpen()) {\n event.preventDefault();\n return;\n }\n if (isVideo || !image.url) return;\n event.preventDefault();\n onPreview({ src: image.url, alt: image.alt || product.name });\n }}\n aria-label={product.name}\n className={`swiper-slide magnify-wrapper homeslider__slide ${image.video_url ? 'video-entry' : ''}`}\n >\n <div className={`w-full ${loaded ? '' : 'aspect-square bg-gray-100 animate-pulse'}`}>\n <Image\n id={String(image.id)}\n src={image.url}\n alt={image.alt || product.name}\n className={`h-full w-full object-${objectFit}`}\n aspectRatio=\"1/1\"\n priority={index === 0}\n noWrapper\n onLoad={() => setLoaded(true)}\n />\n </div>\n </a>\n );\n}\n\nfunction ThumbSlide({ image, index }: { image: ProductImage; index: number }) {\n return (\n <div\n className={`slide--one-fourth ${image.video_url ? 'video-entry' : ''} ${image.three_d_image_url ? 'model-entry' : ''}`}\n data-caption={image.alt}\n >\n <Image\n src={image.url}\n alt={image.alt || ''}\n className=\"object-cover w-full h-full bg-gray-100 rounded-md overflow-hidden\"\n title={image.alt}\n priority={index < 5}\n noWrapper\n />\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/product/lazy.ts","../src/components/product/ProductCard.tsx","../src/components/product/ProductGallery.tsx"],"names":["ProductCardContent","ProductCard","jsxs","jsx","useMemo"],"mappings":";;;;;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,IAAA;AAAA,EAAK,MACrC,OAAO,8BAAkB,CAAA,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AAAA,GAAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,EAAA,EAAI,MAAA,CAAO,KAAA,CAAM,EAAE,CAAA;AAAA,UACnB,KAAK,KAAA,CAAM,GAAA;AAAA,UACX,GAAA,EAAK,KAAA,CAAM,GAAA,IAAO,OAAA,CAAQ,IAAA;AAAA,UAC1B,SAAA,EAAW,wBAAwB,SAAS,CAAA,CAAA;AAAA,UAC5C,WAAA,EAAY,KAAA;AAAA,UACZ,UAAU,KAAA,KAAU,CAAA;AAAA,UACpB,SAAA,EAAS,IAAA;AAAA,UACT,MAAA,EAAQ,MAAM,SAAA,CAAU,IAAI;AAAA;AAAA,OAC9B,EACF;AAAA;AAAA,GACF;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,KAAA,EAAO,KAAA,EAAM,EAA2C;AAC5E,EAAA,uBACEA,GAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,CAAA,kBAAA,EAAqB,KAAA,CAAM,SAAA,GAAY,aAAA,GAAgB,EAAE,CAAA,CAAA,EAAI,KAAA,CAAM,iBAAA,GAAoB,aAAA,GAAgB,EAAE,CAAA,CAAA;AAAA,MACpH,gBAAc,KAAA,CAAM,GAAA;AAAA,MAEpB,QAAA,kBAAAA,GAAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,KAAK,KAAA,CAAM,GAAA;AAAA,UACX,GAAA,EAAK,MAAM,GAAA,IAAO,EAAA;AAAA,UAClB,SAAA,EAAU,mEAAA;AAAA,UACV,OAAO,KAAA,CAAM,GAAA;AAAA,UACb,UAAU,KAAA,GAAQ,CAAA;AAAA,UAClB,SAAA,EAAS;AAAA;AAAA;AACX;AAAA,GACF;AAEJ","file":"chunk-WFSOVIYU.js","sourcesContent":["import { lazy } from 'react';\n\nexport const LazyProductDetails = lazy(() =>\n import('./ProductDetails').then((m) => ({ default: m.ProductDetails }))\n);\n\nexport const LazyAddToCartForm = lazy(() =>\n import('./AddToCartForm').then((m) => ({ default: m.AddToCartForm }))\n);\n","import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(product.id);\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(product.id);\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n fitImageHeight && isVertical ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n","import { SallaSlider } from '@salla.sa/twilight-components-react/slider';\nimport { Suspense, useEffect, useMemo, useState } from 'react';\nimport { registry } from '../ComponentRegistry';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { Product, ProductImage } from '../../types';\nimport { Image } from '../common/Image';\nimport { ImageModal } from '../modal';\n\nconst PRODUCT_GALLERY_KEY = 'product:gallery';\n\nexport interface ProductGalleryProps {\n product: Product;\n}\n\ntype ImagePreview = { src: string; alt: string };\ntype GalleryMedia = { url: string; type: 'image' | 'video' | '3d-image' };\n\nfunction ProductGalleryContent({ product }: ProductGalleryProps) {\n const { t } = useTranslation();\n const { theme } = useTwilight();\n const sliderId = `details-slider-${product.id}`;\n const objectFit = theme.settings.slider_background_size ?? 'cover';\n\n // Clicking an image opens an in-app lightbox instead of navigating to the CDN URL.\n const [preview, setPreview] = useState<ImagePreview | null>(null);\n\n useEffect(() => {\n const raf = requestAnimationFrame(() => {\n const el = document.getElementById(sliderId);\n if (!el?.parentElement) return;\n const { parentElement, nextSibling } = el;\n parentElement.removeChild(el);\n parentElement.insertBefore(el, nextSibling);\n });\n return () => cancelAnimationFrame(raf);\n }, [sliderId]);\n\n // The product-details API only returns `image` (singular).\n // Fall back so the main image always renders even without the full gallery array.\n const images: ProductImage[] =\n product.images && product.images.length > 0\n ? product.images\n : product.image?.url\n ? [product.image]\n : [];\n\n const hasManyImages = images.length > 1;\n const nativeGallery = images.flatMap<GalleryMedia>((image) => {\n if (image.three_d_image_url) return [{ url: image.three_d_image_url, type: '3d-image' }];\n if (image.video_url) return [{ url: image.video_url, type: 'video' }];\n return image.url ? [{ url: image.url, type: 'image' }] : [];\n });\n const openNativeGallery = () => {\n if (!window.salla?.mobile?.isEnabled?.()) return false;\n window.salla.event.dispatch('mobile::gallery.open', { images: nativeGallery });\n return true;\n };\n\n return (\n <div className=\"sidebar md:sticky top-24 w-full md:!w-2/4 rtl:ml-8 ltr:mr-8 pb-8 md:pb-16 overflow-hidden shrink-0\">\n <SallaSlider\n id={sliderId}\n className=\"details-slider rounded-md image-slider\"\n type=\"thumbs\"\n loop={false}\n autoHeight\n listenToThumbnailsOption\n showThumbsControls={false}\n sliderConfig={{ watchOverflow: true, autoHeight: true }}\n >\n {product.promotion_title && (\n <div className=\"promotion-title\">{product.promotion_title}</div>\n )}\n\n {product.calories && (\n <div className=\"absolute z-[2] top-4 rtl:left-4 ltr:right-4 bg-white shadow-sm flex flex-col justify-center items-center rounded-full w-20 h-20 md:w-24 md:h-24\">\n <span className=\"text-red-500 text-xl leading-none font-bold\">{product.calories}</span>\n <span className=\"text-xs text-gray-500\">\n {t('pages.products.calories', 'Calories')}\n </span>\n </div>\n )}\n\n <div slot=\"items\">\n {images.map((image, index) => (\n <ImageSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n product={product}\n index={index}\n objectFit={objectFit}\n onPreview={setPreview}\n onNativeOpen={openNativeGallery}\n />\n ))}\n </div>\n\n {hasManyImages && (\n <div slot=\"thumbs\">\n {images.map((image, index) => (\n <ThumbSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n index={index}\n />\n ))}\n </div>\n )}\n </SallaSlider>\n\n <Suspense fallback={null}>\n <ImageModal\n isOpen={!!preview}\n onClose={() => setPreview(null)}\n src={preview?.src ?? ''}\n alt={preview?.alt}\n />\n </Suspense>\n </div>\n );\n}\n\nexport function ProductGallery(props: ProductGalleryProps) {\n const Component = useMemo(() => {\n const resolved = registry.resolve<ProductGalleryProps>(PRODUCT_GALLERY_KEY);\n // A theme that seeds the key with this component (register + override) would\n // otherwise recurse into itself when it has not actually overridden anything.\n return resolved === ProductGallery ? null : resolved;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductGalleryContent {...props} />;\n}\n\nfunction ImageSlide({\n image,\n product,\n index,\n objectFit,\n onPreview,\n onNativeOpen,\n}: {\n image: ProductImage;\n product: Product;\n index: number;\n objectFit: 'cover' | 'contain';\n onPreview: (preview: ImagePreview) => void;\n onNativeOpen: () => boolean;\n}) {\n const [loaded, setLoaded] = useState(false);\n const isVideo = Boolean(image.video_url);\n\n if (image.three_d_image_url) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: model-viewer is an interactive web component.\n <model-viewer\n style={{ minHeight: '500px' }}\n className=\"swiper-slide model-entry w-full h-full\"\n loading=\"lazy\"\n camera-controls\n touch-action=\"pan-y\"\n auto-rotate\n poster={image.url || undefined}\n src={image.three_d_image_url}\n shadow-intensity=\"1\"\n alt={image.alt}\n onClick={onNativeOpen}\n ></model-viewer>\n );\n }\n\n return (\n <a\n data-fslightbox={`product_${product.id}`}\n data-img-id={image.id}\n data-slid-index={index}\n {...(image.video_url ? { 'data-video-src': image.video_url } : {})}\n data-caption={image.alt}\n data-infinite=\"false\"\n data-type={image.video_url ? 'youtube' : 'image'}\n href={image.video_url || image.url}\n // FsLightbox isn't loaded in this React theme, so the bare href would leave the SPA.\n // Open images in an in-app lightbox; let videos open in a new tab.\n {...(isVideo ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n onClick={(event) => {\n if (onNativeOpen()) {\n event.preventDefault();\n return;\n }\n if (isVideo || !image.url) return;\n event.preventDefault();\n onPreview({ src: image.url, alt: image.alt || product.name });\n }}\n aria-label={product.name}\n className={`swiper-slide magnify-wrapper homeslider__slide ${image.video_url ? 'video-entry' : ''}`}\n >\n <div className={`w-full ${loaded ? '' : 'aspect-square bg-gray-100 animate-pulse'}`}>\n <Image\n id={String(image.id)}\n src={image.url}\n alt={image.alt || product.name}\n className={`h-full w-full object-${objectFit}`}\n aspectRatio=\"1/1\"\n priority={index === 0}\n noWrapper\n onLoad={() => setLoaded(true)}\n />\n </div>\n </a>\n );\n}\n\nfunction ThumbSlide({ image, index }: { image: ProductImage; index: number }) {\n return (\n <div\n className={`slide--one-fourth ${image.video_url ? 'video-entry' : ''} ${image.three_d_image_url ? 'model-entry' : ''}`}\n data-caption={image.alt}\n >\n <Image\n src={image.url}\n alt={image.alt || ''}\n className=\"object-cover w-full h-full bg-gray-100 rounded-md overflow-hidden\"\n title={image.alt}\n priority={index < 5}\n noWrapper\n />\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasTwilightSettings, updateTwilightContext, getTwilightContext, SettingsError } from './chunk-
|
|
1
|
+
import { hasTwilightSettings, updateTwilightContext, getTwilightContext, SettingsError } from './chunk-SOPK72TP.js';
|
|
2
2
|
|
|
3
3
|
// src/twilight/ensure-context.ts
|
|
4
4
|
function readSettings(source) {
|
|
@@ -123,5 +123,5 @@ function withHead(route, extend) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
export { ensureTwilightContextFromMatches, tanstackHeadAdapter, withHead };
|
|
126
|
-
//# sourceMappingURL=chunk-
|
|
127
|
-
//# sourceMappingURL=chunk-
|
|
126
|
+
//# sourceMappingURL=chunk-WIAPOLEA.js.map
|
|
127
|
+
//# sourceMappingURL=chunk-WIAPOLEA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/twilight/ensure-context.ts","../src/tanstack/head.ts"],"names":[],"mappings":";;;AAiBA,SAAS,aAAa,MAAA,EAAuE;AAC3F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AO,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-4D44TJ72.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;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,EAA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A,IAAa,EAAC,EAAG;AAC3C,IAAA,OAAA,CAAQ,IAAA,CAAK,EAAE,IAAA,EAAM,WAAA,EAAa,UAAU,IAAA,CAAK,SAAA,CAAU,EAAE,CAAA,EAAG,CAAA;AAAA,EAClE;AACA,EAAA,KAAA,MAAW,KAAK,UAAA,CAAW,OAAA,IAAW,EAAC,EAAG,OAAA,CAAQ,KAAK,CAAC,CAAA;AAExD,EAAA,OAAO,EAAE,IAAA,EAAM,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,8 +1,8 @@
|
|
|
1
|
-
import { order } from './chunk-
|
|
1
|
+
import { order } from './chunk-YJJZN5UP.js';
|
|
2
2
|
import { buildHreflangAlternates } from './chunk-TZ3E5BN4.js';
|
|
3
|
-
import { orUnauthorized } from './chunk-
|
|
3
|
+
import { orUnauthorized } from './chunk-JDROOL5C.js';
|
|
4
4
|
import { RouteId } from './chunk-TFB3QXYH.js';
|
|
5
|
-
import { getTwilightContext } from './chunk-
|
|
5
|
+
import { getTwilightContext } from './chunk-SOPK72TP.js';
|
|
6
6
|
import { lazy } from 'react';
|
|
7
7
|
|
|
8
8
|
// src/routes/account/orders/loader.ts
|
|
@@ -48,9 +48,9 @@ async function orderSingleLoader({
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// src/routes/account/orders/index.tsx
|
|
51
|
-
var LazyOrdersPage = lazy(() => import('./OrdersPage-
|
|
51
|
+
var LazyOrdersPage = lazy(() => import('./OrdersPage-O2LSXL4W.js').then((m) => ({ default: m.OrdersPage })));
|
|
52
52
|
var LazyOrderSinglePage = lazy(
|
|
53
|
-
() => import('./OrderSinglePage-
|
|
53
|
+
() => import('./OrderSinglePage-NCQR6ADR.js').then((m) => ({ default: m.OrderSinglePage }))
|
|
54
54
|
);
|
|
55
55
|
var OrdersPage = LazyOrdersPage;
|
|
56
56
|
var OrderSinglePage = LazyOrderSinglePage;
|
|
@@ -102,5 +102,5 @@ var OrderSingle = {
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
export { OrderSingle, OrderSinglePage, Orders, OrdersPage, orderSingleLoader, ordersLoader };
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
//# sourceMappingURL=chunk-XDB2POG3.js.map
|
|
106
|
+
//# sourceMappingURL=chunk-XDB2POG3.js.map
|