Skip to main content
Go to Latest
interface IVisitor
import { type IVisitor } from "https://deno.land/x/flagship_io_js_sdk@3.0.11/visitor/index.ts";

Properties

visitorId: string
flagsData: Map<string, FlagDTO>
deprecated
modifications: Map<string, Modification>
context: Record<string, primitive>
hasConsented: boolean

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

config: IFlagshipConfig

Methods

deprecated
getModificationsArray(): FlagDTO[]
getFlagsDataArray(): FlagDTO[]

Return an array of all flags fetched for the current visitor

setConsent(hasConsented: boolean): void

Set if visitor has consented for protected data usage.

updateContext(context: Record<string, primitive>): void

Update the visitor context values, matching the given keys, used for targeting.

A new context value associated with this key will be created if there is no previous matching value.

Context keys must be String, and values types must be one of the following : Number, Boolean, String.

clearContext(): void

clear the actual visitor context

deprecated
getModification<T>(params: modificationsRequested<T>): Promise<T>

Retrieve a modification value by key. If no modification match the given key or if the stored value type and default value type do not match, default value will be returned.

getFlag<T>(key: string, defaultValue: T): IFlag<T>

Return a Flag object by its key. If no flag match the given key an empty flag will be returned.

deprecated
getModifications<T>(params: modificationsRequested<T>[], activateAll?: boolean): Promise<Record<string, T>>

Retrieve an array of modification value by keys. If no modification match the given key or if the stored value type and default value type do not match, an array of default value will be returned.

deprecated
getModificationSync<T>(params: modificationsRequested<T>): T

Retrieve a modification value by key. If no modification match the given key or if the stored value type and default value type do not match, default value will be returned.

deprecated
getModificationsSync<T>(params: modificationsRequested<T>[], activateAll?: boolean): Record<string, T>

Retrieve an array of modification value by keys. If no modification match the given key or if the stored value type and default value type do not match, an array of default value will be returned.

deprecated
getModificationInfo(key: string): Promise<FlagDTO | null>

Get the campaign modification information value matching the given key.

deprecated
getModificationInfoSync(key: string): FlagDTO | null

Get the campaign modification information value matching the given key.

deprecated
synchronizeModifications(): Promise<void>

This function calls the decision api and update all the campaigns modifications from the server according to the visitor context.

fetchFlags(): Promise<void>

This function calls the decision api and update all the campaigns modifications from the server according to the visitor context.

deprecated
activateModification(key: string): Promise<void>

Report this user has seen this modification.

deprecated
activateModifications(keys: { key: string; }[]): Promise<void>

Report this user has seen these modifications.

deprecated
activateModifications(keys: string[]): Promise<void>

Report this user has seen these modifications.

sendHit(hit: HitAbstract): Promise<void>

Send a Hit to Flagship servers for reporting.

sendHit(hit: IHit): Promise<void>
deprecated
sendHit(hit: HitShape): Promise<void>

Send a Hit to Flagship servers for reporting.

sendHits(hit: Array<HitAbstract>): Promise<void>

Send Hits to Flagship servers for reporting.

sendHits(hit: Array<IHit>): Promise<void>
deprecated
sendHits(hit: Array<HitShape>): Promise<void>

Send Hits to Flagship servers for reporting.

deprecated
getAllModifications(activate: boolean): Promise<{ visitorId: string; campaigns: CampaignDTO[]; }>

returns a Promise containing all the data for all the campaigns associated with the current visitor.

getAllFlagsData(activate: boolean): Promise<{ visitorId: string; campaigns: CampaignDTO[]; }>

returns a Promise containing all the data for all the campaigns associated with the current visitor.

deprecated
getModificationsForCampaign(campaignId: string, activate: boolean): Promise<{ visitorId: string; campaigns: CampaignDTO[]; }>

Get data for a specific campaign.

getFlatsDataForCampaign(campaignId: string, activate: boolean): Promise<{ visitorId: string; campaigns: CampaignDTO[]; }>

Get data for a specific campaign.

authenticate(visitorId: string): void

Authenticate anonymous visitor

unauthenticate(): void

This function change authenticated Visitor to anonymous visitor