UNPKG

quala-widget

Version:

Smart feedback widget for SaaS trial optimization

120 lines 3.65 kB
export interface TechnicalContext { consoleErrors: Array<{ message: string; stack?: string; timestamp: string; level: 'error' | 'warn'; }>; failedRequests: Array<{ url: string; status: number; method: string; timestamp: string; }>; performanceMetrics: { pageLoadTime?: number; firstContentfulPaint?: number; largestContentfulPaint?: number; cumulativeLayoutShift?: number; }; deviceInfo: { userAgent: string; viewport: string; screenResolution: string; devicePixelRatio: number; connectionType?: string; deviceType: 'mobile' | 'tablet' | 'desktop'; operatingSystem: string; browser: string; browserVersion: string; isTouchDevice: boolean; language: string; timezone: string; }; pageContext: { url: string; referrer: string; timestamp: string; scrollPosition: number; timeOnPage: number; }; userActions: Array<{ type: 'click' | 'scroll' | 'focus' | 'error' | 'navigation' | 'input' | 'form_submit'; element?: string; timestamp: string; data?: any; elementDetails?: { id?: string; text?: string; value?: string; type?: string; name?: string; placeholder?: string; className?: string; tagName: string; ariaLabel?: string; title?: string; }; }>; } export declare class TechnicalContextCollector { private consoleErrors; private failedRequests; private userActions; private pageStartTime; private debug; private isCapturing; private qualaContainerSelectors; constructor(debug?: boolean); private log; /** * ✅ SIMPLIFIED: Check if element is inside any Quala container * Just mark top-level containers and ignore everything inside! */ private isQualaElement; /** * Check if a URL is a Quala API endpoint */ private isQualaRequest; initialize(): void; private captureConsoleErrors; private captureNetworkFailures; private interceptXHR; private getRequestUrl; private getRequestMethod; private captureUserActions; private trackPageVisibility; private getElementDetails; private getElementLabel; private getElementSelector; private addConsoleError; /** * Properly serialize different types of arguments including Error objects */ private serializeArgument; addFailedRequest(url: string, status: number, method: string, timestamp: string): void; private addUserAction; private sanitizeUrl; private getPerformanceMetrics; private getDeviceInfo; private detectDeviceType; private detectOperatingSystem; private detectBrowser; private detectTouchDevice; private getPageContext; getContext(): TechnicalContext; getRecentErrors(count?: number): TechnicalContext['consoleErrors']; getRecentFailures(count?: number): TechnicalContext['failedRequests']; hasRecentActivity(): boolean; addQualaContainerSelector(selector: string): void; checkIsQualaElement(element: Element): boolean; getDetectionInfo(): { containerSelectors: string[]; isCapturing: boolean; }; private static instance; static getInstance(): TechnicalContextCollector; static initialize(debug?: boolean): TechnicalContextCollector; destroy(): void; } //# sourceMappingURL=TechnicalContextCollector.d.ts.map