@salla.sa/twilight-theme-engine 1.0.85 → 1.0.87
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/README.md +4 -3
- package/bin/twilight-check-manifest.mjs +16 -0
- package/dist/{AddToCartForm-B5C2M4OZ.js → AddToCartForm-P644O2QL.js} +4 -4
- package/dist/{AddToCartForm-B5C2M4OZ.js.map → AddToCartForm-P644O2QL.js.map} +1 -1
- package/dist/{BlogAuthorPage-GTF4UGSS.js → BlogAuthorPage-VWSO6MPY.js} +13 -11
- package/dist/BlogAuthorPage-VWSO6MPY.js.map +1 -0
- package/dist/{BlogCategoryPage-TN7Y4NBP.js → BlogCategoryPage-K2KSQ6T6.js} +13 -11
- package/dist/BlogCategoryPage-K2KSQ6T6.js.map +1 -0
- package/dist/{BlogPage-TDB3M3PI.js → BlogPage-XRM7VWOZ.js} +12 -10
- package/dist/BlogPage-XRM7VWOZ.js.map +1 -0
- package/dist/{BlogSinglePage-4A52Q5QW.js → BlogSinglePage-XIAXT54H.js} +12 -10
- package/dist/BlogSinglePage-XIAXT54H.js.map +1 -0
- package/dist/{BlogTagPage-TOVPBETA.js → BlogTagPage-IHOA267V.js} +13 -11
- package/dist/BlogTagPage-IHOA267V.js.map +1 -0
- package/dist/{BrandsPage-VUDGYSQI.js → BrandsPage-ZFEILRT3.js} +12 -10
- package/dist/BrandsPage-ZFEILRT3.js.map +1 -0
- package/dist/{Breadcrumb-CI3SN5YR.js → Breadcrumb-CVSISL2K.js} +12 -10
- package/dist/Breadcrumb-CVSISL2K.js.map +1 -0
- package/dist/{CartItem-BHLEURAB.js → CartItem-EOI7P3JA.js} +12 -10
- package/dist/CartItem-EOI7P3JA.js.map +1 -0
- package/dist/{CartSummary-QERVESYN.js → CartSummary-RZGUBDKJ.js} +12 -10
- package/dist/CartSummary-RZGUBDKJ.js.map +1 -0
- package/dist/{Copyright-RL6ALKRC.js → Copyright-5BLYSP24.js} +4 -4
- package/dist/{Copyright-RL6ALKRC.js.map → Copyright-5BLYSP24.js.map} +1 -1
- package/dist/{CustomerLayout-VRZUWGQK.js → CustomerLayout-6F4BJAMU.js} +12 -10
- package/dist/CustomerLayout-6F4BJAMU.js.map +1 -0
- package/dist/{Footer-ZWBZCMDL.js → Footer-NF2NLDLR.js} +6 -6
- package/dist/{Footer-ZWBZCMDL.js.map → Footer-NF2NLDLR.js.map} +1 -1
- package/dist/{Header-WNK4O66B.js → Header-6DQJ5X7J.js} +9 -7
- package/dist/{Header-WNK4O66B.js.map → Header-6DQJ5X7J.js.map} +1 -1
- package/dist/{LoyaltyPage-CGTHWJ76.js → LoyaltyPage-YHWHIWCS.js} +12 -10
- package/dist/LoyaltyPage-YHWHIWCS.js.map +1 -0
- package/dist/{LoyaltyPointsPage-QSU6K3PW.js → LoyaltyPointsPage-T6K3H5A5.js} +10 -3
- package/dist/LoyaltyPointsPage-T6K3H5A5.js.map +1 -0
- package/dist/{MainMenu-V3T7F32R.js → MainMenu-Y2TAM7DK.js} +4 -4
- package/dist/{MainMenu-V3T7F32R.js.map → MainMenu-Y2TAM7DK.js.map} +1 -1
- package/dist/{MasterLayout-XQF644LD.js → MasterLayout-GBEEFFPG.js} +12 -10
- package/dist/{MasterLayout-XQF644LD.js.map → MasterLayout-GBEEFFPG.js.map} +1 -1
- package/dist/{MobileMenu-U4BVQYKH.js → MobileMenu-RE5XVGZL.js} +12 -10
- package/dist/MobileMenu-RE5XVGZL.js.map +1 -0
- package/dist/{NotificationsPage-ZRRQY7TF.js → NotificationsPage-QAFWZAS3.js} +12 -10
- package/dist/NotificationsPage-QAFWZAS3.js.map +1 -0
- package/dist/{OrderSinglePage-O3XYVMG5.js → OrderSinglePage-T4PRXTKG.js} +12 -10
- package/dist/OrderSinglePage-T4PRXTKG.js.map +1 -0
- package/dist/{OrdersPage-CMXZF5MI.js → OrdersPage-3S6ZS56E.js} +12 -10
- package/dist/OrdersPage-3S6ZS56E.js.map +1 -0
- package/dist/{PageSingle-IIG2US43.js → PageSingle-W3UTXDOW.js} +4 -4
- package/dist/{PageSingle-IIG2US43.js.map → PageSingle-W3UTXDOW.js.map} +1 -1
- package/dist/{ProductDetails-65GDABI7.js → ProductDetails-X5A7TG3F.js} +14 -7
- package/dist/ProductDetails-X5A7TG3F.js.map +1 -0
- package/dist/{ProfilePage-SNJ4WXU4.js → ProfilePage-DUH3AILJ.js} +12 -10
- package/dist/ProfilePage-DUH3AILJ.js.map +1 -0
- package/dist/{ReviewsPage-UT7UT55J.js → ReviewsPage-2C2P7VS3.js} +4 -4
- package/dist/{ReviewsPage-UT7UT55J.js.map → ReviewsPage-2C2P7VS3.js.map} +1 -1
- package/dist/{SeoCartWidget-DBJAXJKT.js → SeoCartWidget-VYLGEW2I.js} +12 -10
- package/dist/SeoCartWidget-VYLGEW2I.js.map +1 -0
- package/dist/{SettingsPage-FLTIOPU5.js → SettingsPage-OZJEW6CW.js} +12 -10
- package/dist/SettingsPage-OZJEW6CW.js.map +1 -0
- package/dist/{StoreClosedNotification-ZT3QKDKS.js → StoreClosedNotification-QHIZBNXO.js} +13 -11
- package/dist/{StoreClosedNotification-ZT3QKDKS.js.map → StoreClosedNotification-QHIZBNXO.js.map} +1 -1
- package/dist/{TestimonialsPage-CU7HKU4O.js → TestimonialsPage-K6WJKKME.js} +4 -4
- package/dist/{TestimonialsPage-CU7HKU4O.js.map → TestimonialsPage-K6WJKKME.js.map} +1 -1
- package/dist/{ThankYouPage-5X6B4X3T.js → ThankYouPage-H6QQEI5R.js} +12 -10
- package/dist/ThankYouPage-H6QQEI5R.js.map +1 -0
- package/dist/{WalletPage-H2BKIDPA.js → WalletPage-G5IBGN6B.js} +12 -10
- package/dist/WalletPage-G5IBGN6B.js.map +1 -0
- package/dist/{WishlistPage-RS5UCIQ3.js → WishlistPage-AIOTAB6L.js} +12 -10
- package/dist/WishlistPage-AIOTAB6L.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-4FJGZQD3.js +6 -0
- package/dist/chunk-4FJGZQD3.js.map +1 -0
- package/dist/{chunk-SDFDS4Q3.js → chunk-BCJTF3V7.js} +20 -4
- package/dist/chunk-BCJTF3V7.js.map +1 -0
- package/dist/chunk-DBW7XXNE.js +103 -0
- package/dist/chunk-DBW7XXNE.js.map +1 -0
- 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-SE5JYWOK.js → chunk-EZHXVHXY.js} +4 -4
- package/dist/{chunk-SE5JYWOK.js.map → chunk-EZHXVHXY.js.map} +1 -1
- package/dist/{chunk-JO7JWV34.js → chunk-FWYKOQV5.js} +5 -5
- package/dist/chunk-FWYKOQV5.js.map +1 -0
- package/dist/{chunk-JRNH3FUF.js → chunk-FYHF62KI.js} +4 -4
- package/dist/{chunk-JRNH3FUF.js.map → chunk-FYHF62KI.js.map} +1 -1
- package/dist/{chunk-UJKFBZFJ.js → chunk-GJ5IMPNY.js} +7 -7
- package/dist/{chunk-UJKFBZFJ.js.map → chunk-GJ5IMPNY.js.map} +1 -1
- package/dist/chunk-IVBOLREE.js +29 -0
- package/dist/chunk-IVBOLREE.js.map +1 -0
- package/dist/chunk-LWPKBVIE.js +14 -0
- package/dist/{chunk-7WAXN2PP.js.map → chunk-LWPKBVIE.js.map} +1 -1
- package/dist/{chunk-SX5MF2YA.js → chunk-N3BCZIGS.js} +4 -4
- package/dist/{chunk-SX5MF2YA.js.map → chunk-N3BCZIGS.js.map} +1 -1
- package/dist/{chunk-NZVR4OF7.js → chunk-NXQZ4RLM.js} +8 -8
- package/dist/chunk-NXQZ4RLM.js.map +1 -0
- package/dist/{chunk-NXQJA7D3.js → chunk-PCURRKIH.js} +3 -3
- package/dist/{chunk-NXQJA7D3.js.map → chunk-PCURRKIH.js.map} +1 -1
- package/dist/{chunk-4CZRUAZB.js → chunk-PU2LHFDQ.js} +10 -11
- package/dist/chunk-PU2LHFDQ.js.map +1 -0
- package/dist/{chunk-OWX2CPNQ.js → chunk-UQIVX4YA.js} +3 -3
- package/dist/{chunk-OWX2CPNQ.js.map → chunk-UQIVX4YA.js.map} +1 -1
- package/dist/chunk-X5NK4TZH.js +228 -0
- package/dist/chunk-X5NK4TZH.js.map +1 -0
- package/dist/{chunk-6SWDSRIL.js → chunk-XKNXYQ2K.js} +6 -6
- package/dist/{chunk-6SWDSRIL.js.map → chunk-XKNXYQ2K.js.map} +1 -1
- package/dist/{chunk-KHBSGD2D.js → chunk-XO7B3VWS.js} +3 -3
- package/dist/{chunk-KHBSGD2D.js.map → chunk-XO7B3VWS.js.map} +1 -1
- package/dist/cli/check-manifest.d.ts +10 -0
- package/dist/cli/check-manifest.d.ts.map +1 -0
- package/dist/cli/check-manifest.js +44 -0
- package/dist/cli/check-manifest.js.map +1 -0
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +2 -2
- package/dist/components/drawer/index.js +10 -8
- package/dist/components/home/index.js +12 -10
- package/dist/components/layout/Footer.d.ts.map +1 -1
- package/dist/components/layout/MasterLayout.d.ts.map +1 -1
- 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 +11 -9
- package/dist/components/store/index.js +12 -10
- package/dist/components/store/index.js.map +1 -1
- package/dist/{document-class-67HTP45G.js → document-class-FRL7JHWD.js} +6 -5
- package/dist/{document-class-67HTP45G.js.map → document-class-FRL7JHWD.js.map} +1 -1
- package/dist/hooks/index.js +10 -8
- package/dist/hooks/useGtm.js +10 -8
- package/dist/hooks/useMoney.js +10 -8
- package/dist/hooks/useStore.js +10 -8
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/{not-found-QTHBFPNT.js → not-found-E6AR4CZ4.js} +12 -10
- package/dist/not-found-E6AR4CZ4.js.map +1 -0
- package/dist/providers/index.js +10 -8
- 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 +14 -12
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home.js +13 -11
- package/dist/routes/loyalty.js +2 -2
- package/dist/routes/page.js +1 -1
- package/dist/routes/product-listing.js +12 -10
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +12 -10
- 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 +13 -11
- 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 +33 -4
- package/dist/tanstack.js.map +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +14 -25
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugins/twilight-manifest.d.ts +23 -0
- package/dist/vite/plugins/twilight-manifest.d.ts.map +1 -1
- package/dist/vite/plugins/twilight-schema.plugin.d.ts.map +1 -1
- package/package.json +16 -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 +341 -0
- package/tailwind/components/layout/Header.tsx.txt +154 -0
- package/tailwind/components/layout/MasterLayout.tsx.txt +62 -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-GTF4UGSS.js.map +0 -1
- package/dist/BlogCategoryPage-TN7Y4NBP.js.map +0 -1
- package/dist/BlogPage-TDB3M3PI.js.map +0 -1
- package/dist/BlogSinglePage-4A52Q5QW.js.map +0 -1
- package/dist/BlogTagPage-TOVPBETA.js.map +0 -1
- package/dist/BrandsPage-VUDGYSQI.js.map +0 -1
- package/dist/Breadcrumb-CI3SN5YR.js.map +0 -1
- package/dist/CartItem-BHLEURAB.js.map +0 -1
- package/dist/CartSummary-QERVESYN.js.map +0 -1
- package/dist/CustomerLayout-VRZUWGQK.js.map +0 -1
- package/dist/LoyaltyPage-CGTHWJ76.js.map +0 -1
- package/dist/LoyaltyPointsPage-QSU6K3PW.js.map +0 -1
- package/dist/MobileMenu-U4BVQYKH.js.map +0 -1
- package/dist/NotificationsPage-ZRRQY7TF.js.map +0 -1
- package/dist/OrderSinglePage-O3XYVMG5.js.map +0 -1
- package/dist/OrdersPage-CMXZF5MI.js.map +0 -1
- package/dist/ProductDetails-65GDABI7.js.map +0 -1
- package/dist/ProfilePage-SNJ4WXU4.js.map +0 -1
- package/dist/SeoCartWidget-DBJAXJKT.js.map +0 -1
- package/dist/SettingsPage-FLTIOPU5.js.map +0 -1
- package/dist/ThankYouPage-5X6B4X3T.js.map +0 -1
- package/dist/WalletPage-H2BKIDPA.js.map +0 -1
- package/dist/WishlistPage-RS5UCIQ3.js.map +0 -1
- package/dist/chunk-4CZRUAZB.js.map +0 -1
- package/dist/chunk-7WAXN2PP.js +0 -14
- package/dist/chunk-JO7JWV34.js.map +0 -1
- package/dist/chunk-NZVR4OF7.js.map +0 -1
- package/dist/chunk-SDFDS4Q3.js.map +0 -1
- package/dist/not-found-QTHBFPNT.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drawer Component System
|
|
3
|
+
*
|
|
4
|
+
* A slide-in panel for mobile navigation and side content.
|
|
5
|
+
* Eager-loaded because it uses compound component pattern (Drawer.Header, Drawer.Body).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { Drawer } from '@salla.sa/twilight-theme-engine/components/drawer';
|
|
10
|
+
*
|
|
11
|
+
* function MobileNav() {
|
|
12
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
13
|
+
*
|
|
14
|
+
* return (
|
|
15
|
+
* <>
|
|
16
|
+
* <button onClick={() => setIsOpen(true)}>☰ Menu</button>
|
|
17
|
+
* <Drawer isOpen={isOpen} onClose={() => setIsOpen(false)} position="left">
|
|
18
|
+
* <Drawer.Header onClose={() => setIsOpen(false)}>Menu</Drawer.Header>
|
|
19
|
+
* <Drawer.Body>
|
|
20
|
+
* <nav className="space-y-2">
|
|
21
|
+
* <a href="/" className="block py-2">Home</a>
|
|
22
|
+
* <a href="/products" className="block py-2">Products</a>
|
|
23
|
+
* </nav>
|
|
24
|
+
* </Drawer.Body>
|
|
25
|
+
* </Drawer>
|
|
26
|
+
* </>
|
|
27
|
+
* );
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
Drawer,
|
|
34
|
+
type DrawerProps,
|
|
35
|
+
type DrawerHeaderProps,
|
|
36
|
+
type DrawerBodyProps,
|
|
37
|
+
type DrawerFooterProps,
|
|
38
|
+
} from './Drawer';
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dropdown Component
|
|
3
|
+
*
|
|
4
|
+
* A controlled dropdown menu with keyboard navigation and click-away support.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* function UserMenu() {
|
|
9
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
10
|
+
*
|
|
11
|
+
* return (
|
|
12
|
+
* <Dropdown isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
13
|
+
* <Dropdown.Trigger onClick={() => setIsOpen(!isOpen)}>
|
|
14
|
+
* <button>Account ▼</button>
|
|
15
|
+
* </Dropdown.Trigger>
|
|
16
|
+
* <Dropdown.Menu>
|
|
17
|
+
* <Dropdown.Item href="/profile">Profile</Dropdown.Item>
|
|
18
|
+
* <Dropdown.Item href="/orders">Orders</Dropdown.Item>
|
|
19
|
+
* <Dropdown.Item onClick={handleLogout}>Logout</Dropdown.Item>
|
|
20
|
+
* </Dropdown.Menu>
|
|
21
|
+
* </Dropdown>
|
|
22
|
+
* );
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { type ReactNode, type HTMLAttributes } from 'react';
|
|
28
|
+
import { useClickAway } from '@uidotdev/usehooks';
|
|
29
|
+
|
|
30
|
+
export interface DropdownProps {
|
|
31
|
+
isOpen: boolean;
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Position of the dropdown menu
|
|
36
|
+
* @default 'bottom-start'
|
|
37
|
+
*/
|
|
38
|
+
position?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
|
|
39
|
+
/**
|
|
40
|
+
* Additional className for the dropdown container
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const positionClasses = {
|
|
46
|
+
'bottom-start': 'top-full start-0',
|
|
47
|
+
'bottom-end': 'top-full end-0',
|
|
48
|
+
'top-start': 'bottom-full start-0',
|
|
49
|
+
'top-end': 'bottom-full end-0',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export function Dropdown({ isOpen, onClose, children, className }: DropdownProps) {
|
|
53
|
+
// useClickAway returns a ref that we attach to the container
|
|
54
|
+
// It calls the callback when clicking outside the element
|
|
55
|
+
const dropdownRef = useClickAway<HTMLDivElement>(() => {
|
|
56
|
+
if (isOpen) {
|
|
57
|
+
onClose();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div ref={dropdownRef} className={`relative inline-block ${className || ''}`}>
|
|
63
|
+
{children}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Trigger Component
|
|
69
|
+
export interface DropdownTriggerProps extends HTMLAttributes<HTMLDivElement> {
|
|
70
|
+
children: ReactNode;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Dropdown.Trigger = function DropdownTrigger({
|
|
74
|
+
children,
|
|
75
|
+
className,
|
|
76
|
+
...props
|
|
77
|
+
}: DropdownTriggerProps) {
|
|
78
|
+
return (
|
|
79
|
+
<div className={`inline-block ${className || ''}`} {...props}>
|
|
80
|
+
{children}
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Menu Component
|
|
86
|
+
export interface DropdownMenuProps extends HTMLAttributes<HTMLUListElement> {
|
|
87
|
+
children: ReactNode;
|
|
88
|
+
isOpen?: boolean;
|
|
89
|
+
position?: DropdownProps['position'];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
Dropdown.Menu = function DropdownMenu({
|
|
93
|
+
children,
|
|
94
|
+
isOpen = false,
|
|
95
|
+
position = 'bottom-start',
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}: DropdownMenuProps) {
|
|
99
|
+
if (!isOpen) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<ul
|
|
105
|
+
className={`absolute z-40 mt-1 min-w-[10rem] rounded-lg bg-white py-1 shadow-lg ring-1 ring-black/5 animate-in fade-in slide-in-from-top-1 duration-100 ${positionClasses[position]} ${className || ''}`}
|
|
106
|
+
role="menu"
|
|
107
|
+
{...props}
|
|
108
|
+
>
|
|
109
|
+
{children}
|
|
110
|
+
</ul>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Item Component
|
|
115
|
+
export interface DropdownItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
116
|
+
children: ReactNode;
|
|
117
|
+
href?: string;
|
|
118
|
+
onClick?: () => void;
|
|
119
|
+
disabled?: boolean;
|
|
120
|
+
active?: boolean;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
Dropdown.Item = function DropdownItem({
|
|
124
|
+
children,
|
|
125
|
+
href,
|
|
126
|
+
onClick,
|
|
127
|
+
disabled = false,
|
|
128
|
+
active = false,
|
|
129
|
+
className,
|
|
130
|
+
...props
|
|
131
|
+
}: DropdownItemProps) {
|
|
132
|
+
const classes = `flex cursor-pointer items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 ${active ? 'bg-gray-100 text-gray-900' : ''} ${disabled ? 'cursor-not-allowed opacity-50 hover:bg-transparent' : ''} ${className || ''}`;
|
|
133
|
+
|
|
134
|
+
if (href) {
|
|
135
|
+
return (
|
|
136
|
+
<li role="menuitem" {...props}>
|
|
137
|
+
<a href={href} className={classes}>
|
|
138
|
+
{children}
|
|
139
|
+
</a>
|
|
140
|
+
</li>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<li
|
|
146
|
+
role="menuitem"
|
|
147
|
+
onClick={disabled ? undefined : onClick}
|
|
148
|
+
onKeyDown={(e) => {
|
|
149
|
+
if (!disabled && (e.key === 'Enter' || e.key === ' ')) {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
onClick?.();
|
|
152
|
+
}
|
|
153
|
+
}}
|
|
154
|
+
tabIndex={disabled ? -1 : 0}
|
|
155
|
+
className={classes}
|
|
156
|
+
{...props}
|
|
157
|
+
>
|
|
158
|
+
{children}
|
|
159
|
+
</li>
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// Divider Component
|
|
164
|
+
Dropdown.Divider = function DropdownDivider({ className }: HTMLAttributes<HTMLLIElement>) {
|
|
165
|
+
return <li className={`my-1 h-px bg-gray-200 ${className || ''}`} />;
|
|
166
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dropdown Component System
|
|
3
|
+
*
|
|
4
|
+
* A controlled dropdown menu with keyboard navigation.
|
|
5
|
+
* Eager-loaded because it uses compound component pattern (Dropdown.Trigger, Dropdown.Menu).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { Dropdown } from '@salla.sa/twilight-theme-engine/components/dropdown';
|
|
10
|
+
*
|
|
11
|
+
* function SortDropdown() {
|
|
12
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
13
|
+
* const [sort, setSort] = useState('newest');
|
|
14
|
+
*
|
|
15
|
+
* return (
|
|
16
|
+
* <Dropdown isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
17
|
+
* <Dropdown.Trigger onClick={() => setIsOpen(!isOpen)}>
|
|
18
|
+
* <button>Sort: {sort}</button>
|
|
19
|
+
* </Dropdown.Trigger>
|
|
20
|
+
* <Dropdown.Menu isOpen={isOpen}>
|
|
21
|
+
* <Dropdown.Item onClick={() => { setSort('newest'); setIsOpen(false); }}>
|
|
22
|
+
* Newest
|
|
23
|
+
* </Dropdown.Item>
|
|
24
|
+
* <Dropdown.Item onClick={() => { setSort('price-asc'); setIsOpen(false); }}>
|
|
25
|
+
* Price: Low to High
|
|
26
|
+
* </Dropdown.Item>
|
|
27
|
+
* </Dropdown.Menu>
|
|
28
|
+
* </Dropdown>
|
|
29
|
+
* );
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
Dropdown,
|
|
36
|
+
type DropdownProps,
|
|
37
|
+
type DropdownTriggerProps,
|
|
38
|
+
type DropdownMenuProps,
|
|
39
|
+
type DropdownItemProps,
|
|
40
|
+
} from './Dropdown';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { memo, useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface BundleComponentProps {
|
|
4
|
+
data: {
|
|
5
|
+
component_name: string;
|
|
6
|
+
bundle_id: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const BundleComponent = memo(function BundleComponent(props: BundleComponentProps) {
|
|
12
|
+
const [mounted, setMounted] = useState(false);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setMounted(true);
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
18
|
+
if (!mounted) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { component_name: componentName, bundle_id: bundleId, ...rest } = props.data;
|
|
23
|
+
const config = JSON.stringify(rest);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<salla-custom-component
|
|
28
|
+
component-name={componentName}
|
|
29
|
+
bundle-id={bundleId}
|
|
30
|
+
config={config}
|
|
31
|
+
suppressHydrationWarning
|
|
32
|
+
/>
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Component, type ReactNode, type ErrorInfo } from 'react';
|
|
2
|
+
import { TwilightContext } from '../../providers/twilight-context';
|
|
3
|
+
import type { TwilightContextValue } from '../../types/twilight';
|
|
4
|
+
import type { HomeComponentData } from '../../types';
|
|
5
|
+
|
|
6
|
+
interface ComponentErrorBoundaryProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
data: HomeComponentData;
|
|
9
|
+
position: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ComponentErrorBoundaryState {
|
|
13
|
+
hasError: boolean;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function DevelopmentErrorCard({ error, data }: { error: Error; data: HomeComponentData }) {
|
|
18
|
+
return (
|
|
19
|
+
<section
|
|
20
|
+
dir="ltr"
|
|
21
|
+
className="s-block container overflow-hidden bg-red-50 border border-red-300 p-4"
|
|
22
|
+
>
|
|
23
|
+
<p className="text-red-800 text-sm font-bold">Home Component Error: {data.path}</p>
|
|
24
|
+
<p className="text-red-700 text-sm mt-2">{error.message}</p>
|
|
25
|
+
<details className="mt-2">
|
|
26
|
+
<summary className="text-xs cursor-pointer text-red-600">Stack Trace</summary>
|
|
27
|
+
<pre className="text-xs mt-1 overflow-auto max-h-32 text-red-700">{error.stack}</pre>
|
|
28
|
+
</details>
|
|
29
|
+
<details className="mt-2">
|
|
30
|
+
<summary className="text-xs cursor-pointer text-red-600">Component Data</summary>
|
|
31
|
+
<pre className="text-xs mt-1 overflow-auto max-h-32 text-red-700">
|
|
32
|
+
{JSON.stringify(data, null, 2)}
|
|
33
|
+
</pre>
|
|
34
|
+
</details>
|
|
35
|
+
</section>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class ComponentErrorBoundary extends Component<
|
|
40
|
+
ComponentErrorBoundaryProps,
|
|
41
|
+
ComponentErrorBoundaryState
|
|
42
|
+
> {
|
|
43
|
+
static contextType = TwilightContext;
|
|
44
|
+
|
|
45
|
+
declare context: TwilightContextValue | null;
|
|
46
|
+
|
|
47
|
+
constructor(props: ComponentErrorBoundaryProps) {
|
|
48
|
+
super(props);
|
|
49
|
+
this.state = { hasError: false, error: null };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static getDerivedStateFromError(error: Error): ComponentErrorBoundaryState {
|
|
53
|
+
return { hasError: true, error };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Blocks are keyed by position, so a replacement block at the same position reuses
|
|
57
|
+
// this boundary. An error belongs to the block that threw it, not the position.
|
|
58
|
+
componentDidUpdate(prevProps: ComponentErrorBoundaryProps): void {
|
|
59
|
+
if (this.state.hasError && prevProps.data !== this.props.data) {
|
|
60
|
+
this.setState({ hasError: false, error: null });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
|
|
65
|
+
if (!this.context) {
|
|
66
|
+
console.error('[ComponentErrorBoundary] Must be used within TwilightProvider');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const { log } = this.context;
|
|
70
|
+
const { data, position } = this.props;
|
|
71
|
+
|
|
72
|
+
log.groupCollapsed(`HomeComponent Error: ${data.path || 'unknown'}`);
|
|
73
|
+
log.error('ERROR', error.message);
|
|
74
|
+
log.label('COMPONENT', data.path || 'unknown');
|
|
75
|
+
log.label('POSITION', position);
|
|
76
|
+
log.label('URL', typeof window !== 'undefined' ? window.location.href : 'SSR');
|
|
77
|
+
log.label('TIME', new Date().toISOString());
|
|
78
|
+
log.trace('STACK TRACE', error.stack || '');
|
|
79
|
+
log.trace('COMPONENT STACK', errorInfo.componentStack || '');
|
|
80
|
+
log.dir('COMPONENT DATA', data);
|
|
81
|
+
log.groupEnd();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
render(): ReactNode {
|
|
85
|
+
const { hasError, error } = this.state;
|
|
86
|
+
const { children, data } = this.props;
|
|
87
|
+
|
|
88
|
+
if (hasError && error) {
|
|
89
|
+
if (process.env.NODE_ENV === 'production') {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return <DevelopmentErrorCard error={error} data={data} />;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return children;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { memo, useState, useCallback } from 'react';
|
|
2
|
+
import { SallaButton } from '@salla.sa/twilight-components-react/button';
|
|
3
|
+
import type { Product } from '../../types';
|
|
4
|
+
|
|
5
|
+
interface SectionItem {
|
|
6
|
+
title?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
products?: Product[];
|
|
11
|
+
limit?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface MainProduct {
|
|
15
|
+
id?: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
product?: Product;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FeaturedProductsStyle1Props {
|
|
22
|
+
data: {
|
|
23
|
+
items: SectionItem[];
|
|
24
|
+
main_product?: MainProduct;
|
|
25
|
+
position?: number;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const FeaturedProductsStyle1 = memo(function FeaturedProductsStyle1({
|
|
31
|
+
data,
|
|
32
|
+
}: FeaturedProductsStyle1Props) {
|
|
33
|
+
const items = data.items || [];
|
|
34
|
+
const mainProduct = data.main_product;
|
|
35
|
+
|
|
36
|
+
const [activeTab, setActiveTab] = useState<string>(items[0]?.id || '');
|
|
37
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
38
|
+
|
|
39
|
+
const handleTabClick = useCallback(
|
|
40
|
+
(tabId: string) => {
|
|
41
|
+
if (tabId === activeTab) return;
|
|
42
|
+
setIsAnimating(true);
|
|
43
|
+
setActiveTab(tabId);
|
|
44
|
+
setTimeout(() => setIsAnimating(false), 100);
|
|
45
|
+
},
|
|
46
|
+
[activeTab]
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if (!items.length) return null;
|
|
50
|
+
|
|
51
|
+
const hasMultipleSections = items.length > 1;
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<div className="s-block__title">
|
|
56
|
+
<div className="right-side">
|
|
57
|
+
<h2>{mainProduct?.title}</h2>
|
|
58
|
+
</div>
|
|
59
|
+
{hasMultipleSections && (
|
|
60
|
+
<div className="tabs hide-scroll hidden lg:flex">
|
|
61
|
+
{items.map((section) => (
|
|
62
|
+
<SallaButton
|
|
63
|
+
key={section.id}
|
|
64
|
+
shape="link"
|
|
65
|
+
onClick={() => handleTabClick(section.id || '')}
|
|
66
|
+
className={`tab-trigger ${activeTab === section.id ? 'is-active' : ''}`}
|
|
67
|
+
>
|
|
68
|
+
{section.title || section.name}
|
|
69
|
+
</SallaButton>
|
|
70
|
+
))}
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div className={`grid grid-cols-1 gap-8 ${mainProduct?.product ? 'lg:grid-cols-2' : ''}`}>
|
|
76
|
+
{mainProduct?.product && (
|
|
77
|
+
<div className="flex flex-col">
|
|
78
|
+
<custom-salla-product-card
|
|
79
|
+
shadow-on-hover
|
|
80
|
+
product={JSON.stringify(mainProduct.product)}
|
|
81
|
+
isSpecial
|
|
82
|
+
></custom-salla-product-card>
|
|
83
|
+
</div>
|
|
84
|
+
)}
|
|
85
|
+
<div className="flex flex-col">
|
|
86
|
+
{hasMultipleSections && (
|
|
87
|
+
<div className="tabs mb-4 sm:mb-8 hide-scroll lg:hidden">
|
|
88
|
+
{items.map((section) => (
|
|
89
|
+
<SallaButton
|
|
90
|
+
key={section.id}
|
|
91
|
+
shape="link"
|
|
92
|
+
onClick={() => handleTabClick(section.id || '')}
|
|
93
|
+
className={`tab-trigger ${activeTab === section.id ? 'is-active' : ''}`}
|
|
94
|
+
>
|
|
95
|
+
{section.title || section.name}
|
|
96
|
+
</SallaButton>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
<div className="tabs-wrapper flex flex-1">
|
|
102
|
+
{items.map((section) => {
|
|
103
|
+
const isActive = activeTab === section.id;
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
key={section.id}
|
|
107
|
+
className={`tabs__item grid-cols-2 ${mainProduct?.product ? '' : 'lg:grid-cols-4'} ${isActive ? 'is-active' : ''} ${isAnimating && isActive ? 'opacity-0 translate-y-3' : ''} ${!isAnimating && isActive ? 'opacity-100 translate-y-0' : ''}`}
|
|
108
|
+
>
|
|
109
|
+
{section.products
|
|
110
|
+
?.slice(0, mainProduct?.product ? 4 : 8)
|
|
111
|
+
.map((product, productIndex) => (
|
|
112
|
+
<custom-salla-product-card
|
|
113
|
+
key={product.id || productIndex}
|
|
114
|
+
product={JSON.stringify(product)}
|
|
115
|
+
></custom-salla-product-card>
|
|
116
|
+
))}
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
})}
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</>
|
|
124
|
+
);
|
|
125
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { memo, useState, useCallback } from 'react';
|
|
2
|
+
import { SallaButton } from '@salla.sa/twilight-components-react/button';
|
|
3
|
+
import { SallaProductsList } from '@salla.sa/twilight-components-react';
|
|
4
|
+
import { SallaProductsSlider } from '@salla.sa/twilight-components-react';
|
|
5
|
+
import { product, ProductsListSource } from '../../api/product';
|
|
6
|
+
import { ProductCard } from '../../components/product';
|
|
7
|
+
|
|
8
|
+
interface ProductSource {
|
|
9
|
+
source: ProductsListSource;
|
|
10
|
+
limit?: number;
|
|
11
|
+
source_value?: number | number[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface SectionItem {
|
|
15
|
+
title?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
id?: string;
|
|
19
|
+
products: ProductSource;
|
|
20
|
+
limit?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FeaturedProductsStyle2Props {
|
|
24
|
+
data: {
|
|
25
|
+
items: SectionItem[];
|
|
26
|
+
position?: number;
|
|
27
|
+
is_slider?: boolean;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const FeaturedProductsStyle2 = memo(function FeaturedProductsStyle2({
|
|
33
|
+
data,
|
|
34
|
+
}: FeaturedProductsStyle2Props) {
|
|
35
|
+
const items = data.items || [];
|
|
36
|
+
const isSlider = data.is_slider ?? true;
|
|
37
|
+
|
|
38
|
+
const [activeTab, setActiveTab] = useState<string>(items[0]?.id || '');
|
|
39
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
40
|
+
|
|
41
|
+
const handleTabClick = useCallback(
|
|
42
|
+
(tabId: string) => {
|
|
43
|
+
if (tabId === activeTab) return;
|
|
44
|
+
setIsAnimating(true);
|
|
45
|
+
setActiveTab(tabId);
|
|
46
|
+
setTimeout(() => setIsAnimating(false), 100);
|
|
47
|
+
},
|
|
48
|
+
[activeTab]
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const loader = useCallback(
|
|
52
|
+
(source: ProductsListSource, value?: number | number[], limit?: number) => {
|
|
53
|
+
return () =>
|
|
54
|
+
product.list({
|
|
55
|
+
source: source,
|
|
56
|
+
sourceValue: value,
|
|
57
|
+
perPage: limit,
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
[]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (!items.length) return null;
|
|
64
|
+
|
|
65
|
+
const hasMultipleSections = items.length > 1;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<>
|
|
69
|
+
<div className="container">
|
|
70
|
+
{hasMultipleSections && (
|
|
71
|
+
<div className="tabs hide-scroll">
|
|
72
|
+
{items.map((section) => (
|
|
73
|
+
<SallaButton
|
|
74
|
+
key={section.id}
|
|
75
|
+
fill="outline"
|
|
76
|
+
onClick={() => handleTabClick(section.id || '')}
|
|
77
|
+
className={`tab-trigger ${activeTab === section.id ? 'is-active' : ''}`}
|
|
78
|
+
>
|
|
79
|
+
{section.title || section.name}
|
|
80
|
+
</SallaButton>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
<div className="tabs-wrapper">
|
|
86
|
+
{items.map((section) => {
|
|
87
|
+
const isActive = activeTab === section.id;
|
|
88
|
+
return (
|
|
89
|
+
<div
|
|
90
|
+
key={section.id}
|
|
91
|
+
className={`tabs__item ${isActive ? 'is-active' : ''} ${isAnimating && isActive ? 'opacity-0 translate-y-3' : ''} ${!isAnimating && isActive ? 'opacity-100 translate-y-0' : ''}`}
|
|
92
|
+
>
|
|
93
|
+
{isSlider ? (
|
|
94
|
+
<SallaProductsSlider
|
|
95
|
+
loader={loader(
|
|
96
|
+
section.products.source,
|
|
97
|
+
section.products?.source_value,
|
|
98
|
+
section.products?.limit
|
|
99
|
+
)}
|
|
100
|
+
sliderProps={{ id: `section-${section.id}-slider` }}
|
|
101
|
+
>
|
|
102
|
+
{(product) => (
|
|
103
|
+
<ProductCard className="s-products-slider-card" product={product} />
|
|
104
|
+
)}
|
|
105
|
+
</SallaProductsSlider>
|
|
106
|
+
) : (
|
|
107
|
+
<SallaProductsList
|
|
108
|
+
loader={loader(
|
|
109
|
+
section.products.source,
|
|
110
|
+
section.products?.source_value,
|
|
111
|
+
section.products?.limit
|
|
112
|
+
)}
|
|
113
|
+
itemsClassName="s-products-list-horizontal-cards"
|
|
114
|
+
>
|
|
115
|
+
{(products) =>
|
|
116
|
+
products.map((product) => <ProductCard key={product.id} product={product} />)
|
|
117
|
+
}
|
|
118
|
+
</SallaProductsList>
|
|
119
|
+
)}
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
})}
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</>
|
|
126
|
+
);
|
|
127
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { ProductCard } from '../product/ProductCard';
|
|
3
|
+
import type { Product } from '../../types';
|
|
4
|
+
|
|
5
|
+
interface SectionItem {
|
|
6
|
+
title?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
products?: Product[];
|
|
10
|
+
featured_product?: Product;
|
|
11
|
+
limit?: number;
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface FeaturedProductsStyle3Props {
|
|
16
|
+
data: {
|
|
17
|
+
items: SectionItem[];
|
|
18
|
+
position?: number;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const FeaturedProductsStyle3 = memo(function FeaturedProductsStyle3({
|
|
24
|
+
data,
|
|
25
|
+
}: FeaturedProductsStyle3Props) {
|
|
26
|
+
const items = data.items || [];
|
|
27
|
+
|
|
28
|
+
if (!items.length) return null;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<div className="inner">
|
|
33
|
+
{items.map((section, sectionIndex) => (
|
|
34
|
+
<div key={section.id || sectionIndex}>
|
|
35
|
+
<div className="s-block__title">
|
|
36
|
+
<h2>{section.title}</h2>
|
|
37
|
+
</div>
|
|
38
|
+
<div className="flex-1 grid lg:grid-cols-2 gap-4 sm:gap-8">
|
|
39
|
+
{section.featured_product ? (
|
|
40
|
+
<>
|
|
41
|
+
<ProductCard product={section.featured_product} layout="fullImage" withShadow />
|
|
42
|
+
<div className="grid gap-4 sm:gap-8">
|
|
43
|
+
{section.products?.slice(0, 3).map((product, idx) => (
|
|
44
|
+
<ProductCard
|
|
45
|
+
key={product.id}
|
|
46
|
+
product={product}
|
|
47
|
+
layout="minimal"
|
|
48
|
+
withShadow
|
|
49
|
+
index={idx}
|
|
50
|
+
/>
|
|
51
|
+
))}
|
|
52
|
+
</div>
|
|
53
|
+
</>
|
|
54
|
+
) : (
|
|
55
|
+
section.products?.map((product, idx) => (
|
|
56
|
+
<ProductCard
|
|
57
|
+
key={product.id}
|
|
58
|
+
product={product}
|
|
59
|
+
layout="minimal"
|
|
60
|
+
withShadow
|
|
61
|
+
index={idx}
|
|
62
|
+
/>
|
|
63
|
+
))
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
});
|