@dargmuesli/nuxt-cookie-control 6.4.0 → 6.4.2

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
@@ -1,6 +1,8 @@
1
1
  # Nuxt Cookie Control
2
2
 
3
- [![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href]
3
+ [![ci status][ci-image]][ci-url]
4
+ [![npm version][npm-version-src]][npm-version-href]
5
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
4
6
 
5
7
  ![nuxt-cookie-control](https://drive.google.com/a/broj42.com/uc?id=19sFguJo7SKUvmH4xu9DhK9ZXzR6oWLX8)
6
8
 
@@ -64,7 +66,7 @@ const {
64
66
  cookiesEnabledIds,
65
67
  isConsentGiven,
66
68
  isModalActive,
67
- moduleOptions
69
+ moduleOptions,
68
70
  } = useCookieControl()
69
71
 
70
72
  // example: react to a cookie being accepted
@@ -72,14 +74,14 @@ watch(
72
74
  () => cookiesEnabledIds.value,
73
75
  (current, previous) => {
74
76
  if (
75
- (!previous?.includes('google-analytics') &&
76
- current?.includes('google-analytics'))
77
+ !previous?.includes('google-analytics') &&
78
+ current?.includes('google-analytics')
77
79
  ) {
78
80
  // cookie with id `google-analytics` got added
79
81
  window.location.reload() // placeholder for your custom change handler
80
82
  }
81
83
  },
82
- { deep: true }
84
+ { deep: true },
83
85
  )
84
86
  </script>
85
87
  ```
@@ -91,7 +93,7 @@ watch(
91
93
  const cookieControl = useCookieControl()
92
94
 
93
95
  if (cookieControl.cookiesEnabledIds.value.includes('google-analytics')) {
94
- initGoogleAnalytics() // placeholder for your custom initialization
96
+ initGoogleAnalytics() // placeholder for your custom initialization
95
97
  }
96
98
  ```
97
99
 
@@ -197,20 +199,24 @@ localeTexts: {
197
199
 
198
200
  #### Cookies
199
201
 
200
- Every property the includes a `{ en: ... }` value is a translatable property that could instead only specify a string (`'...'`) or other locales as well (`{ de: ..., uk: ... }`).
202
+ Every property that includes a `{ en: ... }` value is a translatable property that could instead only specify a string (`'...'`) or other locales as well (`{ de: ..., uk: ... }`).
201
203
 
202
204
  ```javascript
203
205
  {
204
206
  description: {
205
- en: 'Used for cookie control.'
207
+ en: 'This cookie stores preferences.'
206
208
  },
207
- id: 'ga', // if unset, `getCookieId(cookie)` returns the cookie's slugified name instead, which e.g. is used to fill the state's `enabledCookieIds` list
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
208
210
  // use a short cookie id to save bandwidth!
209
211
  name: {
210
- en: 'Google Analytics' // you always have to specify a cookie name (in English)
212
+ en: 'Preferences' // you always have to specify a cookie name (in English)
211
213
  },
212
- src: 'https://www.googletagmanager.com/gtag/js?id=<API-KEY>',
213
- targetCookieIds: ['cookie_control_consent', 'cookie_control_enabled_cookies']
214
+ links: {
215
+ 'https://example.com/privacy': 'Privacy Policy',
216
+ 'https://example.com/terms': 'Terms of Service',
217
+ },
218
+ src: 'https://example.com/preferences/js?id=<API-KEY>',
219
+ targetCookieIds: ['xmpl_a', 'xmpl_b']
214
220
  }
215
221
  ```
216
222
 
@@ -241,7 +247,7 @@ Every property the includes a `{ en: ... }` value is a translatable property tha
241
247
 
242
248
  ```html
243
249
  <template #cookie="{config}">
244
- <span v-for="c in config" :key="c.id" v-text="c.cookies"/>
250
+ <span v-for="c in config" :key="c.id" v-text="c.cookies" />
245
251
  </template>
246
252
  ```
247
253
 
@@ -249,11 +255,14 @@ Every property the includes a `{ en: ... }` value is a translatable property tha
249
255
 
250
256
  - locale: `['en']`
251
257
  ```html
252
- <CookieControl locale="de"/>
258
+ <CookieControl locale="de" />
253
259
  ```
254
260
 
255
261
 
256
262
  <!-- Badges -->
263
+ [ci-image]: https://img.shields.io/github/actions/workflow/status/dargmuesli/nuxt-cookie-control/ci.yml
264
+ [ci-url]: https://github.com/dargmuesli/nuxt-cookie-control/actions/workflows/ci.yml
265
+
257
266
  [npm-version-src]: https://badgen.net/npm/v/@dargmuesli/nuxt-cookie-control/latest
258
267
  [npm-version-href]: https://npmjs.com/package/@dargmuesli/nuxt-cookie-control
259
268
 
@@ -0,0 +1,58 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+ import { CookieOptions } from 'nuxt/app';
3
+
4
+ type Locale = 'ar' | 'az' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
5
+ type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
6
+ type Translatable = string | PartialRecord<Locale, string>;
7
+ interface Cookie {
8
+ description?: Translatable;
9
+ id?: string;
10
+ name: Translatable;
11
+ links?: Record<string, string | null>;
12
+ src?: string;
13
+ targetCookieIds?: string[];
14
+ }
15
+ interface LocaleStrings {
16
+ accept: string;
17
+ acceptAll: string;
18
+ bannerDescription: string;
19
+ bannerTitle: string;
20
+ close: string;
21
+ cookiesFunctional: string;
22
+ cookiesNecessary: string;
23
+ cookiesOptional: string;
24
+ iframeBlocked: string;
25
+ decline: string;
26
+ declineAll: string;
27
+ here: string;
28
+ manageCookies: string;
29
+ save: string;
30
+ settingsUnsaved: string;
31
+ }
32
+ interface ModuleOptions {
33
+ barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
34
+ closeModalOnClickOutside: boolean;
35
+ colors: false | Record<string, any>;
36
+ cookieExpiryOffsetMs: number;
37
+ cookieNameCookiesEnabledIds: string;
38
+ cookieNameIsConsentGiven: string;
39
+ cookies: {
40
+ necessary: Cookie[];
41
+ optional: Cookie[];
42
+ };
43
+ cookieOptions: CookieOptions;
44
+ isAcceptNecessaryButtonEnabled: boolean;
45
+ isControlButtonEnabled: boolean;
46
+ isCookieIdVisible: boolean;
47
+ isCssEnabled: boolean;
48
+ isCssPonyfillEnabled: boolean;
49
+ isDashInDescriptionEnabled: boolean;
50
+ isIframeBlocked: boolean;
51
+ isModalForced: boolean;
52
+ locales: Locale[];
53
+ localeTexts: PartialRecord<Locale, Partial<LocaleStrings>>;
54
+ }
55
+
56
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
57
+
58
+ export { _default as default };
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "6.4.0",
3
+ "version": "6.4.2",
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 = "6.4.0";
6
+ const version = "6.4.2";
7
7
 
8
8
  const en = {
9
9
  accept: "Accept",
@@ -186,7 +186,6 @@
186
186
  <script setup lang="ts">
187
187
  import { ref, computed, onBeforeMount, watch } from 'vue'
188
188
 
189
- import { useNuxtApp } from '#app'
190
189
  import { Cookie, CookieType, Locale, Translatable } from '../types'
191
190
  import {
192
191
  getAllCookieIdsString,
@@ -195,8 +194,9 @@ import {
195
194
  removeCookie,
196
195
  resolveTranslatable,
197
196
  } from '../methods'
198
- import setCssVariables from '#cookie-control/set-vars'
199
197
 
198
+ import { useNuxtApp } from '#app'
199
+ import setCssVariables from '#cookie-control/set-vars'
200
200
  import { useCookieControl, useCookie } from '#imports'
201
201
 
202
202
  export interface Props {
@@ -21,8 +21,9 @@
21
21
  <script setup lang="ts">
22
22
  import { computed } from 'vue'
23
23
 
24
- import { useNuxtApp } from '#app'
25
24
  import { Cookie } from '../types'
25
+
26
+ import { useNuxtApp } from '#app'
26
27
  import { useCookieControl } from '#imports'
27
28
 
28
29
  const { cookiesEnabled, isModalActive, moduleOptions } = useCookieControl()
@@ -1,5 +1,5 @@
1
- import { Plugin } from '#app';
2
1
  import { State } from './types';
2
+ import { Plugin } from '#app';
3
3
  declare const plugin: Plugin<{
4
4
  cookies: State;
5
5
  }>;
@@ -0,0 +1,7 @@
1
+
2
+ import { } from './module'
3
+
4
+
5
+
6
+
7
+ export { default } from './module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "6.4.0",
3
+ "version": "6.4.2",
4
4
  "description": "Nuxt Cookie Control Module",
5
5
  "author": "Dario Ferderber <dario.ferderber@broj42.com>",
6
6
  "maintainers": [
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=16"
23
23
  },
24
- "packageManager": "pnpm@8.6.12",
24
+ "packageManager": "pnpm@8.7.1",
25
25
  "exports": {
26
26
  ".": {
27
27
  "import": "./dist/module.mjs",
@@ -44,7 +44,7 @@
44
44
  "prepare": "husky install"
45
45
  },
46
46
  "dependencies": {
47
- "@nuxt/kit": "3.6.5",
47
+ "@nuxt/kit": "3.7.1",
48
48
  "@sindresorhus/slugify": "2.2.1",
49
49
  "css-vars-ponyfill": "2.4.8",
50
50
  "string-replace-loader": "3.1.0"
@@ -52,17 +52,17 @@
52
52
  "devDependencies": {
53
53
  "@commitlint/cli": "17.7.1",
54
54
  "@commitlint/config-conventional": "17.7.0",
55
- "@dargmuesli/nuxt-cookie-control": "link:.",
56
- "@nuxt/module-builder": "0.4.0",
57
- "@nuxtjs/eslint-config-typescript": "12.0.0",
58
- "eslint": "8.47.0",
55
+ "@dargmuesli/nuxt-cookie-control": "link:",
56
+ "@nuxt/module-builder": "0.5.1",
57
+ "@nuxtjs/eslint-config-typescript": "12.1.0",
58
+ "eslint": "8.48.0",
59
59
  "eslint-config-prettier": "9.0.0",
60
60
  "eslint-plugin-prettier": "5.0.0",
61
61
  "husky": "8.0.3",
62
- "lint-staged": "14.0.0",
63
- "nuxt": "3.6.5",
64
- "prettier": "3.0.1",
65
- "typescript": "5.1.6",
62
+ "lint-staged": "14.0.1",
63
+ "nuxt": "3.7.1",
64
+ "prettier": "3.0.3",
65
+ "typescript": "5.2.2",
66
66
  "vue": "3.3.4",
67
67
  "vue-tsc": "1.8.8",
68
68
  "webpack": "5.88.2"