import type * as Whop from "../index.js"; export interface Experiment { /** Owning account ID. */ account_id: string; /** Assignment hashes UTF-8 seed + subject ID with CRC32 modulo 100 and selects the stored end-exclusive range. */ assignment_seed: string; /** Randomization unit — `user` buckets each user independently, `account` buckets whole accounts (every user of an account gets the same arm). `null` for feature flags. */ bucket_by?: (Experiment.BucketBy | null) | undefined; /** Revision of the serving configuration. Increments on every configuration change, so a cached definition with a lower revision is stale. Does not change the assignment seed. */ configuration_revision: number; control: Experiment.Control; /** When the experiment was created, as an ISO 8601 timestamp. */ created_at?: (string | null) | undefined; /** ID of the user who created the experiment, prefixed `user_`. `null` for experiments created before creators were recorded. */ created_by?: (string | null) | undefined; /** When the experiment stopped collecting data, as an ISO 8601 timestamp. `null` while still running. */ ended_at?: (string | null) | undefined; /** `true` when this was created as a feature flag rather than a full experiment. Feature flags share the same evaluation API but do not collect metric results. */ feature_flag_only?: (boolean | null) | undefined; /** What was learned and why this outcome, recorded when the experiment was ended. `null` until then. */ findings?: (string | null) | undefined; /** Developer-chosen handle referenced from code. Anywhere the API takes an experiment identifier, the `expt_` id and the flag_key are interchangeable. */ flag_key: string; /** Hypothesis for this experiment. `null` when none is set, and always `null` for feature flags. */ hypothesis?: (string | null) | undefined; /** Unique identifier for the experiment, prefixed `expt_`. */ id: string; /** Human-readable display name. */ name: string; /** Resource owned by the account that this experiment is bound to, such as an app or product. `null` when unbound. Fixed once the experiment first activates. */ related_resource: Whop.ExperimentResourceReference; /** When the experiment began collecting data, as an ISO 8601 timestamp. `null` for drafts. */ started_at?: (string | null) | undefined; /** Lifecycle state. `draft` — not yet live; `active` — currently running; `paused` — traffic paused; `ended` — concluded. */ status: Experiment.Status; /** Rules gating who is in the experiment at all. Conditions within a rule are AND-ed, rules are OR-ed, and `exclude` rules always win. Empty means everyone qualifies. */ targeting_rules: Experiment.TargetingRules.Item[]; updated_at: string | null; /** Treatment arms. Users outside every arm's allocation form the implicit `control` group. Weights only ever grow and arms are never removed, so a user moves from control into a treatment at most once. */ variants: Experiment.Variants.Item[]; /** The treatment that won, set when the experiment was ended. Once set, every evaluation returns this arm to every caller regardless of targeting or allocation, and no further exposures are recorded. `null` means control won — an ended experiment with no winning arm evaluates to `control` for everyone. Always `null` for feature flags, which simply evaluate to disabled once ended. */ winning_arm?: (string | null) | undefined; } export declare namespace Experiment { /** Randomization unit — `user` buckets each user independently, `account` buckets whole accounts (every user of an account gets the same arm). `null` for feature flags. */ const BucketBy: { readonly User: "user"; readonly Account: "account"; readonly Anonymous: "anonymous"; }; type BucketBy = (typeof BucketBy)[keyof typeof BucketBy]; interface Control { related_resource?: Whop.ExperimentResourceReference | undefined; } /** Lifecycle state. `draft` — not yet live; `active` — currently running; `paused` — traffic paused; `ended` — concluded. */ const Status: { readonly Draft: "draft"; readonly Active: "active"; readonly Paused: "paused"; readonly Ended: "ended"; }; type Status = (typeof Status)[keyof typeof Status]; type TargetingRules = TargetingRules.Item[]; namespace TargetingRules { interface Item { /** Conditions within this rule, all of which must match. */ conditions: Item.Conditions.Item[]; /** `include` — users matching this rule qualify; `exclude` — users matching this rule are always excluded, overriding any include rule. */ type?: Item.Type | undefined; } namespace Item { type Conditions = Conditions.Item[]; namespace Conditions { interface Item { /** Property name to read from the user context. Present when `type` is `property`. */ field?: (string | null) | undefined; /** Comparison to apply. */ operator: Item.Operator; /** What the condition matches on: the user ID, the account ID, or a named user property. */ type: Item.Type; value?: unknown | undefined; } namespace Item { /** Comparison to apply. */ const Operator: { readonly Any: "any"; readonly None: "none"; readonly Eq: "eq"; readonly Neq: "neq"; readonly Gt: "gt"; readonly Gte: "gte"; readonly Lt: "lt"; readonly Lte: "lte"; }; type Operator = (typeof Operator)[keyof typeof Operator]; /** What the condition matches on: the user ID, the account ID, or a named user property. */ const Type: { readonly UserId: "user_id"; readonly AccountId: "account_id"; readonly Property: "property"; }; type Type = (typeof Type)[keyof typeof Type]; } } /** `include` — users matching this rule qualify; `exclude` — users matching this rule are always excluded, overriding any include rule. */ const Type: { readonly Include: "include"; readonly Exclude: "exclude"; }; type Type = (typeof Type)[keyof typeof Type]; } } type Variants = Variants.Item[]; namespace Variants { interface Item { /** Treatment identifier. `control` is reserved — it is the implicit remainder. */ name: string; /** Granted bucket ranges (1% units, end-exclusive) recording this arm's allocation history. Server-managed; ranges are only ever appended, which is what keeps assignments permanent. */ ranges?: number[][] | undefined; related_resource?: Whop.ExperimentResourceReference | undefined; /** Percentage of all users assigned to this treatment, 1–100. All weights together sum to at most 100; the remainder is control. */ weight: number; } } }