@sonic-equipment/ui 141.0.0 → 143.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.
Files changed (140) hide show
  1. package/dist/address-info-display/address-info-display.d.ts +6 -0
  2. package/dist/{address/address.js → address-info-display/address-info-display.js} +3 -3
  3. package/dist/address-info-display/address-info-display.module.css.js +3 -0
  4. package/dist/algolia/algolia-filter-panel.js +2 -2
  5. package/dist/algolia/algolia-search-provider.js +22 -11
  6. package/dist/background-overlay/background-overlay.js +4 -7
  7. package/dist/badges/badge/badge.js +4 -8
  8. package/dist/base.css +2 -0
  9. package/dist/breadcrumbs/breadcrumb.js +4 -4
  10. package/dist/buttons/add-to-cart-button/add-to-cart-button.js +27 -40
  11. package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.js +19 -2
  12. package/dist/buttons/favorite/connected-favorite-button.js +12 -18
  13. package/dist/buttons/favorite/favorite-button.d.ts +1 -1
  14. package/dist/buttons/icon-button/icon-button.d.ts +4 -2
  15. package/dist/buttons/icon-button/icon-button.js +5 -2
  16. package/dist/buttons/link/link.d.ts +12 -5
  17. package/dist/buttons/link/link.js +10 -4
  18. package/dist/carousel/card-carousel/card-carousel.js +3 -2
  19. package/dist/carousel/carousel-navigation-button.js +1 -1
  20. package/dist/carousel/carousel.js +8 -8
  21. package/dist/carousel/pagination/pagination.d.ts +1 -1
  22. package/dist/carousel/usp-carousel/product-usp-carousel-slide.js +3 -1
  23. package/dist/carousel/usp-carousel/product-usp-carousel.js +1 -1
  24. package/dist/carousel/usp-carousel/usp-carousel.js +3 -1
  25. package/dist/country-select/country-select.d.ts +27 -0
  26. package/dist/{country-selector/country-select → country-select}/country-select.js +7 -4
  27. package/dist/country-select/hooks/use-countries.d.ts +12 -0
  28. package/dist/country-select/hooks/use-countries.js +51 -0
  29. package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +11 -9
  30. package/dist/country-selector/country-selector-trigger/country-selector-trigger.d.ts +1 -1
  31. package/dist/country-selector/use-countries-languages.d.ts +3 -3
  32. package/dist/country-selector/use-countries-languages.js +3 -1
  33. package/dist/exports.d.ts +12 -4
  34. package/dist/filters/active-filters/active-filters.d.ts +1 -1
  35. package/dist/forms/number-field/number-field.js +5 -1
  36. package/dist/forms/select/select.js +3 -2
  37. package/dist/forms/textarea/textarea.js +1 -1
  38. package/dist/global-search/global-search-provider/global-search-provider.js +3 -2
  39. package/dist/global-search/search-highlight/highlight.js +1 -0
  40. package/dist/global-search/search-result-panel/sections/no-search.js +3 -1
  41. package/dist/header/header.d.ts +5 -1
  42. package/dist/header/header.js +5 -2
  43. package/dist/header/link-list/navigation-link-list.d.ts +6 -0
  44. package/dist/header/link-list/navigation-link-list.js +15 -0
  45. package/dist/header/link-list/navigation-link-list.module.css.js +3 -0
  46. package/dist/index.js +15 -7
  47. package/dist/info-icon-tooltip/info-icon-tooltip.d.ts +3 -1
  48. package/dist/info-icon-tooltip/info-icon-tooltip.js +5 -5
  49. package/dist/intl/intl-context.js +2 -1
  50. package/dist/intl/intl-provider.js +7 -6
  51. package/dist/intl/missing-translation-provider.js +6 -5
  52. package/dist/intl/translation-id.d.ts +1 -1
  53. package/dist/lists/feature-list/feature-list.js +3 -1
  54. package/dist/lists/orderline-list/orderline-list.d.ts +1 -1
  55. package/dist/lists/orderline-list/orderline-list.js +6 -1
  56. package/dist/lists/product-overview-grid/product-overview-grid.js +5 -1
  57. package/dist/media/image/image.d.ts +1 -1
  58. package/dist/media/image-lightbox/image-lightbox.js +6 -2
  59. package/dist/media/zoom-image/zoom-image.d.ts +1 -1
  60. package/dist/message/message.d.ts +2 -1
  61. package/dist/message/message.js +2 -2
  62. package/dist/modals/favorite/add-to-favorite-dialog.d.ts +1 -1
  63. package/dist/modals/modal/modal.js +2 -1
  64. package/dist/notifications/announcements/connected-announcement.js +1 -1
  65. package/dist/pages/checkout/components/billing-and-invoice-information.js +2 -2
  66. package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.js +3 -1
  67. package/dist/pages/checkout/payment-page/components/payment.js +1 -2
  68. package/dist/pages/checkout/shipping-page/components/currency-change-dialog.d.ts +6 -0
  69. package/dist/pages/checkout/shipping-page/components/currency-change-dialog.js +13 -0
  70. package/dist/pages/checkout/shipping-page/components/edit-address-form.d.ts +12 -10
  71. package/dist/pages/checkout/shipping-page/components/edit-address-form.js +11 -4
  72. package/dist/pages/checkout/shipping-page/components/edit-address-form.module.css.js +1 -1
  73. package/dist/pages/checkout/shipping-page/components/readonly-address.d.ts +2 -2
  74. package/dist/pages/checkout/shipping-page/components/readonly-address.js +6 -4
  75. package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.d.ts +4 -4
  76. package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.js +8 -4
  77. package/dist/pages/checkout/shipping-page/shipping-page.js +68 -17
  78. package/dist/pages/components/page-container/page-container.js +2 -1
  79. package/dist/pages/error-page/error-page.js +4 -1
  80. package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +3 -1
  81. package/dist/pages/product/product-listing-page/no-results/no-results.js +3 -3
  82. package/dist/pages/product/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.js +1 -1
  83. package/dist/pages/product/product-listing-page/product-listing-page-provider/product-listing-page-provider.js +3 -2
  84. package/dist/pages/product/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel.js +1 -1
  85. package/dist/promos/promo-banners/promo-banners.d.ts +6 -5
  86. package/dist/promos/promo-banners/promo-banners.js +6 -5
  87. package/dist/promos/promo-card/promo-card.d.ts +1 -1
  88. package/dist/shared/api/bff/model/bff.model.d.ts +13 -0
  89. package/dist/shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.d.ts +2 -2
  90. package/dist/shared/api/storefront/hooks/cart/use-delete-current-cart.d.ts +2 -2
  91. package/dist/shared/api/storefront/hooks/cart/use-save-cart-for-later.d.ts +2 -2
  92. package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.d.ts +1 -1
  93. package/dist/shared/api/storefront/hooks/website/use-fetch-countries-with-languages.d.ts +4 -2
  94. package/dist/shared/api/storefront/hooks/website/use-fetch-countries-with-languages.js +3 -2
  95. package/dist/shared/api/storefront/hooks/website/{use-fetch-countries.d.ts → use-fetch-country-models.d.ts} +1 -1
  96. package/dist/shared/api/storefront/hooks/website/use-fetch-country-models.js +16 -0
  97. package/dist/shared/api/storefront/model/storefront.model.d.ts +21 -1
  98. package/dist/shared/api/storefront/services/customer-service.d.ts +3 -3
  99. package/dist/shared/api/storefront/services/customer-service.js +1 -1
  100. package/dist/shared/api/storefront/services/website-service.d.ts +1 -3
  101. package/dist/shared/api/storefront/services/website-service.js +4 -45
  102. package/dist/shared/data/cart.data.d.ts +2 -0
  103. package/dist/shared/data/cart.data.js +650 -0
  104. package/dist/shared/data/countries-languages.data.d.ts +11 -0
  105. package/dist/shared/data/countries-languages.data.js +61 -0
  106. package/dist/shared/hooks/use-breakpoint.js +2 -2
  107. package/dist/shared/hooks/use-cookie.d.ts +1 -0
  108. package/dist/shared/hooks/use-cookie.js +13 -7
  109. package/dist/shared/hooks/use-disclosure.d.ts +3 -3
  110. package/dist/shared/hooks/use-is-breakpoint.js +1 -1
  111. package/dist/shared/hooks/use-is-scrolled-beyond-element.d.ts +1 -0
  112. package/dist/shared/hooks/use-is-scrolled-beyond-element.js +26 -0
  113. package/dist/shared/hooks/use-scroll-to.d.ts +1 -1
  114. package/dist/shared/hooks/use-scroll-to.js +2 -2
  115. package/dist/shared/model/countries-languages.d.ts +3 -1
  116. package/dist/shared/model/countries-languages.js +32 -0
  117. package/dist/shared/model/defaults.d.ts +1 -0
  118. package/dist/shared/model/defaults.js +3 -0
  119. package/dist/shared/model/image.d.ts +1 -1
  120. package/dist/shared/model/link.d.ts +15 -0
  121. package/dist/shared/providers/favorite-provider.d.ts +3 -3
  122. package/dist/shared/providers/global-state-provider.js +2 -1
  123. package/dist/shared/reset.module.css.js +3 -0
  124. package/dist/shared/routing/with-routing.js +1 -0
  125. package/dist/shared/utils/local-storage.d.ts +1 -7
  126. package/dist/shared/utils/local-storage.js +4 -4
  127. package/dist/shared/utils/number.d.ts +1 -0
  128. package/dist/shared/utils/number.js +10 -0
  129. package/dist/sidebar/sidebar-provider.js +4 -1
  130. package/dist/sidebar/use-sidebar.js +4 -3
  131. package/dist/sign-in-form/sign-in-form.js +2 -1
  132. package/dist/styles.css +68 -5
  133. package/dist/tooltip/tooltip.js +6 -3
  134. package/package.json +17 -14
  135. package/dist/address/address.d.ts +0 -6
  136. package/dist/address/address.module.css.js +0 -3
  137. package/dist/country-selector/country-select/country-select.d.ts +0 -27
  138. package/dist/shared/api/storefront/hooks/website/use-fetch-countries.js +0 -15
  139. package/dist/shared/model/countries.d.ts +0 -225
  140. package/dist/shared/model/countries.js +0 -260
