@sonic-equipment/ui 147.0.0 → 148.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.
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { useHits } from 'react-instantsearch';
3
3
  import { useFormattedMessage } from '../intl/use-formatted-message.js';
4
+ import { MAX_QUERY_RESULTS } from './constants/index.js';
4
5
 
5
6
  function AlgoliaResultsCount() {
6
7
  const { results } = useHits();
@@ -8,6 +9,13 @@ function AlgoliaResultsCount() {
8
9
  if (!results)
9
10
  return null;
10
11
  const count = results.nbHits;
12
+ if (count > MAX_QUERY_RESULTS) {
13
+ return t('More than {0} articles', {
14
+ replacementValues: {
15
+ '0': MAX_QUERY_RESULTS.toString(),
16
+ },
17
+ });
18
+ }
11
19
  return `${count} ${count === 1 ? t('article') : t('articles')}`;
12
20
  }
13
21
 
@@ -0,0 +1 @@
1
+ export declare const MAX_QUERY_RESULTS = 1000;
@@ -0,0 +1,3 @@
1
+ const MAX_QUERY_RESULTS = 1000;
2
+
3
+ export { MAX_QUERY_RESULTS };
@@ -15,9 +15,9 @@ function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, onC
15
15
  const isCountryLanguageSelected = useMemo(() => selectedCountry !== undefined && selectedLanguage !== undefined, [selectedCountry, selectedLanguage]);
16
16
  const isDismissable = isCountryLanguageSelected;
17
17
  useEffect(() => {
18
- setIsOpen(!isCountryLanguageSelected);
18
+ setIsOpen(!isFetching && !isCountryLanguageSelected);
19
19
  // eslint-disable-next-line react-hooks/exhaustive-deps
20
- }, [isCountryLanguageSelected]);
20
+ }, [isFetching, isCountryLanguageSelected]);
21
21
  if (isFetching)
22
22
  return null;
