@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,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { RefObject, createContext, useContext } from "react";
|
|
4
|
+
import Grid from "@mui/material/Grid2";
|
|
5
|
+
import Card from "@mui/material/Card";
|
|
6
|
+
import KeyboardArrowDown from "@mui/icons-material/KeyboardArrowDown";
|
|
7
|
+
import List from "@mui/material/List";
|
|
8
|
+
// GLOBAL COMPONENTS
|
|
9
|
+
import FlexRowCenter from "@evenicanpm/storefront-core/src/components-v2/flex-box/flex-row-center";
|
|
10
|
+
import { H6 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
11
|
+
// HOOKS
|
|
12
|
+
import useOverflowDetect from "@evenicanpm/storefront-core/src/hooks/use-overflow-detect";
|
|
13
|
+
// STYLED
|
|
14
|
+
import { MenusContainer, Wrapper, MenuListItem, StyledNavLink } from "./styles";
|
|
15
|
+
|
|
16
|
+
type MegaMenuContextType = {
|
|
17
|
+
isLeftOverflowing: boolean;
|
|
18
|
+
isRightOverflowing: boolean;
|
|
19
|
+
elementRef: RefObject<HTMLLIElement>;
|
|
20
|
+
checkOverflow: () => void;
|
|
21
|
+
};
|
|
22
|
+
const MegaMenuContext = createContext<MegaMenuContextType | null>(null);
|
|
23
|
+
const useMegaMenu = () => useContext(MegaMenuContext)!;
|
|
24
|
+
|
|
25
|
+
const Grid2Size = (length: number) => {
|
|
26
|
+
if (length === 1) return 12;
|
|
27
|
+
if (length === 2) return 6;
|
|
28
|
+
if (length === 3) return 4;
|
|
29
|
+
if (length === 4) return 3;
|
|
30
|
+
return 3;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const MegaMenu = ({
|
|
34
|
+
title,
|
|
35
|
+
children,
|
|
36
|
+
}: {
|
|
37
|
+
title?: string;
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}) => {
|
|
40
|
+
const { elementRef, isLeftOverflowing, isRightOverflowing, checkOverflow } =
|
|
41
|
+
useOverflowDetect();
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<MegaMenuContext.Provider
|
|
45
|
+
value={{
|
|
46
|
+
elementRef: elementRef as RefObject<HTMLLIElement>,
|
|
47
|
+
isLeftOverflowing,
|
|
48
|
+
isRightOverflowing,
|
|
49
|
+
checkOverflow,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<Wrapper onMouseOver={checkOverflow}>
|
|
53
|
+
{title && (
|
|
54
|
+
<FlexRowCenter fontWeight={600} alignItems="flex-end" gap={0.3}>
|
|
55
|
+
{title}
|
|
56
|
+
<KeyboardArrowDown className="icon" />
|
|
57
|
+
</FlexRowCenter>
|
|
58
|
+
)}
|
|
59
|
+
{children}
|
|
60
|
+
</Wrapper>
|
|
61
|
+
</MegaMenuContext.Provider>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
MegaMenu.Trigger = ({ children }: { children?: React.ReactNode }) => {
|
|
66
|
+
return (
|
|
67
|
+
<FlexRowCenter fontWeight={600} alignItems="flex-end" gap={0.3}>
|
|
68
|
+
{children}
|
|
69
|
+
<KeyboardArrowDown className="icon" />
|
|
70
|
+
</FlexRowCenter>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
MegaMenu.Container = ({ children }: { children: React.ReactNode }) => {
|
|
75
|
+
const { elementRef, isLeftOverflowing, isRightOverflowing } = useMegaMenu();
|
|
76
|
+
return (
|
|
77
|
+
<MenusContainer
|
|
78
|
+
ref={elementRef}
|
|
79
|
+
className="menu-list"
|
|
80
|
+
left={isLeftOverflowing}
|
|
81
|
+
right={isRightOverflowing}
|
|
82
|
+
>
|
|
83
|
+
<Card className="card" elevation={3} sx={{ mt: 1.5, overflow: "hidden" }}>
|
|
84
|
+
<Grid container>{children}</Grid>
|
|
85
|
+
</Card>
|
|
86
|
+
</MenusContainer>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
MegaMenu.Column = ({
|
|
91
|
+
children,
|
|
92
|
+
count,
|
|
93
|
+
}: {
|
|
94
|
+
children: React.ReactNode;
|
|
95
|
+
count: number;
|
|
96
|
+
}) => {
|
|
97
|
+
const size = Grid2Size(count);
|
|
98
|
+
const STYLE = { py: 2, ":nth-of-type(odd)": { backgroundColor: "grey.100" } };
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Grid size={size} sx={STYLE}>
|
|
102
|
+
{children}
|
|
103
|
+
</Grid>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
MegaMenu.Category = ({
|
|
108
|
+
title,
|
|
109
|
+
children,
|
|
110
|
+
}: {
|
|
111
|
+
title: string;
|
|
112
|
+
children: React.ReactNode;
|
|
113
|
+
}) => {
|
|
114
|
+
return (
|
|
115
|
+
<List>
|
|
116
|
+
<H6 mb={0.5} pl={4}>
|
|
117
|
+
{title}
|
|
118
|
+
</H6>
|
|
119
|
+
{children}
|
|
120
|
+
</List>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
MegaMenu.Item = ({
|
|
125
|
+
href,
|
|
126
|
+
children,
|
|
127
|
+
}: {
|
|
128
|
+
href: string;
|
|
129
|
+
children: React.ReactNode;
|
|
130
|
+
}) => {
|
|
131
|
+
return (
|
|
132
|
+
<StyledNavLink href={href}>
|
|
133
|
+
<MenuListItem>{children}</MenuListItem>
|
|
134
|
+
</StyledNavLink>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default MegaMenu;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import ListItem from "@mui/material/ListItem";
|
|
2
|
+
import styled from "@mui/material/styles/styled";
|
|
3
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
4
|
+
import { NavLink } from "@evenicanpm/storefront-core/src/components-v2/nav-link/index";
|
|
5
|
+
|
|
6
|
+
// STYLED COMPONENTS
|
|
7
|
+
export const Wrapper = styled("div")(({ theme }) => ({
|
|
8
|
+
cursor: "pointer",
|
|
9
|
+
position: "relative",
|
|
10
|
+
transition: "color 150ms ease-in-out",
|
|
11
|
+
".icon": {
|
|
12
|
+
fontSize: "1.1rem",
|
|
13
|
+
color: theme.palette.grey[500],
|
|
14
|
+
},
|
|
15
|
+
":hover": {
|
|
16
|
+
color: theme.palette.primary.main,
|
|
17
|
+
"& .menu-list": { display: "block" },
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
type Props = { left: boolean; right: boolean };
|
|
22
|
+
|
|
23
|
+
export const MenusContainer = styled(ListItem, {
|
|
24
|
+
shouldForwardProp: (prop) => prop !== "left" && prop !== "right",
|
|
25
|
+
})<Props>(({ theme, left, right }) => ({
|
|
26
|
+
zIndex: 2,
|
|
27
|
+
top: "100%",
|
|
28
|
+
minWidth: 1000,
|
|
29
|
+
display: "none",
|
|
30
|
+
position: "absolute",
|
|
31
|
+
transform: "translate(-50%, 0%)",
|
|
32
|
+
[theme.breakpoints.down(1070)]: { minWidth: 800 },
|
|
33
|
+
...(left && { transform: "translate(0%, 0%)" }),
|
|
34
|
+
...(right && { transform: "translate(-80%, 0%)" }),
|
|
35
|
+
...(left && right && { transform: "translate(-25%, 0%)" }),
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
export const MenuListItem = styled(ListItem)(({ theme }) => ({
|
|
39
|
+
padding: ".5rem 2rem",
|
|
40
|
+
":hover": { backgroundColor: theme.palette.action.hover },
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
export const StyledNavLink = styled(NavLink)({ transition: "all 0.3s" });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MobileMenu } from "./mobile-menu";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { describe, it, vi, beforeEach } from "vitest";
|
|
2
|
+
import { render, screen, fireEvent } from "@testing-library/react";
|
|
3
|
+
import MobileMenu from "./mobile-menu";
|
|
4
|
+
import { transformCmsNav } from "../utils/transform-nav";
|
|
5
|
+
import { CmsNavItem } from "@/cms/interfaces/navigation";
|
|
6
|
+
|
|
7
|
+
// Mock NavContext
|
|
8
|
+
vi.mock("@evenicanpm/storefront-core/src/providers/nav-provider", () => {
|
|
9
|
+
return {
|
|
10
|
+
NavContext: {
|
|
11
|
+
// We'll replace these in beforeEach per test
|
|
12
|
+
Provider: ({ value, children }: any) => (
|
|
13
|
+
<div data-testid="nav-context-provider">{children}</div
|
|
14
|
+
),
|
|
15
|
+
},
|
|
16
|
+
useContext: vi.fn(),
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
import * as NavProvider from "@evenicanpm/storefront-core/src/providers/nav-provider";
|
|
21
|
+
import { useContext } from "react";
|
|
22
|
+
|
|
23
|
+
describe("MobileMenu", () => {
|
|
24
|
+
const cmsNav = transformCmsNav(mockCmsData as unknown as CmsNavItem[]);
|
|
25
|
+
const handleClose = vi.fn();
|
|
26
|
+
vi.mock("react", () => ({
|
|
27
|
+
...jest.requireActual("react"),
|
|
28
|
+
useContext: vi.fn(),
|
|
29
|
+
}));
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
vi.clearAllMocks();
|
|
32
|
+
|
|
33
|
+
(useContext as vi.Mock).mockReturnValue({
|
|
34
|
+
isMobileSideNavOpen: true,
|
|
35
|
+
toggleMobileSideNav: handleClose,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should render root menu items", () => {
|
|
40
|
+
render(
|
|
41
|
+
<MobileMenu.Drawer>
|
|
42
|
+
<MobileMenu.List data={cmsNav} />
|
|
43
|
+
</MobileMenu.Drawer>,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
expect(screen.getByText("My Page")).toBeInTheDocument();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("should expand nested items when clicked", () => {
|
|
50
|
+
render(
|
|
51
|
+
<MobileMenu.Drawer>
|
|
52
|
+
<MobileMenu.List data={cmsNav} />
|
|
53
|
+
</MobileMenu.Drawer>,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
fireEvent.click(screen.getByText("My Page"));
|
|
57
|
+
expect(screen.getByText("NESTED")).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("should call onClose when leaf link is clicked", () => {
|
|
61
|
+
render(
|
|
62
|
+
<MobileMenu.Drawer>
|
|
63
|
+
<MobileMenu.List data={cmsNav} />
|
|
64
|
+
</MobileMenu.Drawer>,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const link = screen.getByText("NESTED");
|
|
68
|
+
expect(link.closest("a")).toHaveAttribute("href", "https://google.com");
|
|
69
|
+
|
|
70
|
+
fireEvent.click(link);
|
|
71
|
+
expect(handleClose).toHaveBeenCalled();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const mockCmsData = [
|
|
76
|
+
{
|
|
77
|
+
id: 3,
|
|
78
|
+
title: "My Page",
|
|
79
|
+
menuAttached: false,
|
|
80
|
+
order: 1,
|
|
81
|
+
path: "/pages/my-page",
|
|
82
|
+
type: "INTERNAL",
|
|
83
|
+
uiRouterKey: "my-page",
|
|
84
|
+
slug: "pages-my-page",
|
|
85
|
+
external: false,
|
|
86
|
+
related: {
|
|
87
|
+
id: 1,
|
|
88
|
+
title: "My Page",
|
|
89
|
+
slug: "my-page",
|
|
90
|
+
createdAt: "2025-01-20T17:27:16.685Z",
|
|
91
|
+
updatedAt: "2025-01-20T17:27:19.608Z",
|
|
92
|
+
publishedAt: "2025-01-20T17:27:19.603Z",
|
|
93
|
+
__contentType: "api::page.page",
|
|
94
|
+
navigationItemId: 3,
|
|
95
|
+
__templateName: "Generic",
|
|
96
|
+
},
|
|
97
|
+
items: [
|
|
98
|
+
{
|
|
99
|
+
id: 4,
|
|
100
|
+
title: "NESTED",
|
|
101
|
+
menuAttached: false,
|
|
102
|
+
order: 1,
|
|
103
|
+
path: "https://google.com",
|
|
104
|
+
type: "EXTERNAL",
|
|
105
|
+
uiRouterKey: "nested",
|
|
106
|
+
slug: "",
|
|
107
|
+
external: true,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
];
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useContext, Fragment } from "react";
|
|
4
|
+
import Box from "@mui/material/Box";
|
|
5
|
+
import Drawer from "@mui/material/Drawer";
|
|
6
|
+
import IconButton from "@mui/material/IconButton";
|
|
7
|
+
import Divider from "@mui/material/Divider";
|
|
8
|
+
import Accordion from "@mui/material/Accordion";
|
|
9
|
+
import AccordionSummary from "@mui/material/AccordionSummary";
|
|
10
|
+
import {
|
|
11
|
+
MdMenu as Menu,
|
|
12
|
+
MdClear as Clear,
|
|
13
|
+
MdExpandMore as ExpandMore,
|
|
14
|
+
} from "react-icons/md";
|
|
15
|
+
import Scrollbar from "@evenicanpm/storefront-core/src/components-v2/scrollbar";
|
|
16
|
+
import { H6 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
17
|
+
import { NavLink } from "@evenicanpm/storefront-core/src/components-v2/nav-link";
|
|
18
|
+
import { TransformedNavItem } from "@evenicanpm/storefront-core/src/components-v2/navbar/utils/transform-nav";
|
|
19
|
+
import { NavContext } from "@evenicanpm/storefront-core/src/providers/nav-provider";
|
|
20
|
+
|
|
21
|
+
type RootProps = { children: React.ReactNode };
|
|
22
|
+
|
|
23
|
+
const MobileMenu = ({ children }: RootProps) => {
|
|
24
|
+
return <>{children}</>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
MobileMenu.Trigger = () => {
|
|
28
|
+
const { toggleMobileSideNav } = useContext(NavContext);
|
|
29
|
+
return (
|
|
30
|
+
<IconButton
|
|
31
|
+
onClick={toggleMobileSideNav}
|
|
32
|
+
sx={{ flexShrink: 0, color: "grey.600" }}
|
|
33
|
+
>
|
|
34
|
+
<Menu />
|
|
35
|
+
</IconButton>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
MobileMenu.Drawer = ({ children }: { children: React.ReactNode }) => {
|
|
40
|
+
const { isMobileSideNavOpen, toggleMobileSideNav } = useContext(NavContext);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Drawer
|
|
44
|
+
anchor="left"
|
|
45
|
+
open={isMobileSideNavOpen}
|
|
46
|
+
onClose={toggleMobileSideNav}
|
|
47
|
+
sx={{ zIndex: 15001 }}
|
|
48
|
+
>
|
|
49
|
+
<Box width="100vw" height="100%" position="relative">
|
|
50
|
+
<Scrollbar autoHide={false} sx={{ height: "100vh" }}>
|
|
51
|
+
<Box
|
|
52
|
+
px={5}
|
|
53
|
+
py={8}
|
|
54
|
+
maxWidth={500}
|
|
55
|
+
margin="auto"
|
|
56
|
+
position="relative"
|
|
57
|
+
height="100%"
|
|
58
|
+
>
|
|
59
|
+
<IconButton
|
|
60
|
+
onClick={toggleMobileSideNav}
|
|
61
|
+
sx={{ position: "absolute", right: 30, top: 15 }}
|
|
62
|
+
>
|
|
63
|
+
<Clear />
|
|
64
|
+
</IconButton>
|
|
65
|
+
|
|
66
|
+
{children}
|
|
67
|
+
</Box>
|
|
68
|
+
</Scrollbar>
|
|
69
|
+
</Box>
|
|
70
|
+
</Drawer>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
MobileMenu.List = ({ data }: { data: TransformedNavItem[] }) => {
|
|
75
|
+
const { toggleMobileSideNav } = useContext(NavContext);
|
|
76
|
+
return (
|
|
77
|
+
<Fragment>
|
|
78
|
+
{data.map((item, idx) => (
|
|
79
|
+
<MobileMenu.Item key={idx} item={item} onClose={toggleMobileSideNav} />
|
|
80
|
+
))}
|
|
81
|
+
</Fragment>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const ACCORDION_STYLES = {
|
|
86
|
+
"&:not(:last-child)": { borderBottom: 0 },
|
|
87
|
+
"&:before": { display: "none" },
|
|
88
|
+
};
|
|
89
|
+
const ACCORDION_SUMMARY_STYLES = {
|
|
90
|
+
padding: 0,
|
|
91
|
+
minHeight: 48,
|
|
92
|
+
boxShadow: "none",
|
|
93
|
+
"& .Mui-expanded": { color: "primary.main", margin: 0 },
|
|
94
|
+
"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded": {
|
|
95
|
+
margin: 0,
|
|
96
|
+
"& .MuiSvgIcon-root": { color: "primary.main" },
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Single Item (link or accordion)
|
|
101
|
+
MobileMenu.Item = ({
|
|
102
|
+
item,
|
|
103
|
+
onClose,
|
|
104
|
+
}: {
|
|
105
|
+
item: TransformedNavItem;
|
|
106
|
+
onClose: () => void;
|
|
107
|
+
}) => {
|
|
108
|
+
const { href, title, items } = item;
|
|
109
|
+
|
|
110
|
+
if (items && items.length) {
|
|
111
|
+
return (
|
|
112
|
+
<Accordion square elevation={0} disableGutters sx={ACCORDION_STYLES}>
|
|
113
|
+
<AccordionSummary
|
|
114
|
+
expandIcon={<ExpandMore style={{ fontSize: "1.5rem" }} />}
|
|
115
|
+
sx={ACCORDION_SUMMARY_STYLES}
|
|
116
|
+
>
|
|
117
|
+
<H6>{title}</H6>
|
|
118
|
+
</AccordionSummary>
|
|
119
|
+
<Box mx={2}>
|
|
120
|
+
{items.map((sub, idx) => (
|
|
121
|
+
<MobileMenu.Item key={idx} item={sub} onClose={onClose} />
|
|
122
|
+
))}
|
|
123
|
+
</Box>
|
|
124
|
+
</Accordion>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<Box py={1}>
|
|
130
|
+
<NavLink href={href} onClick={onClose}>
|
|
131
|
+
{title}
|
|
132
|
+
</NavLink>
|
|
133
|
+
</Box>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
MobileMenu.Divider = () => {
|
|
138
|
+
return <Divider sx={{ my: 2 }} />;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export default MobileMenu;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*import React from "react";
|
|
2
|
+
import { expect, describe, it } from "vitest";
|
|
3
|
+
import { render, screen } from "@testing-library/react";
|
|
4
|
+
import { NavContext } from "@evenicanpm/storefront-core/src/components-v2/NavProvider";
|
|
5
|
+
import NavCms from "./index";
|
|
6
|
+
|
|
7
|
+
describe("NavCms", () => {
|
|
8
|
+
it("Renders the page links and dropdown menu", () => {
|
|
9
|
+
render(
|
|
10
|
+
<NavContext.Provider value={mockData}>
|
|
11
|
+
<NavCms />
|
|
12
|
+
</NavContext.Provider>,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(screen.getByText("About Us")).toBeInTheDocument();
|
|
16
|
+
expect(screen.getByText("Pages")).toBeInTheDocument();
|
|
17
|
+
expect(screen.getByText("My Page")).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const mockData = {
|
|
22
|
+
categories: [],
|
|
23
|
+
cmsNav: [
|
|
24
|
+
{
|
|
25
|
+
id: 1,
|
|
26
|
+
title: "About Us",
|
|
27
|
+
menuAttached: false,
|
|
28
|
+
order: 1,
|
|
29
|
+
path: "https://youtube.com",
|
|
30
|
+
type: "EXTERNAL",
|
|
31
|
+
uiRouterKey: "about-us",
|
|
32
|
+
slug: {},
|
|
33
|
+
external: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 2,
|
|
37
|
+
title: "Pages",
|
|
38
|
+
menuAttached: true,
|
|
39
|
+
order: 2,
|
|
40
|
+
path: "/pages",
|
|
41
|
+
type: "WRAPPER",
|
|
42
|
+
uiRouterKey: "pages",
|
|
43
|
+
slug: "pages-1",
|
|
44
|
+
external: false,
|
|
45
|
+
items: [
|
|
46
|
+
{
|
|
47
|
+
id: 3,
|
|
48
|
+
title: "My Page",
|
|
49
|
+
menuAttached: false,
|
|
50
|
+
order: 1,
|
|
51
|
+
path: "/pages/my-page",
|
|
52
|
+
type: "INTERNAL",
|
|
53
|
+
uiRouterKey: "my-page",
|
|
54
|
+
slug: "pages-my-page",
|
|
55
|
+
external: false,
|
|
56
|
+
related: {
|
|
57
|
+
id: 1,
|
|
58
|
+
title: "My Page",
|
|
59
|
+
slug: "my-page",
|
|
60
|
+
createdAt: "2025-01-20T17:27:16.685Z",
|
|
61
|
+
updatedAt: "2025-01-20T17:27:19.608Z",
|
|
62
|
+
publishedAt: "2025-01-20T17:27:19.603Z",
|
|
63
|
+
__contentType: "api::page.page",
|
|
64
|
+
navigationItemId: 3,
|
|
65
|
+
__templateName: "Generic",
|
|
66
|
+
},
|
|
67
|
+
items: [
|
|
68
|
+
{
|
|
69
|
+
id: 4,
|
|
70
|
+
title: "NESTED",
|
|
71
|
+
menuAttached: false,
|
|
72
|
+
order: 1,
|
|
73
|
+
path: "https://google.com",
|
|
74
|
+
type: "EXTERNAL",
|
|
75
|
+
uiRouterKey: "nested",
|
|
76
|
+
slug: {},
|
|
77
|
+
external: true,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./nav-list";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { PropsWithChildren, RefObject } from "react";
|
|
4
|
+
import { usePathname } from "next/navigation";
|
|
5
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
6
|
+
// MUI ICON COMPONENTS
|
|
7
|
+
import ArrowLeft from "@mui/icons-material/ArrowLeft";
|
|
8
|
+
import ArrowRight from "@mui/icons-material/ArrowRight";
|
|
9
|
+
// GLOBAL CUSTOM HOOKS
|
|
10
|
+
import useOverflowDetect from "@evenicanpm/storefront-core/src/hooks/use-overflow-detect";
|
|
11
|
+
import useSettings from "@evenicanpm/storefront-core/src/hooks/use-settings";
|
|
12
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
13
|
+
import { Span } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
14
|
+
import BazaarCard from "@evenicanpm/storefront-core/src/components-v2/BazaarCard";
|
|
15
|
+
// STYLED COMPONENTS
|
|
16
|
+
import { ParentNav, ParentNavItem } from "../styles";
|
|
17
|
+
|
|
18
|
+
import { TransformedNavItem } from "@evenicanpm/storefront-core/src/components-v2/navbar/utils/transform-nav";
|
|
19
|
+
|
|
20
|
+
// ==============================================================
|
|
21
|
+
interface Props extends PropsWithChildren {
|
|
22
|
+
nav: TransformedNavItem;
|
|
23
|
+
}
|
|
24
|
+
// ==============================================================
|
|
25
|
+
|
|
26
|
+
export default function NavItemChild({ nav, children }: Props) {
|
|
27
|
+
const pathname = usePathname();
|
|
28
|
+
const { settings } = useSettings();
|
|
29
|
+
const { checkOverflow, elementRef, isLeftOverflowing, isRightOverflowing } =
|
|
30
|
+
useOverflowDetect();
|
|
31
|
+
|
|
32
|
+
const isActive = nav.items.flat().find((item) => {
|
|
33
|
+
const { href } = item;
|
|
34
|
+
if (!href || !pathname) return false;
|
|
35
|
+
return href === pathname;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<ParentNav
|
|
40
|
+
minWidth={200}
|
|
41
|
+
active={isActive ? 1 : 0}
|
|
42
|
+
onMouseEnter={checkOverflow}
|
|
43
|
+
>
|
|
44
|
+
<MenuItem color="grey.700">
|
|
45
|
+
<Span flex="1 1 0">{nav?.title}</Span>
|
|
46
|
+
|
|
47
|
+
{settings.direction === "ltr" ? (
|
|
48
|
+
<ArrowRight fontSize="small" />
|
|
49
|
+
) : (
|
|
50
|
+
<ArrowLeft fontSize="small" />
|
|
51
|
+
)}
|
|
52
|
+
</MenuItem>
|
|
53
|
+
|
|
54
|
+
<ParentNavItem
|
|
55
|
+
ref={elementRef as RefObject<HTMLDivElement>}
|
|
56
|
+
left={isLeftOverflowing}
|
|
57
|
+
right={isRightOverflowing}
|
|
58
|
+
className="parent-nav-item"
|
|
59
|
+
>
|
|
60
|
+
<BazaarCard elevation={3} sx={{ py: "0.5rem", minWidth: 180 }}>
|
|
61
|
+
{children}
|
|
62
|
+
</BazaarCard>
|
|
63
|
+
</ParentNavItem>
|
|
64
|
+
</ParentNav>
|
|
65
|
+
);
|
|
66
|
+
}
|