-
Notifications
You must be signed in to change notification settings - Fork 214
@W-17594891 Update Wording of Interface In DNT hook #2182
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
Changes from 4 commits
60eb461
6a2a51d
3fde987
4949802
d5132b2
384b0fb
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 |
|---|---|---|
|
|
@@ -7,10 +7,11 @@ | |
| import useAuthContext from './useAuthContext' | ||
|
|
||
| interface useDntReturn { | ||
| selectedDoNotTrackValue: boolean | undefined | ||
| selectedDnt: boolean | undefined | ||
| dntStatus: boolean | undefined | ||
| effectiveDoNotTrackValue: boolean | undefined | ||
| effectiveDnt: boolean | undefined | ||
| updateDNT: (preference: boolean | null) => Promise<void> | ||
| updateDnt: (preference: boolean | null) => Promise<void> | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -20,33 +21,36 @@ interface useDntReturn { | |
| * @returns {Object} - The returned object containing DNT states and function to update preference | ||
| * @property {boolean | undefined} dntStatus @deprecated - DNT user preference. Used to determine | ||
| * if the consent tracking form should be rendered | ||
| * **Deprecated since version 3.1.0 Use selectedDoNotTrackValue instead.** | ||
| * @property {boolean} selectedDoNotTrackValue - DNT user preference. Used to determine | ||
| * **Deprecated since version 3.1.0 Use selectedDnt instead.** | ||
| * @property {boolean} selectedDnt - DNT user preference. Used to determine | ||
| * if the consent tracking form should be rendered | ||
| * @property {boolean} effectiveDoNotTrackValue - effective DNT value to apply to | ||
| * analytics layers. Takes defaultDnt into account when selectedDoNotTrackValue is undefined. | ||
| * @property {boolean} effectiveDnt - effective DNT value to apply to | ||
| * analytics layers. Takes defaultDnt into account when selectedDnt is undefined. | ||
| * If defaultDnt is undefined as well, then SDK default is used. | ||
| * @property {function} updateDNT - takes a DNT choice and creates the dw_dnt | ||
| * cookie and reauthorizes with SLAS | ||
| * | ||
| */ | ||
| const useDNT = (): useDntReturn => { | ||
| const auth = useAuthContext() | ||
| const selectedDoNotTrackValue = auth.getDnt() | ||
| const effectiveDoNotTrackValue = auth.getDnt({ | ||
| const selectedDnt = auth.getDnt() | ||
| const effectiveDnt = auth.getDnt({ | ||
| includeDefaults: true | ||
| }) | ||
| const updateDNT = async (preference: boolean | null) => { | ||
| await auth.setDnt(preference) | ||
| } | ||
| const dntStatus = selectedDoNotTrackValue | ||
| const updateDnt = updateDNT | ||
| const dntStatus = selectedDnt | ||
|
|
||
| return { | ||
| selectedDoNotTrackValue, | ||
| effectiveDoNotTrackValue, | ||
| /** @deprecated - Deprecated since version 3.1.0. Use selectedDoNotTrackValue instead. */ | ||
| selectedDnt, | ||
| effectiveDnt, | ||
| /** @deprecated - Deprecated since version 3.1.0. Use selectedDnt instead. */ | ||
| dntStatus, | ||
| updateDNT | ||
| /** @deprecated - Deprecated since version 3.1.0. Use updateDnt instead. */ | ||
|
||
| updateDNT, | ||
| updateDnt | ||
|
Contributor
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. which one are we deprecating again? updateDNT is a defined func, if we remove it, what does updateDnt equal to?
Collaborator
Author
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. They are the same thing. We are deprecating updateDNT and dntStatus |
||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Please move this block to jsdoc comment so it will be generated into the typedoc when we merge.