@sonic-equipment/ui 0.0.62 → 0.0.63

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/index.js CHANGED
@@ -778,9 +778,10 @@ async function getWishListItemsByWishListId({ wishListId, }) {
778
778
  });
779
779
  }
780
780
 
781
- function useFetchAllWishListsItems() {
781
+ function useFetchAllWishListsItems({ enabled = true } = { enabled: true }) {
782
782
  const queryClient = useQueryClient();
783
783
  return useQuery({
784
+ enabled,
784
785
  queryFn: async () => {
785
786
  const body =
786
787
  // Reuse existing data if available
@@ -817,8 +818,8 @@ function useFavorite() {
817
818
  return { signInUrl: state.signInUrl };
818
819
  }
819
820
  function useFavoriteProduct(productId) {
820
- const { data: entries, isFetching: isFetchingWishListItems } = useFetchAllWishListsItems();
821
821
  const isAuthenticated = useIsAuthenticated();
822
+ const { data: entries, isFetching: isFetchingWishListItems } = useFetchAllWishListsItems({ enabled: Boolean(isAuthenticated) });
822
823
  const entry = entries?.find(({ wishListItem }) => wishListItem.productId === productId);
823
824
  return {
824
825
  isFavorite: Boolean(entry),
@@ -1261,7 +1262,7 @@ function ProductPrice({ className, isVatIncluded, originalPrice, price, }) {
1261
1262
  var styles$F = {"product-sku":"product-sku-module-ITb8x"};
1262
1263
 
1263
1264
  function ProductSku({ sku }) {
1264
- return jsx("p", { className: styles$F['product-sku'], children: sku });
1265
+ return (jsx("p", { className: styles$F['product-sku'], "data-test-selector": "productNumber", children: sku }));
1265
1266
  }
1266
1267
 
1267
1268
  function isResponsiveImage(image) {
@@ -1310,7 +1311,7 @@ function PictureComponent({ className, fallbackSrc, fit = 'cover', hasError, ima
1310
1311
  var styles$D = {"product-card":"product-card-module-pLaiB","favorite-button":"product-card-module-tvEdz","content":"product-card-module-e0kMu","top":"product-card-module-Q0VvF","tag":"product-card-module-HkWBE","title":"product-card-module-CStNi","bottom":"product-card-module-kD2tU","image":"product-card-module-p-zoi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
1311
1312
 
1312
1313
  function ProductCard({ addToCartButton: AddToCartButton, areaSelected, favoriteButton: FavoriteButton, href, id, image, onClick, onMouseDown, onMouseMove, onPress, price, role, sku, tags, title, }) {
1313
- return (jsxs(RouteLink, { "aria-selected": areaSelected, className: styles$D['product-card'], href: href, id: id, onClick: onClick, onMouseDown: onMouseDown, onMouseMove: onMouseMove, onPress: onPress, role: role, children: [jsx("div", { className: styles$D.image, children: jsx(Image, { ...image }) }), jsx("div", { className: styles$D['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$D.content, children: [jsxs("div", { className: styles$D.top, children: [jsx("div", { className: styles$D.tag, children: tags?.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { optional: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) }), jsx("h2", { className: styles$D.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$D.bottom, children: [jsx("div", { className: styles$D.price, children: jsx(ProductPrice, { isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price }) }), jsx("div", { className: styles$D['add-to-cart-button'], children: AddToCartButton })] })] })] }));
1314
+ return (jsxs(RouteLink, { "aria-selected": areaSelected, className: styles$D['product-card'], "data-product-id": sku, href: href, id: id, onClick: onClick, onMouseDown: onMouseDown, onMouseMove: onMouseMove, onPress: onPress, role: role, children: [jsx("div", { className: styles$D.image, children: jsx(Image, { ...image }) }), jsx("div", { className: styles$D['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$D.content, children: [jsxs("div", { className: styles$D.top, children: [jsx("div", { className: styles$D.tag, children: tags?.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { optional: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) }), jsx("h2", { className: styles$D.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$D.bottom, children: [jsx("div", { className: styles$D.price, children: jsx(ProductPrice, { isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price }) }), jsx("div", { className: styles$D['add-to-cart-button'], children: AddToCartButton })] })] })] }));
1314
1315
  }
1315
1316
 
1316
1317
  /**
@@ -8267,7 +8268,7 @@ function StrokeRecentIcon(props) {
8267
8268
  function WithResults() {
8268
8269
  const { state } = useAlgoliaSearch();
8269
8270
  const { close } = useGlobalSearchDisclosure();
8270
- return (jsx("div", { children: jsx(SectionContainer, { buttons: jsxs(RouteButton, { className: clsx(styles$6['show-all-button'], buttonStyles.button, buttonStyles.secondary, buttonStyles.outline, buttonStyles.md), href: `/search?keyword=${state.query}`, onPress: close, children: [jsx(FormattedMessage, { id: "See all results" }), ")", jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })] }), leftContent: jsx(SuggestionsSection, {}), rightContent: jsx(ProductResultsSection, {}) }) }));
8271
+ return (jsx("div", { children: jsx(SectionContainer, { buttons: jsxs(RouteButton, { className: clsx(styles$6['show-all-button'], buttonStyles.button, buttonStyles.secondary, buttonStyles.outline, buttonStyles.md), href: `/search?keyword=${state.query}`, onPress: close, children: [jsx(FormattedMessage, { id: "See all results" }), jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })] }), leftContent: jsx(SuggestionsSection, {}), rightContent: jsx(ProductResultsSection, {}) }) }));
8271
8272
  }
8272
8273
  function SuggestionsSection() {
8273
8274
  const { autocomplete, categories, querySuggestions, recentSearches } = useAlgoliaSearch();
@@ -1,5 +1,9 @@
1
1
  import { WishListLineModel, WishListModel } from 'shared/api/shop/model/shop.model';
2
- export declare function useFetchAllWishListsItems(): import("@tanstack/react-query").UseQueryResult<{
2
+ interface UseFetchAllWishListsItemsArgs {
3
+ enabled?: boolean;
4
+ }
5
+ export declare function useFetchAllWishListsItems({ enabled }?: UseFetchAllWishListsItemsArgs): import("@tanstack/react-query").UseQueryResult<{
3
6
  wishList: WishListModel;
4
7
  wishListItem: WishListLineModel;
5
8
  }[], Error>;
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "0.0.62",
3
+ "version": "0.0.63",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {