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

Update GDPR default regional experience to include consent expiry #128

Merged
merged 2 commits into from
Feb 1, 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": "10.12.1",
"version": "10.12.2",
"homepage": "https://github.com/transcend-io/airgap.js-types",
"repository": {
"type": "git",
Expand Down
19 changes: 18 additions & 1 deletion src/experience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
REGIME_DISPLAY_PRIORITY,
REGIME_TIMEZONES,
} from './constants';
import { BrowserLanguage, RegionsOperator } from './enums';
import { BrowserLanguage, OnConsentExpiry, RegionsOperator } from './enums';

export interface Region {
/** A country's ISO code */
Expand Down Expand Up @@ -49,6 +49,10 @@ export interface ExperienceInput {
viewState: InitialViewState;
/** experience purposes to be added */
experiencePurposeInputs: ExperiencePurposeInput[];
/** Time in months after which a user's opt-in consent should expire */
consentExpiry: number;
/** Behavior to exhibit when the user's consent has expired */
onConsentExpiry: OnConsentExpiry;
}

// default to []
Expand Down Expand Up @@ -122,6 +126,17 @@ export const REGIME_LANGUAGES: Record<PrivacyRegime, string[]> = {
],
};

// default to 0
export const REGIME_CONSENT_EXPIRY: Record<PrivacyRegime, number> = {
GDPR: 12,
};

// default to prompt
export const REGIME_ON_CONSENT_EXPIRY: Record<PrivacyRegime, OnConsentExpiry> =
{
GDPR: OnConsentExpiry.ResetOptIns,
};

/**
* construct default experience for regime
* @param regime - regime
Expand Down Expand Up @@ -150,6 +165,8 @@ export function defaultExperience(regime: PrivacyRegime): ExperienceInput {
false,
}),
),
consentExpiry: REGIME_CONSENT_EXPIRY[regime] ?? 0,
onConsentExpiry: REGIME_ON_CONSENT_EXPIRY[regime] ?? OnConsentExpiry.Prompt,
};
}

Expand Down
Loading