import type { ErrorCode, EvaluationContext, EvaluationContextValue, FlagValue, TrackingEventDetails } from '@openfeature/web-sdk'; /** * GoFeatureFlagEvaluationContext is the representation of a user for GO Feature Flag * the key is used to do the repartition in GO Feature Flag this is the only * mandatory field when calling the API. */ export interface GoFeatureFlagEvaluationContext { key: string; custom?: { [key: string]: EvaluationContextValue; }; } /** * GoFeatureFlagAllFlagRequest is the request format used to call the GO Feature Flag * API to retrieve all the feature flags for this user. */ export interface GoFeatureFlagAllFlagRequest { evaluationContext: GoFeatureFlagEvaluationContext; } /** * GoFeatureFlagProviderOptions is the object containing all the provider options * when initializing the open-feature provider. */ export interface GoFeatureFlagWebProviderOptions { endpoint: string; apiTimeout?: number; apiKey?: string; retryInitialDelay?: number; retryDelayMultiplier?: number; maxRetries?: number; dataFlushInterval?: number; disableDataCollection?: boolean; exporterMetadata?: Record; websocketKeepAliveInterval?: number; } export type ExporterMetadataValue = string | number | boolean; /** * FlagState is the object used to get the value return by GO Feature Flag. */ export interface FlagState { failed: boolean; trackEvents: boolean; value: T; variationType: string; version?: string; reason: string; metadata: Record; errorCode?: ErrorCode; cacheable: boolean; } /** * GOFeatureFlagAllFlagsResponse is the object containing the results returned * by GO Feature Flag. */ export interface GOFeatureFlagAllFlagsResponse { valid: boolean; flags: Record>; } /** * Format of the websocket event we can receive. */ export interface GOFeatureFlagWebsocketResponse { deleted?: { [key: string]: any; }; added?: { [key: string]: any; }; updated?: { [key: string]: any; }; } export interface DataCollectorRequest { events: Array | TrackingEvent>; meta: Record; } export interface FeatureEvent { contextKind: string; creationDate: number; default: boolean; key: string; kind: string; userKey: string; value: T; variation: string; version?: string; source?: string; } export interface TrackingEvent { kind: string; contextKind: string; userKey: string; creationDate: number; key: string; evaluationContext: EvaluationContext; trackingEventDetails: TrackingEventDetails; }