import DynamicConfig from './DynamicConfig'; import Layer, { LogParameterFunction } from './Layer'; import StatsigIdentity from './StatsigIdentity'; import { StatsigUser } from './StatsigUser'; export declare enum EvaluationReason { Network = "Network", Bootstrap = "Bootstrap", InvalidBootstrap = "InvalidBootstrap", Cache = "Cache", Unrecognized = "Unrecognized", Uninitialized = "Uninitialized", Error = "Error", NetworkNotModified = "NetworkNotModified", LocalOverride = "LocalOverride" } export type EvaluationDetails = { time: number; reason: EvaluationReason; }; type APIFeatureGate = { name: string; value: boolean; rule_id: string; secondary_exposures?: string[] | Record[]; }; export type StoreGateFetchResult = { gate: APIFeatureGate; evaluationDetails: EvaluationDetails; }; export type BootstrapMetadata = { generatorSDKInfo?: Record; lcut?: number; user?: Record; }; type DefaultValueFallbackFunc = (user: StatsigUser | null, message: string, metadata: object) => void; export default class StatsigStore { private _identity; private _loaded; private _values; private _userValues; private _userCacheKey; private _reason; private readonly _onDefaultValueFallback; constructor(identity: StatsigIdentity, onDefaultValueFallback: DefaultValueFallbackFunc, initializeValues: Record | null); updateUser(): number | null; bootstrap(initializeValues: Record): void; getBootstrapMetadata(): BootstrapMetadata | null; isLoaded(): boolean; getLastUpdateTime(user: StatsigUser | null): number | null; getPreviousDerivedFields(user: StatsigUser | null): Record | undefined; setEvaluationReason(evalReason: EvaluationReason): void; save(user: StatsigUser | null, jsonConfigs: Record, updateState?: boolean): Promise; checkGate(gateName: string): StoreGateFetchResult; mapExposures(exposures: Record[] | string[]): Record[]; getConfig(configName: string): DynamicConfig; getLayer(logParameterFunction: LogParameterFunction | null, layerName: string): Layer; getGlobalEvaluationDetails(): EvaluationDetails; private _loadFromLocalStorage; private _parseCachedValues; private _setUserValueFromCache; private _removeFromStorage; /** * Merges the provided init configs into the provided config map, according to the provided merge function */ private _mergeInitializeResponseIntoUserMap; private _getDefaultUserCacheValues; /** * Writes the provided values to storage, truncating down to * MAX_USER_VALUE_CACHED number entries. * @returns The truncated entry list */ private _writeValuesToStorage; private _getLatestValue; private _createDynamicConfig; private _getEvaluationDetails; private _resetUserValues; private _convertAPIDataToCacheValues; private _makeOnConfigDefaultValueFallback; } export {};