@transcend-io/consent-manager-ui
Version:
Transcend Consent Manager reference consent UI
43 lines (40 loc) • 1.29 kB
text/typescript
import {
ConsentOptions,
TrackingConsent,
TrackingConsentDetails,
TrackingPurposesTypes,
} from '@transcend-io/airgap.js-types';
import { TranslatedMessages } from '@transcend-io/internationalization';
export interface TestWindowBase extends Window {
/** Jest setup variables */
JEST_SETUP_VARS: {
/** Cached english messages read from en.json */
messages: TranslatedMessages;
} & Record<string, unknown>;
}
/** Window type for jest testing extending the test window base type. This is necessary bc the airgap types are incompatible */
export type TestWindow = Omit<TestWindowBase, 'airgap'> & {
/** mock ag object */
airgap: {
/** mock getPurposeTypes fxn */
getPurposeTypes: () => TrackingPurposesTypes;
/** mock optIn fxn */
optIn: () => void;
/** mock optOut fxn */
optOut: () => void;
/** mock setConsent fxn */
setConsent: (
event: Event,
purposes: TrackingConsent,
options: ConsentOptions,
) => void;
/** mock getConsent fxn */
getConsent: () => TrackingConsentDetails;
/** mock getPrivacySignals fxn */
getPrivacySignals: () => Set<'DNT' | 'GPC'>;
/** mock getRegimePurposes fxn */
getRegimePurposes: () => Set<string>;
/** mock reset fxn */
reset: () => void;
};
};