From 0af6a60d19232c42d834794eedea1fe0aef1091e Mon Sep 17 00:00:00 2001 From: Eli Grey <~@eligrey.com> Date: Tue, 6 Aug 2024 16:56:36 +0000 Subject: [PATCH 1/3] Expose `airgap.isConsented()` --- package.json | 2 +- src/core.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 19dbe8c..c454bf7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/core.ts b/src/core.ts index a48ce9e..ea96e8d 100644 --- a/src/core.ts +++ b/src/core.ts @@ -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 */ @@ -237,6 +240,16 @@ 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 */ From 8372be9b129ca1573d7b117fd1e3e0be6d2e080d Mon Sep 17 00:00:00 2001 From: Eli Grey <~@eligrey.com> Date: Tue, 6 Aug 2024 17:19:39 +0000 Subject: [PATCH 2/3] fix pre-commit --- src/core.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index ea96e8d..829824f 100644 --- a/src/core.ts +++ b/src/core.ts @@ -244,7 +244,6 @@ export type AirgapAPI = Readonly<{ * 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. From 4574da3af44e86e4cbdba17476706f24812164c0 Mon Sep 17 00:00:00 2001 From: Eli Grey <~@eligrey.com> Date: Tue, 6 Aug 2024 17:21:30 +0000 Subject: [PATCH 3/3] prettier wasn't auto-applying --- src/core.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index 829824f..b8eb99f 100644 --- a/src/core.ts +++ b/src/core.ts @@ -248,7 +248,10 @@ export type AirgapAPI = Readonly<{ * @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; + isConsented( + trackingPurposes: TrackingPurposes, + use?: TrackingEventType, + ): boolean; /** Get tracking consent */ getConsent(): TrackingConsentDetails; /** Set tracking consent */