@sonic-equipment/ui 251.0.0 → 253.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.
@@ -10,6 +10,7 @@ export interface LinkProps {
10
10
  isDisabled?: boolean;
11
11
  onClick?: MouseEventHandler<HTMLElement>;
12
12
  onKeyUp?: (event: KeyboardEvent) => void;
13
+ rel?: string;
13
14
  role?: string;
14
15
  route?: NavigateOptions;
15
16
  tabIndex?: number;
@@ -5,16 +5,16 @@ import clsx from 'clsx';
5
5
  import { useRouteLink } from '../../shared/routing/use-route-link.js';
6
6
  import styles from './link.module.css.js';
7
7
 
8
- const Link = forwardRef(({ children, className: _className, color, hasUnderline, href, id, isDisabled, onClick, onKeyUp, role, route, tabIndex, target, title, ...rest }, ref) => {
8
+ const Link = forwardRef(({ children, className: _className, color, hasUnderline, href, id, isDisabled, onClick, onKeyUp, rel, role, route, tabIndex, target, title, ...rest }, ref) => {
9
9
  const { getRouteLinkProps, RouteLinkElement } = useRouteLink();
10
10
  const className = clsx({
11
11
  [styles.hover]: Boolean(href || onClick),
12
12
  [styles['has-underline']]: hasUnderline,
13
13
  }, styles['link'], color && styles[color], _className);
14
14
  if (href) {
15
- return (jsx(RouteLinkElement, { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, id: id, onClick: onClick, onKeyUp: onKeyUp, role: role, tabIndex: isDisabled ? -1 : tabIndex, target: target, title: title, ...getRouteLinkProps(href, route), ...rest, children: children }));
15
+ return (jsx(RouteLinkElement, { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, id: id, onClick: onClick, onKeyUp: onKeyUp, rel: rel, role: role, tabIndex: isDisabled ? -1 : tabIndex, target: target, title: title, ...getRouteLinkProps(href, route), ...rest, children: children }));
16
16
  }
17
- return (jsx("button", { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, disabled: isDisabled ? true : undefined, id: id, onClick: onClick, onKeyUp: onKeyUp, role: role, tabIndex: isDisabled ? -1 : tabIndex, title: title, type: "button", ...rest, children: children }));
17
+ return (jsx("button", { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, disabled: isDisabled ? true : undefined, id: id, onClick: onClick, onKeyUp: onKeyUp, rel: rel, role: role, tabIndex: isDisabled ? -1 : tabIndex, title: title, type: "button", ...rest, children: children }));
18
18
  });
19
19
  Link.displayName = 'Link';
20
20
 
@@ -7,7 +7,7 @@ export type OnCountryLanguageChangeHandler = (args: {
7
7
  export interface ConnectedCountrySelectorProps {
8
8
  defaultCountryCode: CountryCode;
9
9
  defaultLanguageCode: LanguageCode;
10
+ lockCountry?: boolean;
10
11
  onChange?: OnCountryLanguageChangeHandler;
11
- showCountry?: boolean;
12
12
  }
13
- export declare function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, onChange, showCountry, }: ConnectedCountrySelectorProps): import("react/jsx-runtime").JSX.Element | null;
13
+ export declare function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, lockCountry, onChange, }: ConnectedCountrySelectorProps): import("react/jsx-runtime").JSX.Element | null;
@@ -2,15 +2,18 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useMemo, useEffect } from 'react';
4
4
  import { logger } from '../logging/logger.js';
5
+ import { useFetchSession } from '../shared/api/storefront/hooks/authentication/use-fetch-session.js';
5
6
  import { useCookiebot } from '../shared/hooks/use-cookiebot.js';
6
7
  import { useDisclosure } from '../shared/hooks/use-disclosure.js';
7
8
  import { CountrySelectorDialog } from './country-selector-dialog/country-selector-dialog.js';
8
9
  import { CountrySelectorTrigger } from './country-selector-trigger/country-selector-trigger.js';
9
10
  import { useCountriesLanguages } from './use-countries-languages.js';
10
11
 
