@sonic-equipment/ui 0.0.119 → 120.0.0
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/dist/_virtual/_commonjsHelpers.js +5 -0
- package/dist/_virtual/index.js +7 -0
- package/dist/algolia/algolia-active-categories.js +38 -0
- package/dist/algolia/algolia-active-filters.js +33 -0
- package/dist/algolia/algolia-categories-filters.js +29 -0
- package/dist/algolia/algolia-dummy-refinement-list-consumer.js +20 -0
- package/dist/algolia/algolia-filter-panel.js +42 -0
- package/dist/algolia/algolia-filter-panel.module.css.js +3 -0
- package/dist/algolia/algolia-hit-type.js +6 -0
- package/dist/algolia/algolia-hits-provider.js +17 -0
- package/dist/algolia/algolia-index-config.js +175 -0
- package/dist/algolia/algolia-insight-instant-search-provider.js +14 -0
- package/dist/algolia/algolia-insights-provider.js +18 -0
- package/dist/algolia/algolia-instant-search-state-provider.js +16 -0
- package/dist/algolia/algolia-intialization.js +26 -0
- package/dist/algolia/algolia-multi-select-filter-section.js +27 -0
- package/dist/algolia/algolia-pagination.js +18 -0
- package/dist/algolia/algolia-provider.js +34 -0
- package/dist/algolia/algolia-query-string-routing.js +106 -0
- package/dist/algolia/algolia-results-count.js +14 -0
- package/dist/algolia/algolia-search-provider.js +139 -0
- package/dist/algolia/algolia-searchclient-offline.js +25 -0
- package/dist/algolia/algolia-sonic-searchclient.js +25 -0
- package/dist/algolia/algolia-sort-by.js +29 -0
- package/dist/algolia/filter-section.js +33 -0
- package/dist/algolia/filter-section.module.css.js +3 -0
- package/dist/algolia/use-algolia-hits.js +19 -0
- package/dist/algolia/use-algolia-insights-provider-global-state.js +9 -0
- package/dist/algolia/use-algolia-insights.js +181 -0
- package/dist/algolia/use-algolia-instant-search-state.js +25 -0
- package/dist/algolia/use-algolia-search.js +41 -0
- package/dist/background-overlay/background-overlay.js +36 -0
- package/dist/background-overlay/background-overlay.module.css.js +3 -0
- package/dist/badges/badge/badge.js +22 -0
- package/dist/badges/badge/badge.module.css.js +3 -0
- package/dist/badges/badge/icon-with-badge/icon-with-badge.js +8 -0
- package/dist/badges/badge/icon-with-badge/icon-with-badge.module.css.js +3 -0
- package/dist/badges/tag/tag.js +10 -0
- package/dist/badges/tag/tag.module.css.js +3 -0
- package/dist/breadcrumbs/breadcrumb.js +35 -0
- package/dist/breadcrumbs/breadcrumb.module.css.js +3 -0
- package/dist/buttons/add-to-cart-button/add-to-cart-button.js +113 -0
- package/dist/buttons/add-to-cart-button/add-to-cart-button.module.css.js +3 -0
- package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.js +92 -0
- package/dist/buttons/button/button.js +21 -0
- package/dist/buttons/button/button.module.css.js +3 -0
- package/dist/buttons/favorite/connected-favorite-button.js +64 -0
- package/dist/buttons/favorite/favorite-button.js +15 -0
- package/dist/buttons/favorite/favorite-button.module.css.js +3 -0
- package/dist/buttons/icon-button/icon-button.js +15 -0
- package/dist/buttons/icon-button/icon-button.module.css.js +3 -0
- package/dist/buttons/link/link.js +10 -0
- package/dist/buttons/link/link.module.css.js +3 -0
- package/dist/buttons/print-button/print-button.js +9 -0
- package/dist/cards/category-card/category-card.js +15 -0
- package/dist/cards/category-card/category-card.module.css.js +3 -0
- package/dist/cards/orderline-card/connected-orderline-card.js +13 -0
- package/dist/cards/orderline-card/connected-remove-button.js +19 -0
- package/dist/cards/orderline-card/orderline-card.js +17 -0
- package/dist/cards/orderline-card/orderline-card.module.css.js +3 -0
- package/dist/cards/product-card/connected-product-card.js +11 -0
- package/dist/cards/product-card/product-card.js +15 -0
- package/dist/cards/product-card/product-card.module.css.js +3 -0
- package/dist/carousel/card-carousel/card-carousel.js +23 -0
- package/dist/carousel/card-carousel/card-carousel.module.css.js +3 -0
- package/dist/carousel/carousel-navigation-button.js +13 -0
- package/dist/carousel/carousel-navigation-button.module.css.js +3 -0
- package/dist/carousel/carousel.js +69 -0
- package/dist/carousel/carousel.module.css.js +3 -0
- package/dist/carousel/category-carousel/category-carousel.js +9 -0
- package/dist/carousel/category-carousel/category-carousel.module.css.js +3 -0
- package/dist/carousel/pagination/pagination.js +40 -0
- package/dist/carousel/pagination/pagination.module.css.js +3 -0
- package/dist/carousel/pagination/transitions.js +144 -0
- package/dist/carousel/usp-carousel/product-usp-carousel-slide.js +10 -0
- package/dist/carousel/usp-carousel/product-usp-carousel.js +9 -0
- package/dist/carousel/usp-carousel/usp-carousel.js +47 -0
- package/dist/carousel/usp-carousel/usp-carousel.module.css.js +3 -0
- package/dist/cart-totals/cart-totals-summary.js +11 -0
- package/dist/cart-totals/cart-totals-summary.module.css.js +3 -0
- package/dist/cart-totals/cart-totals.js +10 -0
- package/dist/cart-totals/cart-totals.module.css.js +3 -0
- package/dist/collapsables/accordion/accordion-item.js +18 -0
- package/dist/collapsables/accordion/accordion.js +15 -0
- package/dist/collapsables/accordion/accordion.module.css.js +3 -0
- package/dist/collapsables/show-all/show-all.js +33 -0
- package/dist/collapsables/show-all/show-all.module.css.js +3 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +82 -0
- package/dist/country-selector/connected-country-selector.js +37 -0
- package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +42 -0
- package/dist/country-selector/country-selector-dialog/country-selector-dialog.module.css.js +3 -0
- package/dist/country-selector/country-selector-trigger/country-selector-trigger.js +16 -0
- package/dist/country-selector/country-selector-trigger/country-selector-trigger.module.css.js +3 -0
- package/dist/country-selector/use-countries-languages.js +72 -0
- package/dist/delivery-time/delivery-time.js +18 -0
- package/dist/delivery-time/delivery-time.module.css.js +3 -0
- package/dist/display/product-price/product-price.js +19 -0
- package/dist/display/product-price/product-price.module.css.js +3 -0
- package/dist/display/product-price/product-total-price.js +16 -0
- package/dist/display/product-price/product-total-price.module.css.js +3 -0
- package/dist/display/product-sku/product-sku.js +8 -0
- package/dist/display/product-sku/product-sku.module.css.js +3 -0
- package/dist/exports.d.ts +4 -4
- package/dist/filters/active-filters/active-filters.js +20 -0
- package/dist/filters/active-filters/active-filters.module.css.js +3 -0
- package/dist/filters/multi-select/multi-select.js +20 -0
- package/dist/filters/multi-select/multi-select.module.css.js +3 -0
- package/dist/filters/pagination/pagination.js +14 -0
- package/dist/filters/pagination/pagination.module.css.js +3 -0
- package/dist/forms/checkbox/checkbox.js +11 -0
- package/dist/forms/checkbox/checkbox.module.css.js +3 -0
- package/dist/forms/color-checkbox/color-checkbox.js +13 -0
- package/dist/forms/field-error/field-error.js +10 -0
- package/dist/forms/field-error/field-error.module.css.js +3 -0
- package/dist/forms/input/input.js +31 -0
- package/dist/forms/input/input.module.css.js +3 -0
- package/dist/forms/label/label.js +12 -0
- package/dist/forms/label/label.module.css.js +3 -0
- package/dist/forms/number-field/number-field.js +29 -0
- package/dist/forms/number-field/number-field.module.css.js +3 -0
- package/dist/forms/select/select.js +31 -0
- package/dist/forms/select/select.module.css.js +3 -0
- package/dist/forms/text-field/text-field.js +22 -0
- package/dist/forms/text-field/text-field.module.css.js +3 -0
- package/dist/forms/textarea/textarea.js +54 -0
- package/dist/forms/textarea/textarea.module.css.js +3 -0
- package/dist/global-search/categories-grid/categories-grid.js +14 -0
- package/dist/global-search/categories-grid/categories-grid.module.css.js +3 -0
- package/dist/global-search/global-search-provider/global-search-provider.js +15 -0
- package/dist/global-search/global-search-provider/use-search-disclosure.js +13 -0
- package/dist/global-search/global-search.js +43 -0
- package/dist/global-search/global-search.module.css.js +3 -0
- package/dist/global-search/plugins/categories-plugin.js +35 -0
- package/dist/global-search/plugins/popular-categories-plugin.js +32 -0
- package/dist/global-search/plugins/popular-searches-plugin.js +23 -0
- package/dist/global-search/plugins/query-suggestions-plugin.js +21 -0
- package/dist/global-search/plugins/quick-access-plugin.js +34 -0
- package/dist/global-search/plugins/recent-searches-plugin.js +16 -0
- package/dist/global-search/search-highlight/highlight.js +13 -0
- package/dist/global-search/search-input/connected-search-input.js +22 -0
- package/dist/global-search/search-input/search-input.js +29 -0
- package/dist/global-search/search-input/search-input.module.css.js +3 -0
- package/dist/global-search/search-result-panel/panel-content.js +13 -0
- package/dist/global-search/search-result-panel/search-result-panel.js +17 -0
- package/dist/global-search/search-result-panel/search-result-panel.module.css.js +3 -0
- package/dist/global-search/search-result-panel/sections/no-search-results.js +30 -0
- package/dist/global-search/search-result-panel/sections/no-search.js +56 -0
- package/dist/global-search/search-result-panel/sections/search-content.module.css.js +3 -0
- package/dist/global-search/search-result-panel/sections/section-container.js +8 -0
- package/dist/global-search/search-result-panel/sections/with-results.js +101 -0
- package/dist/global-search/search-section/search-list-item.js +25 -0
- package/dist/global-search/search-section/search-list-item.module.css.js +3 -0
- package/dist/global-search/search-section/search-list.js +9 -0
- package/dist/global-search/search-section/search-list.module.css.js +3 -0
- package/dist/global-search/search-section/search-section.js +9 -0
- package/dist/global-search/search-section/search-section.module.css.js +3 -0
- package/dist/header/cart-icon/connected-cart-icon.js +14 -0
- package/dist/icons/glyph/glyphs-arrow-boldcaps-left-icon.js +7 -0
- package/dist/icons/glyph/glyphs-arrow-boldcaps-right-icon.js +7 -0
- package/dist/icons/glyph/glyphs-arrow-semibold-right-icon.js +7 -0
- package/dist/icons/glyph/glyphs-chevrons-bold-down-icon.js +7 -0
- package/dist/icons/glyph/glyphs-chevrons-slim-down-icon.js +7 -0
- package/dist/icons/glyph/glyphs-chevrons-slim-left-icon.js +7 -0
- package/dist/icons/glyph/glyphs-chevrons-slim-right-icon.js +7 -0
- package/dist/icons/solid/solid-attention-icon.js +7 -0
- package/dist/icons/solid/solid-cart-icon.js +7 -0
- package/dist/icons/solid/solid-close-icon.js +7 -0
- package/dist/icons/solid/solid-event-icon.js +7 -0
- package/dist/icons/solid/solid-favorite-icon.js +7 -0
- package/dist/icons/solid/solid-home-icon.js +7 -0
- package/dist/icons/solid/solid-information-icon.js +7 -0
- package/dist/icons/solid/solid-news-icon.js +7 -0
- package/dist/icons/solid/solid-notice-icon.js +7 -0
- package/dist/icons/solid/solid-okay-icon.js +7 -0
- package/dist/icons/solid/solid-sale-icon.js +7 -0
- package/dist/icons/solid/solid-tag-icon.js +7 -0
- package/dist/icons/stroke/stroke-categories-icon.js +7 -0
- package/dist/icons/stroke/stroke-checkmark-icon.js +7 -0
- package/dist/icons/stroke/stroke-closebox-icon.js +7 -0
- package/dist/icons/stroke/stroke-collapse-icon.js +7 -0
- package/dist/icons/stroke/stroke-download-icon.js +7 -0
- package/dist/icons/stroke/stroke-expand-icon.js +7 -0
- package/dist/icons/stroke/stroke-favorite-icon.js +7 -0
- package/dist/icons/stroke/stroke-filter-icon.js +7 -0
- package/dist/icons/stroke/stroke-recent-icon.js +7 -0
- package/dist/icons/stroke/stroke-search-icon.js +7 -0
- package/dist/icons/stroke/stroke-trash-icon.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +254 -12972
- package/dist/intl/formatted-message.js +6 -0
- package/dist/intl/intl-context.js +10 -0
- package/dist/intl/intl-provider.js +15 -0
- package/dist/intl/types.js +17 -0
- package/dist/intl/use-culture-code.js +14 -0
- package/dist/intl/use-formatted-message.js +17 -0
- package/dist/intl/use-language-code.js +11 -0
- package/dist/intl/utils.js +29 -0
- package/dist/lists/download-document-list/download-document-list.js +16 -0
- package/dist/lists/download-document-list/download-document-list.module.css.js +3 -0
- package/dist/lists/feature-list/feature-list.js +22 -0
- package/dist/lists/feature-list/feature-list.module.css.js +3 -0
- package/dist/lists/orderline-list/orderline-list.js +25 -0
- package/dist/lists/orderline-list/orderline-list.module.css.js +3 -0
- package/dist/lists/product-overview-grid/product-overview-grid.js +10 -0
- package/dist/lists/product-overview-grid/product-overview-grid.module.css.js +3 -0
- package/dist/lists/ul/list.js +11 -0
- package/dist/lists/ul/list.module.css.js +3 -0
- package/dist/loading/blank-page-spacer.js +8 -0
- package/dist/loading/blank-page-spacer.module.css.js +3 -0
- package/dist/loading/loading-overlay.js +9 -0
- package/dist/loading/loading-overlay.module.css.js +3 -0
- package/dist/loading/progress-circle.js +9 -0
- package/dist/loading/progress-circle.module.css.js +3 -0
- package/dist/media/image/image.js +46 -0
- package/dist/media/image/image.module.css.js +3 -0
- package/dist/media/image-grid/images-grid.js +32 -0
- package/dist/media/image-grid/images-grid.module.css.js +3 -0
- package/dist/media/image-lightbox/image-lightbox.js +35 -0
- package/dist/media/image-lightbox/image-lightbox.module.css.js +3 -0
- package/dist/media/zoom-image/zoom-image.js +33 -0
- package/dist/media/zoom-image/zoom-image.module.css.js +3 -0
- package/dist/modals/confirmation/confirmation-dialog.js +12 -0
- package/dist/modals/confirmation/confirmation-dialog.module.css.js +3 -0
- package/dist/modals/dialog/dialog.js +30 -0
- package/dist/modals/dialog/dialog.module.css.js +3 -0
- package/dist/modals/favorite/add-to-favorite-dialog.js +60 -0
- package/dist/modals/favorite/add-to-favorite-dialog.module.css.js +3 -0
- package/dist/modals/modal/modal.js +34 -0
- package/dist/modals/modal/modal.module.css.js +3 -0
- package/dist/modals/signin/sign-in-dialog.js +22 -0
- package/dist/modals/signin/sign-in-dialog.module.css.js +3 -0
- package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/routers/history.js +341 -0
- package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/stateMappings/simple.js +36 -0
- package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/documentation.js +8 -0
- package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/logger.js +32 -0
- package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/noop.js +3 -0
- package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/safelyRunOnBrowser.js +24 -0
- package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/formats.js +33 -0
- package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/index.js +25 -0
- package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/parse.js +269 -0
- package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/stringify.js +300 -0
- package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/utils.js +264 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/free-mode.js +237 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/navigation.js +200 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/thumbs.js +193 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/create-element-if-not-defined.js +21 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/ssr-window.esm.js +145 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/swiper-core.js +3912 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/update-on-virtual-data.js +130 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/update-swiper.js +230 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/utils.js +287 -0
- package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/swiper-react.js +389 -0
- package/dist/notifications/announcements/announcement-provider.js +32 -0
- package/dist/notifications/announcements/announcement-provider.module.css.js +3 -0
- package/dist/notifications/announcements/announcement.js +30 -0
- package/dist/notifications/announcements/announcement.module.css.js +3 -0
- package/dist/notifications/announcements/connected-announcement.js +27 -0
- package/dist/observers/intersection-observer.js +18 -0
- package/dist/pages/cart-page/cart-page.js +114 -0
- package/dist/pages/error-page/error-page.js +22 -0
- package/dist/pages/layouts/checkout-page-layout/checkout-page-layout.js +30 -0
- package/dist/pages/layouts/checkout-page-layout/checkout-page-layout.module.css.js +3 -0
- package/dist/pages/layouts/product-details-page-layout/product-details-page-layout.js +8 -0
- package/dist/pages/layouts/product-details-page-layout/product-details-page-layout.module.css.js +3 -0
- package/dist/pages/loading-page/loading-page.js +9 -0
- package/dist/pages/page/page.js +18 -0
- package/dist/pages/page/page.module.css.js +3 -0
- package/dist/pages/page-container/page-container.js +9 -0
- package/dist/pages/page-container/page-container.module.css.js +3 -0
- package/dist/pages/product-details-page/components/product-details-images/product-detail-images.js +35 -0
- package/dist/pages/product-details-page/components/product-details-images/product-detail-images.module.css.js +3 -0
- package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.d.ts +3 -2
- package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.js +35 -0
- package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.module.css.js +3 -0
- package/dist/pages/product-details-page/components/product-details-recently-viewed/product-details-recently-viewed.d.ts +4 -0
- package/dist/pages/product-details-page/components/product-details-recently-viewed/product-details-recently-viewed.js +15 -0
- package/dist/pages/product-details-page/product-details-page.js +22 -0
- package/dist/pages/product-details-page/product-details.d.ts +6 -0
- package/dist/pages/product-details-page/product-details.js +25 -0
- package/dist/pages/product-listing-page/no-results/no-results.js +14 -0
- package/dist/pages/product-listing-page/no-results/no-results.module.css.js +3 -0
- package/dist/pages/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.js +22 -0
- package/dist/pages/product-listing-page/product-listing-page-provider/product-listing-page-context.js +8 -0
- package/dist/pages/product-listing-page/product-listing-page-provider/product-listing-page-provider.js +13 -0
- package/dist/pages/product-listing-page/product-listing-page.js +29 -0
- package/dist/pages/product-listing-page/product-listing-page.module.css.js +3 -0
- package/dist/pages/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +36 -0
- package/dist/pages/product-listing-page/product-listing.d.ts +6 -0
- package/dist/pages/product-listing-page/product-listing.js +42 -0
- package/dist/pages/search-result-page/search-result-product-overview/search-result-product-overview.js +38 -0
- package/dist/pages/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel.js +22 -0
- package/dist/pages/search-result-page/search-results-page.js +49 -0
- package/dist/pages/search-result-page/search-results-page.module.css.js +3 -0
- package/dist/promos/promo-banner/promo-banner.js +11 -0
- package/dist/promos/promo-banner/promo-banner.module.css.js +3 -0
- package/dist/promos/promo-banners/promo-banners.js +16 -0
- package/dist/promos/promo-banners/promo-banners.module.css.js +3 -0
- package/dist/promos/promo-card/promo-card.js +11 -0
- package/dist/promos/promo-card/promo-card.module.css.js +3 -0
- package/dist/shared/api/bff/hooks/use-fetch-announcements.js +15 -0
- package/dist/shared/api/bff/hooks/use-fetch-product-details-page-data.js +14 -0
- package/dist/shared/api/bff/hooks/use-fetch-product-listing-page-data.js +14 -0
- package/dist/shared/api/bff/model/bff.model.d.ts +1 -1
- package/dist/shared/api/bff/model/bff.model.js +1 -0
- package/dist/shared/api/bff/services/bff-service.js +76 -0
- package/dist/shared/api/storefront/hooks/authentication/use-fetch-session.js +18 -0
- package/dist/shared/api/storefront/hooks/authentication/use-invalidate-session.js +9 -0
- package/dist/shared/api/storefront/hooks/authentication/use-is-authenticated.js +8 -0
- package/dist/shared/api/storefront/hooks/authentication/use-sign-in.js +21 -0
- package/dist/shared/api/storefront/hooks/authentication/use-sign-out.js +25 -0
- package/dist/shared/api/storefront/hooks/cart/use-add-product-to-current-cart.js +31 -0
- package/dist/shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.js +23 -0
- package/dist/shared/api/storefront/hooks/cart/use-delete-current-cart.js +18 -0
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-checkout-atp.js +15 -0
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-count.js +8 -0
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines-with-atp.js +11 -0
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines.js +11 -0
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-product-atp.js +15 -0
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-promotions.js +15 -0
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js +26 -0
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart.js +17 -0
- package/dist/shared/api/storefront/hooks/cart/use-invalidate-current-cart.js +9 -0
- package/dist/shared/api/storefront/hooks/cart/use-patch-cart.js +15 -0
- package/dist/shared/api/storefront/hooks/cart/use-place-order.js +15 -0
- package/dist/shared/api/storefront/hooks/cart/use-save-cart-for-later.js +17 -0
- package/dist/shared/api/storefront/hooks/cart/use-update-cart-line-by-id.js +30 -0
- package/dist/shared/api/storefront/hooks/translation/use-fetch-translations.js +15 -0
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries-languages.js +15 -0
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries-with-languages.js +15 -0
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries.js +14 -0
- package/dist/shared/api/storefront/hooks/website/use-fetch-settings.js +18 -0
- package/dist/shared/api/storefront/hooks/website/use-update-locale.js +11 -0
- package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-current-wishlist.js +34 -0
- package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-wishlist.js +33 -0
- package/dist/shared/api/storefront/hooks/wishlist/use-create-wishlist.js +17 -0
- package/dist/shared/api/storefront/hooks/wishlist/use-delete-wishlist-item-from-wishlist.js +21 -0
- package/dist/shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items.js +36 -0
- package/dist/shared/api/storefront/hooks/wishlist/use-fetch-wishlists.js +14 -0
- package/dist/shared/api/storefront/model/shop.model.js +42 -0
- package/dist/shared/api/storefront/services/authentication-service.js +80 -0
- package/dist/shared/api/storefront/services/cart-service.js +128 -0
- package/dist/shared/api/storefront/services/translation-service.js +16 -0
- package/dist/shared/api/storefront/services/website-service.js +83 -0
- package/dist/shared/api/storefront/services/wishlist-service.js +72 -0
- package/dist/shared/feature-flags/use-feature-flags.js +45 -0
- package/dist/shared/fetch/request.d.ts +5 -0
- package/dist/shared/fetch/request.js +263 -0
- package/dist/shared/hooks/use-breakpoint.js +24 -0
- package/dist/shared/hooks/use-cookie.js +27 -0
- package/dist/shared/hooks/use-debounced-callback.js +18 -0
- package/dist/shared/hooks/use-disclosure.js +24 -0
- package/dist/shared/hooks/use-enable-mobile-zoom.js +36 -0
- package/dist/shared/hooks/use-intersection-observer.js +66 -0
- package/dist/shared/hooks/use-is-breakpoint.js +19 -0
- package/dist/shared/hooks/use-local-storage.js +19 -0
- package/dist/shared/hooks/use-resize-observer.d.ts +2 -2
- package/dist/shared/hooks/use-resize-observer.js +30 -0
- package/dist/shared/hooks/use-scroll-lock.js +11 -0
- package/dist/shared/hooks/use-scroll-to.js +19 -0
- package/dist/shared/hooks/use-session-storage.js +19 -0
- package/dist/shared/hooks/use-watch-css-property.d.ts +1 -0
- package/dist/shared/hooks/use-watch-css-property.js +29 -0
- package/dist/shared/model/announcement.js +18 -0
- package/dist/shared/model/category.js +25 -0
- package/dist/shared/model/currency.js +29 -0
- package/dist/shared/model/hit.js +45 -0
- package/dist/shared/model/image.js +5 -0
- package/dist/shared/providers/cart-provider.js +13 -0
- package/dist/shared/providers/favorite-provider.js +33 -0
- package/dist/shared/providers/global-state-provider.js +83 -0
- package/dist/shared/providers/react-query-container.js +20 -0
- package/dist/shared/routing/route-button.js +7 -0
- package/dist/shared/routing/route-icon-button.js +7 -0
- package/dist/shared/routing/route-link.js +7 -0
- package/dist/shared/routing/route-provider.d.ts +3 -1
- package/dist/shared/routing/route-provider.js +48 -0
- package/dist/shared/routing/with-routing.js +36 -0
- package/dist/shared/utils/array.js +5 -0
- package/dist/shared/utils/breakpoints.js +33 -0
- package/dist/shared/utils/date.js +58 -0
- package/dist/shared/utils/environment.d.ts +2 -2
- package/dist/shared/utils/environment.js +61 -0
- package/dist/shared/utils/event-emitter.js +34 -0
- package/dist/shared/utils/local-storage.js +108 -0
- package/dist/shared/utils/merge.js +70 -0
- package/dist/shared/utils/price.js +6 -0
- package/dist/shared/utils/time.js +9 -0
- package/dist/shared/utils/uuid.js +15 -0
- package/dist/shared/utils/wait.js +5 -0
- package/dist/sidebar/sidebar-provider.js +46 -0
- package/dist/sidebar/sidebar-provider.module.css.js +3 -0
- package/dist/sidebar/sidebar.js +23 -0
- package/dist/sidebar/sidebar.module.css.js +3 -0
- package/dist/sidebar/toggle-sidebar-button.js +13 -0
- package/dist/sidebar/use-sidebar.js +38 -0
- package/dist/styles.css +5 -16
- package/dist/toast/toast-provider.js +9 -0
- package/dist/toast/toast-provider.module.css.js +3 -0
- package/dist/toast/toast.js +24 -0
- package/dist/toast/toast.module.css.js +3 -0
- package/dist/toast/use-toast.js +21 -0
- package/dist/tokens/tokens.js +8 -0
- package/dist/typography/heading/heading.js +27 -0
- package/dist/typography/heading/heading.module.css.js +3 -0
- package/package.json +3 -2
- package/dist/pages/product-listing-page/product-listing-page-provider/use-subcategories.d.ts +0 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { TIME } from '../../../../utils/time.js';
|
|
3
|
+
import { fetchSettings } from '../../services/website-service.js';
|
|
4
|
+
|
|
5
|
+
function useFetchSettings({ enabled = true, } = {}) {
|
|
6
|
+
return useQuery({
|
|
7
|
+
enabled,
|
|
8
|
+
gcTime: TIME.DAY,
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
return await fetchSettings();
|
|
11
|
+
},
|
|
12
|
+
queryKey: ['settings'],
|
|
13
|
+
retry: 3,
|
|
14
|
+
staleTime: TIME.DAY,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { useFetchSettings };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { updateLocale } from '../../services/website-service.js';
|
|
3
|
+
|
|
4
|
+
function useUpdateLocale() {
|
|
5
|
+
return useMutation({
|
|
6
|
+
mutationFn: updateLocale,
|
|
7
|
+
throwOnError: true,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { useUpdateLocale };
|
package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-current-wishlist.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { createWishList, addWishListItemToWishList } from '../../services/wishlist-service.js';
|
|
3
|
+
|
|
4
|
+
function useAddWishListItemToCurrentWishList() {
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
|
+
return useMutation({
|
|
7
|
+
mutationFn: async ({ productId }) => {
|
|
8
|
+
const wishLists = queryClient.getQueryData(['wishlists']) || [];
|
|
9
|
+
let wishList = wishLists[0];
|
|
10
|
+
if (!wishList) {
|
|
11
|
+
wishList = await createWishList();
|
|
12
|
+
queryClient.setQueryData(['wishlists'], [...wishLists, wishList]);
|
|
13
|
+
}
|
|
14
|
+
const wishListItem = await addWishListItemToWishList({
|
|
15
|
+
productId,
|
|
16
|
+
wishListId: wishList.id,
|
|
17
|
+
});
|
|
18
|
+
const wishListLines = queryClient.getQueryData(['wishlistlines']) || [];
|
|
19
|
+
queryClient.setQueryData(['wishlistlines'], [
|
|
20
|
+
...wishListLines,
|
|
21
|
+
{
|
|
22
|
+
wishList,
|
|
23
|
+
wishListItem,
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
},
|
|
27
|
+
onError() {
|
|
28
|
+
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
29
|
+
queryClient.removeQueries({ queryKey: ['wishlistlines'] });
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { useAddWishListItemToCurrentWishList };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { getWishLists, addWishListItemToWishList } from '../../services/wishlist-service.js';
|
|
3
|
+
|
|
4
|
+
/* eslint-disable unicorn/no-await-expression-member */
|
|
5
|
+
function useAddWishListItemToWishList() {
|
|
6
|
+
const queryClient = useQueryClient();
|
|
7
|
+
return useMutation({
|
|
8
|
+
mutationFn: async ({ productId, wishListId }) => {
|
|
9
|
+
let wishLists = queryClient.getQueryData(['wishlists']);
|
|
10
|
+
if (!wishLists) {
|
|
11
|
+
wishLists = (await getWishLists()).wishListCollection || [];
|
|
12
|
+
queryClient.setQueryData(['wishlists'], wishLists);
|
|
13
|
+
}
|
|
14
|
+
const wishList = wishLists.find(wishList => wishList.id === wishListId);
|
|
15
|
+
if (!wishList)
|
|
16
|
+
throw new Error(`Wish list with id ${wishListId} not found`);
|
|
17
|
+
const wishListItem = await addWishListItemToWishList({
|
|
18
|
+
productId,
|
|
19
|
+
wishListId,
|
|
20
|
+
});
|
|
21
|
+
const wishListLines = queryClient.getQueryData(['wishlistlines']) || [];
|
|
22
|
+
queryClient.setQueryData(['wishlistlines'], [
|
|
23
|
+
...wishListLines,
|
|
24
|
+
{
|
|
25
|
+
wishList,
|
|
26
|
+
wishListItem,
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { useAddWishListItemToWishList };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { createWishList } from '../../services/wishlist-service.js';
|
|
3
|
+
|
|
4
|
+
function useCreateWishList() {
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
|
+
return useMutation({
|
|
7
|
+
mutationFn: async ({ name }) => {
|
|
8
|
+
const createdWishList = await createWishList({ name });
|
|
9
|
+
// Add to cache
|
|
10
|
+
const wishLists = queryClient.getQueryData(['wishlists']) || [];
|
|
11
|
+
queryClient.setQueryData(['wishlists'], [...wishLists, createdWishList]);
|
|
12
|
+
return createdWishList.id;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { useCreateWishList };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { deleteWishListItemFromWishList } from '../../services/wishlist-service.js';
|
|
3
|
+
|
|
4
|
+
function useDeleteWishListItemFromWishList() {
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
|
+
return useMutation({
|
|
7
|
+
mutationFn: async ({ wishListId, wishListItemId }) => {
|
|
8
|
+
await deleteWishListItemFromWishList({ wishListId, wishListItemId });
|
|
9
|
+
const wishListLines = queryClient.getQueryData(['wishlistlines']) || [];
|
|
10
|
+
if (wishListLines.some(item => item.wishListItem.id === wishListItemId)) {
|
|
11
|
+
queryClient.setQueryData(['wishlistlines'], wishListLines.filter(line => line.wishListItem.id !== wishListItemId));
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
onError() {
|
|
15
|
+
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
16
|
+
queryClient.removeQueries({ queryKey: ['wishlistlines'] });
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { useDeleteWishListItemFromWishList };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useQueryClient, useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { TIME } from '../../../../utils/time.js';
|
|
3
|
+
import { getWishLists, getWishListItemsByWishListId } from '../../services/wishlist-service.js';
|
|
4
|
+
|
|
5
|
+
/* eslint-disable unicorn/no-await-expression-member */
|
|
6
|
+
function useFetchAllWishListsItems({ enabled = true } = { enabled: true }) {
|
|
7
|
+
const queryClient = useQueryClient();
|
|
8
|
+
return useQuery({
|
|
9
|
+
enabled,
|
|
10
|
+
gcTime: 15 * TIME.MINUTE,
|
|
11
|
+
queryFn: async () => {
|
|
12
|
+
let wishLists =
|
|
13
|
+
// Reuse existing data if available
|
|
14
|
+
queryClient.getQueryData(['wishlists']);
|
|
15
|
+
if (wishLists === undefined) {
|
|
16
|
+
wishLists = (await getWishLists()).wishListCollection || [];
|
|
17
|
+
// Update the cache with the new or existing data
|
|
18
|
+
queryClient.setQueryData(['wishlists'], wishLists);
|
|
19
|
+
}
|
|
20
|
+
if (wishLists.length === 0)
|
|
21
|
+
return [];
|
|
22
|
+
const wishListLines = await Promise.all(wishLists.map(async (wishList) => {
|
|
23
|
+
return ((await getWishListItemsByWishListId({ wishListId: wishList.id }))
|
|
24
|
+
.wishListLines || []).map(wishListItem => ({
|
|
25
|
+
wishList,
|
|
26
|
+
wishListItem,
|
|
27
|
+
}));
|
|
28
|
+
}));
|
|
29
|
+
return wishListLines.flat();
|
|
30
|
+
},
|
|
31
|
+
queryKey: ['wishlistlines'],
|
|
32
|
+
staleTime: 15 * TIME.MINUTE,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { useFetchAllWishListsItems };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { TIME } from '../../../../utils/time.js';
|
|
3
|
+
import { getWishLists } from '../../services/wishlist-service.js';
|
|
4
|
+
|
|
5
|
+
function useFetchWishLists() {
|
|
6
|
+
return useQuery({
|
|
7
|
+
gcTime: 15 * TIME.MINUTE,
|
|
8
|
+
queryFn: getWishLists,
|
|
9
|
+
queryKey: ['wishlists'],
|
|
10
|
+
staleTime: 15 * TIME.MINUTE,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { useFetchWishLists };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var CurrencyPositioningType;
|
|
2
|
+
(function (CurrencyPositioningType) {
|
|
3
|
+
CurrencyPositioningType["Left"] = "Left";
|
|
4
|
+
CurrencyPositioningType["Right"] = "Right";
|
|
5
|
+
})(CurrencyPositioningType || (CurrencyPositioningType = {}));
|
|
6
|
+
var AvailabilityMessageType;
|
|
7
|
+
(function (AvailabilityMessageType) {
|
|
8
|
+
AvailabilityMessageType[AvailabilityMessageType["NoMessage"] = 0] = "NoMessage";
|
|
9
|
+
AvailabilityMessageType[AvailabilityMessageType["Available"] = 1] = "Available";
|
|
10
|
+
AvailabilityMessageType[AvailabilityMessageType["OutOfStock"] = 2] = "OutOfStock";
|
|
11
|
+
AvailabilityMessageType[AvailabilityMessageType["LowStock"] = 3] = "LowStock";
|
|
12
|
+
})(AvailabilityMessageType || (AvailabilityMessageType = {}));
|
|
13
|
+
var VariantDisplayTypeValues;
|
|
14
|
+
(function (VariantDisplayTypeValues) {
|
|
15
|
+
VariantDisplayTypeValues["Button"] = "Button";
|
|
16
|
+
VariantDisplayTypeValues["Dropdown"] = "Dropdown";
|
|
17
|
+
VariantDisplayTypeValues["SwatchDropdown"] = "SwatchDropdown";
|
|
18
|
+
VariantDisplayTypeValues["SwatchGrid"] = "SwatchGrid";
|
|
19
|
+
VariantDisplayTypeValues["SwatchList"] = "SwatchList";
|
|
20
|
+
})(VariantDisplayTypeValues || (VariantDisplayTypeValues = {}));
|
|
21
|
+
var BadgeTypeValues;
|
|
22
|
+
(function (BadgeTypeValues) {
|
|
23
|
+
BadgeTypeValues["Image"] = "Image";
|
|
24
|
+
BadgeTypeValues["Text"] = "Text";
|
|
25
|
+
})(BadgeTypeValues || (BadgeTypeValues = {}));
|
|
26
|
+
var BadgeImagePlacementValues;
|
|
27
|
+
(function (BadgeImagePlacementValues) {
|
|
28
|
+
BadgeImagePlacementValues["BottomCenter"] = "Bottom Center";
|
|
29
|
+
BadgeImagePlacementValues["BottomLeft"] = "Bottom Left";
|
|
30
|
+
BadgeImagePlacementValues["BottomRight"] = "Bottom Right";
|
|
31
|
+
BadgeImagePlacementValues["None"] = "None";
|
|
32
|
+
BadgeImagePlacementValues["TopCenter"] = "Top Center";
|
|
33
|
+
BadgeImagePlacementValues["TopLeft"] = "Top Left";
|
|
34
|
+
BadgeImagePlacementValues["TopRight"] = "Top Right";
|
|
35
|
+
})(BadgeImagePlacementValues || (BadgeImagePlacementValues = {}));
|
|
36
|
+
var BadgeStyleValues;
|
|
37
|
+
(function (BadgeStyleValues) {
|
|
38
|
+
BadgeStyleValues["Rectangle"] = "Rectangle";
|
|
39
|
+
BadgeStyleValues["Round"] = "Round";
|
|
40
|
+
})(BadgeStyleValues || (BadgeStyleValues = {}));
|
|
41
|
+
|
|
42
|
+
export { AvailabilityMessageType, BadgeImagePlacementValues, BadgeStyleValues, BadgeTypeValues, CurrencyPositioningType, VariantDisplayTypeValues };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { config } from '../../../../config.js';
|
|
2
|
+
import { request } from '../../../fetch/request.js';
|
|
3
|
+
|
|
4
|
+
async function fetchSession() {
|
|
5
|
+
const { body } = await request({
|
|
6
|
+
credentials: 'include',
|
|
7
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
8
|
+
});
|
|
9
|
+
return body;
|
|
10
|
+
}
|
|
11
|
+
async function patchSession({ session, }) {
|
|
12
|
+
const { body } = await request({
|
|
13
|
+
body: session,
|
|
14
|
+
credentials: 'include',
|
|
15
|
+
headers: {
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
},
|
|
18
|
+
method: 'PATCH',
|
|
19
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
20
|
+
});
|
|
21
|
+
return body;
|
|
22
|
+
}
|
|
23
|
+
async function signIn({ password, userName, }) {
|
|
24
|
+
const params = new URLSearchParams();
|
|
25
|
+
params.append('grant_type', 'password');
|
|
26
|
+
params.append('username', userName);
|
|
27
|
+
params.append('password', password);
|
|
28
|
+
params.append('scope', 'iscapi offline_access');
|
|
29
|
+
const { body } = await request({
|
|
30
|
+
body: params.toString(),
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: `Basic ${btoa('isc:009AC476-B28E-4E33-8BAE-B5F103A142BC')}`,
|
|
33
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
34
|
+
},
|
|
35
|
+
method: 'POST',
|
|
36
|
+
url: `${config.SHOP_API_URL}/identity/connect/token`,
|
|
37
|
+
});
|
|
38
|
+
return body;
|
|
39
|
+
}
|
|
40
|
+
async function createSession({ accessToken, password, userName, }) {
|
|
41
|
+
const { body } = await request({
|
|
42
|
+
body: {
|
|
43
|
+
isGuest: false,
|
|
44
|
+
password,
|
|
45
|
+
rememberMe: true,
|
|
46
|
+
userName,
|
|
47
|
+
},
|
|
48
|
+
headers: {
|
|
49
|
+
Accept: 'application/json, text/plain, */*',
|
|
50
|
+
Authorization: `Bearer ${accessToken}`,
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
},
|
|
53
|
+
method: 'POST',
|
|
54
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions`,
|
|
55
|
+
});
|
|
56
|
+
return body;
|
|
57
|
+
}
|
|
58
|
+
async function signOut() {
|
|
59
|
+
await request({
|
|
60
|
+
method: 'DELETE',
|
|
61
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async function createGuestAccount({ defaultWarehouseId, }) {
|
|
65
|
+
const { body } = await request({
|
|
66
|
+
body: {
|
|
67
|
+
defaultFulfillmentMethod: 'Ship',
|
|
68
|
+
defaultWarehouseId,
|
|
69
|
+
isGuest: true,
|
|
70
|
+
},
|
|
71
|
+
headers: {
|
|
72
|
+
'Content-Type': 'application/json',
|
|
73
|
+
},
|
|
74
|
+
method: 'POST',
|
|
75
|
+
url: `${config.SHOP_API_URL}/api/v1/accounts`,
|
|
76
|
+
});
|
|
77
|
+
return body;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { createGuestAccount, createSession, fetchSession, patchSession, signIn, signOut };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { config } from '../../../../config.js';
|
|
2
|
+
import { request } from '../../../fetch/request.js';
|
|
3
|
+
|
|
4
|
+
async function fetchCurrentCart() {
|
|
5
|
+
const { body } = await request({
|
|
6
|
+
credentials: 'include',
|
|
7
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current?expand=shipping%2Cvalidation%2CcartLines%2Crestrictions%2Ccarriers%2CpaymentOptions%2CcostCodes%2Chiddenproducts%2Ctax&forceRecalculation=true&allowInvalidAddress=true`,
|
|
8
|
+
});
|
|
9
|
+
return body;
|
|
10
|
+
}
|
|
11
|
+
async function fetchCurrentCartPromotions() {
|
|
12
|
+
const { body } = await request({
|
|
13
|
+
credentials: 'include',
|
|
14
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/promotions`,
|
|
15
|
+
});
|
|
16
|
+
return body.promotions || [];
|
|
17
|
+
}
|
|
18
|
+
async function fetchCurrentCartLines() {
|
|
19
|
+
const { body: { cartLines }, } = await request({
|
|
20
|
+
credentials: 'include',
|
|
21
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines?page=1&pageSize=999`,
|
|
22
|
+
});
|
|
23
|
+
return cartLines;
|
|
24
|
+
}
|
|
25
|
+
async function updateCartLineById({ cartLine, cartLineId, }) {
|
|
26
|
+
await request({
|
|
27
|
+
body: JSON.stringify(cartLine),
|
|
28
|
+
credentials: 'include',
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
},
|
|
32
|
+
method: 'PATCH',
|
|
33
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines/${cartLineId}`,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function patchCart({ cart }) {
|
|
37
|
+
const { body } = await request({
|
|
38
|
+
body: cart,
|
|
39
|
+
credentials: 'include',
|
|
40
|
+
headers: {
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
},
|
|
43
|
+
method: 'PATCH',
|
|
44
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current`,
|
|
45
|
+
});
|
|
46
|
+
return body;
|
|
47
|
+
}
|
|
48
|
+
async function deleteCurrentCart() {
|
|
49
|
+
const { body } = await request({
|
|
50
|
+
credentials: 'include',
|
|
51
|
+
method: 'DELETE',
|
|
52
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current`,
|
|
53
|
+
});
|
|
54
|
+
return body;
|
|
55
|
+
}
|
|
56
|
+
async function deleteCartLineById({ cartLineId, }) {
|
|
57
|
+
await request({
|
|
58
|
+
credentials: 'include',
|
|
59
|
+
headers: {
|
|
60
|
+
'Content-Type': 'application/json',
|
|
61
|
+
},
|
|
62
|
+
method: 'DELETE',
|
|
63
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines/${cartLineId}`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async function addProductToCurrentCart(productOrderData) {
|
|
67
|
+
const { body } = await request({
|
|
68
|
+
body: JSON.stringify(productOrderData),
|
|
69
|
+
credentials: 'include',
|
|
70
|
+
headers: {
|
|
71
|
+
'Content-Type': 'application/json',
|
|
72
|
+
},
|
|
73
|
+
method: 'POST',
|
|
74
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines`,
|
|
75
|
+
});
|
|
76
|
+
return body;
|
|
77
|
+
}
|
|
78
|
+
async function fetchCurrentCartProductAtp() {
|
|
79
|
+
const { body } = await request({
|
|
80
|
+
credentials: 'include',
|
|
81
|
+
method: 'GET',
|
|
82
|
+
url: `${config.SHOP_API_URL}/api/custom/atp/cart`,
|
|
83
|
+
});
|
|
84
|
+
return body.map(atp => ({
|
|
85
|
+
...atp,
|
|
86
|
+
date: new Date(atp.date),
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
async function fetchCurrentCheckoutAtp() {
|
|
90
|
+
const { body } = await request({
|
|
91
|
+
credentials: 'include',
|
|
92
|
+
method: 'GET',
|
|
93
|
+
url: `${config.SHOP_API_URL}/api/custom/atp`,
|
|
94
|
+
});
|
|
95
|
+
return body;
|
|
96
|
+
}
|
|
97
|
+
async function placeOrder({ cart, isPending, }) {
|
|
98
|
+
const newStatus = cart.requiresApproval
|
|
99
|
+
? 'AwaitingApproval'
|
|
100
|
+
: isPending
|
|
101
|
+
? 'PendingPaymentValidation'
|
|
102
|
+
: 'Submitted';
|
|
103
|
+
const { body } = await request({
|
|
104
|
+
body: { ...cart, status: newStatus },
|
|
105
|
+
credentials: 'include',
|
|
106
|
+
headers: {
|
|
107
|
+
'Content-Type': 'application/json',
|
|
108
|
+
},
|
|
109
|
+
method: 'PATCH',
|
|
110
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current`,
|
|
111
|
+
});
|
|
112
|
+
return body;
|
|
113
|
+
}
|
|
114
|
+
async function saveCartForLater({ cart }) {
|
|
115
|
+
// USER NEEDS TO BE LOGGED IN
|
|
116
|
+
const { body } = await request({
|
|
117
|
+
body: JSON.stringify({ ...cart, status: 'Saved' }),
|
|
118
|
+
credentials: 'include',
|
|
119
|
+
headers: {
|
|
120
|
+
'Content-Type': 'application/json',
|
|
121
|
+
},
|
|
122
|
+
method: 'PATCH',
|
|
123
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current`,
|
|
124
|
+
});
|
|
125
|
+
return body;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { addProductToCurrentCart, deleteCartLineById, deleteCurrentCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, patchCart, placeOrder, saveCartForLater, updateCartLineById };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { config } from '../../../../config.js';
|
|
2
|
+
import { request } from '../../../fetch/request.js';
|
|
3
|
+
|
|
4
|
+
async function fetchTranslations(languageCode) {
|
|
5
|
+
const translations = {};
|
|
6
|
+
const { body } = await request({
|
|
7
|
+
credentials: 'include',
|
|
8
|
+
url: `${config.SHOP_API_URL}/api/v1/translationdictionaries?page=1&pageSize=9999&languageCode=${languageCode}`,
|
|
9
|
+
});
|
|
10
|
+
body.translationDictionaries?.forEach(dictionary => {
|
|
11
|
+
translations[dictionary.keyword] = dictionary.translation;
|
|
12
|
+
});
|
|
13
|
+
return translations;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { fetchTranslations };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { config } from '../../../../config.js';
|
|
2
|
+
import { isCountryCode, isLanguageCode, isCultureCode } from '../../../../intl/types.js';
|
|
3
|
+
import { request } from '../../../fetch/request.js';
|
|
4
|
+
|
|
5
|
+
const countryIsoCodeToLanguageIsoCode = {
|
|
6
|
+
'*': ['EN'],
|
|
7
|
+
AT: ['EN', 'DE'],
|
|
8
|
+
BE: ['EN', 'NL', 'FR'],
|
|
9
|
+
CH: ['EN', 'FR', 'DE', 'IT'],
|
|
10
|
+
DE: ['EN', 'DE'],
|
|
11
|
+
FR: ['EN', 'FR'],
|
|
12
|
+
IT: ['EN', 'IT'],
|
|
13
|
+
LU: ['EN', 'FR', 'DE'],
|
|
14
|
+
NL: ['EN', 'NL'],
|
|
15
|
+
};
|
|
16
|
+
async function fetchCountries() {
|
|
17
|
+
const { body } = await request({
|
|
18
|
+
url: `${config.SHOP_API_URL}/api/v1/websites/current/countries?expand=isActive`,
|
|
19
|
+
});
|
|
20
|
+
return body.countries || [];
|
|
21
|
+
}
|
|
22
|
+
async function fetchCountriesLanguages() {
|
|
23
|
+
const { body } = await request({
|
|
24
|
+
url: `${config.SHOP_API_URL}/api/v1/websites/current?expand=languages%2Ccountries`,
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
countries: body.countries?.countries || [],
|
|
28
|
+
languages: body.languages?.languages || [],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
async function fetchCountriesWithLanguages() {
|
|
32
|
+
const { countries, languages } = await fetchCountriesLanguages();
|
|
33
|
+
return countries.map((country) => {
|
|
34
|
+
const abbreviation = country.abbreviation.toUpperCase();
|
|
35
|
+
if (!isCountryCode(abbreviation))
|
|
36
|
+
throw new Error(`Invalid country code: ${abbreviation}`);
|
|
37
|
+
return {
|
|
38
|
+
abbreviation,
|
|
39
|
+
id: country.id,
|
|
40
|
+
languages: languages
|
|
41
|
+
.filter(language => countryIsoCodeToLanguageIsoCode[country.abbreviation]?.includes(language.languageCode) ??
|
|
42
|
+
countryIsoCodeToLanguageIsoCode['*'].includes(language.languageCode.toUpperCase()))
|
|
43
|
+
.map((language) => {
|
|
44
|
+
const languageCode = language.languageCode.toUpperCase();
|
|
45
|
+
if (!isLanguageCode(languageCode))
|
|
46
|
+
throw new Error(`Invalid language code: ${languageCode}`);
|
|
47
|
+
if (!isCultureCode(language.cultureCode))
|
|
48
|
+
throw new Error(`Invalid culture code: ${language.cultureCode}`);
|
|
49
|
+
return {
|
|
50
|
+
cultureCode: language.cultureCode,
|
|
51
|
+
description: language.description,
|
|
52
|
+
id: language.id,
|
|
53
|
+
languageCode,
|
|
54
|
+
};
|
|
55
|
+
}),
|
|
56
|
+
name: country.name,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async function updateLocale({ countryId, languageId, }) {
|
|
61
|
+
const { body } = await request({
|
|
62
|
+
body: JSON.stringify({
|
|
63
|
+
countryId,
|
|
64
|
+
languageId,
|
|
65
|
+
}),
|
|
66
|
+
credentials: 'include',
|
|
67
|
+
headers: {
|
|
68
|
+
'Content-Type': 'application/json',
|
|
69
|
+
},
|
|
70
|
+
method: 'POST',
|
|
71
|
+
url: `${config.SHOP_API_URL}/api/v1/locale`,
|
|
72
|
+
});
|
|
73
|
+
return body;
|
|
74
|
+
}
|
|
75
|
+
async function fetchSettings() {
|
|
76
|
+
const { body } = await request({
|
|
77
|
+
credentials: 'include',
|
|
78
|
+
url: `${config.SHOP_API_URL}/api/v1/settings`,
|
|
79
|
+
});
|
|
80
|
+
return body.settingsCollection;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { fetchCountries, fetchCountriesLanguages, fetchCountriesWithLanguages, fetchSettings, updateLocale };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { config } from '../../../../config.js';
|
|
2
|
+
import { request, BadRequestError } from '../../../fetch/request.js';
|
|
3
|
+
|
|
4
|
+
async function getWishList({ wishListId, }) {
|
|
5
|
+
const { body } = await request({
|
|
6
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}`,
|
|
7
|
+
});
|
|
8
|
+
return body;
|
|
9
|
+
}
|
|
10
|
+
async function getWishLists() {
|
|
11
|
+
const { body } = await request({
|
|
12
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists?page=1&pageSize=999`,
|
|
13
|
+
});
|
|
14
|
+
return body;
|
|
15
|
+
}
|
|
16
|
+
class WishListNameAlreadyExistsError extends Error {
|
|
17
|
+
constructor() {
|
|
18
|
+
super('List name already exists');
|
|
19
|
+
this.name = 'WishListNameAlreadyExistsError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function createWishList(args) {
|
|
23
|
+
try {
|
|
24
|
+
const { body } = await request({
|
|
25
|
+
body: args ? { name: args.name } : {},
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
},
|
|
29
|
+
method: 'POST',
|
|
30
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists`,
|
|
31
|
+
});
|
|
32
|
+
return body;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (error instanceof BadRequestError &&
|
|
36
|
+
error.body?.message === 'Name already exists') {
|
|
37
|
+
throw new WishListNameAlreadyExistsError();
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function deleteWishList({ wishListId, }) {
|
|
43
|
+
await request({
|
|
44
|
+
method: 'DELETE',
|
|
45
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async function addWishListItemToWishList({ productId, wishListId, }) {
|
|
49
|
+
const { body } = await request({
|
|
50
|
+
body: { productId, qtyOrdered: 1, unitOfMeasure: '' },
|
|
51
|
+
headers: {
|
|
52
|
+
'Content-Type': 'application/json',
|
|
53
|
+
},
|
|
54
|
+
method: 'POST',
|
|
55
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines`,
|
|
56
|
+
});
|
|
57
|
+
return body;
|
|
58
|
+
}
|
|
59
|
+
async function deleteWishListItemFromWishList({ wishListId, wishListItemId, }) {
|
|
60
|
+
await request({
|
|
61
|
+
method: 'DELETE',
|
|
62
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines/${wishListItemId}`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async function getWishListItemsByWishListId({ wishListId, }) {
|
|
66
|
+
const { body } = await request({
|
|
67
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines?page=1&pageSize=999`,
|
|
68
|
+
});
|
|
69
|
+
return body;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { WishListNameAlreadyExistsError, addWishListItemToWishList, createWishList, deleteWishList, deleteWishListItemFromWishList, getWishList, getWishListItemsByWishListId, getWishLists };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import qs from 'query-string';
|
|
3
|
+
|
|
4
|
+
const features = {
|
|
5
|
+
cart: 'cartV2',
|
|
6
|
+
language: 'language',
|
|
7
|
+
pdp: 'pdpV2',
|
|
8
|
+
plpv1: 'plpV1',
|
|
9
|
+
searchv1: 'searchV1',
|
|
10
|
+
};
|
|
11
|
+
function useFeatureFlags() {
|
|
12
|
+
const { search } = typeof window === 'undefined'
|
|
13
|
+
? {
|
|
14
|
+
search: '',
|
|
15
|
+
}
|
|
16
|
+
: window.location;
|
|
17
|
+
return useMemo(() => {
|
|
18
|
+
const queryParams = qs.parse(search);
|
|
19
|
+
const hasQueryStringFeatures = queryParams['features'] !== undefined && queryParams['features'] !== null;
|
|
20
|
+
if (!hasQueryStringFeatures) {
|
|
21
|
+
/* When no new feature flags are set get them from localStorage */
|
|
22
|
+
return Object.entries(features).reduce((acc, [, value]) => ({
|
|
23
|
+
...acc,
|
|
24
|
+
[value]: localStorage?.getItem(value) === 'true',
|
|
25
|
+
}), {});
|
|
26
|
+
}
|
|
27
|
+
const queryStringFeatures = String(queryParams['features'])
|
|
28
|
+
.toLowerCase()
|
|
29
|
+
.split(',');
|
|
30
|
+
const featureResults = Object.entries(features).map(([key, value]) => ({
|
|
31
|
+
key: key,
|
|
32
|
+
selected: queryStringFeatures.includes(key),
|
|
33
|
+
value: value,
|
|
34
|
+
}));
|
|
35
|
+
featureResults.forEach(({ selected, value }) => {
|
|
36
|
+
localStorage?.setItem(value, selected.toString());
|
|
37
|
+
});
|
|
38
|
+
return featureResults.reduce((acc, { selected, value }) => ({
|
|
39
|
+
...acc,
|
|
40
|
+
[value]: selected,
|
|
41
|
+
}), {});
|
|
42
|
+
}, [search]);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { useFeatureFlags };
|