@sonic-equipment/ui 155.0.0 → 157.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/exports.d.ts CHANGED
@@ -102,6 +102,7 @@ export * from './global-search/search-result-panel/panel-content';
102
102
  export * from './global-search/search-result-panel/search-result-panel';
103
103
  export * from './global-search/search-result-panel/sections/no-search';
104
104
  export * from './global-search/search-result-panel/sections/no-search-results';
105
+ export * from './global-search/search-result-panel/sections/searching';
105
106
  export * from './global-search/search-result-panel/sections/section-container';
106
107
  export * from './global-search/search-result-panel/sections/with-results';
107
108
  export * from './global-search/search-section/search-list';
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useRef, useEffect } from 'react';
4
- import { Select as Select$1, Button, SelectValue, Popover, ListBox, Section, Header, ListBoxItem } from 'react-aria-components';
4
+ import { Select as Select$1, Button, SelectValue, Popover, ListBox, ListBoxSection, Header, ListBoxItem } from 'react-aria-components';
5
5
  import clsx from 'clsx';
6
6
  import { GlyphsChevronsSlimDownIcon } from '../../icons/glyph/glyphs-chevrons-slim-down-icon.js';
7
7
  import { StrokeCheckmarkIcon } from '../../icons/stroke/stroke-checkmark-icon.js';
@@ -32,7 +32,7 @@ function Select({ 'data-test-selector': dataTestSelector, defaultSelectedOption,
32
32
  ? undefined
33
33
  : String(defaultSelectedOption), isDisabled: isDisabled, isRequired: isRequired, name: name, onSelectionChange: selected => onChange?.(selected), placeholder: placeholder || label, selectedKey: selectedOption === undefined ? undefined : String(selectedOption), children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), jsxs(Button, { className: styles.button, children: [jsx(SelectValue, { "data-test-selector": "value" }), jsx("div", { className: styles['icon-wrapper'], children: isLoading ? jsx(ProgressCircle, { variant: "gray" }) : icon })] }), jsx(FieldError, {}), jsx(Popover, { ref: ref =>
34
34
  // Workaround for react/react-aria #1513
35
- ref?.addEventListener('touchend', e => e.preventDefault()), className: clsx(styles.popover, styles[variant]), placement: "bottom left", children: jsx(ListBox, { className: styles.listbox, "data-test-selector": dataTestSelector ? `${dataTestSelector}_options` : undefined, children: jsxs(Section, { children: [showPlaceholder && (jsx(Header, { className: styles.header, children: placeholder || label })), Object.entries(options).map(([key, value]) => (jsxs(ListBoxItem, { "aria-label": value, className: styles.item, id: key, textValue: value, children: [selectedOption === key && (jsx("span", { slot: "description", children: jsx(StrokeCheckmarkIcon, { className: styles.check }) })), jsx("span", { slot: "label", children: value })] }, key)))] }) }) })] }));
35
+ ref?.addEventListener('touchend', e => e.preventDefault()), className: clsx(styles.popover, styles[variant]), placement: "bottom left", children: jsx(ListBox, { className: styles.listbox, "data-test-selector": dataTestSelector ? `${dataTestSelector}_options` : undefined, children: jsxs(ListBoxSection, { children: [showPlaceholder && (jsx(Header, { className: styles.header, children: placeholder || label })), Object.entries(options).map(([key, value]) => (jsxs(ListBoxItem, { "aria-label": value, className: styles.item, id: key, textValue: value, children: [selectedOption === key && (jsx("span", { slot: "description", children: jsx(StrokeCheckmarkIcon, { className: styles.check }) })), jsx("span", { slot: "label", children: value })] }, key)))] }) }) })] }));
36
36
  }
37
37
 
38
38
  export { Select };
@@ -6,8 +6,11 @@ import { NoSearchResults } from './sections/no-search-results.js';
6
6
  import { WithResults } from './sections/with-results.js';
7
7
 
8
8
  function PanelContent() {
9
- const { hasResults, state } = useAlgoliaSearch();
10
- return (jsx(Fragment, { children: state.query.length === 0 ? (jsx(NoSearch, {})) : hasResults ? (jsx(WithResults, {})) : (jsx(NoSearchResults, {})) }));
9
+ const { state } = useAlgoliaSearch();
10
+ const hasSearchQuery = state.query.length > 0;
11
+ const isLoading = (state.status === 'loading' || state.status === 'stalled') && hasSearchQuery;
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 })) }));
11
14
  }
12
15
 
