@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,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useHits } from 'react-instantsearch';
|
|
3
|
+
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
4
|
+
|
|
5
|
+
function AlgoliaResultsCount() {
|
|
6
|
+
const { results } = useHits();
|
|
7
|
+
const t = useFormattedMessage();
|
|
8
|
+
if (!results)
|
|
9
|
+
return null;
|
|
10
|
+
const count = results.nbHits;
|
|
11
|
+
return `${count} ${count === 1 ? t('article') : t('articles')}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { AlgoliaResultsCount };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { createContext, useState, useMemo, useRef, useEffect } from 'react';
|
|
4
|
+
import { createAutocomplete } from '@algolia/autocomplete-core';
|
|
5
|
+
import { getAlgoliaResults } from '@algolia/autocomplete-preset-algolia';
|
|
6
|
+
import { config } from '../config.js';
|
|
7
|
+
import { categoriesPlugin } from '../global-search/plugins/categories-plugin.js';
|
|
8
|
+
import { popularCategoriesPlugin } from '../global-search/plugins/popular-categories-plugin.js';
|
|
9
|
+
import { popularSearchesPlugin } from '../global-search/plugins/popular-searches-plugin.js';
|
|
10
|
+
import { querySuggestionsPlugin } from '../global-search/plugins/query-suggestions-plugin.js';
|
|
11
|
+
import { quickAccessPlugin } from '../global-search/plugins/quick-access-plugin.js';
|
|
12
|
+
import { recentSearchesPlugin } from '../global-search/plugins/recent-searches-plugin.js';
|
|
13
|
+
import { useLanguageCode } from '../intl/use-language-code.js';
|
|
14
|
+
import { useDebouncedCallback } from '../shared/hooks/use-debounced-callback.js';
|
|
15
|
+
import { environment } from '../shared/utils/environment.js';
|
|
16
|
+
import { getAlgoliaIndex } from './algolia-index-config.js';
|
|
17
|
+
import { AlgoliaInsightsProvider } from './algolia-insights-provider.js';
|
|
18
|
+
import { createSonicSearchClient } from './algolia-sonic-searchclient.js';
|
|
19
|
+
|
|
20
|
+
const GlobalSearchContext = createContext(null);
|
|
21
|
+
function AlgoliaSearchProvider({ children, searchClient: _searchClient, }) {
|
|
22
|
+
const [state, setState] = useState({
|
|
23
|
+
activeItemId: null,
|
|
24
|
+
collections: [],
|
|
25
|
+
completion: null,
|
|
26
|
+
context: {},
|
|
27
|
+
isOpen: false,
|
|
28
|
+
query: '',
|
|
29
|
+
status: 'idle',
|
|
30
|
+
});
|
|
31
|
+
const searchClient = useMemo(() => _searchClient ||
|
|
32
|
+
createSonicSearchClient({
|
|
33
|
+
apiKey: config.ALGOLIA_API_KEY,
|
|
34
|
+
appId: config.ALGOLIA_APP_ID,
|
|
35
|
+
host: config.ALGOLIA_HOST,
|
|
36
|
+
}), [_searchClient]);
|
|
37
|
+
const languageCode = useLanguageCode();
|
|
38
|
+
const index = getAlgoliaIndex(environment, languageCode);
|
|
39
|
+
const productsIndexName = index.default;
|
|
40
|
+
const productsQuerySuggestionsIndexName = index.suggestions;
|
|
41
|
+
const getSources = useDebouncedCallback(({ query }) => {
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
getItems() {
|
|
45
|
+
return getAlgoliaResults({
|
|
46
|
+
queries: [
|
|
47
|
+
{
|
|
48
|
+
indexName: productsIndexName,
|
|
49
|
+
params: {
|
|
50
|
+
hitsPerPage: 5,
|
|
51
|
+
},
|
|
52
|
+
query,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
searchClient,
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
sourceId: 'productsPlugin',
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
}, 300);
|
|
62
|
+
/**
|
|
63
|
+
* https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer/#mirror-a-native-mobile-experience
|
|
64
|
+
*/
|
|
65
|
+
const autocomplete = useMemo(() => createAutocomplete({
|
|
66
|
+
autoFocus: true,
|
|
67
|
+
getSources,
|
|
68
|
+
insights: true,
|
|
69
|
+
onStateChange({ state }) {
|
|
70
|
+
setState(state);
|
|
71
|
+
},
|
|
72
|
+
openOnFocus: true,
|
|
73
|
+
plugins: [
|
|
74
|
+
querySuggestionsPlugin({
|
|
75
|
+
searchClient,
|
|
76
|
+
suggestionsIndexName: productsQuerySuggestionsIndexName,
|
|
77
|
+
}),
|
|
78
|
+
popularCategoriesPlugin({
|
|
79
|
+
productsIndexName,
|
|
80
|
+
searchClient,
|
|
81
|
+
}),
|
|
82
|
+
quickAccessPlugin({
|
|
83
|
+
productsIndexName,
|
|
84
|
+
searchClient,
|
|
85
|
+
}),
|
|
86
|
+
categoriesPlugin({
|
|
87
|
+
productsIndexName,
|
|
88
|
+
searchClient,
|
|
89
|
+
}),
|
|
90
|
+
popularSearchesPlugin({
|
|
91
|
+
searchClient,
|
|
92
|
+
suggestionsIndexName: productsQuerySuggestionsIndexName,
|
|
93
|
+
}),
|
|
94
|
+
recentSearchesPlugin,
|
|
95
|
+
],
|
|
96
|
+
}),
|
|
97
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
|
+
[productsIndexName, productsQuerySuggestionsIndexName, searchClient]);
|
|
99
|
+
/**
|
|
100
|
+
* https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer/#mirror-a-native-mobile-experience
|
|
101
|
+
*/
|
|
102
|
+
const inputRef = useRef(null);
|
|
103
|
+
const formRef = useRef(null);
|
|
104
|
+
const panelRef = useRef(null);
|
|
105
|
+
const { getEnvironmentProps } = autocomplete;
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (typeof window === 'undefined')
|
|
108
|
+
return;
|
|
109
|
+
if (!formRef.current || !panelRef.current || !inputRef.current) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const { onMouseDown, onTouchMove, onTouchStart } = getEnvironmentProps({
|
|
113
|
+
formElement: formRef.current,
|
|
114
|
+
inputElement: inputRef.current,
|
|
115
|
+
panelElement: panelRef.current,
|
|
116
|
+
});
|
|
117
|
+
window.addEventListener('mousedown', onMouseDown);
|
|
118
|
+
window.addEventListener('touchstart', onTouchStart);
|
|
119
|
+
window.addEventListener('touchmove', onTouchMove);
|
|
120
|
+
return () => {
|
|
121
|
+
window?.removeEventListener('mousedown', onMouseDown);
|
|
122
|
+
window?.removeEventListener('touchstart', onTouchStart);
|
|
123
|
+
window?.removeEventListener('touchmove', onTouchMove);
|
|
124
|
+
};
|
|
125
|
+
}, [getEnvironmentProps, state.isOpen]);
|
|
126
|
+
return (jsx(AlgoliaInsightsProvider, { value: { index: productsIndexName }, children: jsx(GlobalSearchContext.Provider, { value: {
|
|
127
|
+
autocomplete,
|
|
128
|
+
formRef,
|
|
129
|
+
inputRef,
|
|
130
|
+
panelRef,
|
|
131
|
+
productsIndexName,
|
|
132
|
+
productsQuerySuggestionsIndexName,
|
|
133
|
+
searchClient,
|
|
134
|
+
setState,
|
|
135
|
+
state,
|
|
136
|
+
}, children: typeof children === 'function' ? children(autocomplete) : children }) }));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { AlgoliaSearchProvider, GlobalSearchContext };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const searchClientLogger = (searchClient) => {
|
|
3
|
+
return {
|
|
4
|
+
...searchClient,
|
|
5
|
+
search: (async (queries, requestOptions) => {
|
|
6
|
+
const response = await searchClient.search(queries, requestOptions);
|
|
7
|
+
// eslint-disable-next-line no-console
|
|
8
|
+
console.log('Algolia::SearchClient::search', {
|
|
9
|
+
args: { queries, requestOptions },
|
|
10
|
+
response,
|
|
11
|
+
});
|
|
12
|
+
return response;
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const offlineSearchClient = {
|
|
17
|
+
search(_queries, _requestOptions) {
|
|
18
|
+
return fetch('data/algolia.json').then(response => response.json());
|
|
19
|
+
},
|
|
20
|
+
async searchForFacetValues(_queries, _requestOptions) {
|
|
21
|
+
return [];
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { offlineSearchClient, searchClientLogger };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import algoliasearch from 'algoliasearch';
|
|
3
|
+
|
|
4
|
+
const createSonicSearchClient = ({ apiKey, appId, host, }) => {
|
|
5
|
+
const searchClient = algoliasearch(appId, apiKey);
|
|
6
|
+
if (!host) {
|
|
7
|
+
return searchClient;
|
|
8
|
+
}
|
|
9
|
+
const read = searchClient.transporter.read;
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
searchClient.transporter.hosts = [{ accept: 1, protocol: 'https', url: host }];
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
searchClient.transporter.timeouts = { connect: 3000, read: 3000, write: 3000 };
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
searchClient.transporter.read = (request) => {
|
|
19
|
+
request.path = `/api/v1/bff/${request.path.replace('*', 'x')}`;
|
|
20
|
+
return read(request);
|
|
21
|
+
};
|
|
22
|
+
return searchClient;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { createSonicSearchClient };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useSortBy } from 'react-instantsearch';
|
|
4
|
+
import { Select } from '../forms/select/select.js';
|
|
5
|
+
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
6
|
+
import { useLanguageCode } from '../intl/use-language-code.js';
|
|
7
|
+
import { environment } from '../shared/utils/environment.js';
|
|
8
|
+
import { getAlgoliaIndex } from './algolia-index-config.js';
|
|
9
|
+
|
|
10
|
+
function AlgoliaSortBy() {
|
|
11
|
+
const languageCode = useLanguageCode();
|
|
12
|
+
const algoliaIndex = getAlgoliaIndex(environment, languageCode);
|
|
13
|
+
const t = useFormattedMessage();
|
|
14
|
+
const { currentRefinement, options: algoliaOptions, refine, } = useSortBy({
|
|
15
|
+
items: algoliaIndex.sort.map(({ index, name }) => ({
|
|
16
|
+
label: t(`sort.${name}`),
|
|
17
|
+
value: index,
|
|
18
|
+
})),
|
|
19
|
+
});
|
|
20
|
+
if (algoliaOptions.length === 0)
|
|
21
|
+
return null;
|
|
22
|
+
const options = algoliaOptions.reduce((acc, option) => {
|
|
23
|
+
acc[option.value] = option.label;
|
|
24
|
+
return acc;
|
|
25
|
+
}, {});
|
|
26
|
+
return (jsx(Select, { label: t('Sort by'), onChange: value => refine(String(value)), options: options, selectedOption: currentRefinement, showLabel: false, size: "sm" }));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { AlgoliaSortBy };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { Accordion } from '../collapsables/accordion/accordion.js';
|
|
4
|
+
import { AccordionItem } from '../collapsables/accordion/accordion-item.js';
|
|
5
|
+
import { FormattedMessage } from '../intl/formatted-message.js';
|
|
6
|
+
import filterSectionStyles from './filter-section.module.css.js';
|
|
7
|
+
|
|
8
|
+
function FilterSection({ ...props }) {
|
|
9
|
+
const variant = props.variant;
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
11
|
+
if (props.variant === 'collapsible') {
|
|
12
|
+
return jsx(CollapsibleFilterSection, { ...props });
|
|
13
|
+
}
|
|
14
|
+
if (props.variant === 'default') {
|
|
15
|
+
return jsx(DefaultFilterSection, { ...props });
|
|
16
|
+
}
|
|
17
|
+
if (props.variant === 'with-action') {
|
|
18
|
+
return jsx(WithActionFilterSection, { ...props });
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`Invalid variant ${variant}`);
|
|
21
|
+
/* eslint-enable @typescript-eslint/no-unnecessary-condition */
|
|
22
|
+
}
|
|
23
|
+
function CollapsibleFilterSection({ children, gap = 'md', initialIsOpen = true, title, variant, }) {
|
|
24
|
+
return (jsx("section", { className: clsx(filterSectionStyles['filter-section'], filterSectionStyles[variant], filterSectionStyles[gap]), children: jsx(Accordion, { borderType: "middle", children: jsx(AccordionItem, { id: title, initialIsOpen: initialIsOpen, title: jsx("span", { className: filterSectionStyles['accordion-title'], children: jsx(FormattedMessage, { optional: true, fallbackValue: title, id: `facet.${title.toLowerCase()}` }) }), children: jsx("div", { className: filterSectionStyles.content, children: children }) }) }) }));
|
|
25
|
+
}
|
|
26
|
+
function WithActionFilterSection({ button, children, gap = 'md', title, variant, }) {
|
|
27
|
+
return (jsxs("section", { className: clsx(filterSectionStyles['filter-section'], filterSectionStyles[variant], filterSectionStyles[gap]), children: [jsxs("div", { className: filterSectionStyles.header, children: [jsx("h3", { className: filterSectionStyles.title, children: title }), jsx("div", { children: button })] }), jsx("div", { className: filterSectionStyles.content, children: children })] }));
|
|
28
|
+
}
|
|
29
|
+
function DefaultFilterSection({ children, gap = 'md', title, variant, }) {
|
|
30
|
+
return (jsxs("section", { className: clsx(filterSectionStyles['filter-section'], filterSectionStyles[variant], filterSectionStyles[gap]), children: [jsx("h3", { className: filterSectionStyles.title, children: title }), jsx("div", { className: filterSectionStyles.content, children: children })] }));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { FilterSection };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var filterSectionStyles = {"filter-section":"filter-section-module-q1Ob8","default":"filter-section-module-JkP09","title":"filter-section-module-hWVv-","with-action":"filter-section-module-9qc6L","header":"filter-section-module-zi2ZE","content":"filter-section-module-15-YW","border-top":"filter-section-module-dGcTY","filter-section-item":"filter-section-module-n-AWg"};
|
|
2
|
+
|
|
3
|
+
export { filterSectionStyles as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { transformAlgoliaProductHitToProductHit, transformAlgoliaPromoHitToPromoHit } from '../shared/model/hit.js';
|
|
3
|
+
import { useGlobalState } from '../shared/providers/global-state-provider.js';
|
|
4
|
+
import { isAlgoliaProductHit } from './algolia-hit-type.js';
|
|
5
|
+
|
|
6
|
+
const useAlgoliaHitsItems = () => useGlobalState('algolia-product-hits-items', []);
|
|
7
|
+
const useAlgoliaHitsLoading = () => useGlobalState('algolia-product-hits-loading');
|
|
8
|
+
function useAlgoliaHits() {
|
|
9
|
+
const [items] = useAlgoliaHitsItems();
|
|
10
|
+
const [isLoading] = useAlgoliaHitsLoading();
|
|
11
|
+
return {
|
|
12
|
+
hits: items.map(hit => isAlgoliaProductHit(hit)
|
|
13
|
+
? transformAlgoliaProductHitToProductHit(hit)
|
|
14
|
+
: transformAlgoliaPromoHitToPromoHit(hit)),
|
|
15
|
+
isLoading,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { useAlgoliaHits, useAlgoliaHitsItems, useAlgoliaHitsLoading };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useGlobalState } from '../shared/providers/global-state-provider.js';
|
|
3
|
+
|
|
4
|
+
function useAlgoliaInsightsGlobalState() {
|
|
5
|
+
const [state, setState] = useGlobalState('algolia-insights-global-state', {});
|
|
6
|
+
return [state, setState];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { useAlgoliaInsightsGlobalState };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import aa from 'search-insights';
|
|
4
|
+
import { currencySymbolToISO } from '../shared/model/currency.js';
|
|
5
|
+
import { ensureArray } from '../shared/utils/array.js';
|
|
6
|
+
import { AlgoliaInsightsProviderContext } from './algolia-insights-provider.js';
|
|
7
|
+
import { userToken } from './algolia-intialization.js';
|
|
8
|
+
import { useAlgoliaInsightsGlobalState } from './use-algolia-insights-provider-global-state.js';
|
|
9
|
+
|
|
10
|
+
function getCurrencyFromPriceString(priceString) {
|
|
11
|
+
const currencySymbol = priceString?.replace(/[\d ,.-]/g, '');
|
|
12
|
+
return currencySymbol ? currencySymbolToISO[currencySymbol] : undefined;
|
|
13
|
+
}
|
|
14
|
+
function useAlgoliaInsights() {
|
|
15
|
+
const context = useContext(AlgoliaInsightsProviderContext);
|
|
16
|
+
const [, setGlobalState] = useAlgoliaInsightsGlobalState();
|
|
17
|
+
return {
|
|
18
|
+
context,
|
|
19
|
+
sendAddToCartFromProductListPageEvent({ cartLine, objectId }) {
|
|
20
|
+
if (!context.index)
|
|
21
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
22
|
+
if (!context.queryId)
|
|
23
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no queryId', context);
|
|
24
|
+
aa('addedToCartObjectIDsAfterSearch', {
|
|
25
|
+
currency: getCurrencyFromPriceString(cartLine.pricing?.actualPriceDisplay),
|
|
26
|
+
eventName: 'PLP: AddToCart ClickedAfterSearch',
|
|
27
|
+
index: context.index,
|
|
28
|
+
objectData: [
|
|
29
|
+
{
|
|
30
|
+
price: cartLine.pricing?.actualPrice || undefined,
|
|
31
|
+
quantity: cartLine.qtyOrdered || undefined,
|
|
32
|
+
queryID: context.queryId,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
objectIDs: [objectId],
|
|
36
|
+
queryID: context.queryId,
|
|
37
|
+
userToken,
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
sendAddToCartFromSearchEvent({ cartLine, objectId, queryId }) {
|
|
41
|
+
if (!context.index)
|
|
42
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
43
|
+
aa('addedToCartObjectIDsAfterSearch', {
|
|
44
|
+
currency: getCurrencyFromPriceString(cartLine.pricing?.actualPriceDisplay),
|
|
45
|
+
eventName: 'SRP: AddToCart ClickedAfterSearch',
|
|
46
|
+
index: context.index,
|
|
47
|
+
objectData: [
|
|
48
|
+
{
|
|
49
|
+
price: cartLine.pricing?.actualPrice || undefined,
|
|
50
|
+
quantity: cartLine.qtyOrdered || undefined,
|
|
51
|
+
queryID: context.queryId,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
objectIDs: [objectId],
|
|
55
|
+
queryID: queryId,
|
|
56
|
+
userToken,
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
sendAddToCartFromSearchResultPageEvent({ cartLine, objectId }) {
|
|
60
|
+
if (!context.index)
|
|
61
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
62
|
+
if (!context.queryId)
|
|
63
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no queryId', context);
|
|
64
|
+
aa('addedToCartObjectIDsAfterSearch', {
|
|
65
|
+
currency: getCurrencyFromPriceString(cartLine.pricing?.actualPriceDisplay),
|
|
66
|
+
eventName: 'SRP: AddToCart ClickedAfterSearch',
|
|
67
|
+
index: context.index,
|
|
68
|
+
objectData: [
|
|
69
|
+
{
|
|
70
|
+
price: cartLine.pricing?.actualPrice || undefined,
|
|
71
|
+
quantity: cartLine.qtyOrdered || undefined,
|
|
72
|
+
queryID: context.queryId,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
objectIDs: [objectId],
|
|
76
|
+
queryID: context.queryId,
|
|
77
|
+
userToken,
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
sendAddToWishListFromProductListPageEvent({ objectId, position }) {
|
|
81
|
+
if (!context.index)
|
|
82
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
83
|
+
if (!context.queryId)
|
|
84
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no queryId', context);
|
|
85
|
+
aa('clickedObjectIDsAfterSearch', {
|
|
86
|
+
eventName: 'PLP: Product Added to Wishlist',
|
|
87
|
+
index: context.index,
|
|
88
|
+
objectIDs: [objectId],
|
|
89
|
+
positions: [position],
|
|
90
|
+
queryID: context.queryId,
|
|
91
|
+
userToken,
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
sendAddToWishListFromSearchEvent({ objectId, position, queryId }) {
|
|
95
|
+
if (!context.index)
|
|
96
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
97
|
+
aa('clickedObjectIDsAfterSearch', {
|
|
98
|
+
eventName: 'SRP: Product Added to Wishlist',
|
|
99
|
+
index: context.index,
|
|
100
|
+
objectIDs: [objectId],
|
|
101
|
+
positions: [position],
|
|
102
|
+
queryID: queryId,
|
|
103
|
+
userToken,
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
sendAddToWishListFromSearchResultPageEvent({ objectId, position, }) {
|
|
107
|
+
if (!context.index)
|
|
108
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
109
|
+
if (!context.queryId)
|
|
110
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no queryId', context);
|
|
111
|
+
aa('clickedObjectIDsAfterSearch', {
|
|
112
|
+
eventName: 'SRP: Product Added to Wishlist',
|
|
113
|
+
index: context.index,
|
|
114
|
+
objectIDs: [objectId],
|
|
115
|
+
positions: [position],
|
|
116
|
+
queryID: context.queryId,
|
|
117
|
+
userToken,
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
sendProductClickFromProductListPageEvent({ objectId, position }) {
|
|
121
|
+
if (!objectId)
|
|
122
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
123
|
+
if (!context.index)
|
|
124
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
125
|
+
if (!context.queryId)
|
|
126
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no queryId', context);
|
|
127
|
+
aa('clickedObjectIDsAfterSearch', {
|
|
128
|
+
eventName: 'PLP: Product Clicked',
|
|
129
|
+
index: context.index,
|
|
130
|
+
objectIDs: [objectId],
|
|
131
|
+
positions: [position],
|
|
132
|
+
queryID: context.queryId,
|
|
133
|
+
userToken,
|
|
134
|
+
});
|
|
135
|
+
setGlobalState({
|
|
136
|
+
index: context.index,
|
|
137
|
+
queryId: context.queryId,
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
sendProductClickFromSearchEvent({ objectId, position, queryId }) {
|
|
141
|
+
if (!objectId)
|
|
142
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
143
|
+
if (!context.index)
|
|
144
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
145
|
+
aa('clickedObjectIDsAfterSearch', {
|
|
146
|
+
eventName: 'SRP: Product Clicked',
|
|
147
|
+
index: context.index,
|
|
148
|
+
objectIDs: ensureArray(objectId),
|
|
149
|
+
positions: ensureArray(position),
|
|
150
|
+
queryID: queryId,
|
|
151
|
+
userToken,
|
|
152
|
+
});
|
|
153
|
+
setGlobalState({
|
|
154
|
+
index: context.index,
|
|
155
|
+
queryId,
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
sendProductClickFromSearchResultPageEvent({ objectId, position }) {
|
|
159
|
+
if (!objectId)
|
|
160
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
161
|
+
if (!context.index)
|
|
162
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
163
|
+
if (!context.queryId)
|
|
164
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no queryId', context);
|
|
165
|
+
aa('clickedObjectIDsAfterSearch', {
|
|
166
|
+
eventName: 'SRP: Product Clicked',
|
|
167
|
+
index: context.index,
|
|
168
|
+
objectIDs: [objectId],
|
|
169
|
+
positions: [position],
|
|
170
|
+
queryID: context.queryId,
|
|
171
|
+
userToken,
|
|
172
|
+
});
|
|
173
|
+
setGlobalState({
|
|
174
|
+
index: context.index,
|
|
175
|
+
queryId: context.queryId,
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export { useAlgoliaInsights };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useGlobalState } from '../shared/providers/global-state-provider.js';
|
|
3
|
+
|
|
4
|
+
const useAlgoliaInstantSearchStateIndex = () => useGlobalState('algolia-global-state-index');
|
|
5
|
+
const useAlgoliaInstantSearchStateQueryId = () => useGlobalState('algolia-global-state-queryId');
|
|
6
|
+
const useAlgoliaInstantSearchStateOnline = (initialState) => useGlobalState('algolia-global-state-online', initialState ?? true);
|
|
7
|
+
const useAlgoliaInstantSearchStateStatus = (initialState) => useGlobalState('algolia-global-state-status', initialState ?? 'idle');
|
|
8
|
+
function useAlgoliaInstantSearchState(initialState) {
|
|
9
|
+
const [index, setIndex] = useAlgoliaInstantSearchStateIndex();
|
|
10
|
+
const [queryId, setQueryId] = useAlgoliaInstantSearchStateQueryId();
|
|
11
|
+
const [online, setOnline] = useAlgoliaInstantSearchStateOnline(initialState?.online);
|
|
12
|
+
const [status, setStatus] = useAlgoliaInstantSearchStateStatus(initialState?.status);
|
|
13
|
+
return {
|
|
14
|
+
index,
|
|
15
|
+
online,
|
|
16
|
+
queryId,
|
|
17
|
+
setIndex,
|
|
18
|
+
setOnline,
|
|
19
|
+
setQueryId,
|
|
20
|
+
setStatus,
|
|
21
|
+
status,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { useAlgoliaInstantSearchState, useAlgoliaInstantSearchStateIndex, useAlgoliaInstantSearchStateOnline, useAlgoliaInstantSearchStateQueryId, useAlgoliaInstantSearchStateStatus };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { transformAlgoliaProductHitToProductHit, transformAlgoliaPromoHitToPromoHit } from '../shared/model/hit.js';
|
|
4
|
+
import { isAlgoliaProductHit } from './algolia-hit-type.js';
|
|
5
|
+
import { GlobalSearchContext } from './algolia-search-provider.js';
|
|
6
|
+
|
|
7
|
+
function useAlgoliaSearch() {
|
|
8
|
+
const globalSearch = useContext(GlobalSearchContext);
|
|
9
|
+
if (!globalSearch) {
|
|
10
|
+
throw new Error('This component must be wrapped with a GlobalSearchProvider');
|
|
11
|
+
}
|
|
12
|
+
const { state } = globalSearch;
|
|
13
|
+
const products = state.collections
|
|
14
|
+
.map(collection => ({
|
|
15
|
+
...collection,
|
|
16
|
+
items: collection.items.map(hit => isAlgoliaProductHit(hit)
|
|
17
|
+
? transformAlgoliaProductHitToProductHit(hit)
|
|
18
|
+
: transformAlgoliaPromoHitToPromoHit(hit)),
|
|
19
|
+
}))
|
|
20
|
+
.find(collection => collection.source.sourceId === 'productsPlugin');
|
|
21
|
+
const popularSearches = state.collections.find(collection => collection.source.sourceId === 'popularSearchesPlugin');
|
|
22
|
+
const recentSearches = state.collections.find(collection => collection.source.sourceId === 'recentSearchesPlugin');
|
|
23
|
+
const quickAccess = state.collections.find(collection => collection.source.sourceId === 'quickAccessPlugin');
|
|
24
|
+
const popularCategories = state.collections.find(collection => collection.source.sourceId === 'popularCategoriesPlugin');
|
|
25
|
+
const querySuggestions = state.collections.find(collection => collection.source.sourceId === 'querySuggestionsPlugin');
|
|
26
|
+
const categories = state.collections.find(collection => collection.source.sourceId === 'categoriesPlugin');
|
|
27
|
+
const hasResults = !!products?.items.length;
|
|
28
|
+
return {
|
|
29
|
+
...globalSearch,
|
|
30
|
+
categories,
|
|
31
|
+
hasResults,
|
|
32
|
+
popularCategories,
|
|
33
|
+
popularSearches,
|
|
34
|
+
products,
|
|
35
|
+
querySuggestions,
|
|
36
|
+
quickAccess,
|
|
37
|
+
recentSearches,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { useAlgoliaSearch };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import ReactDOM from 'react-dom';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import styles from './background-overlay.module.css.js';
|
|
7
|
+
|
|
8
|
+
function BackgroundOverlay({ className, isOpen, onClose, }) {
|
|
9
|
+
const [, setRender] = useState(isOpen);
|
|
10
|
+
const nodeRef = useRef(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (isOpen)
|
|
13
|
+
setRender(isOpen);
|
|
14
|
+
}, [isOpen]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const node = nodeRef.current;
|
|
17
|
+
if (!node || isOpen)
|
|
18
|
+
return;
|
|
19
|
+
const handleAnimationEnd = () => {
|
|
20
|
+
setRender(false);
|
|
21
|
+
node.removeEventListener('animationend', handleAnimationEnd);
|
|
22
|
+
};
|
|
23
|
+
node.addEventListener('animationend', handleAnimationEnd);
|
|
24
|
+
}, [isOpen]);
|
|
25
|
+
if (typeof document === 'undefined')
|
|
26
|
+
return null;
|
|
27
|
+
return ReactDOM.createPortal(jsx("div", { ref: nodeRef, className: clsx(styles['background-overlay'], {
|
|
28
|
+
[styles['open']]: isOpen,
|
|
29
|
+
[styles['close']]: !isOpen,
|
|
30
|
+
}, className), onClick: onClose, onKeyUp: event => {
|
|
31
|
+
if (event.key === 'Escape')
|
|
32
|
+
onClose?.();
|
|
33
|
+
}, role: "none" }), document.body);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { BackgroundOverlay };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import styles from './badge.module.css.js';
|
|
6
|
+
|
|
7
|
+
const ANIMATION_DURATION = 600;
|
|
8
|
+
function Badge({ count, variant = 'red' }) {
|
|
9
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (count === undefined)
|
|
12
|
+
return;
|
|
13
|
+
setIsAnimating(true);
|
|
14
|
+
const timer = setTimeout(() => setIsAnimating(false), ANIMATION_DURATION);
|
|
15
|
+
return () => clearTimeout(timer);
|
|
16
|
+
}, [count]);
|
|
17
|
+
return (jsx("span", { className: clsx(styles.badge, styles[variant], {
|
|
18
|
+
[styles['is-animating']]: isAnimating,
|
|
19
|
+
}), style: { '--animation-duration': `${ANIMATION_DURATION}ms` }, children: count !== undefined && jsx("span", { className: styles.count, children: count }) }, count));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { Badge };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import styles from './icon-with-badge.module.css.js';
|
|
3
|
+
|
|
4
|
+
function IconWithBadge({ badge, icon }) {
|
|
5
|
+
return (jsxs("div", { className: styles['icon-with-badge'], children: [icon, jsx("div", { className: styles['badge-wrapper'], children: badge })] }));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { IconWithBadge };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import styles from './tag.module.css.js';
|
|
3
|
+
|
|
4
|
+
function Tag({ children }) {
|
|
5
|
+
if (!children)
|
|
6
|
+
return null;
|
|
7
|
+
return (jsxs("div", { className: styles.tag, children: [jsx("div", { className: styles.body, children: children }), jsx("svg", { className: styles.shape, height: "16", viewBox: "0 0 9 16", width: "9", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M1.92461763,0 L0,0 L0,16 L1.92461763,16 L6.4117887,16 L8.87489381,7.57121588 C9.23711515,6.3325062 8.79482383,4.99454094 7.78060408,4.2560794 L1.92461763,0 Z", fill: "currentColor" }) })] }));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { Tag };
|