From a4ae05b42efe35f27bb0203aafcff7e324108456 Mon Sep 17 00:00:00 2001 From: Mick Perkins Date: Thu, 26 Sep 2024 16:47:02 +0100 Subject: [PATCH] Add warning if eu consent type mapping doesnt match a cookie type --- packages/cookie-banner/src/lib/utils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/cookie-banner/src/lib/utils.js b/packages/cookie-banner/src/lib/utils.js index 8b8c92a..9cc2075 100755 --- a/packages/cookie-banner/src/lib/utils.js +++ b/packages/cookie-banner/src/lib/utils.js @@ -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; }, {});