Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Latest
interface IFlagshipConfig
import { type IFlagshipConfig } from "https://deno.land/x/flagship_io_js_sdk@4.0.1/config/IFlagshipConfig.ts";

Represents the configuration options for the Flagship SDK.

Properties

optional
envId: string

The environment ID provided by Flagship.

optional
apiKey: string

The secure API key provided by Flagship.

optional
timeout: number

The timeout in seconds for API requests.

Default value is 2 seconds.

optional
logLevel: LogLevel

The maximum log level to display.

optional
decisionMode: DecisionMode

The SDK running mode. Can be "BUCKETING", "DECISION_API" or "BUCKETING_EDGE".

optional
onSdkStatusChanged: (status: FSSdkStatus) => void

A callback function to be called when the SDK status has changed.

optional
logManager: IFlagshipLogManager

A custom implementation of the LogManager interface to receive logs from the SDK.

optional
fetchNow: boolean

Determines whether to automatically fetch modification data when creating a new FlagshipVisitor.

optional
pollingInterval: number

Bucketing mode only

The delay in seconds between two bucketing polling requests.

If 0 is given, it will only poll once at start time.

Default value is 5 seconds.

optional
fetchThirdPartyData: boolean

Bucketing mode only

If true, the SDK will fetch the visitor's segment from the universal data connector each time fetchFlags is called and append those segments in the visitor context.

optional
reuseVisitorIds: boolean

client-side only

If true, the SDK will save the visitor ID and/or anonymous ID in the local storage and reuse it for the next session if visitorId is not set, to maintain cross-session visitor experience.

Default value is true.

optional
onBucketingSuccess: (param: { status: number; payload?: BucketingDTO; }) => void

A callback function to be called when the first bucketing polling succeeds.

optional
onBucketingFail: (error: Error) => void

A callback function to be called when the first bucketing polling fails.

optional
onBucketingUpdated: (lastUpdate: Date) => void

A callback function to be called each time bucketing data from Flagship has been updated.

optional
initialBucketing: BucketingDTO

An object containing the data received when fetching the bucketing endpoint. Providing this object will make bucketing ready to use and the first polling will immediately check for updates.

optional
decisionApiUrl: string

The URL of the decision API.

optional
hitDeduplicationTime: number

The delay in seconds for hit deduplication. After a hit is sent, any future attempts to send the same hit will be blocked until the specified delay has expired. If a value of 0 is given, no deduplication process will be used.

optional
visitorCacheImplementation: IVisitorCacheImplementation

An object that implements the IVisitorCacheImplementation interface to handle the visitor cache.

optional
hitCacheImplementation: IHitCacheImplementation

An object that implements the IHitCacheImplementation interface to manage hits cache.

optional
disableCache: boolean

If set to true, hit cache and visitor cache will be disabled; otherwise, they will be enabled.

optional
language: 0 | 1 | 2
optional
trackingManagerConfig: ITrackingManagerConfig

Options to configure hit batching.

optional
onVisitorExposed: (arg: OnVisitorExposed) => void

A callback function to be called each time a flag is exposed to a visitor (i.e., when an activation hit is sent by the SDK).

optional
sdkVersion: string
optional
onLog: (
level: LogLevel,
tag: string,
message: string,
) => void

A callback function to be called whenever the SDK needs to report a log.

optional
nextFetchConfig: Record<string, unknown>

In Next.js 13, you can define the time in seconds for storing SDK route cache before revalidation.

optional
fetchFlagsBufferingTime: number

The delay in seconds for buffering fetch flags calls. After the SDK has fetched flags, they will be buffered for the specified delay. During this delay, any subsequent fetch flags calls will return the same flags. If a value of 0 is given, no buffering process will be used. If visitor data has changed, the buffering will be bypassed.

optional
isQAModeEnabled: boolean
optional
disableDeveloperUsageTracking: boolean