import { Attributes } from '@eppo/js-client-sdk-common'; import { AttributeType } from '@eppo/js-client-sdk-common'; import { BanditActions } from '@eppo/js-client-sdk-common'; import { BanditSubjectAttributes } from '@eppo/js-client-sdk-common'; import { ContextAttributes } from '@eppo/js-client-sdk-common'; import { EppoAssignmentLogger } from '@eppo/js-client-sdk-common'; import { EppoClient } from '@eppo/js-client-sdk-common'; import { EventDispatcher } from '@eppo/js-client-sdk-common'; import { IAssignmentDetails } from '@eppo/js-client-sdk-common'; import { IAssignmentEvent } from '@eppo/js-client-sdk-common'; import { IAssignmentLogger } from '@eppo/js-client-sdk-common'; import { IBanditEvent } from '@eppo/js-client-sdk-common'; import { IBanditLogger } from '@eppo/js-client-sdk-common'; export { Attributes } export { AttributeType } export { BanditActions } export { BanditSubjectAttributes } export { ContextAttributes } export { EppoAssignmentLogger } /** * Returns the current bandits configuration as a JSON string. * This can be used together with getFlagsConfiguration() to bootstrap * another SDK instance using offlineInit(). * * @returns JSON string containing the bandits configuration * @public */ export declare function getBanditsConfiguration(): string; /** * Reconstructs the current flags configuration as a JSON string. * This can be used to bootstrap another SDK instance using offlineInit(). * * @returns JSON string containing the flags configuration, or null if not initialized * @public */ export declare function getFlagsConfiguration(): string | null; /** * Used to access a singleton SDK client instance. * Use the method after calling init() to initialize the client. * @returns a singleton client instance or throws an Error if init() has not been called */ export declare function getInstance(): EppoClient; export { IAssignmentDetails } export { IAssignmentEvent } export { IAssignmentLogger } export { IBanditEvent } export { IBanditLogger } /** * Configuration used for initializing the Eppo client * @public */ export declare interface IClientConfig { /** Eppo SDK key */ apiKey: string; /** * Base URL of the Eppo API. * Clients should use the default setting in most cases. */ baseUrl?: string; /** Provide a logging implementation to send variation assignments to your data warehouse. */ assignmentLogger: IAssignmentLogger; /** Logging implementation to send bandit actions to your data warehouse */ banditLogger?: IBanditLogger; /** Timeout in milliseconds for the HTTPS request for the experiment configuration. (Default: 5000) */ requestTimeoutMs?: number; /** * Number of additional times the initial configuration request will be attempted if it fails. * This is the request servers typically synchronously wait for completion. A small wait will be * done between requests. (Default: 1) */ numInitialRequestRetries?: number; /** * Number of additional times polling for updated configurations will be attempted before giving up. * Polling is done after a successful initial request. Subsequent attempts are done using an exponential * backoff. (Default: 7) */ numPollRequestRetries?: number; /** Throw error if unable to fetch an initial configuration during initialization. (default: true) */ throwOnFailedInitialization?: boolean; /** Poll for new configurations even if the initial configuration request failed. (default: false) */ pollAfterFailedInitialization?: boolean; /** * Poll for new configurations (every `pollingIntervalMs`) after successfully requesting the initial configuration. (default: true) * For server-side applications, this defaults to true to ensure configurations stay up-to-date for the life of the process. */ pollAfterSuccessfulInitialization?: boolean; /** Amount of time in milliseconds to wait between API calls to refresh configuration data. Default of 30_000 (30s). */ pollingIntervalMs?: number; /** * Configuration settings for the event dispatcher. * @deprecated Eppo has discontinued eventing support. Event tracking will be handled by Datadog SDKs. */ eventTracking?: { /** Maximum number of events to send per delivery request. Defaults to 1000 events. */ batchSize?: number; /** Number of milliseconds to wait between each batch delivery. Defaults to 10 seconds. */ deliveryIntervalMs?: number; /** Whether to enable event tracking. Defaults to false. */ enabled?: boolean; /** * Maximum number of events to queue in memory before starting to drop events. * Note: This is only used if localStorage is not available. * Defaults to 10000 events. */ maxQueueSize?: number; /** Maximum number of retry attempts before giving up on a batch delivery. Defaults to 3 retries. */ maxRetries?: number; /** Maximum amount of milliseconds to wait before retrying a failed delivery. Defaults to 30 seconds. */ maxRetryDelayMs?: number; /** Minimum amount of milliseconds to wait before retrying a failed delivery. Defaults to 5 seconds */ retryIntervalMs?: number; }; } /** * Initializes the Eppo client with configuration parameters. * This method should be called once on application startup. * After invocation of this method, the SDK will poll Eppo API at regular intervals to retrieve assignment configurations. * @param config client configuration * @public */ export declare function init(config: IClientConfig): Promise; /** * Configuration used for offline initialization of the Eppo client. * Offline initialization allows the SDK to be used without making any network requests. * @public */ export declare interface IOfflineClientConfig { /** * The full flags configuration JSON string as returned by the Eppo API. * This should be the complete response from the /flag-config/v1/config endpoint. * * Expected format: * ```json * { * "createdAt": "2024-04-17T19:40:53.716Z", * "format": "SERVER", * "environment": { "name": "production" }, * "flags": { ... } * } * ``` */ flagsConfiguration: string; /** * Optional bandit models configuration JSON string as returned by the Eppo API. * This should be the complete response from the bandit parameters endpoint. * * Expected format: * ```json * { * "updatedAt": "2024-04-17T19:40:53.716Z", * "bandits": { ... } * } * ``` */ banditsConfiguration?: string; /** * Optional assignment logger for sending variation assignments to your data warehouse. * Required for experiment analysis. */ assignmentLogger?: IAssignmentLogger; /** Optional bandit logger for sending bandit actions to your data warehouse */ banditLogger?: IBanditLogger; /** * Whether to throw an error if initialization fails. (default: true) * If false, the client will be initialized with an empty configuration. */ throwOnFailedInitialization?: boolean; } /** * @deprecated Eppo has discontinued eventing support. Event tracking will be handled by Datadog SDKs. */ export declare const NO_OP_EVENT_DISPATCHER: EventDispatcher; /** * Initializes the Eppo client in offline mode with a provided configuration. * This method is synchronous and does not make any network requests. * Use this when you want to initialize the SDK with a previously fetched configuration. * @param config offline client configuration containing flag configurations as JSON strings * @returns the initialized client instance * @public */ export declare function offlineInit(config: IOfflineClientConfig): EppoClient; export { }