/** * FingerprintJS Botd v0.1.24 - Copyright (c) FingerprintJS, Inc, 2022 (https://fingerprintjs.com) * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. */ /** * Represents a simple component value. Component value is a result of the source evaluation. */ declare type SimpleComponentValue = string | number | boolean; /** * Represents a component value. Component value is a result of the source evaluation. */ declare type ComponentValue = SimpleComponentValue | SimpleComponentValue[]; /** * Represents a component with state and value. */ declare type Component = { state: State.Success; value: ComponentValue; } | { state: State; value: string; }; /** * Dictionary of components. */ declare type ComponentDict = Record; /** * Represents the response of the bot detection API. */ declare type BotdResponse = RequestIdResponse | SuccessResponse | ErrorResponse; /** * Status of the bot detection. */ declare type DetectStatus = 'processed' | 'notEnoughData' | 'error'; /** * Detection result note. */ declare type DetectNote = { status: DetectStatus; probability: number; type?: string; }; /** * Interface for request identifier response of the bot detection API. * * @interface RequestIdResponse */ interface RequestIdResponse { requestId: string; } /** * Interface for success response of the bot detection API. * * @interface SuccessResponse */ interface SuccessResponse { requestId: string; ip: string; tag: string; bot: { automationTool: DetectNote; searchEngine: DetectNote; browserSpoofing: DetectNote; }; vm: DetectNote; } /** * Interface for error response of the bot detection API. * * @interface ErrorResponse */ interface ErrorResponse { error: { code: ErrorCodes; message: string; }; } /** * Enum for bot detection error codes. * * @readonly * @enum {string} */ declare const enum ErrorCodes { BotdFailed = "botdFailed", PublicKeyRequired = "publicKeyRequired" } /** * Interface for classes that represent a bot detector. * * @interface BotDetectorInterface */ interface BotDetectorInterface { /** * Performs bot detection, internally it will make a network request to the server-side bot detection API. * * @param {DetectOptions} options? Configuration options for bot detector. * @returns {Promise} A promise to the instance of the bot detection response. */ detect(options?: DetectOptions): Promise; /** * Collects all the components from the browser. * * @returns {Promise} A promise to the collected components. */ collect(): Promise; } /** * Interface for configuration for the bot detector. * * @interface InitOptions */ interface InitOptions { /** * A public key required to access the server-side bot detection API. */ publicKey?: string; /** * @deprecated Use publicKey instead */ token?: string; /** * Represents mode for querying API. Default is 'requestId'. */ mode?: Modes; /** * Optional endpoint for the server-side bot detection API. */ endpoint?: string; obfuscationMode?: ObfuscationModes; } /** * Interface for configuration for detect options. * * @interface DetectOptions */ interface DetectOptions { /** * Represents metadata string that you can associate with each bot detection event. */ tag: string; } /** * Represents mode for querying API. * When `requestId` mode is used, only `requestId` field is returned to the browser. This mode is recommended for production usage. * Use `integration` mode only with cloud BotD integrations. */ declare type Modes = 'requestId' | 'integration'; /** * Represents mode for obfuscation. */ declare type ObfuscationModes = 'all' | 'requestOnly' | 'none'; /** * Enum for the source state. * * @readonly * @enum {number} */ declare const enum State { Unexpected = -100, Undefined = -1, Success = 1, Null = 101, UnexpectedBehaviour = 102, WrongType = 103, NotFunction = 104, ObfuscationError = 105 } /** * Builds an instance of the BotDetector. It's recommended to call it as early as possible, ideally during application startup. * * @param {InitOptions} options Configuration options. * @returns {Promise} A promise to the instance of the bot detector. */ declare function load(options: InitOptions): Promise; declare const _default: { load: typeof load; }; export default _default; export { load };