[Bug]: Callbacks are not triggered in individually togglable services.
handplant opened this issue · comments
Expected Behavior
The onAccept callbacks should be triggered for all services, including Personio, when the user accepts the corresponding category/service.
Current Behavior
The onAccept callbacks are triggered for YouTube and Vimeo services, but not for the Personio service.
Steps to reproduce
Set up a web application with my categories/services functionality.
Here are my categories/services.
categories: {
necessary: {
readOnly: true,
enabled: true,
},
videos: {
services: {
youtube: {
label: 'Youtube Embed',
onAccept: () => {
console.log('accept youtube');
}
},
vimeo: {
label: 'Vimeo Embed',
onAccept: () => {
console.log('accept vimeo');
}
},
},
},
personio: {
label: 'Personio',
onAccept: () => {
console.log('accept personio');
}
}
},
Proposed fix or additional info.
No response
Version
3.0.0
On which browser do you see the issue?
Chrome
You have declared personio outside services, as a category: [necessary, videos, personio]
Okay, I'm now solving it through the CookieConsent onChange callback!
onChange: ({ cookie, changedCategories, changedServices }) => {
if (cookie.categories.includes('personio')) {
im.acceptService('personio');
} else {
im.rejectService('personio')
}
},
Thank you very much for this first-class consent management tool!