-
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?
Changes from all commits
1219f46
d2880b2
157a040
f6d4527
f018675
c52d835
dbffc09
0ec8464
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Let's add some optional chaining to the window object (like |
||
<Dropdown.Item onClick={() => window.Osano.cm.showDrawer('osano-cm-dom-info-dialog-open')}> | ||
{t('cookieSettingsItem')} | ||
</Dropdown.Item> | ||
)} | ||
|
||
<Dropdown.Item onClick={onLogOutItemClick}>{t('logoutItem')}</Dropdown.Item> | ||
</Dropdown.Menu> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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:
It's logically the same. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^^that. |
||
document.documentElement.lang = i18n.language; | ||
window.OneTrust.changeLanguage(i18n.language); | ||
window.Osano.cm.locale = i18n.language; | ||
if (window.Osano.cm.locale !== i18n.language) { | ||
window.Osano.cm.locale = 'en'; | ||
} | ||
} | ||
}, [i18n.language]); | ||
|
||
|
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: