import { BaseAnalyticsProvider } from '../../base-analytics-provider.js'; import type { ProviderConfig, ConsentSettings } from '../../../types/provider.js'; import type { RevenueData } from '../../../definitions.js'; interface PostHogConfig extends ProviderConfig { apiKey: string; apiHost?: string; /** @deprecated Documented alias for `apiHost`. */ host?: string; loaded?: (posthog: any) => void; autocapture?: boolean; capturePageview?: boolean; capturePageleave?: boolean; crossSubdomainCookie?: boolean; persistence?: 'localStorage' | 'cookie' | 'memory'; cookieName?: string; cookieExpiration?: number; respectDnt?: boolean; propertyBlacklist?: string[]; xhr_headers?: Record; ipCapture?: boolean; optOutCapturingByDefault?: boolean; mask_all_text?: boolean; mask_all_element_attributes?: boolean; featureFlags?: Record; sessionRecording?: { enabled?: boolean; maskAllInputs?: boolean; maskInputOptions?: Record; sampleRate?: number; minimumDuration?: number; }; } interface PostHogSDK { init: (apiKey: string, config?: any) => void; capture: (event: string, properties?: any, options?: any) => void; identify: (distinctId: string, properties?: any, options?: any) => void; people: { set: (properties: any) => void; set_once: (properties: any) => void; increment: (properties: any) => void; append: (properties: any) => void; delete: () => void; }; alias: (alias: string, distinctId?: string) => void; reset: (resetDeviceId?: boolean) => void; get_distinct_id: () => string; get_session_id: () => string; opt_out_capturing: () => void; opt_in_capturing: () => void; has_opted_out_capturing: () => boolean; set_config: (config: any) => void; register: (properties: any) => void; register_once: (properties: any) => void; unregister: (property: string) => void; get_property: (property: string) => any; startSessionRecording: () => void; stopSessionRecording: () => void; feature_flags: { reloadFeatureFlags: () => void; isFeatureEnabled: (flag: string) => boolean; getFeatureFlag: (flag: string) => any; onFeatureFlags: (callback: (flags: Record) => void) => void; }; group: (groupType: string, groupKey: string, properties?: any) => void; debug: (enable?: boolean) => void; setPersonProperties: (properties: any) => void; setPersonPropertiesForFlags: (properties: any) => void; isFeatureEnabled: (flag: string) => boolean; getFeatureFlag: (flag: string) => any; onFeatureFlags: (callback: (flags: Record) => void) => void; reloadFeatureFlags: () => void; } declare global { interface Window { posthog?: PostHogSDK; } } export declare class PostHogAnalyticsProvider extends BaseAnalyticsProvider { readonly id = "posthog"; readonly name = "PostHog Analytics"; readonly version = "1.0.0"; private posthog?; private _posthogConfig; private scriptLoaded; /** * Get provider name */ getName(): string; protected doInitialize(config: PostHogConfig): Promise; private loadPostHogSDK; protected doShutdown(): Promise; protected doProviderReset(): Promise; protected doUpdateConsent(consent: ConsentSettings): Promise; track(eventName: string, properties?: Record): Promise; protected doTrack(eventName: string, properties: Record): Promise; protected doIdentifyUser(userId: string, traits: Record): Promise; /** * Alias for identifyUser to match test expectations */ identify(userId: string, traits?: Record): Promise; setUserProperties(properties: Record): Promise; protected doSetUserProperties(properties: Record): Promise; logScreenView(screenName: string, properties?: Record): Promise; protected doLogScreenView(screenName: string, properties: Record): Promise; logRevenue(data: RevenueData): Promise; protected doLogRevenue(data: RevenueData): Promise; protected doReset(): Promise; protected doSetDebugMode(enabled: boolean): void; /** * Set super properties (properties sent with every event) */ setSuperProperties(properties: Record): void; /** * Set super properties once (properties sent with every event, but only set once) */ setSuperPropertiesOnce(properties: Record): void; /** * Unregister a super property */ unregisterSuperProperty(property: string): void; /** * Get a super property */ getSuperProperty(property: string): any; /** * Get the distinct ID */ getDistinctId(): string | null; /** * Get the session ID */ getSessionId(): string | null; /** * Alias a user */ alias(alias: string, distinctId?: string): void; /** * Associate a user with a group */ group(groupType: string, groupKey: string, properties?: Record): void; /** * Check if a feature flag is enabled */ isFeatureEnabled(flag: string): boolean; /** * Get the value of a feature flag */ getFeatureFlag(flag: string): any; /** * Listen for feature flag changes */ onFeatureFlags(callback: (flags: Record) => void): void; /** * Reload feature flags */ reloadFeatureFlags(): void; /** * Start session recording */ startSessionRecording(): void; /** * Stop session recording */ stopSessionRecording(): void; /** * Set person properties for feature flags */ setPersonPropertiesForFlags(properties: Record): void; /** * Sanitize properties for PostHog */ private sanitizeProperties; } export {};