UNPKG

@flagship.io/js-sdk

Version:
49 lines (48 loc) 2.64 kB
import { type IFlagshipConfig } from '../config/IFlagshipConfig'; import { type IHttpClient } from '../utils/HttpClient'; import { BatchingCachingStrategyAbstract } from './BatchingCachingStrategyAbstract'; import { HitCacheDTO, TroubleshootingData } from '../types'; import { ITrackingManager } from './ITrackingManager'; import { type Troubleshooting } from '../hit/Troubleshooting'; import { type UsageHit } from '../hit/UsageHit'; import { ISharedActionTracking } from '../sharedFeature/ISharedActionTracking'; import { ActivateConstructorParam } from '../type.local'; import { type HitAbstract } from '../hit/HitAbstract'; export declare const LOOKUP_HITS_JSON_ERROR = "JSON DATA must be an array of object"; export declare const LOOKUP_HITS_JSON_OBJECT_ERROR = "JSON DATA must fit the type HitCacheDTO"; export declare abstract class TrackingManagerAbstract implements ITrackingManager { private _httpClient; private _config; private _hitsPoolQueue; private _activatePoolQueue; private _troubleshootingQueue; protected _analyticHitQueue: Map<string, UsageHit>; protected strategy: BatchingCachingStrategyAbstract; protected _intervalID: any; protected _isPooling: boolean; private _flagshipInstanceId?; private _initTroubleshootingHit?; private _sharedActionTracking?; get initTroubleshootingHit(): Troubleshooting | undefined; set initTroubleshootingHit(v: Troubleshooting | undefined); get flagshipInstanceId(): string | undefined; get troubleshootingData(): TroubleshootingData | undefined; set troubleshootingData(v: TroubleshootingData | undefined); constructor(httpClient: IHttpClient, config: IFlagshipConfig, flagshipInstanceId?: string, sharedActionTracking?: ISharedActionTracking); protected initStrategy(): BatchingCachingStrategyAbstract; get httpClient(): IHttpClient; get config(): IFlagshipConfig; abstract addHit(hit: HitAbstract): Promise<void>; abstract activateFlag(hit: ActivateConstructorParam): Promise<void>; abstract sendBatch(): Promise<void>; sendTroubleshootingHit(hit: Troubleshooting): Promise<void>; startBatchingLoop(): void; stopBatchingLoop(): void; protected batchingLoop(): Promise<void>; protected checkLookupHitData(item: HitCacheDTO): boolean; protected extractHitData(key: string, item: HitCacheDTO): Promise<HitAbstract | undefined>; protected processCachedHits(hitsCache: Record<string, HitCacheDTO>): Promise<void>; lookupHits(): Promise<void>; sendUsageHit(hit: UsageHit): Promise<void>; addTroubleshootingHit(hit: Troubleshooting): Promise<void>; }