/*! * Convert JS SDK * Version 1.0.0 * Copyright(c) 2020 Convert Insights, Inc * License Apache-2.0 * * Server-side HTTP requests issued through this SDK announce themselves as * `User-Agent: ConvertAgent/1.0` (see packages/utils/src/http-client.ts). This * is an SDK invariant relied on by the metrics endpoint's isbot bypass and is * not customer- or env-configurable. */ import { ApiManagerInterface } from '../../api'; import { ContextInterface } from './interfaces/context'; import { CoreInterface } from './interfaces/core'; import { DataManagerInterface } from '../../data'; import { EventManagerInterface } from '../../event'; import { ExperienceManagerInterface } from '../../experience'; import { FeatureManagerInterface } from './interfaces/feature-manager'; import { LogManagerInterface } from '../../logger'; import { SegmentsManagerInterface } from '../../segments'; import { Config, ConfigResponseData } from '../../types'; import { SystemEvents } from '../../enums'; /** * Core * @category Main * @constructor * @implements {CoreInterface} */ export declare class Core implements CoreInterface { data: ConfigResponseData; private _dataManager; private _eventManager; private _experienceManager; private _featureManager; private _segmentsManager; private _loggerManager; private _apiManager; private _config; private _promise; private _fetchConfigTimerID; private _environment; private _initialized; /** * @param {Config} config * @param {DataManagerInterface} dependencies.dataManager * @param {EventManagerInterface} dependencies.eventManager * @param {ExperienceManagerInterface} dependencies.experienceManager * @param {FeatureManagerInterface} dependencies.featureManager * @param {SegmentsManagerInterface} dependencies.segmentsManager * @param {ApiManagerInterface} dependencies.apiManager * @param {LogManagerInterface} dependencies.loggerManager */ constructor(config: Config, { dataManager, eventManager, experienceManager, featureManager, segmentsManager, apiManager, loggerManager }: { dataManager: DataManagerInterface; eventManager: EventManagerInterface; experienceManager: ExperienceManagerInterface; featureManager: FeatureManagerInterface; segmentsManager: SegmentsManagerInterface; apiManager: ApiManagerInterface; loggerManager?: LogManagerInterface; }); /** * Initialize credentials, configData etc.. * @param config */ private initialize; /** * Create visitor context * @param {string} visitorId A visitor id * @param {Record=} visitorAttributes An object of key-value pairs that are used for audience and/or segments targeting * @return {ContextInterface | null} */ createContext(visitorId: string, visitorAttributes?: Record): ContextInterface | null; /** * Add event handler to event * @param {SystemEvents} event Event name * @param {function(args, err): void} fn A callback function which will be fired */ on(event: SystemEvents, fn: (args?: any, err?: any) => void): void; /** * Promisified ready event * @return {Promise} */ onReady(): Promise; /** * Fetch remote config data * @return {Promise} */ private fetchConfig; }