@salla.sa/twilight-theme-engine 1.0.45 → 1.0.47
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-QBPE4QIU.js → AddToCartForm-NICDUAS3.js} +3 -3
- package/dist/{AddToCartForm-QBPE4QIU.js.map → AddToCartForm-NICDUAS3.js.map} +1 -1
- package/dist/{BlogAuthorPage-X3I7KLML.js → BlogAuthorPage-NKPS4CQ2.js} +16 -15
- package/dist/BlogAuthorPage-NKPS4CQ2.js.map +1 -0
- package/dist/{BlogCategoryPage-F3ORUZAF.js → BlogCategoryPage-FSCFBS36.js} +16 -15
- package/dist/BlogCategoryPage-FSCFBS36.js.map +1 -0
- package/dist/{BlogPage-G7AOQDP2.js → BlogPage-OZTHYA3G.js} +14 -13
- package/dist/BlogPage-OZTHYA3G.js.map +1 -0
- package/dist/{BlogSinglePage-VP4ZLQPA.js → BlogSinglePage-KC67IUL7.js} +14 -13
- package/dist/BlogSinglePage-KC67IUL7.js.map +1 -0
- package/dist/{BlogTagPage-WCHB3VL2.js → BlogTagPage-N7JLIRKV.js} +16 -15
- package/dist/BlogTagPage-N7JLIRKV.js.map +1 -0
- package/dist/{BrandsPage-MR3RNHNS.js → BrandsPage-5SC62L6S.js} +14 -13
- package/dist/BrandsPage-5SC62L6S.js.map +1 -0
- package/dist/{Breadcrumb-QCWPUUEQ.js → Breadcrumb-W64WMO56.js} +14 -13
- package/dist/Breadcrumb-W64WMO56.js.map +1 -0
- package/dist/{CartItem-M2FEFI23.js → CartItem-UOVSSW5O.js} +14 -13
- package/dist/CartItem-UOVSSW5O.js.map +1 -0
- package/dist/{CartSummary-RND3CQYW.js → CartSummary-4V3L56U7.js} +14 -13
- package/dist/CartSummary-4V3L56U7.js.map +1 -0
- package/dist/{Copyright-YVUGHPR6.js → Copyright-OCQCOUFS.js} +3 -3
- package/dist/{Copyright-YVUGHPR6.js.map → Copyright-OCQCOUFS.js.map} +1 -1
- package/dist/{CustomerLayout-B7HTCSMV.js → CustomerLayout-PLJTAXCP.js} +14 -13
- package/dist/CustomerLayout-PLJTAXCP.js.map +1 -0
- package/dist/{Footer-JOBYWULB.js → Footer-QD7ASWFT.js} +14 -13
- package/dist/{Footer-JOBYWULB.js.map → Footer-QD7ASWFT.js.map} +1 -1
- package/dist/{Header-TE35DMNI.js → Header-M5GOR6XZ.js} +7 -6
- package/dist/{Header-TE35DMNI.js.map → Header-M5GOR6XZ.js.map} +1 -1
- package/dist/{LoyaltyPage-26NMNBJV.js → LoyaltyPage-C7FKYLIW.js} +15 -14
- package/dist/LoyaltyPage-C7FKYLIW.js.map +1 -0
- package/dist/{MainMenu-4ZZEDUBZ.js → MainMenu-MMAYRKYE.js} +8 -7
- package/dist/MainMenu-MMAYRKYE.js.map +1 -0
- package/dist/{MasterLayout-AELGECHE.js → MasterLayout-SCTQ42ID.js} +14 -13
- package/dist/{MasterLayout-AELGECHE.js.map → MasterLayout-SCTQ42ID.js.map} +1 -1
- package/dist/{MobileMenu-GFEOQWO6.js → MobileMenu-J34MVD6W.js} +15 -14
- package/dist/MobileMenu-J34MVD6W.js.map +1 -0
- package/dist/{NotificationsPage-226QGY4Q.js → NotificationsPage-KF6AIPK3.js} +14 -13
- package/dist/NotificationsPage-KF6AIPK3.js.map +1 -0
- package/dist/{OrderSinglePage-44VBTQQS.js → OrderSinglePage-LP7FUHKL.js} +18 -16
- package/dist/OrderSinglePage-LP7FUHKL.js.map +1 -0
- package/dist/{OrdersPage-NUQUDEAK.js → OrdersPage-A3K5BDBZ.js} +15 -14
- package/dist/OrdersPage-A3K5BDBZ.js.map +1 -0
- package/dist/{PageSingle-76O4HAYZ.js → PageSingle-FHHC5QDA.js} +3 -3
- package/dist/{PageSingle-76O4HAYZ.js.map → PageSingle-FHHC5QDA.js.map} +1 -1
- package/dist/{ProductDetails-WTXNHY2S.js → ProductDetails-AF3I5FQQ.js} +3 -3
- package/dist/{ProductDetails-WTXNHY2S.js.map → ProductDetails-AF3I5FQQ.js.map} +1 -1
- package/dist/{ProfilePage-K7ZEU6IF.js → ProfilePage-RXQIUTU4.js} +14 -13
- package/dist/ProfilePage-RXQIUTU4.js.map +1 -0
- package/dist/{SeoCartWidget-6LY5YQKA.js → SeoCartWidget-72U3UQKH.js} +14 -13
- package/dist/SeoCartWidget-72U3UQKH.js.map +1 -0
- package/dist/{SettingsPage-NDZAS5PQ.js → SettingsPage-65CZ2LNG.js} +14 -13
- package/dist/SettingsPage-65CZ2LNG.js.map +1 -0
- package/dist/{StoreClosedNotification-CU2OVCIG.js → StoreClosedNotification-4KJVEGPE.js} +15 -14
- package/dist/{StoreClosedNotification-CU2OVCIG.js.map → StoreClosedNotification-4KJVEGPE.js.map} +1 -1
- package/dist/{TestimonialsPage-ICQGRIXS.js → TestimonialsPage-NGCHKB4F.js} +3 -3
- package/dist/{TestimonialsPage-ICQGRIXS.js.map → TestimonialsPage-NGCHKB4F.js.map} +1 -1
- package/dist/{ThankYouPage-WIHRO3DC.js → ThankYouPage-A7IWCMXJ.js} +14 -13
- package/dist/ThankYouPage-A7IWCMXJ.js.map +1 -0
- package/dist/{WalletPage-YD4TKPGA.js → WalletPage-FNGL7Z3Z.js} +15 -14
- package/dist/WalletPage-FNGL7Z3Z.js.map +1 -0
- package/dist/{WishlistPage-3UNTMS2B.js → WishlistPage-KDLBETWD.js} +16 -15
- package/dist/WishlistPage-KDLBETWD.js.map +1 -0
- package/dist/api/apps.js +5 -4
- package/dist/api/brands.js +6 -5
- package/dist/api/cart.js +6 -5
- package/dist/api/category.js +6 -5
- package/dist/api/client.js +4 -3
- package/dist/api/home.js +5 -4
- package/dist/api/loyalty.js +6 -5
- package/dist/api/menu.js +5 -4
- package/dist/api/notification.js +5 -4
- package/dist/api/order.js +6 -5
- package/dist/api/page.js +6 -5
- package/dist/api/product.js +6 -5
- package/dist/api/profile.js +4 -3
- package/dist/api/profile.js.map +1 -1
- package/dist/api/store.js +5 -4
- package/dist/api/translations.js +5 -4
- package/dist/api/user.js +5 -4
- package/dist/api/wishlist.js +7 -6
- package/dist/chunk-3FIWHGCZ.js +101 -0
- package/dist/chunk-3FIWHGCZ.js.map +1 -0
- package/dist/{chunk-E5EH32L7.js → chunk-3MHDV5JS.js} +3 -3
- package/dist/{chunk-E5EH32L7.js.map → chunk-3MHDV5JS.js.map} +1 -1
- package/dist/{chunk-KOZYZQH4.js → chunk-3XIITSKM.js} +4 -4
- package/dist/{chunk-KOZYZQH4.js.map → chunk-3XIITSKM.js.map} +1 -1
- package/dist/{chunk-5TRRUV7N.js → chunk-4D44TJ72.js} +3 -3
- package/dist/{chunk-5TRRUV7N.js.map → chunk-4D44TJ72.js.map} +1 -1
- package/dist/{chunk-UWWYR3UX.js → chunk-65Z2ZDKZ.js} +6 -6
- package/dist/{chunk-UWWYR3UX.js.map → chunk-65Z2ZDKZ.js.map} +1 -1
- package/dist/{chunk-AGT5BKY4.js → chunk-AVPIY3Y4.js} +7 -7
- package/dist/{chunk-AGT5BKY4.js.map → chunk-AVPIY3Y4.js.map} +1 -1
- package/dist/{chunk-XLJPUFN4.js → chunk-CPQXPECC.js} +5 -5
- package/dist/{chunk-XLJPUFN4.js.map → chunk-CPQXPECC.js.map} +1 -1
- package/dist/{chunk-PNXUBS5X.js → chunk-DTWFNS3F.js} +16 -15
- package/dist/chunk-DTWFNS3F.js.map +1 -0
- package/dist/{chunk-ZNWNJZSM.js → chunk-EMKO3C2V.js} +4 -4
- package/dist/{chunk-ZNWNJZSM.js.map → chunk-EMKO3C2V.js.map} +1 -1
- package/dist/{chunk-KFH3OBFW.js → chunk-GXNQX4Z2.js} +4 -4
- package/dist/{chunk-KFH3OBFW.js.map → chunk-GXNQX4Z2.js.map} +1 -1
- package/dist/chunk-HNSZ6VBK.js +14 -0
- package/dist/{chunk-I2UBYEUG.js.map → chunk-HNSZ6VBK.js.map} +1 -1
- package/dist/{chunk-TMR7TZMB.js → chunk-ICNOLZNT.js} +4 -4
- package/dist/{chunk-TMR7TZMB.js.map → chunk-ICNOLZNT.js.map} +1 -1
- package/dist/{chunk-2AGMXJVP.js → chunk-IH3TQ3LD.js} +4 -4
- package/dist/{chunk-2AGMXJVP.js.map → chunk-IH3TQ3LD.js.map} +1 -1
- package/dist/{chunk-6KI2QCPL.js → chunk-JD4J2ZB6.js} +3 -3
- package/dist/{chunk-6KI2QCPL.js.map → chunk-JD4J2ZB6.js.map} +1 -1
- package/dist/{chunk-NX6BEOXW.js → chunk-JEJR23P4.js} +4 -4
- package/dist/{chunk-NX6BEOXW.js.map → chunk-JEJR23P4.js.map} +1 -1
- package/dist/{chunk-XLGVT7QF.js → chunk-JK77XRXR.js} +13 -9
- package/dist/chunk-JK77XRXR.js.map +1 -0
- package/dist/{chunk-XTOXFAP7.js → chunk-KT2MUSRN.js} +3 -3
- package/dist/{chunk-XTOXFAP7.js.map → chunk-KT2MUSRN.js.map} +1 -1
- package/dist/{chunk-ME727LL4.js → chunk-KV5R4LKM.js} +3 -3
- package/dist/{chunk-ME727LL4.js.map → chunk-KV5R4LKM.js.map} +1 -1
- package/dist/{chunk-3644MRQI.js → chunk-L42W6YS3.js} +5 -5
- package/dist/{chunk-3644MRQI.js.map → chunk-L42W6YS3.js.map} +1 -1
- package/dist/{chunk-G6F5DCCP.js → chunk-LKBWIN26.js} +3 -3
- package/dist/{chunk-G6F5DCCP.js.map → chunk-LKBWIN26.js.map} +1 -1
- package/dist/{chunk-CCCKRNO4.js → chunk-MENDTTOA.js} +3 -3
- package/dist/{chunk-CCCKRNO4.js.map → chunk-MENDTTOA.js.map} +1 -1
- package/dist/{chunk-AZ5HAIYQ.js → chunk-O6XXHXC4.js} +5 -4
- package/dist/chunk-O6XXHXC4.js.map +1 -0
- package/dist/{chunk-2TEGEKIQ.js → chunk-OKP6LUT7.js} +4 -4
- package/dist/{chunk-2TEGEKIQ.js.map → chunk-OKP6LUT7.js.map} +1 -1
- package/dist/{chunk-QG2Q6HB5.js → chunk-P4DUWQU4.js} +3 -3
- package/dist/{chunk-QG2Q6HB5.js.map → chunk-P4DUWQU4.js.map} +1 -1
- package/dist/{chunk-6XWMNQ52.js → chunk-PJWFEMBX.js} +15 -4
- package/dist/chunk-PJWFEMBX.js.map +1 -0
- package/dist/{chunk-OGGWNPF3.js → chunk-PZL3JWM2.js} +3 -3
- package/dist/{chunk-OGGWNPF3.js.map → chunk-PZL3JWM2.js.map} +1 -1
- package/dist/{chunk-6MGDRMZM.js → chunk-QKIQ3K24.js} +4 -4
- package/dist/{chunk-6MGDRMZM.js.map → chunk-QKIQ3K24.js.map} +1 -1
- package/dist/{chunk-BWIESZJK.js → chunk-QUUSMVCP.js} +3 -3
- package/dist/{chunk-BWIESZJK.js.map → chunk-QUUSMVCP.js.map} +1 -1
- package/dist/{chunk-MLIJWD6B.js → chunk-QVPMWMPP.js} +35 -14
- package/dist/chunk-QVPMWMPP.js.map +1 -0
- package/dist/{chunk-X26WB7AG.js → chunk-R6M6RM6U.js} +3 -3
- package/dist/{chunk-X26WB7AG.js.map → chunk-R6M6RM6U.js.map} +1 -1
- package/dist/{chunk-J5J64BAN.js → chunk-U325BK62.js} +4 -4
- package/dist/{chunk-J5J64BAN.js.map → chunk-U325BK62.js.map} +1 -1
- package/dist/{chunk-G4M73JU5.js → chunk-UQRLBMIO.js} +6 -6
- package/dist/{chunk-G4M73JU5.js.map → chunk-UQRLBMIO.js.map} +1 -1
- package/dist/{chunk-RBISDOPR.js → chunk-UV5BRJH4.js} +4 -4
- package/dist/{chunk-RBISDOPR.js.map → chunk-UV5BRJH4.js.map} +1 -1
- package/dist/{chunk-ULQMJUO2.js → chunk-WHOWSSX4.js} +4 -4
- package/dist/{chunk-ULQMJUO2.js.map → chunk-WHOWSSX4.js.map} +1 -1
- package/dist/{chunk-CG3AM4DH.js → chunk-WITIL2MK.js} +5 -5
- package/dist/{chunk-CG3AM4DH.js.map → chunk-WITIL2MK.js.map} +1 -1
- package/dist/{chunk-QIC6DSWU.js → chunk-WL5CWJVZ.js} +4 -4
- package/dist/{chunk-QIC6DSWU.js.map → chunk-WL5CWJVZ.js.map} +1 -1
- package/dist/{chunk-2KZORZZN.js → chunk-WMSOSA74.js} +5 -5
- package/dist/{chunk-2KZORZZN.js.map → chunk-WMSOSA74.js.map} +1 -1
- package/dist/{chunk-JBXTU5NM.js → chunk-XTMHHLNK.js} +62 -78
- package/dist/chunk-XTMHHLNK.js.map +1 -0
- package/dist/{chunk-RIZOT5FN.js → chunk-Z74NUTEI.js} +3 -3
- package/dist/{chunk-RIZOT5FN.js.map → chunk-Z74NUTEI.js.map} +1 -1
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +12 -11
- package/dist/components/home/index.js +15 -14
- package/dist/components/layout/index.js +5 -5
- package/dist/components/product/index.js +13 -12
- package/dist/components/store/index.js +14 -13
- package/dist/components/store/index.js.map +1 -1
- package/dist/document-class-IESLLQCD.js +26 -0
- package/dist/{document-class-G34XZMVK.js.map → document-class-IESLLQCD.js.map} +1 -1
- package/dist/hooks/index.js +12 -11
- package/dist/hooks/useGtm.js +12 -11
- package/dist/hooks/useMoney.js +12 -11
- package/dist/hooks/useStore.js +12 -11
- package/dist/hooks/useUser.js +6 -5
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/{navigation-D7QS3NK2.js → navigation-BCTD7TIG.js} +5 -4
- package/dist/navigation-BCTD7TIG.js.map +1 -0
- package/dist/{navigation-DQNNT2LY.js → navigation-DF2RT7D6.js} +6 -5
- package/dist/{navigation-DQNNT2LY.js.map → navigation-DF2RT7D6.js.map} +1 -1
- package/dist/{not-found-6PX2EO7T.js → not-found-3OWRDBD3.js} +14 -13
- package/dist/not-found-3OWRDBD3.js.map +1 -0
- package/dist/providers/NavigationProvider.d.ts +9 -2
- package/dist/providers/NavigationProvider.d.ts.map +1 -1
- package/dist/providers/index.js +12 -11
- package/dist/routes/account/orders/OrderSinglePage.d.ts.map +1 -1
- package/dist/routes/account/orders.js +7 -6
- package/dist/routes/account.js +16 -15
- package/dist/routes/account.js.map +1 -1
- package/dist/routes/blog.js +11 -10
- package/dist/routes/blog.js.map +1 -1
- package/dist/routes/brands.js +7 -6
- package/dist/routes/brands.js.map +1 -1
- package/dist/routes/cart.js +20 -19
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home.js +17 -16
- package/dist/routes/index.js +4 -3
- package/dist/routes/loyalty.js +7 -6
- package/dist/routes/loyalty.js.map +1 -1
- package/dist/routes/page.js +7 -6
- package/dist/routes/page.js.map +1 -1
- package/dist/routes/product-listing/ProductListPage.d.ts.map +1 -1
- package/dist/routes/product-listing.js +22 -21
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +15 -14
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/root/beforeLoad.d.ts.map +1 -1
- package/dist/routes/seo-redirects.js +4 -3
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +7 -6
- package/dist/routes/thank-you.js.map +1 -1
- package/dist/skeleton.js +17 -16
- package/dist/tanstack/middleware/twilight.d.ts.map +1 -1
- package/dist/tanstack/router.d.ts.map +1 -1
- package/dist/tanstack/store-base.d.ts +20 -0
- package/dist/tanstack/store-base.d.ts.map +1 -0
- package/dist/tanstack.js +18 -17
- package/dist/tanstack.js.map +1 -1
- package/dist/twilight/context.d.ts +10 -0
- package/dist/twilight/context.d.ts.map +1 -1
- package/dist/utils/cookies.d.ts +56 -0
- package/dist/utils/cookies.d.ts.map +1 -1
- package/dist/utils/index.js +5 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/runtime-env.d.ts +11 -0
- package/dist/utils/runtime-env.d.ts.map +1 -1
- package/dist/utils/store-base.d.ts +62 -0
- package/dist/utils/store-base.d.ts.map +1 -0
- package/dist/utils/store-identity.d.ts +38 -3
- package/dist/utils/store-identity.d.ts.map +1 -1
- package/dist/vite/index.js +2 -2
- package/package.json +1 -1
- package/dist/BlogAuthorPage-X3I7KLML.js.map +0 -1
- package/dist/BlogCategoryPage-F3ORUZAF.js.map +0 -1
- package/dist/BlogPage-G7AOQDP2.js.map +0 -1
- package/dist/BlogSinglePage-VP4ZLQPA.js.map +0 -1
- package/dist/BlogTagPage-WCHB3VL2.js.map +0 -1
- package/dist/BrandsPage-MR3RNHNS.js.map +0 -1
- package/dist/Breadcrumb-QCWPUUEQ.js.map +0 -1
- package/dist/CartItem-M2FEFI23.js.map +0 -1
- package/dist/CartSummary-RND3CQYW.js.map +0 -1
- package/dist/CustomerLayout-B7HTCSMV.js.map +0 -1
- package/dist/LoyaltyPage-26NMNBJV.js.map +0 -1
- package/dist/MainMenu-4ZZEDUBZ.js.map +0 -1
- package/dist/MobileMenu-GFEOQWO6.js.map +0 -1
- package/dist/NotificationsPage-226QGY4Q.js.map +0 -1
- package/dist/OrderSinglePage-44VBTQQS.js.map +0 -1
- package/dist/OrdersPage-NUQUDEAK.js.map +0 -1
- package/dist/ProfilePage-K7ZEU6IF.js.map +0 -1
- package/dist/SeoCartWidget-6LY5YQKA.js.map +0 -1
- package/dist/SettingsPage-NDZAS5PQ.js.map +0 -1
- package/dist/ThankYouPage-WIHRO3DC.js.map +0 -1
- package/dist/WalletPage-YD4TKPGA.js.map +0 -1
- package/dist/WishlistPage-3UNTMS2B.js.map +0 -1
- package/dist/chunk-6XWMNQ52.js.map +0 -1
- package/dist/chunk-AZ5HAIYQ.js.map +0 -1
- package/dist/chunk-I2UBYEUG.js +0 -14
- package/dist/chunk-JBXTU5NM.js.map +0 -1
- package/dist/chunk-MLIJWD6B.js.map +0 -1
- package/dist/chunk-PNXUBS5X.js.map +0 -1
- package/dist/chunk-XLGVT7QF.js.map +0 -1
- package/dist/document-class-G34XZMVK.js +0 -25
- package/dist/navigation-D7QS3NK2.js.map +0 -1
- package/dist/not-found-6PX2EO7T.js.map +0 -1
package/dist/api/notification.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { notification } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { notification } from '../chunk-MENDTTOA.js';
|
|
2
|
+
import '../chunk-O6XXHXC4.js';
|
|
3
|
+
import '../chunk-3FIWHGCZ.js';
|
|
4
|
+
import '../chunk-XTMHHLNK.js';
|
|
5
|
+
import '../chunk-PJWFEMBX.js';
|
|
5
6
|
import '../chunk-T72DAX7R.js';
|
|
6
7
|
import '../chunk-DGUM43GV.js';
|
|
7
8
|
//# sourceMappingURL=notification.js.map
|
package/dist/api/order.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { order } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { order } from '../chunk-OKP6LUT7.js';
|
|
2
|
+
import '../chunk-JK77XRXR.js';
|
|
3
3
|
import '../chunk-MTONGOJD.js';
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-O6XXHXC4.js';
|
|
5
|
+
import '../chunk-3FIWHGCZ.js';
|
|
6
|
+
import '../chunk-XTMHHLNK.js';
|
|
7
|
+
import '../chunk-PJWFEMBX.js';
|
|
7
8
|
import '../chunk-T72DAX7R.js';
|
|
8
9
|
import '../chunk-DF6FBKDN.js';
|
|
9
10
|
import '../chunk-DGUM43GV.js';
|
package/dist/api/page.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { page } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { page } from '../chunk-ICNOLZNT.js';
|
|
2
|
+
import '../chunk-JK77XRXR.js';
|
|
3
3
|
import '../chunk-MTONGOJD.js';
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-O6XXHXC4.js';
|
|
5
|
+
import '../chunk-3FIWHGCZ.js';
|
|
6
|
+
import '../chunk-XTMHHLNK.js';
|
|
7
|
+
import '../chunk-PJWFEMBX.js';
|
|
7
8
|
import '../chunk-T72DAX7R.js';
|
|
8
9
|
import '../chunk-DF6FBKDN.js';
|
|
9
10
|
import '../chunk-DGUM43GV.js';
|
package/dist/api/product.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { getProductPreview, isProductPreviewQuery, product, productDetailQueryKey, productPreviewQueryKey, rememberProductPreview, shouldDehydrateQuery } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { getProductPreview, isProductPreviewQuery, product, productDetailQueryKey, productPreviewQueryKey, rememberProductPreview, shouldDehydrateQuery } from '../chunk-CPQXPECC.js';
|
|
2
|
+
import '../chunk-JK77XRXR.js';
|
|
3
3
|
import '../chunk-MTONGOJD.js';
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-O6XXHXC4.js';
|
|
5
|
+
import '../chunk-3FIWHGCZ.js';
|
|
6
|
+
import '../chunk-XTMHHLNK.js';
|
|
7
|
+
import '../chunk-PJWFEMBX.js';
|
|
7
8
|
import '../chunk-T72DAX7R.js';
|
|
8
9
|
import '../chunk-DF6FBKDN.js';
|
|
9
10
|
import '../chunk-DGUM43GV.js';
|
package/dist/api/profile.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { api } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { api } from '../chunk-O6XXHXC4.js';
|
|
2
|
+
import '../chunk-3FIWHGCZ.js';
|
|
3
|
+
import '../chunk-XTMHHLNK.js';
|
|
4
|
+
import '../chunk-PJWFEMBX.js';
|
|
4
5
|
import '../chunk-T72DAX7R.js';
|
|
5
6
|
import '../chunk-DGUM43GV.js';
|
|
6
7
|
|
package/dist/api/profile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/profile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/api/profile.ts"],"names":[],"mappings":";;;;;;;;AAEO,IAAM,OAAA,GAAU;AAAA,EACrB,QAAQ,YAA2B;AACjC,IAAA,MAAM,GAAA,CAAI,OAAO,SAAS,CAAA;AAAA,EAC5B,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,cAAA,EAAgB,OAAO,IAAA,EAAc,KAAA,KAAkC;AACrE,IAAA,MAAM,GAAA,CAAI,KAAK,kBAAA,EAAoB,EAAE,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,EAAG,CAAA;AAAA,EAC9D;AACF","file":"profile.js","sourcesContent":["import { api } from './client';\n\nexport const profile = {\n delete: async (): Promise<void> => {\n await api.delete('profile');\n },\n\n /**\n * Persist a single user preference (e.g. `is_notifiable` for marketing\n * messages) via the Salla settings endpoint.\n */\n updateSettings: async (name: string, value: boolean): Promise<void> => {\n await api.post('profile/settings', { json: { name, value } });\n },\n};\n"]}
|
package/dist/api/store.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { store } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
export { resolveStoreIdentifier } from '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { store } from '../chunk-WMSOSA74.js';
|
|
2
|
+
import '../chunk-O6XXHXC4.js';
|
|
3
|
+
export { resolveStoreIdentifier } from '../chunk-3FIWHGCZ.js';
|
|
4
|
+
import '../chunk-XTMHHLNK.js';
|
|
5
|
+
import '../chunk-PJWFEMBX.js';
|
|
5
6
|
import '../chunk-T72DAX7R.js';
|
|
6
7
|
import '../chunk-DGUM43GV.js';
|
|
7
8
|
//# sourceMappingURL=store.js.map
|
package/dist/api/translations.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { translations } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { translations } from '../chunk-KT2MUSRN.js';
|
|
2
|
+
import '../chunk-O6XXHXC4.js';
|
|
3
|
+
import '../chunk-3FIWHGCZ.js';
|
|
4
|
+
import '../chunk-XTMHHLNK.js';
|
|
5
|
+
import '../chunk-PJWFEMBX.js';
|
|
5
6
|
import '../chunk-T72DAX7R.js';
|
|
6
7
|
import '../chunk-DGUM43GV.js';
|
|
7
8
|
//# sourceMappingURL=translations.js.map
|
package/dist/api/user.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { user } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { user } from '../chunk-Z74NUTEI.js';
|
|
2
|
+
import '../chunk-O6XXHXC4.js';
|
|
3
|
+
import '../chunk-3FIWHGCZ.js';
|
|
4
|
+
import '../chunk-XTMHHLNK.js';
|
|
5
|
+
import '../chunk-PJWFEMBX.js';
|
|
5
6
|
import '../chunk-T72DAX7R.js';
|
|
6
7
|
import '../chunk-DGUM43GV.js';
|
|
7
8
|
//# sourceMappingURL=user.js.map
|
package/dist/api/wishlist.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { wishlist } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { wishlist } from '../chunk-3XIITSKM.js';
|
|
2
|
+
import '../chunk-CPQXPECC.js';
|
|
3
|
+
import '../chunk-JK77XRXR.js';
|
|
4
4
|
import '../chunk-MTONGOJD.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-O6XXHXC4.js';
|
|
6
|
+
import '../chunk-3FIWHGCZ.js';
|
|
7
|
+
import '../chunk-XTMHHLNK.js';
|
|
8
|
+
import '../chunk-PJWFEMBX.js';
|
|
8
9
|
import '../chunk-T72DAX7R.js';
|
|
9
10
|
import '../chunk-DF6FBKDN.js';
|
|
10
11
|
import '../chunk-DGUM43GV.js';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { hostIdentifiesStore, resolveRequestStoreBase, storeBaseRedirectHref } from './chunk-XTMHHLNK.js';
|
|
2
|
+
import { getRequestStore } from './chunk-PJWFEMBX.js';
|
|
3
|
+
|
|
4
|
+
// src/utils/inline-script.ts
|
|
5
|
+
function escapeForInlineScript(value) {
|
|
6
|
+
return value.replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// src/utils/runtime-env.ts
|
|
10
|
+
var RUNTIME_ENV_KEY = "__SALLA_RUNTIME_ENV__";
|
|
11
|
+
function readEnv(key) {
|
|
12
|
+
try {
|
|
13
|
+
const vite = import.meta.env?.[key];
|
|
14
|
+
if (vite) return vite;
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
|
+
return typeof process !== "undefined" ? process.env?.[key] : void 0;
|
|
18
|
+
}
|
|
19
|
+
function resolveRuntimeEnv() {
|
|
20
|
+
const injected = getInjectedRuntimeEnv();
|
|
21
|
+
const { storeId, storeBase, versionId, requestHost } = getRequestStore();
|
|
22
|
+
return {
|
|
23
|
+
apiBase: injected.apiBase || readEnv("VITE_API_URL"),
|
|
24
|
+
// The request outranks the build-time var here for the same reason it does
|
|
25
|
+
// in `resolveStoreIdentifier`, and this is the copy that reaches the
|
|
26
|
+
// browser: publish the store SSR actually rendered, or hydration resolves
|
|
27
|
+
// again from a URL whose `?storeId=` the dispatcher has already stripped and
|
|
28
|
+
// queries a different store than the markup it is hydrating.
|
|
29
|
+
storeIdentifier: injected.storeIdentifier || storeId || storeBase || (hostIdentifiesStore(requestHost) ? requestHost : null) || readEnv("VITE_STORE_DOMAIN"),
|
|
30
|
+
// Absent rather than empty when the path named no store, so it drops out of
|
|
31
|
+
// the inline script, like `versionId`.
|
|
32
|
+
storeBase: injected.storeBase || storeBase || void 0,
|
|
33
|
+
// No env fallback on purpose. A store identifier has one because a build can
|
|
34
|
+
// legitimately be pinned to a store; a version is something a request asks
|
|
35
|
+
// for, and a build-time default would make every visitor of every store see
|
|
36
|
+
// whichever draft was current when the theme was compiled.
|
|
37
|
+
versionId: injected.versionId || versionId || void 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function getInjectedRuntimeEnv() {
|
|
41
|
+
const holder = globalThis;
|
|
42
|
+
return holder[RUNTIME_ENV_KEY] ?? {};
|
|
43
|
+
}
|
|
44
|
+
function renderRuntimeEnvScript(env = resolveRuntimeEnv()) {
|
|
45
|
+
const set = Object.entries(env).filter(([, value]) => Boolean(value));
|
|
46
|
+
if (!set.length) return null;
|
|
47
|
+
const json = escapeForInlineScript(JSON.stringify(Object.fromEntries(set)));
|
|
48
|
+
return `window.${RUNTIME_ENV_KEY}=${json};`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/utils/store-identity.ts
|
|
52
|
+
function resolveStoreIdentifier(explicit) {
|
|
53
|
+
if (explicit) return explicit;
|
|
54
|
+
const { storeId, requestHost } = getRequestStore();
|
|
55
|
+
if (storeId) return storeId;
|
|
56
|
+
const storeBase = resolveStoreBase();
|
|
57
|
+
if (storeBase) return storeBase;
|
|
58
|
+
const injected = getInjectedRuntimeEnv().storeIdentifier;
|
|
59
|
+
if (injected) return injected;
|
|
60
|
+
if (hostIdentifiesStore(requestHost)) return requestHost;
|
|
61
|
+
const browserHost = typeof window !== "undefined" ? window.location.host : null;
|
|
62
|
+
if (hostIdentifiesStore(browserHost)) return browserHost;
|
|
63
|
+
return readEnv("VITE_STORE_DOMAIN") || readEnv("STORE_DOMAIN") || "";
|
|
64
|
+
}
|
|
65
|
+
function resolveStoreBase() {
|
|
66
|
+
const { storeBase } = getRequestStore();
|
|
67
|
+
if (storeBase) return storeBase;
|
|
68
|
+
if (typeof window === "undefined") return null;
|
|
69
|
+
const published = getInjectedRuntimeEnv();
|
|
70
|
+
if (published.storeBase) return published.storeBase;
|
|
71
|
+
if (Object.keys(published).length > 0) return null;
|
|
72
|
+
return resolveRequestStoreBase(window.location.href, window.location.host);
|
|
73
|
+
}
|
|
74
|
+
function resolveStoreBaseRedirect(username, href) {
|
|
75
|
+
const host = getRequestStore().requestHost ?? (typeof window !== "undefined" ? window.location.host : null);
|
|
76
|
+
return storeBaseRedirectHref({ host, base: resolveStoreBase(), username, href });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/utils/sdk-helpers.ts
|
|
80
|
+
var isBrowser = typeof window !== "undefined";
|
|
81
|
+
function getStoreIdentifier(explicit) {
|
|
82
|
+
return resolveStoreIdentifier(explicit);
|
|
83
|
+
}
|
|
84
|
+
function getSallaSDK() {
|
|
85
|
+
if (!isBrowser) return void 0;
|
|
86
|
+
return window.salla;
|
|
87
|
+
}
|
|
88
|
+
function syncSdkLocale(locale) {
|
|
89
|
+
const sdk = getSallaSDK();
|
|
90
|
+
if (!sdk || !locale) return;
|
|
91
|
+
try {
|
|
92
|
+
sdk.lang?.setLocale?.(locale);
|
|
93
|
+
sdk.api?.setHeader?.("accept-language", locale);
|
|
94
|
+
sdk.config?.set?.("user.language_code", locale);
|
|
95
|
+
} catch {
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { escapeForInlineScript, getInjectedRuntimeEnv, getSallaSDK, getStoreIdentifier, readEnv, renderRuntimeEnvScript, resolveStoreBase, resolveStoreBaseRedirect, resolveStoreIdentifier, syncSdkLocale };
|
|
100
|
+
//# sourceMappingURL=chunk-3FIWHGCZ.js.map
|
|
101
|
+
//# sourceMappingURL=chunk-3FIWHGCZ.js.map
|
|
@@ -0,0 +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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AChD,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,4 +1,4 @@
|
|
|
1
|
-
import { api } from './chunk-
|
|
1
|
+
import { api } from './chunk-O6XXHXC4.js';
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
var apps = {
|
|
@@ -40,5 +40,5 @@ var apps = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export { apps };
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-3MHDV5JS.js.map
|
|
44
|
+
//# sourceMappingURL=chunk-3MHDV5JS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/apps.ts"],"names":[],"mappings":";;;AAmCO,IAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,UAAU,YAAmC;AAC3C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,eAAA,EAAiB,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CACtC,IAAA,EAA8B;AACjC,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,YAAkC;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,M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OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,IAAQ,EAAC,EAAE;AAAA,EAClC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA;AAAA;AAAA;AAAA,MAIX,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,IAEH,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA,MACX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-3MHDV5JS.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\n\nexport interface AppSnippetRow {\n place: string;\n content: string;\n url?: string | null;\n /**\n * Raw snippet id, emitted as `data-snippet-id`. Present only on CDN rows — the\n * inline branch of the backend's snippet parser omits the key entirely.\n */\n id?: number;\n /** `{{customer.x}}` placeholders in `content` to substitute from SDK config `user.*` keys. */\n customer_parameters?: string[];\n}\n\nexport interface AppSnippet {\n service: string;\n app_id: string;\n /** Encoded app id (`getRouteKey()`): the scope id its snippets bind to via `data-scope-id`,\n * and its settings-bucket key. Absent on payloads predating the settings API. */\n id?: string;\n app_slug: string;\n status: string;\n snippets: AppSnippetRow[];\n}\n\n/**\n * Per-app public `app.*` buckets for CDN snippets, keyed by encoded app id (== `AppSnippet.id`,\n * the `Salla.appScope` scope id). One isolated bucket per app; reads within a scope are bare `app.*`.\n */\nexport interface AppSettings {\n apps: Record<string, Record<string, unknown>>;\n}\n\nexport const apps = {\n /**\n * Installed apps' snippets (scripts/HTML to inject). Timeout-bounded because it's awaited in\n * rootBeforeLoad (SSR/TTFB): a slow response degrades to no CDN tags, never stalls the page.\n */\n snippets: async (): Promise<AppSnippet[]> => {\n const { data } = await api\n .get('apps/snippets', { timeout: 2500 })\n .json<{ data?: AppSnippet[] }>();\n return data ?? [];\n },\n\n /**\n * Per-app public `app.*` buckets, keyed by encoded app id. Timeout-bounded (SSR-awaited):\n * a slow response degrades to empty buckets (fail-open), never strands injection.\n */\n settings: async (): Promise<AppSettings> => {\n const { data } = await api\n .get('apps/snippets/settings', { timeout: 2500 })\n .json<{ data?: Partial<AppSettings> }>();\n return { apps: data?.apps ?? {} };\n },\n\n queries: {\n snippets: () =>\n queryOptions({\n queryKey: ['apps', 'snippets'],\n queryFn: () => apps.snippets(),\n // Snippets are static per session; one fetch per page load is enough.\n staleTime: Infinity,\n // No retry: this is awaited in rootBeforeLoad, so the router's default `retry: 1` would\n // make the SSR wait 2 x the 2500ms timeout (plus backoff) before failing open. The\n // 2500ms timeout must be the whole budget; the client fallback query does the retrying.\n retry: 0,\n }),\n\n settings: () =>\n queryOptions({\n queryKey: ['apps', 'settings'],\n queryFn: () => apps.settings(),\n // Encoded app ids and their buckets are stable per page; one fetch is enough.\n staleTime: Infinity,\n retry: 0,\n }),\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { rememberProductPreview } from './chunk-
|
|
2
|
-
import { getActiveScope, api } from './chunk-
|
|
1
|
+
import { rememberProductPreview } from './chunk-CPQXPECC.js';
|
|
2
|
+
import { getActiveScope, api } from './chunk-O6XXHXC4.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var wishlist = {
|
|
@@ -31,5 +31,5 @@ var wishlist = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export { wishlist };
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-3XIITSKM.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EAAC;AAChC,IAAA,KAAA,MAAW,IAAA,IAAQ,KAAA,EAAO,sBAAA,CAAuB,IAAI,CAAA;AAErD,IAAA,OAAO;AAAA,MACL,KAAA;AAAA,MACA,IAAA,EAAM,QAAA,CAAS,MAAA,EAAQ,IAAA,IAAQ;AAAA,KACjC;AAAA,EACF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,CAAC,MAAA,KACL,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,UAAA,EAAY,MAAA,EAAQ,QAAQ,EAAE,KAAA,EAAO,cAAA,EAAe,EAAG,CAAA;AAAA,MAClE,OAAA,EAAS,CAAC,EAAE,MAAA,EAAO,KAAM,QAAA,CAAS,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAC7D;AAAA;AAEP","file":"chunk-3XIITSKM.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport {\n rememberProductPreview,\n type ProductsListResult,\n type ProductsListResponse,\n} from './product';\n\nexport interface WishlistListParams {\n page?: number;\n perPage?: number;\n filterable?: boolean;\n signal?: AbortSignal;\n}\n\n/**\n * Wishlist API — page-based pagination only.\n * Kept separate from product.list to avoid mixing cursor and page pagination strategies.\n */\nexport const wishlist = {\n list: async (params: WishlistListParams = {}): Promise<ProductsListResult> => {\n const { page = 1, perPage = 15, filterable, signal } = params;\n\n const searchParams = new URLSearchParams();\n searchParams.set('source', 'wishlist');\n searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n if (filterable !== undefined) {\n searchParams.set('filterable', filterable ? '1' : '0');\n }\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`products?${searchParams.toString()}`, options as any)\n .json<ProductsListResponse>();\n\n const items = response.data ?? [];\n for (const item of items) rememberProductPreview(item);\n\n return {\n items,\n next: response.cursor?.next ?? null,\n };\n },\n\n queries: {\n list: (params: Omit<WishlistListParams, 'signal'>) =>\n queryOptions({\n queryKey: ['wishlist', 'list', params, { scope: getActiveScope() }],\n queryFn: ({ signal }) => wishlist.list({ ...params, signal }),\n }),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasTwilightSettings, updateTwilightContext, getTwilightContext, SettingsError } from './chunk-
|
|
1
|
+
import { hasTwilightSettings, updateTwilightContext, getTwilightContext, SettingsError } from './chunk-PJWFEMBX.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-4D44TJ72.js.map
|
|
127
|
+
//# sourceMappingURL=chunk-4D44TJ72.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,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;AAC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/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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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-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,7 +1,7 @@
|
|
|
1
|
-
import { useIsHome } from './chunk-
|
|
1
|
+
import { useIsHome } from './chunk-JK77XRXR.js';
|
|
2
2
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
3
3
|
import { HookSlot } from './chunk-Q7VWURUR.js';
|
|
4
|
-
import { Image } from './chunk-
|
|
4
|
+
import { Image } from './chunk-LKBWIN26.js';
|
|
5
5
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
6
6
|
import { lazy, useState } from 'react';
|
|
7
7
|
import { SallaAdvertisement } from '@salla.sa/twilight-components-react/advertisement';
|
|
@@ -13,9 +13,9 @@ import { SallaSearch } from '@salla.sa/twilight-components-react/search';
|
|
|
13
13
|
import { SallaUserMenu } from '@salla.sa/twilight-components-react/user-menu';
|
|
14
14
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
15
15
|
|
|
16
|
-
var LazyMainMenu = lazy(() => import('./MainMenu-
|
|
16
|
+
var LazyMainMenu = lazy(() => import('./MainMenu-MMAYRKYE.js').then((m) => ({ default: m.MainMenu })));
|
|
17
17
|
var LazyMobileMenu = lazy(
|
|
18
|
-
() => import('./MobileMenu-
|
|
18
|
+
() => import('./MobileMenu-J34MVD6W.js').then((m) => ({ default: m.MobileMenu }))
|
|
19
19
|
);
|
|
20
20
|
function Header(_props) {
|
|
21
21
|
const { currency, theme, store } = useTwilight();
|
|
@@ -120,5 +120,5 @@ function Header(_props) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export { Header };
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
123
|
+
//# sourceMappingURL=chunk-65Z2ZDKZ.js.map
|
|
124
|
+
//# sourceMappingURL=chunk-65Z2ZDKZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/navigation/lazy.ts","../src/components/layout/Header.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMO,IAAM,YAAA,GAAe,IAAA,CAAK,MAAM,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,GAAW,CAAC,CAAA;AAE3F,IAAM,cAAA,GAAiB,IAAA;AAAA,EAAK,MACjC,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE,CAAA;ACUO,SAAS,OAAO,MAAA,EAAqB;AAC1C,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAO,KAAA,KAAU,WAAA,EAAY;AAC/C,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAA,EAAa,GAAI,cAAA,EAAe;AAChD,EAAA,MAAM,QAAA,GAAW,KAAA,EAAO,QAAA,IAAY,EAAC;AACrC,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAS,KAAK,CAAA;AAG9D,EAAA,MAAM,aAAa,SAAA,EAAU;AAE7B,EAAA,MAAM,UAAA,GAAa,aAAa,IAAA,GAAO,MAAA;AAEvC,EAAA,uBACE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BACZ,GAAA,EAAK,CAAA,EAAG,KAAA,EAAO,IAAA,IAAQ,OAAO,CAAA,KAAA,CAAA;AAAA,kBAC9B,QAAA,EAAQ,IAAA;AAAA,kBACR,KAAA,EAAO,GAAA;AAAA,kBACP,MAAA,EAAQ;AAAA;AAAA,eACV,EACF,CAAA;AAAA,kCACC,UAAA,EAAA,EAAW,SAAA,EAAU,SAAA,EAAW,QAAA,EAAA,KAAA,EAAO,QAAQ,OAAA,EAAQ;AAAA,aAAA,EAC1D,CAAA;AAAA,gCACC,YAAA,EAAA,EAAS;AAAA,WAAA,EACZ,CAAA;AAAA,0BACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,sCAAA,EACb,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,iBAAc,UAAA,EAAU,IAAA,EAAC,UAAA,EAAU,IAAA,EAAC,WAAU,YAAA,EAAa,CAAA;AAAA,4BAC5D,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAU,8BAAA,EAC1B,QAAA,kBAAA,GAAA,CAAC,OAAE,IAAA,EAAK,MAAA,EAAO,SAAA,EAAU,0CAAA,EAA2C,CAAA,EACtE;AAAA,WAAA,EACF;AAAA,SAAA,EACF,GACF,CAAA,EACF;AAAA;AAAA,KACF;AAAA,oBAGA,GAAA,CAAC,kBAAW,MAAA,EAAQ,gBAAA,EAAkB,SAAS,MAAM,mBAAA,CAAoB,KAAK,CAAA,EAAG,CAAA;AAAA,oBACjF,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAK,YAAA,EAAa;AAAA,GAAA,EAC9B,CAAA;AAEJ","file":"chunk-UWWYR3UX.js","sourcesContent":["import { lazy } from 'react';\n\n/**\n * Lazy-loaded navigation components\n * Use these for code-splitting navigation sections\n */\nexport const LazyMainMenu = lazy(() => import('./MainMenu').then((m) => ({ default: m.MainMenu })));\n\nexport const LazyMobileMenu = lazy(() =>\n import('./MobileMenu').then((m) => ({ default: m.MobileMenu }))\n);\n","import { useState } from 'react';\nimport { useIsHome } from '../../providers/NavigationProvider';\nimport { SallaAdvertisement } from '@salla.sa/twilight-components-react/advertisement';\nimport { SallaCartSummary } from '@salla.sa/twilight-components-react/cart-summary';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaLocalizationModal } from '@salla.sa/twilight-components-react/localization-modal';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaSearch } from '@salla.sa/twilight-components-react/search';\nimport { SallaUserMenu } from '@salla.sa/twilight-components-react/user-menu';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { MainMenu, MobileMenu } from '../navigation';\nimport { Image } from '../common';\nimport type { Cart } from '../../types';\n\ninterface HeaderProps {\n cart?: Cart;\n}\n\nexport function Header(_props: HeaderProps) {\n const { currency, theme, store } = useTwilight();\n const { locale, languageName } = useTranslation();\n const settings = theme?.settings || {};\n const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);\n\n // Check if we're on homepage\n const isHomepage = useIsHome();\n\n const StoreTitle = isHomepage ? 'h1' : 'span';\n\n return (\n <header className=\"store-header\" suppressHydrationWarning>\n <HookSlot name=\"header:start\" />\n <div className=\"advertisement-slot\">\n <SallaAdvertisement />\n </div>\n {/* Top Nav */}\n <div className={`top-navbar${settings.topnav_is_dark ? ' top-navbar--dark' : ''}`}>\n <div className=\"container flex justify-between\">\n <div className=\"flex-1 flex items-center gap-2\">\n {/* Footer Menu */}\n {settings.important_links && <SallaMenu source=\"footer\" topnav />}\n\n {/* Language & Currency */}\n <div className=\"header-buttons\">\n {(store?.settings?.is_multilingual || store?.settings?.currencies_enabled) && (\n <>\n <button\n type=\"button\"\n onClick={() => window.salla?.event.dispatch('localization::open')}\n className=\"btn--rounded-gray basis-0\"\n >\n <span>{languageName}</span>\n <span className=\"mx-1.5\">|</span>\n <span className={`flag iti__flag iti__${store?.country.toLowerCase()}`}></span>\n\n <span>\n {store?.settings?.use_sar_symbol && currency?.code === 'SAR' ? (\n <i className=\"sicon-sar\"></i>\n ) : (\n <>{currency?.symbol}</>\n )}\n </span>\n </button>\n {/* TODO:: support switch the lang without hit the web API, by set it in the sdk and local storage */}\n {/* TODO:: Support switch the curency without hit the web API, by set it in the sdk and local storage */}\n <SallaLocalizationModal\n language={locale}\n currency={currency?.code || 'SAR'}\n suppressHydrationWarning\n />\n </>\n )}\n </div>\n\n {/* Scopes / Branches */}\n {store?.scope && (\n <button\n type=\"button\"\n className=\"btn--rounded-gray\"\n onClick={() =>\n window.salla?.event.dispatch('scopes::open', {\n mode: 'default',\n })\n }\n >\n <i className=\"sicon-location rtl:ml-1 ltr:mr-1\"></i>\n {store.scope.name}\n </button>\n )}\n\n {/* Search bar */}\n <div className=\"header-search flex-1\">\n {/* todo:: use a search icon insted with open the search popup */}\n <SallaSearch inline oval height={36} />\n </div>\n </div>\n\n <SallaContacts contacts={store?.contacts} contactsTitle=\"N/A\" isHeader />\n </div>\n </div>\n\n {/* Main Nav */}\n <div\n id=\"mainnav\"\n className={`main-nav-container shadow-default bg-white flex items-center relative z-50${settings.header_is_sticky ? ' sticky top-0' : ''}`}\n >\n <div className=\"inner bg-inherit w-full\">\n <div className=\"container\">\n <div className=\"flex items-stretch justify-between relative\">\n <div className=\"flex items-center\">\n <a\n className=\"lg:hidden mburger mburger--collapse leading-none rtl:ml-4 ltr:mr-4\"\n href=\"#mobile-menu\"\n aria-label=\"Open-menu\"\n onClick={(e) => {\n e.preventDefault();\n setIsMobileMenuOpen(true);\n }}\n >\n <i className=\"sicon-menu text-primary text-2xl\"></i>\n </a>\n <a className=\"navbar-brand\" href={store?.url || '/'}>\n <div className=\"logo-wrapper\">\n <Image\n src={store?.logo}\n alt={`${store?.name || 'Store'} logo`}\n priority\n width={120}\n height={48}\n />\n </div>\n <StoreTitle className=\"sr-only\">{store?.name || 'Store'}</StoreTitle>\n </a>\n <MainMenu />\n </div>\n <div className=\"flex items-center justify-end my-2.5\">\n <SallaUserMenu avatarOnly showHeader className=\"header-btn\" />\n <SallaCartSummary className=\"ml-4 rtl:ml-[unset] rtl:mr-4\">\n <i slot=\"icon\" className=\"header-btn__icon icon sicon-shopping-bag\"></i>\n </SallaCartSummary>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n {/* Mobile Menu */}\n <MobileMenu isOpen={isMobileMenuOpen} onClose={() => setIsMobileMenuOpen(false)} />\n <HookSlot name=\"header:end\" />\n </header>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/navigation/lazy.ts","../src/components/layout/Header.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMO,IAAM,YAAA,GAAe,IAAA,CAAK,MAAM,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,GAAW,CAAC,CAAA;AAE3F,IAAM,cAAA,GAAiB,IAAA;AAAA,EAAK,MACjC,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE,CAAA;ACUO,SAAS,OAAO,MAAA,EAAqB;AAC1C,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAO,KAAA,KAAU,WAAA,EAAY;AAC/C,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAA,EAAa,GAAI,cAAA,EAAe;AAChD,EAAA,MAAM,QAAA,GAAW,KAAA,EAAO,QAAA,IAAY,EAAC;AACrC,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAS,KAAK,CAAA;AAG9D,EAAA,MAAM,aAAa,SAAA,EAAU;AAE7B,EAAA,MAAM,UAAA,GAAa,aAAa,IAAA,GAAO,MAAA;AAEvC,EAAA,uBACE,IAAA,CAAC,QAAA,EAAA,EAAO,SAAA,EAAU,cAAA,EAAe,0BAAwB,IAAA,EACvD,QAAA,EAAA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BAC9B,QAAA,EAAQ,IAAA;AAAA,kBACR,KAAA,EAAO,GAAA;AAAA,kBACP,MAAA,EAAQ;AAAA;AAAA,eACV,EACF,CAAA;AAAA,kCACC,UAAA,EAAA,EAAW,SAAA,EAAU,SAAA,EAAW,QAAA,EAAA,KAAA,EAAO,QAAQ,OAAA,EAAQ;AAAA,aAAA,EAC1D,CAAA;AAAA,gCACC,YAAA,EAAA,EAAS;AAAA,WAAA,EACZ,CAAA;AAAA,0BACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,sCAAA,EACb,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,iBAAc,UAAA,EAAU,IAAA,EAAC,UAAA,EAAU,IAAA,EAAC,WAAU,YAAA,EAAa,CAAA;AAAA,4BAC5D,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAU,8BAAA,EAC1B,QAAA,kBAAA,GAAA,CAAC,OAAE,IAAA,EAAK,MAAA,EAAO,SAAA,EAAU,0CAAA,EAA2C,CAAA,EACtE;AAAA,WAAA,EACF;AAAA,SAAA,EACF,GACF,CAAA,EACF;AAAA;AAAA,KACF;AAAA,oBAGA,GAAA,CAAC,kBAAW,MAAA,EAAQ,gBAAA,EAAkB,SAAS,MAAM,mBAAA,CAAoB,KAAK,CAAA,EAAG,CAAA;AAAA,oBACjF,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAK,YAAA,EAAa;AAAA,GAAA,EAC9B,CAAA;AAEJ","file":"chunk-65Z2ZDKZ.js","sourcesContent":["import { lazy } from 'react';\n\n/**\n * Lazy-loaded navigation components\n * Use these for code-splitting navigation sections\n */\nexport const LazyMainMenu = lazy(() => import('./MainMenu').then((m) => ({ default: m.MainMenu })));\n\nexport const LazyMobileMenu = lazy(() =>\n import('./MobileMenu').then((m) => ({ default: m.MobileMenu }))\n);\n","import { useState } from 'react';\nimport { useIsHome } from '../../providers/NavigationProvider';\nimport { SallaAdvertisement } from '@salla.sa/twilight-components-react/advertisement';\nimport { SallaCartSummary } from '@salla.sa/twilight-components-react/cart-summary';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaLocalizationModal } from '@salla.sa/twilight-components-react/localization-modal';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaSearch } from '@salla.sa/twilight-components-react/search';\nimport { SallaUserMenu } from '@salla.sa/twilight-components-react/user-menu';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { MainMenu, MobileMenu } from '../navigation';\nimport { Image } from '../common';\nimport type { Cart } from '../../types';\n\ninterface HeaderProps {\n cart?: Cart;\n}\n\nexport function Header(_props: HeaderProps) {\n const { currency, theme, store } = useTwilight();\n const { locale, languageName } = useTranslation();\n const settings = theme?.settings || {};\n const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);\n\n // Check if we're on homepage\n const isHomepage = useIsHome();\n\n const StoreTitle = isHomepage ? 'h1' : 'span';\n\n return (\n <header className=\"store-header\" suppressHydrationWarning>\n <HookSlot name=\"header:start\" />\n <div className=\"advertisement-slot\">\n <SallaAdvertisement />\n </div>\n {/* Top Nav */}\n <div className={`top-navbar${settings.topnav_is_dark ? ' top-navbar--dark' : ''}`}>\n <div className=\"container flex justify-between\">\n <div className=\"flex-1 flex items-center gap-2\">\n {/* Footer Menu */}\n {settings.important_links && <SallaMenu source=\"footer\" topnav />}\n\n {/* Language & Currency */}\n <div className=\"header-buttons\">\n {(store?.settings?.is_multilingual || store?.settings?.currencies_enabled) && (\n <>\n <button\n type=\"button\"\n onClick={() => window.salla?.event.dispatch('localization::open')}\n className=\"btn--rounded-gray basis-0\"\n >\n <span>{languageName}</span>\n <span className=\"mx-1.5\">|</span>\n <span className={`flag iti__flag iti__${store?.country.toLowerCase()}`}></span>\n\n <span>\n {store?.settings?.use_sar_symbol && currency?.code === 'SAR' ? (\n <i className=\"sicon-sar\"></i>\n ) : (\n <>{currency?.symbol}</>\n )}\n </span>\n </button>\n {/* TODO:: support switch the lang without hit the web API, by set it in the sdk and local storage */}\n {/* TODO:: Support switch the curency without hit the web API, by set it in the sdk and local storage */}\n <SallaLocalizationModal\n language={locale}\n currency={currency?.code || 'SAR'}\n suppressHydrationWarning\n />\n </>\n )}\n </div>\n\n {/* Scopes / Branches */}\n {store?.scope && (\n <button\n type=\"button\"\n className=\"btn--rounded-gray\"\n onClick={() =>\n window.salla?.event.dispatch('scopes::open', {\n mode: 'default',\n })\n }\n >\n <i className=\"sicon-location rtl:ml-1 ltr:mr-1\"></i>\n {store.scope.name}\n </button>\n )}\n\n {/* Search bar */}\n <div className=\"header-search flex-1\">\n {/* todo:: use a search icon insted with open the search popup */}\n <SallaSearch inline oval height={36} />\n </div>\n </div>\n\n <SallaContacts contacts={store?.contacts} contactsTitle=\"N/A\" isHeader />\n </div>\n </div>\n\n {/* Main Nav */}\n <div\n id=\"mainnav\"\n className={`main-nav-container shadow-default bg-white flex items-center relative z-50${settings.header_is_sticky ? ' sticky top-0' : ''}`}\n >\n <div className=\"inner bg-inherit w-full\">\n <div className=\"container\">\n <div className=\"flex items-stretch justify-between relative\">\n <div className=\"flex items-center\">\n <a\n className=\"lg:hidden mburger mburger--collapse leading-none rtl:ml-4 ltr:mr-4\"\n href=\"#mobile-menu\"\n aria-label=\"Open-menu\"\n onClick={(e) => {\n e.preventDefault();\n setIsMobileMenuOpen(true);\n }}\n >\n <i className=\"sicon-menu text-primary text-2xl\"></i>\n </a>\n <a className=\"navbar-brand\" href={store?.url || '/'}>\n <div className=\"logo-wrapper\">\n <Image\n src={store?.logo}\n alt={`${store?.name || 'Store'} logo`}\n priority\n width={120}\n height={48}\n />\n </div>\n <StoreTitle className=\"sr-only\">{store?.name || 'Store'}</StoreTitle>\n </a>\n <MainMenu />\n </div>\n <div className=\"flex items-center justify-end my-2.5\">\n <SallaUserMenu avatarOnly showHeader className=\"header-btn\" />\n <SallaCartSummary className=\"ml-4 rtl:ml-[unset] rtl:mr-4\">\n <i slot=\"icon\" className=\"header-btn__icon icon sicon-shopping-bag\"></i>\n </SallaCartSummary>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n {/* Mobile Menu */}\n <MobileMenu isOpen={isMobileMenuOpen} onClose={() => setIsMobileMenuOpen(false)} />\n <HookSlot name=\"header:end\" />\n </header>\n );\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { order } from './chunk-
|
|
1
|
+
import { order } from './chunk-OKP6LUT7.js';
|
|
2
2
|
import { buildHreflangAlternates } from './chunk-TZ3E5BN4.js';
|
|
3
|
-
import { orUnauthorized } from './chunk-
|
|
3
|
+
import { orUnauthorized } from './chunk-JK77XRXR.js';
|
|
4
4
|
import { RouteId } from './chunk-MTONGOJD.js';
|
|
5
|
-
import { getTwilightContext } from './chunk-
|
|
5
|
+
import { getTwilightContext } from './chunk-PJWFEMBX.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-A3K5BDBZ.js').then((m) => ({ default: m.OrdersPage })));
|
|
52
52
|
var LazyOrderSinglePage = lazy(
|
|
53
|
-
() => import('./OrderSinglePage-
|
|
53
|
+
() => import('./OrderSinglePage-LP7FUHKL.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-AVPIY3Y4.js.map
|
|
106
|
+
//# sourceMappingURL=chunk-AVPIY3Y4.js.map
|