import { BaseAnalyticsProvider } from '../../base-analytics-provider.js'; import type { ProviderConfig, ConsentSettings } from '../../../types/provider.js'; import type { RevenueData } from '../../../definitions.js'; interface SegmentConfig extends ProviderConfig { writeKey: string; apiHost?: string; flushAt?: number; flushInterval?: number; enabledIntegrations?: Record; /** @deprecated Documented alias for `enabledIntegrations`. */ integrations?: Record; defaultIntegrations?: boolean; anonymousId?: string; timeout?: number; retryCount?: number; } interface SegmentSDK { load: (writeKey: string, options?: any) => void; identify: (userId?: string, traits?: any, options?: any, callback?: () => void) => void; track: (event: string, properties?: any, options?: any, callback?: () => void) => void; page: (category?: string, name?: string, properties?: any, options?: any, callback?: () => void) => void; screen: (name?: string, properties?: any, options?: any, callback?: () => void) => void; group: (groupId: string, traits?: any, options?: any, callback?: () => void) => void; alias: (userId: string, previousId?: string, options?: any, callback?: () => void) => void; reset: () => void; ready: (callback: () => void) => void; user: () => any; anonymousId: () => string; on: (event: string, callback: (...args: any[]) => void) => void; off: (event: string, callback?: (...args: any[]) => void) => void; once: (event: string, callback: (...args: any[]) => void) => void; flush: (callback?: () => void) => void; setAnonymousId: (anonymousId: string) => void; debug: (enabled: boolean) => void; timeout: (ms: number) => void; addSourceMiddleware: (middleware: any) => void; addDestinationMiddleware: (integrationName: string, middleware: any) => void; } declare global { interface Window { analytics?: SegmentSDK; } } export declare class SegmentAnalyticsProvider extends BaseAnalyticsProvider { readonly id = "segment"; readonly name = "Segment Analytics"; readonly version = "1.0.0"; private analytics?; private _segmentConfig; private scriptLoaded; private _isReady; private _isInitialized; protected doInitialize(config: SegmentConfig): Promise; private loadSegmentSDK; protected doShutdown(): Promise; protected doUpdateConsent(consent: ConsentSettings): Promise; protected doIdentifyUser(userId: string, traits: Record): Promise; protected doSetUserProperties(properties: Record): Promise; protected doLogScreenView(screenName: string, properties: Record): Promise; protected doLogRevenue(data: RevenueData): Promise; protected doProviderReset(): Promise; protected doSetDebugMode(enabled: boolean): void; /** * Alias a user ID */ alias(userId: string, previousId?: string, options?: Record): Promise; /** * Associate a user with a group */ group(groupId: string, traits?: Record, options?: Record): Promise; /** * Track a page view */ page(name?: string, properties?: Record): Promise; /** * Flush queued events */ flush(): Promise; /** * Get the current user */ getUser(): any; /** * Sanitize properties for Segment */ private sanitizeProperties; /** * Check if provider is initialized */ isInitialized(): boolean; /** * Track page view */ trackPageView(pageName?: string, properties?: Record, options?: Record): Promise; /** * Track page view with category */ trackPageViewWithCategory(category: string, pageName?: string, properties?: Record, options?: Record): Promise; /** * Identify user with options */ identify(userId?: string, traits?: Record, options?: Record): Promise; /** * Override the base track method to support options */ track(eventName: string, properties?: Record, options?: Record): Promise; /** * Get user ID */ getUserId(): Promise; /** * Get user traits */ getUserTraits(): Promise | null>; /** * Get anonymous ID async */ getAnonymousId(): Promise; /** * Set anonymous ID async */ setAnonymousId(anonymousId: string): Promise; /** * Add source middleware */ addSourceMiddleware(middleware: any): Promise; /** * Add destination middleware */ addDestinationMiddleware(integrationName: string, middleware: any): Promise; /** * Add event listener */ on(event: string, callback: (...args: any[]) => void): Promise; /** * Remove event listener */ off(event: string, callback?: (...args: any[]) => void): Promise; /** * Add one-time event listener */ once(event: string, callback: (...args: any[]) => void): Promise; /** * Enable debug mode */ enableDebug(): Promise; /** * Disable debug mode */ disableDebug(): Promise; /** * Set timeout */ setTimeout(timeout: number): Promise; /** * Wait for ready state */ waitForReady(callback: () => void): Promise; /** * Track revenue with RevenueData */ trackRevenue(data: RevenueData): Promise; /** * Override doTrack to not include callback in base class call */ protected doTrack(eventName: string, properties: Record): Promise; } export {};