@el7ven/cookie-kit 0.3.1 → 0.3.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/package.json +21 -1
- package/src/core/AnalyticsManager.js +400 -0
- package/src/core/ConsentManager.js +710 -0
- package/src/core/ConsentMode.js +109 -0
- package/src/core/FocusTrap.js +130 -0
- package/src/core/GeoDetector.js +144 -0
- package/src/core/ScriptLoader.js +229 -0
- package/src/core/StorageAdapter.js +179 -0
- package/src/core/index.js +4 -4
- package/src/geo/GeoDetector.js +536 -0
- package/src/geo/RegionRules.js +126 -0
- package/src/geo/index.js +16 -0
- package/src/index.js +55 -17
- package/src/locales/en.js +54 -0
- package/src/locales/index.js +20 -0
- package/src/locales/ro.js +54 -0
- package/src/plugins/CMPPlugin.js +187 -0
- package/src/plugins/PluginManager.js +234 -0
- package/src/plugins/index.js +7 -0
- package/src/providers/GoogleConsentModeProvider.js +278 -0
- package/src/providers/index.js +6 -0
- package/src/rewriting/ScriptRewriter.js +278 -0
- package/src/rewriting/index.js +6 -0
- package/src/scripts/ScriptLoader.js +310 -0
- package/src/scripts/ScriptManager.js +278 -0
- package/src/scripts/ScriptRegistry.js +175 -0
- package/src/scripts/ScriptScanner.js +178 -0
- package/src/scripts/index.js +9 -0
- package/src/trackers/TrackerDetector.js +488 -0
- package/src/trackers/TrackerPatterns.js +307 -0
- package/src/trackers/TrackerRegistry.js +172 -0
- package/src/trackers/index.js +15 -0
- package/src/utils/cookies.js +37 -0
- package/src/utils/dom.js +58 -0
- package/src/utils/helpers.js +89 -0
- package/src/vue/CookieConsent.vue +4 -12
|
@@ -42,7 +42,7 @@ const mergedConfig = computed(() => deepMerge(DEFAULT_CONFIG, props.config))
|
|
|
42
42
|
const {
|
|
43
43
|
core,
|
|
44
44
|
consent,
|
|
45
|
-
categories
|
|
45
|
+
categories,
|
|
46
46
|
acceptAll,
|
|
47
47
|
rejectAll,
|
|
48
48
|
acceptSelected,
|
|
@@ -57,9 +57,6 @@ const isSettingsMode = ref(false)
|
|
|
57
57
|
const currentTab = ref('privacy')
|
|
58
58
|
const drawerRef = ref(null)
|
|
59
59
|
|
|
60
|
-
// Category state (reactive, for toggles)
|
|
61
|
-
const categories = ref(buildCategoryState(mergedConfig.value.categories))
|
|
62
|
-
|
|
63
60
|
// Computed
|
|
64
61
|
const consentVersion = computed(() => mergedConfig.value.version || 'v2')
|
|
65
62
|
const capabilities = computed(() => mergedConfig.value.capabilities || {})
|
|
@@ -207,7 +204,9 @@ const handleSelectTab = (tabId) => {
|
|
|
207
204
|
const handleToggleCategory = (categoryId) => {
|
|
208
205
|
const cat = mergedConfig.value.categories[categoryId]
|
|
209
206
|
if (cat && !cat.disabled && !cat.required) {
|
|
210
|
-
|
|
207
|
+
// Toggle the category state
|
|
208
|
+
const current = categories.value[categoryId]
|
|
209
|
+
categories.value[categoryId] = !current
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
212
|
|
|
@@ -245,13 +244,6 @@ defineExpose({
|
|
|
245
244
|
})
|
|
246
245
|
|
|
247
246
|
// Helpers
|
|
248
|
-
function buildCategoryState(cats) {
|
|
249
|
-
if (!cats) return {}
|
|
250
|
-
return Object.fromEntries(
|
|
251
|
-
Object.keys(cats).map(id => [id, !!cats[id].enabled])
|
|
252
|
-
)
|
|
253
|
-
}
|
|
254
|
-
|
|
255
247
|
function deepMerge(target, source) {
|
|
256
248
|
const result = { ...target }
|
|
257
249
|
for (const key of Object.keys(source)) {
|