@sonic-equipment/ui 215.0.0 → 217.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 (53) hide show
  1. package/dist/buttons/button/button.module.css.js +1 -1
  2. package/dist/buttons/icon-button/icon-button.d.ts +1 -1
  3. package/dist/buttons/icon-button/icon-button.js +5 -3
  4. package/dist/buttons/reorder-button/connected-reorder-button.d.ts +4 -0
  5. package/dist/buttons/reorder-button/connected-reorder-button.js +37 -0
  6. package/dist/buttons/reorder-button/reorder-button.d.ts +9 -0
  7. package/dist/buttons/reorder-button/reorder-button.js +11 -0
  8. package/dist/display/price/price.js +2 -2
  9. package/dist/display/price/price.module.css.js +1 -1
  10. package/dist/exports.d.ts +6 -0
  11. package/dist/header/buttons/account/connected-account-button.d.ts +1 -2
  12. package/dist/header/buttons/account/connected-account-button.js +20 -11
  13. package/dist/header/buttons/account/connected-account-button.module.css.js +3 -0
  14. package/dist/index.js +10 -4
  15. package/dist/intl/translation-id.d.ts +1 -1
  16. package/dist/navigation/mobile-navigation/mobile-navigation.js +2 -2
  17. package/dist/navigation/quick-access-menu/quick-access-menu.d.ts +8 -0
  18. package/dist/navigation/quick-access-menu/quick-access-menu.js +21 -0
  19. package/dist/navigation/quick-access-menu/quick-access-menu.module.css.js +3 -0
  20. package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +3 -16
  21. package/dist/pages/my-sonic/navigation/my-sonic-desktop-navigation.d.ts +2 -2
  22. package/dist/pages/my-sonic/navigation/my-sonic-desktop-navigation.js +7 -5
  23. package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.d.ts +2 -2
  24. package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.js +7 -5
  25. package/dist/pages/my-sonic/navigation/my-sonic-navigation-items.d.ts +5 -2
  26. package/dist/pages/my-sonic/navigation/my-sonic-navigation-items.js +16 -5
  27. package/dist/pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.js +2 -2
  28. package/dist/pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.js +2 -2
  29. package/dist/pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.js +2 -2
  30. package/dist/pages/my-sonic/pages/favorites/favorites-page.js +1 -1
  31. package/dist/pages/my-sonic/pages/my-account/my-account-page.js +2 -2
  32. package/dist/pages/my-sonic/pages/order-details/order-details-content.d.ts +3 -1
  33. package/dist/pages/my-sonic/pages/order-details/order-details-content.js +3 -3
  34. package/dist/pages/my-sonic/pages/order-details/order-details-page.d.ts +4 -1
  35. package/dist/pages/my-sonic/pages/order-details/order-details-page.js +23 -3
  36. package/dist/pages/my-sonic/pages/order-history/order-history-page.js +5 -2
  37. package/dist/shared/api/storefront/hooks/authentication/use-sign-out-mutation.d.ts +5 -0
  38. package/dist/shared/api/storefront/hooks/authentication/use-sign-out-mutation.js +26 -0
  39. package/dist/shared/api/storefront/hooks/authentication/use-sign-out.d.ts +3 -5
  40. package/dist/shared/api/storefront/hooks/authentication/use-sign-out.js +15 -18
  41. package/dist/shared/api/storefront/hooks/cart/use-add-bulk-products-to-current-cart.d.ts +4 -0
  42. package/dist/shared/api/storefront/hooks/cart/use-add-bulk-products-to-current-cart.js +21 -0
  43. package/dist/shared/api/storefront/services/cart-service.d.ts +4 -0
  44. package/dist/shared/api/storefront/services/cart-service.js +13 -1
  45. package/dist/shared/routing/types.d.ts +1 -1
  46. package/dist/shared/utils/greeting.d.ts +1 -0
  47. package/dist/shared/utils/greeting.js +15 -0
  48. package/dist/shared/utils/price.d.ts +1 -0
  49. package/dist/shared/utils/price.js +3 -0
  50. package/dist/shared/utils/types.d.ts +1 -0
  51. package/dist/shared/utils/types.js +4 -1
  52. package/dist/styles.css +117 -12
  53. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
- var buttonStyles = {"button":"button-module-V4meK","light":"button-module-fepAr","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","active":"button-module-XMFzj","ghost":"button-module-f4UVe"};
1
+ var buttonStyles = {"button":"button-module-V4meK","light":"button-module-fepAr","icon":"button-module-XaNWz","right-arrow-icon":"button-module-ydQAo","loading-uninformative":"button-module-LwuW2","loading-informative":"button-module-U5IxM","spinner":"button-module-13ndF","children":"button-module-vqRq-","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","active":"button-module-XMFzj","ghost":"button-module-f4UVe"};
2
2
 
3
3
  export { buttonStyles as default };
@@ -14,4 +14,4 @@ export interface IconButtonProps {
14
14
  title?: string;
15
15
  type?: 'button' | 'submit' | 'reset';
16
16
  }
