@evenicanpm/storefront-core 1.0.3 → 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/schemas/product.schema.ts +0 -1
- 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/user/mutations/add-to-wishlist.ts +23 -3
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +23 -0
- package/src/cms/blocks/Components/CategoryCarousel/index.tsx +6 -7
- package/src/cms/blocks/Components/HeroCarousel/index.tsx +25 -19
- package/src/cms/blocks/Components/ProductCarousel/index.tsx +44 -38
- package/src/cms/blocks/Components/ProductSectionFullWidth/index.tsx +7 -3
- package/src/cms/blocks/Components/shared/product-grid.tsx +38 -23
- package/src/components/_components/wishlist/add-to-wishlist-dialog.tsx +1 -1
- package/src/components/_components/wishlist/remove-from-wishlist-dialog.tsx +1 -1
- package/src/components/_components/wishlist-modal/add-to-wishlist-dialog.tsx +1 -1
- package/src/components/_components/wishlist-modal/remove-from-wishlist-dialog.tsx +1 -1
- package/src/components-v2/carousel/carousel.tsx +69 -35
- package/src/components-v2/carousel/components/carousel-arrows.tsx +40 -46
- package/src/components-v2/carousel/components/carousel-dots.tsx +10 -13
- package/src/components-v2/carousel/index.ts +0 -2
- package/src/components-v2/carousel-cards/carousel-card-1/carousel-card-1.tsx +68 -49
- package/src/components-v2/categories/category-list/category-list.tsx +83 -41
- package/src/components-v2/categories/category-list/styles.ts +7 -1
- package/src/components-v2/categories/category-menu.tsx +2 -0
- package/src/components-v2/categories/mega-menu/banner.tsx +68 -37
- package/src/components-v2/categories/mega-menu/column-list.tsx +59 -52
- package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +19 -1
- package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +32 -2
- package/src/components-v2/header/components/mobile-header.tsx +119 -46
- package/src/components-v2/header/components/user.tsx +163 -117
- package/src/components-v2/header/header.tsx +62 -42
- package/src/components-v2/header/sticky-header.tsx +34 -2
- package/src/components-v2/mini-cart/components/bottom-actions.tsx +71 -17
- package/src/components-v2/mini-cart/components/cart-item.tsx +159 -101
- package/src/components-v2/mini-cart/components/empty-view.tsx +59 -19
- package/src/components-v2/mini-cart/components/top-header.tsx +61 -22
- package/src/components-v2/mini-cart/mini-cart-trigger.tsx +99 -0
- package/src/components-v2/mini-cart/mini-cart.tsx +111 -43
- package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +93 -48
- package/src/components-v2/navbar/categories.tsx +70 -16
- package/src/components-v2/navbar/category-based-menu/category-based-menu.tsx +135 -41
- package/src/components-v2/navbar/mega-menu/mega-menu.tsx +115 -48
- package/src/components-v2/navbar/mobile-menu/mobile-menu.test.tsx +111 -0
- package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +127 -56
- package/src/components-v2/navbar/nav-list/nav-list.tsx +125 -103
- package/src/components-v2/navbar/navbar.tsx +72 -20
- package/src/components-v2/product-cards/{product-card-1 → product-card}/components/quantity-buttons.tsx +1 -1
- package/src/components-v2/product-cards/product-card/product-card.tsx +410 -0
- package/src/components-v2/product-cards/{product-card-1 → product-card}/styles/index.ts +6 -0
- package/src/components-v2/product-cards/product-card-plp/product-card.tsx +161 -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/product-card.tsx +166 -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/{components → compound}/dimensions-group-error.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group-label.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group-list-chip.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group-list.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions.tsx +0 -3
- package/src/components-v2/product-dimensions/index.tsx +1 -1
- 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 +24 -11
- package/src/components-v2/products-view/products-list-view.tsx +29 -12
- 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-box/components/category-dropdown.tsx → search-bar/compound/textfield-adornment-category.tsx} +29 -7
- 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-box → search-bar}/styles/index.ts +5 -3
- 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/side-nav.tsx +4 -5
- package/src/components-v2/sticky/index.ts +1 -1
- package/src/components-v2/{wishlist-modal → wishlist-dialogs/add-to-wishlist}/add-to-wishlist-button.tsx +1 -1
- 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/components → wishlist-dialogs/create-wishlist}/create-wishlist-button.tsx +5 -3
- package/src/components-v2/wishlist-dialogs/create-wishlist/index.tsx +22 -0
- package/src/hooks/use-cart.ts +29 -23
- package/src/hooks/use-variants.ts +106 -53
- package/src/lib/build-detail-url.ts +2 -1
- package/src/pages/product-details/product-intro/product-intro.tsx +26 -23
- package/src/pages/product-list/quick-view-dialog-content.tsx +18 -9
- package/src/pages-v2/product-details/bopis/find-in-store-button.tsx +9 -8
- package/src/pages-v2/product-details/bopis/find-in-store-modal.tsx +2 -2
- package/src/{components-v2/shop-card → pages-v2/product-details/bopis/store-card}/shop-card.tsx +17 -48
- 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/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-tabs.tsx +87 -21
- package/src/pages-v2/product-details/related-products.tsx +26 -12
- package/src/pages-v2/product-list/quick-view-dialog-content.tsx +17 -10
- package/typedoc.js +3 -1
- package/src/components-v2/MiniCartClient.tsx +0 -65
- package/src/components-v2/carousel-cards/carousel-card-2/carousel-card-2.tsx +0 -78
- package/src/components-v2/carousel-cards/carousel-card-2/index.ts +0 -1
- package/src/components-v2/carousel-cards/carousel-card-2/styles.ts +0 -26
- package/src/components-v2/carousel-cards/carousel-card-3/carousel-card-3.tsx +0 -37
- package/src/components-v2/carousel-cards/carousel-card-3/index.ts +0 -1
- package/src/components-v2/carousel-cards/carousel-card-3/styles.ts +0 -28
- package/src/components-v2/carousel-cards/carousel-card-4/carousel-card-4.tsx +0 -81
- package/src/components-v2/carousel-cards/carousel-card-4/index.ts +0 -1
- package/src/components-v2/carousel-cards/carousel-card-4/styles.ts +0 -27
- package/src/components-v2/category-cards/category-card-1/category-card-1.tsx +0 -21
- package/src/components-v2/category-cards/category-card-1/index.ts +0 -1
- package/src/components-v2/category-cards/category-card-1/styles.ts +0 -37
- package/src/components-v2/countdown/count-box.tsx +0 -19
- package/src/components-v2/countdown/count-down.tsx +0 -24
- package/src/components-v2/countdown/index.tsx +0 -2
- package/src/components-v2/countdown/useCountDown.ts +0 -41
- package/src/components-v2/data-table/index.ts +0 -2
- package/src/components-v2/data-table/table-header.tsx +0 -91
- package/src/components-v2/data-table/table-pagination.tsx +0 -36
- package/src/components-v2/footer/components/about-links.tsx +0 -23
- package/src/components-v2/footer/components/app-store.tsx +0 -38
- package/src/components-v2/footer/components/customer-care-links.tsx +0 -21
- package/src/components-v2/footer/components/logo.tsx +0 -23
- package/src/components-v2/footer/components/social-links.tsx +0 -43
- package/src/components-v2/footer/data/index.ts +0 -54
- package/src/components-v2/footer/footer-1.tsx +0 -62
- package/src/components-v2/footer/footer-2.tsx +0 -57
- package/src/components-v2/footer/footer-3.tsx +0 -53
- package/src/components-v2/footer/footer-4.tsx +0 -71
- package/src/components-v2/footer/index.ts +0 -4
- package/src/components-v2/footer/styles/index.ts +0 -42
- package/src/components-v2/navbar/category-based-menu/components/categories.tsx +0 -44
- package/src/components-v2/navbar/category-based-menu/components/category-item.tsx +0 -31
- package/src/components-v2/navbar/category-based-menu/components/child-categories.tsx +0 -38
- package/src/components-v2/navbar/mega-menu/category-list.tsx +0 -29
- package/src/components-v2/navbar/mobile-menu/render-levels.test.tsx +0 -71
- package/src/components-v2/navbar/mobile-menu/render-levels.tsx +0 -62
- package/src/components-v2/newsletter/index.ts +0 -1
- package/src/components-v2/newsletter/newsletter.tsx +0 -112
- package/src/components-v2/newsletter/social-icons.tsx +0 -35
- package/src/components-v2/newsletter/styles.ts +0 -65
- package/src/components-v2/page-sidenav/grocery-side-nav/components/link-item.tsx +0 -21
- package/src/components-v2/page-sidenav/grocery-side-nav/components/list-item.tsx +0 -27
- package/src/components-v2/page-sidenav/grocery-side-nav/components/nav-accordion.tsx +0 -36
- package/src/components-v2/page-sidenav/grocery-side-nav/components/render-child.tsx +0 -26
- package/src/components-v2/page-sidenav/grocery-side-nav/grocery-side-nav.tsx +0 -32
- package/src/components-v2/page-sidenav/grocery-side-nav/index.ts +0 -1
- package/src/components-v2/page-sidenav/grocery-side-nav/styles/index.ts +0 -11
- package/src/components-v2/page-sidenav/health-beauty-side-nav/components/list-item.tsx +0 -27
- package/src/components-v2/page-sidenav/health-beauty-side-nav/components/nav-accordion.tsx +0 -44
- package/src/components-v2/page-sidenav/health-beauty-side-nav/components/render-child.tsx +0 -20
- package/src/components-v2/page-sidenav/health-beauty-side-nav/health-beauty-side-nav.tsx +0 -43
- package/src/components-v2/page-sidenav/health-beauty-side-nav/index.ts +0 -1
- package/src/components-v2/page-sidenav/health-beauty-side-nav/styles/index.ts +0 -27
- package/src/components-v2/page-sidenav/side-navbar/components/list-item.tsx +0 -25
- package/src/components-v2/page-sidenav/side-navbar/components/nav-accordion.tsx +0 -46
- package/src/components-v2/page-sidenav/side-navbar/components/render-child.tsx +0 -20
- package/src/components-v2/page-sidenav/side-navbar/index.ts +0 -1
- package/src/components-v2/page-sidenav/side-navbar/side-nav-bar.tsx +0 -77
- package/src/components-v2/page-sidenav/side-navbar/styles/index.ts +0 -73
- package/src/components-v2/page-sidenav/side-navbar-2/components/button-content.tsx +0 -32
- package/src/components-v2/page-sidenav/side-navbar-2/components/sidebar-accordion.tsx +0 -66
- package/src/components-v2/page-sidenav/side-navbar-2/index.ts +0 -1
- package/src/components-v2/page-sidenav/side-navbar-2/side-navbar-2.tsx +0 -63
- package/src/components-v2/page-sidenav/side-navbar-2/styles/index.ts +0 -68
- package/src/components-v2/product-cards/product-card-1/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-1/product-card-1-wrapper.tsx +0 -304
- package/src/components-v2/product-cards/product-card-1/product-card.tsx +0 -107
- package/src/components-v2/product-cards/product-card-10/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-10/product-card.tsx +0 -128
- package/src/components-v2/product-cards/product-card-10/styles/index.ts +0 -38
- package/src/components-v2/product-cards/product-card-11/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-11/product-card.tsx +0 -66
- package/src/components-v2/product-cards/product-card-11/styles/index.ts +0 -16
- package/src/components-v2/product-cards/product-card-12/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-12/product-card.tsx +0 -42
- package/src/components-v2/product-cards/product-card-12/styles/index.ts +0 -16
- package/src/components-v2/product-cards/product-card-13/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-13/product-card.tsx +0 -48
- package/src/components-v2/product-cards/product-card-13/styles/index.ts +0 -25
- package/src/components-v2/product-cards/product-card-14/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-14/product-card.tsx +0 -125
- package/src/components-v2/product-cards/product-card-14/styles/index.ts +0 -40
- package/src/components-v2/product-cards/product-card-15/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-15/product-card.tsx +0 -121
- package/src/components-v2/product-cards/product-card-15/styles/index.ts +0 -57
- package/src/components-v2/product-cards/product-card-16/product-card.tsx +0 -116
- package/src/components-v2/product-cards/product-card-2/components/favorite-button.tsx +0 -29
- package/src/components-v2/product-cards/product-card-2/components/product-price.tsx +0 -26
- package/src/components-v2/product-cards/product-card-2/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-2/product-card.tsx +0 -70
- package/src/components-v2/product-cards/product-card-3/components/hover-actions.tsx +0 -83
- package/src/components-v2/product-cards/product-card-3/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-3/product-card.tsx +0 -110
- package/src/components-v2/product-cards/product-card-3/styles/index.ts +0 -89
- package/src/components-v2/product-cards/product-card-4/components/hover-actions.tsx +0 -50
- package/src/components-v2/product-cards/product-card-4/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-4/product-card.tsx +0 -128
- package/src/components-v2/product-cards/product-card-4/styles/index.ts +0 -66
- package/src/components-v2/product-cards/product-card-5/components/button-actions.tsx +0 -49
- package/src/components-v2/product-cards/product-card-5/components/hover-actions.tsx +0 -50
- package/src/components-v2/product-cards/product-card-5/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-5/product-card.tsx +0 -137
- package/src/components-v2/product-cards/product-card-5/styles/index.ts +0 -94
- package/src/components-v2/product-cards/product-card-6/components/hover-actions.tsx +0 -50
- package/src/components-v2/product-cards/product-card-6/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-6/product-card.tsx +0 -121
- package/src/components-v2/product-cards/product-card-6/styles/index.ts +0 -63
- package/src/components-v2/product-cards/product-card-7/components/product-status.tsx +0 -18
- package/src/components-v2/product-cards/product-card-7/components/quantity-buttons.tsx +0 -47
- package/src/components-v2/product-cards/product-card-7/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-7/product-card.tsx +0 -139
- package/src/components-v2/product-cards/product-card-7/styles/index.ts +0 -98
- package/src/components-v2/product-cards/product-card-8/product-card.tsx +0 -151
- package/src/components-v2/product-cards/product-card-9/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-9/product-card.tsx +0 -169
- package/src/components-v2/product-cards/product-card-wishlist/components/hover-actions.tsx +0 -37
- package/src/components-v2/product-cards/product-card-wishlist/product-card.tsx +0 -118
- package/src/components-v2/product-cards/product-card-wishlist/styles/index.ts +0 -53
- package/src/components-v2/product-quantity-buttons/product-quantity-buttons.tsx +0 -88
- package/src/components-v2/products-view/product-view-dialog.tsx +0 -218
- package/src/components-v2/search-box/__test__/search-input-category.test.tsx +0 -110
- package/src/components-v2/search-box/__test__/search-input.test.tsx +0 -137
- package/src/components-v2/search-box/__test__/search-results.json +0 -165
- package/src/components-v2/search-box/components/search-result.tsx +0 -86
- package/src/components-v2/search-box/hooks/use-search.ts +0 -63
- package/src/components-v2/search-box/index.ts +0 -2
- package/src/components-v2/search-box/search-input-category.test.tsx +0 -110
- package/src/components-v2/search-box/search-input-category.tsx +0 -203
- package/src/components-v2/search-box/search-input.test.tsx +0 -41
- package/src/components-v2/search-box/search-input.tsx +0 -66
- package/src/components-v2/section-header/index.ts +0 -2
- package/src/components-v2/section-header/section-creator.tsx +0 -29
- package/src/components-v2/section-header/section-header.tsx +0 -44
- package/src/components-v2/service-cards/icon-component.tsx +0 -18
- package/src/components-v2/service-cards/service-card-1/index.ts +0 -1
- package/src/components-v2/service-cards/service-card-1/service-card-1.tsx +0 -42
- package/src/components-v2/service-cards/service-card-2/index.ts +0 -1
- package/src/components-v2/service-cards/service-card-2/service-card-2.tsx +0 -37
- package/src/components-v2/service-cards/service-card-3/index.ts +0 -1
- package/src/components-v2/service-cards/service-card-3/service-card-3.tsx +0 -28
- package/src/components-v2/service-cards/service-card-3/styles.ts +0 -23
- package/src/components-v2/settings/index.ts +0 -1
- package/src/components-v2/settings/setting.tsx +0 -141
- package/src/components-v2/settings/styles.ts +0 -57
- package/src/components-v2/sticky-wrapper/index.ts +0 -1
- package/src/components-v2/sticky-wrapper/sticky-wrapper.tsx +0 -21
- package/src/components-v2/sticky-wrapper/styles.ts +0 -25
- package/src/components-v2/stories/story-content/index.ts +0 -1
- package/src/components-v2/stories/story-content/story-content.tsx +0 -28
- package/src/components-v2/stories/story-content/styles.ts +0 -22
- package/src/components-v2/stories/story-item/index.ts +0 -1
- package/src/components-v2/stories/story-item/story-item.tsx +0 -24
- package/src/components-v2/stories/story-item/styles.ts +0 -11
- package/src/components-v2/stories/story-viewer/index.ts +0 -1
- package/src/components-v2/stories/story-viewer/story-viewer.tsx +0 -44
- package/src/components-v2/stories/story-viewer/styles.ts +0 -15
- package/src/components-v2/subscribe-input/index.ts +0 -1
- package/src/components-v2/subscribe-input/styles.ts +0 -14
- package/src/components-v2/subscribe-input/subscribe-input.tsx +0 -43
- package/src/components-v2/topbar/index.ts +0 -1
- package/src/components-v2/topbar/styles.ts +0 -55
- package/src/components-v2/topbar/top-bar.tsx +0 -115
- package/src/components-v2/wishlist/add-to-wishlist-dialog.tsx +0 -161
- package/src/components-v2/wishlist/components/create-new-list.tsx +0 -167
- package/src/components-v2/wishlist/components/dashboard-header.tsx +0 -123
- package/src/components-v2/wishlist/components/navigation.tsx +0 -87
- package/src/components-v2/wishlist/components/no-records.tsx +0 -20
- package/src/components-v2/wishlist/components/wishlist-modal-item.tsx +0 -66
- package/src/components-v2/wishlist/remove-from-wishlist-dialog.tsx +0 -175
- package/src/components-v2/wishlist-modal/TODO.md +0 -10
- package/src/components-v2/wishlist-modal/add-to-wishlist-dialog.tsx +0 -161
- package/src/components-v2/wishlist-modal/remove-from-wishlist-dialog.tsx +0 -174
- package/src/components-v2/wishlist-modal/wishlist-modal-item.tsx +0 -65
- package/src/pages-v2/product-details/product-intro/product-intro-images.tsx +0 -90
- package/src/pages-v2/product-details/product-intro/product-intro.tsx +0 -256
- /package/src/{pages-v2/account → components-v2}/no-records.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-1 → product-card}/components/hover-actions.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-16 → product-card}/index.ts +0 -0
- /package/src/components-v2/product-cards/{product-card-16 → product-card-plp}/components/quantity-buttons.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-wishlist → product-card-plp}/index.ts +0 -0
- /package/src/components-v2/product-cards/{product-card-16 → product-card-plp}/styles/index.ts +0 -0
- /package/src/components-v2/product-cards/{product-card-9 → product-card-plp-list}/components/add-to-cart.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-9 → product-card-plp-list}/components/favorite-button.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-9 → product-card-plp-list}/components/tags.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-8 → product-card-search}/index.ts +0 -0
- /package/src/components-v2/product-cards/{product-card-8 → product-card-search}/styles/index.ts +0 -0
- /package/src/components-v2/sticky/{Sticky.tsx → sticky.tsx} +0 -0
- /package/src/components-v2/{wishlist → wishlist-dialogs}/styles.ts +0 -0
- /package/src/{components-v2/shop-card → pages-v2/product-details/bopis/store-card}/index.ts +0 -0
- /package/src/{components-v2/shop-card → pages-v2/product-details/bopis/store-card}/styles.ts +0 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import React, { useContext, useState } from "react";
|
|
2
|
+
import Rating from "@mui/material/Rating";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import Grid from "@mui/material/Grid2";
|
|
5
|
+
import { CircularProgress, Typography } from "@mui/material";
|
|
6
|
+
|
|
7
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
8
|
+
import useCurrencyFormatter from "@/lib/currency-formatter";
|
|
9
|
+
import {
|
|
10
|
+
H1,
|
|
11
|
+
H2,
|
|
12
|
+
H6,
|
|
13
|
+
} from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
14
|
+
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box";
|
|
15
|
+
import QuantityButtons from "@evenicanpm/storefront-core/src/components-v2/product-quantity-buttons";
|
|
16
|
+
import AddToWishlistButton from "@evenicanpm/storefront-core/src/components-v2/wishlist-dialogs/add-to-wishlist/add-to-wishlist-button";
|
|
17
|
+
// D365
|
|
18
|
+
|
|
19
|
+
// API MANAGER
|
|
20
|
+
import getProductPrices from "@/api-manager/services/product/queries/get-product-prices";
|
|
21
|
+
import getProductAvailability from "@/api-manager/services/product/queries/get-product-availability";
|
|
22
|
+
|
|
23
|
+
// LOCAL HOOKS
|
|
24
|
+
import useCart, {
|
|
25
|
+
AddToCartBopisInput,
|
|
26
|
+
} from "@evenicanpm/storefront-core/src/hooks/use-cart";
|
|
27
|
+
|
|
28
|
+
// LOCAL COMPONENTS
|
|
29
|
+
import ProductDimensions from "@evenicanpm/storefront-core/src/components-v2/product-dimensions";
|
|
30
|
+
import FindInStoreButton from "../../bopis/find-in-store-button";
|
|
31
|
+
import { ProductIntroContext, ProductInfoContext } from "./context";
|
|
32
|
+
|
|
33
|
+
import {
|
|
34
|
+
getInventoryLabel,
|
|
35
|
+
checkProductOOS,
|
|
36
|
+
buildInventorySearchCriteria,
|
|
37
|
+
} from "../utils";
|
|
38
|
+
|
|
39
|
+
export interface Props {
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* PRODUCT INFO
|
|
45
|
+
*/
|
|
46
|
+
const ProductInfo = ({ children }: Props) => {
|
|
47
|
+
const [showDimensionError, setShowDimensionError] = useState(false);
|
|
48
|
+
const { selectedVariant } = useContext(ProductIntroContext);
|
|
49
|
+
|
|
50
|
+
const shippingInventorySearchCriteria = selectedVariant
|
|
51
|
+
? buildInventorySearchCriteria(selectedVariant?.RecordId)
|
|
52
|
+
: null;
|
|
53
|
+
|
|
54
|
+
// Query disabled if the input is null
|
|
55
|
+
const { data: shippingInventoryData, isLoading: inventoryPending } =
|
|
56
|
+
getProductAvailability.useData(shippingInventorySearchCriteria);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ProductInfoContext.Provider
|
|
60
|
+
value={{
|
|
61
|
+
inventoryPending,
|
|
62
|
+
shippingInventoryData,
|
|
63
|
+
showDimensionError,
|
|
64
|
+
setShowDimensionError,
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<Grid size={{ md: 6, xs: 12 }} alignItems="center">
|
|
68
|
+
{children}
|
|
69
|
+
</Grid>
|
|
70
|
+
</ProductInfoContext.Provider>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @category Sub-Component
|
|
76
|
+
*/
|
|
77
|
+
ProductInfo.Name = () => {
|
|
78
|
+
const { masterProduct } = useContext(ProductIntroContext);
|
|
79
|
+
return <H1 mb={1}>{masterProduct.Name}</H1>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @category Sub-Component
|
|
84
|
+
*/
|
|
85
|
+
ProductInfo.Sku = () => {
|
|
86
|
+
const { masterProduct, selectedVariant } = useContext(ProductIntroContext);
|
|
87
|
+
return (
|
|
88
|
+
<FlexBox alignItems="center" mb={1}>
|
|
89
|
+
<H6>SKU: {selectedVariant?.ItemId || masterProduct.ItemId}</H6>
|
|
90
|
+
</FlexBox>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @category Sub-Component
|
|
96
|
+
*/
|
|
97
|
+
ProductInfo.Sku = () => {
|
|
98
|
+
return (
|
|
99
|
+
<FlexBox alignItems="center" gap={1} mb={2}>
|
|
100
|
+
<Box lineHeight="1">Rated:</Box>
|
|
101
|
+
<Rating color="warn" value={0} readOnly />
|
|
102
|
+
<H6 lineHeight="1">(0)</H6>
|
|
103
|
+
</FlexBox>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @category Sub-Component
|
|
109
|
+
*/
|
|
110
|
+
ProductInfo.Dimensions = () => {
|
|
111
|
+
const { masterProduct, selectDimensions, handleChangeVariant } =
|
|
112
|
+
useContext(ProductIntroContext);
|
|
113
|
+
const { showDimensionError } = useContext(ProductInfoContext);
|
|
114
|
+
return (
|
|
115
|
+
<ProductDimensions
|
|
116
|
+
dimensionGroups={masterProduct.DimensionValues}
|
|
117
|
+
selectDimensions={selectDimensions}
|
|
118
|
+
handleChangeVariant={handleChangeVariant}
|
|
119
|
+
showDimensionError={showDimensionError}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
ProductInfo.Price = () => {
|
|
125
|
+
const { masterProduct, selectedVariant } = useContext(ProductIntroContext);
|
|
126
|
+
const { formatCurrency } = useCurrencyFormatter();
|
|
127
|
+
|
|
128
|
+
const { data: productPrices, isPending: pricesPending } =
|
|
129
|
+
getProductPrices.useData({
|
|
130
|
+
productIds: [selectedVariant?.RecordId || masterProduct?.RecordId],
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<Box pt={1}>
|
|
135
|
+
<H2 color="primary.main" mb={0.5} lineHeight="1">
|
|
136
|
+
{pricesPending || !productPrices ? (
|
|
137
|
+
<CircularProgress size={20} />
|
|
138
|
+
) : (
|
|
139
|
+
formatCurrency(productPrices?.[0]?.CustomerContextualPrice)
|
|
140
|
+
)}
|
|
141
|
+
</H2>
|
|
142
|
+
<Box color="inherit">{}</Box>
|
|
143
|
+
</Box>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @category Sub-Component
|
|
149
|
+
*/
|
|
150
|
+
ProductInfo.Inventory = () => {
|
|
151
|
+
const { variantPending, allDimensionsSelected } =
|
|
152
|
+
useContext(ProductIntroContext);
|
|
153
|
+
const { shippingInventoryData, inventoryPending } =
|
|
154
|
+
useContext(ProductInfoContext);
|
|
155
|
+
|
|
156
|
+
if (!allDimensionsSelected)
|
|
157
|
+
return (
|
|
158
|
+
<FlexBox alignItems="center" gap={1}>
|
|
159
|
+
{/* INVENTORY */}
|
|
160
|
+
<Box sx={{ my: 3 }}>
|
|
161
|
+
<Typography
|
|
162
|
+
variant="body2"
|
|
163
|
+
color="text.secondary"
|
|
164
|
+
fontWeight={600}
|
|
165
|
+
></Typography>
|
|
166
|
+
</Box>
|
|
167
|
+
</FlexBox>
|
|
168
|
+
);
|
|
169
|
+
return (
|
|
170
|
+
<FlexBox alignItems="center" gap={1}>
|
|
171
|
+
{/* INVENTORY */}
|
|
172
|
+
<Box sx={{ my: 3 }}>
|
|
173
|
+
{inventoryPending || variantPending ? (
|
|
174
|
+
<CircularProgress size={20} />
|
|
175
|
+
) : (
|
|
176
|
+
<Typography variant="body2" color="text.secondary" fontWeight={600}>
|
|
177
|
+
{getInventoryLabel(shippingInventoryData)}
|
|
178
|
+
</Typography>
|
|
179
|
+
)}
|
|
180
|
+
</Box>
|
|
181
|
+
</FlexBox>
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @category Sub-Component
|
|
187
|
+
*/
|
|
188
|
+
ProductInfo.Buttons = () => {
|
|
189
|
+
const { masterProduct, selectedVariant, allDimensionsSelected } =
|
|
190
|
+
useContext(ProductIntroContext);
|
|
191
|
+
const { setShowDimensionError, shippingInventoryData } =
|
|
192
|
+
useContext(ProductInfoContext);
|
|
193
|
+
const { handleAddToCart } = useCart(selectedVariant?.RecordId);
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A wrapper around the add to cart handler that
|
|
197
|
+
* checks if the dimensions are selected and shows errors if not
|
|
198
|
+
*/
|
|
199
|
+
const onAddToCart = (bopisInput?: AddToCartBopisInput) => {
|
|
200
|
+
if (!allDimensionsSelected) {
|
|
201
|
+
setShowDimensionError(true);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
setShowDimensionError(false);
|
|
205
|
+
handleAddToCart(bopisInput);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const isOOS = allDimensionsSelected && checkProductOOS(shippingInventoryData);
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
<FlexBox gap={2}>
|
|
212
|
+
<QuantityButtons
|
|
213
|
+
customAddToCart={onAddToCart}
|
|
214
|
+
isOOS={isOOS}
|
|
215
|
+
productId={selectedVariant?.RecordId}
|
|
216
|
+
/>
|
|
217
|
+
<FindInStoreButton
|
|
218
|
+
setDimensionsError={setShowDimensionError}
|
|
219
|
+
productId={selectedVariant?.RecordId || masterProduct.RecordId}
|
|
220
|
+
handleAddToCart={() => handleAddToCart(selectedVariant?.RecordId)}
|
|
221
|
+
allDimensionsSelected={allDimensionsSelected}
|
|
222
|
+
/>
|
|
223
|
+
<AddToWishlistButton
|
|
224
|
+
path="Account.Wishlists.btnAddToWishlist"
|
|
225
|
+
product={masterProduct}
|
|
226
|
+
/>
|
|
227
|
+
</FlexBox>
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export default ProductInfo;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Grid from "@mui/material/Grid2";
|
|
3
|
+
import React, { useContext, useEffect, useState } from "react";
|
|
4
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
5
|
+
import {
|
|
6
|
+
FlexBox,
|
|
7
|
+
FlexRowCenter,
|
|
8
|
+
} from "@evenicanpm/storefront-core/src/components-v2/flex-box";
|
|
9
|
+
import ImageWithFallback from "@evenicanpm/storefront-core/src/components-v2/ImageWithFallback";
|
|
10
|
+
import { ProductImagesContext, ProductIntroContext } from "./context";
|
|
11
|
+
import ThumbnailWithSkeleton from "./thumbnail-with-skeleton";
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @category Compound Component
|
|
19
|
+
*/
|
|
20
|
+
export default function ProductImages({ children }: Props) {
|
|
21
|
+
const [selectedImageIndex, setSelectedImageIndex] = useState<number>(0);
|
|
22
|
+
|
|
23
|
+
const { selectedVariant, masterProduct } = useContext(ProductIntroContext);
|
|
24
|
+
const { Name } = masterProduct;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* VARIANT SELECTION - IF VARIANT HAS IMAGES, USE THOSE
|
|
28
|
+
* IF NOT USE masterProduct
|
|
29
|
+
*/
|
|
30
|
+
const images =
|
|
31
|
+
Array.isArray(selectedVariant?.Images) && selectedVariant?.Images.length > 0
|
|
32
|
+
? selectedVariant?.Images
|
|
33
|
+
: Array.isArray(masterProduct?.Images) && masterProduct?.Images.length > 0
|
|
34
|
+
? masterProduct?.Images
|
|
35
|
+
: [];
|
|
36
|
+
|
|
37
|
+
const primaryImageUrl =
|
|
38
|
+
selectedVariant?.primaryImageUrl || masterProduct?.primaryImageUrl;
|
|
39
|
+
|
|
40
|
+
// HANDLE SELECT IMAGE
|
|
41
|
+
const handleImageClick = (ind: number) => () => {
|
|
42
|
+
setSelectedImageIndex(ind);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<ProductImagesContext.Provider
|
|
47
|
+
value={{
|
|
48
|
+
name: Name,
|
|
49
|
+
selectedImageIndex,
|
|
50
|
+
images,
|
|
51
|
+
handleImageClick,
|
|
52
|
+
primaryImageUrl,
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<Grid size={{ md: 6, xs: 12 }} alignItems="center">
|
|
56
|
+
{children}
|
|
57
|
+
</Grid>
|
|
58
|
+
</ProductImagesContext.Provider>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The image gallery thumbnails, when clicked switches the main image.
|
|
64
|
+
* @category Sub-Component
|
|
65
|
+
*/
|
|
66
|
+
ProductImages.Thumbnails = () => {
|
|
67
|
+
const { images, handleImageClick, selectedImageIndex } =
|
|
68
|
+
useContext(ProductImagesContext);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<FlexBox overflow="auto" gap={1} justifyContent="center">
|
|
73
|
+
{images?.map((url: string, ind: number) => {
|
|
74
|
+
return (
|
|
75
|
+
<FlexRowCenter
|
|
76
|
+
key={ind}
|
|
77
|
+
width={64}
|
|
78
|
+
height={64}
|
|
79
|
+
minWidth={64}
|
|
80
|
+
bgcolor="white"
|
|
81
|
+
border="1px solid"
|
|
82
|
+
borderRadius="10px"
|
|
83
|
+
style={{ cursor: "pointer" }}
|
|
84
|
+
onClick={handleImageClick(ind)}
|
|
85
|
+
borderColor={
|
|
86
|
+
selectedImageIndex === ind ? "primary.main" : "grey.400"
|
|
87
|
+
}
|
|
88
|
+
>
|
|
89
|
+
<ThumbnailWithSkeleton src={url} />
|
|
90
|
+
</FlexRowCenter>
|
|
91
|
+
);
|
|
92
|
+
})}
|
|
93
|
+
</FlexBox>
|
|
94
|
+
</>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Main large image on PDP that displays currently selected image from
|
|
100
|
+
* product details.
|
|
101
|
+
* @category Sub-Component
|
|
102
|
+
*/
|
|
103
|
+
ProductImages.Main = () => {
|
|
104
|
+
const { name, images, primaryImageUrl, selectedImageIndex } =
|
|
105
|
+
useContext(ProductImagesContext);
|
|
106
|
+
return (
|
|
107
|
+
<FlexBox borderRadius={3} overflow="hidden" justifyContent="center" mb={6}>
|
|
108
|
+
<ImageWithFallback
|
|
109
|
+
alt={name ?? "product"}
|
|
110
|
+
width={300}
|
|
111
|
+
height={300}
|
|
112
|
+
loading="eager"
|
|
113
|
+
src={
|
|
114
|
+
Array.isArray(images) &&
|
|
115
|
+
selectedImageIndex !== undefined &&
|
|
116
|
+
images[selectedImageIndex]
|
|
117
|
+
? images[selectedImageIndex]
|
|
118
|
+
: primaryImageUrl
|
|
119
|
+
}
|
|
120
|
+
style={{ objectFit: "contain" }}
|
|
121
|
+
/>
|
|
122
|
+
</FlexBox>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import Grid from "@mui/material/Grid2";
|
|
5
|
+
import { ProductDetails } from "@/api-manager/schemas/product.schema";
|
|
6
|
+
import useVariants from "../../../../hooks/use-variants";
|
|
7
|
+
import ProductImages from "./product-intro-images";
|
|
8
|
+
import ProductInfo from "./product-info";
|
|
9
|
+
import { ProductIntroContext } from "./context";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Master product data comes in as prop, selected variant details are called
|
|
13
|
+
* every render, if there is a valid variant id selected (based on dimensions).
|
|
14
|
+
*/
|
|
15
|
+
type Props = { product: ProductDetails; children: React.ReactNode };
|
|
16
|
+
|
|
17
|
+
export default function ProductIntro({ product, children }: Props) {
|
|
18
|
+
// HOOKS
|
|
19
|
+
const {
|
|
20
|
+
selectedVariant,
|
|
21
|
+
selectDimensions,
|
|
22
|
+
handleChangeVariant,
|
|
23
|
+
allDimensionsSelected,
|
|
24
|
+
variantPending,
|
|
25
|
+
} = useVariants(product);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<ProductIntroContext.Provider
|
|
29
|
+
value={{
|
|
30
|
+
masterProduct: product,
|
|
31
|
+
allDimensionsSelected,
|
|
32
|
+
variantPending,
|
|
33
|
+
selectedVariant,
|
|
34
|
+
selectDimensions,
|
|
35
|
+
handleChangeVariant,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<Box width="100%">
|
|
39
|
+
<Grid container spacing={3} justifyContent="space-around">
|
|
40
|
+
{children}
|
|
41
|
+
{/* PRODUCT INFO AREA */}
|
|
42
|
+
</Grid>
|
|
43
|
+
</Box>
|
|
44
|
+
</ProductIntroContext.Provider>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ProductIntro.Images = ProductImages;
|
|
49
|
+
ProductIntro.Info = ProductInfo;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Skeleton } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shows a skeleton until the image loads
|
|
6
|
+
* @category Sub-Component
|
|
7
|
+
*/
|
|
8
|
+
function ThumbnailWithSkeleton({ src }: { src: string }) {
|
|
9
|
+
const [loaded, setLoaded] = useState(false);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
{!loaded && <Skeleton variant="rounded" width={50} height={50} />}
|
|
14
|
+
<img
|
|
15
|
+
src={src}
|
|
16
|
+
onLoad={() => setLoaded(true)}
|
|
17
|
+
style={{
|
|
18
|
+
display: loaded ? "block" : "none",
|
|
19
|
+
width: "80%",
|
|
20
|
+
height: "80%",
|
|
21
|
+
objectFit: "cover",
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default ThumbnailWithSkeleton;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ProductDetails } from "@/api-manager/schemas/product.schema";
|
|
2
|
+
import { ProductWarehouseInventoryInformation } from "@msdyn365-commerce/retail-proxy";
|
|
3
|
+
|
|
4
|
+
export const getInventoryLabel = (
|
|
5
|
+
shippingInventoryData: ProductWarehouseInventoryInformation,
|
|
6
|
+
): string | null => {
|
|
7
|
+
const aggregate =
|
|
8
|
+
shippingInventoryData?.AggregatedProductInventoryAvailabilities &&
|
|
9
|
+
shippingInventoryData?.AggregatedProductInventoryAvailabilities[0];
|
|
10
|
+
if (aggregate) {
|
|
11
|
+
const { TotalAvailableInventoryLevelLabel } = aggregate;
|
|
12
|
+
return TotalAvailableInventoryLevelLabel || null;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const checkProductOOS = (
|
|
18
|
+
shippingInventoryData: ProductWarehouseInventoryInformation,
|
|
19
|
+
) => {
|
|
20
|
+
//TODO: Incorporate global inventory enabled flag.
|
|
21
|
+
const OOSCode = "OOS"; // Always means out of stock
|
|
22
|
+
const aggregate =
|
|
23
|
+
shippingInventoryData?.AggregatedProductInventoryAvailabilities &&
|
|
24
|
+
shippingInventoryData?.AggregatedProductInventoryAvailabilities[0];
|
|
25
|
+
if (aggregate) {
|
|
26
|
+
const { TotalAvailableInventoryLevelCode } = aggregate;
|
|
27
|
+
return TotalAvailableInventoryLevelCode === OOSCode;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Simple object building for inventory query.
|
|
34
|
+
*/
|
|
35
|
+
export const buildInventorySearchCriteria = (productId: number) => {
|
|
36
|
+
return {
|
|
37
|
+
searchCriteria: {
|
|
38
|
+
defaultWarehouseOnly: true,
|
|
39
|
+
productIds: [productId],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import React, { useState } from "react";
|
|
3
|
+
import React, { useContext, useState, createContext } from "react";
|
|
4
4
|
import Box from "@mui/material/Box";
|
|
5
5
|
import Tab from "@mui/material/Tab";
|
|
6
6
|
import Tabs from "@mui/material/Tabs";
|
|
7
7
|
import styled from "@mui/material/styles/styled";
|
|
8
|
+
|
|
8
9
|
// LOCAL CUSTOM COMPONENTS
|
|
9
10
|
import ProductDescription from "./product-description";
|
|
10
11
|
import { AttributeValue } from "@msdyn365-commerce/retail-proxy";
|
|
12
|
+
|
|
11
13
|
// STYLED COMPONENT
|
|
12
14
|
const StyledTabs = styled(Tabs)(({ theme }) => ({
|
|
13
15
|
minHeight: 0,
|
|
@@ -21,31 +23,95 @@ const StyledTabs = styled(Tabs)(({ theme }) => ({
|
|
|
21
23
|
},
|
|
22
24
|
}));
|
|
23
25
|
|
|
24
|
-
type Props = { productAttributes: AttributeValue[] };
|
|
26
|
+
type Props = { productAttributes: AttributeValue[]; children: React.ReactNode };
|
|
27
|
+
|
|
28
|
+
export interface TabsContext {
|
|
29
|
+
selectedOption: number;
|
|
30
|
+
productAttributes: AttributeValue[];
|
|
31
|
+
handleOptionClick: (_: React.SyntheticEvent, value: number) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface TabPanelProps {
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
index: number;
|
|
37
|
+
value: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function CustomTabPanel(props: TabPanelProps) {
|
|
41
|
+
const { children, value, index, ...other } = props;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div role="tabpanel" hidden={value !== index} {...other}>
|
|
45
|
+
{value === index && <Box sx={{ p: 3 }}>{children}</Box>}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const TabsContext = createContext<TabsContext>(null);
|
|
25
51
|
|
|
26
|
-
|
|
52
|
+
/**
|
|
53
|
+
* @category Compound Component
|
|
54
|
+
*/
|
|
55
|
+
export default function ProductTabs({ productAttributes, children }: Props) {
|
|
27
56
|
const [selectedOption, setSelectedOption] = useState(0);
|
|
28
57
|
const handleOptionClick = (_: React.SyntheticEvent, value: number) =>
|
|
29
58
|
setSelectedOption(value);
|
|
30
59
|
|
|
31
60
|
return (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
onChange={handleOptionClick}
|
|
38
|
-
>
|
|
39
|
-
<Tab className="inner-tab" label="Description" />
|
|
40
|
-
<Tab className="inner-tab" label="Review (3)" />
|
|
41
|
-
</StyledTabs>
|
|
42
|
-
|
|
43
|
-
<Box mb={6}>
|
|
44
|
-
{selectedOption === 0 && (
|
|
45
|
-
<ProductDescription attributes={productAttributes} />
|
|
46
|
-
)}
|
|
47
|
-
{/*selectedOption === 1 && <ProductReview />*/}
|
|
48
|
-
</Box>
|
|
49
|
-
</>
|
|
61
|
+
<TabsContext.Provider
|
|
62
|
+
value={{ selectedOption, handleOptionClick, productAttributes }}
|
|
63
|
+
>
|
|
64
|
+
<Box mb={6}>{children}</Box>
|
|
65
|
+
</TabsContext.Provider>
|
|
50
66
|
);
|
|
51
67
|
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @category Sub-Component
|
|
71
|
+
*/
|
|
72
|
+
ProductTabs.Tabs = ({ children }: { children: React.ReactNode }) => {
|
|
73
|
+
const { selectedOption, handleOptionClick } = useContext(TabsContext);
|
|
74
|
+
return (
|
|
75
|
+
<StyledTabs
|
|
76
|
+
textColor="primary"
|
|
77
|
+
value={selectedOption}
|
|
78
|
+
indicatorColor="primary"
|
|
79
|
+
onChange={handleOptionClick}
|
|
80
|
+
>
|
|
81
|
+
{children}
|
|
82
|
+
</StyledTabs>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @category Sub-Component
|
|
88
|
+
*/
|
|
89
|
+
ProductTabs.Option = (props: { label: string; value: number }) => {
|
|
90
|
+
return <Tab className="inner-tab" {...props} />;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @category Sub-Component
|
|
95
|
+
*/
|
|
96
|
+
ProductTabs.Content = ({
|
|
97
|
+
index,
|
|
98
|
+
children,
|
|
99
|
+
}: {
|
|
100
|
+
index: number;
|
|
101
|
+
children: React.ReactNode;
|
|
102
|
+
}) => {
|
|
103
|
+
const { selectedOption } = useContext(TabsContext);
|
|
104
|
+
return (
|
|
105
|
+
<CustomTabPanel value={selectedOption} index={index}>
|
|
106
|
+
{children}
|
|
107
|
+
</CustomTabPanel>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @category Sub-Component
|
|
113
|
+
*/
|
|
114
|
+
ProductTabs.Description = () => {
|
|
115
|
+
const { productAttributes } = useContext(TabsContext);
|
|
116
|
+
return <ProductDescription attributes={productAttributes} />;
|
|
117
|
+
};
|
|
@@ -4,7 +4,7 @@ import Box from "@mui/material/Box";
|
|
|
4
4
|
import Grid from "@mui/material/Grid2";
|
|
5
5
|
// GLOBAL CUSTOM COMPONENTS
|
|
6
6
|
import { H3 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
7
|
-
import
|
|
7
|
+
import ProductCard from "@evenicanpm/storefront-core/src/components-v2/product-cards/product-card/product-card";
|
|
8
8
|
// CUSTOM DATA MODEL
|
|
9
9
|
import GetRelatedProductsDataFetcher from "@/api-manager/services/product/queries/get-related-products";
|
|
10
10
|
|
|
@@ -23,17 +23,31 @@ export default function RelatedProducts({ RecordId }: Props) {
|
|
|
23
23
|
<Grid container spacing={3}>
|
|
24
24
|
{products?.map((item, ind) => (
|
|
25
25
|
<Grid size={{ lg: 3, md: 4, sm: 6, xs: 12 }} key={ind}>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
<ProductCard
|
|
27
|
+
product={{
|
|
28
|
+
id: item.ItemId ?? "",
|
|
29
|
+
slug: String(item?.RecordId) ?? "",
|
|
30
|
+
title: item.Name ?? "",
|
|
31
|
+
price: item.Price ?? 0,
|
|
32
|
+
imgUrl: item.PrimaryImageUrl ?? "",
|
|
33
|
+
rating: 0,
|
|
34
|
+
discount: 0,
|
|
35
|
+
hoverEffect: true,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<ProductCard.Image />
|
|
39
|
+
<ProductCard.Body>
|
|
40
|
+
<ProductCard.Info>
|
|
41
|
+
<ProductCard.Title />
|
|
42
|
+
<ProductCard.Rating />
|
|
43
|
+
<ProductCard.Price />
|
|
44
|
+
</ProductCard.Info>
|
|
45
|
+
<ProductCard.Actions>
|
|
46
|
+
<ProductCard.QuantityButtons />
|
|
47
|
+
{/* <ProductCard.HoverActions /> */}
|
|
48
|
+
</ProductCard.Actions>
|
|
49
|
+
</ProductCard.Body>
|
|
50
|
+
</ProductCard>
|
|
37
51
|
</Grid>
|
|
38
52
|
))}
|
|
39
53
|
</Grid>
|