@evenicanpm/storefront-core 1.0.2 → 1.0.4
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/docs.tsconfig.json +35 -0
- package/package.json +6 -3
- package/src/api-manager/README.md +30 -22
- package/src/api-manager/datasources/e4/{e4-address.datasource.ts → address/e4-address.datasource.ts} +10 -10
- package/src/api-manager/datasources/e4/address/e4-address.remaps.ts +70 -0
- package/src/api-manager/datasources/e4/address/e4-address.translator.ts +98 -0
- package/src/api-manager/datasources/e4/{e4-cart.datasource.ts → cart/e4-cart.datasource.ts} +17 -16
- package/src/api-manager/datasources/e4/cart/e4-cart.remaps.ts +94 -0
- package/src/api-manager/datasources/e4/cart/e4-cart.translator.ts +23 -0
- package/src/api-manager/datasources/e4/categories/e4-categories.datasource.ts +38 -0
- package/src/api-manager/datasources/e4/categories/e4-categories.translator.ts +161 -0
- package/src/api-manager/datasources/e4/e4.datasource.ts +8 -39
- package/src/api-manager/datasources/e4/{e4-order.datasource.ts → order/e4-order.datasource.ts} +3 -3
- package/src/api-manager/datasources/e4/order/e4-order.remaps.ts +101 -0
- package/src/api-manager/datasources/e4/{e4-organization.datasource.ts → organization/e4-organization.datasource.ts} +1 -1
- package/src/api-manager/datasources/e4/{e4-product.datasource.ts → product/e4-product.datasource.ts} +13 -11
- package/src/api-manager/datasources/e4/product/e4-product.remaps.ts +88 -0
- package/src/api-manager/datasources/e4/{e4.translator.ts → product/e4-product.translator.ts} +9 -329
- package/src/api-manager/datasources/e4/{e4-session.datasource.ts → session/e4-session.datasource.ts} +3 -3
- package/src/api-manager/datasources/e4/session/e4-session.translator.ts +18 -0
- package/src/api-manager/datasources/e4/user/e4-user.datasource.ts +13 -6
- package/src/api-manager/datasources/e4/user/e4-user.remaps.ts +49 -0
- package/src/api-manager/datasources/e4/user/e4-user.translator.ts +23 -2
- package/src/api-manager/datasources/e4/utils/unwrap-e4-variants.ts +1 -1
- package/src/api-manager/index.ts +11 -6
- package/src/api-manager/schemas/product.schema.ts +0 -1
- package/src/api-manager/schemas/user.schema.ts +3 -1
- package/src/api-manager/services/cart/mutations/add-to-cart.ts +1 -1
- package/src/api-manager/services/cart/mutations/checkout.ts +1 -2
- package/src/api-manager/services/create-query.ts +10 -0
- package/src/api-manager/services/product/queries/get-product-availability.ts +1 -1
- package/src/api-manager/services/product/server/product.server.ts +4 -1
- package/src/api-manager/services/user/mutations/add-to-wishlist.ts +23 -3
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +23 -0
- package/src/api-manager/types/Datasource.ts +1 -5
- package/src/cms/blocks/BlockManager.tsx +67 -0
- package/src/cms/blocks/Components/BrandLogosScroller.tsx +72 -0
- package/src/cms/blocks/Components/CategoryCard.tsx +47 -0
- package/src/cms/blocks/Components/CategoryCarousel/index.tsx +59 -0
- package/src/cms/blocks/Components/FeaturePill.tsx +99 -0
- package/src/cms/blocks/Components/FeaturedCategories.tsx +41 -0
- package/src/cms/blocks/Components/FeaturedProducts.tsx +41 -0
- package/src/cms/blocks/Components/Footer/data/index.ts +32 -0
- package/src/cms/blocks/Components/Footer/index.tsx +88 -0
- package/src/cms/blocks/Components/Footer/interfaces.ts +37 -0
- package/src/cms/blocks/Components/Footer/sections/FooterAppStore.tsx +45 -0
- package/src/cms/blocks/Components/Footer/sections/FooterContact.tsx +36 -0
- package/src/cms/blocks/Components/Footer/sections/FooterLinks.tsx +30 -0
- package/src/cms/blocks/Components/Footer/sections/FooterLogo.tsx +26 -0
- package/src/cms/blocks/Components/Footer/sections/FooterSocialLinks.tsx +70 -0
- package/src/cms/blocks/Components/Footer/styles/index.ts +39 -0
- package/src/cms/blocks/Components/Footer.tsx +77 -0
- package/src/cms/blocks/Components/Hero.tsx +73 -0
- package/src/cms/blocks/Components/HeroCarousel/index.tsx +48 -0
- package/src/cms/blocks/Components/Image.tsx +39 -0
- package/src/cms/blocks/Components/MediaCard.tsx +41 -0
- package/src/cms/blocks/Components/ProductCarousel/index.tsx +88 -0
- package/src/cms/blocks/Components/ProductSectionFullWidth/index.tsx +107 -0
- package/src/cms/blocks/Components/RichText.tsx +19 -0
- package/src/cms/blocks/Components/Seo/index.tsx +48 -0
- package/src/cms/blocks/Components/Services/index.tsx +21 -0
- package/src/cms/blocks/Components/Services/service-card.tsx +73 -0
- package/src/cms/blocks/Components/shared/featured-product-card.tsx +29 -0
- package/src/cms/blocks/Components/shared/product-category-item.tsx +49 -0
- package/src/cms/blocks/Components/shared/product-grid.tsx +63 -0
- package/src/cms/blocks/Components/shared/top-categories-card.tsx +66 -0
- package/src/cms/blocks/Components/shared/top-rating-product-card.tsx +66 -0
- package/src/cms/blocks/Icons/Components/Category.tsx +14 -0
- package/src/cms/blocks/Icons/Components/DottedStar.tsx +40 -0
- package/src/cms/blocks/Icons/Components/FallbackIcon.tsx +33 -0
- package/src/cms/blocks/Icons/Components/GiftBox.tsx +18 -0
- package/src/cms/blocks/Icons/Components/Light.tsx +13 -0
- package/src/cms/blocks/Icons/Components/NewArrival.tsx +18 -0
- package/src/cms/blocks/Icons/Components/RankBadge.tsx +39 -0
- package/src/cms/blocks/Icons/index.ts +32 -0
- package/src/cms/blocks/index.tsx +16 -0
- package/src/cms/blocks/interfaces.ts +240 -0
- package/src/components/Notifications/README.md +1 -1
- package/src/components/Notifications/notification-context.tsx +1 -1
- package/src/components/README.md +3 -8
- package/src/components/_components/MiniCartClient.tsx +1 -1
- package/src/components/_components/navbar/category-based-menu/components/categories.tsx +1 -1
- package/src/components/_components/navbar/mega-menu/mega-menu.tsx +1 -1
- package/src/components/_components/navbar/nav-list/nav-item-child.tsx +2 -2
- package/src/components/_components/product-cards/product-card-1/product-card-1-wrapper.tsx +1 -1
- package/src/components/_components/products-view/product-view-dialog.tsx +1 -1
- package/src/components/_components/settings/setting.tsx +1 -1
- package/src/components/_components/wishlist/add-to-wishlist-dialog.tsx +2 -2
- package/src/components/_components/wishlist/components/create-new-list.tsx +1 -1
- package/src/components/_components/wishlist/remove-from-wishlist-dialog.tsx +2 -2
- package/src/components/_components/wishlist-modal/add-to-wishlist-dialog.tsx +2 -2
- package/src/components/_components/wishlist-modal/remove-from-wishlist-dialog.tsx +2 -2
- package/src/components/countries-input.tsx +0 -1
- package/src/components-v2/BazaarCard.tsx +21 -0
- package/src/components-v2/BazaarImage.tsx +12 -0
- package/src/components-v2/BazaarMenu.tsx +47 -0
- package/src/components-v2/BazaarSwitch.tsx +37 -0
- package/src/components-v2/BazaarTextField.tsx +73 -0
- package/src/components-v2/BoxShadowCard.tsx +16 -0
- package/src/components-v2/DropZone.tsx +86 -0
- package/src/components-v2/HoverBox.tsx +22 -0
- package/src/components-v2/Image.tsx +5 -0
- package/src/components-v2/ImageWithFallback.tsx +51 -0
- package/src/components-v2/LazyImage.tsx +12 -0
- package/src/components-v2/Loading.tsx +36 -0
- package/src/components-v2/README.md +4 -0
- package/src/components-v2/SearchInput.tsx +28 -0
- package/src/components-v2/SnackbarProvider.tsx +32 -0
- package/src/components-v2/T/index.tsx +15 -0
- package/src/components-v2/Typography.tsx +227 -0
- package/src/components-v2/WhiteButton.tsx +20 -0
- package/src/components-v2/accordion/accordion-header.tsx +43 -0
- package/src/components-v2/accordion/index.ts +1 -0
- package/src/components-v2/bazaar-types.ts +84 -0
- package/src/components-v2/carousel/carousel.tsx +106 -0
- package/src/components-v2/carousel/components/carousel-arrows.tsx +54 -0
- package/src/components-v2/carousel/components/carousel-dots.tsx +18 -0
- package/src/components-v2/carousel/index.ts +1 -0
- package/src/components-v2/carousel/styles/index.ts +93 -0
- package/src/components-v2/carousel-cards/carousel-card-1/carousel-card-1.tsx +83 -0
- package/src/components-v2/carousel-cards/carousel-card-1/index.ts +1 -0
- package/src/components-v2/carousel-cards/carousel-card-1/styles.ts +34 -0
- package/src/components-v2/categories/category-list/category-list.tsx +101 -0
- package/src/components-v2/categories/category-list/index.ts +1 -0
- package/src/components-v2/categories/category-list/styles.ts +35 -0
- package/src/components-v2/categories/category-list/types.ts +4 -0
- package/src/components-v2/categories/category-list-item/category-menu-item.tsx +37 -0
- package/src/components-v2/categories/category-list-item/index.ts +1 -0
- package/src/components-v2/categories/category-list-item/styles.ts +35 -0
- package/src/components-v2/categories/category-menu.tsx +53 -0
- package/src/components-v2/categories/mega-menu/banner.tsx +91 -0
- package/src/components-v2/categories/mega-menu/column-list.tsx +77 -0
- package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +55 -0
- package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +67 -0
- package/src/components-v2/categories/mega-menu/styles.ts +25 -0
- package/src/components-v2/categories/types.ts +16 -0
- package/src/components-v2/countries-input.tsx +73 -0
- package/src/components-v2/flex-box/flex-between.tsx +14 -0
- package/src/components-v2/flex-box/flex-box.tsx +9 -0
- package/src/components-v2/flex-box/flex-row-center.tsx +9 -0
- package/src/components-v2/flex-box/index.ts +5 -0
- package/src/components-v2/header/components/categories-menu.tsx +23 -0
- package/src/components-v2/header/components/mobile-header.tsx +148 -0
- package/src/components-v2/header/components/user.test.tsx +200 -0
- package/src/components-v2/header/components/user.tsx +250 -0
- package/src/components-v2/header/header.tsx +83 -0
- package/src/components-v2/header/hooks/use-header.ts +13 -0
- package/src/components-v2/header/index.ts +1 -0
- package/src/components-v2/header/sticky-header.tsx +49 -0
- package/src/components-v2/header/styles/index.ts +24 -0
- package/src/components-v2/icons/cart-bag.tsx +13 -0
- package/src/components-v2/icons/category-outline.tsx +29 -0
- package/src/components-v2/icons/category.tsx +12 -0
- package/src/components-v2/icons/home.tsx +19 -0
- package/src/components-v2/icons/search.tsx +13 -0
- package/src/components-v2/icons/shopping-bag-outlined.tsx +13 -0
- package/src/components-v2/icons/up-down.tsx +21 -0
- package/src/components-v2/icons/user.tsx +13 -0
- package/src/components-v2/icons/user2.tsx +14 -0
- package/src/components-v2/mini-cart/__tests__/cart-item.test.tsx +174 -0
- package/src/components-v2/mini-cart/__tests__/mini-cart.test.tsx +121 -0
- package/src/components-v2/mini-cart/__tests__/test-cart-empty.json +84 -0
- package/src/components-v2/mini-cart/__tests__/test-cart-with-item.json +244 -0
- package/src/components-v2/mini-cart/components/bottom-actions.tsx +81 -0
- package/src/components-v2/mini-cart/components/cart-item.tsx +205 -0
- package/src/components-v2/mini-cart/components/empty-view.tsx +69 -0
- package/src/components-v2/mini-cart/components/top-header.tsx +76 -0
- package/src/components-v2/mini-cart/index.ts +1 -0
- package/src/components-v2/mini-cart/mini-cart-trigger.tsx +99 -0
- package/src/components-v2/mini-cart/mini-cart.tsx +175 -0
- package/src/components-v2/mobile-navigation/index.ts +3 -0
- package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +118 -0
- package/src/components-v2/mobile-navigation/styles/index.ts +63 -0
- package/src/components-v2/nav-link/index.ts +5 -0
- package/src/components-v2/nav-link/nav-link-2.tsx +32 -0
- package/src/components-v2/nav-link/nav-link-3.tsx +67 -0
- package/src/components-v2/nav-link/nav-link.tsx +53 -0
- package/src/components-v2/navbar/categories.tsx +81 -0
- package/src/components-v2/navbar/category-based-menu/category-based-menu.tsx +146 -0
- package/src/components-v2/navbar/category-based-menu/index.ts +1 -0
- package/src/components-v2/navbar/category-based-menu/styles.ts +81 -0
- package/src/components-v2/navbar/category-based-menu/types.ts +18 -0
- package/src/components-v2/navbar/index.ts +1 -0
- package/src/components-v2/navbar/mega-menu/index.ts +1 -0
- package/src/components-v2/navbar/mega-menu/mega-menu.tsx +138 -0
- package/src/components-v2/navbar/mega-menu/styles.ts +43 -0
- package/src/components-v2/navbar/mobile-menu/index.ts +1 -0
- package/src/components-v2/navbar/mobile-menu/mobile-menu.test.tsx +111 -0
- package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +141 -0
- package/src/components-v2/navbar/nav-list/cms-nav.test.tsx +84 -0
- package/src/components-v2/navbar/nav-list/index.ts +1 -0
- package/src/components-v2/navbar/nav-list/nav-item-child.tsx +66 -0
- package/src/components-v2/navbar/nav-list/nav-list.tsx +141 -0
- package/src/components-v2/navbar/navbar.tsx +95 -0
- package/src/components-v2/navbar/styles.ts +90 -0
- package/src/components-v2/navbar/utils/transform-nav.test.ts +209 -0
- package/src/components-v2/navbar/utils/transform-nav.ts +43 -0
- package/src/components-v2/no-records.tsx +20 -0
- package/src/components-v2/product-cards/discount-chip.tsx +43 -0
- package/src/components-v2/product-cards/product-card/components/hover-actions.tsx +37 -0
- package/src/components-v2/product-cards/product-card/components/quantity-buttons.tsx +65 -0
- package/src/components-v2/product-cards/product-card/index.ts +1 -0
- package/src/components-v2/product-cards/product-card/product-card.tsx +410 -0
- package/src/components-v2/product-cards/product-card/styles/index.ts +52 -0
- package/src/components-v2/product-cards/product-card-plp/components/quantity-buttons.tsx +54 -0
- package/src/components-v2/product-cards/product-card-plp/index.ts +1 -0
- package/src/components-v2/product-cards/product-card-plp/product-card.tsx +161 -0
- package/src/components-v2/product-cards/product-card-plp/styles/index.ts +18 -0
- package/src/components-v2/product-cards/product-card-plp-list/components/add-to-cart.tsx +63 -0
- package/src/components-v2/product-cards/product-card-plp-list/components/favorite-button.tsx +27 -0
- package/src/components-v2/product-cards/product-card-plp-list/components/tags.tsx +33 -0
- package/src/components-v2/product-cards/product-card-plp-list/index.ts +1 -0
- package/src/components-v2/product-cards/product-card-plp-list/product-card.tsx +219 -0
- package/src/components-v2/product-cards/product-card-search/index.ts +1 -0
- package/src/components-v2/product-cards/product-card-search/product-card.tsx +166 -0
- package/src/components-v2/product-cards/product-card-search/styles/index.ts +61 -0
- package/src/components-v2/product-cards/product-price.tsx +26 -0
- package/src/components-v2/product-cards/product-rating.tsx +28 -0
- package/src/components-v2/product-cards/product-title.tsx +24 -0
- package/src/components-v2/product-cards/use-product.ts +35 -0
- package/src/components-v2/product-dialog/compound/product-dialog.tsx +225 -0
- package/src/components-v2/product-dialog/index.tsx +29 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group-error.tsx +46 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group-label.tsx +27 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group-list-chip.tsx +78 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group-list.tsx +24 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group.tsx +55 -0
- package/src/components-v2/product-dimensions/compound/dimensions.tsx +81 -0
- package/src/components-v2/product-dimensions/index.tsx +38 -0
- package/src/components-v2/product-dimensions/utils/has-selected-dimension.ts +20 -0
- package/src/components-v2/product-quantity-buttons/compound/quantity-buttons-root.tsx +181 -0
- package/src/components-v2/product-quantity-buttons/index.tsx +22 -0
- package/src/components-v2/product-quantity-variants/index.tsx +90 -0
- package/src/components-v2/products-view/compound/context.ts +25 -0
- package/src/components-v2/products-view/compound/products-grid-view.tsx +109 -0
- package/src/components-v2/products-view/compound/products-list-view.tsx +98 -0
- package/src/components-v2/products-view/compound/types.ts +12 -0
- package/src/components-v2/products-view/index.tsx +45 -0
- package/src/components-v2/products-view/products-grid-view.tsx +65 -0
- package/src/components-v2/products-view/products-list-view.tsx +66 -0
- package/src/components-v2/progress/index.ts +1 -0
- package/src/components-v2/progress/progress.tsx +77 -0
- package/src/components-v2/scrollbar/index.ts +1 -0
- package/src/components-v2/scrollbar/scrollbar.tsx +27 -0
- package/src/components-v2/scrollbar/styles.ts +15 -0
- package/src/components-v2/search-bar/compound/context.ts +31 -0
- package/src/components-v2/search-bar/compound/results-item-lg.tsx +43 -0
- package/src/components-v2/search-bar/compound/results-item-sm.tsx +48 -0
- package/src/components-v2/search-bar/compound/results-suspense.tsx +49 -0
- package/src/components-v2/search-bar/compound/results.tsx +42 -0
- package/src/components-v2/search-bar/compound/search-bar-root.tsx +64 -0
- package/src/components-v2/search-bar/compound/textfield-adornment-button.tsx +22 -0
- package/src/components-v2/search-bar/compound/textfield-adornment-category.tsx +83 -0
- package/src/components-v2/search-bar/compound/textfield-adornment-search-icon.tsx +34 -0
- package/src/components-v2/search-bar/compound/textfield.tsx +58 -0
- package/src/components-v2/search-bar/hooks/use-click-outside.ts +20 -0
- package/src/components-v2/search-bar/hooks/use-search.ts +63 -0
- package/src/components-v2/search-bar/index.tsx +36 -0
- package/src/components-v2/search-bar/styles/index.ts +49 -0
- package/src/components-v2/search-bar/utils/findCategoryNameById.ts +18 -0
- package/src/components-v2/section/compound/section-header.tsx +63 -0
- package/src/components-v2/section/compound/section.tsx +26 -0
- package/src/components-v2/section/index.ts +1 -0
- package/src/components-v2/side-nav/index.ts +1 -0
- package/src/components-v2/side-nav/side-nav.tsx +48 -0
- package/src/components-v2/site-logo.tsx +17 -0
- package/src/components-v2/sticky/index.ts +1 -0
- package/src/components-v2/sticky/sticky.tsx +62 -0
- package/src/components-v2/sticky/styles.ts +38 -0
- package/src/components-v2/utils/constants.ts +8 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/add-to-wishlist-button.tsx +69 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-bottom-ui.tsx +35 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +79 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +41 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/context.ts +29 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-header.tsx +74 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-item.tsx +82 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/hooks/use-add-to-wishlist.ts +152 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/index.tsx +39 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/context.ts +2 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui.tsx +42 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +92 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form.tsx +96 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/create-wishlist-button.tsx +42 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/index.tsx +22 -0
- package/src/components-v2/wishlist-dialogs/styles.ts +61 -0
- package/src/hooks/{use-cart.tsx → use-cart.ts} +29 -23
- package/src/hooks/use-variants.ts +138 -0
- package/src/lib/build-detail-url.ts +2 -1
- package/src/pages/README.md +4 -0
- package/src/pages/product-details/product-intro/product-intro.tsx +29 -24
- package/src/pages/product-list/quick-view-dialog-content.tsx +22 -11
- package/src/pages-v2/README.md +4 -0
- package/src/pages-v2/account/addresses/address-form.tsx +289 -0
- package/src/pages-v2/account/addresses/address-item.tsx +104 -0
- package/src/pages-v2/account/dashboard-header.tsx +123 -0
- package/src/pages-v2/account/navigation.tsx +87 -0
- package/src/pages-v2/account/orders/icons/delivery.tsx +14 -0
- package/src/pages-v2/account/orders/icons/package-box.tsx +13 -0
- package/src/pages-v2/account/orders/icons/truck-filled.tsx +14 -0
- package/src/pages-v2/account/orders/order-progress.tsx +114 -0
- package/src/pages-v2/account/orders/order-row.tsx +64 -0
- package/src/pages-v2/account/orders/order-summary.tsx +87 -0
- package/src/pages-v2/account/orders/ordered-products.tsx +121 -0
- package/src/pages-v2/account/profile/profile-button.test.tsx +59 -0
- package/src/pages-v2/account/profile/profile-button.tsx +50 -0
- package/src/pages-v2/account/profile/user-info.tsx +62 -0
- package/src/pages-v2/account/styles.ts +32 -0
- package/src/pages-v2/account/table-row.tsx +19 -0
- package/src/pages-v2/account/wishlist/create-new-list.tsx +167 -0
- package/src/pages-v2/account/wishlist/create-wishlist-button.tsx +40 -0
- package/src/pages-v2/account/wishlist/wishlist-item.tsx +82 -0
- package/src/pages-v2/blog/pagination.tsx +38 -0
- package/src/pages-v2/cart/cart-item.tsx +312 -0
- package/src/pages-v2/cart/checkout-form.tsx +122 -0
- package/src/pages-v2/cart/coupon-entry.tsx +90 -0
- package/src/pages-v2/cart/estimate-shipping.tsx +183 -0
- package/src/pages-v2/cart/wrapper.tsx +30 -0
- package/src/pages-v2/checkout/checkout-alt-form/address-card.tsx +76 -0
- package/src/pages-v2/checkout/checkout-alt-form/checkout-form.tsx +131 -0
- package/src/pages-v2/checkout/checkout-alt-form/checkout-step.tsx +120 -0
- package/src/pages-v2/checkout/checkout-alt-form/customer-information.tsx +94 -0
- package/src/pages-v2/checkout/checkout-alt-form/delivery-address.tsx +174 -0
- package/src/pages-v2/checkout/checkout-alt-form/delivery-date.tsx +114 -0
- package/src/pages-v2/checkout/checkout-alt-form/delivery-options.tsx +190 -0
- package/src/pages-v2/checkout/checkout-alt-form/edit-address-form.tsx +130 -0
- package/src/pages-v2/checkout/checkout-alt-form/heading.tsx +50 -0
- package/src/pages-v2/checkout/checkout-alt-form/index.ts +1 -0
- package/src/pages-v2/checkout/checkout-alt-form/new-address-form.tsx +299 -0
- package/src/pages-v2/checkout/checkout-alt-form/node.tsx +9 -0
- package/src/pages-v2/checkout/checkout-alt-form/payment-details.tsx +347 -0
- package/src/pages-v2/checkout/checkout-alt-form/safe-card-preview-data.tsx +36 -0
- package/src/pages-v2/checkout/checkout-alt-form/types.ts +20 -0
- package/src/pages-v2/checkout/checkout-alt-summary/cart-item.tsx +42 -0
- package/src/pages-v2/checkout/checkout-alt-summary/checkout-alt-summary.tsx +42 -0
- package/src/pages-v2/checkout/checkout-alt-summary/index.ts +1 -0
- package/src/pages-v2/checkout/checkout-alt-summary/list-item.tsx +31 -0
- package/src/pages-v2/confirmation/address.tsx +25 -0
- package/src/pages-v2/confirmation/confirmation-summary.tsx +55 -0
- package/src/pages-v2/confirmation/ordered-products.tsx +115 -0
- package/src/pages-v2/product-details/available-shops.tsx +48 -0
- package/src/pages-v2/product-details/bopis/find-in-store-button.tsx +64 -0
- package/src/pages-v2/product-details/bopis/find-in-store-modal.tsx +257 -0
- package/src/pages-v2/product-details/bopis/pickup-option-select.tsx +127 -0
- package/src/pages-v2/product-details/bopis/search-header.tsx +69 -0
- package/src/pages-v2/product-details/bopis/store-card/index.ts +1 -0
- package/src/pages-v2/product-details/bopis/store-card/shop-card.tsx +121 -0
- package/src/pages-v2/product-details/bopis/store-card/styles.ts +33 -0
- package/src/pages-v2/product-details/bopis/store-card/utils/convertSecondsToTime.ts +8 -0
- package/src/pages-v2/product-details/bopis/store-card/utils/getDaysResources.ts +25 -0
- package/src/pages-v2/product-details/checkbox-label.tsx +20 -0
- package/src/pages-v2/product-details/currency.ts +64 -0
- package/src/pages-v2/product-details/frequently-bought.tsx +97 -0
- package/src/pages-v2/product-details/frequently-product-card.tsx +63 -0
- package/src/pages-v2/product-details/product-comment.tsx +49 -0
- package/src/pages-v2/product-details/product-description.tsx +22 -0
- package/src/pages-v2/product-details/product-filter-card.tsx +265 -0
- package/src/pages-v2/product-details/product-intro/compound/context.ts +52 -0
- package/src/pages-v2/product-details/product-intro/compound/product-info.tsx +231 -0
- package/src/pages-v2/product-details/product-intro/compound/product-intro-images.tsx +124 -0
- package/src/pages-v2/product-details/product-intro/compound/product-intro.tsx +49 -0
- package/src/pages-v2/product-details/product-intro/compound/thumbnail-with-skeleton.tsx +28 -0
- package/src/pages-v2/product-details/product-intro/utils.ts +42 -0
- package/src/pages-v2/product-details/product-review.tsx +131 -0
- package/src/pages-v2/product-details/product-tabs.tsx +117 -0
- package/src/pages-v2/product-details/related-products.tsx +56 -0
- package/src/pages-v2/product-details/types.ts +11 -0
- package/src/pages-v2/product-list/breadcrumbs.tsx +39 -0
- package/src/pages-v2/product-list/checkbox-label.tsx +20 -0
- package/src/pages-v2/product-list/facet-group.tsx +125 -0
- package/src/pages-v2/product-list/facet.tsx +36 -0
- package/src/pages-v2/product-list/list-filter.tsx +43 -0
- package/src/pages-v2/product-list/pagination.tsx +80 -0
- package/src/pages-v2/product-list/product-list-context.tsx +302 -0
- package/src/pages-v2/product-list/product-list-state.ts +187 -0
- package/src/pages-v2/product-list/product-rating.tsx +16 -0
- package/src/pages-v2/product-list/quick-view-dialog-content.tsx +214 -0
- package/src/pages-v2/product-list/quick-view-dialog.tsx +54 -0
- package/src/pages-v2/product-list/range-filter.tsx +125 -0
- package/src/pages-v2/product-list/scrollbar.tsx +38 -0
- package/src/pages-v2/product-list/search-bar.tsx +162 -0
- package/src/pages-v2/product-list/selected-facets.tsx +80 -0
- package/src/pages-v2/product-list/side-nav.tsx +49 -0
- package/src/pages-v2/product-list/swatch.tsx +80 -0
- package/src/pages-v2/product-list/types.ts +18 -0
- package/src/pages-v2/product-list/use-product-list.ts +12 -0
- package/src/pages-v2/product-list/useCategoryFilter.tsx +26 -0
- package/src/pages-v2/product-list/utils/facet-helpers.ts +5 -0
- package/src/pages-v2/product-list/utils/generate-breadcrumbs.ts +30 -0
- package/src/pages-v2/product-list/utils/getCategoryFilterFromSlug.ts +153 -0
- package/src/pages-v2/product-list/utils/product-list-helper.ts +111 -0
- package/src/pages-v2/product-list/utils/product-list-types.ts +41 -0
- package/src/pages-v2/product-list/utils/search-for-category.ts +76 -0
- package/src/pages-v2/product-list/utils/sort-options.ts +44 -0
- package/src/pages-v2/product-list/utils/use-previous-refiners.ts +14 -0
- package/src/pages-v2/quickorder/order-upload.tsx +150 -0
- package/src/pages-v2/quickorder/quick-order-form.tsx +346 -0
- package/src/pages-v2/quickorder/quick-order-row.tsx +144 -0
- package/src/providers/nav-provider/index.tsx +59 -0
- package/src/providers/nav-provider/utils/createLink.ts +15 -0
- package/src/providers/notifications/README.md +15 -0
- package/src/providers/notifications/notification-context.tsx +82 -0
- package/src/providers/notifications/use-notification.ts +12 -0
- package/tsconfig.json +3 -2
- package/typedoc.js +12 -0
- package/src/api-manager/api-manager.config.json +0 -12
- package/src/api-manager/datasources/e4/e4.remaps.ts +0 -355
- package/src/api-manager/datasources/e4/e4.translator.test.ts +0 -202
- package/src/hooks/use-variants.tsx +0 -85
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import Grid from "@mui/material/Grid2";
|
|
3
|
+
import Button from "@mui/material/Button";
|
|
4
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
5
|
+
import BazaarImage from "@evenicanpm/storefront-core/src/components-v2/BazaarImage";
|
|
6
|
+
import { Paragraph } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
7
|
+
// STYLED COMPONENT
|
|
8
|
+
import { StyledRoot } from "./styles";
|
|
9
|
+
|
|
10
|
+
type CarouselCard1Props = {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const CarouselCard1 = ({ children }: CarouselCard1Props) => {
|
|
15
|
+
return (
|
|
16
|
+
<StyledRoot>
|
|
17
|
+
<Grid container spacing={3} alignItems="center">
|
|
18
|
+
{children}
|
|
19
|
+
</Grid>
|
|
20
|
+
</StyledRoot>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
CarouselCard1.Info = ({ children }: { children: ReactNode }) => {
|
|
25
|
+
return (
|
|
26
|
+
<Grid className="Grid2-item" size={{ xl: 4, md: 5, sm: 6, xs: 12 }}>
|
|
27
|
+
{children}
|
|
28
|
+
</Grid>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
CarouselCard1.Title = ({ title }: { title?: string }) => {
|
|
33
|
+
return <h1 className="title">{title}</h1>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
CarouselCard1.Description = ({ description }: { description?: string }) => {
|
|
37
|
+
return (
|
|
38
|
+
<Paragraph color="secondary.main" mb={2.7}>
|
|
39
|
+
{description}
|
|
40
|
+
</Paragraph>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
CarouselCard1.Button = ({
|
|
45
|
+
buttonLink,
|
|
46
|
+
buttonText,
|
|
47
|
+
}: {
|
|
48
|
+
buttonLink?: string;
|
|
49
|
+
buttonText?: string;
|
|
50
|
+
}) => {
|
|
51
|
+
return (
|
|
52
|
+
<a href={buttonLink}>
|
|
53
|
+
<Button
|
|
54
|
+
size="large"
|
|
55
|
+
disableElevation
|
|
56
|
+
variant="contained"
|
|
57
|
+
className="button-link"
|
|
58
|
+
sx={{ height: 44, borderRadius: "4px" }}
|
|
59
|
+
>
|
|
60
|
+
{buttonText}
|
|
61
|
+
</Button>
|
|
62
|
+
</a>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
CarouselCard1.Image = ({ imgUrl }: { imgUrl?: string }) => {
|
|
67
|
+
return (
|
|
68
|
+
<Grid size={{ xl: 8, md: 7, sm: 6, xs: 12 }}>
|
|
69
|
+
<BazaarImage
|
|
70
|
+
src={imgUrl ?? ""}
|
|
71
|
+
alt="carousel card image"
|
|
72
|
+
sx={{
|
|
73
|
+
mx: "auto",
|
|
74
|
+
maxHeight: 400,
|
|
75
|
+
display: "block",
|
|
76
|
+
maxWidth: "100%",
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
</Grid>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default CarouselCard1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./carousel-card-1";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import styled from "@mui/material/styles/styled";
|
|
4
|
+
|
|
5
|
+
export const StyledRoot = styled("div")(({ theme }) => ({
|
|
6
|
+
display: "flex",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
justifyContent: "space-between",
|
|
9
|
+
".title": {
|
|
10
|
+
fontSize: 50,
|
|
11
|
+
marginTop: 0,
|
|
12
|
+
lineHeight: 1.2,
|
|
13
|
+
marginBottom: "1.35rem",
|
|
14
|
+
},
|
|
15
|
+
[theme.breakpoints.up("sm")]: {
|
|
16
|
+
".grid-item": {
|
|
17
|
+
minHeight: 424,
|
|
18
|
+
display: "flex",
|
|
19
|
+
alignItems: "baseline",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
[theme.breakpoints.down("sm")]: {
|
|
25
|
+
marginLeft: 0,
|
|
26
|
+
paddingLeft: 0,
|
|
27
|
+
".title": { fontSize: 32 },
|
|
28
|
+
},
|
|
29
|
+
[theme.breakpoints.down("xs")]: {
|
|
30
|
+
".title": { fontSize: 16 },
|
|
31
|
+
".title + *": { fontSize: 13 },
|
|
32
|
+
".button-link": { height: 36, padding: "0 1.5rem", fontSize: 13 },
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { createContext, useContext, ReactNode } from "react";
|
|
4
|
+
import getCategories from "@/services/categories/queries/get-categories";
|
|
5
|
+
import { CategoryHierarchy } from "@/lib/category-helpers";
|
|
6
|
+
import { StyledRoot, SubMenuStyledRoot } from "./styles";
|
|
7
|
+
|
|
8
|
+
import MegaMenu1 from "@evenicanpm/storefront-core/src/components-v2/categories/mega-menu/mega-menu-1";
|
|
9
|
+
import MegaMenu2 from "@evenicanpm/storefront-core/src/components-v2/categories/mega-menu/mega-menu-2";
|
|
10
|
+
import CategoryListItem from "../category-list-item/index";
|
|
11
|
+
|
|
12
|
+
type MegaMenuType = "default" | "mega-menu-1" | "mega-menu-2";
|
|
13
|
+
|
|
14
|
+
interface CategoryListContextValue {
|
|
15
|
+
open?: boolean;
|
|
16
|
+
position: "absolute" | "relative";
|
|
17
|
+
megaMenuRenderers: Record<
|
|
18
|
+
MegaMenuType,
|
|
19
|
+
(children: CategoryHierarchy[]) => ReactNode
|
|
20
|
+
>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const CategoryListContext = createContext<CategoryListContextValue | null>(
|
|
24
|
+
null,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
interface RootProps {
|
|
28
|
+
open?: boolean;
|
|
29
|
+
position?: "absolute" | "relative";
|
|
30
|
+
categories?: CategoryHierarchy[];
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const CategoryList = ({
|
|
35
|
+
open,
|
|
36
|
+
position = "absolute",
|
|
37
|
+
categories,
|
|
38
|
+
children,
|
|
39
|
+
}: RootProps) => {
|
|
40
|
+
let { data: fetchedCategories } = getCategories.useSuspenseData();
|
|
41
|
+
const cats = categories ?? fetchedCategories ?? [];
|
|
42
|
+
|
|
43
|
+
const megaMenuRenderers: Record<
|
|
44
|
+
MegaMenuType,
|
|
45
|
+
(children: CategoryHierarchy[]) => ReactNode
|
|
46
|
+
> = {
|
|
47
|
+
default: (children) => <CategoryList.SubMenu items={children} />,
|
|
48
|
+
"mega-menu-1": (children) => <MegaMenu1 data={children} />,
|
|
49
|
+
"mega-menu-2": (children) => <MegaMenu2 data={children} />,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<CategoryListContext.Provider value={{ open, position, megaMenuRenderers }}>
|
|
54
|
+
<StyledRoot elevation={2} open={open} position={position}>
|
|
55
|
+
{children ??
|
|
56
|
+
cats.map((c) => <CategoryList.Item key={c.RecordId} category={c} />)}
|
|
57
|
+
</StyledRoot>
|
|
58
|
+
</CategoryListContext.Provider>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
interface ItemProps {
|
|
63
|
+
category: CategoryHierarchy;
|
|
64
|
+
}
|
|
65
|
+
CategoryList.Item = ({ category }: ItemProps) => {
|
|
66
|
+
const ctx = useContext(CategoryListContext);
|
|
67
|
+
if (!ctx) return null;
|
|
68
|
+
const { megaMenuRenderers } = ctx;
|
|
69
|
+
const { RecordId, Name, Url, Children } = category;
|
|
70
|
+
const hasChildren = !!Children?.length;
|
|
71
|
+
|
|
72
|
+
// Sub menu can also be "categories/mega-menu/mega-menu-1" or "mega-menu-2",
|
|
73
|
+
// Mega menus have submenu items listed in columns and also have option to show banners(offers).
|
|
74
|
+
// Which submenu to display should be decided from categopry data
|
|
75
|
+
const menuType: MegaMenuType = "default";
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<CategoryListItem
|
|
79
|
+
key={RecordId}
|
|
80
|
+
href={`/products/${Url}`}
|
|
81
|
+
title={Name ?? ""}
|
|
82
|
+
caret={hasChildren}
|
|
83
|
+
render={hasChildren ? megaMenuRenderers[menuType]?.(Children!) : null}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
interface SubMenuProps {
|
|
89
|
+
items: CategoryHierarchy[];
|
|
90
|
+
}
|
|
91
|
+
CategoryList.SubMenu = ({ items }: SubMenuProps) => {
|
|
92
|
+
return (
|
|
93
|
+
<SubMenuStyledRoot elevation={2}>
|
|
94
|
+
{items.map((c) => (
|
|
95
|
+
<CategoryList.Item key={c.RecordId} category={c} />
|
|
96
|
+
))}
|
|
97
|
+
</SubMenuStyledRoot>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default CategoryList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./category-list";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import styled from "@mui/material/styles/styled";
|
|
2
|
+
import { Props } from "./types";
|
|
3
|
+
import Card from "@mui/material/Card";
|
|
4
|
+
|
|
5
|
+
interface StyledRootProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
elevation: number;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
position: "absolute" | "relative";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// styled component
|
|
12
|
+
export const StyledRoot: React.FC<StyledRootProps> = styled("div", {
|
|
13
|
+
shouldForwardProp: (prop) => prop !== "position" && prop !== "open",
|
|
14
|
+
})<Props>(({ theme, position, open }) => ({
|
|
15
|
+
left: 0,
|
|
16
|
+
zIndex: 98,
|
|
17
|
+
right: "auto",
|
|
18
|
+
borderRadius: 4,
|
|
19
|
+
padding: "0.5rem 0px",
|
|
20
|
+
transformOrigin: "top",
|
|
21
|
+
boxShadow: theme.shadows[2],
|
|
22
|
+
position: position || "unset",
|
|
23
|
+
transition: "all 250ms ease-in-out",
|
|
24
|
+
transform: open ? "scaleY(1)" : "scaleY(0)",
|
|
25
|
+
backgroundColor: theme.palette.background.paper,
|
|
26
|
+
top: position === "absolute" ? "calc(100% + 0.7rem)" : "0.5rem",
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
export const SubMenuStyledRoot = styled(Card)(() => ({
|
|
30
|
+
marginLeft: "0.6rem",
|
|
31
|
+
paddingBlock: "0.5rem",
|
|
32
|
+
// Prevent clipping of 2nd-level dropdowns that are absolutely positioned.
|
|
33
|
+
// Needed to make sure submenus render outside the card's bounds
|
|
34
|
+
overflow: "visible",
|
|
35
|
+
}));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
// MUI ICON COMPONENTS
|
|
4
|
+
import { SvgIconComponent } from "@mui/icons-material";
|
|
5
|
+
import ChevronRight from "@mui/icons-material/ChevronRight";
|
|
6
|
+
// STYLED COMPONENT
|
|
7
|
+
import { Wrapper } from "./styles";
|
|
8
|
+
|
|
9
|
+
// =============================================================
|
|
10
|
+
interface Props {
|
|
11
|
+
href: string;
|
|
12
|
+
title: string;
|
|
13
|
+
caret?: boolean;
|
|
14
|
+
render?: ReactNode;
|
|
15
|
+
icon?: SvgIconComponent;
|
|
16
|
+
}
|
|
17
|
+
// =============================================================
|
|
18
|
+
|
|
19
|
+
export default function CategoryListItem(props: Props) {
|
|
20
|
+
const { href, title, render, caret = true, icon: Icon } = props;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Wrapper>
|
|
24
|
+
<Link href={href}>
|
|
25
|
+
<div className="category-dropdown-link">
|
|
26
|
+
{Icon ? <Icon fontSize="small" color="inherit" /> : null}
|
|
27
|
+
<span className="title">{title}</span>
|
|
28
|
+
{caret ? (
|
|
29
|
+
<ChevronRight fontSize="small" className="caret-icon" />
|
|
30
|
+
) : null}
|
|
31
|
+
</div>
|
|
32
|
+
</Link>
|
|
33
|
+
|
|
34
|
+
{render ? <div className="mega-menu">{render}</div> : null}
|
|
35
|
+
</Wrapper>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./category-menu-item";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import styled from "@mui/material/styles/styled";
|
|
2
|
+
|
|
3
|
+
export const Wrapper = styled("div")(({ theme }) => ({
|
|
4
|
+
// Needed "relative" here so that the absolutely positioned `.mega-menu` inside this wrapper
|
|
5
|
+
// is aligned relative to this parent element.
|
|
6
|
+
// If we want submenu to align to the top always then we can remove this.
|
|
7
|
+
position: "relative",
|
|
8
|
+
"& .category-dropdown-link": {
|
|
9
|
+
height: 40,
|
|
10
|
+
display: "flex",
|
|
11
|
+
minWidth: "220px", // same as CategoryMenuButton width
|
|
12
|
+
cursor: "pointer",
|
|
13
|
+
whiteSpace: "pre",
|
|
14
|
+
padding: "0px 1rem",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
transition: "all 300ms ease-in-out",
|
|
17
|
+
".title": { flexGrow: 1, paddingLeft: "0.75rem" },
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
":hover": {
|
|
21
|
+
color: theme.palette.primary.main,
|
|
22
|
+
background: theme.palette.action.hover,
|
|
23
|
+
"& > .mega-menu": { display: "block" },
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
".mega-menu": {
|
|
27
|
+
top: 0,
|
|
28
|
+
zIndex: 99,
|
|
29
|
+
left: "100%",
|
|
30
|
+
right: "auto",
|
|
31
|
+
display: "none",
|
|
32
|
+
position: "absolute",
|
|
33
|
+
},
|
|
34
|
+
...(theme.direction === "rtl" && { ".caret-icon": { rotate: "180deg" } }),
|
|
35
|
+
}));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { MouseEvent, useCallback, useEffect, useState } from "react";
|
|
4
|
+
import styled from "@mui/material/styles/styled";
|
|
5
|
+
import CategoryList from "./category-list/index";
|
|
6
|
+
|
|
7
|
+
// STYLED COMPONENT
|
|
8
|
+
const Wrapper = styled("div", {
|
|
9
|
+
shouldForwardProp: (prop) => prop !== "open",
|
|
10
|
+
})<{ open: boolean }>(({ open, theme: { direction } }) => ({
|
|
11
|
+
cursor: "pointer",
|
|
12
|
+
position: "relative",
|
|
13
|
+
"& .dropdown-icon": {
|
|
14
|
+
transition: "all 250ms ease-in-out",
|
|
15
|
+
transform: `rotate(${
|
|
16
|
+
open ? (direction === "rtl" ? "-90deg" : "90deg") : "0deg"
|
|
17
|
+
})`,
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
// ===========================================================
|
|
22
|
+
type Props = {
|
|
23
|
+
render: (
|
|
24
|
+
handler: (e: React.MouseEvent<HTMLButtonElement>) => void,
|
|
25
|
+
) => JSX.Element;
|
|
26
|
+
};
|
|
27
|
+
// ===========================================================
|
|
28
|
+
|
|
29
|
+
// CategoryMenu is acting purely as a configuration/wiring component,
|
|
30
|
+
// not as a reusable UI element that needs further extensibility.
|
|
31
|
+
export default function CategoryMenu({ render }: Props) {
|
|
32
|
+
const [open, setOpen] = useState(false);
|
|
33
|
+
|
|
34
|
+
const onClick = (e: MouseEvent<HTMLButtonElement>) => {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
setOpen((open) => !open);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const handleDocumentClick = useCallback(() => setOpen(false), []);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
window.addEventListener("click", handleDocumentClick);
|
|
43
|
+
return () => window.removeEventListener("click", handleDocumentClick);
|
|
44
|
+
}, [handleDocumentClick]);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Wrapper open={open}>
|
|
48
|
+
{render(onClick)}
|
|
49
|
+
|
|
50
|
+
<CategoryList open={open} />
|
|
51
|
+
</Wrapper>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import Box from "@mui/material/Box";
|
|
6
|
+
import Grid from "@mui/material/Grid2";
|
|
7
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components-v2/flex-box/flex-box";
|
|
8
|
+
import LazyImage from "@evenicanpm/storefront-core/src/components-v2/LazyImage";
|
|
9
|
+
import {
|
|
10
|
+
H3,
|
|
11
|
+
Paragraph,
|
|
12
|
+
Small,
|
|
13
|
+
} from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
14
|
+
|
|
15
|
+
interface RootProps {
|
|
16
|
+
href: string;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
const OfferBanner = ({ href, children }: RootProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<Link href={href}>
|
|
22
|
+
<Grid
|
|
23
|
+
className="h-full"
|
|
24
|
+
container
|
|
25
|
+
spacing={0}
|
|
26
|
+
wrap="wrap-reverse"
|
|
27
|
+
alignItems="center"
|
|
28
|
+
mb={-1}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</Grid>
|
|
32
|
+
</Link>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
interface TextProps {
|
|
37
|
+
title: string;
|
|
38
|
+
subtitle?: string;
|
|
39
|
+
ctaText?: string;
|
|
40
|
+
}
|
|
41
|
+
OfferBanner.Text = ({ title, subtitle, ctaText }: TextProps) => {
|
|
42
|
+
return (
|
|
43
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
44
|
+
<Box px={2.5}>
|
|
45
|
+
<H3 mb={1}>{title}</H3>
|
|
46
|
+
{subtitle && (
|
|
47
|
+
<Paragraph color="grey.600" mb={1}>
|
|
48
|
+
{subtitle}
|
|
49
|
+
</Paragraph>
|
|
50
|
+
)}
|
|
51
|
+
{ctaText && (
|
|
52
|
+
<Small
|
|
53
|
+
fontWeight="700"
|
|
54
|
+
borderBottom="2px solid"
|
|
55
|
+
borderColor="primary.main"
|
|
56
|
+
>
|
|
57
|
+
{ctaText}
|
|
58
|
+
</Small>
|
|
59
|
+
)}
|
|
60
|
+
</Box>
|
|
61
|
+
</Grid>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
interface ImageProps {
|
|
66
|
+
src: string;
|
|
67
|
+
alt?: string;
|
|
68
|
+
width?: number;
|
|
69
|
+
height?: number;
|
|
70
|
+
}
|
|
71
|
+
OfferBanner.Image = ({
|
|
72
|
+
src,
|
|
73
|
+
alt = "",
|
|
74
|
+
width = 292,
|
|
75
|
+
height = 195,
|
|
76
|
+
}: ImageProps) => {
|
|
77
|
+
return (
|
|
78
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
79
|
+
<FlexBox
|
|
80
|
+
height="160px"
|
|
81
|
+
position="relative"
|
|
82
|
+
flexDirection="column"
|
|
83
|
+
justifyContent="flex-end"
|
|
84
|
+
>
|
|
85
|
+
<LazyImage alt={alt} width={width} height={height} src={src} />
|
|
86
|
+
</FlexBox>
|
|
87
|
+
</Grid>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default OfferBanner;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { PropsWithChildren, ReactNode, createContext, useContext } from "react";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import Box from "@mui/material/Box";
|
|
6
|
+
import Grid from "@mui/material/Grid2";
|
|
7
|
+
import LazyImage from "@evenicanpm/storefront-core/src/components-v2/LazyImage";
|
|
8
|
+
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
9
|
+
import { NavLink } from "@evenicanpm/storefront-core/src/components-v2/nav-link/index";
|
|
10
|
+
import { StyledRoot } from "./styles";
|
|
11
|
+
|
|
12
|
+
interface RootProps extends PropsWithChildren {
|
|
13
|
+
minWidth?: number;
|
|
14
|
+
}
|
|
15
|
+
const ColumnList = ({ minWidth = 760, children }: RootProps) => {
|
|
16
|
+
return (
|
|
17
|
+
<StyledRoot elevation={2} sx={{ minWidth }}>
|
|
18
|
+
<FlexBox px={2.5}>{children}</FlexBox>
|
|
19
|
+
</StyledRoot>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
interface WrapperProps {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
ColumnList.Wrapper = ({ children }: WrapperProps) => {
|
|
27
|
+
return (
|
|
28
|
+
<Box flex="1 1 0">
|
|
29
|
+
<Grid container spacing={4}>
|
|
30
|
+
{children}
|
|
31
|
+
</Grid>
|
|
32
|
+
</Box>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
interface ColumnProps {
|
|
37
|
+
title: string;
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
ColumnList.Column = ({ title, children }: ColumnProps) => {
|
|
41
|
+
return (
|
|
42
|
+
<Grid size={3}>
|
|
43
|
+
<div className="title-link">{title}</div>
|
|
44
|
+
{children}
|
|
45
|
+
</Grid>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
interface LinkProps {
|
|
50
|
+
href: string;
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
}
|
|
53
|
+
ColumnList.Link = ({ href, children }: LinkProps) => {
|
|
54
|
+
return (
|
|
55
|
+
<NavLink className="child-link" href={href}>
|
|
56
|
+
{children}
|
|
57
|
+
</NavLink>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
interface BannerProps {
|
|
62
|
+
href: string;
|
|
63
|
+
url: string;
|
|
64
|
+
width?: number;
|
|
65
|
+
height?: number;
|
|
66
|
+
}
|
|
67
|
+
ColumnList.Banner = ({ href, url, width = 137, height = 318 }: BannerProps) => {
|
|
68
|
+
return (
|
|
69
|
+
<Box mt={1.5}>
|
|
70
|
+
<Link href={href}>
|
|
71
|
+
<LazyImage src={url} width={width} height={height} alt="banner" />
|
|
72
|
+
</Link>
|
|
73
|
+
</Box>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default ColumnList;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
// MUI
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
5
|
+
import LazyImage from "@evenicanpm/storefront-core/src/components-v2/LazyImage";
|
|
6
|
+
// LOCAL CUSTOM COMPONENTS
|
|
7
|
+
import ColumnList from "./column-list";
|
|
8
|
+
// DATA TYPE
|
|
9
|
+
import { CategoryItemOffer } from "../types";
|
|
10
|
+
import { CategoryHierarchy } from "@/lib/category-helpers";
|
|
11
|
+
|
|
12
|
+
// =========================================================
|
|
13
|
+
interface Props {
|
|
14
|
+
minWidth?: string;
|
|
15
|
+
data: CategoryHierarchy[];
|
|
16
|
+
banner?: CategoryItemOffer;
|
|
17
|
+
}
|
|
18
|
+
// =========================================================
|
|
19
|
+
|
|
20
|
+
// MegaMenu1 is acting purely as a configuration/wiring component,
|
|
21
|
+
// not as a reusable UI element that needs further extensibility.
|
|
22
|
+
export default function MegaMenu1({ banner, data }: Props) {
|
|
23
|
+
return (
|
|
24
|
+
<ColumnList>
|
|
25
|
+
<ColumnList.Wrapper>
|
|
26
|
+
{data.map((item) => (
|
|
27
|
+
<ColumnList.Column key={item.RecordId} title={item.Name}>
|
|
28
|
+
{item.Children?.map((sub) => (
|
|
29
|
+
<ColumnList.Link key={sub.RecordId} href={`/products/${sub.Url}`}>
|
|
30
|
+
{sub.Name}
|
|
31
|
+
</ColumnList.Link>
|
|
32
|
+
))}
|
|
33
|
+
</ColumnList.Column>
|
|
34
|
+
))}
|
|
35
|
+
</ColumnList.Wrapper>
|
|
36
|
+
|
|
37
|
+
{banner?.position === "right" && (
|
|
38
|
+
<ColumnList.Banner href={banner.href} url={banner.url} />
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
{banner?.position === "bottom" ? (
|
|
42
|
+
<Link href={banner.href}>
|
|
43
|
+
<Box position="relative" height={150} width="100%">
|
|
44
|
+
<LazyImage
|
|
45
|
+
fill
|
|
46
|
+
alt="banner"
|
|
47
|
+
src={banner.url}
|
|
48
|
+
style={{ objectFit: "cover", objectPosition: "center center" }}
|
|
49
|
+
/>
|
|
50
|
+
</Box>
|
|
51
|
+
</Link>
|
|
52
|
+
) : null}
|
|
53
|
+
</ColumnList>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// LOCAL CUSTOM COMPONENTS
|
|
2
|
+
import OfferBanner from "./banner";
|
|
3
|
+
import ColumnList from "./column-list";
|
|
4
|
+
import CategoryMenuItem from "../category-list-item/index";
|
|
5
|
+
// STYLED COMPONENT
|
|
6
|
+
import { StyledRoot } from "./styles";
|
|
7
|
+
// DATA TYPE
|
|
8
|
+
import { CategoryHierarchy } from "@/lib/category-helpers";
|
|
9
|
+
|
|
10
|
+
// =======================================================================
|
|
11
|
+
interface Props {
|
|
12
|
+
data: CategoryHierarchy[];
|
|
13
|
+
}
|
|
14
|
+
// =======================================================================
|
|
15
|
+
|
|
16
|
+
// MegaMenu2 is acting purely as a configuration/wiring component,
|
|
17
|
+
// not as a reusable UI element that needs further extensibility.
|
|
18
|
+
export default function MegaMenu2({ data }: Props) {
|
|
19
|
+
return (
|
|
20
|
+
<StyledRoot elevation={2}>
|
|
21
|
+
{data.map((item) => (
|
|
22
|
+
<CategoryMenuItem
|
|
23
|
+
href={`/products/${item.Url}`}
|
|
24
|
+
//icon={item.icon} // No icon information
|
|
25
|
+
key={item.RecordId}
|
|
26
|
+
title={item.Name ?? ""}
|
|
27
|
+
caret={!!(item.Children && item.Children.length)}
|
|
28
|
+
render={
|
|
29
|
+
item.Children?.length ? (
|
|
30
|
+
<ColumnList minWidth={550}>
|
|
31
|
+
<ColumnList.Wrapper>
|
|
32
|
+
{item.Children.map((childItem) => (
|
|
33
|
+
<ColumnList.Column
|
|
34
|
+
key={childItem.RecordId}
|
|
35
|
+
title={childItem.Name}
|
|
36
|
+
>
|
|
37
|
+
{childItem.Children?.map((sub) => (
|
|
38
|
+
<ColumnList.Link
|
|
39
|
+
key={sub.RecordId}
|
|
40
|
+
href={`/products/${sub.Url}`}
|
|
41
|
+
>
|
|
42
|
+
{sub.Name}
|
|
43
|
+
</ColumnList.Link>
|
|
44
|
+
))}
|
|
45
|
+
</ColumnList.Column>
|
|
46
|
+
))}
|
|
47
|
+
</ColumnList.Wrapper>
|
|
48
|
+
{/* Sample offer banner */}
|
|
49
|
+
<OfferBanner href="/sale-page-2">
|
|
50
|
+
<OfferBanner.Text
|
|
51
|
+
title="Big Sale Upto 60% Off"
|
|
52
|
+
subtitle="Handcrafted from genuine Italian Leather"
|
|
53
|
+
ctaText="SHOP NOW"
|
|
54
|
+
/>
|
|
55
|
+
<OfferBanner.Image
|
|
56
|
+
src="/assets/images/models/model-1.png"
|
|
57
|
+
alt="model"
|
|
58
|
+
/>
|
|
59
|
+
</OfferBanner>
|
|
60
|
+
</ColumnList>
|
|
61
|
+
) : null
|
|
62
|
+
}
|
|
63
|
+
/>
|
|
64
|
+
))}
|
|
65
|
+
</StyledRoot>
|
|
66
|
+
);
|
|
67
|
+
}
|