@salla.sa/twilight-theme-engine 1.0.61 → 1.0.63
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-RAQX7VHU.js → AddToCartForm-365O6IQY.js} +26 -6
- package/dist/AddToCartForm-365O6IQY.js.map +1 -0
- package/dist/{BlogAuthorPage-HV6JUJNL.js → BlogAuthorPage-QIII3YRK.js} +12 -11
- package/dist/BlogAuthorPage-QIII3YRK.js.map +1 -0
- package/dist/{BlogCategoryPage-ATPIVUAL.js → BlogCategoryPage-HNGWYTN6.js} +12 -11
- package/dist/BlogCategoryPage-HNGWYTN6.js.map +1 -0
- package/dist/{BlogPage-6IIOSB45.js → BlogPage-7NGO5VLL.js} +10 -9
- package/dist/BlogPage-7NGO5VLL.js.map +1 -0
- package/dist/{BlogSinglePage-DV3XYB26.js → BlogSinglePage-Y42LPA2L.js} +10 -9
- package/dist/BlogSinglePage-Y42LPA2L.js.map +1 -0
- package/dist/{BlogTagPage-RVJIXERD.js → BlogTagPage-ZCFYLXH6.js} +12 -11
- package/dist/BlogTagPage-ZCFYLXH6.js.map +1 -0
- package/dist/{BrandsPage-RQXP67LV.js → BrandsPage-PPJVASUW.js} +11 -10
- package/dist/BrandsPage-PPJVASUW.js.map +1 -0
- package/dist/{Breadcrumb-NXXVZJJD.js → Breadcrumb-4DUAJK3V.js} +10 -9
- package/dist/Breadcrumb-4DUAJK3V.js.map +1 -0
- package/dist/{CartItem-XRWTSJB5.js → CartItem-T4N3HMXU.js} +83 -59
- package/dist/CartItem-T4N3HMXU.js.map +1 -0
- package/dist/{CartSummary-F6BY5APF.js → CartSummary-Z25JDFWN.js} +10 -9
- package/dist/CartSummary-Z25JDFWN.js.map +1 -0
- package/dist/{Copyright-TEDF6HMC.js → Copyright-WNJIDKSR.js} +3 -3
- package/dist/{Copyright-TEDF6HMC.js.map → Copyright-WNJIDKSR.js.map} +1 -1
- package/dist/{CustomerLayout-T5BSTU6T.js → CustomerLayout-A6DVYYC3.js} +10 -9
- package/dist/CustomerLayout-A6DVYYC3.js.map +1 -0
- package/dist/{Footer-IRX2WAEF.js → Footer-3YBOSAO5.js} +10 -9
- package/dist/{Footer-IRX2WAEF.js.map → Footer-3YBOSAO5.js.map} +1 -1
- package/dist/{Header-HQKDTZSI.js → Header-6M7TVMSW.js} +6 -6
- package/dist/{Header-HQKDTZSI.js.map → Header-6M7TVMSW.js.map} +1 -1
- package/dist/LoyaltyPage-XQJ6RDT6.js +61 -0
- package/dist/LoyaltyPage-XQJ6RDT6.js.map +1 -0
- package/dist/LoyaltyPointsPage-K75LJNNP.js +16 -0
- package/dist/LoyaltyPointsPage-K75LJNNP.js.map +1 -0
- package/dist/{MainMenu-4ZPVIJCN.js → MainMenu-V7GPKDTU.js} +3 -3
- package/dist/{MainMenu-4ZPVIJCN.js.map → MainMenu-V7GPKDTU.js.map} +1 -1
- package/dist/{MasterLayout-G3MVZLYZ.js → MasterLayout-MBQ4JM3D.js} +10 -9
- package/dist/{MasterLayout-G3MVZLYZ.js.map → MasterLayout-MBQ4JM3D.js.map} +1 -1
- package/dist/{MobileMenu-A5DBTPS7.js → MobileMenu-UFX4ZHW7.js} +10 -9
- package/dist/MobileMenu-UFX4ZHW7.js.map +1 -0
- package/dist/{NotificationsPage-T2O67MLD.js → NotificationsPage-M3YK2HRM.js} +10 -9
- package/dist/NotificationsPage-M3YK2HRM.js.map +1 -0
- package/dist/{OrderSinglePage-4W4JZX7I.js → OrderSinglePage-7LIUMNRB.js} +11 -10
- package/dist/OrderSinglePage-7LIUMNRB.js.map +1 -0
- package/dist/{OrdersPage-DYKFBMRC.js → OrdersPage-WI4OSGBF.js} +11 -10
- package/dist/OrdersPage-WI4OSGBF.js.map +1 -0
- package/dist/{PageSingle-6U6GPMXJ.js → PageSingle-HRMSVNHN.js} +4 -4
- package/dist/{PageSingle-6U6GPMXJ.js.map → PageSingle-HRMSVNHN.js.map} +1 -1
- package/dist/{ProductDetails-OWSIL357.js → ProductDetails-GAC3NYQM.js} +10 -3
- package/dist/ProductDetails-GAC3NYQM.js.map +1 -0
- package/dist/{ProfilePage-LLCIJHAI.js → ProfilePage-33I2XTJ6.js} +10 -9
- package/dist/ProfilePage-33I2XTJ6.js.map +1 -0
- package/dist/{SeoCartWidget-ZL3FTBWK.js → SeoCartWidget-AEG2YLEF.js} +13 -12
- package/dist/SeoCartWidget-AEG2YLEF.js.map +1 -0
- package/dist/{SettingsPage-2XU5IF4A.js → SettingsPage-N3M677LP.js} +10 -9
- package/dist/SettingsPage-N3M677LP.js.map +1 -0
- package/dist/{StoreClosedNotification-CNJI2Q26.js → StoreClosedNotification-5MTDRRC3.js} +11 -10
- package/dist/{StoreClosedNotification-CNJI2Q26.js.map → StoreClosedNotification-5MTDRRC3.js.map} +1 -1
- package/dist/{TestimonialsPage-QYPLMNWL.js → TestimonialsPage-Z64P6MZX.js} +4 -4
- package/dist/{TestimonialsPage-QYPLMNWL.js.map → TestimonialsPage-Z64P6MZX.js.map} +1 -1
- package/dist/{ThankYouPage-WG3CM5JP.js → ThankYouPage-ZXQZMWCX.js} +14 -12
- package/dist/ThankYouPage-ZXQZMWCX.js.map +1 -0
- package/dist/{WalletPage-J7CH22JM.js → WalletPage-557AU5GH.js} +10 -9
- package/dist/WalletPage-557AU5GH.js.map +1 -0
- package/dist/{WishlistPage-ZXWYB56R.js → WishlistPage-HTDQW2N2.js} +150 -26
- package/dist/WishlistPage-HTDQW2N2.js.map +1 -0
- package/dist/api/brands.js +3 -3
- package/dist/api/cart.d.ts +7 -6
- package/dist/api/cart.d.ts.map +1 -1
- package/dist/api/cart.js +3 -3
- package/dist/api/category.js +3 -3
- package/dist/api/loyalty.js +3 -3
- package/dist/api/order.js +3 -3
- package/dist/api/page.js +3 -3
- package/dist/api/product.js +3 -3
- package/dist/api/store.d.ts +12 -0
- package/dist/api/store.d.ts.map +1 -1
- package/dist/api/store.js +1 -1
- package/dist/api/wishlist.js +4 -4
- package/dist/{chunk-3YVAYIM4.js → chunk-4KTY2FT6.js} +6 -6
- package/dist/{chunk-3YVAYIM4.js.map → chunk-4KTY2FT6.js.map} +1 -1
- package/dist/chunk-7V36I5GT.js +26 -0
- package/dist/chunk-7V36I5GT.js.map +1 -0
- package/dist/{chunk-OET4G4XC.js → chunk-BE3JDKE2.js} +19 -3
- package/dist/chunk-BE3JDKE2.js.map +1 -0
- package/dist/{chunk-2U3PUO3V.js → chunk-EIJXSBL6.js} +34 -17
- package/dist/chunk-EIJXSBL6.js.map +1 -0
- package/dist/{chunk-7OIP65ER.js → chunk-EQ32CL4D.js} +7 -4
- package/dist/chunk-EQ32CL4D.js.map +1 -0
- package/dist/{chunk-IZFZLJHD.js → chunk-EXKTSWBC.js} +5 -5
- package/dist/{chunk-IZFZLJHD.js.map → chunk-EXKTSWBC.js.map} +1 -1
- package/dist/{chunk-PK7EU5TM.js → chunk-GD26FI4J.js} +2 -2
- package/dist/chunk-GD26FI4J.js.map +1 -0
- package/dist/{chunk-YMVLYYLU.js → chunk-GOPUP26T.js} +4 -4
- package/dist/chunk-GOPUP26T.js.map +1 -0
- package/dist/{chunk-N4THXNXA.js → chunk-HSVGQ2DV.js} +12 -10
- package/dist/chunk-HSVGQ2DV.js.map +1 -0
- package/dist/{chunk-WH225GEC.js → chunk-I62RENKM.js} +3 -3
- package/dist/{chunk-WH225GEC.js.map → chunk-I62RENKM.js.map} +1 -1
- package/dist/{chunk-TDZSHACC.js → chunk-IC7YN4OQ.js} +3 -3
- package/dist/{chunk-TDZSHACC.js.map → chunk-IC7YN4OQ.js.map} +1 -1
- package/dist/{chunk-4DHLIY6V.js → chunk-IIYK56TI.js} +4 -3
- package/dist/chunk-IIYK56TI.js.map +1 -0
- package/dist/chunk-JKT44Y2M.js +14 -0
- package/dist/{chunk-ZPRZQTYM.js.map → chunk-JKT44Y2M.js.map} +1 -1
- package/dist/{chunk-W2B5P54C.js → chunk-KHRIGLYL.js} +3 -3
- package/dist/{chunk-W2B5P54C.js.map → chunk-KHRIGLYL.js.map} +1 -1
- package/dist/{chunk-NHKP5XIG.js → chunk-KILNHLWE.js} +4 -4
- package/dist/{chunk-NHKP5XIG.js.map → chunk-KILNHLWE.js.map} +1 -1
- package/dist/{chunk-ZQGMVUPE.js → chunk-KWHCKGLL.js} +3 -3
- package/dist/{chunk-ZQGMVUPE.js.map → chunk-KWHCKGLL.js.map} +1 -1
- package/dist/{chunk-LCJW7JKZ.js → chunk-LUTMPFRW.js} +4 -4
- package/dist/{chunk-LCJW7JKZ.js.map → chunk-LUTMPFRW.js.map} +1 -1
- package/dist/{chunk-YH4O3H4R.js → chunk-NPEI4SAZ.js} +3 -3
- package/dist/{chunk-YH4O3H4R.js.map → chunk-NPEI4SAZ.js.map} +1 -1
- package/dist/{chunk-JVGZDLFP.js → chunk-PE3LLBNR.js} +3 -3
- package/dist/{chunk-JVGZDLFP.js.map → chunk-PE3LLBNR.js.map} +1 -1
- package/dist/{chunk-3U26OMNO.js → chunk-PWBMSGMU.js} +24 -17
- package/dist/chunk-PWBMSGMU.js.map +1 -0
- package/dist/{chunk-VSJLPWFI.js → chunk-Q5UYV2EN.js} +3 -3
- package/dist/{chunk-VSJLPWFI.js.map → chunk-Q5UYV2EN.js.map} +1 -1
- package/dist/{chunk-GUGZ4CEG.js → chunk-S3CC2YGF.js} +3 -3
- package/dist/{chunk-GUGZ4CEG.js.map → chunk-S3CC2YGF.js.map} +1 -1
- package/dist/{chunk-NFTOMTTI.js → chunk-UFPZXWGM.js} +4 -4
- package/dist/{chunk-NFTOMTTI.js.map → chunk-UFPZXWGM.js.map} +1 -1
- package/dist/{chunk-TLAEW7TB.js → chunk-UH5ZXDEO.js} +3 -3
- package/dist/{chunk-TLAEW7TB.js.map → chunk-UH5ZXDEO.js.map} +1 -1
- package/dist/{chunk-3ITQB3PY.js → chunk-VLBQPVHM.js} +3 -3
- package/dist/{chunk-3ITQB3PY.js.map → chunk-VLBQPVHM.js.map} +1 -1
- package/dist/{chunk-TLO2M5TJ.js → chunk-W66OHTSM.js} +3 -3
- package/dist/{chunk-TLO2M5TJ.js.map → chunk-W66OHTSM.js.map} +1 -1
- package/dist/{chunk-6IDCWH5K.js → chunk-XFCJM6RN.js} +7 -7
- package/dist/{chunk-6IDCWH5K.js.map → chunk-XFCJM6RN.js.map} +1 -1
- package/dist/chunk-Y7HKVYDG.js +21 -0
- package/dist/chunk-Y7HKVYDG.js.map +1 -0
- package/dist/{chunk-VJHDE6UT.js → chunk-YEY3SO23.js} +3 -3
- package/dist/{chunk-VJHDE6UT.js.map → chunk-YEY3SO23.js.map} +1 -1
- package/dist/{chunk-FUIPNVQY.js → chunk-YLPI4HDD.js} +9 -6
- package/dist/chunk-YLPI4HDD.js.map +1 -0
- package/dist/{chunk-TFB3QXYH.js → chunk-ZGHRSRDO.js} +3 -2
- package/dist/chunk-ZGHRSRDO.js.map +1 -0
- package/dist/components/cart/CartItem.d.ts.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 +8 -7
- package/dist/components/home/index.js +11 -10
- package/dist/components/layout/index.js +1 -18
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/product/AddToCartForm.d.ts.map +1 -1
- package/dist/components/product/ProductCard.d.ts.map +1 -1
- package/dist/components/product/ProductDetails.d.ts.map +1 -1
- package/dist/components/product/index.js +9 -8
- package/dist/components/store/index.js +10 -9
- package/dist/components/store/index.js.map +1 -1
- package/dist/{document-class-7KPUN2DK.js → document-class-SKCL6IJF.js} +9 -9
- package/dist/{document-class-7KPUN2DK.js.map → document-class-SKCL6IJF.js.map} +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +8 -7
- package/dist/hooks/useComments.js +1 -1
- package/dist/hooks/useGtm.js +8 -7
- package/dist/hooks/useHostAttributes.d.ts +4 -0
- package/dist/hooks/useHostAttributes.d.ts.map +1 -0
- package/dist/hooks/useHostAttributes.js +4 -0
- package/dist/hooks/useHostAttributes.js.map +1 -0
- package/dist/hooks/useMoney.js +8 -7
- package/dist/hooks/useProduct.d.ts.map +1 -1
- package/dist/hooks/useProduct.js +1 -1
- package/dist/hooks/useStore.js +8 -7
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/{navigation-QMBOIYJI.js → navigation-ESPAHRXM.js} +5 -5
- package/dist/{navigation-QMBOIYJI.js.map → navigation-ESPAHRXM.js.map} +1 -1
- package/dist/{navigation-XZJCQXY3.js → navigation-YKRXGGSL.js} +4 -4
- package/dist/{navigation-XZJCQXY3.js.map → navigation-YKRXGGSL.js.map} +1 -1
- package/dist/{not-found-UE5XOV5C.js → not-found-KBOXJ3AG.js} +11 -10
- package/dist/not-found-KBOXJ3AG.js.map +1 -0
- package/dist/providers/TwilightProvider.d.ts.map +1 -1
- package/dist/providers/index.js +8 -7
- package/dist/providers/twilight-init.d.ts.map +1 -1
- package/dist/router/route-ids.d.ts +1 -0
- package/dist/router/route-ids.d.ts.map +1 -1
- package/dist/routes/account/orders.js +4 -4
- package/dist/routes/account/wishlist/WishlistPage.d.ts +1 -1
- package/dist/routes/account/wishlist/WishlistPage.d.ts.map +1 -1
- package/dist/routes/account/wishlist/WishlistShare.d.ts +1 -0
- package/dist/routes/account/wishlist/WishlistShare.d.ts.map +1 -1
- package/dist/routes/account.js +11 -11
- package/dist/routes/blog.js +8 -8
- package/dist/routes/brands.js +4 -4
- package/dist/routes/cart/CartPage.d.ts.map +1 -1
- package/dist/routes/cart.js +17 -16
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home.js +12 -11
- package/dist/routes/index.d.ts +1 -1
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +3 -3
- package/dist/routes/loyalty/LoyaltyPage.d.ts +1 -1
- package/dist/routes/loyalty/LoyaltyPage.d.ts.map +1 -1
- package/dist/routes/loyalty/LoyaltyPointsPage.d.ts +3 -0
- package/dist/routes/loyalty/LoyaltyPointsPage.d.ts.map +1 -0
- package/dist/routes/loyalty/index.d.ts +15 -3
- package/dist/routes/loyalty/index.d.ts.map +1 -1
- package/dist/routes/loyalty/loader.d.ts +2 -1
- package/dist/routes/loyalty/loader.d.ts.map +1 -1
- package/dist/routes/loyalty/types.d.ts +3 -0
- package/dist/routes/loyalty/types.d.ts.map +1 -1
- package/dist/routes/loyalty.js +62 -11
- package/dist/routes/loyalty.js.map +1 -1
- package/dist/routes/page.js +4 -4
- package/dist/routes/product/index.d.ts.map +1 -1
- package/dist/routes/product-listing/index.d.ts.map +1 -1
- package/dist/routes/product-listing.js +23 -19
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +16 -13
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/seo-redirects.js +3 -3
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you/ThankYouPage.d.ts.map +1 -1
- package/dist/routes/thank-you.js +4 -4
- package/dist/skeleton.js +12 -11
- package/dist/tanstack/document-class.d.ts.map +1 -1
- package/dist/tanstack/head.d.ts +1 -4
- package/dist/tanstack/head.d.ts.map +1 -1
- package/dist/tanstack/router.d.ts.map +1 -1
- package/dist/tanstack/templates/locale-wrapper.d.ts.map +1 -1
- package/dist/tanstack.js +10 -10
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/salla-sdk.d.ts +1 -1
- package/dist/types/salla-sdk.d.ts.map +1 -1
- package/dist/utils/head.d.ts +3 -0
- package/dist/utils/head.d.ts.map +1 -1
- package/dist/utils/head.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/vite/adapters/tanstack.adapter.d.ts.map +1 -1
- package/dist/vite/index.js +92 -11
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugins/best-practices/hooks-registry.d.ts.map +1 -1
- package/dist/vite/plugins/component-deps.d.ts +5 -0
- package/dist/vite/plugins/component-deps.d.ts.map +1 -0
- package/dist/vite/plugins/package-aliases.plugin.d.ts.map +1 -1
- package/package.json +5 -1
- package/dist/AddToCartForm-RAQX7VHU.js.map +0 -1
- package/dist/BlogAuthorPage-HV6JUJNL.js.map +0 -1
- package/dist/BlogCategoryPage-ATPIVUAL.js.map +0 -1
- package/dist/BlogPage-6IIOSB45.js.map +0 -1
- package/dist/BlogSinglePage-DV3XYB26.js.map +0 -1
- package/dist/BlogTagPage-RVJIXERD.js.map +0 -1
- package/dist/BrandsPage-RQXP67LV.js.map +0 -1
- package/dist/Breadcrumb-NXXVZJJD.js.map +0 -1
- package/dist/CartItem-XRWTSJB5.js.map +0 -1
- package/dist/CartSummary-F6BY5APF.js.map +0 -1
- package/dist/CustomerLayout-T5BSTU6T.js.map +0 -1
- package/dist/LoyaltyPage-AIUDZLT7.js +0 -194
- package/dist/LoyaltyPage-AIUDZLT7.js.map +0 -1
- package/dist/MobileMenu-A5DBTPS7.js.map +0 -1
- package/dist/NotificationsPage-T2O67MLD.js.map +0 -1
- package/dist/OrderSinglePage-4W4JZX7I.js.map +0 -1
- package/dist/OrdersPage-DYKFBMRC.js.map +0 -1
- package/dist/ProductDetails-OWSIL357.js.map +0 -1
- package/dist/ProfilePage-LLCIJHAI.js.map +0 -1
- package/dist/SeoCartWidget-ZL3FTBWK.js.map +0 -1
- package/dist/SettingsPage-2XU5IF4A.js.map +0 -1
- package/dist/ThankYouPage-WG3CM5JP.js.map +0 -1
- package/dist/WalletPage-J7CH22JM.js.map +0 -1
- package/dist/WishlistPage-ZXWYB56R.js.map +0 -1
- package/dist/chunk-2U3PUO3V.js.map +0 -1
- package/dist/chunk-3U26OMNO.js.map +0 -1
- package/dist/chunk-4DHLIY6V.js.map +0 -1
- package/dist/chunk-7OIP65ER.js.map +0 -1
- package/dist/chunk-FUIPNVQY.js.map +0 -1
- package/dist/chunk-N4THXNXA.js.map +0 -1
- package/dist/chunk-OET4G4XC.js.map +0 -1
- package/dist/chunk-PK7EU5TM.js.map +0 -1
- package/dist/chunk-TFB3QXYH.js.map +0 -1
- package/dist/chunk-YMVLYYLU.js.map +0 -1
- package/dist/chunk-ZPRZQTYM.js +0 -14
- package/dist/not-found-UE5XOV5C.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/apply-theme.ts","../src/providers/twilight-theme.ts","../src/utils/engine-version.ts","../src/providers/twilight-init.ts","../src/providers/navigation-setups.ts","../src/providers/DocumentSyncRegistry.ts","../src/hooks/useDate.ts","../src/hooks/useNumber.ts","../src/hooks/useMoney.tsx","../src/hooks/useGtm.ts","../src/hooks/useOpeningHours.ts","../src/hooks/usePageConfig.ts","../src/utils/breadcrumb.ts","../src/hooks/useBreadcrumbs.ts","../src/utils/fast-checkout.ts","../src/hooks/registerDefaultHooks.tsx","../src/components/layout/Footer.tsx","../src/components/layout/MasterLayout.tsx","../src/components/snippets/AppsSnippets.tsx","../src/providers/TwilightProvider.tsx","../src/hooks/useStore.ts"],"names":["color","useEffect","lazy","useMemo","useState","jsx","id","jsxs","Fragment","Suspense","getSalla","React","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAAS,WAAW,KAAA,EAAoB;AAC7C,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AAErC,EAAA,MAAM,OAA2B,EAAC;AAElC,EAAA,IAAI,KAAA,CAAM,MAAM,IAAA,EAAM;AACpB,IAAA,IAAA,CAAK,IAAA;AAAA,MACH,CAAC,aAAA,EAAe,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAAA,MAC/B,CAAC,cAAA,EAAgB,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAAA,MAChC,CAAC,gBAAA,EAAkB,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAAA,MAClC,CAAC,eAAA,EAAiB,CAAA,EAAG,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA,OAAA,CAAS,CAAA;AAAA,MAC7C,CAAC,aAAA,EAAe,CAAA,EAAG,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA,KAAA,CAAO;A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,GAAA,EACH,GACF,CAAA,EACF,CAAA;AAEJ;;;ACzSO,SAAS,QAAA,GAA2B;AACzC,EAAA,MAAM,EAAE,KAAA,EAAO,SAAA,EAAW,KAAA,KAAU,WAAA,EAAY;AAEhD,EAAA,MAAM,OAAA,GAAUO,YAAY,YAAY;AACtC,IAAA,IAAI,CAAC,KAAA,EAAO;AACZ,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,GAAO,KAAA,CAAM,MAAA,CAAO,GAAA,EAAI;AAC9B,MAAA,IAAI,IAAA,EAAM,KAAA,IAAS,OAAO,IAAA,CAAK,UAAU,QAAA,EAAU;AACjD,QAAA,SAAA,CAAU,CAAC,UAAU,EAAE,GAAG,MAAM,GAAI,IAAA,CAAK,OAAyB,CAAE,CAAA;AAAA,MACtE;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAS,CAAC,CAAA;AAErB,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,OAAA,EAAQ;AAC7B","file":"chunk-2U3PUO3V.js","sourcesContent":["import type { Theme } from '../types';\nimport { color as makeColor } from './color';\n\nexport function applyTheme(theme: Theme): void {\n if (typeof document === 'undefined') return;\n\n const vars: [string, string][] = [];\n\n if (theme.font?.name) {\n vars.push(\n ['--font-main', theme.font.name],\n ['--font-light', theme.font.name],\n ['--font-regular', theme.font.name],\n ['--font-medium', `${theme.font.name}-Medium`],\n ['--font-bold', `${theme.font.name}-Bold`]\n );\n }\n\n const { color } = theme;\n if (color) {\n vars.push(['--color-text', '#222222']);\n\n if (color.primary) {\n const c = makeColor(color.primary);\n vars.push(\n ['--color-primary', color.primary],\n ['--color-primary-dark', c.darken(0.15)],\n ['--color-primary-light', c.lighten(0.15)],\n ['--color-title', color.primary],\n ['--color-secondary', color.primary]\n );\n }\n\n if (color.reverse_text) {\n vars.push(\n ['--color-primary-reverse', color.reverse_text],\n ['--color-text-reverse', color.reverse_text],\n ['--color-reverse-text', color.reverse_text]\n );\n }\n\n if (color.reverse_primary) {\n vars.push(['--color-reverse-primary', color.reverse_primary]);\n }\n }\n\n vars.push(['--page-height', '100%']);\n\n const root = document.documentElement;\n for (const [prop, val] of vars) {\n root.style.setProperty(prop, val);\n }\n}\n","import { useEffect } from 'react';\nimport { applyTheme } from '../utils/apply-theme';\nimport { useDocumentClass } from '../hooks/useDocumentClass';\nimport type { Theme } from '../types';\n\nexport function fontToClass(name: string | undefined): string | null {\n if (!name) return null;\n const slug = name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n return slug ? `font-${slug}` : null;\n}\n\nexport function ThemeDocumentSync({\n theme,\n locale,\n direction,\n isMobileWebview,\n}: {\n theme: Theme;\n locale: string;\n direction: 'rtl' | 'ltr';\n isMobileWebview: boolean;\n}): null {\n const bodyClasses = [\n theme.name ? `salla-${theme.name}` : null,\n `color-mode-${theme.color?.is_dark ? 'dark' : 'light'}`,\n direction,\n theme.mode === 'preview' ? 'preview-mode' : null,\n fontToClass(theme.font?.name),\n isMobileWebview ? 'mobile-webview' : null,\n theme.settings?.footer_is_dark ? 'footer-is-dark' : 'footer-is-light',\n theme.settings?.topnav_is_dark ? 'topnav-is-dark' : null,\n theme.settings?.sticky_add_to_cart ? 'is-sticky-product-bar' : null,\n ].filter(Boolean) as string[];\n\n useDocumentClass({\n html: { lang: locale, dir: direction },\n body: { class: bodyClasses },\n });\n\n useEffect(() => {\n applyTheme(theme);\n }, [theme]);\n\n return null;\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import { type Dispatch, type SetStateAction, useEffect, useMemo, useState } from 'react';\nimport type { SallaCurrency, SallaSDK } from '../types/salla-sdk';\nimport { useDevSettingsOverrides } from '../dev/dev-settings-store';\nimport { getTwilightContext } from '../twilight/context';\nimport type { Store, Theme } from '../types';\nimport { syncScopeCookie } from '../utils/cookies';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { type StoreContext, syncSdkLocale } from '../utils/sdk-helpers';\nimport { getLanguageInfo } from './locale-constants';\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\nfunction getSalla(): SallaSDK | undefined {\n if (typeof window === 'undefined') return undefined;\n return window.salla;\n}\n\n// ─── Hook ─────────────────────────────────────────────────────────────────────\n\nexport interface UseTwilightInitOptions {\n debug: boolean;\n initialData?: StoreContext | Record<string, unknown>;\n onReady?: (data: { store: Store; theme: Theme }) => void;\n onError?: (error: Error) => void;\n initialLocale: string;\n}\n\nexport interface UseTwilightInitReturn {\n isReady: boolean;\n storeData: Store;\n setStoreData: Dispatch<SetStateAction<Store>>;\n themeData: Theme;\n currency: SallaCurrency | null;\n isMobileWebview: boolean;\n}\n\nexport function useTwilightInit({\n debug: _debug,\n initialData,\n onReady,\n onError: _onError,\n initialLocale,\n}: UseTwilightInitOptions): UseTwilightInitReturn {\n const isBrowser = typeof window !== 'undefined';\n const initialLanguage = getLanguageInfo(initialLocale);\n const settingsData = initialData as StoreContext | undefined;\n\n const [isReady, setReady] = useState<boolean>(() => !!settingsData);\n const [storeData, setStoreData] = useState<Store>(\n () => (settingsData?.store as Store) ?? ({} as Store)\n );\n const [baseTheme] = useState<Theme>(() => {\n const theme = settingsData?.theme as Partial<Theme> | undefined;\n if (theme) {\n return {\n ...theme,\n is_rtl: theme.is_rtl ?? initialLanguage.dir === 'rtl',\n } as Theme;\n }\n return { is_rtl: initialLanguage.dir === 'rtl' } as Theme;\n });\n\n // Dev-mode only: overlay the settings the DevSettingsWidget has enabled onto\n // the real theme so the storefront renders with them live. `import.meta.env.DEV`\n // is statically false in production builds, so this whole branch (and the\n // overrides hook's effect) is dead-code-eliminated from the shipped bundle.\n const devOverrides = useDevSettingsOverrides();\n const themeData = useMemo<Theme>(() => {\n if (import.meta.env.DEV && devOverrides.enabled) {\n const overrides = devOverrides.settings;\n if (overrides && Object.keys(overrides).length > 0) {\n return {\n ...baseTheme,\n settings: { ...(baseTheme.settings ?? {}), ...overrides } as Theme['settings'],\n };\n }\n }\n return baseTheme;\n }, [baseTheme, devOverrides]);\n const [currency] = useState<SallaCurrency | null>(null);\n const [isMobileWebview] = useState<boolean>(false); // todo :: add a flage in the store data for mobile\n\n useEffect(() => {\n if (!isBrowser || !themeData) return;\n const sdk = getSalla();\n sdk?.config?.set?.('theme.is_rtl', themeData.is_rtl ?? false);\n window.enable_more_menu = String(themeData.settings?.enable_more_menu ?? true);\n }, [themeData, isBrowser]);\n\n useEffect(() => {\n const sdk = getSalla();\n if (!sdk) return;\n\n // Expose which engine build rendered this storefront (salla.versions.engine)\n // for debugging and support tooling. Merged, not assigned, so other Salla\n // packages can register their own versions on the same object.\n const sdkWithVersions = sdk as SallaSDK & { versions?: Record<string, string> };\n sdkWithVersions.versions = { ...sdkWithVersions.versions, engine: ENGINE_VERSION };\n\n if (initialLocale) {\n // Sync UI translations + the SDK's axios accept-language header to the route locale.\n // The header set may be a no-op now if the SDK isn't fully ready; it's re-asserted\n // after onReady below, and on every navigation in rootBeforeLoad.\n syncSdkLocale(initialLocale);\n }\n\n if (typeof sdk.init !== 'function') return;\n\n const ctx = getTwilightContext();\n const pageCtx = ctx.page;\n const initData = pageCtx\n ? {\n ...settingsData,\n page: {\n ...pageCtx,\n url: pageCtx.url ?? ctx.location.pathname + ctx.location.searchStr,\n },\n }\n : settingsData;\n\n sdk.init(initData);\n\n const initSdk = async () => {\n try {\n await sdk.onReady();\n } catch {\n // sdk.onReady() may fail during partial initialization\n }\n\n // The SDK loads async; the sync above may have run against a not-yet-ready SDK.\n // Now that it's ready, re-assert so the very first SDK API calls use the route locale.\n syncSdkLocale(initialLocale);\n\n // Mirror the selected branch into the `scope` cookie so the NEXT SSR request keys\n // its settings query on the same scope the client does. rootBeforeLoad also calls\n // this, but only from a client-side navigation: on the initial load TanStack\n // restores the root match's __beforeLoadContext instead of re-running beforeLoad,\n // so a visitor who never navigates would otherwise never write the cookie. Here is\n // the earliest point salla.storage is guaranteed populated.\n syncScopeCookie();\n\n setReady(true);\n document.dispatchEvent(new CustomEvent('theme::ready'));\n\n onReady?.({\n store: storeData,\n theme: themeData,\n });\n };\n\n initSdk();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- Intentional: SDK init runs once per locale change only\n }, [initialLocale]);\n\n return {\n isReady,\n storeData,\n setStoreData,\n themeData,\n currency,\n isMobileWebview,\n };\n}\n","import { lazy, type LazyExoticComponent, type FC, type ReactNode } from 'react';\n\nexport const navigationSetups: Record<string, LazyExoticComponent<FC<{ children: ReactNode }>>> = {\n tanstack: lazy(() =>\n import('../tanstack/navigation').then((m) => ({ default: m.NavigationSetup }))\n ),\n nextjs: lazy(() => import('../nextjs/navigation').then((m) => ({ default: m.NavigationSetup }))),\n};\n","import { lazy, type FC, type LazyExoticComponent } from 'react';\n\n/**\n * Registry for framework-specific document sync components.\n * Each framework (tanstack, nextjs, etc.) can register its own sync component.\n * Used by TwilightProvider to automatically apply route-based body classes.\n *\n * @example Adding a new framework\n * ```ts\n * import { registerDocumentSync } from '@salla.sa/twilight-theme-engine';\n *\n * registerDocumentSync('my-framework', lazy(() => import('./my-document-sync')));\n * ```\n */\nexport const routeDocumentSyncs: Record<string, LazyExoticComponent<FC>> = {\n tanstack: lazy(() =>\n import('../tanstack/document-class').then((m) => ({\n default: m.TanStackDocumentSync,\n }))\n ),\n // Add other frameworks here:\n // nextjs: lazy(() => import('../nextjs/document-sync').then(m => ({ default: m.NextjsDocumentSync }))),\n};\n\n/**\n * Register a framework-specific document sync component.\n * Convenience function for adding new frameworks to the registry.\n */\nexport function registerDocumentSync(framework: string, component: LazyExoticComponent<FC>): void {\n routeDocumentSyncs[framework] = component;\n}\n","import { useTranslation } from '../providers/I18nProvider';\n\ntype DateFormat = 'full' | 'long' | 'medium' | 'short' | 'time';\n\nexport type DateInput =\n | string\n | number\n | Date\n | { date: string; timezone_type: number; timezone: string }\n | undefined;\n\nfunction normalizeDate(input: DateInput): Date {\n if (!input) return new Date();\n if (input instanceof Date) return input;\n if (typeof input === 'number') return new Date(input);\n if (typeof input === 'object' && 'date' in input) return new Date(input.date);\n return new Date(input);\n}\n\nexport interface UseDateResult {\n format: (date: DateInput, formatType?: DateFormat) => string;\n ago: (date: DateInput) => string;\n now: Date;\n}\n\n/**\n * useDate - Hook for formatting dates\n *\n * @example\n * const { format, ago, now } = useDate();\n * format('2024-03-15') // 'March 15, 2024'\n * format('2024-03-15', 'full') // 'Friday, March 15, 2024'\n * ago(Date.now() - 3600000) // '1 hour ago'\n * now // current Date object\n */\nexport function useDate(): UseDateResult {\n const { locale } = useTranslation();\n\n const format = (date: DateInput, formatType: DateFormat = 'medium'): string => {\n const dateObj = normalizeDate(date);\n\n const formatOptionsMap: Record<DateFormat, Intl.DateTimeFormatOptions> = {\n full: { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' },\n long: { year: 'numeric', month: 'long', day: 'numeric' },\n medium: { year: 'numeric', month: 'long', day: 'numeric' },\n short: { year: 'numeric', month: 'short', day: 'numeric' },\n time: { hour: '2-digit', minute: '2-digit' },\n };\n\n try {\n return new Intl.DateTimeFormat(locale, formatOptionsMap[formatType]).format(dateObj);\n } catch {\n return dateObj.toLocaleDateString(locale);\n }\n };\n\n const ago = (date: DateInput): string => {\n const dateObj = normalizeDate(date);\n const diffInSeconds = Math.floor((Date.now() - dateObj.getTime()) / 1000);\n\n const units: Array<{ unit: Intl.RelativeTimeFormatUnit; threshold: number; divisor: number }> =\n [\n { unit: 'year', threshold: 31536000, divisor: 31536000 },\n { unit: 'month', threshold: 2592000, divisor: 2592000 },\n { unit: 'week', threshold: 604800, divisor: 604800 },\n { unit: 'day', threshold: 86400, divisor: 86400 },\n { unit: 'hour', threshold: 3600, divisor: 3600 },\n { unit: 'minute', threshold: 60, divisor: 60 },\n { unit: 'second', threshold: 1, divisor: 1 },\n ];\n\n for (const { unit, threshold, divisor } of units) {\n if (diffInSeconds >= threshold) {\n const value = Math.floor(diffInSeconds / divisor);\n try {\n return new Intl.RelativeTimeFormat(locale, { numeric: 'auto', style: 'long' }).format(\n -value,\n unit\n );\n } catch {\n return new Intl.RelativeTimeFormat('en', { numeric: 'auto' }).format(-value, unit);\n }\n }\n }\n\n return locale.startsWith('ar') ? 'الآن' : 'just now';\n };\n\n return { format, ago, now: new Date() };\n}\n","import { useTwilight } from '../providers/TwilightProvider';\n\nconst ARABIC_NUMERALS = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];\n\nconst toArabic = (input: number | string): string => {\n const str = String(input);\n return str.replace(/[0-9]/g, (d) => ARABIC_NUMERALS[parseInt(d)]);\n};\n\n/**\n * UseNumberResult - Return type for useNumber hook\n */\nexport interface UseNumberResult {\n /** Format number with store settings */\n format: (number: number | string) => string;\n /** Convert to Arabic numerals */\n toArabic: (input: number | string) => string;\n /** Whether Arabic numerals are enabled */\n useArabicNumerals: boolean;\n}\n\n/**\n * useNumber - Hook for number formatting\n *\n * @returns Object with number formatting utilities\n *\n * @example\n * const { format, toArabic, useArabicNumerals } = useNumber();\n * format(1234) // '١٢٣٤' if arabic numbers enabled, else '1234'\n * toArabic(1234) // '١٢٣٤'\n * useArabicNumerals // boolean from store settings\n */\nexport function useNumber(): UseNumberResult {\n const { store } = useTwilight();\n const useArabicNumerals = store?.settings?.arabic_numbers_enabled ?? false;\n\n const format = (number: number | string): string => {\n return useArabicNumerals ? toArabic(number) : String(number);\n };\n\n return {\n /** Format number with store settings */\n format,\n /** Convert to Arabic numerals */\n toArabic,\n /** Whether Arabic numerals are enabled */\n useArabicNumerals,\n };\n}\n","import { useTwilight } from '../providers/TwilightProvider';\nimport { useTranslation } from '../providers/I18nProvider';\nimport React from 'react';\n\nconst AR_LOCALE = 'ar';\nconst SAR_CURRENCY = 'SAR';\n\nconst intlCache = new Map<string, Intl.NumberFormat>();\nfunction getCachedIntl(loc: string, opts: Intl.NumberFormatOptions): Intl.NumberFormat {\n const key = `${loc}|${JSON.stringify(opts)}`;\n let fmt = intlCache.get(key);\n if (!fmt) {\n fmt = new Intl.NumberFormat(loc, opts);\n intlCache.set(key, fmt);\n }\n return fmt;\n}\n\n/**\n * Parse a money string to a number.\n *\n * Locale-agnostic by design: normalises both Western (`,.`) and\n * Arabic-Indic (`٬`, `٫`) separators using fixed rules. Do NOT add\n * locale-dependent separator logic here — if per-locale rules are\n * ever needed, refactor back into the hook body where `locale`\n * is available.\n */\nconst parse = (moneyString: string): number => {\n const cleaned = moneyString.replace(/[^\\d.,٬٫]/g, '');\n const normalized = cleaned.replace(/٬/g, '').replace(/٫/g, '.');\n const parts = normalized.split(/[.,]/);\n if (parts.length > 2) {\n return parseFloat(`${parts.slice(0, -1).join('')}.${parts[parts.length - 1]}`);\n }\n return parseFloat(normalized.replace(/,/g, ''));\n};\n\n/**\n * Check if a value is a valid monetary amount.\n *\n * Locale-agnostic: accepts numbers and numeric strings only.\n */\nconst isValid = (value: unknown): boolean => {\n if (typeof value === 'number' && !isNaN(value) && isFinite(value)) return true;\n if (typeof value === 'string') {\n const parsed = parseFloat(value);\n return !isNaN(parsed) && isFinite(parsed);\n }\n return false;\n};\n\n/**\n * UseMoneyResult - Return type for useMoney hook\n */\nexport interface UseMoneyResult {\n /** Format amount with currency */\n format: (\n amount: number | string | undefined,\n options?: { currency?: string; locale?: string; type?: 'product' | 'general' }\n ) => React.ReactNode;\n /** Parse money string to number */\n parse: (moneyString: string) => number;\n /** Check if value is valid monetary amount */\n isValid: (value: unknown) => boolean;\n}\n\n/**\n * useMoney - Hook for formatting monetary values\n *\n * @example\n * const { format, parse, isValid } = useMoney();\n * // Render price (SAR shows with icon):\n * <span>{format(100)}</span> // '100.00' with <i className=\"sicon-sar\" />\n */\nexport function useMoney(): UseMoneyResult {\n const { store } = useTwilight();\n const { locale } = useTranslation();\n const useArabicNumerals = store?.settings?.arabic_numbers_enabled ?? false;\n\n const format = (\n amount: number | string | undefined,\n options?: { currency?: string; locale?: string; type?: 'product' | 'general' }\n ): React.ReactNode => {\n const currency = options?.currency ?? 'SAR';\n const loc = options?.locale ?? locale;\n const type = options?.type ?? 'product'; // Default to 'product'\n\n // Handle undefined or null case\n if (amount == null || amount === '') {\n const showDash = type === 'product' ? store?.settings?.product?.show_price_as_dash : false; // General type defaults to not showing dash\n\n return showDash ? '-' : '';\n }\n\n const numericAmount = typeof amount === 'string' ? parseFloat(amount) : amount;\n\n if (typeof amount === 'string' && amount === '-') return amount;\n if (isNaN(numericAmount)) return String(amount);\n\n // Handle zero amounts with dash based on settings\n if (!numericAmount && numericAmount !== 0) {\n // This covers cases where amount evaluates to falsy but isn't explicitly 0\n const showDash = type === 'product' ? store?.settings?.product?.show_price_as_dash : false; // General type defaults to not showing dash\n\n return showDash ? '-' : '';\n }\n\n let formatted = getCachedIntl(loc, {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n }).format(numericAmount);\n\n // Apply Arabic numerals if enabled\n if (useArabicNumerals && loc.startsWith(AR_LOCALE)) {\n formatted = formatted.replace(/[0-9]/g, (d) => '٠١٢٣٤٥٦٧٨٩'[parseInt(d)]);\n }\n\n // For SAR, return with icon element\n if (currency === SAR_CURRENCY) {\n return (\n <>\n {formatted} <i className=\"sicon-sar\" />\n </>\n );\n }\n\n // For non-SAR currencies, try standard currency formatting\n try {\n return getCachedIntl(loc, {\n style: 'currency',\n currency,\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n }).format(numericAmount);\n } catch {\n return `${formatted} ${currency}`;\n }\n };\n\n return { format, parse, isValid };\n}\n","import { useCallback } from 'react';\nimport type { Product, Cart, CartItem } from '../types';\nimport { useTwilight } from '../providers/TwilightProvider';\nimport { useUser } from './useUser';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface UseGtmResult {\n /** Check if GTM is enabled */\n enabled: boolean;\n /** Raw push to dataLayer */\n push: (data: Record<string, unknown>) => void;\n /** Track page view */\n viewPage: (pageType: string) => void;\n /** Track product detail view */\n detail: (product: Product) => void;\n /** Track product impressions (listing) */\n impressions: (products: Product[], list?: string) => void;\n /** Track product click */\n click: (product: Product, list?: string, position?: number) => void;\n /** Track add to cart */\n add: (product: Product, quantity?: number) => void;\n /** Track remove from cart */\n remove: (item: CartItem) => void;\n /** Track checkout */\n checkout: (cart: Cart, step?: number) => void;\n /** Track purchase */\n purchase: (orderId: string | number, cart: Cart) => void;\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\n/** Generate unique event ID */\nfunction eventId(prefix: string): string {\n return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;\n}\n\n/** Convert Product to GTM format */\nfunction toProduct(product: Product, overrides?: Record<string, unknown>): Record<string, unknown> {\n return {\n id: product.id,\n name: product.name,\n price: product.sale_price,\n brand: product.brand?.name,\n category: product.category?.name,\n quantity: 1,\n ...overrides,\n };\n}\n\n/** Get currency from product or fallback */\nfunction getCurrency(product?: Product, fallback = 'SAR'): string {\n return product?.currency ?? fallback;\n}\n\n// ============================================================================\n// Hook Implementation\n// ============================================================================\n\n/**\n * useGtm - Google Tag Manager hook for tracking events\n *\n * @example\n * ```tsx\n * function ProductPage({ product }) {\n * const gtm = useGtm();\n *\n * useEffect(() => { gtm.detail(product); }, [product.id]);\n * return <button onClick={() => gtm.add(product)}>Add to Cart</button>;\n * }\n * ```\n */\nexport function useGtm(): UseGtmResult {\n const { store } = useTwilight();\n const { data: user } = useUser();\n\n const gtmIds = store.settings?.keys?.gtm;\n const enabled = !!(gtmIds && gtmIds.length > 0);\n const currency = user?.preferences?.currency_code ?? 'SAR';\n\n const push = useCallback(\n (data: Record<string, unknown>) => {\n if (!enabled) return;\n window.dataLayer = window.dataLayer || [];\n window.dataLayer.push(data);\n },\n [enabled]\n );\n\n const viewPage = useCallback((pageType: string) => push({ event: 'viewPage', pageType }), [push]);\n\n const detail = useCallback(\n (product: Product) =>\n push({\n event: 'detail',\n ecommerce: {\n currencyCode: getCurrency(product, currency),\n event_id: eventId('detail'),\n detail: { products: [toProduct(product)] },\n },\n }),\n [push, currency]\n );\n\n const impressions = useCallback(\n (products: Product[], list?: string) => {\n if (products.length === 0) return;\n push({\n event: 'impressions',\n ecommerce: {\n currencyCode: getCurrency(products[0], currency),\n event_id: eventId('impressions'),\n impressions: {\n products: products.map((p, i) => toProduct(p, { position: i + 1, list })),\n },\n },\n });\n },\n [push, currency]\n );\n\n const click = useCallback(\n (product: Product, list?: string, position?: number) =>\n push({\n event: 'click',\n ecommerce: {\n currencyCode: getCurrency(product, currency),\n event_id: eventId('click'),\n click: {\n actionField: { list },\n products: [toProduct(product, { position, list })],\n },\n },\n }),\n [push, currency]\n );\n\n const add = useCallback(\n (product: Product, quantity = 1) =>\n push({\n event: 'addToCart',\n ecommerce: {\n currencyCode: getCurrency(product, currency),\n event_id: eventId('addToCart'),\n add: { products: [toProduct(product, { quantity })] },\n },\n }),\n [push, currency]\n );\n\n const remove = useCallback(\n (item: CartItem) =>\n push({\n event: 'removeFromCart',\n ecommerce: {\n currencyCode: currency,\n event_id: eventId('removeFromCart'),\n remove: {\n products: [\n {\n id: item.product_id,\n name: item.product_name,\n price: typeof item.price === 'number' ? item.price : item.price.amount,\n quantity: item.quantity,\n },\n ],\n },\n },\n }),\n [push, currency]\n );\n\n const checkout = useCallback(\n (cart: Cart, step = 1) =>\n push({\n event: 'checkout',\n ecommerce: {\n currencyCode: currency,\n event_id: eventId('checkout'),\n checkout: {\n actionField: { step, id: cart.id },\n products: cart.items.map((item) => ({\n id: item.product_id,\n name: item.product_name,\n price: typeof item.price === 'number' ? item.price : item.price.amount,\n quantity: item.quantity,\n })),\n },\n },\n }),\n [push, currency]\n );\n\n const purchase = useCallback(\n (orderId: string | number, cart: Cart) =>\n push({\n event: 'purchase',\n ecommerce: {\n currencyCode: currency,\n event_id: eventId('purchase'),\n purchase: {\n actionField: {\n id: orderId,\n revenue: cart.total,\n tax: cart.tax_amount,\n coupon: cart.coupon,\n },\n products: cart.items.map((item) => ({\n id: item.product_id,\n name: item.product_name,\n price: typeof item.price === 'number' ? item.price : item.price.amount,\n quantity: item.quantity,\n })),\n },\n },\n }),\n [push, currency]\n );\n\n return { enabled, push, viewPage, detail, impressions, click, add, remove, checkout, purchase };\n}\n","import { useMemo } from 'react';\nimport { useTranslation } from '../providers/I18nProvider';\nimport type { OpeningHoursSettings } from '../types';\n\ntype DayOfWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';\n\nconst DAYS: DayOfWeek[] = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n 'saturday',\n 'sunday',\n];\n\nconst DAY_NAMES: Record<string, string> = {\n monday: 'common.days.monday',\n tuesday: 'common.days.tuesday',\n wednesday: 'common.days.wednesday',\n thursday: 'common.days.thursday',\n friday: 'common.days.friday',\n saturday: 'common.days.saturday',\n sunday: 'common.days.sunday',\n};\n\nconst TIME_NAMES: Record<string, string> = {\n AM: 'common.time.am',\n PM: 'common.time.pm',\n};\n\ninterface ParsedTimeRange {\n start: number; // minutes from midnight\n end: number; // minutes from midnight\n}\n\ninterface DaySchedule {\n ranges: ParsedTimeRange[];\n}\n\nexport interface UseOpeningHoursResult {\n /** Whether the store is currently open */\n isOpen: boolean;\n /** Whether opening hours feature is enabled and configured */\n isEnabled: boolean;\n /** Next opening time as Date object, null if currently open or not configured */\n nextOpen: Date | null;\n /** Formatted next opening time string, empty if currently open or not configured */\n nextOpenFormatted: string;\n}\n\n/**\n * Parse a time string like \"09:00\" or \"9:00 AM\" to minutes from midnight.\n */\nfunction parseTime(timeStr: string): number {\n const cleaned = timeStr.trim().toLowerCase();\n const match = cleaned.match(/^(\\d{1,2}):(\\d{2})(?:\\s*(am|pm))?$/);\n\n if (!match) {\n return 0;\n }\n\n let hours = parseInt(match[1], 10);\n const minutes = parseInt(match[2], 10);\n const meridiem = match[3];\n\n if (meridiem === 'pm' && hours < 12) {\n hours += 12;\n } else if (meridiem === 'am' && hours === 12) {\n hours = 0;\n }\n\n return hours * 60 + minutes;\n}\n\n/**\n * Parse opening hours ranges for a day.\n * Input format: [\"09:00-12:00\", \"13:00-18:00\"] or [\"09:00 AM - 12:00 PM\"]\n */\nfunction parseRanges(ranges: string[]): ParsedTimeRange[] {\n return ranges\n .map((range) => {\n const parts = range.split('-').map((s) => s.trim());\n if (parts.length !== 2) return null;\n\n const start = parseTime(parts[0]);\n const end = parseTime(parts[1]);\n\n return { start, end };\n })\n .filter((r): r is ParsedTimeRange => r !== null && r.start < r.end);\n}\n\n/**\n * Convert day index (0 = Monday) to day name.\n */\nfunction indexToDay(index: number): DayOfWeek {\n return DAYS[index % 7];\n}\n\n/**\n * Get the day index for a date (0 = Monday, 6 = Sunday).\n */\nfunction getDayIndex(date: Date): number {\n const jsDay = date.getDay(); // 0 = Sunday, 1 = Monday, etc.\n return jsDay === 0 ? 6 : jsDay - 1; // Convert to 0 = Monday\n}\n\n/**\n * Get current time in minutes from midnight.\n */\nfunction getTimeInMinutes(date: Date): number {\n return date.getHours() * 60 + date.getMinutes();\n}\n\n/**\n * Check if the given time falls within any of the ranges.\n */\nfunction isInRanges(time: number, ranges: ParsedTimeRange[]): boolean {\n return ranges.some((range) => time >= range.start && time < range.end);\n}\n\n/**\n * Find the next time range that starts after the given time.\n */\nfunction findNextRange(time: number, ranges: ParsedTimeRange[]): ParsedTimeRange | null {\n const sorted = [...ranges].sort((a, b) => a.start - b.start);\n return sorted.find((range) => range.start > time) ?? null;\n}\n\n/**\n * useOpeningHours - Hook for checking store opening status and next open time.\n *\n * @param settings - Opening hours settings from the store\n * @returns Opening status information\n *\n * @example\n * ```tsx\n * const { isOpen, nextOpenFormatted } = useOpeningHours(store.settings.opening_hours);\n *\n * if (!isOpen) {\n * return <div>Store closed. Opens at {nextOpenFormatted}</div>;\n * }\n * ```\n */\nexport function useOpeningHours(settings?: OpeningHoursSettings): UseOpeningHoursResult {\n const { t } = useTranslation();\n\n return useMemo(() => {\n if (!settings?.enabled || !settings?.hours) {\n return {\n isOpen: true, // Assume open if not configured\n isEnabled: false,\n nextOpen: null,\n nextOpenFormatted: '',\n };\n }\n\n const hours = settings.hours;\n const now = new Date();\n const currentDayIndex = getDayIndex(now);\n const currentTime = getTimeInMinutes(now);\n\n // Build schedule for all days\n const schedule: Record<DayOfWeek, DaySchedule> = {} as Record<DayOfWeek, DaySchedule>;\n for (const day of DAYS) {\n const dayRanges = hours[day];\n schedule[day] = {\n ranges: dayRanges ? parseRanges(dayRanges) : [],\n };\n }\n\n // Check if currently open\n const todaySchedule = schedule[indexToDay(currentDayIndex)];\n if (isInRanges(currentTime, todaySchedule.ranges)) {\n return {\n isOpen: true,\n isEnabled: true,\n nextOpen: null,\n nextOpenFormatted: '',\n };\n }\n\n // Find next open time\n // Check remaining ranges today\n const nextRangeToday = findNextRange(currentTime, todaySchedule.ranges);\n if (nextRangeToday) {\n const nextOpen = new Date(now);\n nextOpen.setHours(Math.floor(nextRangeToday.start / 60), nextRangeToday.start % 60, 0, 0);\n\n return {\n isOpen: false,\n isEnabled: true,\n nextOpen,\n nextOpenFormatted: formatNextOpen(nextOpen, t),\n };\n }\n\n // Check subsequent days (up to 7 days ahead)\n for (let i = 1; i <= 7; i++) {\n const nextDayIndex = (currentDayIndex + i) % 7;\n const nextDayName = indexToDay(nextDayIndex);\n const nextDaySchedule = schedule[nextDayName];\n\n if (nextDaySchedule.ranges.length > 0) {\n // Get the first range of that day\n const firstRange = [...nextDaySchedule.ranges].sort((a, b) => a.start - b.start)[0];\n\n const nextOpen = new Date(now);\n nextOpen.setDate(nextOpen.getDate() + i);\n nextOpen.setHours(Math.floor(firstRange.start / 60), firstRange.start % 60, 0, 0);\n\n return {\n isOpen: false,\n isEnabled: true,\n nextOpen,\n nextOpenFormatted: formatNextOpen(nextOpen, t),\n };\n }\n }\n\n // No opening hours found in the next week - assume open\n return {\n isOpen: true,\n isEnabled: true,\n nextOpen: null,\n nextOpenFormatted: '',\n };\n }, [settings, t]);\n}\n\n/**\n * Format the next open time similar to the PHP widget.\n * Output: \"Sunday 09:00 AM\" (translated)\n */\nfunction formatNextOpen(date: Date, t: (key: string) => string): string {\n const dayName = t(DAY_NAMES[indexToDay(getDayIndex(date))]);\n const hours = date.getHours();\n const minutes = date.getMinutes().toString().padStart(2, '0');\n const isPM = hours >= 12;\n const displayHours = hours > 12 ? hours - 12 : hours === 0 ? 12 : hours;\n const meridiem = t(TIME_NAMES[isPM ? 'PM' : 'AM']);\n\n return `${dayName} ${displayHours}:${minutes} ${meridiem}`;\n}\n","import { useEffect, useRef } from 'react';\n\n/**\n * Page config data structure for salla.config.set('page', ...)\n */\nexport interface PageConfigData {\n slug: string;\n id?: string | number;\n title: string;\n /** Optional - defaults to current location pathname + search */\n url?: string;\n parent?: { id: string | number; name: string; url: string } | null;\n}\n\n/**\n * usePageConfig - Centralized hook for setting salla.config.page\n *\n * Replaces scattered salla?.config?.set('page', ...) calls across multiple pages.\n * Handles optional salla object safely.\n * Automatically uses current URL from router context if url not provided.\n *\n * @param pageData - Page configuration data to set\n *\n * @example\n * ```tsx\n * // URL is auto-detected from router context\n * usePageConfig({\n * slug: 'product.index',\n * id: categoryId,\n * title: category.name,\n * });\n *\n * // With explicit URL override\n * usePageConfig({\n * slug: 'product.index',\n * id: categoryId,\n * title: category.name,\n * url: '/custom-url',\n * });\n * ```\n */\nexport function usePageConfig(pageData: PageConfigData): void {\n const pageDataRef = useRef(pageData);\n pageDataRef.current = pageData;\n\n useEffect(() => {\n const salla = window.salla;\n if (!salla?.config?.set) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('[usePageConfig] salla.config.set not available. Page config not set.');\n }\n return;\n }\n\n const current = pageDataRef.current;\n // A page can render without loader page data (tests, custom mounts) — nothing to seed.\n if (!current) return;\n const url = current.url ?? window.location.pathname + window.location.search;\n\n salla.config.set('page', {\n ...current,\n url,\n });\n }, []);\n}\n","import type { Breadcrumb } from '../types';\n\nconst BREADCRUMB_REFERRER_KEY = 'breadcrumb-referrer';\n\nexport function getBreadcrumbReferrer(): Breadcrumb | null {\n try {\n const raw = sessionStorage.getItem(BREADCRUMB_REFERRER_KEY);\n if (!raw) return null;\n const { name, url } = JSON.parse(raw);\n return typeof name === 'string' && typeof url === 'string' ? { name, url } : null;\n } catch {\n return null;\n }\n}\n\nexport function setBreadcrumbReferrer(breadcrumb: Breadcrumb): void {\n try {\n sessionStorage.setItem(BREADCRUMB_REFERRER_KEY, JSON.stringify(breadcrumb));\n } catch {\n // sessionStorage unavailable (private browsing quota, etc.)\n }\n}\n","import { useMemo, useEffect, useState } from 'react';\nimport { useLocation, useIsHome } from '../providers/NavigationProvider';\nimport { useTranslation } from '../providers/I18nProvider';\nimport { getBreadcrumbReferrer, setBreadcrumbReferrer } from '../utils/breadcrumb';\nimport type { Breadcrumb, Page } from '../types';\n\nexport function useBreadcrumbs(page?: Page | null): Breadcrumb[] {\n const location = useLocation();\n const isHome = useIsHome();\n const { t } = useTranslation();\n\n const [referrerCrumb, setReferrerCrumb] = useState<Breadcrumb | null>(null);\n\n useEffect(() => {\n if (page?.slug === 'product.single') {\n const ref = getBreadcrumbReferrer();\n if (ref) setReferrerCrumb(ref);\n return;\n }\n\n setReferrerCrumb(null);\n\n if (!isHome && page) {\n setBreadcrumbReferrer({ name: page.title, url: location.pathname + location.searchStr });\n }\n }, [page, isHome, location.pathname, location.searchStr]);\n\n return useMemo(() => {\n if (!page) return [];\n\n if (page.breadcrumbs?.length) {\n if (page.slug === 'product.single' && referrerCrumb) {\n const last = page.breadcrumbs.at(-1);\n return last ? [page.breadcrumbs[0], referrerCrumb, last] : page.breadcrumbs;\n }\n return page.breadcrumbs;\n }\n\n if (isHome) return [];\n\n const home: Breadcrumb = { name: t('common.titles.home'), url: '/' };\n return [home, { name: page.title, url: location.pathname }];\n }, [isHome, location.pathname, page, t, referrerCrumb]);\n}\n","/**\n * `salla-add-product-button` renders its quick-buy widget only when an element with this id exists\n * at render time. The body:end default hook keeps a src-less marker with this id in the DOM on every\n * page; the widget code itself is loaded by `fastCheckoutScript()` (eager from the product route\n * head, on idle elsewhere) and deduped by src, not by id.\n */\nexport const FAST_CHECKOUT_SCRIPT_ID = 'fast-checkout-js';\nexport const FAST_CHECKOUT_SCRIPT_URL =\n 'https://cdn.assets.salla.network/mini-checkout/widget/widget.esm.js?v=0.0.9';\n\nexport const fastCheckoutScript = () => ({ type: 'module', src: FAST_CHECKOUT_SCRIPT_URL });\n\n/**\n * Appends the widget script unless one with the same src is already in the document. On a product\n * page's first load TanStack has removed its own head tag by the time this runs, so a second tag can\n * land; that is harmless, the module map serves the same URL without refetching or re-evaluating.\n */\nexport function injectFastCheckoutScript(): void {\n if (document.querySelector(`script[src=\"${FAST_CHECKOUT_SCRIPT_URL}\"]`)) return;\n const s = document.createElement('script');\n Object.assign(s, fastCheckoutScript());\n document.head.appendChild(s);\n}\n","/**\n * Auto-registered default hooks for tracking/notification components.\n *\n * This module is imported automatically by hooks/index.ts to register\n * default handlers for body:start and body:end hooks.\n *\n * All handlers check conditions at render time via twilight context,\n * so they work without any setup from theme-custom.\n */\n\nimport React, { lazy, Suspense, useEffect } from 'react';\nimport { hookRegistry } from './HookRegistry';\nimport { HookName } from '../types/hooks';\nimport type { HookContext } from './HookSlot';\nimport { useUser } from './useUser';\nimport { FAST_CHECKOUT_SCRIPT_ID, injectFastCheckoutScript } from '../utils/fast-checkout';\n\n// Lazy load tracking/notification components from theme-engine\nconst GoogleTagBody = lazy(() =>\n import('../components/tracking/GoogleTag').then((m) => ({ default: m.GoogleTagBody }))\n);\n\nconst TwilightBundles = lazy(() =>\n import('../components/tracking/TwilightBundles').then((m) => ({ default: m.TwilightBundles }))\n);\n\nconst LazySiftSnippet = lazy(() =>\n import('../components/tracking/SiftSnippet').then((m) => ({ default: m.SiftSnippet }))\n);\n\nconst LazyStoreClosedNotification = lazy(() =>\n import('../components/store/StoreClosedNotification').then((m) => ({\n default: m.StoreClosedNotification,\n }))\n);\n\n// Lazy load cart widget components\nconst LazyPriceQuoteButton = lazy(() =>\n import('../components/cart/PriceQuoteButton').then((m) => ({ default: m.PriceQuoteButton }))\n);\n\nconst LazyPreOrderNotification = lazy(() =>\n import('../components/cart/PreOrderNotification').then((m) => ({\n default: m.PreOrderNotification,\n }))\n);\n\n/**\n * GTM handler - renders GoogleTagBody if store has GTM keys configured.\n */\nfunction gtmHandler({ twilight }: HookContext): React.ReactNode {\n if (!twilight?.store?.settings?.keys?.gtm?.length) {\n return null;\n }\n\n return (\n <Suspense fallback={null}>\n <GoogleTagBody gtmIds={twilight.store.settings.keys.gtm} />\n </Suspense>\n );\n}\n\n/**\n * Sift handler - renders SiftSnippet if store has sift key configured.\n */\nfunction useSiftHandler({ twilight }: HookContext): React.ReactNode {\n const { data: user } = useUser();\n\n if (!twilight?.store?.settings?.keys?.sift) {\n return null;\n }\n\n const customerId = user?.type === 'user' && user.id ? String(user.id) : '';\n\n return (\n <Suspense fallback={null}>\n <LazySiftSnippet beaconKey={twilight.store.settings.keys.sift} customerId={customerId} />\n </Suspense>\n );\n}\n\n/**\n * Store closed notification handler - renders if opening hours feature is enabled.\n */\nfunction storeClosedHandler({ twilight }: HookContext): React.ReactNode {\n if (!twilight?.store?.settings?.opening_hours?.enabled) {\n return null;\n }\n\n return (\n <Suspense fallback={null}>\n <LazyStoreClosedNotification />\n </Suspense>\n );\n}\n\n/**\n * Quick-buy widget presence + lazy loader. `salla-add-product-button` only checks that\n * `#fast-checkout-js` exists when it renders, so a src-less marker with that id is kept in the\n * body on every page: it survives hydration (TanStack drops head scripts after hydrating) and is\n * there before any app or custom JS renders a quick-buy button. An early `<salla-mini-checkout-widget>`\n * simply upgrades once the code lands. The code is loaded eagerly by the product route head and,\n * elsewhere, appended once the page is idle so it stays off the critical chain.\n */\nfunction FastCheckoutTag(): React.JSX.Element {\n useEffect(() => {\n if (typeof window.requestIdleCallback === 'function') {\n const id = window.requestIdleCallback(injectFastCheckoutScript);\n return () => window.cancelIdleCallback(id);\n }\n const id = window.setTimeout(injectFastCheckoutScript, 2000);\n return () => window.clearTimeout(id);\n }, []);\n return <script id={FAST_CHECKOUT_SCRIPT_ID} type=\"module\" />;\n}\n\n/**\n * Fast checkout handler - keeps the quick-buy marker in the DOM and lazily loads the widget when\n * quick purchase (`store.settings.buy_now`) is on.\n */\nfunction fastCheckoutHandler({ twilight }: HookContext): React.ReactNode {\n if (!twilight?.store?.settings?.buy_now) {\n return null;\n }\n\n return <FastCheckoutTag />;\n}\n\n/**\n * Twilight bundles handler - always renders (core tracking).\n */\nfunction bundlesHandler(): React.ReactNode {\n return (\n <Suspense fallback={null}>\n <TwilightBundles />\n </Suspense>\n );\n}\n\n/**\n * Price quote handler - renders if price-quote feature is enabled.\n * Twig: PriceQuoteWidget - checks feature('price-quote')->isAccessibleForCustomers()\n */\nfunction priceQuoteHandler({ twilight }: HookContext): React.ReactNode {\n // TODO: support price_quote in store settings API response\n if (!twilight?.store?.settings?.features?.price_quote) {\n return null;\n }\n\n return (\n <Suspense fallback={null}>\n <LazyPriceQuoteButton />\n </Suspense>\n );\n}\n\n/**\n * Pre-order notification handler - renders if cart has items with active pre-order campaigns.\n * Twig: PreOrderNotificationWidget - checks cart items for getHasActivePreorderCampaign()\n */\nfunction preOrderNotificationHandler({ twilight, cartItems }: HookContext): React.ReactNode {\n if (!twilight?.store?.settings?.features?.['pre-order-campaigns']) {\n return null;\n }\n\n const items = cartItems as\n Array<{ has_pre_order_campaign?: boolean; parent_id?: unknown }> | undefined;\n const hasPreOrder = items?.some((item) => !item.parent_id && item.has_pre_order_campaign);\n\n if (!hasPreOrder) {\n return null;\n }\n\n return (\n <Suspense fallback={null}>\n <LazyPreOrderNotification />\n </Suspense>\n );\n}\n\n/**\n * Register all default hooks from theme-engine.\n * Called automatically on module import.\n *\n * Note: theme-custom can register additional handlers like AddProductToast.\n */\nfunction registerDefaultHooks(): void {\n // Body start hooks (tracking, notifications)\n hookRegistry.register(HookName.BODY_START, gtmHandler, 100);\n hookRegistry.register(HookName.BODY_START, useSiftHandler, 90);\n hookRegistry.register(HookName.BODY_START, storeClosedHandler, 80);\n\n // Body end hooks (bundles)\n hookRegistry.register(HookName.BODY_END, bundlesHandler, 100);\n hookRegistry.register(HookName.BODY_END, fastCheckoutHandler, 90);\n\n // Cart hooks\n hookRegistry.register('cart:submit.start', priceQuoteHandler, 100);\n hookRegistry.register('cart:items.start', preOrderNotificationHandler, 100);\n}\n\n// Auto-register on module load\nregisterDefaultHooks();\n\nexport { registerDefaultHooks };\n","import { useState } from 'react';\nimport { SallaAppsIcons } from '@salla.sa/twilight-components-react/apps-icons';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaPayments } from '@salla.sa/twilight-components-react/payments';\nimport { SallaSocial } from '@salla.sa/twilight-components-react/social';\nimport { SallaTrustBadges } from '@salla.sa/twilight-components-react/trust-badges';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { Copyright } from './Copyright';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { Link, Image } from '../common';\nimport { ImageModal } from '../../components/modal';\nimport { useAsset } from '../../hooks';\n\nexport function Footer() {\n const { store, theme } = useTwilight();\n const { cdn } = useAsset();\n const { t } = useTranslation();\n const [isTaxModalOpen, setIsTaxModalOpen] = useState(false);\n const [taxImageSrc, setTaxImageSrc] = useState('');\n\n const handleTaxImageClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n const modalId = event.currentTarget.dataset.modalId;\n const modal = document.getElementById(modalId || '');\n const img = modal?.querySelector('img');\n const imgSrc = img?.dataset.src;\n\n if (imgSrc) {\n setTaxImageSrc(imgSrc);\n setIsTaxModalOpen(true);\n }\n };\n\n return (\n <footer className=\"store-footer\" suppressHydrationWarning>\n <HookSlot name=\"footer:start\" />\n <div aria-label=\"footer\" className=\"store-footer__inner\">\n <div className=\"container grid grid-cols-1 lg:grid-cols-6 gap-8 lg:gap-6\">\n {/* Store Info */}\n <div className=\"lg:col-span-2 rtl:lg:pl-20 ltr:lg:pr-20\">\n <Link to=\"/\" className=\"flex items-center m-0\">\n <h3>{store.name}</h3>\n </Link>\n {store.description && (\n <div\n className=\"max-w-sm leading-6 mb-6\"\n dangerouslySetInnerHTML={{ __html: store.description }}\n />\n )}\n\n <div className=\"hidden lg:block\">\n <SallaSocial className=\"block mb-6\" />\n </div>\n\n <div className=\"flex gap-4\">\n <SallaTrustBadges {...(theme.settings?.footer_is_dark ? { dark: true } : {})} />\n\n {store.settings?.tax?.number && (\n <div className=\"flex rtl:space-x-reverse space-x-2 items-end\">\n {store.settings?.tax?.certificate && (\n <a\n data-modal-id=\"modal-value-tax\"\n href=\"#/\"\n aria-label={store.settings?.tax?.number}\n onClick={handleTaxImageClick}\n >\n <img\n width={40}\n height={40}\n src={cdn('/images/placeholder.png')}\n className=\"w-10 rounded-sm hover:opacity-80 transition-opacity\"\n alt=\"value added tax\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </a>\n )}\n <div>\n <p className=\"text-sm text-text-grey mb-1\">\n {t('common.elements.tax_number', 'Tax Number')}\n </p>\n <b className=\"text-sm\">{store.settings?.tax?.number}</b>\n </div>\n </div>\n )}\n </div>\n </div>\n\n {/* Footer Links */}\n <div>\n <h3>{t('blocks.footer.pages_links', 'Important Links')}</h3>\n <SallaMenu source=\"footer\" />\n </div>\n\n {/* Contact Info */}\n <div>\n <SallaContacts\n contacts={store.contacts}\n contactsTitle={t('blocks.footer.social', 'Stay in touch')}\n />\n\n <div className=\"lg:hidden contact-social\">\n <SallaSocial />\n </div>\n </div>\n\n {/* App Icons */}\n <SallaAppsIcons\n apps={store.apps}\n appsTitle={t('blocks.footer.download_apps', 'Get our apps')}\n className=\"lg:col-span-2 rtl:lg:pr-20 ltr:lg:pl-20\"\n />\n </div>\n </div>\n\n {/* Copyright */}\n <div className=\"md:flex items-center justify-between py-4 container text-center\">\n <span className=\"text-sm copyright-text\">\n <HookSlot\n name=\"copyright\"\n context={{ storeName: store.name }}\n fallback={<Copyright storeName={store.name} />}\n />\n </span>\n <SallaPayments />\n </div>\n\n {/* Hidden modal content for data extraction */}\n <div id=\"modal-value-tax\" className=\"hidden\">\n <Image src={store.settings?.tax?.certificate || undefined} alt=\"Tax Certificate\" />\n </div>\n\n {/* Image Modal */}\n <ImageModal\n isOpen={isTaxModalOpen}\n onClose={() => setIsTaxModalOpen(false)}\n src={taxImageSrc}\n alt=\"Tax Certificate\"\n title={t('common.elements.tax_certificate', 'Tax Certificate')}\n />\n <HookSlot name=\"footer:end\" />\n </footer>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport { Header } from './Header';\nimport { Footer } from './Footer';\nimport type { LayoutProps } from '../../types';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useUser } from '../../hooks';\n\nconst SallaLoginModal = lazy(() =>\n import('@salla.sa/twilight-components-react/login-modal').then((m) => ({\n default: m.SallaLoginModal,\n }))\n);\nconst SallaScopes = lazy(() =>\n import('@salla.sa/twilight-components-react/scopes').then((m) => ({\n default: m.SallaScopes,\n }))\n);\nconst SallaOfferModal = lazy(() =>\n import('@salla.sa/twilight-components-react/offer-modal').then((m) => ({\n default: m.SallaOfferModal,\n }))\n);\n\nexport function MasterLayout({ children }: LayoutProps) {\n const { store } = useTwilight();\n const { isLoggedIn } = useUser();\n\n return (\n <>\n <div className=\"app-inner flex flex-col min-h-full\">\n <Header />\n <main id=\"main-content\" role=\"main\" className=\"flex-1\">\n {children}\n </main>\n <Footer />\n </div>\n\n <Suspense>\n <SallaOfferModal />\n </Suspense>\n\n {!isLoggedIn && (\n <Suspense>\n <SallaLoginModal\n isEmailAllowed={store?.settings?.auth?.email_allowed}\n isMobileAllowed={store?.settings?.auth?.mobile_allowed}\n isEmailRequired={store?.settings?.auth?.is_email_required}\n suppressHydrationWarning\n />\n </Suspense>\n )}\n\n {store?.scope && (\n <Suspense>\n <SallaScopes\n selection={store?.scope?.display_as === 'popup' ? 'mandatory' : 'optional'}\n suppressHydrationWarning\n />\n </Suspense>\n )}\n </>\n );\n}\n","import { useEffect, useMemo } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { apps, type AppSnippetRow } from '../../api/apps';\nimport { installAppScope } from '../../utils/app-scope';\nimport { applyThemeHookSlots } from '../../utils/theme-hook-slots';\nimport { getTwilightContext } from '../../twilight/context';\n\n/** How long to wait on the SDK / settings before injecting anyway. */\nconst READY_TIMEOUT_MS = 2500;\n\n// Module-level so StrictMode double-effects and remounts can't inject twice per page load.\nlet injected = false;\n\n/** A snippet plus its app's scope id — the key that resolves its config bucket. */\ntype OwnedSnippet = AppSnippetRow & { appScopeId: string };\n\n/**\n * Appends raw snippet HTML to `target`, recreating each `<script>` — innerHTML-parsed\n * scripts are flagged \"already started\" and never run.\n */\nexport function injectHtml(html: string, target: HTMLElement) {\n const tpl = document.createElement('template');\n tpl.innerHTML = html;\n tpl.content.querySelectorAll('script').forEach((inert) => {\n // importmap scripts can't be added post-init; the engine already injects its own.\n if (inert.type === 'importmap') {\n inert.remove();\n return;\n }\n const script = document.createElement('script');\n for (const attr of Array.from(inert.attributes)) {\n script.setAttribute(attr.name, attr.value);\n }\n script.text = inert.text;\n inert.replaceWith(script);\n });\n target.appendChild(tpl.content);\n}\n\n/**\n * Replaces `{{customer.x}}` placeholders with SDK config `user.*` values. Non-`customer.`\n * params are left untouched, matching the classic themes.\n */\nexport function resolveCustomerParams(content: string, params?: string[]): string {\n if (!params?.length) return content;\n for (const param of params) {\n if (!param.startsWith('customer.')) continue;\n const value = String(window.salla?.config?.get(param.replace(/^customer\\./, 'user.')) ?? '');\n // Tolerate inner whitespace (`{{ customer.email }}`); function replacement keeps `value`\n // literal so a `$&` in customer data isn't expanded.\n const escaped = param.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const placeholder = new RegExp(`\\\\{\\\\{\\\\s*${escaped}\\\\s*\\\\}\\\\}`, 'g');\n content = content.replace(placeholder, () => value);\n }\n return content;\n}\n\n/** Resolves after `ms`, so a promise that may never settle can't block injection. */\nconst timeout = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * `onReady` hangs forever if the SDK never initializes; race a timeout so a broken SDK\n * degrades to unsubstituted placeholders instead of dropping every snippet.\n */\nconst waitForSdk = (): Promise<unknown> => {\n const ready = window.salla?.onReady();\n return ready ? Promise.race([ready, timeout(READY_TIMEOUT_MS)]) : Promise.resolve();\n};\n\n/**\n * Whitelists hook slots, installs the config sandbox, then injects the inline snippets.\n * Runs once per page load, after the SDK is ready.\n */\nfunction mountSnippets(\n owned: OwnedSnippet[],\n clientSnippets: OwnedSnippet[],\n buckets: Record<string, Record<string, unknown>>\n): void {\n // Backstop for the inline head copy (see renderThemeHookSlotsScript) — that one runs at\n // parse time, ahead of the snippet scripts; this only covers a head that didn't render.\n applyThemeHookSlots();\n\n // Install before any snippet resolves config. The inline SSR-head install normally got there\n // first (with these buckets, or with none when its prefetch failed), so this either installs\n // the factory or seeds the buckets into it. Pass the complete map once.\n installAppScope({ apps: buckets });\n\n // Flag every CDN scope with a missing bucket (SSR-rendered ones included).\n const unresolved = new Set<string>();\n for (const s of owned) {\n if (s.url && !(s.appScopeId in buckets)) unresolved.add(s.appScopeId);\n }\n\n for (const snippet of clientSnippets) {\n // Honour `place`: a head-placed snippet is often a <meta>/<link>/<style> (site\n // verification, canonical, preload) that crawlers only read inside <head>.\n const target = snippet.place?.includes('head') ? document.head : document.body;\n try {\n injectHtml(resolveCustomerParams(snippet.content, snippet.customer_parameters), target);\n } catch (error) {\n console.error(`[salla] failed to inject snippet for app ${snippet.appScopeId}`, error);\n }\n }\n\n if (unresolved.size) {\n // One line per page, not per snippet; expected during settings-endpoint rollout.\n console.warn(\n `[salla] app settings missing for ${unresolved.size} app(s); their snippets ran without app.* config`,\n [...unresolved]\n );\n }\n}\n\n/** A CDN snippet reduced to what its SSR `<script>` tag needs. */\ninterface SsrCdnScript {\n key: string;\n url: string;\n snippetId?: number;\n appScopeId: string;\n}\n\n/**\n * Mounts installed apps' snippets once per page load:\n * - **CDN** — rendered as SSR `<script>` tags in <body> (see return), so they exist on first\n * paint. `place` doesn't apply: they're deferred scripts, which run in order either way.\n * - **inline** — injected client-side in the effect, into `place`'s target (head or body).\n */\nexport function AppsSnippets() {\n // From twilight context, not useQuery: React Query isn't dehydrated here, so useQuery has no\n // SSR data — but the CDN <script> tags must render server-side.\n const ssrSnippets = getTwilightContext().appsSnippets;\n\n // Client fallback for when the SSR prefetch failed or timed out (it fails open, non-fatal).\n // Without it a single blip on `apps/snippets` would drop every installed app's snippets for\n // the whole page load — no CDN tags, no inline scripts, no hook slots. Retries here because\n // the query's own `retry: 0` exists only to bound the SSR wait.\n const { data: fallbackSnippets } = useQuery({\n ...apps.queries.snippets(),\n enabled: !ssrSnippets,\n retry: 2,\n });\n const data = ssrSnippets ?? fallbackSnippets;\n\n const { data: settings, isSuccess, isError } = useQuery({ ...apps.queries.settings(), retry: 2 });\n\n // Fail open: inject once settings settle either way, so snippets that never read `app.*`\n // aren't dropped when the bucket is empty.\n const settingsSettled = isSuccess || isError;\n\n // Each enabled app's snippets, tagged with its scope id (the encoded `id`). Older payloads\n // lacking `id` get a deterministic per-app fallback sharing one empty bucket.\n const owned = useMemo<OwnedSnippet[]>(\n () =>\n (data ?? [])\n .filter((app) => app.status === 'enabled')\n .flatMap((app) =>\n app.snippets.map((s) => ({ ...s, appScopeId: app.id ?? `unresolved-${app.app_id}` }))\n ),\n [data]\n );\n\n // Every CDN snippet → a real `<script>` tag in the SSR body (rendered below).\n const ssrCdnScripts = useMemo<SsrCdnScript[]>(\n () =>\n owned\n .filter((s) => s.url)\n .map((s, i) => ({\n key: `${s.appScopeId}:${s.id ?? i}`,\n url: s.url as string,\n snippetId: s.id,\n appScopeId: s.appScopeId,\n })),\n [owned]\n );\n\n useEffect(() => {\n if (injected || !data || !settingsSettled) return;\n injected = true;\n\n // Client-injected: inline snippets only. Every CDN snippet is SSR-rendered (below).\n const clientSnippets = owned.filter((s) => !s.url);\n\n // Always wait for the SDK: a snippet body calls the global `salla`/`Salla` (config, hooks,\n // event bus) whether or not it declares customer parameters, and those are only populated\n // after init. The wait is timeout-raced, so a broken SDK still can't strand injection.\n void waitForSdk().then(() => mountSnippets(owned, clientSnippets, settings?.apps ?? {}));\n }, [data, owned, settings, settingsSettled]);\n\n // CDN snippets as classic `defer` scripts: non-blocking, in-order, kept in <body> (React hoists\n // only `async` to <head>), and still exposing `document.currentScript` for the wrapper.\n return (\n <>\n {ssrCdnScripts.map((s) => (\n <script\n key={s.key}\n src={s.url}\n defer\n data-scope-id={s.appScopeId}\n data-snippet-id={s.snippetId != null ? String(s.snippetId) : ''}\n />\n ))}\n </>\n );\n}\n","import React, { useMemo, Suspense, useState, useEffect } from 'react';\nimport { WidgetHead } from '../components/layout/WidgetHead';\nimport { HookSlot } from '../hooks/HookSlot';\nimport { HookName } from '../types/hooks';\nimport { DocumentClassProvider } from './DocumentClassProvider';\nimport { TwilightContext } from './twilight-context';\nimport { ThemeDocumentSync } from './twilight-theme';\nimport { useTwilightInit } from './twilight-init';\nimport { I18nProvider, FALLBACK_LOCALE } from './I18nProvider';\nimport { NavigationInterceptor } from './NavigationProvider';\nimport { navigationSetups } from './navigation-setups';\nimport { routeDocumentSyncs } from './DocumentSyncRegistry';\nimport { MasterLayout } from '../components/layout/MasterLayout';\nimport { Toaster } from '../components/toast/Toaster';\nimport { AppsSnippets } from '../components/snippets/AppsSnippets';\nimport { getTwilightContext, updateTwilightContext } from '../twilight/context';\nimport { AUTH_TOKEN_COOKIE_NAME, clearAuthTokenCookie, rememberDevStoreId } from '../utils/cookies';\nimport type {\n TwilightContextValue,\n TwilightConfig,\n TwilightProviderProps,\n TwilightLog,\n} from '../types/twilight';\nimport type { StoreContext } from '../api/store';\n\nconst getSalla = () => (typeof window !== 'undefined' ? window.salla : undefined);\n\nconst TWILIGHT_LOG_STYLES = {\n header:\n 'background: linear-gradient(90deg, #7c3aed, #6366f1); color: white; padding: 4px 8px; border-radius: 4px; font-weight: bold;',\n error:\n 'background: #dc2626; color: white; padding: 2px 6px; border-radius: 3px; font-weight: bold;',\n warn: 'background: #f59e0b; color: white; padding: 2px 6px; border-radius: 3px; font-weight: bold;',\n info: 'background: #3b82f6; color: white; padding: 2px 6px; border-radius: 3px; font-weight: bold;',\n label: 'color: #7c3aed; font-weight: bold;',\n value: 'color: inherit;',\n};\n\nexport { useTwilight } from './twilight-context';\nexport type { TwilightProviderProps };\n\nexport function TwilightProvider({\n children,\n debug = false,\n skeleton,\n translations: themeTranslations,\n onReady,\n onError,\n client = { framework: 'tanstack', interceptLinks: true },\n toast = true,\n toastMobilePosition = 'bottom-center',\n addToCartToast = true,\n routeClass = true,\n layout: LayoutComponent = MasterLayout,\n}: TwilightProviderProps): React.ReactElement {\n const ctx = getTwilightContext();\n const initialLocale = ctx.locale || FALLBACK_LOCALE;\n let initialData: StoreContext | undefined;\n try {\n initialData = ctx.settings;\n } catch {\n // Settings not initialized yet — loading state\n }\n\n // Auth token state for React re-renders on login/logout\n const [authToken, setAuthToken] = useState<string | null>(() => {\n if (typeof window !== 'undefined') {\n return ctx.authToken ?? window.localStorage.getItem(AUTH_TOKEN_COOKIE_NAME);\n }\n return null;\n });\n\n // SDK auth event listeners\n useEffect(() => {\n if (typeof window === 'undefined') return;\n\n const sdk = getSalla();\n if (!sdk?.auth?.event) return;\n\n // Symmetric counterpart to handleTokenInvalid's clear below. path=/ + Lax so the\n // cookie is sent on the native webview's top-level navigation to /account/orders,\n // letting twilightMiddleware authenticate the SSR render — the SDK only stores the\n // token in localStorage, which the server can't read.\n const writeAuthCookie = (token: string) => {\n document.cookie = `${AUTH_TOKEN_COOKIE_NAME}=${token}; path=/; max-age=${60 * 60 * 24 * 30}; SameSite=Lax; Secure`;\n };\n\n const clearAuthCookie = clearAuthTokenCookie;\n\n // The SDK only refreshes `user.type` on a full page load, but our auth flows update\n // the UI without one — SDK components read it directly (e.g. salla-login-modal's\n // render bails for 'user' and never creates its inner modal), so keep it in sync.\n const setSdkUserType = (type: 'user' | 'guest') => {\n sdk.config?.set?.('user.type', type);\n };\n\n const handleLogin = () => {\n const newToken = sdk.storage.get(AUTH_TOKEN_COOKIE_NAME) as string | null;\n // logged.in can fire before the token is stored (iframe mirror) — don't clobber\n if (!newToken) return;\n setAuthToken(newToken);\n updateTwilightContext({ authToken: newToken });\n setSdkUserType('user');\n };\n\n // Fires on a fresh token fetch (login / web-session refresh — the native app flow).\n // Mirror the token into a cookie so SSR loads of authenticated pages are authenticated.\n const handleTokenFetched = (token: unknown) => {\n if (typeof token !== 'string' || !token) return;\n setAuthToken(token);\n updateTwilightContext({ authToken: token });\n writeAuthCookie(token);\n setSdkUserType('user');\n };\n\n const handleLogout = () => {\n const wasLoggedIn = Boolean(getTwilightContext().authToken);\n setAuthToken(null);\n updateTwilightContext({ authToken: null });\n setSdkUserType('guest');\n // Clear the SSR cookie too, otherwise a logged-out user's next full-page load\n // would still send a stale token to the server.\n try {\n clearAuthCookie();\n } catch {\n // Cookie removal may fail in restricted environments\n }\n // SDK logout redirects via location.href only after an accounts-iframe roundtrip\n // that can hang forever (iOS webview). If its redirect hasn't unloaded the page\n // by then, reload so SSR re-renders as guest. Guarded to logged-in users so the\n // SDK's force_logout guest flow can't reload-loop.\n if (wasLoggedIn) {\n window.setTimeout(() => window.location.reload(), 3500);\n }\n };\n\n const handleTokenInvalid = () => {\n setAuthToken(null);\n updateTwilightContext({ authToken: null });\n setSdkUserType('guest');\n try {\n window.localStorage.removeItem(AUTH_TOKEN_COOKIE_NAME);\n sdk.storage.remove?.(AUTH_TOKEN_COOKIE_NAME);\n clearAuthCookie();\n } catch {\n // Storage/cookie removal may fail in restricted environments\n }\n };\n\n sdk.auth.event.onLoggedIn(handleLogin);\n sdk.auth.event.onLoggedOut(handleLogout);\n sdk.event.on('auth::token.invalid', handleTokenInvalid);\n sdk.event.on('auth::token.fetched', handleTokenFetched);\n // fires on every token path, and BEFORE logged.in in the login-iframe flow\n sdk.event.on('api::token.injected', handleTokenFetched);\n\n return () => {\n // Sub-emitters use root salla.event.off for cleanup\n sdk.event.off('auth::loggedIn', handleLogin);\n sdk.event.off('auth::loggedOut', handleLogout);\n sdk.event.off('auth::token.invalid', handleTokenInvalid);\n sdk.event.off('auth::token.fetched', handleTokenFetched);\n sdk.event.off('api::token.injected', handleTokenFetched);\n };\n }, []);\n\n const { isReady, storeData, setStoreData, themeData, currency, isMobileWebview } =\n useTwilightInit({\n debug,\n initialData,\n onReady,\n onError,\n initialLocale,\n });\n\n const storeId = storeData?.id;\n useEffect(() => rememberDevStoreId(storeId), [storeId]);\n\n const config = useMemo<TwilightConfig>(() => ({ debug }), [debug]);\n\n const log = useMemo<TwilightLog>(\n () => ({\n groupCollapsed: (title) =>\n console.groupCollapsed(`%c ⚡ Twilight: ${title} `, TWILIGHT_LOG_STYLES.header),\n group: (title) => console.group(`%c${title}`, TWILIGHT_LOG_STYLES.label),\n groupEnd: () => console.groupEnd(),\n error: (label, value) =>\n console.log(`%c[${label}]%c`, TWILIGHT_LOG_STYLES.error, TWILIGHT_LOG_STYLES.value, value),\n warn: (label, value) =>\n console.log(`%c[${label}]%c`, TWILIGHT_LOG_STYLES.warn, TWILIGHT_LOG_STYLES.value, value),\n info: (label, value) =>\n console.log(`%c[${label}]%c`, TWILIGHT_LOG_STYLES.info, TWILIGHT_LOG_STYLES.value, value),\n label: (label, value) =>\n console.log(`%c[${label}]%c`, TWILIGHT_LOG_STYLES.label, TWILIGHT_LOG_STYLES.value, value),\n dir: (label, value) => {\n console.log(`%c${label}`, TWILIGHT_LOG_STYLES.label);\n console.dir(value);\n },\n trace: (label, trace) => {\n console.log(`%c${label}`, TWILIGHT_LOG_STYLES.label);\n console.error(trace);\n },\n }),\n []\n );\n\n const contextValue = useMemo<TwilightContextValue>(\n () => ({\n isReady,\n store: storeData,\n _setStore: setStoreData,\n theme: themeData,\n currency,\n config,\n log,\n get salla() {\n return getSalla();\n },\n get settings() {\n return getTwilightContext().settings;\n },\n get locale() {\n return getTwilightContext().locale;\n },\n get routeId() {\n return getTwilightContext().routeId;\n },\n get location() {\n return getTwilightContext().location;\n },\n get authToken() {\n return authToken;\n },\n get i18n() {\n return getTwilightContext().i18n;\n },\n get dir() {\n return getTwilightContext().dir;\n },\n get extras() {\n return getTwilightContext().extras;\n },\n }),\n [isReady, storeData, setStoreData, themeData, currency, config, log, authToken]\n );\n\n const framework = client !== false ? (client?.framework ?? 'tanstack') : null;\n const LazyNavSetup = framework ? navigationSetups[framework] : null;\n const LazyDocumentSync = routeClass && framework ? routeDocumentSyncs[framework] : null;\n const interceptLinks = client !== false && (client?.interceptLinks ?? true);\n\n const documentSyncElement = useMemo(\n () => (LazyDocumentSync ? React.createElement(LazyDocumentSync) : null),\n [LazyDocumentSync]\n );\n\n const readyShell = useMemo(() => {\n if (!isReady) return null;\n return {\n LayoutComponent,\n LazyNavSetup,\n toast,\n toastMobilePosition,\n addToCartToast,\n interceptLinks,\n };\n }, [\n isReady,\n LazyNavSetup,\n LayoutComponent,\n toast,\n toastMobilePosition,\n addToCartToast,\n interceptLinks,\n ]);\n\n const readyContent = useMemo(() => {\n if (!readyShell) return null;\n\n const inner = readyShell.LayoutComponent ? (\n <readyShell.LayoutComponent>{children}</readyShell.LayoutComponent>\n ) : (\n children\n );\n\n const wrapped = (\n <>\n <WidgetHead />\n {/* Installed apps' snippets — client-only, injected once per page load. Lives\n here so every theme gets marketplace apps without re-implementing injection. */}\n <AppsSnippets />\n <HookSlot name={HookName.BODY_START} />\n <Suspense fallback={null}>\n {readyShell.toast && (\n <Toaster\n mobilePosition={readyShell.toastMobilePosition}\n addToCartToast={readyShell.addToCartToast}\n />\n )}\n {readyShell.interceptLinks && <NavigationInterceptor />}\n </Suspense>\n {inner}\n <HookSlot name={HookName.BODY_END} />\n </>\n );\n\n if (readyShell.LazyNavSetup) {\n return React.createElement(readyShell.LazyNavSetup, null, wrapped);\n }\n return wrapped;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [readyShell]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const i18nInstance = useMemo(() => getTwilightContext().i18n, [initialLocale]);\n\n return (\n <DocumentClassProvider>\n <TwilightContext.Provider value={contextValue}>\n <I18nProvider i18nInstance={i18nInstance} themeTranslations={themeTranslations}>\n <ThemeDocumentSync\n theme={themeData}\n locale={initialLocale}\n direction={getTwilightContext().dir}\n isMobileWebview={isMobileWebview}\n />\n {documentSyncElement}\n {!isReady && (\n <div className=\"loading-overlay\">{skeleton || <div className=\"loading-spinner\" />}</div>\n )}\n {readyContent}\n </I18nProvider>\n </TwilightContext.Provider>\n </DocumentClassProvider>\n );\n}\n\nexport default TwilightProvider;\n","import { useCallback } from 'react';\nimport { useTwilight } from '../providers/TwilightProvider';\nimport type { Store } from '../types';\n\n/**\n * UseStoreResult - Return type for useStore hook\n *\n * Extends the Store interface with a refresh method to re-fetch\n * the latest store configuration from the Salla SDK.\n */\nexport interface UseStoreResult extends Store {\n refresh: () => Promise<void>;\n}\n\n/**\n * useStore - Hook for accessing and managing store state\n *\n * Provides access to the store configuration and metadata from the\n * Twilight provider. Includes a refresh method to update the store\n * state with the latest data from the Salla SDK.\n *\n * @returns Store object with refresh() method to reload store data\n *\n * @example\n * ```tsx\n * function StoreInfo() {\n * const { name, currency, refresh } = useStore();\n *\n * return (\n * <div>\n * <h1>{name}</h1>\n * <button onClick={refresh}>Refresh store data</button>\n * <p>Current currency: {currency}</p>\n * </div>\n * );\n * }\n * ```\n */\nexport function useStore(): UseStoreResult {\n const { store, _setStore, salla } = useTwilight();\n\n const refresh = useCallback(async () => {\n if (!salla) return;\n try {\n const data = salla.config.all();\n if (data?.store && typeof data.store === 'object') {\n _setStore((prev) => ({ ...prev, ...(data.store as Partial<Store>) }));\n }\n } catch {\n // Silently ignore errors - store remains unchanged\n }\n }, [salla, _setSt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,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AACrB,IAAA,IAAI,CAAC,KAAA,EAAO,KAAA,EAAO,EAAA,EAAI;AAEvB,IAAA,MAAM,oBAAoB,MAAM;AAC9B,MAAA,UAAA,CAAW,CAAC,IAAA,MAAU,EAAE,GAAG,IAAA,EAAM,eAAA,EAAiB,MAAK,CAAE,CAAA;AAAA,IAC3D,CAAA;AAEA,IAAA,KAAA,CAAM,KAAA,CAAM,EAAA,CAAG,+BAAA,EAAiC,iBAAiB,CAAA;AACjE,IAAA,OAAO,MAAM;AACX,MAAA,KAAA,CAAM,KAAA,EAAO,GAAA,GAAM,+BAAA,EAAiC,iBAAiB,CAAA;AAAA,IACvE,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,SAAS,MAAA,EAAO;AAC3B","file":"chunk-3U26OMNO.js","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport type { Product } from '../types';\n\n/**\n * UseProductResult - Return type for useProduct hook\n */\nexport interface UseProductResult {\n /** Current product state (updates on option changes) */\n product: Product;\n /** Reload product data from API */\n reload: () => Promise<void>;\n}\n\nexport interface UseProductOptions {\n /**\n * True while `initialProduct` is a list-card stand-in. When it flips to false\n * (details arrived), state re-seeds. Do not infer this from `options`/`images`\n * — list payloads may include those fields.\n */\n isPreview?: boolean;\n}\n\n/**\n * useProduct - Hook for managing product state with live updates\n *\n * Provides reactive product data with automatic updates for price, stock,\n * and variant changes. Handles manual reloads (e.g., after add-to-cart)\n * and subscribes to Salla SDK events for real-time price updates.\n *\n * Stock status is reflected in `product.is_out_of_stock` which updates\n * when price calculations succeed or fail (e.g., unavailable option combinations).\n *\n * @param initialProduct - The initial product object (typically from loader/SSR).\n * @param options.isPreview - Pass true for a list-card placeholder so the hook\n * re-seeds when details for the same id arrive (`isPreview` goes false).\n *\n * @returns Object with product and reload function\n *\n * @example\n * ```tsx\n * function ProductDetails({ product }) {\n * const { product: updatedProduct, reload } = useProduct(product);\n *\n * const handleAddToCart = async () => {\n * await addToCart(updatedProduct.id);\n * await reload(); // Refresh product state after cart update\n * };\n *\n * return (\n * <div>\n * <h1>{updatedProduct.name}</h1>\n * <p>Price: {formatMoney(updatedProduct.price)}</p>\n * {updatedProduct.is_out_of_stock && <p>Currently out of stock</p>}\n * <button onClick={handleAddToCart}>Add to Cart</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useProduct(initialProduct: Product, options?: UseProductOptions): UseProductResult {\n const [product, setProduct] = useState<Product>(initialProduct);\n\n // Always keep a ref to the latest initialProduct so the re-seed effect below\n // can read it without adding the full object to the dependency array.\n const initialProductRef = useRef<Product>(initialProduct);\n useEffect(() => {\n initialProductRef.current = initialProduct;\n });\n\n const reload = useCallback(async () => {\n const salla = window.salla;\n if (!salla?.api?.product?.getDetails) return;\n try {\n const response = await salla.api.product.getDetails(String(product.id), [\n 'images',\n 'category',\n ]);\n if (response?.success && response.data) {\n setProduct(response.data as Product);\n }\n } catch {\n // silently ignore network errors during reload\n }\n }, [product.id]);\n\n // Re-seed when the loader navigates to a different product, or when a\n // list-card placeholder (`isPreview`) is replaced by details for the same id.\n // Object identity is not a dependency — that would reset live option/price state.\n useEffect(() => {\n setProduct(initialProductRef.current);\n }, [initialProduct.id, options?.isPreview]);\n\n // Subscribe to Salla option-change events so price/stock stays in sync\n useEffect(() => {\n const salla = window.salla;\n if (!salla?.event?.on) return;\n\n salla.event.on('product:options.updated', reload);\n return () => {\n salla.event?.off?.('product:options.updated', reload);\n };\n }, [reload]);\n\n // Subscribe to price update events (matches product.js registerEvents)\n useEffect(() => {\n const salla = window.salla;\n if (!salla?.product?.event?.onPriceUpdated) return;\n\n const handlePriceUpdated = (res: { data?: Record<string, unknown> }) => {\n const data = res.data;\n if (!data) return;\n\n setProduct((prev) => ({\n ...prev,\n price: (data.price as number) ?? prev.price,\n sale_price: (data.sale_price as number) ?? prev.sale_price,\n regular_price: (data.regular_price as number) ?? prev.regular_price,\n is_on_sale: (data.has_sale_price as boolean) ?? prev.is_on_sale,\n weight: (data.weight as string) ?? prev.weight,\n is_out_of_stock: false,\n }));\n };\n\n salla.product.event.onPriceUpdated(handlePriceUpdated);\n return () => {\n salla.event?.off?.(\n 'product::price.updated',\n handlePriceUpdated as (...args: unknown[]) => void\n );\n };\n }, []);\n\n // Subscribe to price update failed events (matches product.js)\n useEffect(() => {\n const salla = window.salla;\n if (!salla?.event?.on) return;\n\n const handlePriceFailed = () => {\n setProduct((prev) => ({ ...prev, is_out_of_stock: true }));\n };\n\n salla.event.on('product::price.updated.failed', handlePriceFailed);\n return () => {\n salla.event?.off?.('product::price.updated.failed', handlePriceFailed);\n };\n }, []);\n\n return { product, reload };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/cart.ts"],"names":[],"mappings":";;;;AAWA,SAAS,sBAAsB,IAAA,EAA6B;AAC1D,EAAA,OAAO;AAAA,IACL,GAAG,IAAA,CAAK,IAAA;AAAA,IACR,OAAA,EAAS,KAAK,OAAA,IAAW,IAAA;AAAA,IACzB,IAAA,EAAM,KAAK,IAAA,IAAQ;AAAA,GACrB;AACF;AAEO,IAAM,IAAA,GAAO;AAAA,EAClB,GAAA,EAAK,OAAO,MAAA,KAAkC;AAC5C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,KAAA,EAAQ,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAAgC;AACjF,IAAA,OAAO,sBAAsB,IAAI,CAAA;AAAA,EACnC,CAAA;AAAA,EAEA,YAAY,CAAC,MAAA,KAAkC,QAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,CAAC,CAAA;AAAA,EAEvE,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,MAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,MACzB,OAAA,EAAS,MAAM,IAAA,CAAK,GAAA,CAAI,MAAM;AAAA,KAC/B;AAAA;AAEP","file":"chunk-4DHLIY6V.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Cart } from '../types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport interface CartApiResponse {\n cart: Omit<Cart, 'loyalty' | 'gift'>;\n loyalty?: Cart['loyalty'];\n gift?: Cart['gift'];\n}\n\nfunction normalizeCartResponse(data: CartApiResponse): Cart {\n return {\n ...data.cart,\n loyalty: data.loyalty ?? null,\n gift: data.gift ?? null,\n } as Cart;\n}\n\nexport const cart = {\n get: async (cartId: number): Promise<Cart> => {\n const { data } = await api.get(`cart/${cartId}`).json<{ data: CartApiResponse }>();\n return normalizeCartResponse(data);\n },\n\n getOrThrow: (cartId: number): Promise<Cart> => orThrow(cart.get(cartId)),\n\n queries: {\n detail: (cartId: number) =>\n queryOptions({\n queryKey: ['cart', cartId],\n queryFn: () => cart.get(cartId),\n }),\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/store.ts"],"names":[],"mappings":";;;;;AASA,IAAM,qBAAA,GAAwB;AAAA,EAC5B,OAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,gBAAA;AAAA,EACA,mBAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA;AAmDA,SAAS,iBAAiB,SAAA,EAA8D;AACtF,EAAA,IAAI,CAAC,WAAW,OAAO,MAAA;AAGvB,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,SAAS,CAAA,CAAE,GAAA,CAAI,CAAC,IAAA,MAAU,EAAE,QAAA,EAAU,IAAA,CAAK,IAAA,EAAM,GAAG,MAAK,CAAE,CAAA;AAClF;AAEO,IAAM,KAAA,GAAQ;AAAA,EACnB,QAAA,EAA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AA,OAAA,CAAQ,KAAA,CAAM,4BAA4B,KAAK,CAAA;AAC/C,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,CAAC,eAAA,KACT,YAAA,CAAkC;AAAA,MAChC,QAAA,EAAU;AAAA,QACR,OAAA;AAAA,QACA,UAAA;AAAA,QACA,eAAA;AAAA,QACA,oBAAmB,CAAE,MAAA;AAAA,QACrB,cAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQf,uBAAA;AAAwB,OAC1B;AAAA,MACA,OAAA,EAAS,MAAM,KAAA,CAAM,QAAA,CAAS,eAAe;AAAA,KAC9C;AAAA;AAEP","file":"chunk-7OIP65ER.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope, getActiveScopeId, STORE_IDENTIFIER_HEADER } from './client';\nimport type { Store, Theme, Language } from '../types';\nimport { getTwilightContext } from '../twilight/context';\nimport { resolveStoreIdentifier } from '../utils/store-identity';\nimport { requestedThemeVersionId } from '../utils/theme-version';\n\nexport { resolveStoreIdentifier };\n\nconst DEFAULT_INCLUDE_ITEMS = [\n 'store',\n 'settings',\n 'theme',\n 'theme_settings',\n 'external_services',\n 'currencies',\n 'languages',\n 'payments',\n 'product_widgets',\n 'rating',\n 'ratings',\n];\n\n/**\n * Raw API response for settings endpoint.\n * Languages come as object: { \"AR\": { code, name, ... }, \"EN\": {...} }\n */\ninterface SettingsApiResponse {\n store?: Store;\n theme?: Theme;\n languages?: Record<string, Language>;\n currencies?: Record<\n string,\n { code: string; name: string; symbol: string; amount: number; country_code: string }\n >;\n external_services?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n login?: { url: string; turnstile_site_key: string };\n affiliate?: { utm_url: string; cta_enabled: boolean };\n debug?: boolean;\n trace_console?: boolean;\n policy_url?: string;\n}\n\n/**\n * Central settings context - single source of truth for all API data.\n * Contains everything from the settings endpoint response after processing.\n */\nexport interface StoreContext {\n store?: Store;\n theme?: Theme;\n /** Languages as array after conversion from API object format */\n languages?: Language[];\n currencies?: Record<\n string,\n { code: string; name: string; symbol: string; amount: number; country_code: string }\n >;\n external_services?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n login?: { url: string; turnstile_site_key: string };\n affiliate?: { utm_url: string; cta_enabled: boolean };\n debug?: boolean;\n trace_console?: boolean; // todo:: remove it\n policy_url?: string;\n}\n\n/**\n * Converts languages object from API to array format.\n * API returns: { \"AR\": { code, name, ... }, \"EN\": { ... } }\n * We need: [{ code, name, ... }, { code, name, ... }]\n * todo:: return the languages as object from the APIs to avoid this\n */\nfunction languagesToArray(languages?: Record<string, Language>): Language[] | undefined {\n if (!languages) return undefined;\n // The SDK's localization modal reads `lang.iso_code` (not `code`) when a language is\n // selected — without it the switch navigates to `/undefined/...`.\n return Object.values(languages).map((lang) => ({ iso_code: lang.code, ...lang }));\n}\n\nexport const store = {\n settings: async (storeIdentifier?: string): Promise<StoreContext | null> => {\n const identifier = storeIdentifier ?? resolveStoreIdentifier();\n\n if (!identifier) {\n console.warn('[store.settings] No store identifier available');\n return null;\n }\n\n const includeParams = DEFAULT_INCLUDE_ITEMS.map((i) => `include[]=${i}`).join('&');\n const scopeId = getActiveScopeId();\n const params = scopeId != null ? `${includeParams}&scope=${scopeId}` : includeParams;\n\n try {\n const json = await api\n // Sent explicitly rather than left to the client's own resolution, so\n // the identifier this function checked is the identifier that travels.\n // They agree today; a caller passing one and being answered about\n // another is the failure this makes impossible rather than unlikely.\n .get(`store/settings?${params}`, {\n timeout: 5000,\n headers: { [STORE_IDENTIFIER_HEADER]: identifier },\n })\n .json<{ data?: SettingsApiResponse }>();\n\n const data = json?.data;\n if (!data) return null;\n\n // Convert languages from object to array\n const languages = languagesToArray(data.languages);\n\n return {\n store: data.store,\n theme: data.theme,\n languages,\n currencies: data.currencies,\n external_services: data.external_services,\n headers: data.headers,\n login: data.login,\n affiliate: data.affiliate,\n policy_url: data.policy_url,\n };\n } catch (error) {\n console.error('[store.settings] Failed:', error);\n return null;\n }\n },\n\n queries: {\n settings: (storeIdentifier?: string) =>\n queryOptions<StoreContext | null>({\n queryKey: [\n 'store',\n 'settings',\n storeIdentifier,\n getTwilightContext().locale,\n getActiveScope(),\n // Two versions of one store's settings are two different answers, and\n // this is the query whose answer decides what every other call is\n // pinned to. `requestedThemeVersionId` rather than the resolved one:\n // the resolved value falls back to what these settings report, so it\n // is not knowable until after this query has run — the key would be\n // one thing on the server and another on the client, and the hydrated\n // page would refetch the settings it was just handed.\n requestedThemeVersionId(),\n ],\n queryFn: () => store.settings(storeIdentifier),\n }),\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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;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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-FUIPNVQY.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"]}
|