@sonic-equipment/ui 216.0.0 → 218.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 (46) 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 +9 -3
  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 +2 -15
  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 +4 -4
  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 +3 -3
  25. package/dist/pages/my-sonic/navigation/my-sonic-navigation-items.d.ts +4 -1
  26. package/dist/pages/my-sonic/navigation/my-sonic-navigation-items.js +13 -2
  27. package/dist/pages/my-sonic/pages/order-details/order-details-content.d.ts +3 -1
  28. package/dist/pages/my-sonic/pages/order-details/order-details-content.js +2 -2
  29. package/dist/pages/my-sonic/pages/order-details/order-details-page.js +2 -1
  30. package/dist/pages/my-sonic/pages/order-history/order-history-page.js +4 -1
  31. package/dist/shared/api/storefront/hooks/authentication/use-sign-out-mutation.d.ts +5 -0
  32. package/dist/shared/api/storefront/hooks/authentication/use-sign-out-mutation.js +26 -0
  33. package/dist/shared/api/storefront/hooks/authentication/use-sign-out.d.ts +3 -5
  34. package/dist/shared/api/storefront/hooks/authentication/use-sign-out.js +15 -18
  35. package/dist/shared/api/storefront/hooks/cart/use-add-bulk-products-to-current-cart.d.ts +4 -0
  36. package/dist/shared/api/storefront/hooks/cart/use-add-bulk-products-to-current-cart.js +21 -0
  37. package/dist/shared/api/storefront/services/cart-service.d.ts +4 -0
  38. package/dist/shared/api/storefront/services/cart-service.js +13 -1
  39. package/dist/shared/utils/greeting.d.ts +1 -0
  40. package/dist/shared/utils/greeting.js +15 -0
  41. package/dist/shared/utils/price.d.ts +1 -0
  42. package/dist/shared/utils/price.js +3 -0
  43. package/dist/shared/utils/types.d.ts +1 -0
  44. package/dist/shared/utils/types.js +4 -1
  45. package/dist/styles.css +120 -12
  46. 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.MY_SONIC
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,7 +276,7 @@ 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';
@@ -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 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' | '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
10
  const { fullPathname } = 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: fullPathname, onLogout: mutate }), jsx(MySonicMobileNavigation, { className: styles['small'], currentPath: fullPathname, onLogout: mutate })] }));
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 {};
@@ -7,12 +7,12 @@ import { useLocation } from '../../../shared/routing/use-location.js';
7
7
  import { useMySonicNavigationItems } from './my-sonic-navigation-items.js';
8
8
  import styles from './my-sonic-desktop-navigation.module.css.js';
9
9
 
