import { ExperimentVariantName } from '.'; import { PercentageOutOfOne, Service } from '..'; import { UserId, UserRole } from '../user'; import { ExperimentVariant, ExperimentVariantValue } from './ExperimentVariant'; export interface Experiment { /** ID is equal to service.name */ id: ExperimentId; /** The service this experiment applies to. If it appliest to multiple, use the most relevant service. */ service: Service; /** The name of the experiment: lowercase and separated by dashes. (i.e. api.use-sentiment) */ name: string; /** Is the experiment currently running? If not, return the default value or null. */ isActive: boolean; /** The default value, if a user has not yet been placed in a variant. */ defaultValue?: ExperimentVariantValue; /** * If present, a user exposed to this experiment will be automatically placed in the variant if the user's * role matches. Useful for gating features based on a user's role. Takes precedence over overrideValue. */ overrideRole?: ExperimentOverrideRole; /** Returns this value for all users if present, regardless of variants. */ overrideValue?: ExperimentVariantValue; /** Different groups of users with different values for this experiment. */ variants?: ExperimentVariant[]; /** Which user created this experiment? */ creator?: UserId; /** List of experimentees, defined as a collection in the backend. */ experimentees?: UserId[]; /** A percentage between 0 and 1 denoting what % of the user population is exposed to this experiment. */ rolloutPct?: PercentageOutOfOne; /** Automatically mark exposure for participants? */ autoMarkExposure?: boolean; } export declare type ExperimentId = string; export declare type ExperimentOverrideRole = Partial<{ [role in UserRole]: ExperimentVariantName; }>;