@sonic-equipment/ui 0.0.119 → 121.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 +109 -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.d.ts +2 -1
- 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 +13 -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.d.ts +0 -1
- 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.d.ts +2 -1
- 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 +14 -23
- 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,7 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
|
|
2
|
+
import { __require as requireLib } from '../node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/index.js';
|
|
3
|
+
|
|
4
|
+
var libExports = requireLib();
|
|
5
|
+
var qs = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
6
|
+
|
|
7
|
+
export { qs as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useHierarchicalMenu } from 'react-instantsearch';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { StrokeCategoriesIcon } from '../icons/stroke/stroke-categories-icon.js';
|
|
6
|
+
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
7
|
+
import { RouteLink } from '../shared/routing/route-link.js';
|
|
8
|
+
import { FilterSection } from './filter-section.js';
|
|
9
|
+
import styles from './algolia-filter-panel.module.css.js';
|
|
10
|
+
import filterSectionStyles from './filter-section.module.css.js';
|
|
11
|
+
|
|
12
|
+
function AlgoliaActiveCategories() {
|
|
13
|
+
const { items: categories } = useHierarchicalMenu({
|
|
14
|
+
attributes: [
|
|
15
|
+
'hierarchicalCategories.lvl0',
|
|
16
|
+
'hierarchicalCategories.lvl1',
|
|
17
|
+
'hierarchicalCategories.lvl2',
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
const t = useFormattedMessage();
|
|
21
|
+
if (categories.length <= 0)
|
|
22
|
+
return null;
|
|
23
|
+
return (jsx(FilterSection, { gap: "sm", title: t('facet.categories'), variant: "default", children: jsx(Categories, { categories: categories, path: "/Catalog" }) }));
|
|
24
|
+
}
|
|
25
|
+
function Categories({ categories, path: _path, }) {
|
|
26
|
+
return categories
|
|
27
|
+
.filter(category => category.isRefined)
|
|
28
|
+
.map(category => {
|
|
29
|
+
const categorySlug = category.label.toLowerCase().replaceAll(' ', '-');
|
|
30
|
+
const path = `${_path}/${categorySlug}`;
|
|
31
|
+
const isActive = !category.data || !category.data.some(c => c.isRefined);
|
|
32
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: filterSectionStyles['filter-section-item'], children: jsxs(RouteLink, { hasUnderline: true, className: clsx(styles.category, {
|
|
33
|
+
[styles['is-active']]: isActive,
|
|
34
|
+
}), href: path, isDisabled: isActive, children: [jsx(StrokeCategoriesIcon, { height: 24, width: 24 }), jsx("span", { children: category.label })] }) }), category.data && (jsx(Categories, { categories: category.data, path: path }))] }, category.value));
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { AlgoliaActiveCategories };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useCurrentRefinements, useClearRefinements } from 'react-instantsearch';
|
|
4
|
+
import { ActiveFilters } from '../filters/active-filters/active-filters.js';
|
|
5
|
+
|
|
6
|
+
function AlgoliaActiveFilters() {
|
|
7
|
+
const { items, refine } = useCurrentRefinements();
|
|
8
|
+
const itemsToIgnore = [
|
|
9
|
+
'hierarchicalCategories.lvl0',
|
|
10
|
+
'hierarchicalCategories.lvl1',
|
|
11
|
+
'hierarchicalCategories.lvl2',
|
|
12
|
+
];
|
|
13
|
+
const { refine: clearAllFilters } = useClearRefinements({
|
|
14
|
+
excludedAttributes: itemsToIgnore,
|
|
15
|
+
});
|
|
16
|
+
const itemsToDisplay = items.filter(item => !itemsToIgnore.includes(item.label));
|
|
17
|
+
const selectedFilterCategories = itemsToDisplay
|
|
18
|
+
.sort((a, b) => (a.label.localeCompare(b.label) ? 1 : -1))
|
|
19
|
+
.map((category) => ({
|
|
20
|
+
filters: category.refinements,
|
|
21
|
+
label: category.label,
|
|
22
|
+
}));
|
|
23
|
+
function onClearFilter(categoryLabel, filter) {
|
|
24
|
+
selectedFilterCategories
|
|
25
|
+
.filter(category => category.label === categoryLabel)
|
|
26
|
+
.flatMap(category => category.filters)
|
|
27
|
+
.filter(f => f.value === filter.value)
|
|
28
|
+
.forEach(refine);
|
|
29
|
+
}
|
|
30
|
+
return (jsx(ActiveFilters, { onClearAllFilters: clearAllFilters, onClearFilter: onClearFilter, selectedFilterCategories: selectedFilterCategories }));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { AlgoliaActiveFilters };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Fragment } from 'react';
|
|
4
|
+
import { useHierarchicalMenu } from 'react-instantsearch';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { Link } from '../buttons/link/link.js';
|
|
7
|
+
import { StrokeCategoriesIcon } from '../icons/stroke/stroke-categories-icon.js';
|
|
8
|
+
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
9
|
+
import { FilterSection } from './filter-section.js';
|
|
10
|
+
import styles from './algolia-filter-panel.module.css.js';
|
|
11
|
+
import filterSectionStyles from './filter-section.module.css.js';
|
|
12
|
+
|
|
13
|
+
function AlgoliaCategoriesFilters() {
|
|
14
|
+
const { items: categories, refine } = useHierarchicalMenu({
|
|
15
|
+
attributes: [
|
|
16
|
+
'hierarchicalCategories.lvl0',
|
|
17
|
+
'hierarchicalCategories.lvl1',
|
|
18
|
+
'hierarchicalCategories.lvl2',
|
|
19
|
+
],
|
|
20
|
+
});
|
|
21
|
+
const t = useFormattedMessage();
|
|
22
|
+
if (categories.length <= 0)
|
|
23
|
+
return null;
|
|
24
|
+
return (jsx(FilterSection, { title: t('facet.categories'), variant: "default", children: categories.map(category => (jsx(Fragment, { children: jsx("div", { className: filterSectionStyles['filter-section-item'], children: jsxs(Link, { hasUnderline: true, className: clsx(styles.category, {
|
|
25
|
+
[styles['is-active']]: category.isRefined,
|
|
26
|
+
}), onClick: () => refine(category.value), children: [jsx(StrokeCategoriesIcon, { height: 24, width: 24 }), jsx("span", { children: category.label }), jsxs("span", { className: styles.count, children: ["(", category.count, ")"] })] }) }) }, category.value))) }));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { AlgoliaCategoriesFilters };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRefinementList } from 'react-instantsearch';
|
|
3
|
+
|
|
4
|
+
function AlgoliaDummyRefinementListConsumer() {
|
|
5
|
+
/*
|
|
6
|
+
* This component supresses the following Algolia warning:
|
|
7
|
+
*
|
|
8
|
+
* [InstantSearch.js]: The UI state for the index "instant_search" is not consistent with the widgets mounted.
|
|
9
|
+
*
|
|
10
|
+
* When the page loads the useDynamicWidgets hook is called to
|
|
11
|
+
* get a list of attributes to render. This is list is empty initially
|
|
12
|
+
* and therefor no refinement list is rendered. This causes the warning.
|
|
13
|
+
*
|
|
14
|
+
* Reference: https://github.com/algolia/instantsearch/pull/4140
|
|
15
|
+
*/
|
|
16
|
+
useRefinementList({ attribute: 'dummy' });
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { AlgoliaDummyRefinementListConsumer };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useDynamicWidgets } from 'react-instantsearch';
|
|
4
|
+
import { Button } from '../buttons/button/button.js';
|
|
5
|
+
import { FormattedMessage } from '../intl/formatted-message.js';
|
|
6
|
+
import { useSidebarActions } from '../sidebar/use-sidebar.js';
|
|
7
|
+
import { AlgoliaActiveCategories } from './algolia-active-categories.js';
|
|
8
|
+
import { AlgoliaActiveFilters } from './algolia-active-filters.js';
|
|
9
|
+
import { AlgoliaCategoriesFilters } from './algolia-categories-filters.js';
|
|
10
|
+
import { AlgoliaDummyRefinementListConsumer } from './algolia-dummy-refinement-list-consumer.js';
|
|
11
|
+
import { AlgoliaMultiSelectFilterSection } from './algolia-multi-select-filter-section.js';
|
|
12
|
+
import { AlgoliaResultsCount } from './algolia-results-count.js';
|
|
13
|
+
import styles from './algolia-filter-panel.module.css.js';
|
|
14
|
+
|
|
15
|
+
const MULTISELECT_ATTRIBUTE_IGNORE_LIST = [
|
|
16
|
+
'hierarchicalCategories.lvl0',
|
|
17
|
+
];
|
|
18
|
+
function PanelCloseButton() {
|
|
19
|
+
const { close } = useSidebarActions();
|
|
20
|
+
return (jsx("div", { className: styles.button, children: jsxs(Button, { withArrow: true, onClick: close, size: "md", children: [jsx(FormattedMessage, { id: "Show" }), " ", jsx(AlgoliaResultsCount, {})] }) }));
|
|
21
|
+
}
|
|
22
|
+
function AlgoliaFilterPanel({ showActiveCategories = false, showCategoriesFilters = false, }) {
|
|
23
|
+
/*
|
|
24
|
+
* This hook will return the attributes that are available to be rendered.
|
|
25
|
+
* Initially it will return an empty array and fires a new query to Algolia
|
|
26
|
+
* to get the attributes that are available to be rendered.
|
|
27
|
+
*
|
|
28
|
+
* *** THIS WILL CAUSE A SECOND QUERY TO ALGOLIA ON PAGE LOAD***
|
|
29
|
+
* See ticket: https://dev.azure.com/arlanet/Sonic%20Equipment/_workitems/edit/23095
|
|
30
|
+
*/
|
|
31
|
+
const { attributesToRender } = useDynamicWidgets({
|
|
32
|
+
facets: ['*'],
|
|
33
|
+
maxValuesPerFacet: 100,
|
|
34
|
+
});
|
|
35
|
+
return (jsx("div", { className: styles['filter-panel'], children: jsxs("div", { className: styles['scroll-container'], children: [showActiveCategories && jsx(AlgoliaActiveCategories, {}), showCategoriesFilters && jsx(AlgoliaCategoriesFilters, {}), jsx(AlgoliaActiveFilters, {}), attributesToRender.length === 0 ? (jsx(AlgoliaDummyRefinementListConsumer, {})) : (jsx("section", { children: attributesToRender
|
|
36
|
+
.filter(attribute => !MULTISELECT_ATTRIBUTE_IGNORE_LIST.includes(attribute))
|
|
37
|
+
.map((attribute, index) => {
|
|
38
|
+
return (jsx(AlgoliaMultiSelectFilterSection, { attribute: attribute }, `attribute-${index}`));
|
|
39
|
+
}) })), jsx(PanelCloseButton, {})] }) }));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { AlgoliaFilterPanel };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"filter-panel":"algolia-filter-panel-module-GfhOO","scroll-container":"algolia-filter-panel-module-4ubB1","category":"algolia-filter-panel-module-LKet3","is-active":"algolia-filter-panel-module-yf8kI","value":"algolia-filter-panel-module-gQzED","count":"algolia-filter-panel-module-uAHPx","button":"algolia-filter-panel-module-ABOYv"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useHits } from 'react-instantsearch';
|
|
3
|
+
import { useAlgoliaHitsItems, useAlgoliaHitsLoading } from './use-algolia-hits.js';
|
|
4
|
+
import { useAlgoliaInstantSearchState } from './use-algolia-instant-search-state.js';
|
|
5
|
+
|
|
6
|
+
function AlgoliaHitsProvider() {
|
|
7
|
+
const { status } = useAlgoliaInstantSearchState();
|
|
8
|
+
const [, setItems] = useAlgoliaHitsItems();
|
|
9
|
+
const [, setLoading] = useAlgoliaHitsLoading();
|
|
10
|
+
const { items, results } = useHits();
|
|
11
|
+
setItems(items);
|
|
12
|
+
// @ts-expect-error -- params is not officially exposed but is included in results
|
|
13
|
+
setLoading(status !== 'idle' || !results || results.params === '');
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { AlgoliaHitsProvider };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const defaultLanguageCodes = {
|
|
3
|
+
PL: 'EN',
|
|
4
|
+
};
|
|
5
|
+
const getLanguageForAlgoliaIndex = (languageCode) => defaultLanguageCodes[languageCode] || languageCode;
|
|
6
|
+
const algoliaIndexesPerEnvironment = {
|
|
7
|
+
local: {
|
|
8
|
+
default: 'dev_sonic_products_<languageCode>',
|
|
9
|
+
sort: [
|
|
10
|
+
{
|
|
11
|
+
index: 'dev_sonic_products_<languageCode>',
|
|
12
|
+
name: 'relevance',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
index: 'dev_sonic_products_<languageCode>_is-new_desc',
|
|
16
|
+
name: 'newest',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
index: 'dev_sonic_products_<languageCode>_price_asc',
|
|
20
|
+
name: 'price_asc',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
index: 'dev_sonic_products_<languageCode>_price_desc',
|
|
24
|
+
name: 'price_desc',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
suggestions: 'dev_sonic_products_<languageCode>_query_suggestions',
|
|
28
|
+
},
|
|
29
|
+
marketingLocal: {
|
|
30
|
+
default: 'dev_sonic_products_<languageCode>',
|
|
31
|
+
sort: [
|
|
32
|
+
{
|
|
33
|
+
index: 'dev_sonic_products_<languageCode>',
|
|
34
|
+
name: 'relevance',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
index: 'dev_sonic_products_<languageCode>_is-new_desc',
|
|
38
|
+
name: 'newest',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
index: 'dev_sonic_products_<languageCode>_price_asc',
|
|
42
|
+
name: 'price_asc',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
index: 'dev_sonic_products_<languageCode>_price_desc',
|
|
46
|
+
name: 'price_desc',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
suggestions: 'dev_sonic_products_<languageCode>_query_suggestions',
|
|
50
|
+
},
|
|
51
|
+
next: {
|
|
52
|
+
default: 'dev_sonic_products_<languageCode>',
|
|
53
|
+
sort: [
|
|
54
|
+
{
|
|
55
|
+
index: 'dev_sonic_products_<languageCode>',
|
|
56
|
+
name: 'relevance',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
index: 'dev_sonic_products_<languageCode>_is-new_desc',
|
|
60
|
+
name: 'newest',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
index: 'dev_sonic_products_<languageCode>_price_asc',
|
|
64
|
+
name: 'price_asc',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
index: 'dev_sonic_products_<languageCode>_price_desc',
|
|
68
|
+
name: 'price_desc',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
suggestions: 'dev_sonic_products_<languageCode>_query_suggestions',
|
|
72
|
+
},
|
|
73
|
+
production: {
|
|
74
|
+
default: 'prod_sonic_products_<languageCode>',
|
|
75
|
+
sort: [
|
|
76
|
+
{
|
|
77
|
+
index: 'prod_sonic_products_<languageCode>',
|
|
78
|
+
name: 'relevance',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
index: 'prod_sonic_products_<languageCode>_is-new_desc',
|
|
82
|
+
name: 'newest',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
index: 'prod_sonic_products_<languageCode>_price_asc',
|
|
86
|
+
name: 'price_asc',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
index: 'prod_sonic_products_<languageCode>_price_desc',
|
|
90
|
+
name: 'price_desc',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
suggestions: 'prod_sonic_products_<languageCode>_query_suggestions',
|
|
94
|
+
},
|
|
95
|
+
sandbox: {
|
|
96
|
+
default: 'dev_sonic_products_<languageCode>',
|
|
97
|
+
sort: [
|
|
98
|
+
{
|
|
99
|
+
index: 'dev_sonic_products_<languageCode>',
|
|
100
|
+
name: 'relevance',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
index: 'dev_sonic_products_<languageCode>_is-new_desc',
|
|
104
|
+
name: 'newest',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
index: 'dev_sonic_products_<languageCode>_price_asc',
|
|
108
|
+
name: 'price_asc',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
index: 'dev_sonic_products_<languageCode>_price_desc',
|
|
112
|
+
name: 'price_desc',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
suggestions: 'dev_sonic_products_<languageCode>_query_suggestions',
|
|
116
|
+
},
|
|
117
|
+
'sandbox-reverse-proxy': {
|
|
118
|
+
default: 'dev_sonic_products_<languageCode>',
|
|
119
|
+
sort: [
|
|
120
|
+
{
|
|
121
|
+
index: 'dev_sonic_products_<languageCode>',
|
|
122
|
+
name: 'relevance',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
index: 'dev_sonic_products_<languageCode>_is-new_desc',
|
|
126
|
+
name: 'newest',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
index: 'dev_sonic_products_<languageCode>_price_asc',
|
|
130
|
+
name: 'price_asc',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
index: 'dev_sonic_products_<languageCode>_price_desc',
|
|
134
|
+
name: 'price_desc',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
suggestions: 'dev_sonic_products_<languageCode>_query_suggestions',
|
|
138
|
+
},
|
|
139
|
+
storybook: {
|
|
140
|
+
default: 'dev_sonic_products_<languageCode>',
|
|
141
|
+
sort: [
|
|
142
|
+
{
|
|
143
|
+
index: 'dev_sonic_products_<languageCode>',
|
|
144
|
+
name: 'relevance',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
index: 'dev_sonic_products_<languageCode>_is-new_desc',
|
|
148
|
+
name: 'newest',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
index: 'dev_sonic_products_<languageCode>_price_asc',
|
|
152
|
+
name: 'price_asc',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
index: 'dev_sonic_products_<languageCode>_price_desc',
|
|
156
|
+
name: 'price_desc',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
suggestions: 'dev_sonic_products_<languageCode>_query_suggestions',
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
const getAlgoliaIndex = (environment, languageCode) => {
|
|
163
|
+
const environmentIndex = algoliaIndexesPerEnvironment[environment];
|
|
164
|
+
const language = getLanguageForAlgoliaIndex(languageCode).toLowerCase();
|
|
165
|
+
return {
|
|
166
|
+
default: environmentIndex.default.replace(/<languageCode>/, language),
|
|
167
|
+
sort: environmentIndex.sort.map(({ index, name }) => ({
|
|
168
|
+
index: index.replace(/<languageCode>/, language),
|
|
169
|
+
name,
|
|
170
|
+
})),
|
|
171
|
+
suggestions: environmentIndex.suggestions.replace(/<languageCode>/, language),
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export { algoliaIndexesPerEnvironment, getAlgoliaIndex };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { AlgoliaInsightsProvider } from './algolia-insights-provider.js';
|
|
4
|
+
import { useAlgoliaInstantSearchState } from './use-algolia-instant-search-state.js';
|
|
5
|
+
|
|
6
|
+
function AlgoliaInsightInstantSearchProvider({ children, }) {
|
|
7
|
+
const { index, queryId } = useAlgoliaInstantSearchState();
|
|
8
|
+
return (jsx(AlgoliaInsightsProvider, { value: {
|
|
9
|
+
index,
|
|
10
|
+
queryId,
|
|
11
|
+
}, children: children }));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { AlgoliaInsightInstantSearchProvider };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
import { useAlgoliaInsightsGlobalState } from './use-algolia-insights-provider-global-state.js';
|
|
5
|
+
|
|
6
|
+
const AlgoliaInsightsProviderContext = createContext({});
|
|
7
|
+
function AlgoliaInsightsProvider({ children, value, }) {
|
|
8
|
+
const [globalState] = useAlgoliaInsightsGlobalState();
|
|
9
|
+
const context = useContext(AlgoliaInsightsProviderContext);
|
|
10
|
+
const combinedValue = {
|
|
11
|
+
...globalState,
|
|
12
|
+
...context,
|
|
13
|
+
...value,
|
|
14
|
+
};
|
|
15
|
+
return (jsx(AlgoliaInsightsProviderContext.Provider, { value: combinedValue, children: children }));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { AlgoliaInsightsProvider, AlgoliaInsightsProviderContext };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useInstantSearch } from 'react-instantsearch';
|
|
3
|
+
import { useAlgoliaInstantSearchStateIndex, useAlgoliaInstantSearchStateQueryId, useAlgoliaInstantSearchStateStatus } from './use-algolia-instant-search-state.js';
|
|
4
|
+
|
|
5
|
+
function AlgoliaInstantSearchStateProvider() {
|
|
6
|
+
const { results: { index, queryID }, status, } = useInstantSearch();
|
|
7
|
+
const [, setIndex] = useAlgoliaInstantSearchStateIndex();
|
|
8
|
+
const [, setQueryId] = useAlgoliaInstantSearchStateQueryId();
|
|
9
|
+
const [, setStatus] = useAlgoliaInstantSearchStateStatus();
|
|
10
|
+
setStatus(status);
|
|
11
|
+
setIndex(index);
|
|
12
|
+
setQueryId(queryID);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { AlgoliaInstantSearchStateProvider };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { config } from '../config.js';
|
|
3
|
+
import Cookies from 'js-cookie';
|
|
4
|
+
import aa from 'search-insights';
|
|
5
|
+
import { createUUID } from '../shared/utils/uuid.js';
|
|
6
|
+
|
|
7
|
+
let userToken = generateUserToken();
|
|
8
|
+
aa('init', {
|
|
9
|
+
apiKey: config.ALGOLIA_API_KEY,
|
|
10
|
+
appId: config.ALGOLIA_APP_ID,
|
|
11
|
+
useCookie: (Cookies.get('cookie-statistics-0') || 'false').toLowerCase() === 'true',
|
|
12
|
+
userToken,
|
|
13
|
+
});
|
|
14
|
+
aa('getUserToken', {}, (err, value) => {
|
|
15
|
+
if (err)
|
|
16
|
+
return console.error(err);
|
|
17
|
+
userToken = value === undefined ? generateUserToken() : String(value);
|
|
18
|
+
});
|
|
19
|
+
aa('onUserTokenChange', value => {
|
|
20
|
+
userToken = value === undefined ? generateUserToken() : String(value);
|
|
21
|
+
});
|
|
22
|
+
function generateUserToken() {
|
|
23
|
+
return `anonymous-${createUUID()}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { userToken };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRefinementList } from 'react-instantsearch';
|
|
4
|
+
import { MultiSelect } from '../filters/multi-select/multi-select.js';
|
|
5
|
+
import { Checkbox } from '../forms/checkbox/checkbox.js';
|
|
6
|
+
import { FilterSection } from './filter-section.js';
|
|
7
|
+
|
|
8
|
+
function AlgoliaMultiSelectFilterSection({ attribute, }) {
|
|
9
|
+
const { items, refine } = useRefinementList({
|
|
10
|
+
attribute,
|
|
11
|
+
limit: 100,
|
|
12
|
+
operator: 'or',
|
|
13
|
+
showMoreLimit: 100,
|
|
14
|
+
});
|
|
15
|
+
if (items.length === 0 ||
|
|
16
|
+
(items.length < 2 && items.filter(item => item.isRefined).length === 0)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return (jsx(FilterSection, { title: attribute, variant: "collapsible", children: jsx(MultiSelect, { onChange: ({ value }) => refine(value), options: items.map(item => ({
|
|
20
|
+
amount: item.count,
|
|
21
|
+
isSelected: item.isRefined,
|
|
22
|
+
label: item.label,
|
|
23
|
+
value: item.value,
|
|
24
|
+
})), render: ({ onChange, option }) => (jsx(Checkbox, { isSelected: option.isSelected, onChange: () => onChange(option.value), value: option.value, children: option.label })) }) }));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { AlgoliaMultiSelectFilterSection };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePagination } from 'react-instantsearch';
|
|
4
|
+
import { Pagination } from '../filters/pagination/pagination.js';
|
|
5
|
+
|
|
6
|
+
function AlgoliaPagination({ onChange }) {
|
|
7
|
+
const { currentRefinement, nbPages, refine } = usePagination();
|
|
8
|
+
function handlePageChange(pageNumber) {
|
|
9
|
+
refine(pageNumber - 1);
|
|
10
|
+
onChange(pageNumber);
|
|
11
|
+
}
|
|
12
|
+
if (nbPages === 0) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (jsx(Pagination, { currentPage: currentRefinement + 1, onChange: pageNumber => handlePageChange(pageNumber), totalPages: nbPages }));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { AlgoliaPagination };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { InstantSearch, Configure } from 'react-instantsearch';
|
|
4
|
+
import { useGlobalState } from '../shared/providers/global-state-provider.js';
|
|
5
|
+
import { environment } from '../shared/utils/environment.js';
|
|
6
|
+
import { AlgoliaHitsProvider } from './algolia-hits-provider.js';
|
|
7
|
+
import { getAlgoliaIndex } from './algolia-index-config.js';
|
|
8
|
+
import { AlgoliaInsightInstantSearchProvider } from './algolia-insight-instant-search-provider.js';
|
|
9
|
+
import { AlgoliaInstantSearchStateProvider } from './algolia-instant-search-state-provider.js';
|
|
10
|
+
import { createQueryStringRouting } from './algolia-query-string-routing.js';
|
|
11
|
+
import { useAlgoliaInstantSearchState } from './use-algolia-instant-search-state.js';
|
|
12
|
+
|
|
13
|
+
function AlgoliaProvider({ categoryPages, children, hierarchicalCategories, languageCode, offlineSearchClient, online: _online = true, query, searchClient, }) {
|
|
14
|
+
const { online } = useAlgoliaInstantSearchState({
|
|
15
|
+
online: _online,
|
|
16
|
+
});
|
|
17
|
+
const algoliaIndex = getAlgoliaIndex(environment, languageCode);
|
|
18
|
+
return (jsxs(InstantSearch, { future: {
|
|
19
|
+
persistHierarchicalRootCount: true,
|
|
20
|
+
preserveSharedStateOnUnmount: true,
|
|
21
|
+
}, indexName: algoliaIndex.default, insights: true, routing: createQueryStringRouting({
|
|
22
|
+
algoliaIndex,
|
|
23
|
+
hierarchicalCategories,
|
|
24
|
+
}), searchClient: online ? searchClient : offlineSearchClient || searchClient, children: [jsx(Configure, { analytics: true, filters: categoryPages
|
|
25
|
+
? // Replace double quotes with escaped double quotes to avoid breaking the query
|
|
26
|
+
`categoryPages: "${categoryPages.replaceAll('"', String.raw `\"`)}"`
|
|
27
|
+
: undefined, hitsPerPage: 12, maxValuesPerFacet: 100, query: query, ruleContexts: ['storefront'] }), jsx(AlgoliaInstantSearchStateProvider, {}), jsx(AlgoliaHitsProvider, {}), jsx(AlgoliaInsightInstantSearchProvider, { children: children })] }));
|
|
28
|
+
}
|
|
29
|
+
function useAlgolia() {
|
|
30
|
+
const [online, setOnline] = useGlobalState('algolia', false);
|
|
31
|
+
return { online, setOnline, toggleOnline: () => setOnline(!online) };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { AlgoliaProvider, useAlgolia };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import historyRouter from '../node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/routers/history.js';
|
|
3
|
+
import simpleStateMapping from '../node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/stateMappings/simple.js';
|
|
4
|
+
|
|
5
|
+
function createQueryStringRouting({ algoliaIndex, hierarchicalCategories, }) {
|
|
6
|
+
return {
|
|
7
|
+
router: historyRouter({
|
|
8
|
+
cleanUrlOnDispose: true,
|
|
9
|
+
createURL({ location, qsModule: qs, routeState }) {
|
|
10
|
+
const indexNames = Object.keys(routeState);
|
|
11
|
+
const indexName = indexNames[0];
|
|
12
|
+
if (!indexName)
|
|
13
|
+
return location.href;
|
|
14
|
+
if (indexNames.length !== 1)
|
|
15
|
+
throw new Error('Only one index is supported');
|
|
16
|
+
const state = routeState[indexName];
|
|
17
|
+
if (!state)
|
|
18
|
+
throw new Error(`Index ${indexName} not found in routeState`);
|
|
19
|
+
const queryString = qs.parse(location.search.slice(1), {
|
|
20
|
+
allowDots: true,
|
|
21
|
+
duplicates: 'combine',
|
|
22
|
+
});
|
|
23
|
+
queryString.filters = state.refinementList;
|
|
24
|
+
queryString.sortBy = state.sortBy;
|
|
25
|
+
if (state.page) {
|
|
26
|
+
queryString.page = state.page.toString();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
delete queryString.page;
|
|
30
|
+
}
|
|
31
|
+
if (!hierarchicalCategories &&
|
|
32
|
+
state.hierarchicalMenu?.['hierarchicalCategories.lvl0']) {
|
|
33
|
+
queryString.category =
|
|
34
|
+
state.hierarchicalMenu['hierarchicalCategories.lvl0'].join('+');
|
|
35
|
+
}
|
|
36
|
+
const newQueryString = qs.stringify(queryString, {
|
|
37
|
+
addQueryPrefix: true,
|
|
38
|
+
allowDots: true,
|
|
39
|
+
arrayFormat: 'repeat',
|
|
40
|
+
});
|
|
41
|
+
return `${location.href.split('?')[0]}${newQueryString}`;
|
|
42
|
+
},
|
|
43
|
+
parseURL({ location, qsModule: qs }) {
|
|
44
|
+
const queryString = qs.parse(location.search.slice(1), {
|
|
45
|
+
allowDots: true,
|
|
46
|
+
duplicates: 'combine',
|
|
47
|
+
});
|
|
48
|
+
const refinementList = Object.keys(queryString.filters || {}).reduce((refinementList, filter) => {
|
|
49
|
+
refinementList[filter] = [queryString.filters?.[filter]].flat();
|
|
50
|
+
return refinementList;
|
|
51
|
+
}, {});
|
|
52
|
+
const hierarchicalMenu = hierarchicalCategories
|
|
53
|
+
? {
|
|
54
|
+
'hierarchicalCategories.lvl0': hierarchicalCategories,
|
|
55
|
+
}
|
|
56
|
+
: queryString.category
|
|
57
|
+
? typeof queryString.category === 'string'
|
|
58
|
+
? {
|
|
59
|
+
'hierarchicalCategories.lvl0': queryString.category.split('+'),
|
|
60
|
+
}
|
|
61
|
+
: Array.isArray(queryString.category)
|
|
62
|
+
? {
|
|
63
|
+
'hierarchicalCategories.lvl0': queryString.category
|
|
64
|
+
.join('+')
|
|
65
|
+
.split('+'),
|
|
66
|
+
}
|
|
67
|
+
: undefined
|
|
68
|
+
: undefined;
|
|
69
|
+
const sortBy = queryString.sortBy?.toString();
|
|
70
|
+
const uiState = {
|
|
71
|
+
[algoliaIndex.default]: {
|
|
72
|
+
hierarchicalMenu,
|
|
73
|
+
page: queryString.page
|
|
74
|
+
? Number.parseInt(queryString.page.toString(), 10)
|
|
75
|
+
: 0,
|
|
76
|
+
refinementList,
|
|
77
|
+
sortBy,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
return uiState;
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
stateMapping: {
|
|
84
|
+
routeToState(routeState) {
|
|
85
|
+
return simpleStateMapping().routeToState(hierarchicalCategories
|
|
86
|
+
? Object.keys(routeState).reduce((newRouteState, indexName) => {
|
|
87
|
+
if (!routeState[indexName])
|
|
88
|
+
return newRouteState;
|
|
89
|
+
return {
|
|
90
|
+
...newRouteState,
|
|
91
|
+
[indexName]: {
|
|
92
|
+
...routeState[indexName],
|
|
93
|
+
hierarchicalMenu: {
|
|
94
|
+
'hierarchicalCategories.lvl0': hierarchicalCategories,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}, routeState)
|
|
99
|
+
: routeState);
|
|
100
|
+
},
|
|
101
|
+
stateToRoute: simpleStateMapping().stateToRoute,
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { createQueryStringRouting };
|