@lime-bundles/widget 3.3.0 → 3.4.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.
@@ -316,13 +316,22 @@ useEffect(() => {
316
316
  return <span>{formatCountdown(msLeft)}</span>;
317
317
  ```
318
318
 
319
- **A/B variant resolution:**
319
+ **A/B variant resolution (link-group model):**
320
320
 
321
321
  ```tsx
322
- import { getABTestAssignment, applyABVariantB } from "@lime-bundles/react";
323
-
324
- const assignment = await getABTestAssignment(bundle.abTestId!, bundle.id);
325
- const bundleForRender = assignment?.variant === "B" ? applyABVariantB(bundle) : bundle;
322
+ import { getLinkGroupAssignment } from "@lime-bundles/react";
323
+
324
+ // Variants under the new model are full duplicate bundles; the primary
325
+ // advertises the variant weight map via `bundle.linkGroup.variants`. The
326
+ // assigner returns one variant's metaobject GID; render that bundle.
327
+ if (bundle.linkGroup?.isPrimary && bundle.linkGroup.variants?.length) {
328
+ const assignment = await getLinkGroupAssignment(
329
+ bundle.linkGroup.id,
330
+ bundle.linkGroup.variants,
331
+ );
332
+ // Render the variant whose metaobjectId === assignment.variantMetaobjectId;
333
+ // fall back to the primary when assignment is null (consent denied).
334
+ }
326
335
  ```
327
336
 
328
337
  **Analytics + consent:**
@@ -296,6 +296,6 @@ Every part of the widget a merchant configures in the admin is wired up for you:
296
296
  - **Variant dropdowns on fixed bundles.** Products with multiple eligible variants (filtered by the merchant's `selectedVariantIds`) render a `<select>`; switching variants live-updates the row price and the bundle total.
297
297
  - **Mix-match picker modal.** Click any empty slot to open the modal; search, quantity stepper, progress bar, and pricing update as selections change. Keyboard: Escape closes, Tab traps inside the modal.
298
298
  - **Out-of-stock behaviour.** Honours `widgetConfig.outOfStockBehavior` (`"hide"` removes OOS products from the list; `"show_greyed_out"` renders them disabled). Fixed bundles hide the whole widget when required products are OOS; mix-match hides when the available count can't satisfy `minQuantity`.
299
- - **A/B test assignment.** The widget bucketises the visitor via `getABTestAssignment` (cookie-persisted, consent-gated) and merges Variant B overrides (title, description, discount, volume tiers) when the visitor lands in B. Honours Shopify's `customerPrivacy` framework or the SDK's `setConsent(true)` helper.
299
+ - **A/B test assignment (link-group model).** When a bundle is the primary of an A/B test, the widget reads the link group's variant weights from `data-link-group-variants`, walks the cumulative FNV-1a weight distribution via `getLinkGroupAssignment`, and renders the assigned variant (which is a real Bundle with its own products, discount, and widget config not an overlay). Cookie-persisted, consent-gated; honours Shopify's `customerPrivacy` framework or the SDK's `setConsent(true)` helper. Without consent the primary renders and no cookie is written.
300
300
  - **Impression + add-to-cart analytics.** Fire on visibility + CTA click regardless of whether the merchant takes over the cart via `preventDefault`. Disable by setting `analytics="false"` or omitting `app-url`.
301
301
  - **Purchase attribution.** The `orders/create` webhook ingests `bundle_purchased` events server-side from the `_lime_bundle_gid` cart attribute the widget adds automatically. No `checkout_completed` handler needed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lime-bundles/widget",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Drop-in <lime-bundle> web component for the Lime Bundles Shopify app. Embed merchant-configured bundles on Hydrogen, Astro, Vue, Svelte, or any JavaScript-enabled headless storefront.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -46,7 +46,7 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@lime-bundles/core": "^4.2.0"
49
+ "@lime-bundles/core": "^5.0.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "tsup": "^8.0.0",