@salla.sa/twilight-theme-engine 1.0.202 → 1.0.203
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-MGRO2C32.js → AddToCartForm-6FMKWZ6T.js} +3 -3
- package/dist/{AddToCartForm-MGRO2C32.js.map → AddToCartForm-6FMKWZ6T.js.map} +1 -1
- package/dist/{BlogAuthorPage-6HETWD7Z.js → BlogAuthorPage-LX2G6ACQ.js} +19 -19
- package/dist/{BlogAuthorPage-6HETWD7Z.js.map → BlogAuthorPage-LX2G6ACQ.js.map} +1 -1
- package/dist/{BlogCategoryPage-QE3JE6MV.js → BlogCategoryPage-YKZUJDOH.js} +19 -19
- package/dist/{BlogCategoryPage-QE3JE6MV.js.map → BlogCategoryPage-YKZUJDOH.js.map} +1 -1
- package/dist/{BlogPage-TO5P5MH6.js → BlogPage-PGNI7AH2.js} +17 -17
- package/dist/{BlogPage-TO5P5MH6.js.map → BlogPage-PGNI7AH2.js.map} +1 -1
- package/dist/{BlogSinglePage-5UZMVCCQ.js → BlogSinglePage-J35SDJ7Z.js} +17 -17
- package/dist/{BlogSinglePage-5UZMVCCQ.js.map → BlogSinglePage-J35SDJ7Z.js.map} +1 -1
- package/dist/{BlogTagPage-KJXCZ43X.js → BlogTagPage-7DPI7CFX.js} +19 -19
- package/dist/{BlogTagPage-KJXCZ43X.js.map → BlogTagPage-7DPI7CFX.js.map} +1 -1
- package/dist/{BrandsPage-OOYJOJMW.js → BrandsPage-IXHS2NLZ.js} +18 -18
- package/dist/{BrandsPage-OOYJOJMW.js.map → BrandsPage-IXHS2NLZ.js.map} +1 -1
- package/dist/{Breadcrumb-HEW6S7E4.js → Breadcrumb-F7YU3LCH.js} +17 -17
- package/dist/{Breadcrumb-HEW6S7E4.js.map → Breadcrumb-F7YU3LCH.js.map} +1 -1
- package/dist/{CanvasOverlay-LMGV2MGY.js → CanvasOverlay-65WZ3VPB.js} +3 -3
- package/dist/{CanvasOverlay-LMGV2MGY.js.map → CanvasOverlay-65WZ3VPB.js.map} +1 -1
- package/dist/{CartItem-VQ6TVI43.js → CartItem-KKSCIQOG.js} +17 -17
- package/dist/{CartItem-VQ6TVI43.js.map → CartItem-KKSCIQOG.js.map} +1 -1
- package/dist/{CartSummary-ZSKWTTKV.js → CartSummary-YO6CY7GX.js} +17 -17
- package/dist/{CartSummary-ZSKWTTKV.js.map → CartSummary-YO6CY7GX.js.map} +1 -1
- package/dist/{Copyright-TBIKM4AV.js → Copyright-Q6T4OOG2.js} +3 -3
- package/dist/{Copyright-TBIKM4AV.js.map → Copyright-Q6T4OOG2.js.map} +1 -1
- package/dist/{CustomerLayout-C6F4FMXW.js → CustomerLayout-HV4IGBAR.js} +17 -17
- package/dist/{CustomerLayout-C6F4FMXW.js.map → CustomerLayout-HV4IGBAR.js.map} +1 -1
- package/dist/{Footer-33DPB36S.js → Footer-SVJT3UAP.js} +3 -3
- package/dist/{Footer-33DPB36S.js.map → Footer-SVJT3UAP.js.map} +1 -1
- package/dist/GoogleTag-4IUBSGDQ.js +15 -0
- package/dist/{GoogleTag-UNWHTJVU.js.map → GoogleTag-4IUBSGDQ.js.map} +1 -1
- package/dist/{Header-6B27RGMD.js → Header-HKN42YHL.js} +8 -8
- package/dist/{Header-6B27RGMD.js.map → Header-HKN42YHL.js.map} +1 -1
- package/dist/{LatestProducts-DETZ5IVU.js → LatestProducts-5G3TECJX.js} +19 -19
- package/dist/{LatestProducts-DETZ5IVU.js.map → LatestProducts-5G3TECJX.js.map} +1 -1
- package/dist/{LoyaltyPage-ELAZ35HO.js → LoyaltyPage-ZFOD7SIT.js} +17 -17
- package/dist/{LoyaltyPage-ELAZ35HO.js.map → LoyaltyPage-ZFOD7SIT.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-ESGKNK2X.js → LoyaltyPointsPage-V67LM3UF.js} +6 -6
- package/dist/{LoyaltyPointsPage-ESGKNK2X.js.map → LoyaltyPointsPage-V67LM3UF.js.map} +1 -1
- package/dist/{MainMenu-T7ROBQTQ.js → MainMenu-7F4UK4WB.js} +5 -5
- package/dist/{MainMenu-T7ROBQTQ.js.map → MainMenu-7F4UK4WB.js.map} +1 -1
- package/dist/{MasterLayout-RDS7MIBF.js → MasterLayout-GRP2MPD6.js} +17 -17
- package/dist/{MasterLayout-RDS7MIBF.js.map → MasterLayout-GRP2MPD6.js.map} +1 -1
- package/dist/{MobileMenu-LTXUY7HT.js → MobileMenu-VAAQ43S6.js} +18 -18
- package/dist/{MobileMenu-LTXUY7HT.js.map → MobileMenu-VAAQ43S6.js.map} +1 -1
- package/dist/{NotificationsPage-HFJUK6QN.js → NotificationsPage-ERCQPECE.js} +17 -17
- package/dist/{NotificationsPage-HFJUK6QN.js.map → NotificationsPage-ERCQPECE.js.map} +1 -1
- package/dist/{OrderSinglePage-UMQKAO5O.js → OrderSinglePage-43G324LB.js} +18 -18
- package/dist/{OrderSinglePage-UMQKAO5O.js.map → OrderSinglePage-43G324LB.js.map} +1 -1
- package/dist/{OrdersPage-JGU4S2GM.js → OrdersPage-5ZBHBH6W.js} +17 -17
- package/dist/{OrdersPage-JGU4S2GM.js.map → OrdersPage-5ZBHBH6W.js.map} +1 -1
- package/dist/{PageSingle-JTXOUJ5I.js → PageSingle-45Z5EU5E.js} +3 -3
- package/dist/{PageSingle-JTXOUJ5I.js.map → PageSingle-45Z5EU5E.js.map} +1 -1
- package/dist/{ProductDetails-YDXO7SO3.js → ProductDetails-YD45MKRJ.js} +5 -5
- package/dist/{ProductDetails-YDXO7SO3.js.map → ProductDetails-YD45MKRJ.js.map} +1 -1
- package/dist/{ProfilePage-WJGXPQJA.js → ProfilePage-QB2D2NCO.js} +17 -17
- package/dist/{ProfilePage-WJGXPQJA.js.map → ProfilePage-QB2D2NCO.js.map} +1 -1
- package/dist/{ReviewsPage-KGVOTE3C.js → ReviewsPage-LTGLXDVL.js} +3 -3
- package/dist/{ReviewsPage-KGVOTE3C.js.map → ReviewsPage-LTGLXDVL.js.map} +1 -1
- package/dist/{SeoCartWidget-DHWNMBVG.js → SeoCartWidget-TCLBMX75.js} +17 -17
- package/dist/{SeoCartWidget-DHWNMBVG.js.map → SeoCartWidget-TCLBMX75.js.map} +1 -1
- package/dist/{SettingsPage-KN7XND2F.js → SettingsPage-P6IACFWB.js} +17 -17
- package/dist/{SettingsPage-KN7XND2F.js.map → SettingsPage-P6IACFWB.js.map} +1 -1
- package/dist/{StoreClosedNotification-R4RRKDTC.js → StoreClosedNotification-TBTT2KU2.js} +18 -18
- package/dist/{StoreClosedNotification-R4RRKDTC.js.map → StoreClosedNotification-TBTT2KU2.js.map} +1 -1
- package/dist/{TestimonialsPage-5FN6GXWE.js → TestimonialsPage-OVNNDMCX.js} +3 -3
- package/dist/{TestimonialsPage-5FN6GXWE.js.map → TestimonialsPage-OVNNDMCX.js.map} +1 -1
- package/dist/{ThankYouPage-MFR6N5QH.js → ThankYouPage-I2BRD7QC.js} +17 -17
- package/dist/{ThankYouPage-MFR6N5QH.js.map → ThankYouPage-I2BRD7QC.js.map} +1 -1
- package/dist/{WalletPage-KREUDNWV.js → WalletPage-PRJDQLR3.js} +18 -18
- package/dist/{WalletPage-KREUDNWV.js.map → WalletPage-PRJDQLR3.js.map} +1 -1
- package/dist/{WebMcpTools-7PTIWZTI.js → WebMcpTools-UCY4IWDN.js} +5 -5
- package/dist/{WebMcpTools-7PTIWZTI.js.map → WebMcpTools-UCY4IWDN.js.map} +1 -1
- package/dist/{WishlistPage-MNEYEAZZ.js → WishlistPage-NRUSXP32.js} +20 -20
- package/dist/WishlistPage-NRUSXP32.js.map +1 -0
- package/dist/api/advertisement.js +2 -2
- package/dist/api/apps.js +2 -2
- package/dist/api/blog.js +3 -3
- package/dist/api/brands.js +3 -3
- package/dist/api/cart.js +3 -3
- package/dist/api/category.js +3 -3
- package/dist/api/client.js +1 -1
- package/dist/api/custom-url.js +2 -2
- package/dist/api/home.js +2 -2
- package/dist/api/loyalty.js +3 -3
- package/dist/api/menu.js +2 -2
- package/dist/api/notification.js +2 -2
- package/dist/api/order.js +3 -3
- package/dist/api/page.js +3 -3
- package/dist/api/product.js +3 -3
- package/dist/api/profile.js +1 -1
- package/dist/api/store.js +2 -2
- package/dist/api/translations.js +2 -2
- package/dist/api/user.js +2 -2
- package/dist/api/wallet.js +2 -2
- package/dist/api/wishlist.js +4 -4
- package/dist/{chunk-E2FLUO66.js → chunk-2EEIMTU7.js} +4 -4
- package/dist/{chunk-E2FLUO66.js.map → chunk-2EEIMTU7.js.map} +1 -1
- package/dist/{chunk-5KJRXUTY.js → chunk-2LOLKRMT.js} +3 -3
- package/dist/{chunk-5KJRXUTY.js.map → chunk-2LOLKRMT.js.map} +1 -1
- package/dist/{chunk-EIKSX6CU.js → chunk-3AEHPT4C.js} +3 -3
- package/dist/{chunk-EIKSX6CU.js.map → chunk-3AEHPT4C.js.map} +1 -1
- package/dist/{chunk-B36XYFRF.js → chunk-3ZUWSJVH.js} +4 -4
- package/dist/{chunk-B36XYFRF.js.map → chunk-3ZUWSJVH.js.map} +1 -1
- package/dist/{chunk-D673H35J.js → chunk-467XYJGK.js} +4 -4
- package/dist/{chunk-D673H35J.js.map → chunk-467XYJGK.js.map} +1 -1
- package/dist/{chunk-5THYN7HU.js → chunk-77EKLFWG.js} +3 -3
- package/dist/{chunk-5THYN7HU.js.map → chunk-77EKLFWG.js.map} +1 -1
- package/dist/{chunk-TTIMB7FN.js → chunk-7R4SNM3G.js} +3 -3
- package/dist/{chunk-TTIMB7FN.js.map → chunk-7R4SNM3G.js.map} +1 -1
- package/dist/{chunk-HNYFF4V5.js → chunk-A764QYEF.js} +4 -4
- package/dist/{chunk-HNYFF4V5.js.map → chunk-A764QYEF.js.map} +1 -1
- package/dist/{chunk-IZHE3Y4T.js → chunk-BEQBNADR.js} +4 -4
- package/dist/{chunk-IZHE3Y4T.js.map → chunk-BEQBNADR.js.map} +1 -1
- package/dist/{chunk-VY4ZQTAD.js → chunk-CUIQQKVP.js} +5 -5
- package/dist/{chunk-VY4ZQTAD.js.map → chunk-CUIQQKVP.js.map} +1 -1
- package/dist/{chunk-AZFF7ZF3.js → chunk-DV6FY3F3.js} +7 -7
- package/dist/{chunk-AZFF7ZF3.js.map → chunk-DV6FY3F3.js.map} +1 -1
- package/dist/{chunk-TCLVTP3U.js → chunk-FA57RGWU.js} +4 -4
- package/dist/{chunk-TCLVTP3U.js.map → chunk-FA57RGWU.js.map} +1 -1
- package/dist/{chunk-4YQDF2LY.js → chunk-FDNUH4RX.js} +3 -3
- package/dist/{chunk-4YQDF2LY.js.map → chunk-FDNUH4RX.js.map} +1 -1
- package/dist/{chunk-B4W6L3Z7.js → chunk-FJQPEXR5.js} +5 -5
- package/dist/{chunk-B4W6L3Z7.js.map → chunk-FJQPEXR5.js.map} +1 -1
- package/dist/{chunk-INIQV72S.js → chunk-GBZBG3VU.js} +3 -3
- package/dist/{chunk-INIQV72S.js.map → chunk-GBZBG3VU.js.map} +1 -1
- package/dist/{chunk-GLRSTHPF.js → chunk-H6ISS5WL.js} +7 -7
- package/dist/{chunk-GLRSTHPF.js.map → chunk-H6ISS5WL.js.map} +1 -1
- package/dist/{chunk-YSZ4MUVA.js → chunk-HEDPG2B5.js} +4 -4
- package/dist/{chunk-YSZ4MUVA.js.map → chunk-HEDPG2B5.js.map} +1 -1
- package/dist/{chunk-X5RY3ZJX.js → chunk-HJKJVBYI.js} +2 -2
- package/dist/{chunk-X5RY3ZJX.js.map → chunk-HJKJVBYI.js.map} +1 -1
- package/dist/{chunk-D44Q42QK.js → chunk-IA3CVVAC.js} +3 -3
- package/dist/{chunk-D44Q42QK.js.map → chunk-IA3CVVAC.js.map} +1 -1
- package/dist/{chunk-BR6TMSXJ.js → chunk-IB2POFG7.js} +3 -3
- package/dist/{chunk-BR6TMSXJ.js.map → chunk-IB2POFG7.js.map} +1 -1
- package/dist/{chunk-HMBZG5SI.js → chunk-IBGFKAHH.js} +4 -4
- package/dist/{chunk-HMBZG5SI.js.map → chunk-IBGFKAHH.js.map} +1 -1
- package/dist/{chunk-3YWOSDTE.js → chunk-INCVJ6LJ.js} +4 -4
- package/dist/{chunk-3YWOSDTE.js.map → chunk-INCVJ6LJ.js.map} +1 -1
- package/dist/{chunk-P3VBZF3Q.js → chunk-IWECQPA3.js} +6 -6
- package/dist/{chunk-P3VBZF3Q.js.map → chunk-IWECQPA3.js.map} +1 -1
- package/dist/{chunk-FYOGL2RP.js → chunk-J5BV3OJC.js} +5 -5
- package/dist/{chunk-FYOGL2RP.js.map → chunk-J5BV3OJC.js.map} +1 -1
- package/dist/{chunk-BY7WVT74.js → chunk-JK2FVL6U.js} +3 -3
- package/dist/{chunk-BY7WVT74.js.map → chunk-JK2FVL6U.js.map} +1 -1
- package/dist/{chunk-GQZLSXFT.js → chunk-JLPOORYB.js} +3 -3
- package/dist/{chunk-GQZLSXFT.js.map → chunk-JLPOORYB.js.map} +1 -1
- package/dist/{chunk-6MTMABUA.js → chunk-JLVYQBHV.js} +4 -4
- package/dist/{chunk-6MTMABUA.js.map → chunk-JLVYQBHV.js.map} +1 -1
- package/dist/{chunk-XAGPOES5.js → chunk-LNJUQ2S6.js} +3 -3
- package/dist/{chunk-XAGPOES5.js.map → chunk-LNJUQ2S6.js.map} +1 -1
- package/dist/{chunk-LFZNV4AM.js → chunk-LPGCUQGP.js} +4 -4
- package/dist/{chunk-LFZNV4AM.js.map → chunk-LPGCUQGP.js.map} +1 -1
- package/dist/{chunk-DUIQQINV.js → chunk-MRBNEIHQ.js} +29 -21
- package/dist/chunk-MRBNEIHQ.js.map +1 -0
- package/dist/{chunk-TSCG4Y6Z.js → chunk-N7Y6ODZM.js} +3 -3
- package/dist/{chunk-TSCG4Y6Z.js.map → chunk-N7Y6ODZM.js.map} +1 -1
- package/dist/{chunk-QHQ7A6MC.js → chunk-NNMFEKSI.js} +4 -4
- package/dist/{chunk-QHQ7A6MC.js.map → chunk-NNMFEKSI.js.map} +1 -1
- package/dist/{chunk-2U3YFFAK.js → chunk-OJERROHX.js} +4 -4
- package/dist/{chunk-2U3YFFAK.js.map → chunk-OJERROHX.js.map} +1 -1
- package/dist/{chunk-P6B6BKE2.js → chunk-ORW2SKDM.js} +3 -3
- package/dist/{chunk-P6B6BKE2.js.map → chunk-ORW2SKDM.js.map} +1 -1
- package/dist/{chunk-F6COCO2Y.js → chunk-OSTF5LXJ.js} +4 -4
- package/dist/{chunk-F6COCO2Y.js.map → chunk-OSTF5LXJ.js.map} +1 -1
- package/dist/{chunk-YTON74ML.js → chunk-OT4UEO5H.js} +4 -4
- package/dist/{chunk-YTON74ML.js.map → chunk-OT4UEO5H.js.map} +1 -1
- package/dist/{chunk-2LUM7P3K.js → chunk-PGM5R2XW.js} +3 -3
- package/dist/{chunk-2LUM7P3K.js.map → chunk-PGM5R2XW.js.map} +1 -1
- package/dist/{chunk-AB54IGXY.js → chunk-QRTQQF2M.js} +3 -3
- package/dist/{chunk-AB54IGXY.js.map → chunk-QRTQQF2M.js.map} +1 -1
- package/dist/{chunk-V2LH4NTK.js → chunk-R2PIKS37.js} +3 -3
- package/dist/{chunk-V2LH4NTK.js.map → chunk-R2PIKS37.js.map} +1 -1
- package/dist/{chunk-TITXSVCX.js → chunk-SFMOOU6Z.js} +3 -3
- package/dist/{chunk-TITXSVCX.js.map → chunk-SFMOOU6Z.js.map} +1 -1
- package/dist/{chunk-3XXTI5AT.js → chunk-SHIZAN54.js} +3 -3
- package/dist/{chunk-3XXTI5AT.js.map → chunk-SHIZAN54.js.map} +1 -1
- package/dist/{chunk-HNNBAD4P.js → chunk-SIQ563AO.js} +14 -14
- package/dist/{chunk-HNNBAD4P.js.map → chunk-SIQ563AO.js.map} +1 -1
- package/dist/{chunk-BHH4R46G.js → chunk-SUKNOJBZ.js} +4 -4
- package/dist/{chunk-BHH4R46G.js.map → chunk-SUKNOJBZ.js.map} +1 -1
- package/dist/{chunk-DKNV4AS6.js → chunk-W5ARKYF2.js} +7 -7
- package/dist/{chunk-DKNV4AS6.js.map → chunk-W5ARKYF2.js.map} +1 -1
- package/dist/{chunk-6AIUG32Y.js → chunk-WFXRDHF5.js} +3 -3
- package/dist/{chunk-6AIUG32Y.js.map → chunk-WFXRDHF5.js.map} +1 -1
- package/dist/{chunk-7NWQ2QQ7.js → chunk-WUC4UYYL.js} +5 -5
- package/dist/{chunk-7NWQ2QQ7.js.map → chunk-WUC4UYYL.js.map} +1 -1
- package/dist/{chunk-QT7LLCYA.js → chunk-XR7TECRL.js} +3 -3
- package/dist/{chunk-QT7LLCYA.js.map → chunk-XR7TECRL.js.map} +1 -1
- package/dist/{chunk-BBKMOJZN.js → chunk-YKP4BFVK.js} +3 -3
- package/dist/{chunk-BBKMOJZN.js.map → chunk-YKP4BFVK.js.map} +1 -1
- package/dist/{chunk-36FHHN24.js → chunk-Z5DX5AXM.js} +3 -3
- package/dist/{chunk-36FHHN24.js.map → chunk-Z5DX5AXM.js.map} +1 -1
- package/dist/{chunk-PZCMNKQD.js → chunk-ZE2L2PAA.js} +4 -4
- package/dist/{chunk-PZCMNKQD.js.map → chunk-ZE2L2PAA.js.map} +1 -1
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +15 -15
- package/dist/components/home/index.js +20 -20
- package/dist/components/layout/index.js +4 -4
- package/dist/components/product/index.js +17 -17
- package/dist/components/store/index.js +16 -16
- package/dist/components/tracking/index.js +6 -6
- package/dist/{custom-urls-Q5RSWIQF.js → custom-urls-GRYQ2CLS.js} +7 -7
- package/dist/{custom-urls-Q5RSWIQF.js.map → custom-urls-GRYQ2CLS.js.map} +1 -1
- package/dist/dev/editor/index.js +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/{document-class-BVPGIVAG.js → document-class-YA2Z4FVP.js} +17 -17
- package/dist/{document-class-BVPGIVAG.js.map → document-class-YA2Z4FVP.js.map} +1 -1
- package/dist/hooks/index.js +15 -15
- package/dist/hooks/useGtm.d.ts.map +1 -1
- package/dist/hooks/useGtm.js +15 -15
- package/dist/hooks/useMoney.js +15 -15
- package/dist/hooks/useStore.js +15 -15
- package/dist/hooks/useUser.js +3 -3
- package/dist/index.js +15 -15
- package/dist/{navigation-VKTU7EYX.js → navigation-COMJX7AY.js} +5 -5
- package/dist/{navigation-VKTU7EYX.js.map → navigation-COMJX7AY.js.map} +1 -1
- package/dist/{navigation-IL7NGYVV.js → navigation-WOID2TUS.js} +4 -4
- package/dist/{navigation-IL7NGYVV.js.map → navigation-WOID2TUS.js.map} +1 -1
- package/dist/{not-found-6O4MKPJT.js → not-found-KCC3OUJZ.js} +18 -18
- package/dist/{not-found-6O4MKPJT.js.map → not-found-KCC3OUJZ.js.map} +1 -1
- package/dist/providers/index.js +15 -15
- package/dist/routes/account/orders.js +4 -4
- package/dist/routes/account/wishlist/WishlistPage.d.ts.map +1 -1
- package/dist/routes/account.js +13 -13
- package/dist/routes/blog.js +8 -8
- package/dist/routes/brands.js +4 -4
- package/dist/routes/cart.js +25 -25
- package/dist/routes/home.js +21 -21
- package/dist/routes/index.js +8 -8
- package/dist/routes/loyalty.js +5 -5
- package/dist/routes/page.js +4 -4
- package/dist/routes/product/index.d.ts.map +1 -1
- package/dist/routes/product-listing.js +25 -25
- package/dist/routes/product.js +49 -38
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/seo-redirects.js +8 -8
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +4 -4
- package/dist/skeleton.js +23 -23
- package/dist/{store-lookup-QQJUHZOQ.js → store-lookup-TZ62QW7B.js} +8 -8
- package/dist/{store-lookup-QQJUHZOQ.js.map → store-lookup-TZ62QW7B.js.map} +1 -1
- package/dist/tanstack.js +17 -17
- package/dist/utils/index.js +2 -2
- package/dist/utils/product-price.d.ts +12 -0
- package/dist/utils/product-price.d.ts.map +1 -0
- package/package.json +1 -1
- package/tailwind/routes/account/wishlist/WishlistPage.tsx.txt +3 -1
- package/tailwind/routes/product/index.tsx.txt +41 -20
- package/dist/GoogleTag-UNWHTJVU.js +0 -15
- package/dist/WishlistPage-MNEYEAZZ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EAA4B,CAAA;AAAA,0BACrD,GAAA,CAAC,aAAA,EAAA,EAAc,SAAA,EAAU,yBAAA,EAA0B,CAAA;AAAA,0BACnD,GAAA,CAAC,aAAA,EAAA,EAAc,SAAA,EAAU,yBAAA,EAA0B;AAAA,SAAA,EACrD,CAAA;AAAA,wBACA,GAAA,CAAC,SAAI,SAAA,EAAU,2BAAA,EACb,8BAAC,aAAA,EAAA,EAAc,SAAA,EAAU,6BAA4B,CAAA,EACvD;AAAA,OAAA,EACF;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAEJ","file":"chunk-2EEIMTU7.js","sourcesContent":["import { useMemo } from 'react';\nimport { useParams } from '@tanstack/react-router';\nimport {\n BreadcrumbSkeleton,\n ProductDetailSkeleton,\n SkeletonPulse,\n} from '@salla.sa/twilight-components-react/skeletons';\nimport { getProductPreview } from '../../api/product';\nimport { Image } from '../../components/common/Image';\nimport { ProductPrice } from '../../components/product/ProductDetails';\nimport type { Product } from '../../types';\n\n/**\n * Product route `pendingComponent`. When the shopper opens a product from a card, the\n * list already gave us its name, price and image (`rememberProductPreview`), so paint\n * those in the product page's layout while details load, not a blank skeleton.\n * Without a remembered card (deep link, SKU link) it is `ProductDetailSkeleton`.\n * `id` defaults to the route's `id` param.\n *\n * Only plain markup: no gallery slider, form, hook slots or `salla-*` widgets, which\n * would start (and fetch) for the stand-in and again when the real page mounts.\n */\nexport function ProductPendingPreview({ id: idProp }: { id?: string } = {}) {\n const params = useParams({ strict: false }) as { id?: string };\n const id = idProp ?? params.id;\n const product = useMemo(() => (id ? getProductPreview(id) : undefined), [id]);\n\n if (!product?.name) return <ProductDetailSkeleton />;\n return <ProductDetailPreview product={product} />;\n}\n\n/** `ProductDetailSkeleton`'s boxes, with the card's image, name and price filled in. */\nexport function ProductDetailPreview({ product }: { product: Product }) {\n const image = product.image?.url ? product.image : product.images?.[0];\n\n return (\n <div data-product-preview={product.id}>\n <div className=\"s-skeleton-detail-container\">\n <BreadcrumbSkeleton />\n <div className=\"s-skeleton-detail-layout\">\n <div className=\"s-skeleton-detail-images\">\n {image?.url ? (\n <div className=\"s-skeleton-card-image overflow-hidden bg-gray-100\">\n <Image\n src={image.url}\n alt={image.alt || product.name}\n className=\"h-full w-full object-cover\"\n aspectRatio=\"1/1\"\n priority\n noWrapper\n />\n </div>\n ) : (\n <SkeletonPulse className=\"s-skeleton-card-image\" />\n )}\n <div className=\"s-skeleton-slider-thumbs\">\n {Array.from({ length: 3 }, (_, i) => (\n <SkeletonPulse key={i} className=\"s-skeleton-slider-thumb\" />\n ))}\n </div>\n </div>\n <div className=\"s-skeleton-detail-content\">\n <h1 className=\"text-xl md:text-2xl leading-10 font-bold text-gray-800\">\n {product.name}\n </h1>\n {product.subtitle && (\n <h2 className=\"product-entry__sub-title text-sm text-gray-500 leading-6\">\n {product.subtitle}\n </h2>\n )}\n <ProductPrice product={product} />\n <div className=\"s-skeleton-detail-description\">\n <SkeletonPulse className=\"s-skeleton-text-line-full\" />\n <SkeletonPulse className=\"s-skeleton-text-line-lg\" />\n <SkeletonPulse className=\"s-skeleton-text-line-sm\" />\n </div>\n <div className=\"s-skeleton-detail-actions\">\n <SkeletonPulse className=\"s-skeleton-detail-add-btn\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { advertisement, advertisementsFor } from './chunk-
|
|
1
|
+
import { advertisement, advertisementsFor } from './chunk-JLPOORYB.js';
|
|
2
2
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
3
3
|
import { whenSallaReady } from './chunk-MZPX4EPS.js';
|
|
4
4
|
import { subscribeTwilight, getTwilightContext } from './chunk-MWUAHDQL.js';
|
|
@@ -99,5 +99,5 @@ function PageAdvertisements() {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export { PageAdvertisements };
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
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unk-2LOLKRMT.js","sourcesContent":["import { useEffect, useState, useSyncExternalStore } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { advertisement, advertisementsFor, type Advertisement } from '../../api/advertisement';\nimport { whenSallaReady } from '../../utils/sdk-helpers';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { getTwilightContext, subscribeTwilight } from '../../twilight/context';\n\nconst currentPageSlug = () => getTwilightContext().page?.slug;\n\n/** The key `<salla-advertisement>` marks a closed ad with, through `salla.storage` (store.js, JSON). */\nconst dismissedKey = (id: number) => `statusAd-${id}`;\n\n/** Stable while the query has no data, so the effect below doesn't rerun on every render. */\nconst NO_ADS: Advertisement[] = [];\n\n/** Hides the ads this visitor closed before the first paint; the effect then drops them. */\nconst HIDE_DISMISSED_SCRIPT =\n \"(function(){try{if(window.self!==window.top)return;document.currentScript.parentNode.querySelectorAll('.s-advertisement[data-id]').forEach(function(e){if(localStorage.getItem('statusAd-'+e.getAttribute('data-id')))e.hidden=true})}catch(e){}})();\";\n\nfunction isDismissed(id: number): boolean {\n try {\n return Boolean(window.localStorage.getItem(dismissedKey(id)));\n } catch {\n return false;\n }\n}\n\nfunction dismiss(id: number): void {\n const storage = window.salla?.storage;\n if (typeof storage?.set === 'function') storage.set(dismissedKey(id), 'dismissed');\n else {\n try {\n window.localStorage.setItem(dismissedKey(id), JSON.stringify('dismissed'));\n } catch {\n // Storage disabled: the ad hides for this page view only.\n }\n }\n}\n\ninterface ClientView {\n /** The theme editor's iframe, or the SDK's debug flag: every ad shows, closed or not. */\n preview: boolean;\n /** Inside the Salla mobile app, which shows no ads. */\n inApp: boolean;\n dismissed: Set<number>;\n}\n\n/**\n * The merchant's announcement bars, in place of `<salla-advertisement>`. Same data, rules and\n * markup, but rendered on the server (the ads are prefetched in the root `beforeLoad`), so the\n * bar is in the first paint instead of pushing the page down when the web component fetches it.\n */\nexport function PageAdvertisements() {\n const { t } = useTranslation();\n // The deepest route loader's `page`, the page `salla.config` reports.\n const pageSlug = useSyncExternalStore(subscribeTwilight, currentPageSlug, currentPageSlug);\n // The query's `retry: 0` only bounds the server wait; the browser may retry.\n const { data: ads = NO_ADS } = useQuery({ ...advertisement.queries.list(), retry: 2 });\n const [view, setView] = useState<ClientView | null>(null);\n\n useEffect(() => {\n const dismissed = new Set(ads.filter((ad) => isDismissed(ad.id)).map((ad) => ad.id));\n setView({ preview: window.self !== window.top, inApp: false, dismissed });\n return whenSallaReady((sdk) => {\n const config = sdk.config as { isMobileApp?: () => boolean; isDebug?: () => boolean };\n const inApp = Boolean(config?.isMobileApp?.());\n const debug = Boolean(config?.isDebug?.());\n if (inApp || debug) {\n setView((current) =>\n current ? { ...current, inApp, preview: current.preview || debug } : current\n );\n }\n });\n }, [ads]);\n\n if (view?.inApp) return null;\n const shown = view?.preview\n ? ads\n : advertisementsFor(ads, pageSlug).filter((ad) => !view?.dismissed.has(ad.id));\n if (!shown.length) return null;\n\n const close = (id: number) => {\n dismiss(id);\n setView((current) =>\n current ? { ...current, dismissed: new Set(current.dismissed).add(id) } : current\n );\n };\n\n return (\n <>\n {shown.map((ad) => (\n <div\n key={ad.id}\n className=\"s-advertisement\"\n data-id={ad.id}\n style={{ backgroundColor: ad.colors?.bg, color: ad.colors?.text }}\n >\n <div className=\"s-advertisement-content container flex justify-between items-center py-2.5\">\n <span className=\"s-advertisement-content-main flex-1 font-bold text-center text-sm\">\n {/* Rendered without an icon too, as the SDK does: its margin is part of the layout. */}\n <i\n className={`s-advertisement-content-icon inline-block align-middle me-2 text-base ${ad.icon ?? ''}`}\n />\n {ad.url ? (\n <a\n href={ad.url}\n target={ad.target ?? undefined}\n rel={ad.target === '_blank' ? 'noopener' : undefined}\n >\n {ad.description}\n </a>\n ) : (\n ad.description\n )}\n </span>\n <button\n type=\"button\"\n className=\"s-advertisement-action px-1\"\n aria-label={t('common.buttons.close', 'Close')}\n onClick={() => close(ad.id)}\n >\n {/* `inline-block`: before the icon CSS loads, an empty inline `<i>` leaves the button 0px tall. */}\n <i className=\"sicon-cancel inline-block\" />\n </button>\n </div>\n </div>\n ))}\n <script suppressHydrationWarning>{HIDE_DISMISSED_SCRIPT}</script>\n </>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNotLaunchedNotice } from './chunk-O7JTXTGP.js';
|
|
2
|
-
import { getAuthToken, getActiveScope, api, STORE_IDENTIFIER_HEADER, devSettingsFetchedAt, rememberStoreRay } from './chunk-
|
|
2
|
+
import { getAuthToken, getActiveScope, api, STORE_IDENTIFIER_HEADER, devSettingsFetchedAt, rememberStoreRay } from './chunk-LNJUQ2S6.js';
|
|
3
3
|
import { requestedThemeVersionId } from './chunk-MZPX4EPS.js';
|
|
4
4
|
import { LANGUAGE_COOKIE_NAME, LANGUAGE_COOKIE_MAX_AGE, AUTH_TOKEN_COOKIE_NAME, resolveStoreIdentifier, extractScopeFromUrl, parseStoreId } from './chunk-4OZIBANF.js';
|
|
5
5
|
import { revokeAuthToken, getTwilightContext, SettingsError } from './chunk-MWUAHDQL.js';
|
|
@@ -273,5 +273,5 @@ var store = {
|
|
|
273
273
|
};
|
|
274
274
|
|
|
275
275
|
export { persistLanguageCookie, readCookieHeader, readNativeAppHeaders, readPageSearch, store };
|
|
276
|
-
//# sourceMappingURL=chunk-
|
|
277
|
-
//# sourceMappingURL=chunk-
|
|
276
|
+
//# sourceMappingURL=chunk-3AEHPT4C.js.map
|
|
277
|
+
//# sourceMappingURL=chunk-3AEHPT4C.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/language-cookie.ts","../src/utils/native-app-headers.ts","../src/api/store.ts"],"names":["createIsomorphicFn","setCookie"],"mappings":";;;;;;;;;;AAaA,IAAM,sBAAA,GAAyB,kBAAA,EAAmB,CAC/C,MAAA,CAAO,MAAqB;AAC3B,EAAA,IAAI;AACF,IAAA,OAAO,gBAAA,CAAiB,QAAQ,CAAA,IAAK,IAAA;AAAA,EACvC,CAAA,CAAA,MAAQ;AACN,IAAA,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lang` cookie, on the server and in the browser.\n *\n * The server reads it from the request the framework is handling and writes it to that\n * request's response. The server-only import is stripped from the client bundle by\n * `createIsomorphicFn`, as in `routes/root/beforeLoad.ts`. The browser uses `document.cookie`.\n * Either side outside a request (a prerender, a test) has nothing to read or write and says so\n * quietly.\n */\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getRequestHeader, getRequestUrl, setCookie } from '@tanstack/react-start/server';\nimport { LANGUAGE_COOKIE_MAX_AGE, LANGUAGE_COOKIE_NAME } from './cookies';\n\nconst readServerCookieHeader = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getRequestHeader('cookie') ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nconst writeServerLanguageCookie = createIsomorphicFn()\n .server((code: string): void => {\n try {\n setCookie(LANGUAGE_COOKIE_NAME, code, {\n path: '/',\n maxAge: LANGUAGE_COOKIE_MAX_AGE,\n sameSite: 'lax',\n });\n } catch {\n // Outside a request: there is no response to write to.\n }\n })\n .client((): void => {});\n\nconst readServerSearch = createIsomorphicFn()\n .server((): string => {\n try {\n return getRequestUrl().search;\n } catch {\n return '';\n }\n })\n .client((): string => '');\n\n/**\n * The query string of the page being rendered (`?lang=en`, or `''`): the request's on the\n * server, the address bar's in the browser, so both sides read the same one.\n */\nexport function readPageSearch(): string {\n return readServerSearch() || (typeof window !== 'undefined' ? window.location.search : '');\n}\n\n/** The `Cookie` header of the request being handled, or `document.cookie` in the browser. */\nexport function readCookieHeader(): string | null {\n return readServerCookieHeader() ?? (typeof document !== 'undefined' ? document.cookie : null);\n}\n\n/** Remembers `code` as the visitor's language for every store on this host. */\nexport function persistLanguageCookie(code: string): void {\n writeServerLanguageCookie(code);\n if (typeof document !== 'undefined') {\n document.cookie = `${LANGUAGE_COOKIE_NAME}=${encodeURIComponent(code)}; path=/; max-age=${LANGUAGE_COOKIE_MAX_AGE}; SameSite=Lax`;\n }\n}\n","/** The headers the Salla native app sends with every page it loads in its webview. */\nexport const NATIVE_APP_HEADERS = [\n 's-app-os',\n 's-app-version',\n 's-app-full-version',\n 's-app-os-version',\n];\n\n/**\n * How the app's webview names itself to the Store API. On a Twig theme Laravel hands these\n * to the SDK as request headers, which is how the API tells an app order from a website one.\n */\nexport const NATIVE_APP_REQUEST_HEADERS = ['s-source', 's-app-webview'];\n\n/**\n * The native app's own headers on this request, or null when it is not the app.\n *\n * On a Twig theme Laravel copies them into the settings' `jitsu.context.extra.headers`,\n * where the SDK reads the app's platform and version from (`salla.config.isMobileApp()`).\n * A React theme asks for its settings from the server, through the API, so the app's\n * headers never reach that call: the request is the only place they are.\n */\nexport function readNativeAppHeaders(headers: Headers): Record<string, string> | null {\n const os = headers.get('s-app-os')?.toLowerCase();\n if (os !== 'ios' && os !== 'android') return null;\n const found: Record<string, string> = {};\n for (const name of [...NATIVE_APP_HEADERS, ...NATIVE_APP_REQUEST_HEADERS]) {\n const value = headers.get(name);\n if (value) found[name] = value;\n }\n return found;\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { setCookie } from '@tanstack/react-start/server';\nimport { isHTTPError, isNetworkError, isTimeoutError } from 'ky';\nimport {\n api,\n getActiveScope,\n getAuthToken,\n rememberStoreRay,\n STORE_IDENTIFIER_HEADER,\n} from './client';\nimport { devSettingsFetchedAt } from './dev-settings-cache';\nimport { SettingsError } from '../utils/errors';\nimport type { Store, Theme, Language, JitsuConfig, MaintenanceDetails } from '../types';\nimport { getTwilightContext, revokeAuthToken } from '../twilight/context';\nimport { resolveStoreIdentifier } from '../utils/store-identity';\nimport { AUTH_TOKEN_COOKIE_NAME, extractScopeFromUrl, parseStoreId } from '../utils/cookies';\nimport { readPageSearch } from '../utils/language-cookie';\nimport { requestedThemeVersionId } from '../utils/theme-version';\nimport { NATIVE_APP_HEADERS } from '../utils/native-app-headers';\nimport { isNotLaunchedNotice } from '../utils/maintenance';\n\nexport { resolveStoreIdentifier };\n\n// `rating` and `ratings` are left out: nothing in the engine reads them, and the API builds them by\n// aggregating every testimonial of the store, which on large stores ran past SETTINGS_TIMEOUT_MS on\n// every render (TD-17779).\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 'user',\n];\n\n/** Twig's `salla.init({ user })` object; the endpoint ignores the token, so always the guest. */\nexport interface SettingsUser {\n type: 'guest' | 'user';\n id?: number | string | null;\n language_code?: string;\n currency_code?: string;\n country_code?: string;\n [key: string]: unknown;\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 user?: SettingsUser;\n jitsu?: JitsuConfig;\n maintenance?: boolean;\n maintenance_details?: MaintenanceDetails;\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 user?: SettingsUser;\n /** Where the SDK's analytics send events, and which ones; without it the SDK tracks nothing. */\n jitsu?: JitsuConfig;\n /**\n * The store is closed: by the merchant from the dashboard, by the platform, or\n * for the selected market only. The engine then renders the maintenance page\n * to everyone but the merchant; see `rootBeforeLoad`.\n */\n maintenance?: boolean;\n /** What the maintenance page says; sent beside `maintenance`. */\n maintenance_details?: MaintenanceDetails;\n /**\n * `false` while the store has not launched yet: `maintenance` is then `true` and the\n * engine's maintenance page says the store is launching soon. Absent otherwise. Not\n * from the API: read off `maintenance_details` by `store.settings`, since the\n * backend sends the merchant's \"finish launching\" notice there for every visitor,\n * which is not for a customer's eyes.\n */\n launched?: false;\n /**\n * The scope these settings were requested with; absent when none was. Not from\n * the API: stamped by `store.settings`, so `resolveThemeVersionId` can tell\n * whether the version they name still answers the scope that is active now.\n */\n requestedScopeId?: string;\n /** Which answer of the API these settings are; see {@link SettingsAnswer}. */\n answer?: SettingsAnswer;\n /**\n * When the dev server fetched these settings from the API (epoch ms). It reuses\n * them for a while (see `dev-settings-cache.ts`) and the theme editor says how old\n * they are. Only on a dev server render; absent everywhere else.\n */\n devFetchedAt?: number;\n}\n\n/**\n * Which answer of the settings API a set of settings came from, read off the\n * response rather than the body: the API's request id, the Store's trace, and\n * whether Cloudflare served it from its cache and how old it was. A decision the\n * settings drive for every visitor alike (the maintenance page) can then be\n * traced to the exact request the backend logged, or to a cached copy of it.\n */\nexport interface SettingsAnswer {\n requestId?: string;\n traceId?: string;\n cacheStatus?: string;\n age?: string;\n}\n\nconst ANSWER_HEADERS: Record<keyof SettingsAnswer, string> = {\n requestId: 's-request-id',\n traceId: 'x-trace-id',\n cacheStatus: 'cf-cache-status',\n age: 'age',\n};\n\nfunction settingsAnswerOf(headers: Headers | undefined): SettingsAnswer | undefined {\n if (!headers) return undefined;\n const answer: SettingsAnswer = {};\n for (const [field, name] of Object.entries(ANSWER_HEADERS) as [keyof SettingsAnswer, string][]) {\n const value = headers.get(name);\n if (value) answer[field] = value;\n }\n return Object.keys(answer).length ? answer : undefined;\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\n/**\n * The settings' analytics context with the native app's headers in it, as Laravel\n * writes it for a Twig theme: the SDK reads the app's platform and version from there.\n * The API answers a server-side call with the engine's own headers, never the app's.\n */\nfunction withNativeAppHeaders(jitsu?: JitsuConfig): JitsuConfig | undefined {\n const appHeaders = requestNativeAppHeaders();\n if (!jitsu || !appHeaders) return jitsu;\n const extra = jitsu.context?.extra;\n // The engine's own app headers go, so an app that sends no version doesn't get the engine's.\n const headers = { ...extra?.headers };\n for (const name of NATIVE_APP_HEADERS) {\n delete headers[name];\n if (appHeaders[name]) headers[name] = appHeaders[name];\n }\n return {\n ...jitsu,\n context: {\n ...jitsu.context,\n extra: { ...extra, headers },\n },\n };\n}\n\n/** The app's headers on the request being rendered; null in the browser and outside the app. */\nfunction requestNativeAppHeaders(): Record<string, string> | null {\n if (typeof window !== 'undefined') return null;\n try {\n return getTwilightContext().nativeAppHeaders;\n } catch {\n return null;\n }\n}\n\n/**\n * The settings' request headers with the app's `s-source` and `s-app-webview` in them, as\n * Laravel adds them for a Twig theme: the SDK copies `headers` onto every call it makes.\n *\n * Both or neither. `s-source: mobile` without `s-app-webview` is the native app itself to\n * the API, which then answers a guest's `cart/latest` with a new cart every time.\n */\nfunction withNativeAppRequestHeaders(\n headers?: Record<string, unknown>\n): Record<string, unknown> | undefined {\n const appHeaders = requestNativeAppHeaders();\n if (appHeaders?.['s-source'] !== 'mobile' || !appHeaders['s-app-webview']) return headers;\n return { ...headers, 's-source': 'mobile', 's-app-webview': appHeaders['s-app-webview'] };\n}\n\nconst SETTINGS_TIMEOUT_MS = 5000;\n\n/**\n * Whether the page's own address switches market (`?scope=`).\n *\n * Only then does the settings request name the scope in its query string. The API\n * reads `?scope=` as a switch and lets it override the market a market's own domain\n * is pinned to, which the `s-scope-id` header never does. Sent on every request, a\n * market remembered from another visit would win over the host the shopper is on: the\n * settings, and the SDK seeded from them, would answer for that market while every\n * call without the parameter (the cart, among them) answers for the host's, and a\n * guest's cart created in one is refused by the other (TD-17588).\n */\nfunction pageSwitchesScope(): boolean {\n return extractScopeFromUrl(`http://page.invalid/${readPageSearch()}`) !== null;\n}\n\nasync function requestSettings(identifier: string): Promise<StoreContext> {\n const includeParams = DEFAULT_INCLUDE_ITEMS.map((i) => `include[]=${i}`).join('&');\n const scope = getActiveScope();\n const params =\n scope != null && pageSwitchesScope() ? `${includeParams}&scope=${scope.id}` : includeParams;\n\n const request = 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: SETTINGS_TIMEOUT_MS,\n headers: { [STORE_IDENTIFIER_HEADER]: identifier },\n });\n const json = await request.json<{ data?: SettingsApiResponse }>();\n // The same response, already settled; only its headers are read.\n const headers = (await request)?.headers;\n const answer = settingsAnswerOf(headers);\n const devFetchedAt = devSettingsFetchedAt(headers);\n\n const data = json?.data;\n if (!data) {\n throw new SettingsError(\n `The Salla API answered the settings request for store \"${identifier}\" without settings.`,\n { reason: 'empty' }\n );\n }\n\n rememberStoreRay(identifier, data.headers);\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: withNativeAppRequestHeaders(data.headers),\n login: data.login,\n affiliate: data.affiliate,\n policy_url: data.policy_url,\n user: data.user,\n jitsu: withNativeAppHeaders(data.jitsu),\n maintenance: data.maintenance,\n maintenance_details: data.maintenance_details,\n ...(data.maintenance === true &&\n isNotLaunchedNotice(data.maintenance_details) && { launched: false as const }),\n ...(scope && { requestedScopeId: scope.id }),\n ...(answer && { answer }),\n ...(devFetchedAt && { devFetchedAt }),\n };\n}\n\n/** The message the API put in an error body, `{ error: { message } }`, when it sent one. */\nfunction apiErrorMessage(data: unknown): string | undefined {\n const message = (data as { error?: { message?: unknown } } | undefined)?.error?.message;\n return typeof message === 'string' && message.length > 0 && message.length <= 200\n ? message\n : undefined;\n}\n\n/**\n * What core's `CurrentStoreMiddleware` answers, with a 422, when no store has the\n * username or domain it was given (or the store's status is `deleted`). The lookup is\n * `loadUseUsernameOrDomain`, the same one Twig's `checkUsername` turns into its 410.\n * The literal is not translated: it reads the same whatever language was asked for.\n */\nconst STORE_NOT_FOUND_MESSAGE = 'المتجر غير موجود';\n\n/**\n * Whether the API answered that no store has this identifier. A numeric identifier\n * is looked up with `findOrFail`, which Store's exception handler answers with a 410;\n * a username or domain gets {@link STORE_NOT_FOUND_MESSAGE}. A 410 for a username is\n * not read as one: nothing on that path answers it, and a store that does exist must\n * never be told it does not.\n */\nfunction isStoreNotFound(identifier: string, status: number, said: string | undefined): boolean {\n if (status === 410) return parseStoreId(identifier) !== null;\n return status === 422 && said === STORE_NOT_FOUND_MESSAGE;\n}\n\n/**\n * Whether the API answered that the token was signed out of all devices. `unauthorized`\n * alone: `token_invalid` is refreshed by the SDK, and a limited token (a review link)\n * gets `policy_token_not_allowed` so that its customer stays signed in.\n */\nfunction isRevokedToken(error: unknown): boolean {\n if (!isHTTPError(error) || error.response.status !== 401) return false;\n return (error.data as { error?: { code?: unknown } } | undefined)?.error?.code === 'unauthorized';\n}\n\n/**\n * Drops a token the API answered as signed out everywhere (401 `unauthorized`), for the\n * rest of this server render and from the visitor's cookie. Without it the render stopped\n * at \"Store Unavailable\" and every reload sent the same token again; the SDK, which signs\n * the customer out on that answer, never loaded to do it.\n *\n * Answers whether there was a token to drop, so the caller knows a retry can differ.\n */\nconst dropRevokedToken = createIsomorphicFn()\n .server((): boolean => {\n // An uncompiled build runs this branch in the browser too; the SDK signs out there.\n if (typeof document !== 'undefined' || !getAuthToken()) return false;\n revokeAuthToken();\n try {\n setCookie(AUTH_TOKEN_COOKIE_NAME, '', { path: '/', maxAge: 0 });\n } catch {\n // Outside a request (prerender): there is no response to write to.\n }\n return true;\n })\n .client((): boolean => false);\n\n/**\n * Names what went wrong, because the page, the server log and Sentry all carry\n * this message. Every failure used to read \"Make sure VITE_STORE_DOMAIN is set\",\n * a local-development variable no deployed theme has, so a slow API looked like\n * a misconfigured theme.\n */\nfunction describeSettingsFailure(identifier: string, error: unknown): SettingsError {\n if (error instanceof SettingsError) return error;\n const request = `the settings request for store \"${identifier}\"`;\n if (isTimeoutError(error)) {\n return new SettingsError(\n `The Salla API did not answer ${request} within ${SETTINGS_TIMEOUT_MS} ms.`,\n { reason: 'timeout' }\n );\n }\n if (isHTTPError(error)) {\n const { status } = error.response;\n const said = apiErrorMessage(error.data);\n return new SettingsError(\n `The Salla API answered ${request} with HTTP ${status}${said ? `: ${said}` : ''}.`,\n { reason: isStoreNotFound(identifier, status, said) ? 'not-found' : 'http', status }\n );\n }\n if (isNetworkError(error)) {\n return new SettingsError(`The Salla API could not be reached for ${request}.`, {\n reason: 'network',\n });\n }\n const detail = error instanceof Error ? `: ${error.message}` : '';\n return new SettingsError(`The settings request for store \"${identifier}\" failed${detail}.`);\n}\n\n/**\n * The settings, or a {@link SettingsError} that says why there are none. The\n * query throws it so the root route can say why the store did not load;\n * `store.settings` keeps answering `null` for its own callers.\n */\nasync function fetchSettings(storeIdentifier?: string): Promise<StoreContext> {\n const identifier = storeIdentifier ?? resolveStoreIdentifier();\n\n if (!identifier) {\n const error = new SettingsError(\n 'No store is named for this request: add `?storeId=` on the preview host, or set VITE_STORE_DOMAIN in local development.',\n { reason: 'no-store' }\n );\n console.warn('[store.settings]', error.message);\n throw error;\n }\n\n try {\n return await requestSettings(identifier);\n } catch (cause) {\n // Asked again as a guest, once: the second time there is no token left to drop.\n if (isRevokedToken(cause) && dropRevokedToken()) return fetchSettings(identifier);\n const error = describeSettingsFailure(identifier, cause);\n console.error('[store.settings]', error.message, ...(cause === error ? [] : [cause]));\n throw error;\n }\n}\n\nexport const store = {\n settings: async (storeIdentifier?: string): Promise<StoreContext | null> => {\n try {\n return await fetchSettings(storeIdentifier);\n } catch {\n // Already logged, with the reason.\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 // Throws rather than resolving `null`, so the failure keeps its reason.\n queryFn: () => fetchSettings(storeIdentifier),\n // A null never retried, and the root route waits on this: the router's\n // default `retry: 1` would sit through the timeout twice.\n retry: 0,\n }),\n },\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/language-cookie.ts","../src/utils/native-app-headers.ts","../src/api/store.ts"],"names":["createIsomorphicFn","setCookie"],"mappings":";;;;;;;;;;AAaA,IAAM,sBAAA,GAAyB,kBAAA,EAAmB,CAC/C,MAAA,CAAO,MAAqB;AAC3B,EAAA,IAAI;AACF,IAAA,OAAO,gBAAA,CAAiB,QAAQ,CAAA,IAAK,IAAA;AAAA,EACvC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF,CAAC,CAAA,CACA,MAAA,CAAO,MAAqB,IAAI,CAAA;AAEnC,IAAM,yBAAA,GAA4B,kBAAA,EAAmB,CAClD,MAAA,CAAO,CAAC,IAAA,KAAuB;AAC9B,EAAA,IAAI;AACF,IAAA,SAAA,CAAU,sBAAsB,IAAA,EAAM;AAAA,MACpC,IAAA,EAAM,GAAA;AAAA,MACN,MAAA,EAAQ,uBAAA;AAAA,MACR,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH,CAA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AQ,uBAAA,CAAwB,UAAA,EAAY,KAAK,CAAA;AACvD,IAAA,OAAA,CAAQ,KAAA,CAAM,kBAAA,EAAoB,KAAA,CAAM,OAAA,EAAS,GAAI,KAAA,KAAU,KAAA,GAAQ,EAAC,GAAI,CAAC,KAAK,CAAE,CAAA;AACpF,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAEO,IAAM,KAAA,GAAQ;AAAA,EACnB,QAAA,EAAU,OAAO,eAAA,KAA2D;AAC1E,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,cAAc,eAAe,CAAA;AAAA,IAC5C,CAAA,CAAA,MAAQ;AAEN,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;AAAA,MAEA,OAAA,EAAS,MAAM,aAAA,CAAc,eAAe,CAAA;AAAA;AAAA;AAAA,MAG5C,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-3AEHPT4C.js","sourcesContent":["/**\n * @fileoverview Reading and writing the `s-lang` cookie, on the server and in the browser.\n *\n * The server reads it from the request the framework is handling and writes it to that\n * request's response. The server-only import is stripped from the client bundle by\n * `createIsomorphicFn`, as in `routes/root/beforeLoad.ts`. The browser uses `document.cookie`.\n * Either side outside a request (a prerender, a test) has nothing to read or write and says so\n * quietly.\n */\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getRequestHeader, getRequestUrl, setCookie } from '@tanstack/react-start/server';\nimport { LANGUAGE_COOKIE_MAX_AGE, LANGUAGE_COOKIE_NAME } from './cookies';\n\nconst readServerCookieHeader = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getRequestHeader('cookie') ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nconst writeServerLanguageCookie = createIsomorphicFn()\n .server((code: string): void => {\n try {\n setCookie(LANGUAGE_COOKIE_NAME, code, {\n path: '/',\n maxAge: LANGUAGE_COOKIE_MAX_AGE,\n sameSite: 'lax',\n });\n } catch {\n // Outside a request: there is no response to write to.\n }\n })\n .client((): void => {});\n\nconst readServerSearch = createIsomorphicFn()\n .server((): string => {\n try {\n return getRequestUrl().search;\n } catch {\n return '';\n }\n })\n .client((): string => '');\n\n/**\n * The query string of the page being rendered (`?lang=en`, or `''`): the request's on the\n * server, the address bar's in the browser, so both sides read the same one.\n */\nexport function readPageSearch(): string {\n return readServerSearch() || (typeof window !== 'undefined' ? window.location.search : '');\n}\n\n/** The `Cookie` header of the request being handled, or `document.cookie` in the browser. */\nexport function readCookieHeader(): string | null {\n return readServerCookieHeader() ?? (typeof document !== 'undefined' ? document.cookie : null);\n}\n\n/** Remembers `code` as the visitor's language for every store on this host. */\nexport function persistLanguageCookie(code: string): void {\n writeServerLanguageCookie(code);\n if (typeof document !== 'undefined') {\n document.cookie = `${LANGUAGE_COOKIE_NAME}=${encodeURIComponent(code)}; path=/; max-age=${LANGUAGE_COOKIE_MAX_AGE}; SameSite=Lax`;\n }\n}\n","/** The headers the Salla native app sends with every page it loads in its webview. */\nexport const NATIVE_APP_HEADERS = [\n 's-app-os',\n 's-app-version',\n 's-app-full-version',\n 's-app-os-version',\n];\n\n/**\n * How the app's webview names itself to the Store API. On a Twig theme Laravel hands these\n * to the SDK as request headers, which is how the API tells an app order from a website one.\n */\nexport const NATIVE_APP_REQUEST_HEADERS = ['s-source', 's-app-webview'];\n\n/**\n * The native app's own headers on this request, or null when it is not the app.\n *\n * On a Twig theme Laravel copies them into the settings' `jitsu.context.extra.headers`,\n * where the SDK reads the app's platform and version from (`salla.config.isMobileApp()`).\n * A React theme asks for its settings from the server, through the API, so the app's\n * headers never reach that call: the request is the only place they are.\n */\nexport function readNativeAppHeaders(headers: Headers): Record<string, string> | null {\n const os = headers.get('s-app-os')?.toLowerCase();\n if (os !== 'ios' && os !== 'android') return null;\n const found: Record<string, string> = {};\n for (const name of [...NATIVE_APP_HEADERS, ...NATIVE_APP_REQUEST_HEADERS]) {\n const value = headers.get(name);\n if (value) found[name] = value;\n }\n return found;\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { setCookie } from '@tanstack/react-start/server';\nimport { isHTTPError, isNetworkError, isTimeoutError } from 'ky';\nimport {\n api,\n getActiveScope,\n getAuthToken,\n rememberStoreRay,\n STORE_IDENTIFIER_HEADER,\n} from './client';\nimport { devSettingsFetchedAt } from './dev-settings-cache';\nimport { SettingsError } from '../utils/errors';\nimport type { Store, Theme, Language, JitsuConfig, MaintenanceDetails } from '../types';\nimport { getTwilightContext, revokeAuthToken } from '../twilight/context';\nimport { resolveStoreIdentifier } from '../utils/store-identity';\nimport { AUTH_TOKEN_COOKIE_NAME, extractScopeFromUrl, parseStoreId } from '../utils/cookies';\nimport { readPageSearch } from '../utils/language-cookie';\nimport { requestedThemeVersionId } from '../utils/theme-version';\nimport { NATIVE_APP_HEADERS } from '../utils/native-app-headers';\nimport { isNotLaunchedNotice } from '../utils/maintenance';\n\nexport { resolveStoreIdentifier };\n\n// `rating` and `ratings` are left out: nothing in the engine reads them, and the API builds them by\n// aggregating every testimonial of the store, which on large stores ran past SETTINGS_TIMEOUT_MS on\n// every render (TD-17779).\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 'user',\n];\n\n/** Twig's `salla.init({ user })` object; the endpoint ignores the token, so always the guest. */\nexport interface SettingsUser {\n type: 'guest' | 'user';\n id?: number | string | null;\n language_code?: string;\n currency_code?: string;\n country_code?: string;\n [key: string]: unknown;\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 user?: SettingsUser;\n jitsu?: JitsuConfig;\n maintenance?: boolean;\n maintenance_details?: MaintenanceDetails;\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 user?: SettingsUser;\n /** Where the SDK's analytics send events, and which ones; without it the SDK tracks nothing. */\n jitsu?: JitsuConfig;\n /**\n * The store is closed: by the merchant from the dashboard, by the platform, or\n * for the selected market only. The engine then renders the maintenance page\n * to everyone but the merchant; see `rootBeforeLoad`.\n */\n maintenance?: boolean;\n /** What the maintenance page says; sent beside `maintenance`. */\n maintenance_details?: MaintenanceDetails;\n /**\n * `false` while the store has not launched yet: `maintenance` is then `true` and the\n * engine's maintenance page says the store is launching soon. Absent otherwise. Not\n * from the API: read off `maintenance_details` by `store.settings`, since the\n * backend sends the merchant's \"finish launching\" notice there for every visitor,\n * which is not for a customer's eyes.\n */\n launched?: false;\n /**\n * The scope these settings were requested with; absent when none was. Not from\n * the API: stamped by `store.settings`, so `resolveThemeVersionId` can tell\n * whether the version they name still answers the scope that is active now.\n */\n requestedScopeId?: string;\n /** Which answer of the API these settings are; see {@link SettingsAnswer}. */\n answer?: SettingsAnswer;\n /**\n * When the dev server fetched these settings from the API (epoch ms). It reuses\n * them for a while (see `dev-settings-cache.ts`) and the theme editor says how old\n * they are. Only on a dev server render; absent everywhere else.\n */\n devFetchedAt?: number;\n}\n\n/**\n * Which answer of the settings API a set of settings came from, read off the\n * response rather than the body: the API's request id, the Store's trace, and\n * whether Cloudflare served it from its cache and how old it was. A decision the\n * settings drive for every visitor alike (the maintenance page) can then be\n * traced to the exact request the backend logged, or to a cached copy of it.\n */\nexport interface SettingsAnswer {\n requestId?: string;\n traceId?: string;\n cacheStatus?: string;\n age?: string;\n}\n\nconst ANSWER_HEADERS: Record<keyof SettingsAnswer, string> = {\n requestId: 's-request-id',\n traceId: 'x-trace-id',\n cacheStatus: 'cf-cache-status',\n age: 'age',\n};\n\nfunction settingsAnswerOf(headers: Headers | undefined): SettingsAnswer | undefined {\n if (!headers) return undefined;\n const answer: SettingsAnswer = {};\n for (const [field, name] of Object.entries(ANSWER_HEADERS) as [keyof SettingsAnswer, string][]) {\n const value = headers.get(name);\n if (value) answer[field] = value;\n }\n return Object.keys(answer).length ? answer : undefined;\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\n/**\n * The settings' analytics context with the native app's headers in it, as Laravel\n * writes it for a Twig theme: the SDK reads the app's platform and version from there.\n * The API answers a server-side call with the engine's own headers, never the app's.\n */\nfunction withNativeAppHeaders(jitsu?: JitsuConfig): JitsuConfig | undefined {\n const appHeaders = requestNativeAppHeaders();\n if (!jitsu || !appHeaders) return jitsu;\n const extra = jitsu.context?.extra;\n // The engine's own app headers go, so an app that sends no version doesn't get the engine's.\n const headers = { ...extra?.headers };\n for (const name of NATIVE_APP_HEADERS) {\n delete headers[name];\n if (appHeaders[name]) headers[name] = appHeaders[name];\n }\n return {\n ...jitsu,\n context: {\n ...jitsu.context,\n extra: { ...extra, headers },\n },\n };\n}\n\n/** The app's headers on the request being rendered; null in the browser and outside the app. */\nfunction requestNativeAppHeaders(): Record<string, string> | null {\n if (typeof window !== 'undefined') return null;\n try {\n return getTwilightContext().nativeAppHeaders;\n } catch {\n return null;\n }\n}\n\n/**\n * The settings' request headers with the app's `s-source` and `s-app-webview` in them, as\n * Laravel adds them for a Twig theme: the SDK copies `headers` onto every call it makes.\n *\n * Both or neither. `s-source: mobile` without `s-app-webview` is the native app itself to\n * the API, which then answers a guest's `cart/latest` with a new cart every time.\n */\nfunction withNativeAppRequestHeaders(\n headers?: Record<string, unknown>\n): Record<string, unknown> | undefined {\n const appHeaders = requestNativeAppHeaders();\n if (appHeaders?.['s-source'] !== 'mobile' || !appHeaders['s-app-webview']) return headers;\n return { ...headers, 's-source': 'mobile', 's-app-webview': appHeaders['s-app-webview'] };\n}\n\nconst SETTINGS_TIMEOUT_MS = 5000;\n\n/**\n * Whether the page's own address switches market (`?scope=`).\n *\n * Only then does the settings request name the scope in its query string. The API\n * reads `?scope=` as a switch and lets it override the market a market's own domain\n * is pinned to, which the `s-scope-id` header never does. Sent on every request, a\n * market remembered from another visit would win over the host the shopper is on: the\n * settings, and the SDK seeded from them, would answer for that market while every\n * call without the parameter (the cart, among them) answers for the host's, and a\n * guest's cart created in one is refused by the other (TD-17588).\n */\nfunction pageSwitchesScope(): boolean {\n return extractScopeFromUrl(`http://page.invalid/${readPageSearch()}`) !== null;\n}\n\nasync function requestSettings(identifier: string): Promise<StoreContext> {\n const includeParams = DEFAULT_INCLUDE_ITEMS.map((i) => `include[]=${i}`).join('&');\n const scope = getActiveScope();\n const params =\n scope != null && pageSwitchesScope() ? `${includeParams}&scope=${scope.id}` : includeParams;\n\n const request = 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: SETTINGS_TIMEOUT_MS,\n headers: { [STORE_IDENTIFIER_HEADER]: identifier },\n });\n const json = await request.json<{ data?: SettingsApiResponse }>();\n // The same response, already settled; only its headers are read.\n const headers = (await request)?.headers;\n const answer = settingsAnswerOf(headers);\n const devFetchedAt = devSettingsFetchedAt(headers);\n\n const data = json?.data;\n if (!data) {\n throw new SettingsError(\n `The Salla API answered the settings request for store \"${identifier}\" without settings.`,\n { reason: 'empty' }\n );\n }\n\n rememberStoreRay(identifier, data.headers);\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: withNativeAppRequestHeaders(data.headers),\n login: data.login,\n affiliate: data.affiliate,\n policy_url: data.policy_url,\n user: data.user,\n jitsu: withNativeAppHeaders(data.jitsu),\n maintenance: data.maintenance,\n maintenance_details: data.maintenance_details,\n ...(data.maintenance === true &&\n isNotLaunchedNotice(data.maintenance_details) && { launched: false as const }),\n ...(scope && { requestedScopeId: scope.id }),\n ...(answer && { answer }),\n ...(devFetchedAt && { devFetchedAt }),\n };\n}\n\n/** The message the API put in an error body, `{ error: { message } }`, when it sent one. */\nfunction apiErrorMessage(data: unknown): string | undefined {\n const message = (data as { error?: { message?: unknown } } | undefined)?.error?.message;\n return typeof message === 'string' && message.length > 0 && message.length <= 200\n ? message\n : undefined;\n}\n\n/**\n * What core's `CurrentStoreMiddleware` answers, with a 422, when no store has the\n * username or domain it was given (or the store's status is `deleted`). The lookup is\n * `loadUseUsernameOrDomain`, the same one Twig's `checkUsername` turns into its 410.\n * The literal is not translated: it reads the same whatever language was asked for.\n */\nconst STORE_NOT_FOUND_MESSAGE = 'المتجر غير موجود';\n\n/**\n * Whether the API answered that no store has this identifier. A numeric identifier\n * is looked up with `findOrFail`, which Store's exception handler answers with a 410;\n * a username or domain gets {@link STORE_NOT_FOUND_MESSAGE}. A 410 for a username is\n * not read as one: nothing on that path answers it, and a store that does exist must\n * never be told it does not.\n */\nfunction isStoreNotFound(identifier: string, status: number, said: string | undefined): boolean {\n if (status === 410) return parseStoreId(identifier) !== null;\n return status === 422 && said === STORE_NOT_FOUND_MESSAGE;\n}\n\n/**\n * Whether the API answered that the token was signed out of all devices. `unauthorized`\n * alone: `token_invalid` is refreshed by the SDK, and a limited token (a review link)\n * gets `policy_token_not_allowed` so that its customer stays signed in.\n */\nfunction isRevokedToken(error: unknown): boolean {\n if (!isHTTPError(error) || error.response.status !== 401) return false;\n return (error.data as { error?: { code?: unknown } } | undefined)?.error?.code === 'unauthorized';\n}\n\n/**\n * Drops a token the API answered as signed out everywhere (401 `unauthorized`), for the\n * rest of this server render and from the visitor's cookie. Without it the render stopped\n * at \"Store Unavailable\" and every reload sent the same token again; the SDK, which signs\n * the customer out on that answer, never loaded to do it.\n *\n * Answers whether there was a token to drop, so the caller knows a retry can differ.\n */\nconst dropRevokedToken = createIsomorphicFn()\n .server((): boolean => {\n // An uncompiled build runs this branch in the browser too; the SDK signs out there.\n if (typeof document !== 'undefined' || !getAuthToken()) return false;\n revokeAuthToken();\n try {\n setCookie(AUTH_TOKEN_COOKIE_NAME, '', { path: '/', maxAge: 0 });\n } catch {\n // Outside a request (prerender): there is no response to write to.\n }\n return true;\n })\n .client((): boolean => false);\n\n/**\n * Names what went wrong, because the page, the server log and Sentry all carry\n * this message. Every failure used to read \"Make sure VITE_STORE_DOMAIN is set\",\n * a local-development variable no deployed theme has, so a slow API looked like\n * a misconfigured theme.\n */\nfunction describeSettingsFailure(identifier: string, error: unknown): SettingsError {\n if (error instanceof SettingsError) return error;\n const request = `the settings request for store \"${identifier}\"`;\n if (isTimeoutError(error)) {\n return new SettingsError(\n `The Salla API did not answer ${request} within ${SETTINGS_TIMEOUT_MS} ms.`,\n { reason: 'timeout' }\n );\n }\n if (isHTTPError(error)) {\n const { status } = error.response;\n const said = apiErrorMessage(error.data);\n return new SettingsError(\n `The Salla API answered ${request} with HTTP ${status}${said ? `: ${said}` : ''}.`,\n { reason: isStoreNotFound(identifier, status, said) ? 'not-found' : 'http', status }\n );\n }\n if (isNetworkError(error)) {\n return new SettingsError(`The Salla API could not be reached for ${request}.`, {\n reason: 'network',\n });\n }\n const detail = error instanceof Error ? `: ${error.message}` : '';\n return new SettingsError(`The settings request for store \"${identifier}\" failed${detail}.`);\n}\n\n/**\n * The settings, or a {@link SettingsError} that says why there are none. The\n * query throws it so the root route can say why the store did not load;\n * `store.settings` keeps answering `null` for its own callers.\n */\nasync function fetchSettings(storeIdentifier?: string): Promise<StoreContext> {\n const identifier = storeIdentifier ?? resolveStoreIdentifier();\n\n if (!identifier) {\n const error = new SettingsError(\n 'No store is named for this request: add `?storeId=` on the preview host, or set VITE_STORE_DOMAIN in local development.',\n { reason: 'no-store' }\n );\n console.warn('[store.settings]', error.message);\n throw error;\n }\n\n try {\n return await requestSettings(identifier);\n } catch (cause) {\n // Asked again as a guest, once: the second time there is no token left to drop.\n if (isRevokedToken(cause) && dropRevokedToken()) return fetchSettings(identifier);\n const error = describeSettingsFailure(identifier, cause);\n console.error('[store.settings]', error.message, ...(cause === error ? [] : [cause]));\n throw error;\n }\n}\n\nexport const store = {\n settings: async (storeIdentifier?: string): Promise<StoreContext | null> => {\n try {\n return await fetchSettings(storeIdentifier);\n } catch {\n // Already logged, with the reason.\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 // Throws rather than resolving `null`, so the failure keeps its reason.\n queryFn: () => fetchSettings(storeIdentifier),\n // A null never retried, and the root route waits on this: the router's\n // default `retry: 1` would sit through the timeout twice.\n retry: 0,\n }),\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useOpeningHours } from './chunk-
|
|
2
|
-
import { useIsProduct } from './chunk-
|
|
1
|
+
import { useOpeningHours } from './chunk-MRBNEIHQ.js';
|
|
2
|
+
import { useIsProduct } from './chunk-JK2FVL6U.js';
|
|
3
3
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
4
4
|
import { useTwilight } from './chunk-3VFOVWOE.js';
|
|
5
5
|
import { useState } from 'react';
|
|
@@ -54,5 +54,5 @@ function StoreClosedNotification(_props) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export { StoreClosedNotification };
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-3ZUWSJVH.js.map
|
|
58
|
+
//# sourceMappingURL=chunk-3ZUWSJVH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/store/StoreClosedNotification.tsx"],"names":[],"mappings":";;;;;;;AAsBO,SAAS,wBAAwB,MAAA,EAAsC;AAC5E,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,QAAQ,SAAA,EAAW,iBAAA,KAAsB,eAAA,CAAgB,KAAA,CAAM,UAAU,aAAa,CAAA;AAC9F,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAG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AAU;AAAA,OACZ;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,IAAA,EAAK,GAAA;AAAA,YACL,EAAA,EAAG,cAAA;AAAA,YACH,OAAA,EAAS,WAAA;AAAA,YACT,KAAA,EAAO,EAAE,QAAA,EAAU,UAAA,EAAY,MAAM,EAAA,EAAI,KAAA,EAAO,MAAA,EAAQ,cAAA,EAAgB,MAAA,EAAO;AAAA,YAE/E,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,cAAA,EAAe;AAAA;AAAA,SAC9B;AAAA,wBACA,GAAA,CAAC,GAAA,EAAA,EAAE,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAA,EAAG,SAAA,EAAW,QAAA,EAAU,IAAA,EAAM,CAAA,EAAE,EACjD,QAAA,EAAA,CAAA,CAAE,2BAAA,EAA6B;AAAA,UAC9B,YAAA,EAAc,qPAAkD,iBAAiB,CAAA,CAAA,CAAA;AAAA,UACjF,QAAA,EAAU;AAAA,SACX,CAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-3ZUWSJVH.js","sourcesContent":["import { useState } from 'react';\nimport { useIsProduct } from '../../providers/NavigationProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useOpeningHours } from '../../hooks/useOpeningHours';\nimport { useTranslation } from '../../providers/I18nProvider';\n\nexport interface StoreClosedNotificationProps {\n /** Whether to show the notification (defaults to true when store is closed on product page) */\n show?: boolean;\n}\n\n/**\n * StoreClosedNotification - Shows a notification bar when the store is closed.\n *\n * Mirrors PHP ReceivingOrdersTimesWidget:\n * - Only shows on product pages\n * - Only shows when store is closed for receiving orders\n * - Displays when the store will open next\n * - Has a close button to dismiss\n *\n * Injected via hook registry at body:start.\n */\nexport function StoreClosedNotification(_props: StoreClosedNotificationProps) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const { isOpen, isEnabled, nextOpenFormatted } = useOpeningHours(store.settings?.opening_hours);\n const [dismissed, setDismissed] = useState(false);\n\n // Check if we're on a product page\n const isProductPage = useIsProduct();\n\n // Conditions: product page, opening hours enabled, store closed, not dismissed\n if (!isProductPage || !isEnabled || isOpen || dismissed || !nextOpenFormatted) {\n return null;\n }\n\n const handleClose = (e: React.MouseEvent) => {\n e.preventDefault();\n setDismissed(true);\n };\n\n return (\n <div\n className=\"store-notify\"\n id=\"store-closed-notification\"\n data-testid=\"store-closed-notification\"\n style={{\n backgroundColor: '#d63031',\n color: '#fff',\n padding: '10px 15px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <a\n href=\"#\"\n id=\"notify-close\"\n onClick={handleClose}\n style={{ position: 'absolute', left: 15, color: '#fff', textDecoration: 'none' }}\n >\n <i className=\"sicon-cancel\" />\n </a>\n <p style={{ margin: 0, textAlign: 'center', flex: 1 }}>\n {t('store.closed_notification', {\n defaultValue: `المتجر حاليا مغلق لاستقبال الطلبات وسيتم فتحه (${nextOpenFormatted})`,\n nextOpen: nextOpenFormatted,\n })}\n </p>\n </div>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { orThrow } from './chunk-
|
|
2
|
-
import { api } from './chunk-
|
|
1
|
+
import { orThrow } from './chunk-JK2FVL6U.js';
|
|
2
|
+
import { api } from './chunk-LNJUQ2S6.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var brand = {
|
|
@@ -25,5 +25,5 @@ var brand = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export { brand };
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-467XYJGK.js.map
|
|
29
|
+
//# sourceMappingURL=chunk-467XYJGK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/brands.ts"],"names":[],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D,IAAA,MAAM,EAAE,IAAA,EAAM,MAAA,EAAO,GAAI,MAAM,GAAA,CAC5B,GAAA,CAAI,IAAA,GAAO,CAAA,YAAA,EAAe,IAAI,CAAA,CAAA,GAAK,QAAQ,EAC3C,IAAA,EAAoD;AACvD,IAAA,OAAO,EAAE,OAAO,IAAA,IAAQ,IAAI,IAAA,EAAM,MAAA,EAAQ,QAAQ,IAAA,EAAK;AAAA,EACzD,CAAA;AAAA,EAEA,IAAA,EAAM,OAAO,EAAA,KAA+B;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,OAAA,EAAU,EAAE,CAAA,CAAE,CAAA,CAAE,IAAA,EAAsB;AACrE,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,EAAA,KAA+B,QAAQ,KAAA,CAAM,IAAA,CAAK,EAAE,CAAC,CAAA;AAAA,EAEnE,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,CAAC,IAAA,KACL,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,QAAA,EAAU,MAAA,EAAQ,QAAQ,CAAC,CAAA;AAAA,MACtC,OAAA,EAAS,MAAM,KAAA,CAAM,IAAA,CAAK,IAAI;AAAA,KAC/B,CAAA;AAAA,IACH,MAAA,EAAQ,CAAC,EAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,QAAA,EAAU,QAAA,EAAU,EAAE,CAAA;AAAA,MACjC,OAAA,EAAS,MAAM,KAAA,CAAM,IAAA,CAAK,EAAE;AAAA,KAC7B;AAAA;AAEP","file":"chunk-467XYJGK.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Brand } from '../routes/brands/types';\nimport type { PaginatedResult, Pagination } from './types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const brand = {\n list: async (page?: number): Promise<PaginatedResult<Brand>> => {\n const { data, cursor } = await api\n .get(page ? `brands?page=${page}` : 'brands')\n .json<{ data: Brand[] | null; cursor?: Pagination }>();\n return { items: data ?? [], next: cursor?.next ?? null };\n },\n\n find: async (id: string): Promise<Brand> => {\n const { data } = await api.get(`brands/${id}`).json<{ data: Brand }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Brand> => orThrow(brand.find(id)),\n\n queries: {\n list: (page?: number) =>\n queryOptions({\n queryKey: ['brands', 'list', page ?? 1],\n queryFn: () => brand.list(page),\n }),\n detail: (id: string) =>\n queryOptions({\n queryKey: ['brands', 'detail', id],\n queryFn: () => brand.find(id),\n }),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api } from './chunk-
|
|
1
|
+
import { api } from './chunk-LNJUQ2S6.js';
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
var notification = {
|
|
@@ -24,5 +24,5 @@ var notification = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export { notification };
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-77EKLFWG.js.map
|
|
28
|
+
//# sourceMappingURL=chunk-77EKLFWG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/notification.ts"],"names":[],"mappings":";;;AAcO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAM,YAAgD;AACpD,IAAA,MAAM,WAAW,MAAM,GAAA,CACpB,GAAA,CAAI,eAAe,EACnB,IAAA,EAAmF;AACtF,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,QAAA,CAAS,IAAA,IAAQ,EAAC;AAAA,MACxB,QAAQ,QAAA,CAAS;AAAA,KACnB;AAAA,EACF,CAAA;AAAA,EAEA,UAAA,EAAY,OAAO,EAAA,KAA8B;AAC/C,IAAA,MAAM,IAAI,GAAA,CAAI,CAAA,cAAA,EAAiB,EAAE,CAAA,KAAA,CAAO,EAAE,IAAA,EAAK;AAAA,EACjD,CAAA;AAAA,EAEA,eAAe,YAA2B;AACxC,IAAA,MAAM,GAAA,CAAI,GAAA,CAAI,wBAAwB,CAAA,CAAE,IAAA,EAAK;AAAA,EAC/C,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,eAAA,EAAiB,MAAM,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,YAAA,CAAa,IAAA;AAAK,KAClC;AAAA;AAEP","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/api/notification.ts"],"names":[],"mappings":";;;AAcO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAM,YAAgD;AACpD,IAAA,MAAM,WAAW,MAAM,GAAA,CACpB,GAAA,CAAI,eAAe,EACnB,IAAA,EAAmF;AACtF,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,QAAA,CAAS,IAAA,IAAQ,EAAC;AAAA,MACxB,QAAQ,QAAA,CAAS;AAAA,KACnB;AAAA,EACF,CAAA;AAAA,EAEA,UAAA,EAAY,OAAO,EAAA,KAA8B;AAC/C,IAAA,MAAM,IAAI,GAAA,CAAI,CAAA,cAAA,EAAiB,EAAE,CAAA,KAAA,CAAO,EAAE,IAAA,EAAK;AAAA,EACjD,CAAA;AAAA,EAEA,eAAe,YAA2B;AACxC,IAAA,MAAM,GAAA,CAAI,GAAA,CAAI,wBAAwB,CAAA,CAAE,IAAA,EAAK;AAAA,EAC/C,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,eAAA,EAAiB,MAAM,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,YAAA,CAAa,IAAA;AAAK,KAClC;AAAA;AAEP","file":"chunk-77EKLFWG.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Notification } from '../routes/account/notifications/types';\n\nexport interface NotificationsListResponse {\n data: Notification[];\n cursor: {\n current: number;\n previous: number | null;\n next: number | null;\n count: number;\n };\n}\n\nexport const notification = {\n list: async (): Promise<NotificationsListResponse> => {\n const response = await api\n .get('notifications')\n .json<{ data: Notification[] | null; cursor: NotificationsListResponse['cursor'] }>();\n return {\n data: response.data ?? [],\n cursor: response.cursor,\n };\n },\n\n markAsRead: async (id: number): Promise<void> => {\n await api.put(`notifications/${id}/read`).json();\n },\n\n markAllAsRead: async (): Promise<void> => {\n await api.put('notifications/read-all').json();\n },\n\n queries: {\n list: () =>\n queryOptions({\n queryKey: ['notifications', 'list'],\n queryFn: () => notification.list(),\n }),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api } from './chunk-
|
|
1
|
+
import { api } from './chunk-LNJUQ2S6.js';
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
var apps = {
|
|
@@ -40,5 +40,5 @@ var apps = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export { apps };
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-7R4SNM3G.js.map
|
|
44
|
+
//# sourceMappingURL=chunk-7R4SNM3G.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/apps.ts"],"names":[],"mappings":";;;AAmCO,IAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,UAAU,YAAmC;AAC3C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,eAAA,EAAiB,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CACtC,IAAA,EAA8B;AACjC,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,YAAkC;AAC1C,I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AA,CAC/C,IAAA,EAAsC;AACzC,IAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,IAAQ,EAAC,EAAE;AAAA,EAClC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA;AAAA;AAAA;AAAA,MAIX,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,IAEH,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA,MACX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-7R4SNM3G.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\n\nexport interface AppSnippetRow {\n place: string;\n content: string;\n url?: string | null;\n /**\n * Raw snippet id, emitted as `data-snippet-id`. Present only on CDN rows — the\n * inline branch of the backend's snippet parser omits the key entirely.\n */\n id?: number;\n /** `{{customer.x}}` placeholders in `content` to substitute from SDK config `user.*` keys. */\n customer_parameters?: string[];\n}\n\nexport interface AppSnippet {\n service: string;\n app_id: string;\n /** Encoded app id (`getRouteKey()`): the scope id its snippets bind to via `data-scope-id`,\n * and its settings-bucket key. Absent on payloads predating the settings API. */\n id?: string;\n app_slug: string;\n status: string;\n snippets: AppSnippetRow[];\n}\n\n/**\n * Per-app public `app.*` buckets for CDN snippets, keyed by encoded app id (== `AppSnippet.id`,\n * the `Salla.appScope` scope id). One isolated bucket per app; reads within a scope are bare `app.*`.\n */\nexport interface AppSettings {\n apps: Record<string, Record<string, unknown>>;\n}\n\nexport const apps = {\n /**\n * Installed apps' snippets (scripts/HTML to inject). Timeout-bounded because it's awaited in\n * rootBeforeLoad (SSR/TTFB): a slow response degrades to no CDN tags, never stalls the page.\n */\n snippets: async (): Promise<AppSnippet[]> => {\n const { data } = await api\n .get('apps/snippets', { timeout: 2500 })\n .json<{ data?: AppSnippet[] }>();\n return data ?? [];\n },\n\n /**\n * Per-app public `app.*` buckets, keyed by encoded app id. Timeout-bounded (SSR-awaited):\n * a slow response degrades to empty buckets (fail-open), never strands injection.\n */\n settings: async (): Promise<AppSettings> => {\n const { data } = await api\n .get('apps/snippets/settings', { timeout: 2500 })\n .json<{ data?: Partial<AppSettings> }>();\n return { apps: data?.apps ?? {} };\n },\n\n queries: {\n snippets: () =>\n queryOptions({\n queryKey: ['apps', 'snippets'],\n queryFn: () => apps.snippets(),\n // Snippets are static per session; one fetch per page load is enough.\n staleTime: Infinity,\n // No retry: this is awaited in rootBeforeLoad, so the router's default `retry: 1` would\n // make the SSR wait 2 x the 2500ms timeout (plus backoff) before failing open. The\n // 2500ms timeout must be the whole budget; the client fallback query does the retrying.\n retry: 0,\n }),\n\n settings: () =>\n queryOptions({\n queryKey: ['apps', 'settings'],\n queryFn: () => apps.settings(),\n // Encoded app ids and their buckets are stable per page; one fetch is enough.\n staleTime: Infinity,\n retry: 0,\n }),\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GTM_PAGE_DATA_WAIT_MS, whenGtmPageData } from './chunk-
|
|
2
|
-
import { DATA_LAYER_PROXY_SCRIPT } from './chunk-
|
|
1
|
+
import { GTM_PAGE_DATA_WAIT_MS, whenGtmPageData } from './chunk-ZE2L2PAA.js';
|
|
2
|
+
import { DATA_LAYER_PROXY_SCRIPT } from './chunk-YKP4BFVK.js';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
function containerScript(gtmId) {
|
|
@@ -63,5 +63,5 @@ function GoogleTagBody({ gtmIds }) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export { GTM_LOAD_DELAY_MS, GoogleTagBody };
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-A764QYEF.js.map
|
|
67
|
+
//# sourceMappingURL=chunk-A764QYEF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tracking/GoogleTag.tsx"],"names":[],"mappings":";;;;AAUA,SAAS,gBAAgB,KAAA,EAAuB;AAC9C,EAAA,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA,wCAAA,EAIiC,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA,EAAA,CAAA;AAC/D;AAGA,SAAS,UAAU,MAAA,EAAmC;AACpD,EAAA,OAAO,CAAC,yBAAyB,GAAG,MAAA,CAAO,IAAI,eAAe,CAAC,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA;AAC5E;AAEA,IAAM,qBAAqB,CAAC,aAAA,EAAe,SAAA,EAAW,YAAA,EAAc,UAAU,OAAO,CAAA;AAG9E,IAAM,iBAAA,GAAoB;AAGjC,SAAS,aAAa,MAAA,EAAiD;AACrE,EAAA,OAAO,CAAC,GAAG,IAAI,GAAA,CAAA,CAAK,MAAA,IAAU,EAAC,EAAG,GAAA,CAAI,CAAC,EAAA,KAAO,IAAI,IAAA,EAAM,EAAE,MAAA,CAAO,OAAO,CAAC,CAAC,CAAA;AAC5E;AAMO,SAAS,aAAA,CAAc,EAAE,MAAA,EAAO,EAA6B;AAClE,EAAA,MAAM,GAAA,GAAM,aAAa,MAAM,CAAA;AAC/B,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,IAAA,CAAK,GAAG,CAAA;AAE3B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,aAAa,MAAA,GAAS,MAAA,CAAO,KAAA,CAAM,GAAG,IAAI,EAAC;AACjD,IAAA,IAAI,CAAC,WAAW,MAAA,EAAQ;AAExB,I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,CAAmB,OAAA;AAAA,MAAQ,CAAC,IAAA,KAC1B,MAAA,CAAO,gBAAA,CAAiB,IAAA,EAAM,MAAA,EAAQ,EAAE,IAAA,EAAM,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM;AAAA,KACrE;AACA,IAAA,IAAI,QAAA,CAAS,UAAA,KAAe,UAAA,EAAY,MAAA,EAAO;AAAA,gBACnC,gBAAA,CAAiB,MAAA,EAAQ,QAAQ,EAAE,IAAA,EAAM,MAAM,CAAA;AAE3D,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,IAAA;AACZ,MAAA,WAAA,EAAY;AACZ,MAAA,MAAA,CAAO,aAAa,aAAa,CAAA;AACjC,MAAA,QAAA,CAAS,cAAA,CAAe,YAAY,CAAA,EAAG,MAAA,EAAO;AAAA,IAChD,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,OAAO,IAAA;AACT","file":"chunk-A764QYEF.js","sourcesContent":["import { useEffect } from 'react';\nimport { DATA_LAYER_PROXY_SCRIPT } from '../../lib/analytics/gtm';\nimport { GTM_PAGE_DATA_WAIT_MS, whenGtmPageData } from '../../lib/analytics/gtm-page';\n\nexport interface GoogleTagBodyProps {\n /** GTM container IDs; every one is loaded, as on Twig. Empty or missing renders nothing. */\n gtmIds?: string[];\n}\n\n/** One container's loader, Google's snippet. */\nfunction containerScript(gtmId: string): string {\n return `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\nnew Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\nj=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n})(window,document,'script','dataLayer',${JSON.stringify(gtmId)});`;\n}\n\n/** Every container, in the settings' order: Salla's first, then the merchant's own. */\nfunction gtmScript(gtmIds: readonly string[]): string {\n return [DATA_LAYER_PROXY_SCRIPT, ...gtmIds.map(containerScript)].join('\\n');\n}\n\nconst INTERACTION_EVENTS = ['pointerdown', 'keydown', 'touchstart', 'scroll', 'wheel'] as const;\n\n/** How long after `load` GTM waits for a visitor who never interacts. */\nexport const GTM_LOAD_DELAY_MS = 4000;\n\n/** Distinct container ids, in order. */\nfunction containerIds(gtmIds: readonly string[] | undefined): string[] {\n return [...new Set((gtmIds ?? []).map((id) => id?.trim()).filter(Boolean))];\n}\n\n/**\n * Injects GTM on the first interaction or GTM_LOAD_DELAY_MS after `load`, off the page's load\n * path, once the first page's data is in the data layer (at most GTM_PAGE_DATA_WAIT_MS later).\n */\nexport function GoogleTagBody({ gtmIds }: GoogleTagBodyProps): null {\n const ids = containerIds(gtmIds);\n const idsKey = ids.join(',');\n\n useEffect(() => {\n const containers = idsKey ? idsKey.split(',') : [];\n if (!containers.length) return;\n\n let timer: number | undefined;\n let pageDataTimer: number | undefined;\n let cancelled = false;\n const stopWaiting = () => {\n window.clearTimeout(timer);\n window.removeEventListener('load', onLoad);\n INTERACTION_EVENTS.forEach((type) => window.removeEventListener(type, inject));\n };\n function append() {\n window.clearTimeout(pageDataTimer);\n if (cancelled || document.getElementById('gtm-script')) return;\n const script = document.createElement('script');\n script.id = 'gtm-script';\n script.textContent = gtmScript(containers);\n document.head.appendChild(script);\n }\n function inject() {\n stopWaiting();\n // A container's tags read the page's data when `gtm.js` fires, as on Twig.\n pageDataTimer = window.setTimeout(append, GTM_PAGE_DATA_WAIT_MS);\n void whenGtmPageData().then(append);\n }\n function onLoad() {\n timer = window.setTimeout(inject, GTM_LOAD_DELAY_MS);\n }\n\n INTERACTION_EVENTS.forEach((type) =>\n window.addEventListener(type, inject, { once: true, passive: true })\n );\n if (document.readyState === 'complete') onLoad();\n else window.addEventListener('load', onLoad, { once: true });\n\n return () => {\n cancelled = true;\n stopWaiting();\n window.clearTimeout(pageDataTimer);\n document.getElementById('gtm-script')?.remove();\n };\n }, [idsKey]);\n\n return null;\n}\n"]}
|
|
@@ -12,10 +12,10 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
12
12
|
|
|
13
13
|
// src/components/product/lazy.ts
|
|
14
14
|
var LazyProductDetails = lazyComponent(
|
|
15
|
-
() => import('./ProductDetails-
|
|
15
|
+
() => import('./ProductDetails-YD45MKRJ.js').then((m) => ({ default: m.ProductDetails }))
|
|
16
16
|
);
|
|
17
17
|
var LazyAddToCartForm = lazyComponent(
|
|
18
|
-
() => import('./AddToCartForm-
|
|
18
|
+
() => import('./AddToCartForm-6FMKWZ6T.js').then((m) => ({ default: m.AddToCartForm }))
|
|
19
19
|
);
|
|
20
20
|
var PRODUCT_GALLERY_KEY = "product:gallery";
|
|
21
21
|
function legacyGalleryMedia(images) {
|
|
@@ -204,5 +204,5 @@ function ThumbSlide({ image, index }) {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
export { LazyAddToCartForm, LazyProductDetails, ProductGallery };
|
|
207
|
-
//# sourceMappingURL=chunk-
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
207
|
+
//# sourceMappingURL=chunk-BEQBNADR.js.map
|
|
208
|
+
//# sourceMappingURL=chunk-BEQBNADR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/product/lazy.ts","../src/components/product/ProductGallery.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,aAAA;AAAA,EAAc,MAC9C,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE;AAEO,IAAM,iBAAA,GAAoB,aAAA;AAAA,EAAc,MAC7C,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE;ACGA,IAAM,mBAAA,GAAsB,iBAAA;AAc5B,SAAS,mBAAmB,MAAA,EAAwC;AA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,CAAA;AAAA,UAClB,SAAA,EAAS;AAAA;AAAA;AACX;AAAA,GACF;AAEJ","file":"chunk-IZHE3Y4T.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\nexport const LazyProductDetails = lazyComponent(() =>\n import('./ProductDetails').then((m) => ({ default: m.ProductDetails }))\n);\n\nexport const LazyAddToCartForm = lazyComponent(() =>\n import('./AddToCartForm').then((m) => ({ default: m.AddToCartForm }))\n);\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';\nimport { isNativeApp } from '../../native-app';\nimport { useRenderProbe } from '../../utils/render-probe';\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\n/**\n * The engine's own `mobile::gallery.open` payload from before `salla.mobile.openGallery`: a video's\n * link and a 3D model's file go in `url`, with no ids. Sent when the SDK has no `openGallery`\n * (Twilight before 2.14.569) or declines inside the app, so those stores keep the gallery they had.\n */\nfunction legacyGalleryMedia(images: ProductImage[]): GalleryMedia[] {\n return 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}\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 openNativeGallery = (selected: ProductImage) => {\n if (!isNativeApp()) return false;\n if (window.salla?.mobile?.openGallery?.(images, selected)) return true;\n window.salla?.event.dispatch('mobile::gallery.open', { images: legacyGalleryMedia(images) });\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 useRenderProbe('ProductGallery');\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: (image: ProductImage) => 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(image)}\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(image)) {\n event.preventDefault();\n return;\n }\n if (isVideo || !image.url) return;\n event.preventDefault();\n onPreview({ src: image.url, alt: image.alt || product.name });\n }}\n aria-label={product.name}\n className={`swiper-slide magnify-wrapper homeslider__slide ${image.video_url ? 'video-entry' : ''}`}\n >\n <div className={`w-full ${loaded ? '' : 'aspect-square bg-gray-100 animate-pulse'}`}>\n <Image\n id={String(image.id)}\n src={image.url}\n alt={image.alt || product.name}\n className={`h-full w-full object-${objectFit}`}\n aspectRatio=\"1/1\"\n priority={index === 0}\n noWrapper\n onLoad={() => setLoaded(true)}\n />\n </div>\n </a>\n );\n}\n\nfunction ThumbSlide({ image, index }: { image: ProductImage; index: number }) {\n return (\n <div\n className={`slide--one-fourth ${image.video_url ? 'video-entry' : ''} ${image.three_d_image_url ? 'model-entry' : ''}`}\n data-caption={image.alt}\n >\n <Image\n src={image.url}\n alt={image.alt || ''}\n className=\"object-cover w-full h-full bg-gray-100 rounded-md overflow-hidden\"\n title={image.alt}\n priority={index < 5}\n noWrapper\n />\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/product/lazy.ts","../src/components/product/ProductGallery.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,aAAA;AAAA,EAAc,MAC9C,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE;AAEO,IAAM,iBAAA,GAAoB,aAAA;AAAA,EAAc,MAC7C,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE;ACGA,IAAM,mBAAA,GAAsB,iBAAA;AAc5B,SAAS,mBAAmB,MAAA,EAAwC;AAClE,EA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;AAAA,UAClB,SAAA,EAAS;AAAA;AAAA;AACX;AAAA,GACF;AAEJ","file":"chunk-BEQBNADR.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\nexport const LazyProductDetails = lazyComponent(() =>\n import('./ProductDetails').then((m) => ({ default: m.ProductDetails }))\n);\n\nexport const LazyAddToCartForm = lazyComponent(() =>\n import('./AddToCartForm').then((m) => ({ default: m.AddToCartForm }))\n);\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';\nimport { isNativeApp } from '../../native-app';\nimport { useRenderProbe } from '../../utils/render-probe';\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\n/**\n * The engine's own `mobile::gallery.open` payload from before `salla.mobile.openGallery`: a video's\n * link and a 3D model's file go in `url`, with no ids. Sent when the SDK has no `openGallery`\n * (Twilight before 2.14.569) or declines inside the app, so those stores keep the gallery they had.\n */\nfunction legacyGalleryMedia(images: ProductImage[]): GalleryMedia[] {\n return 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}\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 openNativeGallery = (selected: ProductImage) => {\n if (!isNativeApp()) return false;\n if (window.salla?.mobile?.openGallery?.(images, selected)) return true;\n window.salla?.event.dispatch('mobile::gallery.open', { images: legacyGalleryMedia(images) });\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 useRenderProbe('ProductGallery');\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: (image: ProductImage) => 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(image)}\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(image)) {\n event.preventDefault();\n return;\n }\n if (isVideo || !image.url) return;\n event.preventDefault();\n onPreview({ src: image.url, alt: image.alt || product.name });\n }}\n aria-label={product.name}\n className={`swiper-slide magnify-wrapper homeslider__slide ${image.video_url ? 'video-entry' : ''}`}\n >\n <div className={`w-full ${loaded ? '' : 'aspect-square bg-gray-100 animate-pulse'}`}>\n <Image\n id={String(image.id)}\n src={image.url}\n alt={image.alt || product.name}\n className={`h-full w-full object-${objectFit}`}\n aspectRatio=\"1/1\"\n priority={index === 0}\n noWrapper\n onLoad={() => setLoaded(true)}\n />\n </div>\n </a>\n );\n}\n\nfunction ThumbSlide({ image, index }: { image: ProductImage; index: number }) {\n return (\n <div\n className={`slide--one-fourth ${image.video_url ? 'video-entry' : ''} ${image.three_d_image_url ? 'model-entry' : ''}`}\n data-caption={image.alt}\n >\n <Image\n src={image.url}\n alt={image.alt || ''}\n className=\"object-cover w-full h-full bg-gray-100 rounded-md overflow-hidden\"\n title={image.alt}\n priority={index < 5}\n noWrapper\n />\n </div>\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { customUrl } from './chunk-
|
|
2
|
-
import { store } from './chunk-
|
|
3
|
-
import { redirect } from './chunk-
|
|
1
|
+
import { customUrl } from './chunk-FDNUH4RX.js';
|
|
2
|
+
import { store } from './chunk-3AEHPT4C.js';
|
|
3
|
+
import { redirect } from './chunk-JK2FVL6U.js';
|
|
4
4
|
import { isLocale } from './chunk-T72DAX7R.js';
|
|
5
5
|
|
|
6
6
|
// src/routes/custom-urls.ts
|
|
@@ -87,5 +87,5 @@ async function customUrlRedirect(pathname, search, options) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export { customUrlKey, customUrlPagePath, customUrlRedirect, storePathOf, withAddressQuery };
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-CUIQQKVP.js.map
|
|
91
|
+
//# sourceMappingURL=chunk-CUIQQKVP.js.map
|