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: handle cases where show banner is unchecked #987

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

silesky
Copy link
Contributor

@silesky silesky commented Nov 2, 2023

#972

Fix bug: if showAlertNotice is false and Segment has default categories, we want to immediately load Segment with any default categories.

This PR mantains the status quo when it comes to end user re-consent / updated consent (consent updates made after the initial consent decision, in this case, any decision where the end user toggles the alert box on again.)

  • stamped consent categories will update as usual
  • analytics will not load any new device mode plugins according to the updated consent

^ This will come in later PRs / work

Copy link

changeset-bot bot commented Nov 2, 2023

⚠️ No Changeset found

Latest commit: 431ad2b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@silesky silesky marked this pull request as ready for review November 2, 2023 18:21
@silesky silesky requested a review from chrisradek November 2, 2023 18:21
@silesky silesky force-pushed the handle-show-banner-false-jurisdictions branch from 8fce3aa to 431ad2b Compare November 2, 2023 22:45
Comment on lines +56 to +58
if ('geolocationResponse' in oneTrust) {
return undefined
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - I'm having a little trouble understanding this bit.

window.OneTrust can be different objects depending on some conditions? Does it become the OneTrust object we know only after the banner is interacted with, or after something outside our control is loaded?

The comment about polling a few lines down confused me a bit too...when does this happen?

Copy link
Contributor Author

@silesky silesky Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.OneTrust can be different objects depending on some conditions?

Correct. I think if the show banner checkbox is false (or maybe some other condition in the template I used), it will have a moment before it fully initialized where it just has the geolocation property.

Manual testing was the only reason I noticed that. Likely undocumented, but made me realize that this object is unreliable and I'd rather we not throw if it cycles through different shapes.

The comment about polling a few lines down confused me a bit too...when does this happen?

See the usage of "resolveWhen" for when we poll for the OneTrust global. My meaning is: because we are polling the object, we have the chance of hitting one of those intermediate states, so, when used in resolveWhen, we wait for every method we depend on to exist before we actually return the global. If undefined, it continues to poll.

I decided to log an error vs throw because, well, my confidence is shaken: it's possible that there is some intermediate state(s) we don't know about that a customer (or us) will discover --- and OneTrust still gets a chance to initialize correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible that there is some intermediate state(s) we don't know about that a customer (or us) will discover

Yeah, that seems reasonable to log then.

Copy link
Contributor

@chrisradek chrisradek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Comment on lines +56 to +58
if ('geolocationResponse' in oneTrust) {
return undefined
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible that there is some intermediate state(s) we don't know about that a customer (or us) will discover

Yeah, that seems reasonable to log then.

@silesky silesky merged commit a63f6c1 into master Nov 7, 2023
5 checks passed
@silesky silesky deleted the handle-show-banner-false-jurisdictions branch November 7, 2023 06:39
@github-actions github-actions bot mentioned this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants