@lime-bundles/widget 2.1.0 → 2.2.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.
@@ -155,6 +155,25 @@ type CartLineInput = {
155
155
 
156
156
  Every `CartLineInput.attributes` array includes `{ key: "_lime_bundle_gid", value: <bundle GID> }`. Preserve it on the way to Shopify cart mutation or purchase attribution breaks.
157
157
 
158
+ ### Loading state (optional)
159
+
160
+ The widget's CTA button is structured to support a spinner overlay that matches the theme-extension look. The SDK itself stays neutral on timing — you toggle the state during your async cart mutation:
161
+
162
+ ```ts
163
+ el.addEventListener("lime-bundle:add-to-cart", async (e: CustomEvent) => {
164
+ const btn = (e.target as Element).shadowRoot
165
+ ?.querySelector<HTMLButtonElement>("[data-add-bundle]");
166
+ btn?.setAttribute("data-loading", "true");
167
+ try {
168
+ await cart.linesAdd(e.detail.lines);
169
+ } finally {
170
+ btn?.removeAttribute("data-loading");
171
+ }
172
+ });
173
+ ```
174
+
175
+ Under the hood the button is a 1×1 CSS grid with two overlaid children (`.lb-cta-label` and `.lb-cta-spinner`). Setting `data-loading="true"` hides the label and reveals the spinner without resizing the button. Omit this pattern entirely and the button simply stays static during the cart call — no visual regression.
176
+
158
177
  ### `lime-bundle:loaded`
159
178
 
160
179
  Fired once bundle data has been fetched and parsed successfully. Useful for hiding a placeholder or triggering analytics in non-SDK systems. The event fires even when zero bundles apply to the current product (product has no bundles attached); check `bundleCount` to tell the difference.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lime-bundles/widget",
3
- "version": "2.1.0",
3
+ "version": "2.2.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",