11
- function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, onChange, showCountry = true, }) {
12
+ function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, lockCountry = false, onChange, }) {
13
+ const { data: sessionData } = useFetchSession();
12
14
  const { close, isOpen, open, setIsOpen } = useDisclosure(false);
13
15
  const { countries, defaultCountry, defaultLanguage, error, isFetching, selectedCountry, selectedLanguage, updateCountryLanguage, } = useCountriesLanguages({
16
+ billToCountryId: sessionData?.billTo?.country?.id,
14
17
  defaultCountryCode,
15
18
  defaultLanguageCode,
16
19
  });
@@ -38,7 +41,7 @@ function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, onC
38
41
  logger.error('Error fetching countries and languages:', error);
39
42
  return null;
40
43
  }
41
- return (jsxs(Fragment, { children: [jsx(CountrySelectorTrigger, { onClick: open, selectedCountry: selectedCountry || defaultCountry, selectedLanguage: selectedLanguage || defaultLanguage, showCountry: showCountry }), jsx(CountrySelectorDialog, { countries: countries, isDismissable: isDismissable, isOpen: isOpen, onOpenChange: open => {
44
+ return (jsxs(Fragment, { children: [jsx(CountrySelectorTrigger, { onClick: open, selectedCountry: selectedCountry || defaultCountry, selectedLanguage: selectedLanguage || defaultLanguage }), jsx(CountrySelectorDialog, { countries: countries, isDismissable: isDismissable, isOpen: isOpen, lockCountry: lockCountry, onOpenChange: open => {
42
45
  if (!isDismissable)
43
46
  return;
44
47
  setIsOpen(open);
@@ -49,7 +52,7 @@ function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, onC
49
52
  await updateCountryLanguage({ country, language });
50
53
  close();
51
54
  onChange?.({ country, language });
52
- }, selectedCountry: selectedCountry || defaultCountry, selectedLanguage: selectedLanguage || defaultLanguage, showCountry: showCountry })] }));
55
+ }, selectedCountry: selectedCountry || defaultCountry, selectedLanguage: selectedLanguage || defaultLanguage })] }));
53
56
  }
54
57
 
55
58
  export { ConnectedCountrySelector };
@@ -3,6 +3,7 @@ export interface CountrySelectorDialogProps {
3
3
  countries: Country[];
4
4
  isDismissable?: boolean;
5
5
  isOpen: boolean;
6
+ lockCountry?: boolean;
6
7
  onOpenChange?: (isOpen: boolean) => void;
7
8
  onSubmit: ({ country, language, }: {
8
9
  country: Country;
@@ -10,6 +11,5 @@ export interface CountrySelectorDialogProps {
10
11
  }) => void;
11
12
  selectedCountry: Country;
12
13
  selectedLanguage: Language;
13
- showCountry?: boolean;
14
14
  }
15
- export declare function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange, onSubmit, selectedCountry, selectedLanguage, showCountry, }: CountrySelectorDialogProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function CountrySelectorDialog({ countries, isDismissable, isOpen, lockCountry, onOpenChange, onSubmit, selectedCountry, selectedLanguage, }: CountrySelectorDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -9,7 +9,7 @@ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
9
9
  import { Dialog } from '../../modals/dialog/dialog.js';
10
10
  import styles from './country-selector-dialog.module.css.js';
11
11
 
12
- function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange, onSubmit, selectedCountry, selectedLanguage, showCountry = true, }) {
12
+ function CountrySelectorDialog({ countries, isDismissable, isOpen, lockCountry = false, onOpenChange, onSubmit, selectedCountry, selectedLanguage, }) {
13
13
  const t = useFormattedMessage();
14
14
  const [currentCountry, setCurrentCountry] = useState(selectedCountry);
15
15
  const [currentLanguage, setCurrentLanguage] = useState(selectedLanguage);
@@ -28,7 +28,7 @@ function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange,
28
28
  return (jsx(Dialog, { hideTitle: true, allowClose: isDismissable, className: {
29
29
  dialog: styles['country-selector-dialog'],
30
30
  modal: styles.modal,
31
- }, footer: jsx(Button, { withArrow: true, "data-test-selector": "clSelector_apply", type: "submit", children: jsx(FormattedMessage, { id: "Save" }) }), hasCloseButton: isDismissable, isDismissable: isDismissable, isOpen: isOpen, onOpenChange: onOpenChange, onSubmit: () => onSubmit({ country: currentCountry, language: currentLanguage }), shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(CountrySelect, { isRequired: true, countries: countries, countryNameInLanguageOfCountry: true, "data-test-selector": "clSelector_country", onCountryChange: onCountryChange, selectedCountry: currentCountry })), jsx(Select, { isRequired: true, "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, placeholder: t('Select a language'), selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
31
+ }, footer: jsx(Button, { withArrow: true, "data-test-selector": "clSelector_apply", type: "submit", children: jsx(FormattedMessage, { id: "Save" }) }), hasCloseButton: isDismissable, isDismissable: isDismissable, isOpen: isOpen, onOpenChange: onOpenChange, onSubmit: () => onSubmit({ country: currentCountry, language: currentLanguage }), shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [jsx(CountrySelect, { isRequired: true, countries: countries, countryNameInLanguageOfCountry: true, "data-test-selector": "clSelector_country", isDisabled: lockCountry, onCountryChange: onCountryChange, selectedCountry: currentCountry }), jsx(Select, { isRequired: true, "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, placeholder: t('Select a language'), selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
32
32
  }
33
33
 
34
34
  export { CountrySelectorDialog };
@@ -3,6 +3,5 @@ export interface CountrySelectorTriggerProps {
3
3
  onClick: VoidFunction;
4
4
  selectedCountry: Country | undefined;
5
5
  selectedLanguage: Language | undefined;
6
- showCountry?: boolean;
7
6
  }
8
- export declare function CountrySelectorTrigger({ onClick, selectedCountry, selectedLanguage, showCountry, }: CountrySelectorTriggerProps): import("react/jsx-runtime").JSX.Element | undefined;
7
+ export declare function CountrySelectorTrigger({ onClick, selectedCountry, selectedLanguage, }: CountrySelectorTriggerProps): import("react/jsx-runtime").JSX.Element | undefined;
@@ -1,18 +1,24 @@
1
1
  "use client";
2
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useFormattedMessage } from '../../intl/use-formatted-message.js';
4
4
  import { Image } from '../../media/image/image.js';
5
5
  import styles from './country-selector-trigger.module.css.js';
6
6
 
7
- function CountrySelectorTrigger({ onClick, selectedCountry, selectedLanguage, showCountry = true, }) {
7
+ function CountrySelectorTrigger({ onClick, selectedCountry, selectedLanguage, }) {
8
8
  const t = useFormattedMessage();
9
9
  if (!selectedCountry || !selectedLanguage)
10
10
  return;
11
11
  const abbreviation = selectedCountry.abbreviation.toLowerCase();
12
12
  const flagSrc = `https://res.cloudinary.com/dkz9eknwh/image/upload/v1729678637/images/flags/${abbreviation}.svg`;
13
- return (jsxs("button", { "aria-label": "Open country selector dialog", className: styles['country-selector-trigger'], onClick: onClick, type: "button", children: [jsx(Image, { className: styles.flag, height: 24, image: { 1: flagSrc, 2: flagSrc, 3: flagSrc, altText: abbreviation }, title: abbreviation, width: 24 }), jsxs("div", { className: styles.text, children: [showCountry && (jsxs(Fragment, { children: [jsx("span", { children: t(`clSelector.${selectedCountry.abbreviation}`, {
14
- noTranslationId: true,
15
- }) }), jsx("span", { className: styles.divider, children: "-" })] })), jsx("span", { children: selectedLanguage.description })] })] }));
13
+ const countryName = t(`clSelector.${selectedCountry.abbreviation}`, {
14
+ noTranslationId: true,
15
+ });
16
+ return (jsxs("button", { "aria-label": "Open country selector dialog", className: styles['country-selector-trigger'], onClick: onClick, type: "button", children: [jsx(Image, { className: styles.flag, height: 24, image: {
17
+ 1: flagSrc,
18
+ 2: flagSrc,
19
+ 3: flagSrc,
20
+ altText: countryName,
21
+ }, title: countryName, width: 24 }), jsx("div", { className: styles.text, children: jsx("span", { children: selectedLanguage.description }) })] }));
16
22
  }
17
23
 
18
24
  export { CountrySelectorTrigger };
@@ -1,3 +1,3 @@
1
- var styles = {"country-selector-trigger":"country-selector-trigger-module-aioDu","flag":"country-selector-trigger-module-zOSJK","text":"country-selector-trigger-module-TE8tl","divider":"country-selector-trigger-module-GNRDD"};
1
+ var styles = {"country-selector-trigger":"country-selector-trigger-module-aioDu","flag":"country-selector-trigger-module-zOSJK","text":"country-selector-trigger-module-TE8tl"};
2
2
 
3
3
  export { styles as default };
@@ -1,6 +1,7 @@
1
1
  import { CountryCode, LanguageCode } from '../intl/types';
2
2
  import { Country, Language } from '../shared/model/countries-languages';
3
3
  interface UseCountriesLanguagesArgs {
4
+ billToCountryId?: string;
4
5
  defaultCountryCode: CountryCode;
5
6
  defaultLanguageCode: LanguageCode;
6
7
  }
@@ -56,5 +57,5 @@ interface UseCountriesLanguagesReturnType {
56
57
  language: Language;
57
58
  }): Promise<void>;
58
59
  }
59
- export declare function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }: UseCountriesLanguagesArgs): UseCountriesLanguagesReturnType | UseCountriesLanguagesReturnTypeError | UseCountriesLanguagesReturnTypeFetching | UseCountriesLanguagesReturnTypeSelected;
60
+ export declare function useCountriesLanguages({ billToCountryId, defaultCountryCode, defaultLanguageCode, }: UseCountriesLanguagesArgs): UseCountriesLanguagesReturnType | UseCountriesLanguagesReturnTypeError | UseCountriesLanguagesReturnTypeFetching | UseCountriesLanguagesReturnTypeSelected;
60
61
  export {};
@@ -6,10 +6,11 @@ import { updateLocale } from '../shared/api/storefront/services/website-service.
6
6
  import { useSessionStorage } from '../shared/local-storage/use-session-storage.js';
7
7
  import { isCountry } from '../shared/model/countries-languages.js';
8
8
 
9
- function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }) {
9
+ function useCountriesLanguages({ billToCountryId, defaultCountryCode, defaultLanguageCode, }) {
10
10
  const [sessionCountries, setSessionCountries] = useSessionStorage('countries-v1');
11
- const [currentCountryId] = useCookie('CurrentCountryId');
12
- // const [currentLanguageId] = ['be71b608-4876-420a-b1f5-adfe0093a72a'] // useCookie('CurrentLanguageId', cookieOptions)
11
+ // get the current country ID from billToCountryId, from CurrentCountryId cookie second
12
+ const [cookieCountryId] = useCookie('CurrentCountryId');
13
+ const currentCountryId = billToCountryId ?? cookieCountryId;
13
14
  const [currentLanguageId] = useCookie('CurrentLanguageId');
14
15
  const hasSessionCountries = Boolean(sessionCountries?.length);
15
16
  const { data: apiCountries, error, isFetching, } = useFetchCountriesWithLanguages({
@@ -19,6 +20,11 @@ function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }) {
19
20
  const countries = hasSessionCountries
20
21
  ? sessionCountries
21
22
  : apiCountries;
23
+ const allLanguages = [
24
+ ...new Map(countries
25
+ ?.flatMap(country => country.languages)
26
+ .map(language => [language.id, language])).values(),
27
+ ];
22
28
  useEffect(() => {
23
29
  setSessionCountries(apiCountries);
24
30
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -55,8 +61,12 @@ function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }) {
55
61
  if (!defaultLanguage)
56
62
  throw new Error(`Unable to find the default language ${defaultLanguageCode} for country ${defaultCountry.name}`);
57
63
  const selectedCountry = countries.find(country => country.id === currentCountryId);
58
- const selectedLanguage = selectedCountry &&
59
- selectedCountry.languages.find(language => language.id === currentLanguageId);
64
+ const selectedLanguage = allLanguages.find(language => language.id === currentLanguageId);
65
+ // const selectedLanguage: Language | undefined =
66
+ // selectedCountry &&
67
+ // selectedCountry.languages.find(
68
+ // language => language.id === currentLanguageId,
69
+ // )
60
70
  return {
61
71
  countries,
62
72
  defaultCountry,
@@ -17,7 +17,7 @@ function ConnectedFooter({ className, onCountryLanguageChange, source, }) {
17
17
  const footerNavigationSection = data?.items
18
18
  .filter(isNavigationSection)
19
19
  .find(item => item.key === 'footer');
20
- return (jsx(Footer, { className: className, copyright: jsx(FormattedMessage, { id: "Copyright \u00A9 Sonic Equipment B.V." }), countrySelector: jsx(ConnectedCountrySelector, { defaultCountryCode: "NL", defaultLanguageCode: "EN", onChange: onCountryLanguageChange, showCountry: isAuthenticated === false }), footerNavigationSection: footerNavigationSection }));
20
+ return (jsx(Footer, { className: className, copyright: jsx(FormattedMessage, { id: "Copyright \u00A9 Sonic Equipment B.V." }), countrySelector: jsx(ConnectedCountrySelector, { defaultCountryCode: "NL", defaultLanguageCode: "EN", lockCountry: isAuthenticated === true, onChange: onCountryLanguageChange }), footerNavigationSection: footerNavigationSection }));
21
21
  }
22
22
 
23
23
  export { ConnectedFooter };
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { Link } from '../../buttons/link/link.js';
3
4
  import { StrokeDownloadIcon } from '../../icons/stroke/stroke-download-icon.js';
4
5
  import { FeatureList } from '../feature-list/feature-list.js';
5
6
  import styles from './download-document-list.module.css.js';
@@ -11,7 +12,7 @@ function DownloadDocumentList({ className, documents, }) {
11
12
  })), style: { valueAlignment: 'left' } }));
12
13
  }
