@dargmuesli/nuxt-cookie-control 4.4.1 → 4.6.0

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
@@ -4,38 +4,49 @@
4
4
  ![Nuxt Cookie Control](https://drive.google.com/a/broj42.com/uc?id=1FGQVyj2s0OT-gpTYxH_FuQhe6oU9iejW)
5
5
 
6
6
 
7
- Continuing Dario Ferderber's work on [gitlab.com/broj42/nuxt-cookie-control](https://gitlab.com/broj42/nuxt-cookie-control).
7
+ Translated for: ar, az, cs, da, de, en, es, fr, hr, hu, it, ja, ko, lt, nl, no, pt, ru, sk, tr and uk
8
8
 
9
- 🚩 **Make sure to read the Migration instructions for all major version updates like [v2.0.0](https://github.com/dargmuesli/nuxt-cookie-control/releases/tag/2.0.0), [v3.0.0](https://github.com/dargmuesli/nuxt-cookie-control/releases/tag/3.0.0) and following!**
9
+ Vue 3 support
10
+
11
+ ✅ Components and composables are [auto-imported](https://nuxt.com/docs/guide/concepts/auto-imports)
12
+
13
+ 🚩 API changes since continuing Dario Ferderber's work on [gitlab.com/broj42/nuxt-cookie-control](https://gitlab.com/broj42/nuxt-cookie-control), make sure to read the README!
14
+
15
+
16
+ ## 🚀 Getting Started
10
17
 
11
18
  [![Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/dargmuesli/nuxt-cookie-control?file=playground%2Fapp.vue)
12
19
 
13
- ## 🚀 Usage
20
+ ### Installation
14
21
  ```bash
15
22
  npm i -D @dargmuesli/nuxt-cookie-control
16
23
  yarn add -D @dargmuesli/nuxt-cookie-control
17
24
  pnpm i -D @dargmuesli/nuxt-cookie-control
18
25
  ```
19
26
 
20
-
27
+ ### Configuration
21
28
  ```javascript
22
29
  // nuxt.config.js
23
30
 
24
31
  modules: [
25
32
  '@dargmuesli/nuxt-cookie-control'
26
- ]
33
+ ],
34
+ cookieControl: {
35
+ // typed module options
36
+ }
37
+
27
38
  // or
39
+
28
40
  modules: [
29
41
  ['@dargmuesli/nuxt-cookie-control', {
30
- // module options
42
+ // untyped module options
31
43
  }]
32
44
  ]
33
45
  ```
34
46
 
35
- Components and composables are [auto-imported](https://nuxt.com/docs/guide/concepts/auto-imports)!
36
-
47
+ ### Usage
37
48
  ```html
38
- <!-- component.vue -->
49
+ <!-- app.vue -->
39
50
 
40
51
  <template>
41
52
  <CookieControl locale="en" />
@@ -49,61 +60,39 @@ const {
49
60
  isModalActive,
50
61
  moduleOptions
51
62
  } = useCookieControl()
63
+
64
+ // example: react to a cookie being accepted
65
+ watch(
66
+ () => cookiesEnabledIds.value,
67
+ (current, previous) => {
68
+ if (
69
+ (!previous?.includes('google-analytics') &&
70
+ current?.includes('google-analytics'))
71
+ ) {
72
+ // cookie with id `google-analytics` got added
73
+ window.location.reload() // placeholder for your custom change handler
74
+ }
75
+ },
76
+ { deep: true }
77
+ )
52
78
  </script>
53
79
  ```
54
- ## Component Slots
55
- ### Bar
56
- ```html
57
- <CookieControl>
58
- <template #bar>
59
- <h3>Bar title</h3>
60
- <p>Bar description (you can use $cookies.text.barDescription)</p>
61
- <n-link>Go somewhere</n-link>
62
- </template>
63
- </CookieControl>
64
- ```
65
- ### Modal
66
- ```html
67
- <template #modal>
68
- <h3>Modal title</h3>
69
- <p>Modal description</p>
70
- </template>
71
- ```
72
- ### Cookie
73
- ```html
74
- <template #cookie="{config}">
75
- <span v-for="c in config" :key="c.id" v-text="c.cookies"/>
76
- </template>
77
- ```
78
80
 
79
- ## Props
80
- - locale: `['en']`
81
- ```html
82
- <CookieControl locale="de"/>
81
+ ```ts
82
+ // plugins/analytics.client.ts
83
+
84
+ // example: initialization based on enabled cookies
85
+ const cookieControl = useCookieControl()
86
+
87
+ if (cookieControl.cookiesEnabledIds.value.includes('google-analytics')) {
88
+ initGoogleAnalytics() // placeholder for your custom initialization
89
+ }
83
90
  ```
84
91
 
85
- Currently available:
86
- - ar
87
- - az
88
- - cs
89
- - da
90
- - de
91
- - en
92
- - es
93
- - fr
94
- - hr
95
- - hu
96
- - it
97
- - ja
98
- - ko
99
- - nl
100
- - no
101
- - pt
102
- - ru
103
- - sk
104
- - uk
105
-
106
- ## Module Options
92
+
93
+ ## API
94
+
95
+ ### Module Options
107
96
 
108
97
  ```javascript
109
98
  // Position of cookie bar.
@@ -196,7 +185,7 @@ localeTexts: {
196
185
  }
197
186
  ```
198
187
 
199
- ### Cookies
188
+ #### Cookies
200
189
 
201
190
  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
191
 
@@ -214,6 +203,40 @@ Every property the includes a `{ en: ... }` value is a translatable property tha
214
203
  }
215
204
  ```
216
205
 
206
+ ### Component Slots
207
+
208
+ #### Bar
209
+ ```html
210
+ <CookieControl>
211
+ <template #bar>
212
+ <h3>Bar title</h3>
213
+ <p>Bar description (you can use $cookies.text.barDescription)</p>
214
+ <n-link>Go somewhere</n-link>
215
+ </template>
216
+ </CookieControl>
217
+ ```
218
+
219
+ #### Modal
220
+ ```html
221
+ <template #modal>
222
+ <h3>Modal title</h3>
223
+ <p>Modal description</p>
224
+ </template>
225
+ ```
226
+
227
+ #### Cookie
228
+ ```html
229
+ <template #cookie="{config}">
230
+ <span v-for="c in config" :key="c.id" v-text="c.cookies"/>
231
+ </template>
232
+ ```
233
+
234
+ ### Props
235
+ - locale: `['en']`
236
+ ```html
237
+ <CookieControl locale="de"/>
238
+ ```
239
+
217
240
 
218
241
  <!-- Badges -->
219
242
  [npm-version-src]: https://badgen.net/npm/v/@dargmuesli/nuxt-cookie-control/latest
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "4.4.1",
3
+ "version": "4.6.0",
4
4
  "configKey": "cookieControl",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { resolve } from 'node:path';
2
2
  import { createResolver, defineNuxtModule, addPlugin, addImports, addTemplate, extendWebpackConfig, resolvePath } from '@nuxt/kit';
3
3
 
4
4
  const name = "@dargmuesli/nuxt-cookie-control";
5
- const version = "4.4.1";
5
+ const version = "4.6.0";
6
6
 
7
7
  const en = {
8
8
  accept: "Accept",
@@ -0,0 +1,3 @@
1
+ import { LocaleStrings } from '../types';
2
+ declare const _default: LocaleStrings;
3
+ export default _default;
@@ -0,0 +1,17 @@
1
+ export default {
2
+ accept: "Sutinku",
3
+ acceptAll: "Sutinku su visais",
4
+ bannerDescription: "Mes naudojame savo slapukus and tre\u010Di\u0173j\u0173 \u0161ali\u0173 slapukus tam, kad gal\u0117tume geriau suprasti kaip svetain\u0117 veikia ir yra naudojama bei tobulinti savo teikiamas paslaugas. J\u016Bs bet kuriuo metu galite pakeisti sutikim\u0105 d\u0117l slapuk\u0173 naudojimo paspaud\u0119 slapuk\u0173 mygtuk\u0105 kuris atsiras kai \u0161ioje reklamjuost\u0117je padarysite pasirinkim\u0105.",
5
+ bannerTitle: "Slapukai",
6
+ close: "U\u017Edaryti",
7
+ cookiesFunctional: "Funkciniai slapukai",
8
+ cookiesNecessary: "B\u016Btinieji slapukai",
9
+ cookiesOptional: "Pasirinktiniai slapukai",
10
+ decline: "At\u0161aukti",
11
+ declineAll: "At\u0161aukti visk\u0105",
12
+ here: "\u010Dia",
13
+ iframeBlocked: "Nor\u0117dami matyti, leiskite naudoti funkcinius slapukus",
14
+ manageCookies: "Su\u017Einoti daugiau ir pritaikyti",
15
+ save: "I\u0161saugoti",
16
+ settingsUnsaved: "J\u016Bs nei\u0161saugojote vis\u0173 nustatym\u0173"
17
+ };
@@ -0,0 +1,3 @@
1
+ import { LocaleStrings } from '../types';
2
+ declare const _default: LocaleStrings;
3
+ export default _default;
@@ -0,0 +1,17 @@
1
+ export default {
2
+ accept: "Kabul etmek",
3
+ acceptAll: "T\xFCm\xFCn\xFC kabul et",
4
+ bannerDescription: "Bu web sitesini do\u011Fru bir \u015Fekilde g\xF6r\xFCnt\xFCleyebilmek ve teklifimizi geli\u015Ftirmek i\xE7in bu web sitesinin nas\u0131l kullan\u0131ld\u0131\u011F\u0131n\u0131 daha iyi anlayabilmek i\xE7in kendi ve \xFC\xE7\xFCnc\xFC taraf \xE7erezlerimizi kullan\u0131yoruz. \xC7erez kullanma izni ile ilgili karar, bu banner \xFCzerinde bir se\xE7im yap\u0131ld\u0131ktan sonra g\xF6r\xFCnen \xE7erez d\xFC\u011Fmesi arac\u0131l\u0131\u011F\u0131yla herhangi bir zamanda de\u011Fi\u015Ftirilebilir.",
5
+ bannerTitle: "\xC7erezler",
6
+ close: "Kapat",
7
+ cookiesFunctional: "\u0130\u015Flevsel \xE7erezler",
8
+ cookiesNecessary: "Gerekli \xE7erezler",
9
+ cookiesOptional: "\u0130ste\u011Fe ba\u011Fl\u0131 \xE7erezler",
10
+ decline: "Reddetmek",
11
+ declineAll: "T\xFCm\xFCn\xFC reddet",
12
+ here: "here",
13
+ iframeBlocked: "Bunu g\xF6rmek i\xE7in l\xFCtfen i\u015Flevsel \xE7erezleri etkinle\u015Ftirin",
14
+ manageCookies: "\xC7erezleri y\xF6net",
15
+ save: "Kaydet",
16
+ settingsUnsaved: "Kaydedilmemi\u015F ayarlar mevcut"
17
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "4.4.1",
3
+ "version": "4.6.0",
4
4
  "description": "Nuxt Cookies Control Module",
5
5
  "author": "Dario Ferderber <dario.ferderber@broj42.com>",
6
6
  "maintainers": [
@@ -36,7 +36,7 @@
36
36
  "lint": "pnpm prepack && eslint --ext .js,.ts,.vue . && nuxi typecheck playground"
37
37
  },
38
38
  "dependencies": {
39
- "@nuxt/kit": "3.2.0",
39
+ "@nuxt/kit": "3.2.2",
40
40
  "@sindresorhus/slugify": "2.2.0",
41
41
  "css-vars-ponyfill": "2.4.8",
42
42
  "js-cookie": "3.0.1",
@@ -45,17 +45,17 @@
45
45
  "devDependencies": {
46
46
  "@nuxt/module-builder": "0.2.1",
47
47
  "@nuxtjs/eslint-config-typescript": "12.0.0",
48
- "@types/js-cookie": "3.0.2",
48
+ "@types/js-cookie": "3.0.3",
49
49
  "eslint": "8.34.0",
50
50
  "eslint-config-prettier": "8.6.0",
51
51
  "eslint-plugin-prettier": "4.2.1",
52
52
  "husky": "8.0.3",
53
53
  "lint-staged": "13.1.2",
54
- "nuxt": "3.2.0",
54
+ "nuxt": "3.2.2",
55
55
  "prettier": "2.8.4",
56
56
  "typescript": "4.9.5",
57
57
  "vue": "3.2.47",
58
- "vue-tsc": "1.0.24",
58
+ "vue-tsc": "1.1.7",
59
59
  "webpack": "5.75.0"
60
60
  },
61
61
  "resolutions": {