@dargmuesli/nuxt-cookie-control 9.0.9 → 9.1.0
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 +4 -0
- package/dist/module.d.mts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/CookieControl.vue +21 -17
- package/dist/runtime/types.d.ts +1 -0
- package/dist/runtime/types.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -185,6 +185,10 @@ isIframeBlocked: false,
|
|
|
185
185
|
// Switch to toggle the modal being shown right away, requiring a user's decision.
|
|
186
186
|
isModalForced: false,
|
|
187
187
|
|
|
188
|
+
// "Decline all" in the modal removes all cookies by default (which will re-open the cookie bar).
|
|
189
|
+
// Set this to true to decline all optional cookies and accept necessary cookies.
|
|
190
|
+
declineAllAcceptsNecessary: false,
|
|
191
|
+
|
|
188
192
|
// The locales to include.
|
|
189
193
|
locales: ['en'],
|
|
190
194
|
|
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -99,12 +99,13 @@ const DEFAULTS = {
|
|
|
99
99
|
isDashInDescriptionEnabled: true,
|
|
100
100
|
isIframeBlocked: false,
|
|
101
101
|
isModalForced: false,
|
|
102
|
+
declineAllAcceptsNecessary: false,
|
|
102
103
|
locales: ["en"],
|
|
103
104
|
localeTexts: { en }
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
const name = "@dargmuesli/nuxt-cookie-control";
|
|
107
|
-
const version = "9.0
|
|
108
|
+
const version = "9.1.0";
|
|
108
109
|
|
|
109
110
|
const resolver = createResolver(import.meta.url);
|
|
110
111
|
const runtimeDir = resolver.resolve("./runtime");
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
:id="resolveTranslatable(cookie.name, locale)"
|
|
101
101
|
type="checkbox"
|
|
102
102
|
:checked="
|
|
103
|
-
|
|
103
|
+
getCookieIds(localCookiesEnabled).includes(
|
|
104
104
|
cookie.id
|
|
105
105
|
)
|
|
106
106
|
"
|
|
107
|
-
@change="
|
|
107
|
+
@change="toggleCookie(cookie)"
|
|
108
108
|
/>
|
|
109
109
|
<button type="button" @click="toggleButton($event)">
|
|
110
110
|
{{ getName(cookie.name) }}
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
type="button"
|
|
172
172
|
@click="
|
|
173
173
|
() => {
|
|
174
|
-
|
|
174
|
+
acceptAll();
|
|
175
175
|
isModalActive = false;
|
|
176
176
|
}
|
|
177
177
|
"
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
type="button"
|
|
183
183
|
@click="
|
|
184
184
|
() => {
|
|
185
|
-
acceptNone();
|
|
185
|
+
moduleOptions.declineAllAcceptsNecessary ? acceptNecessary() : acceptNone();
|
|
186
186
|
isModalActive = false;
|
|
187
187
|
}
|
|
188
188
|
"
|
|
@@ -222,7 +222,12 @@ const {
|
|
|
222
222
|
} = useCookieControl();
|
|
223
223
|
const nuxtApp = useNuxtApp();
|
|
224
224
|
const expires = new Date(Date.now() + moduleOptions.cookieExpiryOffsetMs);
|
|
225
|
-
const
|
|
225
|
+
const preselectedCookies = moduleOptions.cookies[CookieType.OPTIONAL].filter(
|
|
226
|
+
(cookie) => cookie.isPreselected
|
|
227
|
+
);
|
|
228
|
+
const localCookiesEnabled = ref([
|
|
229
|
+
...cookiesEnabled.value || (isConsentGiven.value === void 0 ? preselectedCookies : [])
|
|
230
|
+
]);
|
|
226
231
|
const allCookieIdsString = getAllCookieIdsString(moduleOptions);
|
|
227
232
|
const cookieIsConsentGiven = useCookie(moduleOptions.cookieNameIsConsentGiven, {
|
|
228
233
|
expires,
|
|
@@ -241,30 +246,29 @@ const isSaved = computed(
|
|
|
241
246
|
const localeStrings = computed(() => moduleOptions.localeTexts[locale]);
|
|
242
247
|
const acceptAll = () => {
|
|
243
248
|
setCookies({
|
|
244
|
-
|
|
245
|
-
|
|
249
|
+
cookiesOptionalEnabled: moduleOptions.cookies.optional,
|
|
250
|
+
isConsentGiven: true
|
|
246
251
|
});
|
|
247
252
|
};
|
|
248
253
|
const acceptPartial = () => {
|
|
249
254
|
const localCookiesEnabledIds = getCookieIds(localCookiesEnabled.value);
|
|
250
255
|
setCookies({
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
].filter((cookie) => localCookiesEnabledIds.includes(cookie.id))
|
|
256
|
+
cookiesOptionalEnabled: moduleOptions.cookies.optional.filter(
|
|
257
|
+
(cookie) => localCookiesEnabledIds.includes(cookie.id)
|
|
258
|
+
),
|
|
259
|
+
isConsentGiven: true
|
|
256
260
|
});
|
|
257
261
|
};
|
|
258
262
|
const acceptNecessary = () => {
|
|
259
263
|
setCookies({
|
|
260
|
-
|
|
261
|
-
|
|
264
|
+
cookiesOptionalEnabled: [],
|
|
265
|
+
isConsentGiven: true
|
|
262
266
|
});
|
|
263
267
|
};
|
|
264
268
|
const acceptNone = () => {
|
|
265
269
|
setCookies({
|
|
266
|
-
|
|
267
|
-
|
|
270
|
+
cookiesOptionalEnabled: [],
|
|
271
|
+
isConsentGiven: false
|
|
268
272
|
});
|
|
269
273
|
};
|
|
270
274
|
const getDescription = (description) => `${moduleOptions.isDashInDescriptionEnabled === false ? "" : "-"} ${resolveTranslatable(description, locale)}`;
|
|
@@ -296,7 +300,7 @@ const toggleButton = ($event) => {
|
|
|
296
300
|
;
|
|
297
301
|
$event.target?.nextSibling?.click();
|
|
298
302
|
};
|
|
299
|
-
const
|
|
303
|
+
const toggleCookie = (cookie) => {
|
|
300
304
|
const cookieIndex = getCookieIds(localCookiesEnabled.value).indexOf(cookie.id);
|
|
301
305
|
if (cookieIndex < 0) {
|
|
302
306
|
localCookiesEnabled.value.push(cookie);
|
package/dist/runtime/types.d.ts
CHANGED
package/dist/runtime/types.js
CHANGED
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"semantic-release": "24.2.7",
|
|
34
34
|
"vite": "7.0.6",
|
|
35
35
|
"vue": "3.5.18",
|
|
36
|
-
"vue-tsc": "3.0.
|
|
36
|
+
"vue-tsc": "3.0.5",
|
|
37
37
|
"webpack": "5.101.0"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"Jonas Thelemann"
|
|
64
64
|
],
|
|
65
65
|
"name": "@dargmuesli/nuxt-cookie-control",
|
|
66
|
-
"packageManager": "pnpm@10.
|
|
66
|
+
"packageManager": "pnpm@10.14.0",
|
|
67
67
|
"pnpm": {
|
|
68
68
|
"ignoredBuiltDependencies": [
|
|
69
69
|
"@parcel/watcher",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
]
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
|
-
"version": "9.0
|
|
102
|
+
"version": "9.1.0"
|
|
103
103
|
}
|