configcat-react
Version:
ConfigCat is a configuration as a service that lets you manage your features and configurations without actually deploying new code.
32 lines (31 loc) • 1.59 kB
TypeScript
import type { Config, IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions } from "@configcat/sdk";
import { PollingMode } from "@configcat/sdk";
import React, { Component, type PropsWithChildren } from "react";
import { type ConfigCatContextData } from "./ConfigCatContext";
/** Options used to configure the ConfigCat SDK in the case of Auto Polling mode. */
export type IReactAutoPollOptions = IAutoPollOptions;
/** Options used to configure the ConfigCat SDK in the case of Lazy Loading mode. */
export type IReactLazyLoadingOptions = ILazyLoadingOptions;
/** Options used to configure the ConfigCat SDK in the case of Manual Polling mode. */
export type IReactManualPollOptions = IManualPollOptions;
type ConfigCatProviderProps = {
sdkKey: string;
pollingMode?: PollingMode;
options?: IReactAutoPollOptions | IReactLazyLoadingOptions | IReactManualPollOptions;
id?: string;
};
type ConfigCatProviderState = ConfigCatContextData;
declare class ConfigCatProvider extends Component<PropsWithChildren<ConfigCatProviderProps>, ConfigCatProviderState, {}> {
private configChangedHandler?;
private originalClearDefaultUser?;
private originalSetDefaultUser?;
constructor(props: ConfigCatProviderProps);
componentDidMount(): void;
componentWillUnmount(): void;
private initializeConfigCatClient;
reactConfigChanged(_newConfig: Config): void;
clientReady(): void;
render(): React.JSX.Element;
}
export declare function createConfigCatProviderError(methodName: string, providerId?: string): Error;
export default ConfigCatProvider;