@propeller-commerce/propeller-v2-react-ui 0.19.2 → 0.20.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/index.d.cts CHANGED
@@ -2598,6 +2598,8 @@ interface AccountIconAndMenuProps {
2598
2598
  iconClassName?: string;
2599
2599
  /** Additional class name for the dropdown menu. */
2600
2600
  menuClassName?: string;
2601
+ /** Additional class name for each sidebar menu link. */
2602
+ linkClassName?: string;
2601
2603
  /**
2602
2604
  * Component variant.
2603
2605
  * - 'dropdown' (default): Header icon with popup menu
@@ -4287,10 +4289,14 @@ declare function DeliveryDate(rawProps: DeliveryDateProps): React$1.JSX.Element;
4287
4289
 
4288
4290
  interface GridPaginationProps {
4289
4291
  /**
4290
- * A ProductsResponse object for populating the pagination component.
4291
- * Reads `page` (current page), `pages` (total pages) from the response.
4292
+ * Pagination state: `page` (current page) and `pages` (total pages).
4293
+ * Structural, so a `ProductsResponse` fits as-is and callers holding the two
4294
+ * numbers on their own — `useSpareParts`, `FavoriteListDetails` — need no cast.
4292
4295
  */
4293
- products: ProductsResponse;
4296
+ products: Pick<ProductsResponse, 'page' | 'pages'> | {
4297
+ page?: number;
4298
+ pages?: number;
4299
+ };
4294
4300
  /**
4295
4301
  * Called when the user navigates to a different page.
4296
4302
  * Receives the newly selected page number (1-based).
@@ -4455,6 +4461,11 @@ interface FavoriteListDetailsProps {
4455
4461
  graphqlClient?: GraphQLClient;
4456
4462
  /** The logged in user for which the favorite list is going to be displayed. Resolved from PropellerProvider when omitted. */
4457
4463
  user?: Contact | Customer;
4464
+ /**
4465
+ * Active company ID from the company switcher.
4466
+ * Overrides the user's default company for price calculation.
4467
+ * Triggers a re-fetch when changed. */
4468
+ companyId?: number;
4458
4469
  /** The favorite list ID to display */
4459
4470
  favoriteListId: string;
4460
4471
  /** Action method for deleting a single favorite list item. If not provided, delete button is hidden */
@@ -4864,7 +4875,7 @@ interface GridToolbarProps {
4864
4875
  * Controls which icon the view-toggle button shows.
4865
4876
  * Defaults to 'grid'.
4866
4877
  */
4867
- viewMode?: string;
4878
+ viewMode?: 'grid' | 'list';
4868
4879
  /**
4869
4880
  * Available page-size options shown in the per-page dropdown.
4870
4881
  * Defaults to [12, 24, 48].
@@ -4889,7 +4900,7 @@ interface GridToolbarProps {
4889
4900
  * Called when the user clicks the view-mode toggle button.
4890
4901
  * Receives the new mode: 'grid' or 'list'.
4891
4902
  */
4892
- onViewChange?: (mode: string) => void;
4903
+ onViewChange?: (mode: 'grid' | 'list') => void;
4893
4904
  /**
4894
4905
  * Total products found — displayed as a result count on the left side.
4895
4906
  * Pass 0 or undefined to hide the count.
@@ -6305,9 +6316,10 @@ declare function ProductDescription(props: ProductDescriptionProps): React$1.JSX
6305
6316
  interface ProductDownloadsProps {
6306
6317
  /**
6307
6318
  * Media documents for the product.
6308
- * Obtain from `product.media.documents`.
6319
+ * Obtain from `product.media?.documents`. The API answers `null` rather than
6320
+ * an empty page when a product has none, so this may be absent.
6309
6321
  */
6310
- downloads: PaginatedMediaDocumentResponse;
6322
+ downloads?: PaginatedMediaDocumentResponse | null;
6311
6323
  /**
6312
6324
  * Language code used to resolve the correct localised document URL and label.
6313
6325
  */
@@ -6414,16 +6426,6 @@ interface ProductGridProps {
6414
6426
  * of this prop. Defaults to false.
6415
6427
  */
6416
6428
  isLoading?: boolean;
6417
- /**
6418
- * Provide a custom product card renderer.
6419
- * Falls back to the built-in `<ProductCard>` when not set.
6420
- */
6421
- renderProductCard?: (product: Product) => any;
6422
- /**
6423
- * Provide a custom cluster card renderer.
6424
- * Falls back to the built-in `<ClusterCard>` when not set.
6425
- */
6426
- renderClusterCard?: (cluster: Cluster) => any;
6427
6429
  /**
6428
6430
  * Controls portal visibility mode.
6429
6431
  * 'open' — full e-commerce; AddToCart is visible in product cards.
@@ -7080,9 +7082,10 @@ declare function ProductSpecifications(rawProps: ProductSpecificationsProps): Re
7080
7082
  interface ProductVideosProps {
7081
7083
  /**
7082
7084
  * Media videos for the product.
7083
- * Obtain from `product.media.videos`.
7085
+ * Obtain from `product.media?.videos`. The API answers `null` rather than an
7086
+ * empty page when a product has none, so this may be absent.
7084
7087
  */
7085
- videos: PaginatedMediaVideoResponse;
7088
+ videos?: PaginatedMediaVideoResponse | null;
7086
7089
  /**
7087
7090
  * Language code used to resolve the correct localised video URI.
7088
7091
  */
package/dist/index.d.ts CHANGED
@@ -2598,6 +2598,8 @@ interface AccountIconAndMenuProps {
2598
2598
  iconClassName?: string;
2599
2599
  /** Additional class name for the dropdown menu. */
2600
2600
  menuClassName?: string;
2601
+ /** Additional class name for each sidebar menu link. */
2602
+ linkClassName?: string;
2601
2603
  /**
2602
2604
  * Component variant.
2603
2605
  * - 'dropdown' (default): Header icon with popup menu
@@ -4287,10 +4289,14 @@ declare function DeliveryDate(rawProps: DeliveryDateProps): React$1.JSX.Element;
4287
4289
 
4288
4290
  interface GridPaginationProps {
4289
4291
  /**
4290
- * A ProductsResponse object for populating the pagination component.
4291
- * Reads `page` (current page), `pages` (total pages) from the response.
4292
+ * Pagination state: `page` (current page) and `pages` (total pages).
4293
+ * Structural, so a `ProductsResponse` fits as-is and callers holding the two
4294
+ * numbers on their own — `useSpareParts`, `FavoriteListDetails` — need no cast.
4292
4295
  */
4293
- products: ProductsResponse;
4296
+ products: Pick<ProductsResponse, 'page' | 'pages'> | {
4297
+ page?: number;
4298
+ pages?: number;
4299
+ };
4294
4300
  /**
4295
4301
  * Called when the user navigates to a different page.
4296
4302
  * Receives the newly selected page number (1-based).
@@ -4455,6 +4461,11 @@ interface FavoriteListDetailsProps {
4455
4461
  graphqlClient?: GraphQLClient;
4456
4462
  /** The logged in user for which the favorite list is going to be displayed. Resolved from PropellerProvider when omitted. */
4457
4463
  user?: Contact | Customer;
4464
+ /**
4465
+ * Active company ID from the company switcher.
4466
+ * Overrides the user's default company for price calculation.
4467
+ * Triggers a re-fetch when changed. */
4468
+ companyId?: number;
4458
4469
  /** The favorite list ID to display */
4459
4470
  favoriteListId: string;
4460
4471
  /** Action method for deleting a single favorite list item. If not provided, delete button is hidden */
@@ -4864,7 +4875,7 @@ interface GridToolbarProps {
4864
4875
  * Controls which icon the view-toggle button shows.
4865
4876
  * Defaults to 'grid'.
4866
4877
  */
4867
- viewMode?: string;
4878
+ viewMode?: 'grid' | 'list';
4868
4879
  /**
4869
4880
  * Available page-size options shown in the per-page dropdown.
4870
4881
  * Defaults to [12, 24, 48].
@@ -4889,7 +4900,7 @@ interface GridToolbarProps {
4889
4900
  * Called when the user clicks the view-mode toggle button.
4890
4901
  * Receives the new mode: 'grid' or 'list'.
4891
4902
  */
4892
- onViewChange?: (mode: string) => void;
4903
+ onViewChange?: (mode: 'grid' | 'list') => void;
4893
4904
  /**
4894
4905
  * Total products found — displayed as a result count on the left side.
4895
4906
  * Pass 0 or undefined to hide the count.
@@ -6305,9 +6316,10 @@ declare function ProductDescription(props: ProductDescriptionProps): React$1.JSX
6305
6316
  interface ProductDownloadsProps {
6306
6317
  /**
6307
6318
  * Media documents for the product.
6308
- * Obtain from `product.media.documents`.
6319
+ * Obtain from `product.media?.documents`. The API answers `null` rather than
6320
+ * an empty page when a product has none, so this may be absent.
6309
6321
  */
6310
- downloads: PaginatedMediaDocumentResponse;
6322
+ downloads?: PaginatedMediaDocumentResponse | null;
6311
6323
  /**
6312
6324
  * Language code used to resolve the correct localised document URL and label.
6313
6325
  */
@@ -6414,16 +6426,6 @@ interface ProductGridProps {
6414
6426
  * of this prop. Defaults to false.
6415
6427
  */
6416
6428
  isLoading?: boolean;
6417
- /**
6418
- * Provide a custom product card renderer.
6419
- * Falls back to the built-in `<ProductCard>` when not set.
6420
- */
6421
- renderProductCard?: (product: Product) => any;
6422
- /**
6423
- * Provide a custom cluster card renderer.
6424
- * Falls back to the built-in `<ClusterCard>` when not set.
6425
- */
6426
- renderClusterCard?: (cluster: Cluster) => any;
6427
6429
  /**
6428
6430
  * Controls portal visibility mode.
6429
6431
  * 'open' — full e-commerce; AddToCart is visible in product cards.
@@ -7080,9 +7082,10 @@ declare function ProductSpecifications(rawProps: ProductSpecificationsProps): Re
7080
7082
  interface ProductVideosProps {
7081
7083
  /**
7082
7084
  * Media videos for the product.
7083
- * Obtain from `product.media.videos`.
7085
+ * Obtain from `product.media?.videos`. The API answers `null` rather than an
7086
+ * empty page when a product has none, so this may be absent.
7084
7087
  */
7085
- videos: PaginatedMediaVideoResponse;
7088
+ videos?: PaginatedMediaVideoResponse | null;
7086
7089
  /**
7087
7090
  * Language code used to resolve the correct localised video URI.
7088
7091
  */
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { getLabel, getLocalizedValue, formatPrice, localeForLanguage, getClusterSku, getClusterImageUrl, isContentHidden, getProductSku, getProductImageUrl, createServices, err, ok, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses, attributeNameMatches, getAttributeDisplayName, filterProductsBySelections, extractAttributeValues, buildInventoryFilter, MIN_STOCK_THRESHOLD, getNettedBonusItems, getLanguageString, collectAttributeValues, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
2
+ import { getLabel, getLocalizedValue, formatPrice, localeForLanguage, getClusterSku, getClusterImageUrl, isContentHidden, getProductSku, getProductImageUrl, isCheckoutAllowed, createServices, err, ok, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses, attributeNameMatches, getAttributeDisplayName, filterProductsBySelections, extractAttributeValues, buildInventoryFilter, findPurchaserPac, isOverAuthorizationLimit, MIN_STOCK_THRESHOLD, getNettedBonusItems, getLanguageString, collectAttributeValues, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
3
3
  export * from '@propeller-commerce/propeller-v2-core-ui';
4
4
  import * as React6 from 'react';
5
5
  import { createContext, useState, useRef, useCallback, useMemo, useContext, useEffect } from 'react';
6
6
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
7
- import { ProductStatus, ProductSortField, SortOrder, PurchaseRole, CrossupsellType, CartStatus, CartAddressType, Gender, YesNo, AddressType, MagicTokenService, PaymentStatuses, OrderSearchFields, OrderItemClass, ProductSearchableField, machineService, AttributeType, OrderSortField, OrderType, BundleCondition, OrderDiscountType } from '@propeller-commerce/propeller-sdk-v2';
7
+ import { ProductStatus, ProductSortField, SortOrder, CrossupsellType, CartStatus, CartAddressType, Gender, YesNo, AddressType, MagicTokenService, PaymentStatuses, OrderSearchFields, OrderItemClass, ProductSearchableField, machineService, PurchaseRole, AttributeType, OrderSortField, OrderType, BundleCondition, OrderDiscountType } from '@propeller-commerce/propeller-sdk-v2';
8
8
  import { clsx } from 'clsx';
9
9
  import { twMerge } from 'tailwind-merge';
10
10
  import { User } from 'lucide-react';
@@ -725,6 +725,7 @@ var DEFAULT_IMAGE_VARIANT_FILTERS = {
725
725
  function useCart(options) {
726
726
  const { graphqlClient, user, companyId, configuration, onCartCreated } = options;
727
727
  const language = options.language || configuration?.language || "NL";
728
+ const resolvedCompanyId = companyId ?? (user && "contactId" in user ? user.company?.companyId : void 0);
728
729
  const [cart, setCart] = useState(null);
729
730
  const [createdCartId, setCreatedCartId] = useState("");
730
731
  const cartId = options.cartId || createdCartId;
@@ -746,20 +747,10 @@ function useCart(options) {
746
747
  const [loading, setLoading] = useState(false);
747
748
  const [error, setError] = useState(null);
748
749
  const notesTimers = useRef({});
749
- const checkoutAllowed = useMemo(() => {
750
- if (!user || !("contactId" in user)) return true;
751
- if (!companyId) return true;
752
- if (!cart) return true;
753
- const pacData = user.purchaseAuthorizationConfigs;
754
- const items = pacData?.items ?? [];
755
- const purchaserPac = items.find(
756
- (pac) => pac.purchaseRole === PurchaseRole.PURCHASER && pac.company?.companyId === companyId
757
- );
758
- if (!purchaserPac) return true;
759
- const limit = purchaserPac.authorizationLimit ?? 0;
760
- const totalGross = cart.total?.totalGross ?? 0;
761
- return totalGross <= limit;
762
- }, [user, companyId, cart]);
750
+ const checkoutAllowed = useMemo(
751
+ () => isCheckoutAllowed(user, companyId, cart),
752
+ [user, companyId, cart]
753
+ );
763
754
  function getMinQuantity(product) {
764
755
  const min = product?.minimumQuantity;
765
756
  return min && min > 0 ? min : 1;
@@ -948,7 +939,8 @@ function useCart(options) {
948
939
  imageVariantFilters: opts.imageVariantFilters ?? imageVariantFilters(),
949
940
  priceCalculateProductInput: {
950
941
  taxZone: taxZone || "NL",
951
- ...user && "company" in user && { companyId: user?.company?.companyId },
942
+ // Switcher selection wins; the contact's default company is the fallback.
943
+ ...resolvedCompanyId !== void 0 && { companyId: resolvedCompanyId },
952
944
  ...user && "contactId" in user && { contactId: user?.contactId },
953
945
  ...user && "customerId" in user && { customerId: user?.customerId }
954
946
  }
@@ -958,7 +950,7 @@ function useCart(options) {
958
950
  } catch {
959
951
  return [];
960
952
  }
961
- }, [graphqlClient, language, user, imageSearchFilters, imageVariantFilters]);
953
+ }, [graphqlClient, language, user, resolvedCompanyId, imageSearchFilters, imageVariantFilters]);
962
954
  return { cart, cartId, loading, error, checkoutAllowed, resolveCart, addItem, addItems, updateItemQuantity, updateItemNotes, deleteItem, addActionCode, removeActionCode, requestAuthorization, processCart, getCrossupsells, getMinQuantity, getStep };
963
955
  }
964
956
  function buildAddressInput(type, addr) {
@@ -4191,7 +4183,9 @@ function AccountIconAndMenu(rawProps) {
4191
4183
  href: link.href,
4192
4184
  onClick: (event) => handleMenuLinkClick(event, link.href),
4193
4185
  "data-active": isActiveLink(link.href) ? "true" : "false",
4194
- className: `propeller-account-menu__link flex w-full items-center gap-3 px-4 py-2.5 text-sm font-medium transition-colors ${isActiveLink(link.href) ? "bg-secondary/5 text-secondary border-l-2 border-secondary" : "text-muted-foreground hover:bg-surface-hover hover:text-foreground"}`,
4186
+ className: cn(
4187
+ `propeller-account-menu__link flex w-full items-center gap-3 px-4 py-2.5 text-sm font-medium transition-colors ${isActiveLink(link.href) ? "bg-primary/5 text-primary border-l-2 border-primary" : "text-muted-foreground hover:bg-surface-hover hover:text-foreground"}${props.linkClassName ? " " + props.linkClassName : ""}`
4188
+ ),
4195
4189
  children: link.label
4196
4190
  }
4197
4191
  ) }, link.href)) }) }),
@@ -4213,7 +4207,7 @@ function AccountIconAndMenu(rawProps) {
4213
4207
  onClick: (event) => handleIconClick(),
4214
4208
  "aria-label": getLabel(props.labels, "accountLabel", "Account"),
4215
4209
  "data-open": menuOpen ? "true" : "false",
4216
- className: cn(`propeller-account-menu__trigger inline-flex items-center gap-2 px-3 py-2 rounded-control text-sm font-medium transition-colors text-white hover:bg-white/10${props.iconClassName ? " " + props.iconClassName : ""}`),
4210
+ className: cn(`propeller-account-menu__trigger inline-flex items-center gap-2 px-3 py-2 rounded-control text-sm font-medium transition-colors text-foreground hover:bg-surface-hover${props.iconClassName ? " " + props.iconClassName : ""}`),
4217
4211
  children: [
4218
4212
  /* @__PURE__ */ jsx(
4219
4213
  "svg",
@@ -6611,6 +6605,7 @@ function ItemStock(props) {
6611
6605
  getTotalQuantity() > 0 ? /* @__PURE__ */ jsxs("span", { className: "propeller-item-stock__count opacity-70", children: [
6612
6606
  "(",
6613
6607
  getTotalQuantity(),
6608
+ " ",
6614
6609
  getLabel(props.labels, "pieces", "pcs"),
6615
6610
  ")"
6616
6611
  ] }) : null
@@ -6844,7 +6839,7 @@ function CartItem(rawProps) {
6844
6839
  }
6845
6840
  useEffect(() => {
6846
6841
  fetchCrossupsells();
6847
- }, []);
6842
+ }, [props.companyId]);
6848
6843
  useEffect(() => {
6849
6844
  setQuantity(props.cartItem.quantity || 1);
6850
6845
  setNotes(props.cartItem.notes || "");
@@ -7298,13 +7293,6 @@ CartItemExport.Price = CartItemPrice;
7298
7293
  CartItemExport.Quantity = CartItemQuantity;
7299
7294
  CartItemExport.Delete = CartItemDelete;
7300
7295
  var CartItem_default = CartItemExport;
7301
- function findPurchaserPAC(user, companyId) {
7302
- if (!user || !("contactId" in user) || !companyId) return void 0;
7303
- const items = user.purchaseAuthorizationConfigs?.items ?? [];
7304
- return items.find(
7305
- (pac) => pac.purchaseRole === PurchaseRole.PURCHASER && pac.company?.companyId === companyId
7306
- );
7307
- }
7308
7296
  function CartIconAndSidebar(rawProps) {
7309
7297
  const props = useInfraProps(rawProps);
7310
7298
  const CartBonusItemsImpl = props.cartBonusItemsComponent ?? CartBonusItems_default;
@@ -7335,10 +7323,9 @@ function CartIconAndSidebar(rawProps) {
7335
7323
  return useTax ? getLabel(props.labels, key, "Total") : getLabel(props.labels, "totalExclVat", "Total excl. VAT");
7336
7324
  }
7337
7325
  const sidebarTitle = props.cartSidebarTitle || props.labels?.["cartSidebarTitle"] || "Shopping cart";
7338
- const purchaserPAC = findPurchaserPAC(props.user, props.companyId);
7339
- const totalGross = props.cart?.total?.totalGross ?? 0;
7340
- const overLimit = !!purchaserPAC && totalGross > (purchaserPAC.authorizationLimit ?? 0);
7341
- const showCheckoutButton = props.cartCheckoutButton === false ? false : !props.user || !("contactId" in props.user) || !props.companyId || !purchaserPAC ? true : !overLimit;
7326
+ const purchaserPAC = findPurchaserPac(props.user, props.companyId);
7327
+ const overLimit = isOverAuthorizationLimit(props.user, props.companyId, props.cart);
7328
+ const showCheckoutButton = props.cartCheckoutButton === false ? false : !purchaserPAC ? true : !overLimit;
7342
7329
  const showRequestAuthorizationButton = !!purchaserPAC && overLimit;
7343
7330
  function handleIconClick() {
7344
7331
  if (props.showCartSidebarOnClick !== false) {
@@ -7951,17 +7938,7 @@ function CartSummary(rawProps) {
7951
7938
  }
7952
7939
  }
7953
7940
  function showRequestAuthorizationButton() {
7954
- if (!props.user || !("contactId" in props.user)) return false;
7955
- if (!props.companyId) return false;
7956
- if (!props.cart) return false;
7957
- const items = props.user.purchaseAuthorizationConfigs?.items ?? [];
7958
- const purchaserPAC = items.find(
7959
- (pac) => pac.purchaseRole === PurchaseRole.PURCHASER && Number(pac.company?.companyId) === Number(props.companyId)
7960
- );
7961
- if (!purchaserPAC) return false;
7962
- const limit = purchaserPAC.authorizationLimit ?? 0;
7963
- const totalGross = props.cart.total?.totalGross ?? 0;
7964
- return totalGross > limit;
7941
+ return isOverAuthorizationLimit(props.user, props.companyId, props.cart);
7965
7942
  }
7966
7943
  function showRequestQuoteButton() {
7967
7944
  return !!props.onRequestQuoteClick && !!props.user && "contactId" in props.user;
@@ -8101,7 +8078,7 @@ function CategoryDescription(props) {
8101
8078
  !shouldTruncate || expanded ? /* @__PURE__ */ jsx(
8102
8079
  "div",
8103
8080
  {
8104
- className: "propeller-category-description__content prose prose-slate max-w-none text-muted-foreground",
8081
+ className: "propeller-category-description__content text-muted-foreground",
8105
8082
  dangerouslySetInnerHTML: { __html: html }
8106
8083
  }
8107
8084
  ) : /* @__PURE__ */ jsx("p", { className: "propeller-category-description__truncated text-muted-foreground", children: getTruncated() }),
@@ -8127,7 +8104,7 @@ function CategoryShortDescription(props) {
8127
8104
  return /* @__PURE__ */ jsx(Fragment, { children: !!html ? /* @__PURE__ */ jsx("div", { className: cn(`propeller-category-short-description mb-6 ${props.className || ""}`), children: /* @__PURE__ */ jsx(
8128
8105
  "div",
8129
8106
  {
8130
- className: "propeller-category-short-description__content prose prose-slate max-w-none text-muted-foreground",
8107
+ className: "propeller-category-short-description__content text-muted-foreground",
8131
8108
  dangerouslySetInnerHTML: { __html: html }
8132
8109
  }
8133
8110
  ) }) : null });
@@ -9367,27 +9344,24 @@ function ProductGrid(rawProps) {
9367
9344
  {
9368
9345
  children: [
9369
9346
  props.beforeItem?.(item, idx),
9370
- /* @__PURE__ */ jsxs("div", { children: [
9371
- isClusterItem(item) ? /* @__PURE__ */ jsx(Fragment, { children: !props.renderClusterCard ? /* @__PURE__ */ jsx(
9372
- ClusterCardImpl,
9373
- {
9374
- cluster: item,
9375
- labels: props.clusterCardLabels,
9376
- stockLabels: props.stockLabels
9377
- }
9378
- ) : null }) : null,
9379
- !isClusterItem(item) ? /* @__PURE__ */ jsx(Fragment, { children: !props.renderProductCard ? /* @__PURE__ */ jsx(
9380
- ProductCardImpl,
9381
- {
9382
- product: item,
9383
- allowAddToCart: showAddToCart(),
9384
- labels: props.productCardLabels,
9385
- stockLabels: props.stockLabels,
9386
- priceLabels: props.priceLabels,
9387
- addToCartLabels: props.addToCartLabels
9388
- }
9389
- ) : null }) : null
9390
- ] }),
9347
+ /* @__PURE__ */ jsx("div", { children: isClusterItem(item) ? /* @__PURE__ */ jsx(
9348
+ ClusterCardImpl,
9349
+ {
9350
+ cluster: item,
9351
+ labels: props.clusterCardLabels,
9352
+ stockLabels: props.stockLabels
9353
+ }
9354
+ ) : /* @__PURE__ */ jsx(
9355
+ ProductCardImpl,
9356
+ {
9357
+ product: item,
9358
+ allowAddToCart: showAddToCart(),
9359
+ labels: props.productCardLabels,
9360
+ stockLabels: props.stockLabels,
9361
+ priceLabels: props.priceLabels,
9362
+ addToCartLabels: props.addToCartLabels
9363
+ }
9364
+ ) }),
9391
9365
  props.afterItem?.(item, idx)
9392
9366
  ]
9393
9367
  },
@@ -11909,8 +11883,9 @@ function FavoriteListDetails(rawProps) {
11909
11883
  if (contact.contactId) {
11910
11884
  priceInput.contactId = contact.contactId;
11911
11885
  }
11912
- if (contact.company?.companyId) {
11913
- priceInput.companyId = contact.company.companyId;
11886
+ const activeCompanyId = props.companyId ?? contact.company?.companyId;
11887
+ if (activeCompanyId) {
11888
+ priceInput.companyId = activeCompanyId;
11914
11889
  }
11915
11890
  }
11916
11891
  }
@@ -11986,12 +11961,15 @@ function FavoriteListDetails(rawProps) {
11986
11961
  setPrevListId(props.favoriteListId || "");
11987
11962
  fetchList();
11988
11963
  }, []);
11964
+ const prevCompanyIdRef = useRef(props.companyId);
11989
11965
  useEffect(() => {
11990
- if (props.favoriteListId && props.favoriteListId !== prevListId) {
11991
- setPrevListId(props.favoriteListId);
11992
- fetchList();
11993
- }
11994
- }, [props.favoriteListId]);
11966
+ const listChanged = !!props.favoriteListId && props.favoriteListId !== prevListId;
11967
+ const companyChanged = props.companyId !== prevCompanyIdRef.current;
11968
+ if (!listChanged && !companyChanged) return;
11969
+ if (listChanged) setPrevListId(props.favoriteListId);
11970
+ prevCompanyIdRef.current = props.companyId;
11971
+ fetchList();
11972
+ }, [props.favoriteListId, props.companyId]);
11995
11973
  return /* @__PURE__ */ jsxs("div", { className: cn(`propeller-favorite-list-details ${props.className || ""}`), "data-loading": loading ? "true" : "false", children: [
11996
11974
  loading ? /* @__PURE__ */ jsx("div", { className: "propeller-favorite-list-details__skeleton space-y-4", children: [1, 2, 3]?.map((i) => /* @__PURE__ */ jsxs(
11997
11975
  "div",
@@ -13867,7 +13845,7 @@ function OrderList(rawProps) {
13867
13845
  return /* @__PURE__ */ jsxs("div", { className: cn(`propeller-order-list ${props.className || ""}`), "data-loading": loading ? "true" : "false", children: [
13868
13846
  props.enableSearch && searchFields().length > 0 ? /* @__PURE__ */ jsxs("div", { className: "propeller-order-list__filters mb-6 bg-card p-4 rounded-container shadow space-y-4", children: [
13869
13847
  searchFields().includes("term") ? /* @__PURE__ */ jsxs("div", { className: "propeller-order-list__search-field w-full", children: [
13870
- /* @__PURE__ */ jsx("label", { className: "propeller-order-list__filter-label block text-sm font-medium text-muted-foreground capitalize mb-1", children: getColumnLabel("term") }),
13848
+ /* @__PURE__ */ jsx("label", { className: "propeller-order-list__filter-label block text-sm font-medium text-muted-foreground mb-1", children: getColumnLabel("term") }),
13871
13849
  /* @__PURE__ */ jsx(
13872
13850
  "input",
13873
13851
  {
@@ -13895,7 +13873,7 @@ function OrderList(rawProps) {
13895
13873
  )
13896
13874
  ] }) : null,
13897
13875
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4", children: searchFields().filter((f) => f !== "term")?.map((field) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
13898
- /* @__PURE__ */ jsx("label", { className: "propeller-order-list__filter-label block text-sm font-medium text-muted-foreground capitalize", children: getColumnLabel(field) }),
13876
+ /* @__PURE__ */ jsx("label", { className: "propeller-order-list__filter-label block text-sm font-medium text-muted-foreground", children: getColumnLabel(field) }),
13899
13877
  field === "createdAt" ? /* @__PURE__ */ jsxs("div", { className: "flex space-x-2 w-full", children: [
13900
13878
  /* @__PURE__ */ jsx(
13901
13879
  "input",
@@ -15599,7 +15577,7 @@ function ProductDescription(props) {
15599
15577
  !shouldTruncate || expanded ? /* @__PURE__ */ jsx(
15600
15578
  "div",
15601
15579
  {
15602
- className: "propeller-product-description__content prose prose-slate max-w-none text-muted-foreground",
15580
+ className: "propeller-product-description__content text-muted-foreground",
15603
15581
  dangerouslySetInnerHTML: { __html: html }
15604
15582
  }
15605
15583
  ) : /* @__PURE__ */ jsx("p", { className: "propeller-product-description__truncated text-muted-foreground", children: getTruncated() }),
@@ -16341,7 +16319,7 @@ function ProductShortDescription(props) {
16341
16319
  "div",
16342
16320
  {
16343
16321
  dangerouslySetInnerHTML: { __html: html },
16344
- className: cn(`propeller-product-short-description prose prose-slate max-w-none text-muted-foreground ${props.className || ""}`)
16322
+ className: cn(`propeller-product-short-description text-muted-foreground ${props.className || ""}`)
16345
16323
  }
16346
16324
  ) : null });
16347
16325
  }