@sonic-equipment/ui 146.0.0 → 147.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.
|
@@ -19,14 +19,15 @@ function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }) {
|
|
|
19
19
|
const [currentCountryId] = useCookie('CurrentCountryId', cookieOptions);
|
|
20
20
|
const [currentLanguageId] = useCookie('CurrentLanguageId', cookieOptions);
|
|
21
21
|
const [contextLanguageCode] = useCookie('SetContextLanguageCode', cookieOptions);
|
|
22
|
+
const hasSessionCountries = Boolean(sessionCountries?.length);
|
|
22
23
|
const { data: apiCountries, error, isFetching, } = useFetchCountriesWithLanguages({
|
|
23
|
-
enabled: !
|
|
24
|
+
enabled: !hasSessionCountries,
|
|
24
25
|
select: countries => countries.filter(country => isCountry(country)),
|
|
25
26
|
});
|
|
26
|
-
const countries =
|
|
27
|
+
const countries = hasSessionCountries
|
|
28
|
+
? sessionCountries
|
|
29
|
+
: apiCountries;
|
|
27
30
|
useEffect(() => {
|
|
28
|
-
if (sessionCountries)
|
|
29
|
-
return;
|
|
30
31
|
setSessionCountries(apiCountries);
|
|
31
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
33
|
}, [apiCountries]);
|
|
@@ -8,7 +8,7 @@ function ProductOverviewGrid({ children, isLoading, }) {
|
|
|
8
8
|
// eslint-disable-next-line @eslint-react/no-children-map
|
|
9
9
|
Children.map(children, (child, index) => (
|
|
10
10
|
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
11
|
-
jsx("div", { className: styles['grid-item'], children: child }, index))), isLoading && (jsx("div", { className: styles['loading-panel'], children: jsx(ProgressCircle, { className: styles['progress-circle'] }) }))] }));
|
|
11
|
+
jsx("div", { className: styles['grid-item'], children: child }, index))), isLoading && (jsx("div", { className: styles['loading-panel'], children: jsx(ProgressCircle, { className: styles['progress-circle'], variant: "gray" }) }))] }));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export { ProductOverviewGrid };
|
|
@@ -16,7 +16,7 @@ function isLanguage(language) {
|
|
|
16
16
|
function isCountry(country) {
|
|
17
17
|
if (typeof country !== 'object' || country === null)
|
|
18
18
|
return false;
|
|
19
|
-
if (!('abbreviation' in country) || isCountryCode(country.abbreviation))
|
|
19
|
+
if (!('abbreviation' in country) || !isCountryCode(country.abbreviation))
|
|
20
20
|
return false;
|
|
21
21
|
if (!('id' in country) || typeof country.id !== 'string')
|
|
22
22
|
return false;
|