import { G as FlagResult, u as FlagContext } from '../types-DdEZ8iqq.mjs'; import './metrics.mjs'; import './flag-types.mjs'; interface ExposureTrackerConfig { /** * Time window in milliseconds within which duplicate impressions are suppressed. * @default 60_000 (1 minute) */ windowMs?: number; /** * Max entries in the dedup cache. When exceeded, oldest entries are evicted. * @default 10_000 */ maxEntries?: number; /** * Which fields to include in the dedup key. Default: flag key + user ID + value. */ keyFields?: Array<"flagKey" | "userId" | "value" | "variant" | "reason">; } interface ExposureTracker { /** Check if this evaluation should be tracked (returns false if duplicate). */ shouldTrack(result: FlagResult, context: FlagContext): boolean; /** Manually mark an evaluation as tracked. */ mark(result: FlagResult, context: FlagContext): void; /** Get count of tracked (deduplicated) impressions. */ stats(): ExposureStats; /** Reset all tracking state. */ reset(): void; } interface ExposureStats { totalEvaluations: number; uniqueImpressions: number; duplicatesSuppressed: number; cacheSize: number; } /** * Create an exposure tracker for deduplicating flag evaluation impressions. * * ```ts * const tracker = createExposureTracker({ windowMs: 60_000 }) * // In hooks: * if (tracker.shouldTrack(result, context)) { * // Record impression * } * ``` */ declare function createExposureTracker(config?: ExposureTrackerConfig): ExposureTracker; export { type ExposureStats, type ExposureTracker, type ExposureTrackerConfig, createExposureTracker };