Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
class VisitorAbstract
implements IVisitor
extends EventEmitter
Abstract
import { VisitorAbstract } from "https://deno.land/x/flagship_io_js_sdk@3.2.3/visitor/VisitorAbstract.ts";

Constructors

new
VisitorAbstract(param: NewVisitor & { visitorId?: string; configManager: IConfigManager; context: Record<string, primitive>; })

Properties

protected
_anonymousId: string | null
protected
_campaigns: CampaignDTO[]
protected
_configManager: IConfigManager
protected
_context: Record<string, primitive>
protected
_flags: Map<string, FlagDTO>
protected
_hasConsented: boolean
protected
_isCleaningDeDuplicationCache: boolean
protected
_visitorId: string
anonymousId: string | null
campaigns: CampaignDTO[]
readonly
config: IFlagshipConfig
readonly
configManager: IConfigManager
context: Record<string, primitive>

Clear the current context and set a new context value

deDuplicationCache: Record<string, number>
flagsData: Map<string, FlagDTO>
hasConsented: boolean

Return True or False if the visitor has consented for protected data usage.

modifications: Map<string, Modification>
optional
visitorCache: VisitorCacheDTO
visitorId: string

Methods

protected
generateVisitorId(): string
protected
setInitialFlags(modifications?: Map<string, FlagDTO> | FlagDTO[]): void
protected
setInitializeCampaigns(campaigns?: CampaignDTO[], hasModifications?: boolean): void
protected
updateCache(): void
abstract
activateModification(key: string): Promise<void>
abstract
activateModifications(keys: { key: string; }[]): Promise<void>
abstract
activateModifications(keys: string[]): Promise<void>
abstract
activateModifications(params: Array<{ key: string; }> | Array<string>): Promise<void>
abstract
authenticate(visitorId: string): void
abstract
clearContext(): void
clearDeDuplicationCache(deDuplicationTime: number): void
abstract
fetchFlags(): Promise<void>
abstract
getAllFlagsData(activate: boolean): Promise<{ visitorId: string; campaigns: CampaignDTO[]; }>
abstract
getAllModifications(activate: boolean): Promise<{ visitorId: string; campaigns: CampaignDTO[]; }>
abstract
getFlag<T>(key: string, defaultValue: T): IFlag<T>
abstract
getFlagMetadata(param: { metadata: IFlagMetadata; key?: string; hasSameType: boolean; }): IFlagMetadata
abstract
getFlagValue<T>(param: { key: string; defaultValue: T; flag?: FlagDTO; userExposed?: boolean; }): T
abstract
getFlatsDataForCampaign(campaignId: string, activate: boolean): Promise<{ visitorId: string; campaigns: CampaignDTO[]; }>
abstract
getModification<T>(params: modificationsRequested<T>): Promise<T>
abstract
getModificationInfo(key: string): Promise<Modification | null>
abstract
getModificationInfoSync(key: string): Modification | null
abstract
getModifications<T>(params: modificationsRequested<T>[], activateAll?: boolean): Promise<Record<string, T>>
abstract
getModificationsForCampaign(campaignId: string, activate: boolean): Promise<{ visitorId: string; campaigns: CampaignDTO[]; }>
abstract
getModificationsSync<T>(params: modificationsRequested<T>[], activateAll?: boolean): Record<string, T>
abstract
sendHit(hit: HitAbstract): Promise<void>
abstract
sendHit(hit: IHit): Promise<void>
abstract
sendHit(hit: HitShape): Promise<void>
abstract
sendHit(hit: IHit | HitAbstract | HitShape): Promise<void>
abstract
sendHits(hit: HitAbstract[]): Promise<void>
abstract
sendHits(hit: IHit[]): Promise<void>
abstract
sendHits(hit: HitShape[]): Promise<void>
abstract
sendHits(hit: HitAbstract[] | IHit[] | HitShape[]): Promise<void>
setConsent(hasConsented: boolean): void

Set if visitor has consented for protected data usage.

abstract
synchronizeModifications(): Promise<void>
abstract
unauthenticate(): void
abstract
updateContext(key: string, value: primitive): void
abstract
updateContext(context: Record<string, primitive>): void
abstract
updateContext(context: Record<string, primitive> | string, value?: primitive): void
abstract
visitorExposed<T>(param: { key: string; flag?: FlagDTO; defaultValue: T; }): Promise<void>