@dargmuesli/nuxt-cookie-control 8.0.0-beta.2 → 8.0.0-beta.4

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
@@ -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.
@@ -207,6 +208,7 @@ Every property that includes a `{ en: ... }` value is a translatable property th
207
208
  en: 'This cookie stores preferences.'
208
209
  },
209
210
  id: 'p', // use a short cookie id to save bandwidth and prefixes to separate
211
+ isPreselected: false // `true` is not GDPR compliant! This flag does not enable any cookies, it only preselects the cookie's modal toggle. The default is `false`.
210
212
  name: {
211
213
  en: 'Preferences' // you always have to specify a cookie name (in English)
212
214
  },
@@ -215,7 +217,7 @@ Every property that includes a `{ en: ... }` value is a translatable property th
215
217
  'https://example.com/terms': 'Terms of Service',
216
218
  },
217
219
  src: 'https://example.com/preferences/js?id=<API-KEY>',
218
- targetCookieIds: ['xmpl_a', 'xmpl_b']
220
+ targetCookieIds: ['xmpl_a', 'xmpl_b'],
219
221
  }
220
222
  ```
221
223
 
package/dist/module.d.mts CHANGED
@@ -7,6 +7,7 @@ type Translatable = string | PartialRecord<Locale, string>;
7
7
  interface Cookie {
8
8
  description?: Translatable;
9
9
  id: string;
10
+ isPreselected?: boolean;
10
11
  name: Translatable;
11
12
  links?: Record<string, string | null>;
12
13
  src?: string;
package/dist/module.d.ts CHANGED
@@ -7,6 +7,7 @@ type Translatable = string | PartialRecord<Locale, string>;
7
7
  interface Cookie {
8
8
  description?: Translatable;
9
9
  id: string;
10
+ isPreselected?: boolean;
10
11
  name: Translatable;
11
12
  links?: Record<string, string | null>;
12
13
  src?: string;
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "8.0.0-beta.2",
3
+ "version": "8.0.0-beta.4",
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.2";
6
+ const version = "8.0.0-beta.4";
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,
@@ -94,9 +94,11 @@
94
94
  :id="resolveTranslatable(cookie.name, props.locale)"
95
95
  type="checkbox"
96
96
  :checked="
97
- getCookieIds(localCookiesEnabled).includes(
98
- cookie.id,
99
- )
97
+ isConsentGiven === undefined
98
+ ? cookie.isPreselected
99
+ : getCookieIds(localCookiesEnabled).includes(
100
+ cookie.id,
101
+ )
100
102
  "
101
103
  @change="toogleCookie(cookie)"
102
104
  />
@@ -139,9 +141,16 @@
139
141
  :key="entry[0]"
140
142
  >
141
143
  <br />
142
- <a :href="entry[0]">{{
143
- entry[1] || entry[0]
144
- }}</a>
144
+ <NuxtLink
145
+ :to="entry[0]"
146
+ @click="
147
+ !entry[0].toLowerCase().startsWith('http')
148
+ ? (isModalActive = false)
149
+ : null
150
+ "
151
+ >
152
+ {{ entry[1] || entry[0] }}
153
+ </NuxtLink>
145
154
  </span>
146
155
  </template>
147
156
  </label>
@@ -13,7 +13,7 @@ const plugin = defineNuxtPlugin((_nuxtApp) => {
13
13
  moduleOptions.cookieOptions
14
14
  ).value?.split(COOKIE_ID_SEPARATOR);
15
15
  const isConsentGiven = ref(
16
- cookieIsConsentGiven === void 0 ? void 0 : cookieIsConsentGiven.value === getAllCookieIdsString(moduleOptions)
16
+ cookieIsConsentGiven.value === void 0 ? void 0 : cookieIsConsentGiven.value === getAllCookieIdsString(moduleOptions)
17
17
  );
18
18
  const cookiesEnabled = ref(
19
19
  cookieCookiesEnabledIds === void 0 ? void 0 : [
@@ -10,6 +10,7 @@ export declare enum CookieType {
10
10
  export interface Cookie {
11
11
  description?: Translatable;
12
12
  id: string;
13
+ isPreselected?: boolean;
13
14
  name: Translatable;
14
15
  links?: Record<string, string | null>;
15
16
  src?: string;
@@ -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
@@ -23,10 +23,10 @@
23
23
  "lint-staged": "15.2.2",
24
24
  "nuxt": "3.11.1",
25
25
  "prettier": "3.2.5",
26
- "typescript": "5.4.2",
26
+ "typescript": "5.4.3",
27
27
  "vue": "3.4.21",
28
- "vue-tsc": "2.0.6",
29
- "webpack": "5.90.3"
28
+ "vue-tsc": "2.0.7",
29
+ "webpack": "5.91.0"
30
30
  },
31
31
  "engines": {
32
32
  "node": ">=16"
@@ -79,5 +79,5 @@
79
79
  },
80
80
  "type": "module",
81
81
  "types": "./dist/module.d.ts",
82
- "version": "8.0.0-beta.2"
82
+ "version": "8.0.0-beta.4"
83
83
  }