comand-component-library 4.1.2 → 4.1.3
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/comand-component-library.js +2185 -2165
- package/dist/comand-component-library.umd.cjs +25 -25
- package/package.json +1 -1
- package/src/components/CmdGoogleMaps.vue +7 -0
- package/src/index.js +1 -0
- package/src/utils/cookie.js +28 -0
package/package.json
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
// import mixins
|
20
20
|
import I18n from "../mixins/I18n"
|
21
21
|
import DefaultMessageProperties from "../mixins/CmdGoogleMaps/DefaultMessageProperties"
|
22
|
+
import {setCookieDisclaimerCookie, getCookieDisclaimerCookie} from "../utils/cookie"
|
22
23
|
|
23
24
|
export default {
|
24
25
|
name: "CmdGoogleMaps",
|
@@ -49,6 +50,11 @@ export default {
|
|
49
50
|
required: true
|
50
51
|
}
|
51
52
|
},
|
53
|
+
mounted() {
|
54
|
+
if(getCookieDisclaimerCookie().includes("google-maps")) {
|
55
|
+
this.cookiesAccepted = true
|
56
|
+
}
|
57
|
+
},
|
52
58
|
computed: {
|
53
59
|
locateAddress() {
|
54
60
|
if(this.address) {
|
@@ -62,6 +68,7 @@ export default {
|
|
62
68
|
},
|
63
69
|
methods: {
|
64
70
|
acceptCookies() {
|
71
|
+
setCookieDisclaimerCookie(["google-maps"])
|
65
72
|
this.cookiesAccepted = true
|
66
73
|
this.$emit("click", this.cookiesAccepted)
|
67
74
|
}
|
package/src/index.js
CHANGED
@@ -65,6 +65,7 @@ export { default as DirFancybox } from '@/directives/fancybox'
|
|
65
65
|
// export functions
|
66
66
|
export { createUuid, createHtmlId } from '@/utils/common'
|
67
67
|
export { getFileExtension } from '@/utils/getFileExtension'
|
68
|
+
export { setCookieDisclaimerCookie, getCookieDisclaimerCookie } from '@/utils/cookie'
|
68
69
|
|
69
70
|
// export composables
|
70
71
|
export { useSequence } from '@/composables/sequence'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
const cookieDisclaimerCookieName = "acceptedCookies"
|
2
|
+
|
3
|
+
function setCookieDisclaimerCookie(listOfAcceptedCookies, daysToExpire = 365) {
|
4
|
+
const cookie = [...getCookieDisclaimerCookie(), ...listOfAcceptedCookies].join(",")
|
5
|
+
let expires = ""
|
6
|
+
const date = new Date()
|
7
|
+
date.setTime(date.getTime() + daysToExpire * 24 * 60 * 60 * 1000)
|
8
|
+
expires = "; expires=" + date.toUTCString()
|
9
|
+
document.cookie = cookieDisclaimerCookieName + "=" + encodeURIComponent(cookie) + expires + "; SameSite=strict; path=/"
|
10
|
+
}
|
11
|
+
|
12
|
+
function getCookieDisclaimerCookie() {
|
13
|
+
const cookie = document.cookie.split(";").map((cookie)=> {
|
14
|
+
return cookie.trim()
|
15
|
+
}).find((cookie) => {
|
16
|
+
return cookie.startsWith(cookieDisclaimerCookieName + "=")
|
17
|
+
})
|
18
|
+
|
19
|
+
if(cookie) {
|
20
|
+
const indexOfEqualSign = cookie.indexOf("=")
|
21
|
+
return decodeURIComponent(cookie.slice(indexOfEqualSign + 1)).split(",")
|
22
|
+
}
|
23
|
+
|
24
|
+
return []
|
25
|
+
}
|
26
|
+
|
27
|
+
export {setCookieDisclaimerCookie, getCookieDisclaimerCookie}
|
28
|
+
|