@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,45 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import ProductsGridView from "./compound/products-grid-view";
|
|
3
|
+
import ProductsListView from "./compound/products-list-view";
|
|
4
|
+
// DATA MODEL
|
|
5
|
+
import { ProductSearchResult as Product } from "@msdyn365-commerce/retail-proxy";
|
|
6
|
+
import { ProductPrice } from "@/api-manager/schemas/product.schema";
|
|
7
|
+
|
|
8
|
+
export interface Props {
|
|
9
|
+
/** List of products to display */
|
|
10
|
+
products: Product[];
|
|
11
|
+
/** Pagination component */
|
|
12
|
+
pagination?: ReactNode;
|
|
13
|
+
/** Array of product pricing */
|
|
14
|
+
productPrices?: ProductPrice[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* Pre-composed implementation of ProductGrid
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export function ProductsGrid(props: Props) {
|
|
23
|
+
return (
|
|
24
|
+
<ProductsGridView {...props}>
|
|
25
|
+
<ProductsGridView.Grid>
|
|
26
|
+
<ProductsGridView.Card />
|
|
27
|
+
</ProductsGridView.Grid>
|
|
28
|
+
</ProductsGridView>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* Pre-composed implementation of ProductList
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
export function ProductsList(props: Props) {
|
|
38
|
+
return (
|
|
39
|
+
<ProductsListView {...props}>
|
|
40
|
+
<ProductsListView.List>
|
|
41
|
+
<ProductsListView.Card />
|
|
42
|
+
</ProductsListView.List>
|
|
43
|
+
</ProductsListView>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Fragment, ReactNode } from "react";
|
|
2
|
+
import Grid from "@mui/material/Grid2";
|
|
3
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
4
|
+
import { FlexBetween } from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
5
|
+
import ProductCardPlp from "@evenicanpm/storefront-core/src/components-v2/product-cards/product-card-plp/product-card";
|
|
6
|
+
// DATA MODEL
|
|
7
|
+
import { ProductSearchResult as Product } from "@msdyn365-commerce/retail-proxy";
|
|
8
|
+
import { ProductPrice } from "@/api-manager/schemas/product.schema";
|
|
9
|
+
|
|
10
|
+
// ========================================================
|
|
11
|
+
type Props = {
|
|
12
|
+
products: Product[];
|
|
13
|
+
pagination?: ReactNode;
|
|
14
|
+
productPrices?: ProductPrice[];
|
|
15
|
+
};
|
|
16
|
+
// ========================================================
|
|
17
|
+
|
|
18
|
+
export default function ProductsGridView({
|
|
19
|
+
products,
|
|
20
|
+
pagination,
|
|
21
|
+
productPrices,
|
|
22
|
+
}: Props) {
|
|
23
|
+
return (
|
|
24
|
+
<Fragment>
|
|
25
|
+
<Grid container spacing={3}>
|
|
26
|
+
{products.map((item: Product) => {
|
|
27
|
+
const matchingPrice = productPrices?.find(
|
|
28
|
+
(price) => price.ProductId === item.RecordId,
|
|
29
|
+
);
|
|
30
|
+
return (
|
|
31
|
+
<Grid size={{ lg: 4, sm: 6, xs: 12 }} key={item.ItemId}>
|
|
32
|
+
<ProductCardPlp
|
|
33
|
+
key={item.RecordId}
|
|
34
|
+
product={{
|
|
35
|
+
title: item.Name ?? "",
|
|
36
|
+
slug: item.ItemId ?? "",
|
|
37
|
+
price: matchingPrice?.CustomerContextualPrice ?? 0,
|
|
38
|
+
imgUrl: item.PrimaryImageUrl ?? "",
|
|
39
|
+
rating: item.TotalRatings ?? 0,
|
|
40
|
+
discount: 0, // Need to get discount info for product.
|
|
41
|
+
id: item.RecordId,
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
<ProductCardPlp.Image />
|
|
45
|
+
<ProductCardPlp.Body>
|
|
46
|
+
<ProductCardPlp.Info>
|
|
47
|
+
<ProductCardPlp.Title />
|
|
48
|
+
<ProductCardPlp.Rating />
|
|
49
|
+
<ProductCardPlp.Price />
|
|
50
|
+
</ProductCardPlp.Info>
|
|
51
|
+
{/* <ProductCardPlp.Actions>
|
|
52
|
+
<ProductCardPlp.QuantityButtons />
|
|
53
|
+
</ProductCardPlp.Actions> */}
|
|
54
|
+
</ProductCardPlp.Body>
|
|
55
|
+
</ProductCardPlp>
|
|
56
|
+
</Grid>
|
|
57
|
+
);
|
|
58
|
+
})}
|
|
59
|
+
</Grid>
|
|
60
|
+
<FlexBetween flexWrap="wrap" mt={6}>
|
|
61
|
+
{pagination}
|
|
62
|
+
</FlexBetween>
|
|
63
|
+
</Fragment>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
3
|
+
import FlexBetween from "@evenicanpm/storefront-core/src/components-v2/flex-box/flex-between";
|
|
4
|
+
import { ProductCardPlpList } from "@evenicanpm/storefront-core/src/components-v2/product-cards/product-card-plp-list/index";
|
|
5
|
+
// DATA MODEL
|
|
6
|
+
import { ProductSearchResult as Product } from "@msdyn365-commerce/retail-proxy";
|
|
7
|
+
import { ProductPrice } from "@/api-manager/schemas/product.schema";
|
|
8
|
+
|
|
9
|
+
// ==========================================================
|
|
10
|
+
type Props = {
|
|
11
|
+
products: Product[];
|
|
12
|
+
pagination?: ReactNode;
|
|
13
|
+
productPrices?: ProductPrice[];
|
|
14
|
+
};
|
|
15
|
+
// ==========================================================
|
|
16
|
+
|
|
17
|
+
export default function ProductsListView({
|
|
18
|
+
products,
|
|
19
|
+
pagination,
|
|
20
|
+
productPrices,
|
|
21
|
+
}: Props) {
|
|
22
|
+
return (
|
|
23
|
+
<div>
|
|
24
|
+
{products.map((item) => {
|
|
25
|
+
const matchingPrice = productPrices?.find(
|
|
26
|
+
(price) => price.ProductId === item.RecordId,
|
|
27
|
+
);
|
|
28
|
+
return (
|
|
29
|
+
<ProductCardPlpList
|
|
30
|
+
key={item.RecordId}
|
|
31
|
+
product={{
|
|
32
|
+
id: item.RecordId,
|
|
33
|
+
title: item.Name ?? "",
|
|
34
|
+
slug: item.ItemId ?? "",
|
|
35
|
+
price: matchingPrice?.CustomerContextualPrice ?? 0,
|
|
36
|
+
imgUrl: item.PrimaryImageUrl ?? "",
|
|
37
|
+
rating: item.TotalRatings ?? 0,
|
|
38
|
+
discount: 0, // Need to get discount info for product.,
|
|
39
|
+
//tags: ["Bike", "Motor", "Ducati"], // Example tags
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{/* <ProductCardPlpList.FavoriteButton /> */}
|
|
43
|
+
<ProductCardPlpList.Body>
|
|
44
|
+
<ProductCardPlpList.Image />
|
|
45
|
+
<ProductCardPlpList.Content>
|
|
46
|
+
<ProductCardPlpList.Info>
|
|
47
|
+
{/* <ProductCardPlpList.Tags /> */}
|
|
48
|
+
<ProductCardPlpList.Title />
|
|
49
|
+
<ProductCardPlpList.Price />
|
|
50
|
+
<ProductCardPlpList.Rating />
|
|
51
|
+
</ProductCardPlpList.Info>
|
|
52
|
+
{/* <ProductCardPlpList.Actions>
|
|
53
|
+
<ProductCardPlpList.QuantityButtons />
|
|
54
|
+
</ProductCardPlpList.Actions> */}
|
|
55
|
+
</ProductCardPlpList.Content>
|
|
56
|
+
</ProductCardPlpList.Body>
|
|
57
|
+
</ProductCardPlpList>
|
|
58
|
+
);
|
|
59
|
+
})}
|
|
60
|
+
|
|
61
|
+
<FlexBetween flexWrap="wrap" mt={4}>
|
|
62
|
+
{pagination}
|
|
63
|
+
</FlexBetween>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./progress";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// https://github.com/apal21/nextjs-progressbar/issues/86
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import NProgress from "nprogress";
|
|
6
|
+
import useTheme from "@mui/material/styles/useTheme";
|
|
7
|
+
import GlobalStyles from "@mui/material/GlobalStyles";
|
|
8
|
+
|
|
9
|
+
import "nprogress/nprogress.css";
|
|
10
|
+
|
|
11
|
+
type PushStateInput = [
|
|
12
|
+
data: string,
|
|
13
|
+
unused: string,
|
|
14
|
+
url?: string | URL | null | undefined,
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export default function ProgressBar() {
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
NProgress.configure({ showSpinner: false });
|
|
22
|
+
|
|
23
|
+
const handleAnchorClick = (event: Event) => {
|
|
24
|
+
const targetUrl = (event.currentTarget as HTMLAnchorElement).href;
|
|
25
|
+
const currentUrl = location.href;
|
|
26
|
+
if (targetUrl !== currentUrl) {
|
|
27
|
+
NProgress.start();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const handleMutation: MutationCallback = () => {
|
|
32
|
+
const anchorElements = document.querySelectorAll("a[href]");
|
|
33
|
+
anchorElements.forEach((anchor) =>
|
|
34
|
+
anchor.addEventListener("click", handleAnchorClick),
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const mutationObserver = new MutationObserver(handleMutation);
|
|
39
|
+
mutationObserver.observe(document, { childList: true, subtree: true });
|
|
40
|
+
|
|
41
|
+
window.history.pushState = new Proxy(window.history.pushState, {
|
|
42
|
+
apply: (target, thisArg, argArray: PushStateInput) => {
|
|
43
|
+
NProgress.done();
|
|
44
|
+
return target.apply(thisArg, argArray);
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<GlobalStyles
|
|
51
|
+
styles={{
|
|
52
|
+
"#nprogress": {
|
|
53
|
+
pointerEvents: "none",
|
|
54
|
+
".bar": {
|
|
55
|
+
top: 0,
|
|
56
|
+
left: 0,
|
|
57
|
+
height: 2,
|
|
58
|
+
width: "100%",
|
|
59
|
+
position: "fixed",
|
|
60
|
+
zIndex: 9999999999,
|
|
61
|
+
background: theme.palette.primary.main,
|
|
62
|
+
},
|
|
63
|
+
".peg": {
|
|
64
|
+
right: 0,
|
|
65
|
+
opacity: 1,
|
|
66
|
+
width: 100,
|
|
67
|
+
height: "100%",
|
|
68
|
+
display: "block",
|
|
69
|
+
boxShadow: "none",
|
|
70
|
+
position: "absolute",
|
|
71
|
+
transform: "rotate(3deg) translate(0px, -4px)",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./scrollbar";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { SxProps, Theme } from "@mui/material/styles";
|
|
3
|
+
import { Props } from "simplebar-react";
|
|
4
|
+
import "simplebar-react/dist/simplebar.min.css";
|
|
5
|
+
// STYLED COMPONENT
|
|
6
|
+
import { StyledScrollBar } from "./styles";
|
|
7
|
+
|
|
8
|
+
// =============================================================
|
|
9
|
+
interface ScrollbarProps extends Props {
|
|
10
|
+
autoHide?: boolean;
|
|
11
|
+
sx?: SxProps<Theme>;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
// =============================================================
|
|
15
|
+
|
|
16
|
+
export default function Scolbar({
|
|
17
|
+
children,
|
|
18
|
+
autoHide = true,
|
|
19
|
+
sx,
|
|
20
|
+
...props
|
|
21
|
+
}: ScrollbarProps) {
|
|
22
|
+
return (
|
|
23
|
+
<StyledScrollBar sx={sx} autoHide={autoHide} {...props}>
|
|
24
|
+
{children}
|
|
25
|
+
</StyledScrollBar>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { alpha, styled } from "@mui/material/styles";
|
|
4
|
+
import SimpleBar from "simplebar-react";
|
|
5
|
+
|
|
6
|
+
export const StyledScrollBar = styled(SimpleBar)(({ theme }) => ({
|
|
7
|
+
maxHeight: "100%",
|
|
8
|
+
"& .simplebar-scrollbar": {
|
|
9
|
+
"&.simplebar-visible:before": { opacity: 1 },
|
|
10
|
+
"&:before": { backgroundColor: alpha(theme.palette.grey[400], 0.6) },
|
|
11
|
+
},
|
|
12
|
+
"& .simplebar-track.simplebar-vertical": { width: 9 },
|
|
13
|
+
"& .simplebar-track.simplebar-horizontal .simplebar-scrollbar": { height: 6 },
|
|
14
|
+
"& .simplebar-mask": { zIndex: "inherit" },
|
|
15
|
+
}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ProductSearchResult } from "@msdyn365-commerce/retail-proxy";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
import { FormEvent } from "react";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @category Context
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface SearchBarContext {
|
|
10
|
+
state: {
|
|
11
|
+
resultsOpen: boolean;
|
|
12
|
+
searchText: string;
|
|
13
|
+
searchCategory: number;
|
|
14
|
+
};
|
|
15
|
+
setters: {
|
|
16
|
+
setResultsOpen: (open: boolean) => void;
|
|
17
|
+
};
|
|
18
|
+
handlers: {
|
|
19
|
+
handleNavigate: () => void;
|
|
20
|
+
handleCategoryChange: (categoryId: number) => void;
|
|
21
|
+
handleSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
22
|
+
handleSearch: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
23
|
+
};
|
|
24
|
+
handleCloseDrawer: () => void;
|
|
25
|
+
}
|
|
26
|
+
export const SearchContext = createContext<SearchBarContext>(null);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export const SearchResultItemContext = createContext<ProductSearchResult>(null);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import Grid from "@mui/material/Grid";
|
|
6
|
+
import ProductCardSearch from "@evenicanpm/storefront-core/src/components-v2/product-cards/product-card-search";
|
|
7
|
+
import { SearchContext, SearchResultItemContext } from "./context";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Large, vertical result item card, used for desktop view.
|
|
11
|
+
* @category Sub-Component
|
|
12
|
+
*/
|
|
13
|
+
export default function ResultItemLg() {
|
|
14
|
+
const { handleCloseDrawer } = useContext(SearchContext);
|
|
15
|
+
const item = useContext(SearchResultItemContext);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Grid item xs={12} sm={6} md={4} onClick={handleCloseDrawer}>
|
|
19
|
+
<ProductCardSearch
|
|
20
|
+
product={{
|
|
21
|
+
slug: item.ItemId ?? "",
|
|
22
|
+
price: item.Price,
|
|
23
|
+
title: item.Name ?? "",
|
|
24
|
+
thumbnail: item.PrimaryImageUrl ?? "",
|
|
25
|
+
id: item.RecordId ?? "",
|
|
26
|
+
rating: item.AverageRating ?? 0,
|
|
27
|
+
reviews: item.TotalRatings ?? 0,
|
|
28
|
+
categories: [], // TODO: Category info not available in item
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<ProductCardSearch.CardMedia>
|
|
32
|
+
<ProductCardSearch.Image />
|
|
33
|
+
</ProductCardSearch.CardMedia>
|
|
34
|
+
<ProductCardSearch.Info>
|
|
35
|
+
<ProductCardSearch.Category />
|
|
36
|
+
<ProductCardSearch.Title />
|
|
37
|
+
<ProductCardSearch.Price />
|
|
38
|
+
<ProductCardSearch.Rating />
|
|
39
|
+
</ProductCardSearch.Info>
|
|
40
|
+
</ProductCardSearch>
|
|
41
|
+
</Grid>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import NavLink from "@evenicanpm/storefront-core/src/components-v2/nav-link/nav-link";
|
|
6
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
7
|
+
import { getProductDetailUrl } from "@/lib/build-product-detail-url";
|
|
8
|
+
import { Box, Grid } from "@mui/material";
|
|
9
|
+
import LazyImage from "@evenicanpm/storefront-core/src/components-v2/LazyImage";
|
|
10
|
+
import {
|
|
11
|
+
H4,
|
|
12
|
+
Span,
|
|
13
|
+
} from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
14
|
+
import { currency } from "@/lib/lib";
|
|
15
|
+
import { SearchContext, SearchResultItemContext } from "./context";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Small, horizontal result item card, used for mobile view.
|
|
19
|
+
* @category Sub-Component
|
|
20
|
+
*/
|
|
21
|
+
export default function ResultItemSm() {
|
|
22
|
+
const { handleCloseDrawer } = useContext(SearchContext);
|
|
23
|
+
const item = useContext(SearchResultItemContext);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Grid item xs={12}>
|
|
27
|
+
<MenuItem onClick={handleCloseDrawer}>
|
|
28
|
+
<NavLink href={getProductDetailUrl(item)} key={item.RecordId}>
|
|
29
|
+
<Box display="flex" alignItems="center">
|
|
30
|
+
<Box position="relative" height={130} width={130}>
|
|
31
|
+
<LazyImage
|
|
32
|
+
height={300}
|
|
33
|
+
width={300}
|
|
34
|
+
alt="product"
|
|
35
|
+
className="product-img"
|
|
36
|
+
src={item.PrimaryImageUrl ?? ""}
|
|
37
|
+
/>
|
|
38
|
+
</Box>
|
|
39
|
+
<Box flex="1" ml={2} whiteSpace="normal">
|
|
40
|
+
<H4>{item.Name}</H4>
|
|
41
|
+
<Span>{currency(item.Price)}</Span>
|
|
42
|
+
</Box>
|
|
43
|
+
</Box>
|
|
44
|
+
</NavLink>
|
|
45
|
+
</MenuItem>
|
|
46
|
+
</Grid>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
|
|
6
|
+
import React, { Suspense, useContext } from "react";
|
|
7
|
+
import { SearchContext } from "./context";
|
|
8
|
+
import { CircularProgress } from "@mui/material";
|
|
9
|
+
import SearchResult from "./results";
|
|
10
|
+
import { SearchResultCard } from "../styles/index";
|
|
11
|
+
import ResultItemCardLg from "@evenicanpm/storefront-core/src/components-v2/search-bar/compound/results-item-lg";
|
|
12
|
+
import ResultItemCardSm from "./results-item-sm";
|
|
13
|
+
|
|
14
|
+
import _ from "lodash";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* useSuspenseQuery will instantly suspend component fallback to
|
|
18
|
+
* suspense boundary above.
|
|
19
|
+
* Therefore, we cannot handle the suspense fallback state
|
|
20
|
+
* inside SearchResult, we have to use this wrapper.
|
|
21
|
+
*
|
|
22
|
+
* @category Sub-Component
|
|
23
|
+
*/
|
|
24
|
+
export default function SearchResultSuspense({
|
|
25
|
+
children,
|
|
26
|
+
}: {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}) {
|
|
29
|
+
const { state } = useContext(SearchContext);
|
|
30
|
+
return (
|
|
31
|
+
<Suspense
|
|
32
|
+
fallback={
|
|
33
|
+
<SearchResultCard sx={{ display: "flex", justifyContent: "center" }}>
|
|
34
|
+
<CircularProgress
|
|
35
|
+
size={15}
|
|
36
|
+
sx={{ marginTop: "1rem", marginBottom: "1rem" }}
|
|
37
|
+
/>
|
|
38
|
+
</SearchResultCard>
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
{state.searchText && state.resultsOpen && (
|
|
42
|
+
<SearchResult>{children}</SearchResult>
|
|
43
|
+
)}
|
|
44
|
+
</Suspense>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
SearchResultSuspense.ItemCardLg = ResultItemCardLg;
|
|
49
|
+
SearchResultSuspense.ItemCardSm = ResultItemCardSm;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import { useTranslations } from "next-intl";
|
|
6
|
+
import searchProducts from "@/services/product/queries/search-products";
|
|
7
|
+
import { SearchResultCard } from "../styles/index";
|
|
8
|
+
import { SearchContext, SearchResultItemContext } from "./context";
|
|
9
|
+
import Grid from "@mui/material/Grid";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Search Results Container that handles mapping items and styles of the containing box.
|
|
13
|
+
* @category Sub-Component
|
|
14
|
+
*/
|
|
15
|
+
export default function SearchResultsContainer({
|
|
16
|
+
children,
|
|
17
|
+
}: {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}) {
|
|
20
|
+
const t = useTranslations();
|
|
21
|
+
const { state } = useContext(SearchContext);
|
|
22
|
+
const { data: results } = searchProducts.useSuspenseData({
|
|
23
|
+
searchText: state.searchText,
|
|
24
|
+
category: state.searchCategory,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (results.length === 0) {
|
|
28
|
+
return <SearchResultCard>{t("Search.noResults")}</SearchResultCard>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<SearchResultCard>
|
|
33
|
+
<Grid container>
|
|
34
|
+
{results.map((item, i) => (
|
|
35
|
+
<SearchResultItemContext.Provider value={item} key={i}>
|
|
36
|
+
{children}
|
|
37
|
+
</SearchResultItemContext.Provider>
|
|
38
|
+
))}
|
|
39
|
+
</Grid>
|
|
40
|
+
</SearchResultCard>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
"use client";
|
|
5
|
+
import React, { useRef } from "react";
|
|
6
|
+
import Box from "@mui/material/Box";
|
|
7
|
+
|
|
8
|
+
// local hooks
|
|
9
|
+
import useSearch from "../hooks/use-search";
|
|
10
|
+
import { useClickOutside } from "../hooks/use-click-outside";
|
|
11
|
+
|
|
12
|
+
// contexts
|
|
13
|
+
import { SearchContext } from "./context";
|
|
14
|
+
|
|
15
|
+
// components
|
|
16
|
+
import SearchResultSuspense from "./results-suspense";
|
|
17
|
+
import TextField from "./textfield";
|
|
18
|
+
|
|
19
|
+
import _ from "lodash";
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
handleCloseDrawer?: () => void;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Search input with a category filter.
|
|
28
|
+
* @category Compound Component
|
|
29
|
+
* @example
|
|
30
|
+
* <SearchBar handleCloseDrawer={handleCloseDrawer}>
|
|
31
|
+
* <SearchBar.TextField />
|
|
32
|
+
* <SearchBar.Results>
|
|
33
|
+
* <SearchBar.Results.ItemCardLg />
|
|
34
|
+
* </SearchBar.Results>
|
|
35
|
+
* </SearchBar>
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export default function SearchBarRoot({ handleCloseDrawer, children }: Props) {
|
|
39
|
+
const { setters, handlers, state } = useSearch();
|
|
40
|
+
const inputRef = useRef(null);
|
|
41
|
+
useClickOutside(inputRef, () => setters.setResultsOpen(false));
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<SearchContext.Provider
|
|
45
|
+
value={{ setters, handlers, state, handleCloseDrawer }}
|
|
46
|
+
>
|
|
47
|
+
<Box
|
|
48
|
+
position="relative"
|
|
49
|
+
flex="1 1 0"
|
|
50
|
+
maxWidth="670px"
|
|
51
|
+
mx="auto"
|
|
52
|
+
onClick={() => {
|
|
53
|
+
setters.setResultsOpen(true);
|
|
54
|
+
}}
|
|
55
|
+
ref={inputRef}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</Box>
|
|
59
|
+
</SearchContext.Provider>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
SearchBarRoot.TextField = TextField;
|
|
64
|
+
SearchBarRoot.Results = SearchResultSuspense;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchBar
|
|
3
|
+
*/
|
|
4
|
+
import Button from "@mui/material/Button";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @category Sub-Component
|
|
8
|
+
*/
|
|
9
|
+
const AdornmentButton = ({ label }: { label: string }) => {
|
|
10
|
+
return (
|
|
11
|
+
<Button
|
|
12
|
+
color="primary"
|
|
13
|
+
disableElevation
|
|
14
|
+
variant="contained"
|
|
15
|
+
type="submit"
|
|
16
|
+
sx={{ px: "3rem", height: "100%", borderRadius: "0 4px 4px 0" }}
|
|
17
|
+
>
|
|
18
|
+
{label}
|
|
19
|
+
</Button>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export default AdornmentButton;
|