orestbida / cookieconsent

:cookie: Simple cross-browser cookie-consent plugin written in vanilla js
https://playground.cookieconsent.orestbida.com/
MIT License
4.06k stars 416 forks source link

Fix service reject issue & setCookieData() method deletes lastConsentTimestamp field #701

Closed peaemaye closed 4 months ago

peaemaye commented 4 months ago

Fixes #700

The retrieveState method of api.js currently sets the _enabledServices before _acceptedServices so the enabled services don't include services read from the cc-cookie. I think reversing this order is sufficient to fix it.

Fixes #702

The setCookieData() method can accidentally delete the lastConsentTimestamp field from the cc-cookie.

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **cookieconsent-docs** | ⬜️ Ignored ([Inspect](https://vercel.com/orest-bidas-projects/cookieconsent-docs/CL6XshvL5TZmAc9FrQ7BqR34BUGU)) | [Visit Preview](https://cookieconsent-docs-git-fork-peaemay-a9fcdf-orest-bidas-projects.vercel.app) | | Jun 27, 2024 11:39am |
netlify[bot] commented 4 months ago

Deploy Preview for cookieconsentv3-playground canceled.

Name Link
Latest commit 8785e5050611fb8e6f2c9abb17f40ee2c3af119b
Latest deploy log https://app.netlify.com/sites/cookieconsentv3-playground/deploys/667d4f6d765e06000835d070
peaemaye commented 4 months ago

I think this also fixes #696 which is the same as #700

danielpaul commented 4 months ago

Came across the same issue of lastConsentTimestamp not being set (basically was getting deleted) and spent a lot of time debugging 🙈

orestbida commented 4 months ago

Thanks for your contribution!