import { a as FeatureManagementParameterStore, c as FeatureManagementRedactedUserInfo, i as FeatureManagementLayer, l as FeatureManagementUserUpdate, n as FeatureManagementExperiment, o as FeatureManagementParameterStoreEvaluationOptions, r as FeatureManagementGate, s as FeatureManagementReadStatus, t as FeatureManagementEventMetadata } from "./IFeatureManagementCapability-De8wpbGh.js"; //#region src/integrations/feature-management/featureManagement.d.ts /** * Name of the shared Statsig parameter store fronting SDK-module * experiments that need mutual exclusion. Callers read only this store via * {@link getFeatureParameterStore} (or the UI's `useFeatureManagement`) — * each param is wired, in the Statsig console, to a Layer's param, which in * turn delegates to the individual Experiment; the Layer guarantees at most * one experiment sharing it is ever allocated for a given user, so callers * reading different experiments from different surfaces don't need to * coordinate that themselves. See the ID module's `useIdExperiment` * (`packages/ui/src/modules/id/experiments/`) for the reference * integration. */ declare const ONBOARDING_WEB_SDK_PARAMETER_STORE = "onboarding_web_sdk_ps"; /** * Subscribes to changes in the FeatureManagement user identity (readiness * settling, `updateFeatureManagementUser`, or `resetFeatureManagement`). * Returns an unsubscribe function. Intended for UI to re-read * gates/experiments/layers whenever the shared identity changes, no matter * which caller triggered the change — see `getFeatureManagementVersion`. */ declare function subscribeFeatureManagement(listener: () => void): () => void; /** * Monotonically increasing revision of the FeatureManagement user identity. * Pair with {@link subscribeFeatureManagement} (e.g. via * `useSyncExternalStore`) to force a re-read after any identity change. * The number itself carries no meaning beyond "has this changed since my * last read". */ declare function getFeatureManagementVersion(): number; /** * Resolves once feature-management boot for the current SDK lifecycle has * settled. */ declare function getIsFeatureManagementInitialized(): Promise; /** * Merges additional randomization-unit custom IDs (and, optionally, * analytics/targeting-only `custom` attributes) into the active * FeatureManagement user and re-evaluates. * * `flow_id` is populated from the flow response before `getFlow` resolves; * `workflow_id` is populated from the workflow configuration before * `loadWorkflow` resolves. `custom` lets callers enrich identity with * attributes discovered later in the session (e.g. a backend-driven flag) * without needing a randomization unit — unlike `customIDs`, `custom` * values never bucket experiments, only affect targeting conditions and * event annotation. * * `undefined` values in `customIDs` are dropped before merging — they mean * "not yet known", never "clear this ID". No-op when every `customIDs` * value is `undefined` and no `custom` is supplied, or when * `initializeFeatureManagement` was never called (or failed). */ declare function updateFeatureManagementUser(update: FeatureManagementUserUpdate): Promise; /** Evaluates a feature gate. Returns a fallback-only result before initialization. */ declare function getFeatureGate(name: string): FeatureManagementGate; /** Evaluates an experiment. Returns a fallback-only result before initialization. */ declare function getExperiment(name: string): FeatureManagementExperiment; /** Evaluates a layer. Returns a fallback-only result before initialization. Exposure is logged natively per-parameter on `.get()`. */ declare function getLayer(name: string): FeatureManagementLayer; /** Evaluates a parameter store. Returns a fallback-only result before initialization. Exposure is logged natively for the mapped source on `.get()`. */ declare function getFeatureParameterStore(name: string, options?: FeatureManagementParameterStoreEvaluationOptions): FeatureManagementParameterStore; /** Evaluates a dynamic config. Returns `null` before initialization or if the config is unknown. */ declare function getFeatureDynamicConfig(name: string): Record | null; /** * Logs a custom analytics event to the FeatureManagement provider. No-op * before initialization. * * `type: 'scheduled'` (default) batches the event with the underlying * SDK's normal flush cadence. `type: 'immediate'` logs then flushes right * away — use for events that must reach the backend even if the page is * about to unload (e.g. a one-time experiment-assignment event). */ declare function logEvent(name: string, value?: string | number, options?: { metadata?: FeatureManagementEventMetadata; type?: 'scheduled' | 'immediate'; }): void; //#endregion //#region src/integrations/feature-management/experiments.d.ts /** * Statsig object payload: declared params live at the root; `analytics` is * an optional, code-unvalidated block spread verbatim into the * `experimentsAssigned` event. Presence of a non-empty `analytics` record is * the only reportability signal — there is no `schema`/`status`/`arm` * discriminator. */ type ExperimentTransport = { analytics?: Record; } & Record; type ExperimentSpec

= { storeParam: string; defaults: P; parseParams(raw: Record): Partial

; }; /** * Verbatim copy of the console-supplied `analytics` block. Only `flagKey` * (used elsewhere for reporting identity) is conventionally present — no * field here is required or validated by the SDK. */ type ExperimentAssignedPayload = Record; type ResolvedExperiment

= { params: P; /** * Null when not reportable: `analytics` absent/empty on the console * payload, not allocated (`{}`), unavailable, or the * `experiment_assigned_analytics_event` gate is off. */ assignment: ExperimentAssignedPayload | null; }; type ResolveExperimentOptions = { /** When omitted, a fresh store read is performed with exposure suppressed. */ store?: FeatureManagementParameterStore; }; /** * Non-null fallback compared by reference. A `null` code fallback disables * Statsig's type validation, so `undefined`/`null` can never be used here. * The `__unavailable` marker exists purely for debuggability: a genuinely * not-allocated console payload is an empty object `{}`, which is otherwise * indistinguishable from this sentinel by inspection (both resolve to code * defaults with no assignment — the reference check is what actually * matters at runtime). */ declare const EXPERIMENT_UNAVAILABLE_SENTINEL: Readonly<{ __unavailable: true; }>; /** * Resolves an object-shaped experiment param with exposure suppressed (phase 1). * Pass `store` when the caller already holds a reactive parameter-store handle * (UI hooks) so the read logs exposure through that handle instead. */ declare function resolveExperiment

(spec: ExperimentSpec

, options?: ResolveExperimentOptions): ResolvedExperiment

; /** * Phase 1 (core). Memoized for the SDK session: the first resolution is the arm * the user actually experiences, so later identity changes cannot retroactively * rewrite it. Exposure suppressed. */ declare function resolveExperimentOnce

(spec: ExperimentSpec

): ResolvedExperiment

; /** * Phase 2 (core). Performs the exposing read for its Statsig side effect at * most once per SDK session (keyed by `storeParam`), then returns the memoized * phase-1 assignment so analytics reports what the user saw. */ declare function exposeExperimentOnce

(spec: ExperimentSpec

): ExperimentAssignedPayload | null; //#endregion //#region src/integrations/feature-management/experimentParams.d.ts type ExperimentParamValue = boolean | number | string; /** One declared param: its default and the guard that admits a store value. */ type ExperimentParamDescriptor = { default: T; isValid: (value: unknown) => value is T; }; type ExperimentParamsSchema = Record> & { /** * Reserved at the payload root for the pass-through analytics block — a * param schema can never declare a param named `analytics`. */ analytics?: never; }; /** The params map a schema implies — the single source of truth for `P`. */ type InferExperimentParams = { [K in keyof S]: S[K] extends ExperimentParamDescriptor ? T : never; }; type NumberParamBounds = { min?: number; max?: number; integer?: boolean; }; declare const booleanParam: (defaultValue: boolean) => ExperimentParamDescriptor; declare const numberParam: (defaultValue: number, bounds?: NumberParamBounds) => ExperimentParamDescriptor; /** Empty strings are console mistakes, not values. */ declare const stringParam: (defaultValue: string) => ExperimentParamDescriptor; declare const enumParam: (defaultValue: T[number], allowed: T) => ExperimentParamDescriptor; /** * Derives the `defaults` / `parseParams` half of an `ExperimentSpec` from a * schema. An omitted param keeps its code default (control users still get * shipped behavior); a present-but-invalid param is skipped (falls back to * its own default) rather than rejecting the whole payload, so a corrupt * console edit to one key never disables the rest of the treatment. */ declare function defineExperimentParams(schema: S): Pick>, 'defaults' | 'parseParams'>; //#endregion export { EXPERIMENT_UNAVAILABLE_SENTINEL, type ExperimentAssignedPayload, type ExperimentParamDescriptor, type ExperimentParamValue, type ExperimentParamsSchema, type ExperimentSpec, type ExperimentTransport, type FeatureManagementExperiment, type FeatureManagementGate, type FeatureManagementLayer, type FeatureManagementParameterStore, type FeatureManagementParameterStoreEvaluationOptions, type FeatureManagementReadStatus, type FeatureManagementRedactedUserInfo, type FeatureManagementUserUpdate, type InferExperimentParams, type NumberParamBounds, ONBOARDING_WEB_SDK_PARAMETER_STORE, type ResolveExperimentOptions, type ResolvedExperiment, booleanParam, defineExperimentParams, enumParam, exposeExperimentOnce, getExperiment, getFeatureDynamicConfig, getFeatureGate, getFeatureManagementVersion, getFeatureParameterStore, getIsFeatureManagementInitialized, getLayer, logEvent, numberParam, resolveExperiment, resolveExperimentOnce, stringParam, subscribeFeatureManagement, updateFeatureManagementUser };