@lime-bundles/react 7.0.0 → 7.1.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/index.d.cts CHANGED
@@ -51,6 +51,14 @@ interface BundleComponentProps {
51
51
  * `marketIds` doesn't include this market.
52
52
  */
53
53
  marketId?: string;
54
+ /**
55
+ * The product page this component is rendered on — full GID
56
+ * (`gid://shopify/Product/123`) or bare numeric id. Multi-product
57
+ * renderers (`<VolumeBundle>`) price and sell this product; without it
58
+ * they fall back to the bundle's first product, so any bundle spanning
59
+ * more than one product should pass it.
60
+ */
61
+ productId?: string;
54
62
  }
55
63
 
56
64
  declare function FixedBundle(props: BundleComponentProps): react_jsx_runtime.JSX.Element | null;
package/dist/index.d.ts CHANGED
@@ -51,6 +51,14 @@ interface BundleComponentProps {
51
51
  * `marketIds` doesn't include this market.
52
52
  */
53
53
  marketId?: string;
54
+ /**
55
+ * The product page this component is rendered on — full GID
56
+ * (`gid://shopify/Product/123`) or bare numeric id. Multi-product
57
+ * renderers (`<VolumeBundle>`) price and sell this product; without it
58
+ * they fall back to the bundle's first product, so any bundle spanning
59
+ * more than one product should pass it.
60
+ */
61
+ productId?: string;
54
62
  }
55
63
 
56
64
  declare function FixedBundle(props: BundleComponentProps): react_jsx_runtime.JSX.Element | null;
package/dist/index.js CHANGED
@@ -2309,6 +2309,7 @@ import {
2309
2309
  resolveDefaultTierIndex,
2310
2310
  resolvePopularTierIndex,
2311
2311
  isVariantFulfillable as isVariantFulfillable4,
2312
+ resolveContextProduct,
2312
2313
  shouldShowLowStockBadge as shouldShowLowStockBadge2
2313
2314
  } from "@lime-bundles/core";
2314
2315
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
@@ -2321,7 +2322,8 @@ function VolumeBundle(props) {
2321
2322
  analyticsEnabled,
2322
2323
  onAddToCart,
2323
2324
  onError,
2324
- className
2325
+ className,
2326
+ productId
2325
2327
  } = props;
2326
2328
  const result = useBundleData({
2327
2329
  shopDomain,
@@ -2371,7 +2373,7 @@ function VolumeBundle(props) {
2371
2373
  );
2372
2374
  }
2373
2375
  }, [result, onError]);
2374
- const product = bundle?.products[0];
2376
+ const product = bundle ? resolveContextProduct(bundle.products, { productId }) : void 0;
2375
2377
  const variants = useMemo7(() => product?.variants.nodes ?? [], [product]);
2376
2378
  const optionNames = useMemo7(() => {
2377
2379
  const first = variants[0];