@code-collective/booking-widget 1.0.0 → 1.0.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 +21 -5
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -8,7 +8,10 @@ Drop in a script tag and use the custom elements directly. No framework or npm i
|
|
|
8
8
|
|
|
9
9
|
```html
|
|
10
10
|
<head>
|
|
11
|
-
<link rel="stylesheet"
|
|
11
|
+
<link rel="stylesheet"
|
|
12
|
+
href="https://cdn.jsdelivr.net/npm/@code-collective/booking-widget@1.0.2/dist/booking-widget.min.css"
|
|
13
|
+
integrity="sha384-Chz7xKNGRdJXbNwkaJzy45I9DiwPStkzNQV9VgWMNKgnlHCpgnhbiukEJEtbHt+v"
|
|
14
|
+
crossorigin="anonymous" />
|
|
12
15
|
</head>
|
|
13
16
|
<body>
|
|
14
17
|
<bw-configurator product-id="your-product-id" checkout-key="your-checkout-key"></bw-configurator>
|
|
@@ -16,10 +19,15 @@ Drop in a script tag and use the custom elements directly. No framework or npm i
|
|
|
16
19
|
<bw-cart display="bar"></bw-cart>
|
|
17
20
|
<bw-checkout></bw-checkout>
|
|
18
21
|
|
|
19
|
-
<script
|
|
22
|
+
<script
|
|
23
|
+
src="https://cdn.jsdelivr.net/npm/@code-collective/booking-widget@1.0.2/dist/booking-widget.min.js"
|
|
24
|
+
integrity="sha384-y2Ncw7PWI9NxiwKR0nhDk+ddkYmUyl+kxFyU+B4eDXWt3bfcMk1CRVTXXUwhTgJd"
|
|
25
|
+
crossorigin="anonymous"></script>
|
|
20
26
|
</body>
|
|
21
27
|
```
|
|
22
28
|
|
|
29
|
+
> **Note:** Pin to a specific version (e.g. `@1.0.0`) when using SRI. The hashes change with every release. Run `npm run build:elements` to see the current hashes.
|
|
30
|
+
|
|
23
31
|
The script auto-wires the elements together:
|
|
24
32
|
- Adding an item shows the cart and opens the checkout overlay
|
|
25
33
|
- Clicking checkout in the cart opens the overlay
|
|
@@ -65,7 +73,9 @@ Set `window.bwOptions` before the widget script loads:
|
|
|
65
73
|
wizardPages: '',
|
|
66
74
|
};
|
|
67
75
|
</script>
|
|
68
|
-
<script src="https://cdn.jsdelivr.net/npm/@code-collective/booking-widget@
|
|
76
|
+
<script src="https://cdn.jsdelivr.net/npm/@code-collective/booking-widget@1.0.2/dist/booking-widget.min.js"
|
|
77
|
+
integrity="sha384-y2Ncw7PWI9NxiwKR0nhDk+ddkYmUyl+kxFyU+B4eDXWt3bfcMk1CRVTXXUwhTgJd"
|
|
78
|
+
crossorigin="anonymous"></script>
|
|
69
79
|
```
|
|
70
80
|
|
|
71
81
|
| Option | Default | Description |
|
|
@@ -195,8 +205,14 @@ const product = await getProduct(Astro.params.slug);
|
|
|
195
205
|
<bw-cart display="bar" checkout-key={product.checkoutKey}></bw-cart>
|
|
196
206
|
<bw-checkout checkout-key={product.checkoutKey}></bw-checkout>
|
|
197
207
|
|
|
198
|
-
<link rel="stylesheet"
|
|
199
|
-
|
|
208
|
+
<link rel="stylesheet"
|
|
209
|
+
href="https://cdn.jsdelivr.net/npm/@code-collective/booking-widget@1.0.2/dist/booking-widget.min.css"
|
|
210
|
+
integrity="sha384-Chz7xKNGRdJXbNwkaJzy45I9DiwPStkzNQV9VgWMNKgnlHCpgnhbiukEJEtbHt+v"
|
|
211
|
+
crossorigin="anonymous" />
|
|
212
|
+
<script is:inline
|
|
213
|
+
src="https://cdn.jsdelivr.net/npm/@code-collective/booking-widget@1.0.2/dist/booking-widget.min.js"
|
|
214
|
+
integrity="sha384-y2Ncw7PWI9NxiwKR0nhDk+ddkYmUyl+kxFyU+B4eDXWt3bfcMk1CRVTXXUwhTgJd"
|
|
215
|
+
crossorigin="anonymous"></script>
|
|
200
216
|
```
|
|
201
217
|
|
|
202
218
|
### Svelte island approach
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-collective/booking-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/booking-widget.umd.cjs",
|
|
6
6
|
"module": "dist/booking-widget.js",
|
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
"dev": "vite",
|
|
23
23
|
"build": "vite build",
|
|
24
24
|
"build:elements": "vite build --mode elements",
|
|
25
|
+
"postbuild:elements": "node -e \"const{readFileSync:r}=require('fs'),{createHash:h}=require('crypto');['dist/booking-widget.min.js','dist/booking-widget.min.css'].forEach(f=>{const d=h('sha384').update(r(f)).digest('base64');console.log(f+' -> sha384-'+d)})\"",
|
|
25
26
|
"build:demo": "vite build --mode demo",
|
|
26
27
|
"preview": "vite preview",
|
|
27
|
-
"check": "svelte-check --tsconfig ./tsconfig.json"
|
|
28
|
+
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
29
|
+
"release": "node scripts/publish.cjs"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
30
32
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|