/**
 * SessionMetricTracker - Real-time session-based metrics for segment targeting.
 *
 * This module tracks metrics during a user's session and updates GrowthBook
 * attributes in real-time, enabling instant segment targeting without waiting
 * for batch PostHog cohort computation.
 *
 * Use cases:
 * - "Show action plan after 3+ button clicks in this session"
 * - "Target users who viewed 5+ products this session"
 * - "Trigger intervention when user hovers a CTA 2+ times"
 */
import type { ExperimentClient } from '../experiments/types';
/**
 * Options for creating a SessionMetricTracker.
 */
export interface SessionMetricTrackerOptions {
    /**
     * The experiment client to update attributes on.
     * When a metric changes, the session_${metricKey} attribute is updated.
     */
    experiments?: ExperimentClient;
    /**
     * Prefix for attribute keys sent to GrowthBook.
     * @default "session_"
     */
    attributePrefix?: string;
    /**
     * Callback fired when any metric value changes.
     * Useful for debugging or custom integrations.
     */
    onMetricChange?: (key: string, newValue: number) => void;
}
/**
 * Tracks session-based metrics for real-time segment targeting.
 */
export declare class SessionMetricTracker {
    private metrics;
    private subscribers;
    private experiments?;
    private attributePrefix;
    private onMetricChange?;
    constructor(options?: SessionMetricTrackerOptions);
    /**
     * Increment a metric by the specified amount.
     *
     * @param metricKey - The metric to increment (e.g., "button_clicks", "page_views")
     * @param amount - Amount to increment by (default: 1)
     * @returns The new metric value
     */
    increment(metricKey: string, amount?: number): number;
    /**
     * Set a metric to a specific value.
     *
     * @param metricKey - The metric to set
     * @param value - The value to set
     */
    set(metricKey: string, value: number): void;
    /**
     * Get the current value of a metric.
     *
     * @param metricKey - The metric to get
     * @returns The current value (0 if not set)
     */
    get(metricKey: string): number;
    /**
     * Check if a metric meets or exceeds a threshold.
     *
     * @param metricKey - The metric to check
     * @param threshold - The threshold value
     * @returns True if metric >= threshold
     */
    meetsThreshold(metricKey: string, threshold: number): boolean;
    /**
     * Get all current metric values.
     *
     * @returns Record of metric keys to values
     */
    getAll(): Record<string, number>;
    /**
     * Reset a specific metric to zero.
     *
     * @param metricKey - The metric to reset
     */
    reset(metricKey: string): void;
    /**
     * Reset all metrics (clear the session).
     */
    resetAll(): void;
    subscribe(callback: () => void): () => void;
    destroy(): void;
    /**
     * Update the experiment client (useful if experiments client changes).
     */
    setExperiments(experiments: ExperimentClient): void;
    private updateExperimentAttributes;
    private syncAllToExperiments;
    private notifySubscribers;
    private loadFromStorage;
    private saveToStorage;
}
/**
 * Create a SessionMetricTracker instance.
 */
export declare function createSessionMetricTracker(options?: SessionMetricTrackerOptions): SessionMetricTracker;
