@sonic-equipment/ui 123.0.0 → 125.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 (114) hide show
  1. package/dist/address/address.d.ts +9 -0
  2. package/dist/address/address.js +9 -0
  3. package/dist/address/address.module.css.js +3 -0
  4. package/dist/algolia/use-algolia-insights.d.ts +1 -1
  5. package/dist/breadcrumbs/breadcrumb.js +4 -3
  6. package/dist/buttons/add-to-cart-button/add-to-cart-button.js +2 -2
  7. package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.d.ts +1 -1
  8. package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.js +10 -2
  9. package/dist/buttons/button/button.d.ts +3 -1
  10. package/dist/buttons/button/button.js +8 -3
  11. package/dist/buttons/button/button.module.css.js +1 -1
  12. package/dist/checkout/adyen-payment.d.ts +1 -1
  13. package/dist/checkout/payment-details.d.ts +1 -1
  14. package/dist/checkout/payment.d.ts +1 -1
  15. package/dist/checkout/payment.js +1 -1
  16. package/dist/country-selector/country-select/country-select.d.ts +20 -0
  17. package/dist/country-selector/country-select/country-select.js +17 -0
  18. package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +2 -8
  19. package/dist/exports.d.ts +14 -2
  20. package/dist/forms/number-field/number-field.d.ts +2 -1
  21. package/dist/forms/number-field/number-field.js +3 -3
  22. package/dist/forms/select/select.d.ts +4 -1
  23. package/dist/forms/select/select.js +6 -3
  24. package/dist/forms/text-field/text-field.d.ts +2 -1
  25. package/dist/forms/text-field/text-field.js +2 -2
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +18 -6
  28. package/dist/intl/formatted-message.d.ts +1 -2
  29. package/dist/intl/missing-translation-provider.d.ts +6 -0
  30. package/dist/intl/missing-translation-provider.js +30 -0
  31. package/dist/intl/translation-id.d.ts +1 -1
  32. package/dist/loading/progress-circle.d.ts +3 -1
  33. package/dist/loading/progress-circle.js +3 -3
  34. package/dist/loading/progress-circle.module.css.js +1 -1
  35. package/dist/modals/signin/sign-in-dialog.js +1 -1
  36. package/dist/pages/layouts/checkout-page-layout/checkout-page-layout.d.ts +1 -1
  37. package/dist/pages/product-details-page/product-details.js +7 -0
  38. package/dist/pages/shipping-page/components/edit-address.d.ts +24 -0
  39. package/dist/pages/shipping-page/components/edit-address.js +54 -0
  40. package/dist/pages/shipping-page/components/edit-address.module.css.js +3 -0
  41. package/dist/pages/shipping-page/components/readonly-address.d.ts +10 -0
  42. package/dist/pages/shipping-page/components/readonly-address.js +25 -0
  43. package/dist/pages/shipping-page/components/readonly-address.module.css.js +3 -0
  44. package/dist/pages/shipping-page/shipping-page.d.ts +1 -0
  45. package/dist/pages/shipping-page/shipping-page.js +75 -0
  46. package/dist/pages/shipping-page/shipping-page.module.css.js +3 -0
  47. package/dist/shared/api/bff/model/bff.model.d.ts +1 -0
  48. package/dist/shared/api/shared/hooks/use-awaitable-mutation.d.ts +13 -0
  49. package/dist/shared/api/shared/hooks/use-awaitable-mutation.js +32 -0
  50. package/dist/shared/api/storefront/hooks/authentication/use-create-guest-account.d.ts +1 -1
  51. package/dist/shared/api/storefront/hooks/authentication/use-fetch-session.d.ts +1 -1
  52. package/dist/shared/api/storefront/hooks/authentication/use-patch-session.d.ts +1 -1
  53. package/dist/shared/api/storefront/hooks/cart/use-add-product-to-current-cart.d.ts +1 -1
  54. package/dist/shared/api/storefront/hooks/cart/use-delete-current-cart.d.ts +1 -1
  55. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-checkout-atp.d.ts +1 -1
  56. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines-with-atp.d.ts +15 -15
  57. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines.d.ts +1 -1
  58. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-product-atp.d.ts +1 -1
  59. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-promotions.d.ts +1 -1
  60. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.d.ts +1 -1
  61. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart.d.ts +1 -1
  62. package/dist/shared/api/storefront/hooks/cart/use-patch-cart-line-by-id.d.ts +6 -0
  63. package/dist/shared/api/storefront/hooks/cart/{use-update-cart-line-by-id.js → use-patch-cart-line-by-id.js} +4 -4
  64. package/dist/shared/api/storefront/hooks/cart/use-patch-cart.d.ts +10 -3
  65. package/dist/shared/api/storefront/hooks/cart/use-patch-cart.js +10 -7
  66. package/dist/shared/api/storefront/hooks/cart/use-place-order.d.ts +1 -1
  67. package/dist/shared/api/storefront/hooks/cart/use-save-cart-for-later.d.ts +1 -1
  68. package/dist/shared/api/storefront/hooks/customer/use-fetch-bill-to-addresses.d.ts +1 -1
  69. package/dist/shared/api/storefront/hooks/customer/use-fetch-ship-to-addresses.d.ts +1 -1
  70. package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.d.ts +6 -0
  71. package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.js +15 -0
  72. package/dist/shared/api/storefront/hooks/payment/use-create-adyen-session.d.ts +1 -1
  73. package/dist/shared/api/storefront/hooks/payment/use-fetch-adyen-config.d.ts +1 -1
  74. package/dist/shared/api/storefront/hooks/translation/use-fetch-translations.js +1 -1
  75. package/dist/shared/api/storefront/hooks/website/use-fetch-countries-languages.d.ts +2 -2
  76. package/dist/shared/api/storefront/hooks/website/use-fetch-countries.d.ts +3 -1
  77. package/dist/shared/api/storefront/hooks/website/use-fetch-countries.js +2 -1
  78. package/dist/shared/api/storefront/hooks/website/use-fetch-settings.d.ts +1 -1
  79. package/dist/shared/api/storefront/hooks/website/use-update-locale.d.ts +1 -1
  80. package/dist/shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items.d.ts +1 -1
  81. package/dist/shared/api/storefront/hooks/wishlist/use-fetch-wishlists.d.ts +1 -1
  82. package/dist/shared/api/storefront/services/authentication-service.d.ts +1 -1
  83. package/dist/shared/api/storefront/services/cart-service.d.ts +2 -2
  84. package/dist/shared/api/storefront/services/cart-service.js +2 -2
  85. package/dist/shared/api/storefront/services/customer-service.d.ts +2 -2
  86. package/dist/shared/api/storefront/services/customer-service.js +2 -2
  87. package/dist/shared/api/storefront/services/payment-service.d.ts +1 -1
  88. package/dist/shared/api/storefront/services/website-service.d.ts +1 -1
  89. package/dist/shared/api/storefront/services/wishlist-service.d.ts +1 -1
  90. package/dist/shared/feature-flags/use-feature-flags.d.ts +3 -0
  91. package/dist/shared/feature-flags/use-feature-flags.js +3 -0
  92. package/dist/shared/ga/data-layer.d.ts +2 -0
  93. package/dist/shared/ga/data-layer.js +13 -0
  94. package/dist/shared/ga/google-analytics-provider.d.ts +8 -0
  95. package/dist/shared/ga/google-analytics-provider.js +16 -0
  96. package/dist/shared/ga/types.d.ts +34 -0
  97. package/dist/shared/ga/types.js +8 -0
  98. package/dist/shared/ga/use-data-layer.d.ts +50 -0
  99. package/dist/shared/ga/use-data-layer.js +89 -0
  100. package/dist/shared/model/currency.d.ts +1 -0
  101. package/dist/shared/model/currency.js +1 -0
  102. package/dist/shared/providers/cart-provider.d.ts +1 -1
  103. package/dist/shared/providers/favorite-provider.d.ts +1 -1
  104. package/dist/shared/utils/string.d.ts +1 -0
  105. package/dist/shared/utils/string.js +5 -0
  106. package/dist/styles.css +328 -121
  107. package/dist/tooltip/tooltip.js +1 -1
  108. package/dist/tooltip/tooltip.module.css.js +1 -1
  109. package/package.json +1 -1
  110. package/dist/shared/api/storefront/hooks/cart/use-update-cart-line-by-id.d.ts +0 -6
  111. package/dist/shared/api/storefront/hooks/customer/use-update-bill-to-address.d.ts +0 -6
  112. package/dist/shared/api/storefront/hooks/customer/use-update-bill-to-address.js +0 -17
  113. /package/dist/shared/api/storefront/model/{shop.model.d.ts → storefront.model.d.ts} +0 -0
  114. /package/dist/shared/api/storefront/model/{shop.model.js → storefront.model.js} +0 -0
