Skip to content
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

Expose airgap.isConsented() #140

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/airgap.js-types",
"description": "TypeScript types for airgap.js interoperability with custom consent UIs",
"version": "11.0.0",
"version": "12.0.0",
"homepage": "https://github.com/transcend-io/airgap.js-types",
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ export type CookieOverride = (event: IPendingCookieMutation) => void;
*/
export type CookieWatcher = (event: IPendingCookieMutation) => void;

/** Event types (for purpose resolution) */
export type TrackingEventType = 'request' | 'cookie';

/** airgap.js API */
export type AirgapAPI = Readonly<{
/** Embedded request watchers */
Expand All @@ -237,6 +240,18 @@ export type AirgapAPI = Readonly<{
* @param resolveOverrides - Resolve overrides. Defaults to true.
*/
resolve(url: Stringifiable, resolveOverrides?: boolean): Stringifiable;
/**
* Resolve consent status for given tracking purposes. Essential purposes override opted out unessential purposes.
*
* If `use` is not provided, consent is resolved for both request and cookie tracking event types.
* @param trackingPurposes - Tracking purposes to resolve
* @param use - Optional event type to use for tracking purpose resolution
* @returns `true` if the applicable tracking purposes are consented.
*/
isConsented(
trackingPurposes: TrackingPurposes,
use?: TrackingEventType,
): boolean;
/** Get tracking consent */
getConsent(): TrackingConsentDetails;
/** Set tracking consent */
Expand Down
Loading