Skip to content

Commit

Permalink
Add warning if eu consent type mapping doesnt match a cookie type
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbp committed Sep 26, 2024
1 parent da099a4 commit a4ae05b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/cookie-banner/src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ export const setGoogleConsent = (Store, pushType = 'update') => () => {
if (!euConsentTypes) return;

const euConsent = Object.keys(euConsentTypes).reduce((acc, type) => {
if (Object.keys(consent).length > 0 && consent[euConsentTypes[type]] === undefined) {
console.warn(`Cannot find consent type '${euConsentTypes[type]}' in preferences cookie, check your euConsentTypes configuration matches your cookie types`);
}
acc[type] = (consent[euConsentTypes[type]] && pushType === 'update') ? 'granted' : 'denied';
return acc;
}, {});
Expand Down

0 comments on commit a4ae05b

Please sign in to comment.