@@ -1,15 +1,16 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { useState } from 'react';
3
+ import { useState, useMemo } from 'react';
4
4
  import { IntlContext } from './intl-context.js';
5
5
 
6
6
  function IntlProvider({ children, cultureCode: _cultureCode, formattedMessage, }) {
7
7
  const [cultureCode, updateCultureCode] = useState(_cultureCode);
8
- return (jsx(IntlContext.Provider, { value: {
9
- cultureCode,
10
- formattedMessage,
11
- updateCultureCode,
12
- }, children: children }));
8
+ const value = useMemo(() => ({
9
+ cultureCode,
10
+ formattedMessage,
11
+ updateCultureCode,
12
+ }), [cultureCode, formattedMessage]);
13
+ return jsx(IntlContext.Provider, { value: value, children: children });
13
14
  }
14
15
 
15
16
  export { IntlProvider };
@@ -1,5 +1,5 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
- import { useContext, useCallback } from 'react';
2
+ import { useContext, useCallback, useMemo } from 'react';
3
3
  import { useFetchTranslations } from '../shared/api/storefront/hooks/translation/use-fetch-translations.js';
4
4
  import { useFeatureFlags } from '../shared/feature-flags/use-feature-flags.js';
5
5
  import { IntlContext } from './intl-context.js';
@@ -24,14 +24,15 @@ function MissingTranslationProvider({ children, }) {
24
24
  : `⭐️${message}⭐️`
25
25
  : message;
26
26
  }, [intlProps, missing, showTranslations, translations]);
27
+ const value = useMemo(() => ({
28
+ ...intlProps,
29
+ formattedMessage,
30
+ }), [intlProps, formattedMessage]);
27
31
  if (!missing && !showTranslations)
28
32
  return jsx(Fragment, { children: children });
29
33
  if (missing && (isLoading || !translations))
30
34
  return null;
31
- return (jsx(IntlContext.Provider, { value: {
32
- ...intlProps,
33
- formattedMessage,
34
- }, children: children }));
35
+ return jsx(IntlContext.Provider, { value: value, children: children });
35
36
  }
36
37
 
37
38
  export { MissingTranslationProvider };
