@thumbmarkjs/thumbmarkjs 1.1.3-rc.7 → 1.3.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/README.md +66 -66
  2. package/dist/thumbmark.cjs.js +1 -1
  3. package/dist/thumbmark.cjs.js.map +1 -1
  4. package/dist/thumbmark.esm.d.ts +3 -10
  5. package/dist/thumbmark.esm.js +1 -1
  6. package/dist/thumbmark.esm.js.map +1 -1
  7. package/dist/thumbmark.umd.js +1 -1
  8. package/dist/thumbmark.umd.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/components/mathml/index.ts +149 -0
  11. package/src/components/webrtc/index.ts +126 -0
  12. package/src/factory.ts +12 -0
  13. package/src/functions/api.ts +130 -0
  14. package/src/functions/filterComponents.ts +0 -1
  15. package/src/functions/index.ts +39 -140
  16. package/src/options.ts +3 -1
  17. package/src/utils/log.ts +2 -1
  18. package/dist/types/components/audio/index.d.ts +0 -2
  19. package/dist/types/components/canvas/index.d.ts +0 -3
  20. package/dist/types/components/fonts/index.d.ts +0 -4
  21. package/dist/types/components/hardware/index.d.ts +0 -2
  22. package/dist/types/components/locales/index.d.ts +0 -2
  23. package/dist/types/components/math/index.d.ts +0 -2
  24. package/dist/types/components/permissions/index.d.ts +0 -3
  25. package/dist/types/components/plugins/index.d.ts +0 -2
  26. package/dist/types/components/screen/index.d.ts +0 -2
  27. package/dist/types/components/system/browser.d.ts +0 -7
  28. package/dist/types/components/system/index.d.ts +0 -2
  29. package/dist/types/components/webgl/index.d.ts +0 -2
  30. package/dist/types/factory.d.ts +0 -51
  31. package/dist/types/functions/filterComponents.d.ts +0 -10
  32. package/dist/types/functions/index.d.ts +0 -89
  33. package/dist/types/functions/legacy_functions.d.ts +0 -27
  34. package/dist/types/index.d.ts +0 -8
  35. package/dist/types/options.d.ts +0 -43
  36. package/dist/types/thumbmark.d.ts +0 -26
  37. package/dist/types/utils/commonPixels.d.ts +0 -1
  38. package/dist/types/utils/ephemeralIFrame.d.ts +0 -4
  39. package/dist/types/utils/getMostFrequent.d.ts +0 -5
  40. package/dist/types/utils/hash.d.ts +0 -5
  41. package/dist/types/utils/imageDataToDataURL.d.ts +0 -1
  42. package/dist/types/utils/log.d.ts +0 -8
  43. package/dist/types/utils/raceAll.d.ts +0 -9
  44. package/dist/types/utils/sort.d.ts +0 -8
  45. package/dist/types/utils/version.d.ts +0 -4
  46. package/dist/types/utils/visitorId.d.ts +0 -11
@@ -4,22 +4,15 @@
4
4
  * This module handles component collection, API calls, uniqueness scoring, and data filtering
5
5
  * for the ThumbmarkJS browser fingerprinting library.
6
6
  *
7
- * Exports:
8
- * - getThumbmark
9
- * - getThumbmarkDataFromPromiseMap
10
- * - resolveClientComponents
11
- * - filterThumbmarkData
12
- *
13
- * Internal helpers and types are also defined here.
14
7
  */
15
8
 
16
- // ===================== Imports =====================
17
9
  import { defaultOptions, optionsInterface } from "../options";
18
10
  import {
19
11
  timeoutInstance,
20
12
  componentInterface,
21
13
  tm_component_promises,
22
14
  customComponents,
15
+ tm_experimental_component_promises,
23
16
  includeComponent as globalIncludeComponent
24
17
  } from "../factory";
25
18
  import { hash } from "../utils/hash";
@@ -27,43 +20,8 @@ import { raceAllPerformance } from "../utils/raceAll";
27
20
  import { getVersion } from "../utils/version";
28
21
  import { filterThumbmarkData } from './filterComponents'
29
22
  import { logThumbmarkData } from '../utils/log';
