import * as nanostores from 'nanostores'; import { ReadableAtom } from 'nanostores'; import * as _ops_ai_toggly_hooks_types from '@ops-ai/toggly-hooks-types'; import { TogglyEntityContext, Hook } from '@ops-ai/toggly-hooks-types'; import { T as TogglyConfig, V as VariantResult, E as EvaluatedVariantDef } from '../index-B3YY1P83.js'; import { LocalGate } from '@ops-ai/toggly-local-gates'; /** * Atom containing all feature flags */ declare const $flags: nanostores.PreinitializedWritableAtom<_ops_ai_toggly_hooks_types.EvaluatedDefinitions> & object; /** * Atom containing evaluated variant definitions (empty when enableVariants is false) */ declare const $variants: nanostores.PreinitializedWritableAtom> & object; /** * Atom indicating if flags are loaded and ready */ declare const $isReady: nanostores.PreinitializedWritableAtom & object; /** * Atom containing any error that occurred during initialization */ declare const $error: nanostores.PreinitializedWritableAtom & object; /** * Bumped when device-local gates change so computed atoms re-evaluate. */ declare const $localGatesRevision: nanostores.PreinitializedWritableAtom & object; /** * Initialize Toggly client with configuration * * @param config - Toggly configuration */ declare function initTogglyClient(config: TogglyConfig): Promise; /** * Manually refresh feature flags */ declare function refreshFlags(): Promise; /** * Set user identity for targeting * * @param identity - User identifier */ declare function setIdentity(identity: string): void; /** * Clear user identity */ declare function clearIdentity(): void; /** * Stop automatic refresh interval and WebSocket live updates */ declare function stopRefreshInterval(): void; /** * Stop WebSocket live updates (keeps poll interval if running) */ declare function stopWebSocket(): void; /** * Register device-local gates (read-time AND on worker booleans). */ declare function setLocalGates(gates: LocalGate[]): void; /** * Notify UI that local gate state changed (no network fetch). */ declare function notifyLocalGatesChanged(): void; /** * Reset the client instance (for testing purposes) * @internal */ declare function __resetClient(): void; /** Release the shared browser owner; island unmount alone does not dispose it. */ declare function destroyTogglyClient(): void; /** * Current variant assignment for a feature (requires enableVariants in config). */ declare function getVariant(featureKey: string): VariantResult | null; /** * Configuration payload for the assigned variant, if any. */ declare function getVariantValue(featureKey: string, isT?: (v: unknown) => v is T): T | null; /** * Create a computed atom for a specific feature flag * * @param key - Feature flag key * @param defaultValue - Default value if flag not found * @param entity - Entity the flag is evaluated against, or a mappable domain object * @param kind - Registered context kind, required when entity is a domain object * @returns Readable atom with the flag value */ declare function $flag(key: string, defaultValue?: boolean, entity?: TogglyEntityContext | Record | null, kind?: string): ReadableAtom; /** * Create a computed atom that evaluates multiple feature flags * * @param keys - Array of feature flag keys * @param requirement - 'all' or 'any' * @param negate - Whether to negate the result * @returns Readable atom with the evaluation result */ declare function $gate(keys: string[], requirement?: 'all' | 'any', negate?: boolean, entity?: TogglyEntityContext | Record | null, kind?: string): ReadableAtom; /** * Reactive variant assignment for a feature (null when disabled, missing, or no variant name). */ declare function $variant(featureKey: string): ReadableAtom; /** * Add a hook dynamically */ declare function addHook(hook: Hook): void; /** * Remove a hook by name * @returns true if hook was found and removed, false otherwise */ declare function removeHook(name: string): boolean; /** Explicit browser events never evaluate flags. */ declare function recordUsage(key: string, variant?: string): void; declare function recordView(key: string, variant?: string): void; declare function incrementCounter(key: string, value?: number): void; declare function setGauge(key: string, value: number): void; declare function flushTelemetry(): Promise; export { $error, $flag, $flags, $gate, $isReady, $localGatesRevision, $variant, $variants, __resetClient, addHook, clearIdentity, destroyTogglyClient, flushTelemetry, getVariant, getVariantValue, incrementCounter, initTogglyClient, notifyLocalGatesChanged, recordUsage, recordView, refreshFlags, removeHook, setGauge, setIdentity, setLocalGates, stopRefreshInterval, stopWebSocket };