@glideroggan/cookie-consent
v0.1.2
Published
A vanilla TypeScript web component for GDPR-compliant cookie consent management
Maintainers
Readme
Cookie Consent Component
A vanilla TypeScript web component for GDPR-compliant cookie consent management.
Installation
npm install @glideroggan/cookie-consent
# or
yarn add @glideroggan/cookie-consentUsage
Via CDN (ESM)
<script type="module" src="https://unpkg.com/@glideroggan/cookie-consent/dist/cookie-consent.esm.js"></script>
<cookie-consent api-url="https://your-api.com/consent" cookie-name="my-consent"></cookie-consent>Via CDN (Script tag)
<script src="https://unpkg.com/@glideroggan/cookie-consent/dist/cookie-consent.js"></script>
<cookie-consent api-url="https://your-api.com/consent" cookie-name="my-consent"></cookie-consent>With bundler
import '@glideroggan/cookie-consent';API
The component expects a consent API endpoint that returns:
{
"version": "1.3",
"categories": [
{
"id": "necessary",
"name": "Necessary",
"description": "Required for basic site functionality",
"required": true,
"enabled": true
}
]
}Attributes
api-url: URL to your consent configuration endpointcookie-name: Name of the cookie to store consent preferences
