@sonic-equipment/ui 180.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.
Files changed (23) hide show
  1. package/dist/buttons/print-button/print-button.js +1 -0
  2. package/dist/footer/connected-footer.js +1 -0
  3. package/dist/forms/password-field/password-field.js +1 -0
  4. package/dist/forms/search-field/search-field.js +1 -0
  5. package/dist/header/connected-header.js +1 -0
  6. package/dist/pages/my-sonic/actions/change-customer/change-customer-dialog.js +1 -0
  7. package/dist/pages/my-sonic/actions/change-customer/change-customer.js +1 -0
  8. package/dist/pages/my-sonic/actions/change-customer/connected-change-customer-dialog.js +1 -0
  9. package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +1 -0
  10. package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.js +1 -0
  11. package/dist/pages/my-sonic/widgets/components/address-data-card.js +1 -0
  12. package/dist/pages/my-sonic/widgets/connected-bill-to-address-widget.js +1 -0
  13. package/dist/pages/my-sonic/widgets/connected-customer-information-widget.js +1 -0
  14. package/dist/pages/my-sonic/widgets/connected-ship-to-address-widget.js +1 -0
  15. package/dist/pages/my-sonic/widgets/connected-user-account-widget.js +1 -0
  16. package/dist/pages/product/product-details-page/components/product-details-recently-viewed-section/product-details-recently-viewed-section.js +1 -0
  17. package/dist/pages/product/product-details-page/product-details.js +2 -0
  18. package/dist/shared/api/bff/hooks/use-fetch-product-details-page-data.js +2 -6
  19. package/dist/shared/api/bff/services/bff-service.js +0 -2
  20. package/dist/shared/api/storefront/hooks/product/use-mark-product-as-viewed.d.ts +3 -2
  21. package/dist/shared/api/storefront/hooks/product/use-mark-product-as-viewed.js +4 -3
  22. package/dist/shared/routing/with-routing.js +1 -0
  23. package/package.json +2 -1
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { FormattedMessage } from '../../intl/formatted-message.js';
3
4
  import { Button } from '../button/button.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { ConnectedCountrySelector } from '../country-selector/connected-country-selector.js';
3
4
  import { useCultureCode } from '../intl/use-culture-code.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useState, useCallback } from 'react';
3
4
  import { PasswordRevealToggle } from '../text-field/password-reveal-toggle/password-reveal-toggle.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useState } from 'react';
3
4
  import { StrokeSearchIcon } from '../../icons/stroke/stroke-search-icon.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useCultureCode } from '../intl/use-culture-code.js';
3
4
  import { useFetchNavigationLinks } from '../shared/api/bff/hooks/use-fetch-navigation-links.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useState } from 'react';
3
4
  import { FormattedMessage } from '../../../../intl/formatted-message.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsxs, jsx } from 'react/jsx-runtime';
2
3
  import { useRef, useMemo } from 'react';
3
4
  import { ListBox, ListBoxItem, Text } from 'react-aria-components';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useState } from 'react';
3
4
  import { usePatchSession } from '../../../../shared/api/storefront/hooks/authentication/use-patch-session.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import Cookies from 'js-cookie';
3
4
  import { logger } from '../../../logging/logger.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { Select } from '../../../forms/select/select.js';
3
4
  import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { Button } from '../../../../buttons/button/button.js';
3
4
  import { DataCard } from '../../../../cards/data-card/data-card.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useFetchCurrentBillToAddress } from '../../../shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.js';
3
4
  import { AddressDataCard } from './components/address-data-card.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
3
  import { useState } from 'react';
3
4
  import { Button } from '../../../buttons/button/button.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useFetchCurrentShipToAddress } from '../../../shared/api/storefront/hooks/customer/use-fetch-current-ship-to-address.js';
3
4
  import { AddressDataCard } from './components/address-data-card.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { Button } from '../../../buttons/button/button.js';
3
4
  import { DataCard } from '../../../cards/data-card/data-card.js';
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsxs, jsx } from 'react/jsx-runtime';
2
3
  import { ConnectedProductCard } from '../../../../../cards/product-card/connected-product-card.js';
3
4
  import { CardCarousel } from '../../../../../carousel/card-carousel/card-carousel.js';
@@ -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 { useQueryClient, useQuery } from '@tanstack/react-query';
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
- import { MarkProductAsRecentlyViewedArgs } from '../../services/product-service';
2
- export declare function useMarkProductAsRecentlyViewed(args: MarkProductAsRecentlyViewedArgs): import("@tanstack/react-query").UseQueryResult<void, Error>;
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(args) {
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(args);
10
+ markProductAsRecentlyViewed({ productId: productId });
10
11
  queryClient.removeQueries({ queryKey: ['products', 'recently-viewed'] });
11
12
  },
12
- queryKey: ['mark-product-as-recently-viewed', args.productId],
13
+ queryKey: ['mark-product-as-recently-viewed', productId],
13
14
  staleTime: 0,
14
15
  });
15
16
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createElement } from 'react';
2
3
  import { useNavigate } from './use-navigate.js';
3
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "180.0.0",
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",