react-cookie-kit
Advanced tools
Comparing version 1.0.23 to 1.0.24
@@ -404,2 +404,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var _this$props2 = this.props, | ||
checkByDefaultTypes = _this$props2.checkByDefaultTypes, | ||
displayOnlyForEU = _this$props2.displayOnlyForEU, | ||
@@ -413,27 +414,34 @@ requestDataTypes = _this$props2.requestDataTypes; | ||
return; | ||
} | ||
var hostsDefaultCookieConsents = cookieTypes.map(function (type) { | ||
return { | ||
type: type, | ||
checked: requestDataTypes.includes(type) | ||
}; | ||
}); | ||
hostsDefaultCookieConsents.push({ | ||
type: "donotsell", | ||
checked: false | ||
}); | ||
hostsDefaultCookieConsents.push({ | ||
type: "fingerprint", | ||
checked: false | ||
}); // If we were unable to resolve the user's country code, then assume it is in | ||
} // If we were unable to resolve the user's country code, then assume it is in | ||
// the EU. | ||
var cCode = countryCode || euCountries[0]; | ||
if (displayOnlyForEU && !euCountries.includes(cCode)) { | ||
var hostsDefaultCookieConsents = checkByDefaultTypes.map(function (type) { | ||
return { | ||
type: type, | ||
checked: requestDataTypes.includes(type) | ||
}; | ||
}); | ||
hostsDefaultCookieConsents.push({ | ||
type: "donotsell", | ||
checked: false | ||
}); | ||
hostsDefaultCookieConsents.push({ | ||
type: "fingerprint", | ||
checked: false | ||
}); | ||
this.setCookieConsents("hostsDefaults", hostsDefaultCookieConsents); | ||
} else { | ||
var consentsSource = "unknown"; | ||
var cookieConsents = hostsDefaultCookieConsents; | ||
var consentsSource = "unknown"; // Note: We can always set "application" to checked even if it is not in | ||
// requestDataTypes because CookieKitPopup will filter everything based on | ||
// requestDataTypes. Alternatively, we can pre-filter here too. We opted for the | ||
// former. | ||
var cookieConsents = [{ | ||
type: "application", | ||
checked: true | ||
}]; | ||
this.setState({ | ||
@@ -440,0 +448,0 @@ consentsSource: consentsSource, |
@@ -206,2 +206,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
_consentSettings[cookieConsent.type] = cookieConsent.checked; | ||
}); // Ensure all requested data types are in consent settings. Otherwise logic using | ||
// state.consentSettings doesn't work correctly. | ||
requestDataTypes.forEach(function (dataType) { | ||
if (!(dataType in _consentSettings)) { | ||
_consentSettings[dataType] = false; | ||
} | ||
}); | ||
@@ -208,0 +215,0 @@ _this.state = { |
{ | ||
"name": "react-cookie-kit", | ||
"version": "1.0.23", | ||
"version": "1.0.24", | ||
"description": "GDPR / CCPA Easy Cookie, Script, Do-Not-Sell, and Fingerprint Consent Management for Websites.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -392,2 +392,3 @@ import fetch from "isomorphic-fetch"; | ||
const { | ||
checkByDefaultTypes, | ||
displayOnlyForEU, | ||
@@ -402,8 +403,2 @@ requestDataTypes, | ||
const hostsDefaultCookieConsents = cookieTypes.map(type => ({ | ||
type, | ||
checked: requestDataTypes.includes(type), | ||
})); | ||
hostsDefaultCookieConsents.push({ type: "donotsell", checked: false }); | ||
hostsDefaultCookieConsents.push({ type: "fingerprint", checked: false }); | ||
// If we were unable to resolve the user's country code, then assume it is in | ||
@@ -413,6 +408,16 @@ // the EU. | ||
if (displayOnlyForEU && !euCountries.includes(cCode)) { | ||
const hostsDefaultCookieConsents = checkByDefaultTypes.map(type => ({ | ||
type, | ||
checked: requestDataTypes.includes(type), | ||
})); | ||
hostsDefaultCookieConsents.push({ type: "donotsell", checked: false }); | ||
hostsDefaultCookieConsents.push({ type: "fingerprint", checked: false }); | ||
this.setCookieConsents("hostsDefaults", hostsDefaultCookieConsents); | ||
} else { | ||
const consentsSource = "unknown"; | ||
const cookieConsents = hostsDefaultCookieConsents; | ||
// Note: We can always set "application" to checked even if it is not in | ||
// requestDataTypes because CookieKitPopup will filter everything based on | ||
// requestDataTypes. Alternatively, we can pre-filter here too. We opted for the | ||
// former. | ||
const cookieConsents = [{ type: "application", checked: true }]; | ||
this.setState({ consentsSource, cookieConsents, initializing: false }); | ||
@@ -419,0 +424,0 @@ } |
@@ -80,2 +80,10 @@ import React from "react"; | ||
// Ensure all requested data types are in consent settings. Otherwise logic using | ||
// state.consentSettings doesn't work correctly. | ||
requestDataTypes.forEach((dataType) => { | ||
if (!(dataType in consentSettings)) { | ||
consentSettings[dataType] = false; | ||
} | ||
}); | ||
this.state = { | ||
@@ -82,0 +90,0 @@ consentSettings, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
386289
4486