@thumbmarkjs/thumbmarkjs 1.6.0 → 1.7.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/thumbmark.cjs.js +1 -1
  2. package/dist/thumbmark.cjs.js.map +1 -1
  3. package/dist/thumbmark.esm.js +1 -1
  4. package/dist/thumbmark.esm.js.map +1 -1
  5. package/dist/thumbmark.umd.js +1 -1
  6. package/dist/thumbmark.umd.js.map +1 -1
  7. package/package.json +6 -2
  8. package/src/components/audio/index.ts +11 -2
  9. package/src/components/canvas/index.ts +12 -5
  10. package/src/factory.ts +5 -4
  11. package/src/functions/index.ts +0 -1
  12. package/dist/types/components/audio/index.d.ts +0 -2
  13. package/dist/types/components/canvas/index.d.ts +0 -3
  14. package/dist/types/components/fonts/index.d.ts +0 -4
  15. package/dist/types/components/hardware/index.d.ts +0 -2
  16. package/dist/types/components/locales/index.d.ts +0 -2
  17. package/dist/types/components/math/index.d.ts +0 -2
  18. package/dist/types/components/mathml/index.d.ts +0 -2
  19. package/dist/types/components/permissions/index.d.ts +0 -3
  20. package/dist/types/components/plugins/index.d.ts +0 -2
  21. package/dist/types/components/screen/index.d.ts +0 -2
  22. package/dist/types/components/speech/index.d.ts +0 -2
  23. package/dist/types/components/system/browser.d.ts +0 -7
  24. package/dist/types/components/system/index.d.ts +0 -2
  25. package/dist/types/components/webgl/index.d.ts +0 -2
  26. package/dist/types/components/webrtc/index.d.ts +0 -2
  27. package/dist/types/factory.d.ts +0 -62
  28. package/dist/types/functions/api.d.ts +0 -50
  29. package/dist/types/functions/filterComponents.d.ts +0 -10
  30. package/dist/types/functions/index.d.ts +0 -45
  31. package/dist/types/functions/legacy_functions.d.ts +0 -27
  32. package/dist/types/index.d.ts +0 -9
  33. package/dist/types/options.d.ts +0 -59
  34. package/dist/types/thumbmark.d.ts +0 -26
  35. package/dist/types/utils/cache.d.ts +0 -23
  36. package/dist/types/utils/commonPixels.d.ts +0 -1
  37. package/dist/types/utils/ephemeralIFrame.d.ts +0 -4
  38. package/dist/types/utils/getMostFrequent.d.ts +0 -5
  39. package/dist/types/utils/hash.d.ts +0 -5
  40. package/dist/types/utils/imageDataToDataURL.d.ts +0 -1
  41. package/dist/types/utils/log.d.ts +0 -8
  42. package/dist/types/utils/raceAll.d.ts +0 -9
  43. package/dist/types/utils/sort.d.ts +0 -8
  44. package/dist/types/utils/stableStringify.d.ts +0 -22
  45. package/dist/types/utils/version.d.ts +0 -4
  46. package/dist/types/utils/visitorId.d.ts +0 -14
