orestbida / cookieconsent

:cookie: Simple cross-browser cookie-consent plugin written in vanilla js

Home Page:https://playground.cookieconsent.orestbida.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Category with services - 'enabled' unexpected behaviour

frankykubo opened this issue · comments

Expected Behavior

When I do not consent right away but open the setting modal instead, by default the category and all the services under it should be enabled. Thats happening.

When I click Save preferences, then, in onConsent function parameter (cookie), I get services object where there are by-config-enabled services included.

Current Behavior

When I click Save preferences in Settings modal before first consent, then, in onConsent function parameter (cookie), I get services object where there are NOT by-config-enabled services included.

Also, CookieConsent.acceptedService('test', 'analytics') is false, which should be true.

Steps to reproduce

Reproduced here, by setting updating analytics category:

analytics: {
      services: {
        test: {
          label: 'Test',
        },
      },
      enabled: true,
    },
  1. Click Manage preferences in UI
  2. Click Save preferences in UI
  3. See console, where parameter of onConsent is logged
  4. Look for services object, where under analytics, test should be included, but it is not.

Proposed fix or additional info.

No response

Version

3.0.0

On which browser do you see the issue?

No response