@@ -0,0 +1,9 @@
1
+ export interface AddressProps {
2
+ city?: string;
3
+ companyName?: string;
4
+ country?: string;
5
+ email?: string;
6
+ phone?: string;
7
+ postalCode?: string;
8
+ }
9
+ export declare function Address({ city, companyName, country, email, phone, postalCode, }: AddressProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { capitalizeFirstLetter } from '../shared/utils/string.js';
3
+ import styles from './address.module.css.js';
4
+
5
+ function Address({ city, companyName, country, email, phone, postalCode, }) {
6
+ return (jsxs("address", { className: styles.address, children: [companyName && jsx("p", { children: companyName }), (postalCode || city) && (jsxs("p", { children: [postalCode, " ", city ? capitalizeFirstLetter(city) : ''] })), country && jsx("p", { children: country }), phone && jsx("p", { children: phone }), email && jsx("p", { children: email })] }));
7
+ }
8
+
9
+ export { Address };
@@ -0,0 +1,3 @@
1
+ var styles = {"address":"address-module-vt62a"};
2
+
3
+ export { styles as default };
@@ -1,4 +1,4 @@
1
- import { CartLineModel } from '../shared/api/storefront/model/shop.model';
1
+ import { CartLineModel } from '../shared/api/storefront/model/storefront.model';
2
2
  import { AlgoliaInsightsProviderGlobalState } from './use-algolia-insights-provider-global-state';
3
3
  export interface UseAlgoliaEventResult {
4
4
  context: Readonly<AlgoliaInsightsProviderGlobalState>;
@@ -13,17 +13,18 @@ function BreadcrumbShort({ links }) {
13
13
  const previousLink = links.at(-2);
14
14
  const isHomeLink = previousLink === undefined || previousLink === homeLink;
15
15
  const href = previousLink?.href || homeLink?.href;
16
- return (jsx(Breadcrumbs, { className: styles.breadcrumbs, children: jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsxs(RouteLink, { className: styles.link, href: href, isDisabled: false, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: styles.icon }), isHomeLink ? (jsx(SolidHomeIcon, { className: styles.icon })) : (jsx("span", { children: previousLink.label }))] }) }) }));
16
+ const label = previousLink?.label || homeLink?.label;
17
+ return (jsx(Breadcrumbs, { className: styles.breadcrumbs, children: jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsxs(RouteLink, { className: styles.link, href: href, isDisabled: false, title: label, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: styles.icon }), isHomeLink ? (jsx(SolidHomeIcon, { className: styles.icon })) : (jsx("span", { children: previousLink.label }))] }) }) }));
17
18
  }
18
19
  function BreadcrumbLongItem({ index, isDisabled, link, }) {
19
- return (jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsxs(RouteLink, { className: styles.link, color: "secondary", href: link.href, isDisabled: isDisabled, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: clsx(styles['previous-icon'], styles.icon) }), link.label] }) }, index));
20
+ return (jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsxs(RouteLink, { className: styles.link, color: "secondary", href: link.href, isDisabled: isDisabled, title: link.label, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: clsx(styles['previous-icon'], styles.icon) }), link.label] }) }, index));
20
21
  }
21
22
  function BreadcrumbLong({ links }) {
22
23
  const linksWithoutFirst = links.slice(1);
23
24
  const homeLink = links[0];
24
25
  if (!homeLink)
25
26
  return null;
26
- return (jsxs(Breadcrumbs, { className: styles.breadcrumbs, children: [jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsx(RouteLink, { className: styles.link, href: homeLink.href, children: jsx(SolidHomeIcon, { className: clsx(styles['home-icon'], styles.icon) }) }) }), linksWithoutFirst.map((link, index) => (jsx(BreadcrumbLongItem, { index: index, isDisabled: linksWithoutFirst.length - 1 === index, link: link }, index)))] }));
27
+ return (jsxs(Breadcrumbs, { className: styles.breadcrumbs, children: [jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsx(RouteLink, { className: styles.link, href: homeLink.href, title: homeLink.label, children: jsx(SolidHomeIcon, { className: clsx(styles['home-icon'], styles.icon) }) }) }), linksWithoutFirst.map((link, index) => (jsx(BreadcrumbLongItem, { index: index, isDisabled: linksWithoutFirst.length - 1 === index, link: link }, index)))] }));
27
28
  }
