@tinytapanalytics/sdk
Version:
Behavioral psychology platform that detects visitor frustration, predicts abandonment, and helps you save at-risk conversions in real-time
89 lines • 2.08 kB
TypeScript
/**
* Shadow DOM Manager for TinyTapAnalytics SDK
* Provides complete CSS isolation for UI elements
*/
interface ModalConfig {
title?: string;
content: string;
persistent?: boolean;
className?: string;
width?: string;
height?: string;
allowHTML?: boolean;
}
interface NotificationConfig {
message: string;
type?: 'info' | 'success' | 'warning' | 'error';
duration?: number;
className?: string;
}
export declare class ShadowDOMManager {
private shadowHost;
private shadowRoot;
private styleSheet;
private components;
private componentCounter;
constructor();
/**
* Create the shadow host element
*/
private createShadowHost;
/**
* Initialize CSS styles for the shadow DOM
*/
private initializeStyles;
/**
* Get base CSS styles for shadow DOM components
*/
private getBaseStyles;
/**
* Sanitize text content to prevent XSS
*/
private sanitizeText;
/**
* Create a modal component
*/
createModal(config: ModalConfig): HTMLElement;
/**
* Create a notification component
*/
createNotification(config: NotificationConfig): HTMLElement;
/**
* Create a banner component (for consent, notifications, etc.)
*/
createBanner(config: {
content: string;
className?: string;
allowHTML?: boolean;
}): HTMLElement;
/**
* Show a component
*/
show(component: HTMLElement): void;
/**
* Hide a component by ID or element
*/
hide(componentIdOrElement: string | HTMLElement): void;
/**
* Hide all components
*/
hideAll(): void;
/**
* Update styles dynamically
*/
updateStyles(css: string): void;
/**
* Check if any components are visible
*/
hasVisibleComponents(): boolean;
/**
* Get component count
*/
getComponentCount(): number;
/**
* Clean up and destroy the shadow DOM
*/
destroy(): void;
}
export {};
//# sourceMappingURL=ShadowDOMManager.d.ts.map