@thumbmarkjs/thumbmarkjs
Version:
   • 2.6 kB
TypeScript
type JSONValue = string | number | boolean | null | JSONValue[] | {
[key: string]: JSONValue;
};
export interface OptionsAfterDefaults {
/**
* A function to customise localStorage names used by thumbmark
* @param name Original name of the storage property eg. visitor_id
* @returns The name under which the storage property should be saved eg. myprefix_visitor_id
*/
property_name_factory: (name: string) => string;
/**
* @deprecated use property_name_factory
*/
storage_property_name?: string;
exclude?: string[];
include?: string[];
permissions_to_check?: PermissionName[];
timeout?: number;
logging?: boolean;
api_key?: string;
api_endpoint?: string;
/**
* @deprecated This will be removed in Thumbmarkjs 2.0, use cache_lifetime_in_ms instead
*/
cache_api_call?: boolean;
/**
* How long the cache will be valid for, maximum is 72h (259_200_000)
*/
cache_lifetime_in_ms: number;
performance?: boolean;
stabilize?: string[];
experimental?: boolean;
/**
* Optional metadata to pass through to the API and webhooks.
* Can be a static JSON object or a function that returns a JSON object (evaluated at request time).
* This field is excluded from fingerprint calculation.
* Maximum length: 1000 characters when stringified.
* @example metadata: { userId: "123", eventType: "login" }
* @example metadata: () => ({ timestamp: Date.now(), sessionId: "abc" })
*/
metadata?: JSONValue | (() => JSONValue);
}
export type optionsInterface = Partial<OptionsAfterDefaults>;
export declare const DEFAULT_CACHE_LIFETIME = 0;
export declare const MAXIMUM_CACHE_LIFETIME = 259200000;
export declare const DEFAULT_STORAGE_PREFIX = "thumbmark";
export declare const DEFAULT_API_ENDPOINT = "https://api.thumbmarkjs.com";
export declare const defaultOptions: OptionsAfterDefaults;
export declare let options: OptionsAfterDefaults;
/**
*
* @param key @deprecated this function will be removed
* @param value
*/
export declare function setOption<K extends keyof optionsInterface>(key: K, value: OptionsAfterDefaults[K]): void;
export declare const stabilizationExclusionRules: {
private: {
exclude: string[];
browsers: string[];
}[];
iframe: ({
exclude: string[];
browsers: string[];
} | {
exclude: string[];
browsers?: undefined;
})[];
vpn: {
exclude: string[];
}[];
always: {
exclude: string[];
browsers: string[];
}[];
};
export {};