@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
|
@@ -16,11 +16,13 @@ import {
|
|
|
16
16
|
import Grid from "@mui/material/Grid";
|
|
17
17
|
import Box from "@mui/material/Box";
|
|
18
18
|
import ProductRating from "./product-rating";
|
|
19
|
-
import useCart, {
|
|
19
|
+
import useCart, {
|
|
20
|
+
AddToCartBopisInput,
|
|
21
|
+
} from "@evenicanpm/storefront-core/src/hooks/use-cart";
|
|
20
22
|
import useCurrencyFormatter from "@/lib/currency-formatter";
|
|
21
23
|
import ProductDimensions from "@/components/_components/product-dimensions/product-dimensions";
|
|
22
24
|
import QuantityButtons from "@/components/_components/product-quantity-buttons/product-quantity-buttons";
|
|
23
|
-
import useVariants from "
|
|
25
|
+
import useVariants from "@evenicanpm/storefront-core/src/hooks/use-variants";
|
|
24
26
|
import {
|
|
25
27
|
InventorySearchCriteriaInput,
|
|
26
28
|
ProductDetails,
|
|
@@ -47,11 +49,12 @@ export default function QuickViewContent({
|
|
|
47
49
|
}: Props) {
|
|
48
50
|
const [showDimensionError, setShowDimensionError] = useState(false);
|
|
49
51
|
const {
|
|
50
|
-
|
|
52
|
+
selectedVariant,
|
|
51
53
|
selectDimensions,
|
|
52
54
|
handleChangeVariant,
|
|
53
55
|
allDimensionsSelected,
|
|
54
|
-
} = useVariants(
|
|
56
|
+
} = useVariants(productDetails);
|
|
57
|
+
|
|
55
58
|
const t = useTranslations("ProductList.QuickView");
|
|
56
59
|
const { formatCurrency } = useCurrencyFormatter();
|
|
57
60
|
const { handleCartAmountChange, handleAddToCart, loading } = useCart(
|
|
@@ -59,35 +62,43 @@ export default function QuickViewContent({
|
|
|
59
62
|
? {
|
|
60
63
|
cart,
|
|
61
64
|
recordId: product.RecordId,
|
|
62
|
-
selectVariantId:
|
|
65
|
+
selectVariantId: selectedVariant?.RecordId,
|
|
63
66
|
}
|
|
64
67
|
: {
|
|
65
68
|
cart: { Id: "", CartLines: [] },
|
|
66
69
|
recordId: product.RecordId,
|
|
67
|
-
selectVariantId:
|
|
70
|
+
selectVariantId: selectedVariant?.RecordId,
|
|
68
71
|
},
|
|
69
72
|
);
|
|
70
73
|
|
|
71
74
|
const searchCriteria = useMemo<InventorySearchCriteriaInput>(
|
|
72
75
|
() => ({
|
|
73
|
-
allDimensionsSelected: allDimensionsSelected
|
|
76
|
+
allDimensionsSelected: allDimensionsSelected,
|
|
74
77
|
searchCriteria: {
|
|
75
78
|
defaultWarehouseOnly: true,
|
|
76
|
-
productIds: [
|
|
79
|
+
productIds: [selectedVariant?.RecordId || product.RecordId],
|
|
77
80
|
},
|
|
78
81
|
}),
|
|
79
|
-
[
|
|
82
|
+
[
|
|
83
|
+
allDimensionsSelected,
|
|
84
|
+
selectDimensions,
|
|
85
|
+
product,
|
|
86
|
+
selectedVariant?.RecordId,
|
|
87
|
+
],
|
|
80
88
|
);
|
|
81
89
|
|
|
82
90
|
const { data: shippingInventoryData, isLoading: inventoryLoading } =
|
|
83
91
|
getProductAvailability.useData(searchCriteria);
|
|
84
92
|
|
|
85
93
|
const currentCartLine = cart?.CartLines?.find((item) => {
|
|
86
|
-
return
|
|
94
|
+
return (
|
|
95
|
+
item?.ProductId ===
|
|
96
|
+
(Number(selectedVariant?.RecordId) || product.RecordId)
|
|
97
|
+
);
|
|
87
98
|
});
|
|
88
99
|
|
|
89
100
|
const onAddToCart = (bopisInput?: AddToCartBopisInput) => {
|
|
90
|
-
if (!allDimensionsSelected
|
|
101
|
+
if (!allDimensionsSelected) {
|
|
91
102
|
setShowDimensionError(true);
|
|
92
103
|
return;
|
|
93
104
|
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Button,
|
|
5
|
+
FormControl,
|
|
6
|
+
InputLabel,
|
|
7
|
+
TextField,
|
|
8
|
+
MenuItem,
|
|
9
|
+
Select,
|
|
10
|
+
OutlinedInput,
|
|
11
|
+
} from "@mui/material";
|
|
12
|
+
import Grid from "@mui/material/Grid2";
|
|
13
|
+
import { useLocale, useTranslations } from "next-intl";
|
|
14
|
+
import { useNotification } from "@evenicanpm/storefront-core/src/providers/notifications/use-notification";
|
|
15
|
+
import { useRouter } from "next/navigation";
|
|
16
|
+
// Forms
|
|
17
|
+
import { useFormik } from "formik";
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
import { withZodSchema } from "formik-validator-zod";
|
|
20
|
+
// API and Interfaces
|
|
21
|
+
import { Address } from "@/api-manager/schemas/address.schema";
|
|
22
|
+
import { CountryRegionInfo } from "@msdyn365-commerce/retail-proxy";
|
|
23
|
+
import getCountries from "@/api-manager/services/address/queries/get-countries";
|
|
24
|
+
import getStates from "@/api-manager/services/address/queries/get-states";
|
|
25
|
+
import useCreateAddress from "@/api-manager/services/address/mutations/create-address";
|
|
26
|
+
import useUpdateAddress from "@/api-manager/services/address/mutations/update-address";
|
|
27
|
+
|
|
28
|
+
// =============================================================
|
|
29
|
+
type Props = { address: Address };
|
|
30
|
+
// =============================================================
|
|
31
|
+
export default function AddressForm({ address }: Props) {
|
|
32
|
+
const [tn, t] = ["Account.Addresses", "Address"].map(useTranslations);
|
|
33
|
+
const { setNotification } = useNotification();
|
|
34
|
+
const router = useRouter();
|
|
35
|
+
const locale = useLocale();
|
|
36
|
+
|
|
37
|
+
const { data: countries } = getCountries.useData({ locale });
|
|
38
|
+
const defaultCountry = countries?.find(
|
|
39
|
+
(c) => c.CountryRegionId === address?.ThreeLetterISORegionName,
|
|
40
|
+
);
|
|
41
|
+
const [selectedCountry, setSelectedCountry] =
|
|
42
|
+
React.useState<CountryRegionInfo | null>(defaultCountry ?? null);
|
|
43
|
+
const { data: states } = getStates.useData({
|
|
44
|
+
countryId: selectedCountry?.CountryRegionId,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const { mutateAsync: createAddress } = useCreateAddress();
|
|
48
|
+
const { mutateAsync: updateAddress } = useUpdateAddress();
|
|
49
|
+
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (!selectedCountry && defaultCountry) {
|
|
52
|
+
setSelectedCountry(defaultCountry);
|
|
53
|
+
}
|
|
54
|
+
}, [defaultCountry, selectedCountry]);
|
|
55
|
+
|
|
56
|
+
const FormSchema = z.object({
|
|
57
|
+
Name: z.string().nonempty(t("Validation.required", { field: t("name") })),
|
|
58
|
+
Street: z
|
|
59
|
+
.string()
|
|
60
|
+
.nonempty(t("Validation.required", { field: t("street") })),
|
|
61
|
+
City: z.string().nonempty(t("Validation.required", { field: t("city") })),
|
|
62
|
+
State: z.string().nonempty(t("Validation.required", { field: t("state") })),
|
|
63
|
+
ZipCode: z
|
|
64
|
+
.string()
|
|
65
|
+
.nonempty(t("Validation.required", { field: t("zipCode") })),
|
|
66
|
+
Country: z
|
|
67
|
+
.string()
|
|
68
|
+
.nonempty(t("Validation.required", { field: t("country") })),
|
|
69
|
+
Phone: z.string().optional().default(""),
|
|
70
|
+
});
|
|
71
|
+
type FormSchemaType = z.infer<typeof FormSchema>;
|
|
72
|
+
|
|
73
|
+
const handleSubmit = async (values: FormSchemaType) => {
|
|
74
|
+
let newAddress: Address = {
|
|
75
|
+
Name: values.Name,
|
|
76
|
+
Street: values.Street,
|
|
77
|
+
City: values.City,
|
|
78
|
+
State: values.State,
|
|
79
|
+
ZipCode: values.ZipCode,
|
|
80
|
+
TwoLetterISORegionName: selectedCountry?.ISOCode,
|
|
81
|
+
ThreeLetterISORegionName: selectedCountry?.CountryRegionId,
|
|
82
|
+
Phone: values.Phone || undefined,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
if (address?.Id && address?.Id !== "new") {
|
|
87
|
+
newAddress = { ...newAddress, Id: address?.Id };
|
|
88
|
+
await updateAddress(newAddress);
|
|
89
|
+
} else {
|
|
90
|
+
await createAddress(newAddress);
|
|
91
|
+
}
|
|
92
|
+
setNotification({
|
|
93
|
+
message: tn("addressSuccess"),
|
|
94
|
+
severity: "success",
|
|
95
|
+
});
|
|
96
|
+
router.push("/account/addresses");
|
|
97
|
+
} catch (error) {
|
|
98
|
+
setNotification({
|
|
99
|
+
message: tn("addressFailed"),
|
|
100
|
+
severity: "error",
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const setValues = (address: Address) => {
|
|
106
|
+
return {
|
|
107
|
+
Name: address?.Name || "",
|
|
108
|
+
Street: address?.Street || "",
|
|
109
|
+
City: address?.City || "",
|
|
110
|
+
State: address?.State || "",
|
|
111
|
+
ZipCode: address?.ZipCode || "",
|
|
112
|
+
Country: address?.ThreeLetterISORegionName || "",
|
|
113
|
+
Phone: address?.Phone || "",
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const intialValues = setValues(address);
|
|
118
|
+
|
|
119
|
+
const formik = useFormik<FormSchemaType>({
|
|
120
|
+
initialValues: intialValues,
|
|
121
|
+
onSubmit: handleSubmit,
|
|
122
|
+
validate: withZodSchema(FormSchema),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<form onSubmit={formik.handleSubmit}>
|
|
127
|
+
<Grid container spacing={3}>
|
|
128
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
129
|
+
<TextField
|
|
130
|
+
name="Name"
|
|
131
|
+
fullWidth
|
|
132
|
+
autoComplete="off"
|
|
133
|
+
label={t("name")}
|
|
134
|
+
value={formik.values.Name}
|
|
135
|
+
onChange={formik.handleChange}
|
|
136
|
+
onBlur={formik.handleBlur}
|
|
137
|
+
error={formik.touched.Name && Boolean(formik.errors.Name)}
|
|
138
|
+
helperText={formik.touched.Name && formik.errors.Name}
|
|
139
|
+
required
|
|
140
|
+
/>
|
|
141
|
+
</Grid>
|
|
142
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
143
|
+
<TextField
|
|
144
|
+
name="Street"
|
|
145
|
+
fullWidth
|
|
146
|
+
autoComplete="off"
|
|
147
|
+
label={t("street")}
|
|
148
|
+
value={formik.values.Street}
|
|
149
|
+
onChange={formik.handleChange}
|
|
150
|
+
onBlur={formik.handleBlur}
|
|
151
|
+
error={formik.touched.Street && Boolean(formik.errors.Street)}
|
|
152
|
+
helperText={formik.touched.Street && formik.errors.Street}
|
|
153
|
+
required
|
|
154
|
+
/>
|
|
155
|
+
</Grid>
|
|
156
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
157
|
+
<TextField
|
|
158
|
+
name="City"
|
|
159
|
+
fullWidth
|
|
160
|
+
autoComplete="off"
|
|
161
|
+
label={t("city")}
|
|
162
|
+
value={formik.values.City}
|
|
163
|
+
onChange={formik.handleChange}
|
|
164
|
+
onBlur={formik.handleBlur}
|
|
165
|
+
error={formik.touched.City && Boolean(formik.errors.City)}
|
|
166
|
+
helperText={formik.touched.City && formik.errors.City}
|
|
167
|
+
required
|
|
168
|
+
/>
|
|
169
|
+
</Grid>
|
|
170
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
171
|
+
<FormControl
|
|
172
|
+
fullWidth
|
|
173
|
+
size="small"
|
|
174
|
+
error={formik.touched.Country && Boolean(formik.errors.Country)}
|
|
175
|
+
>
|
|
176
|
+
<InputLabel required id="Country">
|
|
177
|
+
{t("country")}
|
|
178
|
+
</InputLabel>
|
|
179
|
+
<Select
|
|
180
|
+
labelId="Country"
|
|
181
|
+
name="Country"
|
|
182
|
+
input={<OutlinedInput label={t("country")} />}
|
|
183
|
+
value={formik.values.Country}
|
|
184
|
+
onChange={(event) => {
|
|
185
|
+
const countryId = event.target.value;
|
|
186
|
+
|
|
187
|
+
// Update selected country
|
|
188
|
+
const selected =
|
|
189
|
+
countries?.find((c) => c.CountryRegionId === countryId) ||
|
|
190
|
+
null;
|
|
191
|
+
setSelectedCountry(selected);
|
|
192
|
+
|
|
193
|
+
formik.setFieldValue("Country", countryId);
|
|
194
|
+
// Reset state field when country changes
|
|
195
|
+
formik.setFieldValue("State", "");
|
|
196
|
+
}}
|
|
197
|
+
onBlur={formik.handleBlur}
|
|
198
|
+
required
|
|
199
|
+
>
|
|
200
|
+
<MenuItem value="">Select Country</MenuItem>
|
|
201
|
+
{countries?.map(({ ShortName, CountryRegionId }, index) => (
|
|
202
|
+
<MenuItem value={CountryRegionId} key={index}>
|
|
203
|
+
{ShortName}
|
|
204
|
+
</MenuItem>
|
|
205
|
+
))}
|
|
206
|
+
</Select>
|
|
207
|
+
{formik.touched.Country && formik.errors.Country && (
|
|
208
|
+
<Box
|
|
209
|
+
component="span"
|
|
210
|
+
sx={{ color: "error.main", fontSize: "0.75rem", mt: 0.5 }}
|
|
211
|
+
>
|
|
212
|
+
{formik.errors.Country}
|
|
213
|
+
</Box>
|
|
214
|
+
)}
|
|
215
|
+
</FormControl>
|
|
216
|
+
</Grid>
|
|
217
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
218
|
+
<FormControl
|
|
219
|
+
fullWidth
|
|
220
|
+
size="small"
|
|
221
|
+
error={formik.touched.State && Boolean(formik.errors.State)}
|
|
222
|
+
>
|
|
223
|
+
<InputLabel required id="State">
|
|
224
|
+
{t("state")}
|
|
225
|
+
</InputLabel>
|
|
226
|
+
<Select
|
|
227
|
+
labelId="State"
|
|
228
|
+
name="State"
|
|
229
|
+
input={<OutlinedInput label={t("state")} />}
|
|
230
|
+
value={formik.values.State}
|
|
231
|
+
onChange={formik.handleChange}
|
|
232
|
+
onBlur={formik.handleBlur}
|
|
233
|
+
required
|
|
234
|
+
>
|
|
235
|
+
<MenuItem value="">Select a state</MenuItem>
|
|
236
|
+
{states?.map(({ StateName, StateId }, index) => (
|
|
237
|
+
<MenuItem value={StateId} key={index}>
|
|
238
|
+
{StateName}
|
|
239
|
+
</MenuItem>
|
|
240
|
+
))}
|
|
241
|
+
</Select>
|
|
242
|
+
{formik.touched.State && formik.errors.State && (
|
|
243
|
+
<Box
|
|
244
|
+
component="span"
|
|
245
|
+
sx={{ color: "error.main", fontSize: "0.75rem", mt: 0.5 }}
|
|
246
|
+
>
|
|
247
|
+
{formik.errors.State}
|
|
248
|
+
</Box>
|
|
249
|
+
)}
|
|
250
|
+
</FormControl>
|
|
251
|
+
</Grid>
|
|
252
|
+
|
|
253
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
254
|
+
<TextField
|
|
255
|
+
name="ZipCode"
|
|
256
|
+
fullWidth
|
|
257
|
+
autoComplete="off"
|
|
258
|
+
label={t("zipCode")}
|
|
259
|
+
value={formik.values.ZipCode}
|
|
260
|
+
onChange={formik.handleChange}
|
|
261
|
+
onBlur={formik.handleBlur}
|
|
262
|
+
error={formik.touched.ZipCode && Boolean(formik.errors.ZipCode)}
|
|
263
|
+
helperText={formik.touched.ZipCode && formik.errors.ZipCode}
|
|
264
|
+
required
|
|
265
|
+
/>
|
|
266
|
+
</Grid>
|
|
267
|
+
<Grid size={{ sm: 6, xs: 12 }}>
|
|
268
|
+
<TextField
|
|
269
|
+
name="Phone"
|
|
270
|
+
fullWidth
|
|
271
|
+
autoComplete="off"
|
|
272
|
+
label={t("phone")}
|
|
273
|
+
value={formik.values.Phone}
|
|
274
|
+
onChange={formik.handleChange}
|
|
275
|
+
onBlur={formik.handleBlur}
|
|
276
|
+
error={formik.touched.Phone && Boolean(formik.errors.Phone)}
|
|
277
|
+
helperText={formik.touched.Phone && formik.errors.Phone}
|
|
278
|
+
required
|
|
279
|
+
/>
|
|
280
|
+
</Grid>
|
|
281
|
+
</Grid>
|
|
282
|
+
<Grid size={{ sm: 6, xs: 12 }} sx={{ mt: 3 }}>
|
|
283
|
+
<Button type="submit" variant="contained" color="primary">
|
|
284
|
+
{t("save")}
|
|
285
|
+
</Button>
|
|
286
|
+
</Grid>
|
|
287
|
+
</form>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import IconButton from "@mui/material/IconButton";
|
|
2
|
+
import { Button, Box, Chip } from "@mui/material";
|
|
3
|
+
import { useTranslations } from "next-intl";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
5
|
+
import { useNotification } from "@evenicanpm/storefront-core/src/providers/notifications/use-notification";
|
|
6
|
+
// MUI ICON COMPONENTS
|
|
7
|
+
import { MdEdit as Edit } from "react-icons/md";
|
|
8
|
+
import { MdDelete as Delete } from "react-icons/md";
|
|
9
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
10
|
+
import { Paragraph } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
11
|
+
// LOCAL CUSTOM COMPONENT
|
|
12
|
+
import TableRow from "../table-row";
|
|
13
|
+
// API
|
|
14
|
+
import useDeleteAddress from "@/api-manager/services/address/mutations/delete-address";
|
|
15
|
+
import useUpdateUser from "@/api-manager/services/user/mutations/update-user";
|
|
16
|
+
import { Address } from "@/api-manager/schemas/address.schema";
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
address: Address;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function AddressListItem({ address }: Props) {
|
|
23
|
+
const router = useRouter();
|
|
24
|
+
const t = useTranslations("Account.Addresses");
|
|
25
|
+
const { setNotification } = useNotification();
|
|
26
|
+
|
|
27
|
+
const { mutateAsync: updateUser } = useUpdateUser();
|
|
28
|
+
const { mutateAsync: deleteAddress } = useDeleteAddress();
|
|
29
|
+
|
|
30
|
+
const setPrimaryAddress = (id: string) => {
|
|
31
|
+
updateUser({ AccountNumber: "", DefaultShippingAddressId: id });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const editAddress = (id: string) => {
|
|
35
|
+
router.push(`/account/addresses/${id}`);
|
|
36
|
+
};
|
|
37
|
+
const handleDelete = async (id: string) => {
|
|
38
|
+
try {
|
|
39
|
+
await deleteAddress(id);
|
|
40
|
+
setNotification({
|
|
41
|
+
message: t("deleteAddressSuccess"),
|
|
42
|
+
severity: "success",
|
|
43
|
+
});
|
|
44
|
+
} catch (error) {
|
|
45
|
+
setNotification({
|
|
46
|
+
message: t("deleteAddressFailed"),
|
|
47
|
+
severity: "error",
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<TableRow
|
|
54
|
+
sx={{
|
|
55
|
+
display: "grid",
|
|
56
|
+
gridTemplateColumns: "1fr 2fr 1fr 1.5fr", // Define equal column structure
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
gap: 2,
|
|
59
|
+
padding: "10px 15px",
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<Paragraph ellipsis>{address?.Name}</Paragraph>
|
|
63
|
+
<Paragraph ellipsis>{address?.FullAddress}</Paragraph>
|
|
64
|
+
<Paragraph ellipsis>{address?.Phone}</Paragraph>
|
|
65
|
+
|
|
66
|
+
{/* Actions Column */}
|
|
67
|
+
<Box display="flex" alignItems="center" gap={1} justifySelf="end">
|
|
68
|
+
{address?.IsPrimary ? (
|
|
69
|
+
<Chip size="small" label={t("primaryFlag")} color="primary" />
|
|
70
|
+
) : (
|
|
71
|
+
<Button
|
|
72
|
+
color="secondary"
|
|
73
|
+
variant="outlined"
|
|
74
|
+
size="small"
|
|
75
|
+
onClick={() => {
|
|
76
|
+
const rid = address.RecordId?.toString();
|
|
77
|
+
setPrimaryAddress(address.Id ?? rid ?? "");
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
{t("btnPrimaryAddress")}
|
|
81
|
+
</Button>
|
|
82
|
+
)}
|
|
83
|
+
|
|
84
|
+
<IconButton
|
|
85
|
+
onClick={() => {
|
|
86
|
+
const rid = address.RecordId?.toString();
|
|
87
|
+
editAddress(address.Id ?? rid ?? "");
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<Edit fontSize="large" color="inherit" />
|
|
91
|
+
</IconButton>
|
|
92
|
+
|
|
93
|
+
<IconButton
|
|
94
|
+
onClick={() => {
|
|
95
|
+
const rid = address.RecordId?.toString();
|
|
96
|
+
handleDelete(address.Id ?? rid ?? "");
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<Delete fontSize="large" color="inherit" />
|
|
100
|
+
</IconButton>
|
|
101
|
+
</Box>
|
|
102
|
+
</TableRow>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { Box, Button, IconButton, Theme, styled } from "@mui/material";
|
|
4
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
5
|
+
import { useTranslations } from "next-intl";
|
|
6
|
+
// ICON COMPONENTS
|
|
7
|
+
import { MdMenu as Menu } from "react-icons/md";
|
|
8
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
9
|
+
import SideNav from "@evenicanpm/storefront-core/src/components-v2/side-nav/index";
|
|
10
|
+
import { H2 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
11
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components-v2/flex-box/flex-box";
|
|
12
|
+
// LOCAL CUSTOM COMPONENTS
|
|
13
|
+
import Navigation from "./navigation";
|
|
14
|
+
import { IconType } from "react-icons";
|
|
15
|
+
|
|
16
|
+
// STYLED COMPONENT
|
|
17
|
+
const StyledBox = styled("div")(({ theme }) => ({
|
|
18
|
+
display: "flex",
|
|
19
|
+
marginTop: theme.spacing(-2),
|
|
20
|
+
marginBottom: theme.spacing(3),
|
|
21
|
+
"& .headerHold": {
|
|
22
|
+
flexGrow: 1,
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "space-between",
|
|
25
|
+
},
|
|
26
|
+
[theme.breakpoints.up("md")]: {
|
|
27
|
+
"& .sidenav": { display: "none" },
|
|
28
|
+
},
|
|
29
|
+
[theme.breakpoints.down("md")]: {
|
|
30
|
+
flexDirection: "column",
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
// ==============================================================
|
|
35
|
+
|
|
36
|
+
type WithButtons = {
|
|
37
|
+
title: string;
|
|
38
|
+
titleMessage?: string;
|
|
39
|
+
buttons: ReactNode;
|
|
40
|
+
Icon: IconType;
|
|
41
|
+
href?: never;
|
|
42
|
+
buttonText?: never;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type WithGeneratedButton = {
|
|
46
|
+
title: string;
|
|
47
|
+
titleMessage?: string;
|
|
48
|
+
href?: string;
|
|
49
|
+
buttonText?: string;
|
|
50
|
+
Icon: IconType;
|
|
51
|
+
buttons?: ReactNode;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type Props = WithButtons | WithGeneratedButton;
|
|
55
|
+
|
|
56
|
+
// ==============================================================
|
|
57
|
+
|
|
58
|
+
export default function DashboardHeader({
|
|
59
|
+
title,
|
|
60
|
+
titleMessage,
|
|
61
|
+
buttons,
|
|
62
|
+
href,
|
|
63
|
+
buttonText,
|
|
64
|
+
Icon,
|
|
65
|
+
}: Props) {
|
|
66
|
+
const t = useTranslations();
|
|
67
|
+
const isTablet = useMediaQuery((theme: Theme) =>
|
|
68
|
+
theme.breakpoints.down(1025),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const GENERATED_BUTTON = href ? (
|
|
72
|
+
<Button
|
|
73
|
+
href={href}
|
|
74
|
+
color="primary"
|
|
75
|
+
LinkComponent={Link}
|
|
76
|
+
sx={{ bgcolor: "primary.light", px: 4 }}
|
|
77
|
+
>
|
|
78
|
+
{t(buttonText)}
|
|
79
|
+
</Button>
|
|
80
|
+
) : null;
|
|
81
|
+
|
|
82
|
+
const HEADER_LINKS = (
|
|
83
|
+
<FlexBox gap={1} justifyContent="flex-end">
|
|
84
|
+
{buttons || GENERATED_BUTTON}
|
|
85
|
+
</FlexBox>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<StyledBox>
|
|
90
|
+
<FlexBox mt={2} className="headerHold">
|
|
91
|
+
<FlexBox alignItems="center" gap={0.5}>
|
|
92
|
+
{Icon && (
|
|
93
|
+
<IconButton color="primary">
|
|
94
|
+
<Icon />
|
|
95
|
+
</IconButton>
|
|
96
|
+
)}
|
|
97
|
+
<H2 my={0} lineHeight={1} ellipsis>
|
|
98
|
+
{titleMessage ? titleMessage : t(title)}
|
|
99
|
+
</H2>
|
|
100
|
+
</FlexBox>
|
|
101
|
+
|
|
102
|
+
<FlexBox className="button-container" justifyContent="flex-end">
|
|
103
|
+
{!isTablet && HEADER_LINKS}
|
|
104
|
+
</FlexBox>
|
|
105
|
+
|
|
106
|
+
<div className="sidenav">
|
|
107
|
+
<SideNav
|
|
108
|
+
position="left"
|
|
109
|
+
handler={(close) => (
|
|
110
|
+
<IconButton onClick={close}>
|
|
111
|
+
<Menu fontSize="small" />
|
|
112
|
+
</IconButton>
|
|
113
|
+
)}
|
|
114
|
+
>
|
|
115
|
+
<Navigation />
|
|
116
|
+
</SideNav>
|
|
117
|
+
</div>
|
|
118
|
+
</FlexBox>
|
|
119
|
+
|
|
120
|
+
{isTablet ? <Box mt={2}>{HEADER_LINKS}</Box> : null}
|
|
121
|
+
</StyledBox>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
4
|
+
import { Fragment } from "react";
|
|
5
|
+
import { useTranslations } from "next-intl";
|
|
6
|
+
|
|
7
|
+
// ICON COMPONENTS
|
|
8
|
+
import {
|
|
9
|
+
MdOutlineShoppingBag as ShoppingBagOutlined,
|
|
10
|
+
MdFavoriteBorder as FavoriteBorder,
|
|
11
|
+
MdPerson as Person,
|
|
12
|
+
MdPlace as Place,
|
|
13
|
+
} from "react-icons/md";
|
|
14
|
+
|
|
15
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
16
|
+
import FlexBox from "@evenicanpm/storefront-core/src/components-v2/flex-box/flex-box";
|
|
17
|
+
import {
|
|
18
|
+
Paragraph,
|
|
19
|
+
Span,
|
|
20
|
+
} from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
21
|
+
|
|
22
|
+
// API
|
|
23
|
+
import getUser from "@/api-manager/services/user/queries/get-user";
|
|
24
|
+
import getUserCounts from "@/api-manager/services/user/queries/get-user-counts";
|
|
25
|
+
|
|
26
|
+
// STYLED COMPONENTS
|
|
27
|
+
import { MainContainer, StyledNavLink } from "./styles";
|
|
28
|
+
|
|
29
|
+
const MENU_ITEMS = [
|
|
30
|
+
{
|
|
31
|
+
title: "DASHBOARD",
|
|
32
|
+
list: [
|
|
33
|
+
{
|
|
34
|
+
href: "/account/orders",
|
|
35
|
+
title: "orders",
|
|
36
|
+
Icon: ShoppingBagOutlined,
|
|
37
|
+
count: 0,
|
|
38
|
+
},
|
|
39
|
+
{ href: "/account/wish-lists", title: "wishlists", Icon: FavoriteBorder },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: "ACCOUNT SETTINGS",
|
|
44
|
+
list: [
|
|
45
|
+
{ href: "/account/profile", title: "profile", Icon: Person },
|
|
46
|
+
{ href: "/account/addresses", title: "addresses", Icon: Place, count: 0 },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export default function Navigation() {
|
|
52
|
+
const pathname = usePathname();
|
|
53
|
+
const t = useTranslations("Account.Menu");
|
|
54
|
+
|
|
55
|
+
const { data: user } = getUser.useData();
|
|
56
|
+
const { data: counts } = getUserCounts.useData(String(user?.RecordId) || "");
|
|
57
|
+
|
|
58
|
+
MENU_ITEMS[0].list[0].count = counts?.orderCount;
|
|
59
|
+
MENU_ITEMS[1].list[1].count = counts?.addressCount;
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<MainContainer>
|
|
63
|
+
{MENU_ITEMS.map((item) => (
|
|
64
|
+
<Fragment key={item.title}>
|
|
65
|
+
<Paragraph p="26px 30px 1rem" color="grey.600" fontSize={12}>
|
|
66
|
+
{item.title}
|
|
67
|
+
</Paragraph>
|
|
68
|
+
|
|
69
|
+
{item.list.map(({ Icon, count, href, title }) => (
|
|
70
|
+
<StyledNavLink
|
|
71
|
+
href={href}
|
|
72
|
+
key={title}
|
|
73
|
+
isCurrentPath={pathname.includes(href)}
|
|
74
|
+
>
|
|
75
|
+
<FlexBox alignItems="center" gap={1}>
|
|
76
|
+
<Icon color="inherit" fontSize="large" className="nav-icon" />
|
|
77
|
+
<Span>{t(title)}</Span>
|
|
78
|
+
</FlexBox>
|
|
79
|
+
|
|
80
|
+
<Span>{count}</Span>
|
|
81
|
+
</StyledNavLink>
|
|
82
|
+
))}
|
|
83
|
+
</Fragment>
|
|
84
|
+
))}
|
|
85
|
+
</MainContainer>
|
|
86
|
+
);
|
|
87
|
+
}
|