@navinc/base-react-components
Version:
Nav's Pattern Library
26 lines (25 loc) • 1.17 kB
TypeScript
import { ReactNode, ComponentType } from 'react';
import { LDClient, LDContext, LDFlagSet, LDOptions } from 'launchdarkly-js-client-sdk';
type LaunchDarklyProviderProps = {
clientSideID: string;
context: LDContext;
options?: LDOptions;
children: ReactNode;
LoadingContent?: ComponentType;
onTimeout?: () => void;
};
export declare const LaunchDarklyProvider: ({ clientSideID, context, options, children, LoadingContent, onTimeout, }: LaunchDarklyProviderProps) => JSX.Element;
export declare const useLaunchDarkly: () => {
flags: LDFlagSet;
isLoading: boolean;
isInitialized: boolean;
trackMetric: ((key: string, data?: any, metricValue?: number | undefined) => void) | undefined;
trackOfferReferral: ((key: string, data?: any, metricValue?: number | undefined) => void) | undefined;
whichVariation: ((key: string, defaultValue?: any) => any) | undefined;
ldclient: LDClient | undefined;
hasProvider: boolean;
};
export declare const withLaunchDarkly: <T extends {
whichVariation?: ((key: string, defaultValue?: any) => any) | undefined;
}>(Component: ComponentType<T>) => (props: T) => JSX.Element;
export {};