-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(headless,headless-react): support OneTrust preferences in typedo…
…c sites (#4942) https://coveord.atlassian.net/browse/KIT-3946 I realized that the settings pannel in Typedoc sites relies on cookies. This means that technically, we need to support the privacy preferences set on docs.coveo.com. You can test my fix by opening this page: https://docs.coveo.com/en/headless/latest/reference/functions/Case_Assist.buildCaseAssistEngine.html After allowing or disallowing cookies from https://docs.coveo.com/en/0 (`Cookie preferences` modal accessible through upper right corner (...) button). Typedoc also uses a very large number of cookies for navigation purposes. I'll look into this with legal, but I think we'll be able to consider them strictly necessary, so we won't have to clear them as Typedoc populates them. Basically, if we erased the navigation cookies, Typedoc would never remember the navigation tree you opened prior to opening a new page.
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export function insertOneTrust() { | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const areFunctionalCookiesEnabled = document.cookie | ||
.split('; ') | ||
.some( | ||
(cookie) => | ||
cookie.startsWith('OptanonConsent') && cookie.includes('C0003%3A1') | ||
); | ||
|
||
if (!areFunctionalCookiesEnabled) { | ||
const settingsDiv = document.querySelector('.settings'); | ||
if (settingsDiv) { | ||
(settingsDiv as HTMLElement).style.display = 'none'; | ||
} | ||
|
||
const itemsToDelete = [ | ||
'tsd-theme', | ||
'filter-protected', | ||
'filter-inherited', | ||
'filter-external', | ||
]; | ||
itemsToDelete.forEach((item) => localStorage.removeItem(item)); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export function insertOneTrust() { | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const areFunctionalCookiesEnabled = document.cookie | ||
.split('; ') | ||
.some( | ||
(cookie) => | ||
cookie.startsWith('OptanonConsent') && cookie.includes('C0003%3A1') | ||
); | ||
|
||
if (!areFunctionalCookiesEnabled) { | ||
const settingsDiv = document.querySelector('.settings'); | ||
if (settingsDiv) { | ||
(settingsDiv as HTMLElement).style.display = 'none'; | ||
} | ||
|
||
const itemsToDelete = [ | ||
'tsd-theme', | ||
'filter-protected', | ||
'filter-inherited', | ||
'filter-external', | ||
]; | ||
itemsToDelete.forEach((item) => localStorage.removeItem(item)); | ||
} | ||
}); | ||
} |