@evenicanpm/storefront-core 1.0.0-alpha
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/README.md +40 -0
- package/package.json +36 -0
- package/src/api-manager/README.md +38 -0
- package/src/api-manager/api-manager.config.json +12 -0
- package/src/api-manager/datasources/README.md +17 -0
- package/src/api-manager/datasources/d365/d365-address.datasource.ts +141 -0
- package/src/api-manager/datasources/d365/d365-base.datasource.ts +8 -0
- package/src/api-manager/datasources/d365/d365-cart.datasource.ts +374 -0
- package/src/api-manager/datasources/d365/d365-categories.datasource.ts +40 -0
- package/src/api-manager/datasources/d365/d365-order.datasource.ts +69 -0
- package/src/api-manager/datasources/d365/d365-organization.datasource.ts +92 -0
- package/src/api-manager/datasources/d365/d365-product.datasource.ts +272 -0
- package/src/api-manager/datasources/d365/d365-session.datasource.ts +25 -0
- package/src/api-manager/datasources/d365/d365-user.datasource.ts +132 -0
- package/src/api-manager/datasources/d365/d365.datasource.ts +45 -0
- package/src/api-manager/datasources/d365/index.ts +4 -0
- package/src/api-manager/datasources/d365/test-context.ts +30 -0
- package/src/api-manager/datasources/d365/utils/create-search-criteria.ts +17 -0
- package/src/api-manager/datasources/d365/utils/decode-jwt.ts +11 -0
- package/src/api-manager/datasources/d365/utils/get-context-cookie.ts +37 -0
- package/src/api-manager/datasources/d365/utils/parse-object.ts +9 -0
- package/src/api-manager/datasources/d365/utils/product-images-utils.ts +43 -0
- package/src/api-manager/datasources/d365/utils/product-inventory-utils.ts +37 -0
- package/src/api-manager/datasources/e4/e4-address.datasource.ts +107 -0
- package/src/api-manager/datasources/e4/e4-cart.datasource.ts +248 -0
- package/src/api-manager/datasources/e4/e4-order.datasource.ts +43 -0
- package/src/api-manager/datasources/e4/e4-organization.datasource.ts +19 -0
- package/src/api-manager/datasources/e4/e4-product.datasource.ts +157 -0
- package/src/api-manager/datasources/e4/e4-session.datasource.ts +43 -0
- package/src/api-manager/datasources/e4/e4-user.datasource.ts +118 -0
- package/src/api-manager/datasources/e4/e4.datasource.ts +55 -0
- package/src/api-manager/datasources/e4/e4.remaps.ts +331 -0
- package/src/api-manager/datasources/e4/e4.translator.test.ts +202 -0
- package/src/api-manager/datasources/e4/e4.translator.ts +648 -0
- package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +43515 -0
- package/src/api-manager/datasources/e4/utils/unwrap-e4-variants.ts +65 -0
- package/src/api-manager/index.ts +71 -0
- package/src/api-manager/lib/cart-cookie-handler.ts +14 -0
- package/src/api-manager/lib/category-helpers.ts +113 -0
- package/src/api-manager/lib/get-dynamics-context.ts +34 -0
- package/src/api-manager/lib/get-graphql-client.test.ts +106 -0
- package/src/api-manager/lib/get-graphql-client.ts +53 -0
- package/src/api-manager/schemas/README.md +12 -0
- package/src/api-manager/schemas/address.schema.ts +46 -0
- package/src/api-manager/schemas/cart.schema.ts +92 -0
- package/src/api-manager/schemas/d365.schema.ts +7727 -0
- package/src/api-manager/schemas/order.schema.ts +30 -0
- package/src/api-manager/schemas/organization.schema.ts +32 -0
- package/src/api-manager/schemas/product.schema.ts +140 -0
- package/src/api-manager/schemas/session.schema.ts +17 -0
- package/src/api-manager/schemas/user.schema.ts +14 -0
- package/src/api-manager/services/address/mutations/create-address.ts +22 -0
- package/src/api-manager/services/address/mutations/delete-address.ts +21 -0
- package/src/api-manager/services/address/mutations/get-delivery-options.ts +22 -0
- package/src/api-manager/services/address/mutations/update-address.ts +21 -0
- package/src/api-manager/services/address/queries/get-countries.ts +16 -0
- package/src/api-manager/services/address/queries/get-states.ts +16 -0
- package/src/api-manager/services/cart/mutations/add-discount-code.ts +21 -0
- package/src/api-manager/services/cart/mutations/add-to-cart.ts +53 -0
- package/src/api-manager/services/cart/mutations/checkout.ts +11 -0
- package/src/api-manager/services/cart/mutations/delete-cart-line.ts +18 -0
- package/src/api-manager/services/cart/mutations/get-payment-accept-result.ts +20 -0
- package/src/api-manager/services/cart/mutations/remove-cart-line-delivery-mode.ts +24 -0
- package/src/api-manager/services/cart/mutations/remove-discount-code.ts +21 -0
- package/src/api-manager/services/cart/mutations/update-cart-line-delivery-mode.ts +24 -0
- package/src/api-manager/services/cart/mutations/update-cart-lines.ts +21 -0
- package/src/api-manager/services/cart/mutations/update-cart.ts +21 -0
- package/src/api-manager/services/cart/queries/get-cart.ts +12 -0
- package/src/api-manager/services/cart/queries/get-payment-accept-point.ts +18 -0
- package/src/api-manager/services/categories/queries/get-categories.ts +8 -0
- package/src/api-manager/services/create-mutation.ts +65 -0
- package/src/api-manager/services/create-query.ts +305 -0
- package/src/api-manager/services/get-query-client.ts +40 -0
- package/src/api-manager/services/order/queries/get-order-details.ts +17 -0
- package/src/api-manager/services/order/queries/get-orders.ts +14 -0
- package/src/api-manager/services/organization/queries/get-channel-configuration.ts +14 -0
- package/src/api-manager/services/organization/queries/get-stores.ts +17 -0
- package/src/api-manager/services/product/mutations/search-products.ts +23 -0
- package/src/api-manager/services/product/queries/get-product-availability.ts +15 -0
- package/src/api-manager/services/product/queries/get-product-by-id.ts +17 -0
- package/src/api-manager/services/product/queries/get-product-by-ids.ts +14 -0
- package/src/api-manager/services/product/queries/get-product-list.ts +16 -0
- package/src/api-manager/services/product/queries/get-related-products.ts +14 -0
- package/src/api-manager/services/product/queries/search-products.ts +10 -0
- package/src/api-manager/services/product/server/product.server.ts +13 -0
- package/src/api-manager/services/session/mutations/session-init.ts +22 -0
- package/src/api-manager/services/session/mutations/session-logout.ts +18 -0
- package/src/api-manager/services/session/queries/get-session.ts +10 -0
- package/src/api-manager/services/user/mutations/create-wishlist.ts +21 -0
- package/src/api-manager/services/user/mutations/delete-wishlist.ts +17 -0
- package/src/api-manager/services/user/mutations/update-user.ts +18 -0
- package/src/api-manager/services/user/queries/get-user-counts.ts +10 -0
- package/src/api-manager/services/user/queries/get-user.ts +10 -0
- package/src/api-manager/services/user/queries/get-wishlist-details.ts +10 -0
- package/src/api-manager/services/user/queries/get-wishlists.ts +10 -0
- package/src/api-manager/types/Datasource.ts +197 -0
- package/src/auth/auth-options.test.ts +127 -0
- package/src/auth/auth-options.ts +68 -0
- package/src/auth/msal.ts +65 -0
- package/src/auth/next-auth-cookie-manager.ts +86 -0
- package/src/auth/providers/aadb2c-provider.ts +33 -0
- package/src/auth/providers/authentik-provider.ts +24 -0
- package/src/auth/providers/index.ts +9 -0
- package/src/auth/providers/keycloak-provider.ts +22 -0
- package/src/auth/refresh-token-url-keys.ts +6 -0
- package/src/auth/refresh-token.ts +134 -0
- package/src/auth/signout.ts +46 -0
- package/src/auth/types/next-auth.d.ts +38 -0
- package/src/cms/blog.ts +229 -0
- package/src/cms/endpoints.ts +76 -0
- package/src/cms/interfaces/navigation.ts +52 -0
- package/src/cms/interfaces/productData.ts +83 -0
- package/src/cms/pages.ts +149 -0
- package/src/components/Blocks/BlockManager.tsx +67 -0
- package/src/components/Blocks/Components/BrandLogosScroller.tsx +72 -0
- package/src/components/Blocks/Components/CategoryCard.tsx +47 -0
- package/src/components/Blocks/Components/CategoryCarousel/index.tsx +60 -0
- package/src/components/Blocks/Components/FeaturePill.tsx +99 -0
- package/src/components/Blocks/Components/FeaturedCategories.tsx +41 -0
- package/src/components/Blocks/Components/FeaturedProducts.tsx +41 -0
- package/src/components/Blocks/Components/Footer.tsx +77 -0
- package/src/components/Blocks/Components/Hero.tsx +73 -0
- package/src/components/Blocks/Components/HeroCarousel/index.tsx +42 -0
- package/src/components/Blocks/Components/Image.tsx +39 -0
- package/src/components/Blocks/Components/MediaCard.tsx +41 -0
- package/src/components/Blocks/Components/ProductCarousel/index.tsx +82 -0
- package/src/components/Blocks/Components/ProductSectionFullWidth/index.tsx +103 -0
- package/src/components/Blocks/Components/RichText.tsx +19 -0
- package/src/components/Blocks/Components/Seo/index.tsx +48 -0
- package/src/components/Blocks/Components/Services/index.tsx +21 -0
- package/src/components/Blocks/Components/Services/service-card.tsx +70 -0
- package/src/components/Blocks/Components/shared/featured-product-card.tsx +29 -0
- package/src/components/Blocks/Components/shared/product-category-item.tsx +49 -0
- package/src/components/Blocks/Components/shared/product-grid.tsx +48 -0
- package/src/components/Blocks/Components/shared/top-categories-card.tsx +66 -0
- package/src/components/Blocks/Components/shared/top-rating-product-card.tsx +63 -0
- package/src/components/Blocks/Icons/Components/Category.tsx +14 -0
- package/src/components/Blocks/Icons/Components/DottedStar.tsx +40 -0
- package/src/components/Blocks/Icons/Components/FallbackIcon.tsx +33 -0
- package/src/components/Blocks/Icons/Components/GiftBox.tsx +18 -0
- package/src/components/Blocks/Icons/Components/Light.tsx +13 -0
- package/src/components/Blocks/Icons/Components/NewArrival.tsx +18 -0
- package/src/components/Blocks/Icons/Components/RankBadge.tsx +39 -0
- package/src/components/Blocks/Icons/index.ts +32 -0
- package/src/components/Blocks/index.tsx +16 -0
- package/src/components/Blocks/interfaces.ts +240 -0
- package/src/components/BoxShadowCard.tsx +16 -0
- package/src/components/Footer/data/index.ts +32 -0
- package/src/components/Footer/index.tsx +88 -0
- package/src/components/Footer/interfaces.ts +37 -0
- package/src/components/Footer/sections/FooterAppStore.tsx +45 -0
- package/src/components/Footer/sections/FooterContact.tsx +36 -0
- package/src/components/Footer/sections/FooterLinks.tsx +30 -0
- package/src/components/Footer/sections/FooterLogo.tsx +26 -0
- package/src/components/Footer/sections/FooterSocialLinks.tsx +70 -0
- package/src/components/Footer/styles/index.ts +39 -0
- package/src/components/GlobalLoading/index.tsx +102 -0
- package/src/components/ImageWithFallback.tsx +51 -0
- package/src/components/Loading/index.tsx +36 -0
- package/src/components/NavProvider/index.tsx +59 -0
- package/src/components/NavProvider/utils/createLink.ts +15 -0
- package/src/components/Notifications/README.md +15 -0
- package/src/components/Notifications/notification-context.tsx +82 -0
- package/src/components/Notifications/use-notification.ts +12 -0
- package/src/components/README.md +9 -0
- package/src/components/ReactQueryProvider/index.tsx +12 -0
- package/src/components/Shared/Image.tsx +5 -0
- package/src/components/T/index.tsx +15 -0
- package/src/components/_components/BazaarCard.tsx +21 -0
- package/src/components/_components/BazaarImage.tsx +12 -0
- package/src/components/_components/BazaarMenu.tsx +47 -0
- package/src/components/_components/BazaarSwitch.tsx +37 -0
- package/src/components/_components/BazaarTextField.tsx +73 -0
- package/src/components/_components/DropZone.tsx +86 -0
- package/src/components/_components/HoverBox.tsx +22 -0
- package/src/components/_components/LazyImage.tsx +9 -0
- package/src/components/_components/MiniCartClient.tsx +65 -0
- package/src/components/_components/SearchInput.tsx +28 -0
- package/src/components/_components/SnackbarProvider.tsx +32 -0
- package/src/components/_components/Typography.tsx +227 -0
- package/src/components/_components/WhiteButton.tsx +20 -0
- package/src/components/_components/accordion/accordion-header.tsx +43 -0
- package/src/components/_components/accordion/index.ts +1 -0
- package/src/components/_components/bazaar-types.ts +84 -0
- package/src/components/_components/carousel/carousel.tsx +72 -0
- package/src/components/_components/carousel/components/carousel-arrows.tsx +60 -0
- package/src/components/_components/carousel/components/carousel-dots.tsx +21 -0
- package/src/components/_components/carousel/index.ts +3 -0
- package/src/components/_components/carousel/styles/index.ts +93 -0
- package/src/components/_components/carousel-cards/carousel-card-1/carousel-card-1.tsx +64 -0
- package/src/components/_components/carousel-cards/carousel-card-1/index.ts +1 -0
- package/src/components/_components/carousel-cards/carousel-card-1/styles.ts +34 -0
- package/src/components/_components/carousel-cards/carousel-card-2/carousel-card-2.tsx +73 -0
- package/src/components/_components/carousel-cards/carousel-card-2/index.ts +1 -0
- package/src/components/_components/carousel-cards/carousel-card-2/styles.ts +26 -0
- package/src/components/_components/carousel-cards/carousel-card-3/carousel-card-3.tsx +34 -0
- package/src/components/_components/carousel-cards/carousel-card-3/index.ts +1 -0
- package/src/components/_components/carousel-cards/carousel-card-3/styles.ts +28 -0
- package/src/components/_components/carousel-cards/carousel-card-4/carousel-card-4.tsx +76 -0
- package/src/components/_components/carousel-cards/carousel-card-4/index.ts +1 -0
- package/src/components/_components/carousel-cards/carousel-card-4/styles.ts +27 -0
- package/src/components/_components/categories/category-list/category-list.tsx +59 -0
- package/src/components/_components/categories/category-list/index.ts +1 -0
- package/src/components/_components/categories/category-list/styles.ts +29 -0
- package/src/components/_components/categories/category-list/types.ts +4 -0
- package/src/components/_components/categories/category-list-item/category-menu-item.tsx +37 -0
- package/src/components/_components/categories/category-list-item/index.ts +1 -0
- package/src/components/_components/categories/category-list-item/styles.ts +35 -0
- package/src/components/_components/categories/category-menu.tsx +51 -0
- package/src/components/_components/categories/mega-menu/banner.tsx +56 -0
- package/src/components/_components/categories/mega-menu/column-list.tsx +70 -0
- package/src/components/_components/categories/mega-menu/mega-menu-1.tsx +37 -0
- package/src/components/_components/categories/mega-menu/mega-menu-2.tsx +37 -0
- package/src/components/_components/categories/mega-menu/styles.ts +25 -0
- package/src/components/_components/categories/types.ts +16 -0
- package/src/components/_components/category-cards/category-card-1/category-card-1.tsx +21 -0
- package/src/components/_components/category-cards/category-card-1/index.ts +1 -0
- package/src/components/_components/category-cards/category-card-1/styles.ts +37 -0
- package/src/components/_components/countdown/count-box.tsx +16 -0
- package/src/components/_components/countdown/count-down.tsx +24 -0
- package/src/components/_components/countdown/index.tsx +2 -0
- package/src/components/_components/countdown/useCountDown.ts +41 -0
- package/src/components/_components/data-table/index.ts +2 -0
- package/src/components/_components/data-table/table-header.tsx +91 -0
- package/src/components/_components/data-table/table-pagination.tsx +36 -0
- package/src/components/_components/flex-box/flex-between.tsx +14 -0
- package/src/components/_components/flex-box/flex-box.tsx +9 -0
- package/src/components/_components/flex-box/flex-row-center.tsx +9 -0
- package/src/components/_components/flex-box/index.ts +5 -0
- package/src/components/_components/footer/components/about-links.tsx +23 -0
- package/src/components/_components/footer/components/app-store.tsx +38 -0
- package/src/components/_components/footer/components/customer-care-links.tsx +21 -0
- package/src/components/_components/footer/components/logo.tsx +23 -0
- package/src/components/_components/footer/components/social-links.tsx +43 -0
- package/src/components/_components/footer/data/index.ts +54 -0
- package/src/components/_components/footer/footer-1.tsx +62 -0
- package/src/components/_components/footer/footer-2.tsx +57 -0
- package/src/components/_components/footer/footer-3.tsx +53 -0
- package/src/components/_components/footer/footer-4.tsx +71 -0
- package/src/components/_components/footer/index.ts +4 -0
- package/src/components/_components/footer/styles/index.ts +42 -0
- package/src/components/_components/header/components/categories-menu.tsx +23 -0
- package/src/components/_components/header/components/mobile-header.tsx +72 -0
- package/src/components/_components/header/components/user.test.tsx +200 -0
- package/src/components/_components/header/components/user.tsx +205 -0
- package/src/components/_components/header/header.tsx +63 -0
- package/src/components/_components/header/hooks/use-header.ts +13 -0
- package/src/components/_components/header/index.ts +1 -0
- package/src/components/_components/header/sticky-header.tsx +17 -0
- package/src/components/_components/header/styles/index.ts +24 -0
- package/src/components/_components/hooks/useOverflowDetect.ts +34 -0
- package/src/components/_components/hooks/useSettings.ts +16 -0
- package/src/components/_components/icons/cart-bag.tsx +13 -0
- package/src/components/_components/icons/category-outline.tsx +29 -0
- package/src/components/_components/icons/category.tsx +12 -0
- package/src/components/_components/icons/home.tsx +19 -0
- package/src/components/_components/icons/search.tsx +13 -0
- package/src/components/_components/icons/shopping-bag-outlined.tsx +13 -0
- package/src/components/_components/icons/up-down.tsx +21 -0
- package/src/components/_components/icons/user.tsx +13 -0
- package/src/components/_components/icons/user2.tsx +14 -0
- package/src/components/_components/mini-cart/__tests__/cart-item.test.tsx +174 -0
- package/src/components/_components/mini-cart/__tests__/mini-cart.test.tsx +121 -0
- package/src/components/_components/mini-cart/__tests__/test-cart-empty.json +84 -0
- package/src/components/_components/mini-cart/__tests__/test-cart-with-item.json +244 -0
- package/src/components/_components/mini-cart/components/bottom-actions.tsx +27 -0
- package/src/components/_components/mini-cart/components/cart-item.tsx +144 -0
- package/src/components/_components/mini-cart/components/empty-view.tsx +29 -0
- package/src/components/_components/mini-cart/components/top-header.tsx +34 -0
- package/src/components/_components/mini-cart/index.ts +1 -0
- package/src/components/_components/mini-cart/mini-cart.tsx +107 -0
- package/src/components/_components/mobile-navigation/index.ts +3 -0
- package/src/components/_components/mobile-navigation/mobile-navigation-bar.tsx +73 -0
- package/src/components/_components/mobile-navigation/styles/index.ts +63 -0
- package/src/components/_components/nav-link/index.ts +5 -0
- package/src/components/_components/nav-link/nav-link-2.tsx +32 -0
- package/src/components/_components/nav-link/nav-link-3.tsx +67 -0
- package/src/components/_components/nav-link/nav-link.tsx +53 -0
- package/src/components/_components/navbar/categories.tsx +27 -0
- package/src/components/_components/navbar/category-based-menu/category-based-menu.tsx +52 -0
- package/src/components/_components/navbar/category-based-menu/components/categories.tsx +44 -0
- package/src/components/_components/navbar/category-based-menu/components/category-item.tsx +31 -0
- package/src/components/_components/navbar/category-based-menu/components/child-categories.tsx +38 -0
- package/src/components/_components/navbar/category-based-menu/index.ts +1 -0
- package/src/components/_components/navbar/category-based-menu/styles.ts +81 -0
- package/src/components/_components/navbar/category-based-menu/types.ts +18 -0
- package/src/components/_components/navbar/index.ts +1 -0
- package/src/components/_components/navbar/mega-menu/category-list.tsx +29 -0
- package/src/components/_components/navbar/mega-menu/index.ts +1 -0
- package/src/components/_components/navbar/mega-menu/mega-menu.tsx +71 -0
- package/src/components/_components/navbar/mega-menu/styles.ts +43 -0
- package/src/components/_components/navbar/mobile-menu/index.ts +1 -0
- package/src/components/_components/navbar/mobile-menu/mobile-menu.tsx +70 -0
- package/src/components/_components/navbar/mobile-menu/render-levels.test.tsx +71 -0
- package/src/components/_components/navbar/mobile-menu/render-levels.tsx +62 -0
- package/src/components/_components/navbar/nav-list/cms-nav.test.tsx +84 -0
- package/src/components/_components/navbar/nav-list/index.ts +1 -0
- package/src/components/_components/navbar/nav-list/nav-item-child.tsx +66 -0
- package/src/components/_components/navbar/nav-list/nav-list.tsx +119 -0
- package/src/components/_components/navbar/navbar.tsx +43 -0
- package/src/components/_components/navbar/styles.ts +90 -0
- package/src/components/_components/navbar/utils/transform-nav.test.ts +209 -0
- package/src/components/_components/navbar/utils/transform-nav.ts +43 -0
- package/src/components/_components/newsletter/index.ts +1 -0
- package/src/components/_components/newsletter/newsletter.tsx +108 -0
- package/src/components/_components/newsletter/social-icons.tsx +35 -0
- package/src/components/_components/newsletter/styles.ts +65 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/components/link-item.tsx +21 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/components/list-item.tsx +27 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/components/nav-accordion.tsx +36 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/components/render-child.tsx +26 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/grocery-side-nav.tsx +32 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/index.ts +1 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/styles/index.ts +11 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/list-item.tsx +27 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/nav-accordion.tsx +44 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/render-child.tsx +20 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/health-beauty-side-nav.tsx +43 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/index.ts +1 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/styles/index.ts +27 -0
- package/src/components/_components/page-sidenav/side-navbar/components/list-item.tsx +25 -0
- package/src/components/_components/page-sidenav/side-navbar/components/nav-accordion.tsx +46 -0
- package/src/components/_components/page-sidenav/side-navbar/components/render-child.tsx +20 -0
- package/src/components/_components/page-sidenav/side-navbar/index.ts +1 -0
- package/src/components/_components/page-sidenav/side-navbar/side-nav-bar.tsx +77 -0
- package/src/components/_components/page-sidenav/side-navbar/styles/index.ts +73 -0
- package/src/components/_components/page-sidenav/side-navbar-2/components/button-content.tsx +32 -0
- package/src/components/_components/page-sidenav/side-navbar-2/components/sidebar-accordion.tsx +66 -0
- package/src/components/_components/page-sidenav/side-navbar-2/index.ts +1 -0
- package/src/components/_components/page-sidenav/side-navbar-2/side-navbar-2.tsx +63 -0
- package/src/components/_components/page-sidenav/side-navbar-2/styles/index.ts +68 -0
- package/src/components/_components/product-cards/discount-chip.tsx +43 -0
- package/src/components/_components/product-cards/product-card-1/components/hover-actions.tsx +37 -0
- package/src/components/_components/product-cards/product-card-1/components/quantity-buttons.tsx +56 -0
- package/src/components/_components/product-cards/product-card-1/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-1/product-card.tsx +146 -0
- package/src/components/_components/product-cards/product-card-1/styles/index.ts +46 -0
- package/src/components/_components/product-cards/product-card-10/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-10/product-card.tsx +124 -0
- package/src/components/_components/product-cards/product-card-10/styles/index.ts +38 -0
- package/src/components/_components/product-cards/product-card-11/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-11/product-card.tsx +63 -0
- package/src/components/_components/product-cards/product-card-11/styles/index.ts +16 -0
- package/src/components/_components/product-cards/product-card-12/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-12/product-card.tsx +42 -0
- package/src/components/_components/product-cards/product-card-12/styles/index.ts +16 -0
- package/src/components/_components/product-cards/product-card-13/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-13/product-card.tsx +45 -0
- package/src/components/_components/product-cards/product-card-13/styles/index.ts +25 -0
- package/src/components/_components/product-cards/product-card-14/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-14/product-card.tsx +122 -0
- package/src/components/_components/product-cards/product-card-14/styles/index.ts +40 -0
- package/src/components/_components/product-cards/product-card-15/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-15/product-card.tsx +118 -0
- package/src/components/_components/product-cards/product-card-15/styles/index.ts +57 -0
- package/src/components/_components/product-cards/product-card-16/components/quantity-buttons.tsx +56 -0
- package/src/components/_components/product-cards/product-card-16/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-16/product-card.tsx +114 -0
- package/src/components/_components/product-cards/product-card-16/styles/index.ts +18 -0
- package/src/components/_components/product-cards/product-card-2/components/favorite-button.tsx +29 -0
- package/src/components/_components/product-cards/product-card-2/components/product-price.tsx +26 -0
- package/src/components/_components/product-cards/product-card-2/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-2/product-card.tsx +70 -0
- package/src/components/_components/product-cards/product-card-3/components/hover-actions.tsx +83 -0
- package/src/components/_components/product-cards/product-card-3/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-3/product-card.tsx +110 -0
- package/src/components/_components/product-cards/product-card-3/styles/index.ts +89 -0
- package/src/components/_components/product-cards/product-card-4/components/hover-actions.tsx +50 -0
- package/src/components/_components/product-cards/product-card-4/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-4/product-card.tsx +128 -0
- package/src/components/_components/product-cards/product-card-4/styles/index.ts +66 -0
- package/src/components/_components/product-cards/product-card-5/components/button-actions.tsx +49 -0
- package/src/components/_components/product-cards/product-card-5/components/hover-actions.tsx +50 -0
- package/src/components/_components/product-cards/product-card-5/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-5/product-card.tsx +137 -0
- package/src/components/_components/product-cards/product-card-5/styles/index.ts +94 -0
- package/src/components/_components/product-cards/product-card-6/components/hover-actions.tsx +50 -0
- package/src/components/_components/product-cards/product-card-6/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-6/product-card.tsx +121 -0
- package/src/components/_components/product-cards/product-card-6/styles/index.ts +63 -0
- package/src/components/_components/product-cards/product-card-7/components/product-status.tsx +18 -0
- package/src/components/_components/product-cards/product-card-7/components/quantity-buttons.tsx +47 -0
- package/src/components/_components/product-cards/product-card-7/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-7/product-card.tsx +136 -0
- package/src/components/_components/product-cards/product-card-7/styles/index.ts +98 -0
- package/src/components/_components/product-cards/product-card-8/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-8/product-card.tsx +133 -0
- package/src/components/_components/product-cards/product-card-8/styles/index.ts +51 -0
- package/src/components/_components/product-cards/product-card-9/components/add-to-cart.tsx +60 -0
- package/src/components/_components/product-cards/product-card-9/components/favorite-button.tsx +27 -0
- package/src/components/_components/product-cards/product-card-9/components/tags.tsx +33 -0
- package/src/components/_components/product-cards/product-card-9/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-9/product-card.tsx +169 -0
- package/src/components/_components/product-cards/product-price.tsx +26 -0
- package/src/components/_components/product-cards/product-rating.tsx +28 -0
- package/src/components/_components/product-cards/product-title.tsx +24 -0
- package/src/components/_components/product-cards/use-product.ts +35 -0
- package/src/components/_components/products-view/product-view-dialog.tsx +180 -0
- package/src/components/_components/products-view/products-grid-view.tsx +39 -0
- package/src/components/_components/products-view/products-list-view.tsx +35 -0
- package/src/components/_components/progress/index.ts +1 -0
- package/src/components/_components/progress/progress.tsx +77 -0
- package/src/components/_components/scrollbar/index.ts +1 -0
- package/src/components/_components/scrollbar/scrollbar.tsx +27 -0
- package/src/components/_components/scrollbar/styles.ts +15 -0
- package/src/components/_components/search-box/components/category-dropdown.tsx +61 -0
- package/src/components/_components/search-box/components/search-result.tsx +29 -0
- package/src/components/_components/search-box/hooks/use-search.ts +63 -0
- package/src/components/_components/search-box/index.ts +2 -0
- package/src/components/_components/search-box/search-input-category.test.tsx +110 -0
- package/src/components/_components/search-box/search-input-category.tsx +104 -0
- package/src/components/_components/search-box/search-input.test.tsx +41 -0
- package/src/components/_components/search-box/search-input.tsx +64 -0
- package/src/components/_components/search-box/styles/index.ts +45 -0
- package/src/components/_components/section-header/index.ts +2 -0
- package/src/components/_components/section-header/section-creator.tsx +28 -0
- package/src/components/_components/section-header/section-header.tsx +44 -0
- package/src/components/_components/service-cards/icon-component.tsx +18 -0
- package/src/components/_components/service-cards/service-card-1/index.ts +1 -0
- package/src/components/_components/service-cards/service-card-1/service-card-1.tsx +39 -0
- package/src/components/_components/service-cards/service-card-2/index.ts +1 -0
- package/src/components/_components/service-cards/service-card-2/service-card-2.tsx +34 -0
- package/src/components/_components/service-cards/service-card-3/index.ts +1 -0
- package/src/components/_components/service-cards/service-card-3/service-card-3.tsx +25 -0
- package/src/components/_components/service-cards/service-card-3/styles.ts +23 -0
- package/src/components/_components/settings/index.ts +1 -0
- package/src/components/_components/settings/setting.tsx +141 -0
- package/src/components/_components/settings/styles.ts +57 -0
- package/src/components/_components/shop-card/index.ts +1 -0
- package/src/components/_components/shop-card/shop-card.tsx +152 -0
- package/src/components/_components/shop-card/styles.ts +33 -0
- package/src/components/_components/side-nav/index.ts +1 -0
- package/src/components/_components/side-nav/side-nav.tsx +49 -0
- package/src/components/_components/site-logo.tsx +17 -0
- package/src/components/_components/sticky/Sticky.tsx +62 -0
- package/src/components/_components/sticky/index.ts +1 -0
- package/src/components/_components/sticky/styles.ts +38 -0
- package/src/components/_components/sticky-wrapper/index.ts +1 -0
- package/src/components/_components/sticky-wrapper/sticky-wrapper.tsx +21 -0
- package/src/components/_components/sticky-wrapper/styles.ts +25 -0
- package/src/components/_components/stories/story-content/index.ts +1 -0
- package/src/components/_components/stories/story-content/story-content.tsx +28 -0
- package/src/components/_components/stories/story-content/styles.ts +22 -0
- package/src/components/_components/stories/story-item/index.ts +1 -0
- package/src/components/_components/stories/story-item/story-item.tsx +24 -0
- package/src/components/_components/stories/story-item/styles.ts +11 -0
- package/src/components/_components/stories/story-viewer/index.ts +1 -0
- package/src/components/_components/stories/story-viewer/story-viewer.tsx +44 -0
- package/src/components/_components/stories/story-viewer/styles.ts +15 -0
- package/src/components/_components/subscribe-input/index.ts +1 -0
- package/src/components/_components/subscribe-input/styles.ts +14 -0
- package/src/components/_components/subscribe-input/subscribe-input.tsx +43 -0
- package/src/components/_components/topbar/index.ts +1 -0
- package/src/components/_components/topbar/styles.ts +55 -0
- package/src/components/_components/topbar/top-bar.tsx +112 -0
- package/src/components/_components/utils/constants.ts +8 -0
- package/src/components/countries-input.tsx +78 -0
- package/src/config.ts +47 -0
- package/src/lib/build-detail-url.ts +8 -0
- package/src/lib/build-product-detail-url.ts +12 -0
- package/src/lib/cart-cookie-client-handler.ts +12 -0
- package/src/lib/cart-cookie-handler.ts +14 -0
- package/src/lib/category-helpers.ts +113 -0
- package/src/lib/create-graphql-client.ts +32 -0
- package/src/lib/currency-formatter.ts +31 -0
- package/src/lib/get-palette-color.ts +50 -0
- package/src/lib/graphqlRequestSdk.ts +41234 -0
- package/src/lib/hexToLuma.ts +55 -0
- package/src/lib/lib.ts +61 -0
- package/src/lib/map-helper.ts +71 -0
- package/src/lib/page-slugs.ts +10 -0
- package/src/lib/refiner-utils.ts +32 -0
- package/src/lib/store-hours-helper.ts +274 -0
- package/src/lib/test-media.ts +23 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import {
|
|
3
|
+
salesLineSchema,
|
|
4
|
+
salesOrderSchema,
|
|
5
|
+
searchLocationSchema,
|
|
6
|
+
simpleProductSchema,
|
|
7
|
+
} from "./d365.schema";
|
|
8
|
+
|
|
9
|
+
const getSalesOrderDetailsInput = z.object({
|
|
10
|
+
transactionId: z.string(),
|
|
11
|
+
searchLocation: searchLocationSchema.optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const salesOrderInput = z.object({
|
|
15
|
+
id: z.string(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const extendedSalesLineSchema = salesLineSchema.extend({
|
|
19
|
+
Product: simpleProductSchema.optional(),
|
|
20
|
+
});
|
|
21
|
+
const extendedSalesOrderSchema = salesOrderSchema
|
|
22
|
+
.omit({ SalesLines: true })
|
|
23
|
+
.extend({ SalesLines: extendedSalesLineSchema.array().optional() });
|
|
24
|
+
|
|
25
|
+
export type GetSalesOrderDetailsInput = z.infer<
|
|
26
|
+
typeof getSalesOrderDetailsInput
|
|
27
|
+
>;
|
|
28
|
+
export type SalesOrderInput = z.infer<typeof salesOrderInput>;
|
|
29
|
+
export type SalesOrder = z.infer<typeof extendedSalesOrderSchema>;
|
|
30
|
+
export type SalesLine = z.infer<typeof extendedSalesLineSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
channelConfigurationSchema,
|
|
3
|
+
deliveryModeTypeFilterSchema,
|
|
4
|
+
deliveryOptionSchema,
|
|
5
|
+
orgUnitLocationSchema,
|
|
6
|
+
queryResultSettingsSchema,
|
|
7
|
+
searchAreaSchema,
|
|
8
|
+
storeHoursSchema,
|
|
9
|
+
} from "./d365.schema";
|
|
10
|
+
import z from "zod";
|
|
11
|
+
|
|
12
|
+
const getOrgUnitLocationsByAreaInput = z.object({
|
|
13
|
+
queryResultSettings: queryResultSettingsSchema,
|
|
14
|
+
searchArea: searchAreaSchema,
|
|
15
|
+
deliveryModeTypeFilter: deliveryModeTypeFilterSchema.optional(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const orgUnitLocationReturnType = z.object({
|
|
19
|
+
location: orgUnitLocationSchema,
|
|
20
|
+
storeHours: storeHoursSchema,
|
|
21
|
+
pickupOptions: deliveryOptionSchema.array().optional(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type OrgUnitLocation = z.infer<typeof orgUnitLocationSchema>;
|
|
25
|
+
export type OrgUnitLocationReturnType = z.infer<
|
|
26
|
+
typeof orgUnitLocationReturnType
|
|
27
|
+
>;
|
|
28
|
+
export type GetOrgUnitLocationsByAreaInput = z.infer<
|
|
29
|
+
typeof getOrgUnitLocationsByAreaInput
|
|
30
|
+
>;
|
|
31
|
+
export type ChannelConfiguration = z.infer<typeof channelConfigurationSchema>;
|
|
32
|
+
export type DeliveryOptionsSchema = z.infer<typeof deliveryOptionSchema>;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import {
|
|
3
|
+
categorySchema,
|
|
4
|
+
commercePropertySchema,
|
|
5
|
+
productRefinerSchema,
|
|
6
|
+
productSearchResultSchema,
|
|
7
|
+
queryResultSettingsSchema,
|
|
8
|
+
searchAreaSchema,
|
|
9
|
+
} from "./d365.schema";
|
|
10
|
+
import {
|
|
11
|
+
AttributeValue,
|
|
12
|
+
ProductDimensionValueInventoryAvailability,
|
|
13
|
+
SimpleProduct,
|
|
14
|
+
ProductRefinerValue,
|
|
15
|
+
} from "@msdyn365-commerce/retail-proxy";
|
|
16
|
+
|
|
17
|
+
// e4 review
|
|
18
|
+
const reviewSchema = z.object({
|
|
19
|
+
Body: z.string().optional(),
|
|
20
|
+
Rating: z.number().optional(),
|
|
21
|
+
Title: z.string().optional(),
|
|
22
|
+
Created: z.string().optional(),
|
|
23
|
+
ProductId: z.string().optional(),
|
|
24
|
+
ContactId: z.string().optional(),
|
|
25
|
+
contact: z
|
|
26
|
+
.object({
|
|
27
|
+
firstName: z.string().optional(),
|
|
28
|
+
lastName: z.string().optional(),
|
|
29
|
+
})
|
|
30
|
+
.optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Using this schema instead of the
|
|
35
|
+
* D365 schema to avoid unnecessary properties
|
|
36
|
+
* that are not provided by the E4 API.
|
|
37
|
+
* Add properties as needed.
|
|
38
|
+
*/
|
|
39
|
+
export const productSchema = z.object({
|
|
40
|
+
ItemId: z.string(), // sku?
|
|
41
|
+
RecordId: z.number(),
|
|
42
|
+
Name: z.string(),
|
|
43
|
+
Price: z.number().optional(),
|
|
44
|
+
BasePrice: z.number().optional(),
|
|
45
|
+
Description: z.string().optional(),
|
|
46
|
+
PrimaryImageUrl: z.string().or(z.null()).optional(), // adding a null for nextjs/image component
|
|
47
|
+
Variants: z.array(z.any()).optional(),
|
|
48
|
+
// required by E4
|
|
49
|
+
UnitOfMeasureId: z.string().optional(),
|
|
50
|
+
// ItemCode: z.string().optional(), // a SKU, does D365 have something like this? Keeping separate for now.
|
|
51
|
+
Reviews: z.array(reviewSchema).optional(),
|
|
52
|
+
categoryFilter: z.string().optional(),
|
|
53
|
+
ExtensionProperties: z.array(commercePropertySchema).optional(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const productWCategorySchema = productSchema.extend({
|
|
57
|
+
Category: categorySchema.optional(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const getProductByIdInput = z.object({
|
|
61
|
+
id: z.number().or(z.string()),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const getRelatedProductsInput = z.object({
|
|
65
|
+
id: z.number(),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const getProductByIdsInput = z.object({
|
|
69
|
+
id: z.union([z.number().array(), z.string().array()]),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const getDimensionsInput = z.object({
|
|
73
|
+
id: z.number(),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const searchProductsInput = z.object({
|
|
77
|
+
searchText: z.string().optional(),
|
|
78
|
+
category: z.number().optional(),
|
|
79
|
+
itemIds: z.string().array().optional(),
|
|
80
|
+
});
|
|
81
|
+
export const searchByCriteriaInput = z.object({
|
|
82
|
+
categoryId: z.number().optional(),
|
|
83
|
+
searchState: z.object({
|
|
84
|
+
queryResultSettings: queryResultSettingsSchema,
|
|
85
|
+
refinement: z.custom<ProductRefinerValue>().array(),
|
|
86
|
+
searchTerm: z.string().optional(),
|
|
87
|
+
}),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export const categoryFilterInput = z.object({
|
|
91
|
+
categoryId: z.number(),
|
|
92
|
+
searchState: z.any().optional(),
|
|
93
|
+
categoryFilterString: z.string().optional(),
|
|
94
|
+
pageSize: z.number().optional(),
|
|
95
|
+
currentPage: z.number().optional(),
|
|
96
|
+
sort: z
|
|
97
|
+
.object({
|
|
98
|
+
field: z.string(),
|
|
99
|
+
direction: z.string(),
|
|
100
|
+
})
|
|
101
|
+
.optional(),
|
|
102
|
+
refiners: z.number().array().optional(),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const searchByCriteriaResponse = z.object({
|
|
106
|
+
products: productSearchResultSchema.array(),
|
|
107
|
+
refiners: productRefinerSchema.array(),
|
|
108
|
+
count: z.number(),
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const InventorySearchCriteriaInput = z.object({
|
|
112
|
+
searchCriteria: z.object({
|
|
113
|
+
defaultWarehouseOnly: z.boolean(),
|
|
114
|
+
productIds: z.number().array(),
|
|
115
|
+
searchArea: searchAreaSchema.optional(),
|
|
116
|
+
}),
|
|
117
|
+
allDimensionsSelected: z.boolean(),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// entities
|
|
121
|
+
export type Product = z.infer<typeof productSchema>;
|
|
122
|
+
export type ProductDetails = SimpleProduct & {
|
|
123
|
+
DimensionValues: ProductDimensionValueInventoryAvailability[][];
|
|
124
|
+
Attributes: AttributeValue[];
|
|
125
|
+
Images: string[];
|
|
126
|
+
};
|
|
127
|
+
export type ProductWCategory = z.infer<typeof productWCategorySchema>;
|
|
128
|
+
export type Review = z.infer<typeof reviewSchema>;
|
|
129
|
+
// inputs
|
|
130
|
+
export type GetProductByIdInput = z.infer<typeof getProductByIdInput>;
|
|
131
|
+
export type GetProductByIdsInput = z.infer<typeof getProductByIdsInput>;
|
|
132
|
+
export type searchProductsInput = z.infer<typeof searchProductsInput>;
|
|
133
|
+
export type GetRelatedProductsInput = z.infer<typeof getRelatedProductsInput>;
|
|
134
|
+
export type CategoryFilterInput = z.infer<typeof categoryFilterInput>;
|
|
135
|
+
export type GetDimensionsInput = z.infer<typeof getDimensionsInput>;
|
|
136
|
+
export type SearchByCriteriaInput = z.infer<typeof searchByCriteriaInput>;
|
|
137
|
+
export type SearchByCriteriaResponse = z.infer<typeof searchByCriteriaResponse>;
|
|
138
|
+
export type InventorySearchCriteriaInput = z.infer<
|
|
139
|
+
typeof InventorySearchCriteriaInput
|
|
140
|
+
>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { extendedCartSchema } from "./cart.schema";
|
|
3
|
+
import { extendedCustomerSchema } from "./user.schema";
|
|
4
|
+
|
|
5
|
+
export const sessionSchema = z.object({
|
|
6
|
+
Id: z.string().optional(),
|
|
7
|
+
User: extendedCustomerSchema.optional(),
|
|
8
|
+
Cart: extendedCartSchema.optional(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const sessionInitInput = z.object({
|
|
12
|
+
accessToken: z.string(),
|
|
13
|
+
email: z.string(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type Session = z.infer<typeof sessionSchema>;
|
|
17
|
+
export type SessionInitInput = z.infer<typeof sessionInitInput>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { customerSchema } from "./d365.schema";
|
|
3
|
+
|
|
4
|
+
export const userCountsSchema = z.object({
|
|
5
|
+
orderCount: z.number().optional(),
|
|
6
|
+
addressCount: z.number().optional(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const extendedCustomerSchema = customerSchema.extend({
|
|
10
|
+
DefaultShippingAddressId: z.string().optional(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type User = z.infer<typeof extendedCustomerSchema>;
|
|
14
|
+
export type UserCounts = z.infer<typeof userCountsSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Address } from "@/api-manager/schemas/address.schema";
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { createApiPath } from "../../create-query";
|
|
4
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
5
|
+
|
|
6
|
+
const apiPath = createApiPath("address", "createAddress");
|
|
7
|
+
|
|
8
|
+
const useCreateAddress = () => {
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
|
|
11
|
+
return useCreateMutation<Address, Address>(apiPath, {
|
|
12
|
+
onSuccess: () => {
|
|
13
|
+
queryClient.invalidateQueries({ queryKey: ["me"] });
|
|
14
|
+
queryClient.invalidateQueries({ queryKey: ["user-counts"] });
|
|
15
|
+
},
|
|
16
|
+
onError: (error) => {
|
|
17
|
+
console.error("Failed to create address:", error);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default useCreateAddress;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { createApiPath } from "../../create-query";
|
|
3
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
4
|
+
|
|
5
|
+
const apiPath = createApiPath("address", "deleteAddress");
|
|
6
|
+
|
|
7
|
+
const useDeleteAddress = () => {
|
|
8
|
+
const queryClient = useQueryClient();
|
|
9
|
+
|
|
10
|
+
return useCreateMutation<string, void>(apiPath, {
|
|
11
|
+
onSuccess: () => {
|
|
12
|
+
queryClient.invalidateQueries({ queryKey: ["me"] });
|
|
13
|
+
queryClient.invalidateQueries({ queryKey: ["user-counts"] });
|
|
14
|
+
},
|
|
15
|
+
onError: (error) => {
|
|
16
|
+
console.error("Failed to delete address:", error);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default useDeleteAddress;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DeliveryOption } from "@msdyn365-commerce/retail-proxy";
|
|
2
|
+
import { GetDeliveryOptionsInput } from "@/api-manager/schemas/address.schema";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { createApiPath } from "../../create-query";
|
|
5
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
6
|
+
|
|
7
|
+
const apiPath = createApiPath("address", "getDeliveryOptions");
|
|
8
|
+
|
|
9
|
+
const useGetDeliveryOptions = () => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
|
|
12
|
+
return useCreateMutation<GetDeliveryOptionsInput, DeliveryOption[]>(apiPath, {
|
|
13
|
+
onSuccess: (result, input) => {
|
|
14
|
+
queryClient.setQueryData(["deliveryOptions", input], result);
|
|
15
|
+
},
|
|
16
|
+
onError: (error) => {
|
|
17
|
+
console.error("Failed to fetch delivery options:", error);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default useGetDeliveryOptions;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Address } from "@/api-manager/schemas/address.schema";
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { createApiPath } from "../../create-query";
|
|
4
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
5
|
+
|
|
6
|
+
const apiPath = createApiPath("address", "updateAddress");
|
|
7
|
+
|
|
8
|
+
const useUpdateAddress = () => {
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
|
|
11
|
+
return useCreateMutation<Address, Address>(apiPath, {
|
|
12
|
+
onSuccess: () => {
|
|
13
|
+
queryClient.invalidateQueries({ queryKey: ["me"] });
|
|
14
|
+
},
|
|
15
|
+
onError: (error) => {
|
|
16
|
+
console.error("Failed to update address:", error);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default useUpdateAddress;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createQuery } from "../../create-query";
|
|
2
|
+
import { GetCountriesInput } from "@/api-manager/schemas/address.schema";
|
|
3
|
+
import { CountryRegionInfo } from "@msdyn365-commerce/retail-proxy";
|
|
4
|
+
import { createApiPath } from "../../create-query";
|
|
5
|
+
|
|
6
|
+
const apiPath = createApiPath("address", "getCountries");
|
|
7
|
+
const config = {
|
|
8
|
+
queryKey: "countries",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const getCountries = createQuery<GetCountriesInput, CountryRegionInfo[]>(
|
|
12
|
+
apiPath,
|
|
13
|
+
config,
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default getCountries;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GetStatesInput } from "@/api-manager/schemas/address.schema";
|
|
2
|
+
import { StateProvinceInfo } from "@msdyn365-commerce/retail-proxy";
|
|
3
|
+
import { createQuery, createApiPath } from "../../create-query";
|
|
4
|
+
|
|
5
|
+
const apiPath = createApiPath("address", "getStates");
|
|
6
|
+
const config = {
|
|
7
|
+
queryKey: "states",
|
|
8
|
+
disablePropertis: ["countryId"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const getStates = createQuery<GetStatesInput, StateProvinceInfo[]>(
|
|
12
|
+
apiPath,
|
|
13
|
+
config,
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default getStates;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ManageDiscountCodeInput,
|
|
3
|
+
Cart,
|
|
4
|
+
} from "@/api-manager/schemas/cart.schema";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import getCart from "../queries/get-cart";
|
|
7
|
+
import { createApiPath } from "../../create-query";
|
|
8
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
9
|
+
|
|
10
|
+
const apiPath = createApiPath("cart", "addDiscountCode");
|
|
11
|
+
|
|
12
|
+
const useAddDiscountCode = () => {
|
|
13
|
+
const queryClient = useQueryClient();
|
|
14
|
+
return useCreateMutation<ManageDiscountCodeInput, Cart>(apiPath, {
|
|
15
|
+
onSuccess: async (result) => {
|
|
16
|
+
await getCart.setQueryData(queryClient, result);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default useAddDiscountCode;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AddToCartInput, Cart } from "@/api-manager/schemas/cart.schema";
|
|
2
|
+
import { useNotification } from "@/components/Notifications/use-notification";
|
|
3
|
+
import { useTranslations } from "next-intl";
|
|
4
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
5
|
+
import getCart from "../queries/get-cart";
|
|
6
|
+
import { createApiPath } from "../../create-query";
|
|
7
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
8
|
+
|
|
9
|
+
const apiPath = createApiPath("cart", "addToCart");
|
|
10
|
+
|
|
11
|
+
const useAddToCart = () => {
|
|
12
|
+
const { setNotification } = useNotification();
|
|
13
|
+
const t = useTranslations("Cart.Messages");
|
|
14
|
+
const queryClient = useQueryClient();
|
|
15
|
+
|
|
16
|
+
return useCreateMutation<AddToCartInput, Cart>(apiPath, {
|
|
17
|
+
onSuccess: async (result, input) => {
|
|
18
|
+
await getCart.setQueryData(queryClient, result);
|
|
19
|
+
|
|
20
|
+
// Handle single cart line
|
|
21
|
+
if (input.cartLine.length === 1) {
|
|
22
|
+
const cartLine = result?.CartLines?.find(
|
|
23
|
+
(line) => line.ItemId === input.cartLine[0].ItemId,
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (cartLine) {
|
|
27
|
+
setNotification({
|
|
28
|
+
message: t("cartAddSuccess", { item: cartLine?.Product?.Name }),
|
|
29
|
+
severity: "success",
|
|
30
|
+
type: "cart",
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Handle multiple cart lines
|
|
37
|
+
setNotification({
|
|
38
|
+
message: t("cartAddSuccessMulti", { count: input.cartLine.length }),
|
|
39
|
+
severity: "success",
|
|
40
|
+
type: "cart",
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
onError: () => {
|
|
44
|
+
setNotification({
|
|
45
|
+
message: t("cartAddError"),
|
|
46
|
+
severity: "error",
|
|
47
|
+
type: "cart",
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default useAddToCart;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Cart, CheckoutInput } from "@/api-manager/schemas/cart.schema";
|
|
2
|
+
import { createApiPath } from "../../create-query";
|
|
3
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
4
|
+
|
|
5
|
+
const apiPath = createApiPath("cart", "checkout");
|
|
6
|
+
|
|
7
|
+
const useCheckout = () => {
|
|
8
|
+
return useCreateMutation<CheckoutInput, Cart>(apiPath);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default useCheckout;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Cart, DeleteCartLineInput } from "@/api-manager/schemas/cart.schema";
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import getCart from "../queries/get-cart";
|
|
4
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
5
|
+
import { createApiPath } from "../../create-query";
|
|
6
|
+
|
|
7
|
+
const apiPath = createApiPath("cart", "deleteCartLine");
|
|
8
|
+
|
|
9
|
+
const useDeleteCartLine = () => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useCreateMutation<DeleteCartLineInput, Cart>(apiPath, {
|
|
12
|
+
onSuccess: async (result) => {
|
|
13
|
+
await getCart.setQueryData(queryClient, result);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default useDeleteCartLine;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CardPaymentAcceptResult } from "@msdyn365-commerce/retail-proxy";
|
|
2
|
+
import { RetrieveCardPaymentAcceptResultInput } from "@/api-manager/schemas/cart.schema";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { createApiPath } from "../../create-query";
|
|
5
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
6
|
+
|
|
7
|
+
const apiPath = createApiPath("cart", "retrieveCardPaymentAcceptResult");
|
|
8
|
+
const usePaymentAcceptResult = () => {
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
return useCreateMutation<
|
|
11
|
+
RetrieveCardPaymentAcceptResultInput,
|
|
12
|
+
CardPaymentAcceptResult
|
|
13
|
+
>(apiPath, {
|
|
14
|
+
onSuccess: (result, input) => {
|
|
15
|
+
queryClient.setQueryData(["paymentAcceptResult", input.cartId], result);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default usePaymentAcceptResult;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Cart,
|
|
3
|
+
RemoveCartLineDeliveryModeInput,
|
|
4
|
+
} from "@/api-manager/schemas/cart.schema";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import getCart from "../queries/get-cart";
|
|
7
|
+
import { createApiPath } from "../../create-query";
|
|
8
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
9
|
+
|
|
10
|
+
const apiPath = createApiPath("cart", "removeLineDeliveryMode");
|
|
11
|
+
|
|
12
|
+
const useRemoveCartLineDeliveryMode = () => {
|
|
13
|
+
const queryClient = useQueryClient();
|
|
14
|
+
return useCreateMutation<RemoveCartLineDeliveryModeInput, Cart>(apiPath, {
|
|
15
|
+
onSuccess: async (result) => {
|
|
16
|
+
await getCart.setQueryData(queryClient, result);
|
|
17
|
+
},
|
|
18
|
+
onError: (error) => {
|
|
19
|
+
console.error(error);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default useRemoveCartLineDeliveryMode;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Cart,
|
|
3
|
+
ManageDiscountCodeInput,
|
|
4
|
+
} from "@/api-manager/schemas/cart.schema";
|
|
5
|
+
import getCart from "../queries/get-cart";
|
|
6
|
+
import { createApiPath } from "../../create-query";
|
|
7
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
8
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
|
|
10
|
+
const apiPath = createApiPath("cart", "removeDiscountcode");
|
|
11
|
+
|
|
12
|
+
const useRemoveDiscountcode = () => {
|
|
13
|
+
const queryClient = useQueryClient();
|
|
14
|
+
return useCreateMutation<ManageDiscountCodeInput, Cart>(apiPath, {
|
|
15
|
+
onSuccess: async (result) => {
|
|
16
|
+
await getCart.setQueryData(queryClient, result);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default useRemoveDiscountcode;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Cart,
|
|
3
|
+
UpdateCartLineDeliveryModeInput,
|
|
4
|
+
} from "@/api-manager/schemas/cart.schema";
|
|
5
|
+
import getCart from "../queries/get-cart";
|
|
6
|
+
import { createApiPath } from "../../create-query";
|
|
7
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
8
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
|
|
10
|
+
const apiPath = createApiPath("cart", "updateLineDeliveryMode");
|
|
11
|
+
|
|
12
|
+
const useUpdateCartLineDeliveryMode = () => {
|
|
13
|
+
const queryClient = useQueryClient();
|
|
14
|
+
return useCreateMutation<UpdateCartLineDeliveryModeInput, Cart>(apiPath, {
|
|
15
|
+
onSuccess: async (result) => {
|
|
16
|
+
await getCart.setQueryData(queryClient, result);
|
|
17
|
+
},
|
|
18
|
+
onError: (error) => {
|
|
19
|
+
console.error("Failed to update cart line delivery mode:", error);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default useUpdateCartLineDeliveryMode;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UpdateCartLineInput, Cart } from "@/api-manager/schemas/cart.schema";
|
|
2
|
+
import getCart from "../queries/get-cart";
|
|
3
|
+
import { createApiPath } from "../../create-query";
|
|
4
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
|
|
7
|
+
const apiPath = createApiPath("cart", "updateCartLines");
|
|
8
|
+
|
|
9
|
+
const useUpdateCartLines = () => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useCreateMutation<UpdateCartLineInput, Cart>(apiPath, {
|
|
12
|
+
onSuccess: async (result) => {
|
|
13
|
+
await getCart.setQueryData(queryClient, result);
|
|
14
|
+
},
|
|
15
|
+
onError: (error) => {
|
|
16
|
+
console.error("Failed to update cart lines:", error);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default useUpdateCartLines;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Cart, UpdateCartInput } from "@/api-manager/schemas/cart.schema";
|
|
2
|
+
import getCart from "../queries/get-cart";
|
|
3
|
+
import { createApiPath } from "../../create-query";
|
|
4
|
+
import { useCreateMutation } from "../../create-mutation";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
|
|
7
|
+
const apiPath = createApiPath("cart", "updateCart");
|
|
8
|
+
|
|
9
|
+
const useUpdateCart = () => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useCreateMutation<UpdateCartInput, Cart>(apiPath, {
|
|
12
|
+
onSuccess: async (result) => {
|
|
13
|
+
await getCart.setQueryData(queryClient, result);
|
|
14
|
+
},
|
|
15
|
+
onError: (error) => {
|
|
16
|
+
console.error("Failed to update cart:", error);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default useUpdateCart;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createQuery } from "../../create-query";
|
|
2
|
+
import { Cart } from "@/api-manager/schemas/cart.schema";
|
|
3
|
+
import { createApiPath } from "../../create-query";
|
|
4
|
+
|
|
5
|
+
const apiPath = createApiPath("cart", "getCart");
|
|
6
|
+
|
|
7
|
+
const getCart = createQuery<null, Cart>(apiPath, {
|
|
8
|
+
queryKey: "cart",
|
|
9
|
+
//config
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export default getCart;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CardPaymentAcceptPoint } from "@msdyn365-commerce/retail-proxy";
|
|
2
|
+
import { createQuery, createApiPath } from "../../create-query";
|
|
3
|
+
import { GetCardPaymentAcceptPointInput } from "@/api-manager/schemas/cart.schema";
|
|
4
|
+
|
|
5
|
+
const apiPath = createApiPath("cart", "getCardAcceptPoint");
|
|
6
|
+
const config = {
|
|
7
|
+
queryKey: "paymentAcceptPoint",
|
|
8
|
+
disableProperties: ["cartId", "totalAmount", "isClient"] as Array<
|
|
9
|
+
keyof GetCardPaymentAcceptPointInput
|
|
10
|
+
>,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getPaymentAcceptPoint = createQuery<
|
|
14
|
+
GetCardPaymentAcceptPointInput,
|
|
15
|
+
CardPaymentAcceptPoint
|
|
16
|
+
>(apiPath, config);
|
|
17
|
+
|
|
18
|
+
export default getPaymentAcceptPoint;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CategoryHierarchy } from "../../../lib/category-helpers";
|
|
2
|
+
import { createApiPath, createQuery } from "../../create-query";
|
|
3
|
+
|
|
4
|
+
const apiPath = createApiPath("categories", "getCategories");
|
|
5
|
+
|
|
6
|
+
const getCategories = createQuery<null, CategoryHierarchy[]>(apiPath);
|
|
7
|
+
|
|
8
|
+
export default getCategories;
|