13
16
  export { PanelContent };
@@ -1 +1,3 @@
1
- export declare function NoSearchResults(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function NoSearchResults({ isLoading }: {
2
+ isLoading?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -6,11 +6,12 @@ import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
6
6
  import { CategoriesGrid } from '../../categories-grid/categories-grid.js';
7
7
  import { useGlobalSearchDisclosure } from '../../global-search-provider/use-search-disclosure.js';
8
8
  import { SearchSection } from '../../search-section/search-section.js';
9
+ import { SearchingSection } from './searching.js';
9
10
  import { SectionContainer } from './section-container.js';
10
11
  import styles from './search-content.module.css.js';
11
12
 
12
- function NoSearchResults() {
13
- return (jsx(Fragment, { children: jsx(SectionContainer, { leftContent: jsx(NotFound, {}), rightContent: jsx(PopularCategoriesSection, {}) }) }));
13
+ function NoSearchResults({ isLoading }) {
14
+ return (jsx(Fragment, { children: jsx(SectionContainer, { leftContent: jsx(NotFound, {}), rightContent: isLoading ? jsx(SearchingSection, {}) : jsx(PopularCategoriesSection, {}) }) }));
14
15
  }
15
16
  function NotFound() {
16
17
  const { state } = useAlgoliaSearch();
@@ -1 +1,5 @@
1
- export declare function NoSearch(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function NoSearch({ isLoading }: {
2
+ isLoading?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
4
+ export declare function PopularSearchesSection(): import("react/jsx-runtime").JSX.Element | null;
5
+ export declare function RecentSearchesSection(): import("react/jsx-runtime").JSX.Element | null;
@@ -12,11 +12,12 @@ import { Highlight } from '../../search-highlight/highlight.js';
12
12
  import { SearchList } from '../../search-section/search-list.js';
13
13
  import { SearchListItem } from '../../search-section/search-list-item.js';
14
14
  import { SearchSection } from '../../search-section/search-section.js';
15
+ import { SearchingSection } from './searching.js';
15
16
  import { SectionContainer } from './section-container.js';
16
17
  import styles from './search-content.module.css.js';
17
18
 
18
- function NoSearch() {
19
- return (jsx(SectionContainer, { leftContent: jsxs("div", { children: [jsx(RecentSearchesSection, {}), jsx(PopularSearchesSection, {})] }), rightContent: jsx(QuickAccessSection, {}) }));
19
+ function NoSearch({ isLoading }) {
20
+ return (jsx(SectionContainer, { leftContent: jsxs("div", { children: [jsx(RecentSearchesSection, {}), jsx(PopularSearchesSection, {})] }), rightContent: isLoading ? jsx(SearchingSection, {}) : jsx(QuickAccessSection, {}) }));
20
21
  }
21
22
  function PopularSearchesSection() {
22
23
  const { autocomplete, popularSearches: collection } = useAlgoliaSearch();
@@ -55,4 +56,4 @@ function QuickAccessSection() {
55
56
  , { href: item.action.url, image: item.image, onClick: close }, `${index}-${item.action.url}`))), cardsPerView: "auto", cardWidth: "narrow" }) }) }));
56
57
  }
57
58
 
58
- export { NoSearch };
59
+ export { NoSearch, PopularSearchesSection, RecentSearchesSection };
@@ -1,3 +1,3 @@
1
- var styles = {"section-container":"search-content-module-ZMwlB","content":"search-content-module-KIok6","left":"search-content-module-YRLIf","right":"search-content-module-qK5sg","button-container":"search-content-module-w-ORq","show-all-button":"search-content-module-bO1Q0","product-results":"search-content-module-bcFCH","quick-access-section-header":"search-content-module-HrHCE","product-results-section-header":"search-content-module-9bgxF","no-results-text":"search-content-module-H-FX2","query":"search-content-module-LbQnK","suggestions":"search-content-module-mhiBZ","list":"search-content-module-coPAt"};
1
+ var styles = {"section-container":"search-content-module-ZMwlB","content":"search-content-module-KIok6","left":"search-content-module-YRLIf","right":"search-content-module-qK5sg","button-container":"search-content-module-w-ORq","show-all-button":"search-content-module-bO1Q0","product-results":"search-content-module-bcFCH","quick-access-section-header":"search-content-module-HrHCE","product-results-section-header":"search-content-module-9bgxF","no-results-text":"search-content-module-H-FX2","query":"search-content-module-LbQnK","suggestions":"search-content-module-mhiBZ","list":"search-content-module-coPAt","search-section":"search-content-module-qQMqH"};
2
2
 
