Conversation
feat: Osana cookie manager
| <Dropdown.Divider /> | ||
| </>} | ||
|
|
||
| <Dropdown.Item onClick={() => cookieSettingsRef.current.click()}>{t('cookieSettingsItem')}</Dropdown.Item> |
There was a problem hiding this comment.
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} />
|
|
||
| useEffect(() => { | ||
| if (window?.OneTrust) { | ||
| if (typeof window !== 'undefined' && window.Osano) { |
There was a problem hiding this comment.
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.
^^that. window?.Osano?.cm is a step safer as well, since it checks for the target object receiving a property in this code.
| </>} | ||
|
|
||
| <Dropdown.Item onClick={() => cookieSettingsRef.current.click()}>{t('cookieSettingsItem')}</Dropdown.Item> | ||
| {window.Osano?.cm && ( |
There was a problem hiding this comment.
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 |
|
🗑️ Environment torn down due to inactivity |
25 similar comments
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
|
🗑️ Environment torn down due to inactivity |
Replaced typeof window !== 'undefined' && window.Osano with window?.Osano?.cm. Removed the no-op locale fallback logic Fixed indentation on the <% if %> block to align with surrounding content.
What does this PR do?
Swapping out OneTrust with Osana
feat: Osana cookie manager
How does it look
Relevant link(s)