/** * Remote Configuration Manager * * Handles loading, fetching, caching, and applying remote configuration * from the /decide endpoint. Supports bootstrap data for instant loading. * * Config merge precedence: client init > remote > defaults * Uses _initConfig snapshot to distinguish user-set values from cache-applied values. * * @see docs/patterns/tracker-feature-lifecycle.md */ import { VTiltConfig, RemoteConfig } from "../types"; import type { FeatureManager } from "./feature-manager"; export interface RemoteConfigHost { getConfig(): VTiltConfig; updateConfig(config: Partial): void; buildEndpointUrl(path: string): string; __loaded: boolean; featureManager: FeatureManager; } export type RemoteConfigCallback = (config: RemoteConfig) => void; export declare class RemoteConfigManager { private _host; private _remoteConfig; private _onApply?; private _onLoad?; private _initConfig; constructor(host: RemoteConfigHost); get config(): RemoteConfig | null; onApply(callback: RemoteConfigCallback): void; onLoad(callback: RemoteConfigCallback): void; /** * Load remote config from cache and fetch fresh in background. * Priority: 1) Bootstrap config 2) Window bootstrap 3) localStorage cache */ load(): void; private _fetch; /** * Apply remote config to current config. * Uses _initConfig snapshot: only values NOT set by the user in vt.init() are applied. * Feature config is mapped via FeatureManager descriptors; non-feature config is handled inline. * * @param fromCache When true, analytics / chat / privacy toggles are skipped to avoid * acting on stale localStorage data before the fresh /decide fetch resolves. * Invisible features (e.g. session recording) may still arm from cache. */ private _apply; }