@sonic-equipment/ui 186.0.0 → 188.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 (47) hide show
  1. package/dist/collapsables/accordion/accordion-item.js +2 -1
  2. package/dist/collapsables/accordion/accordion.module.css.js +1 -1
  3. package/dist/exports.d.ts +1 -0
  4. package/dist/footer/connected-footer.d.ts +2 -1
  5. package/dist/footer/connected-footer.js +9 -2
  6. package/dist/footer/footer.d.ts +6 -10
  7. package/dist/footer/footer.js +24 -18
  8. package/dist/footer/footer.module.css.js +1 -1
  9. package/dist/header/connected-header.js +9 -1
  10. package/dist/header/drawers/desktop-navigation-drawer.d.ts +3 -3
  11. package/dist/header/drawers/desktop-navigation-drawer.js +2 -4
  12. package/dist/header/drawers/mobile-navigation-drawer.d.ts +3 -3
  13. package/dist/header/drawers/mobile-navigation-drawer.js +2 -2
  14. package/dist/header/header.d.ts +3 -3
  15. package/dist/header/header.js +15 -9
  16. package/dist/header/link-list/navigation-link-list.d.ts +5 -5
  17. package/dist/header/link-list/navigation-link-list.js +10 -5
  18. package/dist/index.js +1 -0
  19. package/dist/intl/translation-id.d.ts +1 -1
  20. package/dist/lists/menu-list/menu-list-header.d.ts +1 -1
  21. package/dist/lists/menu-list/menu-list-item.d.ts +2 -2
  22. package/dist/lists/menu-list/menu-list-item.js +1 -1
  23. package/dist/lists/menu-list/menu-list.d.ts +6 -4
  24. package/dist/lists/menu-list/menu-list.js +3 -3
  25. package/dist/media/image-lightbox/image-lightbox.js +12 -2
  26. package/dist/media/zoom-image/zoom-image.js +6 -1
  27. package/dist/navigation/mobile-navigation/mobile-navigation.d.ts +3 -3
  28. package/dist/navigation/mobile-navigation/mobile-navigation.js +2 -2
  29. package/dist/navigation/panel-navigation/panel-navigation.d.ts +5 -7
  30. package/dist/navigation/panel-navigation/panel-navigation.js +11 -14
  31. package/dist/pages/checkout/payment-page/components/adyen-payment.js +8 -2
  32. package/dist/pages/checkout/payment-page/components/payment.d.ts +1 -2
  33. package/dist/pages/checkout/payment-page/components/payment.js +2 -75
  34. package/dist/pages/checkout/payment-page/payment-page-content.d.ts +1 -3
  35. package/dist/pages/checkout/payment-page/payment-page-content.js +3 -3
  36. package/dist/pages/checkout/payment-page/payment-page.js +1 -2
  37. package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +1 -1
  38. package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.module.css.js +1 -1
  39. package/dist/shared/api/bff/hooks/use-fetch-navigation-links.d.ts +1 -1
  40. package/dist/shared/api/bff/model/bff.model.d.ts +22 -14
  41. package/dist/shared/api/bff/model/bff.model.js +11 -0
  42. package/dist/shared/api/bff/services/bff-service.d.ts +2 -2
  43. package/dist/shared/api/bff/services/bff-service.js +1 -1
  44. package/dist/shared/data/navigation.d.ts +2 -0
  45. package/dist/shared/data/navigation.js +2605 -0
  46. package/dist/styles.css +1549 -1481
  47. package/package.json +1 -1
@@ -6,6 +6,7 @@ import { GlyphsChevronsBoldDownIcon } from '../../icons/glyph/glyphs-chevrons-bo
6
6
  import { GlyphsChevronsSlimDownIcon } from '../../icons/glyph/glyphs-chevrons-slim-down-icon.js';
7
7
  import { useDisclosure } from '../../shared/hooks/use-disclosure.js';
8
8
  import { ensureArray } from '../../shared/utils/array.js';
9
+ import { Heading } from '../../typography/heading/heading.js';
9
10
  import styles from './accordion.module.css.js';
10
11
 
