Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consent property 'flag' ambigious #23

Open
rockxwre opened this issue Apr 19, 2018 · 2 comments
Open

consent property 'flag' ambigious #23

rockxwre opened this issue Apr 19, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@rockxwre
Copy link
Contributor

Description

With ConsentCookie.get("<app id>") you will get an object that represents a consent.
This object will have a property called flag. Like stated in the documentation the value 0 represents a disabled (rejected?) consent and the value 1 represents an enabled (granted?) consent.
I think the term flag is ambiguous.

Expected Behavior

In my opinion, it would be better to have this flag property only for internal use and backward compatibility.
Instead, functions like:

  • ConsentCookie.isGranted("<app id">)
  • ConsentCookie.isRejected("<app id">)
  • ConsentCookie.get("<app id>").isGranted()
  • ConsentCookie.get("<app id>").isRejected()
    will be more intuitive to use.
@rockxwre rockxwre added the enhancement New feature or request label Apr 19, 2018
This was referenced May 23, 2018
@StevenChoo
Copy link
Member

@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.

@rockxwre
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants