@el7ven/cookie-kit 0.2.18 → 0.2.19
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/package.json +1 -1
- package/src/vue/CookieConsent.vue +14 -25
package/package.json
CHANGED
|
@@ -24,42 +24,33 @@
|
|
|
24
24
|
|
|
25
25
|
<script setup>
|
|
26
26
|
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
|
27
|
-
import {
|
|
27
|
+
import { useCookieKitVue, DEFAULT_CONFIG } from './index.js'
|
|
28
28
|
import CookieDrawer from './CookieDrawer.vue'
|
|
29
29
|
|
|
30
30
|
// Props for customization
|
|
31
31
|
const props = defineProps({
|
|
32
32
|
config: {
|
|
33
33
|
type: Object,
|
|
34
|
-
default: () =>
|
|
35
|
-
categories: {
|
|
36
|
-
necessary: { required: true, enabled: true, name: 'Essential Cookies' },
|
|
37
|
-
analytics: { required: false, enabled: true, name: 'Analytics Cookies' },
|
|
38
|
-
marketing: { required: false, enabled: false, name: 'Marketing Cookies' }
|
|
39
|
-
},
|
|
40
|
-
consentExpireDays: 365,
|
|
41
|
-
version: '0.2.0',
|
|
42
|
-
theme: 'light'
|
|
43
|
-
})
|
|
34
|
+
default: () => DEFAULT_CONFIG
|
|
44
35
|
}
|
|
45
36
|
})
|
|
46
37
|
|
|
47
|
-
// Use the
|
|
38
|
+
// Use the Vue composable
|
|
48
39
|
const {
|
|
49
40
|
consent,
|
|
50
41
|
acceptAll,
|
|
51
42
|
rejectAll,
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
acceptSelected,
|
|
44
|
+
hasConsented,
|
|
54
45
|
hasCategoryConsent
|
|
55
|
-
} =
|
|
46
|
+
} = useCookieKitVue(props.config)
|
|
56
47
|
|
|
57
48
|
// Local state
|
|
58
|
-
const isVisible = computed(() => !
|
|
49
|
+
const isVisible = computed(() => !hasConsented.value)
|
|
59
50
|
const isSettingsMode = ref(false)
|
|
60
51
|
const currentTab = ref('privacy')
|
|
61
|
-
const categories =
|
|
62
|
-
const consentVersion = computed(() => props.config.version || '0.
|
|
52
|
+
const categories = computed(() => consent.value?.categories || props.config.categories)
|
|
53
|
+
const consentVersion = computed(() => props.config.version || '1.0.0')
|
|
63
54
|
const capabilities = computed(() => ({}))
|
|
64
55
|
const isV2 = computed(() => true)
|
|
65
56
|
const theme = computed(() => props.config.theme || 'light')
|
|
@@ -89,13 +80,11 @@ const closeSettings = () => {
|
|
|
89
80
|
}
|
|
90
81
|
|
|
91
82
|
const acceptSelection = () => {
|
|
92
|
-
//
|
|
93
|
-
Object.keys(categories.value)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
})
|
|
83
|
+
// Get selected category IDs
|
|
84
|
+
const selectedIds = Object.keys(categories.value)
|
|
85
|
+
.filter(id => categories.value[id]?.enabled)
|
|
86
|
+
|
|
87
|
+
acceptSelected(selectedIds)
|
|
99
88
|
}
|
|
100
89
|
|
|
101
90
|
const selectTab = (tabId) => {
|