@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,299 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Grid from "@mui/material/Grid2";
|
|
3
|
-
import Button from "@mui/material/Button";
|
|
4
|
-
import Dialog from "@mui/material/Dialog";
|
|
5
|
-
import TextField from "@mui/material/TextField";
|
|
6
|
-
import DialogContent from "@mui/material/DialogContent";
|
|
7
|
-
// React hook form
|
|
8
|
-
import { Controller, useForm } from "react-hook-form";
|
|
9
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
10
|
-
import z from "zod";
|
|
11
|
-
// LOCAL CUSTOM COMPONENT
|
|
12
|
-
import { H5 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
13
|
-
import { Address } from "@/api-manager/schemas/address.schema";
|
|
14
|
-
import { useTranslations } from "use-intl";
|
|
15
|
-
import { Box, FormControl, InputLabel, MenuItem, Select } from "@mui/material";
|
|
16
|
-
import { CountryRegionInfo } from "@msdyn365-commerce/retail-proxy";
|
|
17
|
-
import getStates from "@/api-manager/services/address/queries/get-states";
|
|
18
|
-
import { Paragraph } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
19
|
-
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box";
|
|
20
|
-
import { merge } from "lodash";
|
|
21
|
-
|
|
22
|
-
interface Props {
|
|
23
|
-
address?: Address;
|
|
24
|
-
countries: CountryRegionInfo[];
|
|
25
|
-
cartId: string;
|
|
26
|
-
open: boolean;
|
|
27
|
-
handleClose: () => void;
|
|
28
|
-
handleCreateOrUpdateAddress: (address: Address) => void;
|
|
29
|
-
isGuest: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type AddressFormInput = {
|
|
33
|
-
name: string;
|
|
34
|
-
street: string;
|
|
35
|
-
city: string;
|
|
36
|
-
state: string;
|
|
37
|
-
zipCode: string;
|
|
38
|
-
country: string;
|
|
39
|
-
phone: string | null;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default function NewAddressForm({
|
|
43
|
-
address,
|
|
44
|
-
countries,
|
|
45
|
-
isGuest,
|
|
46
|
-
open,
|
|
47
|
-
handleClose,
|
|
48
|
-
handleCreateOrUpdateAddress,
|
|
49
|
-
}: Props) {
|
|
50
|
-
const t = useTranslations("Address");
|
|
51
|
-
const defaultCountry = React.useMemo(
|
|
52
|
-
() =>
|
|
53
|
-
countries.find(
|
|
54
|
-
(c) => c.CountryRegionId === (address?.ThreeLetterISORegionName ?? ""),
|
|
55
|
-
),
|
|
56
|
-
[countries, address],
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const [selectedCountry, setSelectedCountry] =
|
|
60
|
-
React.useState<CountryRegionInfo | null>(defaultCountry ?? null);
|
|
61
|
-
|
|
62
|
-
const { data: states } = getStates.useData({
|
|
63
|
-
countryId: selectedCountry?.CountryRegionId,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
React.useEffect(() => {
|
|
67
|
-
if (address && defaultCountry) {
|
|
68
|
-
setSelectedCountry(defaultCountry);
|
|
69
|
-
}
|
|
70
|
-
}, [address, defaultCountry]);
|
|
71
|
-
|
|
72
|
-
const validationSchema = z.object({
|
|
73
|
-
name: z
|
|
74
|
-
.string()
|
|
75
|
-
.min(1, { message: t("Validation.required", { field: t("name") }) }),
|
|
76
|
-
street: z
|
|
77
|
-
.string()
|
|
78
|
-
.min(1, { message: t("Validation.required", { field: t("street") }) }),
|
|
79
|
-
city: z
|
|
80
|
-
.string()
|
|
81
|
-
.min(1, { message: t("Validation.required", { field: t("city") }) }),
|
|
82
|
-
state: z
|
|
83
|
-
.string()
|
|
84
|
-
.min(1, { message: t("Validation.required", { field: t("state") }) }),
|
|
85
|
-
zipCode: z
|
|
86
|
-
.string()
|
|
87
|
-
.min(1, { message: t("Validation.required", { field: t("zipCode") }) }),
|
|
88
|
-
country: z
|
|
89
|
-
.string()
|
|
90
|
-
.min(1, { message: t("Validation.required", { field: t("country") }) }),
|
|
91
|
-
phone: z.string().optional().default(""),
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const {
|
|
95
|
-
register,
|
|
96
|
-
handleSubmit,
|
|
97
|
-
formState: { errors },
|
|
98
|
-
control,
|
|
99
|
-
setValue,
|
|
100
|
-
reset,
|
|
101
|
-
} = useForm<AddressFormInput>({
|
|
102
|
-
defaultValues: {
|
|
103
|
-
name: "",
|
|
104
|
-
street: "",
|
|
105
|
-
city: "",
|
|
106
|
-
state: "0",
|
|
107
|
-
zipCode: "",
|
|
108
|
-
phone: "",
|
|
109
|
-
country: selectedCountry?.CountryRegionId || "",
|
|
110
|
-
},
|
|
111
|
-
resolver: zodResolver(validationSchema),
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
React.useEffect(() => {
|
|
115
|
-
setValue("country", selectedCountry?.CountryRegionId || "");
|
|
116
|
-
if (!address) {
|
|
117
|
-
setValue("state", "0");
|
|
118
|
-
}
|
|
119
|
-
}, [selectedCountry, setValue, address]);
|
|
120
|
-
|
|
121
|
-
React.useEffect(() => {
|
|
122
|
-
if (!open) {
|
|
123
|
-
reset();
|
|
124
|
-
setSelectedCountry(defaultCountry ?? null);
|
|
125
|
-
}
|
|
126
|
-
}, [defaultCountry, open, reset]);
|
|
127
|
-
|
|
128
|
-
React.useEffect(() => {
|
|
129
|
-
if (address) {
|
|
130
|
-
setValue("name", address.Name || "");
|
|
131
|
-
setValue("street", address.Street || "");
|
|
132
|
-
setValue("city", address.City || "");
|
|
133
|
-
setValue("state", address.State || "0");
|
|
134
|
-
setValue("zipCode", address.ZipCode || "");
|
|
135
|
-
setValue("phone", address.Phone || "");
|
|
136
|
-
setValue("country", address.ThreeLetterISORegionName || "");
|
|
137
|
-
} else {
|
|
138
|
-
reset();
|
|
139
|
-
}
|
|
140
|
-
}, [address, setValue, reset]);
|
|
141
|
-
|
|
142
|
-
const onFormSubmit = (data: AddressFormInput) => {
|
|
143
|
-
const tempAddress: Address = {
|
|
144
|
-
Name: data.name,
|
|
145
|
-
Street: data.street,
|
|
146
|
-
City: data.city,
|
|
147
|
-
State: data.state,
|
|
148
|
-
ZipCode: data.zipCode,
|
|
149
|
-
TwoLetterISORegionName: selectedCountry?.ISOCode,
|
|
150
|
-
ThreeLetterISORegionName: selectedCountry?.CountryRegionId,
|
|
151
|
-
Phone: data.phone || undefined,
|
|
152
|
-
};
|
|
153
|
-
const newAddress = merge({}, address || {}, tempAddress);
|
|
154
|
-
handleCreateOrUpdateAddress(newAddress);
|
|
155
|
-
handleClose();
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
return (
|
|
159
|
-
<Dialog open={open} onClose={handleClose}>
|
|
160
|
-
<DialogContent>
|
|
161
|
-
<H5 mb={4}>{t("title")}</H5>
|
|
162
|
-
{isGuest && !address && (
|
|
163
|
-
<FlexBox justifyContent="center" mb={2}>
|
|
164
|
-
<Paragraph color={(theme) => theme.palette.error.main}>
|
|
165
|
-
{t("guestCartAddressWarning")}
|
|
166
|
-
</Paragraph>
|
|
167
|
-
</FlexBox>
|
|
168
|
-
)}
|
|
169
|
-
<Box component="form" onSubmit={handleSubmit(onFormSubmit)}>
|
|
170
|
-
<Grid container spacing={3}>
|
|
171
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
172
|
-
<TextField
|
|
173
|
-
{...register("name")}
|
|
174
|
-
label={t("name")}
|
|
175
|
-
fullWidth
|
|
176
|
-
error={!!errors.name}
|
|
177
|
-
helperText={errors.name?.message}
|
|
178
|
-
/>
|
|
179
|
-
</Grid>
|
|
180
|
-
|
|
181
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
182
|
-
<TextField
|
|
183
|
-
{...register("street")}
|
|
184
|
-
label={t("street")}
|
|
185
|
-
fullWidth
|
|
186
|
-
error={!!errors.street}
|
|
187
|
-
helperText={errors.street?.message}
|
|
188
|
-
/>
|
|
189
|
-
</Grid>
|
|
190
|
-
|
|
191
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
192
|
-
<TextField
|
|
193
|
-
{...register("city")}
|
|
194
|
-
label={t("city")}
|
|
195
|
-
fullWidth
|
|
196
|
-
error={!!errors.city}
|
|
197
|
-
helperText={errors.city?.message}
|
|
198
|
-
/>
|
|
199
|
-
</Grid>
|
|
200
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
201
|
-
<FormControl fullWidth size={"small"} error={!!errors.country}>
|
|
202
|
-
<InputLabel id="country-label">{t("country")}</InputLabel>
|
|
203
|
-
<Controller
|
|
204
|
-
name="country"
|
|
205
|
-
control={control}
|
|
206
|
-
render={({ field: { value } }) => (
|
|
207
|
-
<Select
|
|
208
|
-
labelId="country-label"
|
|
209
|
-
value={value}
|
|
210
|
-
onChange={(e) => {
|
|
211
|
-
const cid = e.target.value as string;
|
|
212
|
-
const sel =
|
|
213
|
-
countries.find((c) => c.CountryRegionId === cid) ||
|
|
214
|
-
null;
|
|
215
|
-
setSelectedCountry(sel);
|
|
216
|
-
}}
|
|
217
|
-
>
|
|
218
|
-
<MenuItem value="">Select country</MenuItem>
|
|
219
|
-
{countries.map((c) => (
|
|
220
|
-
<MenuItem
|
|
221
|
-
key={c.CountryRegionId}
|
|
222
|
-
value={c.CountryRegionId}
|
|
223
|
-
>
|
|
224
|
-
{c.ShortName}
|
|
225
|
-
</MenuItem>
|
|
226
|
-
))}
|
|
227
|
-
</Select>
|
|
228
|
-
)}
|
|
229
|
-
/>
|
|
230
|
-
</FormControl>
|
|
231
|
-
</Grid>
|
|
232
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
233
|
-
<FormControl fullWidth size={"small"} error={!!errors.state}>
|
|
234
|
-
<InputLabel id="state-label">{t("state")}</InputLabel>
|
|
235
|
-
<Controller
|
|
236
|
-
name="state"
|
|
237
|
-
control={control}
|
|
238
|
-
render={({ field: { value, onChange } }) => (
|
|
239
|
-
<Select
|
|
240
|
-
labelId="state-label"
|
|
241
|
-
value={value}
|
|
242
|
-
onChange={onChange}
|
|
243
|
-
>
|
|
244
|
-
<MenuItem value="0">Select a state</MenuItem>
|
|
245
|
-
{states &&
|
|
246
|
-
states.length > 0 &&
|
|
247
|
-
states.map(({ StateName, StateId }) => (
|
|
248
|
-
<MenuItem key={StateId} value={StateId}>
|
|
249
|
-
{StateName}
|
|
250
|
-
</MenuItem>
|
|
251
|
-
))}
|
|
252
|
-
</Select>
|
|
253
|
-
)}
|
|
254
|
-
/>
|
|
255
|
-
</FormControl>
|
|
256
|
-
</Grid>
|
|
257
|
-
|
|
258
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
259
|
-
<TextField
|
|
260
|
-
{...register("zipCode")}
|
|
261
|
-
label={t("zipCode")}
|
|
262
|
-
fullWidth
|
|
263
|
-
error={!!errors.zipCode}
|
|
264
|
-
helperText={errors.zipCode?.message}
|
|
265
|
-
/>
|
|
266
|
-
</Grid>
|
|
267
|
-
|
|
268
|
-
<Grid size={{ sm: 6, xs: 12 }}>
|
|
269
|
-
<TextField
|
|
270
|
-
{...register("phone")}
|
|
271
|
-
label={t("phone")}
|
|
272
|
-
fullWidth
|
|
273
|
-
error={!!errors.phone}
|
|
274
|
-
helperText={errors.phone?.message}
|
|
275
|
-
/>
|
|
276
|
-
</Grid>
|
|
277
|
-
<Grid
|
|
278
|
-
size={{ sm: 6, xs: 12 }}
|
|
279
|
-
display="flex"
|
|
280
|
-
justifyContent="space-around"
|
|
281
|
-
>
|
|
282
|
-
<Button
|
|
283
|
-
type="submit"
|
|
284
|
-
color="primary"
|
|
285
|
-
variant="contained"
|
|
286
|
-
data-testid="new-address-btn"
|
|
287
|
-
>
|
|
288
|
-
{t("save")}
|
|
289
|
-
</Button>
|
|
290
|
-
<Button onClick={handleClose} color="primary" variant="outlined">
|
|
291
|
-
{t("cancel")}
|
|
292
|
-
</Button>
|
|
293
|
-
</Grid>
|
|
294
|
-
</Grid>
|
|
295
|
-
</Box>
|
|
296
|
-
</DialogContent>
|
|
297
|
-
</Dialog>
|
|
298
|
-
);
|
|
299
|
-
}
|
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
Container,
|
|
7
|
-
Table,
|
|
8
|
-
TableBody,
|
|
9
|
-
TableCell,
|
|
10
|
-
TableContainer,
|
|
11
|
-
TableHead,
|
|
12
|
-
TableRow,
|
|
13
|
-
} from "@mui/material";
|
|
14
|
-
import QuickOrderRow, { QuickOrderRowData } from "./quick-order-row";
|
|
15
|
-
import { useCallback, useEffect, useState } from "react";
|
|
16
|
-
import { ProductSearchResult } from "@msdyn365-commerce/retail-proxy";
|
|
17
|
-
import useSearchProducts from "@/api-manager/services/product/mutations/search-products";
|
|
18
|
-
import { BorderShadowCard } from "@evenicanpm/storefront-core/src/components-v2/BoxShadowCard";
|
|
19
|
-
import {
|
|
20
|
-
H2,
|
|
21
|
-
Span,
|
|
22
|
-
} from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
23
|
-
import useAddToCart from "@/api-manager/services/cart/mutations/add-to-cart";
|
|
24
|
-
import OrderUpload, { OrderUploadItem } from "./order-upload";
|
|
25
|
-
import { useTranslations } from "next-intl";
|
|
26
|
-
import getCart from "@/api-manager/services/cart/queries/get-cart";
|
|
27
|
-
|
|
28
|
-
export enum RowError {
|
|
29
|
-
ProductNotFound,
|
|
30
|
-
InvalidQuantity,
|
|
31
|
-
OutOfStock,
|
|
32
|
-
None,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default function QuickOrderForm() {
|
|
36
|
-
const [rows, setRows] = useState<QuickOrderRowData[]>([]);
|
|
37
|
-
const { mutateAsync: searchProducts } = useSearchProducts();
|
|
38
|
-
const { mutateAsync: addToCart } = useAddToCart();
|
|
39
|
-
const { data: cart } = getCart.useData();
|
|
40
|
-
|
|
41
|
-
const t = useTranslations("QuickOrder");
|
|
42
|
-
|
|
43
|
-
const _generateEmptyRow = (id: number) => {
|
|
44
|
-
return {
|
|
45
|
-
id,
|
|
46
|
-
value: "",
|
|
47
|
-
quantity: "1",
|
|
48
|
-
product: null,
|
|
49
|
-
rowError: RowError.None,
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// initialize the table with 3 empty rows
|
|
54
|
-
const _tableInit = useCallback(() => {
|
|
55
|
-
const numEmptyRows = 3;
|
|
56
|
-
const rows: QuickOrderRowData[] = [];
|
|
57
|
-
for (let i = 0; i < numEmptyRows; i++) {
|
|
58
|
-
rows.push(_generateEmptyRow(i + 1));
|
|
59
|
-
}
|
|
60
|
-
setRows(rows);
|
|
61
|
-
}, []);
|
|
62
|
-
|
|
63
|
-
const _handleRowDelete = (id: number) => {
|
|
64
|
-
const currentRows = [...rows];
|
|
65
|
-
const idx = currentRows.findIndex((r) => r.id === id);
|
|
66
|
-
if (idx > -1) {
|
|
67
|
-
currentRows.splice(idx, 1);
|
|
68
|
-
const newRowId = currentRows[currentRows.length - 1].id + 1;
|
|
69
|
-
if (currentRows.length < 3) {
|
|
70
|
-
currentRows.push(_generateEmptyRow(newRowId));
|
|
71
|
-
}
|
|
72
|
-
setRows(currentRows);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const _handleRowUpdate = async (
|
|
77
|
-
id: number,
|
|
78
|
-
value: string,
|
|
79
|
-
quantity: string,
|
|
80
|
-
) => {
|
|
81
|
-
const currentRows = [...rows];
|
|
82
|
-
const idx = currentRows.findIndex((row) => row.id === id);
|
|
83
|
-
|
|
84
|
-
// if value changes and is beyond the min characters, do a search for the product
|
|
85
|
-
let product = currentRows[idx].product;
|
|
86
|
-
let foundProduct = false;
|
|
87
|
-
if (currentRows[idx].value !== value) {
|
|
88
|
-
currentRows[idx].value = value;
|
|
89
|
-
const response = await searchProductByRow(id, value);
|
|
90
|
-
product = (response && response[0]) || null;
|
|
91
|
-
}
|
|
92
|
-
foundProduct = !!product;
|
|
93
|
-
currentRows[idx] = _generateRowData(
|
|
94
|
-
product,
|
|
95
|
-
id,
|
|
96
|
-
value,
|
|
97
|
-
foundProduct,
|
|
98
|
-
quantity,
|
|
99
|
-
);
|
|
100
|
-
setRows(currentRows);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const searchProductByRow = async (_id: number, searchText: string) => {
|
|
104
|
-
// call getProductSearchResults with a single entry in an array
|
|
105
|
-
const minQueryLength = 5;
|
|
106
|
-
let response;
|
|
107
|
-
if (searchText.length >= minQueryLength) {
|
|
108
|
-
response = await getProductSearchResults([searchText]);
|
|
109
|
-
}
|
|
110
|
-
return response;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const getProductSearchResults = useCallback(
|
|
114
|
-
async (itemIds: string[]) => {
|
|
115
|
-
// API call to retrieve matching products from database
|
|
116
|
-
const results = await searchProducts({ itemIds });
|
|
117
|
-
return results;
|
|
118
|
-
},
|
|
119
|
-
[searchProducts],
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
const searchProductsMultiple = useCallback(
|
|
123
|
-
async (itemIds: string[]) => {
|
|
124
|
-
// call getProductSearchResults for all item ids
|
|
125
|
-
let response;
|
|
126
|
-
const minQueryLength = 5;
|
|
127
|
-
const validItemIds = itemIds.filter((it) => it.length >= minQueryLength);
|
|
128
|
-
if (validItemIds) {
|
|
129
|
-
response = await getProductSearchResults(validItemIds);
|
|
130
|
-
}
|
|
131
|
-
return response;
|
|
132
|
-
},
|
|
133
|
-
[getProductSearchResults],
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
const _generateRowData = useCallback(
|
|
137
|
-
(
|
|
138
|
-
product: ProductSearchResult | null,
|
|
139
|
-
rowId: number,
|
|
140
|
-
searchText: string,
|
|
141
|
-
foundProduct: boolean,
|
|
142
|
-
quantity: string,
|
|
143
|
-
) => {
|
|
144
|
-
let rowError = RowError.None;
|
|
145
|
-
if (
|
|
146
|
-
Number.isNaN(Number(quantity)) ||
|
|
147
|
-
Number(quantity) < 1 ||
|
|
148
|
-
!Number.isInteger(Number(quantity))
|
|
149
|
-
) {
|
|
150
|
-
rowError = RowError.InvalidQuantity;
|
|
151
|
-
} else if (!foundProduct) {
|
|
152
|
-
rowError = RowError.ProductNotFound;
|
|
153
|
-
}
|
|
154
|
-
// TODO: Out of Stock
|
|
155
|
-
const row: QuickOrderRowData = {
|
|
156
|
-
..._generateEmptyRow(rowId),
|
|
157
|
-
product: foundProduct ? product : null,
|
|
158
|
-
value: searchText,
|
|
159
|
-
quantity: quantity.toString(),
|
|
160
|
-
rowError: rowError,
|
|
161
|
-
};
|
|
162
|
-
return row;
|
|
163
|
-
},
|
|
164
|
-
[],
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
const _handleAddRows = () => {
|
|
168
|
-
const currentRows = [...rows];
|
|
169
|
-
|
|
170
|
-
const maxRowId = currentRows.reduce(
|
|
171
|
-
(max, row) => (row.id > max ? row.id : max),
|
|
172
|
-
0,
|
|
173
|
-
);
|
|
174
|
-
const newRowId = maxRowId + 1;
|
|
175
|
-
currentRows.push(_generateEmptyRow(newRowId));
|
|
176
|
-
currentRows.push(_generateEmptyRow(newRowId + 1));
|
|
177
|
-
|
|
178
|
-
setRows(currentRows);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const _generateFile = () => {
|
|
182
|
-
if (rows.length === 0) return;
|
|
183
|
-
|
|
184
|
-
const header = "SKU,Quantity\n";
|
|
185
|
-
|
|
186
|
-
// parse data into CSV format
|
|
187
|
-
const csvContent =
|
|
188
|
-
"data:text/csv;charset=utf-8," +
|
|
189
|
-
header +
|
|
190
|
-
rows.map(({ value, quantity }) => `${value},${quantity}`).join("\n");
|
|
191
|
-
const encodedUri = encodeURI(csvContent);
|
|
192
|
-
const link = document.createElement("a");
|
|
193
|
-
link.setAttribute("href", encodedUri);
|
|
194
|
-
link.setAttribute("download", "quick_order.csv");
|
|
195
|
-
document.body.appendChild(link);
|
|
196
|
-
link.click();
|
|
197
|
-
document.body.removeChild(link);
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const _generateRow = (row: QuickOrderRowData, isLast: boolean) => {
|
|
201
|
-
return (
|
|
202
|
-
<QuickOrderRow
|
|
203
|
-
key={row.id}
|
|
204
|
-
id={row.id}
|
|
205
|
-
value={row.value}
|
|
206
|
-
quantity={row.quantity}
|
|
207
|
-
product={row.product}
|
|
208
|
-
onRowDelete={_handleRowDelete}
|
|
209
|
-
onRowChange={_handleRowUpdate}
|
|
210
|
-
onAddRows={_handleAddRows}
|
|
211
|
-
isLastRow={isLast}
|
|
212
|
-
rowError={row.rowError}
|
|
213
|
-
/>
|
|
214
|
-
);
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
const handleAddToCart = async () => {
|
|
218
|
-
// add all rows that have a RowError of type None with requested quantities
|
|
219
|
-
if (!cart) return;
|
|
220
|
-
|
|
221
|
-
const products = rows
|
|
222
|
-
.filter((row) => row.product && row.rowError === RowError.None)
|
|
223
|
-
.map((productRow) => ({
|
|
224
|
-
ProductId: Number(productRow.product?.RecordId),
|
|
225
|
-
Quantity: Number(productRow.quantity),
|
|
226
|
-
}));
|
|
227
|
-
if (products.length > 0) {
|
|
228
|
-
await addToCart({
|
|
229
|
-
cartId: cart.Id,
|
|
230
|
-
version: cart.Version,
|
|
231
|
-
cartLine: products,
|
|
232
|
-
});
|
|
233
|
-
_tableInit();
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
const handleUploadedItems = useCallback(
|
|
238
|
-
async (items: OrderUploadItem[]) => {
|
|
239
|
-
const itemIds = items.map((it) => it.itemId.toString());
|
|
240
|
-
const response = await searchProductsMultiple(itemIds);
|
|
241
|
-
|
|
242
|
-
// add items to table
|
|
243
|
-
let currRows = [...rows];
|
|
244
|
-
const idx = currRows.findIndex((r) => !r.value);
|
|
245
|
-
if (idx > -1) {
|
|
246
|
-
currRows = currRows.slice(0, idx);
|
|
247
|
-
}
|
|
248
|
-
let rowId =
|
|
249
|
-
currRows.reduce((max, row) => (row.id > max ? row.id : max), 0) + 1;
|
|
250
|
-
|
|
251
|
-
items.forEach((it) => {
|
|
252
|
-
const product = response?.find((r) => {
|
|
253
|
-
const itemId = it.itemId.toString().toLowerCase();
|
|
254
|
-
const searchText = r.ItemId?.toLowerCase();
|
|
255
|
-
return itemId === searchText;
|
|
256
|
-
});
|
|
257
|
-
const qty = it.qty || 1;
|
|
258
|
-
const rowData = _generateRowData(
|
|
259
|
-
product || null,
|
|
260
|
-
rowId++,
|
|
261
|
-
it.itemId,
|
|
262
|
-
!!product,
|
|
263
|
-
qty.toString(),
|
|
264
|
-
);
|
|
265
|
-
currRows.push(rowData);
|
|
266
|
-
});
|
|
267
|
-
while (currRows.length < 3) {
|
|
268
|
-
currRows.push({ ..._generateEmptyRow(rowId++) });
|
|
269
|
-
}
|
|
270
|
-
setRows(currRows);
|
|
271
|
-
},
|
|
272
|
-
[_generateRowData, rows, searchProductsMultiple],
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
useEffect(() => {
|
|
276
|
-
_tableInit();
|
|
277
|
-
}, [_tableInit]);
|
|
278
|
-
|
|
279
|
-
return (
|
|
280
|
-
<Container>
|
|
281
|
-
<BorderShadowCard>
|
|
282
|
-
<FlexBox justifyContent="left" px={3}>
|
|
283
|
-
<H2>{t("title")}</H2>
|
|
284
|
-
</FlexBox>
|
|
285
|
-
<FlexBox justifyContent="left" px={3}>
|
|
286
|
-
<Span>{t("entryBySku")}</Span>
|
|
287
|
-
</FlexBox>
|
|
288
|
-
</BorderShadowCard>
|
|
289
|
-
<BorderShadowCard sx={{ padding: 0 }}>
|
|
290
|
-
<TableContainer sx={{ borderRadius: "4px" }}>
|
|
291
|
-
<Table>
|
|
292
|
-
<TableHead sx={{ backgroundColor: "#323337" }}>
|
|
293
|
-
<TableRow>
|
|
294
|
-
<TableCell sx={{ color: "white", width: { xs: "30%" } }}>
|
|
295
|
-
{t("Table.itemNo")}
|
|
296
|
-
</TableCell>
|
|
297
|
-
<TableCell sx={{ color: "white", width: { xs: "20%" } }}>
|
|
298
|
-
{t("Table.quantity")}
|
|
299
|
-
</TableCell>
|
|
300
|
-
<TableCell sx={{ color: "white" }}>
|
|
301
|
-
{t("Table.itemName")}
|
|
302
|
-
</TableCell>
|
|
303
|
-
<TableCell
|
|
304
|
-
sx={{
|
|
305
|
-
color: "white",
|
|
306
|
-
display: { xs: "none", sm: "table-cell" },
|
|
307
|
-
}}
|
|
308
|
-
>
|
|
309
|
-
{t("Table.price")}
|
|
310
|
-
</TableCell>
|
|
311
|
-
<TableCell sx={{ color: "white" }}>
|
|
312
|
-
{t("Table.delete")}
|
|
313
|
-
</TableCell>
|
|
314
|
-
</TableRow>
|
|
315
|
-
</TableHead>
|
|
316
|
-
<TableBody>
|
|
317
|
-
{rows.map((r, i) => _generateRow(r, i === rows.length - 1))}
|
|
318
|
-
</TableBody>
|
|
319
|
-
</Table>
|
|
320
|
-
</TableContainer>
|
|
321
|
-
</BorderShadowCard>
|
|
322
|
-
<BorderShadowCard>
|
|
323
|
-
<FlexBox sx={{ justifyContent: "center", gap: { xs: 2, sm: 20 } }}>
|
|
324
|
-
<Button
|
|
325
|
-
variant="contained"
|
|
326
|
-
color="secondary"
|
|
327
|
-
onClick={handleAddToCart}
|
|
328
|
-
>
|
|
329
|
-
{t("addToCartBtn")}
|
|
330
|
-
</Button>
|
|
331
|
-
<Button variant="contained" color="secondary" onClick={_tableInit}>
|
|
332
|
-
{t("resetFormBtn")}
|
|
333
|
-
</Button>
|
|
334
|
-
<Button variant="contained" color="secondary" onClick={_generateFile}>
|
|
335
|
-
{t("downloadFileBtn")}
|
|
336
|
-
</Button>
|
|
337
|
-
</FlexBox>
|
|
338
|
-
</BorderShadowCard>
|
|
339
|
-
<BorderShadowCard>
|
|
340
|
-
<FlexBox justifyContent="center" gap={2} flexDirection="column" px={2}>
|
|
341
|
-
<OrderUpload onUploadItems={handleUploadedItems} />
|
|
342
|
-
</FlexBox>
|
|
343
|
-
</BorderShadowCard>
|
|
344
|
-
</Container>
|
|
345
|
-
);
|
|
346
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/cms/blocks/{Icons/Components/DottedStar.tsx → icons/components/dotted-star.tsx}
RENAMED
|
File without changes
|
/package/src/cms/blocks/{Icons/Components/FallbackIcon.tsx → icons/components/fallback-icon.tsx}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/cms/blocks/{Icons/Components/NewArrival.tsx → icons/components/new-arrival.tsx}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|