@dargmuesli/nuxt-cookie-control 6.4.0 → 6.4.1
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 +17 -13
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ const {
|
|
|
64
64
|
cookiesEnabledIds,
|
|
65
65
|
isConsentGiven,
|
|
66
66
|
isModalActive,
|
|
67
|
-
moduleOptions
|
|
67
|
+
moduleOptions,
|
|
68
68
|
} = useCookieControl()
|
|
69
69
|
|
|
70
70
|
// example: react to a cookie being accepted
|
|
@@ -72,14 +72,14 @@ watch(
|
|
|
72
72
|
() => cookiesEnabledIds.value,
|
|
73
73
|
(current, previous) => {
|
|
74
74
|
if (
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
!previous?.includes('google-analytics') &&
|
|
76
|
+
current?.includes('google-analytics')
|
|
77
77
|
) {
|
|
78
78
|
// cookie with id `google-analytics` got added
|
|
79
79
|
window.location.reload() // placeholder for your custom change handler
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
-
{ deep: true }
|
|
82
|
+
{ deep: true },
|
|
83
83
|
)
|
|
84
84
|
</script>
|
|
85
85
|
```
|
|
@@ -91,7 +91,7 @@ watch(
|
|
|
91
91
|
const cookieControl = useCookieControl()
|
|
92
92
|
|
|
93
93
|
if (cookieControl.cookiesEnabledIds.value.includes('google-analytics')) {
|
|
94
|
-
|
|
94
|
+
initGoogleAnalytics() // placeholder for your custom initialization
|
|
95
95
|
}
|
|
96
96
|
```
|
|
97
97
|
|
|
@@ -197,20 +197,24 @@ localeTexts: {
|
|
|
197
197
|
|
|
198
198
|
#### Cookies
|
|
199
199
|
|
|
200
|
-
Every property
|
|
200
|
+
Every property that includes a `{ en: ... }` value is a translatable property that could instead only specify a string (`'...'`) or other locales as well (`{ de: ..., uk: ... }`).
|
|
201
201
|
|
|
202
202
|
```javascript
|
|
203
203
|
{
|
|
204
204
|
description: {
|
|
205
|
-
en:
|
|
205
|
+
en: 'This cookie stores preferences.'
|
|
206
206
|
},
|
|
207
|
-
id: '
|
|
207
|
+
id: 'p', // if unset, `getCookieId(cookie)` returns the cookie's slugified name instead, which e.g. is used to fill the state's `enabledCookieIds` list
|
|
208
208
|
// use a short cookie id to save bandwidth!
|
|
209
209
|
name: {
|
|
210
|
-
en: '
|
|
210
|
+
en: 'Preferences' // you always have to specify a cookie name (in English)
|
|
211
211
|
},
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
links: {
|
|
213
|
+
'https://example.com/privacy': 'Privacy Policy',
|
|
214
|
+
'https://example.com/terms': 'Terms of Service',
|
|
215
|
+
},
|
|
216
|
+
src: 'https://example.com/preferences/js?id=<API-KEY>',
|
|
217
|
+
targetCookieIds: ['xmpl_a', 'xmpl_b']
|
|
214
218
|
}
|
|
215
219
|
```
|
|
216
220
|
|
|
@@ -241,7 +245,7 @@ Every property the includes a `{ en: ... }` value is a translatable property tha
|
|
|
241
245
|
|
|
242
246
|
```html
|
|
243
247
|
<template #cookie="{config}">
|
|
244
|
-
<span v-for="c in config" :key="c.id" v-text="c.cookies"/>
|
|
248
|
+
<span v-for="c in config" :key="c.id" v-text="c.cookies" />
|
|
245
249
|
</template>
|
|
246
250
|
```
|
|
247
251
|
|
|
@@ -249,7 +253,7 @@ Every property the includes a `{ en: ... }` value is a translatable property tha
|
|
|
249
253
|
|
|
250
254
|
- locale: `['en']`
|
|
251
255
|
```html
|
|
252
|
-
<CookieControl locale="de"/>
|
|
256
|
+
<CookieControl locale="de" />
|
|
253
257
|
```
|
|
254
258
|
|
|
255
259
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
3
3
|
import { createResolver, defineNuxtModule, addPlugin, addImports, addTemplate, extendWebpackConfig, extendViteConfig, resolvePath } from '@nuxt/kit';
|
|
4
4
|
|
|
5
5
|
const name = "@dargmuesli/nuxt-cookie-control";
|
|
6
|
-
const version = "6.4.
|
|
6
|
+
const version = "6.4.1";
|
|
7
7
|
|
|
8
8
|
const en = {
|
|
9
9
|
accept: "Accept",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dargmuesli/nuxt-cookie-control",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.1",
|
|
4
4
|
"description": "Nuxt Cookie Control Module",
|
|
5
5
|
"author": "Dario Ferderber <dario.ferderber@broj42.com>",
|
|
6
6
|
"maintainers": [
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"eslint-config-prettier": "9.0.0",
|
|
60
60
|
"eslint-plugin-prettier": "5.0.0",
|
|
61
61
|
"husky": "8.0.3",
|
|
62
|
-
"lint-staged": "14.0.
|
|
62
|
+
"lint-staged": "14.0.1",
|
|
63
63
|
"nuxt": "3.6.5",
|
|
64
|
-
"prettier": "3.0.
|
|
64
|
+
"prettier": "3.0.2",
|
|
65
65
|
"typescript": "5.1.6",
|
|
66
66
|
"vue": "3.3.4",
|
|
67
67
|
"vue-tsc": "1.8.8",
|