@sonic-equipment/ui 258.1.3 → 259.0.1
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.
- package/dist/footer/connected-footer.d.ts +1 -3
- package/dist/footer/connected-footer.js +2 -2
- package/dist/global-search/search-result-panel/sections/with-results.js +21 -18
- package/dist/header/connected-header.d.ts +1 -3
- package/dist/header/connected-header.js +2 -2
- package/dist/header/header.js +1 -1
- package/dist/index.js +1 -1
- package/dist/shared/api/bff/hooks/use-fetch-navigation-links.d.ts +1 -1
- package/dist/shared/api/bff/hooks/use-fetch-navigation-links.js +3 -3
- package/dist/shared/api/bff/services/bff-service.d.ts +1 -4
- package/dist/shared/api/bff/services/bff-service.js +4 -11
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { OnCountryLanguageChangeHandler } from '../country-selector/connected-country-selector';
|
|
2
|
-
|
|
3
|
-
export declare function ConnectedFooter({ className, onCountryLanguageChange, source, }: {
|
|
2
|
+
export declare function ConnectedFooter({ className, onCountryLanguageChange, }: {
|
|
4
3
|
className?: string;
|
|
5
4
|
onCountryLanguageChange: OnCountryLanguageChangeHandler;
|
|
6
|
-
source: NavigationLinkSource;
|
|
7
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,9 +8,9 @@ import { isNavigationSection } from '../shared/api/bff/model/bff.model.js';
|
|
|
8
8
|
import { useIsAuthenticated } from '../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
|
|
9
9
|
import { Footer } from './footer.js';
|
|
10
10
|
|
|
11
|
-
function ConnectedFooter({ className, onCountryLanguageChange,
|
|
11
|
+
function ConnectedFooter({ className, onCountryLanguageChange, }) {
|
|
12
12
|
const cultureCode = useCultureCode();
|
|
13
|
-
const { data } = useFetchNavigationLinks({ cultureCode
|
|
13
|
+
const { data } = useFetchNavigationLinks({ cultureCode });
|
|
14
14
|
const isAuthenticated = useIsAuthenticated();
|
|
15
15
|
if (data && data.key !== 'navigation')
|
|
16
16
|
throw new Error('Invalid navigation data');
|
|
@@ -56,38 +56,41 @@ function ProductHitCard({ autocomplete, hit, index, source, }) {
|
|
|
56
56
|
// It is just a boolean prop defaulting to true
|
|
57
57
|
const { close } = useGlobalSearchDisclosure();
|
|
58
58
|
const { sendAddToCartFromSearchEvent, sendAddToWishListFromSearchEvent, sendProductClickFromSearchEvent, } = useAlgoliaInsights();
|
|
59
|
+
const { currencyCode, id, image, isVatIncluded, labels, name, objectId, originalPrice, position, price, queryId, storefrontId, storefrontSlug, } = hit;
|
|
60
|
+
const href = storefrontSlug;
|
|
59
61
|
return (jsx(ConnectedProductCard, { ...autocomplete.getItemProps({
|
|
60
62
|
item: hit.hit,
|
|
61
63
|
source,
|
|
62
|
-
}), addToCartEnabled: false, addToFavoritesEnabled: false, href:
|
|
64
|
+
}), addToCartEnabled: false, addToFavoritesEnabled: false, href: href, id: storefrontId, image: {
|
|
63
65
|
fit: 'contain',
|
|
64
|
-
image
|
|
65
|
-
title:
|
|
66
|
-
}, onAddToCart: ({ cartLine }) =>
|
|
66
|
+
image,
|
|
67
|
+
title: name,
|
|
68
|
+
}, onAddToCart: ({ cartLine }) => queryId &&
|
|
67
69
|
sendAddToCartFromSearchEvent({
|
|
68
70
|
cartLine,
|
|
69
|
-
queryId
|
|
71
|
+
queryId,
|
|
70
72
|
}), onClick: () => {
|
|
71
73
|
close();
|
|
72
|
-
if (
|
|
74
|
+
if (queryId) {
|
|
73
75
|
sendProductClickFromSearchEvent({
|
|
74
|
-
objectId
|
|
75
|
-
position:
|
|
76
|
-
queryId
|
|
76
|
+
objectId,
|
|
77
|
+
position: position || index + 1,
|
|
78
|
+
queryId,
|
|
77
79
|
});
|
|
80
|
+
}
|
|
78
81
|
}, onFavoriting: () => {
|
|
79
|
-
if (
|
|
82
|
+
if (queryId)
|
|
80
83
|
sendAddToWishListFromSearchEvent({
|
|
81
|
-
objectId
|
|
82
|
-
position:
|
|
83
|
-
queryId
|
|
84
|
+
objectId,
|
|
85
|
+
position: position || index + 1,
|
|
86
|
+
queryId,
|
|
84
87
|
});
|
|
85
88
|
}, price: {
|
|
86
|
-
currencyCode
|
|
87
|
-
isVatIncluded
|
|
88
|
-
originalPrice
|
|
89
|
-
price
|
|
90
|
-
}, sku:
|
|
89
|
+
currencyCode,
|
|
90
|
+
isVatIncluded,
|
|
91
|
+
originalPrice,
|
|
92
|
+
price,
|
|
93
|
+
}, sku: id, tags: labels, title: jsx(Highlight, { attribute: "name", hit: hit.hit }) }, storefrontId));
|
|
91
94
|
}
|
|
92
95
|
function ProductResultsSection() {
|
|
93
96
|
const { autocomplete, products: collection } = useAlgoliaSearch();
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function ConnectedHeader({ className, source, }: {
|
|
1
|
+
export declare function ConnectedHeader({ className }: {
|
|
3
2
|
className?: string;
|
|
4
|
-
source: NavigationLinkSource;
|
|
5
3
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,9 +5,9 @@ import { useFetchNavigationLinks } from '../shared/api/bff/hooks/use-fetch-navig
|
|
|
5
5
|
import { isNavigationSection } from '../shared/api/bff/model/bff.model.js';
|
|
6
6
|
import { Header } from './header.js';
|
|
7
7
|
|
|
8
|
-
function ConnectedHeader({ className
|
|
8
|
+
function ConnectedHeader({ className }) {
|
|
9
9
|
const cultureCode = useCultureCode();
|
|
10
|
-
const { data } = useFetchNavigationLinks({ cultureCode
|
|
10
|
+
const { data } = useFetchNavigationLinks({ cultureCode });
|
|
11
11
|
if (data && data.key !== 'navigation')
|
|
12
12
|
throw new Error('Invalid navigation data');
|
|
13
13
|
const headerNavigationSection = data?.items
|
package/dist/header/header.js
CHANGED
|
@@ -73,7 +73,7 @@ function Header({ className, headerNavigationSection, sticky, }) {
|
|
|
73
73
|
const mainNavigationSection = headerNavigationSection?.items
|
|
74
74
|
.filter(isNavigationSection)
|
|
75
75
|
.find(item => item.key === 'main-navigation');
|
|
76
|
-
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" }), jsx(ConnectedFavoritesButton, { "data-test-selector": "pageHeaderFavoritesButton", href:
|
|
76
|
+
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" }), jsx(ConnectedFavoritesButton, { "data-test-selector": "pageHeaderFavoritesButton", href: "abc" }), 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) }))] }));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export { Header };
|
package/dist/index.js
CHANGED
|
@@ -330,7 +330,7 @@ export { useFetchProductDetailsPageData } from './shared/api/bff/hooks/use-fetch
|
|
|
330
330
|
export { useFetchProductListingPageData } from './shared/api/bff/hooks/use-fetch-product-listing-page-data.js';
|
|
331
331
|
export { useFetchProductsPrices } from './shared/api/bff/hooks/use-fetch-products-prices.js';
|
|
332
332
|
export { useFetchRecentlyViewedProducts } from './shared/api/bff/hooks/use-fetch-recently-viewed-products.js';
|
|
333
|
-
export { fetchAnnouncements, fetchNavigationLinks, fetchProductDetailsPageData, fetchProductListingPageData, fetchProductsPrices, fetchRecentlyViewedProducts,
|
|
333
|
+
export { fetchAnnouncements, fetchNavigationLinks, fetchProductDetailsPageData, fetchProductListingPageData, fetchProductsPrices, fetchRecentlyViewedProducts, patchCart, placeOrder, saveCartForLater } from './shared/api/bff/services/bff-service.js';
|
|
334
334
|
export { useAwaitableMutation } from './shared/api/shared/hooks/use-awaitable-mutation.js';
|
|
335
335
|
export { useCreateAccount } from './shared/api/storefront/hooks/account/use-create-account.js';
|
|
336
336
|
export { useCreateGuestAccount } from './shared/api/storefront/hooks/account/use-create-guest-account.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FetchNavigationLinksArgs } from '../services/bff-service';
|
|
2
|
-
export declare function useFetchNavigationLinks({ cultureCode,
|
|
2
|
+
export declare function useFetchNavigationLinks({ cultureCode, }: FetchNavigationLinksArgs): import("@tanstack/react-query").UseQueryResult<import("../model/bff.model").NavigationSection, Error>;
|
|
@@ -3,11 +3,11 @@ import { useQuery } from '@tanstack/react-query';
|
|
|
3
3
|
import { TIME } from '../../../utils/time.js';
|
|
4
4
|
import { fetchNavigationLinks } from '../services/bff-service.js';
|
|
5
5
|
|
|
6
|
-
function useFetchNavigationLinks({ cultureCode,
|
|
6
|
+
function useFetchNavigationLinks({ cultureCode, }) {
|
|
7
7
|
return useQuery({
|
|
8
8
|
gcTime: 1 * TIME.DAY,
|
|
9
|
-
queryFn: () => fetchNavigationLinks({ cultureCode
|
|
10
|
-
queryKey: ['navigation',
|
|
9
|
+
queryFn: () => fetchNavigationLinks({ cultureCode }),
|
|
10
|
+
queryKey: ['navigation', cultureCode],
|
|
11
11
|
refetchInterval: 5 * TIME.MINUTE,
|
|
12
12
|
staleTime: 1 * TIME.DAY,
|
|
13
13
|
});
|
|
@@ -15,13 +15,10 @@ export interface FetchProductPageDataArgs {
|
|
|
15
15
|
}
|
|
16
16
|
export declare function fetchProductDetailsPageData({ cultureCode, headers, ignoreCache, pageUrl, }: FetchProductPageDataArgs & APIArguments): Promise<ProductDetailsPageDataResponse>;
|
|
17
17
|
export declare function fetchProductListingPageData({ cultureCode, headers, ignoreCache, pageUrl, }: FetchProductPageDataArgs & APIArguments): Promise<ProductListingPageData>;
|
|
18
|
-
export type NavigationLinkSource = 'shop' | 'marketing';
|
|
19
|
-
export declare function isNavigationLinkSource(value: unknown): value is NavigationLinkSource;
|
|
20
18
|
export interface FetchNavigationLinksArgs {
|
|
21
19
|
cultureCode: CultureCode;
|
|
22
|
-
source: NavigationLinkSource;
|
|
23
20
|
}
|
|
24
|
-
export declare function fetchNavigationLinks({ cultureCode, headers, ignoreCache,
|
|
21
|
+
export declare function fetchNavigationLinks({ cultureCode, headers, ignoreCache, }: FetchNavigationLinksArgs & APIArguments): Promise<NavigationResponse>;
|
|
25
22
|
export declare function fetchRecentlyViewedProducts({ cultureCode, }: {
|
|
26
23
|
cultureCode: CultureCode;
|
|
27
24
|
}): Promise<ProductSummary[]>;
|
|
@@ -97,21 +97,14 @@ async function fetchProductListingPageData({ cultureCode, headers, ignoreCache,
|
|
|
97
97
|
})),
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
return value === 'shop' || value === 'marketing';
|
|
102
|
-
}
|
|
103
|
-
async function fetchNavigationLinks({ cultureCode, headers, ignoreCache, source, }) {
|
|
100
|
+
async function fetchNavigationLinks({ cultureCode, headers, ignoreCache, }) {
|
|
104
101
|
const { body } = await request({
|
|
105
|
-
headers: { 'Current-Language-Id': cultureCode,
|
|
102
|
+
headers: { 'Current-Language-Id': cultureCode, ...headers },
|
|
106
103
|
next: {
|
|
107
104
|
revalidate: ignoreCache ? 0 : Infinity,
|
|
108
105
|
tags: ignoreCache
|
|
109
106
|
? undefined
|
|
110
|
-
: [
|
|
111
|
-
'navigation',
|
|
112
|
-
`navigation-${source}`,
|
|
113
|
-
`navigation-${source}-${cultureCode}`,
|
|
114
|
-
],
|
|
107
|
+
: ['navigation', `navigation-${cultureCode}`],
|
|
115
108
|
},
|
|
116
109
|
url: `${config.BFF_API_URL}/v2/navigation`,
|
|
117
110
|
});
|
|
@@ -183,4 +176,4 @@ async function saveCartForLater({ cart }) {
|
|
|
183
176
|
return body;
|
|
184
177
|
}
|
|
185
178
|
|
|
186
|
-
export { fetchAnnouncements, fetchNavigationLinks, fetchProductDetailsPageData, fetchProductListingPageData, fetchProductsPrices, fetchRecentlyViewedProducts,
|
|
179
|
+
export { fetchAnnouncements, fetchNavigationLinks, fetchProductDetailsPageData, fetchProductListingPageData, fetchProductsPrices, fetchRecentlyViewedProducts, patchCart, placeOrder, saveCartForLater };
|
package/dist/styles.css
CHANGED