import { type Readable } from 'svelte/store'; /** * The state of an A/B experiment for the current session. */ export type ExperimentState = { /** * The variant assigned to this session. Until assignment resolves (and on * the server, or when analytics is disabled), this is the first variant — * treat the first variant as the control. */ variant: Readable; /** * `true` once the variant has been deterministically assigned and its * exposure recorded. Useful to defer rendering when a flash of the control * variant is not acceptable. */ isAssigned: Readable; }; /** * Assigns this session to a variant of an A/B experiment and records the * exposure, scoped to `experimentKey`, so the backend can compute per-variant * conversion rates against `useConversion` events. * * Assignment is deterministic per session (no server round-trip, stable across * re-mounts). The exposure is recorded once per mount. * * @param experimentKey - Unique key identifying the experiment. * @param variants - The candidate variant names; the first one is the control. * @param weights - Optional relative weights, one per variant (e.g. `[9, 1]`). * @returns The {@link ExperimentState} for this session. * * @example * ```svelte * * ``` */ export declare const useExperiment: (experimentKey: string, variants: string[], weights?: number[]) => ExperimentState;