import type * as Whop from "../../../../index.js"; /** * @example * { * account_id: "biz_xxxxxxxxxxxxxx", * flag_key: "checkout_redesign_v2" * } */ export interface CreateExperimentsRequest { /** Owning account ID. Required; ownership cannot change. */ account_id: string; /** Randomization unit, and the only identity the assignment is keyed on — evaluation fails rather than falling back to another. `user` (default) uses `subject[user_id]`; `account` uses `subject[account_id]`, so every user of an account gets the same arm; `anonymous` uses the anonymous id and survives sign-in. Fixed after creation. */ bucket_by?: CreateExperimentsRequest.BucketBy; control?: CreateExperimentsRequest.Control; /** When `true`, creates a binary feature flag rather than a full experiment. Feature flags expose the same evaluation API but do not collect metric results. Defaults to `false`. */ feature_flag_only?: boolean; /** Developer-chosen handle referenced from code, used in evaluation and results calls. Interchangeable with the returned `expt_` id anywhere the API takes an experiment identifier. */ flag_key: string; /** Required for full experiments; rejected on feature flags. Structure it as "If we [change] for [cohort], then [measurable behavior] will [increase/decrease], resulting in [business outcome], because [evidence]. Created by [name]." Evidence should be something real — a baseline number, a funnel breakdown — not a guess, and [name] is you, not something to leave blank. */ hypothesis?: string | null; /** Human-readable display name. Defaults to `flag_key` when omitted. */ 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; /** Rules that determine which subjects qualify for the experiment. */ targeting_rules?: CreateExperimentsRequest.TargetingRules.Item[]; /** Treatment arms to create. Users outside every arm form the implicit `control` group. Required unless `feature_flag_only` is `true`. */ variants?: CreateExperimentsRequest.Variants.Item[]; } export declare namespace CreateExperimentsRequest { /** Randomization unit, and the only identity the assignment is keyed on — evaluation fails rather than falling back to another. `user` (default) uses `subject[user_id]`; `account` uses `subject[account_id]`, so every user of an account gets the same arm; `anonymous` uses the anonymous id and survives sign-in. Fixed after creation. */ 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; } type TargetingRules = TargetingRules.Item[]; namespace TargetingRules { interface Item { /** Conditions within this rule. Must be non-empty. All conditions must be satisfied for the rule to match (AND logic). Rules are OR-ed together. */ conditions: Item.Conditions.Item[]; /** `include` — users matching this rule qualify; `exclude` — users matching this rule are always excluded, overriding any include rule. Defaults to `include`. */ type?: Item.Type | undefined; } namespace Item { type Conditions = Conditions.Item[]; namespace Conditions { interface Item { /** Property name to read from the user context. Required when `type` is `property`. */ field?: (string | null) | undefined; /** Comparison to apply: `any`/`none` — inclusion/exclusion list; `eq`/`neq` — equality; `gt`/`gte`/`lt`/`lte` — numeric range. */ operator: Item.Operator; /** `user_id` — match on subject user ID; `account_id` — match on account ID (prefixed `biz_`); `property` — match on a named user property (requires `field`). */ type: Item.Type; value?: unknown | undefined; } namespace Item { /** Comparison to apply: `any`/`none` — inclusion/exclusion list; `eq`/`neq` — equality; `gt`/`gte`/`lt`/`lte` — numeric range. */ 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]; /** `user_id` — match on subject user ID; `account_id` — match on account ID (prefixed `biz_`); `property` — match on a named user property (requires `field`). */ 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. Defaults to `include`. */ 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 for the implicit remainder. */ name: string; related_resource?: Whop.ExperimentResourceReference | undefined; /** Percentage of all subjects assigned to this treatment. The remainder is control. */ weight: number; } } }