Coder Social home page Coder Social logo

Comments (2)

StevenChoo avatar StevenChoo commented on June 10, 2024

@rockxwre
With the 0.7.0 version the current ConsentCookie.get is set deprecated.
Instead 2 API functions are added:

  • ConsentCookie.getConsent
  • ConsentCookie.getConsents

ConsentCookie.getConsent works as the the deprecated ConsentCookie.get with some minor changes

  • When calling the function and instance of Consent is always returned. The instance has the following getters for easy checking which flag is set:
isAccepted() // If the user has accepted the consent
isAlwaysOn() // If the consent is always on (and cannot be changed by the user)
isEnabled() // If the consent is accepted by the user or is always on
isRejected() // If the consent has not been accepted by the user
  • When calling the function with an id, a instance of Consent is always given. If no consent with the given id exist, a consent with the flag:null is returned. The getters will all return false when called because no state was set.
  • When calling the function without an id all configured consents are returned as an Array

ConsentCookie.getConsents is new and is based on calling the deprecated ConsentCookie.get without an id arguement.

  • The consents are now a private variable. The return of the ConsentCookie.consent will give the Consents instance with the following getters:
get($id) // Works the same as calling ConsentCookie.get
getConsentMap // Will give a map of all configured consents with the key the id of the consent and the value a Consent object
getCookieValues // The ConsentCookie values not filtered by the configuration mapped by key = id and value = consent flag

Could you comment on this update related to the requested changes.

from consentcookie.

rockxwre avatar rockxwre commented on June 10, 2024

Test results

I tested it using the browsers Console. Everything works as described, which is great!
However, I'm struggling with some method names. What I did was executing each method on a specific consent. I did not read your explanation of the method but tried to explain the methods myself. These are the results:

isAccepted

I read some GDPR documentation and in this documentation the verb 'grant' is used in this context. You grant or reject a consent. So maybe isManuallyGranted() is better (please read further).

isAlwaysOn

In line with my previous comment (isAccepted), a consent cannot be 'on' or 'off'. In this case you have no choice. You are forced to grant the consent. Maybe something like isForcedGranted() or isAutoGranted()?

isEnabled

This one confused me the most. Since consent toggles can be immutable, my first guess was that if isEnabled() === true the toggle was enabled. But what it means is that the user granted the consent explicitly or the user had no choice to grant the consent because it was granted automatically. So maybe isGranted()?

isRejected

This one is in line with my previous comments.

from consentcookie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.