@@ -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' | '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 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' | '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.' | '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 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' | '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';
@@ -16,7 +16,9 @@ function FeatureValue({ value }) {
16
16
  return jsx("div", { className: styles.value, children: value });
17
17
  }
18
18
  function FeatureList({ className, features, style }) {
19
- return (jsx("div", { className: clsx(styles['feature-list'], className), children: features.map(({ id, key, value }) => (jsxs("div", { className: styles.row, children: [jsx("div", { className: clsx(styles.column, styles['column-label'], styles[`alignment-${style?.keyAlignment || 'left'}`]), children: key && jsx(FeatureKey, { ...key }) }), jsx("div", { className: clsx(styles.column, styles['column-value'], styles[`alignment-${style?.valueAlignment || 'right'}`]), children: Array.isArray(value) ? (value.map((value, index) => (jsx(FeatureValue, { value: value }, `${id}-${index}`)))) : (jsx(FeatureValue, { value: value })) })] }, id))) }));
19
+ return (jsx("div", { className: clsx(styles['feature-list'], className), children: features.map(({ id, key, value }) => (jsxs("div", { className: styles.row, children: [jsx("div", { className: clsx(styles.column, styles['column-label'], styles[`alignment-${style?.keyAlignment || 'left'}`]), children: key && jsx(FeatureKey, { ...key }) }), jsx("div", { className: clsx(styles.column, styles['column-value'], styles[`alignment-${style?.valueAlignment || 'right'}`]), children: Array.isArray(value) ? (value.map((value, index) => (
20
+ // eslint-disable-next-line @eslint-react/no-array-index-key
21
+ jsx(FeatureValue, { value: value }, `${id}-${index}`)))) : (jsx(FeatureValue, { value: value })) })] }, id))) }));
20
22
  }
21
23
 
22
24
  export { FeatureList };
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  interface OrderLineListProps {
3
3
  children?: ReactNode;
4
- onRemoveAll?: () => void;
4
+ onRemoveAll?: VoidFunction;
5
5
  }
