@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.
@@ -42,7 +42,7 @@ const mergedConfig = computed(() => deepMerge(DEFAULT_CONFIG, props.config))
42
42
  const {
43
43
  core,
44
44
  consent,
45
- categories: coreCategories,
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
- categories.value[categoryId] = !categories.value[categoryId]
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)) {