-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add code to check whether a user is allowed to reject all on the CMP #13183
Conversation
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
Size Change: +107 B (+0.01%) Total Size: 885 kB
ℹ️ View Unchanged
|
This needs to be worked out in the client for mdapi response
dd4fbf5
to
50025d5
Compare
@@ -86,12 +93,18 @@ const persistResponse = (userBenefitsResponse: UserBenefits) => { | |||
} else if (adFreeDataIsPresent() && !forcedAdFreeMode) { | |||
removeAdFreeCookie(); | |||
} | |||
if (userBenefitsResponse.allowRejectAll) { | |||
setAllowRejectAllCookie(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 2 days?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure really, I guess to give a bit of wiggle room past the 24hr refresh period? This is the same as the ad-free cookie which was already in place so I used the same value.
I'm going to do a bit of an investigation into the expiry times we set on these cookies and when we explicitly delete them, so this may change in a future PR
Seen on PROD (merged by @rupertbates 7 minutes and 55 seconds ago) Please check your changes! |
What does this change?
This PR adds code to retrieve and store a user's 'allow reject all' status from either the user-benefits api or the members-data-api (depending on the AB cohort the user is in).
Why?
To enable us to tell which version of the consent management banner to show for signed in users, we need to check whether they are subscribed to either a product which gives them ad-free reading or to Guardian Ad-Lite.
This code does that check and then caches that result in a cookie which is refreshed every 24hrs in the same way as the other user features cookies (ad-free, hide support messaging).