@thumbmarkjs/thumbmarkjs 1.1.3-rc.3 → 1.1.3-rc.5
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.
- package/dist/thumbmark.cjs.js +1 -1
- package/dist/thumbmark.cjs.js.map +1 -1
- package/dist/thumbmark.esm.d.ts +1 -0
- package/dist/thumbmark.esm.js +1 -1
- package/dist/thumbmark.esm.js.map +1 -1
- package/dist/thumbmark.umd.js +1 -1
- package/dist/thumbmark.umd.js.map +1 -1
- package/dist/types/components/audio/index.d.ts +2 -0
- package/dist/types/components/canvas/index.d.ts +3 -0
- package/dist/types/components/fonts/index.d.ts +4 -0
- package/dist/types/components/hardware/index.d.ts +2 -0
- package/dist/types/components/locales/index.d.ts +2 -0
- package/dist/types/components/math/index.d.ts +2 -0
- package/dist/types/components/permissions/index.d.ts +3 -0
- package/dist/types/components/plugins/index.d.ts +2 -0
- package/dist/types/components/screen/index.d.ts +2 -0
- package/dist/types/components/system/browser.d.ts +7 -0
- package/dist/types/components/system/index.d.ts +2 -0
- package/dist/types/components/webgl/index.d.ts +2 -0
- package/dist/types/factory.d.ts +51 -0
- package/dist/types/functions/filterComponents.d.ts +10 -0
- package/dist/types/functions/index.d.ts +89 -0
- package/dist/types/functions/legacy_functions.d.ts +27 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/options.d.ts +43 -0
- package/dist/types/thumbmark.d.ts +26 -0
- package/dist/types/utils/commonPixels.d.ts +1 -0
- package/dist/types/utils/ephemeralIFrame.d.ts +4 -0
- package/dist/types/utils/getMostFrequent.d.ts +5 -0
- package/dist/types/utils/hash.d.ts +5 -0
- package/dist/types/utils/imageDataToDataURL.d.ts +1 -0
- package/dist/types/utils/log.d.ts +8 -0
- package/dist/types/utils/raceAll.d.ts +9 -0
- package/dist/types/utils/sort.d.ts +8 -0
- package/dist/types/utils/version.d.ts +4 -0
- package/dist/types/utils/visitorId.d.ts +11 -0
- package/package.json +1 -1
- package/src/functions/index.ts +9 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function imageDataToDataURL(imageData: ImageData): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
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>;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visitor ID storage utilities - localStorage only, server generates IDs
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Gets visitor ID from localStorage, returns null if unavailable
|
|
6
|
+
*/
|
|
7
|
+
export declare function getVisitorId(): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Sets visitor ID in localStorage
|
|
10
|
+
*/
|
|
11
|
+
export declare function setVisitorId(visitorId: string): void;
|
package/package.json
CHANGED
package/src/functions/index.ts
CHANGED
|
@@ -73,6 +73,7 @@ interface thumbmarkResponse {
|
|
|
73
73
|
info: { [key: string]: any },
|
|
74
74
|
version: string,
|
|
75
75
|
thumbmark: string,
|
|
76
|
+
visitorId?: string,
|
|
76
77
|
/**
|
|
77
78
|
* Only present if options.performance is true.
|
|
78
79
|
*/
|
|
@@ -191,13 +192,20 @@ export async function getThumbmark(options?: optionsInterface): Promise<thumbmar
|
|
|
191
192
|
const thumbmark = hash(JSON.stringify(components));
|
|
192
193
|
const version = getVersion();
|
|
193
194
|
logThumbmarkData(thumbmark, components, _options).catch(() => { /* do nothing */ });
|
|
194
|
-
|
|
195
|
+
|
|
196
|
+
const result: thumbmarkResponse = {
|
|
195
197
|
thumbmark,
|
|
196
198
|
components: components,
|
|
197
199
|
info,
|
|
198
200
|
version,
|
|
199
201
|
...maybeElapsed,
|
|
200
202
|
};
|
|
203
|
+
|
|
204
|
+
if (apiResult?.visitorId) {
|
|
205
|
+
result.visitorId = apiResult.visitorId;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return result;
|
|
201
209
|
}
|
|
202
210
|
|
|
203
211
|
// ===================== Component Resolution & Performance =====================
|