diff --git a/package.json b/package.json index 8f4ba33..af1d411 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": "10.6.1", + "version": "10.7.2", "homepage": "https://github.com/transcend-io/airgap.js-types", "repository": { "type": "git", diff --git a/src/core.ts b/src/core.ts index 6d55255..c75bffb 100644 --- a/src/core.ts +++ b/src/core.ts @@ -5,11 +5,7 @@ import * as t from 'io-ts'; import { FixedLengthArray, valuesOf } from '@transcend-io/type-utils'; // local -import { - ConfigurablePurpose, - SpecialTrackingPurpose, - ViewState, -} from './enums'; +import { SpecialTrackingPurpose, ViewState } from './enums'; /* eslint-disable max-lines */ @@ -320,7 +316,7 @@ export const TrackingPurposeDetails = t.intersection([ }), t.partial({ /** Tracking type */ - trackingType: valuesOf(ConfigurablePurpose), + trackingType: t.string, /** Respected opt-out privacy signals */ optOutSignals: t.array(UserPrivacySignal), }), @@ -375,10 +371,15 @@ export const TrackingConsent = t.intersection([ */ export type TrackingConsent = t.TypeOf<typeof TrackingConsent>; -export const TrackingConsentDetails = t.intersection([ +export const TrackingConsentWithNulls = t.record( + t.string, + t.union([t.boolean, t.undefined, t.null]), +); +/** Type override */ +export type TrackingConsentWithNulls = t.TypeOf<typeof TrackingConsent>; + +const CoreTrackingConsentDetails = t.intersection([ t.type({ - /** Tracking consent config */ - purposes: TrackingConsent, /** * Was tracking consent confirmed by the user? * If this is false, the consent was resolved from defaults & is not yet confirmed @@ -399,23 +400,38 @@ export const TrackingConsentDetails = t.intersection([ }), ]); +/** Type override */ +export type CoreTrackingConsentDetails = t.TypeOf< + typeof CoreTrackingConsentDetails +>; + +export const TrackingConsentDetails = t.intersection([ + CoreTrackingConsentDetails, + t.type({ + /** Tracking consent config */ + purposes: TrackingConsent, + }), +]); + /** Override types. */ export type TrackingConsentDetails = t.TypeOf<typeof TrackingConsentDetails>; +export const TrackingConsentOptionalData = t.partial({ + /** Transparency Consent (TCF) String */ + tcf: t.string, + /** US Privacy (USP) String */ + usp: t.string, + /** Global Privacy Platform (GPP) String */ + gpp: t.string, + /** Consent Manager View State */ + viewState: valuesOf(ViewState), + /** Airgap Version */ + airgapVersion: t.string, +}); + export const FullTrackingConsentDetails = t.intersection([ TrackingConsentDetails, - t.partial({ - /** Transparency Consent (TCF) String */ - tcf: t.string, - /** US Privacy (USP) String */ - usp: t.string, - /** Global Privacy Platform (GPP) String */ - gpp: t.string, - /** Consent Manager View State */ - viewState: valuesOf(ViewState), - /** Airgap Version */ - airgapVersion: t.string, - }), + TrackingConsentOptionalData, ]); /** Override types. */ @@ -423,6 +439,20 @@ export type FullTrackingConsentDetails = t.TypeOf< typeof FullTrackingConsentDetails >; +export const FullTrackingConsentDetailsWithNulls = t.intersection([ + CoreTrackingConsentDetails, + TrackingConsentOptionalData, + t.type({ + /** Tracking consent config */ + purposes: TrackingConsentWithNulls, + }), +]); + +/** Override types. */ +export type FullTrackingConsentDetailsWithNulls = t.TypeOf< + typeof FullTrackingConsentDetailsWithNulls +>; + export const ConsentPreferencesBody = t.type({ /** token containing encrypted identifier */ token: t.string, diff --git a/src/enums/viewState.ts b/src/enums/viewState.ts index b6ac6a3..cac864e 100644 --- a/src/enums/viewState.ts +++ b/src/enums/viewState.ts @@ -35,6 +35,8 @@ export const InitialTranscendViewState = makeEnum({ NoticeAndDoNotSell: 'NoticeAndDoNotSell', /* open a modal that allows for an explanation of do not sell/share, before opting out */ DoNotSellExplainer: 'DoNotSellExplainer', + /* open a modal that allows for complete options toggling */ + CompleteOptionsToggles: 'CompleteOptionsToggles', /* open a modal that shows a notice that the privacy policy has changed, without any prompt to change consent */ PrivacyPolicyNotice: 'PrivacyPolicyNotice', /* expanded and showing full checkbox options */ diff --git a/src/ui.ts b/src/ui.ts index 6425f8c..650d969 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -183,6 +183,8 @@ export type RequiredConsentManagerConfig = t.TypeOf< export const OptionalConsentManagerConfig = t.partial({ /** The set of enabled languages - CSV of ConsentManagerLanguageKey */ languages: t.string, + /** The override value for the consent banner z-index */ + uiZIndex: t.string, }); /** type overload */