@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,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import Navigation from '../node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/navigation.js';
|
|
6
|
+
import freeMode from '../node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/free-mode.js';
|
|
7
|
+
import { Swiper, SwiperSlide } from '../node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/swiper-react.js';
|
|
8
|
+
import { breakpoints } from '../shared/utils/breakpoints.js';
|
|
9
|
+
import { deepMerge } from '../shared/utils/merge.js';
|
|
10
|
+
import { CarouselNavigationButton } from './carousel-navigation-button.js';
|
|
11
|
+
import styles from './carousel.module.css.js';
|
|
12
|
+
|
|
13
|
+
function generateSlidesPerViewBreakpoints(slidesPerView) {
|
|
14
|
+
return Object.keys(slidesPerView).reduce((result, breakpoint) => ({
|
|
15
|
+
...result,
|
|
16
|
+
[breakpoints[breakpoint]]: {
|
|
17
|
+
slidesPerView: slidesPerView[breakpoint],
|
|
18
|
+
},
|
|
19
|
+
}), {});
|
|
20
|
+
}
|
|
21
|
+
function Carousel({ breakpoints: _breakpoints, className, hasNavigation = true, hasOverflow = true, navigationButtonsPosition = 'top', slideClasses, slides, slidesPerView: _slidesPerView = 'auto', spaceBetween, }) {
|
|
22
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
23
|
+
const [isReady, setIsReady] = useState(false);
|
|
24
|
+
const [amountOfSlides, setAmountOfSlides] = useState(0);
|
|
25
|
+
const nextEl = useRef(null);
|
|
26
|
+
const prevEl = useRef(null);
|
|
27
|
+
const swiperRef = useRef(null);
|
|
28
|
+
const slidesPerView = typeof _slidesPerView === 'object' ? undefined : _slidesPerView;
|
|
29
|
+
function handleNavigationButtonClick(direction) {
|
|
30
|
+
if (!swiperRef.current)
|
|
31
|
+
return;
|
|
32
|
+
if (direction === 'next') {
|
|
33
|
+
swiperRef.current.slideTo(swiperRef.current.activeIndex + amountOfSlides - 1);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
swiperRef.current.slideTo(swiperRef.current.activeIndex - amountOfSlides - 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setAmountOfSlides(typeof swiperRef.current?.params.slidesPerView === 'number'
|
|
41
|
+
? swiperRef.current.params.slidesPerView
|
|
42
|
+
: swiperRef.current?.slidesPerViewDynamic() || 1);
|
|
43
|
+
}, [swiperRef]);
|
|
44
|
+
if (typeof _slidesPerView === 'object') {
|
|
45
|
+
const slidesPerViewBreakpoints = generateSlidesPerViewBreakpoints(_slidesPerView);
|
|
46
|
+
_breakpoints = deepMerge(_breakpoints, slidesPerViewBreakpoints);
|
|
47
|
+
}
|
|
48
|
+
if (slides.length === 0)
|
|
49
|
+
return null;
|
|
50
|
+
return (jsxs("div", { className: clsx(styles.carousel, className), style: spaceBetween === undefined
|
|
51
|
+
? undefined
|
|
52
|
+
: { '--column-gap': `${spaceBetween}px` }, children: [jsx(Swiper, { breakpoints: _breakpoints, className: clsx(styles.swiper, {
|
|
53
|
+
[styles['is-dragging']]: isDragging,
|
|
54
|
+
[styles['has-overflow']]: hasOverflow,
|
|
55
|
+
[styles['is-ready']]: isReady,
|
|
56
|
+
}), freeMode: {
|
|
57
|
+
enabled: false,
|
|
58
|
+
sticky: true,
|
|
59
|
+
}, modules: [freeMode, Navigation], navigation: {
|
|
60
|
+
enabled: hasNavigation,
|
|
61
|
+
nextEl: nextEl.current,
|
|
62
|
+
prevEl: prevEl.current,
|
|
63
|
+
}, onBeforeInit: swiper => (swiperRef.current = swiper), onSliderMove: () => setIsDragging(true), onSlidesUpdated: () => {
|
|
64
|
+
if (!isReady)
|
|
65
|
+
setIsReady(true);
|
|
66
|
+
}, onTouchEnd: () => setIsDragging(false), slidesPerGroupAuto: slidesPerView === 'auto', slidesPerView: slidesPerView, spaceBetween: spaceBetween, children: slides.map((slide, index) => (jsx(SwiperSlide, { className: clsx(styles.slide, slideClasses), children: slide }, index))) }), hasNavigation && (jsxs("div", { className: clsx(styles['navigation-buttons'], styles[navigationButtonsPosition]), children: [jsx(CarouselNavigationButton, { ref: prevEl, className: clsx(styles['navigation-button'], styles['navigation-button-prev']), direction: "previous", onClick: direction => handleNavigationButtonClick(direction) }), jsx(CarouselNavigationButton, { ref: nextEl, className: clsx(styles['navigation-button'], styles['navigation-button-next']), direction: "next", onClick: direction => handleNavigationButtonClick(direction) })] }))] }));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { Carousel };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"carousel":"carousel-module-ealh-","swiper":"carousel-module-IftbN","is-ready":"carousel-module-RCpfc","has-overflow":"carousel-module-tPg7k","slide":"carousel-module-bUMlb","navigation-button-next":"carousel-module-T7bTr","is-dragging":"carousel-module-34OWD","navigation-button-prev":"carousel-module-984Rr","navigation-buttons":"carousel-module-k7Z4S","navigation-button":"carousel-module-kcqEE","top":"carousel-module-nL-O8","center":"carousel-module-5SGYn"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Carousel } from '../carousel.js';
|
|
3
|
+
import styles from './category-carousel.module.css.js';
|
|
4
|
+
|
|
5
|
+
function CategoryCarousel({ categoryCards }) {
|
|
6
|
+
return jsx(Carousel, { slideClasses: styles.slide, slides: categoryCards });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { CategoryCarousel };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useEffect } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useResizeObserver } from '../../shared/hooks/use-resize-observer.js';
|
|
6
|
+
import { Animation } from './transitions.js';
|
|
7
|
+
import styles from './pagination.module.css.js';
|
|
8
|
+
|
|
9
|
+
function PaginationButton({ index, onChange, onClick, }) {
|
|
10
|
+
const { ref } = useResizeObserver((target, size, position) => {
|
|
11
|
+
onChange?.(index, target, size, position);
|
|
12
|
+
});
|
|
13
|
+
return (jsx("div", { ref: ref, className: styles['page-button'], onClick: onClick, onKeyUp: e => {
|
|
14
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
15
|
+
onClick?.();
|
|
16
|
+
}
|
|
17
|
+
}, role: "button", tabIndex: 0 }));
|
|
18
|
+
}
|
|
19
|
+
function between(min, value, max) {
|
|
20
|
+
return Math.min(max, Math.max(min, value));
|
|
21
|
+
}
|
|
22
|
+
function CarouselPagination({ contained, currentPage = 1, numberOfPages, onChange, }) {
|
|
23
|
+
const animation = useRef(new Animation());
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
animation.current.animate(between(1, currentPage, numberOfPages));
|
|
26
|
+
}, [currentPage, numberOfPages]);
|
|
27
|
+
if (numberOfPages <= 1)
|
|
28
|
+
return;
|
|
29
|
+
return (jsx("div", { className: clsx({
|
|
30
|
+
[styles['contained']]: contained,
|
|
31
|
+
}, styles['pagination-panel']), children: jsxs("div", { className: styles['content-container'], children: [jsx("div", { ref: animation.current.refButton, className: clsx(styles['active-page-button'], styles['page-button']), children: jsx("div", { ref: animation.current.refCircle, className: styles['circle'] }) }), Array.from({ length: numberOfPages }, (_, index) => (jsx("div", { ref: animation.current.refPaginationButton(index), className: clsx(styles['page-button']), onClick: () => {
|
|
32
|
+
onChange?.(index + 1);
|
|
33
|
+
}, onKeyPress: e => {
|
|
34
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
35
|
+
onChange?.(index + 1);
|
|
36
|
+
}
|
|
37
|
+
}, role: "button", tabIndex: 0 }, index)))] }) }));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { CarouselPagination, PaginationButton };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"pagination-panel":"pagination-module-pQ-Pu","content-container":"pagination-module-EnswA","contained":"pagination-module-4U0M3","page-button":"pagination-module-E-D6l","active-page-button":"pagination-module-rNIvD","circle":"pagination-module-4--ee"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
class Animation {
|
|
3
|
+
constructor(initialPage = -1) {
|
|
4
|
+
Object.defineProperty(this, "_currentPage", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: void 0
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(this, "_buttonElement", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: null
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "_circleElement", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: null
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "_paginationButtonElements", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: []
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "_transitionQueue", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: []
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "_currentSize", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: 1
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(this, "_currentPosition", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: 0
|
|
45
|
+
});
|
|
46
|
+
this._currentPage = initialPage;
|
|
47
|
+
this.refButton = this.refButton.bind(this);
|
|
48
|
+
this.refCircle = this.refCircle.bind(this);
|
|
49
|
+
}
|
|
50
|
+
refPaginationButton(index) {
|
|
51
|
+
return (element) => {
|
|
52
|
+
this._paginationButtonElements[index] = element;
|
|
53
|
+
if (index === this._currentPage - 1)
|
|
54
|
+
element?.classList.add('active');
|
|
55
|
+
this.onNextTransition();
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
refButton(element) {
|
|
59
|
+
this._buttonElement?.removeEventListener('transitionend', this.onNextTransition.bind(this));
|
|
60
|
+
this._buttonElement = element;
|
|
61
|
+
this._buttonElement?.addEventListener('transitionend', e => {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
this.onNextTransition();
|
|
65
|
+
});
|
|
66
|
+
this.onNextTransition();
|
|
67
|
+
}
|
|
68
|
+
refCircle(element) {
|
|
69
|
+
this._circleElement?.removeEventListener('transitionend', this.onNextTransition.bind(this));
|
|
70
|
+
this._circleElement = element;
|
|
71
|
+
this._circleElement?.addEventListener('transitionend', e => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
if (e.propertyName !== 'height')
|
|
75
|
+
return;
|
|
76
|
+
this.onNextTransition();
|
|
77
|
+
});
|
|
78
|
+
this.onNextTransition();
|
|
79
|
+
}
|
|
80
|
+
getLeftPositionOfPaginationButtonElement(index) {
|
|
81
|
+
const fromElement = this._paginationButtonElements[0];
|
|
82
|
+
const toElement = this._paginationButtonElements[index];
|
|
83
|
+
if (!toElement || !fromElement)
|
|
84
|
+
return 0;
|
|
85
|
+
const from = fromElement.getBoundingClientRect().left;
|
|
86
|
+
const to = toElement.getBoundingClientRect().left;
|
|
87
|
+
return to - from;
|
|
88
|
+
}
|
|
89
|
+
onNextTransition() {
|
|
90
|
+
const buttonElement = this._buttonElement;
|
|
91
|
+
const circleElement = this._circleElement;
|
|
92
|
+
const paginationButtonElements = this._paginationButtonElements;
|
|
93
|
+
if (!buttonElement ||
|
|
94
|
+
!circleElement ||
|
|
95
|
+
paginationButtonElements.length === 0)
|
|
96
|
+
return this;
|
|
97
|
+
const nextTransition = this._transitionQueue.shift();
|
|
98
|
+
if (!nextTransition)
|
|
99
|
+
return this;
|
|
100
|
+
switch (nextTransition.type) {
|
|
101
|
+
case 'slide':
|
|
102
|
+
if (this._currentPosition === nextTransition.position) {
|
|
103
|
+
return this.onNextTransition();
|
|
104
|
+
}
|
|
105
|
+
this._currentPosition = nextTransition.position;
|
|
106
|
+
paginationButtonElements.forEach(element => {
|
|
107
|
+
element?.classList.remove('active');
|
|
108
|
+
});
|
|
109
|
+
break;
|
|
110
|
+
case 'grow':
|
|
111
|
+
this._currentSize = nextTransition.size;
|
|
112
|
+
paginationButtonElements[this._currentPage - 1]?.classList.add('active');
|
|
113
|
+
break;
|
|
114
|
+
case 'shrink':
|
|
115
|
+
this._currentSize = nextTransition.size;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
buttonElement.style.transform = `translateX(${this._currentPosition}px`;
|
|
119
|
+
circleElement.style.setProperty('--size', `${this._currentSize}px`);
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
animate(page) {
|
|
123
|
+
const currentPage = this._currentPage;
|
|
124
|
+
if (page === currentPage)
|
|
125
|
+
return this;
|
|
126
|
+
this._currentPage = page;
|
|
127
|
+
const currentTransition = this._transitionQueue[0];
|
|
128
|
+
this._transitionQueue.splice(1);
|
|
129
|
+
if (!currentTransition || currentTransition.type === 'grow') {
|
|
130
|
+
this._transitionQueue.push({ size: 1, type: 'shrink' });
|
|
131
|
+
}
|
|
132
|
+
this._transitionQueue.push({
|
|
133
|
+
position: this.getLeftPositionOfPaginationButtonElement(page - 1),
|
|
134
|
+
type: 'slide',
|
|
135
|
+
}, { size: 16, type: 'grow' });
|
|
136
|
+
return this.onNextTransition();
|
|
137
|
+
}
|
|
138
|
+
dispose() {
|
|
139
|
+
this._buttonElement?.removeEventListener('transitionend', this.onNextTransition);
|
|
140
|
+
this._circleElement?.removeEventListener('transitionend', this.onNextTransition);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { Animation };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Image } from '../../media/image/image.js';
|
|
3
|
+
import { Heading } from '../../typography/heading/heading.js';
|
|
4
|
+
import styles from './usp-carousel.module.css.js';
|
|
5
|
+
|
|
6
|
+
function ProductUsp({ usp }) {
|
|
7
|
+
return (jsxs("div", { className: styles['product-usp'], children: [jsx("div", { className: styles.left, children: jsx(Image, { className: styles.image, fit: "cover", image: usp.image, title: usp.image.altText }) }), jsx("div", { className: styles.right, children: jsxs("div", { "data-content": true, className: styles.content, children: [jsx(Image, { className: styles.icon, image: usp.icon, title: usp.icon.altText }), jsx(Heading, { italic: true, uppercase: true, className: styles.title, size: "xs", children: usp.heading }), jsx("div", { className: styles.text, dangerouslySetInnerHTML: { __html: usp.text } })] }) })] }));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { ProductUsp };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ProductUsp } from './product-usp-carousel-slide.js';
|
|
3
|
+
import { USPCarousel } from './usp-carousel.js';
|
|
4
|
+
|
|
5
|
+
function ProductUSPCarousel({ usps }) {
|
|
6
|
+
return (jsx(USPCarousel, { slides: usps.map((usp, index) => (jsx(ProductUsp, { usp: usp }, index))) }));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { ProductUSPCarousel };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
import { Swiper, SwiperSlide } from '../../node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/swiper-react.js';
|
|
5
|
+
import { CarouselPagination } from '../pagination/pagination.js';
|
|
6
|
+
import styles from './usp-carousel.module.css.js';
|
|
7
|
+
|
|
8
|
+
const DURATION_IN_MS = 800;
|
|
9
|
+
const CONTENT_TRANSLATE_PX = 40;
|
|
10
|
+
const USPCarousel = ({ slides }) => {
|
|
11
|
+
const swiperRef = useRef(null);
|
|
12
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
13
|
+
const swiperElementRef = useRef(null);
|
|
14
|
+
let currentTransitionSpeed = 0;
|
|
15
|
+
function getTransitionSpeed() {
|
|
16
|
+
const transitionSpeed = currentTransitionSpeed;
|
|
17
|
+
currentTransitionSpeed = 0;
|
|
18
|
+
return transitionSpeed;
|
|
19
|
+
}
|
|
20
|
+
function setTranslate(_swiper, _wrapperTranslate) {
|
|
21
|
+
const slides = Object.values(_swiper.slides);
|
|
22
|
+
const durationInSeconds = getTransitionSpeed() / 1000;
|
|
23
|
+
slides.map((slide, _index) => {
|
|
24
|
+
const offset = slide.swiperSlideOffset;
|
|
25
|
+
const translateX = -offset;
|
|
26
|
+
const content = slide.querySelector('[data-content]');
|
|
27
|
+
const opacity = Math.max(1 - Math.abs(slide.progress), 0);
|
|
28
|
+
const translate = Math.min(Math.abs(slide.progress), 1) * CONTENT_TRANSLATE_PX;
|
|
29
|
+
content.style.transform = `translateX(${-translate}px)`;
|
|
30
|
+
content.style.transition = `transform ${durationInSeconds}s ease`;
|
|
31
|
+
slide.style.transform = `translateX(${translateX}px)`;
|
|
32
|
+
slide.style.opacity = `${opacity}`;
|
|
33
|
+
slide.style.transition = `opacity ${durationInSeconds}s ease`;
|
|
34
|
+
if (slide !== _swiper.slides[_swiper.realIndex]) {
|
|
35
|
+
slide.style.transitionDelay = `${durationInSeconds / 4}s`;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return (jsxs(Swiper, { ref: swiperElementRef, className: styles['usp-carousel'], longSwipes: false, onActiveIndexChange: swiper => setCurrentIndex(swiper.activeIndex), onSetTransition: (_swiper, transitions) => {
|
|
40
|
+
currentTransitionSpeed = transitions;
|
|
41
|
+
}, onSetTranslate: setTranslate, onSwiper: swiper => {
|
|
42
|
+
swiper.update();
|
|
43
|
+
swiperRef.current = swiper;
|
|
44
|
+
}, speed: DURATION_IN_MS, virtualTranslate: true, watchSlidesProgress: true, children: [slides.map((slide, index) => (jsx(SwiperSlide, { children: slide }, index))), jsx("div", { className: styles.pagination, id: "pagination" }), jsx("div", { className: styles.pagination, children: jsx(CarouselPagination, { currentPage: currentIndex + 1, numberOfPages: slides.length, onChange: pageNumber => swiperRef.current?.slideTo(pageNumber - 1) }) })] }));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { USPCarousel };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"usp-carousel":"usp-carousel-module-UCbpX","pagination":"usp-carousel-module-msaeJ","product-usp":"usp-carousel-module-rtIrb","left":"usp-carousel-module--Vdc3","image":"usp-carousel-module-F-WAS","right":"usp-carousel-module-2fygw","content":"usp-carousel-module-AOJJg","icon":"usp-carousel-module-Diy2d","title":"usp-carousel-module--xcF2","text":"usp-carousel-module-tq8R8","navigation":"usp-carousel-module-L5Kmv"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { FormattedMessage } from '../intl/formatted-message.js';
|
|
4
|
+
import { Heading } from '../typography/heading/heading.js';
|
|
5
|
+
import styles from './cart-totals-summary.module.css.js';
|
|
6
|
+
|
|
7
|
+
function CartTotalsSummary({ className, totalAmount, }) {
|
|
8
|
+
return (jsx("div", { className: clsx(styles['cart-totals-summary'], className), children: jsxs(Heading, { bold: true, size: "xxxs", children: [jsx(FormattedMessage, { id: "Total amount is" }), jsx("br", {}), totalAmount] }) }));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { CartTotalsSummary };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { FormattedMessage } from '../intl/formatted-message.js';
|
|
3
|
+
import { Heading } from '../typography/heading/heading.js';
|
|
4
|
+
import styles from './cart-totals.module.css.js';
|
|
5
|
+
|
|
6
|
+
function CartTotals({ fulfillmentMethod, orderNumber, shippingCost, subtotal, tax, total, vatPercentage, }) {
|
|
7
|
+
return (jsxs("div", { className: styles['cart-totals'], children: [orderNumber && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Order number" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "orderConfirmation_orderNumber", children: orderNumber }) }) })] })), fulfillmentMethod && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Fulfillment method" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, children: fulfillmentMethod }) }) })] })), jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Cost overview" }) }), jsxs("div", { children: [jsxs("div", { className: styles.line, children: [jsxs("p", { className: styles.label, children: [jsx(FormattedMessage, { id: "Subtotal" }), ' ', jsx(FormattedMessage, { id: "Excl. VAT" })] }), jsx("p", { className: styles.value, "data-test-selector": "cartTotal_subTotal", children: subtotal })] }), jsxs("div", { className: styles.line, children: [jsx("p", { className: styles.label, children: jsx(FormattedMessage, { id: "Shipping and handling" }) }), jsx("p", { className: styles.value, children: shippingCost })] }), jsxs("div", { className: styles.line, children: [jsxs("p", { className: styles.label, children: [jsx(FormattedMessage, { id: "VAT" }), " ", `${vatPercentage}%`] }), jsx("p", { className: styles.value, children: tax })] })] })] }), jsx("section", { className: styles.totals, children: jsxs("div", { className: styles.line, children: [jsx("p", { className: styles.label, children: jsx(FormattedMessage, { id: "Total" }) }), jsx("p", { className: styles.value, "data-test-selector": "cartTotal_orderGrandTotalDisplay", children: total })] }) })] }));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { CartTotals };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"cart-totals":"cart-totals-module-Bk9zi","line":"cart-totals-module-VJ51p","label":"cart-totals-module-ciNsz","value":"cart-totals-module-KaxpH","section":"cart-totals-module-vhhxp","section-header":"cart-totals-module-AeSnX","totals":"cart-totals-module-2RLLQ"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { GlyphsChevronsBoldDownIcon } from '../../icons/glyph/glyphs-chevrons-bold-down-icon.js';
|
|
5
|
+
import { GlyphsChevronsSlimDownIcon } from '../../icons/glyph/glyphs-chevrons-slim-down-icon.js';
|
|
6
|
+
import { useDisclosure } from '../../shared/hooks/use-disclosure.js';
|
|
7
|
+
import { ensureArray } from '../../shared/utils/array.js';
|
|
8
|
+
import styles from './accordion.module.css.js';
|
|
9
|
+
|
|
10
|
+
function AccordionItem({ _pseudo = 'none', borderType = 'bottom', children, className, id, initialIsOpen = false, isDisabled = false, size, title, }) {
|
|
11
|
+
const { isOpen, toggle } = useDisclosure(initialIsOpen);
|
|
12
|
+
const panelId = `panel-${id}`;
|
|
13
|
+
return (jsxs("div", { className: clsx(className, ...ensureArray(borderType).map(type => styles[`border-type-${type}`]), styles['accordion-item'], {
|
|
14
|
+
[styles['is-open']]: isOpen,
|
|
15
|
+
}), children: [jsx("h3", { children: jsxs("button", { "aria-controls": panelId, "aria-expanded": isOpen, className: clsx(styles.button, styles[_pseudo]), disabled: isDisabled, id: id, onClick: toggle, type: "button", children: [title, jsx("span", { className: styles.icon, children: size === 'lg' ? (jsx(GlyphsChevronsBoldDownIcon, {})) : (jsx(GlyphsChevronsSlimDownIcon, {})) })] }) }), jsx("div", { "aria-labelledby": id, className: styles.panel, id: panelId, role: "region", children: jsx("div", { className: styles.content, children: children }) })] }));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { AccordionItem };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Children, cloneElement } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import styles from './accordion.module.css.js';
|
|
5
|
+
|
|
6
|
+
function Accordion({ borderType = 'bottom', children, color = 'black', hasLineSeparator = true, indented, size = 'md', }) {
|
|
7
|
+
return (jsx("div", { className: clsx({ [styles.indented]: indented }, styles.accordion, styles[color], styles[size], hasLineSeparator && styles['with-seperators']), children: Boolean(children) &&
|
|
8
|
+
Children.map(children, child => {
|
|
9
|
+
if (!child)
|
|
10
|
+
return null;
|
|
11
|
+
return cloneElement(child, { borderType, size });
|
|
12
|
+
}) }));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { Accordion };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"accordion":"accordion-module-9WvAH","indented":"accordion-module-6CcEH","white":"accordion-module-CaVdG","accordion-item":"accordion-module-lf9d-","lg":"accordion-module-0qnae","with-seperators":"accordion-module-yOLrW","button":"accordion-module--Rwpb","icon":"accordion-module-Y50uq","focus":"accordion-module-M4BZs","panel":"accordion-module-KZjMo","content":"accordion-module-ejMH3","border-type-bottom":"accordion-module-oTdZK","border-type-top":"accordion-module-0mrLq","border-type-middle":"accordion-module-aAr-R","is-open":"accordion-module-W0F1z","border-type-middle-accentuated":"accordion-module-OB98a"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { GlyphsChevronsSlimDownIcon } from '../../icons/glyph/glyphs-chevrons-slim-down-icon.js';
|
|
6
|
+
import { FormattedMessage } from '../../intl/formatted-message.js';
|
|
7
|
+
import { useDisclosure } from '../../shared/hooks/use-disclosure.js';
|
|
8
|
+
import { useResizeObserver } from '../../shared/hooks/use-resize-observer.js';
|
|
9
|
+
import { RouteLink } from '../../shared/routing/route-link.js';
|
|
10
|
+
import styles from './show-all.module.css.js';
|
|
11
|
+
|
|
12
|
+
function ShowAll({ children, hasTransparency = true, initialHeight = 0, initialIsOpen = false, isOpen: isControlledOpen, onToggle, }) {
|
|
13
|
+
const isControlled = isControlledOpen !== undefined && onToggle !== undefined;
|
|
14
|
+
const { isOpen, toggle } = useDisclosure(initialIsOpen);
|
|
15
|
+
const showAllRef = useRef(null);
|
|
16
|
+
const isReallyOpen = isControlled ? isControlledOpen : isOpen;
|
|
17
|
+
const [contentFits, setContentFits] = useState(false);
|
|
18
|
+
const { ref } = useResizeObserver((_target, size) => {
|
|
19
|
+
setContentFits((size.height || 0) <= initialHeight);
|
|
20
|
+
});
|
|
21
|
+
return (jsxs("div", { ref: showAllRef, className: clsx(styles['show-all'], {
|
|
22
|
+
[styles['content-fits']]: contentFits,
|
|
23
|
+
[styles['is-open']]: isReallyOpen,
|
|
24
|
+
}), style: contentFits ? undefined : { '--initital-height': `${initialHeight}px` }, children: [jsx("div", { className: styles.panel, children: jsx("div", { className: clsx(styles.content, {
|
|
25
|
+
[styles['has-transparency']]: !contentFits && hasTransparency,
|
|
26
|
+
}), children: jsx("div", { ref: ref, children: children }) }) }), !contentFits && (jsxs(RouteLink, { className: styles.button, color: "secondary", onClick: () => {
|
|
27
|
+
if (isControlled)
|
|
28
|
+
return onToggle(!isControlled);
|
|
29
|
+
toggle();
|
|
30
|
+
}, children: [jsx(GlyphsChevronsSlimDownIcon, { className: styles.icon }), isReallyOpen ? (jsx(FormattedMessage, { id: "Show less" })) : (jsx(FormattedMessage, { id: "Show all" }))] }))] }));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { ShowAll };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"show-all":"show-all-module-BDp21","panel":"show-all-module-bEdda","content":"show-all-module-RF--F","has-transparency":"show-all-module-30y7l","button":"show-all-module-58e7Q","icon":"show-all-module-fqncI","is-open":"show-all-module-hQeGI","content-fits":"show-all-module-OhPfm"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
package/dist/config.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ interface Config {
|
|
|
7
7
|
COOKIE_DOMAIN?: string;
|
|
8
8
|
SHOP_API_URL: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const configPerEnvironment: Record<Environment, Config>;
|
|
10
|
+
export declare const configPerEnvironment: Record<Environment, () => Config>;
|
|
11
11
|
export declare const config: Config;
|
|
12
12
|
export {};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { environment } from './shared/utils/environment.js';
|
|
2
|
+
import main from './shared/utils/merge.js';
|
|
3
|
+
|
|
4
|
+
const env = (typeof process === 'undefined'
|
|
5
|
+
? { VITE_SHOP_API_URL: ""}
|
|
6
|
+
: main(process.env, { VITE_SHOP_API_URL: ""}));
|
|
7
|
+
const validateEnvVariable = (name, value) => {
|
|
8
|
+
if (value)
|
|
9
|
+
return value;
|
|
10
|
+
throw new Error(`${name} is not defined`);
|
|
11
|
+
};
|
|
12
|
+
const configPerEnvironment = {
|
|
13
|
+
local: () => ({
|
|
14
|
+
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
15
|
+
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
16
|
+
ALGOLIA_HOST: 'shop-accept.sonic-equipment.workers.dev',
|
|
17
|
+
BFF_API_URL: 'https://shop-accept.sonic-equipment.workers.dev/api/v1/bff',
|
|
18
|
+
COOKIE_DOMAIN: undefined,
|
|
19
|
+
SHOP_API_URL:
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
21
|
+
env?.VITE_SHOP_API_URL || '',
|
|
22
|
+
}),
|
|
23
|
+
marketingLocal: () => ({
|
|
24
|
+
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
25
|
+
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
26
|
+
ALGOLIA_HOST: 'sonicequipment.commerce.insitesandbox.com',
|
|
27
|
+
BFF_API_URL: 'https://localhost:8000/api/v1/bff',
|
|
28
|
+
COOKIE_DOMAIN: '.insitesandbox.com',
|
|
29
|
+
SHOP_API_URL:
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
31
|
+
env?.VITE_SHOP_API_URL || 'https://localhost:8000',
|
|
32
|
+
}),
|
|
33
|
+
next: () => ({
|
|
34
|
+
ALGOLIA_API_KEY: validateEnvVariable('ALGOLIA_API_KEY', env.ALGOLIA_API_KEY),
|
|
35
|
+
ALGOLIA_APP_ID: validateEnvVariable('ALGOLIA_APP_ID', env.ALGOLIA_APP_ID),
|
|
36
|
+
ALGOLIA_HOST: validateEnvVariable('ALGOLIA_HOST', env.ALGOLIA_HOST),
|
|
37
|
+
BFF_API_URL: validateEnvVariable('BFF_API_URL', env.BFF_API_URL),
|
|
38
|
+
COOKIE_DOMAIN: validateEnvVariable('COOKIE_DOMAIN', env.COOKIE_DOMAIN),
|
|
39
|
+
SHOP_API_URL: validateEnvVariable('SHOP_API_URL', env.SHOP_API_URL),
|
|
40
|
+
}),
|
|
41
|
+
production: () => ({
|
|
42
|
+
ALGOLIA_API_KEY: 'e31a3a53449eceb4d0f9273b9bcd9759',
|
|
43
|
+
ALGOLIA_APP_ID: '14CUFCVMAD',
|
|
44
|
+
ALGOLIA_HOST: 'shop.sonic-equipment.com',
|
|
45
|
+
BFF_API_URL: 'https://shop.sonic-equipment.com/api/v1/bff',
|
|
46
|
+
COOKIE_DOMAIN: '.sonic-equipment.com',
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
48
|
+
SHOP_API_URL: env?.VITE_SHOP_API_URL || 'https://shop.sonic-equipment.com',
|
|
49
|
+
}),
|
|
50
|
+
sandbox: () => ({
|
|
51
|
+
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
52
|
+
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
53
|
+
ALGOLIA_HOST: 'sonicequipment.commerce.insitesandbox.com',
|
|
54
|
+
BFF_API_URL: 'https://sonicequipment.commerce.insitesandbox.com/api/v1/bff',
|
|
55
|
+
COOKIE_DOMAIN: '.insitesandbox.com',
|
|
56
|
+
SHOP_API_URL:
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
58
|
+
env?.VITE_SHOP_API_URL ||
|
|
59
|
+
'https://sonicequipment.commerce.insitesandbox.com',
|
|
60
|
+
}),
|
|
61
|
+
'sandbox-reverse-proxy': () => ({
|
|
62
|
+
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
63
|
+
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
64
|
+
ALGOLIA_HOST: 'shop-accept.sonic-equipment.workers.dev',
|
|
65
|
+
BFF_API_URL: 'https://shop-accept.sonic-equipment.workers.dev/api/v1/bff',
|
|
66
|
+
COOKIE_DOMAIN: '.workers.dev',
|
|
67
|
+
SHOP_API_URL: 'https://shop-accept.sonic-equipment.workers.dev',
|
|
68
|
+
}),
|
|
69
|
+
storybook: () => ({
|
|
70
|
+
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
71
|
+
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
72
|
+
ALGOLIA_HOST: 'localhost:8000',
|
|
73
|
+
BFF_API_URL: 'https://localhost:8000/api/v1/bff',
|
|
74
|
+
COOKIE_DOMAIN: 'localhost',
|
|
75
|
+
SHOP_API_URL:
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
77
|
+
env?.VITE_SHOP_API_URL || 'https://localhost:8000',
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
const config = configPerEnvironment[environment]();
|
|
81
|
+
|
|
82
|
+
export { config, configPerEnvironment };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useMemo, useEffect } from 'react';
|
|
4
|
+
import { useDisclosure } from '../shared/hooks/use-disclosure.js';
|
|
5
|
+
import { CountrySelectorDialog } from './country-selector-dialog/country-selector-dialog.js';
|
|
6
|
+
import { CountrySelectorTrigger } from './country-selector-trigger/country-selector-trigger.js';
|
|
7
|
+
import { useCountriesLanguages } from './use-countries-languages.js';
|
|
8
|
+
|
|
9
|
+
function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, onChange, showCountry = true, }) {
|
|
10
|
+
const { close, isOpen, open, setIsOpen } = useDisclosure(false);
|
|
11
|
+
const { countries, defaultCountry, defaultLanguage, isFetching, selectedCountry, selectedLanguage, updateCountryLanguage, } = useCountriesLanguages({
|
|
12
|
+
defaultCountryCode,
|
|
13
|
+
defaultLanguageCode,
|
|
14
|
+
});
|
|
15
|
+
const isCountryLanguageSelected = useMemo(() => selectedCountry !== undefined && selectedLanguage !== undefined, [selectedCountry, selectedLanguage]);
|
|
16
|
+
const isDismissable = isCountryLanguageSelected;
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setIsOpen(!isCountryLanguageSelected);
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
+
}, [isCountryLanguageSelected]);
|
|
21
|
+
if (isFetching)
|
|
22
|
+
return null;
|
|
23
|
+
return (jsxs(Fragment, { children: [jsx(CountrySelectorTrigger, { onClick: open, selectedCountry: selectedCountry, selectedLanguage: selectedLanguage, showCountry: showCountry }), jsx(CountrySelectorDialog, { countries: countries, isDismissable: isDismissable, isOpen: isOpen, onOpenChange: open => {
|
|
24
|
+
if (!isDismissable)
|
|
25
|
+
return;
|
|
26
|
+
setIsOpen(open);
|
|
27
|
+
}, onSubmit: async ({ country, language }) => {
|
|
28
|
+
if (selectedCountry?.id === country.id &&
|
|
29
|
+
selectedLanguage?.id === language.id)
|
|
30
|
+
return close();
|
|
31
|
+
await updateCountryLanguage({ country, language });
|
|
32
|
+
close();
|
|
33
|
+
onChange?.({ country, language });
|
|
34
|
+
}, selectedCountry: selectedCountry || defaultCountry, selectedLanguage: selectedLanguage || defaultLanguage, showCountry: showCountry })] }));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { ConnectedCountrySelector };
|