@@ -1,27 +0,0 @@
1
- /**
2
- * This file is here to support legacy implementations.
3
- * Eventually, these functions will be removed to keep the library small.
4
- */
5
- import { componentInterface } from '../factory';
6
- /**
7
- *
8
- * @deprecated
9
- */
10
- export declare function getFingerprintData(): Promise<componentInterface>;
11
- /**
12
- *
13
- * @param includeData boolean
14
- * @deprecated this function is going to be removed. use getThumbmark or Thumbmark class instead.
15
- */
16
- export declare function getFingerprint(includeData?: false): Promise<string>;
17
- export declare function getFingerprint(includeData: true): Promise<{
18
- hash: string;
19
- data: componentInterface;
20
- }>;
21
- /**
22
- *
23
- * @deprecated use Thumbmark or getThumbmark instead with options
24
- */
25
- export declare function getFingerprintPerformance(): Promise<{
26
- elapsed: Record<string, number>;
27
- }>;
@@ -1,9 +0,0 @@
1
- import { getFingerprint, getFingerprintData, getFingerprintPerformance } from './functions/legacy_functions';
2
- import { getThumbmark } from './functions';
3
- import { getVersion } from './utils/version';
4
- import { setOption, optionsInterface, stabilizationExclusionRules } from './options';
5
- import { includeComponent } from './factory';
6
- import { Thumbmark } from './thumbmark';
7
- import { filterThumbmarkData } from './functions/filterComponents';
8
- import { stableStringify } from './utils/stableStringify';
9
- export { Thumbmark, getThumbmark, getVersion, filterThumbmarkData, optionsInterface, stabilizationExclusionRules, stableStringify, setOption, getFingerprint, getFingerprintData, getFingerprintPerformance, includeComponent };
@@ -1,59 +0,0 @@
1
- export interface OptionsAfterDefaults {
2
- /**
3
- * A function to customise localStorage names used by thumbmark
4
- * @param name Original name of the storage property eg. visitor_id
5
- * @returns The name under which the storage property should be saved eg. myprefix_visitor_id
6
- */
7
- property_name_factory: (name: string) => string;
8
- /**
9
- * @deprecated use property_name_factory
10
- */
11
- storage_property_name?: string;
12
- exclude?: string[];
13
- include?: string[];
14
- permissions_to_check?: PermissionName[];
15
- timeout?: number;
16
- logging?: boolean;
17
- api_key?: string;
18
- api_endpoint?: string;
19
- /**
20
- * @deprecated This will be removed in Thumbmarkjs 2.0, use cache_lifetime_in_ms instead
21
- */
22
- cache_api_call?: boolean;
23
- /**
24
- * How long the cache will be valid for, maximum is 72h (259_200_000)
25
- */
26
- cache_lifetime_in_ms: number;
27
- performance?: boolean;
28
- stabilize?: string[];
29
- experimental?: boolean;
30
- }
31
- export type optionsInterface = Partial<OptionsAfterDefaults>;
32
- export declare const DEFAULT_CACHE_LIFETIME = 0;
33
- export declare const MAXIMUM_CACHE_LIFETIME = 259200000;
34
- export declare const DEFAULT_STORAGE_PREFIX = "thumbmark";
35
- export declare const DEFAULT_API_ENDPOINT = "https://api.thumbmarkjs.com";
36
- export declare const defaultOptions: OptionsAfterDefaults;
37
- export declare let options: OptionsAfterDefaults;
38
- /**
39
- *
40
- * @param key @deprecated this function will be removed
41
- * @param value
42
- */
43
- export declare function setOption<K extends keyof optionsInterface>(key: K, value: OptionsAfterDefaults[K]): void;
44
- export declare const stabilizationExclusionRules: {
45
- private: {
46
- exclude: string[];
47
- browsers: string[];
48
- }[];
49
- iframe: ({
50
- exclude: string[];
51
- browsers: string[];
52
- } | {
53
- exclude: string[];
54
- browsers?: undefined;
55
- })[];
56
- vpn: {
57
- exclude: string[];
58
- }[];
59
- };
@@ -1,26 +0,0 @@
1
- import { optionsInterface } from "./options";
2
- import { componentInterface } from "./factory";
3
- /**
4
- * A client for generating thumbmarks with a persistent configuration.
5
- */
6
- export declare class Thumbmark {
7
- private options;
8
- /**
9
- * Creates a new Thumbmarker client instance.
10
- * @param options - Default configuration options for this instance.
11
- */
12
- constructor(options?: optionsInterface);
13
- /**
14
- * Generates a thumbmark using the instance's configuration.
15
- * @param overrideOptions - Options to override for this specific call.
16
- * @returns The thumbmark result.
17
- */
18
- get(overrideOptions?: optionsInterface): Promise<any>;
19
- getVersion(): string;
20
- /**
21
- * Register a custom component to be included in the fingerprint.
22
- * @param key - The component name
23
- * @param fn - The component function
24
- */
25
- includeComponent(key: string, fn: (options?: optionsInterface) => Promise<componentInterface | null>): void;
26
- }
@@ -1,23 +0,0 @@
1
- import { apiResponse } from "../functions/api";
2
- import { OptionsAfterDefaults } from "../options";
3
- export declare const CACHE_KEY = "cache";
4
- export interface Cache {
5
- apiResponse?: apiResponse;
6
- apiResponseExpiry?: number;
7
- }
8
- /**
9
- * Get all values from cache
10
- * @param _options
11
- */
12
- export declare function getCache(_options: Pick<OptionsAfterDefaults, 'property_name_factory'>): Cache;
13
- /**
14
- * Write given values to cache
15
- * @param _options
16
- * @param values
17
- */
18
- export declare function setCache(_options: OptionsAfterDefaults, values: Partial<Cache>): void;
19
- /**
20
- * Returns the expiry time for cache
21
- * @param _options
22
- */
23
- export declare function getApiResponseExpiry(_options: Pick<OptionsAfterDefaults, 'cache_lifetime_in_ms'>): number;
@@ -1 +0,0 @@
1
- export declare function getCommonPixels(images: ImageData[], width: number, height: number): ImageData;
@@ -1,4 +0,0 @@
1
- export declare function ephemeralIFrame(callback: ({ iframe }: {
2
- iframe: Document;
3
- }) => void): Promise<any>;
4
- export declare function wait<T = void>(durationMs: number, resolveWith?: T): Promise<T>;
@@ -1,5 +0,0 @@
1
- export declare function mostFrequentValuesInArrayOfDictionaries(arr: {
2
- [key: string]: any;
3
- }[], keys: string[]): {
4
- [key: string]: any;
5
- };
@@ -1,5 +0,0 @@
1
- /**
2
- * This code is taken from https://github.com/LinusU/murmur-128/blob/master/index.js
3
- * But instead of dependencies to encode-utf8 and fmix, I've implemented them here.
4
- */
5
- export declare function hash(key: ArrayBuffer | string, seed?: number): string;
@@ -1 +0,0 @@
1
- export declare function imageDataToDataURL(imageData: ImageData): string;
@@ -1,8 +0,0 @@
1
- import { componentInterface } from '../factory';
2
- import { optionsInterface } from '../options';
3
- /**
4
- * Logs thumbmark data to remote logging endpoint (only once per session)
5
- * You can disable this by setting options.logging to false.
6
- * @internal
7
- */
8
- export declare function logThumbmarkData(thisHash: string, thumbmarkData: componentInterface, options: optionsInterface, experimentalData?: componentInterface): Promise<void>;
@@ -1,9 +0,0 @@
1
- type DelayedPromise<T> = Promise<T>;
2
- export declare function delay<T>(t: number, val: T): DelayedPromise<T>;
3
- export interface RaceResult<T> {
4
- value: T;
5
- elapsed?: number;
6
- }
7
- export declare function raceAllPerformance<T>(promises: Promise<T>[], timeoutTime: number, timeoutVal: T): Promise<RaceResult<T>[]>;
8
- export declare function raceAll<T>(promises: Promise<T>[], timeoutTime: number, timeoutVal: T): Promise<(T | undefined)[]>;
9
- export {};
@@ -1,8 +0,0 @@
1
- import { componentInterface } from '../factory';
2
- /**
3
- * Recursively sorts the keys of a component object alphabetically.
4
- * This ensures a consistent order for hashing.
5
- * @param obj The component object to sort.
6
- * @returns A new object with sorted keys.
7
- */
8
- export declare function sortComponentKeys(obj: componentInterface): componentInterface;
@@ -1,22 +0,0 @@
1
- /**
2
- * Stable JSON stringify implementation
3
- * Based on fast-json-stable-stringify by Evgeny Poberezkin
4
- * https://github.com/epoberezkin/fast-json-stable-stringify
5
- *
6
- * This implementation ensures consistent JSON serialization by sorting object keys,
7
- * which is critical for generating stable hashes from fingerprint data.
8
- */
9
- /**
10
- * Converts data to a stable JSON string with sorted keys
11
- *
12
- * @param data - The data to stringify
13
- * @returns Stable JSON string representation
14
- * @throws TypeError if circular reference is detected
15
- *
16
- * @example
17
- * ```typescript
18
- * const obj = { b: 2, a: 1 };
19
- * stableStringify(obj); // '{"a":1,"b":2}'
20
- * ```
21
- */
22
- export declare function stableStringify(data: any): string;
@@ -1,4 +0,0 @@
1
- /**
2
- * Returns the current package version
3
- */
4
- export declare function getVersion(): string;
@@ -1,14 +0,0 @@
1
- import { OptionsAfterDefaults } from "../options";
2
- /**
3
- * Get the storage property name for visitor id
4
- * @param _options
5
- */
6
- export declare function getVisitorIdPropertyName(_options: Pick<OptionsAfterDefaults, 'storage_property_name' | 'property_name_factory'>): string;
7
- /**
8
- * Gets visitor ID from localStorage, returns null if unavailable
9
- */
10
- export declare function getVisitorId(_options: OptionsAfterDefaults): string | null;
11
- /**
12
- * Sets visitor ID in localStorage
13
- */
14
- export declare function setVisitorId(visitorId: string, _options: OptionsAfterDefaults): void;