From 18e16af44af897477c3ea0d537fed4a1fbcd1a3e Mon Sep 17 00:00:00 2001 From: tg666 Date: Wed, 9 Feb 2022 04:05:42 +0100 Subject: [PATCH] Fix: The data attribute `last_action_date` is automatically added into the `cc-settings` cookie for users that accepts/rejects consent before the plugin update --- CHANGELOG.md | 9 ++++++++- package-lock.json | 4 ++-- package.json | 2 +- src/ConsentManager.js | 9 ++------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 808d2d4..48312c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.7] - 2021-02-09 + +### Fixed + +- The data attribute `last_action_date` is automatically added into the `cc-settings` cookie for users that accepts/rejects consent before the plugin update. + ## [0.3.6] - 2021-02-07 ### Added @@ -197,7 +203,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The first version of the package has been released. -[unreleased]: https://github.com/68publishers/cookie-consent/compare/v0.3.6...main +[unreleased]: https://github.com/68publishers/cookie-consent/compare/v0.3.7...main +[0.3.7]: https://github.com/68publishers/cookie-consent/compare/v0.3.6...v0.3.7 [0.3.6]: https://github.com/68publishers/cookie-consent/compare/v0.3.5...v0.3.6 [0.3.5]: https://github.com/68publishers/cookie-consent/compare/v0.3.4...v0.3.5 [0.3.4]: https://github.com/68publishers/cookie-consent/compare/v0.3.3...v0.3.4 diff --git a/package-lock.json b/package-lock.json index 9dd1bb4..9250753 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "68publishers-cookie-consent", - "version": "0.3.6", + "version": "0.3.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "68publishers-cookie-consent", - "version": "0.3.6", + "version": "0.3.7", "license": "MIT", "dependencies": { "vanilla-cookieconsent": "^2.7.1" diff --git a/package.json b/package.json index 88a62cb..384e8f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "68publishers-cookie-consent", - "version": "0.3.6", + "version": "0.3.7", "description": "Cookie consent wrapper based on orestbida/cookieconsent with GTM integration.", "homepage": "http://www.68publishers.io/", "main": "index.js", diff --git a/src/ConsentManager.js b/src/ConsentManager.js index 27ecd2e..c851136 100644 --- a/src/ConsentManager.js +++ b/src/ConsentManager.js @@ -139,14 +139,9 @@ class ConsentManager { _showModalAgainIfAnyStorageIsExpired() { let lastActionDate = this._cookieConsent.get('data').last_action_date; + lastActionDate = lastActionDate ? new Date(lastActionDate) : undefined; - if (!lastActionDate) { - return; - } - - lastActionDate = new Date(lastActionDate); - - if ('Invalid Date' === lastActionDate || isNaN(lastActionDate)) { + if (!lastActionDate || 'Invalid Date' === lastActionDate || isNaN(lastActionDate)) { this._updateLastActionDate(); return;