UNPKG

@segment/analytics-consent-wrapper-onetrust

Version:

<img src="img/onetrust-popup.jpg" width="500" />

53 lines 1.76 kB
import { Categories, ConsentModel } from '@segment/analytics-consent-tools'; /** * @example ["C0001", "C0002"] */ type ActiveGroupIds = string[]; type GroupInfoDto = { CustomGroupId: string; }; type OtConsentChangedEvent = CustomEvent<ActiveGroupIds>; export declare enum OtConsentModel { optIn = "opt-in", optOut = "opt-out", implicit = "implied consent" } export interface OneTrustDomainData { ShowAlertNotice: boolean; Groups: GroupInfoDto[]; ConsentModel: { Name: OtConsentModel; }; } /** * The data model used by the OneTrust lib */ export interface OneTrustGlobal { GetDomainData: () => OneTrustDomainData; /** * This callback appears to fire whenever the alert box is closed, no matter what. * E.g: * - if a user continues without accepting * - if a user makes a selection * - if a user rejects all */ OnConsentChanged: (cb: (event: OtConsentChangedEvent) => void) => void; IsAlertBoxClosed: () => boolean; } export declare const getOneTrustGlobal: () => OneTrustGlobal | undefined; export declare const getOneTrustActiveGroups: () => string | undefined; export declare const getNormalizedActiveGroupIds: (oneTrustActiveGroups?: string | undefined) => ActiveGroupIds; export type GroupInfo = { groupId: string; }; /** * get *all* groups / categories, not just active ones */ export declare const getAllGroups: () => GroupInfo[]; export declare const getNormalizedCategories: (activeGroupIds?: ActiveGroupIds) => Categories; /** * We don't support all consent models, so we need to coerce them to the ones we do support. */ export declare const coerceConsentModel: (model: OtConsentModel) => ConsentModel; export {}; //# sourceMappingURL=onetrust-api.d.ts.map