@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
|
@@ -7,22 +7,16 @@ import { useTranslations } from "next-intl";
|
|
|
7
7
|
// Core/storefront utilities
|
|
8
8
|
import { useNotification } from "@evenicanpm/storefront-core/src/providers/notifications/use-notification";
|
|
9
9
|
import {
|
|
10
|
-
CopyCartToWishlistInput,
|
|
11
10
|
ExtendedProductListLine,
|
|
12
11
|
WishlistLinesInput,
|
|
13
12
|
} from "@evenicanpm/storefront-core/src/api-manager/schemas/user.schema";
|
|
14
13
|
|
|
15
14
|
// API manager - mutations
|
|
16
15
|
import useAddToWishlist from "@/api-manager/services/user/mutations/add-to-wishlist";
|
|
17
|
-
import useCopyCartToWishlist from "@/api-manager/services/user/mutations/copy-cart-to-wishlist";
|
|
18
16
|
import useRemoveFromWishlist from "@/api-manager/services/user/mutations/remove-from-wishlist";
|
|
19
17
|
|
|
20
18
|
// API manager - queries and types
|
|
21
19
|
import getWishlists from "@/api-manager/services/user/queries/get-wishlists";
|
|
22
|
-
import { Wishlist } from "@/api-manager/schemas/user.schema";
|
|
23
|
-
|
|
24
|
-
// Component props
|
|
25
|
-
import { AddToWishlistDialogProps } from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog";
|
|
26
20
|
|
|
27
21
|
/**
|
|
28
22
|
* Handles adding and removing products from a wishlist.
|
|
@@ -33,81 +27,37 @@ export default function UseWishlist() {
|
|
|
33
27
|
const { setNotification } = useNotification();
|
|
34
28
|
const { mutateAsync: addToWishlist, isPending: addPending } =
|
|
35
29
|
useAddToWishlist();
|
|
36
|
-
const { mutateAsync: copyCartToWishlist } = useCopyCartToWishlist();
|
|
37
30
|
const { mutateAsync: removeFromWishlist, isPending: removePending } =
|
|
38
31
|
useRemoveFromWishlist();
|
|
39
32
|
const { data: wishlists } = getWishlists.useSuspenseData();
|
|
40
33
|
const loading = addPending || removePending;
|
|
41
34
|
|
|
42
|
-
const handleAddToWishlist = async (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
UnitOfMeasure: "ea",
|
|
69
|
-
},
|
|
70
|
-
];
|
|
71
|
-
|
|
72
|
-
const wishlistLinesInput: WishlistLinesInput = {
|
|
73
|
-
Id: wishlistId,
|
|
74
|
-
ProductListLines: wishlistLine,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
await addToWishlist(wishlistLinesInput);
|
|
78
|
-
setNotification({
|
|
79
|
-
message: t("wishlistLineAddSuccess"),
|
|
80
|
-
severity: "success",
|
|
81
|
-
});
|
|
82
|
-
if (typeof props.onSuccess === "function") {
|
|
83
|
-
props.onSuccess();
|
|
84
|
-
}
|
|
85
|
-
} catch (error) {
|
|
86
|
-
setNotification({
|
|
87
|
-
message: t("wishlistLineAddFailed"),
|
|
88
|
-
severity: "error",
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
} else if (props.cart) {
|
|
92
|
-
try {
|
|
93
|
-
const copyCartToWishlistInput: CopyCartToWishlistInput = {
|
|
94
|
-
Id: wishlistId,
|
|
95
|
-
CartID: props.cart.Id,
|
|
96
|
-
IsRewrite: false,
|
|
97
|
-
IsQuantityAggregate: true,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
await copyCartToWishlist(copyCartToWishlistInput);
|
|
101
|
-
setNotification({
|
|
102
|
-
message: t("wishlistCartCopySuccess"),
|
|
103
|
-
severity: "success",
|
|
104
|
-
});
|
|
105
|
-
} catch (error) {
|
|
106
|
-
setNotification({
|
|
107
|
-
message: t("wishlistCartCopyFailed"),
|
|
108
|
-
severity: "error",
|
|
109
|
-
});
|
|
110
|
-
}
|
|
35
|
+
const handleAddToWishlist = async (wishlistId: string, productId: number) => {
|
|
36
|
+
try {
|
|
37
|
+
const wishlistLine = [
|
|
38
|
+
{
|
|
39
|
+
ProductListId: wishlistId,
|
|
40
|
+
ProductId: productId,
|
|
41
|
+
Quantity: 1,
|
|
42
|
+
UnitOfMeasure: "ea",
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const wishlistLinesInput: WishlistLinesInput = {
|
|
47
|
+
Id: wishlistId,
|
|
48
|
+
ProductListLines: wishlistLine,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
await addToWishlist(wishlistLinesInput);
|
|
52
|
+
setNotification({
|
|
53
|
+
message: t("wishlistLineAddSuccess"),
|
|
54
|
+
severity: "success",
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
setNotification({
|
|
58
|
+
message: t("wishlistLineAddFailed"),
|
|
59
|
+
severity: "error",
|
|
60
|
+
});
|
|
111
61
|
}
|
|
112
62
|
};
|
|
113
63
|
|
|
@@ -117,7 +67,7 @@ export default function UseWishlist() {
|
|
|
117
67
|
) => {
|
|
118
68
|
// get the selected wishlist
|
|
119
69
|
const wishlist = wishlists.find((wishlist) => wishlist.Id === wishlistId);
|
|
120
|
-
|
|
70
|
+
if (!wishlist) return null;
|
|
121
71
|
try {
|
|
122
72
|
const extendedWishlistLine = wishlist.ProductListLines?.find(
|
|
123
73
|
(item: ExtendedProductListLine) => item.ProductId === productId,
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import AddToWishlistDialog from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog";
|
|
2
|
-
import { Cart } from "@evenicanpm/storefront-core/src/api-manager/schemas/cart.schema";
|
|
3
2
|
|
|
4
3
|
interface Props {
|
|
5
4
|
open: boolean;
|
|
6
5
|
handleClose: () => void;
|
|
7
6
|
productId?: number;
|
|
8
|
-
cart?: Cart;
|
|
9
7
|
onSuccess?: () => void;
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* @category Implementation
|
|
14
12
|
*/
|
|
15
|
-
const AddToWishListDialog1 = ({
|
|
16
|
-
cart,
|
|
17
|
-
open,
|
|
18
|
-
handleClose,
|
|
19
|
-
productId,
|
|
20
|
-
}: Props) => {
|
|
13
|
+
const AddToWishListDialog1 = ({ open, handleClose, productId }: Props) => {
|
|
21
14
|
return (
|
|
22
15
|
<>
|
|
23
16
|
<AddToWishlistDialog
|
|
24
|
-
cart={cart}
|
|
25
17
|
open={open}
|
|
26
18
|
handleClose={handleClose}
|
|
27
19
|
productId={productId}
|
package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui.tsx
CHANGED
|
@@ -2,11 +2,16 @@ import React, { useContext } from "react";
|
|
|
2
2
|
import { useTranslations } from "next-intl";
|
|
3
3
|
import { Button } from "@mui/material";
|
|
4
4
|
import Grid from "@mui/material/Grid2";
|
|
5
|
-
import { CreateNewWishlistContext } from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/create-wishlist/compound/
|
|
5
|
+
import { CreateNewWishlistContext } from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog";
|
|
6
6
|
|
|
7
7
|
function BottomUI() {
|
|
8
8
|
const t = useTranslations("Account.Wishlists");
|
|
9
|
-
const
|
|
9
|
+
const ctx = useContext(CreateNewWishlistContext);
|
|
10
|
+
if (!ctx)
|
|
11
|
+
throw new Error(
|
|
12
|
+
"CreateNewWishlistForm must be used within a CreateNewWishlistContext",
|
|
13
|
+
);
|
|
14
|
+
const { handleClose } = ctx;
|
|
10
15
|
return (
|
|
11
16
|
<Grid
|
|
12
17
|
size={{ sm: 6, xs: 12 }}
|
package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { createContext } from "react";
|
|
2
2
|
import isFunction from "lodash/isFunction";
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
import { Dialog, DialogContent, CircularProgress } from "@mui/material";
|
|
@@ -11,7 +11,6 @@ import { z } from "zod";
|
|
|
11
11
|
import { withZodSchema } from "formik-validator-zod";
|
|
12
12
|
// API
|
|
13
13
|
import useCreateWishlist from "@evenicanpm/storefront-core/src/api-manager/services/user/mutations/create-wishlist";
|
|
14
|
-
import { CreateNewWishlistContext } from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/create-wishlist/compound/context";
|
|
15
14
|
import CreateNewWishlistForm from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form";
|
|
16
15
|
|
|
17
16
|
interface Props {
|
|
@@ -20,22 +19,32 @@ interface Props {
|
|
|
20
19
|
children: React.ReactNode;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const t = useTranslations("Account.Wishlists");
|
|
26
|
-
const { setNotification } = useNotification();
|
|
27
|
-
|
|
28
|
-
const { mutateAsync: createWishlist } = useCreateWishlist();
|
|
29
|
-
|
|
30
|
-
const FormSchema = z.object({
|
|
22
|
+
const createFormSchema = (t: ReturnType<typeof useTranslations>) =>
|
|
23
|
+
z.object({
|
|
31
24
|
Id: z.string(),
|
|
32
25
|
Name: z.string().nonempty(t("Validation.required", { field: t("name") })),
|
|
33
26
|
Comment: z.string().optional(),
|
|
34
27
|
IsPublic: z.boolean().optional(),
|
|
35
28
|
});
|
|
36
29
|
|
|
37
|
-
|
|
30
|
+
type FormSchemaType = z.infer<ReturnType<typeof createFormSchema>>;
|
|
31
|
+
type FormikContextType = ReturnType<typeof useFormik<FormSchemaType>>;
|
|
32
|
+
|
|
33
|
+
interface CreateNewWishlistContext {
|
|
34
|
+
formik: FormikContextType;
|
|
35
|
+
handleClose: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const CreateNewWishlistContext =
|
|
39
|
+
createContext<CreateNewWishlistContext | null>(null);
|
|
38
40
|
|
|
41
|
+
export default function CreateNewList(props: Props) {
|
|
42
|
+
const { children } = props;
|
|
43
|
+
const t = useTranslations("Account.Wishlists");
|
|
44
|
+
const { setNotification } = useNotification();
|
|
45
|
+
|
|
46
|
+
const { mutateAsync: createWishlist } = useCreateWishlist();
|
|
47
|
+
const FormSchema = createFormSchema(t);
|
|
39
48
|
const handleSubmit = async (values: FormSchemaType) => {
|
|
40
49
|
try {
|
|
41
50
|
await createWishlist({ ...values, IsPublic: !values.IsPublic });
|
|
@@ -87,6 +96,5 @@ const FormTitle = () => {
|
|
|
87
96
|
const t = useTranslations("Account.Wishlists");
|
|
88
97
|
return <H5 mb={4}>{t("formTitle")}</H5>;
|
|
89
98
|
};
|
|
90
|
-
|
|
91
99
|
CreateNewList.Title = FormTitle;
|
|
92
100
|
CreateNewList.Form = CreateNewWishlistForm;
|
package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form.tsx
CHANGED
|
@@ -7,13 +7,18 @@ import { Box, TextField, FormControlLabel, Checkbox } from "@mui/material";
|
|
|
7
7
|
import Grid from "@mui/material/Grid2";
|
|
8
8
|
// Global Custom components
|
|
9
9
|
import BottomUI from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui";
|
|
10
|
-
import { CreateNewWishlistContext } from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/create-wishlist/compound/
|
|
10
|
+
import { CreateNewWishlistContext } from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog";
|
|
11
11
|
|
|
12
12
|
/*
|
|
13
13
|
* @category Sub-Component
|
|
14
14
|
*/
|
|
15
15
|
const CreateNewWishlistForm = ({ children }: { children: React.ReactNode }) => {
|
|
16
|
-
const
|
|
16
|
+
const ctx = useContext(CreateNewWishlistContext);
|
|
17
|
+
if (!ctx)
|
|
18
|
+
throw new Error(
|
|
19
|
+
"CreateNewWishlistForm must be used within a CreateNewWishlistContext",
|
|
20
|
+
);
|
|
21
|
+
const { formik } = ctx;
|
|
17
22
|
return (
|
|
18
23
|
<Box component="form" onSubmit={formik.handleSubmit}>
|
|
19
24
|
<Grid container spacing={3}>
|
|
@@ -28,7 +33,12 @@ const CreateNewWishlistForm = ({ children }: { children: React.ReactNode }) => {
|
|
|
28
33
|
*/
|
|
29
34
|
function NameTextField() {
|
|
30
35
|
const t = useTranslations("Account.Wishlists");
|
|
31
|
-
const
|
|
36
|
+
const ctx = useContext(CreateNewWishlistContext);
|
|
37
|
+
if (!ctx)
|
|
38
|
+
throw new Error(
|
|
39
|
+
"CreateNewWishlistForm must be used within a CreateNewWishlistContext",
|
|
40
|
+
);
|
|
41
|
+
const { formik } = ctx;
|
|
32
42
|
return (
|
|
33
43
|
<Grid size={{ sm: 6, xs: 12 }}>
|
|
34
44
|
<TextField
|
|
@@ -51,7 +61,12 @@ function NameTextField() {
|
|
|
51
61
|
*/
|
|
52
62
|
function DescriptionTextField() {
|
|
53
63
|
const t = useTranslations("Account.Wishlists");
|
|
54
|
-
const
|
|
64
|
+
const ctx = useContext(CreateNewWishlistContext);
|
|
65
|
+
if (!ctx)
|
|
66
|
+
throw new Error(
|
|
67
|
+
"CreateNewWishlistForm must be used within a CreateNewWishlistContext",
|
|
68
|
+
);
|
|
69
|
+
const { formik } = ctx;
|
|
55
70
|
return (
|
|
56
71
|
<Grid size={{ sm: 6, xs: 12 }}>
|
|
57
72
|
<TextField
|
|
@@ -70,7 +85,12 @@ function DescriptionTextField() {
|
|
|
70
85
|
|
|
71
86
|
function IsPrivateCheckbox() {
|
|
72
87
|
const t = useTranslations("Account.Wishlists");
|
|
73
|
-
const
|
|
88
|
+
const ctx = useContext(CreateNewWishlistContext);
|
|
89
|
+
if (!ctx)
|
|
90
|
+
throw new Error(
|
|
91
|
+
"CreateNewWishlistForm must be used within a CreateNewWishlistContext",
|
|
92
|
+
);
|
|
93
|
+
const { formik } = ctx;
|
|
74
94
|
return (
|
|
75
95
|
<Grid size={{ sm: 6, xs: 12 }}>
|
|
76
96
|
<FormControlLabel
|
package/src/hooks/use-cart.ts
CHANGED
|
@@ -19,10 +19,7 @@ export interface AddToCartBopisInput {
|
|
|
19
19
|
* @param recordId the record id of the product's cartline to modify.
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
-
export default function useCart(
|
|
23
|
-
recordId: number,
|
|
24
|
-
selectVariantId?: number | undefined,
|
|
25
|
-
) {
|
|
22
|
+
export default function useCart(recordId?: number) {
|
|
26
23
|
const { data: cart } = getCart.useData();
|
|
27
24
|
const { mutate: deleteCartLine, isPending: deletePending } =
|
|
28
25
|
useDeleteCartLine();
|
|
@@ -33,18 +30,18 @@ export default function useCart(
|
|
|
33
30
|
const loading = deletePending || updatePending || addPending;
|
|
34
31
|
|
|
35
32
|
const currentCartLine = cart?.CartLines?.find((item) => {
|
|
36
|
-
return item?.ProductId ===
|
|
33
|
+
return item?.ProductId === recordId;
|
|
37
34
|
});
|
|
38
35
|
|
|
39
36
|
const handleCartAmountChange = (amount: number) => {
|
|
40
37
|
if (amount === 0) {
|
|
41
38
|
deleteCartLine({
|
|
42
|
-
cartId: cart
|
|
43
|
-
version: cart
|
|
39
|
+
cartId: cart?.Id,
|
|
40
|
+
version: cart?.Version,
|
|
44
41
|
cartLine: [
|
|
45
42
|
{
|
|
46
43
|
LineId: currentCartLine?.LineId,
|
|
47
|
-
ProductId:
|
|
44
|
+
ProductId: recordId,
|
|
48
45
|
},
|
|
49
46
|
],
|
|
50
47
|
});
|
|
@@ -52,13 +49,13 @@ export default function useCart(
|
|
|
52
49
|
}
|
|
53
50
|
|
|
54
51
|
updateCartLine({
|
|
55
|
-
cartId: cart
|
|
56
|
-
version: cart
|
|
52
|
+
cartId: cart?.Id,
|
|
53
|
+
version: cart?.Version,
|
|
57
54
|
cartLine: [
|
|
58
55
|
{
|
|
59
56
|
LineId: currentCartLine?.LineId,
|
|
60
57
|
Quantity: amount,
|
|
61
|
-
ProductId:
|
|
58
|
+
ProductId: recordId,
|
|
62
59
|
},
|
|
63
60
|
],
|
|
64
61
|
});
|
|
@@ -66,12 +63,12 @@ export default function useCart(
|
|
|
66
63
|
|
|
67
64
|
const handleAddToCart = (bopisInput?: AddToCartBopisInput) => {
|
|
68
65
|
addToCart({
|
|
69
|
-
cartId: cart
|
|
70
|
-
version: cart
|
|
66
|
+
cartId: cart?.Id,
|
|
67
|
+
version: cart?.Version,
|
|
71
68
|
cartLine: [
|
|
72
69
|
{
|
|
73
70
|
Quantity: 1,
|
|
74
|
-
ProductId:
|
|
71
|
+
ProductId: recordId,
|
|
75
72
|
WarehouseId: bopisInput?.warehouseId || "",
|
|
76
73
|
DeliveryMode: bopisInput?.deliveryMode || "",
|
|
77
74
|
},
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import getWishLists from "@evenicanpm/storefront-core/src/api-manager/services/user/queries/get-wishlists";
|
|
4
|
+
|
|
5
|
+
export default function useFavorite(recordId?: number) {
|
|
6
|
+
const { data } = getWishLists.useData();
|
|
7
|
+
|
|
8
|
+
const wishlists = Array.isArray(data) ? data : [];
|
|
9
|
+
|
|
10
|
+
if (!recordId || wishlists.length === 0) return false;
|
|
11
|
+
|
|
12
|
+
const isFavorite = wishlists.some((list) =>
|
|
13
|
+
list.ProductListLines?.some((line) => line.ProductId === recordId),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return isFavorite;
|
|
17
|
+
}
|
|
@@ -46,7 +46,7 @@ export default function useVariants(product: ProductDetails) {
|
|
|
46
46
|
getProductById.useData({ id: state.selectedVariantRecordId });
|
|
47
47
|
|
|
48
48
|
const allDimensionsSelected =
|
|
49
|
-
Object.keys(state.selectDimensions)
|
|
49
|
+
Object.keys(state.selectDimensions)?.length === DimensionValues?.length;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Adds selected dimension to the current selectDimensions state
|
|
@@ -80,7 +80,7 @@ const prefetchPDPData = (
|
|
|
80
80
|
dimensionValue: ProductDimensionValueInventoryAvailability,
|
|
81
81
|
queryClient: QueryClient,
|
|
82
82
|
) => {
|
|
83
|
-
dimensionValue
|
|
83
|
+
dimensionValue?.ProductIds?.map((id) => {
|
|
84
84
|
getProductById.prefetchData(queryClient, { id: id });
|
|
85
85
|
getProductPrices.prefetchData(queryClient, {
|
|
86
86
|
productIds: [id],
|
|
@@ -108,7 +108,8 @@ const variantReducer = (state: VariantState, action: VariantAction) => {
|
|
|
108
108
|
case "SELECT_DIMENSION":
|
|
109
109
|
const newDimensionsState: SelectedDimensions = {
|
|
110
110
|
...state.selectDimensions,
|
|
111
|
-
[action.dimensionValue?.DimensionTypeValue]:
|
|
111
|
+
[action.dimensionValue?.DimensionTypeValue ?? ""]:
|
|
112
|
+
action.dimensionValue,
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
const allDimensionsSelected =
|
|
@@ -7,7 +7,7 @@ import { useNotification } from "@/components/Notifications/use-notification";
|
|
|
7
7
|
import { MdEdit as Edit } from "react-icons/md";
|
|
8
8
|
import { MdDelete as Delete } from "react-icons/md";
|
|
9
9
|
// GLOBAL CUSTOM COMPONENTS
|
|
10
|
-
import { Paragraph } from "
|
|
10
|
+
import { Paragraph } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
11
11
|
// LOCAL CUSTOM COMPONENT
|
|
12
12
|
import TableRow from "../table-row";
|
|
13
13
|
// API
|
|
@@ -6,9 +6,9 @@ import { useTranslations } from "next-intl";
|
|
|
6
6
|
// ICON COMPONENTS
|
|
7
7
|
import { MdMenu as Menu } from "react-icons/md";
|
|
8
8
|
// GLOBAL CUSTOM COMPONENTS
|
|
9
|
-
import SideNav from "
|
|
10
|
-
import { H2 } from "
|
|
11
|
-
import FlexBox from "
|
|
9
|
+
import SideNav from "@evenicanpm/storefront-core/src/components/_components/side-nav/index";
|
|
10
|
+
import { H2 } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
11
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components/_components/flex-box/flex-box";
|
|
12
12
|
// LOCAL CUSTOM COMPONENTS
|
|
13
13
|
import Navigation from "./navigation";
|
|
14
14
|
import { IconType } from "react-icons";
|
|
@@ -13,8 +13,11 @@ import {
|
|
|
13
13
|
} from "react-icons/md";
|
|
14
14
|
|
|
15
15
|
// GLOBAL CUSTOM COMPONENTS
|
|
16
|
-
import FlexBox from "
|
|
17
|
-
import {
|
|
16
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components/_components/flex-box/flex-box";
|
|
17
|
+
import {
|
|
18
|
+
Paragraph,
|
|
19
|
+
Span,
|
|
20
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
18
21
|
|
|
19
22
|
// API
|
|
20
23
|
import getUser from "@/api-manager/services/user/queries/get-user";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Box } from "@mui/material";
|
|
3
|
-
import { H4 } from "
|
|
3
|
+
import { H4 } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
4
4
|
import { useTranslations } from "next-intl";
|
|
5
5
|
|
|
6
6
|
type Props = { message: string };
|
|
@@ -11,8 +11,11 @@ import Delivery from "./icons/delivery";
|
|
|
11
11
|
import PackageBox from "./icons/package-box";
|
|
12
12
|
import TruckFilled from "./icons/truck-filled";
|
|
13
13
|
// GLOBAL CUSTOM COMPONENTS
|
|
14
|
-
import { Paragraph } from "
|
|
15
|
-
import {
|
|
14
|
+
import { Paragraph } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
15
|
+
import {
|
|
16
|
+
FlexBetween,
|
|
17
|
+
FlexBox,
|
|
18
|
+
} from "@evenicanpm/storefront-core/src/components/_components/flex-box/index";
|
|
16
19
|
|
|
17
20
|
// STYLED COMPONENTS
|
|
18
21
|
const StyledFlexbox = styled(FlexBetween)(({ theme }) => ({
|
|
@@ -6,7 +6,10 @@ import { MdEast as East } from "react-icons/md";
|
|
|
6
6
|
import { ChipProps } from "@mui/material";
|
|
7
7
|
import { format } from "date-fns";
|
|
8
8
|
// GLOBAL CUSTOM COMPONENT
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
H6,
|
|
11
|
+
Paragraph,
|
|
12
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
10
13
|
// Local CUSTOM COMPONENT
|
|
11
14
|
import TableRow from "../table-row";
|
|
12
15
|
// CUSTOM UTILS LIBRARY FUNCTION
|
|
@@ -3,8 +3,12 @@ import Card from "@mui/material/Card";
|
|
|
3
3
|
import Divider from "@mui/material/Divider";
|
|
4
4
|
import { useTranslations } from "next-intl";
|
|
5
5
|
// GLOBAL CUSTOM COMPONENTS
|
|
6
|
-
import { FlexBetween } from "
|
|
7
|
-
import {
|
|
6
|
+
import { FlexBetween } from "@evenicanpm/storefront-core/src/components/_components/flex-box/index";
|
|
7
|
+
import {
|
|
8
|
+
H5,
|
|
9
|
+
H6,
|
|
10
|
+
Paragraph,
|
|
11
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
8
12
|
// CUSTOM UTILS LIBRARY FUNCTION
|
|
9
13
|
import useCurrencyFormatter from "@/lib/currency-formatter";
|
|
10
14
|
import { SalesOrder } from "@/api-manager/schemas/order.schema";
|
|
@@ -7,8 +7,15 @@ import { format } from "date-fns";
|
|
|
7
7
|
import Link from "next/link";
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
// GLOBAL CUSTOM COMPONENTS
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
H6,
|
|
12
|
+
Paragraph,
|
|
13
|
+
Span,
|
|
14
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
15
|
+
import {
|
|
16
|
+
FlexBetween,
|
|
17
|
+
FlexBox,
|
|
18
|
+
} from "@evenicanpm/storefront-core/src/components/_components/flex-box/index";
|
|
12
19
|
// CUSTOM UTILS LIBRARY FUNCTION
|
|
13
20
|
import useCurrencyFormatter from "@/lib/currency-formatter";
|
|
14
21
|
import { SalesLine, SalesOrder } from "@/api-manager/schemas/order.schema";
|
|
@@ -4,8 +4,11 @@ import { Theme } from "@mui/material/styles";
|
|
|
4
4
|
import Card from "@mui/material/Card";
|
|
5
5
|
import { useTranslations } from "next-intl";
|
|
6
6
|
// GLOBAL CUSTOM COMPONENTS
|
|
7
|
-
import FlexBox from "
|
|
8
|
-
import {
|
|
7
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components/_components/flex-box/flex-box";
|
|
8
|
+
import {
|
|
9
|
+
Small,
|
|
10
|
+
Span,
|
|
11
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
9
12
|
// API
|
|
10
13
|
import { User } from "@/api-manager/schemas/user.schema";
|
|
11
14
|
type Props = {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@mui/material";
|
|
13
13
|
import Grid from "@mui/material/Grid2";
|
|
14
14
|
// Global Custom components
|
|
15
|
-
import { H5 } from "
|
|
15
|
+
import { H5 } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
16
16
|
import { useNotification } from "@/components/Notifications/use-notification";
|
|
17
17
|
// Forms
|
|
18
18
|
import { useFormik } from "formik";
|
|
@@ -5,8 +5,8 @@ import { format } from "date-fns";
|
|
|
5
5
|
// MUI ICON COMPONENTS
|
|
6
6
|
import { MdDelete as Delete } from "react-icons/md";
|
|
7
7
|
// GLOBAL CUSTOM COMPONENTS
|
|
8
|
-
import { Paragraph } from "
|
|
9
|
-
import { NavLink3 } from "
|
|
8
|
+
import { Paragraph } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
9
|
+
import { NavLink3 } from "@evenicanpm/storefront-core/src/components/_components/nav-link";
|
|
10
10
|
// LOCAL CUSTOM COMPONENT
|
|
11
11
|
import TableRow from "../table-row";
|
|
12
12
|
// API
|
|
@@ -2,8 +2,11 @@ import { ModeEditOutline, DeleteOutline } from "@mui/icons-material";
|
|
|
2
2
|
import { Card, IconButton } from "@mui/material";
|
|
3
3
|
import Grid from "@mui/material/Grid2";
|
|
4
4
|
import { Address } from "@/api-manager/schemas/address.schema";
|
|
5
|
-
import { FlexBox } from "
|
|
6
|
-
import {
|
|
5
|
+
import { FlexBox } from "@evenicanpm/storefront-core/src/components/_components/flex-box";
|
|
6
|
+
import {
|
|
7
|
+
H6,
|
|
8
|
+
Paragraph,
|
|
9
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
7
10
|
|
|
8
11
|
interface Props {
|
|
9
12
|
address: Address;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Card from "
|
|
1
|
+
import Card from "@evenicanpm/storefront-core/src/components/_components/BazaarCard";
|
|
2
2
|
import Heading from "./heading";
|
|
3
3
|
import { Button, useTheme } from "@mui/material";
|
|
4
4
|
import Grid from "@mui/material/Grid2";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { Span } from "
|
|
7
|
-
import { FlexBox } from "
|
|
6
|
+
import { Span } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
7
|
+
import { FlexBox } from "@evenicanpm/storefront-core/src/components/_components/flex-box";
|
|
8
8
|
import { Cart } from "@/api-manager/schemas/cart.schema";
|
|
9
9
|
import { useTranslations } from "next-intl";
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@ import TextField from "@mui/material/TextField";
|
|
|
5
5
|
import useUpdateCart from "@/api-manager/services/cart/mutations/update-cart";
|
|
6
6
|
import { useTranslations } from "next-intl";
|
|
7
7
|
import { CheckoutStepComponentProps } from "./checkout-step";
|
|
8
|
-
import { Paragraph } from "
|
|
8
|
+
import { Paragraph } from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
9
9
|
import * as yup from "yup";
|
|
10
10
|
import { useForm } from "react-hook-form";
|
|
11
11
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
@@ -149,7 +149,11 @@ export default function DeliveryAddress({
|
|
|
149
149
|
</Grid>
|
|
150
150
|
))}
|
|
151
151
|
|
|
152
|
-
<Grid
|
|
152
|
+
<Grid
|
|
153
|
+
size={{ md: 4, sm: 6, xs: 12 }}
|
|
154
|
+
onClick={openNew}
|
|
155
|
+
data-testid="addr-new"
|
|
156
|
+
>
|
|
153
157
|
<AddressCard
|
|
154
158
|
address={{
|
|
155
159
|
Id: "new",
|
|
@@ -8,13 +8,17 @@ import {
|
|
|
8
8
|
import Grid from "@mui/material/Grid2";
|
|
9
9
|
import { useTranslations } from "next-intl";
|
|
10
10
|
import { Address } from "@/api-manager/schemas/address.schema";
|
|
11
|
-
import { FlexBox } from "
|
|
11
|
+
import { FlexBox } from "@evenicanpm/storefront-core/src/components/_components/flex-box";
|
|
12
12
|
import {
|
|
13
13
|
DeliveryOption,
|
|
14
14
|
DeliveryPreferenceType,
|
|
15
15
|
LineDeliverySpecification,
|
|
16
16
|
} from "@msdyn365-commerce/retail-proxy";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
H4,
|
|
19
|
+
Paragraph,
|
|
20
|
+
Span,
|
|
21
|
+
} from "@evenicanpm/storefront-core/src/components/_components/Typography";
|
|
18
22
|
import useCurrencyFormatter from "@/lib/currency-formatter";
|
|
19
23
|
import { CheckoutStepComponentProps } from "./checkout-step";
|
|
20
24
|
import useGetDeliveryOptions from "@/api-manager/services/address/mutations/get-delivery-options";
|