@dargmuesli/nuxt-cookie-control 2.2.4 → 3.0.0-beta.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/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Nuxt Cookie Control
|
|
2
|
+
[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
|
|
2
6
|
|
|
3
7
|
Continuing Dario Ferderber's work on [gitlab.com/broj42/nuxt-cookie-control](https://gitlab.com/broj42/nuxt-cookie-control).
|
|
4
8
|
|
|
5
|
-

|
|
6
|
-
####
|
|
7
9
|
Try it out here:
|
|
8
10
|
[Nuxt.js Cookie Control](https://codesandbox.io/s/vkwqmm577)
|
|
9
11
|
|
|
@@ -13,8 +15,7 @@ npm i -D @dargmuesli/nuxt-cookie-control
|
|
|
13
15
|
yarn add -D @dargmuesli/nuxt-cookie-control
|
|
14
16
|
pnpm i -D @dargmuesli/nuxt-cookie-control
|
|
15
17
|
```
|
|
16
|
-
|
|
17
|
-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
18
|
+
|
|
18
19
|
|
|
19
20
|
```javascript
|
|
20
21
|
// nuxt.config.js
|
|
@@ -49,7 +50,7 @@ const {
|
|
|
49
50
|
} = useCookieControl()
|
|
50
51
|
</script>
|
|
51
52
|
```
|
|
52
|
-
##
|
|
53
|
+
## Component Slots
|
|
53
54
|
### Bar
|
|
54
55
|
```html
|
|
55
56
|
<CookieControl>
|
|
@@ -188,9 +189,9 @@ Every property the includes a `{ en: ... }` value is a translatable property tha
|
|
|
188
189
|
description: {
|
|
189
190
|
en: 'Used for cookie control.'
|
|
190
191
|
},
|
|
191
|
-
id: 'ga', // if unset, the slugified name
|
|
192
|
+
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
|
|
192
193
|
name: {
|
|
193
|
-
en: 'Google Analytics'
|
|
194
|
+
en: 'Google Analytics' // you always have to specify a cookie name (in English)
|
|
194
195
|
},
|
|
195
196
|
src: 'https://www.googletagmanager.com/gtag/js?id=<API-KEY>',
|
|
196
197
|
targetCookieIds: ['cookie_control_consent', 'cookie_control_enabled_cookies']
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -11,7 +11,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
|
11
11
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
12
12
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
13
13
|
const name = "@dargmuesli/nuxt-cookie-control";
|
|
14
|
-
const version = "
|
|
14
|
+
const version = "3.0.0-beta.1";
|
|
15
15
|
|
|
16
16
|
const en = {
|
|
17
17
|
acceptAll: "Accept all",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
<div class="cookieControl__BarButtons">
|
|
17
17
|
<button
|
|
18
|
-
@click="setConsent({
|
|
18
|
+
@click="setConsent({})"
|
|
19
19
|
v-text="localeStrings?.acceptAll"
|
|
20
20
|
/>
|
|
21
21
|
<button
|
|
@@ -190,12 +190,10 @@ const toogleCookie = (cookie: Cookie) => {
|
|
|
190
190
|
const setConsent = ({
|
|
191
191
|
type = undefined,
|
|
192
192
|
isConsentGiven = true,
|
|
193
|
-
reload = true,
|
|
194
193
|
declineAll = false,
|
|
195
194
|
}: {
|
|
196
195
|
type?: 'partial'
|
|
197
196
|
isConsentGiven?: boolean
|
|
198
|
-
reload?: boolean
|
|
199
197
|
declineAll?: boolean
|
|
200
198
|
}) => {
|
|
201
199
|
const cookieIds = declineAll
|
|
@@ -215,12 +213,8 @@ const setConsent = ({
|
|
|
215
213
|
expires: expirationDate,
|
|
216
214
|
})
|
|
217
215
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
} else {
|
|
221
|
-
setConsentFun()
|
|
222
|
-
isModalActive.value = false
|
|
223
|
-
}
|
|
216
|
+
setConsentFun()
|
|
217
|
+
isModalActive.value = false
|
|
224
218
|
}
|
|
225
219
|
const getDescription = (description: Translatable) =>
|
|
226
220
|
`${
|
package/dist/runtime/methods.mjs
CHANGED
|
@@ -18,7 +18,6 @@ export const acceptNecessary = (cookiesEnabledRef, cookiesNecessary = []) => {
|
|
|
18
18
|
expires
|
|
19
19
|
});
|
|
20
20
|
setHead(cookiesEnabledRef.value);
|
|
21
|
-
window.location.reload();
|
|
22
21
|
};
|
|
23
22
|
export const useResolveTranslatable = (locale = LOCALE_DEFAULT) => {
|
|
24
23
|
return (translatable) => resolveTranslatable(translatable, locale);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dargmuesli/nuxt-cookie-control",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
4
4
|
"description": "Nuxt Cookies Control Module",
|
|
5
5
|
"author": "Dario Ferderber <dario.ferderber@broj42.com>",
|
|
6
6
|
"maintainers": [
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"husky": "8.0.3",
|
|
53
53
|
"lint-staged": "13.1.0",
|
|
54
54
|
"nuxt": "3.0.0",
|
|
55
|
-
"prettier": "2.8.
|
|
55
|
+
"prettier": "2.8.2",
|
|
56
56
|
"typescript": "4.9.4",
|
|
57
57
|
"vue": "3.2.45",
|
|
58
|
-
"vue-tsc": "1.0.
|
|
58
|
+
"vue-tsc": "1.0.24",
|
|
59
59
|
"webpack": "5.75.0"
|
|
60
60
|
},
|
|
61
61
|
"resolutions": {
|