@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/README.md CHANGED
@@ -43,6 +43,7 @@ Same props for `<VolumeBundle>` and `<MixMatchBundle>`.
43
43
  | `onError` | `(error: Error) => void` | | Fires on fetch, parse, or cart failure. |
44
44
  | `locale` | `string` | | BCP-47 tag forwarded to the Storefront API. |
45
45
  | `className` | `string` | | Applied to the outer wrapper. |
46
+ | `productId` | `string` | | The product page the component is rendered on — full GID or bare numeric id. `<VolumeBundle>` prices and sells this product; without it, it falls back to the bundle's first product, so always pass it for bundles spanning more than one product. |
46
47
 
47
48
  `CartLineInput` matches Shopify Hydrogen's shape. A structural-compat test guards the contract across versions. Always preserve `attributes[]` so `_lime_bundle_gid` reaches Shopify; the `orders/create` webhook keys off it for purchase attribution.
48
49
 
package/dist/index.cjs CHANGED
@@ -2336,7 +2336,8 @@ function VolumeBundle(props) {
2336
2336
  analyticsEnabled,
2337
2337
  onAddToCart,
2338
2338
  onError,
2339
- className
2339
+ className,
2340
+ productId
2340
2341
  } = props;
2341
2342
  const result = useBundleData({
2342
2343
  shopDomain,
@@ -2386,7 +2387,7 @@ function VolumeBundle(props) {
2386
2387
  );
2387
2388
  }
2388
2389
  }, [result, onError]);
2389
- const product = bundle?.products[0];
2390
+ const product = bundle ? (0, import_core11.resolveContextProduct)(bundle.products, { productId }) : void 0;
2390
2391
  const variants = (0, import_react13.useMemo)(() => product?.variants.nodes ?? [], [product]);
2391
2392
  const optionNames = (0, import_react13.useMemo)(() => {
2392
2393
  const first = variants[0];