@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
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
7
|
+
import TouchRipple from "@mui/material/ButtonBase";
|
|
8
|
+
import useTheme from "@mui/material/styles/useTheme";
|
|
9
|
+
import getCategories from "@/services/categories/queries/get-categories";
|
|
10
|
+
import { MdKeyboardArrowDown as KeyboardArrowDownOutlined } from "react-icons/md";
|
|
11
|
+
import { findCategoryNameById } from "../utils/findCategoryNameById";
|
|
12
|
+
import Menu from "@evenicanpm/storefront-core/src/components-v2/BazaarMenu";
|
|
13
|
+
import { DropDownHandler } from "../styles/index";
|
|
14
|
+
import { useTranslations } from "next-intl";
|
|
15
|
+
type DisplayCategory = {
|
|
16
|
+
name: string;
|
|
17
|
+
id: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @category Props
|
|
22
|
+
*/
|
|
23
|
+
export interface CategoryDropdownProps {
|
|
24
|
+
/** The currently selected category id, "All" by default. Used to filter typeahead search query. */
|
|
25
|
+
selectedCategoryId: number;
|
|
26
|
+
/** A handler to call when the category is changed. In this case will be changing the state that is held in top-level context */
|
|
27
|
+
handleChange: (categoryId: number) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Category Dropdown filter for SearchBar. Selecting a category
|
|
32
|
+
* will filter the search query.
|
|
33
|
+
*
|
|
34
|
+
* @category Sub-Component
|
|
35
|
+
*/
|
|
36
|
+
const CategoryDropdown = ({
|
|
37
|
+
selectedCategoryId,
|
|
38
|
+
handleChange,
|
|
39
|
+
}: CategoryDropdownProps) => {
|
|
40
|
+
const { data: categories } = getCategories.useSuspenseData();
|
|
41
|
+
const t = useTranslations();
|
|
42
|
+
const { breakpoints } = useTheme();
|
|
43
|
+
|
|
44
|
+
const _categories = Array.isArray(categories) ? categories : [];
|
|
45
|
+
const options: DisplayCategory[] = [
|
|
46
|
+
..._categories.map((cat) => ({ name: cat?.Name ?? "", id: cat.RecordId })),
|
|
47
|
+
{ name: "All Categories", id: 0 },
|
|
48
|
+
]; // add all categories option
|
|
49
|
+
|
|
50
|
+
const title = findCategoryNameById(selectedCategoryId, categories, t);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<Menu
|
|
55
|
+
direction="left"
|
|
56
|
+
sx={{ zIndex: breakpoints.down("md") ? 99999 : 1502 }}
|
|
57
|
+
handler={(e) => (
|
|
58
|
+
<DropDownHandler as={TouchRipple} onClick={e}>
|
|
59
|
+
{title}
|
|
60
|
+
<KeyboardArrowDownOutlined fontSize="small" color="inherit" />
|
|
61
|
+
</DropDownHandler>
|
|
62
|
+
)}
|
|
63
|
+
options={(onClose) => {
|
|
64
|
+
return options
|
|
65
|
+
?.filter((current: DisplayCategory) => current.name !== title)
|
|
66
|
+
.map((item: DisplayCategory) => (
|
|
67
|
+
<MenuItem
|
|
68
|
+
key={item.id}
|
|
69
|
+
onClick={() => {
|
|
70
|
+
handleChange(item.id);
|
|
71
|
+
onClose();
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{item.name}
|
|
75
|
+
</MenuItem>
|
|
76
|
+
));
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default CategoryDropdown;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
import Box from "@mui/material/Box";
|
|
5
|
+
import { IconButton } from "@mui/material";
|
|
6
|
+
import Search from "@evenicanpm/storefront-core/src/components-v2/icons/search";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
handleNavigate: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Search icon that appears in the left adornment slot of search-box
|
|
14
|
+
* @category Sub-Component
|
|
15
|
+
*/
|
|
16
|
+
const AdornmentSearchIcon = ({ handleNavigate }: Props) => {
|
|
17
|
+
return (
|
|
18
|
+
<Box
|
|
19
|
+
mr={1}
|
|
20
|
+
px={1}
|
|
21
|
+
display="grid"
|
|
22
|
+
alignItems="center"
|
|
23
|
+
justifyContent="center"
|
|
24
|
+
borderRight="1px solid"
|
|
25
|
+
borderColor="grey.400"
|
|
26
|
+
>
|
|
27
|
+
<IconButton onClick={handleNavigate}>
|
|
28
|
+
<Search sx={{ fontSize: 17, color: "grey.600" }} />
|
|
29
|
+
</IconButton>
|
|
30
|
+
</Box>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default AdornmentSearchIcon;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
import React, { useContext } from "react";
|
|
6
|
+
import TextField from "@mui/material/TextField";
|
|
7
|
+
|
|
8
|
+
import SearchIconAdornment from "./textfield-adornment-search-icon";
|
|
9
|
+
import AdornmentButton from "./textfield-adornment-button";
|
|
10
|
+
import CategoryDropdown from "./textfield-adornment-category";
|
|
11
|
+
|
|
12
|
+
import { INPUT_SX } from "../styles/index";
|
|
13
|
+
import { useTheme, useMediaQuery } from "@mui/material";
|
|
14
|
+
import _ from "lodash";
|
|
15
|
+
import { useTranslations } from "next-intl";
|
|
16
|
+
import { SearchContext } from "./context";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The actual input field for the search bar.
|
|
20
|
+
* Adornment will change based on media query width -
|
|
21
|
+
* Categories filter for desktop and search button for mobile.
|
|
22
|
+
* @category Sub-Component
|
|
23
|
+
*/
|
|
24
|
+
export default function SearchBarTextField() {
|
|
25
|
+
const { handlers, state } = useContext(SearchContext);
|
|
26
|
+
const t = useTranslations();
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
const downMd = useMediaQuery(theme.breakpoints.down(1150));
|
|
29
|
+
|
|
30
|
+
const endAdornment = downMd ? (
|
|
31
|
+
<AdornmentButton label={t("Search.searchBtn")} />
|
|
32
|
+
) : (
|
|
33
|
+
<CategoryDropdown
|
|
34
|
+
selectedCategoryId={state.searchCategory}
|
|
35
|
+
handleChange={handlers.handleCategoryChange}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<form onSubmit={handlers.handleSubmit}>
|
|
41
|
+
<TextField
|
|
42
|
+
fullWidth
|
|
43
|
+
variant="outlined"
|
|
44
|
+
placeholder={t("Search.searchPlaceholder")}
|
|
45
|
+
onChange={handlers.handleSearch}
|
|
46
|
+
slotProps={{
|
|
47
|
+
input: {
|
|
48
|
+
sx: INPUT_SX,
|
|
49
|
+
startAdornment: (
|
|
50
|
+
<SearchIconAdornment handleNavigate={handlers.handleNavigate} />
|
|
51
|
+
),
|
|
52
|
+
endAdornment: endAdornment,
|
|
53
|
+
},
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
</form>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Detect if clicks are outside of an element in an ref
|
|
5
|
+
*/
|
|
6
|
+
export const useClickOutside = (
|
|
7
|
+
ref: React.RefObject<HTMLElement>,
|
|
8
|
+
callback: () => void,
|
|
9
|
+
) => {
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const handleClick = (e: PointerEvent) => {
|
|
12
|
+
if (ref.current && !ref.current.contains(e.target as Node)) callback();
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
document.addEventListener("click", handleClick);
|
|
16
|
+
return () => {
|
|
17
|
+
document.removeEventListener("click", handleClick);
|
|
18
|
+
};
|
|
19
|
+
}, [ref, callback]);
|
|
20
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { FormEvent, useState } from "react";
|
|
3
|
+
import { PageSlug } from "@/lib/page-slugs";
|
|
4
|
+
import { PageKey } from "@/lib/product-list-types";
|
|
5
|
+
|
|
6
|
+
import _ from "lodash";
|
|
7
|
+
import { useRouter } from "next/navigation";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Handles all main logic and state for the search bar components.
|
|
11
|
+
*/
|
|
12
|
+
export default function useSearch() {
|
|
13
|
+
// State
|
|
14
|
+
const [resultsOpen, setResultsOpen] = useState(false);
|
|
15
|
+
const [searchText, setSearchText] = React.useState<string>("");
|
|
16
|
+
const [searchCategory, setSelectedCategory] = React.useState<number>(0);
|
|
17
|
+
|
|
18
|
+
// Hooks
|
|
19
|
+
const router = useRouter();
|
|
20
|
+
|
|
21
|
+
// Handlers
|
|
22
|
+
const handleCategoryChange = (categoryId: number) => {
|
|
23
|
+
setSelectedCategory(categoryId);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleNavigate = () => {
|
|
27
|
+
if (searchText.trim() === "") {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const url = new URL(PageSlug.ProductList, window.location.origin);
|
|
31
|
+
url.searchParams.set(PageKey.SEARCH, searchText);
|
|
32
|
+
router.push(url.toString());
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const handleSubmit = (event: FormEvent<HTMLFormElement>): void => {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
handleNavigate();
|
|
38
|
+
setResultsOpen(false);
|
|
39
|
+
setSearchText("");
|
|
40
|
+
setSelectedCategory(0);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const handleSearch = _.debounce((e) => {
|
|
44
|
+
setSearchText(e.target.value || "");
|
|
45
|
+
}, 500);
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
state: {
|
|
49
|
+
resultsOpen,
|
|
50
|
+
searchText,
|
|
51
|
+
searchCategory,
|
|
52
|
+
},
|
|
53
|
+
setters: {
|
|
54
|
+
setResultsOpen,
|
|
55
|
+
},
|
|
56
|
+
handlers: {
|
|
57
|
+
handleNavigate,
|
|
58
|
+
handleCategoryChange,
|
|
59
|
+
handleSubmit,
|
|
60
|
+
handleSearch,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
import SearchBar from "./compound/search-bar-root";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
handleCloseDrawer?: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @category Implementation
|
|
12
|
+
*/
|
|
13
|
+
export const SearchBarViewLg = ({ handleCloseDrawer }: Props) => {
|
|
14
|
+
return (
|
|
15
|
+
<SearchBar handleCloseDrawer={handleCloseDrawer}>
|
|
16
|
+
<SearchBar.TextField />
|
|
17
|
+
<SearchBar.Results>
|
|
18
|
+
<SearchBar.Results.ItemCardLg />
|
|
19
|
+
</SearchBar.Results>
|
|
20
|
+
</SearchBar>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @category Implementation
|
|
26
|
+
*/
|
|
27
|
+
export const SearchBarViewSm = ({ handleCloseDrawer }: Props) => {
|
|
28
|
+
return (
|
|
29
|
+
<SearchBar handleCloseDrawer={handleCloseDrawer}>
|
|
30
|
+
<SearchBar.TextField />
|
|
31
|
+
<SearchBar.Results>
|
|
32
|
+
<SearchBar.Results.ItemCardSm />
|
|
33
|
+
</SearchBar.Results>
|
|
34
|
+
</SearchBar>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Card from "@mui/material/Card";
|
|
4
|
+
import Box from "@mui/material/Box";
|
|
5
|
+
import styled from "@mui/material/styles/styled";
|
|
6
|
+
import SearchOutlined from "@mui/icons-material/SearchOutlined";
|
|
7
|
+
|
|
8
|
+
// TODO: caused from symlinked node_modules in client-packages root
|
|
9
|
+
// Need to install only types for mui/styled-engine
|
|
10
|
+
export const SearchOutlinedIcon = styled(SearchOutlined)(({ theme }) => ({
|
|
11
|
+
color: theme.palette.grey[600],
|
|
12
|
+
marginRight: 6,
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
export const SearchResultCard = styled(Card)(({ theme }) => ({
|
|
16
|
+
zIndex: 99,
|
|
17
|
+
top: "100%",
|
|
18
|
+
width: "100%",
|
|
19
|
+
overflowY: "auto",
|
|
20
|
+
position: "absolute",
|
|
21
|
+
paddingTop: "0.5rem",
|
|
22
|
+
paddingBottom: "0.5rem",
|
|
23
|
+
paddingLeft: "2rem",
|
|
24
|
+
paddingRight: "2rem",
|
|
25
|
+
[theme.breakpoints.up("md")]: { maxHeight: "80vH" },
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export const DropDownHandler = styled(Box)(({ theme }) => ({
|
|
29
|
+
width: 160,
|
|
30
|
+
minWidth: 160,
|
|
31
|
+
height: "100%",
|
|
32
|
+
display: "flex",
|
|
33
|
+
whiteSpace: "pre",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
gap: theme.spacing(0.5),
|
|
36
|
+
justifyContent: "flex-end",
|
|
37
|
+
color: theme.palette.grey[700],
|
|
38
|
+
paddingInline: theme.spacing(3),
|
|
39
|
+
borderLeft: `1px solid ${theme.palette.grey[400]}`,
|
|
40
|
+
[theme.breakpoints.down("xs")]: { display: "none" },
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
export const INPUT_SX = {
|
|
44
|
+
padding: 0,
|
|
45
|
+
height: 44,
|
|
46
|
+
overflow: "hidden",
|
|
47
|
+
backgroundColor: "grey.200",
|
|
48
|
+
"& .MuiOutlinedInput-notchedOutline": { border: 0 },
|
|
49
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Category } from "@msdyn365-commerce/retail-proxy";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Looks up the category name by id.
|
|
5
|
+
*/
|
|
6
|
+
export const findCategoryNameById = (
|
|
7
|
+
searchCategory: number,
|
|
8
|
+
categories: any,
|
|
9
|
+
t: Function,
|
|
10
|
+
) => {
|
|
11
|
+
if (searchCategory === 0) {
|
|
12
|
+
return t("Navigation.allCategoriesLabel");
|
|
13
|
+
}
|
|
14
|
+
return (
|
|
15
|
+
categories?.find((cat: Category) => cat.RecordId === searchCategory)
|
|
16
|
+
?.Name || ""
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Section
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
|
|
6
|
+
import Link from "next/link";
|
|
7
|
+
import { ReactNode } from "react";
|
|
8
|
+
// Mui Icon Components
|
|
9
|
+
import ArrowLeft from "@mui/icons-material/ArrowLeft";
|
|
10
|
+
import ArrowRight from "@mui/icons-material/ArrowRight";
|
|
11
|
+
// Local Custom Components
|
|
12
|
+
import { H2 } from "../../Typography";
|
|
13
|
+
import { FlexBetween, FlexBox } from "../../flex-box/index";
|
|
14
|
+
import useSettings from "../../../hooks/use-settings";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @category Sub-Component
|
|
18
|
+
*/
|
|
19
|
+
export const SectionHeader = ({ children }: { children: ReactNode }) => {
|
|
20
|
+
return <FlexBetween mb={3}>{children}</FlexBetween>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @category Props
|
|
25
|
+
*/
|
|
26
|
+
export interface TitleProps {
|
|
27
|
+
/** Title of section */
|
|
28
|
+
title: string;
|
|
29
|
+
/** Icon to display beside title */
|
|
30
|
+
icon?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @category Sub-Component
|
|
35
|
+
*/
|
|
36
|
+
export const SectionHeaderTitle = ({ icon, title }: TitleProps) => (
|
|
37
|
+
<FlexBox alignItems="center" gap={1}>
|
|
38
|
+
{icon ?? null}
|
|
39
|
+
<H2 lineHeight={1}>{title}</H2>
|
|
40
|
+
</FlexBox>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @category Sub-Component
|
|
45
|
+
*/
|
|
46
|
+
export const SectionHeaderSeeMoreLink = ({ link }: { link: string }) => {
|
|
47
|
+
const { settings } = useSettings();
|
|
48
|
+
return (
|
|
49
|
+
<Link href={link}>
|
|
50
|
+
<FlexBox alignItems="center" color="grey.600">
|
|
51
|
+
View all
|
|
52
|
+
{settings.direction === "ltr" ? (
|
|
53
|
+
<ArrowRight fontSize="small" color="inherit" />
|
|
54
|
+
) : (
|
|
55
|
+
<ArrowLeft fontSize="small" color="inherit" />
|
|
56
|
+
)}
|
|
57
|
+
</FlexBox>
|
|
58
|
+
</Link>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
SectionHeader.Title = SectionHeaderTitle;
|
|
63
|
+
SectionHeader.SeeMoreLink = SectionHeaderSeeMoreLink;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Section
|
|
3
|
+
*/
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
import Container from "@mui/material/Container";
|
|
6
|
+
import Box, { BoxProps } from "@mui/material/Box";
|
|
7
|
+
import { SectionHeader } from "./section-header";
|
|
8
|
+
|
|
9
|
+
interface Props extends BoxProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @category Compound Component
|
|
15
|
+
*/
|
|
16
|
+
export const Section = (props: Props) => {
|
|
17
|
+
const { children, ...others } = props;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Box mb={7.5} {...others}>
|
|
21
|
+
<Container className="pb-1">{children}</Container>
|
|
22
|
+
</Box>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
Section.Header = SectionHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Section } from "./compound/section";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./side-nav";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEffect, useState, ReactNode } from "react";
|
|
2
|
+
import Drawer from "@mui/material/Drawer";
|
|
3
|
+
// GLOBAL CUSTOM COMPONENT
|
|
4
|
+
import Scrollbar from "@evenicanpm/storefront-core/src/components-v2/scrollbar/index";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/** Optionally manage open state from parent, default is to use local state. */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
width?: number;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
toggle?: () => void;
|
|
12
|
+
position?: "left" | "right";
|
|
13
|
+
handler: (event: () => void) => ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function SideNav(props: Props) {
|
|
17
|
+
const {
|
|
18
|
+
position = "left",
|
|
19
|
+
open = false,
|
|
20
|
+
width = 280,
|
|
21
|
+
children,
|
|
22
|
+
handler,
|
|
23
|
+
toggle,
|
|
24
|
+
} = props;
|
|
25
|
+
/** If no external state, just use local. */
|
|
26
|
+
const [sideNavOpen, setSideNavOpen] = useState(open);
|
|
27
|
+
const handleToggleSideNav = () => setSideNavOpen(!sideNavOpen);
|
|
28
|
+
|
|
29
|
+
/** Keep external and local state in sync */
|
|
30
|
+
useEffect(() => setSideNavOpen(open), [open]);
|
|
31
|
+
|
|
32
|
+
const handleClose = toggle || handleToggleSideNav;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div>
|
|
36
|
+
<Drawer
|
|
37
|
+
anchor={position}
|
|
38
|
+
open={sideNavOpen}
|
|
39
|
+
onClose={handleClose}
|
|
40
|
+
slotProps={{ transition: { style: { width } } }}
|
|
41
|
+
>
|
|
42
|
+
<Scrollbar autoHide={false}>{children}</Scrollbar>
|
|
43
|
+
</Drawer>
|
|
44
|
+
|
|
45
|
+
{handler(handleClose)}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
|
|
5
|
+
interface SiteLogoProps {
|
|
6
|
+
height?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const SiteLogo: React.FC<SiteLogoProps> = () => {
|
|
10
|
+
return (
|
|
11
|
+
<Link href="/">
|
|
12
|
+
<img src={"/logo-blue.png"} alt="E4 Logo" height={54} />
|
|
13
|
+
</Link>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default SiteLogo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./sticky";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState, ReactNode } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { StyledBox } from "./styles";
|
|
4
|
+
|
|
5
|
+
// ============================================================
|
|
6
|
+
interface Props {
|
|
7
|
+
fixedOn: number;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
scrollDistance?: number;
|
|
10
|
+
onSticky?: (isFixed: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ============================================================
|
|
14
|
+
|
|
15
|
+
export default function Sticky({
|
|
16
|
+
fixedOn,
|
|
17
|
+
children,
|
|
18
|
+
onSticky,
|
|
19
|
+
scrollDistance = 0,
|
|
20
|
+
}: Props) {
|
|
21
|
+
const [fixed, setFixed] = useState(false);
|
|
22
|
+
const elementRef = useRef<HTMLDivElement>(null);
|
|
23
|
+
const [height, setHeight] = useState(0);
|
|
24
|
+
|
|
25
|
+
const scrollListener = useCallback(() => {
|
|
26
|
+
if (!window) return;
|
|
27
|
+
|
|
28
|
+
const isFixed = window.scrollY >= fixedOn + scrollDistance;
|
|
29
|
+
setFixed(isFixed);
|
|
30
|
+
}, [fixedOn, scrollDistance]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!window) return;
|
|
34
|
+
|
|
35
|
+
window.addEventListener("scroll", scrollListener);
|
|
36
|
+
window.addEventListener("resize", scrollListener);
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
window.removeEventListener("scroll", scrollListener);
|
|
40
|
+
window.removeEventListener("resize", scrollListener);
|
|
41
|
+
};
|
|
42
|
+
}, [scrollListener]);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (onSticky) onSticky(fixed);
|
|
46
|
+
}, [fixed, onSticky]);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (elementRef.current) {
|
|
50
|
+
setHeight(elementRef.current.offsetHeight);
|
|
51
|
+
scrollListener();
|
|
52
|
+
}
|
|
53
|
+
}, [scrollListener]);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<StyledBox fixedOn={fixedOn} componentHeight={height} fixed={fixed}>
|
|
57
|
+
<div className={clsx({ hold: !fixed, fixed: fixed })} ref={elementRef}>
|
|
58
|
+
{children}
|
|
59
|
+
</div>
|
|
60
|
+
</StyledBox>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { keyframes, styled } from "@mui/material/styles";
|
|
2
|
+
|
|
3
|
+
// ==============================================================
|
|
4
|
+
interface Props {
|
|
5
|
+
fixed?: boolean;
|
|
6
|
+
fixedOn?: number;
|
|
7
|
+
componentHeight?: number;
|
|
8
|
+
}
|
|
9
|
+
// ==============================================================
|
|
10
|
+
|
|
11
|
+
const slideDown = keyframes`
|
|
12
|
+
from {transform: translateY(-200%)}
|
|
13
|
+
to {transform: translateY(0)}
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export const StyledBox = styled("div", {
|
|
17
|
+
shouldForwardProp: (prop) =>
|
|
18
|
+
prop !== "componentHeight" && prop !== "fixed" && prop !== "fixedOn",
|
|
19
|
+
})<Props>(({ theme, componentHeight, fixedOn, fixed }) => ({
|
|
20
|
+
paddingTop: fixed ? componentHeight : 0,
|
|
21
|
+
|
|
22
|
+
"& .hold": {
|
|
23
|
+
zIndex: 5,
|
|
24
|
+
boxShadow: "none",
|
|
25
|
+
position: "relative",
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
"& .fixed": {
|
|
29
|
+
left: 0,
|
|
30
|
+
right: 0,
|
|
31
|
+
zIndex: 1500,
|
|
32
|
+
position: "fixed",
|
|
33
|
+
top: `${fixedOn}px`,
|
|
34
|
+
boxShadow: theme.shadows[2],
|
|
35
|
+
transition: "all 350ms ease-in-out",
|
|
36
|
+
animation: `${slideDown} 400ms ${theme.transitions.easing.easeInOut}`,
|
|
37
|
+
},
|
|
38
|
+
}));
|