@dargmuesli/nuxt-cookie-control 7.2.2 → 8.0.0-beta.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 +1 -2
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/CookieControl.vue +4 -7
- package/dist/runtime/methods.d.ts +0 -1
- package/dist/runtime/methods.mjs +1 -3
- package/dist/runtime/plugin.mjs +3 -3
- package/dist/runtime/types.d.ts +1 -1
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -206,8 +206,7 @@ Every property that includes a `{ en: ... }` value is a translatable property th
|
|
|
206
206
|
description: {
|
|
207
207
|
en: 'This cookie stores preferences.'
|
|
208
208
|
},
|
|
209
|
-
id: 'p', //
|
|
210
|
-
// use a short cookie id to save bandwidth!
|
|
209
|
+
id: 'p', // use a short cookie id to save bandwidth and prefixes to separate
|
|
211
210
|
name: {
|
|
212
211
|
en: 'Preferences' // you always have to specify a cookie name (in English)
|
|
213
212
|
},
|
package/dist/module.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
|
|
|
6
6
|
type Translatable = string | PartialRecord<Locale, string>;
|
|
7
7
|
interface Cookie {
|
|
8
8
|
description?: Translatable;
|
|
9
|
-
id
|
|
9
|
+
id: string;
|
|
10
10
|
name: Translatable;
|
|
11
11
|
links?: Record<string, string | null>;
|
|
12
12
|
src?: string;
|
package/dist/module.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
|
|
|
6
6
|
type Translatable = string | PartialRecord<Locale, string>;
|
|
7
7
|
interface Cookie {
|
|
8
8
|
description?: Translatable;
|
|
9
|
-
id
|
|
9
|
+
id: string;
|
|
10
10
|
name: Translatable;
|
|
11
11
|
links?: Record<string, string | null>;
|
|
12
12
|
src?: string;
|
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
|
+
const version = "8.0.0-beta.1";
|
|
7
7
|
|
|
8
8
|
const en = {
|
|
9
9
|
accept: "Accept",
|
|
@@ -165,6 +165,7 @@ export default ${JSON.stringify(
|
|
|
165
165
|
const blockIframes = (moduleOptions) => {
|
|
166
166
|
if (moduleOptions.isIframeBlocked) {
|
|
167
167
|
const isIframeBlocked = {
|
|
168
|
+
id: "ncc_f",
|
|
168
169
|
name: "functional"
|
|
169
170
|
};
|
|
170
171
|
if (moduleOptions.cookies) {
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
type="checkbox"
|
|
96
96
|
:checked="
|
|
97
97
|
getCookieIds(localCookiesEnabled).includes(
|
|
98
|
-
|
|
98
|
+
cookie.id,
|
|
99
99
|
)
|
|
100
100
|
"
|
|
101
101
|
@change="toogleCookie(cookie)"
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
{{
|
|
126
126
|
'IDs: ' +
|
|
127
127
|
cookie.targetCookieIds
|
|
128
|
-
.map((id
|
|
128
|
+
.map((id) => `"${id}"`)
|
|
129
129
|
.join(', ')
|
|
130
130
|
}}
|
|
131
131
|
</span>
|
|
@@ -200,7 +200,6 @@ import {
|
|
|
200
200
|
} from '../types'
|
|
201
201
|
import {
|
|
202
202
|
getAllCookieIdsString,
|
|
203
|
-
getCookieId,
|
|
204
203
|
getCookieIds,
|
|
205
204
|
removeCookie,
|
|
206
205
|
resolveTranslatable,
|
|
@@ -266,7 +265,7 @@ const acceptPartial = () => {
|
|
|
266
265
|
cookiesOptionalEnabled: [
|
|
267
266
|
...moduleOptions.cookies.necessary,
|
|
268
267
|
...moduleOptions.cookies.optional,
|
|
269
|
-
].filter((cookie) => localCookiesEnabledIds.includes(
|
|
268
|
+
].filter((cookie) => localCookiesEnabledIds.includes(cookie.id)),
|
|
270
269
|
})
|
|
271
270
|
}
|
|
272
271
|
const decline = () => {
|
|
@@ -325,9 +324,7 @@ const toggleButton = ($event: MouseEvent) => {
|
|
|
325
324
|
)?.click()
|
|
326
325
|
}
|
|
327
326
|
const toogleCookie = (cookie: Cookie) => {
|
|
328
|
-
const cookieIndex = getCookieIds(localCookiesEnabled.value).indexOf(
|
|
329
|
-
getCookieId(cookie),
|
|
330
|
-
)
|
|
327
|
+
const cookieIndex = getCookieIds(localCookiesEnabled.value).indexOf(cookie.id)
|
|
331
328
|
|
|
332
329
|
if (cookieIndex < 0) {
|
|
333
330
|
localCookiesEnabled.value.push(cookie)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Cookie, ModuleOptions, Translatable } from './types';
|
|
2
2
|
export declare const getAllCookieIdsString: (moduleOptions: ModuleOptions) => string;
|
|
3
|
-
export declare const getCookieId: (cookie: Cookie) => string;
|
|
4
3
|
export declare const getCookieIds: (cookies: Cookie[]) => string[];
|
|
5
4
|
export declare const removeCookie: (name: string) => any;
|
|
6
5
|
export declare const resolveTranslatable: (translatable: Translatable, locale?: import("./types").Locale) => string;
|
package/dist/runtime/methods.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import slugify from "@sindresorhus/slugify";
|
|
2
1
|
import { LOCALE_DEFAULT } from "./constants.mjs";
|
|
3
2
|
import { useCookie } from "#imports";
|
|
4
3
|
export const getAllCookieIdsString = (moduleOptions) => getCookieIds([
|
|
5
4
|
...moduleOptions.cookies.necessary,
|
|
6
5
|
...moduleOptions.cookies.optional
|
|
7
6
|
]).join("");
|
|
8
|
-
export const
|
|
9
|
-
export const getCookieIds = (cookies) => cookies.map((cookie) => getCookieId(cookie));
|
|
7
|
+
export const getCookieIds = (cookies) => cookies.map((cookie) => cookie.id);
|
|
10
8
|
export const removeCookie = (name) => useCookie(name, { expires: /* @__PURE__ */ new Date(0) });
|
|
11
9
|
export const resolveTranslatable = (translatable, locale = LOCALE_DEFAULT) => {
|
|
12
10
|
if (typeof translatable === "string")
|
package/dist/runtime/plugin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
|
-
import { getAllCookieIdsString
|
|
2
|
+
import { getAllCookieIdsString } from "./methods.mjs";
|
|
3
3
|
import { defineNuxtPlugin, useCookie } from "#imports";
|
|
4
4
|
import moduleOptions from "#build/cookie-control-options";
|
|
5
5
|
const plugin = defineNuxtPlugin((_nuxtApp) => {
|
|
@@ -17,10 +17,10 @@ const plugin = defineNuxtPlugin((_nuxtApp) => {
|
|
|
17
17
|
const cookiesEnabled = ref(
|
|
18
18
|
cookieCookiesEnabledIds === void 0 ? void 0 : [
|
|
19
19
|
...moduleOptions.cookies.necessary.filter(
|
|
20
|
-
(cookieNecessary) => cookieCookiesEnabledIds.includes(
|
|
20
|
+
(cookieNecessary) => cookieCookiesEnabledIds.includes(cookieNecessary.id)
|
|
21
21
|
),
|
|
22
22
|
...moduleOptions.cookies.optional.filter(
|
|
23
|
-
(cookieOptional) => cookieCookiesEnabledIds.includes(
|
|
23
|
+
(cookieOptional) => cookieCookiesEnabledIds.includes(cookieOptional.id)
|
|
24
24
|
)
|
|
25
25
|
]
|
|
26
26
|
);
|
package/dist/runtime/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@nuxt/kit": "^3.8.0",
|
|
8
|
-
"@sindresorhus/slugify": "^2.2.1",
|
|
9
8
|
"css-vars-ponyfill": "^2.4.8",
|
|
10
9
|
"string-replace-loader": "^3.1.0"
|
|
11
10
|
},
|
|
12
11
|
"description": "Nuxt Cookie Control Module",
|
|
13
12
|
"devDependencies": {
|
|
14
|
-
"@commitlint/cli": "18.4.
|
|
15
|
-
"@commitlint/config-conventional": "18.4.
|
|
13
|
+
"@commitlint/cli": "18.4.4",
|
|
14
|
+
"@commitlint/config-conventional": "18.4.4",
|
|
16
15
|
"@dargmuesli/nuxt-cookie-control": "link:",
|
|
17
16
|
"@nuxt/module-builder": "0.5.5",
|
|
18
17
|
"@nuxt/schema": "3.9.0",
|
|
@@ -25,7 +24,7 @@
|
|
|
25
24
|
"nuxt": "3.9.0",
|
|
26
25
|
"prettier": "3.1.1",
|
|
27
26
|
"typescript": "5.3.3",
|
|
28
|
-
"vue": "3.
|
|
27
|
+
"vue": "3.4.5",
|
|
29
28
|
"vue-tsc": "1.8.27",
|
|
30
29
|
"webpack": "5.89.0"
|
|
31
30
|
},
|
|
@@ -62,7 +61,7 @@
|
|
|
62
61
|
"Jonas Thelemann"
|
|
63
62
|
],
|
|
64
63
|
"name": "@dargmuesli/nuxt-cookie-control",
|
|
65
|
-
"packageManager": "pnpm@8.
|
|
64
|
+
"packageManager": "pnpm@8.14.0",
|
|
66
65
|
"publishConfig": {
|
|
67
66
|
"access": "public"
|
|
68
67
|
},
|
|
@@ -79,5 +78,5 @@
|
|
|
79
78
|
},
|
|
80
79
|
"type": "module",
|
|
81
80
|
"types": "./dist/module.d.ts",
|
|
82
|
-
"version": "
|
|
81
|
+
"version": "8.0.0-beta.1"
|
|
83
82
|
}
|