@evenicanpm/storefront-core 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs.tsconfig.json +35 -0
- package/package.json +6 -3
- package/src/api-manager/README.md +30 -22
- package/src/api-manager/datasources/e4/{e4-address.datasource.ts → address/e4-address.datasource.ts} +10 -10
- package/src/api-manager/datasources/e4/address/e4-address.remaps.ts +70 -0
- package/src/api-manager/datasources/e4/address/e4-address.translator.ts +98 -0
- package/src/api-manager/datasources/e4/{e4-cart.datasource.ts → cart/e4-cart.datasource.ts} +17 -16
- package/src/api-manager/datasources/e4/cart/e4-cart.remaps.ts +94 -0
- package/src/api-manager/datasources/e4/cart/e4-cart.translator.ts +23 -0
- package/src/api-manager/datasources/e4/categories/e4-categories.datasource.ts +38 -0
- package/src/api-manager/datasources/e4/categories/e4-categories.translator.ts +161 -0
- package/src/api-manager/datasources/e4/e4.datasource.ts +8 -39
- package/src/api-manager/datasources/e4/{e4-order.datasource.ts → order/e4-order.datasource.ts} +3 -3
- package/src/api-manager/datasources/e4/order/e4-order.remaps.ts +101 -0
- package/src/api-manager/datasources/e4/{e4-organization.datasource.ts → organization/e4-organization.datasource.ts} +1 -1
- package/src/api-manager/datasources/e4/{e4-product.datasource.ts → product/e4-product.datasource.ts} +13 -11
- package/src/api-manager/datasources/e4/product/e4-product.remaps.ts +88 -0
- package/src/api-manager/datasources/e4/{e4.translator.ts → product/e4-product.translator.ts} +9 -329
- package/src/api-manager/datasources/e4/{e4-session.datasource.ts → session/e4-session.datasource.ts} +3 -3
- package/src/api-manager/datasources/e4/session/e4-session.translator.ts +18 -0
- package/src/api-manager/datasources/e4/user/e4-user.datasource.ts +13 -6
- package/src/api-manager/datasources/e4/user/e4-user.remaps.ts +49 -0
- package/src/api-manager/datasources/e4/user/e4-user.translator.ts +23 -2
- package/src/api-manager/datasources/e4/utils/unwrap-e4-variants.ts +1 -1
- package/src/api-manager/index.ts +11 -6
- package/src/api-manager/schemas/product.schema.ts +0 -1
- package/src/api-manager/schemas/user.schema.ts +3 -1
- package/src/api-manager/services/cart/mutations/add-to-cart.ts +1 -1
- package/src/api-manager/services/cart/mutations/checkout.ts +1 -2
- package/src/api-manager/services/create-query.ts +10 -0
- package/src/api-manager/services/product/queries/get-product-availability.ts +1 -1
- package/src/api-manager/services/product/server/product.server.ts +4 -1
- package/src/api-manager/services/user/mutations/add-to-wishlist.ts +23 -3
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +23 -0
- package/src/api-manager/types/Datasource.ts +1 -5
- package/src/cms/blocks/BlockManager.tsx +67 -0
- package/src/cms/blocks/Components/BrandLogosScroller.tsx +72 -0
- package/src/cms/blocks/Components/CategoryCard.tsx +47 -0
- package/src/cms/blocks/Components/CategoryCarousel/index.tsx +59 -0
- package/src/cms/blocks/Components/FeaturePill.tsx +99 -0
- package/src/cms/blocks/Components/FeaturedCategories.tsx +41 -0
- package/src/cms/blocks/Components/FeaturedProducts.tsx +41 -0
- package/src/cms/blocks/Components/Footer/data/index.ts +32 -0
- package/src/cms/blocks/Components/Footer/index.tsx +88 -0
- package/src/cms/blocks/Components/Footer/interfaces.ts +37 -0
- package/src/cms/blocks/Components/Footer/sections/FooterAppStore.tsx +45 -0
- package/src/cms/blocks/Components/Footer/sections/FooterContact.tsx +36 -0
- package/src/cms/blocks/Components/Footer/sections/FooterLinks.tsx +30 -0
- package/src/cms/blocks/Components/Footer/sections/FooterLogo.tsx +26 -0
- package/src/cms/blocks/Components/Footer/sections/FooterSocialLinks.tsx +70 -0
- package/src/cms/blocks/Components/Footer/styles/index.ts +39 -0
- package/src/cms/blocks/Components/Footer.tsx +77 -0
- package/src/cms/blocks/Components/Hero.tsx +73 -0
- package/src/cms/blocks/Components/HeroCarousel/index.tsx +48 -0
- package/src/cms/blocks/Components/Image.tsx +39 -0
- package/src/cms/blocks/Components/MediaCard.tsx +41 -0
- package/src/cms/blocks/Components/ProductCarousel/index.tsx +88 -0
- package/src/cms/blocks/Components/ProductSectionFullWidth/index.tsx +107 -0
- package/src/cms/blocks/Components/RichText.tsx +19 -0
- package/src/cms/blocks/Components/Seo/index.tsx +48 -0
- package/src/cms/blocks/Components/Services/index.tsx +21 -0
- package/src/cms/blocks/Components/Services/service-card.tsx +73 -0
- package/src/cms/blocks/Components/shared/featured-product-card.tsx +29 -0
- package/src/cms/blocks/Components/shared/product-category-item.tsx +49 -0
- package/src/cms/blocks/Components/shared/product-grid.tsx +63 -0
- package/src/cms/blocks/Components/shared/top-categories-card.tsx +66 -0
- package/src/cms/blocks/Components/shared/top-rating-product-card.tsx +66 -0
- package/src/cms/blocks/Icons/Components/Category.tsx +14 -0
- package/src/cms/blocks/Icons/Components/DottedStar.tsx +40 -0
- package/src/cms/blocks/Icons/Components/FallbackIcon.tsx +33 -0
- package/src/cms/blocks/Icons/Components/GiftBox.tsx +18 -0
- package/src/cms/blocks/Icons/Components/Light.tsx +13 -0
- package/src/cms/blocks/Icons/Components/NewArrival.tsx +18 -0
- package/src/cms/blocks/Icons/Components/RankBadge.tsx +39 -0
- package/src/cms/blocks/Icons/index.ts +32 -0
- package/src/cms/blocks/index.tsx +16 -0
- package/src/cms/blocks/interfaces.ts +240 -0
- package/src/components/Notifications/README.md +1 -1
- package/src/components/Notifications/notification-context.tsx +1 -1
- package/src/components/README.md +3 -8
- package/src/components/_components/MiniCartClient.tsx +1 -1
- package/src/components/_components/navbar/category-based-menu/components/categories.tsx +1 -1
- package/src/components/_components/navbar/mega-menu/mega-menu.tsx +1 -1
- package/src/components/_components/navbar/nav-list/nav-item-child.tsx +2 -2
- package/src/components/_components/product-cards/product-card-1/product-card-1-wrapper.tsx +1 -1
- package/src/components/_components/products-view/product-view-dialog.tsx +1 -1
- package/src/components/_components/settings/setting.tsx +1 -1
- package/src/components/_components/wishlist/add-to-wishlist-dialog.tsx +2 -2
- package/src/components/_components/wishlist/components/create-new-list.tsx +1 -1
- package/src/components/_components/wishlist/remove-from-wishlist-dialog.tsx +2 -2
- package/src/components/_components/wishlist-modal/add-to-wishlist-dialog.tsx +2 -2
- package/src/components/_components/wishlist-modal/remove-from-wishlist-dialog.tsx +2 -2
- package/src/components/countries-input.tsx +0 -1
- package/src/components-v2/BazaarCard.tsx +21 -0
- package/src/components-v2/BazaarImage.tsx +12 -0
- package/src/components-v2/BazaarMenu.tsx +47 -0
- package/src/components-v2/BazaarSwitch.tsx +37 -0
- package/src/components-v2/BazaarTextField.tsx +73 -0
- package/src/components-v2/BoxShadowCard.tsx +16 -0
- package/src/components-v2/DropZone.tsx +86 -0
- package/src/components-v2/HoverBox.tsx +22 -0
- package/src/components-v2/Image.tsx +5 -0
- package/src/components-v2/ImageWithFallback.tsx +51 -0
- package/src/components-v2/LazyImage.tsx +12 -0
- package/src/components-v2/Loading.tsx +36 -0
- package/src/components-v2/README.md +4 -0
- package/src/components-v2/SearchInput.tsx +28 -0
- package/src/components-v2/SnackbarProvider.tsx +32 -0
- package/src/components-v2/T/index.tsx +15 -0
- package/src/components-v2/Typography.tsx +227 -0
- package/src/components-v2/WhiteButton.tsx +20 -0
- package/src/components-v2/accordion/accordion-header.tsx +43 -0
- package/src/components-v2/accordion/index.ts +1 -0
- package/src/components-v2/bazaar-types.ts +84 -0
- package/src/components-v2/carousel/carousel.tsx +106 -0
- package/src/components-v2/carousel/components/carousel-arrows.tsx +54 -0
- package/src/components-v2/carousel/components/carousel-dots.tsx +18 -0
- package/src/components-v2/carousel/index.ts +1 -0
- package/src/components-v2/carousel/styles/index.ts +93 -0
- package/src/components-v2/carousel-cards/carousel-card-1/carousel-card-1.tsx +83 -0
- package/src/components-v2/carousel-cards/carousel-card-1/index.ts +1 -0
- package/src/components-v2/carousel-cards/carousel-card-1/styles.ts +34 -0
- package/src/components-v2/categories/category-list/category-list.tsx +101 -0
- package/src/components-v2/categories/category-list/index.ts +1 -0
- package/src/components-v2/categories/category-list/styles.ts +35 -0
- package/src/components-v2/categories/category-list/types.ts +4 -0
- package/src/components-v2/categories/category-list-item/category-menu-item.tsx +37 -0
- package/src/components-v2/categories/category-list-item/index.ts +1 -0
- package/src/components-v2/categories/category-list-item/styles.ts +35 -0
- package/src/components-v2/categories/category-menu.tsx +53 -0
- package/src/components-v2/categories/mega-menu/banner.tsx +91 -0
- package/src/components-v2/categories/mega-menu/column-list.tsx +77 -0
- package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +55 -0
- package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +67 -0
- package/src/components-v2/categories/mega-menu/styles.ts +25 -0
- package/src/components-v2/categories/types.ts +16 -0
- package/src/components-v2/countries-input.tsx +73 -0
- package/src/components-v2/flex-box/flex-between.tsx +14 -0
- package/src/components-v2/flex-box/flex-box.tsx +9 -0
- package/src/components-v2/flex-box/flex-row-center.tsx +9 -0
- package/src/components-v2/flex-box/index.ts +5 -0
- package/src/components-v2/header/components/categories-menu.tsx +23 -0
- package/src/components-v2/header/components/mobile-header.tsx +148 -0
- package/src/components-v2/header/components/user.test.tsx +200 -0
- package/src/components-v2/header/components/user.tsx +250 -0
- package/src/components-v2/header/header.tsx +83 -0
- package/src/components-v2/header/hooks/use-header.ts +13 -0
- package/src/components-v2/header/index.ts +1 -0
- package/src/components-v2/header/sticky-header.tsx +49 -0
- package/src/components-v2/header/styles/index.ts +24 -0
- package/src/components-v2/icons/cart-bag.tsx +13 -0
- package/src/components-v2/icons/category-outline.tsx +29 -0
- package/src/components-v2/icons/category.tsx +12 -0
- package/src/components-v2/icons/home.tsx +19 -0
- package/src/components-v2/icons/search.tsx +13 -0
- package/src/components-v2/icons/shopping-bag-outlined.tsx +13 -0
- package/src/components-v2/icons/up-down.tsx +21 -0
- package/src/components-v2/icons/user.tsx +13 -0
- package/src/components-v2/icons/user2.tsx +14 -0
- package/src/components-v2/mini-cart/__tests__/cart-item.test.tsx +174 -0
- package/src/components-v2/mini-cart/__tests__/mini-cart.test.tsx +121 -0
- package/src/components-v2/mini-cart/__tests__/test-cart-empty.json +84 -0
- package/src/components-v2/mini-cart/__tests__/test-cart-with-item.json +244 -0
- package/src/components-v2/mini-cart/components/bottom-actions.tsx +81 -0
- package/src/components-v2/mini-cart/components/cart-item.tsx +205 -0
- package/src/components-v2/mini-cart/components/empty-view.tsx +69 -0
- package/src/components-v2/mini-cart/components/top-header.tsx +76 -0
- package/src/components-v2/mini-cart/index.ts +1 -0
- package/src/components-v2/mini-cart/mini-cart-trigger.tsx +99 -0
- package/src/components-v2/mini-cart/mini-cart.tsx +175 -0
- package/src/components-v2/mobile-navigation/index.ts +3 -0
- package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +118 -0
- package/src/components-v2/mobile-navigation/styles/index.ts +63 -0
- package/src/components-v2/nav-link/index.ts +5 -0
- package/src/components-v2/nav-link/nav-link-2.tsx +32 -0
- package/src/components-v2/nav-link/nav-link-3.tsx +67 -0
- package/src/components-v2/nav-link/nav-link.tsx +53 -0
- package/src/components-v2/navbar/categories.tsx +81 -0
- package/src/components-v2/navbar/category-based-menu/category-based-menu.tsx +146 -0
- package/src/components-v2/navbar/category-based-menu/index.ts +1 -0
- package/src/components-v2/navbar/category-based-menu/styles.ts +81 -0
- package/src/components-v2/navbar/category-based-menu/types.ts +18 -0
- package/src/components-v2/navbar/index.ts +1 -0
- package/src/components-v2/navbar/mega-menu/index.ts +1 -0
- package/src/components-v2/navbar/mega-menu/mega-menu.tsx +138 -0
- package/src/components-v2/navbar/mega-menu/styles.ts +43 -0
- package/src/components-v2/navbar/mobile-menu/index.ts +1 -0
- package/src/components-v2/navbar/mobile-menu/mobile-menu.test.tsx +111 -0
- package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +141 -0
- package/src/components-v2/navbar/nav-list/cms-nav.test.tsx +84 -0
- package/src/components-v2/navbar/nav-list/index.ts +1 -0
- package/src/components-v2/navbar/nav-list/nav-item-child.tsx +66 -0
- package/src/components-v2/navbar/nav-list/nav-list.tsx +141 -0
- package/src/components-v2/navbar/navbar.tsx +95 -0
- package/src/components-v2/navbar/styles.ts +90 -0
- package/src/components-v2/navbar/utils/transform-nav.test.ts +209 -0
- package/src/components-v2/navbar/utils/transform-nav.ts +43 -0
- package/src/components-v2/no-records.tsx +20 -0
- package/src/components-v2/product-cards/discount-chip.tsx +43 -0
- package/src/components-v2/product-cards/product-card/components/hover-actions.tsx +37 -0
- package/src/components-v2/product-cards/product-card/components/quantity-buttons.tsx +65 -0
- package/src/components-v2/product-cards/product-card/index.ts +1 -0
- package/src/components-v2/product-cards/product-card/product-card.tsx +410 -0
- package/src/components-v2/product-cards/product-card/styles/index.ts +52 -0
- package/src/components-v2/product-cards/product-card-plp/components/quantity-buttons.tsx +54 -0
- package/src/components-v2/product-cards/product-card-plp/index.ts +1 -0
- package/src/components-v2/product-cards/product-card-plp/product-card.tsx +161 -0
- package/src/components-v2/product-cards/product-card-plp/styles/index.ts +18 -0
- package/src/components-v2/product-cards/product-card-plp-list/components/add-to-cart.tsx +63 -0
- package/src/components-v2/product-cards/product-card-plp-list/components/favorite-button.tsx +27 -0
- package/src/components-v2/product-cards/product-card-plp-list/components/tags.tsx +33 -0
- package/src/components-v2/product-cards/product-card-plp-list/index.ts +1 -0
- package/src/components-v2/product-cards/product-card-plp-list/product-card.tsx +219 -0
- package/src/components-v2/product-cards/product-card-search/index.ts +1 -0
- package/src/components-v2/product-cards/product-card-search/product-card.tsx +166 -0
- package/src/components-v2/product-cards/product-card-search/styles/index.ts +61 -0
- package/src/components-v2/product-cards/product-price.tsx +26 -0
- package/src/components-v2/product-cards/product-rating.tsx +28 -0
- package/src/components-v2/product-cards/product-title.tsx +24 -0
- package/src/components-v2/product-cards/use-product.ts +35 -0
- package/src/components-v2/product-dialog/compound/product-dialog.tsx +225 -0
- package/src/components-v2/product-dialog/index.tsx +29 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group-error.tsx +46 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group-label.tsx +27 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group-list-chip.tsx +78 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group-list.tsx +24 -0
- package/src/components-v2/product-dimensions/compound/dimensions-group.tsx +55 -0
- package/src/components-v2/product-dimensions/compound/dimensions.tsx +81 -0
- package/src/components-v2/product-dimensions/index.tsx +38 -0
- package/src/components-v2/product-dimensions/utils/has-selected-dimension.ts +20 -0
- package/src/components-v2/product-quantity-buttons/compound/quantity-buttons-root.tsx +181 -0
- package/src/components-v2/product-quantity-buttons/index.tsx +22 -0
- package/src/components-v2/product-quantity-variants/index.tsx +90 -0
- package/src/components-v2/products-view/compound/context.ts +25 -0
- package/src/components-v2/products-view/compound/products-grid-view.tsx +109 -0
- package/src/components-v2/products-view/compound/products-list-view.tsx +98 -0
- package/src/components-v2/products-view/compound/types.ts +12 -0
- package/src/components-v2/products-view/index.tsx +45 -0
- package/src/components-v2/products-view/products-grid-view.tsx +65 -0
- package/src/components-v2/products-view/products-list-view.tsx +66 -0
- package/src/components-v2/progress/index.ts +1 -0
- package/src/components-v2/progress/progress.tsx +77 -0
- package/src/components-v2/scrollbar/index.ts +1 -0
- package/src/components-v2/scrollbar/scrollbar.tsx +27 -0
- package/src/components-v2/scrollbar/styles.ts +15 -0
- package/src/components-v2/search-bar/compound/context.ts +31 -0
- package/src/components-v2/search-bar/compound/results-item-lg.tsx +43 -0
- package/src/components-v2/search-bar/compound/results-item-sm.tsx +48 -0
- package/src/components-v2/search-bar/compound/results-suspense.tsx +49 -0
- package/src/components-v2/search-bar/compound/results.tsx +42 -0
- package/src/components-v2/search-bar/compound/search-bar-root.tsx +64 -0
- package/src/components-v2/search-bar/compound/textfield-adornment-button.tsx +22 -0
- package/src/components-v2/search-bar/compound/textfield-adornment-category.tsx +83 -0
- package/src/components-v2/search-bar/compound/textfield-adornment-search-icon.tsx +34 -0
- package/src/components-v2/search-bar/compound/textfield.tsx +58 -0
- package/src/components-v2/search-bar/hooks/use-click-outside.ts +20 -0
- package/src/components-v2/search-bar/hooks/use-search.ts +63 -0
- package/src/components-v2/search-bar/index.tsx +36 -0
- package/src/components-v2/search-bar/styles/index.ts +49 -0
- package/src/components-v2/search-bar/utils/findCategoryNameById.ts +18 -0
- package/src/components-v2/section/compound/section-header.tsx +63 -0
- package/src/components-v2/section/compound/section.tsx +26 -0
- package/src/components-v2/section/index.ts +1 -0
- package/src/components-v2/side-nav/index.ts +1 -0
- package/src/components-v2/side-nav/side-nav.tsx +48 -0
- package/src/components-v2/site-logo.tsx +17 -0
- package/src/components-v2/sticky/index.ts +1 -0
- package/src/components-v2/sticky/sticky.tsx +62 -0
- package/src/components-v2/sticky/styles.ts +38 -0
- package/src/components-v2/utils/constants.ts +8 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/add-to-wishlist-button.tsx +69 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-bottom-ui.tsx +35 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +79 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +41 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/context.ts +29 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-header.tsx +74 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-item.tsx +82 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/hooks/use-add-to-wishlist.ts +152 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/index.tsx +39 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/context.ts +2 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui.tsx +42 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +92 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form.tsx +96 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/create-wishlist-button.tsx +42 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/index.tsx +22 -0
- package/src/components-v2/wishlist-dialogs/styles.ts +61 -0
- package/src/hooks/{use-cart.tsx → use-cart.ts} +29 -23
- package/src/hooks/use-variants.ts +138 -0
- package/src/lib/build-detail-url.ts +2 -1
- package/src/pages/README.md +4 -0
- package/src/pages/product-details/product-intro/product-intro.tsx +29 -24
- package/src/pages/product-list/quick-view-dialog-content.tsx +22 -11
- package/src/pages-v2/README.md +4 -0
- package/src/pages-v2/account/addresses/address-form.tsx +289 -0
- package/src/pages-v2/account/addresses/address-item.tsx +104 -0
- package/src/pages-v2/account/dashboard-header.tsx +123 -0
- package/src/pages-v2/account/navigation.tsx +87 -0
- package/src/pages-v2/account/orders/icons/delivery.tsx +14 -0
- package/src/pages-v2/account/orders/icons/package-box.tsx +13 -0
- package/src/pages-v2/account/orders/icons/truck-filled.tsx +14 -0
- package/src/pages-v2/account/orders/order-progress.tsx +114 -0
- package/src/pages-v2/account/orders/order-row.tsx +64 -0
- package/src/pages-v2/account/orders/order-summary.tsx +87 -0
- package/src/pages-v2/account/orders/ordered-products.tsx +121 -0
- package/src/pages-v2/account/profile/profile-button.test.tsx +59 -0
- package/src/pages-v2/account/profile/profile-button.tsx +50 -0
- package/src/pages-v2/account/profile/user-info.tsx +62 -0
- package/src/pages-v2/account/styles.ts +32 -0
- package/src/pages-v2/account/table-row.tsx +19 -0
- package/src/pages-v2/account/wishlist/create-new-list.tsx +167 -0
- package/src/pages-v2/account/wishlist/create-wishlist-button.tsx +40 -0
- package/src/pages-v2/account/wishlist/wishlist-item.tsx +82 -0
- package/src/pages-v2/blog/pagination.tsx +38 -0
- package/src/pages-v2/cart/cart-item.tsx +312 -0
- package/src/pages-v2/cart/checkout-form.tsx +122 -0
- package/src/pages-v2/cart/coupon-entry.tsx +90 -0
- package/src/pages-v2/cart/estimate-shipping.tsx +183 -0
- package/src/pages-v2/cart/wrapper.tsx +30 -0
- package/src/pages-v2/checkout/checkout-alt-form/address-card.tsx +76 -0
- package/src/pages-v2/checkout/checkout-alt-form/checkout-form.tsx +131 -0
- package/src/pages-v2/checkout/checkout-alt-form/checkout-step.tsx +120 -0
- package/src/pages-v2/checkout/checkout-alt-form/customer-information.tsx +94 -0
- package/src/pages-v2/checkout/checkout-alt-form/delivery-address.tsx +174 -0
- package/src/pages-v2/checkout/checkout-alt-form/delivery-date.tsx +114 -0
- package/src/pages-v2/checkout/checkout-alt-form/delivery-options.tsx +190 -0
- package/src/pages-v2/checkout/checkout-alt-form/edit-address-form.tsx +130 -0
- package/src/pages-v2/checkout/checkout-alt-form/heading.tsx +50 -0
- package/src/pages-v2/checkout/checkout-alt-form/index.ts +1 -0
- package/src/pages-v2/checkout/checkout-alt-form/new-address-form.tsx +299 -0
- package/src/pages-v2/checkout/checkout-alt-form/node.tsx +9 -0
- package/src/pages-v2/checkout/checkout-alt-form/payment-details.tsx +347 -0
- package/src/pages-v2/checkout/checkout-alt-form/safe-card-preview-data.tsx +36 -0
- package/src/pages-v2/checkout/checkout-alt-form/types.ts +20 -0
- package/src/pages-v2/checkout/checkout-alt-summary/cart-item.tsx +42 -0
- package/src/pages-v2/checkout/checkout-alt-summary/checkout-alt-summary.tsx +42 -0
- package/src/pages-v2/checkout/checkout-alt-summary/index.ts +1 -0
- package/src/pages-v2/checkout/checkout-alt-summary/list-item.tsx +31 -0
- package/src/pages-v2/confirmation/address.tsx +25 -0
- package/src/pages-v2/confirmation/confirmation-summary.tsx +55 -0
- package/src/pages-v2/confirmation/ordered-products.tsx +115 -0
- package/src/pages-v2/product-details/available-shops.tsx +48 -0
- package/src/pages-v2/product-details/bopis/find-in-store-button.tsx +64 -0
- package/src/pages-v2/product-details/bopis/find-in-store-modal.tsx +257 -0
- package/src/pages-v2/product-details/bopis/pickup-option-select.tsx +127 -0
- package/src/pages-v2/product-details/bopis/search-header.tsx +69 -0
- package/src/pages-v2/product-details/bopis/store-card/index.ts +1 -0
- package/src/pages-v2/product-details/bopis/store-card/shop-card.tsx +121 -0
- package/src/pages-v2/product-details/bopis/store-card/styles.ts +33 -0
- package/src/pages-v2/product-details/bopis/store-card/utils/convertSecondsToTime.ts +8 -0
- package/src/pages-v2/product-details/bopis/store-card/utils/getDaysResources.ts +25 -0
- package/src/pages-v2/product-details/checkbox-label.tsx +20 -0
- package/src/pages-v2/product-details/currency.ts +64 -0
- package/src/pages-v2/product-details/frequently-bought.tsx +97 -0
- package/src/pages-v2/product-details/frequently-product-card.tsx +63 -0
- package/src/pages-v2/product-details/product-comment.tsx +49 -0
- package/src/pages-v2/product-details/product-description.tsx +22 -0
- package/src/pages-v2/product-details/product-filter-card.tsx +265 -0
- package/src/pages-v2/product-details/product-intro/compound/context.ts +52 -0
- package/src/pages-v2/product-details/product-intro/compound/product-info.tsx +231 -0
- package/src/pages-v2/product-details/product-intro/compound/product-intro-images.tsx +124 -0
- package/src/pages-v2/product-details/product-intro/compound/product-intro.tsx +49 -0
- package/src/pages-v2/product-details/product-intro/compound/thumbnail-with-skeleton.tsx +28 -0
- package/src/pages-v2/product-details/product-intro/utils.ts +42 -0
- package/src/pages-v2/product-details/product-review.tsx +131 -0
- package/src/pages-v2/product-details/product-tabs.tsx +117 -0
- package/src/pages-v2/product-details/related-products.tsx +56 -0
- package/src/pages-v2/product-details/types.ts +11 -0
- package/src/pages-v2/product-list/breadcrumbs.tsx +39 -0
- package/src/pages-v2/product-list/checkbox-label.tsx +20 -0
- package/src/pages-v2/product-list/facet-group.tsx +125 -0
- package/src/pages-v2/product-list/facet.tsx +36 -0
- package/src/pages-v2/product-list/list-filter.tsx +43 -0
- package/src/pages-v2/product-list/pagination.tsx +80 -0
- package/src/pages-v2/product-list/product-list-context.tsx +302 -0
- package/src/pages-v2/product-list/product-list-state.ts +187 -0
- package/src/pages-v2/product-list/product-rating.tsx +16 -0
- package/src/pages-v2/product-list/quick-view-dialog-content.tsx +214 -0
- package/src/pages-v2/product-list/quick-view-dialog.tsx +54 -0
- package/src/pages-v2/product-list/range-filter.tsx +125 -0
- package/src/pages-v2/product-list/scrollbar.tsx +38 -0
- package/src/pages-v2/product-list/search-bar.tsx +162 -0
- package/src/pages-v2/product-list/selected-facets.tsx +80 -0
- package/src/pages-v2/product-list/side-nav.tsx +49 -0
- package/src/pages-v2/product-list/swatch.tsx +80 -0
- package/src/pages-v2/product-list/types.ts +18 -0
- package/src/pages-v2/product-list/use-product-list.ts +12 -0
- package/src/pages-v2/product-list/useCategoryFilter.tsx +26 -0
- package/src/pages-v2/product-list/utils/facet-helpers.ts +5 -0
- package/src/pages-v2/product-list/utils/generate-breadcrumbs.ts +30 -0
- package/src/pages-v2/product-list/utils/getCategoryFilterFromSlug.ts +153 -0
- package/src/pages-v2/product-list/utils/product-list-helper.ts +111 -0
- package/src/pages-v2/product-list/utils/product-list-types.ts +41 -0
- package/src/pages-v2/product-list/utils/search-for-category.ts +76 -0
- package/src/pages-v2/product-list/utils/sort-options.ts +44 -0
- package/src/pages-v2/product-list/utils/use-previous-refiners.ts +14 -0
- package/src/pages-v2/quickorder/order-upload.tsx +150 -0
- package/src/pages-v2/quickorder/quick-order-form.tsx +346 -0
- package/src/pages-v2/quickorder/quick-order-row.tsx +144 -0
- package/src/providers/nav-provider/index.tsx +59 -0
- package/src/providers/nav-provider/utils/createLink.ts +15 -0
- package/src/providers/notifications/README.md +15 -0
- package/src/providers/notifications/notification-context.tsx +82 -0
- package/src/providers/notifications/use-notification.ts +12 -0
- package/tsconfig.json +3 -2
- package/typedoc.js +12 -0
- package/src/api-manager/api-manager.config.json +0 -12
- package/src/api-manager/datasources/e4/e4.remaps.ts +0 -355
- package/src/api-manager/datasources/e4/e4.translator.test.ts +0 -202
- package/src/hooks/use-variants.tsx +0 -85
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Fragment, useState } from "react";
|
|
4
|
+
// MUI
|
|
5
|
+
import Box from "@mui/material/Box";
|
|
6
|
+
import Rating from "@mui/material/Rating";
|
|
7
|
+
import Divider from "@mui/material/Divider";
|
|
8
|
+
import Collapse from "@mui/material/Collapse";
|
|
9
|
+
import TextField from "@mui/material/TextField";
|
|
10
|
+
import FormGroup from "@mui/material/FormGroup";
|
|
11
|
+
// LOCAL CUSTOM COMPONENTS
|
|
12
|
+
import CheckboxLabel from "./checkbox-label";
|
|
13
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
14
|
+
import {
|
|
15
|
+
FlexBetween,
|
|
16
|
+
FlexBox,
|
|
17
|
+
} from "@evenicanpm/storefront-core/src/components-v2/flex-box";
|
|
18
|
+
import {
|
|
19
|
+
H5,
|
|
20
|
+
H6,
|
|
21
|
+
Paragraph,
|
|
22
|
+
Span,
|
|
23
|
+
} from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
24
|
+
import AccordionHeader from "@evenicanpm/storefront-core/src/components-v2/accordion/accordion-header";
|
|
25
|
+
// TYPE
|
|
26
|
+
import {
|
|
27
|
+
ProductFilterKeys,
|
|
28
|
+
ProductFilterValues,
|
|
29
|
+
ProductFilters,
|
|
30
|
+
} from "./types";
|
|
31
|
+
import { Slider } from "@mui/material";
|
|
32
|
+
|
|
33
|
+
// FILTER OPTIONS
|
|
34
|
+
const categoryList = [
|
|
35
|
+
{
|
|
36
|
+
title: "Bath Preparations",
|
|
37
|
+
subCategories: ["Bubble Bath", "Bath Capsules", "Others"],
|
|
38
|
+
},
|
|
39
|
+
{ title: "Eye Makeup Preparations" },
|
|
40
|
+
{ title: "Fragrance" },
|
|
41
|
+
{ title: "Hair Preparations" },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
const BRANDS = [
|
|
45
|
+
{ label: "Mac", value: "mac" },
|
|
46
|
+
{ label: "Karts", value: "karts" },
|
|
47
|
+
{ label: "Baals", value: "baals" },
|
|
48
|
+
{ label: "Bukks", value: "bukks" },
|
|
49
|
+
{ label: "Luasis", value: "luasis" },
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const OTHERS = [
|
|
53
|
+
{ label: "On Sale", value: "sale" },
|
|
54
|
+
{ label: "In Stock", value: "stock" },
|
|
55
|
+
{ label: "Featured", value: "featured" },
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const colorList = [
|
|
59
|
+
"#1C1C1C",
|
|
60
|
+
"#FF7A7A",
|
|
61
|
+
"#FFC672",
|
|
62
|
+
"#84FFB5",
|
|
63
|
+
"#70F6FF",
|
|
64
|
+
"#6B7AFF",
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
// ============================================================================
|
|
68
|
+
interface Props {
|
|
69
|
+
filters: ProductFilters;
|
|
70
|
+
changeFilters: (key: ProductFilterKeys, values: ProductFilterValues) => void;
|
|
71
|
+
}
|
|
72
|
+
// ============================================================================
|
|
73
|
+
|
|
74
|
+
export default function ProductFilterCard({ filters, changeFilters }: Props) {
|
|
75
|
+
const [collapsed, setCollapsed] = useState(true);
|
|
76
|
+
|
|
77
|
+
const handleChangePrice = (values: number[]) => {
|
|
78
|
+
changeFilters("price", values);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const handleChangeColor = (value: string) => {
|
|
82
|
+
const values = filters.color.includes(value)
|
|
83
|
+
? filters.color.filter((item) => item !== value)
|
|
84
|
+
: [...filters.color, value];
|
|
85
|
+
|
|
86
|
+
changeFilters("color", values);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleChangeBrand = (value: string) => {
|
|
90
|
+
const values = filters.brand.includes(value)
|
|
91
|
+
? filters.brand.filter((item) => item !== value)
|
|
92
|
+
: [...filters.brand, value];
|
|
93
|
+
|
|
94
|
+
changeFilters("brand", values);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const handleChangeSales = (value: string) => {
|
|
98
|
+
const values = filters.sales.includes(value)
|
|
99
|
+
? filters.sales.filter((item) => item !== value)
|
|
100
|
+
: [...filters.sales, value];
|
|
101
|
+
|
|
102
|
+
changeFilters("sales", values);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const handleChangeRating = (value: number) => {
|
|
106
|
+
changeFilters("rating", value);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<div>
|
|
111
|
+
{/* CATEGORY VARIANT FILTER */}
|
|
112
|
+
<H6 mb={1.25}>Categories</H6>
|
|
113
|
+
{categoryList.map((item) =>
|
|
114
|
+
item.subCategories ? (
|
|
115
|
+
<Fragment key={item.title}>
|
|
116
|
+
<AccordionHeader
|
|
117
|
+
open={collapsed}
|
|
118
|
+
onClick={() => setCollapsed((state) => !state)}
|
|
119
|
+
sx={{ padding: ".5rem 0", cursor: "pointer", color: "grey.600" }}
|
|
120
|
+
>
|
|
121
|
+
<Span>{item.title}</Span>
|
|
122
|
+
</AccordionHeader>
|
|
123
|
+
|
|
124
|
+
<Collapse in={collapsed}>
|
|
125
|
+
{item.subCategories.map((name) => (
|
|
126
|
+
<Paragraph
|
|
127
|
+
pl="22px"
|
|
128
|
+
py={0.75}
|
|
129
|
+
key={name}
|
|
130
|
+
fontSize="14px"
|
|
131
|
+
color="grey.600"
|
|
132
|
+
sx={{ cursor: "pointer" }}
|
|
133
|
+
>
|
|
134
|
+
{name}
|
|
135
|
+
</Paragraph>
|
|
136
|
+
))}
|
|
137
|
+
</Collapse>
|
|
138
|
+
</Fragment>
|
|
139
|
+
) : (
|
|
140
|
+
<Paragraph
|
|
141
|
+
key={item.title}
|
|
142
|
+
sx={{
|
|
143
|
+
py: 0.75,
|
|
144
|
+
fontSize: 14,
|
|
145
|
+
cursor: "pointer",
|
|
146
|
+
color: "grey.600",
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
{item.title}
|
|
150
|
+
</Paragraph>
|
|
151
|
+
),
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
<Box component={Divider} my={3} />
|
|
155
|
+
|
|
156
|
+
{/* PRICE VARIANT FILTER */}
|
|
157
|
+
<H6 mb={2}>Price Range</H6>
|
|
158
|
+
|
|
159
|
+
<Slider
|
|
160
|
+
min={0}
|
|
161
|
+
max={300}
|
|
162
|
+
size="small"
|
|
163
|
+
value={filters.price}
|
|
164
|
+
valueLabelDisplay="auto"
|
|
165
|
+
valueLabelFormat={(v) => `$${v}`}
|
|
166
|
+
onChange={(_, v) => handleChangePrice(v as number[])}
|
|
167
|
+
/>
|
|
168
|
+
<FlexBetween>
|
|
169
|
+
<TextField
|
|
170
|
+
fullWidth
|
|
171
|
+
size="small"
|
|
172
|
+
type="number"
|
|
173
|
+
placeholder="0"
|
|
174
|
+
value={filters.price[0]}
|
|
175
|
+
onChange={(e) =>
|
|
176
|
+
handleChangePrice([+e.target.value, filters.price[1]])
|
|
177
|
+
}
|
|
178
|
+
/>
|
|
179
|
+
|
|
180
|
+
<H5 color="grey.600" px={1}>
|
|
181
|
+
-
|
|
182
|
+
</H5>
|
|
183
|
+
|
|
184
|
+
<TextField
|
|
185
|
+
fullWidth
|
|
186
|
+
size="small"
|
|
187
|
+
type="number"
|
|
188
|
+
placeholder="250"
|
|
189
|
+
value={filters.price[1]}
|
|
190
|
+
onChange={(e) =>
|
|
191
|
+
handleChangePrice([filters.price[0], +e.target.value])
|
|
192
|
+
}
|
|
193
|
+
/>
|
|
194
|
+
</FlexBetween>
|
|
195
|
+
|
|
196
|
+
<Box component={Divider} my={3} />
|
|
197
|
+
|
|
198
|
+
{/* BRAND VARIANT FILTER */}
|
|
199
|
+
<H6 mb={2}>Brands</H6>
|
|
200
|
+
<FormGroup>
|
|
201
|
+
{BRANDS.map(({ label, value }) => (
|
|
202
|
+
<CheckboxLabel
|
|
203
|
+
key={value}
|
|
204
|
+
label={label}
|
|
205
|
+
checked={filters.brand.includes(value)}
|
|
206
|
+
onChange={() => handleChangeBrand(value)}
|
|
207
|
+
/>
|
|
208
|
+
))}
|
|
209
|
+
</FormGroup>
|
|
210
|
+
|
|
211
|
+
<Box component={Divider} my={3} />
|
|
212
|
+
|
|
213
|
+
{/* SALES OPTIONS */}
|
|
214
|
+
<FormGroup>
|
|
215
|
+
{OTHERS.map(({ label, value }) => (
|
|
216
|
+
<CheckboxLabel
|
|
217
|
+
key={value}
|
|
218
|
+
label={label}
|
|
219
|
+
checked={filters.sales.includes(value)}
|
|
220
|
+
onChange={() => handleChangeSales(value)}
|
|
221
|
+
/>
|
|
222
|
+
))}
|
|
223
|
+
</FormGroup>
|
|
224
|
+
|
|
225
|
+
<Box component={Divider} my={3} />
|
|
226
|
+
|
|
227
|
+
{/* RATINGS FILTER */}
|
|
228
|
+
<H6 mb={2}>Ratings</H6>
|
|
229
|
+
<FormGroup>
|
|
230
|
+
{[5, 4, 3, 2, 1].map((item) => (
|
|
231
|
+
<CheckboxLabel
|
|
232
|
+
key={item}
|
|
233
|
+
checked={filters.rating === item}
|
|
234
|
+
onChange={() => handleChangeRating(item)}
|
|
235
|
+
label={<Rating size="small" value={item} color="warn" readOnly />}
|
|
236
|
+
/>
|
|
237
|
+
))}
|
|
238
|
+
</FormGroup>
|
|
239
|
+
|
|
240
|
+
<Box component={Divider} my={3} />
|
|
241
|
+
|
|
242
|
+
{/* COLORS VARIANT FILTER */}
|
|
243
|
+
<H6 mb={2}>Colors</H6>
|
|
244
|
+
<FlexBox mb={2} flexWrap="wrap" gap={1.5}>
|
|
245
|
+
{colorList.map((item) => (
|
|
246
|
+
<Box
|
|
247
|
+
key={item}
|
|
248
|
+
width={25}
|
|
249
|
+
height={25}
|
|
250
|
+
flexShrink={0}
|
|
251
|
+
bgcolor={item}
|
|
252
|
+
borderRadius="50%"
|
|
253
|
+
onClick={() => handleChangeColor(item)}
|
|
254
|
+
sx={{
|
|
255
|
+
outlineOffset: 1,
|
|
256
|
+
cursor: "pointer",
|
|
257
|
+
outline: filters.color.includes(item) ? 1 : 0,
|
|
258
|
+
outlineColor: item,
|
|
259
|
+
}}
|
|
260
|
+
/>
|
|
261
|
+
))}
|
|
262
|
+
</FlexBox>
|
|
263
|
+
</div>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
import { ProductDetails } from "@/api-manager/schemas/product.schema";
|
|
3
|
+
import { SelectedDimensions } from "@evenicanpm/storefront-core/src/hooks/use-variants";
|
|
4
|
+
import {
|
|
5
|
+
ProductWarehouseInventoryAvailability,
|
|
6
|
+
ProductWarehouseInventoryInformation,
|
|
7
|
+
} from "@msdyn365-commerce/retail-proxy";
|
|
8
|
+
|
|
9
|
+
export interface ProductIntroContext {
|
|
10
|
+
/** The current master product of the PDP */
|
|
11
|
+
masterProduct: ProductDetails;
|
|
12
|
+
/** The currently selected variant that is deduced from dimensions */
|
|
13
|
+
selectedVariant: ProductDetails;
|
|
14
|
+
/** Is the data for variant loading? */
|
|
15
|
+
variantPending: boolean;
|
|
16
|
+
/** State that tracks which dimensions are currently selected */
|
|
17
|
+
selectDimensions: SelectedDimensions;
|
|
18
|
+
/** Handler for when dimensions are selected **/
|
|
19
|
+
handleChangeVariant: () => void;
|
|
20
|
+
/** Calculated value are all dimensions selected? **/
|
|
21
|
+
allDimensionsSelected: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ProductImagesContext {
|
|
25
|
+
/** Currently selected index from images array of product details */
|
|
26
|
+
selectedImageIndex?: number;
|
|
27
|
+
/** The default image to show on PDP */
|
|
28
|
+
primaryImageUrl: string;
|
|
29
|
+
/* Handler when thumbnails are clicked */
|
|
30
|
+
handleImageClick: (ind: number) => () => void;
|
|
31
|
+
/* The array of images to display, comes from */
|
|
32
|
+
images: string[];
|
|
33
|
+
/* Name */
|
|
34
|
+
name: string | undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ProductInfoContext {
|
|
38
|
+
/** Currently selected index from images array of product details */
|
|
39
|
+
isOOS: boolean;
|
|
40
|
+
/** **/
|
|
41
|
+
inventoryPending: boolean;
|
|
42
|
+
/** */
|
|
43
|
+
shippingInventoryData: ProductWarehouseInventoryInformation;
|
|
44
|
+
/** */
|
|
45
|
+
showDimensionError: boolean;
|
|
46
|
+
/** */
|
|
47
|
+
setShowDimensionError: () => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const ProductImagesContext = createContext(null);
|
|
51
|
+
export const ProductIntroContext = createContext(null);
|
|
52
|
+
export const ProductInfoContext = createContext(null);
|
|
@@ -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
|
+
};
|