Skip to content

Commit

Permalink
Expose airgap.isConsented() (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
eligrey authored Aug 6, 2024
1 parent 52939f8 commit c657990
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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

0 comments on commit c657990

Please sign in to comment.