/** * Copyright 2018-2019, 2022-2024, Optimizely * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { UserAttributes, OptimizelyDecideOption } from '@optimizely/optimizely-sdk'; import { ReactSDKClient, VariableValuesObject } from './client'; import { OptimizelyDecision } from './utils'; export declare const hooksLogger: import("@optimizely/optimizely-sdk/dist/modules/logging").LoggerFacade; type HookOptions = { autoUpdate?: boolean; timeout?: number; }; type DecideHooksOptions = HookOptions & { decideOptions?: OptimizelyDecideOption[]; }; type HookOverrides = { overrideUserId?: string; overrideAttributes?: UserAttributes; }; type ClientReady = boolean; type DidTimeout = boolean; interface ExperimentDecisionValues { variation: string | null; } interface FeatureDecisionValues { isEnabled: boolean; variables: VariableValuesObject; } interface UseExperiment { (experimentKey: string, options?: HookOptions, overrides?: HookOverrides): [ExperimentDecisionValues['variation'], ClientReady, DidTimeout]; } interface UseFeature { (featureKey: string, options?: HookOptions, overrides?: HookOverrides): [FeatureDecisionValues['isEnabled'], FeatureDecisionValues['variables'], ClientReady, DidTimeout]; } interface UseDecision { (featureKey: string, options?: DecideHooksOptions, overrides?: HookOverrides): [OptimizelyDecision, ClientReady, DidTimeout]; } interface UseTrackEvent { (): [(...args: Parameters) => void, boolean, boolean]; } /** * A React Hook that retrieves the variation for an experiment, optionally * auto updating that value based on underlying user or datafile changes. * * Note: The react client can become ready AFTER the timeout period. * ClientReady and DidTimeout provide signals to handle this scenario. */ export declare const useExperiment: UseExperiment; /** * A React Hook that retrieves the status of a feature flag and its variables, optionally * auto updating those values based on underlying user or datafile changes. * * Note: The react client can become ready AFTER the timeout period. * ClientReady and DidTimeout provide signals to handle this scenario. */ export declare const useFeature: UseFeature; /** * A React Hook that retrieves the flag decision, optionally * auto updating those values based on underlying user or datafile changes. * * Note: The react client can become ready AFTER the timeout period. * ClientReady and DidTimeout provide signals to handle this scenario. */ export declare const useDecision: UseDecision; export declare const useTrackEvent: UseTrackEvent; export {};