@dargmuesli/nuxt-cookie-control 5.4.0 → 5.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 +4 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/CookieControl.vue +27 -18
- package/dist/runtime/locale/index.mjs +2 -0
- package/dist/runtime/locale/oc.d.ts +3 -0
- package/dist/runtime/locale/oc.mjs +17 -0
- package/dist/runtime/types.d.ts +2 -1
- package/dist/runtime/types.mjs +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|

|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
✅ Translated for: ar, az, cs, da, de, en, es, fi, fr, hr, hu, it, ja, ko, lt, nl, no, pt, pl, ru, sk, sv, tr and uk
|
|
7
|
+
✅ Translated for: ar, az, cs, da, de, en, es, fi, fr, hr, hu, it, ja, ko, lt, nl, no, oc, pt, pl, ru, sk, sv, tr and uk
|
|
8
8
|
|
|
9
9
|
✅ Vue 3 support
|
|
10
10
|
|
|
@@ -99,6 +99,9 @@ if (cookieControl.cookiesEnabledIds.value.includes('google-analytics')) {
|
|
|
99
99
|
// 'top-left', 'top-right', 'top-full', 'bottom-left', 'bottom-right', 'bottom-full'
|
|
100
100
|
barPosition: 'bottom-full',
|
|
101
101
|
|
|
102
|
+
// Switch to toggle if clicking the overlay outside the configuration modal closes the modal.
|
|
103
|
+
closeModalOnClickOutside: true,
|
|
104
|
+
|
|
102
105
|
// Component colors.
|
|
103
106
|
// If you want to disable colors set colors property to false.
|
|
104
107
|
colors: {
|
package/dist/module.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
-
type Locale = 'ar' | 'az' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'pt' | 'pl' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
|
|
3
|
+
type Locale = 'ar' | 'az' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
|
|
4
4
|
type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
|
|
5
5
|
type Translatable = string | PartialRecord<Locale, string>;
|
|
6
6
|
interface Cookie {
|
|
@@ -30,6 +30,7 @@ interface LocaleStrings {
|
|
|
30
30
|
}
|
|
31
31
|
interface ModuleOptions {
|
|
32
32
|
barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
|
|
33
|
+
closeModalOnClickOutside: boolean;
|
|
33
34
|
colors: false | Record<string, any>;
|
|
34
35
|
cookieExpiryOffsetMs: number;
|
|
35
36
|
cookieNameCookiesEnabledIds: string;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
3
3
|
import { createResolver, defineNuxtModule, addPlugin, addImports, addTemplate, extendWebpackConfig, resolvePath } from '@nuxt/kit';
|
|
4
4
|
|
|
5
5
|
const name = "@dargmuesli/nuxt-cookie-control";
|
|
6
|
-
const version = "5.
|
|
6
|
+
const version = "5.6.0";
|
|
7
7
|
|
|
8
8
|
const en = {
|
|
9
9
|
accept: "Accept",
|
|
@@ -25,6 +25,7 @@ const en = {
|
|
|
25
25
|
|
|
26
26
|
const DEFAULTS = {
|
|
27
27
|
barPosition: "bottom-full",
|
|
28
|
+
closeModalOnClickOutside: false,
|
|
28
29
|
colors: {
|
|
29
30
|
barBackground: "#000",
|
|
30
31
|
barButtonBackground: "#fff",
|
|
@@ -43,7 +43,11 @@
|
|
|
43
43
|
</svg>
|
|
44
44
|
</button>
|
|
45
45
|
<transition name="cookieControl__Modal">
|
|
46
|
-
<div
|
|
46
|
+
<div
|
|
47
|
+
v-if="isModalActive"
|
|
48
|
+
class="cookieControl__Modal"
|
|
49
|
+
@click.self="onModalClick"
|
|
50
|
+
>
|
|
47
51
|
<p
|
|
48
52
|
v-if="isSaved"
|
|
49
53
|
class="cookieControl__ModalUnsaved"
|
|
@@ -238,12 +242,6 @@ const accept = () => {
|
|
|
238
242
|
cookiesOptionalEnabled: moduleOptions.cookies.optional,
|
|
239
243
|
})
|
|
240
244
|
}
|
|
241
|
-
const decline = () => {
|
|
242
|
-
setCookies({
|
|
243
|
-
isConsentGiven: true,
|
|
244
|
-
cookiesOptionalEnabled: moduleOptions.cookies.necessary,
|
|
245
|
-
})
|
|
246
|
-
}
|
|
247
245
|
const acceptPartial = () => {
|
|
248
246
|
const localCookiesEnabledIds = getCookieIds(localCookiesEnabled.value)
|
|
249
247
|
|
|
@@ -255,23 +253,18 @@ const acceptPartial = () => {
|
|
|
255
253
|
].filter((cookie) => localCookiesEnabledIds.includes(getCookieId(cookie))),
|
|
256
254
|
})
|
|
257
255
|
}
|
|
256
|
+
const decline = () => {
|
|
257
|
+
setCookies({
|
|
258
|
+
isConsentGiven: true,
|
|
259
|
+
cookiesOptionalEnabled: moduleOptions.cookies.necessary,
|
|
260
|
+
})
|
|
261
|
+
}
|
|
258
262
|
const declineAll = () => {
|
|
259
263
|
setCookies({
|
|
260
264
|
isConsentGiven: false,
|
|
261
265
|
cookiesOptionalEnabled: [],
|
|
262
266
|
})
|
|
263
267
|
}
|
|
264
|
-
const toogleCookie = (cookie: Cookie) => {
|
|
265
|
-
const cookieIndex = getCookieIds(localCookiesEnabled.value).indexOf(
|
|
266
|
-
getCookieId(cookie)
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
if (cookieIndex < 0) {
|
|
270
|
-
localCookiesEnabled.value.push(cookie)
|
|
271
|
-
} else {
|
|
272
|
-
localCookiesEnabled.value.splice(cookieIndex, 1)
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
268
|
const getDescription = (description: Translatable) =>
|
|
276
269
|
`${
|
|
277
270
|
moduleOptions.isDashInDescriptionEnabled === false ? '' : '-'
|
|
@@ -284,6 +277,11 @@ const getName = (name: Translatable) => {
|
|
|
284
277
|
const init = () => {
|
|
285
278
|
expires.setTime(expires.getTime() + moduleOptions.cookieExpiryOffsetMs)
|
|
286
279
|
}
|
|
280
|
+
const onModalClick = () => {
|
|
281
|
+
if (moduleOptions.closeModalOnClickOutside) {
|
|
282
|
+
isModalActive.value = false
|
|
283
|
+
}
|
|
284
|
+
}
|
|
287
285
|
const setCookies = ({
|
|
288
286
|
cookiesOptionalEnabled: cookiesOptionalEnabledNew,
|
|
289
287
|
isConsentGiven: isConsentGivenNew,
|
|
@@ -310,6 +308,17 @@ const toggleButton = ($event: MouseEvent) => {
|
|
|
310
308
|
?.nextSibling as HTMLLabelElement | null
|
|
311
309
|
)?.click()
|
|
312
310
|
}
|
|
311
|
+
const toogleCookie = (cookie: Cookie) => {
|
|
312
|
+
const cookieIndex = getCookieIds(localCookiesEnabled.value).indexOf(
|
|
313
|
+
getCookieId(cookie)
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
if (cookieIndex < 0) {
|
|
317
|
+
localCookiesEnabled.value.push(cookie)
|
|
318
|
+
} else {
|
|
319
|
+
localCookiesEnabled.value.splice(cookieIndex, 1)
|
|
320
|
+
}
|
|
321
|
+
}
|
|
313
322
|
const toggleLabel = ($event: KeyboardEvent) => {
|
|
314
323
|
if ($event.key === ' ') ($event.target as HTMLLabelElement | null)?.click()
|
|
315
324
|
}
|
|
@@ -15,6 +15,7 @@ import ko from "./ko.mjs";
|
|
|
15
15
|
import lt from "./lt.mjs";
|
|
16
16
|
import nl from "./nl.mjs";
|
|
17
17
|
import no from "./no.mjs";
|
|
18
|
+
import oc from "./oc.mjs";
|
|
18
19
|
import pt from "./pt.mjs";
|
|
19
20
|
import pl from "./pl.mjs";
|
|
20
21
|
import ru from "./ru.mjs";
|
|
@@ -40,6 +41,7 @@ export const locales = [
|
|
|
40
41
|
lt,
|
|
41
42
|
nl,
|
|
42
43
|
no,
|
|
44
|
+
oc,
|
|
43
45
|
pt,
|
|
44
46
|
pl,
|
|
45
47
|
ru,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
accept: "Acceptar",
|
|
3
|
+
acceptAll: "Tot acceptar",
|
|
4
|
+
bannerDescription: "Utilizam de cookies d\u2019origina e de cookies t\xE8rces. Aquestes cookies son destinats a vos ofrir una navegacion optimizada sus aqueste site web de nos donar un apercebut de son utilizacion, per melhorar los servicis que vos provesiss\xE8m. En contunhant v\xF2stra navegacion, consideram qu\u2019acceptatz l\u2019usatge de cookies.",
|
|
5
|
+
bannerTitle: "Cookies",
|
|
6
|
+
close: "Tancar",
|
|
7
|
+
cookiesFunctional: "Cookies foncionals",
|
|
8
|
+
cookiesNecessary: "Los cookies obligat\xF2ris",
|
|
9
|
+
cookiesOptional: "Los cookies opcionals",
|
|
10
|
+
decline: "Acc\xE8pti \xE7\xF2 necessari",
|
|
11
|
+
declineAll: "Tot refusar",
|
|
12
|
+
here: "aqu\xED",
|
|
13
|
+
iframeBlocked: "Per veire aqu\xF2, merc\xE9s d\u2019activar los cookies foncionals",
|
|
14
|
+
manageCookies: "Gerir los cookies",
|
|
15
|
+
save: "Salvagardar",
|
|
16
|
+
settingsUnsaved: "Av\xE8tz de param\xE8tres non salvagardats"
|
|
17
|
+
};
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
export type Locale = 'ar' | 'az' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'pt' | 'pl' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
|
|
2
|
+
export type Locale = 'ar' | 'az' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
|
|
3
3
|
export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
|
|
4
4
|
export type Translatable = string | PartialRecord<Locale, string>;
|
|
5
5
|
export declare enum CookieType {
|
|
@@ -33,6 +33,7 @@ export interface LocaleStrings {
|
|
|
33
33
|
}
|
|
34
34
|
export interface ModuleOptions {
|
|
35
35
|
barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
|
|
36
|
+
closeModalOnClickOutside: boolean;
|
|
36
37
|
colors: false | Record<string, any>;
|
|
37
38
|
cookieExpiryOffsetMs: number;
|
|
38
39
|
cookieNameCookiesEnabledIds: string;
|
package/dist/runtime/types.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dargmuesli/nuxt-cookie-control",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Nuxt Cookies Control Module",
|
|
5
5
|
"author": "Dario Ferderber <dario.ferderber@broj42.com>",
|
|
6
6
|
"maintainers": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@dargmuesli/nuxt-cookie-control": "link:.",
|
|
47
|
-
"@nuxt/module-builder": "0.
|
|
47
|
+
"@nuxt/module-builder": "0.3.0",
|
|
48
48
|
"@nuxtjs/eslint-config-typescript": "12.0.0",
|
|
49
49
|
"@types/js-cookie": "3.0.3",
|
|
50
50
|
"eslint": "8.38.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"typescript": "5.0.4",
|
|
58
58
|
"vue": "3.2.47",
|
|
59
59
|
"vue-tsc": "1.2.0",
|
|
60
|
-
"webpack": "5.
|
|
60
|
+
"webpack": "5.79.0"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|