@evenicanpm/storefront-core 1.0.4 → 1.0.6
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/package.json +8 -10
- package/src/api-manager/datasources/d365/d365-address.datasource.ts +2 -2
- package/src/api-manager/datasources/d365/d365-cart.datasource.ts +3 -3
- package/src/api-manager/datasources/d365/d365-categories.datasource.ts +2 -2
- package/src/api-manager/datasources/d365/d365-order.datasource.ts +3 -3
- package/src/api-manager/datasources/d365/d365-organization.datasource.ts +2 -2
- package/src/api-manager/datasources/d365/d365-product.datasource.ts +5 -5
- package/src/api-manager/datasources/d365/d365-session.datasource.ts +2 -2
- package/src/api-manager/datasources/d365/d365-user.datasource.ts +2 -2
- package/src/api-manager/datasources/d365/d365.datasource.ts +8 -8
- package/src/api-manager/datasources/d365/index.ts +2 -2
- package/src/api-manager/datasources/e4/address/e4-address.datasource.ts +4 -4
- package/src/api-manager/datasources/e4/address/e4-address.remaps.ts +1 -1
- package/src/api-manager/datasources/e4/address/e4-address.translator.ts +7 -3
- package/src/api-manager/datasources/e4/cart/e4-cart.datasource.ts +7 -7
- package/src/api-manager/datasources/e4/cart/e4-cart.remaps.ts +7 -3
- package/src/api-manager/datasources/e4/cart/e4-cart.translator.ts +2 -2
- package/src/api-manager/datasources/e4/categories/e4-categories.datasource.ts +2 -2
- package/src/api-manager/datasources/e4/categories/e4-categories.translator.ts +1 -1
- package/src/api-manager/datasources/e4/e4.datasource.ts +9 -9
- package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +2175 -138
- package/src/api-manager/datasources/e4/order/e4-order.datasource.ts +6 -3
- package/src/api-manager/datasources/e4/order/e4-order.remaps.ts +2 -2
- package/src/api-manager/datasources/e4/organization/e4-organization.datasource.ts +1 -1
- package/src/api-manager/datasources/e4/product/e4-product.datasource.ts +4 -4
- package/src/api-manager/datasources/e4/product/e4-product.remaps.ts +2 -2
- package/src/api-manager/datasources/e4/product/e4-product.translator.ts +3 -3
- package/src/api-manager/datasources/e4/session/e4-session.datasource.ts +2 -2
- package/src/api-manager/datasources/e4/session/e4-session.translator.ts +1 -1
- package/src/api-manager/datasources/e4/user/e4-user.datasource.ts +4 -4
- package/src/api-manager/datasources/e4/user/e4-user.remaps.ts +5 -2
- package/src/api-manager/datasources/e4/user/e4-user.translator.ts +5 -2
- package/src/api-manager/datasources/e4/utils/unwrap-e4-variants.ts +6 -2
- package/src/api-manager/index.ts +4 -4
- package/src/api-manager/lib/get-graphql-client.ts +1 -1
- package/src/api-manager/schemas/address.schema.ts +1 -1
- package/src/api-manager/schemas/cart.schema.ts +1 -1
- package/src/api-manager/schemas/order.schema.ts +1 -1
- package/src/api-manager/schemas/organization.schema.ts +1 -1
- package/src/api-manager/schemas/product.schema.ts +1 -1
- package/src/api-manager/schemas/session.schema.ts +2 -2
- package/src/api-manager/schemas/user.schema.ts +1 -1
- package/src/api-manager/services/address/mutations/create-address.ts +2 -2
- package/src/api-manager/services/address/mutations/delete-address.ts +2 -2
- package/src/api-manager/services/address/mutations/get-delivery-options.ts +2 -2
- package/src/api-manager/services/address/mutations/update-address.ts +2 -2
- package/src/api-manager/services/address/queries/get-countries.ts +2 -2
- package/src/api-manager/services/address/queries/get-states.ts +4 -1
- package/src/api-manager/services/cart/mutations/add-discount-code.ts +3 -3
- package/src/api-manager/services/cart/mutations/add-to-cart.ts +3 -3
- package/src/api-manager/services/cart/mutations/checkout.ts +2 -2
- package/src/api-manager/services/cart/mutations/delete-cart-line.ts +3 -3
- package/src/api-manager/services/cart/mutations/get-payment-accept-result.ts +2 -2
- package/src/api-manager/services/cart/mutations/remove-cart-line-delivery-mode.ts +3 -3
- package/src/api-manager/services/cart/mutations/remove-discount-code.ts +3 -3
- package/src/api-manager/services/cart/mutations/update-cart-line-delivery-mode.ts +3 -3
- package/src/api-manager/services/cart/mutations/update-cart-lines.ts +3 -3
- package/src/api-manager/services/cart/mutations/update-cart.ts +3 -3
- package/src/api-manager/services/cart/queries/get-cart-lines-inventory.ts +4 -1
- package/src/api-manager/services/cart/queries/get-cart.ts +2 -2
- package/src/api-manager/services/cart/queries/get-payment-accept-point.ts +4 -1
- package/src/api-manager/services/categories/queries/get-categories.ts +5 -2
- package/src/api-manager/services/create-mutation.ts +2 -2
- package/src/api-manager/services/create-query.ts +2 -2
- package/src/api-manager/services/order/queries/get-order-details.ts +4 -1
- package/src/api-manager/services/order/queries/get-orders.ts +4 -1
- package/src/api-manager/services/organization/queries/get-channel-configuration.ts +4 -1
- package/src/api-manager/services/organization/queries/get-stores.ts +4 -1
- package/src/api-manager/services/product/mutations/search-products.ts +1 -1
- package/src/api-manager/services/product/queries/get-product-availability.ts +4 -1
- package/src/api-manager/services/product/queries/get-product-by-id.ts +5 -2
- package/src/api-manager/services/product/queries/get-product-by-ids.ts +5 -2
- package/src/api-manager/services/product/queries/get-product-list.ts +4 -1
- package/src/api-manager/services/product/queries/get-product-prices.ts +4 -1
- package/src/api-manager/services/product/queries/get-related-products.ts +5 -2
- package/src/api-manager/services/product/queries/search-products.ts +4 -1
- package/src/api-manager/services/product/server/product.server.ts +2 -2
- package/src/api-manager/services/session/mutations/session-init.ts +2 -2
- package/src/api-manager/services/session/mutations/session-logout.ts +2 -2
- package/src/api-manager/services/session/queries/get-session.ts +4 -1
- package/src/api-manager/services/user/mutations/add-to-wishlist.ts +5 -3
- package/src/api-manager/services/user/mutations/copy-cart-to-wishlist.ts +2 -2
- package/src/api-manager/services/user/mutations/create-wishlist.ts +2 -2
- package/src/api-manager/services/user/mutations/delete-wishlist.ts +3 -3
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +6 -4
- package/src/api-manager/services/user/mutations/update-user.ts +2 -2
- package/src/api-manager/services/user/mutations/update-wishlist.ts +2 -2
- package/src/api-manager/services/user/queries/get-user-counts.ts +4 -1
- package/src/api-manager/services/user/queries/get-user.ts +4 -1
- package/src/api-manager/services/user/queries/get-wishlist-details.ts +4 -1
- package/src/api-manager/services/user/queries/get-wishlists.ts +4 -1
- package/src/api-manager/types/Datasource.ts +2 -2
- package/src/auth/auth-options.test.ts +1 -1
- package/src/auth/auth-options.ts +1 -1
- package/src/auth/providers/index.ts +3 -3
- package/src/auth/refresh-token.ts +2 -2
- package/src/cms/blocks/{BlockManager.tsx → block-manager.tsx} +2 -2
- package/src/cms/blocks/{Components/BrandLogosScroller.tsx → components/brand-logos-scroller.tsx} +1 -1
- package/src/cms/blocks/{Components/CategoryCarousel → components/category-carousel}/index.tsx +3 -3
- package/src/cms/blocks/{Components/FeaturePill.tsx → components/feature-pill.tsx} +1 -1
- package/src/cms/blocks/{Components/FeaturedCategories.tsx → components/featured-categories.tsx} +2 -2
- package/src/cms/blocks/{Components/FeaturedProducts.tsx → components/featured-products.tsx} +2 -2
- package/src/cms/blocks/{Components/Footer → components/footer}/index.tsx +7 -4
- package/src/cms/blocks/{Components/Footer/sections/FooterContact.tsx → components/footer/sections/footer-contact.tsx} +3 -3
- package/src/cms/blocks/{Components/Footer/sections/FooterLinks.tsx → components/footer/sections/footer-links.tsx} +5 -2
- package/src/cms/blocks/{Components/Footer/sections/FooterSocialLinks.tsx → components/footer/sections/footer-social-links.tsx} +1 -1
- package/src/cms/blocks/{Components/Footer.tsx → components/footer.tsx} +1 -1
- package/src/cms/blocks/{Components/HeroCarousel → components/hero-carousel}/index.tsx +1 -1
- package/src/cms/blocks/{Components/Hero.tsx → components/hero.tsx} +1 -1
- package/src/cms/blocks/{Components/Image.tsx → components/image.tsx} +1 -1
- package/src/cms/blocks/{Components/ProductCarousel → components/product-carousel}/index.tsx +2 -2
- package/src/cms/blocks/{Components/ProductSectionFullWidth → components/product-section-fullwidth}/index.tsx +2 -2
- package/src/cms/blocks/{Components/Seo → components/seo}/index.tsx +1 -1
- package/src/cms/blocks/{Components/Services → components/services}/index.tsx +2 -2
- package/src/cms/blocks/{Components/Services → components/services}/service-card.tsx +1 -1
- package/src/cms/blocks/{Icons → icons}/index.ts +7 -7
- package/src/cms/blocks/index.tsx +15 -15
- package/src/cms/blog.ts +2 -2
- package/src/cms/endpoints.ts +1 -1
- package/src/cms/interfaces/navigation.ts +9 -9
- package/src/cms/pages.ts +1 -1
- package/src/components-v2/BazaarMenu.tsx +2 -0
- package/src/components-v2/BazaarTextField.tsx +1 -1
- package/src/components-v2/DropZone.tsx +4 -1
- package/src/components-v2/ImageWithFallback.tsx +1 -1
- package/src/components-v2/accordion/index.ts +1 -1
- package/src/components-v2/carousel/carousel.tsx +3 -3
- package/src/components-v2/carousel/components/carousel-arrows.tsx +1 -1
- package/src/components-v2/carousel/components/carousel-dots.tsx +4 -1
- package/src/components-v2/carousel/index.ts +1 -1
- package/src/components-v2/carousel-cards/carousel-card-1/carousel-card-1.tsx +1 -1
- package/src/components-v2/carousel-cards/carousel-card-1/index.ts +1 -1
- package/src/components-v2/categories/category-list/category-list.tsx +7 -4
- package/src/components-v2/categories/category-list/index.ts +1 -1
- package/src/components-v2/categories/category-list/styles.ts +1 -1
- package/src/components-v2/categories/category-list-item/category-menu-item.tsx +1 -1
- package/src/components-v2/categories/category-list-item/index.ts +1 -1
- package/src/components-v2/categories/category-menu.tsx +1 -1
- package/src/components-v2/categories/mega-menu/column-list.tsx +1 -1
- package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +2 -2
- package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +4 -4
- package/src/components-v2/flex-box/index.ts +3 -3
- package/src/components-v2/header/{components → __tests__}/user.test.tsx +51 -29
- package/src/components-v2/header/components/mobile-header.tsx +3 -3
- package/src/components-v2/header/components/user.tsx +8 -5
- package/src/components-v2/header/header.tsx +8 -5
- package/src/components-v2/header/index.ts +1 -1
- package/src/components-v2/header/sticky-header.tsx +1 -1
- package/src/components-v2/mini-cart/__tests__/cart-item.test.tsx +31 -40
- package/src/components-v2/mini-cart/__tests__/mini-cart.test.tsx +7 -8
- package/src/components-v2/mini-cart/index.ts +1 -1
- package/src/components-v2/mini-cart/mini-cart-trigger.tsx +1 -1
- package/src/components-v2/mini-cart/mini-cart.tsx +7 -7
- package/src/components-v2/mobile-navigation/index.ts +1 -1
- package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +6 -1
- package/src/components-v2/nav-link/index.ts +3 -3
- package/src/components-v2/navbar/categories.tsx +1 -1
- package/src/components-v2/navbar/category-based-menu/category-based-menu.tsx +2 -2
- package/src/components-v2/navbar/category-based-menu/index.ts +1 -1
- package/src/components-v2/navbar/index.ts +1 -1
- package/src/components-v2/navbar/mega-menu/index.ts +1 -1
- package/src/components-v2/navbar/mega-menu/mega-menu.tsx +6 -1
- package/src/components-v2/navbar/mobile-menu/index.ts +1 -1
- package/src/components-v2/navbar/mobile-menu/mobile-menu.test.tsx +7 -13
- package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +1 -1
- package/src/components-v2/navbar/nav-list/cms-nav.test.tsx +16 -10
- package/src/components-v2/navbar/nav-list/index.ts +1 -1
- package/src/components-v2/navbar/nav-list/nav-item-child.tsx +4 -1
- package/src/components-v2/navbar/nav-list/nav-list.tsx +8 -4
- package/src/components-v2/navbar/navbar.tsx +6 -3
- package/src/components-v2/navbar/utils/transform-nav.test.ts +4 -1
- package/src/components-v2/product-cards/product-card/components/hover-actions.tsx +1 -1
- package/src/components-v2/product-cards/product-card/index.ts +1 -1
- package/src/components-v2/product-cards/product-card/product-card.tsx +10 -6
- package/src/components-v2/product-cards/product-card-plp/index.ts +1 -1
- package/src/components-v2/product-cards/product-card-plp/product-card.tsx +5 -5
- package/src/components-v2/product-cards/product-card-plp-list/index.ts +1 -1
- package/src/components-v2/product-cards/product-card-plp-list/product-card.tsx +7 -8
- package/src/components-v2/product-cards/product-card-search/index.ts +1 -1
- package/src/components-v2/product-cards/product-card-search/product-card.tsx +2 -2
- package/src/components-v2/product-dialog/compound/product-dialog.tsx +61 -45
- package/src/components-v2/product-dialog/index.tsx +1 -2
- package/src/components-v2/product-dimensions/compound/dimensions-group-error.tsx +3 -3
- package/src/components-v2/product-dimensions/compound/dimensions-group-label.tsx +1 -1
- package/src/components-v2/product-dimensions/compound/dimensions-group-list-chip.tsx +1 -1
- package/src/components-v2/product-dimensions/compound/dimensions-group-list.tsx +2 -2
- package/src/components-v2/product-dimensions/compound/dimensions-group.tsx +3 -3
- package/src/components-v2/product-dimensions/compound/dimensions.tsx +1 -1
- package/src/components-v2/product-dimensions/index.tsx +1 -1
- package/src/components-v2/product-quantity-buttons/compound/quantity-buttons-root.tsx +1 -1
- package/src/components-v2/product-quantity-buttons/index.tsx +2 -2
- package/src/components-v2/products-view/compound/products-grid-view.tsx +2 -2
- package/src/components-v2/products-view/compound/products-list-view.tsx +2 -2
- package/src/components-v2/products-view/compound/types.ts +1 -1
- package/src/components-v2/products-view/index.tsx +2 -2
- package/src/components-v2/progress/index.ts +1 -1
- package/src/components-v2/scrollbar/index.ts +1 -1
- package/src/components-v2/scrollbar/scrollbar.tsx +1 -1
- package/src/components-v2/search-bar/compound/results-item-lg.tsx +4 -1
- package/src/components-v2/search-bar/compound/results-item-sm.tsx +4 -1
- package/src/components-v2/search-bar/compound/results-suspense.tsx +4 -4
- package/src/components-v2/search-bar/compound/results.tsx +5 -2
- package/src/components-v2/search-bar/compound/search-bar-root.tsx +5 -5
- package/src/components-v2/search-bar/compound/textfield-adornment-category.tsx +2 -2
- package/src/components-v2/search-bar/compound/textfield.tsx +5 -5
- package/src/components-v2/search-bar/index.tsx +1 -1
- package/src/components-v2/section/compound/section-header.tsx +6 -3
- package/src/components-v2/section/compound/section.tsx +1 -1
- package/src/components-v2/section/index.ts +1 -1
- package/src/components-v2/side-nav/index.ts +1 -1
- package/src/components-v2/sticky/index.ts +1 -1
- package/src/components-v2/sticky/sticky.tsx +1 -1
- package/src/components-v2/wishlist-dialogs/__tests__/create-new-list.test.tsx +82 -0
- package/src/components-v2/wishlist-dialogs/__tests__/wishlistDetailData.json +280 -0
- package/src/components-v2/wishlist-dialogs/__tests__/wishlistsData.json +38 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/add-to-wishlist-button.tsx +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-bottom-ui.tsx +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +4 -4
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +5 -2
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/context.ts +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-header.tsx +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-item.tsx +6 -3
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/hooks/use-add-to-wishlist.ts +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/index.tsx +1 -1
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui.tsx +1 -1
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +2 -2
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form.tsx +2 -2
- package/src/components-v2/wishlist-dialogs/create-wishlist/create-wishlist-button.tsx +1 -1
- package/src/components-v2/wishlist-dialogs/create-wishlist/index.tsx +1 -1
- package/src/lib/build-detail-url.ts +1 -1
- package/src/lib/cart-cookie-handler.ts +1 -1
- package/src/pages-v2/account/account-navigation.tsx +183 -0
- package/src/pages-v2/account/addresses/address-form.tsx +187 -186
- package/src/pages-v2/account/addresses/address-item.tsx +118 -56
- package/src/pages-v2/account/dashboard-header.tsx +103 -76
- package/src/pages-v2/account/orders/order-progress.tsx +104 -65
- package/src/pages-v2/account/orders/order-row.tsx +69 -32
- package/src/pages-v2/account/orders/order-summary.tsx +96 -62
- package/src/pages-v2/account/orders/ordered-products.tsx +128 -87
- package/src/pages-v2/account/profile/profile-button.test.tsx +1 -1
- package/src/pages-v2/account/profile/user-info.tsx +59 -34
- package/src/pages-v2/account/wishlist/create-new-list.tsx +181 -127
- package/src/pages-v2/account/wishlist/create-wishlist-button.tsx +16 -3
- package/src/pages-v2/account/wishlist/wishlist-item.tsx +93 -42
- package/src/pages-v2/cart/__tests__/cart-item.test.tsx +225 -0
- package/src/pages-v2/cart/__tests__/cart-with-items.json +811 -0
- package/src/pages-v2/cart/__tests__/checkout-form.test.tsx +148 -0
- package/src/pages-v2/cart/__tests__/conutries.json +19407 -0
- package/src/pages-v2/cart/__tests__/estimate-shipping.test.tsx +86 -0
- package/src/pages-v2/cart/cart-item.tsx +387 -258
- package/src/pages-v2/cart/checkout-form.tsx +141 -48
- package/src/pages-v2/cart/coupon-entry.tsx +121 -58
- package/src/pages-v2/cart/estimate-shipping.tsx +174 -118
- package/src/pages-v2/checkout/checkout-alt-form/checkout-form.tsx +153 -76
- package/src/pages-v2/checkout/checkout-alt-form/checkout-step.tsx +128 -77
- package/src/pages-v2/checkout/checkout-alt-form/index.ts +1 -1
- package/src/pages-v2/checkout/checkout-alt-form/{heading.tsx → step-heading.tsx} +1 -1
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/address-card.tsx +131 -0
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/delivery-address.tsx +450 -0
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/new-address-form.tsx +322 -0
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/styles.ts +27 -0
- package/src/pages-v2/checkout/checkout-alt-form/steps/customer-info/customer-information.tsx +139 -0
- package/src/pages-v2/checkout/checkout-alt-form/{payment-details.tsx → steps/payment/payment-details.tsx} +123 -141
- package/src/pages-v2/checkout/checkout-alt-form/{delivery-date.tsx → steps/shipping/delivery-date.tsx} +3 -3
- package/src/pages-v2/checkout/checkout-alt-form/{delivery-options.tsx → steps/shipping/delivery-options.tsx} +97 -50
- package/src/pages-v2/checkout/checkout-alt-summary/cart-item.tsx +58 -28
- package/src/pages-v2/checkout/checkout-alt-summary/checkout-alt-summary.tsx +69 -22
- package/src/pages-v2/checkout/checkout-alt-summary/index.ts +1 -1
- package/src/pages-v2/checkout/checkout-alt-summary/list-item.tsx +56 -14
- package/src/pages-v2/confirmation/address.tsx +37 -15
- package/src/pages-v2/confirmation/confirmation-summary.tsx +80 -41
- package/src/pages-v2/confirmation/ordered-products.tsx +127 -95
- package/src/pages-v2/product-details/bopis/find-in-store-button.tsx +2 -2
- package/src/pages-v2/product-details/bopis/find-in-store-modal.tsx +4 -4
- package/src/pages-v2/product-details/bopis/pickup-option-select.tsx +1 -1
- package/src/pages-v2/product-details/bopis/store-card/index.ts +1 -1
- package/src/pages-v2/product-details/bopis/store-card/shop-card.tsx +3 -3
- package/src/pages-v2/product-details/frequently-bought.tsx +1 -1
- package/src/pages-v2/product-details/product-filter-card.tsx +2 -2
- package/src/pages-v2/product-details/product-intro/compound/context.ts +1 -4
- package/src/pages-v2/product-details/product-intro/compound/product-info.tsx +6 -3
- package/src/pages-v2/product-details/product-intro/compound/product-intro-images.tsx +6 -3
- package/src/pages-v2/product-details/product-intro/compound/product-intro.tsx +4 -4
- package/src/pages-v2/product-details/product-intro/utils.ts +0 -1
- package/src/pages-v2/product-details/product-review.tsx +5 -2
- package/src/pages-v2/product-details/product-tabs.tsx +1 -1
- package/src/pages-v2/quickorder/context.ts +39 -0
- package/src/pages-v2/quickorder/index.tsx +31 -0
- package/src/pages-v2/quickorder/order-upload.tsx +19 -26
- package/src/pages-v2/quickorder/provider.tsx +187 -0
- package/src/pages-v2/quickorder/quick-order-actions.tsx +30 -0
- package/src/pages-v2/quickorder/quick-order-header.tsx +22 -0
- package/src/pages-v2/quickorder/quick-order-row.tsx +8 -17
- package/src/pages-v2/quickorder/quick-order-table.tsx +63 -0
- package/src/pages-v2/quickorder/quick-order-upload.tsx +20 -0
- package/src/providers/nav-provider/index.tsx +1 -1
- package/src/providers/notifications/notification-context.tsx +1 -1
- package/src/providers/notifications/use-notification.ts +1 -1
- package/tsconfig.json +2 -1
- package/src/api-manager/lib/get-graphql-client.test.ts +0 -106
- package/src/components/_components/header/components/user.test.tsx +0 -200
- package/src/components/_components/mini-cart/__tests__/cart-item.test.tsx +0 -174
- package/src/components/_components/mini-cart/__tests__/mini-cart.test.tsx +0 -121
- package/src/components/_components/mini-cart/__tests__/test-cart-empty.json +0 -84
- package/src/components/_components/mini-cart/__tests__/test-cart-with-item.json +0 -244
- package/src/components/_components/navbar/mobile-menu/render-levels.test.tsx +0 -71
- package/src/components/_components/navbar/nav-list/cms-nav.test.tsx +0 -84
- package/src/components/_components/navbar/utils/transform-nav.test.ts +0 -209
- package/src/components/_components/search-box/__test__/search-input-category.test.tsx +0 -110
- package/src/components/_components/search-box/__test__/search-input.test.tsx +0 -137
- package/src/components/_components/search-box/__test__/search-results.json +0 -165
- package/src/components/_components/search-box/search-input-category.test.tsx +0 -110
- package/src/components/_components/search-box/search-input.test.tsx +0 -41
- package/src/components-v2/bazaar-types.ts +0 -84
- package/src/pages-v2/account/navigation.tsx +0 -87
- package/src/pages-v2/checkout/checkout-alt-form/address-card.tsx +0 -76
- package/src/pages-v2/checkout/checkout-alt-form/customer-information.tsx +0 -94
- package/src/pages-v2/checkout/checkout-alt-form/delivery-address.tsx +0 -174
- package/src/pages-v2/checkout/checkout-alt-form/edit-address-form.tsx +0 -130
- package/src/pages-v2/checkout/checkout-alt-form/new-address-form.tsx +0 -299
- package/src/pages-v2/quickorder/quick-order-form.tsx +0 -346
- /package/src/cms/blocks/{Components/CategoryCard.tsx → components/category-card.tsx} +0 -0
- /package/src/cms/blocks/{Components/Footer → components/footer}/data/index.ts +0 -0
- /package/src/cms/blocks/{Components/Footer → components/footer}/interfaces.ts +0 -0
- /package/src/cms/blocks/{Components/Footer/sections/FooterAppStore.tsx → components/footer/sections/footer-app-store.tsx} +0 -0
- /package/src/cms/blocks/{Components/Footer/sections/FooterLogo.tsx → components/footer/sections/footer-logo.tsx} +0 -0
- /package/src/cms/blocks/{Components/Footer → components/footer}/styles/index.ts +0 -0
- /package/src/cms/blocks/{Components/MediaCard.tsx → components/media-card.tsx} +0 -0
- /package/src/cms/blocks/{Components/RichText.tsx → components/rich-text.tsx} +0 -0
- /package/src/cms/blocks/{Components → components}/shared/featured-product-card.tsx +0 -0
- /package/src/cms/blocks/{Components → components}/shared/product-category-item.tsx +0 -0
- /package/src/cms/blocks/{Components → components}/shared/product-grid.tsx +0 -0
- /package/src/cms/blocks/{Components → components}/shared/top-categories-card.tsx +0 -0
- /package/src/cms/blocks/{Components → components}/shared/top-rating-product-card.tsx +0 -0
- /package/src/cms/blocks/{Icons/Components/Category.tsx → icons/components/category.tsx} +0 -0
- /package/src/cms/blocks/{Icons/Components/DottedStar.tsx → icons/components/dotted-star.tsx} +0 -0
- /package/src/cms/blocks/{Icons/Components/FallbackIcon.tsx → icons/components/fallback-icon.tsx} +0 -0
- /package/src/cms/blocks/{Icons/Components/GiftBox.tsx → icons/components/gift-box.tsx} +0 -0
- /package/src/cms/blocks/{Icons/Components/Light.tsx → icons/components/light.tsx} +0 -0
- /package/src/cms/blocks/{Icons/Components/NewArrival.tsx → icons/components/new-arrival.tsx} +0 -0
- /package/src/cms/blocks/{Icons/Components/RankBadge.tsx → icons/components/rank-badge.tsx} +0 -0
- /package/src/cms/interfaces/{productData.ts → product-data.ts} +0 -0
- /package/src/pages-v2/checkout/checkout-alt-form/{safe-card-preview-data.tsx → steps/payment/safe-card-preview-data.tsx} +0 -0
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { ModeEditOutline, DeleteOutline } from "@mui/icons-material";
|
|
2
|
-
import { Card, IconButton } from "@mui/material";
|
|
3
|
-
import Grid from "@mui/material/Grid2";
|
|
4
|
-
import { Address } from "@/api-manager/schemas/address.schema";
|
|
5
|
-
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box";
|
|
6
|
-
import {
|
|
7
|
-
H6,
|
|
8
|
-
Paragraph,
|
|
9
|
-
} from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
address: Address;
|
|
13
|
-
isCartAddress: boolean;
|
|
14
|
-
hideControls?: boolean;
|
|
15
|
-
onEdit?: () => void;
|
|
16
|
-
onSelect?: () => void;
|
|
17
|
-
onDelete?: () => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default function AddressCard({
|
|
21
|
-
address,
|
|
22
|
-
isCartAddress,
|
|
23
|
-
hideControls,
|
|
24
|
-
onEdit,
|
|
25
|
-
onSelect,
|
|
26
|
-
onDelete,
|
|
27
|
-
}: Props) {
|
|
28
|
-
return (
|
|
29
|
-
<Grid onClick={() => onSelect?.()}>
|
|
30
|
-
<Card
|
|
31
|
-
sx={{
|
|
32
|
-
padding: 2,
|
|
33
|
-
boxShadow: "none",
|
|
34
|
-
cursor: onSelect ? "pointer" : "default",
|
|
35
|
-
border: "1px solid",
|
|
36
|
-
position: "relative",
|
|
37
|
-
backgroundColor: "grey.100",
|
|
38
|
-
borderColor: isCartAddress ? "secondary.main" : "transparent",
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
41
|
-
{!hideControls && (
|
|
42
|
-
<FlexBox position="absolute" top={5} right={5}>
|
|
43
|
-
<IconButton
|
|
44
|
-
size="small"
|
|
45
|
-
onClick={(e) => {
|
|
46
|
-
e.stopPropagation();
|
|
47
|
-
onEdit?.();
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
<ModeEditOutline fontSize="inherit" />
|
|
51
|
-
</IconButton>
|
|
52
|
-
<IconButton
|
|
53
|
-
size="small"
|
|
54
|
-
color="error"
|
|
55
|
-
onClick={(e) => {
|
|
56
|
-
e.stopPropagation();
|
|
57
|
-
onDelete?.();
|
|
58
|
-
}}
|
|
59
|
-
disabled={isCartAddress}
|
|
60
|
-
>
|
|
61
|
-
<DeleteOutline fontSize="inherit" />
|
|
62
|
-
</IconButton>
|
|
63
|
-
</FlexBox>
|
|
64
|
-
)}
|
|
65
|
-
<H6 mb={0.5}>{address.Name}</H6>
|
|
66
|
-
<Paragraph color="grey.700">{address.Street}</Paragraph>
|
|
67
|
-
<Paragraph color="grey.700">{address.City}</Paragraph>
|
|
68
|
-
<Paragraph color="grey.700">
|
|
69
|
-
{address.State}, {address.ThreeLetterISORegionName}
|
|
70
|
-
</Paragraph>
|
|
71
|
-
<Paragraph color="grey.700">{address.ZipCode}</Paragraph>
|
|
72
|
-
<Paragraph color="grey.700">{address.Phone}</Paragraph>
|
|
73
|
-
</Card>
|
|
74
|
-
</Grid>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Box from "@mui/material/Box";
|
|
3
|
-
import Grid from "@mui/material/Grid2";
|
|
4
|
-
import TextField from "@mui/material/TextField";
|
|
5
|
-
import useUpdateCart from "@/api-manager/services/cart/mutations/update-cart";
|
|
6
|
-
import { useTranslations } from "next-intl";
|
|
7
|
-
import { CheckoutStepComponentProps } from "./checkout-step";
|
|
8
|
-
import { Paragraph } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
9
|
-
import * as yup from "yup";
|
|
10
|
-
import { useForm } from "react-hook-form";
|
|
11
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
12
|
-
|
|
13
|
-
export default function CustomerInformation(props: CheckoutStepComponentProps) {
|
|
14
|
-
const {
|
|
15
|
-
stepViewState,
|
|
16
|
-
cart: { Id: cartId, ReceiptEmail: email },
|
|
17
|
-
stepSubmissionState,
|
|
18
|
-
setStepSubmissionState,
|
|
19
|
-
} = props;
|
|
20
|
-
const { mutateAsync: updateCart } = useUpdateCart();
|
|
21
|
-
const formRef = React.useRef<HTMLFormElement>(null);
|
|
22
|
-
const t = useTranslations("Checkout.CustomerInformation");
|
|
23
|
-
|
|
24
|
-
const validationSchema = yup.object({
|
|
25
|
-
email: yup.string().email(t("emailInvalid")).required(t("emailRequired")),
|
|
26
|
-
});
|
|
27
|
-
const {
|
|
28
|
-
register,
|
|
29
|
-
handleSubmit,
|
|
30
|
-
formState: { errors, isSubmitted },
|
|
31
|
-
setValue,
|
|
32
|
-
} = useForm({
|
|
33
|
-
defaultValues: { email: email || "" },
|
|
34
|
-
resolver: yupResolver(validationSchema),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
React.useEffect(() => {
|
|
38
|
-
setValue("email", email || "");
|
|
39
|
-
}, [email, setValue]);
|
|
40
|
-
|
|
41
|
-
const handleSave = React.useCallback(
|
|
42
|
-
(formData: { email: string }) => {
|
|
43
|
-
updateCart({
|
|
44
|
-
cart: { ReceiptEmail: formData.email, Id: cartId },
|
|
45
|
-
})
|
|
46
|
-
.then(() => {
|
|
47
|
-
props.handleStepCompletion && props.handleStepCompletion();
|
|
48
|
-
setStepSubmissionState("idle");
|
|
49
|
-
})
|
|
50
|
-
.catch(() => {
|
|
51
|
-
setStepSubmissionState("error");
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
[cartId, props, setStepSubmissionState, updateCart],
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
React.useEffect(() => {
|
|
58
|
-
if (stepSubmissionState === "submitting") {
|
|
59
|
-
handleSubmit(handleSave)();
|
|
60
|
-
}
|
|
61
|
-
}, [handleSave, handleSubmit, stepSubmissionState]);
|
|
62
|
-
|
|
63
|
-
React.useEffect(() => {
|
|
64
|
-
if (errors && isSubmitted) {
|
|
65
|
-
setStepSubmissionState("error");
|
|
66
|
-
}
|
|
67
|
-
}, [errors, isSubmitted, setStepSubmissionState]);
|
|
68
|
-
if (stepViewState === "preview") {
|
|
69
|
-
return (
|
|
70
|
-
<Box ml={2}>
|
|
71
|
-
<Paragraph>
|
|
72
|
-
{t("emailLabel")}: {email}
|
|
73
|
-
</Paragraph>
|
|
74
|
-
</Box>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return (
|
|
78
|
-
<form onSubmit={handleSubmit(handleSave)} ref={formRef}>
|
|
79
|
-
<Grid size={{ sm: 5, xs: 5 }}>
|
|
80
|
-
<TextField
|
|
81
|
-
{...register("email")}
|
|
82
|
-
fullWidth
|
|
83
|
-
sx={{ flexGrow: 1 }}
|
|
84
|
-
type="email"
|
|
85
|
-
name={"email"}
|
|
86
|
-
label={t("emailLabel")}
|
|
87
|
-
variant="outlined"
|
|
88
|
-
error={Boolean(!!errors.email && errors.email.message)}
|
|
89
|
-
helperText={errors.email?.message}
|
|
90
|
-
/>
|
|
91
|
-
</Grid>
|
|
92
|
-
</form>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { useLocale, useTranslations } from "next-intl";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import NewAddressForm from "./new-address-form";
|
|
5
|
-
import { Address } from "@/api-manager/schemas/address.schema";
|
|
6
|
-
import AddressCard from "./address-card";
|
|
7
|
-
|
|
8
|
-
import getUser from "@/api-manager/services/user/queries/get-user";
|
|
9
|
-
import useCreateAddress from "@/api-manager/services/address/mutations/create-address";
|
|
10
|
-
import useUpdateAddress from "@/api-manager/services/address/mutations/update-address";
|
|
11
|
-
import useDeleteAddress from "@/api-manager/services/address/mutations/delete-address";
|
|
12
|
-
import getCountries from "@/api-manager/services/address/queries/get-countries";
|
|
13
|
-
import useUpdateCart from "@/api-manager/services/cart/mutations/update-cart";
|
|
14
|
-
import { CheckoutStepComponentProps } from "./checkout-step";
|
|
15
|
-
import Grid from "@mui/material/Grid2";
|
|
16
|
-
import useUpdateCartLines from "@/api-manager/services/cart/mutations/update-cart-lines";
|
|
17
|
-
import { cloneDeep } from "lodash";
|
|
18
|
-
|
|
19
|
-
export default function DeliveryAddress({
|
|
20
|
-
cart,
|
|
21
|
-
handleStepCompletion,
|
|
22
|
-
stepSubmissionState,
|
|
23
|
-
setStepSubmissionState,
|
|
24
|
-
stepViewState,
|
|
25
|
-
}: CheckoutStepComponentProps) {
|
|
26
|
-
const t = useTranslations("Checkout.Address");
|
|
27
|
-
const locale = useLocale();
|
|
28
|
-
|
|
29
|
-
const { data: user, isLoading: userLoading } = getUser.useData();
|
|
30
|
-
const isGuest = !userLoading && !user?.RecordId;
|
|
31
|
-
|
|
32
|
-
const [addressList, setAddressList] = useState<Address[]>([]);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (!isGuest && user?.Addresses?.length) {
|
|
35
|
-
setAddressList(user.Addresses);
|
|
36
|
-
} else if (cart.ShippingAddress) {
|
|
37
|
-
setAddressList([cart.ShippingAddress]);
|
|
38
|
-
} else {
|
|
39
|
-
setAddressList([]);
|
|
40
|
-
}
|
|
41
|
-
}, [isGuest, user, cart.ShippingAddress]);
|
|
42
|
-
|
|
43
|
-
const { data: countries } = getCountries.useData({ locale });
|
|
44
|
-
|
|
45
|
-
const { mutateAsync: updateCart } = useUpdateCart();
|
|
46
|
-
const { mutateAsync: updateCartLines } = useUpdateCartLines();
|
|
47
|
-
|
|
48
|
-
const { mutateAsync: createAddress } = useCreateAddress();
|
|
49
|
-
const { mutateAsync: updateAddress } = useUpdateAddress();
|
|
50
|
-
const { mutateAsync: deleteAddress } = useDeleteAddress();
|
|
51
|
-
|
|
52
|
-
const [modalOpen, setModalOpen] = useState(false);
|
|
53
|
-
const [editAddress, setEditAddress] = useState<Address | undefined>(
|
|
54
|
-
undefined,
|
|
55
|
-
);
|
|
56
|
-
const openNew = () => {
|
|
57
|
-
setEditAddress(undefined);
|
|
58
|
-
setModalOpen(true);
|
|
59
|
-
};
|
|
60
|
-
const openEdit = (addr: Address) => {
|
|
61
|
-
setEditAddress(addr);
|
|
62
|
-
setModalOpen(true);
|
|
63
|
-
};
|
|
64
|
-
const closeModal = () => setModalOpen(false);
|
|
65
|
-
|
|
66
|
-
const saveToCart = async (address: Address) => {
|
|
67
|
-
const lines = cloneDeep(cart.CartLines ?? []).map((l) => ({
|
|
68
|
-
...l,
|
|
69
|
-
DeliveryMode: "",
|
|
70
|
-
}));
|
|
71
|
-
await updateCartLines({
|
|
72
|
-
cartId: cart.Id,
|
|
73
|
-
cartLine: lines,
|
|
74
|
-
version: cart.Version,
|
|
75
|
-
});
|
|
76
|
-
await updateCart({ cart: { Id: cart.Id, ShippingAddress: address } });
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const handleGuestFlow = async (address: Address) => {
|
|
80
|
-
await saveToCart(address);
|
|
81
|
-
setStepSubmissionState("submitting");
|
|
82
|
-
closeModal();
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const handleAuthFlow = async (address: Address) => {
|
|
86
|
-
const isNew = !address.Id;
|
|
87
|
-
const saved = isNew
|
|
88
|
-
? await createAddress(address)
|
|
89
|
-
: await updateAddress(address);
|
|
90
|
-
// Update local list
|
|
91
|
-
if (isNew) {
|
|
92
|
-
setAddressList((prev) => [...prev, saved]);
|
|
93
|
-
} else {
|
|
94
|
-
setAddressList((prev) =>
|
|
95
|
-
prev.map((a) => (a.Id === saved.Id ? saved : a)),
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
await saveToCart(saved);
|
|
99
|
-
if (isNew) setStepSubmissionState("submitting");
|
|
100
|
-
closeModal();
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const handleSaveAddress = (address: Address) => {
|
|
104
|
-
return isGuest ? handleGuestFlow(address) : handleAuthFlow(address);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const handleDelete = async (address: Address) => {
|
|
108
|
-
if (!isGuest && address.Id) {
|
|
109
|
-
await deleteAddress(address.Id);
|
|
110
|
-
}
|
|
111
|
-
setAddressList((prev) => prev.filter((a) => a.Id !== address.Id));
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
useEffect(() => {
|
|
115
|
-
if (stepSubmissionState === "submitting") {
|
|
116
|
-
handleStepCompletion();
|
|
117
|
-
setStepSubmissionState("idle");
|
|
118
|
-
}
|
|
119
|
-
}, [stepSubmissionState, handleStepCompletion, setStepSubmissionState]);
|
|
120
|
-
|
|
121
|
-
if (stepViewState === "pending" || !countries) return null;
|
|
122
|
-
if (stepViewState === "preview") {
|
|
123
|
-
const sel = cart.ShippingAddress;
|
|
124
|
-
if (!sel) return null;
|
|
125
|
-
return <AddressCard address={sel} hideControls isCartAddress />;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<Grid container spacing={2}>
|
|
130
|
-
<NewAddressForm
|
|
131
|
-
countries={countries}
|
|
132
|
-
open={modalOpen}
|
|
133
|
-
isGuest={isGuest}
|
|
134
|
-
address={editAddress}
|
|
135
|
-
cartId={cart.Id}
|
|
136
|
-
handleClose={closeModal}
|
|
137
|
-
handleCreateOrUpdateAddress={handleSaveAddress}
|
|
138
|
-
/>
|
|
139
|
-
|
|
140
|
-
{addressList.map((addr) => (
|
|
141
|
-
<Grid key={addr.Id || addr.RecordId} size={{ md: 4, sm: 6, xs: 12 }}>
|
|
142
|
-
<AddressCard
|
|
143
|
-
address={addr}
|
|
144
|
-
isCartAddress={cart.ShippingAddress?.Id === addr.Id}
|
|
145
|
-
onEdit={() => openEdit(addr)}
|
|
146
|
-
onSelect={() => handleSaveAddress(addr)}
|
|
147
|
-
onDelete={() => handleDelete(addr)}
|
|
148
|
-
/>
|
|
149
|
-
</Grid>
|
|
150
|
-
))}
|
|
151
|
-
|
|
152
|
-
<Grid
|
|
153
|
-
size={{ md: 4, sm: 6, xs: 12 }}
|
|
154
|
-
onClick={openNew}
|
|
155
|
-
data-testid="addr-new"
|
|
156
|
-
>
|
|
157
|
-
<AddressCard
|
|
158
|
-
address={{
|
|
159
|
-
Id: "new",
|
|
160
|
-
Name: t("createNewAddress"),
|
|
161
|
-
Street: "",
|
|
162
|
-
City: "",
|
|
163
|
-
State: "",
|
|
164
|
-
ZipCode: "",
|
|
165
|
-
Phone: "",
|
|
166
|
-
}}
|
|
167
|
-
hideControls
|
|
168
|
-
isCartAddress={false}
|
|
169
|
-
onSelect={openNew}
|
|
170
|
-
/>
|
|
171
|
-
</Grid>
|
|
172
|
-
</Grid>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import Grid from "@mui/material/Grid2";
|
|
3
|
-
import Dialog from "@mui/material/Dialog";
|
|
4
|
-
import Button from "@mui/material/Button";
|
|
5
|
-
import TextField from "@mui/material/TextField";
|
|
6
|
-
import DialogContent from "@mui/material/DialogContent";
|
|
7
|
-
import { useFormik } from "formik";
|
|
8
|
-
import * as yup from "yup";
|
|
9
|
-
// GLOBAL CUSTOM COMPONENT
|
|
10
|
-
import { H5 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
11
|
-
|
|
12
|
-
import { Address } from "./types";
|
|
13
|
-
|
|
14
|
-
const validationSchema = yup.object({
|
|
15
|
-
address2: yup.string(),
|
|
16
|
-
name: yup.string().required("Name is required!"),
|
|
17
|
-
address1: yup.string().required("Address is required!"),
|
|
18
|
-
phone: yup.number().required("Phone is required!"),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// ================================================================
|
|
22
|
-
interface Props {
|
|
23
|
-
active: boolean;
|
|
24
|
-
address: Address;
|
|
25
|
-
changeEditAddressId: () => void;
|
|
26
|
-
handleEditAddress: (id: number, data: Address) => void;
|
|
27
|
-
}
|
|
28
|
-
// ================================================================
|
|
29
|
-
|
|
30
|
-
export default function EditAddressForm(props: Props) {
|
|
31
|
-
const { active, address, changeEditAddressId, handleEditAddress } = props;
|
|
32
|
-
|
|
33
|
-
const [openModal, setOpenModal] = useState(active);
|
|
34
|
-
|
|
35
|
-
const handleCloseModal = () => {
|
|
36
|
-
setOpenModal(false);
|
|
37
|
-
changeEditAddressId();
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const initialValues = {
|
|
41
|
-
name: address.name,
|
|
42
|
-
phone: address.phone,
|
|
43
|
-
street1: address.street1,
|
|
44
|
-
street2: address.street2,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const { values, touched, errors, handleBlur, handleChange, handleSubmit } =
|
|
48
|
-
useFormik({
|
|
49
|
-
initialValues,
|
|
50
|
-
validationSchema,
|
|
51
|
-
onSubmit: (values) => {
|
|
52
|
-
handleEditAddress(address.id, { ...values, id: address.id });
|
|
53
|
-
handleCloseModal();
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<Dialog open={openModal} onClose={handleCloseModal} sx={{ zIndex: 99999 }}>
|
|
59
|
-
<DialogContent>
|
|
60
|
-
<H5 mb={4}>Edit Address Information</H5>
|
|
61
|
-
|
|
62
|
-
<form onSubmit={handleSubmit}>
|
|
63
|
-
<Grid container spacing={3}>
|
|
64
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
65
|
-
<TextField
|
|
66
|
-
fullWidth
|
|
67
|
-
name="name"
|
|
68
|
-
type="text"
|
|
69
|
-
label="Enter Your Name"
|
|
70
|
-
value={values.name}
|
|
71
|
-
onBlur={handleBlur}
|
|
72
|
-
onChange={handleChange}
|
|
73
|
-
helperText={touched.name && errors.name}
|
|
74
|
-
error={touched.name && Boolean(errors.name)}
|
|
75
|
-
/>
|
|
76
|
-
</Grid>
|
|
77
|
-
|
|
78
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
79
|
-
<TextField
|
|
80
|
-
fullWidth
|
|
81
|
-
type="text"
|
|
82
|
-
name="street1"
|
|
83
|
-
label="Address line 1"
|
|
84
|
-
onBlur={handleBlur}
|
|
85
|
-
value={values.street1}
|
|
86
|
-
onChange={handleChange}
|
|
87
|
-
helperText={touched.street1 && errors.street1}
|
|
88
|
-
error={touched.street1 && Boolean(errors.street1)}
|
|
89
|
-
/>
|
|
90
|
-
</Grid>
|
|
91
|
-
|
|
92
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
93
|
-
<TextField
|
|
94
|
-
fullWidth
|
|
95
|
-
type="text"
|
|
96
|
-
name="street2"
|
|
97
|
-
label="Address line 2"
|
|
98
|
-
onBlur={handleBlur}
|
|
99
|
-
value={values.street2}
|
|
100
|
-
onChange={handleChange}
|
|
101
|
-
helperText={touched.street2 && errors.street2}
|
|
102
|
-
error={touched.street2 && Boolean(errors.street2)}
|
|
103
|
-
/>
|
|
104
|
-
</Grid>
|
|
105
|
-
|
|
106
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
107
|
-
<TextField
|
|
108
|
-
fullWidth
|
|
109
|
-
type="text"
|
|
110
|
-
name="phone"
|
|
111
|
-
label="Enter Your Phone"
|
|
112
|
-
onBlur={handleBlur}
|
|
113
|
-
value={values.phone}
|
|
114
|
-
onChange={handleChange}
|
|
115
|
-
helperText={touched.phone && errors.phone}
|
|
116
|
-
error={touched.phone && Boolean(errors.phone)}
|
|
117
|
-
/>
|
|
118
|
-
</Grid>
|
|
119
|
-
|
|
120
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
121
|
-
<Button color="primary" variant="contained" type="submit">
|
|
122
|
-
Save
|
|
123
|
-
</Button>
|
|
124
|
-
</Grid>
|
|
125
|
-
</Grid>
|
|
126
|
-
</form>
|
|
127
|
-
</DialogContent>
|
|
128
|
-
</Dialog>
|
|
129
|
-
);
|
|
130
|
-
}
|