10
- function MySonicDesktopNavigation({ className, currentPath, onLogout, }) {
10
+ function MySonicDesktopNavigation({ className, currentPath, onSignOut, }) {
11
11
  const mySonicNavigationItems = useMySonicNavigationItems();
12
12
  const { basePathname } = useLocation();
13
- return (jsx(MenuList, { collapsible: true, className: className, children: mySonicNavigationItems.map(item => (jsx(MenuListItem, { badge: jsx(item.Icon, {}), ...(item.type === 'action'
14
- ? item.action === 'logout'
15
- ? { onClick: onLogout }
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 }
16
16
  : {}
17
17
  : {
18
18
  href: item.path,
@@ -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;
@@ -6,14 +6,14 @@ import { useLocation } from '../../../shared/routing/use-location.js';
6
6
  import { useNavigate } from '../../../shared/routing/use-navigate.js';
7
7
  import { useMySonicNavigationItems } from './my-sonic-navigation-items.js';
8
8
 
9
- function MySonicMobileNavigation({ className, currentPath, onLogout, }) {
9
+ function MySonicMobileNavigation({ className, currentPath, onSignOut, }) {
10
10
  const mySonicNavigationItems = useMySonicNavigationItems();
11
11
  const { basePathname } = useLocation();
12
12
  const { navigate } = useNavigate();
13
13
  const t = useFormattedMessage();
14
14
  return (jsx(Select, { className: className, label: t('Navigate to...'), onChange: option => {
15
- if (option === 'logout')
16
- return onLogout();
15
+ if (option === 'signout')
16
+ return onSignOut();
17
17
  return navigate(option);
18
18
  }, options: mySonicNavigationItems.reduce((options, item) => ({
19
19
  ...options,
@@ -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
+ export interface MySonicNavigationLink extends MySonicNavigationItemBase {
9
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 {};
@@ -4,35 +4,46 @@ import { SolidFavoriteIcon } from '../../../icons/solid/solid-favorite-icon.js';
4
4
  import { SolidLoginIcon } from '../../../icons/solid/solid-login-icon.js';
5
5
  import { SolidLogOutIcon } from '../../../icons/solid/solid-logout-icon.js';
6
6
  import { usePaths } from '../../../shared/routing/use-paths.js';
7
+ import { isObject } from '../../../shared/utils/types.js';
7
8
 
9
+ function isMySonicNavigationLink(item) {
10
+ return isObject(item) && 'type' in item && item.type === 'link';
11
+ }
12
+ function isMySonicNavigationAction(item) {
13
+ return isObject(item) && 'type' in item && item.type === 'action';
14
+ }
8
15
  function useMySonicNavigationItems() {
9
16
  const paths = usePaths();
10
17
  return [
11
18
  {
12
19
  Icon: SolidLoginIcon,
20
+ 'data-test-selector': 'accountLink',
13
21
  label: 'Account',
14
22
  path: paths.ACCOUNT,
15
23
  type: 'link',
16
24
  },
17
25
  {
18
26
  Icon: SolidFavoriteIcon,
27
+ 'data-test-selector': 'favoritesLink',
19
28
  label: 'Favorites',
20
29
  path: paths.ACCOUNT_MY_LISTS,
21
30
  type: 'link',
22
31
  },
23
32
  {
24
33
  Icon: SolidCartIcon,
34
+ 'data-test-selector': 'ordersLink',
25
35
  label: 'Orders',
26
36
  path: paths.ACCOUNT_ORDERS,
27
37
  type: 'link',
28
38
  },
29
39
  {
30
40
  Icon: SolidLogOutIcon,
31
- action: 'logout',
41
+ action: 'signout',
42
+ 'data-test-selector': 'logoutButton',
32
43
  label: 'Log out',
33
44
  type: 'action',
34
45
  },
35
46
  ];
36
47
  }
37
48
 
38
- export { useMySonicNavigationItems };
49
+ export { isMySonicNavigationAction, isMySonicNavigationLink, useMySonicNavigationItems };
@@ -1,8 +1,10 @@
1
+ import { ReactNode } from 'react';
1
2
  import { OrderModel } from '../../../../shared/api/storefront/model/storefront.model';
2
3
  import { StatusType } from '../../../../text/status-text/status-text';
3
4
  export type OrderDetailsContentProps = {
4
5
  order: OrderModel;
6
+ reorderButton: ReactNode;
5
7
  returnUrl?: string;
6
8
  };
7
9
  export declare const statusMap: Partial<Record<OrderModel['status'], StatusType>>;
8
- export declare function OrderDetailsContent({ order, returnUrl, }: OrderDetailsContentProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function OrderDetailsContent({ order, reorderButton, returnUrl, }: OrderDetailsContentProps): import("react/jsx-runtime").JSX.Element;
@@ -46,10 +46,10 @@ const getOrderShipToAddress = (order) => ({
46
46
  phone: '',
47
47
  postalCode: order.shipToPostalCode,
48
48
  });
49
- function OrderDetailsContent({ order, returnUrl, }) {
49
+ function OrderDetailsContent({ order, reorderButton, returnUrl, }) {
50
50
  const paths = usePaths();
51
51
  const status = statusMap[order.status];
52
- return (jsxs("div", { className: styles['order-details'], children: [jsxs("section", { className: styles['order-header'], children: [jsxs("div", { className: styles['order-header-info'], children: [jsxs(Heading, { size: "xxs", tag: "h2", children: [jsx(FormattedMessage, { id: "Order" }), " #", order.webOrderNumber] }), jsxs("div", { children: [jsx(FormattedMessage, { id: "Status" }), ":", ' ', jsx(StatusText, { "data-test-selector": "order-status", status: status, children: jsx(FormattedMessage, { noTranslationId: true, id: `orderStatus.${order.status}` }) })] })] }), jsx(PrintButton, {}), jsx(Button, { "data-test-selector": "reorder-button", children: jsx(FormattedMessage, { id: "Reorder" }) })] }), jsxs("section", { className: styles['order-additional-info'], children: [jsxs("dl", { children: [jsx("dt", { children: jsx(FormattedMessage, { id: "orderProperty.Date" }) }), jsx("dd", { children: jsx(FormattedDate, { date: order.orderDate }) })] }), jsxs("dl", { children: [jsx("dt", { children: jsx(FormattedMessage, { id: "orderProperty.PO Number" }) }), jsx("dd", { children: order.customerNumber })] })] }), jsx("section", { className: styles['order-billing-and-shipping'], children: jsx(BillingAndInvoiceInformation, { billToAddress: getOrderBillToAddress(order), shipToAddress: getOrderShipToAddress(order) }) }), jsx("section", { className: styles['order-top-button'], children: jsx(Button, { color: "secondary", href: returnUrl || paths.ACCOUNT_ORDERS, variant: "outline", children: jsx(FormattedMessage, { id: "Back" }) }) }), jsxs("section", { className: styles['order-line-list'], children: [jsx(Heading, { size: "xxs", tag: "h3", children: jsx(FormattedMessage, { id: "Products" }) }), jsx(OrderLineList, { children: order.orderLines?.map(line => (jsx(OrderLineCard, { isReadonly: true, href: line.productUri, image: {
52
+ return (jsxs("div", { className: styles['order-details'], children: [jsxs("section", { className: styles['order-header'], children: [jsxs("div", { className: styles['order-header-info'], children: [jsxs(Heading, { size: "xxs", tag: "h2", children: [jsx(FormattedMessage, { id: "Order" }), " #", order.webOrderNumber] }), jsxs("div", { children: [jsx(FormattedMessage, { id: "Status" }), ":", ' ', jsx(StatusText, { "data-test-selector": "order-status", status: status, children: jsx(FormattedMessage, { noTranslationId: true, id: `orderStatus.${order.status}` }) })] })] }), jsx(PrintButton, {}), reorderButton] }), jsxs("section", { className: styles['order-additional-info'], children: [jsxs("dl", { children: [jsx("dt", { children: jsx(FormattedMessage, { id: "orderProperty.Date" }) }), jsx("dd", { children: jsx(FormattedDate, { date: order.orderDate }) })] }), jsxs("dl", { children: [jsx("dt", { children: jsx(FormattedMessage, { id: "orderProperty.PO Number" }) }), jsx("dd", { children: order.customerPO })] })] }), jsx("section", { className: styles['order-billing-and-shipping'], children: jsx(BillingAndInvoiceInformation, { billToAddress: getOrderBillToAddress(order), shipToAddress: getOrderShipToAddress(order) }) }), jsx("section", { className: styles['order-top-button'], children: jsx(Button, { color: "secondary", href: returnUrl || paths.ACCOUNT_ORDERS, variant: "outline", children: jsx(FormattedMessage, { id: "Back" }) }) }), jsxs("section", { className: styles['order-line-list'], children: [jsx(Heading, { size: "xxs", tag: "h3", children: jsx(FormattedMessage, { id: "Products" }) }), jsx(OrderLineList, { children: order.orderLines?.map(line => (jsx(OrderLineCard, { isReadonly: true, href: line.productUri, image: {
53
53
  fit: 'contain',
54
54
  image: {
55
55
  '1': line.mediumImagePath,
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { Breadcrumb } from '../../../../breadcrumbs/breadcrumb.js';
4
+ import { ConnectedReorderButton } from '../../../../buttons/reorder-button/connected-reorder-button.js';
4
5
  import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
5
6
  import { useFetchOrderById } from '../../../../shared/api/storefront/hooks/orders/use-fetch-order-by-id.js';
6
7
  import { usePaths } from '../../../../shared/routing/use-paths.js';
@@ -22,7 +23,7 @@ function OrderDetailsPage({ orderId, returnUrl }) {
22
23
  if (!order) {
23
24
  return (jsx(ErrorPage, { error: new Error(`Order with ID ${orderId} not found. Please try again later.`) }));
24
25
  }
25
- return (jsx(MySonicLayoutPage, { "data-test-selector": "order-history", title: t('Order details'), children: jsx(OrderDetailsContent, { order: order, returnUrl: returnUrl }) }));
26
+ return (jsx(MySonicLayoutPage, { "data-test-selector": "order-history", title: t('Order details'), children: jsx(OrderDetailsContent, { order: order, reorderButton: jsx(ConnectedReorderButton, { orderId: orderId }), returnUrl: returnUrl }) }));
26
27
  }
27
28
  function OrderDetailsPageBreadcrumb({ orderId }) {
28
29
  const t = useFormattedMessage();
@@ -9,6 +9,7 @@ import { SearchField } from '../../../../forms/fields/search-field/search-field.
9
9
  import { SelectField } from '../../../../forms/fields/select-field/select-field.js';
10
10
  import { SolidCartIcon } from '../../../../icons/solid/solid-cart-icon.js';
11
11
  import { FormattedDate } from '../../../../intl/formatted-date.js';
12
+ import { FormattedMessage } from '../../../../intl/formatted-message.js';
12
13
  import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
13
14
  import { useIntl } from '../../../../intl/use-intl.js';
14
15
  import { DynamicLoadingOverlay } from '../../../../loading/dynamic-loading-overlay.js';
@@ -164,7 +165,9 @@ function OrderHistoryPage() {
164
165
  'data-test-selector': 'reorderButton',
165
166
  nowrap: true,
166
167
  },
167
- value: { action: 'reorder' },
168
+ value: {
169
+ render: order => (jsx(Link, { hasUnderline: true, color: "secondary", "data-test-selector": "order-history-order-link", href: `${paths.ACCOUNT_ORDERS}/${order.webOrderNumber}?returnUrl=${encodeURIComponent(`${paths.ACCOUNT_ORDERS}`)}`, children: jsx(FormattedMessage, { id: "Reorder" }) })),
170
+ },
168
171
  },
169
172
  ], data: orders, onSort: (key, direction) => {
170
173
  if (direction === 'NONE')
@@ -0,0 +1,5 @@
1
+ export interface UseSignOutArgs {
2
+ onError?: (error: Error) => void;
3
+ onSuccess?: VoidFunction;
4
+ }
5
+ export declare function useSignOutMutation(options?: UseSignOutArgs): import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { useQueryClient, useMutation } from '@tanstack/react-query';
3
+ import { UnauthorizedRequestError } from '../../../../fetch/request.js';
4
+ import { signOut } from '../../services/authentication-service.js';
5
+
6
+ function useSignOutMutation(options = {}) {
7
+ const queryClient = useQueryClient();
8
+ return useMutation({
9
+ ...options,
10
+ mutationFn: async () => {
11
+ try {
12
+ await signOut();
13
+ }
14
+ catch (error) {
15
+ if (error instanceof UnauthorizedRequestError)
16
+ return;
17
+ throw error;
18
+ }
19
+ finally {
20
+ queryClient.resetQueries();
21
+ }
22
+ },
23
+ });
24
+ }
25
+
26
+ export { useSignOutMutation };
@@ -1,5 +1,3 @@
1
- export interface UseSignOutArgs {
2
- onError?: (error: Error) => void;
3
- onSuccess?: VoidFunction;
4
- }
5
- export declare function useSignOut(options?: UseSignOutArgs): import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
1
+ export declare function useSignOut(options?: {
2
+ onSignOut?: VoidFunction;
3
+ }): import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
@@ -1,26 +1,23 @@
1
1
  "use client";
2
- import { useQueryClient, useMutation } from '@tanstack/react-query';
3
- import { UnauthorizedRequestError } from '../../../../fetch/request.js';
4
- import { signOut } from '../../services/authentication-service.js';
2
+ import Cookies from 'js-cookie';
3
+ import { logger } from '../../../../../logging/logger.js';
4
+ import { useNavigate } from '../../../../routing/use-navigate.js';
5
+ import { usePaths } from '../../../../routing/use-paths.js';
6
+ import { useSignOutMutation } from './use-sign-out-mutation.js';
5
7
 
6
8
  function useSignOut(options = {}) {
7
- const queryClient = useQueryClient();
8
- return useMutation({
9
- ...options,
10
- mutationFn: async () => {
11
- try {
12
- await signOut();
13
- }
14
- catch (error) {
15
- if (error instanceof UnauthorizedRequestError)
16
- return;
17
- throw error;
18
- }
19
- finally {
20
- queryClient.resetQueries();
21
- }
9
+ const { navigate } = useNavigate();
10
+ const paths = usePaths();
11
+ const { mutate } = useSignOutMutation({
12
+ onError: logger.error,
13
+ onSuccess: () => {
14
+ // TODO: Remove when Spire is deprecated
15
+ Cookies.remove('NavigationMode');
16
+ navigate(paths.HOME, { reload: true });
17
+ options.onSignOut?.();
22
18
  },
23
19
  });
20
+ return mutate;
24
21
  }
25
22
 
26
23
  export { useSignOut };
@@ -0,0 +1,4 @@
1
+ import { useMutation } from '@tanstack/react-query';
2
+ import { CartLineModel } from '../../model/storefront.model';
3
+ import { AddBulkProductsToCurrentCartParams } from '../../services/cart-service';
4
+ export declare function useAddBulkProductsToCurrentCart(options?: Parameters<typeof useMutation<CartLineModel[], Error, AddBulkProductsToCurrentCartParams>>[0]): import("@tanstack/react-query").UseMutationResult<CartLineModel[], Error, AddBulkProductsToCurrentCartParams, unknown>;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { useQueryClient, useMutation } from '@tanstack/react-query';
3
+ import { addBulkProductsToCurrentCart } from '../../services/cart-service.js';
4
+
5
+ function useAddBulkProductsToCurrentCart(options) {
6
+ const queryClient = useQueryClient();
7
+ return useMutation({
8
+ mutationFn: async (params) => {
9
+ const result = await addBulkProductsToCurrentCart(params);
10
+ queryClient.invalidateQueries({ queryKey: ['carts', 'current'] });
11
+ return result;
12
+ },
13
+ onError: (error, variables, context) => {
14
+ queryClient.invalidateQueries({ queryKey: ['carts', 'current'] });
15
+ options?.onError?.(error, variables, context);
16
+ },
17
+ ...options,
18
+ });
19
+ }
20
+
21
+ export { useAddBulkProductsToCurrentCart };
@@ -21,7 +21,11 @@ export interface AddProductToCurrentCartParams {
21
21
  qtyOrdered: number;
22
22
  unitOfMeasure: string;
23
23
  }
24
+ export interface AddBulkProductsToCurrentCartParams {
25
+ cartLines: AddProductToCurrentCartParams[];
26
+ }
24
27
  export declare function addProductToCurrentCart(productOrderData: AddProductToCurrentCartParams): Promise<ShopCartLineModel>;
28
+ export declare function addBulkProductsToCurrentCart(params: AddBulkProductsToCurrentCartParams): Promise<ShopCartLineModel[]>;
25
29
  export declare function fetchCurrentCartProductAtp(): Promise<ProductAtp[]>;
26
30
  export declare function fetchCurrentCheckoutAtp(): Promise<CheckoutAtpEntry[]>;
27
31
  export declare function postAdyenPayment({ currencyCode, data, orderAmount, returnUrl, webOrderNumber, }: {
@@ -67,6 +67,18 @@ async function addProductToCurrentCart(productOrderData) {
67
67
  });
68
68
  return body;
69
69
  }
70
+ async function addBulkProductsToCurrentCart(params) {
71
+ const { body } = await request({
72
+ body: JSON.stringify(params),
73
+ credentials: 'include',
74
+ headers: {
75
+ 'Content-Type': 'application/json',
76
+ },
77
+ method: 'POST',
78
+ url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines/batch`,
79
+ });
80
+ return body;
81
+ }
70
82
  async function fetchCurrentCartProductAtp() {
71
83
  const { body } = await request({
72
84
  credentials: 'include',
@@ -152,4 +164,4 @@ function convertToMinorUnits(value, currencyCode) {
152
164
  return Math.round(valueInMinorUnits);
153
165
  }
154
166
 
155
- export { addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCartLineById, postAdyenPayment };
167
+ export { addBulkProductsToCurrentCart, addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCartLineById, postAdyenPayment };
@@ -0,0 +1 @@
1
+ export declare function useGreeting(): string;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
3
+
4
+ const greetings = [
5
+ 'Goodnight',
6
+ 'Good morning',
7
+ 'Good afternoon',
8
+ 'Good evening',
9
+ ];
10
+ function useGreeting() {
11
+ const t = useFormattedMessage();
12
+ return t(greetings[Math.trunc(new Date().getHours() / 6)] || 'Good day');
13
+ }
14
+
15
+ export { useGreeting };
@@ -3,6 +3,7 @@ type NumberFormatPartTypes = ReturnType<Intl.NumberFormat['formatToParts']>[0]['
3
3
  interface ParcedCurrencyResult extends Partial<Record<NumberFormatPartTypes, string>> {
4
4
  integers?: string[];
5
5
  parts: Intl.NumberFormatPart[];
6
+ symbolPosition: 'before' | 'after';
6
7
  }
7
8
  export declare function parseCurrency({ currencyCode, locale, price, }: {
8
9
  currencyCode: string;
@@ -18,6 +18,9 @@ function parseCurrency({ currencyCode, locale, price, }) {
18
18
  ...namedParts,
19
19
  integer: namedParts.integers?.join(namedParts.group),
20
20
  parts,
21
+ symbolPosition: parts.findIndex(part => part.type === 'currency') === parts.length - 1
22
+ ? 'after'
23
+ : 'before',
21
24
  };
22
25
  }
23
26
  function formatCurrency({ currencyCode, locale, price, replaceNonBreakingSpace = false, }) {
@@ -1,3 +1,4 @@
1
1
  export type NoValue = null | undefined | '';
2
2
  export declare function has<T>(obj: T | undefined): obj is Exclude<T, NoValue>;
3
3
  export declare function hasNo<T>(obj: T | NoValue): obj is NoValue;
4
+ export declare function isObject(item: unknown): item is object;
@@ -4,5 +4,8 @@ function has(obj) {
4
4
  function hasNo(obj) {
5
5
  return obj === undefined || obj === null || obj === '';
6
6
  }
7
+ function isObject(item) {
8
+ return Boolean(item) && typeof item === 'object';
9
+ }
7
10
 
8
- export { has, hasNo };
11
+ export { has, hasNo, isObject };
package/dist/styles.css CHANGED
@@ -240,6 +240,7 @@
240
240
  --search-layer: 200;
241
241
  --modal-layer: 2000;
242
242
  --zoom-image-layer: 2100;
243
+ --popover-layer: 100000;
243
244
  }
244
245
  :root {
245
246
  --search-input-height: 76px;
@@ -1106,8 +1107,13 @@ html {
1106
1107
 
1107
1108
  .button-module-V4meK .button-module-XaNWz {
1108
1109
  display: block;
1109
- width: 24px;
1110
- height: 24px;
1110
+ width: 1.5em;
1111
+ height: 1.5em;
1112
+ }
1113
+
1114
+ .button-module-V4meK .button-module-ydQAo {
1115
+ block-size: 0.7em;
1116
+ inline-size: 0.7em;
1111
1117
  }
1112
1118
 
1113
1119
  .button-module-V4meK.button-module-LwuW2,
@@ -1218,7 +1224,6 @@ html {
1218
1224
 
1219
1225
  .button-module-tmyk8 .button-module-ydQAo {
1220
1226
  color: var(--color-brand-white);
1221
- transform: translateY(-1px);
1222
1227
  }
1223
1228
 
1224
1229
  .button-module-tmyk8:where([data-disabled]):where(:not(.button-module-U5IxM, .button-module-LwuW2)) {
@@ -2047,16 +2052,17 @@ html {
2047
2052
  .badge-module-X5Au9 {
2048
2053
  --shadow-color: 48 209 88;
2049
2054
  --animation-duration: 1000ms;
2055
+ --size: 16px;
2050
2056
 
2051
2057
  display: flex;
2052
- min-width: 16px;
2053
- height: 16px;
2054
2058
  box-sizing: border-box;
2055
2059
  align-items: center;
2056
2060
  justify-content: center;
2057
2061
  padding: var(--space-4);
2058
2062
  border: 1px solid var(--color-white);
2059
- border-radius: var(--border-radius-8);
2063
+ border-radius: calc(var(--size) / 2);
2064
+ block-size: var(--size);
2065
+ min-inline-size: var(--size);
2060
2066
  }
2061
2067
 
2062
2068
  .badge-module-X5Au9 .badge-module-ododp {
@@ -2066,6 +2072,7 @@ html {
2066
2072
  color: var(--color-white);
2067
2073
  font-size: var(--font-size-8);
2068
2074
  font-weight: var(--font-weight-bold);
2075
+ line-height: 1;
2069
2076
  }
2070
2077
 
2071
2078
  .badge-module-X5Au9:where(.badge-module-Q03Go) {
@@ -2904,7 +2911,7 @@ html {
2904
2911
  font-size: var(--font-size, 1em);
2905
2912
  font-style: var(--font-style, inherit);
2906
2913
  font-weight: var(--font-weight, inherit);
2907
- grid-template-areas: 'symbol number';
2914
+ grid-template-columns: repeat(2, minmax(0, min-content));
2908
2915
  line-height: var(--line-height, inherit);
2909
2916
  vertical-align: baseline;
2910
2917
  white-space: nowrap;
@@ -2917,14 +2924,12 @@ html {
2917
2924
  .price-module-Qyyas .price-module--Oil0 {
2918
2925
  font-size: var(--font-size-symbol);
2919
2926
  font-weight: var(--font-weight-symbol);
2920
- grid-area: symbol;
2921
2927
  justify-self: flex-end;
2922
2928
  margin-block-start: var(--margin-block-symbol);
2923
2929
  margin-inline-end: var(--margin-inline-symbol);
2924
2930
  }
2925
2931
  .price-module-Qyyas .price-module-QnS4t {
2926
2932
  display: inline-flex;
2927
- grid-area: number;
2928
2933
  }
2929
2934
  .price-module-Qyyas .price-module-p8hAn {
2930
2935
  font-size: var(--font-size-fraction);
@@ -2940,9 +2945,9 @@ html {
2940
2945
  --font-weight: var(--font-weight-black);
2941
2946
  --font-weight-symbol: var(--font-weight-medium);
2942
2947
  --line-height: 1;
2943
- --margin-block-fraction: 0.05em;
2944
- --margin-block-symbol: 0.1em;
2945
- --margin-inline-fraction: -0.35em;
2948
+ --margin-block-fraction: 0.075em;
2949
+ --margin-block-symbol: 0.075em;
2950
+ --margin-inline-fraction: -0.3em;
2946
2951
  --margin-inline-symbol: 0.05em;
2947
2952
  }
2948
2953
  .price-module-Qyyas.price-module-vUbWV .price-module-9HAVF {
@@ -3066,6 +3071,13 @@ html {
3066
3071
  .price-module-tbuNk:where(.price-module-vUbWV) .price-module-uVTD7 {
3067
3072
  grid-column: 1 / -1;
3068
3073
  }
3074
+ .price-module-tbuNk:where(.price-module-vUbWV):has(.price-module-SkIMi) {
3075
+ justify-content: start;
3076
+ grid-template-columns: 1fr minmax(0, min-content);
3077
+ }
3078
+ .price-module-tbuNk:where(.price-module-vUbWV):has(.price-module-SkIMi) .price-module-x77Vd {
3079
+ grid-template-columns: auto auto;
3080
+ }
3069
3081
 
3070
3082
  .product-sku-module-ITb8x {
3071
3083
  all: unset;
@@ -6034,6 +6046,102 @@ button.swiper-pagination-bullet {
6034
6046
  transform: translateY(-100%);
6035
6047
  }
6036
6048
 
6049
+ .quick-access-menu-module-Hr2Dq {
6050
+ --size-vp: calc(100svh - var(--space-16) * 2);
6051
+ --size: min-content;
6052
+ --size-min: 224px;
6053
+ --size-max: min(var(--size-vp), 350px);
6054
+
6055
+ display: flex;
6056
+ box-sizing: border-box;
6057
+ flex-direction: column;
6058
+ padding: var(--space-12) var(--space-16);
6059
+ border: 1px solid var(--color-brand-medium-gray);
6060
+ border-radius: var(--border-radius-22);
6061
+ background: var(--color-white);
6062
+ box-shadow: 0 0 96px #0000004c;
6063
+ font-family: var(--font-family-sonic);
6064
+ font-size: var(--font-size-base);
6065
+ inline-size: var(--size);
6066
+ line-height: var(--line-height-base);
6067
+ max-inline-size: var(--size-max);
6068
+ min-inline-size: var(--size-min);
6069
+ }
6070
+
6071
+ .quick-access-menu-module-Hr2Dq > * {
6072
+ box-sizing: border-box;
6073
+ }
6074
+
6075
+ .quick-access-menu-module-Hr2Dq .quick-access-menu-module-wUIbQ {
6076
+ display: flex;
6077
+ overflow: hidden;
6078
+ flex-flow: row wrap;
6079
+ padding: var(--space-8);
6080
+ border-block-end: 1px solid var(--color-brand-light-gray);
6081
+ gap: 0 0.25em;
6082
+ line-height: 1.2;
6083
+ }
6084
+
6085
+ .quick-access-menu-module-Hr2Dq .quick-access-menu-module-wUIbQ .quick-access-menu-module-7o1R6 {
6086
+ font: inherit;
6087
+ font-weight: var(--font-weight-bold);
6088
+ }
6089
+
6090
+ .quick-access-menu-module-Hr2Dq .quick-access-menu-module-wUIbQ:has(> .quick-access-menu-module-VtAXj) .quick-access-menu-module-7zAki {
6091
+ flex-basis: 100%;
6092
+ }
6093
+
6094
+ .quick-access-menu-module-Hr2Dq .quick-access-menu-module-wUIbQ .quick-access-menu-module-7zAki + .quick-access-menu-module-VtAXj {
6095
+ flex-basis: 100%;
6096
+ color: var(--color-brand-dark-gray);
6097
+ }
6098
+
6099
+ .quick-access-menu-module-Hr2Dq .quick-access-menu-module-IO03P ul {
6100
+ display: flex;
6101
+ flex-direction: column;
6102
+ padding: 0;
6103
+ margin: 0;
6104
+ list-style: none;
6105
+ }
6106
+
6107
+ .quick-access-menu-module-Hr2Dq .quick-access-menu-module-IO03P .quick-access-menu-module-Wm-UG {
6108
+ border-block-end: 1px solid var(--color-brand-light-gray);
6109
+ }
6110
+
6111
+ .quick-access-menu-module-Hr2Dq .quick-access-menu-module-IO03P .quick-access-menu-module-8Qwjw {
6112
+ display: block;
6113
+ padding: var(--space-8);
6114
+ }
6115
+
6116
+ .quick-access-menu-module-Hr2Dq .quick-access-menu-module-L-W3I {
6117
+ display: flex;
6118
+ flex-direction: column;
6119
+ gap: var(--space-8);
6120
+ margin-block-start: var(--space-24);
6121
+ }
6122
+
6123
+ .connected-account-button-module-d7qyN {
6124
+ z-index: var(--popover-layer) !important;
6125
+ max-height: none !important;
6126
+ outline: 0;
6127
+ transition: opacity var(--transition-duration-short);
6128
+ }
6129
+
6130
+ .connected-account-button-module-d7qyN[data-entering],
6131
+ .connected-account-button-module-d7qyN[data-exiting] {
6132
+ opacity: 0;
6133
+ }
6134
+
6135
+ @media (width < 576px) {.connected-account-button-module-d7qyN {
6136
+ margin: auto;
6137
+ block-size: -moz-fit-content;
6138
+ block-size: fit-content;
6139
+ inline-size: -moz-fit-content;
6140
+ inline-size: fit-content;
6141
+ inset: 0 !important
6142
+ }
6143
+ }
6144
+
6037
6145
  .hamburger-button-module-W6FPI {
6038
6146
  --size: 24px;
6039
6147
  --duration: var(--transition-duration-short);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "216.0.0",
3
+ "version": "218.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {