Skip to content

ERA-11250 Swap in new cookie manager by Osana #1241

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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Conversation

chrisj-er
Copy link
Contributor

What does this PR do?

Swapping out OneTrust with Osana
feat: Osana cookie manager

How does it look

Relevant link(s)

@@ -53,7 +53,11 @@ const UserMenu = ({ onLogOutClick, onProfileClick, selectedUserProfile, user, us
<Dropdown.Divider />
</>}

<Dropdown.Item onClick={() => cookieSettingsRef.current.click()}>{t('cookieSettingsItem')}</Dropdown.Item>
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we can do a bit more cleanup in this file. The following lines can go away:

// Line 1 (just the useRef import)
import React, { useRef } from 'react';
...
// Line 17
const cookieSettingsRef = useRef();
...
// Line 28
<button className="ot-sdk-show-settings" hidden id="ot-sdk-btn" ref={cookieSettingsRef} />

@@ -62,9 +62,12 @@ const RootApp = () => {
const { i18n } = useTranslation();

useEffect(() => {
if (window?.OneTrust) {
if (typeof window !== 'undefined' && window.Osano) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually go for optional chaining, so we can keep the code as it was, just changing the property:

if (window?.Osano) {

It's logically the same.

Copy link
Collaborator

Choose a reason for hiding this comment

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

^^that. window?.Osano?.cm is a step safer as well, since it checks for the target object receiving a property in this code.

@@ -53,7 +53,11 @@ const UserMenu = ({ onLogOutClick, onProfileClick, selectedUserProfile, user, us
<Dropdown.Divider />
</>}

<Dropdown.Item onClick={() => cookieSettingsRef.current.click()}>{t('cookieSettingsItem')}</Dropdown.Item>
{window.Osano?.cm && (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add some optional chaining to the window object (like window?.Osano?.cm) so we're not set up for future failures in headless test environments.

@amicavi
Copy link
Contributor

amicavi commented Mar 31, 2025

Before merging this ticket, please consider the impact this could have on GDPR

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

Successfully merging this pull request may close these issues.

4 participants