@dargmuesli/nuxt-cookie-control 8.0.0-beta.1 → 8.0.0-beta.3

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
@@ -6,7 +6,7 @@
6
6
 
7
7
  ![nuxt-cookie-control](https://drive.google.com/a/broj42.com/uc?id=19sFguJo7SKUvmH4xu9DhK9ZXzR6oWLX8)
8
8
 
9
- ✅ Translated for: ar, az, bg, ca, cs, da, de, en, es, fi, fr, hr, hu, id, it, ja, ko, lt, nl, no, oc, pt, pl, ro, rs, ru, sk, sv, tr and uk
9
+ ✅ Translated for: ar, az, be, bg, ca, cs, da, de, en, es, fi, fr, hr, hu, id, it, ja, ko, lt, nl, no, oc, pt, pl, ro, rs, ru, sk, sv, tr, uk and zh-CN
10
10
 
11
11
  ✅ Vue 3 support
12
12
 
@@ -158,6 +158,7 @@ cookieNameCookiesEnabledIds: 'ncc_e',
158
158
  // Options to pass to nuxt's useCookie
159
159
  cookieOptions: {
160
160
  path: '/',
161
+ sameSite: 'strict',
161
162
  }
162
163
 
163
164
  // Switch to toggle the "accept necessary" button.
package/dist/module.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { CookieOptions } from 'nuxt/app';
3
3
 
4
- type Locale = 'ar' | 'az' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
4
+ type Locale = 'ar' | 'az' | 'be' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk' | 'zh-CN';
5
5
  type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
6
6
  type Translatable = string | PartialRecord<Locale, string>;
7
7
  interface Cookie {
package/dist/module.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { CookieOptions } from 'nuxt/app';
3
3
 
4
- type Locale = 'ar' | 'az' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
4
+ type Locale = 'ar' | 'az' | 'be' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk' | 'zh-CN';
5
5
  type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
6
6
  type Translatable = string | PartialRecord<Locale, string>;
7
7
  interface Cookie {
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "8.0.0-beta.1",
3
+ "version": "8.0.0-beta.3",
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 = "8.0.0-beta.1";
6
+ const version = "8.0.0-beta.3";
7
7
 
8
8
  const en = {
9
9
  accept: "Accept",
@@ -63,7 +63,9 @@ const DEFAULTS = {
63
63
  cookieNameIsConsentGiven: "ncc_c",
64
64
  cookieNameCookiesEnabledIds: "ncc_e",
65
65
  cookieOptions: {
66
- path: "/"
66
+ path: "/",
67
+ sameSite: "strict",
68
+ secure: process.env.NODE_ENV === "development" ? void 0 : true
67
69
  },
68
70
  isAcceptNecessaryButtonEnabled: true,
69
71
  isControlButtonEnabled: true,
@@ -197,14 +197,14 @@ import {
197
197
  CookieType,
198
198
  type Locale,
199
199
  type Translatable,
200
- } from '../types'
200
+ } from '#cookie-control/types'
201
201
  import {
202
202
  getAllCookieIdsString,
203
203
  getCookieIds,
204
204
  removeCookie,
205
205
  resolveTranslatable,
206
- } from '../methods'
207
-
206
+ } from '#cookie-control/methods'
207
+ import { COOKIE_ID_SEPARATOR } from '#cookie-control/constants'
208
208
  import setCssVariables from '#cookie-control/set-vars'
209
209
  import { useCookieControl, useCookie, useNuxtApp } from '#imports'
210
210
 
@@ -246,7 +246,8 @@ const isSaved = computed(
246
246
  () =>
247
247
  getCookieIds(cookiesEnabled.value || [])
248
248
  .sort()
249
- .join('|') !== getCookieIds(localCookiesEnabled.value).sort().join('|'),
249
+ .join(COOKIE_ID_SEPARATOR) !==
250
+ getCookieIds(localCookiesEnabled.value).sort().join(COOKIE_ID_SEPARATOR),
250
251
  )
251
252
  const localeStrings = computed(() => moduleOptions.localeTexts[props.locale])
252
253
 
@@ -358,7 +359,9 @@ watch(
358
359
  localCookiesEnabled.value = [...(current || [])]
359
360
 
360
361
  if (isConsentGiven.value) {
361
- cookieCookiesEnabledIds.value = getCookieIds(current || []).join('|')
362
+ cookieCookiesEnabledIds.value = getCookieIds(current || []).join(
363
+ COOKIE_ID_SEPARATOR,
364
+ )
362
365
 
363
366
  for (const cookieEnabled of current || []) {
364
367
  if (!cookieEnabled.src) continue
@@ -1,2 +1,3 @@
1
1
  import type { Locale } from './types';
2
+ export declare const COOKIE_ID_SEPARATOR = "~";
2
3
  export declare const LOCALE_DEFAULT: Locale;
@@ -1 +1,2 @@
1
+ export const COOKIE_ID_SEPARATOR = "~";
1
2
  export const LOCALE_DEFAULT = "en";
@@ -0,0 +1,3 @@
1
+ import type { LocaleStrings } from '../types';
2
+ declare const _default: LocaleStrings;
3
+ export default _default;
@@ -0,0 +1,17 @@
1
+ export default {
2
+ accept: "\u041F\u0440\u044B\u043D\u044F\u0446\u044C",
3
+ acceptAll: "\u041F\u0440\u044B\u043D\u044F\u0446\u044C \u0443\u0441\u0451",
4
+ bannerDescription: "\u041C\u044B \u0432\u044B\u043A\u0430\u0440\u044B\u0441\u0442\u043E\u045E\u0432\u0430\u0435\u043C \u043D\u0430\u0448\u044B\u044F \u045E\u043B\u0430\u0441\u043D\u044B\u044F cookie-\u0444\u0430\u0439\u043B\u044B \u0456 cookie-\u0444\u0430\u0439\u043B\u044B \u0442\u0440\u044D\u0446\u0456\u0445 \u0441\u0442\u0430\u0440\u043E\u043D, \u043A\u0430\u0431 \u043C\u044B \u043C\u0430\u0433\u043B\u0456 \u043F\u0430\u043A\u0430\u0437\u0430\u0446\u044C \u0432\u0430\u043C \u0433\u044D\u0442\u044B \u0432\u044D\u0431-\u0441\u0430\u0439\u0442 \u0456 \u043B\u0435\u043F\u0448 \u0440\u0430\u0437\u0443\u043C\u0435\u0446\u044C, \u044F\u043A \u0432\u044B \u044F\u0433\u043E \u0432\u044B\u043A\u0430\u0440\u044B\u0441\u0442\u043E\u045E\u0432\u0430\u0435\u0446\u0435, \u0437 \u043C\u044D\u0442\u0430\u0439 \u043F\u0430\u043B\u0435\u043F\u0448\u044D\u043D\u043D\u044F \u043F\u0440\u0430\u043F\u0430\u043D\u0430\u0432\u0430\u043D\u044B\u0445 \u043D\u0430\u043C\u0456 \u043F\u0430\u0441\u043B\u0443\u0433. \u041A\u0430\u043B\u0456 \u0432\u044B \u043F\u0440\u0430\u0446\u044F\u0433\u043D\u0435\u0446\u0435 \u043F\u0440\u0430\u0433\u043B\u044F\u0434, \u043C\u044B \u0431\u0443\u0434\u0437\u0435\u043C \u043B\u0456\u0447\u044B\u0446\u044C, \u0448\u0442\u043E \u0432\u044B \u043F\u0440\u044B\u043D\u044F\u043B\u0456 cookie-\u0444\u0430\u0439\u043B\u044B.",
5
+ bannerTitle: "Cookie-\u0444\u0430\u0439\u043B\u044B",
6
+ close: "\u0417\u0430\u0447\u044B\u043D\u0456\u0446\u044C",
7
+ cookiesFunctional: "\u0424\u0443\u043D\u043A\u0446\u044B\u044F\u043D\u0430\u043B\u044C\u043D\u044B\u044F cookie-\u0444\u0430\u0439\u043B\u044B",
8
+ cookiesNecessary: "\u041D\u0435\u0430\u0431\u0445\u043E\u0434\u043D\u044B\u044F cookie-\u0444\u0430\u0439\u043B\u044B",
9
+ cookiesOptional: "\u0414\u0430\u0434\u0430\u0442\u043A\u043E\u0432\u044B\u044F cookie-\u0444\u0430\u0439\u043B\u044B",
10
+ decline: "\u042F \u043F\u0440\u044B\u043C\u0430\u044E \u0442\u043E\u043B\u044C\u043A\u0456 \u043D\u0435\u0430\u0431\u0445\u043E\u0434\u043D\u0430\u0441\u0446\u044C",
11
+ declineAll: "\u0412\u044B\u0434\u0430\u043B\u0456\u0446\u044C \u0443\u0441\u0435",
12
+ here: "\u0442\u0443\u0442",
13
+ iframeBlocked: "\u041A\u0430\u0431 \u0443\u0431\u0430\u0447\u044B\u0446\u044C \u0433\u044D\u0442\u0430, \u0443\u043A\u043B\u044E\u0447\u044B\u0446\u0435 \u0444\u0443\u043D\u043A\u0446\u044B\u044F\u043D\u0430\u043B\u044C\u043D\u044B\u044F cookie-\u0444\u0430\u0439\u043B\u044B",
14
+ manageCookies: "\u041A\u0456\u0440\u0430\u0432\u0430\u043D\u043D\u0435 cookie-\u0444\u0430\u0439\u043B\u0430\u043C\u0456",
15
+ save: "\u0417\u0430\u0445\u0430\u0432\u0430\u0446\u044C",
16
+ settingsUnsaved: "\u0423 \u0432\u0430\u0441 \u0437\u0430\u0441\u0442\u0430\u043B\u0456\u0441\u044F \u043D\u0435\u0437\u0430\u0445\u0430\u0432\u0430\u043D\u044B\u044F \u043D\u0430\u043B\u0430\u0434\u044B"
17
+ };
@@ -1,5 +1,6 @@
1
1
  import ar from "./ar.mjs";
2
2
  import az from "./az.mjs";
3
+ import be from "./be.mjs";
3
4
  import bg from "./bg.mjs";
4
5
  import ca from "./ca.mjs";
5
6
  import cs from "./cs.mjs";
@@ -28,9 +29,11 @@ import sk from "./sk.mjs";
28
29
  import sv from "./sv.mjs";
29
30
  import tr from "./tr.mjs";
30
31
  import uk from "./uk.mjs";
32
+ import zhCN from "./zh-CN.mjs";
31
33
  export const locales = [
32
34
  ar,
33
35
  az,
36
+ be,
34
37
  bg,
35
38
  ca,
36
39
  cs,
@@ -58,5 +61,6 @@ export const locales = [
58
61
  sk,
59
62
  sv,
60
63
  tr,
61
- uk
64
+ uk,
65
+ zhCN
62
66
  ];
@@ -0,0 +1,3 @@
1
+ import type { LocaleStrings } from '../types';
2
+ declare const _default: LocaleStrings;
3
+ export default _default;
@@ -0,0 +1,17 @@
1
+ export default {
2
+ accept: "\u63A5\u53D7",
3
+ acceptAll: "\u63A5\u53D7\u6240\u6709",
4
+ bannerDescription: "\u6211\u4EEC\u4F7F\u7528\u81EA\u5DF1\u7684cookie\u548C\u7B2C\u4E09\u65B9cookie\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u80FD\u591F\u6B63\u786E\u663E\u793A\u672C\u7F51\u7AD9\u5E76\u66F4\u597D\u5730\u4E86\u89E3\u672C\u7F51\u7AD9\u7684\u4F7F\u7528\u65B9\u5F0F\uFF0C\u4EE5\u6539\u5584\u6211\u4EEC\u63D0\u4F9B\u7684\u670D\u52A1\u3002\u5173\u4E8Ecookie\u4F7F\u7528\u6743\u9650\u7684\u51B3\u5B9A\u53EF\u4EE5\u968F\u65F6\u4F7F\u7528cookie\u6309\u94AE\u8FDB\u884C\u66F4\u6539\uFF0C\u8BE5\u6309\u94AE\u5C06\u5728\u6B64\u6A2A\u5E45\u4E0A\u8FDB\u884C\u9009\u62E9\u540E\u663E\u793A\u3002",
5
+ bannerTitle: "Cookies",
6
+ close: "\u5173\u95ED",
7
+ cookiesFunctional: "\u529F\u80FD\u6027 Cookies",
8
+ cookiesNecessary: "\u5FC5\u8981 Cookies",
9
+ cookiesOptional: "\u53EF\u9009 Cookies",
10
+ decline: "\u62D2\u7EDD",
11
+ declineAll: "\u62D2\u7EDD\u6240\u6709",
12
+ here: "\u5728\u8FD9\u91CC",
13
+ iframeBlocked: "\u5982\u9700\u67E5\u770B\uFF0C\u8BF7\u542F\u7528\u529F\u80FD Cookie",
14
+ manageCookies: "\u4E86\u89E3\u66F4\u591A\u4FE1\u606F\u5E76\u8FDB\u884C\u81EA\u5B9A\u4E49",
15
+ save: "\u4FDD\u5B58",
16
+ settingsUnsaved: "\u60A8\u6709\u672A\u4FDD\u5B58\u7684\u8BBE\u7F6E"
17
+ };
@@ -1,6 +1,6 @@
1
1
  import type { Cookie, ModuleOptions, Translatable } from './types';
2
2
  export declare const getAllCookieIdsString: (moduleOptions: ModuleOptions) => string;
3
3
  export declare const getCookieIds: (cookies: Cookie[]) => string[];
4
- export declare const removeCookie: (name: string) => any;
4
+ export declare const removeCookie: (name: string) => undefined;
5
5
  export declare const resolveTranslatable: (translatable: Translatable, locale?: import("./types").Locale) => string;
6
6
  export declare const useResolveTranslatable: (locale?: import("./types").Locale) => (translatable: Translatable) => string;
@@ -5,7 +5,7 @@ export const getAllCookieIdsString = (moduleOptions) => getCookieIds([
5
5
  ...moduleOptions.cookies.optional
6
6
  ]).join("");
7
7
  export const getCookieIds = (cookies) => cookies.map((cookie) => cookie.id);
8
- export const removeCookie = (name) => useCookie(name, { expires: /* @__PURE__ */ new Date(0) });
8
+ export const removeCookie = (name) => useCookie(name).value = void 0;
9
9
  export const resolveTranslatable = (translatable, locale = LOCALE_DEFAULT) => {
10
10
  if (typeof translatable === "string")
11
11
  return translatable;
@@ -1,4 +1,5 @@
1
1
  import { ref } from "vue";
2
+ import { COOKIE_ID_SEPARATOR } from "./constants.mjs";
2
3
  import { getAllCookieIdsString } from "./methods.mjs";
3
4
  import { defineNuxtPlugin, useCookie } from "#imports";
4
5
  import moduleOptions from "#build/cookie-control-options";
@@ -10,7 +11,7 @@ const plugin = defineNuxtPlugin((_nuxtApp) => {
10
11
  const cookieCookiesEnabledIds = useCookie(
11
12
  moduleOptions.cookieNameCookiesEnabledIds,
12
13
  moduleOptions.cookieOptions
13
- ).value?.split("|");
14
+ ).value?.split(COOKIE_ID_SEPARATOR);
14
15
  const isConsentGiven = ref(
15
16
  cookieIsConsentGiven === void 0 ? void 0 : cookieIsConsentGiven.value === getAllCookieIdsString(moduleOptions)
16
17
  );
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from 'vue';
2
2
  import type { CookieOptions } from 'nuxt/app';
3
- export type Locale = 'ar' | 'az' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
3
+ export type Locale = 'ar' | 'az' | 'be' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk' | 'zh-CN';
4
4
  export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
5
5
  export type Translatable = string | PartialRecord<Locale, string>;
6
6
  export declare enum CookieType {
@@ -44,7 +44,9 @@ export const DEFAULTS = {
44
44
  cookieNameIsConsentGiven: "ncc_c",
45
45
  cookieNameCookiesEnabledIds: "ncc_e",
46
46
  cookieOptions: {
47
- path: "/"
47
+ path: "/",
48
+ sameSite: "strict",
49
+ secure: process.env.NODE_ENV === "development" ? void 0 : true
48
50
  },
49
51
  isAcceptNecessaryButtonEnabled: true,
50
52
  isControlButtonEnabled: true,
package/package.json CHANGED
@@ -10,23 +10,23 @@
10
10
  },
11
11
  "description": "Nuxt Cookie Control Module",
12
12
  "devDependencies": {
13
- "@commitlint/cli": "18.4.4",
14
- "@commitlint/config-conventional": "18.4.4",
13
+ "@commitlint/cli": "19.2.1",
14
+ "@commitlint/config-conventional": "19.1.0",
15
15
  "@dargmuesli/nuxt-cookie-control": "link:",
16
16
  "@nuxt/module-builder": "0.5.5",
17
- "@nuxt/schema": "3.9.0",
17
+ "@nuxt/schema": "3.11.1",
18
18
  "@nuxtjs/eslint-config-typescript": "12.1.0",
19
- "eslint": "8.56.0",
19
+ "eslint": "8.57.0",
20
20
  "eslint-config-prettier": "9.1.0",
21
- "eslint-plugin-prettier": "5.1.2",
22
- "husky": "8.0.3",
23
- "lint-staged": "15.2.0",
24
- "nuxt": "3.9.0",
25
- "prettier": "3.1.1",
26
- "typescript": "5.3.3",
27
- "vue": "3.4.5",
28
- "vue-tsc": "1.8.27",
29
- "webpack": "5.89.0"
21
+ "eslint-plugin-prettier": "5.1.3",
22
+ "husky": "9.0.11",
23
+ "lint-staged": "15.2.2",
24
+ "nuxt": "3.11.1",
25
+ "prettier": "3.2.5",
26
+ "typescript": "5.4.2",
27
+ "vue": "3.4.21",
28
+ "vue-tsc": "2.0.6",
29
+ "webpack": "5.90.3"
30
30
  },
31
31
  "engines": {
32
32
  "node": ">=16"
@@ -61,22 +61,23 @@
61
61
  "Jonas Thelemann"
62
62
  ],
63
63
  "name": "@dargmuesli/nuxt-cookie-control",
64
- "packageManager": "pnpm@8.14.0",
64
+ "packageManager": "pnpm@8.15.5",
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
68
  "repository": "https://github.com/dargmuesli/nuxt-cookie-control",
69
69
  "resolutions": {
70
- "@nuxt/kit": "3.9.0"
70
+ "@nuxt/kit": "3.11.1"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "nuxt-module-build build",
74
+ "dev": "pnpm --dir playground run dev",
74
75
  "lint": "eslint --ext .js,.ts,.vue . && nuxt typecheck",
75
76
  "lint:fix": "eslint --ext .js,.ts,.vue --fix . && nuxt typecheck --fix",
76
77
  "prepack": "pnpm build",
77
- "prepare": "husky install"
78
+ "prepare": "husky"
78
79
  },
79
80
  "type": "module",
80
81
  "types": "./dist/module.d.ts",
81
- "version": "8.0.0-beta.1"
82
+ "version": "8.0.0-beta.3"
82
83
  }