6
6
  export declare function OrderLineList({ children, onRemoveAll }: OrderLineListProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -12,6 +12,7 @@ import styles from './orderline-list.module.css.js';
12
12
  function OrderLineList({ children, onRemoveAll }) {
13
13
  const t = useFormattedMessage();
14
14
  const { close, isOpen, open } = useDisclosure();
15
+ // eslint-disable-next-line @eslint-react/no-children-count
15
16
  const count = React.Children.count(children);
16
17
  const productString = count === 1 ? t('Product') : t('Products');
17
18
  function handleRemoveAll() {
@@ -19,7 +20,11 @@ function OrderLineList({ children, onRemoveAll }) {
19
20
  return;
20
21
  open();
21
22
  }
22
- return (jsxs(Fragment, { children: [jsxs("div", { className: styles['orderline-list'], children: [jsxs("div", { className: styles.header, children: [jsx("p", { className: styles.count, children: `${count} ${productString.toLowerCase()}` }), onRemoveAll && (jsxs(Link, { className: styles['lnk-remove-all'], color: "primary", "data-test-selector": "cartlineHeader_removeAll", onClick: handleRemoveAll, children: [jsx(StrokeTrashIcon, {}), jsx(FormattedMessage, { id: "Remove all" })] }))] }), jsx("div", { className: styles.items, children: Children.map(children, (child, index) => (jsx("div", { className: styles.item, children: child }, index))) })] }), onRemoveAll && (jsx(ConfirmationDialog, { isOpen: isOpen, onCancel: close, onConfirm: onRemoveAll, title: t('Are you sure you want to remove all items from your cart?') }))] }));
23
+ return (jsxs(Fragment, { children: [jsxs("div", { className: styles['orderline-list'], children: [jsxs("div", { className: styles.header, children: [jsx("p", { className: styles.count, children: `${count} ${productString.toLowerCase()}` }), onRemoveAll && (jsxs(Link, { className: styles['lnk-remove-all'], color: "primary", "data-test-selector": "cartlineHeader_removeAll", onClick: handleRemoveAll, children: [jsx(StrokeTrashIcon, {}), jsx(FormattedMessage, { id: "Remove all" })] }))] }), jsx("div", { className: styles.items, children:
24
+ // eslint-disable-next-line @eslint-react/no-children-map
25
+ Children.map(children, (child, index) => (
26
+ // eslint-disable-next-line @eslint-react/no-array-index-key
27
+ jsx("div", { className: styles.item, children: child }, index))) })] }), onRemoveAll && (jsx(ConfirmationDialog, { isOpen: isOpen, onCancel: close, onConfirm: onRemoveAll, title: t('Are you sure you want to remove all items from your cart?') }))] }));
23
28
  }
24
29
 
25
30
  export { OrderLineList };
@@ -4,7 +4,11 @@ import { ProgressCircle } from '../../loading/progress-circle.js';
4
4
  import styles from './product-overview-grid.module.css.js';
5
5
 
6
6
  function ProductOverviewGrid({ children, isLoading, }) {
7
- return (jsxs("div", { className: styles['product-grid'], children: [Children.map(children, (child, index) => (jsx("div", { className: styles['grid-item'], children: child }, index))), isLoading && (jsx("div", { className: styles['loading-panel'], children: jsx(ProgressCircle, { className: styles['progress-circle'] }) }))] }));
7
+ return (jsxs("div", { className: styles['product-grid'], children: [
8
+ // eslint-disable-next-line @eslint-react/no-children-map
9
+ Children.map(children, (child, index) => (
10
+ // eslint-disable-next-line @eslint-react/no-array-index-key
11
+ jsx("div", { className: styles['grid-item'], children: child }, index))), isLoading && (jsx("div", { className: styles['loading-panel'], children: jsx(ProgressCircle, { className: styles['progress-circle'] }) }))] }));
8
12
  }
9
13
 
10
14
  export { ProductOverviewGrid };
@@ -6,7 +6,7 @@ interface ImageProps {
6
6
  height?: number;
7
7
  image: ImageType | ResponsiveImageType | undefined;
8
8
  loading?: 'lazy' | 'eager';
9
- onError?: () => void;
9
+ onError?: VoidFunction;
10
10
  title: string;
11
11
  width?: number;
12
12
  }
@@ -26,10 +26,14 @@ function ImageLightbox({ images, initialSelectedIndex = 0, onZoom, variant = 'sm
26
26
  const scrollPercentage = clientY / height;
27
27
  onZoom?.({ index: currentIndex, scrollPercentage });
28
28
  }
29
- return (jsxs("div", { className: clsx(styles['image-lightbox'], styles[variant]), children: [jsx(Swiper, { watchSlidesProgress: true, className: styles['thumbs-swiper'], direction: variant === 'sm' ? 'horizontal' : 'vertical', modules: [Thumb], onSwiper: swiper => setThumbsSwiper(swiper), slidesPerView: "auto", spaceBetween: 8, children: images.map((image, index) => (jsx(SwiperSlide, { className: styles.slide, children: jsx("div", { className: styles.thumb, children: jsx(Image, { className: styles.image, fit: "contain", height: 80, image: image, title: "Image", width: 80 }) }) }, index))) }), jsxs("div", { className: styles['main-swiper'], children: [jsx(Swiper, { initialSlide: initialSelectedIndex, modules: [Thumb, Navigation], navigation: {
29
+ return (jsxs("div", { className: clsx(styles['image-lightbox'], styles[variant]), children: [jsx(Swiper, { watchSlidesProgress: true, className: styles['thumbs-swiper'], direction: variant === 'sm' ? 'horizontal' : 'vertical', modules: [Thumb], onSwiper: swiper => setThumbsSwiper(swiper), slidesPerView: "auto", spaceBetween: 8, children: images.map((image, index) => (
30
+ // eslint-disable-next-line @eslint-react/no-array-index-key
31
+ jsx(SwiperSlide, { className: styles.slide, children: jsx("div", { className: styles.thumb, children: jsx(Image, { className: styles.image, fit: "contain", height: 80, image: image, title: "Image", width: 80 }) }) }, index))) }), jsxs("div", { className: styles['main-swiper'], children: [jsx(Swiper, { initialSlide: initialSelectedIndex, modules: [Thumb, Navigation], navigation: {
30
32
  nextEl: nextEl.current,
31
33
  prevEl: prevEl.current,
32
- }, onActiveIndexChange: swiper => setCurrentIndex(swiper.activeIndex), onBeforeInit: swiper => (mainSwiperRef.current = swiper), slidesPerView: 1, thumbs: { swiper: thumbsSwiper }, children: images.map((image, index) => (jsx(SwiperSlide, { className: styles.slide, children: jsx("button", { className: styles['active-image'], onClick: handleZoom, type: "button", children: jsx(Image, { className: styles.image, fit: "contain", image: image, title: "Image" }) }) }, index))) }), jsx("div", { className: styles.pagination, children: jsx(CarouselPagination, { contained: true, currentPage: currentIndex + 1, numberOfPages: images.length, onChange: pageNumber => mainSwiperRef.current?.slideTo(pageNumber - 1) }) }), variant === 'lg' && (jsxs(Fragment, { children: [jsx(CarouselNavigationButton, { ref: prevEl, className: clsx(styles['navigation-button'], styles['navigation-button-prev']), direction: "previous" }), jsx(CarouselNavigationButton, { ref: nextEl, className: clsx(styles['navigation-button'], styles['navigation-button-next']), direction: "next" })] }))] })] }));
34
+ }, onActiveIndexChange: swiper => setCurrentIndex(swiper.activeIndex), onBeforeInit: swiper => (mainSwiperRef.current = swiper), slidesPerView: 1, thumbs: { swiper: thumbsSwiper }, children: images.map((image, index) => (
35
+ // eslint-disable-next-line @eslint-react/no-array-index-key
36
+ jsx(SwiperSlide, { className: styles.slide, children: jsx("button", { className: styles['active-image'], onClick: handleZoom, type: "button", children: jsx(Image, { className: styles.image, fit: "contain", image: image, title: "Image" }) }) }, index))) }), jsx("div", { className: styles.pagination, children: jsx(CarouselPagination, { contained: true, currentPage: currentIndex + 1, numberOfPages: images.length, onChange: pageNumber => mainSwiperRef.current?.slideTo(pageNumber - 1) }) }), variant === 'lg' && (jsxs(Fragment, { children: [jsx(CarouselNavigationButton, { ref: prevEl, className: clsx(styles['navigation-button'], styles['navigation-button-prev']), direction: "previous" }), jsx(CarouselNavigationButton, { ref: nextEl, className: clsx(styles['navigation-button'], styles['navigation-button-next']), direction: "next" })] }))] })] }));
33
37
  }
34
38
 
35
39
  export { ImageLightbox };
@@ -3,6 +3,6 @@ import { ImageType } from '../../shared/model/image';
3
3
  export declare function ZoomImage({ currentImage, isZoomed, onClose, scrollFromTopPercentage, }: {
4
4
  currentImage: ImageType | undefined;
5
5
  isZoomed?: boolean;
6
- onClose?: () => void;
6
+ onClose?: VoidFunction;
7
7
  scrollFromTopPercentage?: number;
8
8
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  export interface MessageProps {
3
3
  children?: ReactNode;
4
+ className?: string;
4
5
  type?: 'default' | 'info' | 'danger' | 'success' | 'warning';
5
6
  }
6
- export declare function Message({ children, type }: MessageProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Message({ children, className, type, }: MessageProps): import("react/jsx-runtime").JSX.Element;
@@ -12,8 +12,8 @@ const icons = {
12
12
  success: jsx(SolidOkayIcon, {}),
13
13
  warning: jsx(SolidNoticeIcon, {}),
14
14
  };
15
- function Message({ children, type = 'default' }) {
16
- return (jsxs("div", { className: clsx(styles.message, styles[type]), role: "note", children: [type !== 'default' && (jsx("div", { className: styles.icon, role: "presentation", children: icons[type] })), jsx("div", { className: styles.body, children: children })] }));
15
+ function Message({ children, className, type = 'default', }) {
16
+ return (jsxs("div", { className: clsx(styles.message, styles[type], className), role: "note", children: [type !== 'default' && (jsx("div", { className: styles.icon, role: "presentation", children: icons[type] })), jsx("div", { className: styles.body, children: children })] }));
17
17
  }
18
18
 
19
19
  export { Message };
@@ -1,6 +1,6 @@
1
1
  interface AddToFavoriteDialogProps {
2
2
  isOpen: boolean;
3
- onCancel: () => void;
3
+ onCancel: VoidFunction;
4
4
  onSubmit: (wishListId: string) => void;
5
5
  }
6
6
  export declare function AddToFavoriteDialog({ isOpen, onCancel, onSubmit, }: AddToFavoriteDialogProps): import("react/jsx-runtime").JSX.Element | null;
@@ -4,6 +4,7 @@ import { ModalOverlay, Modal as Modal$1 } from 'react-aria-components';
4
4
  import clsx from 'clsx';
5
5
  import { IconButton } from '../../buttons/icon-button/icon-button.js';
6
6
  import { StrokeCloseboxIcon } from '../../icons/stroke/stroke-closebox-icon.js';
7
+ import resetStyles from '../../shared/reset.module.css.js';
7
8
  import styles from './modal.module.css.js';
8
9
 
9
10
  const getDocument = () => typeof window === 'undefined' ? undefined : window.document;
@@ -26,7 +27,7 @@ function Modal({ children, className, hasCloseButton, isDismissable, isFullScree
26
27
  e.preventDefault();
27
28
  e.stopPropagation();
28
29
  });
29
- }, className: clsx(styles['modal-overlay'], typeof className === 'string' ? className : className?.overlay), isDismissable: isDismissable, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, shouldCloseOnInteractOutside: () => shouldCloseOnInteractOutside, UNSTABLE_portalContainer: document.body, children: jsxs(Modal$1, { className: clsx(styles.modal, {
30
+ }, className: clsx(styles['modal-overlay'], resetStyles.reset, typeof className === 'string' ? className : className?.overlay), isDismissable: isDismissable, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, shouldCloseOnInteractOutside: () => shouldCloseOnInteractOutside, UNSTABLE_portalContainer: document.body, children: jsxs(Modal$1, { className: clsx(styles.modal, {
30
31
  [styles['is-full-screen']]: isFullScreen,
31
32
  }, typeof className === 'string' ? undefined : className?.modal), children: [hasCloseButton && (jsx("div", { className: clsx(styles.close, typeof className === 'string' ? className : className?.close), children: jsx(IconButton, { color: "secondary", isDisabled: !isDismissable, onClick: () => onOpenChange?.(false), children: jsx(StrokeCloseboxIcon, {}) }) })), jsx("div", { className: clsx(styles.content, typeof className === 'string' ? className : className?.content), children: children })] }) }));
32
33
  }
@@ -6,7 +6,7 @@ import { Announcement } from './announcement.js';
6
6
 
7
7
  const now = () => new Date();
8
8
  function ConnectedAnnouncement({ announcement: { endDate, startDate, ...announcement }, onDismiss, }) {
9
- const [isVisible, setIsVisible] = useState((!startDate || startDate <= now()) && (!endDate || endDate > now()));
9
+ const [isVisible, setIsVisible] = useState(() => (!startDate || startDate <= now()) && (!endDate || endDate > now()));
10
10
  const getIsVisible = useCallback(() => isVisible, [isVisible]);
11
11
  useEffect(() => {
12
12
  if (endDate && now() >= endDate)
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Address } from '../../../address/address.js';
2
+ import { AddressInfoDisplay } from '../../../address-info-display/address-info-display.js';
3
3
  import { InfoDisplay } from '../../../display/info-display/info-display.js';
4
4
  import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
5
5
  import styles from './billing-and-invoice-information.module.css.js';
6
6
 
7
7
  function BillingAndInvoiceInformation({ billToAddress, shipToAddress, }) {
8
8
  const t = useFormattedMessage();
9
- return (jsxs("div", { className: styles['billing-and-invoice-information'], children: [jsx("section", { className: styles.section, children: jsx(InfoDisplay, { id: "billing-address", label: t('Billing address'), value: jsx(Address, { address: billToAddress, "data-test-selector": "orderConfirmationBillingInformation" }) }) }), jsx("section", { className: styles.section, children: jsx(InfoDisplay, { id: "shipping-address", label: t('Shipping address'), value: jsx(Address, { address: shipToAddress, "data-test-selector": "orderConfirmationShippingInformation" }) }) })] }));
9
+ return (jsxs("div", { className: styles['billing-and-invoice-information'], children: [jsx("section", { className: styles.section, children: jsx(InfoDisplay, { id: "billing-address", label: t('Billing address'), value: jsx(AddressInfoDisplay, { address: billToAddress, "data-test-selector": "orderConfirmationBillingInformation" }) }) }), jsx("section", { className: styles.section, children: jsx(InfoDisplay, { id: "shipping-address", label: t('Shipping address'), value: jsx(AddressInfoDisplay, { address: shipToAddress, "data-test-selector": "orderConfirmationShippingInformation" }) }) })] }));
10
10
  }
11
11
 
12
12
  export { BillingAndInvoiceInformation };
@@ -3,6 +3,7 @@ import { useRef, useMemo } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { useIntersectionObserver } from '../../../../shared/hooks/use-intersection-observer.js';
5
5
  import { useIsBreakpoint } from '../../../../shared/hooks/use-is-breakpoint.js';
6
+ import { useIsScrolledBeyondElement } from '../../../../shared/hooks/use-is-scrolled-beyond-element.js';
6
7
  import { useWatchCssProperty } from '../../../../shared/hooks/use-watch-css-property.js';
7
8
  import styles from './checkout-page-layout.module.css.js';
8
9
 
@@ -11,6 +12,7 @@ function CheckoutPageLayout({ actions, children, mobileSummary, overview, }) {
11
12
  const topRef = useRef(null);
12
13
  const bottomRef = useRef(null);
13
14
  const headerHeight = useWatchCssProperty('--header-height');
15
+ const isScrolledBeyond = useIsScrolledBeyondElement(bottomRef.current || undefined);
14
16
  const observables = useMemo(() => [
15
17
  {
16
18
  options: {
@@ -24,7 +26,7 @@ function CheckoutPageLayout({ actions, children, mobileSummary, overview, }) {
24
26
  isDisabled: isXXL,
25
27
  observables,
26
28
  });
27
- return (jsxs("div", { className: styles['checkout-page-layout'], children: [!isXXL && (jsxs(Fragment, { children: [mobileSummary, jsx("div", { ref: topRef }), jsxs("div", { className: clsx(styles['top-actions'], styles.actions), children: [actions?.primary, actions?.secondary] }), !isIntersecting && (jsxs("div", { className: clsx(styles['top-actions-sticky'], styles.actions), children: [actions?.primary, actions?.secondary] }))] })), jsxs("div", { className: styles.wrapper, children: [jsx("div", { className: styles.main, children: children }), jsx("div", { className: styles.side, children: jsxs("div", { className: styles['sticky-side'], children: [overview, jsxs("div", { ref: bottomRef, className: styles.actions, children: [actions?.primary, actions?.secondary] })] }) })] })] }));
29
+ return (jsxs("div", { className: styles['checkout-page-layout'], children: [!isXXL && (jsxs(Fragment, { children: [mobileSummary, jsx("div", { ref: topRef }), jsxs("div", { className: clsx(styles['top-actions'], styles.actions), children: [actions?.primary, actions?.secondary] }), !isIntersecting && !isScrolledBeyond && (jsxs("div", { className: clsx(styles['top-actions-sticky'], styles.actions), children: [actions?.primary, actions?.secondary] }))] })), jsxs("div", { className: styles.wrapper, children: [jsx("div", { className: styles.main, children: children }), jsx("div", { className: styles.side, children: jsxs("div", { className: styles['sticky-side'], children: [overview, jsxs("div", { ref: bottomRef, className: styles.actions, children: [actions?.primary, actions?.secondary] })] }) })] })] }));
28
30
  }
29
31
 
30
32
  export { CheckoutPageLayout };
@@ -46,8 +46,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
46
46
  const currencyCode = currencySymbolToISO[cart.currencySymbol];
47
47
  const lastVATNumber = useRef(cart.customerVatNumber);
48
48
  if (!currencyCode)
49
- throw new Error('Currency code not found for cart with currency symbol: ' +
50
- cart.currencySymbol);
49
+ throw new Error(`Currency code not found for cart with currency symbol: ${cart.currencySymbol}`);
51
50
  const isAdyenPayment = selectedPaymentMethod === 'ADY' &&
52
51
  cart.paymentOptions &&
53
52
  cart.billTo?.id &&
@@ -0,0 +1,6 @@
1
+ export interface CurrencyChangeDialogProps {
2
+ isOpen: boolean;
3
+ onOpenChange: (isOpen: boolean) => void;
4
+ onSubmit: () => void;
5
+ }
6
+ export declare function CurrencyChangeDialog({ isOpen, onOpenChange, onSubmit, }: CurrencyChangeDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { FormattedMessage } from '../../../../intl/formatted-message.js';
3
+ import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
4
+ import { Dialog } from '../../../../modals/dialog/dialog.js';
5
+ import { RouteLink } from '../../../../shared/routing/route-link.js';
6
+ import { PATHS } from '../../../paths.js';
7
+
8
+ function CurrencyChangeDialog({ isOpen, onOpenChange, onSubmit, }) {
9
+ const t = useFormattedMessage();
10
+ return (jsx(Dialog, { isOpen: isOpen, onOpenChange: onOpenChange, onSubmit: onSubmit, shouldCloseOnInteractOutside: true, submitLabel: "Continue", title: t('Currency Change'), children: jsxs("p", { children: [jsx(FormattedMessage, { id: "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, " }), jsx(RouteLink, { hasUnderline: true, color: "secondary", href: PATHS.CART, onClick: onSubmit, children: jsx(FormattedMessage, { id: "please go back to your cart." }) }), ' ', jsx(FormattedMessage, { id: "If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country." })] }) }));
11
+ }
12
+
13
+ export { CurrencyChangeDialog };
@@ -1,27 +1,29 @@
1
- import { BillToModel, CountryModel } from '../../../../shared/api/storefront/model/storefront.model';
1
+ import { BillToModel } from '../../../../shared/api/storefront/model/storefront.model';
2
+ import { Country } from '../../../../shared/model/countries-languages';
2
3
  export declare const EDIT_ADDRESS_FORM_ID = "billToForm";
3
- interface Address {
4
+ export interface Address {
4
5
  address1: string;
5
6
  address2: string;
6
7
  address3: string;
7
8
  attention: string;
8
9
  city: string;
9
10
  companyName: string;
10
- country: CountryModel;
11
+ country: Country;
11
12
  email: string;
12
13
  firstName: string;
13
14
  lastName: string;
14
15
  phone: string;
15
16
  postalCode: string;
16
17
  }
17
- export declare function EditAddressesForm({ billTo, countries, isLoading, isPickup, onSubmit, }: {
18
+ export interface EditAddressesFormData {
19
+ address: Address;
20
+ notes: string | undefined;
21
+ }
22
+ export declare function EditAddressesForm({ billTo, countries, currentCountry, isLoading, isPickup, onSubmit, }: {
18
23
  billTo: BillToModel | undefined | null;
19
- countries: CountryModel[];
24
+ countries: Country[];
25
+ currentCountry: Country | undefined;
20
26
  isLoading: boolean;
21
27
  isPickup: boolean;
22
- onSubmit: (event: {
23
- address: Address;
24
- notes: string;
25
- }) => void;
28
+ onSubmit: (event: EditAddressesFormData) => void;
26
29
  }): import("react/jsx-runtime").JSX.Element;
27
- export {};
@@ -1,12 +1,13 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { useState } from 'react';
3
3
  import { Form } from 'react-aria-components';
4
- import { CountrySelect } from '../../../../country-selector/country-select/country-select.js';
4
+ import { CountrySelect } from '../../../../country-select/country-select.js';
5
5
  import { Checkbox } from '../../../../forms/checkbox/checkbox.js';
6
6
  import { TextField } from '../../../../forms/text-field/text-field.js';
7
7
  import { InfoIconTooltip } from '../../../../info-icon-tooltip/info-icon-tooltip.js';
8
8
  import { FormattedMessage } from '../../../../intl/formatted-message.js';
9
9
  import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
10
+ import { Message } from '../../../../message/message.js';
10
11
  import { useFetchCurrentCart } from '../../../../shared/api/storefront/hooks/cart/use-fetch-current-cart.js';
11
12
  import { validatePhone, validateEmail } from '../../../../shared/model/address.js';
12
13
  import { CheckoutPageSection } from '../../layouts/checkout-page-layout/components/checkout-page-section.js';
@@ -15,11 +16,13 @@ import { SonicAddress } from './sonic-address.js';
15
16
  import styles from './edit-address-form.module.css.js';
16
17
 
17
18
  const EDIT_ADDRESS_FORM_ID = 'billToForm';
18
- function EditAddressesForm({ billTo, countries, isLoading, isPickup, onSubmit, }) {
19
+ function EditAddressesForm({ billTo, countries, currentCountry, isLoading, isPickup, onSubmit, }) {
19
20
  const t = useFormattedMessage();
20
21
  const [companyName, setCompanyName] = useState(billTo?.companyName || '');
21
22
  const [lastName, setLastName] = useState(billTo?.lastName || '');
22
23
  const { data: cart } = useFetchCurrentCart();
24
+ const [selectedCountry, setSelectedCountry] = useState(currentCountry);
25
+ const currencyHasChanged = selectedCountry?.currencyCode !== currentCountry?.currencyCode;
23
26
  return (jsxs(Fragment, { children: [jsx(CheckoutPageSection, { title: jsx(FormattedMessage, { id: "Billing address" }), children: jsx(CheckoutPageSectionContent, { children: jsxs(Form, { className: styles.form, "data-test-selector": "billToAddressForm", id: EDIT_ADDRESS_FORM_ID, onSubmit: e => {
24
27
  e.preventDefault();
25
28
  const formData = new FormData(e.currentTarget);
@@ -42,9 +45,13 @@ function EditAddressesForm({ billTo, countries, isLoading, isPickup, onSubmit, }
42
45
  phone: formData.get('phone')?.toString() || '',
43
46
  postalCode: formData.get('postalCode')?.toString() || '',
44
47
  },
45
- notes: formData.get('notes')?.toString() || '',
48
+ notes: cart?.notes === formData.get('notes')
49
+ ? undefined
50
+ : formData.get('notes')?.toString() || '',
46
51
  });
47
- }, children: [jsx(TextField, { defaultValue: billTo?.firstName, isDisabled: isLoading, label: t('First name'), name: "firstName", showLabel: true }), jsx(TextField, { isDisabled: isLoading, isRequired: !companyName, label: t('Last name'), minLength: 3, name: "lastName", onChange: setLastName, showLabel: true, value: lastName }, `lastname-${Boolean(companyName)}`), jsx(TextField, { defaultValue: billTo?.companyName, isDisabled: isLoading, label: t('Company name'), name: "companyName", onChange: setCompanyName, showLabel: true, value: companyName }), jsx(TextField, { defaultValue: billTo?.attention, isDisabled: isLoading, label: t('Attention'), name: "attention", showLabel: true }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: billTo?.address1, isDisabled: isLoading, label: `${t('Address')} 1`, maxLength: 30, minLength: 3, name: "address1", showLabel: true }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: billTo?.address2, isDisabled: isLoading, label: `${t('Address')} 2`, maxLength: 30, minLength: 3, name: "address2", showLabel: true }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: billTo?.address3, isDisabled: isLoading, label: `${t('Address')} 3`, maxLength: 30, minLength: 3, name: "address3", showLabel: true }) }), jsx(TextField, { isRequired: true, defaultValue: billTo?.postalCode, isDisabled: isLoading, label: t('Postal Code'), maxLength: 10, minLength: 4, name: "postalCode", showLabel: true }), jsx(TextField, { isRequired: true, defaultValue: billTo?.city, isDisabled: isLoading, label: t('City'), maxLength: 30, minLength: 3, name: "city", showLabel: true }), jsx("div", { className: styles['span-2'], children: jsx(CountrySelect, { isRequired: true, countries: countries, "data-test-selector": "countrySelect", defaultSelectedCountry: countries.find(country => country.id === billTo?.country?.id), isDisabled: isLoading, name: "countrySelect" }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: billTo?.phone, isDisabled: isLoading, label: t('Phone'), name: "phone", showLabel: true, validate: value => {
52
+ }, children: [jsx(TextField, { defaultValue: billTo?.firstName, isDisabled: isLoading, label: t('First name'), name: "firstName", showLabel: true }), jsx(TextField, { isDisabled: isLoading, isRequired: !companyName, label: t('Last name'), minLength: 3, name: "lastName", onChange: setLastName, showLabel: true, value: lastName }, `lastname-${Boolean(companyName)}`), jsx(TextField, { defaultValue: billTo?.companyName, isDisabled: isLoading, label: t('Company name'), name: "companyName", onChange: setCompanyName, showLabel: true, value: companyName }), jsx(TextField, { defaultValue: billTo?.attention, isDisabled: isLoading, label: t('Attention'), name: "attention", showLabel: true }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: billTo?.address1, isDisabled: isLoading, label: `${t('Address')} 1`, maxLength: 30, minLength: 3, name: "address1", showLabel: true }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: billTo?.address2, isDisabled: isLoading, label: `${t('Address')} 2`, maxLength: 30, minLength: 3, name: "address2", showLabel: true }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: billTo?.address3, isDisabled: isLoading, label: `${t('Address')} 3`, maxLength: 30, minLength: 3, name: "address3", showLabel: true }) }), jsx(TextField, { isRequired: true, defaultValue: billTo?.postalCode, isDisabled: isLoading, label: t('Postal Code'), maxLength: 10, minLength: 4, name: "postalCode", showLabel: true }), jsx(TextField, { isRequired: true, defaultValue: billTo?.city, isDisabled: isLoading, label: t('City'), maxLength: 30, minLength: 3, name: "city", showLabel: true }), jsxs("div", { className: styles['span-2'], children: [jsx(CountrySelect, { isRequired: true, countries: countries, "data-test-selector": "countrySelect", isDisabled: isLoading, name: "countrySelect", onCountryChange: setSelectedCountry, selectedCountry: selectedCountry }), currencyHasChanged && (jsx(Message, { className: styles['currency-warning'], type: "warning", children: jsx(FormattedMessage, { id: "Selecting this country will result in your cart to be converted to the currency {0}", replacementValues: {
53
+ '0': selectedCountry?.currencyCode || t('Unknown'),
54
+ } }) }))] }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: billTo?.phone, isDisabled: isLoading, label: t('Phone'), name: "phone", showLabel: true, validate: value => {
48
55
  if (!value)
49
56
  return value;
50
57
  return (validatePhone(value) ||
@@ -1,3 +1,3 @@
1
- var styles = {"form":"edit-address-form-module-s19Fg","span-2":"edit-address-form-module-O1w3c","use-invoice-checkbox":"edit-address-form-module-2bfdq"};
1
+ var styles = {"form":"edit-address-form-module-s19Fg","span-2":"edit-address-form-module-O1w3c","currency-warning":"edit-address-form-module-lLT5t","use-invoice-checkbox":"edit-address-form-module-2bfdq"};
2
2
 
3
3
  export { styles as default };
@@ -3,9 +3,9 @@ export declare function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes,
3
3
  billTo: BillToModel | undefined | null;
4
4
  isLoading: boolean;
5
5
  isPickup: boolean;
6
- notes: string;
6
+ notes: string | undefined;
7
7
  onSubmit: ({ notes }: {
8
- notes: string;
8
+ notes: string | undefined;
9
9
  }) => void;
10
10
  shipTo: ShipToModel | undefined | null;
11
11
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { Form } from 'react-aria-components';
3
- import { Address } from '../../../../address/address.js';
3
+ import { AddressInfoDisplay } from '../../../../address-info-display/address-info-display.js';
4
4
  import { Checkbox } from '../../../../forms/checkbox/checkbox.js';
5
5
  import { TextField } from '../../../../forms/text-field/text-field.js';
6
6
  import { FormattedMessage } from '../../../../intl/formatted-message.js';
@@ -20,9 +20,11 @@ function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipT
20
20
  e.preventDefault();
21
21
  const formData = new FormData(e.currentTarget);
22
22
  onSubmit({
23
- notes: formData.get('notes')?.toString() || '',
23
+ notes: notes === formData.get('notes')
24
+ ? undefined
25
+ : formData.get('notes')?.toString() || '',
24
26
  });
25
- }, children: [jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: "Billing address" }), children: [jsx(CheckoutPageSectionLink, { children: jsxs(RouteLink, { color: "secondary", href: PATHS.ACCOUNT_ADDRESSES, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit billing address" }), " >"] }) }), jsxs(CheckoutPageSectionContent, { children: [billTo && (jsx(Address, { address: {
27
+ }, children: [jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: "Billing address" }), children: [jsx(CheckoutPageSectionLink, { children: jsxs(RouteLink, { color: "secondary", href: PATHS.ACCOUNT_ADDRESSES, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit billing address" }), " >"] }) }), jsxs(CheckoutPageSectionContent, { children: [billTo && (jsx(AddressInfoDisplay, { address: {
26
28
  address1: billTo.address1,
27
29
  address2: billTo.address2,
28
30
  address3: billTo.address3,
@@ -34,7 +36,7 @@ function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipT
34
36
  lastName: billTo.lastName,
35
37
  phone: billTo.phone,
36
38
  postalCode: billTo.postalCode,
37
- } })), jsx("div", { className: styles.notes, children: jsx(TextField, { defaultValue: notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] })] }), jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: [!isPickup && (jsx(CheckoutPageSectionLink, { children: jsxs(RouteLink, { color: "secondary", href: PATHS.ACCOUNT_ADDRESSES, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit shipping address" }), " >"] }) })), jsx(CheckoutPageSectionContent, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs(Fragment, { children: [jsx(Checkbox, { className: styles['use-invoice-checkbox'], "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), shipTo && (jsx(Address, { address: {
39
+ } })), jsx("div", { className: styles.notes, children: jsx(TextField, { defaultValue: notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] })] }), jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: [!isPickup && (jsx(CheckoutPageSectionLink, { children: jsxs(RouteLink, { color: "secondary", href: PATHS.ACCOUNT_ADDRESSES, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit shipping address" }), " >"] }) })), jsx(CheckoutPageSectionContent, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs(Fragment, { children: [jsx(Checkbox, { className: styles['use-invoice-checkbox'], "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), shipTo && (jsx(AddressInfoDisplay, { address: {
38
40
  address1: shipTo.address1,
39
41
  address2: shipTo.address2,
40
42
  address3: shipTo.address3,
@@ -1,16 +1,16 @@
1
- import { BillToModel, CartModel, SessionModel } from '../../../../shared/api/storefront/model/storefront.model';
1
+ import { BillToModel, CartModel, PatchBillToModel, PatchCartModel, SessionModel } from '../../../../shared/api/storefront/model/storefront.model';
2
2
  export declare function usePatchShippingDetails(): {
3
3
  error: unknown;
4
4
  isError: boolean;
5
5
  isLoading: boolean;
6
6
  isSuccess: boolean;
7
7
  mutate: (args_0: {
8
- billTo?: BillToModel;
9
- cart: CartModel;
8
+ billTo?: PatchBillToModel;
9
+ cart: PatchCartModel;
10
10
  notes: string | undefined;
11
11
  }) => Promise<{
12
12
  patchedBillTo: BillToModel | undefined;
13
- patchedCart: CartModel;
13
+ patchedCart: CartModel | undefined;
14
14
  patchedSession: SessionModel | undefined;
15
15
  }>;
16
16
  };
@@ -18,9 +18,11 @@ function usePatchShippingDetails() {
18
18
  },
19
19
  })
20
20
  : undefined;
21
- const patchedCart = await patchCart({
22
- cart: { ...cart, billTo: patchedBillTo, notes },
23
- });
21
+ const patchedCart = patchedBillTo || notes !== undefined
22
+ ? await patchCart({
23
+ cart: { ...cart, billTo: patchedBillTo, notes },
24
+ })
25
+ : undefined;
24
26
  return { patchedBillTo, patchedCart, patchedSession };
25
27
  },
26
28
  onSuccess: ({ data: { patchedBillTo, patchedCart, patchedSession }, queryClient, }) => {
@@ -32,7 +34,9 @@ function usePatchShippingDetails() {
32
34
  else if (patchedBillTo) {
33
35
  queryClient.removeQueries({ queryKey: ['session'] });
34
36
  }
35
- queryClient.setQueryData(['carts', patchedCart.id], patchedCart);
37
+ if (patchedCart) {
38
+ queryClient.setQueryData(['carts', patchedCart.id], patchedCart);
39
+ }
36
40
  },
37
41
  });
38
42
  }