@dargmuesli/nuxt-cookie-control 4.0.0-beta.2 → 4.0.1
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/dist/module.d.ts +10 -10
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/CookieControl.vue +7 -12
- package/dist/runtime/types.d.ts +10 -10
- package/dist/runtime/types.mjs +1 -0
- package/package.json +5 -5
package/dist/module.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ interface LocaleStrings {
|
|
|
28
28
|
settingsUnsaved: string;
|
|
29
29
|
}
|
|
30
30
|
interface ModuleOptions {
|
|
31
|
-
barPosition
|
|
32
|
-
colors
|
|
31
|
+
barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
|
|
32
|
+
colors: false | Record<string, any>;
|
|
33
33
|
cookieExpiryOffsetMs: number;
|
|
34
34
|
cookieNameCookiesEnabledIds: string;
|
|
35
35
|
cookieNameIsConsentGiven: string;
|
|
@@ -37,14 +37,14 @@ interface ModuleOptions {
|
|
|
37
37
|
necessary: Cookie[];
|
|
38
38
|
optional: Cookie[];
|
|
39
39
|
};
|
|
40
|
-
domain
|
|
41
|
-
isAcceptNecessaryButtonEnabled
|
|
42
|
-
isControlButtonEnabled
|
|
43
|
-
isCookieIdVisible
|
|
44
|
-
isCssEnabled
|
|
45
|
-
isCssPolyfillEnabled
|
|
46
|
-
isDashInDescriptionEnabled
|
|
47
|
-
isIframeBlocked
|
|
40
|
+
domain: string;
|
|
41
|
+
isAcceptNecessaryButtonEnabled: boolean;
|
|
42
|
+
isControlButtonEnabled: boolean;
|
|
43
|
+
isCookieIdVisible: boolean;
|
|
44
|
+
isCssEnabled: boolean;
|
|
45
|
+
isCssPolyfillEnabled: boolean;
|
|
46
|
+
isDashInDescriptionEnabled: boolean;
|
|
47
|
+
isIframeBlocked: boolean | {
|
|
48
48
|
initialState: boolean;
|
|
49
49
|
};
|
|
50
50
|
locales: Locale[];
|
package/dist/module.json
CHANGED
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.0.
|
|
5
|
+
const version = "4.0.1";
|
|
6
6
|
|
|
7
7
|
const en = {
|
|
8
8
|
accept: "Accept",
|
|
@@ -56,6 +56,7 @@ const DEFAULTS = {
|
|
|
56
56
|
optional: []
|
|
57
57
|
},
|
|
58
58
|
cookieExpiryOffsetMs: 1e3 * 60 * 60 * 24 * 365,
|
|
59
|
+
// one year
|
|
59
60
|
cookieNameIsConsentGiven: "cookie_control_is_consent_given",
|
|
60
61
|
cookieNameCookiesEnabledIds: "cookie_control_cookies_enabled_ids",
|
|
61
62
|
isAcceptNecessaryButtonEnabled: true,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<section class="cookieControl">
|
|
4
4
|
<transition :name="`cookieControl__Bar--${moduleOptions.barPosition}`">
|
|
5
5
|
<div
|
|
6
|
-
v-if="
|
|
6
|
+
v-if="isConsentGiven === undefined"
|
|
7
7
|
:class="`cookieControl__Bar cookieControl__Bar--${moduleOptions.barPosition}`"
|
|
8
8
|
>
|
|
9
9
|
<div class="cookieControl__BarContainer">
|
|
@@ -30,9 +30,7 @@
|
|
|
30
30
|
</transition>
|
|
31
31
|
<button
|
|
32
32
|
v-if="
|
|
33
|
-
moduleOptions.isControlButtonEnabled &&
|
|
34
|
-
isColorsSet &&
|
|
35
|
-
isConsentGiven !== undefined
|
|
33
|
+
moduleOptions.isControlButtonEnabled && isConsentGiven !== undefined
|
|
36
34
|
"
|
|
37
35
|
aria-label="Cookie control"
|
|
38
36
|
class="cookieControl__ControlButton"
|
|
@@ -92,7 +90,7 @@
|
|
|
92
90
|
:id="resolveTranslatable(cookie.name)"
|
|
93
91
|
type="checkbox"
|
|
94
92
|
:checked="
|
|
95
|
-
getCookieIds(localCookiesEnabled)
|
|
93
|
+
getCookieIds(localCookiesEnabled).includes(
|
|
96
94
|
getCookieId(cookie)
|
|
97
95
|
) ||
|
|
98
96
|
(getCookie(
|
|
@@ -201,7 +199,6 @@ const resolveTranslatable = useResolveTranslatable(props.locale)
|
|
|
201
199
|
|
|
202
200
|
// data
|
|
203
201
|
const expires = new Date()
|
|
204
|
-
const isColorsSet = ref(false)
|
|
205
202
|
const localCookiesEnabled = ref([...(cookiesEnabled.value || [])])
|
|
206
203
|
|
|
207
204
|
// computations
|
|
@@ -223,7 +220,7 @@ const accept = () => {
|
|
|
223
220
|
const decline = () => {
|
|
224
221
|
setCookies({
|
|
225
222
|
isConsentGiven: true,
|
|
226
|
-
cookiesOptionalEnabled: moduleOptions.cookies
|
|
223
|
+
cookiesOptionalEnabled: moduleOptions.cookies.necessary,
|
|
227
224
|
})
|
|
228
225
|
}
|
|
229
226
|
const acceptPartial = () => {
|
|
@@ -232,7 +229,7 @@ const acceptPartial = () => {
|
|
|
232
229
|
setCookies({
|
|
233
230
|
isConsentGiven: true,
|
|
234
231
|
cookiesOptionalEnabled: [
|
|
235
|
-
...moduleOptions.cookies
|
|
232
|
+
...moduleOptions.cookies.necessary,
|
|
236
233
|
...moduleOptions.cookies.optional,
|
|
237
234
|
].filter((cookie) => localCookiesEnabledIds.includes(getCookieId(cookie))),
|
|
238
235
|
})
|
|
@@ -280,7 +277,7 @@ const setCookies = ({
|
|
|
280
277
|
? [
|
|
281
278
|
...moduleOptions.cookies.necessary,
|
|
282
279
|
...moduleOptions.cookies.optional.filter((cookieOptional: Cookie) =>
|
|
283
|
-
cookiesOptionalEnabledNew
|
|
280
|
+
cookiesOptionalEnabledNew.includes(cookieOptional)
|
|
284
281
|
),
|
|
285
282
|
]
|
|
286
283
|
: []
|
|
@@ -310,8 +307,6 @@ onBeforeMount(async () => {
|
|
|
310
307
|
)
|
|
311
308
|
}
|
|
312
309
|
}
|
|
313
|
-
|
|
314
|
-
isColorsSet.value = true
|
|
315
310
|
}
|
|
316
311
|
|
|
317
312
|
if (getCookie(moduleOptions.cookieNameIsConsentGiven) === 'true') {
|
|
@@ -319,7 +314,7 @@ onBeforeMount(async () => {
|
|
|
319
314
|
if (
|
|
320
315
|
typeof moduleOptions.isIframeBlocked === 'boolean'
|
|
321
316
|
? moduleOptions.isIframeBlocked === true
|
|
322
|
-
: moduleOptions.isIframeBlocked
|
|
317
|
+
: moduleOptions.isIframeBlocked.initialState === true
|
|
323
318
|
) {
|
|
324
319
|
localCookiesEnabled.value.push(cookieOptional)
|
|
325
320
|
}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export interface LocaleStrings {
|
|
|
31
31
|
settingsUnsaved: string;
|
|
32
32
|
}
|
|
33
33
|
export interface ModuleOptions {
|
|
34
|
-
barPosition
|
|
35
|
-
colors
|
|
34
|
+
barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
|
|
35
|
+
colors: false | Record<string, any>;
|
|
36
36
|
cookieExpiryOffsetMs: number;
|
|
37
37
|
cookieNameCookiesEnabledIds: string;
|
|
38
38
|
cookieNameIsConsentGiven: string;
|
|
@@ -40,14 +40,14 @@ export interface ModuleOptions {
|
|
|
40
40
|
necessary: Cookie[];
|
|
41
41
|
optional: Cookie[];
|
|
42
42
|
};
|
|
43
|
-
domain
|
|
44
|
-
isAcceptNecessaryButtonEnabled
|
|
45
|
-
isControlButtonEnabled
|
|
46
|
-
isCookieIdVisible
|
|
47
|
-
isCssEnabled
|
|
48
|
-
isCssPolyfillEnabled
|
|
49
|
-
isDashInDescriptionEnabled
|
|
50
|
-
isIframeBlocked
|
|
43
|
+
domain: string;
|
|
44
|
+
isAcceptNecessaryButtonEnabled: boolean;
|
|
45
|
+
isControlButtonEnabled: boolean;
|
|
46
|
+
isCookieIdVisible: boolean;
|
|
47
|
+
isCssEnabled: boolean;
|
|
48
|
+
isCssPolyfillEnabled: boolean;
|
|
49
|
+
isDashInDescriptionEnabled: boolean;
|
|
50
|
+
isIframeBlocked: boolean | {
|
|
51
51
|
initialState: boolean;
|
|
52
52
|
};
|
|
53
53
|
locales: Locale[];
|
package/dist/runtime/types.mjs
CHANGED
|
@@ -38,6 +38,7 @@ export const DEFAULTS = {
|
|
|
38
38
|
optional: []
|
|
39
39
|
},
|
|
40
40
|
cookieExpiryOffsetMs: 1e3 * 60 * 60 * 24 * 365,
|
|
41
|
+
// one year
|
|
41
42
|
cookieNameIsConsentGiven: "cookie_control_is_consent_given",
|
|
42
43
|
cookieNameCookiesEnabledIds: "cookie_control_cookies_enabled_ids",
|
|
43
44
|
isAcceptNecessaryButtonEnabled: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dargmuesli/nuxt-cookie-control",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Nuxt Cookies Control Module",
|
|
5
5
|
"author": "Dario Ferderber <dario.ferderber@broj42.com>",
|
|
6
6
|
"maintainers": [
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"dev": "pnpm dev:prepare && nuxi dev playground",
|
|
34
34
|
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
|
|
35
35
|
"dev:build": "nuxi build playground",
|
|
36
|
-
"lint": "eslint --ext .js,.ts,.vue . && nuxi typecheck playground"
|
|
36
|
+
"lint": "pnpm prepack && eslint --ext .js,.ts,.vue . && nuxi typecheck playground"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nuxt/kit": "3.
|
|
39
|
+
"@nuxt/kit": "3.1.1",
|
|
40
40
|
"@sindresorhus/slugify": "2.1.1",
|
|
41
41
|
"css-vars-ponyfill": "2.4.8",
|
|
42
42
|
"js-cookie": "3.0.1",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"@nuxt/module-builder": "0.2.1",
|
|
47
47
|
"@nuxtjs/eslint-config-typescript": "12.0.0",
|
|
48
48
|
"@types/js-cookie": "3.0.2",
|
|
49
|
-
"eslint": "8.
|
|
49
|
+
"eslint": "8.33.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.0",
|
|
54
|
-
"nuxt": "3.
|
|
54
|
+
"nuxt": "3.1.1",
|
|
55
55
|
"prettier": "2.8.3",
|
|
56
56
|
"typescript": "4.9.4",
|
|
57
57
|
"vue": "3.2.45",
|