@dargmuesli/nuxt-cookie-control 7.2.1 → 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 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', // if unset, `getCookieId(cookie)` returns the cookie's slugified name instead, which e.g. is used to fill the state's `enabledCookieIds` list
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?: string;
9
+ id: string;
10
10
  name: Translatable;
11
11
  links?: Record<string, string | null>;
12
12
  src?: string;
@@ -40,7 +40,9 @@ interface ModuleOptions {
40
40
  necessary: Cookie[];
41
41
  optional: Cookie[];
42
42
  };
43
- cookieOptions: CookieOptions;
43
+ cookieOptions: CookieOptions & {
44
+ readonly?: false;
45
+ };
44
46
  isAcceptNecessaryButtonEnabled: boolean;
45
47
  isControlButtonEnabled: boolean;
46
48
  isCookieIdVisible: boolean;
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?: string;
9
+ id: string;
10
10
  name: Translatable;
11
11
  links?: Record<string, string | null>;
12
12
  src?: string;
@@ -40,7 +40,9 @@ interface ModuleOptions {
40
40
  necessary: Cookie[];
41
41
  optional: Cookie[];
42
42
  };
43
- cookieOptions: CookieOptions;
43
+ cookieOptions: CookieOptions & {
44
+ readonly?: false;
45
+ };
44
46
  isAcceptNecessaryButtonEnabled: boolean;
45
47
  isControlButtonEnabled: boolean;
46
48
  isCookieIdVisible: boolean;
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "7.2.1",
3
+ "version": "8.0.0-beta.1",
4
4
  "configKey": "cookieControl",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0"
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 = "7.2.1";
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
- getCookieId(cookie),
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: string) => `"${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(getCookieId(cookie))),
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;
@@ -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 getCookieId = (cookie) => cookie.id || slugify(resolveTranslatable(cookie.name));
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")
@@ -1,5 +1,5 @@
1
1
  import { ref } from "vue";
2
- import { getAllCookieIdsString, getCookieId } from "./methods.mjs";
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(getCookieId(cookieNecessary))
20
+ (cookieNecessary) => cookieCookiesEnabledIds.includes(cookieNecessary.id)
21
21
  ),
22
22
  ...moduleOptions.cookies.optional.filter(
23
- (cookieOptional) => cookieCookiesEnabledIds.includes(getCookieId(cookieOptional))
23
+ (cookieOptional) => cookieCookiesEnabledIds.includes(cookieOptional.id)
24
24
  )
25
25
  ]
26
26
  );
@@ -9,7 +9,7 @@ export declare enum CookieType {
9
9
  }
10
10
  export interface Cookie {
11
11
  description?: Translatable;
12
- id?: string;
12
+ id: string;
13
13
  name: Translatable;
14
14
  links?: Record<string, string | null>;
15
15
  src?: string;
@@ -43,7 +43,9 @@ export interface ModuleOptions {
43
43
  necessary: Cookie[];
44
44
  optional: Cookie[];
45
45
  };
46
- cookieOptions: CookieOptions;
46
+ cookieOptions: CookieOptions & {
47
+ readonly?: false;
48
+ };
47
49
  isAcceptNecessaryButtonEnabled: boolean;
48
50
  isControlButtonEnabled: boolean;
49
51
  isCookieIdVisible: boolean;
package/dist/types.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
- import type { } from './module'
2
+ import type { } from './module.js'
3
3
 
4
4
 
5
5
 
6
6
 
7
7
 
8
- export type { default } from './module'
8
+ export type { default } from './module.js'
package/package.json CHANGED
@@ -5,28 +5,27 @@
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.3",
15
- "@commitlint/config-conventional": "18.4.3",
13
+ "@commitlint/cli": "18.4.4",
14
+ "@commitlint/config-conventional": "18.4.4",
16
15
  "@dargmuesli/nuxt-cookie-control": "link:",
17
- "@nuxt/module-builder": "0.5.4",
18
- "@nuxt/schema": "3.8.2",
16
+ "@nuxt/module-builder": "0.5.5",
17
+ "@nuxt/schema": "3.9.0",
19
18
  "@nuxtjs/eslint-config-typescript": "12.1.0",
20
19
  "eslint": "8.56.0",
21
20
  "eslint-config-prettier": "9.1.0",
22
- "eslint-plugin-prettier": "5.0.1",
21
+ "eslint-plugin-prettier": "5.1.2",
23
22
  "husky": "8.0.3",
24
23
  "lint-staged": "15.2.0",
25
- "nuxt": "3.8.2",
24
+ "nuxt": "3.9.0",
26
25
  "prettier": "3.1.1",
27
26
  "typescript": "5.3.3",
28
- "vue": "3.3.13",
29
- "vue-tsc": "1.8.25",
27
+ "vue": "3.4.5",
28
+ "vue-tsc": "1.8.27",
30
29
  "webpack": "5.89.0"
31
30
  },
32
31
  "engines": {
@@ -62,13 +61,13 @@
62
61
  "Jonas Thelemann"
63
62
  ],
64
63
  "name": "@dargmuesli/nuxt-cookie-control",
65
- "packageManager": "pnpm@8.12.1",
64
+ "packageManager": "pnpm@8.14.0",
66
65
  "publishConfig": {
67
66
  "access": "public"
68
67
  },
69
68
  "repository": "https://github.com/dargmuesli/nuxt-cookie-control",
70
69
  "resolutions": {
71
- "@nuxt/kit": "3.8.2"
70
+ "@nuxt/kit": "3.9.0"
72
71
  },
73
72
  "scripts": {
74
73
  "build": "nuxt-module-build build",
@@ -79,5 +78,5 @@
79
78
  },
80
79
  "type": "module",
81
80
  "types": "./dist/module.d.ts",
82
- "version": "7.2.1"
81
+ "version": "8.0.0-beta.1"
83
82
  }