17
- export declare function IconButton({ children, className: _className, color, 'data-test-selector': dataTestSelector, href, isDisabled, onClick, route, size, target, title, type, ...rest }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
+ import { forwardRef } from 'react';
3
4
  import clsx from 'clsx';
4
5
  import { useRouteLink } from '../../shared/routing/use-route-link.js';
5
6
  import styles from './icon-button.module.css.js';
6
7
 
7
- function IconButton({ children, className: _className, color = 'primary', 'data-test-selector': dataTestSelector, href, isDisabled, onClick, route, size = 'md', target, title, type = 'button', ...rest }) {
8
+ const IconButton = forwardRef(({ children, className: _className, color = 'primary', 'data-test-selector': dataTestSelector, href, isDisabled, onClick, route, size = 'md', target, title, type = 'button', ...rest }, ref) => {
8
9
  const { getRouteLinkProps, RouteLinkElement } = useRouteLink();
9
10
  const handleButtonClick = (e) => {
10
11
  e.preventDefault();
@@ -15,7 +16,8 @@ function IconButton({ children, className: _className, color = 'primary', 'data-
15
16
  if (href) {
16
17
  return (jsx(RouteLinkElement, { className: className, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, onClick: onClick, target: target, title: title, ...getRouteLinkProps(href, route), ...rest, children: children }));
17
18
  }
18
- return (jsx("button", { className: className, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, onClick: handleButtonClick, title: title, type: type, ...rest, children: children }));
19
- }
19
+ return (jsx("button", { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, onClick: handleButtonClick, title: title, type: type, ...rest, children: children }));
20
+ });
21
+ IconButton.displayName = 'IconButton';
20
22
 
21
23
  export { IconButton };
@@ -0,0 +1,4 @@
1
+ export interface ConnectedReorderButtonProps {
2
+ orderId: string;
3
+ }
4
+ export declare function ConnectedReorderButton({ orderId, }: ConnectedReorderButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
3
+ import { useAddBulkProductsToCurrentCart } from '../../shared/api/storefront/hooks/cart/use-add-bulk-products-to-current-cart.js';
4
+ import { useFetchOrderById } from '../../shared/api/storefront/hooks/orders/use-fetch-order-by-id.js';
5
+ import { useToast } from '../../toast/use-toast.js';
6
+ import { ReorderButton } from './reorder-button.js';
7
+
8
+ function ConnectedReorderButton({ orderId, }) {
9
+ const { data } = useFetchOrderById(orderId);
10
+ const toast = useToast();
11
+ const t = useFormattedMessage();
12
+ const { isPending, mutate, status } = useAddBulkProductsToCurrentCart({
13
+ onError: _error => toast.addToast({
14
+ body: t('Unable to add the order to your cart.'),
15
+ messageType: 'danger',
16
+ }),
17
+ onSuccess: () => toast.addToast({
18
+ body: t('The order has been added to your cart.'),
19
+ messageType: 'success',
20
+ }),
21
+ });
22
+ const reorder = async () => {
23
+ if (!data || !data.orderLines || data.orderLines.length <= 0)
24
+ return;
25
+ const params = {
26
+ cartLines: data.orderLines.map(line => ({
27
+ productId: line.productId,
28
+ qtyOrdered: line.qtyOrdered,
29
+ unitOfMeasure: line.unitOfMeasure,
30
+ })),
31
+ };
32
+ mutate(params);
33
+ };
34
+ return (jsx(ReorderButton, { allowReorder: Boolean(data?.orderLines && data.orderLines.length > 0), isPending: isPending, onReorder: reorder, orderId: orderId, status: status }));
35
+ }
36
+
37
+ export { ConnectedReorderButton };
@@ -0,0 +1,9 @@
1
+ import { MutationStatus } from '@tanstack/react-query';
2
+ export interface ReorderButtonProps {
3
+ allowReorder?: boolean;
4
+ isPending: boolean;
5
+ onReorder: VoidFunction;
6
+ orderId: string;
7
+ status: MutationStatus;
8
+ }
9
+ export declare function ReorderButton({ allowReorder, isPending, onReorder, orderId, status, }: ReorderButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { FormattedMessage } from '../../intl/formatted-message.js';
3
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
4
+ import { Button } from '../button/button.js';
5
+
6
+ function ReorderButton({ allowReorder = true, isPending, onReorder, orderId, status, }) {
7
+ const t = useFormattedMessage();
8
+ return (jsx(Button, { "data-order-id": orderId, "data-reorder-status": status, "data-test-selector": "reorder-button", iconPosition: "right", isDisabled: isPending || !allowReorder, isLoading: isPending ? t('Reordering...') : false, onClick: onReorder, children: jsx(FormattedMessage, { id: "Reorder" }) }));
9
+ }
10
+
11
+ export { ReorderButton };
@@ -13,12 +13,12 @@ function SinglePrice({ className, currencyCode, isDiscount, isOld, locale, price
13
13
  price,
14
14
  replaceNonBreakingSpace: true,
15
15
  });
16
- const { currency, decimal, fraction, integer, literal } = parseCurrency({
16
+ const { currency, decimal, fraction, integer, literal, symbolPosition } = parseCurrency({
17
17
  currencyCode,
18
18
  locale,
19
19
  price,
20
20
  });
21
- return (jsxs("data", { className: clsx(className, styles['single-price'], styles[variant], small && styles['small'], isDiscount && styles['is-discount'], isOld && styles['is-old']), "data-price-string": priceString, value: price, children: [jsx("span", { className: styles.symbol, children: currency }), jsxs("span", { className: styles.number, children: [literal && jsx("span", { className: styles.literal, children: literal }), jsx("span", { className: styles.integer, children: integer }), decimal && jsx("span", { className: styles.decimal, children: decimal }), fraction && jsx("span", { className: styles.fraction, children: fraction })] })] }));
21
+ return (jsxs("data", { className: clsx(className, styles['single-price'], styles[variant], small && styles['small'], isDiscount && styles['is-discount'], isOld && styles['is-old'], styles[`symbol-${symbolPosition}`]), "data-price-string": priceString, value: price, children: [symbolPosition === 'before' && (jsx("span", { className: styles.symbol, children: currency })), jsxs("span", { className: styles.number, children: [literal && jsx("span", { className: styles.literal, children: literal }), jsx("span", { className: styles.integer, children: integer }), decimal && jsx("span", { className: styles.decimal, children: decimal }), fraction && jsx("span", { className: styles.fraction, children: fraction })] }), symbolPosition === 'after' && (jsx("span", { className: styles.symbol, children: currency }))] }));
22
22
  }
23
23
  function Price({ className, currencyCode, 'data-test-selector': dataTestSelector, isVatIncluded = null, locale, originalPrice, price, pricePerUnit, style, unitAmount = 1, unitType = 'pc', variant = 'default', }) {
24
24
  const t = useFormattedMessage();
@@ -1,3 +1,3 @@
1
- var styles = {"single-price":"price-module-Qyyas","symbol":"price-module--Oil0","number":"price-module-QnS4t","fraction":"price-module-p8hAn","sonic":"price-module-vUbWV","literal":"price-module-9HAVF","is-discount":"price-module-bpZpP","small":"price-module-TEd4d","is-old":"price-module-fydQn","price":"price-module-tbuNk","price-per-unit":"price-module-ZURYg","vat":"price-module-uVTD7","original-price":"price-module-x77Vd","current-price":"price-module-9XVqt"};
1
+ var styles = {"single-price":"price-module-Qyyas","symbol":"price-module--Oil0","number":"price-module-QnS4t","fraction":"price-module-p8hAn","sonic":"price-module-vUbWV","literal":"price-module-9HAVF","is-discount":"price-module-bpZpP","small":"price-module-TEd4d","is-old":"price-module-fydQn","price":"price-module-tbuNk","price-per-unit":"price-module-ZURYg","vat":"price-module-uVTD7","original-price":"price-module-x77Vd","current-price":"price-module-9XVqt","symbol-after":"price-module-SkIMi"};
2
2
 
3
3
  export { styles as default };
package/dist/exports.d.ts CHANGED
@@ -41,6 +41,8 @@ export * from './buttons/favorite/favorite-button';
41
41
  export * from './buttons/icon-button/icon-button';
42
42
  export * from './buttons/link/link';
43
43
  export * from './buttons/print-button/print-button';
44
+ export * from './buttons/reorder-button/connected-reorder-button';
45
+ export * from './buttons/reorder-button/reorder-button';
44
46
  export * from './cards/category-card/category-card';
45
47
  export * from './cards/data-card/data-card';
46
48
  export * from './cards/orderline-card/connected-orderline-card';
@@ -209,6 +211,7 @@ export * from './navigation/cart-icon/cart-icon';
209
211
  export * from './navigation/favorite-icon/favorite-icon';
210
212
  export * from './navigation/mobile-navigation/mobile-navigation';
211
213
  export * from './navigation/panel-navigation/panel-navigation';
214
+ export * from './navigation/quick-access-menu/quick-access-menu';
212
215
  export * from './notifications/announcements/announcement';
213
216
  export * from './notifications/announcements/announcement-list';
214
217
  export * from './notifications/announcements/connected-announcement-list';
@@ -328,6 +331,8 @@ export * from './shared/api/storefront/hooks/authentication/use-patch-session';
328
331
  export * from './shared/api/storefront/hooks/authentication/use-recover-password';
329
332
  export * from './shared/api/storefront/hooks/authentication/use-sign-in';
330
333
  export * from './shared/api/storefront/hooks/authentication/use-sign-out';
334
+ export * from './shared/api/storefront/hooks/authentication/use-sign-out-mutation';
335
+ export * from './shared/api/storefront/hooks/cart/use-add-bulk-products-to-current-cart';
331
336
  export * from './shared/api/storefront/hooks/cart/use-add-product-to-current-cart';
332
337
  export * from './shared/api/storefront/hooks/cart/use-delete-cart-line-by-id';
333
338
  export * from './shared/api/storefront/hooks/cart/use-delete-current-cart';
@@ -444,6 +449,7 @@ export * from './shared/utils/date';
444
449
  export * from './shared/utils/debug';
445
450
  export * from './shared/utils/environment';
446
451
  export * from './shared/utils/event-emitter';
452
+ export * from './shared/utils/greeting';
447
453
  export * from './shared/utils/merge';
448
454
  export * from './shared/utils/number';
449
455
  export * from './shared/utils/price';
@@ -1,6 +1,5 @@
1
1
  export interface ConnectedAccountButtonProps {
2
2
  className?: string;
3
3
  'data-test-selector'?: string;
4
- onClick?: () => void;
5
4
  }
6
- export declare function ConnectedAccountButton({ className, 'data-test-selector': dataTestSelector, onClick, }: ConnectedAccountButtonProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function ConnectedAccountButton({ className, 'data-test-selector': dataTestSelector, }: ConnectedAccountButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,29 @@
1
1
  "use client";
2
- import { jsx } from 'react/jsx-runtime';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { useRef } from 'react';
4
+ import { Popover } from 'react-aria-components';
3
5
  import { IconButton } from '../../../buttons/icon-button/icon-button.js';
4
6
  import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
5
7
  import { AccountIcon } from '../../../navigation/account-icon/account-icon.js';
6
- import { useIsAuthenticated } from '../../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
7
- import { useLocation } from '../../../shared/routing/use-location.js';
8
- import { usePaths } from '../../../shared/routing/use-paths.js';
8
+ import { QuickAccessMenu } from '../../../navigation/quick-access-menu/quick-access-menu.js';
9
+ import { useFetchSession } from '../../../shared/api/storefront/hooks/authentication/use-fetch-session.js';
10
+ import { useSignOut } from '../../../shared/api/storefront/hooks/authentication/use-sign-out.js';
11
+ import { useDisclosure } from '../../../shared/hooks/use-disclosure.js';
12
+ import { useOnNavigate } from '../../../shared/routing/use-on-navigate.js';
13
+ import styles from './connected-account-button.module.css.js';
9
14
 
10
- function ConnectedAccountButton({ className, 'data-test-selector': dataTestSelector, onClick, }) {
11
- const paths = usePaths();
15
+ function ConnectedAccountButton({ className, 'data-test-selector': dataTestSelector, }) {
12
16
  const t = useFormattedMessage();
13
- const isAuthenticated = useIsAuthenticated();
14
- const { href } = useLocation();
15
- return (jsx(IconButton, { className: className, "data-authenticated": isAuthenticated ? true : false, "data-test-selector": dataTestSelector, href: isAuthenticated
16
- ? paths.ACCOUNT
17
- : `${paths.SIGN_IN}${href ? `?returnUrl=${encodeURIComponent(href)}` : ''}`, isDisabled: isAuthenticated === undefined, onClick: onClick, children: jsx(AccountIcon, { "aria-label": isAuthenticated ? t('My Sonic') : t('Sign in or create account'), isAuthenticated: isAuthenticated }) }));
17
+ const { close, isOpen, open, toggle } = useDisclosure(false);
18
+ const triggerRef = useRef(null);
19
+ useOnNavigate(close);
20
+ const signOut = useSignOut({ onSignOut: close });
21
+ const { data, isLoading: isLoadingSession } = useFetchSession();
22
+ const firstName = data?.firstName ? data.firstName.trim() : undefined;
23
+ const lastName = data?.lastName ? data.lastName.trim() : undefined;
24
+ const customerName = firstName ? [firstName, lastName].join(' ') : undefined;
25
+ const customerCompany = data?.billTo?.companyName;
26
+ return (jsxs(Fragment, { children: [jsx(IconButton, { ref: triggerRef, className: className, "data-authenticated": data?.isAuthenticated ? true : false, "data-test-selector": dataTestSelector, isDisabled: isLoadingSession, onClick: toggle, children: jsx(AccountIcon, { "aria-label": t('My Sonic'), isAuthenticated: data?.isAuthenticated }) }), jsx(Popover, { className: styles['popover'], isOpen: isOpen, onOpenChange: state => (state ? open() : close()), placement: "bottom", triggerRef: triggerRef, children: jsx(QuickAccessMenu, { customerCompany: customerCompany, customerName: customerName, isAuthenticated: data?.isAuthenticated, onSignOut: signOut }) })] }));
18
27
  }
19
28
 
20
29
  export { ConnectedAccountButton };
@@ -0,0 +1,3 @@
1
+ var styles = {"popover":"connected-account-button-module-d7qyN"};
2
+
3
+ export { styles as default };
package/dist/index.js CHANGED
@@ -46,6 +46,8 @@ export { FavoriteButton } from './buttons/favorite/favorite-button.js';
46
46
  export { IconButton } from './buttons/icon-button/icon-button.js';
47
47
  export { Link } from './buttons/link/link.js';
48
48
  export { PrintButton } from './buttons/print-button/print-button.js';
49
+ export { ConnectedReorderButton } from './buttons/reorder-button/connected-reorder-button.js';
50
+ export { ReorderButton } from './buttons/reorder-button/reorder-button.js';
49
51
  export { CategoryCard } from './cards/category-card/category-card.js';
50
52
  export { DataCard } from './cards/data-card/data-card.js';
51
53
  export { ConnectedOrderLineCard } from './cards/orderline-card/connected-orderline-card.js';
@@ -211,6 +213,7 @@ export { CartIcon } from './navigation/cart-icon/cart-icon.js';
211
213
  export { FavoriteIcon } from './navigation/favorite-icon/favorite-icon.js';
212
214
  export { MobileNavigation } from './navigation/mobile-navigation/mobile-navigation.js';
213
215
  export { PanelNavigation } from './navigation/panel-navigation/panel-navigation.js';
216
+ export { QuickAccessMenu } from './navigation/quick-access-menu/quick-access-menu.js';
214
217
  export { Announcement } from './notifications/announcements/announcement.js';
215
218
  export { AnnouncementList } from './notifications/announcements/announcement-list.js';
216
219
  export { ConnectedAnnouncementList } from './notifications/announcements/connected-announcement-list.js';
@@ -273,14 +276,14 @@ export { MySonicLayoutTitle } from './pages/my-sonic/layouts/my-sonic-layout/my-
273
276
  export { ConnectedMySonicNavigation } from './pages/my-sonic/navigation/connected-my-sonic-navigation.js';
274
277
  export { MySonicDesktopNavigation } from './pages/my-sonic/navigation/my-sonic-desktop-navigation.js';
275
278
  export { MySonicMobileNavigation } from './pages/my-sonic/navigation/my-sonic-mobile-navigation.js';
276
- export { useMySonicNavigationItems } from './pages/my-sonic/navigation/my-sonic-navigation-items.js';
279
+ export { isMySonicNavigationAction, isMySonicNavigationLink, useMySonicNavigationItems } from './pages/my-sonic/navigation/my-sonic-navigation-items.js';
277
280
  export { CreateShipToAddressDetailsPage, CreateShipToAddressDetailsPageBreadcrumb } from './pages/my-sonic/pages/create-ship-to-address-details-page/create-ship-to-address-details-page.js';
278
281
  export { EditBillToAddressDetailsPage, EditBillToAddressDetailsPageBreadcrumb } from './pages/my-sonic/pages/edit-bill-to-address-details-page/edit-bill-to-address-details-page.js';
279
282
  export { EditShipToAddressDetailsPage, EditShipToAddressDetailsPageBreadcrumb } from './pages/my-sonic/pages/edit-ship-to-address-details-page/edit-ship-to-address-details-page.js';
280
283
  export { FavoritesPage, FavoritesPageBreadcrumb } from './pages/my-sonic/pages/favorites/favorites-page.js';
281
284
  export { MyAccountPage, MyAccountPageBreadcrumb } from './pages/my-sonic/pages/my-account/my-account-page.js';
282
285
  export { OrderDetailsContent, statusMap } from './pages/my-sonic/pages/order-details/order-details-content.js';
283
- export { OrderDetails } from './pages/my-sonic/pages/order-details/order-details-page.js';
286
+ export { OrderDetailsPage, OrderDetailsPageBreadcrumb } from './pages/my-sonic/pages/order-details/order-details-page.js';
284
287
  export { OrderHistoryPage, OrderHistoryPageBreadcrumb } from './pages/my-sonic/pages/order-history/order-history-page.js';
285
288
  export { AddressDataCard } from './pages/my-sonic/widgets/components/address-data-card.js';
286
289
  export { ConnectedAddressBookWidget } from './pages/my-sonic/widgets/connected-address-book-widget.js';
@@ -329,6 +332,8 @@ export { usePatchSession } from './shared/api/storefront/hooks/authentication/us
329
332
  export { useRecoverPassword } from './shared/api/storefront/hooks/authentication/use-recover-password.js';
330
333
  export { useSignIn } from './shared/api/storefront/hooks/authentication/use-sign-in.js';
331
334
  export { useSignOut } from './shared/api/storefront/hooks/authentication/use-sign-out.js';
335
+ export { useSignOutMutation } from './shared/api/storefront/hooks/authentication/use-sign-out-mutation.js';
336
+ export { useAddBulkProductsToCurrentCart } from './shared/api/storefront/hooks/cart/use-add-bulk-products-to-current-cart.js';
332
337
  export { useAddProductToCurrentCart } from './shared/api/storefront/hooks/cart/use-add-product-to-current-cart.js';
333
338
  export { useDeleteCartLineById } from './shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.js';
334
339
  export { useDeleteCurrentCart } from './shared/api/storefront/hooks/cart/use-delete-current-cart.js';
@@ -375,7 +380,7 @@ export { useFetchAllWishListsItems } from './shared/api/storefront/hooks/wishlis
375
380
  export { useFetchWishLists } from './shared/api/storefront/hooks/wishlist/use-fetch-wishlists.js';
376
381
  export { ExistingAccountError, createAccount, createGuestAccount, fetchCurrentAccount, patchCurrentAccount } from './shared/api/storefront/services/account-service.js';
377
382
  export { InvalidPasswordError, NonUniquePasswordError, createSession, fetchSession, patchSession, recoverPassword, signIn, signOut } from './shared/api/storefront/services/authentication-service.js';
378
- export { addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCartLineById, postAdyenPayment } from './shared/api/storefront/services/cart-service.js';
383
+ export { addBulkProductsToCurrentCart, addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCartLineById, postAdyenPayment } from './shared/api/storefront/services/cart-service.js';
379
384
  export { fetchBillToAddress, fetchBillToAddresses, fetchCurrentBillToAddress, fetchCurrentShipToAddress, fetchFulfillmentMethods, fetchPagedShipToAddresses, fetchShipToAddress, fetchShipToAddresses, patchBillToAddress, patchShipToAddress, postShipToAddress } from './shared/api/storefront/services/customer-service.js';
380
385
  export { validateVATNumber } from './shared/api/storefront/services/finance-service.js';
381
386
  export { fetchOrderById, fetchOrders } from './shared/api/storefront/services/order-service.js';
@@ -443,6 +448,7 @@ export { formatDate } from './shared/utils/date.js';
443
448
  export { trackPropertyChange } from './shared/utils/debug.js';
444
449
  export { environment, environments } from './shared/utils/environment.js';
445
450
  export { EventEmitter } from './shared/utils/event-emitter.js';
451
+ export { useGreeting } from './shared/utils/greeting.js';
446
452
  export { clone, deepMerge, isPlainObject, default as main, merge } from './shared/utils/merge.js';
447
453
  export { ensureNumber } from './shared/utils/number.js';
448
454
  export { formatCurrency, getCurrencyByCountryCode, parseCurrency } from './shared/utils/price.js';
@@ -452,7 +458,7 @@ export { multiRef } from './shared/utils/refs.js';
452
458
  export { scrollIntoViewRef, scrollToTop } from './shared/utils/scrolling.js';
453
459
  export { camelCase } from './shared/utils/string.js';
454
460
  export { TIME } from './shared/utils/time.js';
455
- export { has, hasNo } from './shared/utils/types.js';
461
+ export { has, hasNo, isObject } from './shared/utils/types.js';
456
462
  export { createUUID } from './shared/utils/uuid.js';
457
463
  export { Sidebar } from './sidebar/sidebar.js';
458
464
  export { SidebarDetectBreakpoint, SidebarProvider } from './sidebar/sidebar-provider.js';
@@ -1 +1 @@
1
- export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | 'Account' | 'active' | 'Add address' | 'Add order notes' | 'Add to cart' | 'Add to list' | 'Address 1' | 'Address 2' | 'Address 3' | 'Address 4' | 'Address not found' | 'Address' | 'Address book' | 'addressProperty.Default' | 'addressProperty.Company Name' | 'addressProperty.Address Line' | 'addressProperty.Postal Code' | 'addressProperty.City' | 'addressProperty.Country' | 'All payment methods are unavailable at this time. Please contact customer support.' | 'Amount: {0}' | 'An error occurred while changing the customer.' | 'An error occurred while fetching customers. Please try again later.' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'ASC' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | 'Back' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | 'Billing' | 'Cancel' | 'Cart' | 'Change customer' | 'Change password' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Checkout order' | 'Chosen filters' | 'City' | 'Clear filters' | 'Create' | 'Clear' | 'Click the button below to continue shopping.' | 'Client cases' | 'Close' | 'CoC number' | 'Company name' | 'Conceal value' | 'Confirm password' | 'Continue shopping' | 'Continue to sign in' | 'Continue' | 'Copyright © Sonic Equipment B.V.' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Current page' | 'Current Password is invalid' | 'Date' | 'Decrease' | 'Default shipping address' | 'Delivery date' | 'Delivery expected on {0}' | 'DESC' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Edit Sonic account' | 'Edit' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Favorites' | 'Features' | 'Filter order status' | 'Finalize order' | 'Finalize payment' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'Incl. VAT' | 'Includes' | 'Increase' | 'Industry' | 'industry.AG' | 'industry.AU' | 'industry.AV' | 'industry.BC' | 'industry.MA' | 'industry.MC' | 'industry.OT' | 'industry.PP' | 'industry.TR' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'Log out' | 'Main menu' | 'Make this the default customer' | 'Make this the default ship to address' | 'More than {0} articles' | 'My account' | 'My Sonic' | 'Name' | 'Navigate to...' | 'Navigation' | 'New list name' | 'New Password is required and must be different than Current Password' | 'New password' | 'New user?' | 'Next' | 'No countries available. Unable to change address.' | 'No orders found.' | 'No results found. Please refine your search.' | 'Number of favorites' | 'Number of products' | 'of' | 'OK' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order history' | 'Order number' | 'Order#' | 'Order' | 'orderProperty.Date' | 'orderProperty.Number' | 'orderProperty.PO Number' | 'orderProperty.Price' | 'orderProperty.Shipping Address' | 'orderProperty.Status' | 'Orders' | 'orderStatus.Any' | 'orderStatus.Cancelled' | 'orderStatus.ForwardToReseller' | 'orderStatus.Fulfilled' | 'orderStatus.Partially fulfilled' | 'orderStatus.Processing' | 'orderStatus.Saved' | 'orderStatus.Waiting for customer service' | 'Our products' | 'Overview' | 'Password changed. Please sign in again.' | 'Password does not meet requirements' | 'Password' | 'Passwords do not match' | 'Pay by invoice' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Previous' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove' | 'Remove all' | 'Reorder' | 'Requested delivery date' | 'Results' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved' | 'Saved cart for later.' | 'Saving' | 'Search for a customer' | 'Search' | 'Searching again using more general terms' | 'Search orders' | 'See all results' | 'Select a country' | 'Select a desired delivery date' | 'Select a language' | 'Select a list' | 'Select an industry' | 'Select other customer' | 'Selected customer' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Shopping cart' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'Sign in or create account' | 'sign in' | 'Sign me up for newsletters and product updates' | 'Signed in' | 'Signed out' | 'Signing in…' | 'Sonic account' | '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' | 'sort.ASC' | 'sort.DESC' | 'sort.NONE' | 'Specifications' | 'Start checkout' | 'Status' | 'Submenu' | 'Submit email address' | 'Submit' | 'Submitting…' | 'Subtotal' | 'Suggestions' | 'Support' | 'tag.limited' | 'tag.new' | 'The email address you entered is already associated with an existing account. Please sign in to this account or contact Customer Support.' | '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 more customers, please refine your search if needed.' | 'There are no products in your shopping cart.' | 'There is no information to display' | 'This email is already in use' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Username' | '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 are not authorized to access this information.' | 'You are not authorized to perform this action' | 'You are not authorized to view customers. Please log in or contact support.' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!' | 'You must ' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'Your cart has been emptied.' | 'Your email and password were not recognized.' | 'Your favorites are available on multiple devices' | 'Your new Sonic Equipment account was succesfully created. You should receive an email soon with further instructions on how to activate this account. If you do not receive this email, please contact Customer Support.' | 'Your shopping cart is still empty';
1
+ export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | 'Account' | 'active' | 'Add address' | 'Add order notes' | 'Add to cart' | 'Add to list' | 'Address 1' | 'Address 2' | 'Address 3' | 'Address 4' | 'Address not found' | 'Address' | 'Address book' | 'addressProperty.Default' | 'addressProperty.Company Name' | 'addressProperty.Address Line' | 'addressProperty.Postal Code' | 'addressProperty.City' | 'addressProperty.Country' | 'All payment methods are unavailable at this time. Please contact customer support.' | 'Amount: {0}' | 'An error occurred while changing the customer.' | 'An error occurred while fetching customers. Please try again later.' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'ASC' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | 'Back' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | 'Billing' | 'Cancel' | 'Cart' | 'Change customer' | 'Change password' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Checkout order' | 'Chosen filters' | 'City' | 'Clear filters' | 'Create' | 'Clear' | 'Click the button below to continue shopping.' | 'Client cases' | 'Close' | 'CoC number' | 'Company name' | 'Conceal value' | 'Confirm password' | 'Continue shopping' | 'Continue to sign in' | 'Continue' | 'Copyright © Sonic Equipment B.V.' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Current page' | 'Current Password is invalid' | 'Date' | 'Decrease' | 'Default shipping address' | 'Delivery date' | 'Delivery expected on {0}' | 'DESC' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Edit Sonic account' | 'Edit' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Favorites' | 'Features' | 'Filter order status' | 'Finalize order' | 'Finalize payment' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Good day' | 'Good morning' | 'Good afternoon' | 'Good evening' | 'Goodnight' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'Incl. VAT' | 'Includes' | 'Increase' | 'Industry' | 'industry.AG' | 'industry.AU' | 'industry.AV' | 'industry.BC' | 'industry.MA' | 'industry.MC' | 'industry.OT' | 'industry.PP' | 'industry.TR' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'Log out' | 'Main menu' | 'Make this the default customer' | 'Make this the default ship to address' | 'More than {0} articles' | 'My account' | 'My Sonic' | 'My Sonic menu' | 'Name' | 'Navigate to...' | 'Navigation' | 'New list name' | 'New Password is required and must be different than Current Password' | 'New password' | 'New user?' | 'Next' | 'No countries available. Unable to change address.' | 'No orders found.' | 'No results found. Please refine your search.' | 'Number of favorites' | 'Number of products' | 'of' | 'OK' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order details' | 'Order history' | 'Order number' | 'Order#' | 'Order' | 'orderProperty.Date' | 'orderProperty.Number' | 'orderProperty.PO Number' | 'orderProperty.Price' | 'orderProperty.Shipping Address' | 'orderProperty.Status' | 'Orders' | 'orderStatus.Any' | 'orderStatus.Cancelled' | 'orderStatus.ForwardToReseller' | 'orderStatus.Fulfilled' | 'orderStatus.Partially fulfilled' | 'orderStatus.Processing' | 'orderStatus.Saved' | 'orderStatus.Waiting for customer service' | 'Our products' | 'Overview' | 'Password changed. Please sign in again.' | 'Password does not meet requirements' | 'Password' | 'Passwords do not match' | 'Pay by invoice' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Previous' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove' | 'Remove all' | 'Reorder' | 'Reordering...' | 'Requested delivery date' | 'Results' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved' | 'Saved cart for later.' | 'Saving' | 'Search for a customer' | 'Search' | 'Searching again using more general terms' | 'Search orders' | 'See all results' | 'Select a country' | 'Select a desired delivery date' | 'Select a language' | 'Select a list' | 'Select an industry' | 'Select other customer' | 'Selected customer' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Shopping cart' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'Sign in or create account' | 'sign in' | 'Sign me up for newsletters and product updates' | 'Signed in' | 'Signed out' | 'Signing in…' | 'Sonic account' | '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' | 'sort.ASC' | 'sort.DESC' | 'sort.NONE' | 'Specifications' | 'Start checkout' | 'Status' | 'Submenu' | 'Submit email address' | 'Submit' | 'Submitting…' | 'Subtotal' | 'Suggestions' | 'Support' | 'tag.limited' | 'tag.new' | 'The email address you entered is already associated with an existing account. Please sign in to this account or contact Customer Support.' | '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.' | 'The order has been added to your cart.' | 'There are more customers, please refine your search if needed.' | 'There are no products in your shopping cart.' | 'There is no information to display' | 'This email is already in use' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to add the order to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Username' | '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 are not authorized to access this information.' | 'You are not authorized to perform this action' | 'You are not authorized to view customers. Please log in or contact support.' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!' | 'You must ' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'Your cart has been emptied.' | 'Your email and password were not recognized.' | 'Your favorites are available on multiple devices' | 'Your new Sonic Equipment account was succesfully created. You should receive an email soon with further instructions on how to activate this account. If you do not receive this email, please contact Customer Support.' | 'Your shopping cart is still empty';
@@ -6,7 +6,7 @@ import { SonicLogo } from '../../header/sonic-logo/sonic-logo.js';
6
6
  import { useFormattedMessage } from '../../intl/use-formatted-message.js';
7
7
  import { MenuList } from '../../lists/menu-list/menu-list.js';
8
8
  import { MenuListItem } from '../../lists/menu-list/menu-list-item.js';
9
- import { useFetchSession } from '../../shared/api/storefront/hooks/authentication/use-fetch-session.js';
9
+ import { useIsAuthenticated } from '../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
10
10
  import { useFetchCurrentCartCount } from '../../shared/api/storefront/hooks/cart/use-fetch-current-cart-count.js';
11
11
  import { usePaths } from '../../shared/routing/use-paths.js';
12
12
  import { AccountIcon } from '../account-icon/account-icon.js';
@@ -18,7 +18,7 @@ import styles from './mobile-navigation.module.css.js';
18
18
  function MobileNavigation({ id, isActive, linkItems, onActiveChange, }) {
19
19
  const t = useFormattedMessage();
20
20
  const paths = usePaths();
21
- const { data: { isAuthenticated } = {} } = useFetchSession();
21
+ const isAuthenticated = useIsAuthenticated();
22
22
  const cartCount = useFetchCurrentCartCount();
23
23
  return (jsxs("section", { "aria-label": t('Main menu'), className: clsx(styles['mobile-navigation'], isActive && styles['active']), "data-test-selector": "mobileNavigationMenu", id: id, children: [jsxs("header", { className: styles['header'], children: [jsx("div", { className: styles['logo'], role: "presentation", children: jsx(SonicLogo, {}) }), jsx("div", { className: styles['hamburger'], children: jsx(HamburgerButton, { "aria-controls": "mobile-navigation", "data-test-selector": "mobileNavigationHamburgerButton", isActive: isActive, onActiveChange: onActiveChange }) })] }), jsx(PanelNavigation, { allowBack: true, className: styles['panels'], "data-test-selector": "mobileNavigationPanel", isNarrow: true, linkItems: linkItems, variant: "primary", children: jsxs(MenuList, { header: { label: t('My Sonic') }, scrollable: false, children: [jsx(MenuListItem, { badge: jsx(AccountIcon, { isAuthenticated: isAuthenticated }), "data-authenticated": isAuthenticated ? true : false, "data-test-selector": "mobileNavigationAccountButton", href: paths.ACCOUNT, children: isAuthenticated ? t('My Sonic') : t('Sign in or create account') }), jsx(MenuListItem, { badge: jsx(FavoriteIcon, {}), "data-test-selector": "mobileNavigationFavoritesButton", href: paths.FAVORITES, children: t('Favorites') }), jsx(MenuListItem, { badge: jsx(CartIcon, { count: cartCount }), "data-count": cartCount, "data-test-selector": "mobileNavigationCartButton", href: paths.CART, children: t('Shopping cart') })] }) })] }));
24
24
  }
@@ -0,0 +1,8 @@
1
+ export interface QuickAccessMenuProps {
2
+ className?: string;
3
+ customerCompany?: string;
4
+ customerName?: string;
5
+ isAuthenticated?: boolean;
6
+ onSignOut?: () => void;
7
+ }
8
+ export declare function QuickAccessMenu({ className, customerCompany, customerName, isAuthenticated, onSignOut, }: QuickAccessMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
4
+ import { Button } from '../../buttons/button/button.js';
5
+ import { Link } from '../../buttons/link/link.js';
6
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
7
+ import { useMySonicNavigationItems, isMySonicNavigationLink } from '../../pages/my-sonic/navigation/my-sonic-navigation-items.js';
8
+ import { usePaths } from '../../shared/routing/use-paths.js';
9
+ import { useGreeting } from '../../shared/utils/greeting.js';
10
+ import { Truncated } from '../../text/truncated/truncated.js';
11
+ import styles from './quick-access-menu.module.css.js';
12
+
13
+ function QuickAccessMenu({ className, customerCompany, customerName, isAuthenticated, onSignOut, }) {
14
+ const t = useFormattedMessage();
15
+ const paths = usePaths();
16
+ const greeting = useGreeting();
17
+ const links = useMySonicNavigationItems().filter(item => isMySonicNavigationLink(item));
18
+ return (jsxs("section", { "aria-label": t('My Sonic menu'), className: clsx(styles['quick-access-menu'], className), "data-test-selector": "quickAccessMenu", children: [jsxs("header", { className: styles['header'], children: [jsx("h2", { className: styles['title'], "data-test-selector": "quickAccessMenuTitle", children: `${greeting}${customerName || customerCompany ? ',' : ''}` }), customerName && (jsx(Truncated, { className: styles['name'], "data-test-selector": "quickAccessMenuCustomerName", lines: 2, children: customerName })), customerCompany && (jsx(Truncated, { className: styles['company'], "data-test-selector": "quickAccessMenuCustomerCompany", lines: 2, children: customerCompany }))] }), isAuthenticated && (jsx("nav", { className: styles['navigation'], children: jsx("ul", { children: links.map(link => (jsx("li", { className: styles['item'], children: jsx(Link, { className: styles['link'], "data-test-selector": link['data-test-selector'], href: link.path, children: t(link.label) }) }, link.path))) }) })), jsxs("div", { className: styles['actions'], children: [isAuthenticated && (jsx(Button, { withArrow: true, "data-test-selector": "logoutButton", onClick: onSignOut, size: "sm", children: t('Log out') })), !isAuthenticated && (jsxs(Fragment, { children: [jsx(Button, { withArrow: true, "data-test-selector": "signInButton", href: paths.SIGN_IN, size: "sm", children: t('sign in') }), jsx(Button, { withArrow: true, color: "secondary", "data-test-selector": "createAccountButton", href: paths.ACCOUNT_CREATE, size: "sm", variant: "outline", children: t('create account') })] }))] })] }));
19
+ }
20
+
21
+ export { QuickAccessMenu };
@@ -0,0 +1,3 @@
1
+ var styles = {"quick-access-menu":"quick-access-menu-module-Hr2Dq","header":"quick-access-menu-module-wUIbQ","title":"quick-access-menu-module-7o1R6","company":"quick-access-menu-module-VtAXj","name":"quick-access-menu-module-7zAki","navigation":"quick-access-menu-module-IO03P","item":"quick-access-menu-module-Wm-UG","link":"quick-access-menu-module-8Qwjw","actions":"quick-access-menu-module-L-W3I"};
2
+
3
+ export { styles as default };
@@ -1,28 +1,15 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
- import Cookies from 'js-cookie';
4
- import { logger } from '../../../logging/logger.js';
5
3
  import { useSignOut } from '../../../shared/api/storefront/hooks/authentication/use-sign-out.js';
6
4
  import { useLocation } from '../../../shared/routing/use-location.js';
7
- import { useNavigate } from '../../../shared/routing/use-navigate.js';
8
- import { usePaths } from '../../../shared/routing/use-paths.js';
9
5
  import { MySonicDesktopNavigation } from './my-sonic-desktop-navigation.js';
10
6
  import { MySonicMobileNavigation } from './my-sonic-mobile-navigation.js';
11
7
  import styles from './connected-my-sonic-navigation.module.css.js';
12
8
 
13
9
  function ConnectedMySonicNavigation() {
14
- const paths = usePaths();
15
- const { pathname } = useLocation();
16
- const { navigate } = useNavigate();
17
- const { mutate } = useSignOut({
18
- onError: logger.error,
19
- onSuccess: () => {
20
- // TODO: Remove when Spire is deprecated
21
- Cookies.remove('NavigationMode');
22
- navigate(paths.HOME, { reload: true });
23
- },
24
- });
25
- return (jsxs("div", { style: { display: 'grid' }, children: [jsx(MySonicDesktopNavigation, { className: styles['large'], currentPath: pathname, onLogout: mutate }), jsx(MySonicMobileNavigation, { className: styles['small'], currentPath: pathname, onLogout: mutate })] }));
10
+ const { fullPathname } = useLocation();
11
+ const signOut = useSignOut();
12
+ return (jsxs("div", { style: { display: 'grid' }, children: [jsx(MySonicDesktopNavigation, { className: styles['large'], currentPath: fullPathname, onSignOut: signOut }), jsx(MySonicMobileNavigation, { className: styles['small'], currentPath: fullPathname, onSignOut: signOut })] }));
26
13
  }
27
14
 
28
15
  export { ConnectedMySonicNavigation };
@@ -1,7 +1,7 @@
1
1
  interface MySonicDesktopNavigationProps {
2
2
  className?: string;
3
3
  currentPath?: string;
4
- onLogout?: VoidFunction;
4
+ onSignOut?: VoidFunction;
5
5
  }
6
- export declare function MySonicDesktopNavigation({ className, currentPath, onLogout, }: MySonicDesktopNavigationProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function MySonicDesktopNavigation({ className, currentPath, onSignOut, }: MySonicDesktopNavigationProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -3,18 +3,20 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { FormattedMessage } from '../../../intl/formatted-message.js';
4
4
  import { MenuList } from '../../../lists/menu-list/menu-list.js';
5
5
  import { MenuListItem } from '../../../lists/menu-list/menu-list-item.js';
6
+ import { useLocation } from '../../../shared/routing/use-location.js';
6
7
  import { useMySonicNavigationItems } from './my-sonic-navigation-items.js';
7
8
  import styles from './my-sonic-desktop-navigation.module.css.js';
8
9
 
9
- function MySonicDesktopNavigation({ className, currentPath, onLogout, }) {
10
+ function MySonicDesktopNavigation({ className, currentPath, onSignOut, }) {
10
11
  const mySonicNavigationItems = useMySonicNavigationItems();
11
- return (jsx(MenuList, { collapsible: true, className: className, children: mySonicNavigationItems.map(item => (jsx(MenuListItem, { badge: jsx(item.Icon, {}), ...(item.type === 'action'
12
- ? item.action === 'logout'
13
- ? { onClick: onLogout }
12
+ const { basePathname } = useLocation();
13
+ return (jsx(MenuList, { collapsible: true, className: className, children: mySonicNavigationItems.map(item => (jsx(MenuListItem, { badge: jsx(item.Icon, {}), "data-test-selector": item['data-test-selector'], ...(item.type === 'action'
14
+ ? item.action === 'signout'
15
+ ? { onClick: onSignOut }
14
16
  : {}
15
17
  : {
16
18
  href: item.path,
17
- isSelected: currentPath?.toLowerCase() === item.path,
19
+ isSelected: currentPath === `${basePathname}${item.path}`,
18
20
  }), children: jsx("span", { className: styles['menu-list-item'], children: jsx(FormattedMessage, { id: item.label }) }) }, item.label))) }));
19
21
  }
20
22
 
@@ -1,5 +1,5 @@
1
- export declare function MySonicMobileNavigation({ className, currentPath, onLogout, }: {
1
+ export declare function MySonicMobileNavigation({ className, currentPath, onSignOut, }: {
2
2
  className?: string;
3
3
  currentPath?: string;
4
- onLogout: () => void;
4
+ onSignOut: () => void;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,23 +2,25 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { Select } from '../../../forms/elements/select/select.js';
4
4
  import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
5
+ import { useLocation } from '../../../shared/routing/use-location.js';
5
6
  import { useNavigate } from '../../../shared/routing/use-navigate.js';
6
7
  import { useMySonicNavigationItems } from './my-sonic-navigation-items.js';
7
8
 
8
- function MySonicMobileNavigation({ className, currentPath, onLogout, }) {
9
+ function MySonicMobileNavigation({ className, currentPath, onSignOut, }) {
9
10
  const mySonicNavigationItems = useMySonicNavigationItems();
11
+ const { basePathname } = useLocation();
10
12
  const { navigate } = useNavigate();
11
13
  const t = useFormattedMessage();
12
14
  return (jsx(Select, { className: className, label: t('Navigate to...'), onChange: option => {
13
- if (option === 'logout')
14
- return onLogout();
15
+ if (option === 'signout')
16
+ return onSignOut();
15
17
  return navigate(option);
16
18
  }, options: mySonicNavigationItems.reduce((options, item) => ({
17
19
  ...options,
18
20
  ...(item.type === 'link'
19
- ? { [item.path]: t(item.label) }
21
+ ? { [`${basePathname}${item.path}`]: t(item.label) }
20
22
  : { [item.action]: t(item.label) }),
21
- }), {}), selectedOption: currentPath?.toLowerCase() }));
23
+ }), {}), selectedOption: currentPath }));
22
24
  }
23
25
 
24
26
  export { MySonicMobileNavigation };
@@ -2,17 +2,20 @@ import { ComponentType } from 'react';
2
2
  import { TranslationId } from '../../../intl/translation-id';
3
3
  interface MySonicNavigationItemBase {
4
4
  Icon: ComponentType;
5
+ 'data-test-selector'?: string;
5
6
  label: TranslationId;
6
7
  type: 'link' | 'action';
7
8
  }
8
- interface MySonicNavigationLink extends MySonicNavigationItemBase {
9
- path: Lowercase<string>;
9
+ export interface MySonicNavigationLink extends MySonicNavigationItemBase {
10
+ path: string;
10
11
  type: 'link';
11
12
  }
13
+ export declare function isMySonicNavigationLink(item: unknown): item is MySonicNavigationLink;
12
14
  interface MySonicNavigationAction extends MySonicNavigationItemBase {
13
15
  action: string;
14
16
  type: 'action';
15
17
  }
18
+ export declare function isMySonicNavigationAction(item: unknown): item is MySonicNavigationLink;
16
19
  type MySonicNavigationItem = MySonicNavigationLink | MySonicNavigationAction;
17
20
  export declare function useMySonicNavigationItems(): MySonicNavigationItem[];
18
21
  export {};