UNPKG

@visitorquery/react

Version:

Use this package to prevent fraud and abuse by visitors hiding behind proxies and VPNs. With a simple call to `useVisitorQuery` your website or app will be making a request to our servers which will store a value indicating wether the current user is beh

38 lines (37 loc) 1.19 kB
import { default as React } from 'react'; declare global { interface Window { VisitorQuery: any; } } type VisitorQueryState = { started: boolean; ended: boolean; errored?: boolean; }; type VisitorQueryContextType = VisitorQueryState & { isLoading: boolean; }; export type VisitorQueryProviderProps = { apiKey: string; /** * A unique identifier for the session. This is used in order to later * pull results from the VisitorQuery API. */ sessionId: string; /** * The endpoint to use for the VisitorQuery script. Useful in cases when * you are using custom/vanity domains */ endpoint?: string; children?: React.ReactNode; /** * A trigger that can be used to re-run the VisitorQuery script. * This could be a route change or any other event that you want to use to * re-initialize the VisitorQuery script. */ trigger?: string; }; export declare function VisitorQueryProvider({ apiKey, sessionId, endpoint, children, trigger }: VisitorQueryProviderProps): import("react/jsx-runtime").JSX.Element; export declare function useVisitorQuery(): VisitorQueryContextType; export {};