import { IHttpClient, IHttpResponse } from '../utils/HttpClient'; import { IEmotionAI } from './IEmotionAI'; import { EAIConfig } from '../type.local'; import { IVisitorEvent } from './hit/IVisitorEvent'; import { IPageView } from './hit/IPageView'; import { IFlagshipConfig } from '../config/IFlagshipConfig'; import { EAIScore, TroubleshootingLabel } from '../types'; import { VisitorAbstract } from '../visitor/VisitorAbstract'; import { VisitorEvent } from './hit/VisitorEvent'; import { HttpError } from '../utils/HttpError.ts'; type ConstructorParam = { httpClient: IHttpClient; sdkConfig: IFlagshipConfig; eAIConfig: EAIConfig | undefined; }; export declare abstract class CommonEmotionAI implements IEmotionAI { protected _EAIScore?: EAIScore; protected _EAIScoreChecked: boolean; protected _httpClient: IHttpClient; protected _sdkConfig: IFlagshipConfig; protected _eAIConfig?: EAIConfig; protected _isEAIDataCollecting: boolean; protected _fetchEAIScorePromise?: Promise; protected _startScoringTimestamp: number; protected _scoringIntervalId?: NodeJS.Timeout; protected _onEAICollectStatusChange?: (status: boolean) => void; protected _visitor: VisitorAbstract; /** * Indicates whether EAI data has been collected */ protected _startCollectingEAIDataTimestamp: number; constructor({ httpClient, sdkConfig, eAIConfig }: ConstructorParam); init(visitor: VisitorAbstract): void; onEAICollectStatusChange(callback: (status: boolean) => void): void; get EAIScore(): EAIScore | undefined; get EAIScoreChecked(): boolean; abstract cleanup(): void; protected setIsEAIDataCollected(isCollected: boolean): Promise; protected isEAIDataCollected(): Promise; protected sendEAIScoreTroubleshooting(eAIScore?: EAIScore, endpoint?: string): void; protected sendRequestTroubleshooting(response: IHttpResponse, label: TroubleshootingLabel, endpoint?: string, method?: string, apiKeys?: Record, eAIScore?: EAIScore): void; protected sendRequestTroubleshootingError(error: HttpError, label: TroubleshootingLabel, endpoint?: string, apiKeys?: Record): void; protected sendCollectingTroubleshooting(timestamp: number, label: TroubleshootingLabel, score?: EAIScore): void; protected sendCollectingUsageHit(label: TroubleshootingLabel): void; fetchEAIScore(noCache?: boolean): Promise; protected abstract startCollectingEAIData(visitorId: string, currentPage?: Omit): Promise; protected abstract removeListeners(): void; collectEAIEventsAsync(currentPage?: Omit): Promise; reportPageView(pageView: IPageView): Promise; protected sendEAIEvent(event: IVisitorEvent | IPageView): Promise; protected finalizeDataCollection(isCollected: boolean): void; protected stopCollectingEAIData(): void; reportVisitorEvent(visitorEvent: VisitorEvent): Promise; } export {};