import type { AsyncStorage, DeviceInfo, ExpoConstants, ExpoDevice, NativeModules, Platform, UUID } from 'statsig-js'; import React from 'react'; import { UpdateUserFunc } from './StatsigContext'; import { StatsigUser, _SDKPackageInfo } from 'statsig-js'; import { StatsigOptions } from './StatsigOptions'; /** * Properties required to initialize the Statsig React SDK */ type Props = { children: React.ReactNode | React.ReactNode[]; /** * A client SDK key from the Statsig Console */ sdkKey: string; /** * A Statsig User object. Changing this will update the user and Gate values, causing a re-initialization */ user: StatsigUser; /** * A function to keep your reference to a StatsigUser in-sync with Statsig's reference. * This is required if you want to use the useUpdateUser hook. */ setUser?: UpdateUserFunc; /** * Options for initializing the SDK, shared with the statsig-js SDK */ options?: StatsigOptions; /** * Waits for the SDK to load any cached values before rendering child components */ waitForCache?: boolean; /** * Waits for the SDK to initialize with updated values from the network before rendering child components */ waitForInitialization?: boolean; /** * A loading component to render iff waitForInitialization is set to true, and the SDK is initializing */ initializingComponent?: React.ReactNode | React.ReactNode[]; /** * A key for stable mounting/unmounting when updating the user. If this key is set and changes when the user object changes * (or if it is not provided) Then the children of StatsigProvider will unmount/remount with the async update. * If this key is set and does not change, then the children of StatsigProvider will continue to be mounted, * and it will trigger a rerender after updateUser completes */ mountKey?: string; shutdownOnUnmount?: boolean; /** * DO NOT CALL DIRECTLY. Used to polyfill react native specific dependencies. */ _reactNativeDependencies?: { SDKPackageInfo: _SDKPackageInfo; AppState: unknown | null; AsyncStorage: AsyncStorage | null; NativeModules: NativeModules | null; Platform: Platform | null; RNDevice: DeviceInfo | null; Constants: ExpoConstants | null; ExpoDevice: ExpoDevice | null; ReactNativeUUID: UUID | null; }; }; /** * The StatsigProvider is the top level component from which all React SDK components derive * It initializes the SDK so child components can use FeatureGate and DynamicConfig values * * The provider accepts the same SDK initialization parameters as the statsig-js SDK. * * We recommend you place this at the entry point of your app and pass waitForInitialization = true * to ensure the SDK is initialized and all values are up to date prior to rendering anything. * @param props * @returns */ export default function StatsigProvider({ children, sdkKey, user, setUser, options, waitForCache, waitForInitialization, initializingComponent, mountKey, shutdownOnUnmount, _reactNativeDependencies: rnDeps, }: Props): JSX.Element; export {};