@el7ven/cookie-kit 0.3.3 → 0.3.4
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/core/index.js +4 -3
package/package.json
CHANGED
package/src/core/index.js
CHANGED
|
@@ -226,7 +226,8 @@ export class CookieKitCore {
|
|
|
226
226
|
Object.keys(this.config.categories).forEach(id => {
|
|
227
227
|
const category = this.config.categories[id]
|
|
228
228
|
if (category?.enabled === true) {
|
|
229
|
-
|
|
229
|
+
// For enabled categories, set to required status OR false if not required
|
|
230
|
+
next[id] = category.required === true
|
|
230
231
|
}
|
|
231
232
|
})
|
|
232
233
|
return next
|
|
@@ -239,7 +240,7 @@ export class CookieKitCore {
|
|
|
239
240
|
const normalized = this.getDefaultCategoriesState()
|
|
240
241
|
Object.keys(categories || {}).forEach(id => {
|
|
241
242
|
if (Object.prototype.hasOwnProperty.call(normalized, id)) {
|
|
242
|
-
normalized[id] = !!categories[id] ||
|
|
243
|
+
normalized[id] = !!categories[id] || this.config.categories[id]?.required === true
|
|
243
244
|
}
|
|
244
245
|
})
|
|
245
246
|
|
|
@@ -294,7 +295,7 @@ export class CookieKitCore {
|
|
|
294
295
|
Object.keys(this.config.categories).forEach(id => {
|
|
295
296
|
const category = this.config.categories[id]
|
|
296
297
|
if (category?.enabled === true) {
|
|
297
|
-
categories[id] = selectedSet.has(id) ||
|
|
298
|
+
categories[id] = selectedSet.has(id) || category.required === true
|
|
298
299
|
}
|
|
299
300
|
})
|
|
300
301
|
return this.saveConsent(categories, source)
|