3
3
  export { styles as default };
@@ -0,0 +1 @@
1
+ export declare function SearchingSection(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { ProgressCircle } from '../../../loading/progress-circle.js';
4
+ import { SearchSection } from '../../search-section/search-section.js';
5
+ import styles from './search-content.module.css.js';
6
+
7
+ function SearchingSection() {
8
+ return (jsx(SearchSection, { className: styles['search-section'], children: jsx(ProgressCircle, { variant: "gray" }) }));
9
+ }
10
+
11
+ export { SearchingSection };
@@ -1 +1,3 @@
1
- export declare function WithResults(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function WithResults({ isLoading }: {
2
+ isLoading?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,6 @@ import { useAlgoliaInsights } from '../../../algolia/use-algolia-insights.js';
6
6
  import { useAlgoliaSearch } from '../../../algolia/use-algolia-search.js';
7
7
  import { ConnectedProductCard } from '../../../cards/product-card/connected-product-card.js';
8
8
  import { CardCarousel } from '../../../carousel/card-carousel/card-carousel.js';
9
- import { GlyphsArrowBoldCapsRightIcon } from '../../../icons/glyph/glyphs-arrow-boldcaps-right-icon.js';
10
9
  import { StrokeRecentIcon } from '../../../icons/stroke/stroke-recent-icon.js';
11
10
  import { StrokeSearchIcon } from '../../../icons/stroke/stroke-search-icon.js';
12
11
  import { FormattedMessage } from '../../../intl/formatted-message.js';
@@ -19,14 +18,15 @@ import { Highlight } from '../../search-highlight/highlight.js';
19
18
  import { SearchList } from '../../search-section/search-list.js';
20
19
  import { SearchListItem } from '../../search-section/search-list-item.js';
21
20
  import { SearchSection } from '../../search-section/search-section.js';
21
+ import { SearchingSection } from './searching.js';
22
22
  import { SectionContainer } from './section-container.js';
23
23
  import buttonStyles from '../../../buttons/button/button.module.css.js';
24
24
  import styles from './search-content.module.css.js';
25
25
 
26
- function WithResults() {
26
+ function WithResults({ isLoading }) {
27
27
  const { state } = useAlgoliaSearch();
28
28
  const { close } = useGlobalSearchDisclosure();
29
- return (jsx("div", { children: jsx(SectionContainer, { buttons: jsxs(RouteButton, { 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" }), jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })] }), leftContent: jsx(SuggestionsSection, {}), rightContent: jsx(ProductResultsSection, {}) }) }));
29
+ return (jsx("div", { children: jsx(SectionContainer, { buttons: !isLoading && (jsx(RouteButton, { 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, {}) }) }));
30
30
  }
31
31
  function SuggestionsSection() {
32
32
  const { autocomplete, categories, querySuggestions, recentSearches } = useAlgoliaSearch();
package/dist/index.js CHANGED
@@ -105,8 +105,9 @@ export { ConnectedSearchInput } from './global-search/search-input/connected-sea
105
105
  export { SearchInput } from './global-search/search-input/search-input.js';
106
106
  export { PanelContent } from './global-search/search-result-panel/panel-content.js';
107
107
  export { SearchResultPanel } from './global-search/search-result-panel/search-result-panel.js';
108
- export { NoSearch } from './global-search/search-result-panel/sections/no-search.js';
108
+ export { NoSearch, PopularSearchesSection, RecentSearchesSection } from './global-search/search-result-panel/sections/no-search.js';
109
109
  export { NoSearchResults } from './global-search/search-result-panel/sections/no-search-results.js';
110
+ export { SearchingSection } from './global-search/search-result-panel/sections/searching.js';
110
111
  export { SectionContainer } from './global-search/search-result-panel/sections/section-container.js';
111
112
  export { WithResults } from './global-search/search-result-panel/sections/with-results.js';
112
113
  export { SearchList } from './global-search/search-section/search-list.js';
@@ -1 +1 @@
1
- export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | 'Your email and password were not recognized.' | 'Add order notes' | 'Add to list' | 'Address' | 'Amount: {0}' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'Attention' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | 'Cancel' | 'Cart' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Chosen filters' | 'City' | 'Clear filters' | 'Clear' | 'Click the button below to continue shopping.' | 'Close' | 'Company name' | 'Conceal value' | 'Continue shopping' | 'Continue' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Delivery date' | 'Delivery expected in {0} {1}' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Features' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'Incl. VAT' | 'Includes' | 'Industry' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'More than {0} articles' | 'New list name' | 'New user?' | 'of' | 'Or continue as guest' | 'Order number' | 'Order' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Pay by invoice' | 'Pay' | 'Payment method' | 'Payment' | 'Password' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Print' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Requested delivery date' | 'Remember me' | 'Remove all' | 'Requested delivery date' | 'Submitting…' | 'Submit email address' | 'Recover your password' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Search' | 'Searching again using more general terms' | 'See all results' | 'Select a desired delivery date' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Select a list' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'sign in' | 'Signing in…' | 'Sonic address' | 'Sonic Equipment' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'Specifications' | 'Submit' | 'Subtotal' | 'Suggestions' | 'tag.limited' | 'tag.new' | 'The expected delivery is an indication based on the product availability and the shipping location.' | 'The product has been added to your cart.' | 'The product has been removed from your cart.' | 'The product has been updated in your cart.' | 'There are no products in your shopping cart.' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Validating' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You must ' | 'Your cart has been emptied.' | 'Your favorites are available on multiple devices' | 'Your shopping cart is still empty' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!';
1
+ export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | 'Your email and password were not recognized.' | 'Add order notes' | 'Add to list' | 'Address' | 'Amount: {0}' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'Attention' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | 'Cancel' | 'Cart' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Chosen filters' | 'City' | 'Clear filters' | 'Clear' | 'Click the button below to continue shopping.' | 'Close' | 'Company name' | 'Conceal value' | 'Continue shopping' | 'Continue' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Delivery date' | 'Delivery expected in {0} {1}' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Features' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'Incl. VAT' | 'Includes' | 'Industry' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'More than {0} articles' | 'New list name' | 'New user?' | 'of' | 'Or continue as guest' | 'Order number' | 'Order' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Pay by invoice' | 'Pay' | 'Payment method' | 'Payment' | 'Password' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Print' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Requested delivery date' | 'Remember me' | 'Remove all' | 'Requested delivery date' | 'Submitting…' | 'Submit email address' | 'Recover your password' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Search' | 'Searching again using more general terms' | 'See all results' | 'Select a desired delivery date' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Select a list' | 'Select an industry' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'sign in' | 'Signing in…' | 'Sonic address' | 'Sonic Equipment' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'Specifications' | 'Submit' | 'Subtotal' | 'Suggestions' | 'tag.limited' | 'tag.new' | 'The expected delivery is an indication based on the product availability and the shipping location.' | 'The product has been added to your cart.' | 'The product has been removed from your cart.' | 'The product has been updated in your cart.' | 'There are no products in your shopping cart.' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Validating' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You must ' | 'Your cart has been emptied.' | 'Your favorites are available on multiple devices' | 'Your shopping cart is still empty' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!';
@@ -55,6 +55,9 @@ function AdyenPayment({ amount, cartId, countryCode, currencyCode, customerId, d
55
55
  catch (error) {
56
56
  return onError(error, null);
57
57
  }
58
+ finally {
59
+ dropinDivRef.current?.classList.remove(styles.loading);
60
+ }
58
61
  }),
59
62
  onSubmit: (async (state, _component) => {
60
63
  try {
@@ -80,6 +83,9 @@ function AdyenPayment({ amount, cartId, countryCode, currencyCode, customerId, d
80
83
  catch (error) {
81
84
  return onError(error, null);
82
85
  }
86
+ finally {
87
+ dropinDivRef.current?.classList.remove(styles.loading);
88
+ }
83
89
  }),
84
90
  session: {
85
91
  ...adyenSession,
@@ -33,6 +33,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
33
33
  const { sendPurchaseEventFromPaymentPage } = useAlgoliaInsights();
34
34
  const invalidateCurrentCart = useInvalidateCurrentCart();
35
35
  const dropinRef = useRef(null);
36
+ const hasReturnedFromAdyen = useHasReturnedFromAdyen();
36
37
  const [paymentError, setPaymentError] = useState();
37
38
  const [apiError, setAPIError] = useState();
38
39
  const invalidateAdyen = useInvalidateAdyen();
@@ -40,7 +41,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
40
41
  const cartRef = useRef(_cart);
41
42
  const cart = cartRef.current;
42
43
  const hasAtp = atp.length > 1;
43
- const [asSoonAsPossible, setAsSoonAsPossible] = useState(!hasAtp);
44
+ const [asSoonAsPossible, setAsSoonAsPossible] = useState(!hasAtp || (hasReturnedFromAdyen && !cart.requestedDeliveryDate));
44
45
  const [deliveryDate, setDeliveryDate] = useState(cart.requestedDeliveryDateDisplay?.toString() || '');
45
46
  const [selectedPaymentMethod, setSelectedPaymentMethod] = useState(cart.paymentOptions?.paymentMethods?.[0]?.name || 'ADY');
46
47
  if (!isCountryCode(_cart.billTo?.country?.abbreviation))
@@ -54,8 +55,12 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
54
55
  cart.paymentOptions &&
55
56
  cart.billTo?.id &&
56
57
  countryCode;
57
- const hasReturnedFromAdyen = useHasReturnedFromAdyen();
58
- const isDisabled = hasReturnedFromAdyen || isProcessing;
58
+ const isDisabled = isProcessing;
59
+ useEffect(() => {
60
+ if (!hasReturnedFromAdyen)
61
+ return;
62
+ onProcessing(true);
63
+ }, [hasReturnedFromAdyen, onProcessing]);
59
64
  useEffect(() => {
60
65
  cartRef.current = _cart;
61
66
  }, [_cart]);
@@ -182,6 +187,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
182
187
  industry: formData.get('industry')?.toString() || '',
183
188
  };
184
189
  cart.requestedDeliveryDate = formData.get('deliveryDate')?.toString();
190
+ cart.requestedDeliveryDateDisplay = undefined;
185
191
  if (cart.customerVatNumber &&
186
192
  lastVATNumber.current !== cart.customerVatNumber &&
187
193
  !(await validateVAT(cart.customerVatNumber)))
@@ -285,16 +291,16 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
285
291
  }
286
292
  }, [onPaymentComplete, onPlaceOrderCompleted, onProcessing, placeOrder]);
287
293
  const onError = useCallback((error, result) => {
294
+ onProcessing(false);
288
295
  invalidateAdyen();
289
- // invalidateCurrentCart()
290
296
  setPaymentError(error);
291
297
  logger.error(error);
292
298
  _onError?.(error, result);
293
- }, [_onError, invalidateAdyen]);
299
+ }, [_onError, invalidateAdyen, onProcessing]);
294
300
  return (jsxs(Form, { className: styles['payment-form'], "data-test-selector": "paymentForm", id: form, onSubmit: e => {
295
301
  e.preventDefault();
296
302
  onSubmit(e);
297
- }, validationErrors: validationErrors, children: [Boolean(apiError) && (jsx("div", { className: styles['error-message'], children: jsx(FormattedMessage, { id: "An unexpected error occured" }) })), hasAtp && (jsxs("div", { className: styles['delivery-date'], children: [jsx(Select, { showLabel: true, "data-test-selector": "deliveryDateSelect", isDisabled: isDisabled || asSoonAsPossible, isRequired: !asSoonAsPossible, label: t('Select a desired delivery date'), name: "deliveryDate", onChange: setDeliveryDate, options: atpSelectOptions, selectedOption: deliveryDate, variant: "solid" }, String(asSoonAsPossible)), jsxs("div", { className: styles['asap-checkbox'], children: [jsx(Checkbox, { "data-test-selector": "asapCheckbox", isDisabled: isDisabled, isSelected: asSoonAsPossible, onChange: checked => {
303
+ }, validationErrors: validationErrors, children: [Boolean(apiError) && (jsx("div", { className: styles['error-message'], children: jsx(FormattedMessage, { id: "An unexpected error occured" }) })), hasAtp && (jsxs("div", { className: styles['delivery-date'], children: [jsx(Select, { showLabel: true, "data-test-selector": "deliveryDateSelect", defaultSelectedOption: deliveryDate, isDisabled: isDisabled || asSoonAsPossible, isRequired: !asSoonAsPossible, label: t('Select a desired delivery date'), name: "deliveryDate", onChange: setDeliveryDate, options: atpSelectOptions, selectedOption: deliveryDate, variant: "solid" }, String(asSoonAsPossible)), jsxs("div", { className: styles['asap-checkbox'], children: [jsx(Checkbox, { "data-test-selector": "asapCheckbox", isDisabled: isDisabled || Boolean(cart.requestedDeliveryDateDisplay), isSelected: asSoonAsPossible, onChange: checked => {
298
304
  setAsSoonAsPossible(checked);
299
305
  if (checked)
300
306
  setDeliveryDate('');
@@ -310,7 +316,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
310
316
  MA: 'Maritime',
311
317
  OT: 'Other',
312
318
  /* eslint-enable sort-keys-fix/sort-keys-fix */
313
- }, variant: "solid" }), jsx(TextField, { showLabel: true, isDisabled: isDisabled, label: t('VAT Number'), name: "customerVatNumber", onBlur: e => validateVAT(e.target.value), onChange: setCustomerVatNumber, validate: () => validationErrors.customerVatNumber ?? true, value: customerVatNumber }, `vat${Boolean(validationErrors.customerVatNumber)}`), jsx(TextField, { showLabel: true, defaultValue: cart.poNumber, isDisabled: isDisabled, isRequired: cart.requiresPoNumber, label: t('PO Number'), name: "poNumber" }), paymentMethodOptions && Object.keys(paymentMethodOptions).length > 1 && (jsx(Select, { "data-test-selector": "paymentMethodSelect", defaultSelectedOption: cart.paymentOptions?.paymentMethods?.[0]?.name || 'ADY', isDisabled: isDisabled, label: t('Payment method'), name: "paymentMethod", onChange: setSelectedPaymentMethod, options: paymentMethodOptions, selectedOption: selectedPaymentMethod, variant: "solid" })), isAdyenPayment && cart.billTo && (jsx(AdyenPayment, { amount: cart.orderGrandTotal, cartId: cart.trackId, countryCode: countryCode, currencyCode: currencyCode, customerId: cart.billTo.id, dropinRef: dropinRef, environment: environment === 'production' ? 'live' : 'test', isDisabled: isDisabled, onComplete: onComplete, onError: onError, orderAmount: cart.orderGrandTotal, returnUrl:
319
+ }, placeholder: t('Select an industry'), variant: "solid" }), jsx(TextField, { showLabel: true, isDisabled: isDisabled, label: t('VAT Number'), name: "customerVatNumber", onBlur: e => validateVAT(e.target.value), onChange: setCustomerVatNumber, validate: () => validationErrors.customerVatNumber ?? true, value: customerVatNumber }, `vat${Boolean(validationErrors.customerVatNumber)}`), jsx(TextField, { showLabel: true, defaultValue: cart.poNumber, isDisabled: isDisabled, isRequired: cart.requiresPoNumber, label: t('PO Number'), name: "poNumber" }), paymentMethodOptions && Object.keys(paymentMethodOptions).length > 1 && (jsx(Select, { "data-test-selector": "paymentMethodSelect", defaultSelectedOption: cart.paymentOptions?.paymentMethods?.[0]?.name || 'ADY', isDisabled: isDisabled, label: t('Payment method'), name: "paymentMethod", onChange: setSelectedPaymentMethod, options: paymentMethodOptions, selectedOption: selectedPaymentMethod, variant: "solid" })), isAdyenPayment && cart.billTo && (jsx(AdyenPayment, { amount: cart.orderGrandTotal, cartId: cart.trackId, countryCode: countryCode, currencyCode: currencyCode, customerId: cart.billTo.id, dropinRef: dropinRef, environment: environment === 'production' ? 'live' : 'test', isDisabled: isDisabled, onComplete: onComplete, onError: onError, orderAmount: cart.orderGrandTotal, returnUrl:
314
320
  /* eslint-disable ssr-friendly/no-dom-globals-in-react-fc */
315
321
  typeof window === 'undefined'
316
322
  ? ''
package/dist/styles.css CHANGED
@@ -718,6 +718,7 @@
718
718
  display: block;
719
719
  width: var(--width);
720
720
  height: var(--width);
721
+ box-sizing: border-box;
721
722
  border: 4px solid transparent;
722
723
  border-radius: var(--width);
723
724
  animation: progress-circle-module-kCf7K 0.6s infinite linear;
@@ -5033,6 +5034,16 @@ button.swiper-pagination-bullet {
5033
5034
  list-style: initial;
5034
5035
  }
5035
5036
 
5037
+ .search-content-module-qQMqH {
5038
+ display: flex;
5039
+ width: 100%;
5040
+ height: 100%;
5041
+ min-height: 200px;
5042
+ box-sizing: border-box;
5043
+ align-items: center;
5044
+ justify-content: center;
5045
+ }
5046
+
5036
5047
  @media (width >= 768px) {
5037
5048
  .search-content-module-ZMwlB {
5038
5049
  padding-left: var(--space-8);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "155.0.0",
3
+ "version": "157.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {