@kachingappz/bundles-js 0.1.0 → 0.1.2
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 +92 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @kachingappz/bundles-js
|
|
2
|
+
|
|
3
|
+
A vanilla JavaScript web component for integrating [Kaching Bundles](https://apps.shopify.com/bundle-deals) into any Shopify storefront.
|
|
4
|
+
|
|
5
|
+
Works with any framework or no framework at all — just drop in the `<kaching-bundle-component>` custom element.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @kachingappz/bundles-js
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<kaching-bundle-component
|
|
17
|
+
shop-domain="your-store.myshopify.com"
|
|
18
|
+
storefront-token="your-storefront-access-token"
|
|
19
|
+
product-id="7549909008451"
|
|
20
|
+
></kaching-bundle-component>
|
|
21
|
+
|
|
22
|
+
<script type="module">
|
|
23
|
+
import "@kachingappz/bundles-js"
|
|
24
|
+
</script>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Attributes
|
|
28
|
+
|
|
29
|
+
| Attribute | Required | Description |
|
|
30
|
+
|-----------|----------|-------------|
|
|
31
|
+
| `shop-domain` | Yes | Your Shopify store domain (e.g. `your-store.myshopify.com`) |
|
|
32
|
+
| `storefront-token` | Yes | Shopify Storefront API access token |
|
|
33
|
+
| `product-id` | Yes | Shopify product ID |
|
|
34
|
+
| `deal-block-id` | No | Specific deal block ID to display |
|
|
35
|
+
| `selected-variant-id` | No | Currently selected variant ID (plain ID or full GID) |
|
|
36
|
+
| `country` | No | Country code for localization (e.g. `US`) |
|
|
37
|
+
| `language` | No | Language code for localization (e.g. `EN`) |
|
|
38
|
+
| `demo` | No | Render with placeholder data (no credentials needed) |
|
|
39
|
+
|
|
40
|
+
## Events
|
|
41
|
+
|
|
42
|
+
### `items-changed`
|
|
43
|
+
|
|
44
|
+
Fired when the bundle selection changes.
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
document
|
|
48
|
+
.querySelector("kaching-bundle-component")
|
|
49
|
+
.addEventListener("items-changed", (event) => {
|
|
50
|
+
console.log(event.detail.items)
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### `loaded`
|
|
55
|
+
|
|
56
|
+
Fired when the widget has finished loading.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
document
|
|
60
|
+
.querySelector("kaching-bundle-component")
|
|
61
|
+
.addEventListener("loaded", () => {
|
|
62
|
+
console.log("Widget ready")
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Methods
|
|
67
|
+
|
|
68
|
+
### `items()`
|
|
69
|
+
|
|
70
|
+
Returns the current bundle items.
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
const items = document.querySelector("kaching-bundle-component").items()
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Demo Mode
|
|
77
|
+
|
|
78
|
+
Render the widget with example data — no Shopify credentials required:
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<kaching-bundle-component demo></kaching-bundle-component>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Dynamic Product Switching
|
|
85
|
+
|
|
86
|
+
Change the `product-id` attribute to load a different product — the widget reinitializes automatically:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
document
|
|
90
|
+
.querySelector("kaching-bundle-component")
|
|
91
|
+
.setAttribute("product-id", "8001234567890")
|
|
92
|
+
```
|