@dargmuesli/nuxt-cookie-control 3.0.0-beta.4 → 3.0.0-beta.5
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/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { resolve } from 'node:path';
|
|
|
2
2
|
import { createResolver, defineNuxtModule, addPlugin, addImports, addTemplate, extendWebpackConfig, resolvePath } from '@nuxt/kit';
|
|
3
3
|
|
|
4
4
|
const name = "@dargmuesli/nuxt-cookie-control";
|
|
5
|
-
const version = "3.0.0-beta.
|
|
5
|
+
const version = "3.0.0-beta.5";
|
|
6
6
|
|
|
7
7
|
const en = {
|
|
8
8
|
acceptAll: "Accept all",
|
|
@@ -214,9 +214,14 @@ const acceptNecessary = () => {
|
|
|
214
214
|
})
|
|
215
215
|
}
|
|
216
216
|
const acceptPartial = () => {
|
|
217
|
+
const localCookiesEnabledIds = getCookieIds(localCookiesEnabled.value)
|
|
218
|
+
|
|
217
219
|
setCookies({
|
|
218
220
|
isConsentGiven: true,
|
|
219
|
-
cookiesOptionalEnabled:
|
|
221
|
+
cookiesOptionalEnabled: [
|
|
222
|
+
...moduleOptions.cookies?.necessary,
|
|
223
|
+
...moduleOptions.cookies.optional,
|
|
224
|
+
].filter((cookie) => localCookiesEnabledIds.includes(getCookieId(cookie))),
|
|
220
225
|
})
|
|
221
226
|
}
|
|
222
227
|
const declineAll = () => {
|
|
@@ -226,13 +231,14 @@ const declineAll = () => {
|
|
|
226
231
|
})
|
|
227
232
|
}
|
|
228
233
|
const toogleCookie = (cookie: Cookie) => {
|
|
229
|
-
|
|
234
|
+
const cookieIndex = getCookieIds(localCookiesEnabled.value).indexOf(
|
|
235
|
+
getCookieId(cookie)
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
if (cookieIndex < 0) {
|
|
230
239
|
localCookiesEnabled.value.push(cookie)
|
|
231
240
|
} else {
|
|
232
|
-
localCookiesEnabled.value.splice(
|
|
233
|
-
localCookiesEnabled.value.indexOf(cookie),
|
|
234
|
-
1
|
|
235
|
-
)
|
|
241
|
+
localCookiesEnabled.value.splice(cookieIndex, 1)
|
|
236
242
|
}
|
|
237
243
|
}
|
|
238
244
|
const getDescription = (description: Translatable) =>
|