@omniconvert/server-side-testing-sdk
Version:
TypeScript SDK for server-side A/B testing and experimentation
136 lines • 3.74 kB
TypeScript
import { HttpClientInterface } from '../http/HttpClientInterface';
import { StorageFacadeInterface } from '../storage/interfaces/StorageFacadeInterface';
import { DecisionManager } from '../services/DecisionManager';
import { Tracker } from '../services/Tracker';
import { Context } from '../entities/context/Context';
import { Decision } from '../entities/Decision';
import { User } from '../entities/User';
import { UserProviderFactory } from '../factories/UserProviderFactory';
import { ClientConfig } from '../types';
import { BrowserLogger } from '../logger/BrowserLogger';
/**
* Main ExploreClient class - Primary SDK interface
* Provides unified access to A/B testing functionality
*/
export declare class ExploreClient {
private storage;
private httpClient;
private userProvider;
private decisionManager;
private tracker;
private config;
private lastDecisions;
private logger;
constructor(config: ClientConfig);
/**
* Initialize the client by fetching experiments
*/
private initialize;
/**
* Refresh experiments if needed based on various conditions
*/
private refreshExperiments;
/**
* Fetch and update experiments and related settings
*/
private fetchAndUpdateExperiments;
/**
* Fetch experiments from the API and store them
*/
fetchAndStoreExperimentsConfig(): Promise<boolean>;
/**
* Make experiment decisions for the given context
*/
decide(context: Context, experimentKey?: string): Decision[];
/**
* Auto-track page view and variation view
*/
private autoTrack;
/**
* Get the website ID
*/
getWebsiteId(): string;
/**
* Get experiments configuration
*/
getExperimentsConfig(): unknown[];
/**
* Get the tracker instance
*/
getTracker(): Tracker;
/**
* Get the decision manager instance
*/
getDecisionManager(): DecisionManager;
/**
* Get the last decisions made
*/
getLastDecisions(): Decision[];
/**
* Get the current user
*/
getUser(): User | undefined;
/**
* Get the storage facade
*/
getStorage(): StorageFacadeInterface;
/**
* Get the HTTP client
*/
getHttpClient(): HttpClientInterface;
/**
* Get the user provider
*/
getUserProvider(): UserProviderFactory;
/**
* Get client configuration
*/
getConfig(): ClientConfig;
/**
* Force refresh experiments (ignore cache)
*/
forceRefreshExperiments(): Promise<boolean>;
/**
* Check if the client is properly initialized
*/
isInitialized(): boolean;
/**
* Get storage information
*/
getStorageInfo(): {
used: number;
total: number;
available: number;
};
/**
* Clear all data (experiments, user data, etc.)
*/
clearAllData(): void;
/**
* Clear cached experiments to force fresh fetch from API
* This is useful when experiment configurations have changed on the server
* or when there are issues with cached experiment data
*/
clearExperimentsCache(): void;
/**
* Update user activity (call this on user interactions)
*/
updateUserActivity(): void;
/**
* Get SDK version
*/
static getVersion(): string;
/**
* Check if the SDK is running in a browser environment
*/
static isBrowser(): boolean;
/**
* Get logs from the logger (similar to PHP's LoggedDumper::getLogs())
*/
getLogs(): import('../logger/BrowserLogger').LogEntry[];
/**
* Get the logger instance
*/
getLogger(): BrowserLogger;
}
//# sourceMappingURL=ExploreClient.d.ts.map