30
- import { API_ENDPOINT } from "../options";
31
- import { getVisitorId, setVisitorId } from "../utils/visitorId";
32
-
33
- // ===================== Types & Interfaces =====================
34
-
35
- /**
36
- * Info returned from the API (IP, classification, uniqueness, etc)
37
- */
38
- interface infoInterface {
39
- ip_address?: {
40
- ip_address: string,
41
- ip_identifier: string,
42
- autonomous_system_number: number,
43
- ip_version: 'v6' | 'v4',
44
- },
45
- classification?: {
46
- tor: boolean,
47
- vpn: boolean,
48
- bot: boolean,
49
- datacenter: boolean,
50
- danger_level: number, // 5 is highest and should be blocked. 0 is no danger.
51
- },
52
- uniqueness?: {
53
- score: number | string
54
- },
55
- timed_out?: boolean; // added for timeout handling
56
- }
23
+ import { getApiPromise, infoInterface } from "./api";
57
24
 
58
- /**
59
- * API response structure
60
- */
61
- interface apiResponse {
62
- info?: infoInterface;
63
- version?: string;
64
- components?: componentInterface;
65
- visitorId?: string;
66
- }
67
25
 
68
26
  /**
69
27
  * Final thumbmark response structure
@@ -74,101 +32,11 @@ interface thumbmarkResponse {
74
32
  version: string,
75
33
  thumbmark: string,
76
34
  visitorId?: string,
77
- /**
78
- * Only present if options.performance is true.
79
- */
80
35
  elapsed?: any;
36
+ error?: string;
37
+ experimental?: componentInterface;
81
38
  }
82
39
 
83
-
84
-
85
- // ===================== API Call Logic =====================
86
-
87
- let currentApiPromise: Promise<apiResponse> | null = null;
88
- let apiPromiseResult: apiResponse | null = null;
89
-
90
- /**
91
- * Calls the Thumbmark API with the given components, using caching and deduplication.
92
- * Returns a promise for the API response or null on error.
93
- */
94
- export const getApiPromise = (
95
- options: optionsInterface,
96
- components: componentInterface
97
- ): Promise<apiResponse | null> => {
98
- // 1. If a result is already cached and caching is enabled, return it.
99
- if (options.cache_api_call && apiPromiseResult) {
100
- return Promise.resolve(apiPromiseResult);
101
- }
102
-
103
- // 2. If a request is already in flight, return that promise to prevent duplicate calls.
104
- if (currentApiPromise) {
105
- return currentApiPromise;
106
- }
107
-
108
- // 3. Otherwise, initiate a new API call with timeout.
109
- const endpoint = `${API_ENDPOINT}/thumbmark`;
110
- const visitorId = getVisitorId();
111
- const requestBody: any = {
112
- components,
113
- options,
114
- clientHash: hash(JSON.stringify(components)),
115
- version: getVersion()
116
- };
117
- if (visitorId) {
118
- requestBody.visitorId = visitorId;
119
- }
120
-
121
- const fetchPromise = fetch(endpoint, {
122
- method: 'POST',
123
- headers: {
124
- 'x-api-key': options.api_key!,
125
- 'Authorization': 'custom-authorized',
126
- 'Content-Type': 'application/json',
127
- },
128
- body: JSON.stringify(requestBody),
129
- })
130
- .then(response => {
131
- // Handle HTTP errors that aren't network errors
132
- if (!response.ok) {
133
- throw new Error(`HTTP error! status: ${response.status}`);
134
- }
135
- return response.json();
136
- })
137
- .then(data => {
138
- // Handle visitor ID from server response
139
- if (data.visitorId && data.visitorId !== visitorId) {
140
- setVisitorId(data.visitorId);
141
- }
142
- apiPromiseResult = data; // Cache the successful result
143
- currentApiPromise = null; // Clear the in-flight promise
144
- return data;
145
- })
146
- .catch(error => {
147
- console.error('Error fetching pro data', error);
148
- currentApiPromise = null; // Also clear the in-flight promise on error
149
- // Return null instead of a string to prevent downstream crashes
150
- return null;
151
- });
152
-
153
- // Timeout logic
154
- const timeoutMs = options.timeout || 5000;
155
- const timeoutPromise = new Promise<apiResponse>((resolve) => {
156
- setTimeout(() => {
157
- resolve({
158
- info: { timed_out: true },
159
- version: getVersion(),
160
- });
161
- }, timeoutMs);
162
- });
163
-
164
- currentApiPromise = Promise.race([fetchPromise, timeoutPromise]);
165
- return currentApiPromise;
166
- };
167
-
168
- // ===================== Main Thumbmark Logic =====================
169
-
170
-
171
-
172
40
  /**
173
41
  * Main entry point: collects all components, optionally calls API, and returns thumbmark data.
174
42
  *
@@ -177,12 +45,41 @@ export const getApiPromise = (
177
45
  */
