/**
* @tracetail/react: React hooks for TraceTail browser fingerprinting (99.6% accuracy).
*
* @example
* import { useTraceTail } from '@tracetail/react';
*
* function Checkout() {
* const { fingerprint } = useTraceTail({ apiKey: 'YOUR_API_KEY', endpoint: 'https://tracetail.io/api' });
* return ;
* }
*/
import type { ReactNode } from 'react';
import { TraceTail, getComplianceContext } from '@tracetail/js';
import type { ComplianceContext, FingerprintResult, GenerateFingerprintOptions, TraceTailOptions } from '@tracetail/js';
export { TraceTail, getComplianceContext };
export type { BotDetection, ComplianceContext, ComplianceRegion, FingerprintComponents, FingerprintResult, GenerateFingerprintOptions, RiskAssessment, SignalQuality, IdentificationVerification, TraceTailApiError, TraceTailOptions, UnavailableSignal, } from '@tracetail/js';
export interface TraceTailProviderProps extends TraceTailOptions {
children?: ReactNode;
}
/** Configures TraceTail for every hook below it. Changing a prop (say, the API key) switches clients. */
export declare function TraceTailProvider({ apiKey, endpoint, timeout, debug, children }: TraceTailProviderProps): import("react").FunctionComponentElement>;
export interface UseTraceTailOptions extends TraceTailOptions, Omit {
/** Identify when the component mounts. Default: true. */
immediate?: boolean | undefined;
}
export interface UseTraceTailResult {
/** The latest result, or null until the first identification completes. API failures are in `fingerprint.error`. */
fingerprint: FingerprintResult | null;
loading: boolean;
/** Set when identification itself failed, e.g. during server-side rendering. */
error: Error | null;
/** Identify, reusing the page's cached result when there is one. */
generate: () => Promise;
/** Identify again, bypassing the cache. */
regenerate: () => Promise;
}
/**
* Identifies the browser. Pass client options (apiKey, endpoint, timeout, debug) here or through a
* TraceTailProvider; with neither, it runs keyless. It never retries on its own: call `generate`
* to retry a failed registration with its existing token, or `regenerate` for a new identification.
*/
export declare function useTraceTail(options?: UseTraceTailOptions): UseTraceTailResult;
/** Just the visitor ID: `null` until identification completes. */
export declare function useVisitorId(options?: UseTraceTailOptions): {
visitorId: string | null;
loading: boolean;
error: Error | null;
regenerate: () => Promise;
};
/**
* Privacy and region hints (GPC, Do Not Track, inferred region) for deciding whether to ask for
* consent before identifying. Computed once per component; safe during server-side rendering.
*/
export declare function useComplianceContext(): ComplianceContext;