astro-consent 1.0.3 → 1.0.4
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 +24 -31
- package/README.md.bak +128 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# astro-
|
|
1
|
+
# astro-consent
|
|
2
2
|
|
|
3
|
-
A **privacy
|
|
3
|
+
A **privacy-first, zero-dependency cookie consent banner** for Astro projects — built for speed, compliance, and full visual control.
|
|
4
4
|
|
|
5
5
|
Designed and maintained by **Velohost**.
|
|
6
6
|
|
|
@@ -20,34 +20,46 @@ Designed and maintained by **Velohost**.
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
-
## 📦 Installation
|
|
23
|
+
## 📦 Installation (Required)
|
|
24
|
+
|
|
25
|
+
This package uses **both an Astro integration and a CLI installer**.
|
|
26
|
+
|
|
27
|
+
### 1️⃣ Install the package
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
npm install astro-
|
|
30
|
+
npm install astro-consent
|
|
27
31
|
```
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
This step is **required** so Astro can import the integration at build time.
|
|
34
|
+
|
|
35
|
+
### 2️⃣ Run the installer
|
|
30
36
|
|
|
31
37
|
```bash
|
|
32
|
-
npx astro-
|
|
38
|
+
npx astro-consent
|
|
33
39
|
```
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
This will:
|
|
42
|
+
|
|
43
|
+
- Inject the Astro integration into `astro.config.*`
|
|
44
|
+
- Create `src/cookiebanner.css` (theme variables)
|
|
45
|
+
- Enable the consent banner automatically
|
|
46
|
+
|
|
47
|
+
### ❌ Uninstall
|
|
36
48
|
|
|
37
49
|
```bash
|
|
38
|
-
npx astro-
|
|
50
|
+
npx astro-consent remove
|
|
39
51
|
```
|
|
40
52
|
|
|
41
53
|
---
|
|
42
54
|
|
|
43
|
-
## 🔧 Usage
|
|
55
|
+
## 🔧 Astro Integration Usage
|
|
44
56
|
|
|
45
57
|
```ts
|
|
46
|
-
import
|
|
58
|
+
import astroConsent from "astro-consent";
|
|
47
59
|
|
|
48
60
|
export default {
|
|
49
61
|
integrations: [
|
|
50
|
-
|
|
62
|
+
astroConsent({
|
|
51
63
|
siteName: "My Website",
|
|
52
64
|
policyUrl: "/privacy",
|
|
53
65
|
consent: {
|
|
@@ -73,16 +85,6 @@ window.cookieConsent.set({ essential: true, analytics: true });
|
|
|
73
85
|
window.cookieConsent.reset();
|
|
74
86
|
```
|
|
75
87
|
|
|
76
|
-
Example conditional loading:
|
|
77
|
-
|
|
78
|
-
```js
|
|
79
|
-
const consent = window.cookieConsent.get();
|
|
80
|
-
|
|
81
|
-
if (consent?.categories?.analytics) {
|
|
82
|
-
// Load analytics script
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
88
|
---
|
|
87
89
|
|
|
88
90
|
## 🎨 Theming
|
|
@@ -112,17 +114,8 @@ Open‑source with **mandatory attribution**.
|
|
|
112
114
|
|
|
113
115
|
Any public use, fork, or redistribution **must credit Velohost**.
|
|
114
116
|
|
|
115
|
-
See `LICENSE.md` for full terms.
|
|
116
|
-
|
|
117
117
|
---
|
|
118
118
|
|
|
119
119
|
## 🏢 Velohost
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
https://velohost.co.uk
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## 🤝 Contributions
|
|
127
|
-
|
|
128
|
-
PRs welcome — attribution must be preserved.
|
|
121
|
+
https://velohost.co.uk/
|
package/README.md.bak
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# astro-cookiebanner
|
|
2
|
+
|
|
3
|
+
A **privacy‑first, zero‑dependency cookie consent banner** for Astro projects — built for speed, compliance, and full visual control.
|
|
4
|
+
|
|
5
|
+
Designed and maintained by **Velohost**.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- ✅ GDPR / UK GDPR friendly
|
|
12
|
+
- 🍪 Essential, Analytics & Marketing categories
|
|
13
|
+
- 🎛️ Manage preferences modal with toggle switches
|
|
14
|
+
- ⚡ No external dependencies
|
|
15
|
+
- 🎨 Fully themeable via CSS variables
|
|
16
|
+
- 🧠 Frontend‑controlled script loading
|
|
17
|
+
- 🧩 Astro Integration + CLI installer
|
|
18
|
+
- 🔁 Easy uninstall via CLI
|
|
19
|
+
- 🌍 Framework‑agnostic frontend API
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 📦 Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install astro-cookiebanner
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then run the installer inside your Astro project:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx astro-cookiebanner
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
To remove everything:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx astro-cookiebanner remove
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🔧 Usage
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import astroCookieBanner from "astro-cookiebanner";
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
integrations: [
|
|
50
|
+
astroCookieBanner({
|
|
51
|
+
siteName: "My Website",
|
|
52
|
+
policyUrl: "/privacy",
|
|
53
|
+
consent: {
|
|
54
|
+
days: 30,
|
|
55
|
+
storageKey: "astro-cookie-consent"
|
|
56
|
+
},
|
|
57
|
+
categories: {
|
|
58
|
+
analytics: false,
|
|
59
|
+
marketing: false
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🧠 Frontend API
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
window.cookieConsent.get();
|
|
72
|
+
window.cookieConsent.set({ essential: true, analytics: true });
|
|
73
|
+
window.cookieConsent.reset();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Example conditional loading:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
const consent = window.cookieConsent.get();
|
|
80
|
+
|
|
81
|
+
if (consent?.categories?.analytics) {
|
|
82
|
+
// Load analytics script
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🎨 Theming
|
|
89
|
+
|
|
90
|
+
All visuals are controlled via:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
src/cookiebanner.css
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This file is never overwritten.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🔐 Privacy
|
|
101
|
+
|
|
102
|
+
- No cookies before consent
|
|
103
|
+
- No tracking without permission
|
|
104
|
+
- No external calls
|
|
105
|
+
- Stored locally with TTL
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🏷️ License & Attribution
|
|
110
|
+
|
|
111
|
+
Open‑source with **mandatory attribution**.
|
|
112
|
+
|
|
113
|
+
Any public use, fork, or redistribution **must credit Velohost**.
|
|
114
|
+
|
|
115
|
+
See `LICENSE.md` for full terms.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 🏢 Velohost
|
|
120
|
+
|
|
121
|
+
Built by **Velohost**
|
|
122
|
+
https://velohost.co.uk
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 🤝 Contributions
|
|
127
|
+
|
|
128
|
+
PRs welcome — attribution must be preserved.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-consent",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A privacy-first, GDPR-compliant cookie consent banner for Astro with a built-in preferences modal, zero dependencies, and full theme control.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|