-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: develop
Are you sure you want to change the base?
Conversation
feat: Osana cookie manager
@@ -53,7 +53,11 @@ const UserMenu = ({ onLogOutClick, onProfileClick, selectedUserProfile, user, us | |||
<Dropdown.Divider /> | |||
</>} | |||
|
|||
<Dropdown.Item onClick={() => cookieSettingsRef.current.click()}>{t('cookieSettingsItem')}</Dropdown.Item> |
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.
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) { |
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.
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.
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.
^^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 && ( |
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.
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.
Before merging this ticket, please consider the impact this could have on GDPR |
What does this PR do?
Swapping out OneTrust with Osana
feat: Osana cookie manager
How does it look
Relevant link(s)