13
14
  function DownloadListItem({ document: { href, name }, }) {
14
- return (jsxs("div", { className: styles['download-list-item'], children: [jsx(StrokeDownloadIcon, {}), jsx("a", { href: href, rel: "noreferrer", target: "_blank", children: name })] }));
15
+ return (jsxs("div", { className: styles['download-list-item'], children: [jsx(StrokeDownloadIcon, {}), jsx(Link, { href: href, rel: "download noreferrer", target: "_blank", children: name })] }));
15
16
  }
16
17
 
17
18
  export { DownloadDocumentList };
@@ -37,10 +37,10 @@ function ProductDetailsPanel({ priceComponent, product, }) {
37
37
  key: { label: specification.nameDisplay },
38
38
  value: specification.value,
39
39
  })) }) })), product.documents.length > 0 && (jsx(AccordionItem, { id: "downloads", title: jsx(FormattedMessage, { id: "Downloads" }), children: jsx(DownloadDocumentList, { className: styles['feature-list'], documents: product.documents
40
- .map(document => ({
41
- href: document.filePath,
42
- id: document.id,
43
- name: document.name,
40
+ .map(({ filePath, id, name }) => ({
41
+ href: `/${filePath.startsWith('/') ? filePath.slice(1) : filePath}`,
42
+ id,
43
+ name,
44
44
  }))
45
45
  .sort((a, b) => a.name.localeCompare(b.name)) }) }))] }) })] }));
46
46
  }
package/dist/styles.css CHANGED
@@ -4982,10 +4982,6 @@ button.swiper-pagination-bullet {
4982
4982
  line-height: 1;
4983
4983
  }
4984
4984
 
4985
- .country-selector-trigger-module-aioDu .country-selector-trigger-module-TE8tl .country-selector-trigger-module-GNRDD {
4986
- margin-inline: var(--space-4);
4987
- }
4988
-
4989
4985
  .details-module-yz0rE {
4990
4986
  --duration: var(--transition-duration-short);
4991
4987
  --arrow-size: 12px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "251.0.0",
3
+ "version": "253.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {