react-cookie-kit
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -44,2 +44,6 @@ function _typeof(obj) { 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); } | ||
if (event.origin === xbOrigin) { | ||
if (!event.data) { | ||
return; | ||
} | ||
var data = JSON.parse(event.data); | ||
@@ -46,0 +50,0 @@ var action = Object.keys(data)[0]; |
@@ -167,3 +167,5 @@ function _typeof(obj) { 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); } | ||
_this.startPulsing(); | ||
if (props.isAnimated) { | ||
_this.startPulsing(); | ||
} | ||
@@ -253,3 +255,3 @@ if (!isOpen) { | ||
value: function stopPulsing() { | ||
// console.log("CookieKit#startPulsing"); | ||
// console.log("CookieKit#stopPulsing"); | ||
this.setState({ | ||
@@ -290,5 +292,7 @@ pulsing: false | ||
cookieConsents = _this$props4.cookieConsents, | ||
display = _this$props4.display, | ||
displayFingerprint = _this$props4.displayFingerprint, | ||
fingerprintConsent = _this$props4.fingerprintConsent, | ||
hideBrandTag = _this$props4.hideBrandTag, | ||
isAnimated = _this$props4.isAnimated, | ||
loginStatus = _this$props4.loginStatus, | ||
@@ -309,6 +313,7 @@ position = _this$props4.position, | ||
transparent = _this$state.transparent; | ||
var animation = animated ? animations[consentsSource] : animations.unknown; | ||
var animation = animated && isAnimated ? animations[consentsSource] : animations.unknown; | ||
var renderPopup = isOpen || consentsSource === "unknown" && !hasClosed; | ||
var renderButton = !renderPopup; | ||
var renderResetButton = theme === "popup" && testMode && cookieConsentsCache.get(); | ||
var cache = cookieConsentsCache.get(); | ||
var renderResetButton = theme === "popup" && testMode && cache.cookieConsents; | ||
return isShown && React.createElement("div", { | ||
@@ -319,2 +324,4 @@ className: cx(BLOCK, position, { | ||
scroll: isOpen | ||
}, { | ||
"d-none": !display | ||
}) | ||
@@ -356,2 +363,3 @@ }, renderPopup && React.createElement(CookieKitPopup, { | ||
cookieConsents: PropTypes.arrayOf(CookieConsentShape.isRequired).isRequired, | ||
display: PropTypes.bool, | ||
displayFingerprint: PropTypes.bool, | ||
@@ -362,2 +370,3 @@ expirationTime: PropTypes.number, | ||
hideOnComplete: PropTypes.bool.isRequired, | ||
isAnimated: PropTypes.bool, | ||
loginStatus: PropTypes.bool, | ||
@@ -383,5 +392,7 @@ onConsentStatusChange: PropTypes.func.isRequired, | ||
companyLogo: null, | ||
display: true, | ||
displayFingerprint: false, | ||
expirationTime: 0, | ||
fingerprintConsent: false, | ||
isAnimated: true, | ||
loginStatus: false, | ||
@@ -388,0 +399,0 @@ testMode: false, |
@@ -242,3 +242,5 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
defaultCountryCode: countryCodes.includes(props.defaultCountryCode) ? props.defaultCountryCode : DEFAULT_COUNTRY_CODE, | ||
display: true, | ||
initializing: true, | ||
isAnimated: true, | ||
isConsentCached: false, | ||
@@ -264,7 +266,17 @@ isLoginStatusChecked: false, | ||
// console.log("CookieKitContainer#getCookieConsents"); | ||
var cachedCookieConsents = cookieConsentsCache.get(); | ||
var suspendAnimationTime = this.props.suspendAnimationTime; | ||
if (cachedCookieConsents) { | ||
var _cookieConsentsCache$ = cookieConsentsCache.get(), | ||
cookieConsents = _cookieConsentsCache$.cookieConsents, | ||
lastUpdated = _cookieConsentsCache$.lastUpdated; | ||
if (lastUpdated && !!suspendAnimationTime && Date.now() - lastUpdated < suspendAnimationTime * 1000) { | ||
this.setState({ | ||
isAnimated: false | ||
}); | ||
} | ||
if (cookieConsents) { | ||
// console.log("Using cached cookie consents!"); | ||
this.setCookieConsents("cached", cachedCookieConsents); | ||
this.setCookieConsents("cached", cookieConsents); | ||
this.setState({ | ||
@@ -438,2 +450,9 @@ isConsentCached: true | ||
}, { | ||
key: "display", | ||
value: function display(value) { | ||
this.setState({ | ||
display: value | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
@@ -463,3 +482,5 @@ value: function render() { | ||
countryCode = _this$state6.countryCode, | ||
display = _this$state6.display, | ||
initializing = _this$state6.initializing, | ||
isAnimated = _this$state6.isAnimated, | ||
loginStatus = _this$state6.loginStatus; | ||
@@ -483,2 +504,3 @@ var defaultPositionIndex = theme === "overlay" ? 4 : 0; | ||
countryCode: countryCode, | ||
display: display, | ||
displayFingerprint: displayFingerprint, | ||
@@ -489,2 +511,3 @@ expirationTime: expirationTime, | ||
hideOnComplete: hideOnComplete, | ||
isAnimated: isAnimated, | ||
loginStatus: loginStatus, | ||
@@ -531,2 +554,3 @@ onConsentStatusChange: this.handleConsentStatusChange, | ||
requestDataTypes: PropTypes.arrayOf(PropTypes.oneOf(cookieTypes).isRequired), | ||
suspendAnimationTime: PropTypes.number, | ||
targetUrl: PropTypes.string, | ||
@@ -559,2 +583,3 @@ termsUrl: PropTypes.string.isRequired, | ||
requestDataTypes: ["application"], | ||
suspendAnimationTime: 600, | ||
targetUrl: null, | ||
@@ -561,0 +586,0 @@ testMode: false, |
{ | ||
"name": "react-cookie-kit", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"description": "GDPR / CCPA Easy Cookie and Fingerprint Consent Management for Websites.", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"react-country-flag": "^1.0.1", | ||
"xcoobee-cookie-kit-core": "^1.0.15" | ||
"xcoobee-cookie-kit-core": "^1.0.16" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
@@ -30,2 +30,6 @@ import React from "react"; | ||
if (event.origin === xbOrigin) { | ||
if (!event.data) { | ||
return; | ||
} | ||
const data = JSON.parse(event.data); | ||
@@ -32,0 +36,0 @@ const action = Object.keys(data)[0]; |
@@ -50,2 +50,3 @@ import cx from "classnames"; | ||
cookieConsents: PropTypes.arrayOf(CookieConsentShape.isRequired).isRequired, | ||
display: PropTypes.bool, | ||
displayFingerprint: PropTypes.bool, | ||
@@ -56,2 +57,3 @@ expirationTime: PropTypes.number, | ||
hideOnComplete: PropTypes.bool.isRequired, | ||
isAnimated: PropTypes.bool, | ||
loginStatus: PropTypes.bool, | ||
@@ -82,5 +84,7 @@ onConsentStatusChange: PropTypes.func.isRequired, | ||
companyLogo: null, | ||
display: true, | ||
displayFingerprint: false, | ||
expirationTime: 0, | ||
fingerprintConsent: false, | ||
isAnimated: true, | ||
loginStatus: false, | ||
@@ -107,3 +111,6 @@ testMode: false, | ||
this.startPulsing(); | ||
if (props.isAnimated) { | ||
this.startPulsing(); | ||
} | ||
if (!isOpen) { | ||
@@ -238,3 +245,3 @@ this.startDismissTimer(); | ||
stopPulsing() { | ||
// console.log("CookieKit#startPulsing"); | ||
// console.log("CookieKit#stopPulsing"); | ||
this.setState({ pulsing: false }); | ||
@@ -265,5 +272,7 @@ } | ||
cookieConsents, | ||
display, | ||
displayFingerprint, | ||
fingerprintConsent, | ||
hideBrandTag, | ||
isAnimated, | ||
loginStatus, | ||
@@ -280,3 +289,3 @@ position, | ||
const animation = animated ? animations[consentsSource] : animations.unknown; | ||
const animation = animated && isAnimated ? animations[consentsSource] : animations.unknown; | ||
@@ -286,3 +295,4 @@ const renderPopup = isOpen || (consentsSource === "unknown" && !hasClosed); | ||
const renderResetButton = theme === "popup" && testMode && cookieConsentsCache.get(); | ||
const cache = cookieConsentsCache.get(); | ||
const renderResetButton = theme === "popup" && testMode && cache.cookieConsents; | ||
@@ -302,2 +312,5 @@ return ( | ||
}, | ||
{ | ||
"d-none": !display, | ||
}, | ||
) | ||
@@ -304,0 +317,0 @@ } |
@@ -117,2 +117,3 @@ import PropTypes from "prop-types"; | ||
), | ||
suspendAnimationTime: PropTypes.number, | ||
targetUrl: PropTypes.string, | ||
@@ -148,2 +149,3 @@ termsUrl: PropTypes.string.isRequired, | ||
requestDataTypes: ["application"], | ||
suspendAnimationTime: 600, | ||
targetUrl: null, | ||
@@ -165,3 +167,5 @@ testMode: false, | ||
defaultCountryCode: countryCodes.includes(props.defaultCountryCode) ? props.defaultCountryCode : DEFAULT_COUNTRY_CODE, | ||
display: true, | ||
initializing: true, | ||
isAnimated: true, | ||
isConsentCached: false, | ||
@@ -199,7 +203,12 @@ isLoginStatusChecked: false, | ||
// console.log("CookieKitContainer#getCookieConsents"); | ||
const cachedCookieConsents = cookieConsentsCache.get(); | ||
const { suspendAnimationTime } = this.props; | ||
const { cookieConsents, lastUpdated } = cookieConsentsCache.get(); | ||
if (cachedCookieConsents) { | ||
if (lastUpdated && !!suspendAnimationTime && (Date.now() - lastUpdated) < suspendAnimationTime * 1000) { | ||
this.setState({ isAnimated: false }); | ||
} | ||
if (cookieConsents) { | ||
// console.log("Using cached cookie consents!"); | ||
this.setCookieConsents("cached", cachedCookieConsents); | ||
this.setCookieConsents("cached", cookieConsents); | ||
this.setState({ isConsentCached: true }); | ||
@@ -425,2 +434,6 @@ | ||
display(value) { | ||
this.setState({ display: value }); | ||
} | ||
render() { | ||
@@ -449,3 +462,5 @@ // console.log("CookieKitContainer#render"); | ||
countryCode, | ||
display, | ||
initializing, | ||
isAnimated, | ||
loginStatus, | ||
@@ -475,2 +490,3 @@ } = this.state; | ||
countryCode={countryCode} | ||
display={display} | ||
displayFingerprint={displayFingerprint} | ||
@@ -481,2 +497,3 @@ expirationTime={expirationTime} | ||
hideOnComplete={hideOnComplete} | ||
isAnimated={isAnimated} | ||
loginStatus={loginStatus} | ||
@@ -483,0 +500,0 @@ onConsentStatusChange={this.handleConsentStatusChange} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
374233
4141