@sonic-equipment/ui 133.0.0 → 135.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 (79) hide show
  1. package/dist/address/address.d.ts +5 -2
  2. package/dist/address/address.js +3 -2
  3. package/dist/algolia/{algolia-intialization.js → algolia-initialization.js} +7 -0
  4. package/dist/algolia/algolia-insights-provider.js +7 -0
  5. package/dist/algolia/algolia-search-provider.js +19 -0
  6. package/dist/algolia/use-algolia-insights.d.ts +13 -6
  7. package/dist/algolia/use-algolia-insights.js +93 -10
  8. package/dist/buttons/button/button.d.ts +4 -1
  9. package/dist/buttons/button/button.js +2 -2
  10. package/dist/country-selector/country-select/country-select.d.ts +1 -0
  11. package/dist/country-selector/country-select/country-select.js +2 -2
  12. package/dist/delivery-time/delivery-time.js +1 -1
  13. package/dist/exports.d.ts +10 -2
  14. package/dist/forms/checkbox/checkbox.d.ts +2 -1
  15. package/dist/forms/checkbox/checkbox.js +2 -2
  16. package/dist/forms/field-error/field-error.d.ts +2 -1
  17. package/dist/forms/field-error/field-error.js +3 -2
  18. package/dist/forms/input/input.d.ts +1 -0
  19. package/dist/forms/input/input.js +2 -2
  20. package/dist/forms/label/label.d.ts +3 -1
  21. package/dist/forms/label/label.js +3 -2
  22. package/dist/forms/switch/switch.d.ts +2 -1
  23. package/dist/forms/switch/switch.js +2 -2
  24. package/dist/forms/text-field/text-field.d.ts +3 -1
  25. package/dist/forms/text-field/text-field.js +4 -3
  26. package/dist/forms/text-field/text-field.module.css.js +1 -1
  27. package/dist/forms/textarea/textarea.d.ts +1 -0
  28. package/dist/forms/textarea/textarea.js +3 -2
  29. package/dist/global-search/plugins/categories-plugin.js +2 -1
  30. package/dist/global-search/plugins/popular-categories-plugin.js +2 -0
  31. package/dist/global-search/plugins/query-suggestions-plugin.js +1 -0
  32. package/dist/global-search/plugins/quick-access-plugin.js +2 -2
  33. package/dist/global-search/search-result-panel/sections/with-results.js +0 -1
  34. package/dist/header/hamburger-button/hamburger-button.d.ts +6 -0
  35. package/dist/header/hamburger-button/hamburger-button.js +14 -0
  36. package/dist/header/hamburger-button/hamburger-button.module.css.js +3 -0
  37. package/dist/header/header-layout/header-layout.d.ts +9 -0
  38. package/dist/header/header-layout/header-layout.js +8 -0
  39. package/dist/header/header-layout/header-layout.module.css.js +3 -0
  40. package/dist/header/sonic-logo/sonic-logo.d.ts +5 -0
  41. package/dist/header/sonic-logo/sonic-logo.js +11 -0
  42. package/dist/header/sonic-logo/sonic-logo.module.css.js +3 -0
  43. package/dist/index.js +11 -3
  44. package/dist/info-icon-tooltip/info-icon-tooltip.d.ts +7 -0
  45. package/dist/info-icon-tooltip/info-icon-tooltip.js +20 -0
  46. package/dist/info-icon-tooltip/info-icon-tooltip.module.css.js +3 -0
  47. package/dist/intl/translation-id.d.ts +1 -1
  48. package/dist/pages/checkout/components/billing-and-invoice-information.js +1 -1
  49. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.d.ts +5 -0
  50. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +83 -0
  51. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.js +3 -77
  52. package/dist/pages/checkout/payment-page/components/payment.js +49 -4
  53. package/dist/pages/checkout/payment-page/payment-page-content.d.ts +15 -0
  54. package/dist/pages/checkout/payment-page/payment-page-content.js +43 -0
  55. package/dist/pages/checkout/payment-page/payment-page.js +3 -37
  56. package/dist/pages/checkout/shipping-page/components/edit-address.js +3 -3
  57. package/dist/pages/checkout/shipping-page/components/readonly-address.js +25 -1
  58. package/dist/pages/checkout/shipping-page/shipping-page-content.d.ts +14 -0
  59. package/dist/pages/checkout/shipping-page/shipping-page-content.js +40 -0
  60. package/dist/pages/checkout/shipping-page/shipping-page.js +45 -54
  61. package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +11 -1
  62. package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +0 -1
  63. package/dist/pages/product/search-result-page/search-result-product-overview/search-result-product-overview.js +0 -1
  64. package/dist/shared/fetch/request.d.ts +18 -13
  65. package/dist/shared/fetch/request.js +22 -9
  66. package/dist/shared/ga/use-data-layer.d.ts +7 -3
  67. package/dist/shared/ga/use-data-layer.js +6 -1
  68. package/dist/shared/utils/promise.d.ts +2 -0
  69. package/dist/shared/utils/promise.js +9 -0
  70. package/dist/sign-in-form/sign-in-form.d.ts +19 -0
  71. package/dist/sign-in-form/sign-in-form.js +49 -0
  72. package/dist/sign-in-form/sign-in-form.module.css.js +3 -0
  73. package/dist/styles.css +338 -44
  74. package/dist/tooltip/tooltip.d.ts +3 -2
  75. package/dist/tooltip/tooltip.js +5 -4
  76. package/package.json +1 -1
  77. package/dist/shared/utils/wait.d.ts +0 -1
  78. package/dist/shared/utils/wait.js +0 -5
  79. /package/dist/algolia/{algolia-intialization.d.ts → algolia-initialization.d.ts} +0 -0
