@lime-bundles/widget 0.2.0 → 2.0.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.ts CHANGED
@@ -1,28 +1,63 @@
1
1
  declare class LimeBundleElement extends HTMLElement {
2
2
  static observedAttributes: string[];
3
3
  private shadow;
4
- private bundle;
4
+ private bundles;
5
5
  private abortController;
6
- private impressionCleanup;
6
+ private impressionCleanups;
7
+ /**
8
+ * Tick / observer / listener cleanups registered by individual renderers
9
+ * (e.g. countdown setInterval handles). Flushed in disconnectedCallback
10
+ * so we never leak timers or event listeners when the widget is removed.
11
+ */
12
+ private renderCleanups;
13
+ /**
14
+ * Merchant custom CSS fetched from the shop metafield. Injected inside
15
+ * the shadow root alongside the bundle stylesheets so selectors like
16
+ * `.lb-bundle-widget { ... }` reach the widget's DOM.
17
+ */
18
+ private shopCustomCss;
7
19
  constructor();
8
20
  connectedCallback(): void;
9
21
  disconnectedCallback(): void;
10
- private teardownImpression;
22
+ private teardownImpressions;
23
+ private teardownRenderers;
11
24
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
12
25
  private get shopDomain();
13
26
  private get storefrontToken();
14
27
  private get bundleGid();
28
+ private get productHandleAttr();
15
29
  private get appUrl();
16
30
  private get analyticsEnabled();
17
31
  private fetchBundle;
18
32
  /**
19
- * Dispatch add-to-cart for merchant handling. Returns true the widget
20
- * reports success optimistically. If the merchant's cart mutation fails,
21
- * they're responsible for surfacing that error in their own UI.
33
+ * Resolve the visitor's A/B bucket for every bundle with an active test
34
+ * and merge Variant B overrides where applicable. Runs in parallel; any
35
+ * assignment failure logs internally but still renders Variant A (safe
36
+ * default). The `getABTestAssignment` helper also persists the bucket
37
+ * via a first-party cookie + POSTs to /api/ab-assign for server-side
38
+ * analytics.
39
+ */
40
+ private applyABVariants;
41
+ private fetchSingleBundle;
42
+ private fetchProductBundles;
43
+ /**
44
+ * Dispatch add-to-cart with a cancelable event, then — unless a listener
45
+ * called preventDefault — execute the default cart-and-checkout flow.
46
+ *
47
+ * `fire-and-forget` against `reportAddToCart` runs regardless so merchants
48
+ * with BYO cart still get analytics.
49
+ */
50
+ private handleAddToCart;
51
+ /**
52
+ * Default cart flow: Shopify's Storefront Cart API is tokenless, so we
53
+ * don't need any additional scopes. Persist the cart ID in localStorage
54
+ * so subsequent adds on the same browser session join the existing cart
55
+ * instead of creating a new one every click.
22
56
  */
23
- private dispatchAddToCart;
24
- private renderBundle;
25
- private setupImpression;
57
+ private defaultAddToCart;
58
+ private reportAddToCartEvent;
59
+ private renderBundles;
60
+ private setupImpressionFor;
26
61
  private renderLoading;
27
62
  private renderError;
28
63
  private render;