@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,61 @@
|
|
|
1
|
+
import Button from "@mui/material/Button";
|
|
2
|
+
import IconButton from "@mui/material/IconButton";
|
|
3
|
+
import styled from "@mui/material/styles/styled";
|
|
4
|
+
|
|
5
|
+
export const Card = styled("div")({
|
|
6
|
+
":hover": {
|
|
7
|
+
img: { transform: "scale(1.1)" },
|
|
8
|
+
".product-actions": { right: 15 },
|
|
9
|
+
".product-view-action": { opacity: 1 },
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const CardMedia = styled("div")(({ theme }) => ({
|
|
14
|
+
aspectRatio: "1/1",
|
|
15
|
+
// maxHeight: 300,
|
|
16
|
+
borderRadius: 4,
|
|
17
|
+
cursor: "pointer",
|
|
18
|
+
overflow: "hidden",
|
|
19
|
+
position: "relative",
|
|
20
|
+
backgroundColor: theme.palette.grey[300],
|
|
21
|
+
img: { transition: "0.3s" },
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export const AddToCartButton = styled(IconButton)(({ theme }) => ({
|
|
25
|
+
top: 15,
|
|
26
|
+
right: -40,
|
|
27
|
+
position: "absolute",
|
|
28
|
+
backgroundColor: "white",
|
|
29
|
+
transition: "right 0.3s .1s",
|
|
30
|
+
color: theme.palette.text.primary,
|
|
31
|
+
".icon": { fontSize: 16 },
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
export const FavoriteButton = styled(IconButton)(({ theme }) => ({
|
|
35
|
+
top: 55,
|
|
36
|
+
right: -40,
|
|
37
|
+
position: "absolute",
|
|
38
|
+
backgroundColor: "white",
|
|
39
|
+
transition: "right 0.3s .2s",
|
|
40
|
+
color: theme.palette.text.primary,
|
|
41
|
+
".icon": { fontSize: 16 },
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
export const QuickViewButton = styled(Button)({
|
|
45
|
+
left: 0,
|
|
46
|
+
bottom: 12,
|
|
47
|
+
opacity: 0,
|
|
48
|
+
borderRadius: 4,
|
|
49
|
+
position: "absolute",
|
|
50
|
+
transition: "all 0.3s",
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const QuickViewSmallButton = styled(IconButton)(({ theme }) => ({
|
|
54
|
+
top: 15,
|
|
55
|
+
right: -40,
|
|
56
|
+
position: "absolute",
|
|
57
|
+
backgroundColor: "white",
|
|
58
|
+
transition: "right 0.3s .1s",
|
|
59
|
+
color: theme.palette.text.primary,
|
|
60
|
+
".icon": { fontSize: 16 },
|
|
61
|
+
}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Box from "@mui/material/Box";
|
|
2
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
3
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components-v2/flex-box/flex-box";
|
|
4
|
+
import { Paragraph } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
5
|
+
// CUSTOM UTILS LIBRARY FUNCTIONS
|
|
6
|
+
import { calculateDiscount, currency } from "@/lib/lib";
|
|
7
|
+
|
|
8
|
+
// ==============================================================
|
|
9
|
+
type Props = { price: number; discount: number };
|
|
10
|
+
// ==============================================================
|
|
11
|
+
|
|
12
|
+
export default function ProductPrice({ discount, price }: Props) {
|
|
13
|
+
return (
|
|
14
|
+
<FlexBox alignItems="center" gap={1} mt={0.5}>
|
|
15
|
+
<Paragraph fontWeight={600} color="primary.main">
|
|
16
|
+
{calculateDiscount(price, discount)}
|
|
17
|
+
</Paragraph>
|
|
18
|
+
|
|
19
|
+
{discount ? (
|
|
20
|
+
<Box component="del" fontWeight={600} color="grey.600">
|
|
21
|
+
{currency(price)}
|
|
22
|
+
</Box>
|
|
23
|
+
) : null}
|
|
24
|
+
</FlexBox>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Rating from "@mui/material/Rating";
|
|
2
|
+
import { BoxProps } from "@mui/material/Box";
|
|
3
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
4
|
+
import { Span } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
5
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components-v2/flex-box/flex-box";
|
|
6
|
+
|
|
7
|
+
// ==============================================================
|
|
8
|
+
interface Props extends BoxProps {
|
|
9
|
+
rating: number;
|
|
10
|
+
showRating: boolean;
|
|
11
|
+
}
|
|
12
|
+
// ==============================================================
|
|
13
|
+
|
|
14
|
+
export default function ProductRating({
|
|
15
|
+
showRating,
|
|
16
|
+
rating = 0,
|
|
17
|
+
...props
|
|
18
|
+
}: Props) {
|
|
19
|
+
if (showRating) {
|
|
20
|
+
return (
|
|
21
|
+
<FlexBox gap={1} alignItems="center" {...props}>
|
|
22
|
+
<Rating size="small" value={rating} color="warn" readOnly />
|
|
23
|
+
<Span color="grey.600">({rating})</Span>
|
|
24
|
+
</FlexBox>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import { H3 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
3
|
+
|
|
4
|
+
// ==============================================================
|
|
5
|
+
type Props = { title: string; slug: string };
|
|
6
|
+
// ==============================================================
|
|
7
|
+
|
|
8
|
+
export default function ProductTitle({ title, slug }: Props) {
|
|
9
|
+
return (
|
|
10
|
+
<Link href={`/products/${slug}`}>
|
|
11
|
+
<H3
|
|
12
|
+
mb={1}
|
|
13
|
+
ellipsis
|
|
14
|
+
title={title}
|
|
15
|
+
fontSize={14}
|
|
16
|
+
fontWeight={600}
|
|
17
|
+
className="title"
|
|
18
|
+
color="text.secondary"
|
|
19
|
+
>
|
|
20
|
+
{title}
|
|
21
|
+
</H3>
|
|
22
|
+
</Link>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import getCart from "@/services/cart/queries/get-cart";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { useSnackbar } from "notistack";
|
|
4
|
+
|
|
5
|
+
export default function useProduct(slug: string) {
|
|
6
|
+
const { data: cart } = getCart.useData();
|
|
7
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
8
|
+
const [openModal, setOpenModal] = useState(false);
|
|
9
|
+
const [isFavorite, setIsFavorite] = useState(false);
|
|
10
|
+
|
|
11
|
+
const cartItem = cart?.CartLines?.find(
|
|
12
|
+
(cartLine) => String(cartLine.Product?.RecordId) === slug,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const toggleFavorite = useCallback(() => setIsFavorite((fav) => !fav), []);
|
|
16
|
+
const toggleDialog = useCallback(() => setOpenModal((open) => !open), []);
|
|
17
|
+
|
|
18
|
+
const handleCartAmountChange = (type?: "remove") => {
|
|
19
|
+
// TODO Febraury 25, 2025: Implement this function
|
|
20
|
+
//dispatch({ type: "CHANGE_CART_AMOUNT", payload: product });
|
|
21
|
+
// SHOW ALERT PRODUCT ADDED OR REMOVE
|
|
22
|
+
if (type === "remove")
|
|
23
|
+
enqueueSnackbar("Remove from Cart", { variant: "error" });
|
|
24
|
+
else enqueueSnackbar("Added to Cart", { variant: "success" });
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
cartItem,
|
|
29
|
+
openModal,
|
|
30
|
+
isFavorite,
|
|
31
|
+
toggleDialog,
|
|
32
|
+
toggleFavorite,
|
|
33
|
+
handleCartAmountChange,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ProductViewDialog
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
import Grid from "@mui/material/Grid2";
|
|
6
|
+
import Rating from "@mui/material/Rating";
|
|
7
|
+
import Dialog from "@mui/material/Dialog";
|
|
8
|
+
import Divider from "@mui/material/Divider";
|
|
9
|
+
import IconButton from "@mui/material/IconButton";
|
|
10
|
+
import DialogContent from "@mui/material/DialogContent";
|
|
11
|
+
import Close from "@mui/icons-material/Close";
|
|
12
|
+
import { Carousel } from "../../carousel";
|
|
13
|
+
import BazaarImage from "../../BazaarImage";
|
|
14
|
+
import { FlexBox } from "../../flex-box";
|
|
15
|
+
import { H2, Paragraph, H1, H6 } from "../../Typography";
|
|
16
|
+
import { currency } from "@evenicanpm/storefront-core/src/lib/lib";
|
|
17
|
+
import QuantityVariantsSelect from "../../product-quantity-variants";
|
|
18
|
+
import getProductById from "@evenicanpm/storefront-core/src/api-manager/services/product/queries/get-product-by-id";
|
|
19
|
+
import { createContext, ReactElement, useContext } from "react";
|
|
20
|
+
import { ProductDetails } from "@evenicanpm/storefront-core/src/api-manager/schemas/product.schema";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @category Props
|
|
24
|
+
*/
|
|
25
|
+
interface Props {
|
|
26
|
+
productId: number;
|
|
27
|
+
openDialog: boolean;
|
|
28
|
+
cartId?: string;
|
|
29
|
+
handleCloseDialog?: () => void;
|
|
30
|
+
children: ReactElement;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @category Context
|
|
35
|
+
*/
|
|
36
|
+
interface ProductDialogContext {
|
|
37
|
+
/** the product details object that is return from getProductById */
|
|
38
|
+
product: ProductDetails;
|
|
39
|
+
/* is dialog open? */
|
|
40
|
+
openDialog: boolean;
|
|
41
|
+
/** close dialog handler */
|
|
42
|
+
handleCloseDialog?: () => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export const ProductDialogContext = createContext(null);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @category Compound Component
|
|
52
|
+
* @example
|
|
53
|
+
* <ProductViewDialog {...props}>
|
|
54
|
+
* <ProductViewDialog.Content>
|
|
55
|
+
* <ProductViewDialog.Content.Images />
|
|
56
|
+
* <ProductViewDialog.Content.Info>
|
|
57
|
+
* <ProductViewDialog.Content.Info.Name />
|
|
58
|
+
* <ProductViewDialog.Content.Info.Category />
|
|
59
|
+
* <ProductViewDialog.Content.Info.Description />
|
|
60
|
+
* <ProductViewDialog.Content.Info.Rating />
|
|
61
|
+
* <ProductViewDialog.Content.Info.AddToCart />
|
|
62
|
+
* </ProductViewDialog.Content.Info>
|
|
63
|
+
* </ProductViewDialog.Content>
|
|
64
|
+
* </ProductViewDialog>
|
|
65
|
+
*/
|
|
66
|
+
export default function ProductDialog(props: Props) {
|
|
67
|
+
const { children, openDialog, handleCloseDialog } = props;
|
|
68
|
+
const { data: product, isPending } = getProductById.useData({
|
|
69
|
+
id: Number(props.productId),
|
|
70
|
+
});
|
|
71
|
+
if (isPending) return null;
|
|
72
|
+
return (
|
|
73
|
+
<ProductDialogContext.Provider value={{ product, openDialog, handleCloseDialog }}>
|
|
74
|
+
<Dialog
|
|
75
|
+
open={openDialog}
|
|
76
|
+
maxWidth={false}
|
|
77
|
+
onClose={handleCloseDialog}
|
|
78
|
+
sx={{ zIndex: 1501 }}
|
|
79
|
+
>
|
|
80
|
+
<DialogContent sx={{ maxWidth: 900, width: "100%" }}>{children}</DialogContent>
|
|
81
|
+
</Dialog>
|
|
82
|
+
</ProductDialogContext.Provider >
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @category Sub-Component
|
|
88
|
+
*/
|
|
89
|
+
export const ProductDialogContent = ({ children }: { children: React.ReactNode }) => {
|
|
90
|
+
const { handleCloseDialog } = useContext(ProductDialogContext);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<DialogContent sx={{ maxWidth: 900, width: "100%" }}>
|
|
94
|
+
<div>
|
|
95
|
+
<Grid container spacing={3}>
|
|
96
|
+
{children}
|
|
97
|
+
</Grid>
|
|
98
|
+
</div>
|
|
99
|
+
<IconButton
|
|
100
|
+
sx={{ position: "absolute", top: 3, right: 3 }}
|
|
101
|
+
onClick={handleCloseDialog}
|
|
102
|
+
>
|
|
103
|
+
<Close fontSize="small" color="secondary" />
|
|
104
|
+
</IconButton>
|
|
105
|
+
</DialogContent>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @category Sub-Component
|
|
111
|
+
*/
|
|
112
|
+
export const ProductDialogContentImages = () => {
|
|
113
|
+
const { product } = useContext(ProductDialogContext);
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
< Grid size={{ md: 6, xs: 12 }
|
|
117
|
+
}>
|
|
118
|
+
<Carousel
|
|
119
|
+
slidesToShow={1}
|
|
120
|
+
arrowStyles={{
|
|
121
|
+
boxShadow: 0,
|
|
122
|
+
color: "primary.main",
|
|
123
|
+
backgroundColor: "transparent",
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
{product?.Images.map((item: string, index: number) => (
|
|
127
|
+
<BazaarImage
|
|
128
|
+
key={index}
|
|
129
|
+
src={item}
|
|
130
|
+
alt="product"
|
|
131
|
+
sx={{
|
|
132
|
+
mx: "auto",
|
|
133
|
+
width: "100%",
|
|
134
|
+
objectFit: "contain",
|
|
135
|
+
height: { sm: 400, xs: 250 },
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
))}
|
|
139
|
+
</Carousel>
|
|
140
|
+
</Grid >
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @category Sub-Component
|
|
146
|
+
*/
|
|
147
|
+
export const ProductDialogContentInfo = ({ children }: { children: React.ReactNode }) => {
|
|
148
|
+
return (
|
|
149
|
+
<Grid size={{ md: 6, xs: 12 }} alignSelf="center">
|
|
150
|
+
{children}
|
|
151
|
+
</Grid>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @category Sub-Component
|
|
157
|
+
*/
|
|
158
|
+
export const InfoName = () => {
|
|
159
|
+
const { product } = useContext(ProductDialogContext);
|
|
160
|
+
return <H2>{product?.Name}</H2>
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @category Sub-Component
|
|
165
|
+
*/
|
|
166
|
+
export const InfoCategory = () => {
|
|
167
|
+
return (
|
|
168
|
+
<Paragraph py={1} color="grey.500" fontWeight={600} fontSize={13}>
|
|
169
|
+
CATEGORY
|
|
170
|
+
</Paragraph>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @category Sub-Component
|
|
176
|
+
*/
|
|
177
|
+
export const InfoPrice = () => {
|
|
178
|
+
const { product } = useContext(ProductDialogContext);
|
|
179
|
+
return <H1 color="primary.main">{currency(product?.Price)}</H1>
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @category Sub-Component
|
|
184
|
+
*/
|
|
185
|
+
export const InfoDescription = () => {
|
|
186
|
+
const { product } = useContext(ProductDialogContext);
|
|
187
|
+
return <Paragraph my={2}>{product?.Description}</Paragraph>
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @category Sub-Component
|
|
192
|
+
*/
|
|
193
|
+
export const InfoRating = () => {
|
|
194
|
+
return (
|
|
195
|
+
<FlexBox alignItems="center" gap={1} mt={1}>
|
|
196
|
+
<Rating color="warn" value={4} readOnly />
|
|
197
|
+
<H6 lineHeight="1">(50)</H6>
|
|
198
|
+
</FlexBox>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @category Sub-Component
|
|
204
|
+
*/
|
|
205
|
+
export const InfoAddToCart = () => {
|
|
206
|
+
const { product } = useContext(ProductDialogContext);
|
|
207
|
+
return (
|
|
208
|
+
<>
|
|
209
|
+
<Divider sx={{ mb: 2 }} />
|
|
210
|
+
<FlexBox alignItems="center">
|
|
211
|
+
<QuantityVariantsSelect product={product} />
|
|
212
|
+
</FlexBox>
|
|
213
|
+
</>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
ProductDialog.Content = ProductDialogContent;
|
|
218
|
+
ProductDialogContentInfo.Name = InfoName;
|
|
219
|
+
ProductDialogContentInfo.Category = InfoCategory;
|
|
220
|
+
ProductDialogContentInfo.Price = InfoPrice;
|
|
221
|
+
ProductDialogContentInfo.Description = InfoDescription;
|
|
222
|
+
ProductDialogContentInfo.Rating = InfoRating;
|
|
223
|
+
ProductDialogContentInfo.AddToCart = InfoAddToCart;
|
|
224
|
+
ProductDialogContent.Images = ProductDialogContentImages;
|
|
225
|
+
ProductDialogContent.Info = ProductDialogContentInfo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import ProductViewDialog from "./compound/product-dialog";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
productId: number;
|
|
6
|
+
openDialog: boolean;
|
|
7
|
+
handleCloseDialog?: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @category Composed Component
|
|
12
|
+
*/
|
|
13
|
+
export default function ProductDialog(props: Props) {
|
|
14
|
+
return (
|
|
15
|
+
<ProductViewDialog {...props}>
|
|
16
|
+
<ProductViewDialog.Content>
|
|
17
|
+
<ProductViewDialog.Content.Images />
|
|
18
|
+
<ProductViewDialog.Content.Info>
|
|
19
|
+
<ProductViewDialog.Content.Info.Name />
|
|
20
|
+
<ProductViewDialog.Content.Info.Category />
|
|
21
|
+
<ProductViewDialog.Content.Info.Description />
|
|
22
|
+
<ProductViewDialog.Content.Info.Rating />
|
|
23
|
+
<ProductViewDialog.Content.Info.AddToCart />
|
|
24
|
+
</ProductViewDialog.Content.Info>
|
|
25
|
+
</ProductViewDialog.Content>
|
|
26
|
+
</ProductViewDialog>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ProductDimensions
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
import { DimensionsContext } from "./dimensions";
|
|
6
|
+
import { H6 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
7
|
+
import { useTranslations } from "next-intl";
|
|
8
|
+
import { ProductDimensionType } from "@msdyn365-commerce/retail-proxy";
|
|
9
|
+
import { hasSelectedDimension } from "../utils/has-selected-dimension";
|
|
10
|
+
import { useContext } from "react";
|
|
11
|
+
import { DimensionsGroupContext } from "./dimensions-group";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* An error that corresponds with a specific dimension group.
|
|
15
|
+
* Usually renders if the user tries to add to cart without selecting
|
|
16
|
+
* all required dimensions to get variant id.
|
|
17
|
+
*
|
|
18
|
+
* @category Sub-Component
|
|
19
|
+
*/
|
|
20
|
+
export const DimensionGroupError = () => {
|
|
21
|
+
const t = useTranslations("productDetail.Dimensions");
|
|
22
|
+
const dimensionGroupContext = useContext(DimensionsGroupContext);
|
|
23
|
+
const dimensionsContext = useContext(DimensionsContext);
|
|
24
|
+
|
|
25
|
+
if (!dimensionGroupContext || !dimensionsContext)
|
|
26
|
+
throw new Error(
|
|
27
|
+
"ProductDimensionGroup.Error must be used within a ProductDimensionsGroupContext",
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const { dimensions } = dimensionGroupContext;
|
|
31
|
+
const { selectDimensions, showDimensionError } = dimensionsContext;
|
|
32
|
+
|
|
33
|
+
if (
|
|
34
|
+
showDimensionError &&
|
|
35
|
+
!hasSelectedDimension(dimensions, selectDimensions)
|
|
36
|
+
) {
|
|
37
|
+
return (
|
|
38
|
+
<H6 color="error.main" mb={1}>
|
|
39
|
+
{t("selectError", {
|
|
40
|
+
dimension:
|
|
41
|
+
ProductDimensionType[dimensions[0]?.DimensionTypeValue || 0],
|
|
42
|
+
})}
|
|
43
|
+
</H6>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ProductDimensions
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
import { H6 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
6
|
+
import { ProductDimensionType } from "@msdyn365-commerce/retail-proxy";
|
|
7
|
+
import { useContext } from "react";
|
|
8
|
+
import { DimensionsGroupContext } from "./dimensions-group";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @category Sub-Component
|
|
12
|
+
*/
|
|
13
|
+
export const DimensionGroupLabel = () => {
|
|
14
|
+
const context = useContext(DimensionsGroupContext);
|
|
15
|
+
if (!context)
|
|
16
|
+
throw new Error(
|
|
17
|
+
"ProductDimensionGroup.Error must be used within a ProductDimensionsGroupContext",
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const { dimensions } = context;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<H6 mb={1}>
|
|
24
|
+
{ProductDimensionType[dimensions[0]?.DimensionTypeValue || 0]}
|
|
25
|
+
</H6>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ProductDimensions
|
|
3
|
+
*/
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import { Chip } from "@mui/material";
|
|
6
|
+
import {
|
|
7
|
+
ProductDimensionValueInventoryAvailability,
|
|
8
|
+
ProductDimensionType,
|
|
9
|
+
} from "@msdyn365-commerce/retail-proxy";
|
|
10
|
+
import { DimensionsContext } from "./dimensions";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @category Props
|
|
14
|
+
*/
|
|
15
|
+
interface Props {
|
|
16
|
+
dimension: ProductDimensionValueInventoryAvailability;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @category Sub-Component
|
|
21
|
+
*/
|
|
22
|
+
export const DimensionGroupListChip = ({ dimension }: Props) => {
|
|
23
|
+
const context = useContext(DimensionsContext);
|
|
24
|
+
if (!context)
|
|
25
|
+
throw new Error(
|
|
26
|
+
"ProductDimensionGroup.Error must be used within a ProductDimensionsGroupContext",
|
|
27
|
+
);
|
|
28
|
+
const { selectDimensions, handleChangeVariant } = context;
|
|
29
|
+
|
|
30
|
+
// Calculate Values
|
|
31
|
+
const type = ProductDimensionType[dimension.DimensionTypeValue || 0];
|
|
32
|
+
|
|
33
|
+
const disabled = dimension.TotalAvailableInventoryLevelCode !== "AVAIL";
|
|
34
|
+
|
|
35
|
+
const selected =
|
|
36
|
+
selectDimensions[dimension.DimensionTypeValue || 0]?.DimensionValue ===
|
|
37
|
+
dimension.DimensionValue;
|
|
38
|
+
|
|
39
|
+
switch (type) {
|
|
40
|
+
case "Color":
|
|
41
|
+
return (
|
|
42
|
+
<Chip
|
|
43
|
+
key={dimension.DimensionValue?.RecordId}
|
|
44
|
+
onClick={() => {
|
|
45
|
+
handleChangeVariant(dimension);
|
|
46
|
+
}}
|
|
47
|
+
disabled={disabled}
|
|
48
|
+
sx={{
|
|
49
|
+
borderRadius: "100%",
|
|
50
|
+
mr: 1,
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
backgroundColor: dimension.DimensionValue?.Value,
|
|
53
|
+
width: 32,
|
|
54
|
+
height: 32,
|
|
55
|
+
border: selected ? "2px solid" : "2px solid transparent",
|
|
56
|
+
"&:hover": {
|
|
57
|
+
backgroundColor: dimension.DimensionValue?.Value,
|
|
58
|
+
},
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
// Standard text dimension
|
|
63
|
+
default:
|
|
64
|
+
return (
|
|
65
|
+
<Chip
|
|
66
|
+
key={dimension.DimensionValue?.RecordId}
|
|
67
|
+
label={dimension.DimensionValue?.Value}
|
|
68
|
+
onClick={() => {
|
|
69
|
+
handleChangeVariant(dimension);
|
|
70
|
+
}}
|
|
71
|
+
disabled={disabled}
|
|
72
|
+
sx={{ borderRadius: "4px", mr: 1, cursor: "pointer", mb: 1 }}
|
|
73
|
+
color={selected ? "primary" : "default"}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
// Add more chips as needed.
|
|
77
|
+
}
|
|
78
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ProductDimensions
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
import { DimensionGroupListChip } from "./dimensions-group-list-chip";
|
|
6
|
+
import { useContext } from "react";
|
|
7
|
+
import { DimensionsGroupContext } from "./dimensions-group";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @category Sub-Component
|
|
11
|
+
*/
|
|
12
|
+
export const DimensionGroupList = () => {
|
|
13
|
+
const context = useContext(DimensionsGroupContext);
|
|
14
|
+
if (!context)
|
|
15
|
+
throw new Error(
|
|
16
|
+
"ProductDimensionGroup.Error must be used within a ProductDimensionsGroupContext",
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const { dimensions } = context;
|
|
20
|
+
|
|
21
|
+
return dimensions.map((dimension, i) => {
|
|
22
|
+
return <DimensionGroupListChip dimension={dimension} key={i} />;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ProductDimensions
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
import Box from "@mui/material/Box";
|
|
6
|
+
import { createContext } from "react";
|
|
7
|
+
import { ProductDimensionValueInventoryAvailability } from "@msdyn365-commerce/retail-proxy";
|
|
8
|
+
import { PropsWithChildren } from "react";
|
|
9
|
+
import { DimensionGroupError } from "./dimensions-group-error";
|
|
10
|
+
import { DimensionGroupLabel } from "./dimensions-group-label";
|
|
11
|
+
import { DimensionGroupList } from "./dimensions-group-list";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @category Props
|
|
15
|
+
*/
|
|
16
|
+
export interface DimensionGroupProps extends PropsWithChildren {
|
|
17
|
+
dimensions: ProductDimensionValueInventoryAvailability[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @category Context
|
|
22
|
+
*/
|
|
23
|
+
export interface DimensionGroupContext {
|
|
24
|
+
dimensions: ProductDimensionValueInventoryAvailability[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export const DimensionsGroupContext =
|
|
30
|
+
createContext<DimensionGroupContext | null>(null);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A Dimension group ie. 'Swatch' or 'Size. Renders out a list of options in MUI Chips.
|
|
34
|
+
* @category Sub-Component
|
|
35
|
+
* @example
|
|
36
|
+
* <ProductDimension.Group dimensions={group} key={i}>
|
|
37
|
+
* <ProductDimension.Group.Label />
|
|
38
|
+
* <ProductDimension.Group.List />
|
|
39
|
+
* <ProductDimension.Group.Error />
|
|
40
|
+
* </ProductDimension.Group>
|
|
41
|
+
*/
|
|
42
|
+
export const DimensionGroup = ({
|
|
43
|
+
dimensions,
|
|
44
|
+
children,
|
|
45
|
+
}: DimensionGroupProps) => {
|
|
46
|
+
return (
|
|
47
|
+
<DimensionsGroupContext.Provider value={{ dimensions }}>
|
|
48
|
+
<Box mb={2}>{children}</Box>
|
|
49
|
+
</DimensionsGroupContext.Provider>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
DimensionGroup.Error = DimensionGroupError;
|
|
54
|
+
DimensionGroup.Label = DimensionGroupLabel;
|
|
55
|
+
DimensionGroup.List = DimensionGroupList;
|