@@ -3,6 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useState, useCallback } from 'react';
4
4
  import { TextField as TextField$1 } from 'react-aria-components';
5
5
  import clsx from 'clsx';
6
+ import { InfoIconTooltip } from '../../info-icon-tooltip/info-icon-tooltip.js';
6
7
  import { FieldError } from '../field-error/field-error.js';
7
8
  import { Input } from '../input/input.js';
8
9
  import { Label } from '../label/label.js';
@@ -15,15 +16,15 @@ import styles from './text-field.module.css.js';
15
16
  * It can be used as a single line input or as a textarea.
16
17
  * This field can also grow when a user types in text.
17
18
  */
18
- function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', type: defaultType = 'text', validate, value, }) {
19
+ function TextField({ autoFocus, autoGrow, 'data-test-selector': dataTestSelector, defaultValue, info, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', type: defaultType = 'text', validate, value, }) {
19
20
  const [type, setType] = useState(defaultType);
20
21
  const isPasswordInput = type === 'password';
21
22
  const togglePasswordType = useCallback(() => {
22
23
  setType(isPasswordInput ? 'text' : 'password');
23
24
  }, [isPasswordInput]);
24
- 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 => {
25
+ return (jsxs(TextField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles.field, styles[size]), "data-info": info ? true : undefined, defaultValue: defaultValue, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxLength: maxLength, minLength: minLength, name: name, onChange: value => {
25
26
  onChange?.(value);
26
- }, 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, inlineElement: defaultType === 'password' && (jsx(PasswordRevealToggle, { onChange: togglePasswordType, showPassword: !isPasswordInput })), label: label, placeholder: placeholder, size: size, type: type })), jsx(FieldError, {}, Math.random())] }));
27
+ }, onInput: onInput, onKeyUp: e => onKeyUp?.(e), validate: validate, value: value, children: [showLabel && (jsx(Label, { className: styles['label'], "data-test-selector": dataTestSelector ? `${dataTestSelector}-label` : undefined, isRequired: isRequired, children: label })), isMultiline ? (jsx(TextArea, { autoGrow: autoGrow, className: styles['input'], "data-test-selector": dataTestSelector, label: label, placeholder: placeholder, rows: rows, size: size })) : (jsx(Input, { autoGrow: autoGrow, className: styles['input'], "data-test-selector": dataTestSelector, inlineElement: defaultType === 'password' && (jsx(PasswordRevealToggle, { onChange: togglePasswordType, showPassword: !isPasswordInput })), label: label, placeholder: placeholder, size: size, type: type })), info && (jsx(InfoIconTooltip, { className: styles['info'], children: info })), jsx(FieldError, { className: styles['error'] }, Math.random())] }));
27
28
  }
28
29
 
29
30
  export { TextField };
@@ -1,3 +1,3 @@
1
- var styles = {"field":"text-field-module-JeaK0"};
1
+ var styles = {"field":"text-field-module-JeaK0","label":"text-field-module-hFl0f","input":"text-field-module-nHYDe","info":"text-field-module-kHn5y","error":"text-field-module-8XbgH"};
2
2
 
3
3
  export { styles as default };
@@ -2,6 +2,7 @@ import { ComponentProps, FC } from 'react';
2
2
  import { TextArea as AriaTextArea } from 'react-aria-components';
3
3
  export interface TextAreaProps extends Omit<ComponentProps<typeof AriaTextArea>, 'size'> {
4
4
  autoGrow?: boolean;
5
+ className?: string;
5
6
  label: string;
6
7
  size?: 'md' | 'lg';
7
8
  }
