/** * FingerprintJS Pro React v2.7.1 - Copyright (c) FingerprintJS, Inc, 2025 (https://fingerprint.com) * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. */ import * as react from 'react'; import { PropsWithChildren } from 'react'; import { GetOptions, VisitorData, FingerprintJSPro, FpjsClientOptions } from '@fingerprintjs/fingerprintjs-pro-spa'; export { Agent, CacheLocation, CacheStub, Cacheable, FingerprintJSPro, FpjsClient, FpjsClientOptions, GetOptions, ICache, InMemoryCache, LoadOptions, LocalStorageCache, SessionStorageCache, VisitorData, defaultEndpoint, defaultScriptUrlPattern, defaultTlsEndpoint } from '@fingerprintjs/fingerprintjs-pro-spa'; import * as react_jsx_runtime from 'react/jsx-runtime'; interface QueryResult { /** * Stores current query data * */ data?: TData; /** * Is true while query is loading * */ isLoading?: boolean; /** * Stores current query error * */ error?: TError; } interface VisitorQueryResult extends QueryResult> { data?: VisitorData; } interface GetDataOptions extends FingerprintJSPro.GetOptions { /** * When set to true, the visitor data will always be fetched from our API. * */ ignoreCache?: boolean; } interface VisitorQueryContext extends VisitorQueryResult { /** * Performs identification request to server and returns visitors data. * */ getData: (getDataOptions?: GetDataOptions) => Promise>; } /** * The FingerprintJS Context */ interface FpjsContextInterface { getVisitorData: (config?: GetOptions, ignoreCache?: boolean) => Promise>; clearCache: () => void; } declare const FpjsContext: react.Context>; interface CustomAgent { load: (options: FingerprintJSPro.LoadOptions) => Promise; } interface FpjsProviderOptions extends FpjsClientOptions { /** * If set to `true`, will force FpjsClient to be rebuilt with the new options. Should be used with caution * since it can be triggered too often (e.g. on every render) and negatively affect performance of the JS agent. */ forceRebuild?: boolean; customAgent?: CustomAgent; } /** * @example * ```jsx * " * }} * cacheTime={60 * 10} * cacheLocation={CacheLocation.LocalStorage} * > * * * ``` * * Provides the FpjsContext to its child components. * * @privateRemarks * This is just a wrapper around the actual provider. * For the implementation, see `ProviderWithEnv` component. */ declare function FpjsProvider(props: PropsWithChildren): react_jsx_runtime.JSX.Element; type UseVisitorDataOptions = GetDataOptions; /** * @example * ```js * const { * // Request state * data, * isLoading, * error, * // A method to be called manually when the `immediate` field in the config is set to `false`: * getData, * } = useVisitorData({ extended: true }, { immediate: false }); * ``` * Use the `useVisitorData` hook in your components to perform identification requests with the FingerprintJS API. The returned object contains information about loading status, errors, and visitor. * * @param getOptions options for the `fp.get()` request * @param config config for the hook */ declare function useVisitorData(getOptions?: UseVisitorDataOptions, config?: UseVisitorDataConfig): VisitorQueryContext; interface UseVisitorDataConfig { /** * Determines whether the `getData()` method will be called immediately after the hook mounts or not */ immediate: boolean; } export { FpjsContext, FpjsProvider, useVisitorData }; export type { CustomAgent, FpjsContextInterface, FpjsProviderOptions, GetDataOptions, QueryResult, UseVisitorDataConfig, UseVisitorDataOptions, VisitorQueryContext, VisitorQueryResult };