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

CORE-671 CookieYes #2703

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

CORE-671 CookieYes #2703

wants to merge 13 commits into from

Conversation

Dantemss
Copy link
Member

@Dantemss Dantemss commented Feb 6, 2025

  • Removed Osano
  • Added CookieYes

Tom wants to move this snippet into GTM, so he requested that it be able to run without app code.

@Dantemss Dantemss self-assigned this Feb 6, 2025
@Dantemss Dantemss changed the title CookieYes CORE-671 CookieYes Feb 6, 2025
@Dantemss Dantemss requested a review from RoyEJohnson February 6, 2025 23:31
@Dantemss Dantemss marked this pull request as ready for review February 6, 2025 23:31
@Dantemss
Copy link
Member Author

Dantemss commented Feb 7, 2025

Tested on dev.openstax.org and it seems to work just fine.

src/index.html Outdated
} else {
Sentry.captureMessage(`Failed to save cookie consent (HTTP status code: ${response.status})`);
}
}, (error) => Sentry.captureException(error)
Copy link
Member

Choose a reason for hiding this comment

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

i'm pretty sure these sentry calls are the ones triggering the "undefined variable sentry" errors

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I guess I should add a guard and ignore the errors otherwise? I think Sentry is not guaranteed to be accessible when GTM scripts run either.

src/index.html Outdated
<link rel="stylesheet" href="https://ram.openstax.org/osano/osano.css">
<script src="https://cmp.osano.com/AzZqbXTbzhHsU3cv1/68d8e8ae-4024-4489-a000-72766ad284a6/osano.js"></script>
<script>
fetch('/accounts/api/user', { credentials: 'include' }).then((userResponse) => {
Copy link
Member

Choose a reason for hiding this comment

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

osweb also fetches the user, is this gonna make it fetch the user twice on every page load?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes... I can have both this and the app code write the user to the window (only if not already present), I suppose

@Dantemss Dantemss marked this pull request as draft February 12, 2025 23:08
}

document.body.classList.add('hide-osano');
function CookieYesToggle() {
Copy link
Member Author

Choose a reason for hiding this comment

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

I should move this to ui-components and use it in Rex

Copy link
Member

Choose a reason for hiding this comment

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

It wasn't done in a shared way before because Roy didn't want to add styled components to osweb

You could pretty much copy/paste though. Maybe rex and assignable could share a component

@Dantemss Dantemss marked this pull request as ready for review February 27, 2025 23:38
@Dantemss
Copy link
Member Author

This should be ready for another look

Copy link
Contributor

@RoyEJohnson RoyEJohnson left a comment

Choose a reason for hiding this comment

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

A couple of lint errors (it's not part of the check in checks). I have suggested the fixes.

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.

3 participants