@lime-bundles/widget 1.0.0 → 2.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 +76 -72
- package/dist/index.cjs +2643 -344
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -50
- package/dist/index.d.ts +22 -50
- package/dist/index.js +2654 -352
- package/dist/index.js.map +1 -1
- package/dist/lime-bundle.global.js +1243 -86
- package/dist/lime-bundle.global.js.map +1 -1
- package/docs/README.md +81 -0
- package/docs/css-variables.md +158 -0
- package/docs/hydrogen.md +185 -0
- package/docs/react-nextjs.md +379 -0
- package/docs/web-component.md +282 -0
- package/package.json +5 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,62 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* <lime-bundle> Web Component — renders Lime Bundles on any storefront.
|
|
3
|
-
*
|
|
4
|
-
* ## The two modes
|
|
5
|
-
*
|
|
6
|
-
* Single-bundle (pinned):
|
|
7
|
-
* <lime-bundle
|
|
8
|
-
* shop-domain="my-shop.myshopify.com"
|
|
9
|
-
* storefront-token="shpat_..."
|
|
10
|
-
* bundle-gid="gid://shopify/Metaobject/42"
|
|
11
|
-
* ></lime-bundle>
|
|
12
|
-
*
|
|
13
|
-
* Product-aware (matches classic Liquid theme block behaviour — one snippet
|
|
14
|
-
* on the product page renders every active bundle configured against that
|
|
15
|
-
* product):
|
|
16
|
-
* <lime-bundle
|
|
17
|
-
* shop-domain="my-shop.myshopify.com"
|
|
18
|
-
* storefront-token="shpat_..."
|
|
19
|
-
* ></lime-bundle>
|
|
20
|
-
*
|
|
21
|
-
* Product resolution cascade (when no `bundle-gid` is set):
|
|
22
|
-
* 1. explicit `product-handle` attribute
|
|
23
|
-
* 2. <meta name="shopify:product-handle" content="..."> on the page
|
|
24
|
-
* 3. /products/<handle> segment of window.location.pathname
|
|
25
|
-
* 4. fallthrough: renders nothing, fires `lime-bundle:error`
|
|
26
|
-
*
|
|
27
|
-
* ## Add-to-cart behaviour
|
|
28
|
-
*
|
|
29
|
-
* Merchants who do nothing get a default: the widget calls Shopify's
|
|
30
|
-
* Storefront Cart API (tokenless — no extra scopes required) and redirects
|
|
31
|
-
* the browser to the returned checkoutUrl. One-click-to-checkout is the
|
|
32
|
-
* right UX for most merchants pasting the widget into Webflow / Wix /
|
|
33
|
-
* Squarespace / static HTML.
|
|
34
|
-
*
|
|
35
|
-
* Merchants with their own cart state (Hydrogen's useCart, a custom cart
|
|
36
|
-
* drawer, etc.) opt out by attaching a listener that calls
|
|
37
|
-
* `event.preventDefault()`:
|
|
38
|
-
*
|
|
39
|
-
* document.querySelector("lime-bundle").addEventListener(
|
|
40
|
-
* "lime-bundle:add-to-cart",
|
|
41
|
-
* (ev) => {
|
|
42
|
-
* ev.preventDefault(); // suppress the default redirect
|
|
43
|
-
* myCart.linesAdd(ev.detail.lines);
|
|
44
|
-
* },
|
|
45
|
-
* );
|
|
46
|
-
*
|
|
47
|
-
* The event is always dispatched; only the default action is conditional.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
1
|
declare class LimeBundleElement extends HTMLElement {
|
|
51
2
|
static observedAttributes: string[];
|
|
52
3
|
private shadow;
|
|
53
4
|
private bundles;
|
|
54
5
|
private abortController;
|
|
55
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;
|
|
56
19
|
constructor();
|
|
57
20
|
connectedCallback(): void;
|
|
58
21
|
disconnectedCallback(): void;
|
|
59
22
|
private teardownImpressions;
|
|
23
|
+
private teardownRenderers;
|
|
60
24
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
61
25
|
private get shopDomain();
|
|
62
26
|
private get storefrontToken();
|
|
@@ -65,6 +29,15 @@ declare class LimeBundleElement extends HTMLElement {
|
|
|
65
29
|
private get appUrl();
|
|
66
30
|
private get analyticsEnabled();
|
|
67
31
|
private fetchBundle;
|
|
32
|
+
/**
|
|
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;
|
|
68
41
|
private fetchSingleBundle;
|
|
69
42
|
private fetchProductBundles;
|
|
70
43
|
/**
|
|
@@ -87,7 +60,6 @@ declare class LimeBundleElement extends HTMLElement {
|
|
|
87
60
|
private setupImpressionFor;
|
|
88
61
|
private renderLoading;
|
|
89
62
|
private renderError;
|
|
90
|
-
private render;
|
|
91
63
|
}
|
|
92
64
|
|
|
93
65
|
export { LimeBundleElement };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,62 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* <lime-bundle> Web Component — renders Lime Bundles on any storefront.
|
|
3
|
-
*
|
|
4
|
-
* ## The two modes
|
|
5
|
-
*
|
|
6
|
-
* Single-bundle (pinned):
|
|
7
|
-
* <lime-bundle
|
|
8
|
-
* shop-domain="my-shop.myshopify.com"
|
|
9
|
-
* storefront-token="shpat_..."
|
|
10
|
-
* bundle-gid="gid://shopify/Metaobject/42"
|
|
11
|
-
* ></lime-bundle>
|
|
12
|
-
*
|
|
13
|
-
* Product-aware (matches classic Liquid theme block behaviour — one snippet
|
|
14
|
-
* on the product page renders every active bundle configured against that
|
|
15
|
-
* product):
|
|
16
|
-
* <lime-bundle
|
|
17
|
-
* shop-domain="my-shop.myshopify.com"
|
|
18
|
-
* storefront-token="shpat_..."
|
|
19
|
-
* ></lime-bundle>
|
|
20
|
-
*
|
|
21
|
-
* Product resolution cascade (when no `bundle-gid` is set):
|
|
22
|
-
* 1. explicit `product-handle` attribute
|
|
23
|
-
* 2. <meta name="shopify:product-handle" content="..."> on the page
|
|
24
|
-
* 3. /products/<handle> segment of window.location.pathname
|
|
25
|
-
* 4. fallthrough: renders nothing, fires `lime-bundle:error`
|
|
26
|
-
*
|
|
27
|
-
* ## Add-to-cart behaviour
|
|
28
|
-
*
|
|
29
|
-
* Merchants who do nothing get a default: the widget calls Shopify's
|
|
30
|
-
* Storefront Cart API (tokenless — no extra scopes required) and redirects
|
|
31
|
-
* the browser to the returned checkoutUrl. One-click-to-checkout is the
|
|
32
|
-
* right UX for most merchants pasting the widget into Webflow / Wix /
|
|
33
|
-
* Squarespace / static HTML.
|
|
34
|
-
*
|
|
35
|
-
* Merchants with their own cart state (Hydrogen's useCart, a custom cart
|
|
36
|
-
* drawer, etc.) opt out by attaching a listener that calls
|
|
37
|
-
* `event.preventDefault()`:
|
|
38
|
-
*
|
|
39
|
-
* document.querySelector("lime-bundle").addEventListener(
|
|
40
|
-
* "lime-bundle:add-to-cart",
|
|
41
|
-
* (ev) => {
|
|
42
|
-
* ev.preventDefault(); // suppress the default redirect
|
|
43
|
-
* myCart.linesAdd(ev.detail.lines);
|
|
44
|
-
* },
|
|
45
|
-
* );
|
|
46
|
-
*
|
|
47
|
-
* The event is always dispatched; only the default action is conditional.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
1
|
declare class LimeBundleElement extends HTMLElement {
|
|
51
2
|
static observedAttributes: string[];
|
|
52
3
|
private shadow;
|
|
53
4
|
private bundles;
|
|
54
5
|
private abortController;
|
|
55
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;
|
|
56
19
|
constructor();
|
|
57
20
|
connectedCallback(): void;
|
|
58
21
|
disconnectedCallback(): void;
|
|
59
22
|
private teardownImpressions;
|
|
23
|
+
private teardownRenderers;
|
|
60
24
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
61
25
|
private get shopDomain();
|
|
62
26
|
private get storefrontToken();
|
|
@@ -65,6 +29,15 @@ declare class LimeBundleElement extends HTMLElement {
|
|
|
65
29
|
private get appUrl();
|
|
66
30
|
private get analyticsEnabled();
|
|
67
31
|
private fetchBundle;
|
|
32
|
+
/**
|
|
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;
|
|
68
41
|
private fetchSingleBundle;
|
|
69
42
|
private fetchProductBundles;
|
|
70
43
|
/**
|
|
@@ -87,7 +60,6 @@ declare class LimeBundleElement extends HTMLElement {
|
|
|
87
60
|
private setupImpressionFor;
|
|
88
61
|
private renderLoading;
|
|
89
62
|
private renderError;
|
|
90
|
-
private render;
|
|
91
63
|
}
|
|
92
64
|
|
|
93
65
|
export { LimeBundleElement };
|