@sonic-equipment/ui 179.0.0 → 181.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.
- package/dist/algolia/algolia-active-filters.js +4 -0
- package/dist/buttons/print-button/print-button.js +1 -0
- package/dist/footer/connected-footer.js +1 -0
- package/dist/forms/password-field/password-field.js +1 -0
- package/dist/forms/search-field/search-field.js +1 -0
- package/dist/header/connected-header.js +1 -0
- package/dist/pages/my-sonic/actions/change-customer/change-customer-dialog.js +1 -0
- package/dist/pages/my-sonic/actions/change-customer/change-customer.js +1 -0
- package/dist/pages/my-sonic/actions/change-customer/connected-change-customer-dialog.js +1 -0
- package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +1 -0
- package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.js +1 -0
- package/dist/pages/my-sonic/widgets/components/address-data-card.js +1 -0
- package/dist/pages/my-sonic/widgets/connected-bill-to-address-widget.js +1 -0
- package/dist/pages/my-sonic/widgets/connected-customer-information-widget.js +1 -0
- package/dist/pages/my-sonic/widgets/connected-ship-to-address-widget.js +1 -0
- package/dist/pages/my-sonic/widgets/connected-user-account-widget.js +1 -0
- package/dist/pages/product/product-details-page/components/product-details-recently-viewed-section/product-details-recently-viewed-section.js +1 -0
- package/dist/pages/product/product-details-page/product-details.js +2 -0
- package/dist/shared/api/bff/hooks/use-fetch-product-details-page-data.js +2 -6
- package/dist/shared/api/bff/services/bff-service.js +0 -2
- package/dist/shared/api/storefront/hooks/product/use-mark-product-as-viewed.d.ts +3 -2
- package/dist/shared/api/storefront/hooks/product/use-mark-product-as-viewed.js +4 -3
- package/dist/shared/routing/with-routing.js +1 -0
- package/package.json +2 -1
|
@@ -10,6 +10,10 @@ function AlgoliaActiveFilters() {
|
|
|
10
10
|
'hierarchicalCategories.lvl1',
|
|
11
11
|
'hierarchicalCategories.lvl2',
|
|
12
12
|
'hierarchicalCategories.lvl3',
|
|
13
|
+
'hierarchicalStorefrontCategories.lvl0',
|
|
14
|
+
'hierarchicalStorefrontCategories.lvl1',
|
|
15
|
+
'hierarchicalStorefrontCategories.lvl2',
|
|
16
|
+
'hierarchicalStorefrontCategories.lvl3',
|
|
13
17
|
];
|
|
14
18
|
const { refine: clearAllFilters } = useClearRefinements({
|
|
15
19
|
excludedAttributes: itemsToIgnore,
|
|
@@ -4,6 +4,7 @@ import { ConnectedProductCard } from '../../../cards/product-card/connected-prod
|
|
|
4
4
|
import { CardCarousel } from '../../../carousel/card-carousel/card-carousel.js';
|
|
5
5
|
import { ProductUSPCarousel } from '../../../carousel/usp-carousel/product-usp-carousel.js';
|
|
6
6
|
import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
7
|
+
import { useMarkProductAsRecentlyViewed } from '../../../shared/api/storefront/hooks/product/use-mark-product-as-viewed.js';
|
|
7
8
|
import { useDataLayer } from '../../../shared/ga/use-data-layer.js';
|
|
8
9
|
import { Heading } from '../../../typography/heading/heading.js';
|
|
9
10
|
import { Page } from '../../components/page/page.js';
|
|
@@ -14,6 +15,7 @@ import { ProductDetailsRecentlyViewedSection } from './components/product-detail
|
|
|
14
15
|
|
|
15
16
|
function ProductDetails({ data, priceComponent, }) {
|
|
16
17
|
const { breadCrumb, included, page, product, usps } = data;
|
|
18
|
+
useMarkProductAsRecentlyViewed({ productId: product.id });
|
|
17
19
|
useDataLayer({
|
|
18
20
|
event: {
|
|
19
21
|
event: 'view_item',
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { TIME } from '../../../utils/time.js';
|
|
3
3
|
import { fetchProductDetailsPageData } from '../services/bff-service.js';
|
|
4
4
|
|
|
5
5
|
function useFetchProductDetailsPageData(args) {
|
|
6
|
-
const queryClient = useQueryClient();
|
|
7
6
|
return useQuery({
|
|
8
7
|
gcTime: 1 * TIME.DAY,
|
|
9
|
-
queryFn: () =>
|
|
10
|
-
queryClient.removeQueries({ queryKey: ['products', 'recently-viewed'] });
|
|
11
|
-
return fetchProductDetailsPageData(args);
|
|
12
|
-
},
|
|
8
|
+
queryFn: () => fetchProductDetailsPageData(args),
|
|
13
9
|
queryKey: ['product-details-page-data', args.pageUrl, args.cultureCode],
|
|
14
10
|
staleTime: 1 * TIME.DAY,
|
|
15
11
|
});
|
|
@@ -2,7 +2,6 @@ import { config } from '../../../../config.js';
|
|
|
2
2
|
import { request } from '../../../fetch/request.js';
|
|
3
3
|
import { isAnnouncementType, isAnnouncementSubtype } from '../../../model/announcement.js';
|
|
4
4
|
import { TIME } from '../../../utils/time.js';
|
|
5
|
-
import { markProductAsRecentlyViewed } from '../../storefront/services/product-service.js';
|
|
6
5
|
|
|
7
6
|
async function fetchAnnouncements({ cultureCode, }) {
|
|
8
7
|
const { body } = await request({
|
|
@@ -46,7 +45,6 @@ async function fetchProductDetailsPageData({ cultureCode, pageUrl, }) {
|
|
|
46
45
|
},
|
|
47
46
|
url: `${config.BFF_API_URL}/pdp/?pageUrl=${pageUrl}`,
|
|
48
47
|
});
|
|
49
|
-
markProductAsRecentlyViewed({ productId: body.product.id });
|
|
50
48
|
return body;
|
|
51
49
|
}
|
|
52
50
|
async function fetchProductListingPageData({ cultureCode, pageUrl, }) {
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function useMarkProductAsRecentlyViewed({ productId, }: {
|
|
2
|
+
productId?: string;
|
|
3
|
+
}): import("@tanstack/react-query").UseQueryResult<void, Error>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { useQueryClient, useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { markProductAsRecentlyViewed } from '../../services/product-service.js';
|
|
3
3
|
|
|
4
|
-
function useMarkProductAsRecentlyViewed(
|
|
4
|
+
function useMarkProductAsRecentlyViewed({ productId, }) {
|
|
5
5
|
const queryClient = useQueryClient();
|
|
6
6
|
return useQuery({
|
|
7
|
+
enabled: Boolean(productId),
|
|
7
8
|
gcTime: 0,
|
|
8
9
|
queryFn: () => {
|
|
9
|
-
markProductAsRecentlyViewed(
|
|
10
|
+
markProductAsRecentlyViewed({ productId: productId });
|
|
10
11
|
queryClient.removeQueries({ queryKey: ['products', 'recently-viewed'] });
|
|
11
12
|
},
|
|
12
|
-
queryKey: ['mark-product-as-recently-viewed',
|
|
13
|
+
queryKey: ['mark-product-as-recently-viewed', productId],
|
|
13
14
|
staleTime: 0,
|
|
14
15
|
});
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonic-equipment/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "181.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"eslint-plugin-prettier": "5.4.0",
|
|
93
93
|
"eslint-plugin-react": "7.37.5",
|
|
94
94
|
"eslint-plugin-react-hooks": "5.2.0",
|
|
95
|
+
"eslint-plugin-react-server-components": "^1.2.0",
|
|
95
96
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
96
97
|
"eslint-plugin-sort-destructure-keys": "2.0.0",
|
|
97
98
|
"eslint-plugin-sort-keys-fix": "1.1.2",
|