@propeller-commerce/propeller-v2-react-ui 0.11.1 → 0.11.3

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
@@ -6683,6 +6683,16 @@ interface ProductSliderProps {
6683
6683
  /** Called after every successful add-to-cart. Receives the updated cart and the added item. */ afterAddToCart?: (cart: Cart, item?: CartMainItem) => void;
6684
6684
  /** * When true, AddToCart shows a success modal instead of a toast. * Defaults to false. */ showModal?: boolean;
6685
6685
  /** Called when "Proceed to checkout" is clicked in the AddToCart modal. */ onProceedToCheckout?: () => void;
6686
+ /**
6687
+ * Called when an anonymous visitor clicks the log-in action that replaces
6688
+ * add-to-cart in a semi-closed portal. The host owns navigation.
6689
+ */
6690
+ onLoginClick?: () => void;
6691
+ /**
6692
+ * Show the add-to-cart control on each card. Defaults to true; a semi-closed
6693
+ * portal still withholds it from anonymous visitors regardless.
6694
+ */
6695
+ allowAddToCart?: boolean;
6686
6696
  /** Called when "Request a Quote" is clicked in the AddToCart modal. */ onRequestQuoteClick?: (cart: Cart) => void;
6687
6697
  /** * Label overrides forwarded to the embedded AddToCart component. * Keys: add, adding, addedToCart, outOfStock, noCartId, errorAdding, * modalTitle, quantity, continueShopping, proceedToCheckout */ addToCartLabels?: Record<string, string>;
6688
6698
  /** Translated labels forwarded to embedded `<ProductCard>` instances. */
package/dist/index.d.ts CHANGED
@@ -6683,6 +6683,16 @@ interface ProductSliderProps {
6683
6683
  /** Called after every successful add-to-cart. Receives the updated cart and the added item. */ afterAddToCart?: (cart: Cart, item?: CartMainItem) => void;
6684
6684
  /** * When true, AddToCart shows a success modal instead of a toast. * Defaults to false. */ showModal?: boolean;
6685
6685
  /** Called when "Proceed to checkout" is clicked in the AddToCart modal. */ onProceedToCheckout?: () => void;
6686
+ /**
6687
+ * Called when an anonymous visitor clicks the log-in action that replaces
6688
+ * add-to-cart in a semi-closed portal. The host owns navigation.
6689
+ */
6690
+ onLoginClick?: () => void;
6691
+ /**
6692
+ * Show the add-to-cart control on each card. Defaults to true; a semi-closed
6693
+ * portal still withholds it from anonymous visitors regardless.
6694
+ */
6695
+ allowAddToCart?: boolean;
6686
6696
  /** Called when "Request a Quote" is clicked in the AddToCart modal. */ onRequestQuoteClick?: (cart: Cart) => void;
6687
6697
  /** * Label overrides forwarded to the embedded AddToCart component. * Keys: add, adding, addedToCart, outOfStock, noCartId, errorAdding, * modalTitle, quantity, continueShopping, proceedToCheckout */ addToCartLabels?: Record<string, string>;
6688
6698
  /** Translated labels forwarded to embedded `<ProductCard>` instances. */
package/dist/index.js CHANGED
@@ -16017,6 +16017,7 @@ function ProductSlider(rawProps) {
16017
16017
  afterAddToCart: props.afterAddToCart,
16018
16018
  onProceedToCheckout: props.onProceedToCheckout,
16019
16019
  onRequestQuoteClick: props.onRequestQuoteClick,
16020
+ onLoginClick: props.onLoginClick,
16020
16021
  onToggleFavorite: (item, isFav) => props.onToggleFavorite?.(item, isFav),
16021
16022
  onProductClick: (p) => handleProductClick(p),
16022
16023
  onClusterClick: (c) => handleClusterClick(c),
@@ -16060,8 +16061,9 @@ function ProductSlider(rawProps) {
16060
16061
  function desktopCount() {
16061
16062
  return props.itemsPerView?.desktop || 4;
16062
16063
  }
16063
- function portalMode() {
16064
- return props.portalMode || "open";
16064
+ function showAddToCart() {
16065
+ const allow = props.allowAddToCart !== false;
16066
+ return !isContentHidden(props.portalMode, props.user) && allow;
16065
16067
  }
16066
16068
  function isCluster(item) {
16067
16069
  return "clusterId" in item && !("productId" in item);
@@ -16210,7 +16212,7 @@ function ProductSlider(rawProps) {
16210
16212
  ProductCardImpl,
16211
16213
  {
16212
16214
  product: item,
16213
- allowAddToCart: portalMode() === "open",
16215
+ allowAddToCart: showAddToCart(),
16214
16216
  labels: props.productCardLabels,
16215
16217
  stockLabels: props.stockLabels,
16216
16218
  priceLabels: props.priceLabels,