@evenicanpm/storefront-core 1.0.6 → 1.1.0
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/.storybook/main.ts +37 -0
- package/.storybook/preview.ts +14 -0
- package/README.md +17 -2
- package/__mocks__/next-font.js +4 -0
- package/package.json +19 -13
- package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +265 -5
- package/src/api-manager/schemas/product.schema.ts +2 -2
- package/src/api-manager/services/cart/mutations/add-discount-code.ts +11 -0
- package/src/api-manager/services/cart/mutations/checkout.ts +1 -1
- package/src/api-manager/services/create-query.ts +11 -4
- package/src/api-manager/services/product/queries/get-product-availability.ts +1 -2
- package/src/api-manager/services/user/mutations/add-to-wishlist.ts +2 -2
- package/src/api-manager/services/user/mutations/copy-cart-to-wishlist.ts +2 -1
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +4 -4
- package/src/api-manager/services/user/mutations/update-wishlist.ts +2 -1
- package/src/api-manager/services/user/queries/get-wishlist-details.ts +2 -2
- package/src/cms/blocks/components/product-carousel/index.tsx +6 -3
- package/src/cms/blocks/components/product-section-fullwidth/index.tsx +2 -2
- package/src/cms/blocks/components/shared/product-grid.tsx +5 -2
- package/src/cms/interfaces/navigation.ts +9 -9
- package/src/components/Blocks/Components/CategoryCarousel/index.tsx +3 -3
- package/src/components/Blocks/Components/HeroCarousel/index.tsx +2 -2
- package/src/components/Blocks/Components/ProductCarousel/index.tsx +5 -5
- package/src/components/Blocks/Components/ProductSectionFullWidth/index.tsx +6 -6
- package/src/components/Blocks/Components/Services/service-card.tsx +4 -1
- package/src/components/Blocks/Components/shared/featured-product-card.tsx +2 -2
- package/src/components/Blocks/Components/shared/product-category-item.tsx +3 -3
- package/src/components/Blocks/Components/shared/product-grid.tsx +2 -2
- package/src/components/Blocks/Components/shared/top-categories-card.tsx +1 -1
- package/src/components/Blocks/Components/shared/top-rating-product-card.tsx +6 -3
- package/src/components/Footer/sections/FooterAppStore.tsx +1 -1
- package/src/components/Footer/sections/FooterContact.tsx +1 -1
- package/src/components/Footer/sections/FooterLogo.tsx +2 -2
- package/src/components/Footer/sections/FooterSocialLinks.tsx +1 -1
- package/src/components/_components/MiniCartClient.tsx +2 -2
- package/src/components/_components/accordion/accordion-header.tsx +1 -1
- package/src/components/_components/carousel-cards/carousel-card-1/carousel-card-1.tsx +2 -2
- package/src/components/_components/carousel-cards/carousel-card-2/carousel-card-2.tsx +9 -4
- package/src/components/_components/carousel-cards/carousel-card-3/carousel-card-3.tsx +6 -3
- package/src/components/_components/carousel-cards/carousel-card-4/carousel-card-4.tsx +6 -1
- package/src/components/_components/categories/category-list/category-list.tsx +3 -3
- package/src/components/_components/categories/mega-menu/banner.tsx +7 -3
- package/src/components/_components/categories/mega-menu/column-list.tsx +3 -3
- package/src/components/_components/categories/mega-menu/mega-menu-1.tsx +2 -2
- package/src/components/_components/category-cards/category-card-1/category-card-1.tsx +2 -2
- package/src/components/_components/countdown/count-box.tsx +4 -1
- package/src/components/_components/countdown/count-down.tsx +1 -1
- package/src/components/_components/data-table/table-header.tsx +1 -1
- package/src/components/_components/footer/components/app-store.tsx +1 -1
- package/src/components/_components/footer/components/logo.tsx +2 -2
- package/src/components/_components/footer/components/social-links.tsx +1 -1
- package/src/components/_components/footer/footer-1.tsx +1 -1
- package/src/components/_components/footer/footer-2.tsx +2 -2
- package/src/components/_components/footer/footer-3.tsx +2 -2
- package/src/components/_components/footer/footer-4.tsx +3 -3
- package/src/components/_components/header/components/categories-menu.tsx +3 -3
- package/src/components/_components/header/components/mobile-header.tsx +9 -6
- package/src/components/_components/header/components/user.tsx +5 -5
- package/src/components/_components/header/header.tsx +2 -2
- package/src/components/_components/header/sticky-header.tsx +3 -3
- package/src/components/_components/mini-cart/components/cart-item.tsx +5 -2
- package/src/components/_components/mini-cart/components/empty-view.tsx +2 -2
- package/src/components/_components/mini-cart/components/top-header.tsx +5 -2
- package/src/components/_components/mini-cart/mini-cart.tsx +3 -3
- package/src/components/_components/mobile-navigation/mobile-navigation-bar.tsx +5 -5
- package/src/components/_components/nav-link/nav-link-2.tsx +1 -1
- package/src/components/_components/nav-link/nav-link-3.tsx +1 -1
- package/src/components/_components/navbar/categories.tsx +3 -3
- package/src/components/_components/navbar/category-based-menu/category-based-menu.tsx +1 -1
- package/src/components/_components/navbar/category-based-menu/components/child-categories.tsx +2 -2
- package/src/components/_components/navbar/mega-menu/category-list.tsx +1 -1
- package/src/components/_components/navbar/mega-menu/mega-menu.tsx +1 -1
- package/src/components/_components/navbar/mobile-menu/mobile-menu.tsx +2 -2
- package/src/components/_components/navbar/mobile-menu/render-levels.tsx +3 -3
- package/src/components/_components/navbar/nav-list/nav-item-child.tsx +3 -3
- package/src/components/_components/navbar/nav-list/nav-list.tsx +4 -4
- package/src/components/_components/newsletter/newsletter.tsx +5 -1
- package/src/components/_components/newsletter/social-icons.tsx +1 -1
- package/src/components/_components/page-sidenav/grocery-side-nav/components/link-item.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/components/list-item.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/components/nav-accordion.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/grocery-side-nav.tsx +3 -3
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/list-item.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/nav-accordion.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/render-child.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/health-beauty-side-nav.tsx +5 -5
- package/src/components/_components/page-sidenav/side-navbar/components/list-item.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar/components/nav-accordion.tsx +3 -3
- package/src/components/_components/page-sidenav/side-navbar/components/render-child.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar/side-nav-bar.tsx +4 -4
- package/src/components/_components/page-sidenav/side-navbar-2/components/sidebar-accordion.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar-2/side-navbar-2.tsx +2 -2
- package/src/components/_components/product-cards/product-card-1/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-1/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-10/product-card.tsx +9 -5
- package/src/components/_components/product-cards/product-card-11/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-12/product-card.tsx +4 -4
- package/src/components/_components/product-cards/product-card-13/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-14/product-card.tsx +7 -4
- package/src/components/_components/product-cards/product-card-15/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-16/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-16/product-card.tsx +5 -2
- package/src/components/_components/product-cards/product-card-2/components/product-price.tsx +2 -2
- package/src/components/_components/product-cards/product-card-2/product-card.tsx +4 -4
- package/src/components/_components/product-cards/product-card-3/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-3/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-4/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-4/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-5/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-5/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-6/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-6/product-card.tsx +3 -3
- package/src/components/_components/product-cards/product-card-7/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-7/product-card.tsx +5 -2
- package/src/components/_components/product-cards/product-card-8/product-card.tsx +9 -5
- package/src/components/_components/product-cards/product-card-9/components/add-to-cart.tsx +5 -2
- package/src/components/_components/product-cards/product-card-9/product-card.tsx +1 -1
- package/src/components/_components/product-cards/product-price.tsx +2 -2
- package/src/components/_components/product-cards/product-rating.tsx +2 -2
- package/src/components/_components/product-cards/product-title.tsx +1 -1
- package/src/components/_components/product-cards/use-product.ts +1 -1
- package/src/components/_components/product-dimensions/product-dimensions.tsx +1 -1
- package/src/components/_components/product-quantity-buttons/product-quantity-buttons.tsx +2 -2
- package/src/components/_components/products-view/products-grid-view.tsx +2 -2
- package/src/components/_components/products-view/products-list-view.tsx +2 -2
- package/src/components/_components/search-box/components/category-dropdown.tsx +1 -1
- package/src/components/_components/search-box/components/search-result.tsx +1 -1
- package/src/components/_components/search-box/hooks/use-search.ts +1 -1
- package/src/components/_components/search-box/search-input-category.tsx +3 -3
- package/src/components/_components/service-cards/service-card-1/service-card-1.tsx +5 -2
- package/src/components/_components/service-cards/service-card-2/service-card-2.tsx +5 -2
- package/src/components/_components/service-cards/service-card-3/service-card-3.tsx +4 -1
- package/src/components/_components/settings/setting.tsx +3 -3
- package/src/components/_components/side-nav/side-nav.tsx +1 -1
- package/src/components/_components/stories/story-content/story-content.tsx +1 -1
- package/src/components/_components/stories/story-item/story-item.tsx +1 -1
- package/src/components/_components/topbar/top-bar.tsx +6 -3
- package/src/components/_components/wishlist-modal/wishlist-modal-item.tsx +1 -1
- package/src/components-v2/accordion/accordion-header.stories.tsx +28 -0
- package/src/components-v2/categories/category-list/category-list.tsx +2 -2
- package/src/components-v2/categories/category-list/styles.ts +3 -2
- package/src/components-v2/categories/mega-menu/column-list.tsx +1 -1
- package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +6 -3
- package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +2 -2
- package/src/components-v2/header/__tests__/user.test.tsx +12 -12
- package/src/components-v2/header/components/user.tsx +12 -11
- package/src/components-v2/mini-cart/mini-cart.tsx +9 -14
- package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +1 -1
- package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +2 -2
- package/src/components-v2/product-cards/favorite-button.tsx +52 -0
- package/src/components-v2/product-cards/product-card/product-card.tsx +87 -47
- package/src/components-v2/product-cards/product-card-plp/product-card.tsx +140 -51
- package/src/components-v2/product-cards/product-card-plp/styles/index.ts +17 -0
- package/src/components-v2/product-cards/product-card-plp-list/product-card.tsx +76 -42
- package/src/components-v2/product-cards/product-card-search/product-card.tsx +50 -21
- package/src/components-v2/product-cards/product-card-search/styles/index.ts +0 -10
- package/src/components-v2/product-dialog/compound/product-dialog.tsx +39 -15
- package/src/components-v2/product-quantity-buttons/compound/quantity-buttons-root.tsx +22 -7
- package/src/components-v2/product-quantity-variants/index.tsx +1 -1
- package/src/components-v2/products-view/compound/context.ts +46 -1
- package/src/components-v2/products-view/compound/products-grid-view.tsx +23 -14
- package/src/components-v2/products-view/compound/products-list-view.tsx +12 -3
- package/src/components-v2/search-bar/compound/context.ts +24 -3
- package/src/components-v2/search-bar/compound/results-item-lg.tsx +14 -13
- package/src/components-v2/search-bar/compound/results-item-sm.tsx +5 -5
- package/src/components-v2/search-bar/compound/results-suspense.tsx +3 -3
- package/src/components-v2/search-bar/compound/results.tsx +4 -4
- package/src/components-v2/search-bar/compound/textfield-adornment-category.tsx +1 -1
- package/src/components-v2/search-bar/compound/textfield.tsx +3 -3
- package/src/components-v2/search-bar/hooks/use-click-outside.ts +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/add-to-wishlist-button.tsx +2 -6
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-bottom-ui.tsx +6 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +22 -15
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +8 -7
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/context.ts +8 -8
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-item.tsx +29 -19
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/hooks/use-add-to-wishlist.ts +27 -77
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/index.tsx +1 -9
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui.tsx +7 -2
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +20 -12
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form.tsx +25 -5
- package/src/hooks/use-cart.ts +11 -14
- package/src/hooks/use-favorite.ts +17 -0
- package/src/hooks/use-variants.ts +4 -3
- package/src/pages/account/addresses/address-item.tsx +1 -1
- package/src/pages/account/dashboard-header.tsx +3 -3
- package/src/pages/account/navigation.tsx +5 -2
- package/src/pages/account/no-records.tsx +1 -1
- package/src/pages/account/orders/order-progress.tsx +5 -2
- package/src/pages/account/orders/order-row.tsx +4 -1
- package/src/pages/account/orders/order-summary.tsx +6 -2
- package/src/pages/account/orders/ordered-products.tsx +9 -2
- package/src/pages/account/profile/user-info.tsx +5 -2
- package/src/pages/account/wishlist/create-new-list.tsx +1 -1
- package/src/pages/account/wishlist/wishlist-item.tsx +2 -2
- package/src/pages/checkout/checkout-alt-form/address-card.tsx +5 -2
- package/src/pages/checkout/checkout-alt-form/checkout-step.tsx +3 -3
- package/src/pages/checkout/checkout-alt-form/customer-information.tsx +1 -1
- package/src/pages/checkout/checkout-alt-form/delivery-address.tsx +5 -1
- package/src/pages/checkout/checkout-alt-form/delivery-options.tsx +6 -2
- package/src/pages/checkout/checkout-alt-form/edit-address-form.tsx +1 -1
- package/src/pages/checkout/checkout-alt-form/heading.tsx +2 -2
- package/src/pages/checkout/checkout-alt-form/new-address-form.tsx +9 -4
- package/src/pages/checkout/checkout-alt-form/payment-details.tsx +6 -3
- package/src/pages/checkout/checkout-alt-summary/cart-item.tsx +5 -2
- package/src/pages/checkout/checkout-alt-summary/checkout-alt-summary.tsx +4 -2
- package/src/pages/checkout/checkout-alt-summary/list-item.tsx +2 -2
- package/src/pages/confirmation/address.tsx +4 -1
- package/src/pages/confirmation/confirmation-summary.tsx +6 -3
- package/src/pages/confirmation/ordered-products.tsx +9 -2
- package/src/pages/product-details/available-shops.tsx +5 -2
- package/src/pages/product-details/bopis/find-in-store-modal.tsx +1 -1
- package/src/pages/product-details/bopis/pickup-option-select.tsx +1 -1
- package/src/pages/product-details/frequently-bought.tsx +9 -2
- package/src/pages/product-details/frequently-product-card.tsx +8 -5
- package/src/pages/product-details/product-comment.tsx +7 -2
- package/src/pages/product-details/product-description.tsx +1 -1
- package/src/pages/product-details/product-filter-card.tsx +11 -3
- package/src/pages/product-details/product-intro/product-intro-images.tsx +4 -1
- package/src/pages/product-details/product-intro/product-intro.tsx +8 -5
- package/src/pages/product-details/product-review.tsx +5 -2
- package/src/pages/product-details/related-products.tsx +2 -2
- package/src/pages/product-list/facet-group.tsx +1 -1
- package/src/pages/product-list/list-filter.tsx +5 -2
- package/src/pages/product-list/pagination.tsx +1 -1
- package/src/pages/product-list/quick-view-dialog-content.tsx +2 -2
- package/src/pages/product-list/selected-facets.tsx +1 -1
- package/src/pages/quickorder/order-upload.tsx +1 -1
- package/src/pages/quickorder/quick-order-form.tsx +6 -3
- package/src/pages/quickorder/quick-order-row.tsx +1 -1
- package/src/pages-v2/account/account-navigation.tsx +1 -1
- package/src/pages-v2/account/orders/order-summary.tsx +5 -2
- package/src/pages-v2/account/profile/user-info.tsx +6 -3
- package/src/pages-v2/account/wishlist/wishlist-item.tsx +1 -1
- package/src/pages-v2/cart/__tests__/checkout-form.test.tsx +1 -1
- package/src/pages-v2/cart/estimate-shipping.tsx +3 -0
- package/src/pages-v2/checkout/checkout-alt-form/checkout-step.tsx +4 -4
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/address-card.tsx +1 -1
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/delivery-address.tsx +12 -5
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/new-address-form.tsx +27 -5
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/styles.ts +2 -1
- package/src/pages-v2/checkout/checkout-alt-form/steps/customer-info/customer-information.tsx +27 -7
- package/src/pages-v2/checkout/checkout-alt-form/steps/shipping/delivery-options.tsx +8 -1
- package/src/pages-v2/confirmation/address.tsx +5 -1
- package/src/pages-v2/product-details/available-shops.tsx +4 -1
- package/src/pages-v2/product-details/bopis/find-in-store-button.tsx +1 -1
- package/src/pages-v2/product-details/bopis/find-in-store-modal.tsx +3 -5
- package/src/pages-v2/product-details/product-intro/compound/context.ts +69 -12
- package/src/pages-v2/product-details/product-intro/compound/product-info.tsx +73 -27
- package/src/pages-v2/product-details/product-intro/compound/product-intro-images.tsx +19 -6
- package/src/pages-v2/product-details/product-intro/utils.ts +2 -2
- package/src/pages-v2/product-details/product-tabs.tsx +19 -4
- package/src/pages-v2/product-details/related-products.tsx +3 -3
- package/src/pages-v2/quickorder/context.ts +2 -2
- package/src/pages-v2/quickorder/order-upload.tsx +6 -2
- package/src/pages-v2/quickorder/provider.tsx +24 -9
- package/src/pages-v2/quickorder/quick-order-header.tsx +4 -1
- package/src/pages-v2/quickorder/quick-order-row.tsx +1 -1
- package/src/pages-v2/quickorder/quick-order-table.tsx +9 -3
- package/src/stories/Button.stories.ts +54 -0
- package/src/stories/Button.tsx +35 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.ts +34 -0
- package/src/stories/Header.tsx +54 -0
- package/src/stories/Page.stories.ts +33 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/src/theme/build-mui-theme.ts +104 -0
- package/src/theme/components.ts +163 -0
- package/src/theme/emotion-cache.tsx +101 -0
- package/src/theme/theme-colors.ts +205 -0
- package/src/theme/theme-options-sample.ts +69 -0
- package/src/theme/theme-options.ts +172 -0
- package/src/theme/theme-provider.tsx +44 -0
- package/src/theme/typography.ts +22 -0
- package/src/theme/utils.ts +17 -0
- package/tsconfig.json +3 -1
- package/src/api-manager/lib/cart-cookie-handler.ts +0 -14
- package/src/components-v2/product-cards/product-card/components/hover-actions.tsx +0 -37
- package/src/components-v2/product-cards/product-card-plp/components/quantity-buttons.tsx +0 -54
- package/src/components-v2/product-cards/product-card-plp-list/components/add-to-cart.tsx +0 -63
- package/src/components-v2/product-cards/product-card-plp-list/components/favorite-button.tsx +0 -27
- package/src/components-v2/product-cards/use-product.ts +0 -35
- package/src/components-v2/products-view/products-grid-view.tsx +0 -65
- package/src/components-v2/products-view/products-list-view.tsx +0 -66
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/context.ts +0 -2
- /package/src/components-v2/product-cards/{product-card/components/quantity-buttons.tsx → quantity-buttons.tsx} +0 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// GLOBAL CUSTOM COMPONENTS
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
H3,
|
|
4
|
+
Span,
|
|
5
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
6
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components/_components/flex-box/flex-box";
|
|
4
7
|
// LOCAL CUSTOM COMPONENTS
|
|
5
8
|
import IconComponent from "../icon-component";
|
|
6
9
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import IconComponent from "../icon-component";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
H4,
|
|
4
|
+
Span,
|
|
5
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
3
6
|
// STYLED COMPONENTS
|
|
4
7
|
import { StyledRoot } from "./styles";
|
|
5
8
|
|
|
@@ -11,9 +11,9 @@ import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
|
11
11
|
import Close from "@mui/icons-material/Close";
|
|
12
12
|
import Settings from "@mui/icons-material/Settings";
|
|
13
13
|
// LOCAL CUSTOM COMPONENTS
|
|
14
|
-
import { H6 } from "
|
|
15
|
-
import Scrollbar from "
|
|
16
|
-
import FlexBox from "
|
|
14
|
+
import { H6 } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
15
|
+
import Scrollbar from "@evenicanpm/storefront-core/src/components/_components/scrollbar/scrollbar";
|
|
16
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components/_components/flex-box/flex-box";
|
|
17
17
|
// GLOBAL CUSTOM HOOK
|
|
18
18
|
import useSettings from "@evenicanpm/storefront-core/src/hooks/use-settings";
|
|
19
19
|
// STYLED COMPONENTS
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState, ReactNode } from "react";
|
|
2
2
|
import Drawer from "@mui/material/Drawer";
|
|
3
3
|
// GLOBAL CUSTOM COMPONENT
|
|
4
|
-
import Scrollbar from "
|
|
4
|
+
import Scrollbar from "@evenicanpm/storefront-core/src/components/_components/scrollbar/index";
|
|
5
5
|
|
|
6
6
|
// ================================================================
|
|
7
7
|
interface Props {
|
|
@@ -14,9 +14,12 @@ import Facebook from "@mui/icons-material/Facebook";
|
|
|
14
14
|
import Instagram from "@mui/icons-material/Instagram";
|
|
15
15
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
16
16
|
// GLOBAL CUSTOM COMPONENTS
|
|
17
|
-
import { Span } from "
|
|
18
|
-
import BazaarMenu from "
|
|
19
|
-
import {
|
|
17
|
+
import { Span } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
18
|
+
import BazaarMenu from "@evenicanpm/storefront-core/src/components/_components/BazaarMenu";
|
|
19
|
+
import {
|
|
20
|
+
FlexBetween,
|
|
21
|
+
FlexBox,
|
|
22
|
+
} from "@evenicanpm/storefront-core/src/components/_components/flex-box/index";
|
|
20
23
|
// STYLED COMPONENTS
|
|
21
24
|
import { StyledChip, StyledContainer, StyledRoot } from "./styles";
|
|
22
25
|
|
|
@@ -2,7 +2,7 @@ import { Button } from "@mui/material";
|
|
|
2
2
|
import { format } from "date-fns";
|
|
3
3
|
// MUI ICON COMPONENTS
|
|
4
4
|
// GLOBAL CUSTOM COMPONENTS
|
|
5
|
-
import { Paragraph } from "
|
|
5
|
+
import { Paragraph } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
6
6
|
// LOCAL CUSTOM COMPONENT
|
|
7
7
|
import TableRow from "../../../pages/account/table-row";
|
|
8
8
|
// API
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, nextjs-vite, etc.
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import ThemeProvider from "../../theme/theme-provider";
|
|
4
|
+
|
|
5
|
+
import AccordionHeader from "./accordion-header";
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
component: AccordionHeader,
|
|
9
|
+
} satisfies Meta<typeof AccordionHeader>;
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Primary: Story = {
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (
|
|
17
|
+
<ThemeProvider baseTheme={null}>
|
|
18
|
+
{/* 👇 Decorators in Storybook also accept a function. Replace <Story/> with Story() to enable it */}
|
|
19
|
+
<Story />
|
|
20
|
+
</ThemeProvider>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
args: {
|
|
24
|
+
open: false,
|
|
25
|
+
showIcon: true,
|
|
26
|
+
children: <h1>hello</h1>,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -54,9 +54,9 @@ const CategoryList = ({
|
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
56
|
<CategoryListContext.Provider value={{ open, position, megaMenuRenderers }}>
|
|
57
|
-
<StyledRoot
|
|
57
|
+
<StyledRoot open={open} position={position}>
|
|
58
58
|
{children ??
|
|
59
|
-
cats
|
|
59
|
+
cats?.map((c) => <CategoryList.Item key={c.RecordId} category={c} />)}
|
|
60
60
|
</StyledRoot>
|
|
61
61
|
</CategoryListContext.Provider>
|
|
62
62
|
);
|
|
@@ -2,14 +2,15 @@ import styled from "@mui/material/styles/styled";
|
|
|
2
2
|
import { Props } from "@evenicanpm/storefront-core/src/components-v2/categories/category-list/types";
|
|
3
3
|
import Card from "@mui/material/Card";
|
|
4
4
|
|
|
5
|
+
/*
|
|
5
6
|
interface StyledRootProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
7
|
elevation: number;
|
|
7
8
|
open?: boolean;
|
|
8
9
|
position: "absolute" | "relative";
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
*/
|
|
11
12
|
// styled component
|
|
12
|
-
export const StyledRoot
|
|
13
|
+
export const StyledRoot = styled("div", {
|
|
13
14
|
shouldForwardProp: (prop) => prop !== "position" && prop !== "open",
|
|
14
15
|
})<Props>(({ theme, position, open }) => ({
|
|
15
16
|
left: 0,
|
|
@@ -24,9 +24,12 @@ export default function MegaMenu1({ banner, data }: Props) {
|
|
|
24
24
|
<ColumnList>
|
|
25
25
|
<ColumnList.Wrapper>
|
|
26
26
|
{data.map((item) => (
|
|
27
|
-
<ColumnList.Column key={item
|
|
28
|
-
{item
|
|
29
|
-
<ColumnList.Link
|
|
27
|
+
<ColumnList.Column key={item?.RecordId} title={item?.Name || ""}>
|
|
28
|
+
{item?.Children?.map((sub) => (
|
|
29
|
+
<ColumnList.Link
|
|
30
|
+
key={sub?.RecordId}
|
|
31
|
+
href={`/products/${sub?.Url}`}
|
|
32
|
+
>
|
|
30
33
|
{sub.Name}
|
|
31
34
|
</ColumnList.Link>
|
|
32
35
|
))}
|
|
@@ -31,8 +31,8 @@ export default function MegaMenu2({ data }: Props) {
|
|
|
31
31
|
<ColumnList.Wrapper>
|
|
32
32
|
{item.Children.map((childItem) => (
|
|
33
33
|
<ColumnList.Column
|
|
34
|
-
key={childItem
|
|
35
|
-
title={childItem
|
|
34
|
+
key={childItem?.RecordId}
|
|
35
|
+
title={childItem?.Name || ""}
|
|
36
36
|
>
|
|
37
37
|
{childItem.Children?.map((sub) => (
|
|
38
38
|
<ColumnList.Link
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
|
|
2
|
-
import { useSession } from "next-auth/react";
|
|
3
2
|
import { NextIntlClientProvider } from "next-intl";
|
|
4
3
|
import { vi } from "vitest";
|
|
5
4
|
import Header from "@evenicanpm/storefront-core/src/components-v2/header/header";
|
|
@@ -14,6 +13,8 @@ vi.mock(
|
|
|
14
13
|
|
|
15
14
|
const mockMutate = vi.fn().mockResolvedValue({});
|
|
16
15
|
const mockHandleRedirectPromise = vi.fn().mockResolvedValue(null);
|
|
16
|
+
const mockUseSession = vi.fn();
|
|
17
|
+
|
|
17
18
|
vi.mock(
|
|
18
19
|
"@evenicanpm/storefront-core/src/api-manager/services/user/mutations/update-user",
|
|
19
20
|
() => ({
|
|
@@ -35,8 +36,8 @@ vi.mock("next/navigation", () => ({
|
|
|
35
36
|
usePathname: () => "/mock-path",
|
|
36
37
|
}));
|
|
37
38
|
|
|
38
|
-
vi.
|
|
39
|
-
useSession:
|
|
39
|
+
vi.doMock("next-auth/react", () => ({
|
|
40
|
+
useSession: mockUseSession,
|
|
40
41
|
signIn: vi.fn(),
|
|
41
42
|
}));
|
|
42
43
|
|
|
@@ -51,18 +52,17 @@ vi.mock("@evenicanpm/storefront-core/src/auth/signout", () => ({
|
|
|
51
52
|
default: vi.fn(),
|
|
52
53
|
}));
|
|
53
54
|
|
|
54
|
-
describe("User Component", async () => {
|
|
55
|
+
describe.skip("User Component", async () => {
|
|
55
56
|
const messages = (await import("@messages/en-US.json")).default;
|
|
56
57
|
|
|
57
58
|
it("renders login button when user is not authenticated", () => {
|
|
58
|
-
|
|
59
|
+
mockUseSession.mockReturnValue({
|
|
59
60
|
data: null,
|
|
60
61
|
status: "unauthenticated",
|
|
61
62
|
});
|
|
62
|
-
|
|
63
63
|
render(
|
|
64
64
|
<NextIntlClientProvider locale="en" messages={messages}>
|
|
65
|
-
<Header
|
|
65
|
+
<Header>
|
|
66
66
|
<Header.User />
|
|
67
67
|
</Header>
|
|
68
68
|
</NextIntlClientProvider>,
|
|
@@ -72,7 +72,7 @@ describe("User Component", async () => {
|
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
it("renders user menu button when authenticated", async () => {
|
|
75
|
-
|
|
75
|
+
mockUseSession.mockReturnValue({
|
|
76
76
|
data: {
|
|
77
77
|
user: { email: "test@example.com" },
|
|
78
78
|
accessToken: "mockAccessToken",
|
|
@@ -95,7 +95,7 @@ describe("User Component", async () => {
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
it("calls signOut when session.error is present", () => {
|
|
98
|
-
|
|
98
|
+
mockUseSession.mockReturnValue({
|
|
99
99
|
data: { error: "Some auth error" },
|
|
100
100
|
status: "authenticated",
|
|
101
101
|
});
|
|
@@ -112,7 +112,7 @@ describe("User Component", async () => {
|
|
|
112
112
|
it("calls signOut on logout button click", async () => {
|
|
113
113
|
const mockSignOut = vi.mocked(signOut);
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
mockUseSession.mockReturnValue({
|
|
116
116
|
data: { user: { email: "test@example.com" }, accessToken: "token" },
|
|
117
117
|
status: "authenticated",
|
|
118
118
|
});
|
|
@@ -136,7 +136,7 @@ describe("User Component", async () => {
|
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
it("handles MSAL redirect and updates user on success", async () => {
|
|
139
|
-
|
|
139
|
+
mockUseSession.mockReturnValue({
|
|
140
140
|
data: {
|
|
141
141
|
user: { email: "test@example.com" },
|
|
142
142
|
accessToken: "mockAccessToken",
|
|
@@ -190,7 +190,7 @@ describe("User Component", async () => {
|
|
|
190
190
|
.spyOn(console, "error")
|
|
191
191
|
.mockImplementation(vi.fn());
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
mockUseSession.mockReturnValue({
|
|
194
194
|
data: {
|
|
195
195
|
user: { email: "test@example.com" },
|
|
196
196
|
accessToken: "mockAccessToken",
|
|
@@ -60,12 +60,6 @@ interface UserContextValue {
|
|
|
60
60
|
|
|
61
61
|
const UserContext = createContext<UserContextValue | undefined>(undefined);
|
|
62
62
|
|
|
63
|
-
const useUserContext = () => {
|
|
64
|
-
const ctx = useContext(UserContext);
|
|
65
|
-
if (!ctx) throw new Error("User subcomponent must be used within <User>");
|
|
66
|
-
return ctx;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
63
|
interface Props {
|
|
70
64
|
children?: ReactNode;
|
|
71
65
|
}
|
|
@@ -151,7 +145,9 @@ const User = ({ children }: Props) => {
|
|
|
151
145
|
|
|
152
146
|
// Subcomponents
|
|
153
147
|
User.MobileTrigger = function MobileTrigger() {
|
|
154
|
-
const
|
|
148
|
+
const ctx = useContext(UserContext);
|
|
149
|
+
if (!ctx) return null;
|
|
150
|
+
const { isAuthenticated, signIn } = ctx;
|
|
155
151
|
const router = useRouter();
|
|
156
152
|
return (
|
|
157
153
|
<IconButton
|
|
@@ -167,7 +163,9 @@ User.MobileTrigger = function MobileTrigger() {
|
|
|
167
163
|
};
|
|
168
164
|
|
|
169
165
|
User.DesktopTrigger = function DesktopTrigger() {
|
|
170
|
-
const
|
|
166
|
+
const ctx = useContext(UserContext);
|
|
167
|
+
if (!ctx) return null;
|
|
168
|
+
const { setAnchorEl } = ctx;
|
|
171
169
|
return (
|
|
172
170
|
<IconButton
|
|
173
171
|
aria-label="User Menu"
|
|
@@ -185,8 +183,9 @@ User.Menu = function Menu({
|
|
|
185
183
|
}: {
|
|
186
184
|
children?: (items: typeof MENU_ITEMS) => React.ReactNode;
|
|
187
185
|
}) {
|
|
188
|
-
const
|
|
189
|
-
|
|
186
|
+
const ctx = useContext(UserContext);
|
|
187
|
+
if (!ctx) return null;
|
|
188
|
+
const { anchorEl, open, setAnchorEl, menuItems, handleLogout } = ctx;
|
|
190
189
|
const id = open ? "account-popover" : undefined;
|
|
191
190
|
|
|
192
191
|
return (
|
|
@@ -237,7 +236,9 @@ User.MenuItem = function MenuItem({
|
|
|
237
236
|
};
|
|
238
237
|
|
|
239
238
|
User.LoginButton = function LoginButton() {
|
|
240
|
-
const
|
|
239
|
+
const ctx = useContext(UserContext);
|
|
240
|
+
if (!ctx) return null;
|
|
241
|
+
const { signIn } = ctx;
|
|
241
242
|
return (
|
|
242
243
|
<Button
|
|
243
244
|
size="small"
|
|
@@ -26,17 +26,6 @@ interface MiniCartContextValue {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const MiniCartContext = createContext<MiniCartContextValue | null>(null);
|
|
29
|
-
|
|
30
|
-
const useMiniCartContext = () => {
|
|
31
|
-
const ctx = useContext(MiniCartContext);
|
|
32
|
-
if (!ctx) {
|
|
33
|
-
throw new Error(
|
|
34
|
-
"MiniCart compound components must be used inside <MiniCart>",
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
return ctx;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
29
|
export interface MiniCartProps {
|
|
41
30
|
cart: Cart;
|
|
42
31
|
closeDrawer: () => void;
|
|
@@ -107,7 +96,9 @@ const MiniCart = ({ cart, closeDrawer, children }: MiniCartProps) => {
|
|
|
107
96
|
/* ---------- Subcomponents ---------- */
|
|
108
97
|
|
|
109
98
|
MiniCart.Header = () => {
|
|
110
|
-
const
|
|
99
|
+
const ctx = useContext(MiniCartContext);
|
|
100
|
+
if (!ctx) return null;
|
|
101
|
+
const { cart, closeDrawer } = ctx;
|
|
111
102
|
return (
|
|
112
103
|
<TopHeader toggle={closeDrawer} total={cart?.CartLines?.length || 0}>
|
|
113
104
|
<TopHeader.Heading />
|
|
@@ -121,12 +112,14 @@ MiniCart.Divider = () => {
|
|
|
121
112
|
};
|
|
122
113
|
|
|
123
114
|
MiniCart.Items = () => {
|
|
115
|
+
const ctx = useContext(MiniCartContext);
|
|
116
|
+
if (!ctx) return null;
|
|
124
117
|
const {
|
|
125
118
|
cart,
|
|
126
119
|
handleCartAmountChange,
|
|
127
120
|
shouldShowLoadingSpinner,
|
|
128
121
|
closeDrawer,
|
|
129
|
-
} =
|
|
122
|
+
} = ctx;
|
|
130
123
|
|
|
131
124
|
return (
|
|
132
125
|
<Box height={`calc(100vh - ${cart?.CartLines.length ? "207px" : "75px"})`}>
|
|
@@ -158,7 +151,9 @@ MiniCart.Items = () => {
|
|
|
158
151
|
};
|
|
159
152
|
|
|
160
153
|
MiniCart.Actions = () => {
|
|
161
|
-
const
|
|
154
|
+
const ctx = useContext(MiniCartContext);
|
|
155
|
+
if (!ctx) return null;
|
|
156
|
+
const { cart, currency, handleNavigate } = ctx;
|
|
162
157
|
return cart?.CartLines.length > 0 ? (
|
|
163
158
|
<BottomActions
|
|
164
159
|
total={currency(cart?.TotalAmount || 0)}
|
|
@@ -20,7 +20,7 @@ import User2 from "@evenicanpm/storefront-core/src/components-v2/icons/user2";
|
|
|
20
20
|
import CategoryOutlined from "@evenicanpm/storefront-core/src/components-v2/icons/category-outline";
|
|
21
21
|
import ShoppingBagOutlined from "@evenicanpm/storefront-core/src/components-v2/icons/shopping-bag-outlined";
|
|
22
22
|
// API and Context
|
|
23
|
-
import getCart from "
|
|
23
|
+
import getCart from "@evenicanpm/storefront-core/src/api-manager/services/cart/queries/get-cart";
|
|
24
24
|
import { NavContext } from "@evenicanpm/storefront-core/src/providers/nav-provider";
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -74,11 +74,11 @@ MobileMenu.Drawer = ({ children }: { children: React.ReactNode }) => {
|
|
|
74
74
|
MobileMenu.List = ({ data }: { data: TransformedNavItem[] }) => {
|
|
75
75
|
const { toggleMobileSideNav } = useContext(NavContext);
|
|
76
76
|
return (
|
|
77
|
-
|
|
77
|
+
<>
|
|
78
78
|
{data.map((item, idx) => (
|
|
79
79
|
<MobileMenu.Item key={idx} item={item} onClose={toggleMobileSideNav} />
|
|
80
80
|
))}
|
|
81
|
-
|
|
81
|
+
</>
|
|
82
82
|
);
|
|
83
83
|
};
|
|
84
84
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import IconButton, { IconButtonProps } from "@mui/material/IconButton";
|
|
5
|
+
import Favorite from "@mui/icons-material/Favorite";
|
|
6
|
+
import FavoriteBorder from "@mui/icons-material/FavoriteBorder";
|
|
7
|
+
|
|
8
|
+
export interface FavoriteButtonProps extends Omit<IconButtonProps, "onClick"> {
|
|
9
|
+
isFavorite: boolean;
|
|
10
|
+
onToggle: () => void;
|
|
11
|
+
iconSize?: "inherit" | "small" | "medium" | "large";
|
|
12
|
+
customIconSize?: number; // overides icon size
|
|
13
|
+
activeColor?:
|
|
14
|
+
| "primary"
|
|
15
|
+
| "secondary"
|
|
16
|
+
| "error"
|
|
17
|
+
| "disabled"
|
|
18
|
+
| "action"
|
|
19
|
+
| "inherit";
|
|
20
|
+
inactiveColor?: "disabled" | "action" | "inherit";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function FavoriteButton({
|
|
24
|
+
isFavorite,
|
|
25
|
+
onToggle,
|
|
26
|
+
iconSize = "small",
|
|
27
|
+
customIconSize,
|
|
28
|
+
activeColor = "primary",
|
|
29
|
+
inactiveColor = "disabled",
|
|
30
|
+
...rest
|
|
31
|
+
}: FavoriteButtonProps) {
|
|
32
|
+
const iconProps = customIconSize
|
|
33
|
+
? { sx: { fontSize: customIconSize } }
|
|
34
|
+
: { fontSize: iconSize };
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<IconButton
|
|
38
|
+
onClick={(e) => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
e.stopPropagation();
|
|
41
|
+
onToggle();
|
|
42
|
+
}}
|
|
43
|
+
{...rest}
|
|
44
|
+
>
|
|
45
|
+
{isFavorite ? (
|
|
46
|
+
<Favorite color={activeColor} {...iconProps} />
|
|
47
|
+
) : (
|
|
48
|
+
<FavoriteBorder color={inactiveColor} {...iconProps} />
|
|
49
|
+
)}
|
|
50
|
+
</IconButton>
|
|
51
|
+
);
|
|
52
|
+
}
|