23
23
  return (jsxs(Fragment, { children: [jsx(CountrySelectorTrigger, { onClick: open, selectedCountry: selectedCountry, selectedLanguage: selectedLanguage, showCountry: showCountry }), jsx(CountrySelectorDialog, { countries: countries, isDismissable: isDismissable, isOpen: isOpen, onOpenChange: open => {
package/dist/exports.d.ts CHANGED
@@ -183,6 +183,7 @@ export * from './pages/components/page/page';
183
183
  export * from './pages/error-page/error-page';
184
184
  export * from './pages/loading-page/loading-page';
185
185
  export * from './pages/paths';
186
+ export * from './pages/product/components/product-overview';
186
187
  export * from './pages/product/layouts/product-details-page-layout/product-details-page-layout';
187
188
  export * from './pages/product/product-details-page/components/product-details-images/product-detail-images';
188
189
  export * from './pages/product/product-details-page/components/product-details-panel/product-details-panel';
package/dist/index.js CHANGED
@@ -186,6 +186,7 @@ export { Page } from './pages/components/page/page.js';
186
186
  export { ErrorPage } from './pages/error-page/error-page.js';
187
187
  export { LoadingPage } from './pages/loading-page/loading-page.js';
188
188
  export { PATHS } from './pages/paths.js';
189
+ export { ProductOverview } from './pages/product/components/product-overview.js';
189
190
  export { ProductDetailsPageLayout } from './pages/product/layouts/product-details-page-layout/product-details-page-layout.js';
190
191
  export { ProductDetailImages } from './pages/product/product-details-page/components/product-details-images/product-detail-images.js';
191
192
  export { ProductDetailsPanel } from './pages/product/product-details-page/components/product-details-panel/product-details-panel.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' | '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' | 'pc' | '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';
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' | 'pc' | '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!';
@@ -57,6 +57,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
57
57
  cartRef.current = _cart;
58
58
  }, [_cart]);
59
59
  const [validationErrors, setValidationErrors] = useState({});
60
+ const [customerVatNumber, setCustomerVatNumber] = useState(cart.customerVatNumber);
60
61
  const atpSelectOptions = atp
61
62
  .filter(atp => Boolean(atp.date))
62
63
  .reduce((acc, atp) => ({
@@ -69,13 +70,17 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
69
70
  }, {});
70
71
  const validateVAT = useCallback(async (value) => {
71
72
  if (!value) {
72
- setValidationErrors({});
73
+ setValidationErrors(errors => {
74
+ const result = { ...errors };
75
+ delete result.customerVatNumber;
76
+ return result;
77
+ });
73
78
  return true;
74
79
  }
75
80
  if (value.length < 8) {
76
81
  setValidationErrors({
77
82
  ...validationErrors,
78
- vatNumber: t('validation.tooShort'),
83
+ customerVatNumber: t('validation.tooShort'),
79
84
  });
80
85
  return false;
81
86
  }
@@ -85,30 +90,50 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
85
90
  onValidatingVAT(true);
86
91
  const response = await validateVATNumber({ vatNumber: value });
87
92
  lastVATNumber.current = value;
88
- if (!response.isValid) {
89
- setValidationErrors({
90
- ...validationErrors,
91
- vatNumber: t('validation.invalid'),
93
+ if (response.isValid) {
94
+ setValidationErrors(validationErrors => {
95
+ const result = { ...validationErrors };
96
+ delete result.customerVatNumber;
97
+ return result;
92
98
  });
99
+ return true;
100
+ }
101
+ else {
102
+ setValidationErrors(validationErrors => ({
103
+ ...validationErrors,
104
+ customerVatNumber: t('validation.invalid'),
105
+ }));
93
106
  return false;
94
107
  }
95
- setValidationErrors(prev => {
96
- delete prev.vatNumber;
97
- return prev;
98
- });
99
- return true;
100
108
  }
101
109
  catch {
102
- setValidationErrors({
103
- ...validationErrors,
104
- vatNumber: t('validation.invalid'),
110
+ // When an error occurs, we don't want to show the error message
111
+ // because it might be a temporary issue with the service.
112
+ // The customer can not do anything about it, so we just remove the error message.
113
+ setValidationErrors(validationErrors => {
114
+ const result = { ...validationErrors };
115
+ delete result.customerVatNumber;
116
+ return result;
105
117
  });
106
- return false;
118
+ return true;
107
119
  }
108
120
  finally {
109
121
  onValidatingVAT(false);
110
122
  }
111
123
  }, [onValidatingVAT, t, validationErrors]);
124
+ useEffect(() => {
125
+ /* When a customer has an existing VAT that is
126
+ * not valid (e.g. invalid, undetermined, or failure),
127
+ * then trigger a client side validation. */
128
+ if (!cart.customerVatNumber)
129
+ return;
130
+ if (cart.properties.customerVatNumberStatus === 'valid')
131
+ return;
132
+ onValidatingVAT(true);
133
+ lastVATNumber.current = '';
134
+ validateVAT(cart.customerVatNumber);
135
+ // eslint-disable-next-line react-hooks/exhaustive-deps
136
+ }, []);
112
137
  const onPlaceOrderCompleted = useCallback(({ cart, payment_type }) => {
113
138
  dataLayer.push(createEcommerceEvent({
114
139
  cart,
@@ -147,10 +172,10 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
147
172
  const formData = new FormData(e.currentTarget);
148
173
  const cart = cartRef.current;
149
174
  setValidationErrors(prev => prev); // NOTE: This makes sure the form is revalidated on submit
150
- const vatNumber = formData.get('vatNumber')?.toString();
151
- if (vatNumber &&
152
- lastVATNumber.current !== vatNumber &&
153
- !(await validateVAT(vatNumber)))
175
+ const customerVatNumber = formData.get('customerVatNumber')?.toString();
176
+ if (customerVatNumber &&
177
+ lastVATNumber.current !== customerVatNumber &&
178
+ !(await validateVAT(customerVatNumber)))
154
179
  return;
155
180
  if (Object.keys(validationErrors).length > 0)
156
181
  return;
@@ -169,7 +194,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
169
194
  cartRef.current = await patchCart({
170
195
  cart: {
171
196
  ...cart,
172
- customerVatNumber: formData.get('vatNumber')?.toString(),
197
+ customerVatNumber: formData.get('customerVatNumber')?.toString(),
173
198
  poNumber: formData.get('poNumber')?.toString(),
174
199
  properties: {
175
200
  ...cart.properties,
@@ -179,6 +204,12 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
179
204
  },
180
205
  forceRecalculation: false,
181
206
  });
207
+ if (cartRef.current.properties.customerVatNumberStatus === 'invalid') {
208
+ return setValidationErrors({
209
+ ...validationErrors,
210
+ customerVatNumber: t('validation.invalid'),
211
+ });
212
+ }
182
213
  }
183
214
  catch (error) {
184
215
  setAPIError(error);
@@ -279,9 +310,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
279
310
  MA: 'Maritime',
280
311
  OT: 'Other',
281
312
  /* eslint-enable sort-keys-fix/sort-keys-fix */
282
- }, variant: "solid" }), jsx(TextField, { showLabel: true, defaultValue: cart.customerVatNumber, isDisabled: isDisabled, label: t('VAT Number'), name: "vatNumber", onBlur: e => validateVAT(e.target.value), validate: () => validationErrors.vatNumber ?? true }), 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,
283
- // TODO: Use the correct Adyen environment before going live
284
- environment: environment === 'production' ? 'live' : 'test', isDisabled: isDisabled, onComplete: onComplete, onError: onError, orderAmount: cart.orderGrandTotal, returnUrl:
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:
285
314
  /* eslint-disable ssr-friendly/no-dom-globals-in-react-fc */
286
315
  typeof window === 'undefined'
287
316
  ? ''
@@ -36,12 +36,12 @@ function EditAddressesForm({ billTo, countries, currentCountry, isLoading, isPic
36
36
  address2: formData.get('address2')?.toString() || '',
37
37
  address3: formData.get('address3')?.toString() || '',
38
38
  attention: formData.get('attention')?.toString() || '',
39
- city: formData.get('address1')?.toString() || '',
39
+ city: formData.get('city')?.toString() || '',
40
40
  companyName: formData.get('companyName')?.toString() || '',
41
41
  country,
42
42
  email: formData.get('email')?.toString() || '',
43
43
  firstName: formData.get('firstName')?.toString() || '',
44
- lastName: formData.get('address1')?.toString() || '',
44
+ lastName: formData.get('lastName')?.toString() || '',
45
45
  phone: formData.get('phone')?.toString() || '',
46
46
  postalCode: formData.get('postalCode')?.toString() || '',
47
47
  },
@@ -0,0 +1,8 @@
1
+ import { ProductHit } from '../../../shared/model/hit';
2
+ interface ProductOverviewProps {
3
+ ProductHitCard: React.ComponentType<{
4
+ hit: ProductHit;
5
+ }>;
6
+ }
7
+ export declare function ProductOverview({ ProductHitCard }: ProductOverviewProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { usePagination } from 'react-instantsearch';
4
+ import { MAX_QUERY_RESULTS } from '../../../algolia/constants/index.js';
5
+ import { useAlgoliaHits } from '../../../algolia/use-algolia-hits.js';
6
+ import { FormattedMessage } from '../../../intl/formatted-message.js';
7
+ import { ProductOverviewGrid } from '../../../lists/product-overview-grid/product-overview-grid.js';
8
+ import { Message } from '../../../message/message.js';
9
+ import { PromoCard } from '../../../promos/promo-card/promo-card.js';
10
+ import { isProductHit } from '../../../shared/model/hit.js';
11
+
12
+ function ProductOverview({ ProductHitCard }) {
13
+ const { hits, isLoading } = useAlgoliaHits();
14
+ const { currentRefinement, nbHits, nbPages } = usePagination();
15
+ const currentPage = currentRefinement + 1;
16
+ const isLastPage = currentPage === nbPages;
17
+ return (jsxs(Fragment, { children: [isLastPage && nbHits > MAX_QUERY_RESULTS && (jsx(Message, { type: "info", children: jsx(FormattedMessage, { id: "You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!" }) })), jsx(ProductOverviewGrid, { isLoading: isLoading, children: hits.map(hit => isProductHit(hit) ? (jsx(ProductHitCard, { hit: hit }, hit.id)) : (jsx(PromoCard, { href: hit.href, image: hit.image }, hit.id))) })] }));
18
+ }
19
+
20
+ export { ProductOverview };
@@ -1,11 +1,8 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { useAlgoliaHits } from '../../../../algolia/use-algolia-hits.js';
4
3
  import { useAlgoliaInsights } from '../../../../algolia/use-algolia-insights.js';
5
4
  import { ConnectedProductCard } from '../../../../cards/product-card/connected-product-card.js';
6
- import { ProductOverviewGrid } from '../../../../lists/product-overview-grid/product-overview-grid.js';
7
- import { PromoCard } from '../../../../promos/promo-card/promo-card.js';
8
- import { isProductHit } from '../../../../shared/model/hit.js';
5
+ import { ProductOverview } from '../../components/product-overview.js';
9
6
 
10
7
  function ProductHitCard({ hit }) {
11
8
  const { sendAddToCartFromProductListPageEvent, sendAddToWishListFromProductListPageEvent, sendProductClickFromProductListPageEvent, } = useAlgoliaInsights();
@@ -28,8 +25,7 @@ function ProductHitCard({ hit }) {
28
25
  }, sku: hit.id, tags: hit.labels, title: hit.name }, hit.storefrontId));
29
26
  }
30
27
  function ProductListingProductOverview() {
31
- const { hits, isLoading } = useAlgoliaHits();
32
- return (jsx(ProductOverviewGrid, { isLoading: isLoading, children: hits.map(hit => isProductHit(hit) ? (jsx(ProductHitCard, { hit: hit }, hit.id)) : (jsx(PromoCard, { href: hit.href, image: hit.image }, hit.id))) }));
28
+ return jsx(ProductOverview, { ProductHitCard: ProductHitCard });
33
29
  }
34
30
 
35
31
  export { ProductListingProductOverview };
@@ -1,11 +1,8 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { useAlgoliaHits } from '../../../../algolia/use-algolia-hits.js';
4
3
  import { useAlgoliaInsights } from '../../../../algolia/use-algolia-insights.js';
5
4
  import { ConnectedProductCard } from '../../../../cards/product-card/connected-product-card.js';
6
- import { ProductOverviewGrid } from '../../../../lists/product-overview-grid/product-overview-grid.js';
7
- import { PromoCard } from '../../../../promos/promo-card/promo-card.js';
8
- import { isProductHit } from '../../../../shared/model/hit.js';
5
+ import { ProductOverview } from '../../components/product-overview.js';
9
6
 
10
7
  function ProductHitCard({ hit }) {
11
8
  const { sendAddToCartFromSearchResultPageEvent, sendAddToWishListFromSearchResultPageEvent, sendProductClickFromSearchResultPageEvent, } = useAlgoliaInsights();
@@ -30,8 +27,7 @@ function ProductHitCard({ hit }) {
30
27
  }, sku: hit.id, tags: hit.labels, title: hit.name }, hit.storefrontId));
31
28
  }
32
29
  function SearchResultProductOverview() {
33
- const { hits, isLoading } = useAlgoliaHits();
34
- return (jsx(ProductOverviewGrid, { isLoading: isLoading, children: hits.map(hit => isProductHit(hit) ? (jsx(ProductHitCard, { hit: hit }, hit.id)) : (jsx(PromoCard, { href: hit.href, image: hit.image }, hit.id))) }));
30
+ return jsx(ProductOverview, { ProductHitCard: ProductHitCard });
35
31
  }
36
32
 
37
33
  export { SearchResultProductOverview };
@@ -929,6 +929,10 @@ export interface CartModel extends BaseModel {
929
929
  paymentOptions?: PaymentOptionsDto | null;
930
930
  poNumber: string;
931
931
  promotionCode: string;
932
+ properties: {
933
+ customerVatNumberStatus?: 'valid' | 'invalid' | 'failure';
934
+ industry?: string;
935
+ };
932
936
  quoteRequiredCount: number;
933
937
  requestedDeliveryDate: string;
934
938
  requestedDeliveryDateDisplay: Date | null;
@@ -1,11 +1,11 @@
1
1
  interface ValidateVATNumberResponse {
2
2
  address: string;
3
3
  countryCode: string;
4
+ customerVatNumber: string;
4
5
  isValid: boolean;
5
6
  isViesVerified: boolean;
6
7
  manualCheckRequired: false;
7
8
  name: string;
8
- vatNumber: string;
9
9
  }
10
10
  export declare function validateVATNumber({ vatNumber }: {
11
11
  vatNumber: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "147.0.0",
3
+ "version": "148.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {