UNPKG

@flagdeck/vue

Version:

Vue integration for Flagdeck feature flags

30 lines (29 loc) 857 B
import { FlagdeckClient, EvaluationContext } from '@flagdeck/js'; import { Ref } from 'vue'; export interface FlagError { code: string; message: string; type: 'configuration' | 'notfound' | 'inactive' | 'other'; } export interface FlagdeckContext { client: FlagdeckClient | null; isReady: boolean; error?: Error; context?: Partial<EvaluationContext>; setContext: (context: Partial<EvaluationContext>) => void; } export interface FlagResult { isEnabled: Ref<boolean>; isLoading: Ref<boolean>; error: Ref<FlagError | undefined>; } export interface FlagValueResult<T = any> { value: Ref<T>; isLoading: Ref<boolean>; error: Ref<FlagError | undefined>; } export interface FlagsResult<T = any> { values: Ref<Record<string, T>>; isLoading: Ref<boolean>; errors: Ref<Record<string, FlagError>>; }