@@ -2,6 +2,7 @@
2
2
  import { jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { forwardRef, useRef, useCallback, useEffect } from 'react';
4
4
  import { useContextProps, TextAreaContext, TextArea as TextArea$1 } from 'react-aria-components';
5
+ import clsx from 'clsx';
5
6
  import styles from './textarea.module.css.js';
6
7
 
7
8
  /**
@@ -10,7 +11,7 @@ import styles from './textarea.module.css.js';
10
11
  * The initial height is calculated based on the style of the textarea.
11
12
  * The height is updated everytime the user types.
12
13
  */
13
- const TextArea = forwardRef(({ autoGrow, label, size, ...textAreaProps }, _ref) => {
14
+ const TextArea = forwardRef(({ autoGrow, className, label, size, ...textAreaProps }, _ref) => {
14
15
  const textAreaRef = useRef(null);
15
16
  const [props, ref] = useContextProps(textAreaProps, textAreaRef, TextAreaContext);
16
17
  const initialHeight = useRef(null);
@@ -40,7 +41,7 @@ const TextArea = forwardRef(({ autoGrow, label, size, ...textAreaProps }, _ref)
40
41
  }
41
42
  updateHeight();
42
43
  }, [ref, autoGrow, updateHeight, size]);
43
- return (jsx(Fragment, { children: jsx("div", { className: styles['input-container'], children: jsx(TextArea$1, { "aria-label": label, ...textAreaProps, ref: node => {
44
+ return (jsx(Fragment, { children: jsx("div", { className: clsx(className, styles['input-container']), children: jsx(TextArea$1, { "aria-label": label, ...textAreaProps, ref: node => {
44
45
  ref.current =
45
46
  node;
46
47
  return (textAreaRef.current = node);
@@ -14,7 +14,8 @@ const categoriesPlugin = ({ productsIndexName, searchClient, }) => {
14
14
  {
15
15
  indexName: productsIndexName,
16
16
  params: {
17
- hitsPerPage: 1,
17
+ analytics: false,
18
+ hitsPerPage: 0,
18
19
  },
19
20
  query,
20
21
  },
@@ -11,6 +11,8 @@ const popularCategoriesPlugin = ({ productsIndexName, searchClient, }) => {
11
11
  {
12
12
  indexName: productsIndexName,
13
13
  params: {
14
+ analytics: false,
15
+ hitsPerPage: 0,
14
16
  ruleContexts: ['no-results'],
15
17
  },
16
18
  },
@@ -3,6 +3,7 @@ import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query
3
3
  const querySuggestionsPlugin = ({ searchClient, suggestionsIndexName, }) => createQuerySuggestionsPlugin({
4
4
  getSearchParams({ state }) {
5
5
  return {
6
+ analytics: false,
6
7
  hitsPerPage: state.query ? 10 : 0,
7
8
  };
8
9
  },
@@ -2,7 +2,7 @@ import { getAlgoliaResults } from '@algolia/autocomplete-preset-algolia';
2
2
 
3
3
  const quickAccessPlugin = ({ productsIndexName, searchClient, }) => {
4
4
  return {
5
- getSources({ query }) {
5
+ getSources() {
6
6
  return [
7
7
  {
8
8
  getItems() {
@@ -11,10 +11,10 @@ const quickAccessPlugin = ({ productsIndexName, searchClient, }) => {
11
11
  {
12
12
  indexName: productsIndexName,
13
13
  params: {
14
+ analytics: false,
14
15
  hitsPerPage: 0,
15
16
  ruleContexts: ['quick-access'],
16
17
  },
17
- query,
18
18
  },
19
19
  ],
20
20
  searchClient,
@@ -66,7 +66,6 @@ function ProductHitCard({ autocomplete, hit, index, source, }) {
66
66
  }, onAddToCart: ({ cartLine }) => hit.queryId &&
67
67
  sendAddToCartFromSearchEvent({
68
68
  cartLine,
69
- objectId: hit.objectId,
70
69
  queryId: hit.queryId,
71
70
  }), onClick: () => {
72
71
  close();
@@ -0,0 +1,6 @@
1
+ export interface HamburgerButtonProps {
2
+ 'aria-controls': string;
3
+ isActive: boolean;
4
+ onActiveChange: (isActive: boolean) => void;
5
+ }
6
+ export declare function HamburgerButton({ 'aria-controls': ariaControls, isActive, onActiveChange, }: HamburgerButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+ import { IconButton } from '../../buttons/icon-button/icon-button.js';
4
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
5
+ import styles from './hamburger-button.module.css.js';
6
+
7
+ function HamburgerButton({ 'aria-controls': ariaControls, isActive, onActiveChange, }) {
8
+ const t = useFormattedMessage();
9
+ return (jsx(IconButton, { "aria-controls": ariaControls, "aria-expanded": isActive, onClick: () => onActiveChange(!isActive), title: t('Toggle navigation menu'), type: "button", children: jsxs("div", { className: clsx(styles['hamburger-button'], {
10
+ [styles.active]: isActive,
11
+ }), children: [jsx("span", { "aria-hidden": "true" }), jsx("span", { "aria-hidden": "true" }), jsx("span", { "aria-hidden": "true" })] }) }));
12
+ }
13
+
14
+ export { HamburgerButton };
@@ -0,0 +1,3 @@
1
+ var styles = {"hamburger-button":"hamburger-button-module-xER52","active":"hamburger-button-module-7yoVH"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export interface HeaderLayoutProps {
3
+ hamburgerButton?: ReactNode;
4
+ logo: ReactNode;
5
+ mainNavigation: ReactNode;
6
+ navigationActions: ReactNode;
7
+ search: ReactNode;
8
+ }
9
+ export declare function HeaderLayout({ hamburgerButton, logo, mainNavigation, navigationActions, search, }: HeaderLayoutProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import styles from './header-layout.module.css.js';
3
+
4
+ function HeaderLayout({ hamburgerButton, logo, mainNavigation, navigationActions, search, }) {
5
+ return (jsxs("header", { className: styles.header, children: [jsxs("div", { className: styles['mobile-menu-toggle'], children: [hamburgerButton && hamburgerButton, jsx("div", { className: styles.search, children: search })] }), jsx("div", { className: styles.logo, children: logo }), jsx("div", { className: styles['main-navigation'], children: mainNavigation }), jsxs("div", { className: styles['navigation-actions'], children: [jsx("div", { className: styles.search, children: search }), jsx("div", { className: styles.icons, children: navigationActions })] })] }));
6
+ }
7
+
8
+ export { HeaderLayout };
@@ -0,0 +1,3 @@
1
+ var styles = {"header":"header-layout-module-VlTuk","logo":"header-layout-module-oKPyL","mobile-menu-toggle":"header-layout-module-aBOJL","main-navigation":"header-layout-module--ICLK","navigation-actions":"header-layout-module-HjY-a","search":"header-layout-module-fP3a6","icons":"header-layout-module-4Qp5b"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,5 @@
1
+ export interface SonicLogoProps {
2
+ className?: string;
3
+ href?: string;
4
+ }
5
+ export declare function SonicLogo({ className, href }: SonicLogoProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+ import { RouteLink } from '../../shared/routing/route-link.js';
4
+ import styles from './sonic-logo.module.css.js';
5
+
6
+ function SonicLogo({ className, href }) {
7
+ const Tag = href ? RouteLink : 'div';
8
+ return (jsx(Tag, { "aria-label": "Sonic", className: clsx(styles.wrapper, className), href: href, children: jsx("svg", { className: styles['sonic-logo'], viewBox: "0 0 100 24", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { className: styles.letters, d: "M11.87 8.65c1.815 0 3.286 1.482 3.286 3.311 0 6.595-5.325 11.962-11.87 11.962C1.471 23.923 0 22.44 0 20.612c0-1.766 1.372-3.21 3.1-3.307l.186-.005c2.848 0 5.179-2.277 5.293-5.12l.005-.219c0-1.829 1.471-3.311 3.286-3.311zm0-8.65c1.815 0 3.286 1.483 3.286 3.311 0 1.766-1.371 3.21-3.1 3.307l-.186.005c-2.849 0-5.178 2.277-5.293 5.118l-.004.22c0 1.829-1.472 3.311-3.287 3.311C1.472 15.272 0 13.79 0 11.961 0 5.366 5.325 0 11.87 0zm6.155 12.016c0 6.596 5.325 11.963 11.87 11.963 6.545 0 11.87-5.367 11.87-11.963 0-6.595-5.325-11.96-11.87-11.96-6.545 0-11.87 5.365-11.87 11.96zm6.572 0c0-2.943 2.376-5.338 5.298-5.338 2.92 0 5.297 2.395 5.297 5.338 0 2.945-2.376 5.34-5.297 5.34-2.922 0-5.298-2.395-5.298-5.34zM82.251 3.56c-4.628 4.663-4.628 12.251 0 16.915 4.628 4.663 12.158 4.663 16.786 0a3.33 3.33 0 0 0 .001-4.683 3.268 3.268 0 0 0-4.501-.138l-.146.138a5.278 5.278 0 0 1-7.494 0c-2.064-2.081-2.064-5.468.001-7.549a5.275 5.275 0 0 1 7.313-.174l.18.173a3.268 3.268 0 0 0 4.647 0 3.33 3.33 0 0 0 0-4.684c-4.63-4.663-12.16-4.662-16.787.002zm-12.868-.13v17.148c0 1.828 1.47 3.311 3.285 3.311 1.816 0 3.287-1.483 3.287-3.311V3.429c0-1.829-1.471-3.312-3.287-3.312-1.815 0-3.285 1.483-3.285 3.312zM48.063.075c-1.814 0-3.285 1.483-3.285 3.311V20.69c0 1.828 1.471 3.311 3.286 3.311s3.286-1.483 3.286-3.311V6.698h2.95c2.92 0 5.297 2.394 5.297 5.338v8.653c0 1.828 1.471 3.311 3.286 3.311s3.286-1.483 3.286-3.311v-8.653C66.17 5.44 60.844.075 54.3.075h-6.235z" }), jsx("path", { className: styles.dot, d: "M35.27 12.017c0 2.991-2.406 5.416-5.375 5.416-2.97 0-5.376-2.425-5.376-5.416 0-2.992 2.407-5.417 5.376-5.417 2.969 0 5.375 2.425 5.375 5.417" })] }) }) }));
9
+ }
10
+
11
+ export { SonicLogo };
@@ -0,0 +1,3 @@
1
+ var styles = {"wrapper":"sonic-logo-module-5zzhF","sonic-logo":"sonic-logo-module-9Mpdq","letters":"sonic-logo-module-Pa7pF","dot":"sonic-logo-module-vTCO3"};
2
+
3
+ export { styles as default };
package/dist/index.js CHANGED
@@ -12,10 +12,10 @@ export { AlgoliaFilterPanel } from './algolia/algolia-filter-panel.js';
12
12
  export { isAlgoliaProductHit } from './algolia/algolia-hit-type.js';
13
13
  export { AlgoliaHitsProvider } from './algolia/algolia-hits-provider.js';
14
14
  export { algoliaIndexesPerEnvironment, getAlgoliaIndex } from './algolia/algolia-index-config.js';
15
+ export { userToken } from './algolia/algolia-initialization.js';
15
16
  export { AlgoliaInsightInstantSearchProvider } from './algolia/algolia-insight-instant-search-provider.js';
16
17
  export { AlgoliaInsightsProvider, AlgoliaInsightsProviderContext } from './algolia/algolia-insights-provider.js';
17
18
  export { AlgoliaInstantSearchStateProvider } from './algolia/algolia-instant-search-state-provider.js';
18
- export { userToken } from './algolia/algolia-intialization.js';
19
19
  export { AlgoliaMultiSelectFilterSection } from './algolia/algolia-multi-select-filter-section.js';
20
20
  export { AlgoliaPagination } from './algolia/algolia-pagination.js';
21
21
  export { AlgoliaProvider, useAlgolia } from './algolia/algolia-provider.js';
@@ -112,6 +112,10 @@ export { SearchList } from './global-search/search-section/search-list.js';
112
112
  export { SearchListItem } from './global-search/search-section/search-list-item.js';
113
113
  export { SearchSection } from './global-search/search-section/search-section.js';
114
114
  export { ConnectedCartIcon } from './header/cart-icon/connected-cart-icon.js';
115
+ export { HamburgerButton } from './header/hamburger-button/hamburger-button.js';
116
+ export { HeaderLayout } from './header/header-layout/header-layout.js';
117
+ export { SonicLogo } from './header/sonic-logo/sonic-logo.js';
118
+ export { InfoIconTooltip } from './info-icon-tooltip/info-icon-tooltip.js';
115
119
  export { FormattedMessage } from './intl/formatted-message.js';
116
120
  export { IntlContext } from './intl/intl-context.js';
117
121
  export { IntlProvider } from './intl/intl-provider.js';
@@ -152,17 +156,20 @@ export { CheckoutPageSectionContent } from './pages/checkout/layouts/checkout-pa
152
156
  export { CheckoutPageSectionHeader } from './pages/checkout/layouts/checkout-page-layout/components/checkout-page-section-header.js';
153
157
  export { CheckoutPageSectionLink } from './pages/checkout/layouts/checkout-page-layout/components/checkout-page-section-link.js';
154
158
  export { OrderConfirmationPage } from './pages/checkout/order-confirmation-page/order-confirmation-page.js';
159
+ export { OrderConfirmationPageContent } from './pages/checkout/order-confirmation-page/order-confirmation-page-content.js';
155
160
  export { AdyenPayment } from './pages/checkout/payment-page/components/adyen-payment.js';
156
161
  export { Payment } from './pages/checkout/payment-page/components/payment.js';
157
162
  export { useGetAdyenRedirectResult } from './pages/checkout/payment-page/hooks/use-get-adyen-redirect-result.js';
158
163
  export { useHasReturnedFromAdyen } from './pages/checkout/payment-page/hooks/use-has-returned-from-adyen.js';
159
164
  export { PaymentPage } from './pages/checkout/payment-page/payment-page.js';
165
+ export { PaymentPageContent } from './pages/checkout/payment-page/payment-page-content.js';
160
166
  export { parseAmount } from './pages/checkout/payment-page/utils/parse-amount.js';
161
167
  export { EDIT_ADDRESS_FORM_ID, EditAddresses } from './pages/checkout/shipping-page/components/edit-address.js';
162
168
  export { ReadOnlyAddresses } from './pages/checkout/shipping-page/components/readonly-address.js';
163
169
  export { SonicAddress } from './pages/checkout/shipping-page/components/sonic-address.js';
164
170
  export { usePatchShippingDetails } from './pages/checkout/shipping-page/hooks/use-patch-shipping-details.js';
165
171
  export { ShippingPage } from './pages/checkout/shipping-page/shipping-page.js';
172
+ export { ShippingPageContent } from './pages/checkout/shipping-page/shipping-page-content.js';
166
173
  export { PageContainer } from './pages/components/page-container/page-container.js';
167
174
  export { PageMetaData } from './pages/components/page-meta-data/page-meta-data.js';
168
175
  export { Page } from './pages/components/page/page.js';
@@ -245,7 +252,7 @@ export { fetchTranslations } from './shared/api/storefront/services/translation-
245
252
  export { fetchCountries, fetchCountriesLanguages, fetchCountriesWithLanguages, fetchSettings, updateLocale } from './shared/api/storefront/services/website-service.js';
246
253
  export { WishListNameAlreadyExistsError, addWishListItemToWishList, createWishList, deleteWishList, deleteWishListItemFromWishList, getWishList, getWishListItemsByWishListId, getWishLists } from './shared/api/storefront/services/wishlist-service.js';
247
254
  export { useFeatureFlags } from './shared/feature-flags/use-feature-flags.js';
248
- export { BadRequestError, ForbiddenRequestError, InternalServerErrorRequestError, NotFoundRequestError, RequestError, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, isRequestError, request } from './shared/fetch/request.js';
255
+ export { BadRequestError, ForbiddenRequestError, InternalServerErrorRequestError, NotFoundRequestError, RequestError, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, isFormData, isJsonBody, isRequestError, request } from './shared/fetch/request.js';
249
256
  export { dataLayer } from './shared/ga/data-layer.js';
250
257
  export { GoogleAnalyticsProvider, useGoogleAnalyticsProvider } from './shared/ga/google-analytics-provider.js';
251
258
  export { isGAEvent } from './shared/ga/types.js';
@@ -287,16 +294,17 @@ export { environment, environments } from './shared/utils/environment.js';
287
294
  export { EventEmitter } from './shared/utils/event-emitter.js';
288
295
  export { clone, deepMerge, isPlainObject, default as main, merge } from './shared/utils/merge.js';
289
296
  export { currencies, formatPrice, getCurrencyByCountryCode } from './shared/utils/price.js';
297
+ export { isPromise, wait } from './shared/utils/promise.js';
290
298
  export { random, randomInt } from './shared/utils/random.js';
291
299
  export { camelCase, capitalizeFirstLetter } from './shared/utils/string.js';
292
300
  export { TIME } from './shared/utils/time.js';
293
301
  export { has, hasNo } from './shared/utils/types.js';
294
302
  export { createUUID } from './shared/utils/uuid.js';
295
- export { wait } from './shared/utils/wait.js';
296
303
  export { Sidebar } from './sidebar/sidebar.js';
297
304
  export { SidebarDetectBreakpoint, SidebarProvider } from './sidebar/sidebar-provider.js';
298
305
  export { ToggleSidebarButton } from './sidebar/toggle-sidebar-button.js';
299
306
  export { useSidebar, useSidebarActions } from './sidebar/use-sidebar.js';
307
+ export { SignInForm } from './sign-in-form/sign-in-form.js';
300
308
  export { Toast } from './toast/toast.js';
301
309
  export { ToastProvider } from './toast/toast-provider.js';
302
310
  export { useToast } from './toast/use-toast.js';
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ export interface InfoIconTooltipProps {
3
+ children: string | ReactNode;
4
+ className?: string;
5
+ variant?: 'solid' | 'stroke';
6
+ }
7
+ export declare function InfoIconTooltip({ children, className, variant, }: InfoIconTooltipProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
4
+ import { SolidInformationIcon } from '../icons/solid/solid-information-icon.js';
5
+ import { StrokeInformationIcon } from '../icons/stroke/stroke-information-icon.js';
6
+ import { IconButton } from '../buttons/icon-button/icon-button.js';
7
+ import { useFormattedMessage } from '../intl/use-formatted-message.js';
8
+ import { Tooltip } from '../tooltip/tooltip.js';
9
+ import styles from './info-icon-tooltip.module.css.js';
10
+
11
+ function InfoIconTooltip({ children, className, variant = 'solid', }) {
12
+ const t = useFormattedMessage();
13
+ const triggerLabel = t('Information');
14
+ function Icon(props) {
15
+ return (jsx(IconButton, { ...props, className: clsx(styles.trigger), children: variant === 'stroke' ? (jsx(StrokeInformationIcon, { "aria-description": triggerLabel })) : (jsx(SolidInformationIcon, { "aria-description": triggerLabel })) }));
16
+ }
17
+ return (jsx(Tooltip, { className: clsx(className, styles['info-icon-tooltip'], styles[variant]), trigger: jsx(Icon, {}), children: children }));
18
+ }
19
+
20
+ export { InfoIconTooltip };
@@ -0,0 +1,3 @@
1
+ var styles = {"info-icon-tooltip":"info-icon-tooltip-module-oR4nD","stroke":"info-icon-tooltip-module-5zfDr","trigger":"info-icon-tooltip-module-0lY-K"};
2
+
3
+ export { styles as default };
@@ -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.' | 'Add order notes' | 'Add to list' | 'Address' | 'Amount: {0}' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | '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.' | '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' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Features' | 'First name' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'Incl. VAT' | 'Includes' | 'Industry' | 'Language' | 'Last name' | 'List name already exists' | 'New list name' | 'of' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Pay by invoice' | 'Pay' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid e-mail 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' | 'Remove all' | 'Requested delivery date' | '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' | '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.' | 'Total amount is' | 'Total' | 'Total' | 'Try another search' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | '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.' | 'Add order notes' | 'Add to list' | 'Address' | 'Amount: {0}' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | '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.' | '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' | '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' | 'Incl. VAT' | 'Includes' | 'Industry' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'New list name' | 'New user?' | 'of' | 'Or sign in 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 e-mail 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' | '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' | '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' | 'Total' | 'Try another search' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | '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';
@@ -6,7 +6,7 @@ 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, { ...billToAddress }) }) }), jsx("section", { className: styles.section, children: jsx(InfoDisplay, { id: "shipping-address", label: t('Shipping address'), value: jsx(Address, { ...shipToAddress }) }) })] }));
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" }) }) })] }));
10
10
  }
11
11
 
12
12
  export { BillingAndInvoiceInformation };
@@ -0,0 +1,5 @@
1
+ import { CartModel } from '../../../shared/api/storefront/model/storefront.model';
2
+ export interface OrderConfirmationPageContentProps {
3
+ cart: CartModel;
4
+ }
5
+ export declare function OrderConfirmationPageContent({ cart, }: OrderConfirmationPageContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,83 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { PrintButton } from '../../../buttons/print-button/print-button.js';
3
+ import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
4
+ import { CartTotals } from '../../../cart-totals/cart-totals.js';
5
+ import { InfoDisplay } from '../../../display/info-display/info-display.js';
6
+ import { FormattedMessage } from '../../../intl/formatted-message.js';
7
+ import { useCultureCode } from '../../../intl/use-culture-code.js';
8
+ import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
9
+ import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
10
+ import { useSaveCartForLater } from '../../../shared/api/storefront/hooks/cart/use-save-cart-for-later.js';
11
+ import { RouteButton } from '../../../shared/routing/route-button.js';
12
+ import { formatDateToLocaleString } from '../../../shared/utils/date.js';
13
+ import { useToast } from '../../../toast/use-toast.js';
14
+ import { Page } from '../../components/page/page.js';
15
+ import { BillingAndInvoiceInformation } from '../components/billing-and-invoice-information.js';
16
+ import { CHECKOUT_PATHS } from '../constants.js';
17
+ import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
18
+ import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
19
+ import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
20
+ import styles from './order-confirmation-page.module.css.js';
21
+
22
+ function OrderConfirmationPageContent({ cart, }) {
23
+ const t = useFormattedMessage();
24
+ const { addToast } = useToast();
25
+ const cultureCode = useCultureCode();
26
+ const saveCartForLater = useSaveCartForLater({
27
+ onError: () => {
28
+ addToast({
29
+ body: jsx(FormattedMessage, { id: "Unable to save cart for later." }),
30
+ isUserDismissable: false,
31
+ messageType: 'danger',
32
+ });
33
+ },
34
+ onSuccess: () => {
35
+ addToast({
36
+ body: jsx(FormattedMessage, { id: "Saved cart for later." }),
37
+ isUserDismissable: false,
38
+ messageType: 'success',
39
+ });
40
+ },
41
+ });
42
+ return (jsx(Page, { breadCrumb: [{ href: CHECKOUT_PATHS.HOME, label: t('Home') }], title: t('Order confirmation'), children: jsx(CheckoutPageLayout, { actions: {
43
+ primary: (jsx(RouteButton, { withArrow: true, "data-test-selector": "checkoutReviewAndSubmit_continueShopping", href: "/", children: jsx(FormattedMessage, { id: "Continue shopping" }) })),
44
+ secondary: (jsxs(Fragment, { children: [cart.canSaveOrder && (jsx(RouteButton, { color: "secondary", onClick: () => {
45
+ saveCartForLater.mutate({ cart });
46
+ }, variant: "outline", children: jsx(FormattedMessage, { id: "Save order" }) })), jsx(PrintButton, {})] })),
47
+ }, overview: jsx(CartTotals, { fulfillmentMethod: t(`fulfillmentmethod.${cart.fulfillmentMethod}`), orderNumber: cart.orderNumber, shippingCost: cart.shippingAndHandlingDisplay, subtotal: cart.orderSubTotalDisplay, tax: cart.totalTaxDisplay, total: cart.orderGrandTotalDisplay, vatPercentage: cart.cartLines?.[0]?.pricing?.vatRate }), children: jsxs("div", { children: [jsx(CheckoutPageSection, { hasBorder: false, title: t('General'), children: jsx(CheckoutPageSectionContent, { children: jsxs("div", { className: styles['general-order-info'], children: [cart.orderDate && (jsx(InfoDisplay, { id: "order-date", label: t('Order date'), value: formatDateToLocaleString(new Date(cart.orderDate), cultureCode) })), cart.requestedDeliveryDateDisplay && (jsx(InfoDisplay, { id: "requested-delivery-date", label: t('Requested delivery date'), value: formatDateToLocaleString(new Date(cart.requestedDeliveryDateDisplay.toString()), cultureCode) })), cart.poNumber && (jsx(InfoDisplay, { id: "po-number", label: t('PO Number'), value: cart.poNumber }))] }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Billing and shipping information'), children: jsx(CheckoutPageSectionContent, { children: jsx(BillingAndInvoiceInformation, { billToAddress: {
48
+ address1: cart.billTo?.address1,
49
+ address2: cart.billTo?.address2,
50
+ address3: cart.billTo?.address3,
51
+ city: cart.billTo?.city,
52
+ companyName: cart.billTo?.companyName,
53
+ country: cart.billTo?.country?.name,
54
+ email: cart.billTo?.email,
55
+ phone: cart.billTo?.phone,
56
+ postalCode: cart.billTo?.postalCode,
57
+ }, shipToAddress: {
58
+ address1: cart.shipTo?.address1,
59
+ address2: cart.shipTo?.address2,
60
+ address3: cart.shipTo?.address3,
61
+ city: cart.shipTo?.city,
62
+ companyName: cart.shipTo?.companyName,
63
+ country: cart.shipTo?.country?.name,
64
+ email: cart.shipTo?.email,
65
+ phone: cart.shipTo?.phone,
66
+ postalCode: cart.shipTo?.postalCode,
67
+ } }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Order'), children: jsx(CheckoutPageSectionContent, { stretch: true, children: jsx(OrderLineList, { children: cart.cartLines?.map(cartLine => (jsx(OrderLineCard, { deliveryDate: cartLine.atp?.date, href: cartLine.productUri, image: {
68
+ fit: 'contain',
69
+ image: {
70
+ '1': cartLine.smallImagePath,
71
+ '2': cartLine.smallImagePath,
72
+ '3': cartLine.smallImagePath,
73
+ altText: cartLine.altText,
74
+ },
75
+ title: cartLine.altText,
76
+ }, isReadonly: true, price: {
77
+ originalTotalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
78
+ pricePerUnit: cartLine.pricing?.unitNetPrice || 0,
79
+ totalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
80
+ }, productId: cartLine.productId || '', quantity: cartLine.qtyOrdered || 1, sku: cartLine.erpNumber || '', tags: [], title: cartLine.productName }, cartLine.id))) }) }) })] }) }) }));
81
+ }
82
+
83
+ export { OrderConfirmationPageContent };
@@ -1,36 +1,16 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { useEffect } from 'react';
3
- import { PrintButton } from '../../../buttons/print-button/print-button.js';
4
- import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
5
- import { CartTotals } from '../../../cart-totals/cart-totals.js';
6
- import { InfoDisplay } from '../../../display/info-display/info-display.js';
7
- import { FormattedMessage } from '../../../intl/formatted-message.js';
8
- import { useCultureCode } from '../../../intl/use-culture-code.js';
9
- import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
10
- import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
11
3
  import { LoadingPage } from '../../loading-page/loading-page.js';
12
4
  import { useIsAuthenticated } from '../../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
13
5
  import { useFetchCartById } from '../../../shared/api/storefront/hooks/cart/use-fetch-cart-by-id.js';
14
- import { useSaveCartForLater } from '../../../shared/api/storefront/hooks/cart/use-save-cart-for-later.js';
15
- import { RouteButton } from '../../../shared/routing/route-button.js';
16
6
  import { useNavigate } from '../../../shared/routing/route-provider.js';
17
- import { formatDateToLocaleString } from '../../../shared/utils/date.js';
18
7
  import { hasNo } from '../../../shared/utils/types.js';
19
- import { useToast } from '../../../toast/use-toast.js';
20
- import { Page } from '../../components/page/page.js';
21
8
  import { ErrorPage } from '../../error-page/error-page.js';
22
- import { BillingAndInvoiceInformation } from '../components/billing-and-invoice-information.js';
23
9
  import { CHECKOUT_PATHS } from '../constants.js';
24
- import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
25
- import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
26
- import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
27
- import styles from './order-confirmation-page.module.css.js';
10
+ import { OrderConfirmationPageContent } from './order-confirmation-page-content.js';
28
11
 
29
12
  function OrderConfirmationPage({ cartId }) {
30
13
  const isAuthenticated = useIsAuthenticated();
31
- const t = useFormattedMessage();
32
- const cultureCode = useCultureCode();
33
- const { addToast } = useToast();
34
14
  const { isNavigating, navigate } = useNavigate();
35
15
  const { data: cart, error, isLoading: cartIsLoading, } = useFetchCartById({
36
16
  id: cartId,
@@ -45,22 +25,6 @@ function OrderConfirmationPage({ cartId }) {
45
25
  if (cart.status === 'Cart')
46
26
  navigate(CHECKOUT_PATHS.CART);
47
27
  }, [cart, navigate, isAuthenticated]);
48
- const saveCartForLater = useSaveCartForLater({
49
- onError: () => {
50
- addToast({
51
- body: jsx(FormattedMessage, { id: "Unable to save cart for later." }),
52
- isUserDismissable: false,
53
- messageType: 'danger',
54
- });
55
- },
56
- onSuccess: () => {
57
- addToast({
58
- body: jsx(FormattedMessage, { id: "Saved cart for later." }),
59
- isUserDismissable: false,
60
- messageType: 'success',
61
- });
62
- },
63
- });
64
28
  if (error)
65
29
  return jsx(ErrorPage, { error: error });
66
30
  if (cartIsLoading || isNavigating)
@@ -71,45 +35,7 @@ function OrderConfirmationPage({ cartId }) {
71
35
  cart.cartLines.length === 0) {
72
36
  return null;
73
37
  }
74
- return (jsx(Page, { breadCrumb: [{ href: CHECKOUT_PATHS.HOME, label: t('Home') }], title: t('Order confirmation'), children: jsx(CheckoutPageLayout, { actions: {
75
- primary: (jsx(RouteButton, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", href: "/", children: jsx(FormattedMessage, { id: "Continue shopping" }) })),
76
- secondary: (jsxs(Fragment, { children: [cart.canSaveOrder && (jsx(RouteButton, { color: "secondary", onClick: () => {
77
- saveCartForLater.mutate({ cart });
78
- }, variant: "outline", children: jsx(FormattedMessage, { id: "Save order" }) })), jsx(PrintButton, {})] })),
79
- }, overview: jsx(CartTotals, { fulfillmentMethod: t(`fulfillmentmethod.${cart.fulfillmentMethod}`), orderNumber: cart.orderNumber, shippingCost: cart.shippingAndHandlingDisplay, subtotal: cart.orderSubTotalDisplay, tax: cart.totalTaxDisplay, total: cart.orderGrandTotalDisplay, vatPercentage: cart.cartLines[0]?.pricing?.vatRate }), children: jsxs("div", { children: [jsx(CheckoutPageSection, { hasBorder: false, title: t('General'), children: jsx(CheckoutPageSectionContent, { children: jsxs("div", { className: styles['general-order-info'], children: [cart.orderDate && (jsx(InfoDisplay, { id: "order-date", label: t('Order date'), value: formatDateToLocaleString(new Date(cart.orderDate), cultureCode) })), cart.requestedDeliveryDate && (jsx(InfoDisplay, { id: "requested-delivery-date", label: t('Requested delivery date'), value: formatDateToLocaleString(new Date(cart.requestedDeliveryDate), cultureCode) })), cart.poNumber && (jsx(InfoDisplay, { id: "po-number", label: t('PO Number'), value: cart.poNumber }))] }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Billing and shipping information'), children: jsx(CheckoutPageSectionContent, { children: jsx(BillingAndInvoiceInformation, { billToAddress: {
80
- address1: cart.billTo?.address1,
81
- address2: cart.billTo?.address2,
82
- address3: cart.billTo?.address3,
83
- city: cart.billTo?.city,
84
- companyName: cart.billTo?.companyName,
85
- country: cart.billTo?.country?.name,
86
- email: cart.billTo?.email,
87
- phone: cart.billTo?.phone,
88
- postalCode: cart.billTo?.postalCode,
89
- }, shipToAddress: {
90
- address1: cart.shipTo?.address1,
91
- address2: cart.shipTo?.address2,
92
- address3: cart.shipTo?.address3,
93
- city: cart.shipTo?.city,
94
- companyName: cart.shipTo?.companyName,
95
- country: cart.shipTo?.country?.name,
96
- email: cart.shipTo?.email,
97
- phone: cart.shipTo?.phone,
98
- postalCode: cart.shipTo?.postalCode,
99
- } }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Order'), children: jsx(CheckoutPageSectionContent, { stretch: true, children: jsx(OrderLineList, { children: cart.cartLines.map(cartLine => (jsx(OrderLineCard, { deliveryDate: cartLine.atp?.date, href: cartLine.productUri, image: {
100
- fit: 'contain',
101
- image: {
102
- '1': cartLine.smallImagePath,
103
- '2': cartLine.smallImagePath,
104
- '3': cartLine.smallImagePath,
105
- altText: cartLine.altText,
106
- },
107
- title: cartLine.altText,
108
- }, isReadonly: true, price: {
109
- originalTotalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
110
- pricePerUnit: cartLine.pricing?.unitNetPrice || 0,
111
- totalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
112
- }, productId: cartLine.productId || '', quantity: cartLine.qtyOrdered || 1, sku: cartLine.erpNumber || '', tags: [], title: cartLine.productName }, cartLine.id))) }) }) })] }) }) }));
38
+ return jsx(OrderConfirmationPageContent, { cart: cart });
113
39
  }
114
40
 
115
41
  export { OrderConfirmationPage };