11
12
  function AccordionItem({ _pseudo = 'none', allowCollapse = true, allowToggle = true, borderType = 'bottom', children, className, 'data-test-selector': dataTestSelector, id, initialIsOpen = false, isDisabled = false, size, title, }) {
@@ -23,7 +24,7 @@ function AccordionItem({ _pseudo = 'none', allowCollapse = true, allowToggle = t
23
24
  [styles['is-open']]: isOpen,
24
25
  [styles['allow-collapse']]: allowCollapse,
25
26
  [styles['allow-toggle']]: allowCollapse && allowToggle,
26
- }), "data-test-selector": dataTestSelector, children: [jsx("h3", { children: allowCollapse ? (jsxs("button", { "aria-controls": panelId, "aria-expanded": isOpen, className: clsx(styles.button, styles[_pseudo]), disabled: isDisabled, id: id, onClick: () => {
27
+ }), "data-test-selector": dataTestSelector, children: [jsx(Heading, { className: styles.heading, tag: "h3", children: allowCollapse ? (jsxs("button", { "aria-controls": panelId, "aria-expanded": isOpen, className: clsx(styles.button, styles[_pseudo]), disabled: isDisabled, id: id, onClick: () => {
27
28
  if (allowToggle)
28
29
  toggle();
29
30
  }, tabIndex: allowToggle ? 0 : -1, type: "button", children: [title, jsx("span", { className: styles.icon, children: size === 'lg' ? (jsx(GlyphsChevronsBoldDownIcon, {})) : (jsx(GlyphsChevronsSlimDownIcon, {})) })] })) : (jsx("span", { className: styles.button, children: title })) }), jsx("div", { "aria-labelledby": id, className: styles.panel, id: panelId, role: "region", children: jsx("div", { className: styles.content, children: children }) })] }));
@@ -1,3 +1,3 @@
1
- var styles = {"accordion":"accordion-module-9WvAH","indented":"accordion-module-6CcEH","white":"accordion-module-CaVdG","accordion-item":"accordion-module-lf9d-","lg":"accordion-module-0qnae","with-seperators":"accordion-module-yOLrW","button":"accordion-module--Rwpb","icon":"accordion-module-Y50uq","focus":"accordion-module-M4BZs","allow-toggle":"accordion-module-QEO2d","panel":"accordion-module-KZjMo","content":"accordion-module-ejMH3","border-type-bottom":"accordion-module-oTdZK","border-type-top":"accordion-module-0mrLq","border-type-middle":"accordion-module-aAr-R","is-open":"accordion-module-W0F1z","border-type-middle-accentuated":"accordion-module-OB98a","select":"accordion-module-SAbiG","disabled":"accordion-module-ogvYX"};
1
+ var styles = {"accordion":"accordion-module-9WvAH","indented":"accordion-module-6CcEH","white":"accordion-module-CaVdG","accordion-item":"accordion-module-lf9d-","lg":"accordion-module-0qnae","with-seperators":"accordion-module-yOLrW","heading":"accordion-module-d-B4T","button":"accordion-module--Rwpb","icon":"accordion-module-Y50uq","focus":"accordion-module-M4BZs","allow-toggle":"accordion-module-QEO2d","panel":"accordion-module-KZjMo","content":"accordion-module-ejMH3","border-type-bottom":"accordion-module-oTdZK","border-type-top":"accordion-module-0mrLq","border-type-middle":"accordion-module-aAr-R","is-open":"accordion-module-W0F1z","border-type-middle-accentuated":"accordion-module-OB98a","select":"accordion-module-SAbiG","disabled":"accordion-module-ogvYX"};
2
2
 
3
3
  export { styles as default };
package/dist/exports.d.ts CHANGED
@@ -352,6 +352,7 @@ export * from './shared/api/storefront/services/website-service';
352
352
  export * from './shared/api/storefront/services/wishlist-service';
353
353
  export * from './shared/data/cart.data';
354
354
  export * from './shared/data/countries-languages.data';
355
+ export * from './shared/data/navigation';
355
356
  export * from './shared/feature-flags/use-feature-flags';
356
357
  export * from './shared/fetch/request';
357
358
  export * from './shared/ga/data-layer';
@@ -1,6 +1,7 @@
1
1
  import { OnCountryLanguageChangeHandler } from '../country-selector/connected-country-selector';
2
2
  import { NavigationLinkSource } from '../shared/api/bff/services/bff-service';
3
- export declare function ConnectedFooter({ onCountryLanguageChange, source, }: {
3
+ export declare function ConnectedFooter({ className, onCountryLanguageChange, source, }: {
4
+ className?: string;
4
5
  onCountryLanguageChange: OnCountryLanguageChangeHandler;
5
6
  source: NavigationLinkSource;
6
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,21 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { ConnectedCountrySelector } from '../country-selector/connected-country-selector.js';
4
+ import { FormattedMessage } from '../intl/formatted-message.js';
4
5
  import { useCultureCode } from '../intl/use-culture-code.js';
5
6
  import { useFetchNavigationLinks } from '../shared/api/bff/hooks/use-fetch-navigation-links.js';
7
+ import { isNavigationSection } from '../shared/api/bff/model/bff.model.js';
6
8
  import { Footer } from './footer.js';
7
9
 
8
- function ConnectedFooter({ onCountryLanguageChange, source, }) {
10
+ function ConnectedFooter({ className, onCountryLanguageChange, source, }) {
9
11
  const cultureCode = useCultureCode();
10
12
  const { data } = useFetchNavigationLinks({ cultureCode, source });
11
- return (jsx(Footer, { bottomLinks: data?.footer.bottomLinks || [], copyright: data?.footer.copyright || '', countrySelector: jsx(ConnectedCountrySelector, { defaultCountryCode: "NL", defaultLanguageCode: "EN", onChange: onCountryLanguageChange }), linkBlocks: data?.footer.linkBlocks || [] }));
13
+ if (data && data.key !== 'navigation')
14
+ throw new Error('Invalid navigation data');
15
+ const footerNavigationSection = data?.items
16
+ .filter(isNavigationSection)
17
+ .find(item => item.key === 'footer');
18
+ return (jsx(Footer, { className: className, copyright: jsx(FormattedMessage, { id: "Copyright \u00A9 Sonic Equipment B.V." }), countrySelector: jsx(ConnectedCountrySelector, { defaultCountryCode: "NL", defaultLanguageCode: "EN", onChange: onCountryLanguageChange }), footerNavigationSection: footerNavigationSection }));
12
19
  }
13
20
 
14
21
  export { ConnectedFooter };
@@ -1,13 +1,9 @@
1
1
  import { ReactNode } from 'react';
2
- import { NavigationLink } from '../shared/api/bff/model/bff.model';
3
- export interface FooterBottomSectionProps {
4
- bottomLinks: NavigationLink[];
5
- copyright: string;
2
+ import { NavigationSection } from '../shared/api/bff/model/bff.model';
3
+ export interface FooterProps {
4
+ className?: string;
5
+ copyright: ReactNode;
6
6
  countrySelector: ReactNode;
7
+ footerNavigationSection: NavigationSection | undefined;
7
8
  }
8
- export interface FooterLinkBlockProps {
9
- linkBlocks: NavigationLink[];
10
- }
11
- export interface FooterProps extends FooterBottomSectionProps, FooterLinkBlockProps {
12
- }
13
- export declare function Footer({ bottomLinks, copyright, countrySelector, linkBlocks, }: FooterProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function Footer({ className, copyright, countrySelector, footerNavigationSection, }: FooterProps): import("react/jsx-runtime").JSX.Element;
@@ -1,35 +1,41 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
3
4
  import { Link } from '../buttons/link/link.js';
4
5
  import { Accordion } from '../collapsables/accordion/accordion.js';
5
6
  import { AccordionItem } from '../collapsables/accordion/accordion-item.js';
6
- import { logger } from '../logging/logger.js';
7
+ import { isNavigationSection, isNavigationLinkItem, isNavigationLink } from '../shared/api/bff/model/bff.model.js';
7
8
  import { useIsBreakpoint } from '../shared/hooks/use-is-breakpoint.js';
8
9
  import styles from './footer.module.css.js';
9
10
 
10
- function BottomSection({ bottomLinks, copyright, countrySelector, }) {
11
- return (jsxs("div", { className: styles['bottom-section'], children: [copyright && jsx("p", { className: styles.copyright, children: copyright }), bottomLinks.length > 0 && (jsx("div", { className: styles['bottom-links'], children: bottomLinks.map(link => (jsx(Link, { className: styles['bottom-link'], href: link.url, target: link.openInNewTab ? '_blank' : undefined, children: link.title }, link.key))) })), countrySelector] }));
11
+ function BottomSection({ copyright, countrySelector, footerBottomSection, }) {
12
+ if (!footerBottomSection)
13
+ return null;
14
+ const links = footerBottomSection.items.filter(isNavigationLink);
15
+ return (jsxs("section", { className: styles['bottom-section'], children: [copyright && jsx("p", { className: styles.copyright, children: copyright }), footerBottomSection.items.length > 0 && (jsx("ul", { className: styles['bottom-links'], children: links.map(link => (jsx(Link, { className: styles['bottom-link'], href: link.href || undefined, target: link.openInNewTab ? '_blank' : undefined, children: link.label }, link.key))) })), countrySelector && (jsx("div", { className: styles['country-selector'], children: countrySelector }))] }));
12
16
  }
13
- function LinkSection({ link }) {
17
+ function LinkSection({ linkGroup }) {
14
18
  const isXl = useIsBreakpoint('xl');
15
- return (jsx("div", { className: styles['link-block'], children: jsx(Accordion, { color: "white", hasLineSeparator: false, size: "lg", children: jsx(AccordionItem, { allowCollapse: !isXl, id: `link-block-${link.key}`, initialIsOpen: isXl, title: link.title, children: jsx("ul", { className: styles['list'], children: link.links?.map(link => jsx(FooterLink, { link: link }, link.key)) }) }) }) }, link.key));
19
+ return (jsx("section", { className: styles['link-block'], children: jsx(Accordion, { color: "white", hasLineSeparator: false, size: "lg", children: jsx(AccordionItem, { allowCollapse: !isXl, id: `link-block-${linkGroup.key}`, initialIsOpen: isXl, title: linkGroup.header || linkGroup.label, children: jsx("ul", { className: styles['list'], children: linkGroup.items.filter(isNavigationLink).map(link => (jsx("li", { children: jsx(FooterLink, { link: link }) }, link.key))) }) }) }) }, linkGroup.key));
16
20
  }
17
21
  function FooterLink({ link }) {
18
- const type = link.type;
19
- if (type === 'link' || type === 'category') {
20
- return (jsx(Link, { href: link.url, target: link.openInNewTab ? '_blank' : undefined, children: link.title }));
21
- }
22
- if (type === 'section') {
23
- return jsx(LinkSection, { link: link });
24
- }
25
- logger.warn(`Unknown link type '${type}' in footer with key '${link.key}'`);
26
- return null;
22
+ return (jsx(Link, { href: link.href || undefined, target: link.openInNewTab ? '_blank' : undefined, children: link.label }));
27
23
  }
28
- function FooterLinkBlock({ linkBlocks }) {
29
- return (jsx("div", { className: styles['main-links'], children: linkBlocks.map(link => (jsx(FooterLink, { link: link }, link.key))) }));
24
+ function FooterLinkBlock({ footerLinkBlockSection }) {
25
+ if (!footerLinkBlockSection)
26
+ return null;
27
+ return (jsx("nav", { className: styles['main-links'], children: footerLinkBlockSection.items
28
+ .filter(isNavigationLinkItem)
29
+ .map(linkItem => isNavigationLink(linkItem) ? (jsx(FooterLink, { link: linkItem }, linkItem.key)) : (jsx(LinkSection, { linkGroup: linkItem }, linkItem.key))) }));
30
30
  }
31
- function Footer({ bottomLinks, copyright, countrySelector, linkBlocks, }) {
32
- return (jsxs("footer", { className: styles.footer, children: [jsx(FooterLinkBlock, { linkBlocks: linkBlocks }), jsx(BottomSection, { bottomLinks: bottomLinks, copyright: copyright, countrySelector: countrySelector })] }));
31
+ function Footer({ className, copyright, countrySelector, footerNavigationSection, }) {
32
+ const footerLinkBlockSection = footerNavigationSection?.items
33
+ .filter(isNavigationSection)
34
+ .find(section => section.key === 'footer-link-block');
35
+ const footerBottomSection = footerNavigationSection?.items
36
+ .filter(isNavigationSection)
37
+ .find(section => section.key === 'footer-bottom');
38
+ return (jsxs("footer", { className: clsx(styles.footer, className), children: [jsx(FooterLinkBlock, { footerLinkBlockSection: footerLinkBlockSection }), jsx(BottomSection, { copyright: copyright, countrySelector: countrySelector, footerBottomSection: footerBottomSection })] }));
33
39
  }
34
40
 
35
41
  export { Footer };
@@ -1,3 +1,3 @@
1
- var styles = {"footer":"footer-module-YzJ68","main-links":"footer-module-rFBXC","link-block":"footer-module-P5FXP","list":"footer-module-FM4hU","bottom-section":"footer-module-TZq-4","copyright":"footer-module-qlHSS","bottom-links":"footer-module-5eyFH","bottom-link":"footer-module-0gJpF"};
1
+ var styles = {"footer":"footer-module-YzJ68","main-links":"footer-module-rFBXC","link-block":"footer-module-P5FXP","list":"footer-module-FM4hU","bottom-section":"footer-module-TZq-4","copyright":"footer-module-qlHSS","bottom-links":"footer-module-5eyFH","country-selector":"footer-module-rc0bC"};
2
2
 
3
3
  export { styles as default };
@@ -2,12 +2,20 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { useCultureCode } from '../intl/use-culture-code.js';
4
4
  import { useFetchNavigationLinks } from '../shared/api/bff/hooks/use-fetch-navigation-links.js';
5
+ import { isNavigationSection } from '../shared/api/bff/model/bff.model.js';
5
6
  import { Header } from './header.js';
6
7
 
7
8
  function ConnectedHeader({ className, source, }) {
8
9
  const cultureCode = useCultureCode();
9
10
  const { data } = useFetchNavigationLinks({ cultureCode, source });
10
- return (jsx(Header, { className: className, links: data?.header ?? [], sticky: true }));
11
+ if (data && data.key !== 'navigation')
12
+ throw new Error('Invalid navigation data');
13
+ const headerNavigationSection = data?.items
14
+ .filter(isNavigationSection)
15
+ .find(item => item.key === 'header');
16
+ if (data && !headerNavigationSection)
17
+ throw new Error('Header section not found in navigation data');
18
+ return (jsx(Header, { className: className, headerNavigationSection: headerNavigationSection, sticky: true }));
11
19
  }
12
20
 
13
21
  export { ConnectedHeader };
@@ -1,8 +1,8 @@
1
- import { NavigationLink } from '../../shared/api/bff/model/bff.model';
1
+ import { NavigationLinkGroup } from '../../shared/api/bff/model/bff.model';
2
2
  export interface DesktopNavigationDrawerProps {
3
3
  groupId?: string;
4
4
  instanceId?: string;
5
+ linkGroup?: NavigationLinkGroup;
5
6
  onClosed?: () => void;
6
- submenu?: NavigationLink;
7
7
  }
8
- export declare function DesktopNavigationDrawer({ groupId, instanceId, onClosed, submenu, }: DesktopNavigationDrawerProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function DesktopNavigationDrawer({ groupId, instanceId, linkGroup, onClosed, }: DesktopNavigationDrawerProps): import("react/jsx-runtime").JSX.Element;
@@ -4,10 +4,8 @@ import { Drawer } from '../../drawer/drawer.js';
4
4
  import { PanelNavigation } from '../../navigation/panel-navigation/panel-navigation.js';
5
5
  import styles from './desktop-navigation-drawer.module.css.js';
6
6
 
7
- function DesktopNavigationDrawer({ groupId, instanceId, onClosed, submenu, }) {
8
- return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: styles['desktop-navigation-drawer'], "data-test-selector": "desktopNavigationDrawer", groupId: groupId, instanceId: instanceId, onClosed: onClosed, position: "top", showUnder: "header", children: submenu && (jsx(PanelNavigation, { "data-test-selector": "desktopNavigationPanel", header: submenu.url
9
- ? { href: submenu.url, title: submenu.title }
10
- : submenu.title, id: `panels-${submenu.key}`, links: submenu.links }, submenu.key)) }));
7
+ function DesktopNavigationDrawer({ groupId, instanceId, linkGroup, onClosed, }) {
8
+ return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: styles['desktop-navigation-drawer'], "data-test-selector": "desktopNavigationDrawer", groupId: groupId, instanceId: instanceId, onClosed: onClosed, position: "top", showUnder: "header", children: linkGroup && (jsx(PanelNavigation, { "data-test-selector": "desktopNavigationPanel", header: linkGroup, id: `panels-${linkGroup.key}`, linkItems: linkGroup.items }, linkGroup.key)) }));
11
9
  }
12
10
 
13
11
  export { DesktopNavigationDrawer };
@@ -1,7 +1,7 @@
1
- import { NavigationLink } from '../../shared/api/bff/model/bff.model';
1
+ import { NavigationLinkItem } from '../../shared/api/bff/model/bff.model';
2
2
  export interface MobileNavigationDrawerProps {
3
3
  groupId?: string;
4
4
  instanceId?: string;
5
- links: NavigationLink[];
5
+ linkItems: NavigationLinkItem[] | undefined;
6
6
  }
7
- export declare function MobileNavigationDrawer({ groupId, instanceId, links, }: MobileNavigationDrawerProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function MobileNavigationDrawer({ groupId, instanceId, linkItems, }: MobileNavigationDrawerProps): import("react/jsx-runtime").JSX.Element;
@@ -4,8 +4,8 @@ import { Drawer } from '../../drawer/drawer.js';
4
4
  import { MobileNavigation } from '../../navigation/mobile-navigation/mobile-navigation.js';
5
5
  import styles from './mobile-navigation-drawer.module.css.js';
6
6
 
7
- function MobileNavigationDrawer({ groupId, instanceId, links, }) {
8
- return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: styles['mobile-navigation-drawer'], "data-test-selector": "mobileNavigationDrawer", groupId: groupId, instanceId: instanceId, position: "left", showUnder: "announcement", children: ({ close, isOpen }) => (jsx(MobileNavigation, { id: "mobile-navigation", isActive: isOpen, links: links, onActiveChange: close })) }));
7
+ function MobileNavigationDrawer({ groupId, instanceId, linkItems, }) {
8
+ return (jsx(Drawer, { allowCloseOnBackgroundClick: true, showBackgroundOverlay: true, className: styles['mobile-navigation-drawer'], "data-test-selector": "mobileNavigationDrawer", groupId: groupId, instanceId: instanceId, position: "left", showUnder: "announcement", children: ({ close, isOpen }) => (jsx(MobileNavigation, { id: "mobile-navigation", isActive: isOpen, linkItems: linkItems, onActiveChange: close })) }));
9
9
  }
10
10
 
11
11
  export { MobileNavigationDrawer };
@@ -1,7 +1,7 @@
1
- import { NavigationLink } from '../shared/api/bff/model/bff.model';
1
+ import { NavigationSection } from '../shared/api/bff/model/bff.model';
2
2
  export interface HeaderProps {
3
3
  className?: string;
4
- links: NavigationLink[];
4
+ headerNavigationSection?: NavigationSection;
5
5
  sticky?: boolean;
6
6
  }
7
- export declare function Header({ className, links, sticky }: HeaderProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Header({ className, headerNavigationSection, sticky, }: HeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -2,11 +2,11 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useState, useEffect } from 'react';
4
4
  import clsx from 'clsx';
5
- import { config } from '../config.js';
6
5
  import { useDrawer } from '../drawer/use-drawer.js';
7
6
  import { useGlobalSearchDisclosure } from '../global-search/global-search-provider/use-search-disclosure.js';
8
7
  import { useFormattedMessage } from '../intl/use-formatted-message.js';
9
8
  import { PATHS } from '../pages/paths.js';
9
+ import { isNavigationLink, isNavigationSection, isNavigationLinkItem } from '../shared/api/bff/model/bff.model.js';
10
10
  import { useIsBreakpoint } from '../shared/hooks/use-is-breakpoint.js';
11
11
  import { useResizeObserver } from '../shared/hooks/use-resize-observer.js';
12
12
  import { useOnNavigate } from '../shared/routing/use-on-navigate.js';
@@ -23,8 +23,8 @@ import { NavigationLinkList } from './link-list/navigation-link-list.js';
23
23
  import { SonicLogo } from './sonic-logo/sonic-logo.js';
24
24
  import styles from './header.module.css.js';
25
25
 
26
- function Header({ className, links, sticky }) {
27
- const [activeSubmenu, setActiveSubmenu] = useState();
26
+ function Header({ className, headerNavigationSection, sticky, }) {
27
+ const [activeLinkGroup, setActiveLinkGroup] = useState();
28
28
  const t = useFormattedMessage();
29
29
  const isXl = useIsBreakpoint('xl');
30
30
  const { ref: headerRef } = useResizeObserver((_, size) => {
@@ -50,11 +50,11 @@ function Header({ className, links, sticky }) {
50
50
  const toggleMobileNavigation = (isActive) => {
51
51
  setMobileNavigationOpen(isActive);
52
52
  };
53
- const toggleActiveSubmenu = (link) => {
54
- if (link === activeSubmenu)
53
+ const toggleActiveSubmenu = (linkGroup) => {
54
+ if (linkGroup === activeLinkGroup)
55
55
  setDesktopNavigationOpen(false);
56
56
  else
57
- setActiveSubmenu(link);
57
+ setActiveLinkGroup(linkGroup);
58
58
  };
59
59
  const hasDrawersOpen = searchOpen || mobileNavigationOpen || desktopNavigationOpen;
60
60
  useOnNavigate(() => {
@@ -63,10 +63,16 @@ function Header({ className, links, sticky }) {
63
63
  desktopNavigationDrawer.close();
64
64
  });
65
65
  useEffect(() => {
66
- if (activeSubmenu)
66
+ if (activeLinkGroup)
67
67
  setDesktopNavigationOpen(true);
68
- }, [activeSubmenu, setDesktopNavigationOpen]);
69
- return (jsxs(Fragment, { children: [jsx("header", { ref: headerRef, className: clsx(styles['header'], sticky && styles['sticky'], className), "data-test-selector": "pageHeader", children: jsx(HeaderLayout, { hamburgerButton: jsx(HamburgerButton, { "aria-controls": "mobile-navigation", "data-test-selector": "pageHeaderHamburgerButton", isActive: mobileNavigationOpen, onActiveChange: toggleMobileNavigation }), hasDrawersOpen: hasDrawersOpen, logo: jsx(SonicLogo, { "data-test-selector": "pageHeaderLogo", href: config.HOME_PAGE_URL, title: t('Home') }), mainNavigation: jsx(NavigationLinkList, { activeLink: activeSubmenu, "data-test-selector": "pageHeaderMainNavigation", links: links, onSubmenuToggle: link => toggleActiveSubmenu(link) }), navigationActions: jsxs(Fragment, { children: [jsx(ConnectedAccountButton, { "data-test-selector": "pageHeaderAccountButton", href: PATHS.ACCOUNT }), jsx(ConnectedFavoritesButton, { "data-test-selector": "pageHeaderFavoritesButton", href: PATHS.FAVORITES }), jsx(ConnectedCartButton, { "data-test-selector": "pageHeaderCartButton", href: PATHS.CART })] }), search: jsx(SearchButton, { "aria-controls": "global-search", "data-test-selector": "pageHeaderSearchButton", isActive: searchOpen, onActiveChange: toggleSearch }) }) }), jsx(SearchDrawer, { groupId: searchGroupId, instanceId: searchInstanceId }), !isXl && (jsx(MobileNavigationDrawer, { groupId: mobileNavigationDrawer.groupId, instanceId: mobileNavigationDrawer.instanceId, links: links })), isXl && (jsx(DesktopNavigationDrawer, { groupId: desktopNavigationDrawer.groupId, instanceId: desktopNavigationDrawer.instanceId, onClosed: () => setActiveSubmenu(undefined), submenu: activeSubmenu }))] }));
68
+ }, [activeLinkGroup, setDesktopNavigationOpen]);
69
+ const homeLink = headerNavigationSection?.items
70
+ .filter(isNavigationLink)
71
+ .find(item => item.key === 'home');
72
+ const mainNavigationSection = headerNavigationSection?.items
73
+ .filter(isNavigationSection)
74
+ .find(item => item.key === 'main-navigation');
75
+ return (jsxs(Fragment, { children: [jsx("header", { ref: headerRef, className: clsx(styles['header'], sticky && styles['sticky'], className), "data-test-selector": "pageHeader", children: jsx(HeaderLayout, { hamburgerButton: jsx(HamburgerButton, { "aria-controls": "mobile-navigation", "data-test-selector": "pageHeaderHamburgerButton", isActive: mobileNavigationOpen, onActiveChange: toggleMobileNavigation }), hasDrawersOpen: hasDrawersOpen, logo: jsx(SonicLogo, { "data-test-selector": "pageHeaderLogo", href: homeLink?.href || undefined, title: t('Home') }), mainNavigation: jsx(NavigationLinkList, { activeLink: activeLinkGroup, "data-test-selector": "pageHeaderMainNavigation", navigationSection: mainNavigationSection, onSubmenuToggle: toggleActiveSubmenu }), navigationActions: jsxs(Fragment, { children: [jsx(ConnectedAccountButton, { "data-test-selector": "pageHeaderAccountButton", href: PATHS.ACCOUNT }), jsx(ConnectedFavoritesButton, { "data-test-selector": "pageHeaderFavoritesButton", href: PATHS.FAVORITES }), jsx(ConnectedCartButton, { "data-test-selector": "pageHeaderCartButton", href: PATHS.CART })] }), search: jsx(SearchButton, { "aria-controls": "global-search", "data-test-selector": "pageHeaderSearchButton", isActive: searchOpen, onActiveChange: toggleSearch }) }) }), jsx(SearchDrawer, { groupId: searchGroupId, instanceId: searchInstanceId }), !isXl && (jsx(MobileNavigationDrawer, { groupId: mobileNavigationDrawer.groupId, instanceId: mobileNavigationDrawer.instanceId, linkItems: mainNavigationSection?.items.filter(isNavigationLinkItem) })), isXl && (jsx(DesktopNavigationDrawer, { groupId: desktopNavigationDrawer.groupId, instanceId: desktopNavigationDrawer.instanceId, linkGroup: activeLinkGroup, onClosed: () => setActiveLinkGroup(undefined) }))] }));
70
76
  }
71
77
 
72
78
  export { Header };
@@ -1,8 +1,8 @@
1
- import { NavigationLink } from '../../shared/api/bff/model/bff.model';
1
+ import { NavigationLinkGroup, NavigationLinkItem, NavigationSection } from '../../shared/api/bff/model/bff.model';
2
2
  export interface LinkListProps {
3
- activeLink?: NavigationLink;
3
+ activeLink?: NavigationLinkItem;
4
4
  'data-test-selector'?: string;
5
- links: NavigationLink[];
6
- onSubmenuToggle: (link: NavigationLink) => void;
5
+ navigationSection: NavigationSection | undefined;
6
+ onSubmenuToggle: (linkGroup: NavigationLinkGroup) => void;
7
7
  }
8
- export declare function NavigationLinkList({ activeLink, 'data-test-selector': dataTestSelector, links, onSubmenuToggle, }: LinkListProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function NavigationLinkList({ activeLink, 'data-test-selector': dataTestSelector, navigationSection, onSubmenuToggle, }: LinkListProps): import("react/jsx-runtime").JSX.Element;
@@ -2,14 +2,19 @@
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Link } from '../../buttons/link/link.js';
4
4
  import { GlyphsChevronsBoldDownIcon } from '../../icons/glyph/glyphs-chevrons-bold-down-icon.js';
5
+ import { isNavigationLinkGroup, isNavigationLink } from '../../shared/api/bff/model/bff.model.js';
5
6
  import styles from './navigation-link-list.module.css.js';
6
7
 
7
- function NavigationLinkList({ activeLink, 'data-test-selector': dataTestSelector, links, onSubmenuToggle, }) {
8
- return (jsx("ul", { className: styles['navigation-link-list'], "data-test-selector": dataTestSelector, children: links.map(link => {
9
- if (link.links && link.links.length > 0) {
10
- return (jsx("li", { className: activeLink === link ? styles['active'] : undefined, children: jsxs(Link, { "aria-controls": `panels-${link.key}`, "aria-expanded": activeLink === link, className: styles.link, "data-test-selector": `navigationLink-${link.key}`, onClick: () => onSubmenuToggle(link), target: link.openInNewTab ? '_blank' : undefined, children: [link.title, jsx(GlyphsChevronsBoldDownIcon, { className: styles.chevron, role: "presentation" })] }) }, link.key));
8
+ function NavigationLinkList({ activeLink, 'data-test-selector': dataTestSelector, navigationSection, onSubmenuToggle, }) {
9
+ const items = navigationSection?.items ?? [];
10
+ return (jsx("ul", { className: styles['navigation-link-list'], "data-test-selector": dataTestSelector, children: items.map(item => {
11
+ if (isNavigationLinkGroup(item) && item.items.length > 0) {
12
+ return (jsx("li", { className: activeLink === item ? styles['active'] : undefined, children: jsxs(Link, { "aria-controls": `panels-${item.key}`, "aria-expanded": activeLink === item, className: styles.link, "data-test-selector": `navigationLink-${item.key}`, onClick: () => onSubmenuToggle(item), target: item.openInNewTab ? '_blank' : undefined, children: [item.label, jsx(GlyphsChevronsBoldDownIcon, { className: styles.chevron, role: "presentation" })] }) }, item.key));
11
13
  }
12
- return (jsx("li", { children: jsx(Link, { className: styles.link, href: link.url, children: link.title }) }, link.key));
14
+ if (isNavigationLink(item)) {
15
+ return (jsx("li", { children: jsx(Link, { className: styles.link, href: item.href, children: item.label }) }, item.key));
16
+ }
17
+ throw new Error(`Unsupported link type: ${JSON.stringify(item, null, 2)}`);
13
18
  }) }));
14
19
  }
15
20
 
package/dist/index.js CHANGED
@@ -353,6 +353,7 @@ export { fetchCountriesLanguages, fetchCountriesWithLanguages, fetchSettings, up
353
353
  export { WishListNameAlreadyExistsError, addWishListItemToWishList, createWishList, deleteWishList, deleteWishListItemFromWishList, getWishList, getWishListItemsByWishListId, getWishLists } from './shared/api/storefront/services/wishlist-service.js';
354
354
  export { cart } from './shared/data/cart.data.js';
355
355
  export { countries, dutch, english, france, french, german, germany, languages, netherlands, unitedKingdom } from './shared/data/countries-languages.data.js';
356
+ export { navigationData } from './shared/data/navigation.js';
356
357
  export { useFeatureFlags } from './shared/feature-flags/use-feature-flags.js';
357
358
  export { BadRequestError, ForbiddenRequestError, InternalServerErrorRequestError, NotFoundRequestError, RequestError, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, isFormData, isJsonBody, isRequestError, request } from './shared/fetch/request.js';
358
359
  export { dataLayer } from './shared/ga/data-layer.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 order notes' | 'Add to list' | 'Address 1' | 'Address 2' | 'Address 3' | 'Address 4' | 'Address' | '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' | 'ascending' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | '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' | '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' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Current page' | 'Current Password is invalid' | 'Delivery date' | 'Delivery expected on {0}' | 'descending' | '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' | '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' | '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' | 'More than {0} articles' | 'My Sonic' | 'Name' | 'Navigate to...' | 'Navigation' | 'New list name' | 'New Password is required and must be different than Current Password' | 'New password' | 'New user?' | 'No results found. Please refine your search.' | 'Number of favorites' | 'Number of products' | 'of' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Orders' | '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' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove all' | 'Requested delivery date' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Search for a customer' | 'Search' | 'Searching again using more general terms' | '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' | 'Specifications' | 'Start checkout' | '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 order notes' | 'Add to list' | 'Address 1' | 'Address 2' | 'Address 3' | 'Address 4' | 'Address' | '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' | 'ascending' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | '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' | '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' | 'Delivery date' | 'Delivery expected on {0}' | 'descending' | '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' | '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' | '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' | 'More than {0} articles' | 'My Sonic' | 'Name' | 'Navigate to...' | 'Navigation' | 'New list name' | 'New Password is required and must be different than Current Password' | 'New password' | 'New user?' | 'No results found. Please refine your search.' | 'Number of favorites' | 'Number of products' | 'of' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Orders' | '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' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove all' | 'Requested delivery date' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Search for a customer' | 'Search' | 'Searching again using more general terms' | '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' | 'Specifications' | 'Start checkout' | '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';
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
2
2
  interface MenuListHeaderProps {
3
3
  children: ReactNode;
4
4
  'data-test-selector'?: string;
5
- href?: string;
5
+ href?: string | null;
6
6
  }
7
7
  export declare function MenuListHeader({ children, 'data-test-selector': dataTestSelector, href, }: MenuListHeaderProps): import("react/jsx-runtime").JSX.Element;
8
8
  export {};
@@ -7,8 +7,8 @@ export interface MenuListItemProps {
7
7
  className?: string;
8
8
  'data-test-selector'?: string;
9
9
  hasChildren?: boolean;
10
- href?: string;
11
- image?: ImageType;
10
+ href?: string | null;
11
+ image?: ImageType | null;
12
12
  isSelected?: boolean;
13
13
  onClick?: VoidFunction;
14
14
  openInNewTab?: boolean;
@@ -9,7 +9,7 @@ import styles from './menu-list.module.css.js';
9
9
 
10
10
  function MenuListItem({ 'aria-controls': ariaControls, badge, children, className, 'data-test-selector': dataTestSelector, hasChildren, href, image, isSelected, onClick, openInNewTab, ...rest }) {
11
11
  const t = useFormattedMessage();
12
- return (jsxs("li", { "aria-owns": ariaControls, className: clsx(styles['menu-list-item'], isSelected && styles['selected'], hasChildren && styles['has-children'], className), "data-test-selector": dataTestSelector, ...rest, children: [image && (jsx("span", { className: styles['image'], role: "presentation", children: jsx(Image, { fit: "contain", image: image, title: "" }) })), badge && jsx("span", { className: styles['badge'], children: badge }), jsx(Link, { "aria-controls": ariaControls, "aria-expanded": ariaControls && isSelected, "aria-haspopup": hasChildren ? 'true' : undefined, className: styles['label'], href: href, onClick: onClick, role: hasChildren ? 'menuitem' : undefined, target: openInNewTab ? '_blank' : undefined, children: children }), hasChildren && (jsx(GlyphsChevronsSlimRightIcon, { "aria-description": `(${t('Submenu')})`, className: styles['icon'] }))] }));
12
+ return (jsxs("li", { "aria-owns": ariaControls, className: clsx(styles['menu-list-item'], isSelected && styles['selected'], hasChildren && styles['has-children'], className), "data-test-selector": dataTestSelector, ...rest, children: [image && (jsx("span", { className: styles['image'], role: "presentation", children: jsx(Image, { fit: "contain", image: image, title: "" }) })), badge && jsx("span", { className: styles['badge'], children: badge }), jsx(Link, { "aria-controls": ariaControls, "aria-expanded": ariaControls && isSelected, "aria-haspopup": hasChildren ? 'true' : undefined, className: styles['label'], href: href || undefined, onClick: onClick, role: hasChildren ? 'menuitem' : undefined, target: openInNewTab ? '_blank' : undefined, children: children }), hasChildren && (jsx(GlyphsChevronsSlimRightIcon, { "aria-description": `(${t('Submenu')})`, className: styles['icon'] }))] }));
13
13
  }
14
14
 
15
15
  export { MenuListItem };
@@ -1,5 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  export type MenuListVariant = 'default' | 'primary';
3
+ export interface MenuHeader {
4
+ header?: string;
5
+ href?: string | null;
6
+ label: string;
7
+ }
3
8
  export interface MenuListProps {
4
9
  back?: {
5
10
  onClick: () => void;
@@ -7,10 +12,7 @@ export interface MenuListProps {
7
12
  };
8
13
  children: ReactNode;
9
14
  className?: string;
10
- header?: string | {
11
- href: string;
12
- title: string;
13
- };
15
+ header?: MenuHeader;
14
16
  scrollable?: boolean;
15
17
  variant?: MenuListVariant;
16
18
  }
@@ -6,9 +6,9 @@ import { MenuListHeader } from './menu-list-header.js';
6
6
  import styles from './menu-list.module.css.js';
7
7
 
8
8
  function MenuList({ back, children, className, header, scrollable = true, variant = 'default', }) {
9
- const headerTitle = typeof header === 'string' ? header : header?.title;
10
- const headerHref = typeof header === 'string' ? undefined : header?.href;
11
- return (jsxs("section", { className: clsx(styles['menu-list'], styles[variant], scrollable && styles['scrollable'], className), role: "menu", children: [back && (jsx(MenuListBackButton, { "data-test-selector": "menuListBackButton", onClick: back.onClick, children: back.title })), jsxs("div", { className: styles['scroll-area'], "data-test-selector": "menuListScrollArea", children: [header && (jsx(MenuListHeader, { "data-test-selector": "menuListHeader", href: headerHref, children: headerTitle })), jsx("ul", { className: styles['list'], children: children })] })] }));
9
+ const headerTitle = header?.header || header?.label;
10
+ const headerHref = header?.href;
11
+ return (jsxs("section", { className: clsx(styles['menu-list'], styles[variant], scrollable && styles['scrollable'], className), role: "menu", children: [back && (jsx(MenuListBackButton, { "data-test-selector": "menuListBackButton", onClick: back.onClick, children: back.title })), jsxs("div", { className: styles['scroll-area'], "data-test-selector": "menuListScrollArea", children: [header && headerTitle && (jsx(MenuListHeader, { "data-test-selector": "menuListHeader", href: headerHref, children: headerTitle })), jsx("ul", { className: styles['list'], children: children })] })] }));
12
12
  }
13
13
 
14
14
  export { MenuList };
@@ -28,12 +28,22 @@ function ImageLightbox({ images, initialSelectedIndex = 0, onZoom, variant = 'sm
28
28
  }
29
29
  return (jsxs("div", { className: clsx(styles['image-lightbox'], styles[variant]), children: [jsx(Swiper, { watchSlidesProgress: true, className: styles['thumbs-swiper'], direction: variant === 'sm' ? 'horizontal' : 'vertical', modules: [Thumb], onSwiper: swiper => setThumbsSwiper(swiper), slidesPerView: "auto", spaceBetween: 8, children: images.map((image, index) => (
30
30
  // eslint-disable-next-line @eslint-react/no-array-index-key
31
- jsx(SwiperSlide, { className: styles.slide, children: jsx("div", { className: styles.thumb, children: jsx(Image, { className: styles.image, fit: "contain", height: 80, image: image, title: "Image", width: 80 }) }) }, index))) }), jsxs("div", { className: styles['main-swiper'], children: [jsx(Swiper, { initialSlide: initialSelectedIndex, modules: [Thumb, Navigation], navigation: {
31
+ jsx(SwiperSlide, { className: styles.slide, children: jsx("div", { className: styles.thumb, children: jsx(Image, { className: styles.image, fit: "contain", height: 80, image: {
32
+ 1: image['1'],
33
+ 2: image['1'],
34
+ 3: image['1'],
35
+ altText: image.altText,
36
+ }, title: "Image", width: 80 }) }) }, index))) }), jsxs("div", { className: styles['main-swiper'], children: [jsx(Swiper, { initialSlide: initialSelectedIndex, modules: [Thumb, Navigation], navigation: {
32
37
  nextEl: nextEl.current,
33
38
  prevEl: prevEl.current,
34
39
  }, onActiveIndexChange: swiper => setCurrentIndex(swiper.activeIndex), onBeforeInit: swiper => (mainSwiperRef.current = swiper), slidesPerView: 1, thumbs: { swiper: thumbsSwiper }, children: images.map((image, index) => (
35
40
  // eslint-disable-next-line @eslint-react/no-array-index-key
36
- jsx(SwiperSlide, { className: styles.slide, children: jsx("button", { className: styles['active-image'], onClick: handleZoom, type: "button", children: jsx(Image, { className: styles.image, fit: "contain", image: image, title: "Image" }) }) }, index))) }), jsx("div", { className: styles.pagination, children: jsx(CarouselPagination, { contained: true, currentPage: currentIndex + 1, numberOfPages: images.length, onChange: pageNumber => mainSwiperRef.current?.slideTo(pageNumber - 1) }) }), variant === 'lg' && (jsxs(Fragment, { children: [jsx(CarouselNavigationButton, { ref: prevEl, className: clsx(styles['navigation-button'], styles['navigation-button-prev']), direction: "previous" }), jsx(CarouselNavigationButton, { ref: nextEl, className: clsx(styles['navigation-button'], styles['navigation-button-next']), direction: "next" })] }))] })] }));
41
+ jsx(SwiperSlide, { className: styles.slide, children: jsx("button", { className: styles['active-image'], onClick: handleZoom, type: "button", children: jsx(Image, { className: styles.image, fit: "contain", image: {
42
+ 1: image['3'],
43
+ 2: image['3'],
44
+ 3: image['3'],
45
+ altText: image.altText,
46
+ }, title: "Image" }) }) }, index))) }), jsx("div", { className: styles.pagination, children: jsx(CarouselPagination, { contained: true, currentPage: currentIndex + 1, numberOfPages: images.length, onChange: pageNumber => mainSwiperRef.current?.slideTo(pageNumber - 1) }) }), variant === 'lg' && (jsxs(Fragment, { children: [jsx(CarouselNavigationButton, { ref: prevEl, className: clsx(styles['navigation-button'], styles['navigation-button-prev']), direction: "previous" }), jsx(CarouselNavigationButton, { ref: nextEl, className: clsx(styles['navigation-button'], styles['navigation-button-next']), direction: "next" })] }))] })] }));
37
47
  }
38
48
 
39
49
  export { ImageLightbox };
@@ -28,7 +28,12 @@ function ZoomImage({ currentImage, isZoomed = false, onClose, scrollFromTopPerce
28
28
  // handler must also be keyboardd accessible.
29
29
  // In this case the modal already handles the escape key.
30
30
  // This is a no-op at the moment.
31
- }, role: "link", tabIndex: 0, children: jsx(Image, { className: styles['zoomed-image'], image: currentImage, title: currentImage.altText }) }) }));
31
+ }, role: "link", tabIndex: 0, children: jsx(Image, { className: styles['zoomed-image'], image: {
32
+ 1: currentImage['3'],
33
+ 2: currentImage['3'],
34
+ 3: currentImage['3'],
35
+ altText: currentImage.altText,
36
+ }, title: currentImage.altText }) }) }));
32
37
  }
33
38
 
34
39
  export { ZoomImage };
@@ -1,8 +1,8 @@
1
- import { NavigationLink } from '../../shared/api/bff/model/bff.model';
1
+ import { NavigationLinkItem } from '../../shared/api/bff/model/bff.model';
2
2
  export interface MobileNavigationProps {
3
3
  id: string;
4
4
  isActive: boolean;
5
- links: NavigationLink[];
5
+ linkItems: NavigationLinkItem[] | undefined;
6
6
  onActiveChange: (isActive: boolean) => void;
7
7
  }
8
- export declare function MobileNavigation({ id, isActive, links, onActiveChange, }: MobileNavigationProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function MobileNavigation({ id, isActive, linkItems, onActiveChange, }: MobileNavigationProps): import("react/jsx-runtime").JSX.Element;
@@ -15,11 +15,11 @@ import { FavoriteIcon } from '../favorite-icon/favorite-icon.js';
15
15
  import { PanelNavigation } from '../panel-navigation/panel-navigation.js';
16
16
  import styles from './mobile-navigation.module.css.js';
17
17
 
18
- function MobileNavigation({ id, isActive, links, onActiveChange, }) {
18
+ function MobileNavigation({ id, isActive, linkItems, onActiveChange, }) {
19
19
  const t = useFormattedMessage();
20
20
  const { data: { isAuthenticated } = {} } = useFetchSession();
21
21
  const cartCount = useFetchCurrentCartCount();
22
- 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, links: links, variant: "primary", children: jsxs(MenuList, { header: 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') })] }) })] }));
22
+ 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') })] }) })] }));
23
23
  }
24
24
 
25
25
  export { MobileNavigation };