/** * Consent SDK Types * * DSGVO/TTDSG-konforme Typdefinitionen für das Consent Management System. */ /** * Standard-Consent-Kategorien nach IAB TCF 2.2 */ type ConsentCategory = 'essential' | 'functional' | 'analytics' | 'marketing' | 'social'; /** * Consent-Status pro Kategorie */ type ConsentCategories = Record; /** * Consent-Status pro Vendor */ type ConsentVendors = Record; /** * Aktueller Consent-Zustand */ interface ConsentState { /** Consent pro Kategorie */ categories: ConsentCategories; /** Consent pro Vendor (optional, für granulare Kontrolle) */ vendors: ConsentVendors; /** Zeitstempel der letzten Aenderung */ timestamp: string; /** SDK-Version bei Erstellung */ version: string; /** Eindeutige Consent-ID vom Backend */ consentId?: string; /** Ablaufdatum */ expiresAt?: string; /** IAB TCF String (falls aktiviert) */ tcfString?: string; } /** * UI-Position des Banners */ type BannerPosition = 'bottom' | 'top' | 'center'; /** * Banner-Layout */ type BannerLayout = 'bar' | 'modal' | 'floating'; /** * Farbschema */ type BannerTheme = 'light' | 'dark' | 'auto'; /** * UI-Konfiguration */ interface ConsentUIConfig { /** Position des Banners */ position?: BannerPosition; /** Layout-Typ */ layout?: BannerLayout; /** Farbschema */ theme?: BannerTheme; /** Pfad zu Custom CSS */ customCss?: string; /** z-index fuer Banner */ zIndex?: number; /** Scroll blockieren bei Modal */ blockScrollOnModal?: boolean; /** Custom Container-ID */ containerId?: string; } /** * Consent-Verhaltens-Konfiguration */ interface ConsentBehaviorConfig { /** Muss Nutzer interagieren? */ required?: boolean; /** "Alle ablehnen" Button sichtbar */ rejectAllVisible?: boolean; /** "Alle akzeptieren" Button sichtbar */ acceptAllVisible?: boolean; /** Einzelne Kategorien waehlbar */ granularControl?: boolean; /** Einzelne Vendors waehlbar */ vendorControl?: boolean; /** Auswahl speichern */ rememberChoice?: boolean; /** Speicherdauer in Tagen */ rememberDays?: number; /** Nur in EU anzeigen (Geo-Targeting) */ geoTargeting?: boolean; /** Erneut nachfragen nach X Tagen */ recheckAfterDays?: number; } /** * TCF 2.2 Konfiguration */ interface TCFConfig { /** TCF aktivieren */ enabled?: boolean; /** CMP ID */ cmpId?: number; /** CMP Version */ cmpVersion?: number; } /** * PWA-spezifische Konfiguration */ interface PWAConfig { /** Offline-Unterstuetzung aktivieren */ offlineSupport?: boolean; /** Bei Reconnect synchronisieren */ syncOnReconnect?: boolean; /** Cache-Strategie */ cacheStrategy?: 'stale-while-revalidate' | 'network-first' | 'cache-first'; } /** * Haupt-Konfiguration fuer ConsentManager */ interface ConsentConfig { /** API-Endpunkt fuer Consent-Backend */ apiEndpoint: string; /** Site-ID */ siteId: string; /** Sprache (ISO 639-1) */ language?: string; /** Fallback-Sprache */ fallbackLanguage?: string; /** UI-Konfiguration */ ui?: ConsentUIConfig; /** Consent-Verhaltens-Konfiguration */ consent?: ConsentBehaviorConfig; /** Aktive Kategorien */ categories?: ConsentCategory[]; /** TCF 2.2 Konfiguration */ tcf?: TCFConfig; /** PWA-Konfiguration */ pwa?: PWAConfig; /** Callback bei Consent-Aenderung */ onConsentChange?: (consent: ConsentState) => void; /** Callback wenn Banner angezeigt wird */ onBannerShow?: () => void; /** Callback wenn Banner geschlossen wird */ onBannerHide?: () => void; /** Callback bei Fehler */ onError?: (error: Error) => void; /** Debug-Modus aktivieren */ debug?: boolean; } /** * Angular Integration fuer @breakpilot/consent-sdk * * @example * ```typescript * // app.module.ts * import { ConsentModule } from '@breakpilot/consent-sdk/angular'; * * @NgModule({ * imports: [ * ConsentModule.forRoot({ * apiEndpoint: 'https://consent.example.com/api/v1', * siteId: 'site_abc123', * }), * ], * }) * export class AppModule {} * ``` */ /** * ConsentService Interface fuer Angular DI * * @example * ```typescript * @Component({...}) * export class MyComponent { * constructor(private consent: ConsentService) { * if (this.consent.hasConsent('analytics')) { * // Analytics laden * } * } * } * ``` */ interface IConsentService { /** Initialisiert? */ readonly isInitialized: boolean; /** Laedt noch? */ readonly isLoading: boolean; /** Banner sichtbar? */ readonly isBannerVisible: boolean; /** Aktueller Consent-Zustand */ readonly consent: ConsentState | null; /** Muss Consent eingeholt werden? */ readonly needsConsent: boolean; /** Prueft Consent fuer Kategorie */ hasConsent(category: ConsentCategory): boolean; /** Alle akzeptieren */ acceptAll(): Promise; /** Alle ablehnen */ rejectAll(): Promise; /** Auswahl speichern */ saveSelection(categories: Partial): Promise; /** Banner anzeigen */ showBanner(): void; /** Banner ausblenden */ hideBanner(): void; /** Einstellungen oeffnen */ showSettings(): void; } /** * ConsentService - Angular Service Wrapper * * Diese Klasse kann als Angular Service registriert werden: * * @example * ```typescript * // consent.service.ts * import { Injectable } from '@angular/core'; * import { ConsentServiceBase } from '@breakpilot/consent-sdk/angular'; * * @Injectable({ providedIn: 'root' }) * export class ConsentService extends ConsentServiceBase { * constructor() { * super({ * apiEndpoint: environment.consentApiEndpoint, * siteId: environment.siteId, * }); * } * } * ``` */ declare class ConsentServiceBase implements IConsentService { private manager; private _consent; private _isInitialized; private _isLoading; private _isBannerVisible; private changeCallbacks; private bannerShowCallbacks; private bannerHideCallbacks; constructor(config: ConsentConfig); get isInitialized(): boolean; get isLoading(): boolean; get isBannerVisible(): boolean; get consent(): ConsentState | null; get needsConsent(): boolean; hasConsent(category: ConsentCategory): boolean; acceptAll(): Promise; rejectAll(): Promise; saveSelection(categories: Partial): Promise; showBanner(): void; hideBanner(): void; showSettings(): void; /** * Registriert Callback fuer Consent-Aenderungen * (fuer Angular Change Detection) */ onConsentChange(callback: (consent: ConsentState) => void): () => void; /** * Registriert Callback wenn Banner angezeigt wird */ onBannerShow(callback: () => void): () => void; /** * Registriert Callback wenn Banner ausgeblendet wird */ onBannerHide(callback: () => void): () => void; private setupEventListeners; private initialize; } /** * Konfiguration fuer ConsentModule.forRoot() */ interface ConsentModuleConfig extends ConsentConfig { } /** * Token fuer Dependency Injection * Verwendung mit Angular @Inject(): * * @example * ```typescript * constructor(@Inject(CONSENT_CONFIG) private config: ConsentConfig) {} * ``` */ declare const CONSENT_CONFIG = "CONSENT_CONFIG"; declare const CONSENT_SERVICE = "CONSENT_SERVICE"; /** * Factory fuer ConsentService * * @example * ```typescript * // app.module.ts * providers: [ * { provide: CONSENT_CONFIG, useValue: { apiEndpoint: '...', siteId: '...' } }, * { provide: CONSENT_SERVICE, useFactory: consentServiceFactory, deps: [CONSENT_CONFIG] }, * ] * ``` */ declare function consentServiceFactory(config: ConsentConfig): ConsentServiceBase; /** * ConsentModule - Angular Module * * Dies ist eine Template-Definition. Fuer echte Angular-Nutzung * muss ein separates Angular Library Package erstellt werden. * * @example * ```typescript * // In einem Angular Library Package: * @NgModule({ * declarations: [ConsentBannerComponent, ConsentGateDirective], * exports: [ConsentBannerComponent, ConsentGateDirective], * }) * export class ConsentModule { * static forRoot(config: ConsentModuleConfig): ModuleWithProviders { * return { * ngModule: ConsentModule, * providers: [ * { provide: CONSENT_CONFIG, useValue: config }, * { provide: CONSENT_SERVICE, useFactory: consentServiceFactory, deps: [CONSENT_CONFIG] }, * ], * }; * } * } * ``` */ declare const ConsentModuleDefinition: { /** * Providers fuer Root-Module */ forRoot: (config: ConsentModuleConfig) => { provide: string; useValue: ConsentModuleConfig; }; }; /** * ConsentBannerComponent Template * * Fuer Angular Library Implementation: * * @example * ```typescript * @Component({ * selector: 'bp-consent-banner', * template: CONSENT_BANNER_TEMPLATE, * styles: [CONSENT_BANNER_STYLES], * }) * export class ConsentBannerComponent { * constructor(public consent: ConsentService) {} * } * ``` */ declare const CONSENT_BANNER_TEMPLATE = "\n\n \n\n"; /** * ConsentGateDirective Template * * @example * ```typescript * @Directive({ * selector: '[bpConsentGate]', * }) * export class ConsentGateDirective implements OnInit, OnDestroy { * @Input('bpConsentGate') category!: ConsentCategory; * * private unsubscribe?: () => void; * * constructor( * private templateRef: TemplateRef, * private viewContainer: ViewContainerRef, * private consent: ConsentService * ) {} * * ngOnInit() { * this.updateView(); * this.unsubscribe = this.consent.onConsentChange(() => this.updateView()); * } * * ngOnDestroy() { * this.unsubscribe?.(); * } * * private updateView() { * if (this.consent.hasConsent(this.category)) { * this.viewContainer.createEmbeddedView(this.templateRef); * } else { * this.viewContainer.clear(); * } * } * } * ``` */ declare const CONSENT_GATE_USAGE = "\n\n
\n \n
\n\n\n\n \n\n\n

Bitte akzeptieren Sie Marketing-Cookies.

\n
\n"; export { CONSENT_BANNER_TEMPLATE, CONSENT_CONFIG, CONSENT_GATE_USAGE, CONSENT_SERVICE, type ConsentCategories, type ConsentCategory, type ConsentConfig, type ConsentModuleConfig, ConsentModuleDefinition, ConsentServiceBase, type ConsentState, type IConsentService, consentServiceFactory };