178
46
  export async function getThumbmark(options?: optionsInterface): Promise<thumbmarkResponse> {
179
47
  const _options = { ...defaultOptions, ...options };
48
+
49
+ // Early logging decision
50
+ const shouldLog = (!sessionStorage.getItem("_tmjs_l") && Math.random() < 0.0001);
51
+
180
52
  // Merge built-in and user-registered components
181
53
  const allComponents = { ...tm_component_promises, ...customComponents };
182
54
  const { elapsed, resolvedComponents: clientComponentsResult } = await resolveClientComponents(allComponents, _options);
183
55
 
56
+ // Resolve experimental components only when logging
57
+ let experimentalComponents = {};
58
+ if (shouldLog || _options.experimental) {
59
+ const { resolvedComponents } = await resolveClientComponents(tm_experimental_component_promises, _options);
60
+ experimentalComponents = resolvedComponents;
61
+ }
62
+
184
63
  const apiPromise = _options.api_key ? getApiPromise(_options, clientComponentsResult) : null;
185
- const apiResult = apiPromise ? await apiPromise : null;
64
+ let apiResult = null;
65
+
66
+ if (apiPromise) {
67
+ try {
68
+ apiResult = await apiPromise;
69
+ } catch (error) {
70
+ // Handle API key/quota errors
71
+ if (error instanceof Error && error.message === 'INVALID_API_KEY') {
72
+ return {
73
+ error: 'Invalid API key or quota exceeded',
74
+ components: {},
75
+ info: {},
76
+ version: getVersion(),
77
+ thumbmark: ''
78
+ };
79
+ }
80
+ throw error; // Re-throw other errors
81
+ }
82
+ }
186
83
 
187
84
  // Only add 'elapsed' if performance is true
188
85
  const maybeElapsed = _options.performance ? { elapsed } : {};
@@ -191,7 +88,10 @@ export async function getThumbmark(options?: optionsInterface): Promise<thumbmar
191
88
  const info: infoInterface = apiResult?.info || { uniqueness: { score: 'api only' } };
192
89
  const thumbmark = hash(JSON.stringify(components));
193
90
  const version = getVersion();
194
- logThumbmarkData(thumbmark, components, _options).catch(() => { /* do nothing */ });
91
+ // Only log to server when not in debug mode
92
+ if (shouldLog) {
93
+ logThumbmarkData(thumbmark, components, _options, experimentalComponents).catch(() => { /* do nothing */ });
94
+ }
195
95
 
196
96
  const result: thumbmarkResponse = {
197
97
  ...(apiResult?.visitorId && { visitorId: apiResult.visitorId }),
@@ -200,6 +100,7 @@ export async function getThumbmark(options?: optionsInterface): Promise<thumbmar
200
100
  info,
201
101
  version,
202
102
  ...maybeElapsed,
103
+ ...(Object.keys(experimentalComponents).length > 0 && _options.experimental && { experimental: experimentalComponents }),
203
104
  };
204
105
 
205
106
  return result;
@@ -244,6 +145,4 @@ export async function resolveClientComponents(
244
145
  return { elapsed, resolvedComponents };
245
146
  }
246
147
 
247
-
248
-
249
148
  export { globalIncludeComponent as includeComponent };
package/src/options.ts CHANGED
@@ -8,6 +8,7 @@ export interface optionsInterface {
8
8
  cache_api_call?: boolean,
9
9
  performance?: boolean,
10
10
  stabilize?: string[],
11
+ experimental?: boolean,
11
12
  }
12
13
 
13
14
  export const API_ENDPOINT = 'https://api.thumbmarkjs.com';
@@ -19,7 +20,8 @@ export const defaultOptions: optionsInterface = {
19
20
  logging: true,
20
21
  timeout: 5000,
21
22
  cache_api_call: true,
22
- performance: false
23
+ performance: false,
24
+ experimental: false,
23
25
  };
24
26
 
25
27
  export let options = {...defaultOptions};
package/src/utils/log.ts CHANGED
@@ -10,11 +10,12 @@ import { API_ENDPOINT } from '../options';
10
10
  * You can disable this by setting options.logging to false.
11
11
  * @internal
12
12
  */
13
- export async function logThumbmarkData(thisHash: string, thumbmarkData: componentInterface, options: optionsInterface): Promise<void> {
13
+ export async function logThumbmarkData(thisHash: string, thumbmarkData: componentInterface, options: optionsInterface, experimentalData: componentInterface = {}): Promise<void> {
14
14
  const url = `${API_ENDPOINT}/log`;
15
15
  const payload = {
16
16
  thumbmark: thisHash,
17
17
  components: thumbmarkData,
18
+ experimental: experimentalData,
18
19
  version: getVersion(),
19
20
  options,
20
21
  path: window?.location?.pathname,
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getAudio(): Promise<componentInterface | null>;
@@ -1,3 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getCanvas(): Promise<componentInterface | null>;
3
- export declare function generateCanvasFingerprint(): Promise<componentInterface>;
@@ -1,4 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- import { optionsInterface } from '../../options';
3
- export default function getFonts(options?: optionsInterface): Promise<componentInterface | null>;
4
- export declare function getFontMetrics(): Promise<componentInterface>;
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getHardware(): Promise<componentInterface>;
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getLocales(): Promise<componentInterface>;
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getMath(): Promise<componentInterface>;
@@ -1,3 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- import { optionsInterface } from '../../options';
3
- export default function getPermissions(options?: optionsInterface): Promise<componentInterface>;
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getPlugins(): Promise<componentInterface | null>;
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getScreen(): Promise<componentInterface>;
@@ -1,7 +0,0 @@
1
- interface BrowserResult {
2
- name: string;
3
- version: string;
4
- }
5
- export declare function getBrowser(): BrowserResult;
6
- export declare function isMobileUserAgent(): boolean;
7
- export {};
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getSystem(): Promise<componentInterface>;
@@ -1,2 +0,0 @@
1
- import { componentInterface } from '../../factory';
2
- export default function getWebGL(): Promise<componentInterface>;
@@ -1,51 +0,0 @@
1
- /**
2
- * This file is used to create the includeComponent function as well as the interfaces each of the
3
- * fingerprint components must implement.
4
- *
5
- */
6
- import { optionsInterface } from './options';
7
- import getAudio from "./components/audio";
8
- import getCanvas from "./components/canvas";
9
- import getFonts from "./components/fonts";
10
- import getHardware from "./components/hardware";
11
- import getLocales from "./components/locales";
12
- import getMath from "./components/math";
13
- import getPermissions from "./components/permissions";
14
- import getPlugins from "./components/plugins";
15
- import getScreen from "./components/screen";
16
- import getSystem from "./components/system";
17
- import getWebGL from "./components/webgl";
18
- /**
19
- * @description key->function map of built-in components. Do not call the function here.
20
- */
21
- export declare const tm_component_promises: {
22
- audio: typeof getAudio;
23
- canvas: typeof getCanvas;
24
- fonts: typeof getFonts;
25
- hardware: typeof getHardware;
26
- locales: typeof getLocales;
27
- math: typeof getMath;
28
- permissions: typeof getPermissions;
29
- plugins: typeof getPlugins;
30
- screen: typeof getScreen;
31
- system: typeof getSystem;
32
- webgl: typeof getWebGL;
33
- };
34
- export interface componentInterface {
35
- [key: string]: string | string[] | number | boolean | componentInterface;
36
- }
37
- export interface componentFunctionInterface {
38
- (options?: optionsInterface): Promise<componentInterface | null>;
39
- }
40
- export declare const customComponents: {
41
- [name: string]: componentFunctionInterface | null;
42
- };
43
- export declare const timeoutInstance: componentInterface;
44
- /**
45
- * includeComponent is the function each custom component function needs to call in order for the component to be included
46
- * in the fingerprint.
47
- * @param {string} name - the name identifier of the component
48
- * @param {componentFunctionInterface} creationFunction - the function that implements the component
49
- * @returns nothing
50
- */
51
- export declare const includeComponent: (name: string, creationFunction: componentFunctionInterface, options?: optionsInterface) => void;
@@ -1,10 +0,0 @@
1
- import { componentInterface } from "../factory";
2
- import { optionsInterface } from "../options";
3
- /**
4
- * Filters a componentInterface object based on include/exclude and stabilization options.
5
- *
6
- * @param obj - The object to filter
7
- * @param options - Filtering options
8
- * @returns Filtered object
9
- */
10
- export declare function filterThumbmarkData(obj: componentInterface, options?: optionsInterface): componentInterface;
@@ -1,89 +0,0 @@
1
- /**
2
- * ThumbmarkJS: Main fingerprinting and API logic
3
- *
4
- * This module handles component collection, API calls, uniqueness scoring, and data filtering
5
- * for the ThumbmarkJS browser fingerprinting library.
6
- *
7
- * Exports:
8
- * - getThumbmark
9
- * - getThumbmarkDataFromPromiseMap
10
- * - resolveClientComponents
11
- * - filterThumbmarkData
12
- *
13
- * Internal helpers and types are also defined here.
14
- */
15
- import { optionsInterface } from "../options";
16
- import { componentInterface, includeComponent as globalIncludeComponent } from "../factory";
17
- /**
18
- * Info returned from the API (IP, classification, uniqueness, etc)
19
- */
20
- interface infoInterface {
21
- ip_address?: {
22
- ip_address: string;
23
- ip_identifier: string;
24
- autonomous_system_number: number;
25
- ip_version: 'v6' | 'v4';
26
- };
27
- classification?: {
28
- tor: boolean;
29
- vpn: boolean;
30
- bot: boolean;
31
- datacenter: boolean;
32
- danger_level: number;
33
- };
34
- uniqueness?: {
35
- score: number | string;
36
- };
37
- timed_out?: boolean;
38
- }
39
- /**
40
- * API response structure
41
- */
42
- interface apiResponse {
43
- info?: infoInterface;
44
- version?: string;
45
- components?: componentInterface;
46
- visitorId?: string;
47
- }
48
- /**
49
- * Final thumbmark response structure
50
- */
51
- interface thumbmarkResponse {
52
- components: componentInterface;
53
- info: {
54
- [key: string]: any;
55
- };
56
- version: string;
57
- thumbmark: string;
58
- visitorId?: string;
59
- /**
60
- * Only present if options.performance is true.
61
- */
62
- elapsed?: any;
63
- }
64
- /**
65
- * Calls the Thumbmark API with the given components, using caching and deduplication.
66
- * Returns a promise for the API response or null on error.
67
- */
68
- export declare const getApiPromise: (options: optionsInterface, components: componentInterface) => Promise<apiResponse | null>;
69
- /**
70
- * Main entry point: collects all components, optionally calls API, and returns thumbmark data.
71
- *
72
- * @param options - Options for fingerprinting and API
73
- * @returns thumbmarkResponse (elapsed is present only if options.performance is true)
74
- */
75
- export declare function getThumbmark(options?: optionsInterface): Promise<thumbmarkResponse>;
76
- /**
77
- * Resolves and times all filtered component promises from a component function map.
78
- *
79
- * @param comps - Map of component functions
80
- * @param options - Options for filtering and timing
81
- * @returns Object with elapsed times and filtered resolved components
82
- */
83
- export declare function resolveClientComponents(comps: {
84
- [key: string]: (options?: optionsInterface) => Promise<componentInterface | null>;
85
- }, options?: optionsInterface): Promise<{
86
- elapsed: Record<string, number>;
87
- resolvedComponents: componentInterface;
88
- }>;
89
- export { globalIncludeComponent as includeComponent };
@@ -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,8 +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
- export { Thumbmark, getThumbmark, getVersion, filterThumbmarkData, optionsInterface, stabilizationExclusionRules, setOption, getFingerprint, getFingerprintData, getFingerprintPerformance, includeComponent };
@@ -1,43 +0,0 @@
1
- export interface optionsInterface {
2
- exclude?: string[];
3
- include?: string[];
4
- permissions_to_check?: PermissionName[];
5
- timeout?: number;
6
- logging?: boolean;
7
- api_key?: string;
8
- cache_api_call?: boolean;
9
- performance?: boolean;
10
- stabilize?: string[];
11
- }
12
- export declare const API_ENDPOINT = "https://api.thumbmarkjs.com";
13
- export declare const defaultOptions: optionsInterface;
14
- export declare let options: {
15
- exclude?: string[] | undefined;
16
- include?: string[] | undefined;
17
- permissions_to_check?: PermissionName[] | undefined;
18
- timeout?: number | undefined;
19
- logging?: boolean | undefined;
20
- api_key?: string | undefined;
21
- cache_api_call?: boolean | undefined;
22
- performance?: boolean | undefined;
23
- stabilize?: string[] | undefined;
24
- };
25
- /**
26
- *
27
- * @param key @deprecated this function will be removed
28
- * @param value
29
- */
30
- export declare function setOption<K extends keyof optionsInterface>(key: K, value: optionsInterface[K]): void;
31
- export declare const stabilizationExclusionRules: {
32
- private: {
33
- exclude: string[];
34
- browsers: string[];
35
- }[];
36
- iframe: {
37
- exclude: string[];
38
- browsers: string[];
39
- }[];
40
- vpn: {
41
- exclude: string[];
42
- }[];
43
- };
@@ -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 +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): 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,4 +0,0 @@
1
- /**
2
- * Returns the current package version
3
- */
4
- export declare function getVersion(): string;