Skip to content

Commit

Permalink
airgap.toggle() and airgap.status APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
eligrey committed Nov 23, 2023
1 parent e99cc37 commit 4c91cbd
Show file tree
Hide file tree
Showing 2 changed files with 26 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": "10.8.0",
"version": "10.9.0",
"homepage": "https://github.com/transcend-io/airgap.js-types",
"repository": {
"type": "git",
Expand Down
25 changes: 25 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,27 @@ export interface ConsentOptions {
timestamp?: string;
}

/** airgap.toggle() options */
export type AirgapToggleOptions =
/** Protection state */
| boolean
| {
/** Protection state */
protection?: boolean;
};

/** airgap.status format */
export interface AirgapSystemStatus {
/** Protection system active state */
protection: boolean;
/** Have any CSPs been activated? */
csp: boolean;
/** Monitoring system active state */
monitoring: boolean;
/** Telemetry system active state */
telemetry: boolean;
}

/** airgap.js API */
export type AirgapAPI = Readonly<{
/** Airgap ready event subscriber */
Expand Down Expand Up @@ -211,6 +232,10 @@ export type AirgapAPI = Readonly<{
getRegimes(): Set<PrivacyRegime>;
/** Get a list of detected active user agent privacy signals */
getPrivacySignals(): Set<UserPrivacySignal>;
/** Toggle all airgap.js protections. Auth must be a pre-airgap.js or airgap.js script 'load' event. Returns success status */
toggle(auth: AirgapAuth, options?: AirgapToggleOptions): boolean;
/** Current airgap.js system flags */
status: AirgapSystemStatus;
/** airgap.js version number */
version: string;
/** override the event listener signature for consent change events */
Expand Down

0 comments on commit 4c91cbd

Please sign in to comment.