From 534f66f1096b079c42343fb9a82d5c78ebe35f45 Mon Sep 17 00:00:00 2001 From: Samuel Dobbie Date: Wed, 1 Dec 2021 02:56:54 +0000 Subject: [PATCH] Handle consent case where GDPR doesn't apply --- modules/glimpseBidAdapter.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/glimpseBidAdapter.js b/modules/glimpseBidAdapter.js index 7bcf8cf3a7d..7ee3717a84b 100644 --- a/modules/glimpseBidAdapter.js +++ b/modules/glimpseBidAdapter.js @@ -142,11 +142,12 @@ function getGdprConsentChoice(bidderRequest) { if (hasGdprConsent) { const gdprConsent = bidderRequest.gdprConsent + const hasGdprApplies = hasBooleanValue(gdprConsent.gdprApplies) return { consentString: gdprConsent.consentString || '', vendorData: gdprConsent.vendorData || {}, - gdprApplies: gdprConsent.gdprApplies || true, + gdprApplies: hasGdprApplies ? gdprConsent.gdprApplies : true, } } @@ -182,6 +183,13 @@ function hasValue(value) { ) } +function hasBooleanValue(value) { + return ( + hasValue(value) && + typeof value === 'boolean' + ) +} + function hasStringValue(value) { return ( hasValue(value) &&