@salla.sa/twilight-theme-engine 1.0.84 → 1.0.86
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-JUMFLSKN.js → AddToCartForm-5X2WZDWR.js} +3 -3
- package/dist/{AddToCartForm-JUMFLSKN.js.map → AddToCartForm-5X2WZDWR.js.map} +1 -1
- package/dist/{BlogAuthorPage-LFAUMKC7.js → BlogAuthorPage-LO7FSSJR.js} +12 -10
- package/dist/BlogAuthorPage-LO7FSSJR.js.map +1 -0
- package/dist/{BlogCategoryPage-NWYFFPCD.js → BlogCategoryPage-KKFQ3PGR.js} +12 -10
- package/dist/BlogCategoryPage-KKFQ3PGR.js.map +1 -0
- package/dist/{BlogPage-BOHXFV7E.js → BlogPage-VLF3NSGE.js} +11 -9
- package/dist/BlogPage-VLF3NSGE.js.map +1 -0
- package/dist/{BlogSinglePage-FYEXQPMB.js → BlogSinglePage-AVK535IW.js} +11 -9
- package/dist/BlogSinglePage-AVK535IW.js.map +1 -0
- package/dist/{BlogTagPage-DAM3RNVA.js → BlogTagPage-F3T4D7RH.js} +12 -10
- package/dist/BlogTagPage-F3T4D7RH.js.map +1 -0
- package/dist/{BrandsPage-GAKQCE6O.js → BrandsPage-LVSBZSVC.js} +11 -9
- package/dist/BrandsPage-LVSBZSVC.js.map +1 -0
- package/dist/{Breadcrumb-NAYSZNRV.js → Breadcrumb-VLFTXRFC.js} +11 -9
- package/dist/Breadcrumb-VLFTXRFC.js.map +1 -0
- package/dist/{CartItem-ZRVLIZT3.js → CartItem-G3H34GW6.js} +11 -9
- package/dist/CartItem-G3H34GW6.js.map +1 -0
- package/dist/{CartSummary-U2TVLG35.js → CartSummary-VH37RPUI.js} +11 -9
- package/dist/CartSummary-VH37RPUI.js.map +1 -0
- package/dist/{Copyright-2LSBADZD.js → Copyright-HE5ZWINZ.js} +3 -3
- package/dist/{Copyright-2LSBADZD.js.map → Copyright-HE5ZWINZ.js.map} +1 -1
- package/dist/{CustomerLayout-WSKXWI7D.js → CustomerLayout-LKBLOAVW.js} +11 -9
- package/dist/CustomerLayout-LKBLOAVW.js.map +1 -0
- package/dist/{Footer-ONNRJU4G.js → Footer-HHXAST72.js} +5 -5
- package/dist/{Footer-ONNRJU4G.js.map → Footer-HHXAST72.js.map} +1 -1
- package/dist/{Header-C6VXLLUC.js → Header-GEVZM2YG.js} +8 -6
- package/dist/{Header-C6VXLLUC.js.map → Header-GEVZM2YG.js.map} +1 -1
- package/dist/{LoyaltyPage-IG5KSYNO.js → LoyaltyPage-M5CT3CFD.js} +11 -9
- package/dist/LoyaltyPage-M5CT3CFD.js.map +1 -0
- package/dist/{LoyaltyPointsPage-RKO56ZER.js → LoyaltyPointsPage-SDJB52U6.js} +10 -3
- package/dist/LoyaltyPointsPage-SDJB52U6.js.map +1 -0
- package/dist/{MainMenu-USOYTKPU.js → MainMenu-I7EYS752.js} +3 -3
- package/dist/{MainMenu-USOYTKPU.js.map → MainMenu-I7EYS752.js.map} +1 -1
- package/dist/{MasterLayout-2W24ACEK.js → MasterLayout-QDK4T3NE.js} +11 -9
- package/dist/{MasterLayout-2W24ACEK.js.map → MasterLayout-QDK4T3NE.js.map} +1 -1
- package/dist/{MobileMenu-E4X2GOZ3.js → MobileMenu-7VTCWAVJ.js} +11 -9
- package/dist/MobileMenu-7VTCWAVJ.js.map +1 -0
- package/dist/{NotificationsPage-BJ5XVWEG.js → NotificationsPage-QCABE6QD.js} +11 -9
- package/dist/NotificationsPage-QCABE6QD.js.map +1 -0
- package/dist/{OrderSinglePage-544E36FJ.js → OrderSinglePage-2HVBKBG4.js} +11 -9
- package/dist/OrderSinglePage-2HVBKBG4.js.map +1 -0
- package/dist/{OrdersPage-AFBWVTZU.js → OrdersPage-5MNCPCM3.js} +11 -9
- package/dist/OrdersPage-5MNCPCM3.js.map +1 -0
- package/dist/{PageSingle-H2EJIL74.js → PageSingle-EN5XIM2B.js} +3 -3
- package/dist/{PageSingle-H2EJIL74.js.map → PageSingle-EN5XIM2B.js.map} +1 -1
- package/dist/{ProductDetails-SDZHALU6.js → ProductDetails-UEWQPPDZ.js} +13 -6
- package/dist/ProductDetails-UEWQPPDZ.js.map +1 -0
- package/dist/{ProfilePage-V5KV6GQK.js → ProfilePage-TZSU3GHZ.js} +11 -9
- package/dist/ProfilePage-TZSU3GHZ.js.map +1 -0
- package/dist/{ReviewsPage-CXKJABXP.js → ReviewsPage-WYZ6CHF2.js} +3 -3
- package/dist/{ReviewsPage-CXKJABXP.js.map → ReviewsPage-WYZ6CHF2.js.map} +1 -1
- package/dist/{SeoCartWidget-JAV6M3X5.js → SeoCartWidget-5JR5RXQM.js} +11 -9
- package/dist/SeoCartWidget-5JR5RXQM.js.map +1 -0
- package/dist/{SettingsPage-43SUCLQR.js → SettingsPage-DIDRQXMM.js} +11 -9
- package/dist/SettingsPage-DIDRQXMM.js.map +1 -0
- package/dist/{StoreClosedNotification-MINBJOGZ.js → StoreClosedNotification-C2G32E34.js} +12 -10
- package/dist/{StoreClosedNotification-MINBJOGZ.js.map → StoreClosedNotification-C2G32E34.js.map} +1 -1
- package/dist/{TestimonialsPage-RLLIDLOA.js → TestimonialsPage-XPHFRBZ7.js} +3 -3
- package/dist/{TestimonialsPage-RLLIDLOA.js.map → TestimonialsPage-XPHFRBZ7.js.map} +1 -1
- package/dist/{ThankYouPage-52SSZ7FV.js → ThankYouPage-UA6YYFB2.js} +11 -9
- package/dist/ThankYouPage-UA6YYFB2.js.map +1 -0
- package/dist/{WalletPage-4AN4UJ52.js → WalletPage-AJVV7LVL.js} +11 -9
- package/dist/WalletPage-AJVV7LVL.js.map +1 -0
- package/dist/{WishlistPage-L6IYJUJZ.js → WishlistPage-UW6LJLSW.js} +11 -9
- package/dist/WishlistPage-UW6LJLSW.js.map +1 -0
- package/dist/api/advertisement.d.ts +33 -0
- package/dist/api/advertisement.d.ts.map +1 -0
- package/dist/api/advertisement.js +8 -0
- package/dist/api/advertisement.js.map +1 -0
- package/dist/boot/critical-style.d.ts +3 -0
- package/dist/boot/critical-style.d.ts.map +1 -0
- package/dist/boot/index.d.ts +15 -0
- package/dist/boot/index.d.ts.map +1 -0
- package/dist/boot.d.ts +1 -0
- package/dist/boot.js +69 -0
- package/dist/boot.js.map +1 -0
- package/dist/{chunk-R5BQDCDK.js → chunk-2HCCIHU7.js} +4 -4
- package/dist/{chunk-R5BQDCDK.js.map → chunk-2HCCIHU7.js.map} +1 -1
- package/dist/chunk-4FJGZQD3.js +6 -0
- package/dist/chunk-4FJGZQD3.js.map +1 -0
- package/dist/{chunk-UNEZZMQA.js → chunk-4WVJJ7SN.js} +20 -4
- package/dist/chunk-4WVJJ7SN.js.map +1 -0
- package/dist/{chunk-FFWSQJLV.js → chunk-BAYGWTNM.js} +3 -3
- package/dist/{chunk-FFWSQJLV.js.map → chunk-BAYGWTNM.js.map} +1 -1
- package/dist/{chunk-WSRVPR7V.js → chunk-CLBFF2CY.js} +3 -3
- package/dist/{chunk-WSRVPR7V.js.map → chunk-CLBFF2CY.js.map} +1 -1
- package/dist/chunk-DBW7XXNE.js +103 -0
- package/dist/chunk-DBW7XXNE.js.map +1 -0
- package/dist/{chunk-CCUE2FMU.js → chunk-DBXH3EMJ.js} +3 -3
- package/dist/{chunk-CCUE2FMU.js.map → chunk-DBXH3EMJ.js.map} +1 -1
- package/dist/{chunk-MECSOKS7.js → chunk-E26YG3AO.js} +4 -4
- package/dist/{chunk-MECSOKS7.js.map → chunk-E26YG3AO.js.map} +1 -1
- package/dist/{chunk-22SH7OVF.js → chunk-E7WWO3V3.js} +3 -3
- package/dist/{chunk-22SH7OVF.js.map → chunk-E7WWO3V3.js.map} +1 -1
- package/dist/{chunk-IC6XW3PD.js → chunk-HQ7WA37L.js} +7 -7
- package/dist/{chunk-IC6XW3PD.js.map → chunk-HQ7WA37L.js.map} +1 -1
- package/dist/chunk-IVBOLREE.js +29 -0
- package/dist/chunk-IVBOLREE.js.map +1 -0
- package/dist/{chunk-RRGEASAL.js → chunk-KP3VYG4F.js} +6 -6
- package/dist/{chunk-RRGEASAL.js.map → chunk-KP3VYG4F.js.map} +1 -1
- package/dist/{chunk-EFF2WO6W.js → chunk-PWTXR4RR.js} +10 -10
- package/dist/{chunk-EFF2WO6W.js.map → chunk-PWTXR4RR.js.map} +1 -1
- package/dist/chunk-QJYUTRAQ.js +14 -0
- package/dist/{chunk-4EA56R6I.js.map → chunk-QJYUTRAQ.js.map} +1 -1
- package/dist/{chunk-YFQUSAET.js → chunk-U55ZJC2X.js} +4 -4
- package/dist/{chunk-YFQUSAET.js.map → chunk-U55ZJC2X.js.map} +1 -1
- package/dist/{chunk-R54GSKJS.js → chunk-WSDG4ZRI.js} +30 -16
- package/dist/chunk-WSDG4ZRI.js.map +1 -0
- package/dist/{chunk-3PWARKZX.js → chunk-X54QP332.js} +8 -8
- package/dist/chunk-X54QP332.js.map +1 -0
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +9 -7
- package/dist/components/home/HomePageRenderer.d.ts +6 -0
- package/dist/components/home/HomePageRenderer.d.ts.map +1 -1
- package/dist/components/home/index.js +11 -9
- package/dist/components/layout/PageAdvertisements.d.ts +7 -0
- package/dist/components/layout/PageAdvertisements.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +8 -1
- package/dist/components/product/index.js +10 -8
- package/dist/components/store/index.js +11 -9
- package/dist/components/store/index.js.map +1 -1
- package/dist/{document-class-SD6BUMZN.js → document-class-7AXAAWGZ.js} +6 -5
- package/dist/{document-class-SD6BUMZN.js.map → document-class-7AXAAWGZ.js.map} +1 -1
- package/dist/hooks/index.js +9 -7
- package/dist/hooks/useGtm.js +9 -7
- package/dist/hooks/useMoney.js +9 -7
- package/dist/hooks/useStore.js +9 -7
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/{not-found-TUU7WQLL.js → not-found-3EEMQZMU.js} +11 -9
- package/dist/not-found-3EEMQZMU.js.map +1 -0
- package/dist/providers/index.js +9 -7
- package/dist/routes/account/orders.js +1 -1
- package/dist/routes/account.js +6 -6
- package/dist/routes/blog.js +5 -5
- package/dist/routes/brands.js +1 -1
- package/dist/routes/cart.js +13 -11
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home.js +12 -10
- package/dist/routes/loyalty.js +2 -2
- package/dist/routes/page.js +1 -1
- package/dist/routes/product-listing.js +11 -9
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +11 -9
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/root/beforeLoad.d.ts +2 -2
- package/dist/routes/root/beforeLoad.d.ts.map +1 -1
- package/dist/routes/root/head.d.ts.map +1 -1
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +1 -1
- package/dist/skeleton.js +12 -10
- package/dist/tanstack/document-class.d.ts.map +1 -1
- package/dist/tanstack/index.d.ts +1 -0
- package/dist/tanstack/index.d.ts.map +1 -1
- package/dist/tanstack/stylesheet.d.ts +15 -0
- package/dist/tanstack/stylesheet.d.ts.map +1 -0
- package/dist/tanstack.js +34 -5
- package/dist/tanstack.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +12 -3
- package/tailwind/components/Component.tsx.txt +21 -0
- package/tailwind/components/ComponentRegistry.ts.txt +66 -0
- package/tailwind/components/cart/CartItem.tsx.txt +211 -0
- package/tailwind/components/cart/CartSummary.tsx.txt +269 -0
- package/tailwind/components/cart/PreOrderNotification.tsx.txt +16 -0
- package/tailwind/components/cart/PriceQuoteButton.tsx.txt +21 -0
- package/tailwind/components/cart/SeoCartWidget.tsx.txt +99 -0
- package/tailwind/components/cart/index.ts.txt +11 -0
- package/tailwind/components/cart/lazy.ts.txt +15 -0
- package/tailwind/components/collapse/Collapse.tsx.txt +95 -0
- package/tailwind/components/collapse/index.ts.txt +41 -0
- package/tailwind/components/common/Breadcrumb.tsx.txt +27 -0
- package/tailwind/components/common/BreadcrumbJsonLd.tsx.txt +40 -0
- package/tailwind/components/common/BreadcrumbTrail.tsx.txt +97 -0
- package/tailwind/components/common/CurrencySymbol.tsx.txt +8 -0
- package/tailwind/components/common/DeferredData.tsx.txt +122 -0
- package/tailwind/components/common/ErrorPage.tsx.txt +69 -0
- package/tailwind/components/common/Image.tsx.txt +119 -0
- package/tailwind/components/common/Link.tsx.txt +36 -0
- package/tailwind/components/common/Link.types.ts.txt +85 -0
- package/tailwind/components/common/NoContent.tsx.txt +27 -0
- package/tailwind/components/common/RenderWhenVisible.tsx.txt +92 -0
- package/tailwind/components/common/index.ts.txt +42 -0
- package/tailwind/components/common/lazy.ts.txt +28 -0
- package/tailwind/components/defineComponent.ts.txt +32 -0
- package/tailwind/components/drawer/Drawer.tsx.txt +219 -0
- package/tailwind/components/drawer/index.ts.txt +38 -0
- package/tailwind/components/dropdown/Dropdown.tsx.txt +166 -0
- package/tailwind/components/dropdown/index.ts.txt +40 -0
- package/tailwind/components/home/BundleComponent.tsx.txt +35 -0
- package/tailwind/components/home/ComponentErrorBoundary.tsx.txt +98 -0
- package/tailwind/components/home/FeaturedProductsStyle1.tsx.txt +125 -0
- package/tailwind/components/home/FeaturedProductsStyle2.tsx.txt +127 -0
- package/tailwind/components/home/FeaturedProductsStyle3.tsx.txt +71 -0
- package/tailwind/components/home/FixedBanner.tsx.txt +68 -0
- package/tailwind/components/home/FixedProducts.tsx.txt +72 -0
- package/tailwind/components/home/HomePageRenderer.tsx.txt +284 -0
- package/tailwind/components/home/PageBlocks.tsx.txt +24 -0
- package/tailwind/components/home/ParallaxBackground.tsx.txt +50 -0
- package/tailwind/components/home/PhotosSlider.tsx.txt +61 -0
- package/tailwind/components/home/ProductsSlider.tsx.txt +87 -0
- package/tailwind/components/home/ReorderProducts.tsx.txt +38 -0
- package/tailwind/components/home/SquarePhotos.tsx.txt +68 -0
- package/tailwind/components/home/StoreFeatures.tsx.txt +34 -0
- package/tailwind/components/home/Testimonials.tsx.txt +36 -0
- package/tailwind/components/home/Youtube.tsx.txt +48 -0
- package/tailwind/components/home/index.ts.txt +50 -0
- package/tailwind/components/home/lazy.ts.txt +17 -0
- package/tailwind/components/home/register.ts.txt +44 -0
- package/tailwind/components/home/reorder-hooks.ts.txt +52 -0
- package/tailwind/components/home/types.ts.txt +4 -0
- package/tailwind/components/layout/Copyright.tsx.txt +23 -0
- package/tailwind/components/layout/CustomerLayout.tsx.txt +91 -0
- package/tailwind/components/layout/Footer.tsx.txt +343 -0
- package/tailwind/components/layout/Header.tsx.txt +154 -0
- package/tailwind/components/layout/MasterLayout.tsx.txt +63 -0
- package/tailwind/components/layout/PageAdvertisements.tsx.txt +131 -0
- package/tailwind/components/layout/WidgetHead.tsx.txt +53 -0
- package/tailwind/components/layout/index.ts.txt +27 -0
- package/tailwind/components/layout/lazy.ts.txt +25 -0
- package/tailwind/components/layout/types.ts.txt +11 -0
- package/tailwind/components/modal/ImageModal.tsx.txt +70 -0
- package/tailwind/components/modal/Modal.tsx.txt +245 -0
- package/tailwind/components/modal/index.ts.txt +39 -0
- package/tailwind/components/modal/lazy.ts.txt +10 -0
- package/tailwind/components/navigation/MainMenu.tsx.txt +94 -0
- package/tailwind/components/navigation/MobileMenu.tsx.txt +160 -0
- package/tailwind/components/navigation/index.ts.txt +4 -0
- package/tailwind/components/navigation/lazy.ts.txt +11 -0
- package/tailwind/components/product/AddToCartForm.tsx.txt +365 -0
- package/tailwind/components/product/ProductCard.tsx.txt +305 -0
- package/tailwind/components/product/ProductDetails.tsx.txt +267 -0
- package/tailwind/components/product/ProductGallery.tsx.txt +234 -0
- package/tailwind/components/product/index.ts.txt +15 -0
- package/tailwind/components/product/lazy.ts.txt +9 -0
- package/tailwind/components/snippets/AppsSnippets.tsx.txt +225 -0
- package/tailwind/components/snippets/SallaSdkScripts.tsx.txt +14 -0
- package/tailwind/components/snippets/index.ts.txt +4 -0
- package/tailwind/components/store/StoreClosedNotification.tsx.txt +73 -0
- package/tailwind/components/store/index.ts.txt +8 -0
- package/tailwind/components/store/lazy.ts.txt +8 -0
- package/tailwind/components/toast/Toaster.tsx.txt +177 -0
- package/tailwind/components/toast/index.ts.txt +10 -0
- package/tailwind/components/toast/types.ts.txt +38 -0
- package/tailwind/components/toast/useToast.ts.txt +61 -0
- package/tailwind/components/tracking/GoogleTag.tsx.txt +77 -0
- package/tailwind/components/tracking/SiftSnippet.tsx.txt +49 -0
- package/tailwind/components/tracking/TwilightBundles.tsx.txt +67 -0
- package/tailwind/components/tracking/index.ts.txt +11 -0
- package/tailwind/components/tracking/lazy.ts.txt +11 -0
- package/tailwind/components/useComponent.ts.txt +12 -0
- package/tailwind/routes/account/index.tsx.txt +16 -0
- package/tailwind/routes/account/notifications/NotificationsPage.tsx.txt +54 -0
- package/tailwind/routes/account/notifications/index.tsx.txt +39 -0
- package/tailwind/routes/account/notifications/loader.ts.txt +22 -0
- package/tailwind/routes/account/notifications/types.ts.txt +18 -0
- package/tailwind/routes/account/orders/OrderSinglePage.tsx.txt +181 -0
- package/tailwind/routes/account/orders/OrdersPage.tsx.txt +28 -0
- package/tailwind/routes/account/orders/index.tsx.txt +86 -0
- package/tailwind/routes/account/orders/loader.ts.txt +66 -0
- package/tailwind/routes/account/orders/single/OrderActions.tsx.txt +197 -0
- package/tailwind/routes/account/orders/single/OrderHeader.tsx.txt +143 -0
- package/tailwind/routes/account/orders/single/OrderItemRow.tsx.txt +209 -0
- package/tailwind/routes/account/orders/single/OrderSections.tsx.txt +215 -0
- package/tailwind/routes/account/orders/single/types.ts.txt +38 -0
- package/tailwind/routes/account/orders/types.ts.txt +29 -0
- package/tailwind/routes/account/profile/ProfilePage.tsx.txt +30 -0
- package/tailwind/routes/account/profile/index.tsx.txt +39 -0
- package/tailwind/routes/account/profile/loader.ts.txt +16 -0
- package/tailwind/routes/account/profile/types.ts.txt +5 -0
- package/tailwind/routes/account/settings/SettingsPage.tsx.txt +13 -0
- package/tailwind/routes/account/settings/index.tsx.txt +39 -0
- package/tailwind/routes/account/settings/loader.ts.txt +13 -0
- package/tailwind/routes/account/settings/types.ts.txt +5 -0
- package/tailwind/routes/account/types.ts.txt +320 -0
- package/tailwind/routes/account/wallet/WalletPage.tsx.txt +195 -0
- package/tailwind/routes/account/wallet/index.tsx.txt +38 -0
- package/tailwind/routes/account/wallet/loader.ts.txt +27 -0
- package/tailwind/routes/account/wallet/types.ts.txt +11 -0
- package/tailwind/routes/account/wishlist/WishlistPage.tsx.txt +314 -0
- package/tailwind/routes/account/wishlist/WishlistShare.tsx.txt +248 -0
- package/tailwind/routes/account/wishlist/index.tsx.txt +40 -0
- package/tailwind/routes/account/wishlist/loader.ts.txt +26 -0
- package/tailwind/routes/account/wishlist/types.ts.txt +9 -0
- package/tailwind/routes/blog/BlogAuthorPage.tsx.txt +82 -0
- package/tailwind/routes/blog/BlogCategoryPage.tsx.txt +84 -0
- package/tailwind/routes/blog/BlogPage.tsx.txt +191 -0
- package/tailwind/routes/blog/BlogSinglePage.tsx.txt +168 -0
- package/tailwind/routes/blog/BlogTagPage.tsx.txt +84 -0
- package/tailwind/routes/blog/BlogTags.tsx.txt +54 -0
- package/tailwind/routes/blog/components.tsx.txt +87 -0
- package/tailwind/routes/blog/index.tsx.txt +238 -0
- package/tailwind/routes/blog/loader.ts.txt +173 -0
- package/tailwind/routes/blog/types.ts.txt +106 -0
- package/tailwind/routes/brands/BrandsPage.tsx.txt +179 -0
- package/tailwind/routes/brands/index.tsx.txt +47 -0
- package/tailwind/routes/brands/loader.ts.txt +14 -0
- package/tailwind/routes/brands/types.ts.txt +53 -0
- package/tailwind/routes/cart/CartPage.tsx.txt +112 -0
- package/tailwind/routes/cart/index.tsx.txt +39 -0
- package/tailwind/routes/cart/loader.ts.txt +15 -0
- package/tailwind/routes/cart/types.ts.txt +6 -0
- package/tailwind/routes/home/HomePage.tsx.txt +53 -0
- package/tailwind/routes/home/index.tsx.txt +56 -0
- package/tailwind/routes/home/loader.ts.txt +24 -0
- package/tailwind/routes/home/types.ts.txt +11 -0
- package/tailwind/routes/index.ts.txt +94 -0
- package/tailwind/routes/lazy.ts.txt +105 -0
- package/tailwind/routes/loyalty/LoyaltyPage.tsx.txt +17 -0
- package/tailwind/routes/loyalty/LoyaltyPointsPage.tsx.txt +11 -0
- package/tailwind/routes/loyalty/index.tsx.txt +81 -0
- package/tailwind/routes/loyalty/loader.ts.txt +53 -0
- package/tailwind/routes/loyalty/types.ts.txt +109 -0
- package/tailwind/routes/not-found.tsx.txt +50 -0
- package/tailwind/routes/page/PageSingle.tsx.txt +34 -0
- package/tailwind/routes/page/index.tsx.txt +60 -0
- package/tailwind/routes/page/loader.ts.txt +19 -0
- package/tailwind/routes/page/types.ts.txt +34 -0
- package/tailwind/routes/product/ProductPage.tsx.txt +77 -0
- package/tailwind/routes/product/index.tsx.txt +157 -0
- package/tailwind/routes/product/loader.ts.txt +35 -0
- package/tailwind/routes/product/types.ts.txt +6 -0
- package/tailwind/routes/product-listing/ProductListPage.tsx.txt +321 -0
- package/tailwind/routes/product-listing/index.tsx.txt +95 -0
- package/tailwind/routes/product-listing/loader.ts.txt +323 -0
- package/tailwind/routes/product-listing/types.ts.txt +96 -0
- package/tailwind/routes/product-listing/useAppliedFilters.ts.txt +130 -0
- package/tailwind/routes/product-short-link.ts.txt +104 -0
- package/tailwind/routes/root/beforeLoad.ts.txt +354 -0
- package/tailwind/routes/root/head.ts.txt +424 -0
- package/tailwind/routes/root/index.ts.txt +2 -0
- package/tailwind/routes/seo-redirects.ts.txt +82 -0
- package/tailwind/routes/testimonials/ReviewsPage.tsx.txt +12 -0
- package/tailwind/routes/testimonials/TestimonialsPage.tsx.txt +80 -0
- package/tailwind/routes/testimonials/index.tsx.txt +80 -0
- package/tailwind/routes/testimonials/loader.ts.txt +29 -0
- package/tailwind/routes/testimonials/types.ts.txt +9 -0
- package/tailwind/routes/thank-you/ThankYouPage.tsx.txt +241 -0
- package/tailwind/routes/thank-you/index.tsx.txt +49 -0
- package/tailwind/routes/thank-you/loader.ts.txt +40 -0
- package/tailwind/routes/thank-you/types.ts.txt +16 -0
- package/tailwind/routes/types.ts.txt +41 -0
- package/dist/BlogAuthorPage-LFAUMKC7.js.map +0 -1
- package/dist/BlogCategoryPage-NWYFFPCD.js.map +0 -1
- package/dist/BlogPage-BOHXFV7E.js.map +0 -1
- package/dist/BlogSinglePage-FYEXQPMB.js.map +0 -1
- package/dist/BlogTagPage-DAM3RNVA.js.map +0 -1
- package/dist/BrandsPage-GAKQCE6O.js.map +0 -1
- package/dist/Breadcrumb-NAYSZNRV.js.map +0 -1
- package/dist/CartItem-ZRVLIZT3.js.map +0 -1
- package/dist/CartSummary-U2TVLG35.js.map +0 -1
- package/dist/CustomerLayout-WSKXWI7D.js.map +0 -1
- package/dist/LoyaltyPage-IG5KSYNO.js.map +0 -1
- package/dist/LoyaltyPointsPage-RKO56ZER.js.map +0 -1
- package/dist/MobileMenu-E4X2GOZ3.js.map +0 -1
- package/dist/NotificationsPage-BJ5XVWEG.js.map +0 -1
- package/dist/OrderSinglePage-544E36FJ.js.map +0 -1
- package/dist/OrdersPage-AFBWVTZU.js.map +0 -1
- package/dist/ProductDetails-SDZHALU6.js.map +0 -1
- package/dist/ProfilePage-V5KV6GQK.js.map +0 -1
- package/dist/SeoCartWidget-JAV6M3X5.js.map +0 -1
- package/dist/SettingsPage-43SUCLQR.js.map +0 -1
- package/dist/ThankYouPage-52SSZ7FV.js.map +0 -1
- package/dist/WalletPage-4AN4UJ52.js.map +0 -1
- package/dist/WishlistPage-L6IYJUJZ.js.map +0 -1
- package/dist/chunk-3PWARKZX.js.map +0 -1
- package/dist/chunk-4EA56R6I.js +0 -14
- package/dist/chunk-R54GSKJS.js.map +0 -1
- package/dist/chunk-UNEZZMQA.js.map +0 -1
- package/dist/not-found-TUU7WQLL.js.map +0 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { memo, useState, useRef, useCallback, useEffect, useMemo } from 'react';
|
|
2
|
+
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
3
|
+
import { useWindowScroll } from '@uidotdev/usehooks';
|
|
4
|
+
import { Link, Breadcrumb, NoContent, Image } from '../../components/common';
|
|
5
|
+
import { HookSlot } from '../../hooks';
|
|
6
|
+
import { useTranslation } from '../../providers/I18nProvider';
|
|
7
|
+
import { brand } from '../../api/brands';
|
|
8
|
+
import type { Brand, BrandsGroup, BrandsPageProps } from './types';
|
|
9
|
+
|
|
10
|
+
function byLetter(brands: Brand[], locale: string): [string, Brand[]][] {
|
|
11
|
+
const groups: BrandsGroup = {};
|
|
12
|
+
for (const item of brands) {
|
|
13
|
+
(groups[(locale === 'ar' ? item.ar_char : item.en_char) || '#'] ??= []).push(item);
|
|
14
|
+
}
|
|
15
|
+
// Code point order is alphabetical for Arabic and Latin, and the same on server and browser.
|
|
16
|
+
return Object.entries(groups).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface BrandSectionProps {
|
|
20
|
+
char: string;
|
|
21
|
+
brands: Brand[];
|
|
22
|
+
sectionRef: (el: HTMLElement | null) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function BrandSection({ char, brands, sectionRef }: BrandSectionProps) {
|
|
26
|
+
return (
|
|
27
|
+
<section
|
|
28
|
+
id={`brand-section-${char}`}
|
|
29
|
+
ref={sectionRef}
|
|
30
|
+
className="pt-24 first:pt-16 md:first:pt-24"
|
|
31
|
+
>
|
|
32
|
+
<div className="flex items-center mb-10">
|
|
33
|
+
<span data-id={char} className="brand-char">
|
|
34
|
+
<span className="fix-align">{char}</span>
|
|
35
|
+
</span>
|
|
36
|
+
<div className="bg-border-color h-px flex-1"></div>
|
|
37
|
+
</div>
|
|
38
|
+
<div className="grid grid-cols-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 grid-flow-row gap-4 md:gap-8">
|
|
39
|
+
{brands.map((item) => (
|
|
40
|
+
// A grid of logos would preload a brand for every logo the mouse crosses.
|
|
41
|
+
<Link key={item.id} to={`/brands/${item.id}`} className="brand-item" preload={false}>
|
|
42
|
+
<Image
|
|
43
|
+
className="max-h-full"
|
|
44
|
+
width={400}
|
|
45
|
+
height={300}
|
|
46
|
+
src={item.logo}
|
|
47
|
+
alt={item.name}
|
|
48
|
+
/>
|
|
49
|
+
</Link>
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
</section>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const PAGES_PER_WAVE = 6;
|
|
57
|
+
|
|
58
|
+
// One retry per page, so a network blip does not drop it.
|
|
59
|
+
const fetchPage = (page: number) => brand.list(page).catch(() => brand.list(page));
|
|
60
|
+
|
|
61
|
+
async function fetchWave(from: number): Promise<{ items: Brand[]; done: boolean }> {
|
|
62
|
+
const settled = await Promise.allSettled(
|
|
63
|
+
Array.from({ length: PAGES_PER_WAVE }, (_, i) => fetchPage(from + i))
|
|
64
|
+
);
|
|
65
|
+
const pages = settled.flatMap((result) => (result.status === 'fulfilled' ? [result.value] : []));
|
|
66
|
+
return {
|
|
67
|
+
items: pages.flatMap((result) => result.items),
|
|
68
|
+
// Stop at the last page, or when a whole wave fails.
|
|
69
|
+
done: pages.length === 0 || pages.some((result) => !result.next),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The first page plus every page after `next`, fetched in the background so the letter menu is
|
|
75
|
+
* complete without scrolling. The API has no page count, so pages load in parallel waves.
|
|
76
|
+
*/
|
|
77
|
+
function useAllBrands(first: Brand[], next: string | null | undefined, locale: string): Brand[] {
|
|
78
|
+
const startPage = Number(next?.match(/[?&]page=(\d+)/)?.[1]) || 0;
|
|
79
|
+
const { data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({
|
|
80
|
+
queryKey: ['brands', 'after-first-page', locale, startPage],
|
|
81
|
+
queryFn: ({ pageParam }) => fetchWave(pageParam),
|
|
82
|
+
initialPageParam: startPage,
|
|
83
|
+
getNextPageParam: (wave, _waves, from) => (wave.done ? undefined : from + PAGES_PER_WAVE),
|
|
84
|
+
enabled: startPage > 0,
|
|
85
|
+
// Not reused across visits: it must match the first page the loader just fetched.
|
|
86
|
+
gcTime: 0,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (hasNextPage && !isFetchingNextPage) void fetchNextPage();
|
|
91
|
+
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
|
|
92
|
+
|
|
93
|
+
return useMemo(() => {
|
|
94
|
+
const extra = data?.pages.flatMap((wave) => wave.items) ?? [];
|
|
95
|
+
return extra.length ? [...first, ...extra] : first;
|
|
96
|
+
}, [first, data]);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function BrandsPageComponent({ page, brands, pagination }: BrandsPageProps) {
|
|
100
|
+
const { t, locale } = useTranslation();
|
|
101
|
+
const allBrands = useAllBrands(brands, pagination?.next, locale);
|
|
102
|
+
const brandEntries = useMemo(() => byLetter(allBrands, locale), [allBrands, locale]);
|
|
103
|
+
const [selectedChar, setSelectedChar] = useState<string | null>(null);
|
|
104
|
+
const sectionRefs = useRef<Record<string, HTMLElement | null>>({});
|
|
105
|
+
|
|
106
|
+
// Use useWindowScroll hook instead of manual listener
|
|
107
|
+
const [{ y }] = useWindowScroll();
|
|
108
|
+
const isSticky = (y ?? 0) > 200;
|
|
109
|
+
|
|
110
|
+
// Handle brand nav item click - matches brands.js toggle class logic
|
|
111
|
+
const handleBrandClick = useCallback((e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
const char = e.currentTarget.dataset.id;
|
|
114
|
+
if (char) {
|
|
115
|
+
setSelectedChar(char);
|
|
116
|
+
sectionRefs.current[char]?.scrollIntoView({ behavior: 'smooth' });
|
|
117
|
+
}
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div className="container mb-20">
|
|
122
|
+
<Breadcrumb page={page} />
|
|
123
|
+
|
|
124
|
+
<div className="flex justify-between pt-2 pb-6">
|
|
125
|
+
<h1 className="font-bold mb-6 md:mb-0">{page.title}</h1>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
{brandEntries.length > 0 ? (
|
|
129
|
+
<>
|
|
130
|
+
<div className="brands-nav-wrap">
|
|
131
|
+
<ul
|
|
132
|
+
id="brands-nav"
|
|
133
|
+
className={`brands-nav ${isSticky ? 'is-sticky' : 'is-not-sticky'}`}
|
|
134
|
+
>
|
|
135
|
+
<li></li>
|
|
136
|
+
{brandEntries.map(([char]) => (
|
|
137
|
+
<li key={char}>
|
|
138
|
+
<a
|
|
139
|
+
className={`brands-nav__item ${selectedChar === char ? 'is-selected' : 'unselected'}`}
|
|
140
|
+
href={`#brand-section-${char}`}
|
|
141
|
+
onClick={handleBrandClick}
|
|
142
|
+
data-id={char}
|
|
143
|
+
>
|
|
144
|
+
<span className="fix-align">{char}</span>
|
|
145
|
+
</a>
|
|
146
|
+
</li>
|
|
147
|
+
))}
|
|
148
|
+
</ul>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<div className="px-8 xl:px-0">
|
|
152
|
+
<HookSlot name="brands:index.items.start" />
|
|
153
|
+
|
|
154
|
+
{brandEntries.map(([char, brandGroup]) => (
|
|
155
|
+
<BrandSection
|
|
156
|
+
key={char}
|
|
157
|
+
char={char}
|
|
158
|
+
brands={brandGroup}
|
|
159
|
+
sectionRef={(el) => {
|
|
160
|
+
sectionRefs.current[char] = el;
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
))}
|
|
164
|
+
|
|
165
|
+
<HookSlot name="brands:index.items.end" />
|
|
166
|
+
</div>
|
|
167
|
+
</>
|
|
168
|
+
) : (
|
|
169
|
+
<NoContent
|
|
170
|
+
icon="sicon-award-ribbon"
|
|
171
|
+
message={t('pages.brands.non_brands')}
|
|
172
|
+
actionLabel={t('common.elements.back_home')}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export const BrandsPage = memo(BrandsPageComponent);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HeadDescriptor } from '../../utils/head';
|
|
2
|
+
import { buildHreflangAlternates } from '../../utils/baseHead';
|
|
3
|
+
import { lazy } from 'react';
|
|
4
|
+
import { brandsLoader } from './loader';
|
|
5
|
+
import type { BrandsPageProps } from './types';
|
|
6
|
+
import type { TwilightContext } from '../../twilight/context';
|
|
7
|
+
import { RouteId } from '../../router/route-ids';
|
|
8
|
+
|
|
9
|
+
// Lazy-load components for code-splitting
|
|
10
|
+
const LazyBrandsPage = lazy(() => import('./BrandsPage').then((m) => ({ default: m.BrandsPage })));
|
|
11
|
+
|
|
12
|
+
export const BrandsPage = LazyBrandsPage;
|
|
13
|
+
export { brandsLoader };
|
|
14
|
+
export type { BrandsPageProps, Brand, BrandsGroup } from './types';
|
|
15
|
+
|
|
16
|
+
async function brandsLoaderWithExtend(
|
|
17
|
+
_ctx?: { locale?: string },
|
|
18
|
+
extend?: (
|
|
19
|
+
data: BrandsPageProps,
|
|
20
|
+
ctx: { params: Record<string, never> }
|
|
21
|
+
) => Promise<Record<string, unknown>> | Record<string, unknown>
|
|
22
|
+
): Promise<BrandsPageProps> {
|
|
23
|
+
const data = await brandsLoader();
|
|
24
|
+
|
|
25
|
+
if (extend) {
|
|
26
|
+
const extra = await extend(data, { params: {} });
|
|
27
|
+
return { ...data, ...extra } as BrandsPageProps;
|
|
28
|
+
}
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function brandsHead(ctx: TwilightContext, data: BrandsPageProps): HeadDescriptor {
|
|
33
|
+
const base: HeadDescriptor = {
|
|
34
|
+
title: data.page.title,
|
|
35
|
+
description: data.page.description,
|
|
36
|
+
alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return base;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const Brands = {
|
|
43
|
+
id: RouteId.BRANDS_INDEX,
|
|
44
|
+
loader: brandsLoaderWithExtend,
|
|
45
|
+
head: brandsHead,
|
|
46
|
+
Component: LazyBrandsPage,
|
|
47
|
+
} as const;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BrandsPageProps } from './types';
|
|
2
|
+
import { brand } from '../../api/brands';
|
|
3
|
+
import { getTwilightContext } from '../../twilight/context';
|
|
4
|
+
import { RouteId } from '../../router/route-ids';
|
|
5
|
+
|
|
6
|
+
export async function brandsLoader(): Promise<BrandsPageProps> {
|
|
7
|
+
const { items, next } = await brand.list();
|
|
8
|
+
const i18n = getTwilightContext().i18n;
|
|
9
|
+
return {
|
|
10
|
+
page: { slug: RouteId.BRANDS_INDEX, title: i18n.t('common.titles.brands') || 'Brands' },
|
|
11
|
+
brands: items,
|
|
12
|
+
pagination: { next },
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brands Route Types
|
|
3
|
+
* Only types that need to be exported.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Page } from '../../types';
|
|
7
|
+
import type { RoutePagination } from '../types';
|
|
8
|
+
|
|
9
|
+
export interface Brand {
|
|
10
|
+
/** Brand id. Numeric on the Store API (`brands` and `brands/{id}`); string in older fixtures. */
|
|
11
|
+
id: string | number;
|
|
12
|
+
/** Brand page URL. */
|
|
13
|
+
url: string;
|
|
14
|
+
/** Brand name. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Display label. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Brand description. */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Banner image URL, or null. */
|
|
21
|
+
banner?: string | null;
|
|
22
|
+
/** Logo image URL. Always present; required to match Twig template usage. */
|
|
23
|
+
logo: string;
|
|
24
|
+
/** Whether the brand is active. */
|
|
25
|
+
status: boolean;
|
|
26
|
+
/** First Arabic letter, used to group the brands directory. */
|
|
27
|
+
ar_char: string;
|
|
28
|
+
/** First Latin letter, used to group the brands directory. */
|
|
29
|
+
en_char: string;
|
|
30
|
+
/** Sales channels the brand is available on. */
|
|
31
|
+
channels?: string[];
|
|
32
|
+
/** SEO data. */
|
|
33
|
+
metadata?: {
|
|
34
|
+
/** SEO title. */
|
|
35
|
+
title: string;
|
|
36
|
+
/** SEO description. */
|
|
37
|
+
description: string;
|
|
38
|
+
/** SEO URL. */
|
|
39
|
+
url: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface BrandsGroup {
|
|
44
|
+
[char: string]: Brand[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Page props
|
|
48
|
+
export interface BrandsPageProps {
|
|
49
|
+
page: Page;
|
|
50
|
+
/** The first page of brands; the page groups them by letter and loads the rest on scroll. */
|
|
51
|
+
brands: Brand[];
|
|
52
|
+
pagination?: RoutePagination;
|
|
53
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { SallaConditionalOffer } from '@salla.sa/twilight-components-react/conditional-offer';
|
|
3
|
+
import { SallaOffer } from '@salla.sa/twilight-components-react/offer';
|
|
4
|
+
import { SallaProductOptions } from '@salla.sa/twilight-components-react/product-options';
|
|
5
|
+
import { HookSlot } from '../../hooks';
|
|
6
|
+
import { useTranslation } from '../../providers/I18nProvider';
|
|
7
|
+
import type { CartPageProps } from './types';
|
|
8
|
+
import { Breadcrumb, NoContent } from '../../components/common';
|
|
9
|
+
import { CartItem, CartSummary, SeoCartWidget } from '../../components/cart';
|
|
10
|
+
import { useTwilight } from '../../providers/twilight-context';
|
|
11
|
+
import { CartSkeleton } from '../../skeleton';
|
|
12
|
+
import { loyalty } from '../../api/loyalty';
|
|
13
|
+
import { cart } from '../../api/cart';
|
|
14
|
+
|
|
15
|
+
function CartPageContent({ page }: CartPageProps) {
|
|
16
|
+
const { store } = useTwilight();
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const { data: loyaltyPoints } = useQuery(loyalty.queries.points());
|
|
19
|
+
|
|
20
|
+
const { data: cartId } = useQuery(cart.queries.currentId());
|
|
21
|
+
|
|
22
|
+
const { data: cartData } = useQuery({
|
|
23
|
+
...cart.queries.detail(cartId!),
|
|
24
|
+
enabled: !!cartId,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const isLoading = cartId == null || cartData === undefined;
|
|
28
|
+
|
|
29
|
+
if (isLoading) {
|
|
30
|
+
return <CartSkeleton />;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// No cart: it was already turned into an order, shown empty like Twig.
|
|
34
|
+
if (!cartData || cartData.items.length === 0) {
|
|
35
|
+
return (
|
|
36
|
+
<div className="container">
|
|
37
|
+
<Breadcrumb page={page} />
|
|
38
|
+
<NoContent
|
|
39
|
+
icon="sicon-shopping-bag"
|
|
40
|
+
message={t('pages.cart.empty_cart', 'Your cart is empty')}
|
|
41
|
+
actionLabel={t('common.elements.back_home', 'Back to Home')}
|
|
42
|
+
actionUrl="/"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className="container">
|
|
50
|
+
{/* Analytics — no visible UI, fires GTM checkout events */}
|
|
51
|
+
<SeoCartWidget cart={cartData} />
|
|
52
|
+
|
|
53
|
+
<Breadcrumb page={page} />
|
|
54
|
+
<h1 className="sr-only">{t('common.titles.cart', 'Cart')}</h1>
|
|
55
|
+
<SallaConditionalOffer />
|
|
56
|
+
|
|
57
|
+
<HookSlot name="cart:start" />
|
|
58
|
+
|
|
59
|
+
<div className="pt-5 flex flex-col items-start lg:flex-row pb-6 lg:pb-20">
|
|
60
|
+
<div className="main-content w-full lg:w-[calc(100%-384px)]">
|
|
61
|
+
<HookSlot name="cart:items.start" context={{ cartItems: cartData.items }} />
|
|
62
|
+
|
|
63
|
+
{cartData.items.map((item, index) => (
|
|
64
|
+
<CartItem key={item.id} item={item} isFirst={index === 0} />
|
|
65
|
+
))}
|
|
66
|
+
|
|
67
|
+
{cartData.options?.length > 0 && (
|
|
68
|
+
<div className="cart-options">
|
|
69
|
+
{cartData.options.map((option) => (
|
|
70
|
+
<form
|
|
71
|
+
key={option.id}
|
|
72
|
+
className="first:pt-5 relative"
|
|
73
|
+
onChange={(e) => window.salla?.form.onChange('cart.updateItem', e)}
|
|
74
|
+
id={`item-${option.id}`}
|
|
75
|
+
>
|
|
76
|
+
<input type="hidden" name="id" value={option.id} />
|
|
77
|
+
<input type="hidden" name="quantity" value={option.quantity} />
|
|
78
|
+
{/* Twig: {% include 'pages.partials.product.options' with {product:product_option} %} */}
|
|
79
|
+
{option.options && option.options.length > 0 && (
|
|
80
|
+
<SallaProductOptions
|
|
81
|
+
options={JSON.stringify(option.options)}
|
|
82
|
+
productId={option.id}
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
</form>
|
|
86
|
+
))}
|
|
87
|
+
</div>
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
<SallaOffer />
|
|
91
|
+
<HookSlot name="cart:items.end" />
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<CartSummary
|
|
95
|
+
cart={cartData}
|
|
96
|
+
applyCouponEnabled={store.settings?.cart?.apply_coupon_enabled}
|
|
97
|
+
taxAmount={cartData.tax_amount}
|
|
98
|
+
key={cartData.id}
|
|
99
|
+
loyalty={cartData.loyalty}
|
|
100
|
+
gift={cartData.gift}
|
|
101
|
+
loyaltyPoints={loyaltyPoints ?? undefined}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<HookSlot name="cart:end" />
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function CartPage(props: CartPageProps) {
|
|
111
|
+
return <CartPageContent {...props} />;
|
|
112
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HeadDescriptor } from '../../utils/head';
|
|
2
|
+
import { buildHreflangAlternates } from '../../utils/baseHead';
|
|
3
|
+
import { CartPage } from './CartPage';
|
|
4
|
+
import { cartLoader } from './loader';
|
|
5
|
+
import type { CartPageProps } from './types';
|
|
6
|
+
import type { TwilightContext } from '../../twilight/context';
|
|
7
|
+
import { RouteId } from '../../router/route-ids';
|
|
8
|
+
|
|
9
|
+
export { CartPage } from './CartPage';
|
|
10
|
+
export { cartLoader } from './loader';
|
|
11
|
+
export type { CartPageProps } from './types';
|
|
12
|
+
|
|
13
|
+
async function loader(
|
|
14
|
+
_ctx?: { locale?: string },
|
|
15
|
+
extend?: (
|
|
16
|
+
data: CartPageProps,
|
|
17
|
+
ctx: { params: Record<string, never> }
|
|
18
|
+
) => Promise<Record<string, unknown>> | Record<string, unknown>
|
|
19
|
+
): Promise<CartPageProps> {
|
|
20
|
+
const data = cartLoader();
|
|
21
|
+
|
|
22
|
+
if (extend) {
|
|
23
|
+
const extra = extend(data, { params: {} });
|
|
24
|
+
return { ...data, ...(extra instanceof Promise ? {} : extra) } as CartPageProps;
|
|
25
|
+
}
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function head(ctx: TwilightContext, data: CartPageProps): HeadDescriptor {
|
|
30
|
+
const base: HeadDescriptor = {
|
|
31
|
+
title: data.page.title,
|
|
32
|
+
description: data.page.description,
|
|
33
|
+
alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return base;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Cart = { id: RouteId.CART, loader, head, Component: CartPage } as const;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CartPageProps } from './types';
|
|
2
|
+
import { getTwilightContext } from '../../twilight/context';
|
|
3
|
+
import { RouteId } from '../../router/route-ids';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SSR-safe loader that returns only page metadata.
|
|
7
|
+
* Cart data is fetched client-side via React Query since the cart ID
|
|
8
|
+
* lives in localStorage (unavailable during SSR).
|
|
9
|
+
*/
|
|
10
|
+
export function cartLoader(): CartPageProps {
|
|
11
|
+
const i18n = getTwilightContext().i18n;
|
|
12
|
+
return {
|
|
13
|
+
page: { slug: RouteId.CART, title: i18n.t('common.titles.cart') || 'Cart' },
|
|
14
|
+
} as CartPageProps;
|
|
15
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { useDevHomeComponentOverrides } from '../../dev/dev-settings-store';
|
|
3
|
+
import { HookSlot } from '../../hooks';
|
|
4
|
+
import { HomeComponentRenderer, ReorderProducts } from '../../components/home';
|
|
5
|
+
import type { HomePageProps } from './types';
|
|
6
|
+
import { Pulse } from '@salla.sa/twilight-components-react';
|
|
7
|
+
|
|
8
|
+
export const HomeSkeleton = memo(function HomeSkeleton() {
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<div className="s-block container skeleton-block-hero">
|
|
12
|
+
<Pulse className="h-64 sm:h-80 rounded-md" />
|
|
13
|
+
</div>
|
|
14
|
+
<div className="s-block container skeleton-block-products">
|
|
15
|
+
<Pulse className="h-10 w-48 mb-4" />
|
|
16
|
+
<div className="grid grid-cols-2 sm:grid-cols-4 gap-4">
|
|
17
|
+
{[1, 2, 3, 4].map((i) => (
|
|
18
|
+
<Pulse key={i} className="h-56" />
|
|
19
|
+
))}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div className="s-block container skeleton-block-products">
|
|
23
|
+
<Pulse className="h-10 w-48 mb-4" />
|
|
24
|
+
<div className="grid grid-cols-2 sm:grid-cols-4 gap-4">
|
|
25
|
+
{[1, 2, 3, 4].map((i) => (
|
|
26
|
+
<Pulse key={i} className="h-56" />
|
|
27
|
+
))}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const HomePage = memo(function HomePage({ components = [] }: HomePageProps) {
|
|
35
|
+
// Dev-mode only: overlay DevSettingsWidget component-field overrides onto the
|
|
36
|
+
// blocks so edits render live. No-op passthrough in production builds.
|
|
37
|
+
const renderedComponents = useDevHomeComponentOverrides(components);
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<HookSlot name="home:start" />
|
|
41
|
+
<HookSlot name="home:content" />
|
|
42
|
+
{renderedComponents.map((data, index) => (
|
|
43
|
+
// `data.key` is the twilight.json catalog id, shared by every placement
|
|
44
|
+
// of that block. Platform blocks send null. Position is unique.
|
|
45
|
+
<HomeComponentRenderer key={index} data={data} index={index} />
|
|
46
|
+
))}
|
|
47
|
+
<HookSlot name="home:end" />
|
|
48
|
+
<ReorderProducts />
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export { HomePage as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { HeadDescriptor } from '../../utils/head';
|
|
2
|
+
import { buildHreflangAlternates } from '../../utils/baseHead';
|
|
3
|
+
import type { HomeLoaderData } from './loader';
|
|
4
|
+
import { homeLoader } from './loader';
|
|
5
|
+
import type { TwilightContext } from '../../twilight/context';
|
|
6
|
+
import { HomePage } from './HomePage';
|
|
7
|
+
import { RouteId } from '../../router/route-ids';
|
|
8
|
+
|
|
9
|
+
export { HomeSkeleton } from './HomePage';
|
|
10
|
+
export { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';
|
|
11
|
+
export { registerHomeComponentConfig } from '../../components/home';
|
|
12
|
+
export type { HomePageProps } from './types';
|
|
13
|
+
export type { HomeLoaderData } from './loader';
|
|
14
|
+
export type {
|
|
15
|
+
HomeComponentsProps,
|
|
16
|
+
AnyHomeComponent,
|
|
17
|
+
HomeComponentConfig,
|
|
18
|
+
} from '../../components/home';
|
|
19
|
+
|
|
20
|
+
function loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {
|
|
21
|
+
return homeLoader({ locale: _ctx?.locale });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function head(ctx: TwilightContext): HeadDescriptor {
|
|
25
|
+
const store = ctx.settings?.store;
|
|
26
|
+
if (!store) return {};
|
|
27
|
+
|
|
28
|
+
const title = store.meta?.title ?? store.name;
|
|
29
|
+
const description = store.meta?.description ?? store.description;
|
|
30
|
+
const keywords = store.meta?.keywords;
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
title,
|
|
34
|
+
description,
|
|
35
|
+
keywords,
|
|
36
|
+
canonical: store.url,
|
|
37
|
+
openGraph: {
|
|
38
|
+
type: 'website',
|
|
39
|
+
title,
|
|
40
|
+
description,
|
|
41
|
+
images: store.logo,
|
|
42
|
+
url: store.url,
|
|
43
|
+
},
|
|
44
|
+
twitter: {
|
|
45
|
+
card: 'summary_large_image',
|
|
46
|
+
title,
|
|
47
|
+
description,
|
|
48
|
+
images: store.logo,
|
|
49
|
+
},
|
|
50
|
+
alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;
|
|
55
|
+
|
|
56
|
+
export { homeLoader };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getTwilightContext } from '../../twilight/context';
|
|
2
|
+
import { home } from '../../api/home';
|
|
3
|
+
import type { HomeComponentData } from '../../types';
|
|
4
|
+
import { RouteId } from '../../router/route-ids';
|
|
5
|
+
|
|
6
|
+
export interface HomeLoaderData {
|
|
7
|
+
locale: string;
|
|
8
|
+
components: HomeComponentData[];
|
|
9
|
+
page: { slug: string };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {
|
|
13
|
+
const { queryClient } = getTwilightContext();
|
|
14
|
+
const components = await queryClient.ensureQueryData(home.queries.components());
|
|
15
|
+
const result = {
|
|
16
|
+
locale: ctx?.locale || 'ar',
|
|
17
|
+
components: components.map((comp) => ({
|
|
18
|
+
...comp,
|
|
19
|
+
path: comp.path?.replace('home.', '') || comp.path,
|
|
20
|
+
})),
|
|
21
|
+
page: { slug: RouteId.INDEX },
|
|
22
|
+
};
|
|
23
|
+
return result;
|
|
24
|
+
}
|