-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
108 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
/** | ||
* Returns an object with the checkbox status of all purposes. | ||
*/ | ||
export function getAllCheckboxes(): { [key: string]: boolean } { | ||
return getZaraz().consent.getAllCheckboxes(); | ||
} |
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,8 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
/** | ||
* Returns an object with the consent status of all purposes. | ||
*/ | ||
export function getAll(): { [key: string]: boolean } { | ||
return getZaraz().consent.getAll(); | ||
} |
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,14 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
type Purpose = { | ||
name: string; | ||
description: string; | ||
order: number; | ||
}; | ||
|
||
/** | ||
* An object containing all configured purposes, with their ID, name, description, and order. | ||
*/ | ||
export function getPurposes(): { [key: string]: Purpose } { | ||
return getZaraz().consent.purposes; | ||
} |
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,14 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
/** | ||
* Get the current consent status for a purpose using the purpose ID. | ||
* | ||
* ``` | ||
* true: The consent was granted. | ||
* false: The consent was not granted. | ||
* undefined: The purpose does not exist. | ||
* ``` | ||
*/ | ||
export function get(purposeId: string): boolean | undefined { | ||
return getZaraz().consent.get(purposeId); | ||
} |
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,19 @@ | ||
import { get } from './get'; | ||
import { getAll } from './get-all'; | ||
import { getAllCheckboxes } from './get-all-checkboxes'; | ||
import { sendQueuedEvents } from './send-queued-events'; | ||
import { set } from './set'; | ||
import { setAll } from './set-all'; | ||
import { setAllCheckboxes } from './set-all-checkboxes'; | ||
import { setCheckboxes } from './set-checkboxes'; | ||
|
||
export const consent = { | ||
get, | ||
set, | ||
getAll, | ||
setAll, | ||
getAllCheckboxes, | ||
setCheckboxes, | ||
setAllCheckboxes, | ||
sendQueuedEvents, | ||
}; |
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,8 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
/** | ||
* If some Pageview-based events were not sent due to a lack of consent, they can be sent using this method after consent was granted. | ||
*/ | ||
export function sendQueuedEvents(): void { | ||
getZaraz().consent.sendQueuedEvents(); | ||
} |
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,8 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
/** | ||
* Set the checkboxStatus status for all purposes in the consent modal at once. | ||
*/ | ||
export function setAllCheckboxes(checkboxStatus: boolean): void { | ||
getZaraz().consent.setAllCheckboxes(checkboxStatus); | ||
} |
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,8 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
/** | ||
* Set the consent status for all purposes at once. | ||
*/ | ||
export function setAll(consentStatus: boolean): void { | ||
getZaraz().consent.setAll(consentStatus); | ||
} |
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,10 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
/** | ||
* Set the consent status for some purposes using the purpose ID. | ||
*/ | ||
export function setCheckboxes(checkboxesStatus: { | ||
[key: string]: boolean; | ||
}): void { | ||
getZaraz().consent.setCheckboxes(checkboxesStatus); | ||
} |
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,8 @@ | ||
import { getZaraz } from '../helpers/get-zaraz'; | ||
|
||
/** | ||
* Set the consent status for some purposes using the purpose ID. | ||
*/ | ||
export function set(consentPreferences: { [key: string]: boolean }): void { | ||
getZaraz().consent.set(consentPreferences); | ||
} |
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