28
29
  function Breadcrumb({ links }) {
29
30
  const { lg } = useBreakpoint();
@@ -72,7 +72,7 @@ function SpinnerState({ isDisabled, onChange, onManualInput, quantity, }) {
72
72
  useEffect(() => {
73
73
  setInternalQuantity(quantity);
74
74
  }, [quantity]);
75
- return (jsx(NumberField, { withButtons: true, autoGrow: true, formatOptions: {
75
+ return (jsx(NumberField, { withButtons: true, autoGrow: true, "data-test-selector": "quantity", formatOptions: {
76
76
  maximumFractionDigits: 0,
77
77
  style: 'decimal',
78
78
  useGrouping: false,
@@ -95,7 +95,7 @@ function ManualInputState({ isDisabled, onCancel, onConfirm, quantity, }) {
95
95
  if (e.key === 'Escape')
96
96
  onCancel();
97
97
  };
98
- return (jsxs("div", { className: styles['manual-input-container'], children: [jsx("div", { className: styles['left-button-spacer'] }), jsx(NumberField, { autoFocus: true, autoGrow: true, defaultValue: quantity ? ensureNumber(quantity) : undefined, formatOptions: {
98
+ return (jsxs("div", { className: styles['manual-input-container'], children: [jsx("div", { className: styles['left-button-spacer'] }), jsx(NumberField, { autoFocus: true, autoGrow: true, "data-test-selector": "quantity", defaultValue: quantity ? ensureNumber(quantity) : undefined, formatOptions: {
99
99
  maximumFractionDigits: 0,
100
100
  style: 'decimal',
101
101
  useGrouping: false,
@@ -1,4 +1,4 @@
1
- import { CartLineModel } from '../../shared/api/storefront/model/shop.model';
1
+ import { CartLineModel } from '../../shared/api/storefront/model/storefront.model';
2
2
  export type AddToCartHandler = ({ cartLine, }: {
3
3
  cartLine: CartLineModel;
4
4
  }) => void;
@@ -4,16 +4,18 @@ import { FormattedMessage } from '../../intl/formatted-message.js';
4
4
  import { useAddProductToCurrentCart } from '../../shared/api/storefront/hooks/cart/use-add-product-to-current-cart.js';
5
5
  import { useDeleteCartLineById } from '../../shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.js';
6
6
  import { useFetchCurrentCartLines } from '../../shared/api/storefront/hooks/cart/use-fetch-current-cart-lines.js';
7
- import { useUpdateCartLineById } from '../../shared/api/storefront/hooks/cart/use-update-cart-line-by-id.js';
7
+ import { usePatchCartLineById } from '../../shared/api/storefront/hooks/cart/use-patch-cart-line-by-id.js';
8
+ import { useDataLayer } from '../../shared/ga/use-data-layer.js';
8
9
  import { useCartEvents } from '../../shared/providers/cart-provider.js';
9
10
  import { useToast } from '../../toast/use-toast.js';
10
11
  import { AddToCartButton } from './add-to-cart-button.js';
11
12
 
12
13
  const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
14
+ const { createEcommerceEvent, dataLayer } = useDataLayer();
13
15
  const { isPending: isPendingAddToCart, mutate: addToCart } = useAddProductToCurrentCart();
14
16
  const { data: cartLines, isLoading: isLoadingCartLines } = useFetchCurrentCartLines();
15
17
  const { isPending: isPendingDeleteCartLine, mutate: deleteCartLine } = useDeleteCartLineById();
16
- const { mutate: updateCartLine } = useUpdateCartLineById();
18
+ const { mutate: updateCartLine } = usePatchCartLineById();
17
19
  const { addToast } = useToast();
18
20
  const { onCartLineAdded, onCartLineError, onCartLineRemoved, onCartLineUpdated, } = useCartEvents() || {};
19
21
  const cartLine = cartLines?.find(line => line.productId === productId);
@@ -77,6 +79,12 @@ const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
77
79
  onSuccess: cartLine => {
78
80
  onAddToCart?.({ cartLine });
79
81
  onCartLineAdded?.(cartLine);
82
+ dataLayer.push(createEcommerceEvent({
83
+ cartLine,
84
+ event: {
85
+ event: 'add_to_cart',
86
+ },
87
+ }));
80
88
  addToast({
81
89
  body: (jsx(FormattedMessage, { id: "The product has been added to your cart." })),
82
90
  isUserDismissable: false,
@@ -6,13 +6,15 @@ export interface ButtonProps {
6
6
  color?: 'primary' | 'secondary';
7
7
  condensed?: boolean;
8
8
  'data-test-selector'?: string;
9
+ form?: string;
9
10
  icon?: React.ReactNode;
10
11
  iconPosition?: 'left' | 'right';
11
12
  isDisabled?: boolean;
13
+ isLoading?: string | ReactNode | boolean;
12
14
  onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
13
15
  size?: 'sm' | 'md' | 'lg';
14
16
  type?: 'button' | 'submit' | 'reset';
15
17
  variant?: 'solid' | 'outline' | 'ghost';
16
18
  withArrow?: boolean;
17
19
  }
18
- export declare function Button({ _pseudo, children, className, color, condensed, 'data-test-selector': dataTestSelector, icon, iconPosition, isDisabled, onClick: _onClick, size, type, variant, withArrow, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function Button({ _pseudo, children, className, color, condensed, 'data-test-selector': dataTestSelector, form, icon, iconPosition, isDisabled, isLoading, onClick: _onClick, size, type, variant, withArrow, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,12 @@
1
1
  "use client";
2
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { isValidElement } from 'react';
3
4
  import clsx from 'clsx';
5
+ import { ProgressCircle } from '../../loading/progress-circle.js';
4
6
  import { GlyphsArrowBoldCapsRightIcon } from '../../icons/glyph/glyphs-arrow-boldcaps-right-icon.js';
5
7
  import buttonStyles from './button.module.css.js';
6
8
 
7
- function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, icon, iconPosition = 'left', isDisabled, onClick: _onClick, size = 'lg', type = 'button', variant = 'solid', withArrow = false, }) {
9
+ function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, form, icon, iconPosition = 'left', isDisabled, isLoading = false, onClick: _onClick, size = 'lg', type = 'button', variant = 'solid', withArrow = false, }) {
8
10
  const showIconOnLeft = icon && iconPosition === 'left';
9
11
  const showIconOnRight = icon && iconPosition === 'right';
10
12
  const onClick = (e) => {
@@ -15,7 +17,10 @@ function Button({ _pseudo = 'none', children, className, color = 'primary', cond
15
17
  return;
16
18
  e.preventDefault();
17
19
  };
18
- return (jsxs("button", { className: clsx({ [buttonStyles.condensed]: condensed }, { [buttonStyles.icon]: icon }, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], buttonStyles[_pseudo], className), "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, onClick: onClick, type: type, children: [jsx(Fragment, { children: showIconOnLeft && jsx("span", { className: buttonStyles.icon, children: icon }) }), children, withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), showIconOnRight && jsx("span", { className: buttonStyles.icon, children: icon })] }));
20
+ return (jsx("button", { className: clsx({ [buttonStyles.condensed]: condensed }, { [buttonStyles.icon]: icon }, { [buttonStyles['loading-uninformative']]: isLoading === true }, {
21
+ [buttonStyles['loading-informative']]: isLoading &&
22
+ (typeof isLoading === 'string' || isValidElement(isLoading)),
23
+ }, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], buttonStyles[_pseudo], className), "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, form: form, onClick: onClick, type: type, children: jsxs(Fragment, { children: [showIconOnLeft && jsx("span", { className: buttonStyles.icon, children: icon }), jsx("span", { className: buttonStyles.children, children: isLoading ? (isLoading === true ? children : isLoading) : children }), withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), showIconOnRight && jsx("span", { className: buttonStyles.icon, children: icon }), isLoading && (jsx(ProgressCircle, { className: buttonStyles.spinner, size: "sm", variant: color === 'primary' ? 'white' : 'gray' }))] }) }));
19
24
  }
20
25
 
21
26
  export { Button };
@@ -1,3 +1,3 @@
1
- var buttonStyles = {"button":"button-module-V4meK","icon":"button-module-XaNWz","sm":"button-module-Pbwz7","md":"button-module-GVTEW","condensed":"button-module-GKHQc","lg":"button-module-nyNY8","primary":"button-module-tmyk8","outline":"button-module-vq9GI","solid":"button-module-AjvlY","hover":"button-module-YzPAr","focus":"button-module--xzsY","active":"button-module-XMFzj","ghost":"button-module-f4UVe","right-arrow-icon":"button-module-ydQAo","secondary":"button-module--1bCH"};
1
+ var buttonStyles = {"button":"button-module-V4meK","icon":"button-module-XaNWz","loading-uninformative":"button-module-LwuW2","loading-informative":"button-module-U5IxM","spinner":"button-module-13ndF","children":"button-module-vqRq-","right-arrow-icon":"button-module-ydQAo","primary":"button-module-tmyk8","secondary":"button-module--1bCH","sm":"button-module-Pbwz7","md":"button-module-GVTEW","condensed":"button-module-GKHQc","lg":"button-module-nyNY8","outline":"button-module-vq9GI","solid":"button-module-AjvlY","hover":"button-module-YzPAr","focus":"button-module--xzsY","active":"button-module-XMFzj","ghost":"button-module-f4UVe"};
2
2
 
3
3
  export { buttonStyles as default };
@@ -1,6 +1,6 @@
1
1
  import { MutableRefObject } from 'react';
2
2
  import Dropin from '@adyen/adyen-web/dist/types/components/Dropin';
3
- import { AdyenPaymentModel } from 'shared/api/storefront/model/shop.model';
3
+ import { AdyenPaymentModel } from 'shared/api/storefront/model/storefront.model';
4
4
  import '@adyen/adyen-web/dist/adyen.css';
5
5
  interface AdyenPaymentProps {
6
6
  amount: number;
@@ -1,4 +1,4 @@
1
- import { CartModel } from '../shared/api/storefront/model/shop.model';
1
+ import { CartModel } from '../shared/api/storefront/model/storefront.model';
2
2
  export declare function PaymentDetails({ cart, onCartChanged, }: {
3
3
  cart: CartModel;
4
4
  onCartChanged: (cart: CartModel) => void;
@@ -1,4 +1,4 @@
1
- import { AdyenPaymentModel, CartModel } from '../shared/api/storefront/model/shop.model';
1
+ import { AdyenPaymentModel, CartModel } from '../shared/api/storefront/model/storefront.model';
2
2
  export declare function Payment({ cart: _cart, onError, onPaymentComplete, }: {
3
3
  cart: CartModel;
4
4
  onError: (error: unknown, result: AdyenPaymentModel) => void;
@@ -10,7 +10,7 @@ import { AdyenPayment } from './adyen-payment.js';
10
10
  import { PaymentDetails } from './payment-details.js';
11
11
 
12
12
  function Payment({ cart: _cart, onError, onPaymentComplete, }) {
13
- const patchCart = usePatchCart();
13
+ const { mutate: patchCart } = usePatchCart();
14
14
  const placeOrder = usePlaceOrder();
15
15
  const dropinRef = useRef(null);
16
16
  const cartRef = useRef(_cart);
@@ -0,0 +1,20 @@
1
+ import { CountryModel } from '../../shared/api/storefront/model/storefront.model';
2
+ import { Country } from '../../shared/model/countries-languages';
3
+ interface CountrySelectProps<T extends Country | CountryModel> {
4
+ countries: T[];
5
+ 'data-test-selector'?: string;
6
+ isRequired?: boolean;
7
+ name?: string;
8
+ showLabel?: boolean;
9
+ }
10
+ interface CountrySelectPropsWithSelectedCountry<T extends Country | CountryModel> extends CountrySelectProps<T> {
11
+ onCountryChange?: (country: T) => void;
12
+ selectedCountry: T;
13
+ }
14
+ interface CountrySelectPropsWithoutSelectedCountry<T extends Country | CountryModel> extends CountrySelectProps<T> {
15
+ onCountryChange?: (country: T | undefined) => void;
16
+ selectedCountry?: T | undefined;
17
+ }
18
+ export declare function CountrySelect<T extends Country | CountryModel>(props: CountrySelectPropsWithSelectedCountry<T>): JSX.Element;
19
+ export declare function CountrySelect<T extends Country | CountryModel>(props: CountrySelectPropsWithoutSelectedCountry<T>): JSX.Element;
20
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { Select } from '../../forms/select/select.js';
4
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
5
+
6
+ function CountrySelect({ countries, 'data-test-selector': dataTestSelector, isRequired, name, onCountryChange, selectedCountry, showLabel = true, }) {
7
+ const t = useFormattedMessage();
8
+ const countryOptions = useMemo(() => countries.reduce((acc, country) => ({
9
+ ...acc,
10
+ [country.id]: t(`clSelector.${country.abbreviation}`),
11
+ }), {}),
12
+ // eslint-disable-next-line react-hooks/exhaustive-deps
13
+ [countries]);
14
+ return (jsx(Select, { "data-test-selector": dataTestSelector, isRequired: isRequired, label: t('Country'), name: name, onChange: value => onCountryChange?.(countries.find(country => country.id === value)), options: countryOptions, selectedOption: selectedCountry?.id, showLabel: showLabel, showPlaceholder: false, variant: "solid" }));
15
+ }
16
+
17
+ export { CountrySelect };
@@ -6,18 +6,13 @@ import { Select } from '../../forms/select/select.js';
6
6
  import { FormattedMessage } from '../../intl/formatted-message.js';
7
7
  import { useFormattedMessage } from '../../intl/use-formatted-message.js';
8
8
  import { Dialog } from '../../modals/dialog/dialog.js';
9
+ import { CountrySelect } from '../country-select/country-select.js';
9
10
  import styles from './country-selector-dialog.module.css.js';
10
11
 
11
12
  function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange, onSubmit, selectedCountry, selectedLanguage, showCountry = true, }) {
12
13
  const t = useFormattedMessage();
13
14
  const [currentCountry, setCurrentCountry] = useState(selectedCountry);
14
15
  const [currentLanguage, setCurrentLanguage] = useState(selectedLanguage);
15
- const countryOptions = useMemo(() => countries.reduce((acc, country) => ({
16
- ...acc,
17
- [country.id]: t(`clSelector.${country.abbreviation}`),
18
- }), {}),
19
- // eslint-disable-next-line react-hooks/exhaustive-deps
20
- [countries]);
21
16
  const languageOptions = useMemo(() => currentCountry.languages.reduce((acc, language) => ({ ...acc, [language.id]: language.description }), {}), [currentCountry]);
22
17
  useEffect(() => {
23
18
  if (currentCountry.languages.some(language => language.id === currentLanguage.id))
@@ -35,8 +30,7 @@ function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange,
35
30
  onSubmit({ country: currentCountry, language: currentLanguage });
36
31
  e.preventDefault();
37
32
  e.stopPropagation();
38
- }, shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(Select, { "data-test-selector": "clSelector_country", label: t('Country'), onChange: value => setCurrentCountry(countries.find(country => country.id === value) ||
39
- currentCountry), options: countryOptions, selectedOption: currentCountry.id, showPlaceholder: false, variant: "solid" })), jsx(Select, { "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
33
+ }, shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(CountrySelect, { countries: countries, "data-test-selector": "clSelector_country", onCountryChange: setCurrentCountry, selectedCountry: currentCountry })), jsx(Select, { "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
40
34
  }
41
35
 
42
36
  export { CountrySelectorDialog };
package/dist/exports.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './address/address';
1
2
  export * from './algolia/algolia-active-categories';
2
3
  export * from './algolia/algolia-active-filters';
3
4
  export * from './algolia/algolia-categories-filters';
@@ -64,6 +65,7 @@ export * from './collapsables/accordion/accordion-item';
64
65
  export * from './collapsables/show-all/show-all';
65
66
  export * from './config';
66
67
  export * from './country-selector/connected-country-selector';
68
+ export * from './country-selector/country-select/country-select';
67
69
  export * from './country-selector/country-selector-dialog/country-selector-dialog';
68
70
  export * from './country-selector/country-selector-trigger/country-selector-trigger';
69
71
  export * from './country-selector/use-countries-languages';
@@ -110,6 +112,7 @@ export * from './header/cart-icon/connected-cart-icon';
110
112
  export * from './intl/formatted-message';
111
113
  export * from './intl/intl-context';
112
114
  export * from './intl/intl-provider';
115
+ export * from './intl/missing-translation-provider';
113
116
  export * from './intl/translation-id';
114
117
  export * from './intl/types';
115
118
  export * from './intl/use-culture-code';
@@ -160,6 +163,9 @@ export * from './pages/product-listing-page/product-listing-product-overview/pro
160
163
  export * from './pages/search-result-page/search-result-product-overview/search-result-product-overview';
161
164
  export * from './pages/search-result-page/search-results-page';
162
165
  export * from './pages/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel';
166
+ export * from './pages/shipping-page/components/edit-address';
167
+ export * from './pages/shipping-page/components/readonly-address';
168
+ export * from './pages/shipping-page/shipping-page';
163
169
  export * from './promos/promo-banner/promo-banner';
164
170
  export * from './promos/promo-banners/promo-banners';
165
171
  export * from './promos/promo-card/promo-card';
@@ -167,6 +173,7 @@ export * from './shared/api/bff/hooks/use-fetch-announcements';
167
173
  export * from './shared/api/bff/hooks/use-fetch-product-details-page-data';
168
174
  export * from './shared/api/bff/hooks/use-fetch-product-listing-page-data';
169
175
  export * from './shared/api/bff/services/bff-service';
176
+ export * from './shared/api/shared/hooks/use-awaitable-mutation';
170
177
  export * from './shared/api/storefront/hooks/authentication/use-create-guest-account';
171
178
  export * from './shared/api/storefront/hooks/authentication/use-fetch-session';
172
179
  export * from './shared/api/storefront/hooks/authentication/use-invalidate-session';
@@ -187,12 +194,12 @@ export * from './shared/api/storefront/hooks/cart/use-fetch-current-cart-promoti
187
194
  export * from './shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp';
188
195
  export * from './shared/api/storefront/hooks/cart/use-invalidate-current-cart';
189
196
  export * from './shared/api/storefront/hooks/cart/use-patch-cart';
197
+ export * from './shared/api/storefront/hooks/cart/use-patch-cart-line-by-id';
190
198
  export * from './shared/api/storefront/hooks/cart/use-place-order';
191
199
  export * from './shared/api/storefront/hooks/cart/use-save-cart-for-later';
192
- export * from './shared/api/storefront/hooks/cart/use-update-cart-line-by-id';
193
200
  export * from './shared/api/storefront/hooks/customer/use-fetch-bill-to-addresses';
194
201
  export * from './shared/api/storefront/hooks/customer/use-fetch-ship-to-addresses';
195
- export * from './shared/api/storefront/hooks/customer/use-update-bill-to-address';
202
+ export * from './shared/api/storefront/hooks/customer/use-patch-bill-to-address';
196
203
  export * from './shared/api/storefront/hooks/payment/use-create-adyen-session';
197
204
  export * from './shared/api/storefront/hooks/payment/use-fetch-adyen-config';
198
205
  export * from './shared/api/storefront/hooks/payment/use-invalidate-adyen';
@@ -217,6 +224,10 @@ export * from './shared/api/storefront/services/website-service';
217
224
  export * from './shared/api/storefront/services/wishlist-service';
218
225
  export * from './shared/feature-flags/use-feature-flags';
219
226
  export * from './shared/fetch/request';
227
+ export * from './shared/ga/data-layer';
228
+ export * from './shared/ga/google-analytics-provider';
229
+ export * from './shared/ga/types';
230
+ export * from './shared/ga/use-data-layer';
220
231
  export * from './shared/hooks/use-breakpoint';
221
232
  export * from './shared/hooks/use-cookie';
222
233
  export * from './shared/hooks/use-debounced-callback';
@@ -255,6 +266,7 @@ export * from './shared/utils/event-emitter';
255
266
  export * from './shared/utils/merge';
256
267
  export * from './shared/utils/price';
257
268
  export * from './shared/utils/random';
269
+ export * from './shared/utils/string';
258
270
  export * from './shared/utils/time';
259
271
  export * from './shared/utils/uuid';
260
272
  export * from './shared/utils/wait';
@@ -4,6 +4,7 @@ export type NumberFieldSize = 'md' | 'lg';
4
4
  interface NumberFieldProps {
5
5
  autoFocus?: boolean;
6
6
  autoGrow?: boolean;
7
+ 'data-test-selector'?: string;
7
8
  defaultValue?: number;
8
9
  formatOptions?: Intl.NumberFormatOptions;
9
10
  isDisabled?: boolean;
@@ -29,5 +30,5 @@ interface NumberFieldProps {
29
30
  * This component is used to create a number field.
30
31
  * This field can also grow when a user types in text.
31
32
  */
32
- export declare function NumberField({ autoFocus, autoGrow, defaultValue, formatOptions, isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue, name, onChange, onInput, onKeyUp, placeholder, showLabel, size, validate, value, withButtons, }: NumberFieldProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare function NumberField({ autoFocus, autoGrow, 'data-test-selector': dataTestSelector, defaultValue, formatOptions, isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue, name, onChange, onInput, onKeyUp, placeholder, showLabel, size, validate, value, withButtons, }: NumberFieldProps): import("react/jsx-runtime").JSX.Element;
33
34
  export {};
@@ -15,12 +15,12 @@ import styles from './number-field.module.css.js';
15
15
  * This component is used to create a number field.
16
16
  * This field can also grow when a user types in text.
17
17
  */
18
- function NumberField({ autoFocus, autoGrow, defaultValue, formatOptions = { style: 'decimal', useGrouping: false }, isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue, name, onChange, onInput, onKeyUp, placeholder, showLabel = false, size = 'lg', validate, value, withButtons, }) {
18
+ function NumberField({ autoFocus, autoGrow, 'data-test-selector': dataTestSelector, defaultValue, formatOptions = { style: 'decimal', useGrouping: false }, isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue, name, onChange, onInput, onKeyUp, placeholder, showLabel = false, size = 'lg', validate, value, withButtons, }) {
19
19
  const inputRef = useRef(null);
20
- return (jsxs(NumberField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles.field, styles[size]), defaultValue: defaultValue, formatOptions: formatOptions, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxValue: maxValue, minValue: minValue, name: name, onChange: onChange, onInput: onInput, validate: validate, value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), jsxs("div", { className: styles['button-input-container'], children: [withButtons && (jsx(Button, { "data-test-selector": "decrement", isDisabled: isDisabled,
20
+ return (jsxs(NumberField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles.field, styles[size]), "data-test-selector": dataTestSelector, defaultValue: defaultValue, formatOptions: formatOptions, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxValue: maxValue, minValue: minValue, name: name, onChange: onChange, onInput: onInput, validate: validate, value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), jsxs("div", { className: styles['button-input-container'], children: [withButtons && (jsx(Button, { "data-test-selector": "decrement", isDisabled: isDisabled,
21
21
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
22
22
  // @ts-expect-error
23
- onClick: e => e.preventDefault(), onPressStart: e => e.target.focus(), slot: "decrement", children: (value || 0) <= 1 ? jsx(StrokeTrashIcon, {}) : jsx(StrokeCollapseIcon, {}) })), jsx(Input, { ref: inputRef, autoGrow: autoGrow, label: label, maxLength: maxLength, onFocus: e => (e.target.selectionStart = e.target.value.length || 0), onKeyUp: e => onKeyUp?.(e), placeholder: placeholder, size: size }), withButtons && (jsx(Button, { "data-test-selector": "increment", isDisabled: isDisabled,
23
+ onClick: e => e.preventDefault(), onPressStart: e => e.target.focus(), slot: "decrement", children: (value || 0) <= 1 ? jsx(StrokeTrashIcon, {}) : jsx(StrokeCollapseIcon, {}) })), jsx(Input, { ref: inputRef, autoGrow: autoGrow, "data-test-selector": "value", label: label, maxLength: maxLength, onFocus: e => (e.target.selectionStart = e.target.value.length || 0), onKeyUp: e => onKeyUp?.(e), placeholder: placeholder, size: size }), withButtons && (jsx(Button, { "data-test-selector": "increment", isDisabled: isDisabled,
24
24
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
25
25
  // @ts-expect-error
26
26
  onClick: e => e.preventDefault(), onPressStart: e => e.target.focus(), slot: "increment", children: jsx(StrokeExpandIcon, {}) }))] }), jsx(FieldError, {})] }));
@@ -1,7 +1,10 @@
1
1
  export interface SelectProps<T> {
2
2
  'data-test-selector'?: string;
3
+ defaultSelectedOption?: keyof T;
3
4
  isDisabled?: boolean;
5
+ isRequired?: boolean;
4
6
  label: string;
7
+ name?: string;
5
8
  onChange: (value: keyof T) => void;
6
9
  options: T;
7
10
  placeholder?: string;
@@ -11,4 +14,4 @@ export interface SelectProps<T> {
11
14
  size?: 'sm' | 'md';
12
15
  variant?: 'outline' | 'solid';
13
16
  }
14
- export declare function Select<T extends object>({ 'data-test-selector': dataTestSelector, isDisabled, label, onChange, options, placeholder, selectedOption, showLabel, showPlaceholder, size, variant, }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
17
+ export declare function Select<T extends Record<string, string>>({ 'data-test-selector': dataTestSelector, defaultSelectedOption, isDisabled, isRequired, label, name, onChange, options, placeholder, selectedOption, showLabel, showPlaceholder, size, variant, }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -5,10 +5,11 @@ import { Select as Select$1, Button, SelectValue, Popover, ListBox, Section, Hea
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';
8
+ import { FieldError } from '../field-error/field-error.js';
8
9
  import { Label } from '../label/label.js';
9
10
  import styles from './select.module.css.js';
10
11
 
11
- function Select({ 'data-test-selector': dataTestSelector, isDisabled = false, label, onChange, options, placeholder, selectedOption, showLabel = true, showPlaceholder = true, size = 'md', variant = 'outline', }) {
12
+ function Select({ 'data-test-selector': dataTestSelector, defaultSelectedOption, isDisabled = false, isRequired = false, label, name, onChange, options, placeholder, selectedOption, showLabel = true, showPlaceholder = true, size = 'md', variant = 'outline', }) {
12
13
  const selectRef = useRef(null);
13
14
  useEffect(() => {
14
15
  const updateWidth = () => {
@@ -23,9 +24,11 @@ function Select({ 'data-test-selector': dataTestSelector, isDisabled = false, la
23
24
  window.addEventListener('resize', updateWidth);
24
25
  return () => window?.removeEventListener('resize', updateWidth);
25
26
  }, []);
26
- return (jsxs(Select$1, { ref: selectRef, "aria-label": label, className: clsx(styles.select, styles[size], styles[variant]), "data-test-selector": dataTestSelector, isDisabled: isDisabled, onSelectionChange: selected => onChange(selected), placeholder: placeholder || label, selectedKey: String(selectedOption), children: [showLabel && jsx(Label, { children: label }), jsxs(Button, { className: styles.button, children: [jsx(SelectValue, { "data-test-selector": "value" }), jsx(GlyphsChevronsSlimDownIcon, { "aria-hidden": "true", className: styles.chevron })] }), jsx(Popover, { ref: ref =>
27
+ return (jsxs(Select$1, { ref: selectRef, "aria-label": label, className: clsx(styles.select, styles[size], styles[variant]), "data-test-selector": dataTestSelector, defaultSelectedKey: defaultSelectedOption === undefined
28
+ ? undefined
29
+ : 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(GlyphsChevronsSlimDownIcon, { "aria-hidden": "true", className: styles.chevron })] }), jsx(FieldError, {}), jsx(Popover, { ref: ref =>
27
30
  // Workaround for react/react-aria #1513
28
- ref?.addEventListener('touchend', e => e.preventDefault()), className: clsx(styles.popover, styles[variant]), placement: "bottom left", triggerRef: selectRef, 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)))] }) }) })] }));
31
+ 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)))] }) }) })] }));
29
32
  }
30
33
 
31
34
  export { Select };
@@ -20,6 +20,7 @@ interface TextFieldProps {
20
20
  rows?: number;
21
21
  showLabel?: boolean;
22
22
  size?: 'md' | 'lg';
23
+ type?: 'text' | 'email' | 'password';
23
24
  validate?: ValidateFunction<string>;
24
25
  value?: string;
25
26
  }
@@ -28,5 +29,5 @@ interface TextFieldProps {
28
29
  * It can be used as a single line input or as a textarea.
29
30
  * This field can also grow when a user types in text.
30
31
  */
31
- export declare function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel, size, validate, value, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
32
+ export declare function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel, size, type, validate, value, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
32
33
  export {};
@@ -13,10 +13,10 @@ import styles from './text-field.module.css.js';
13
13
  * It can be used as a single line input or as a textarea.
14
14
  * This field can also grow when a user types in text.
15
15
  */
16
- function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', validate, value, }) {
16
+ function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', type = 'text', validate, value, }) {
17
17
  return (jsxs(TextField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles.field, styles[size]), defaultValue: defaultValue, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxLength: maxLength, minLength: minLength, name: name, onChange: value => {
18
18
  onChange?.(value);
19
- }, onInput: onInput, onKeyUp: e => onKeyUp?.(e), validate: validate, value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), isMultiline ? (jsx(TextArea, { autoGrow: autoGrow, label: label, placeholder: placeholder, rows: rows, size: size })) : (jsx(Input, { autoGrow: autoGrow, label: label, placeholder: placeholder, size: size })), jsx(FieldError, {})] }));
19
+ }, onInput: onInput, onKeyUp: e => onKeyUp?.(e), validate: validate, value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), isMultiline ? (jsx(TextArea, { autoGrow: autoGrow, label: label, placeholder: placeholder, rows: rows, size: size })) : (jsx(Input, { autoGrow: autoGrow, label: label, placeholder: placeholder, size: size, type: type })), jsx(FieldError, {}, Math.random())] }));
20
20
  }
21
21
 
22
22
  export { TextField };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import './shared/utils/local-storage';
2
2
  import './tokens/index.css';
3
3
  export * as BffModel from './shared/api/bff/model/bff.model';
4
- export * as ShopModel from './shared/api/storefront/model/shop.model';
4
+ export * as StorefrontModel from './shared/api/storefront/model/storefront.model';
5
5
  export * from './exports';
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import './shared/utils/local-storage.js';
2
2
  import * as bff_model from './shared/api/bff/model/bff.model.js';
3
3
  export { bff_model as BffModel };
4
- import * as shop_model from './shared/api/storefront/model/shop.model.js';
5
- export { shop_model as ShopModel };
4
+ import * as storefront_model from './shared/api/storefront/model/storefront.model.js';
5
+ export { storefront_model as StorefrontModel };
6
+ export { Address } from './address/address.js';
6
7
  export { AlgoliaActiveCategories } from './algolia/algolia-active-categories.js';
7
8
  export { AlgoliaActiveFilters } from './algolia/algolia-active-filters.js';
8
9
  export { AlgoliaCategoriesFilters } from './algolia/algolia-categories-filters.js';
@@ -69,6 +70,7 @@ export { AccordionItem } from './collapsables/accordion/accordion-item.js';
69
70
  export { ShowAll } from './collapsables/show-all/show-all.js';
70
71
  export { config, configPerEnvironment } from './config.js';
71
72
  export { ConnectedCountrySelector } from './country-selector/connected-country-selector.js';
73
+ export { CountrySelect } from './country-selector/country-select/country-select.js';
72
74
  export { CountrySelectorDialog } from './country-selector/country-selector-dialog/country-selector-dialog.js';
73
75
  export { CountrySelectorTrigger } from './country-selector/country-selector-trigger/country-selector-trigger.js';
74
76
  export { useCountriesLanguages } from './country-selector/use-countries-languages.js';
@@ -114,6 +116,7 @@ export { ConnectedCartIcon } from './header/cart-icon/connected-cart-icon.js';
114
116
  export { FormattedMessage } from './intl/formatted-message.js';
115
117
  export { IntlContext } from './intl/intl-context.js';
116
118
  export { IntlProvider } from './intl/intl-provider.js';
119
+ export { MissingTranslationProvider } from './intl/missing-translation-provider.js';
117
120
  export { isCountryCode, isCultureCode, isLanguageCode } from './intl/types.js';
118
121
  export { useCultureCode, useUpdateCultureCode } from './intl/use-culture-code.js';
119
122
  export { useFormattedMessage } from './intl/use-formatted-message.js';
@@ -162,6 +165,9 @@ export { ProductListingProductOverview } from './pages/product-listing-page/prod
162
165
  export { SearchResultProductOverview } from './pages/search-result-page/search-result-product-overview/search-result-product-overview.js';
163
166
  export { SearchResultsPage } from './pages/search-result-page/search-results-page.js';
164
167
  export { SearchResultsPageCategoryCarousel } from './pages/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel.js';
168
+ export { EDIT_ADDRESS_FORM_ID, EditAddresses } from './pages/shipping-page/components/edit-address.js';
169
+ export { ReadOnlyAddresses } from './pages/shipping-page/components/readonly-address.js';
170
+ export { ShippingPage } from './pages/shipping-page/shipping-page.js';
165
171
  export { PromoBanner } from './promos/promo-banner/promo-banner.js';
166
172
  export { PromoBanners } from './promos/promo-banners/promo-banners.js';
167
173
  export { PromoCard } from './promos/promo-card/promo-card.js';
@@ -169,6 +175,7 @@ export { useFetchAnnouncements } from './shared/api/bff/hooks/use-fetch-announce
169
175
  export { useFetchProductDetailsPageData } from './shared/api/bff/hooks/use-fetch-product-details-page-data.js';
170
176
  export { useFetchProductListingPageData } from './shared/api/bff/hooks/use-fetch-product-listing-page-data.js';
171
177
  export { fetchAnnouncements, fetchProductDetailsPageData, fetchProductListingPageData } from './shared/api/bff/services/bff-service.js';
178
+ export { useAwaitableMutation } from './shared/api/shared/hooks/use-awaitable-mutation.js';
172
179
  export { useCreateGuestAccount } from './shared/api/storefront/hooks/authentication/use-create-guest-account.js';
173
180
  export { useFetchSession } from './shared/api/storefront/hooks/authentication/use-fetch-session.js';
174
181
  export { useInvalidateSession } from './shared/api/storefront/hooks/authentication/use-invalidate-session.js';
@@ -189,12 +196,12 @@ export { useFetchCurrentCartPromotions } from './shared/api/storefront/hooks/car
189
196
  export { useFetchCurrentCartWithAtp } from './shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js';
190
197
  export { useInvalidateCurrentCart } from './shared/api/storefront/hooks/cart/use-invalidate-current-cart.js';
191
198
  export { usePatchCart } from './shared/api/storefront/hooks/cart/use-patch-cart.js';
199
+ export { usePatchCartLineById } from './shared/api/storefront/hooks/cart/use-patch-cart-line-by-id.js';
192
200
  export { usePlaceOrder } from './shared/api/storefront/hooks/cart/use-place-order.js';
193
201
  export { useSaveCartForLater } from './shared/api/storefront/hooks/cart/use-save-cart-for-later.js';
194
- export { useUpdateCartLineById } from './shared/api/storefront/hooks/cart/use-update-cart-line-by-id.js';
195
202
  export { useFetchBillToAddresses } from './shared/api/storefront/hooks/customer/use-fetch-bill-to-addresses.js';
196
203
  export { useFetchShipToAddresses } from './shared/api/storefront/hooks/customer/use-fetch-ship-to-addresses.js';
197
- export { useUpdateBillToAddress } from './shared/api/storefront/hooks/customer/use-update-bill-to-address.js';
204
+ export { usePatchBillToAddress } from './shared/api/storefront/hooks/customer/use-patch-bill-to-address.js';
198
205
  export { useCreateAdyenSession } from './shared/api/storefront/hooks/payment/use-create-adyen-session.js';
199
206
  export { useFetchAdyenConfig } from './shared/api/storefront/hooks/payment/use-fetch-adyen-config.js';
200
207
  export { useInvalidateAdyen } from './shared/api/storefront/hooks/payment/use-invalidate-adyen.js';
@@ -211,14 +218,18 @@ export { useDeleteWishListItemFromWishList } from './shared/api/storefront/hooks
211
218
  export { useFetchAllWishListsItems } from './shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items.js';
212
219
  export { useFetchWishLists } from './shared/api/storefront/hooks/wishlist/use-fetch-wishlists.js';
213
220
  export { createGuestAccount, createSession, fetchSession, patchSession, signIn, signOut } from './shared/api/storefront/services/authentication-service.js';
214
- export { addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCart, placeOrder, postAdyenPayment, saveCartForLater, updateCartLineById } from './shared/api/storefront/services/cart-service.js';
215
- export { fetchBillToAddresses, fetchShipToAddresses, updateBillToAddress } from './shared/api/storefront/services/customer-service.js';
221
+ export { addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCart, patchCartLineById, placeOrder, postAdyenPayment, saveCartForLater } from './shared/api/storefront/services/cart-service.js';
222
+ export { fetchBillToAddresses, fetchShipToAddresses, patchBillToAddress } from './shared/api/storefront/services/customer-service.js';
216
223
  export { createAdyenSession, fetchAdyenConfig } from './shared/api/storefront/services/payment-service.js';
217
224
  export { fetchTranslations } from './shared/api/storefront/services/translation-service.js';
218
225
  export { fetchCountries, fetchCountriesLanguages, fetchCountriesWithLanguages, fetchSettings, updateLocale } from './shared/api/storefront/services/website-service.js';
219
226
  export { WishListNameAlreadyExistsError, addWishListItemToWishList, createWishList, deleteWishList, deleteWishListItemFromWishList, getWishList, getWishListItemsByWishListId, getWishLists } from './shared/api/storefront/services/wishlist-service.js';
220
227
  export { useFeatureFlags } from './shared/feature-flags/use-feature-flags.js';
221
228
  export { BadRequestError, ForbiddenRequestError, InternalServerErrorRequestError, NotFoundRequestError, RequestError, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, isRequestError, request } from './shared/fetch/request.js';
229
+ export { dataLayer } from './shared/ga/data-layer.js';
230
+ export { GoogleAnalyticsProvider, useGoogleAnalyticsProvider } from './shared/ga/google-analytics-provider.js';
231
+ export { isGAEvent } from './shared/ga/types.js';
232
+ export { useDataLayer } from './shared/ga/use-data-layer.js';
222
233
  export { useBreakpoint } from './shared/hooks/use-breakpoint.js';
223
234
  export { useCookie } from './shared/hooks/use-cookie.js';
224
235
  export { useDebouncedCallback } from './shared/hooks/use-debounced-callback.js';
@@ -255,6 +266,7 @@ export { EventEmitter } from './shared/utils/event-emitter.js';
255
266
  export { clone, deepMerge, isPlainObject, default as main, merge } from './shared/utils/merge.js';
256
267
  export { currencies, formatPrice, getCurrencyByCountryCode } from './shared/utils/price.js';
257
268
  export { random, randomInt } from './shared/utils/random.js';
269
+ export { capitalizeFirstLetter } from './shared/utils/string.js';
258
270
  export { TIME } from './shared/utils/time.js';
259
271
  export { createUUID } from './shared/utils/uuid.js';
260
272
  export { wait } from './shared/utils/wait.js';
@@ -1,3 +1,2 @@
1
- import { ComponentType } from 'react';
2
1
  import { FormattedMessageProps } from './types';
3
- export declare const FormattedMessage: ComponentType<FormattedMessageProps>;
2
+ export declare const FormattedMessage: ({ fallbackValue, id, optional, replacementValues, }: FormattedMessageProps) => string;