@sonic-equipment/ui 1.1.8 → 2.0.1
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/algolia/algolia-hits-provider.js +4 -1
- package/dist/algolia/algolia-insights-provider.js +3 -3
- package/dist/algolia/algolia-provider.d.ts +4 -1
- package/dist/algolia/algolia-provider.js +6 -3
- package/dist/algolia/algolia-search-provider.js +1 -1
- package/dist/algolia/algolia-searchclient-reserved-slots.d.ts +25 -0
- package/dist/algolia/algolia-searchclient-reserved-slots.js +67 -0
- package/dist/algolia/use-algolia-hits.d.ts +5 -2
- package/dist/algolia/use-algolia-hits.js +9 -5
- package/dist/algolia/use-algolia-insights.js +2 -2
- package/dist/algolia/use-algolia-search.js +2 -2
- package/dist/badges/tag/tag.d.ts +2 -1
- package/dist/badges/tag/tag.js +3 -2
- package/dist/base.css +28 -1
- package/dist/breadcrumbs/breadcrumb.d.ts +1 -1
- package/dist/breadcrumbs/breadcrumb.js +2 -2
- package/dist/buttons/button/button.d.ts +25 -11
- package/dist/buttons/button/button.js +41 -17
- package/dist/buttons/icon-button/icon-button.d.ts +8 -1
- package/dist/buttons/icon-button/icon-button.js +4 -5
- package/dist/cards/data-card/data-card.js +1 -1
- package/dist/cards/product-card/product-card.js +2 -1
- package/dist/cards/product-card/product-card.module.css.js +1 -1
- package/dist/cards/table-card/table-card.d.ts +6 -1
- package/dist/cards/table-card/table-card.js +3 -4
- package/dist/carousel/card-carousel/card-carousel.d.ts +3 -1
- package/dist/carousel/card-carousel/card-carousel.js +5 -3
- package/dist/carousel/card-carousel/card-carousel.module.css.js +1 -1
- package/dist/carousel/carousel-navigation-button.d.ts +3 -1
- package/dist/carousel/carousel-navigation-button.js +2 -3
- package/dist/carousel/carousel.js +1 -1
- package/dist/carousel/usp-carousel/product-usp-carousel-slide.js +1 -1
- package/dist/carousel/usp-carousel/usp-carousel.d.ts +0 -1
- package/dist/cart-totals/cart-totals-summary.js +1 -1
- package/dist/cart-totals/cart-totals.d.ts +3 -1
- package/dist/cart-totals/cart-totals.js +9 -3
- package/dist/cart-totals/cart-totals.module.css.js +1 -1
- package/dist/client-case-banner/client-case-banner.d.ts +16 -0
- package/dist/client-case-banner/client-case-banner.js +13 -0
- package/dist/client-case-banner/client-case-banner.module.css.js +3 -0
- package/dist/collapsables/accordion/accordion-item.js +1 -1
- package/dist/collapsables/cascading-component/cascading-component-container-provider.js +1 -1
- package/dist/collapsables/cascading-component/use-cascading-component-container.js +2 -2
- package/dist/collapsables/collapsable/collapsable.d.ts +12 -0
- package/dist/collapsables/collapsable/collapsable.js +31 -0
- package/dist/collapsables/collapsable/collapsable.module.css.js +3 -0
- package/dist/collapsables/unmounter/unmounter.js +3 -3
- package/dist/cookies/cookie-provider.js +1 -1
- package/dist/cookies/use-cookie.js +2 -2
- package/dist/country-language-selection-list/country-language-selection-list.js +1 -1
- package/dist/country-language-selection-list/country-language-selection-list.module.css.js +1 -1
- package/dist/country-language-selector/connected-country-language-selector.d.ts +1 -2
- package/dist/country-language-selector/connected-country-language-selector.js +2 -2
- package/dist/country-language-selector/country-language-selector.d.ts +1 -2
- package/dist/country-language-selector/country-language-selector.js +12 -19
- package/dist/country-language-selector/country-language-selector.module.css.js +1 -1
- package/dist/country-language-selector/fixtures/fixtures.d.ts +13 -0
- package/dist/country-language-selector-button/country-language-selector-button.stories.d.ts +13 -0
- package/dist/display/details/details.d.ts +2 -1
- package/dist/display/details/details.js +2 -2
- package/dist/display/product-sku/product-sku.js +3 -1
- package/dist/exports.d.ts +65 -20
- package/dist/filters/pagination/pagination.d.ts +2 -1
- package/dist/filters/pagination/pagination.js +3 -2
- package/dist/fonts.css +58 -56
- package/dist/footer/fixtures/fixtures.d.ts +3 -0
- package/dist/footer/footer.js +3 -2
- package/dist/footer/footer.module.css.js +1 -1
- package/dist/forms/elements/input/input.js +4 -6
- package/dist/forms/elements/range-slider/range-slider.d.ts +18 -0
- package/dist/forms/elements/range-slider/range-slider.js +31 -0
- package/dist/forms/elements/range-slider/range-slider.module.css.js +3 -0
- package/dist/global-search/global-search.d.ts +6 -1
- package/dist/global-search/global-search.js +3 -2
- package/dist/global-search/search-highlight/highlight.d.ts +7 -7
- package/dist/global-search/search-highlight/highlight.js +9 -9
- package/dist/global-search/search-input/connected-search-input.js +4 -1
- package/dist/global-search/search-result-panel/panel-content.d.ts +3 -1
- package/dist/global-search/search-result-panel/panel-content.js +2 -2
- package/dist/global-search/search-result-panel/search-result-panel.d.ts +3 -1
- package/dist/global-search/search-result-panel/search-result-panel.js +2 -2
- package/dist/global-search/search-result-panel/sections/no-search-results.js +1 -3
- package/dist/global-search/search-result-panel/sections/no-search.d.ts +2 -1
- package/dist/global-search/search-result-panel/sections/no-search.js +7 -14
- package/dist/global-search/search-result-panel/sections/search-content.module.css.js +1 -1
- package/dist/global-search/search-result-panel/sections/section-container.js +2 -2
- package/dist/global-search/search-result-panel/sections/with-results.js +6 -6
- package/dist/header/drawers/desktop-navigation-drawer.js +2 -1
- package/dist/header/drawers/mobile-navigation-drawer.js +2 -1
- package/dist/header/drawers/search-drawer.d.ts +3 -1
- package/dist/header/drawers/search-drawer.js +3 -2
- package/dist/header/drawers/search-drawer.module.css.js +3 -0
- package/dist/header/fixtures/fixtures.d.ts +4 -0
- package/dist/header/header-layout/header-layout.d.ts +1 -1
- package/dist/header/header-layout/header-layout.js +2 -3
- package/dist/header/header-layout/header-layout.module.css.js +1 -1
- package/dist/header/header.d.ts +3 -2
- package/dist/header/header.js +3 -2
- package/dist/header/header.module.css.js +1 -1
- package/dist/hubspot-form/hubspot-form.d.ts +41 -0
- package/dist/hubspot-form/hubspot-form.js +125 -0
- package/dist/hubspot-form/hubspot-form.module.css.js +3 -0
- package/dist/icons/index.d.ts +86 -0
- package/dist/icons/index.js +86 -0
- package/dist/icons/other/media-captionsoff-icon.d.ts +1 -0
- package/dist/icons/other/media-captionsoff-icon.js +7 -0
- package/dist/icons/other/media-captionson-icon.d.ts +1 -0
- package/dist/icons/other/media-captionson-icon.js +7 -0
- package/dist/icons/other/media-chapters-icon.d.ts +1 -0
- package/dist/icons/other/media-chapters-icon.js +7 -0
- package/dist/icons/other/media-enterfullscreen-icon.d.ts +1 -0
- package/dist/icons/other/media-enterfullscreen-icon.js +7 -0
- package/dist/icons/other/media-exitfullscreen-icon.d.ts +1 -0
- package/dist/icons/other/media-exitfullscreen-icon.js +7 -0
- package/dist/icons/other/media-pause-icon.d.ts +1 -0
- package/dist/icons/other/media-pause-icon.js +7 -0
- package/dist/icons/other/media-play-icon.d.ts +1 -0
- package/dist/icons/other/media-play-icon.js +7 -0
- package/dist/icons/other/media-seekbackwards-icon.d.ts +1 -0
- package/dist/icons/other/media-seekbackwards-icon.js +7 -0
- package/dist/icons/other/media-seekforwards-icon.d.ts +1 -0
- package/dist/icons/other/media-seekforwards-icon.js +7 -0
- package/dist/icons/other/media-subsoff-icon.d.ts +1 -0
- package/dist/icons/other/media-subsoff-icon.js +7 -0
- package/dist/icons/other/media-subson-icon.d.ts +1 -0
- package/dist/icons/other/media-subson-icon.js +7 -0
- package/dist/icons/other/media-volumefull-icon.d.ts +1 -0
- package/dist/icons/other/media-volumefull-icon.js +7 -0
- package/dist/icons/other/media-volumelow-icon.d.ts +1 -0
- package/dist/icons/other/media-volumelow-icon.js +7 -0
- package/dist/icons/other/media-volumemedium-icon.d.ts +1 -0
- package/dist/icons/other/media-volumemedium-icon.js +7 -0
- package/dist/icons/other/media-volumemuted-icon.d.ts +1 -0
- package/dist/icons/other/media-volumemuted-icon.js +7 -0
- package/dist/icons/solid/solid-enterfullscreen-icon.d.ts +1 -0
- package/dist/icons/solid/solid-exitfullscreen-icon.d.ts +1 -0
- package/dist/icons/solid/solid-facebook-icon.js +7 -0
- package/dist/icons/solid/solid-instagram-icon.js +7 -0
- package/dist/icons/solid/solid-link-icon.js +7 -0
- package/dist/icons/solid/solid-linkedin-icon.js +7 -0
- package/dist/icons/solid/solid-tiktok-icon.js +7 -0
- package/dist/icons/solid/solid-youtube-icon.js +7 -0
- package/dist/icons/stroke/stroke-business-icon.js +7 -0
- package/dist/icons/stroke/stroke-captions-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-captions-icon.js +7 -0
- package/dist/icons/stroke/stroke-efficiency-icon.js +7 -0
- package/dist/icons/stroke/stroke-fallback-icon.js +7 -0
- package/dist/icons/stroke/stroke-happy-icon.js +7 -0
- package/dist/icons/stroke/stroke-innovate-icon.js +7 -0
- package/dist/icons/stroke/stroke-list-icon.d.ts +1 -0
- package/dist/icons/stroke/stroke-list-icon.js +7 -0
- package/dist/icons/stroke/stroke-modular-icon.js +7 -0
- package/dist/icons/stroke/stroke-okay-icon.js +7 -0
- package/dist/icons/stroke/stroke-package-icon.js +7 -0
- package/dist/icons/stroke/stroke-proactive-icon.js +7 -0
- package/dist/icons/stroke/stroke-productivity-icon.js +7 -0
- package/dist/icons/stroke/stroke-rating-icon.js +7 -0
- package/dist/icons/stroke/stroke-salecategory-icon.js +7 -0
- package/dist/icons/stroke/stroke-style-icon.js +7 -0
- package/dist/icons/stroke/stroke-support-icon.js +7 -0
- package/dist/icons/stroke/stroke-thumbsup-icon.js +7 -0
- package/dist/icons/stroke/stroke-warranty10y-icon.js +7 -0
- package/dist/icons/stroke/stroke-warranty1y-icon.js +7 -0
- package/dist/icons/stroke/stroke-warranty3y-icon.js +7 -0
- package/dist/icons/stroke/stroke-warranty5y-icon.js +7 -0
- package/dist/icons/stroke/stroke-warrantyconsumable-icon.js +7 -0
- package/dist/icons/stroke/stroke-warrantylifetime-icon.js +7 -0
- package/dist/image-banner/image-banner.d.ts +20 -0
- package/dist/image-banner/image-banner.js +15 -0
- package/dist/image-banner/image-banner.module.css.js +3 -0
- package/dist/index.js +76 -32
- package/dist/intl/intl-provider.js +1 -1
- package/dist/intl/missing-translation-provider.js +1 -1
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/intl/use-intl.js +2 -2
- package/dist/lists/download-document-list/download-document-list.js +2 -1
- package/dist/lists/menu-list/menu-list-provider.js +1 -1
- package/dist/lists/menu-list/use-menu-list.js +2 -2
- package/dist/lists/product-overview-grid/product-overview-grid.d.ts +17 -2
- package/dist/lists/product-overview-grid/product-overview-grid.js +20 -8
- package/dist/lists/product-overview-grid/product-overview-grid.module.css.js +1 -1
- package/dist/loading/dynamic-loading-overlay.js +1 -23
- package/dist/loading/dynamic-loading-overlay.module.css.js +1 -1
- package/dist/media/image-cdn/image-cdn-profile.d.ts +45 -0
- package/dist/media/image-cdn/image-cdn-profile.js +63 -0
- package/dist/media/image-cdn/image-cdn-profile.test.d.ts +1 -0
- package/dist/media/image-cdn/image-cdn-provider.d.ts +10 -0
- package/dist/media/image-cdn/image-cdn-provider.js +15 -0
- package/dist/media/image-cdn/storyblok-profile.d.ts +3 -0
- package/dist/media/image-cdn/storyblok-profile.js +37 -0
- package/dist/media/image-cdn/storyblok-profile.test.d.ts +1 -0
- package/dist/media/image-lightbox/image-lightbox.module.css.js +1 -1
- package/dist/media/media-controls/media-chapters-control/media-chapters-control.d.ts +8 -0
- package/dist/media/media-controls/media-chapters-control/media-chapters-control.js +63 -0
- package/dist/media/media-controls/media-control/media-control.d.ts +19 -0
- package/dist/media/media-controls/media-control/media-control.js +15 -0
- package/dist/media/media-controls/media-controls.d.ts +12 -0
- package/dist/media/media-controls/media-controls.js +17 -0
- package/dist/media/media-controls/media-controls.module.css.js +3 -0
- package/dist/media/media-controls/media-popover/media-popover.d.ts +12 -0
- package/dist/media/media-controls/media-popover/media-popover.js +67 -0
- package/dist/media/media-controls/media-progress-circle/media-progress-circle.d.ts +20 -0
- package/dist/media/media-controls/media-progress-circle/media-progress-circle.js +31 -0
- package/dist/media/media-controls/media-seek-control/media-seek-control.d.ts +6 -0
- package/dist/media/media-controls/media-seek-control/media-seek-control.js +30 -0
- package/dist/media/media-controls/media-subs-control/media-subs-control.d.ts +8 -0
- package/dist/media/media-controls/media-subs-control/media-subs-control.js +65 -0
- package/dist/media/media-controls/media-volume-control/media-volume-control.d.ts +7 -0
- package/dist/media/media-controls/media-volume-control/media-volume-control.js +103 -0
- package/dist/media/media-utils.d.ts +19 -0
- package/dist/media/media-utils.js +28 -0
- package/dist/media/responsive-image/responsive-image.d.ts +37 -0
- package/dist/media/responsive-image/responsive-image.js +135 -0
- package/dist/media/responsive-image/responsive-image.module.css.js +3 -0
- package/dist/media/responsive-video/responsive-video.d.ts +36 -0
- package/dist/media/responsive-video/responsive-video.js +367 -0
- package/dist/media/responsive-video/responsive-video.module.css.js +3 -0
- package/dist/modals/dialog/dialog.js +1 -1
- package/dist/navigation/panel-navigation/panel-navigation.js +1 -1
- package/dist/notifications/announcements/announcement-list.d.ts +10 -1
- package/dist/notifications/announcements/announcement-list.js +1 -13
- package/dist/notifications/announcements/announcement-list.module.css.js +1 -1
- package/dist/notifications/announcements/announcement.d.ts +13 -2
- package/dist/notifications/announcements/announcement.js +14 -6
- package/dist/notifications/announcements/fixtures/fixtures.d.ts +22 -0
- package/dist/page-layout/fixtures/fixtures.d.ts +15 -0
- package/dist/page-layout/page-layout.d.ts +2 -0
- package/dist/page-layout/page-layout.js +33 -0
- package/dist/page-layout/page-layout.module.css.js +3 -0
- package/dist/page-layout/types.d.ts +52 -0
- package/dist/pages/account/change-password-page/change-password-page.js +6 -2
- package/dist/pages/account/components/change-password-form/change-password-form.js +1 -5
- package/dist/pages/account/components/create-account-form/create-account-form.js +1 -4
- package/dist/pages/account/components/sign-in-form/sign-in-form.js +2 -6
- package/dist/pages/account/create-account-page/create-account-page.d.ts +1 -1
- package/dist/pages/account/create-account-page/create-account-page.js +8 -4
- package/dist/pages/account/sign-in-page/sign-in-page.d.ts +1 -1
- package/dist/pages/account/sign-in-page/sign-in-page.js +6 -4
- package/dist/pages/checkout/cart-page/cart-page.d.ts +1 -1
- package/dist/pages/checkout/cart-page/cart-page.js +35 -68
- package/dist/pages/checkout/components/billing-and-invoice-information.js +1 -1
- package/dist/pages/checkout/components/billing-and-invoice-information.module.css.js +1 -1
- package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-header.d.ts +1 -1
- package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-header.js +2 -2
- package/dist/pages/checkout/components/checkout-page-section.js +12 -0
- package/dist/pages/checkout/components/checkout-page-section.module.css.js +3 -0
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +50 -63
- package/dist/pages/checkout/payment-page/payment-page-content.js +25 -25
- package/dist/pages/checkout/shipping-page/components/edit-checkout-bill-to-address-form.js +2 -2
- package/dist/pages/checkout/shipping-page/components/readonly-address.js +3 -3
- package/dist/pages/checkout/shipping-page/components/readonly-address.module.css.js +1 -1
- package/dist/pages/checkout/shipping-page/shipping-page-content.js +12 -12
- package/dist/pages/components/page/page.js +1 -1
- package/dist/pages/countries-page/countries-page.js +7 -4
- package/dist/pages/error-page/error-page.js +2 -7
- package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +2 -1
- package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.d.ts +0 -3
- package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.js +16 -17
- package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.d.ts +0 -3
- package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.js +16 -17
- package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.d.ts +0 -4
- package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.js +16 -17
- package/dist/pages/my-sonic/pages/favorites/favorites-page.d.ts +0 -1
- package/dist/pages/my-sonic/pages/favorites/favorites-page.js +31 -33
- package/dist/pages/my-sonic/pages/favorites/favorites-page.module.css.js +3 -0
- package/dist/pages/my-sonic/pages/my-account/my-account-page.d.ts +0 -1
- package/dist/pages/my-sonic/pages/my-account/my-account-page.js +12 -12
- package/dist/pages/my-sonic/pages/order-details/order-details-content.js +3 -2
- package/dist/pages/my-sonic/pages/order-details/order-details-content.module.css.js +1 -1
- package/dist/pages/my-sonic/pages/order-details/order-details-page.d.ts +0 -3
- package/dist/pages/my-sonic/pages/order-details/order-details-page.js +17 -28
- package/dist/pages/my-sonic/pages/order-history/order-history-page.d.ts +0 -1
- package/dist/pages/my-sonic/pages/order-history/order-history-page.js +112 -116
- package/dist/pages/my-sonic/pages/upload-order-page/upload-order-page.d.ts +0 -1
- package/dist/pages/my-sonic/pages/upload-order-page/upload-order-page.js +12 -12
- package/dist/pages/product/components/product-overview.d.ts +11 -3
- package/dist/pages/product/components/product-overview.js +11 -7
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +5 -7
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.module.css.js +1 -1
- package/dist/pages/product/product-details-page/components/product-details-recently-viewed-section/product-details-recently-viewed-section.d.ts +3 -1
- package/dist/pages/product/product-details-page/components/product-details-recently-viewed-section/product-details-recently-viewed-section.js +9 -10
- package/dist/pages/product/product-details-page/product-details.js +18 -18
- package/dist/pages/product/product-details-page/product-details.module.css.js +3 -0
- package/dist/pages/product/product-listing-page/no-results/no-results.d.ts +3 -5
- package/dist/pages/product/product-listing-page/no-results/no-results.js +2 -4
- package/dist/pages/product/product-listing-page/no-results/no-results.module.css.js +1 -1
- package/dist/pages/product/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.js +6 -4
- package/dist/pages/product/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.module.css.js +3 -0
- package/dist/pages/product/product-listing-page/product-listing-page-provider/product-listing-page-provider.js +3 -3
- package/dist/pages/product/product-listing-page/product-listing-page.js +1 -1
- package/dist/pages/product/product-listing-page/product-listing-page.module.css.js +1 -1
- package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.d.ts +2 -1
- package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +2 -2
- package/dist/pages/product/product-listing-page/product-listing.d.ts +8 -1
- package/dist/pages/product/product-listing-page/product-listing.js +23 -23
- package/dist/pages/product/search-result-page/search-result-product-overview/search-result-product-overview.d.ts +2 -1
- package/dist/pages/product/search-result-page/search-result-product-overview/search-result-product-overview.js +2 -2
- package/dist/pages/product/search-result-page/search-results-page.js +20 -19
- package/dist/promos/promo-banners/promo-banners.js +2 -1
- package/dist/responsive-banner/responsive-banner.d.ts +30 -0
- package/dist/responsive-banner/responsive-banner.js +23 -0
- package/dist/responsive-banner/responsive-banner.module.css.js +3 -0
- package/dist/responsive-carousel/responsive-carousel.d.ts +18 -0
- package/dist/responsive-carousel/responsive-carousel.js +209 -0
- package/dist/responsive-carousel/responsive-carousel.module.css.js +3 -0
- package/dist/rich-text/rich-text.d.ts +7 -0
- package/dist/rich-text/rich-text.js +10 -0
- package/dist/rich-text/rich-text.module.css.js +3 -0
- package/dist/rte-asset/rte-asset.d.ts +8 -0
- package/dist/rte-asset/rte-asset.js +10 -0
- package/dist/rte-asset/rte-asset.module.css.js +3 -0
- package/dist/rte-blockquote/rte-blockquote.d.ts +8 -0
- package/dist/rte-blockquote/rte-blockquote.js +10 -0
- package/dist/rte-blockquote/rte-blockquote.module.css.js +3 -0
- package/dist/rte-details/rte-details.d.ts +7 -0
- package/dist/rte-details/rte-details.js +10 -0
- package/dist/rte-details/rte-details.module.css.js +3 -0
- package/dist/rte-ordered-list/rte-ordered-list.d.ts +14 -0
- package/dist/rte-ordered-list/rte-ordered-list.js +34 -0
- package/dist/rte-ordered-list/rte-ordered-list.module.css.js +3 -0
- package/dist/sections/about-section/about-section.d.ts +13 -0
- package/dist/sections/about-section/about-section.js +13 -0
- package/dist/sections/about-section/about-section.module.css.js +3 -0
- package/dist/sections/about-section/media-contact.d.ts +7 -0
- package/dist/sections/about-section/media-contact.js +12 -0
- package/dist/sections/banner-section/banner-section.d.ts +13 -0
- package/dist/sections/banner-section/banner-section.js +12 -0
- package/dist/sections/banner-section/banner-section.module.css.js +3 -0
- package/dist/sections/banner-section/fixtures/fixtures.d.ts +5 -0
- package/dist/sections/case-studies-listing-section/case-studies-listing-section.constants.d.ts +10 -0
- package/dist/sections/case-studies-listing-section/case-studies-listing-section.constants.js +12 -0
- package/dist/sections/case-studies-listing-section/case-studies-listing-section.d.ts +26 -0
- package/dist/sections/case-studies-listing-section/case-studies-listing-section.js +30 -0
- package/dist/sections/case-studies-listing-section/case-studies-listing-section.module.css.js +3 -0
- package/dist/sections/client-cases-carousel-section/client-cases-carousel-section.d.ts +13 -0
- package/dist/sections/client-cases-carousel-section/client-cases-carousel-section.js +13 -0
- package/dist/sections/client-cases-carousel-section/client-cases-carousel-section.module.css.js +3 -0
- package/dist/sections/downloadable-documents-section/downloadable-documents-section.d.ts +21 -0
- package/dist/sections/downloadable-documents-section/downloadable-documents-section.js +16 -0
- package/dist/sections/downloadable-documents-section/downloadable-documents-section.module.css.js +3 -0
- package/dist/sections/event-info-section/event-info-section.d.ts +9 -0
- package/dist/sections/event-info-section/event-info-section.js +23 -0
- package/dist/sections/event-info-section/event-info-section.module.css.js +3 -0
- package/dist/sections/faq-section/faq-section.d.ts +24 -0
- package/dist/sections/faq-section/faq-section.js +20 -0
- package/dist/sections/faq-section/faq-section.module.css.js +3 -0
- package/dist/sections/hero-section/hero-section.d.ts +22 -0
- package/dist/sections/hero-section/hero-section.js +16 -0
- package/dist/sections/hero-section/hero-section.module.css.js +3 -0
- package/dist/sections/hubspot-form-section/hubspot-form-section.d.ts +18 -0
- package/dist/sections/hubspot-form-section/hubspot-form-section.js +18 -0
- package/dist/sections/hubspot-form-section/hubspot-form-section.module.css.js +3 -0
- package/dist/sections/image-banner-carousel-section/image-banner-carousel-section.d.ts +12 -0
- package/dist/sections/image-banner-carousel-section/image-banner-carousel-section.js +13 -0
- package/dist/sections/image-banner-carousel-section/image-banner-carousel-section.module.css.js +3 -0
- package/dist/sections/image-banner-section/image-banner-section.d.ts +12 -0
- package/dist/sections/image-banner-section/image-banner-section.js +12 -0
- package/dist/sections/image-banner-section/image-banner-section.module.css.js +3 -0
- package/dist/sections/image-hubspot-section/image-hubspot-form-section.d.ts +21 -0
- package/dist/sections/image-hubspot-section/image-hubspot-form-section.js +19 -0
- package/dist/sections/image-hubspot-section/image-hubspot-form-section.module.css.js +3 -0
- package/dist/sections/image-section/image-section.d.ts +25 -0
- package/dist/sections/image-section/image-section.js +14 -0
- package/dist/sections/image-section/image-section.module.css.js +3 -0
- package/dist/sections/image-text-section/image-text-block.d.ts +13 -0
- package/dist/sections/image-text-section/image-text-block.js +13 -0
- package/dist/sections/image-text-section/image-text-section.d.ts +15 -0
- package/dist/sections/image-text-section/image-text-section.js +12 -0
- package/dist/sections/image-text-section/image-text-section.module.css.js +3 -0
- package/dist/sections/legal-section/legal-section.d.ts +10 -0
- package/dist/sections/legal-section/legal-section.js +13 -0
- package/dist/sections/legal-section/legal-section.module.css.js +3 -0
- package/dist/sections/multi-column-section/multi-column-section.d.ts +24 -0
- package/dist/sections/multi-column-section/multi-column-section.js +24 -0
- package/dist/sections/multi-column-section/multi-column-section.module.css.js +3 -0
- package/dist/sections/news-list-section/news-listing-section.d.ts +17 -0
- package/dist/sections/news-list-section/news-listing-section.js +27 -0
- package/dist/sections/news-list-section/news-listing-section.module.css.js +3 -0
- package/dist/sections/numbers-section/numbers-section.d.ts +18 -0
- package/dist/sections/numbers-section/numbers-section.js +15 -0
- package/dist/sections/numbers-section/numbers-section.module.css.js +3 -0
- package/dist/sections/page-meta-section/page-meta-section.d.ts +8 -0
- package/dist/sections/page-meta-section/page-meta-section.js +23 -0
- package/dist/sections/page-meta-section/page-meta-section.module.css.js +3 -0
- package/dist/sections/page-section/page-section.d.ts +297 -0
- package/dist/sections/page-section/page-section.js +23 -0
- package/dist/sections/page-section/page-section.module.css.js +3 -0
- package/dist/sections/percentages-section/percentages-section.d.ts +21 -0
- package/dist/sections/percentages-section/percentages-section.js +18 -0
- package/dist/sections/percentages-section/percentages-section.module.css.js +3 -0
- package/dist/sections/product-comparison-section/product-comparison-section.d.ts +17 -0
- package/dist/sections/product-comparison-section/product-comparison-section.js +19 -0
- package/dist/sections/product-comparison-section/product-comparison-section.module.css.js +3 -0
- package/dist/sections/rich-text-section/rich-text-section.d.ts +11 -0
- package/dist/sections/rich-text-section/rich-text-section.js +12 -0
- package/dist/sections/rich-text-section/rich-text-section.module.css.js +3 -0
- package/dist/sections/social-media-section/social-media-section.d.ts +20 -0
- package/dist/sections/social-media-section/social-media-section.js +27 -0
- package/dist/sections/social-media-section/social-media-section.module.css.js +3 -0
- package/dist/sections/subheadline-section/subheadline-section.d.ts +7 -0
- package/dist/sections/subheadline-section/subheadline-section.js +12 -0
- package/dist/sections/subheadline-section/subheadline-section.module.css.js +3 -0
- package/dist/sections/usp-section/usp-section.d.ts +19 -0
- package/dist/sections/usp-section/usp-section.js +17 -0
- package/dist/sections/usp-section/usp-section.module.css.js +3 -0
- package/dist/sections/video-section/video-section.d.ts +30 -0
- package/dist/sections/video-section/video-section.js +13 -0
- package/dist/sections/video-section/video-section.module.css.js +3 -0
- package/dist/shared/error/default-error-view.d.ts +1 -1
- package/dist/shared/error/default-error-view.js +4 -2
- package/dist/shared/error/default-error-view.module.css.js +1 -1
- package/dist/shared/error/global-unhandled-error-handler.js +3 -3
- package/dist/shared/feature-flags/use-feature-flags.d.ts +1 -0
- package/dist/shared/feature-flags/use-feature-flags.js +3 -2
- package/dist/shared/hooks/use-drag-scroll.d.ts +20 -0
- package/dist/shared/hooks/use-drag-scroll.js +107 -0
- package/dist/shared/local-storage/local-storage-provider.js +1 -1
- package/dist/shared/local-storage/use-local-storage.js +2 -2
- package/dist/shared/local-storage/use-session-storage.js +2 -2
- package/dist/shared/model/announcement.d.ts +1 -0
- package/dist/shared/model/image.d.ts +5 -0
- package/dist/shared/providers/global-state-provider.js +3 -3
- package/dist/shared/routing/route-provider.js +1 -1
- package/dist/shared/routing/use-router.js +2 -2
- package/dist/shared/utils/array.d.ts +1 -0
- package/dist/shared/utils/array.js +9 -1
- package/dist/shared/utils/array.test.d.ts +1 -0
- package/dist/sidebar/sidebar.js +2 -2
- package/dist/site-layout/site-layout.d.ts +15 -0
- package/dist/site-layout/site-layout.js +39 -0
- package/dist/site-layout/site-layout.module.css.js +3 -0
- package/dist/styles.css +10823 -3361
- package/dist/table/elements/table-provider.js +1 -1
- package/dist/table/elements/table-row-provider.js +1 -1
- package/dist/table/elements/table.js +2 -2
- package/dist/table/elements/use-table-row.js +2 -2
- package/dist/table/elements/use-table.js +2 -2
- package/dist/toast/toast.d.ts +6 -1
- package/dist/toast/toast.js +2 -3
- package/dist/typography/heading/heading.d.ts +18 -10
- package/dist/typography/heading/heading.js +28 -14
- package/dist/typography/heading/heading.module.css.js +1 -1
- package/package.json +6 -5
- package/dist/footer/connected-footer.d.ts +0 -3
- package/dist/footer/connected-footer.js +0 -21
- package/dist/header/connected-header.d.ts +0 -3
- package/dist/header/connected-header.js +0 -21
- package/dist/notifications/announcements/connected-announcement-list.d.ts +0 -3
- package/dist/notifications/announcements/connected-announcement-list.js +0 -22
- package/dist/notifications/announcements/use-filter-announcements.d.ts +0 -2
- package/dist/notifications/announcements/use-filter-announcements.js +0 -35
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-background-image.d.ts +0 -6
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-background-image.js +0 -9
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.d.ts +0 -9
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.js +0 -12
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.module.css.js +0 -3
- package/dist/pages/checkout/cart-page/components/empty-cart-page.d.ts +0 -1
- package/dist/pages/checkout/cart-page/components/empty-cart-page.js +0 -12
- package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.d.ts +0 -11
- package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.js +0 -34
- package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.module.css.js +0 -3
- package/dist/pages/checkout/layouts/checkout-page-layout/components/checkout-page-section.js +0 -11
- package/dist/pages/checkout/layouts/checkout-page-layout/components/checkout-page-section.module.css.js +0 -3
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.d.ts +0 -4
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.js +0 -9
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-breadcrumb.d.ts +0 -4
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-breadcrumb.js +0 -9
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.d.ts +0 -4
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.js +0 -9
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.d.ts +0 -5
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.js +0 -10
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.d.ts +0 -4
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.js +0 -9
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.d.ts +0 -4
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.js +0 -10
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.d.ts +0 -5
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.js +0 -10
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.module.css.js +0 -3
- package/dist/pages/product/layouts/product-details-page-layout/product-details-page-layout.d.ts +0 -9
- package/dist/pages/product/layouts/product-details-page-layout/product-details-page-layout.js +0 -10
- package/dist/pages/product/layouts/product-details-page-layout/product-details-page-layout.module.css.js +0 -3
- package/dist/pages/product/product-details-page/components/product-details-recently-viewed-section/product-details-recently-viewed-section.module.css.js +0 -3
- package/dist/pages/product/search-result-page/search-results-page.module.css.js +0 -3
- /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-content.d.ts +0 -0
- /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-content.js +0 -0
- /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-link.d.ts +0 -0
- /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section-link.js +0 -0
- /package/dist/pages/checkout/{layouts/checkout-page-layout/components → components}/checkout-page-section.d.ts +0 -0
|
@@ -5,13 +5,14 @@ import { Transition } from 'react-transition-group';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useAlgoliaSearch } from '../algolia/use-algolia-search.js';
|
|
7
7
|
import { Drawer } from '../drawer/drawer.js';
|
|
8
|
+
import { PageSection } from '../sections/page-section/page-section.js';
|
|
8
9
|
import { useOnNavigate } from '../shared/routing/use-on-navigate.js';
|
|
9
10
|
import { useGlobalSearchDisclosure } from './global-search-provider/use-search-disclosure.js';
|
|
10
11
|
import { ConnectedSearchInput } from './search-input/connected-search-input.js';
|
|
11
12
|
import { SearchResultPanel } from './search-result-panel/search-result-panel.js';
|
|
12
13
|
import styles from './global-search.module.css.js';
|
|
13
14
|
|
|
14
|
-
function SearchRoot() {
|
|
15
|
+
function SearchRoot({ searchSection, }) {
|
|
15
16
|
const { autocomplete, inputRef } = useAlgoliaSearch();
|
|
16
17
|
const { isOpen } = useGlobalSearchDisclosure();
|
|
17
18
|
useEffect(() => {
|
|
@@ -24,7 +25,7 @@ function SearchRoot() {
|
|
|
24
25
|
inputRef.current.blur();
|
|
25
26
|
}
|
|
26
27
|
}, [inputRef, isOpen]);
|
|
27
|
-
return (jsx("div",
|
|
28
|
+
return (jsx(PageSection, { as: "div", className: styles['search-root'], children: jsx(Transition, { in: isOpen, nodeRef: inputRef, timeout: 300, children: transitionState => (jsxs("div", { className: clsx(styles['search-container'], styles[transitionState]), ...autocomplete.getRootProps({}), children: [jsx("div", { className: styles.input, children: jsx(ConnectedSearchInput, {}) }), jsx(SearchResultPanel, { noSearch: searchSection?.noSearch })] })) }) }));
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
31
|
* Global search using algolia autocomplete with a custom renderer
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { HighlightedHit } from '@algolia/autocomplete-preset-algolia/dist/esm';
|
|
3
3
|
type HighlightHitParams<THit> = {
|
|
4
|
+
/**
|
|
5
|
+
* The tag to use for highlighted parts.
|
|
6
|
+
*
|
|
7
|
+
* @default "mark"
|
|
8
|
+
*/
|
|
9
|
+
as?: keyof JSX.IntrinsicElements;
|
|
4
10
|
/**
|
|
5
11
|
* The attribute to retrieve the highlighted parts from.
|
|
6
12
|
*
|
|
@@ -11,12 +17,6 @@ type HighlightHitParams<THit> = {
|
|
|
11
17
|
* The Algolia hit whose attribute to retrieve the highlighted parts from.
|
|
12
18
|
*/
|
|
13
19
|
hit: THit;
|
|
14
|
-
/**
|
|
15
|
-
* The tag name to use for highlighted parts.
|
|
16
|
-
*
|
|
17
|
-
* @default "mark"
|
|
18
|
-
*/
|
|
19
|
-
tagName?: string;
|
|
20
20
|
};
|
|
21
|
-
export declare function Highlight<THit extends HighlightedHit<unknown>>({ attribute, hit,
|
|
21
|
+
export declare function Highlight<THit extends HighlightedHit<unknown>>({ as: Tag, attribute, hit, }: HighlightHitParams<THit>): JSX.Element;
|
|
22
22
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { parseAlgoliaHitHighlight } from '../../node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/parseAlgoliaHitHighlight.js';
|
|
4
4
|
|
|
5
|
-
function Highlight({
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
function Highlight({ as: Tag = 'mark', attribute, hit, }) {
|
|
6
|
+
return (jsx(Fragment, { children: parseAlgoliaHitHighlight({ attribute, hit }).map(({ isHighlighted, value }, index) => {
|
|
7
|
+
if (isHighlighted) {
|
|
8
|
+
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
9
|
+
return jsx(Tag, { children: value }, index);
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}) }));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { Highlight };
|
|
@@ -14,8 +14,11 @@ function ConnectedSearchInput() {
|
|
|
14
14
|
return (jsx(SearchInput, { autocomplete: autocomplete, formRef: formRef, inputRef: inputRef, onCancel: close, onSubmit: () => {
|
|
15
15
|
if (!inputRef.current?.value)
|
|
16
16
|
return;
|
|
17
|
+
// No `close()` here: `navigate` broadcasts through `useOnNavigate`,
|
|
18
|
+
// and the header closes the drawer from there (`header.tsx`). The
|
|
19
|
+
// cancel button above still closes directly, because cancelling is
|
|
20
|
+
// not a navigation.
|
|
17
21
|
navigate(`/search?keyword=${encodeURIComponent(inputRef.current.value)}`);
|
|
18
|
-
return close();
|
|
19
22
|
}, placeholder: t('What are you searching for?') }));
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -5,12 +5,12 @@ import { NoSearch } from './sections/no-search.js';
|
|
|
5
5
|
import { NoSearchResults } from './sections/no-search-results.js';
|
|
6
6
|
import { WithResults } from './sections/with-results.js';
|
|
7
7
|
|
|
8
|
-
function PanelContent() {
|
|
8
|
+
function PanelContent({ noSearch }) {
|
|
9
9
|
const { state } = useAlgoliaSearch();
|
|
10
10
|
const hasSearchQuery = state.query.length > 0;
|
|
11
11
|
const isLoading = (state.status === 'loading' || state.status === 'stalled') && hasSearchQuery;
|
|
12
12
|
const hasResults = (state.collections.find(collection => collection.source.sourceId === 'productsPlugin')?.items.length || 0) > 0;
|
|
13
|
-
return (jsx(Fragment, { children: hasResults ? (jsx(WithResults, { isLoading: isLoading })) : hasSearchQuery && !isLoading ? (jsx(NoSearchResults, { isLoading: isLoading })) : (jsx(NoSearch, { isLoading: isLoading })) }));
|
|
13
|
+
return (jsx(Fragment, { children: hasResults ? (jsx(WithResults, { isLoading: isLoading })) : hasSearchQuery && !isLoading ? (jsx(NoSearchResults, { isLoading: isLoading })) : (jsx(NoSearch, { isLoading: isLoading, children: noSearch })) }));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export { PanelContent };
|
|
@@ -7,11 +7,11 @@ import { useGlobalSearchDisclosure } from '../global-search-provider/use-search-
|
|
|
7
7
|
import { PanelContent } from './panel-content.js';
|
|
8
8
|
import styles from './search-result-panel.module.css.js';
|
|
9
9
|
|
|
10
|
-
function SearchResultPanel() {
|
|
10
|
+
function SearchResultPanel({ noSearch, }) {
|
|
11
11
|
const { autocomplete, panelRef } = useAlgoliaSearch();
|
|
12
12
|
const { isOpen } = useGlobalSearchDisclosure();
|
|
13
13
|
// https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer/#check-network-status
|
|
14
|
-
return (jsx(Transition, { in: isOpen, nodeRef: panelRef, timeout: 300, children: transitionState => (jsx("div", { ref: panelRef, className: clsx(styles['search-result-panel'], styles[transitionState]), ...autocomplete.getPanelProps({}), children: jsx(PanelContent, {}) })) }));
|
|
14
|
+
return (jsx(Transition, { in: isOpen, nodeRef: panelRef, timeout: 300, children: transitionState => (jsx("div", { ref: panelRef, className: clsx(styles['search-result-panel'], styles[transitionState]), ...autocomplete.getPanelProps({}), children: jsx(PanelContent, { noSearch: noSearch }) })) }));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export { SearchResultPanel };
|
|
@@ -5,7 +5,6 @@ import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
|
5
5
|
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
6
6
|
import { Truncated } from '../../../text/truncated/truncated.js';
|
|
7
7
|
import { CategoriesGrid } from '../../categories-grid/categories-grid.js';
|
|
8
|
-
import { useGlobalSearchDisclosure } from '../../global-search-provider/use-search-disclosure.js';
|
|
9
8
|
import { SearchSection } from '../../search-section/search-section.js';
|
|
10
9
|
import { SearchingSection } from './searching.js';
|
|
11
10
|
import { SectionContainer } from './section-container.js';
|
|
@@ -22,11 +21,10 @@ function NotFound() {
|
|
|
22
21
|
function PopularCategoriesSection() {
|
|
23
22
|
const { popularCategories: collection } = useAlgoliaSearch();
|
|
24
23
|
const t = useFormattedMessage();
|
|
25
|
-
const { close } = useGlobalSearchDisclosure();
|
|
26
24
|
if (!collection)
|
|
27
25
|
return null;
|
|
28
26
|
const { items } = collection;
|
|
29
|
-
return (jsx(SearchSection, { title: t('Explore by categories'), children: jsx("div", { className: styles['categories-grid-container'], children: jsx(CategoriesGrid, { categories: items
|
|
27
|
+
return (jsx(SearchSection, { title: t('Explore by categories'), children: jsx("div", { className: styles['categories-grid-container'], children: jsx(CategoriesGrid, { categories: items }) }) }));
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
export { NoSearchResults };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function NoSearch({ isLoading }: {
|
|
1
|
+
export declare function NoSearch({ children, isLoading, }: {
|
|
2
|
+
children?: React.ReactNode;
|
|
2
3
|
isLoading?: boolean;
|
|
3
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
export declare function PopularSearchesSection(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useAlgoliaSearch } from '../../../algolia/use-algolia-search.js';
|
|
4
4
|
import { Link } from '../../../buttons/link/link.js';
|
|
5
|
-
import { CardCarousel } from '../../../carousel/card-carousel/card-carousel.js';
|
|
6
5
|
import { Icon } from '../../../icon/icon.js';
|
|
7
6
|
import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
8
7
|
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
9
|
-
import { PromoCard } from '../../../promos/promo-card/promo-card.js';
|
|
10
|
-
import { useGlobalSearchDisclosure } from '../../global-search-provider/use-search-disclosure.js';
|
|
11
8
|
import { Highlight } from '../../search-highlight/highlight.js';
|
|
12
9
|
import { SearchList } from '../../search-section/search-list.js';
|
|
13
10
|
import { SearchListItem } from '../../search-section/search-list-item.js';
|
|
@@ -16,8 +13,8 @@ import { SearchingSection } from './searching.js';
|
|
|
16
13
|
import { SectionContainer } from './section-container.js';
|
|
17
14
|
import styles from './search-content.module.css.js';
|
|
18
15
|
|
|
19
|
-
function NoSearch({ isLoading }) {
|
|
20
|
-
return (jsx(SectionContainer, { leftContent: jsxs("div", { children: [jsx(RecentSearchesSection, {}), jsx(PopularSearchesSection, {})] }), rightContent: isLoading ? jsx(SearchingSection, {}) : jsx(QuickAccessSection, {}) }));
|
|
16
|
+
function NoSearch({ children, isLoading, }) {
|
|
17
|
+
return (jsx(SectionContainer, { leftContent: jsxs("div", { children: [jsx(RecentSearchesSection, {}), jsx(PopularSearchesSection, {})] }), rightContent: isLoading ? (jsx(SearchingSection, {})) : (jsx(QuickAccessSection, { children: children })) }));
|
|
21
18
|
}
|
|
22
19
|
function PopularSearchesSection() {
|
|
23
20
|
const { autocomplete, popularSearches: collection } = useAlgoliaSearch();
|
|
@@ -44,16 +41,12 @@ function RecentSearchesSection() {
|
|
|
44
41
|
source: source,
|
|
45
42
|
}), icon: jsx(Icon, { name: "Refresh", size: "sm" }), isRemovable: true, onRemove: () => source.onRemove(item.id), text: jsx(Highlight, { attribute: "label", hit: item }) }, item.id))) }) }));
|
|
46
43
|
}
|
|
47
|
-
function QuickAccessSection() {
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
function QuickAccessSection({ children }) {
|
|
45
|
+
// Closing on click is deliberately absent: whatever is rendered here is
|
|
46
|
+
// editorial, and its links route through the library's `Link`, so the
|
|
47
|
+
// header closes the drawer from the `useOnNavigate` broadcast.
|
|
50
48
|
const t = useFormattedMessage();
|
|
51
|
-
|
|
52
|
-
return;
|
|
53
|
-
const { items } = collection;
|
|
54
|
-
return (jsx(SearchSection, { headerClassName: styles['quick-access-section-header'], title: t('Quick access'), children: jsx("div", { className: styles['product-results'], children: jsx(CardCarousel, { cards: items.map((item, index) => (jsx(PromoCard
|
|
55
|
-
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
56
|
-
, { href: item.action.url, image: item.image, onClick: close }, `${index}-${item.action.url}`))), cardsPerView: "auto", cardWidth: "narrow" }) }) }));
|
|
49
|
+
return (jsx(SearchSection, { headerClassName: styles['quick-access-section-header'], title: t('Quick access'), children: jsx("div", { className: styles['product-results'], children: children }) }));
|
|
57
50
|
}
|
|
58
51
|
|
|
59
52
|
export { NoSearch, PopularSearchesSection, RecentSearchesSection };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"section-container":"search-content-module-ZMwlB","
|
|
1
|
+
var styles = {"section-container":"search-content-module-ZMwlB","button-container":"search-content-module-w-ORq","product-results":"search-content-module-bcFCH","product-carousel":"search-content-module-KnjY8","no-results-text":"search-content-module-H-FX2","query":"search-content-module-LbQnK","query-text":"search-content-module---Nh-","suggestions":"search-content-module-mhiBZ","list":"search-content-module-coPAt","search-section":"search-content-module-qQMqH"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import styles from './search-content.module.css.js';
|
|
4
4
|
|
|
5
5
|
function SectionContainer({ buttons, leftContent, rightContent, }) {
|
|
6
|
-
return (
|
|
6
|
+
return (jsxs("div", { className: styles['section-container'], children: [jsx("div", { className: styles['left'], children: leftContent }), jsxs("div", { className: styles['right'], children: [rightContent, buttons && jsx("div", { className: styles['button-container'], children: buttons })] })] }));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { SectionContainer };
|
|
@@ -11,7 +11,6 @@ import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
|
11
11
|
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
12
12
|
import { PromoCard } from '../../../promos/promo-card/promo-card.js';
|
|
13
13
|
import { isProductHit } from '../../../shared/model/hit.js';
|
|
14
|
-
import { useGlobalSearchDisclosure } from '../../global-search-provider/use-search-disclosure.js';
|
|
15
14
|
import { Highlight } from '../../search-highlight/highlight.js';
|
|
16
15
|
import { SearchList } from '../../search-section/search-list.js';
|
|
17
16
|
import { SearchListItem } from '../../search-section/search-list-item.js';
|
|
@@ -23,8 +22,7 @@ import styles from './search-content.module.css.js';
|
|
|
23
22
|
|
|
24
23
|
function WithResults({ isLoading }) {
|
|
25
24
|
const { state } = useAlgoliaSearch();
|
|
26
|
-
|
|
27
|
-
return (jsx("div", { children: jsx(SectionContainer, { buttons: !isLoading && (jsx(Button, { withArrow: true, className: clsx(styles['show-all-button'], buttonStyles.button, buttonStyles.secondary, buttonStyles.outline, buttonStyles.md), href: `/search?keyword=${encodeURIComponent(state.query)}`, onClick: close, children: jsx(FormattedMessage, { id: "See all results" }) })), leftContent: jsx(SuggestionsSection, {}), rightContent: isLoading ? jsx(SearchingSection, {}) : jsx(ProductResultsSection, {}) }) }));
|
|
25
|
+
return (jsx("div", { children: jsx(SectionContainer, { buttons: !isLoading && (jsx(Button, { withArrow: true, className: clsx(styles['show-all-button'], buttonStyles.button, buttonStyles.secondary, buttonStyles.outline, buttonStyles.md), href: `/search?keyword=${encodeURIComponent(state.query)}`, children: jsx(FormattedMessage, { id: "See all results" }) })), leftContent: jsx(SuggestionsSection, {}), rightContent: isLoading ? jsx(SearchingSection, {}) : jsx(ProductResultsSection, {}) }) }));
|
|
28
26
|
}
|
|
29
27
|
function SuggestionsSection() {
|
|
30
28
|
const { autocomplete, categories, querySuggestions, recentSearches } = useAlgoliaSearch();
|
|
@@ -54,7 +52,6 @@ function SuggestionsSection() {
|
|
|
54
52
|
function ProductHitCard({ autocomplete, hit, index, source, }) {
|
|
55
53
|
// TODO: re-enable addToCart and addToFavorites when authentication problems are solved (or we got rid of the split domains)
|
|
56
54
|
// It is just a boolean prop defaulting to true
|
|
57
|
-
const { close } = useGlobalSearchDisclosure();
|
|
58
55
|
const { sendAddToCartFromSearchEvent, sendAddToWishListFromSearchEvent, sendProductClickFromSearchEvent, } = useAlgoliaInsights();
|
|
59
56
|
const { currencyCode, id, image, isVatIncluded, labels, name, objectId, originalPrice, position, price, queryId, storefrontId, storefrontSlug, } = hit;
|
|
60
57
|
const href = storefrontSlug;
|
|
@@ -70,7 +67,8 @@ function ProductHitCard({ autocomplete, hit, index, source, }) {
|
|
|
70
67
|
cartLine,
|
|
71
68
|
queryId,
|
|
72
69
|
}), onClick: () => {
|
|
73
|
-
|
|
70
|
+
// Closing is the header's job, via the `useOnNavigate` broadcast this
|
|
71
|
+
// card's `href` triggers; this handler only reports the click.
|
|
74
72
|
if (queryId) {
|
|
75
73
|
sendProductClickFromSearchEvent({
|
|
76
74
|
objectId,
|
|
@@ -98,7 +96,9 @@ function ProductResultsSection() {
|
|
|
98
96
|
if (!collection)
|
|
99
97
|
return null;
|
|
100
98
|
const { items, source } = collection;
|
|
101
|
-
return (jsx(SearchSection, { className: styles['product-results-section'], headerClassName: styles['product-results-section-header'], title: t('Products'), children: jsx("div", { className: styles['product-results'], ...autocomplete.getListProps({ source }), children: jsx(CardCarousel, { cards: items.map((hit, index) =>
|
|
99
|
+
return (jsx(SearchSection, { className: styles['product-results-section'], headerClassName: styles['product-results-section-header'], title: t('Products'), children: jsx("div", { className: styles['product-results'], ...autocomplete.getListProps({ source }), children: jsx(CardCarousel, { cards: items.map((hit, index) =>
|
|
100
|
+
// WARNING: there appears to be potential here for a promocard showing up in the search results in the header!
|
|
101
|
+
isProductHit(hit) ? (jsx(ProductHitCard, { autocomplete: autocomplete, hit: hit, index: index, source: source }, hit.id)) : (jsx(PromoCard, { href: hit.href, image: hit.image }, hit.id))), cardsPerView: "auto", cardWidth: "narrow", className: styles['product-carousel'] }) }) }));
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
export { WithResults };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
3
4
|
import { Drawer } from '../../drawer/drawer.js';
|
|
4
5
|
import { PanelNavigation } from '../../navigation/panel-navigation/panel-navigation.js';
|
|
5
6
|
import styles from './desktop-navigation-drawer.module.css.js';
|
|
6
7
|
|
|
7
8
|
function DesktopNavigationDrawer({ groupId, instanceId, linkGroup, onClosed, }) {
|
|
8
|
-
return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: styles['desktop-navigation-drawer'], "data-test-selector": "desktopNavigationDrawer", groupId: groupId, instanceId: instanceId, onClosed: onClosed, position: "top", showUnder: "header", children: linkGroup && (jsx(PanelNavigation, { "data-test-selector": "desktopNavigationPanel", header: linkGroup, id: `panels-${linkGroup.key}`, linkItems: linkGroup.items }, linkGroup.key)) }));
|
|
9
|
+
return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: clsx('desktop-navigation-drawer', styles['desktop-navigation-drawer']), "data-test-selector": "desktopNavigationDrawer", groupId: groupId, instanceId: instanceId, onClosed: onClosed, position: "top", showUnder: "header", children: linkGroup && (jsx(PanelNavigation, { "data-test-selector": "desktopNavigationPanel", header: linkGroup, id: `panels-${linkGroup.key}`, linkItems: linkGroup.items }, linkGroup.key)) }));
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export { DesktopNavigationDrawer };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
3
4
|
import { Drawer } from '../../drawer/drawer.js';
|
|
4
5
|
import { MobileNavigation } from '../../navigation/mobile-navigation/mobile-navigation.js';
|
|
5
6
|
import styles from './mobile-navigation-drawer.module.css.js';
|
|
6
7
|
|
|
7
8
|
function MobileNavigationDrawer({ groupId, instanceId, linkItems, }) {
|
|
8
|
-
return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: styles['mobile-navigation-drawer'], "data-test-selector": "mobileNavigationDrawer", groupId: groupId, instanceId: instanceId, position: "left", showUnder: "announcement", children: ({ close, isOpen }) => (jsx(MobileNavigation, { id: "mobile-navigation", isActive: isOpen, linkItems: linkItems, onActiveChange: close })) }));
|
|
9
|
+
return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: clsx('mobile-navigation-drawer', styles['mobile-navigation-drawer']), "data-test-selector": "mobileNavigationDrawer", groupId: groupId, instanceId: instanceId, position: "left", showUnder: "announcement", children: ({ close, isOpen }) => (jsx(MobileNavigation, { id: "mobile-navigation", isActive: isOpen, linkItems: linkItems, onActiveChange: close })) }));
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export { MobileNavigationDrawer };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { searchSectionProps } from '../../global-search/global-search';
|
|
1
2
|
export interface SearchDrawerProps {
|
|
2
3
|
groupId?: string;
|
|
3
4
|
instanceId?: string;
|
|
5
|
+
searchSection?: searchSectionProps;
|
|
4
6
|
}
|
|
5
|
-
export declare function SearchDrawer({ groupId, instanceId }: SearchDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function SearchDrawer({ groupId, instanceId, searchSection, }: SearchDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Drawer } from '../../drawer/drawer.js';
|
|
4
4
|
import { SearchRoot } from '../../global-search/global-search.js';
|
|
5
|
+
import styles from './search-drawer.module.css.js';
|
|
5
6
|
|
|
6
|
-
function SearchDrawer({ groupId, instanceId }) {
|
|
7
|
-
return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, "data-test-selector": "searchDrawer", groupId: groupId, instanceId: instanceId, position: "top", showUnder: "header", children: jsx(SearchRoot, {}) }));
|
|
7
|
+
function SearchDrawer({ groupId, instanceId, searchSection, }) {
|
|
8
|
+
return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: styles['search-drawer'], "data-test-selector": "searchDrawer", groupId: groupId, instanceId: instanceId, position: "top", showUnder: "header", children: jsx(SearchRoot, { searchSection: searchSection }) }));
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export { SearchDrawer };
|
|
@@ -7,4 +7,4 @@ export interface HeaderLayoutProps {
|
|
|
7
7
|
navigationActions: ReactNode;
|
|
8
8
|
search: ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare function HeaderLayout({ hamburgerButton,
|
|
10
|
+
export declare function HeaderLayout({ hamburgerButton, logo, mainNavigation, navigationActions, search, }: HeaderLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
3
|
import styles from './header-layout.module.css.js';
|
|
5
4
|
|
|
6
|
-
function HeaderLayout({ hamburgerButton,
|
|
7
|
-
return (jsxs("div", { className:
|
|
5
|
+
function HeaderLayout({ hamburgerButton, logo, mainNavigation, navigationActions, search, }) {
|
|
6
|
+
return (jsxs("div", { className: styles['header-layout'], children: [jsx("div", { className: styles['logo'], children: logo }), jsx("nav", { className: styles['navigation'], children: mainNavigation }), jsx("div", { className: styles['hamburger'], children: hamburgerButton && hamburgerButton }), jsx("div", { className: styles['search'], children: search }), jsx("nav", { className: styles['actions'], children: navigationActions })] }));
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
export { HeaderLayout };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"header-layout":"header-layout-module-uGT3X","logo":"header-layout-module-oKPyL","hamburger":"header-layout-module-biHA2","search":"header-layout-module-fP3a6","navigation":"header-layout-module-vVRTn","actions":"header-layout-module-Ux7Uj"
|
|
1
|
+
var styles = {"header-layout":"header-layout-module-uGT3X","logo":"header-layout-module-oKPyL","hamburger":"header-layout-module-biHA2","search":"header-layout-module-fP3a6","navigation":"header-layout-module-vVRTn","actions":"header-layout-module-Ux7Uj"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
package/dist/header/header.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { searchSectionProps } from '../global-search/global-search';
|
|
1
2
|
import { NavigationSection } from '../shared/api/bff/model/bff.model';
|
|
2
3
|
export interface HeaderProps {
|
|
3
4
|
className?: string;
|
|
4
5
|
headerNavigationSection?: NavigationSection;
|
|
5
|
-
|
|
6
|
+
searchSection?: searchSectionProps;
|
|
6
7
|
}
|
|
7
|
-
export declare function Header({ className, headerNavigationSection,
|
|
8
|
+
export declare function Header({ className, headerNavigationSection, searchSection, }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/header/header.js
CHANGED
|
@@ -5,6 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { useDrawer } from '../drawer/use-drawer.js';
|
|
6
6
|
import { useGlobalSearchDisclosure } from '../global-search/global-search-provider/use-search-disclosure.js';
|
|
7
7
|
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
8
|
+
import { PageSection } from '../sections/page-section/page-section.js';
|
|
8
9
|
import { isNavigationSection, isNavigationLinkItem } from '../shared/api/bff/model/bff.model.js';
|
|
9
10
|
import { useIsBreakpoint } from '../shared/hooks/use-is-breakpoint.js';
|
|
10
11
|
import { useResizeObserver } from '../shared/hooks/use-resize-observer.js';
|
|
@@ -23,7 +24,7 @@ import { NavigationLinkList } from './link-list/navigation-link-list.js';
|
|
|
23
24
|
import { SonicLogo } from './sonic-logo/sonic-logo.js';
|
|
24
25
|
import styles from './header.module.css.js';
|
|
25
26
|
|
|
26
|
-
function Header({ className, headerNavigationSection,
|
|
27
|
+
function Header({ className, headerNavigationSection, searchSection, }) {
|
|
27
28
|
const paths = usePaths();
|
|
28
29
|
const [activeLinkGroup, setActiveLinkGroup] = useState();
|
|
29
30
|
const t = useFormattedMessage();
|
|
@@ -70,7 +71,7 @@ function Header({ className, headerNavigationSection, sticky, }) {
|
|
|
70
71
|
const mainNavigationSection = headerNavigationSection?.items
|
|
71
72
|
.filter(isNavigationSection)
|
|
72
73
|
.find(item => item.key === 'main-navigation');
|
|
73
|
-
return (jsxs(Fragment, { children: [jsx(
|
|
74
|
+
return (jsxs(Fragment, { children: [jsx(PageSection, { ref: headerRef, as: "header", className: clsx(styles['header'], hasDrawersOpen && styles['has-drawers-open'], className), "data-test-selector": "pageHeader", layout: "wide", children: jsx(HeaderLayout, { hamburgerButton: jsx(HamburgerButton, { "aria-controls": "mobile-navigation", "data-test-selector": "pageHeaderHamburgerButton", isActive: mobileNavigationOpen, onActiveChange: toggleMobileNavigation }), hasDrawersOpen: hasDrawersOpen, logo: jsx(SonicLogo, { "data-test-selector": "pageHeaderLogo", href: "/", title: t('Home') }), mainNavigation: jsx(NavigationLinkList, { activeLink: activeLinkGroup, "data-test-selector": "pageHeaderMainNavigation", navigationSection: mainNavigationSection, onSubmenuToggle: toggleActiveSubmenu }), navigationActions: jsxs(Fragment, { children: [jsx(ConnectedAccountButton, { "data-test-selector": "pageHeaderAccountButton" }), jsx(ConnectedFavoritesButton, { "data-test-selector": "pageHeaderFavoritesButton", href: paths.FAVORITES }), jsx(ConnectedCartButton, { "data-test-selector": "pageHeaderCartButton", href: paths.CART })] }), search: jsx(SearchButton, { "aria-controls": "global-search", "data-test-selector": "pageHeaderSearchButton", isActive: searchOpen, onActiveChange: toggleSearch }) }) }), jsx(SearchDrawer, { groupId: searchGroupId, instanceId: searchInstanceId, searchSection: searchSection }), !isXl && (jsx(MobileNavigationDrawer, { groupId: mobileNavigationDrawer.groupId, instanceId: mobileNavigationDrawer.instanceId, linkItems: mainNavigationSection?.items.filter(isNavigationLinkItem) })), isXl && (jsx(DesktopNavigationDrawer, { groupId: desktopNavigationDrawer.groupId, instanceId: desktopNavigationDrawer.instanceId, linkGroup: activeLinkGroup, onClosed: () => setActiveLinkGroup(undefined) }))] }));
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
export { Header };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
type hsFormSubmissionValues = Record<string, unknown>;
|
|
2
|
+
type hsFormSubmissionData = {
|
|
3
|
+
redirectUrl?: string;
|
|
4
|
+
submissionValues: hsFormSubmissionValues;
|
|
5
|
+
};
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
hbspt?: {
|
|
9
|
+
forms: {
|
|
10
|
+
create(options: {
|
|
11
|
+
formId: string;
|
|
12
|
+
onBeforeFormSubmit?: (formElement: HTMLFormElement, submissionValues: hsFormSubmissionValues) => void;
|
|
13
|
+
onFormReady?: (formElement: HTMLFormElement) => void;
|
|
14
|
+
onFormSubmitted?: (formElement: HTMLFormElement, data: hsFormSubmissionData) => void;
|
|
15
|
+
portalId: string;
|
|
16
|
+
region: string;
|
|
17
|
+
target: string;
|
|
18
|
+
}): void;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export type HubspotFormType = 'v2' | 'v3';
|
|
24
|
+
export interface HubspotFormProps {
|
|
25
|
+
ariaDetails?: string;
|
|
26
|
+
className?: string;
|
|
27
|
+
formId: string;
|
|
28
|
+
/** v2 only. */
|
|
29
|
+
onBeforeFormSubmit?: (formElement: HTMLFormElement, submissionValues: hsFormSubmissionValues) => void;
|
|
30
|
+
onError?: (error: Error) => void;
|
|
31
|
+
/** v2 only. */
|
|
32
|
+
onFormSubmitted?: (formElement: HTMLFormElement, data: hsFormSubmissionData) => void;
|
|
33
|
+
/** Called with the rendered `<form>` once HubSpot has inserted it. */
|
|
34
|
+
onLoad?: (formElement: HTMLFormElement) => void;
|
|
35
|
+
portalId: string;
|
|
36
|
+
/** Which HubSpot embed format to use. Defaults to `v2`. */
|
|
37
|
+
type?: HubspotFormType;
|
|
38
|
+
uid: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function HubspotForm({ ariaDetails, className, formId, onBeforeFormSubmit, onError, onFormSubmitted, onLoad, portalId, type, uid, }: HubspotFormProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useEffect } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import styles from './hubspot-form.module.css.js';
|
|
6
|
+
|
|
7
|
+
const REGION = 'eu1';
|
|
8
|
+
const SCRIPT_SRC_V2 = `https://js-${REGION}.hsforms.net/forms/embed/v2.js`;
|
|
9
|
+
let loader;
|
|
10
|
+
/** Loads the v2 HubSpot forms embed script once, shared across all instances. */
|
|
11
|
+
function loadFormsScript() {
|
|
12
|
+
loader ??= new Promise((resolve, reject) => {
|
|
13
|
+
const script = document?.createElement('script');
|
|
14
|
+
if (!script)
|
|
15
|
+
return;
|
|
16
|
+
script.src = SCRIPT_SRC_V2;
|
|
17
|
+
script.async = true;
|
|
18
|
+
script.addEventListener('load', () => resolve());
|
|
19
|
+
script.addEventListener('error', () => {
|
|
20
|
+
loader = undefined;
|
|
21
|
+
script.remove();
|
|
22
|
+
reject(new Error('Failed to load the HubSpot forms script'));
|
|
23
|
+
});
|
|
24
|
+
document?.head.append(script);
|
|
25
|
+
});
|
|
26
|
+
return loader;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* v3 forms use HubSpot's developer embed (`/forms/embed/developer/{portalId}.js`).
|
|
30
|
+
* Unlike the default v3 embed, which renders the form in a cross-origin iframe,
|
|
31
|
+
* the developer embed renders it as plain HTML in the page DOM without
|
|
32
|
+
* HubSpot's styling, so our own CSS (`hubspot-form.module.css`) can style it.
|
|
33
|
+
*
|
|
34
|
+
* The embed is declarative: the per-portal script scans the page for
|
|
35
|
+
* `.hs-form-html` elements once, when it runs. An element mounted later
|
|
36
|
+
* (client navigation, re-render) is never picked up by a script that already
|
|
37
|
+
* ran, so each mount injects a fresh script tag after its element to trigger
|
|
38
|
+
* a new scan.
|
|
39
|
+
*
|
|
40
|
+
* v3 has no `onFormReady` callback. A MutationObserver watches the
|
|
41
|
+
* `.hs-form-html` element instead and calls `onLoad` with the rendered
|
|
42
|
+
* `<form>` as soon as HubSpot inserts it.
|
|
43
|
+
*/
|
|
44
|
+
function embedV3(container, { formId, portalId }, { onError, onLoad }) {
|
|
45
|
+
const frame = container.ownerDocument.createElement('div');
|
|
46
|
+
frame.className = 'hs-form-html';
|
|
47
|
+
frame.dataset.region = REGION;
|
|
48
|
+
frame.dataset.formId = formId;
|
|
49
|
+
frame.dataset.portalId = portalId;
|
|
50
|
+
container.append(frame);
|
|
51
|
+
const observer = typeof MutationObserver === 'undefined'
|
|
52
|
+
? undefined
|
|
53
|
+
: new MutationObserver(() => {
|
|
54
|
+
const form = frame.querySelector('form');
|
|
55
|
+
if (!form)
|
|
56
|
+
return;
|
|
57
|
+
observer?.disconnect();
|
|
58
|
+
onLoad?.(form);
|
|
59
|
+
});
|
|
60
|
+
observer?.observe(frame, { childList: true, subtree: true });
|
|
61
|
+
const script = container.ownerDocument.createElement('script');
|
|
62
|
+
script.src = `https://js-${REGION}.hsforms.net/forms/embed/developer/${portalId}.js`;
|
|
63
|
+
script.defer = true;
|
|
64
|
+
script.addEventListener('error', () => {
|
|
65
|
+
onError?.(new Error('Failed to load the HubSpot forms script'));
|
|
66
|
+
});
|
|
67
|
+
container.append(script);
|
|
68
|
+
return () => {
|
|
69
|
+
observer?.disconnect();
|
|
70
|
+
script.remove();
|
|
71
|
+
frame.remove();
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function HubspotForm({ ariaDetails, className, formId, onBeforeFormSubmit, onError, onFormSubmitted, onLoad, portalId, type = 'v2', uid, }) {
|
|
75
|
+
const hubspotFormRef = useRef(null);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const targetId = `hbspt-form-${uid}`;
|
|
78
|
+
const targetEl = document?.createElement('div');
|
|
79
|
+
let cancelled = false;
|
|
80
|
+
if (!hubspotFormRef.current || !portalId || !formId || !targetEl)
|
|
81
|
+
return;
|
|
82
|
+
targetEl.setAttribute('id', targetId);
|
|
83
|
+
hubspotFormRef.current.append(targetEl);
|
|
84
|
+
if (type === 'v3') {
|
|
85
|
+
const cleanup = embedV3(targetEl, { formId, portalId }, { onError, onLoad });
|
|
86
|
+
return () => {
|
|
87
|
+
cleanup();
|
|
88
|
+
targetEl.remove();
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
loadFormsScript().then(() => {
|
|
92
|
+
if (cancelled || !window?.hbspt)
|
|
93
|
+
return;
|
|
94
|
+
window.hbspt.forms.create({
|
|
95
|
+
formId,
|
|
96
|
+
onBeforeFormSubmit,
|
|
97
|
+
onFormReady: formElement => {
|
|
98
|
+
onLoad?.(formElement);
|
|
99
|
+
},
|
|
100
|
+
onFormSubmitted,
|
|
101
|
+
portalId,
|
|
102
|
+
region: 'eu1',
|
|
103
|
+
target: `#${targetId}`,
|
|
104
|
+
});
|
|
105
|
+
}, error => onError?.(error instanceof Error ? error : new Error(String(error))));
|
|
106
|
+
// The bridge re-renders bloks while editing, so clear the injected form
|
|
107
|
+
// before the next create() to avoid stacking duplicates.
|
|
108
|
+
return () => {
|
|
109
|
+
cancelled = true;
|
|
110
|
+
targetEl.remove();
|
|
111
|
+
};
|
|
112
|
+
}, [
|
|
113
|
+
formId,
|
|
114
|
+
portalId,
|
|
115
|
+
uid,
|
|
116
|
+
onError,
|
|
117
|
+
onLoad,
|
|
118
|
+
onBeforeFormSubmit,
|
|
119
|
+
onFormSubmitted,
|
|
120
|
+
type,
|
|
121
|
+
]);
|
|
122
|
+
return (jsx("div", { ref: hubspotFormRef, "aria-details": ariaDetails, className: clsx(styles['hubspot-form'], className), "data-type": type, id: `hbspt-form-${uid}` }));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { HubspotForm };
|