@zaplier/sdk 1.1.3 → 1.1.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/index.cjs +30 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +30 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/sdk.js +30 -22
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.min.js +1 -1
- package/dist/src/modules/fingerprint.d.ts.map +1 -1
- package/dist/src/sdk.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5690,11 +5690,22 @@ async function collectFingerprint(options = {}) {
|
|
|
5690
5690
|
timezone: browser?.timezone || "unknown",
|
|
5691
5691
|
// PRIORITY 3: Primary language only (most stable language preference)
|
|
5692
5692
|
// Remove secondary languages as they can change more frequently
|
|
5693
|
-
primaryLanguage:
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5693
|
+
primaryLanguage: (() => {
|
|
5694
|
+
try {
|
|
5695
|
+
const languages = browser?.languages;
|
|
5696
|
+
if (Array.isArray(languages) && languages.length > 0 && languages[0]) {
|
|
5697
|
+
return languages[0].toLowerCase().split("-")[0]; // Only language code (en, pt, fr), not region
|
|
5698
|
+
}
|
|
5699
|
+
// Fallback to navigator.language if browser.languages is not available
|
|
5700
|
+
if (typeof navigator !== 'undefined' && navigator.language) {
|
|
5701
|
+
return navigator.language.toLowerCase().split("-")[0];
|
|
5702
|
+
}
|
|
5703
|
+
return "unknown";
|
|
5704
|
+
}
|
|
5705
|
+
catch {
|
|
5706
|
+
return "unknown";
|
|
5707
|
+
}
|
|
5708
|
+
})(),
|
|
5698
5709
|
// PRIORITY 4: Platform (ultra-stable - OS doesn't change)
|
|
5699
5710
|
platform: (browser?.platform || "unknown").toLowerCase(),
|
|
5700
5711
|
// PRIORITY 5: Device type (critical for differentiation, ultra-stable)
|
|
@@ -7583,15 +7594,15 @@ class ZaplierSDK {
|
|
|
7583
7594
|
*/
|
|
7584
7595
|
getBrowserFingerprint() {
|
|
7585
7596
|
const components = [
|
|
7586
|
-
navigator.userAgent ||
|
|
7587
|
-
navigator.platform ||
|
|
7597
|
+
navigator.userAgent || "",
|
|
7598
|
+
navigator.platform || "",
|
|
7588
7599
|
screen.width || 0,
|
|
7589
7600
|
screen.height || 0,
|
|
7590
7601
|
new Date(2024, 0, 1).getTimezoneOffset(),
|
|
7591
|
-
navigator.language ||
|
|
7592
|
-
navigator.hardwareConcurrency || 0
|
|
7602
|
+
navigator.language || "",
|
|
7603
|
+
navigator.hardwareConcurrency || 0,
|
|
7593
7604
|
];
|
|
7594
|
-
const combined = components.join(
|
|
7605
|
+
const combined = components.join("|");
|
|
7595
7606
|
let hash = 0;
|
|
7596
7607
|
for (let i = 0; i < combined.length; i++) {
|
|
7597
7608
|
const char = combined.charCodeAt(i);
|
|
@@ -7681,8 +7692,8 @@ class ZaplierSDK {
|
|
|
7681
7692
|
// Use page load time (stable during session) instead of current time
|
|
7682
7693
|
performance.timeOrigin || 0,
|
|
7683
7694
|
// Deterministic entropy from browser characteristics
|
|
7684
|
-
|
|
7685
|
-
|
|
7695
|
+
navigator.plugins ? navigator.plugins.length : 0,
|
|
7696
|
+
navigator.mimeTypes ? navigator.mimeTypes.length : 0,
|
|
7686
7697
|
// Memory usage pattern (if available, use rounded values for stability)
|
|
7687
7698
|
Math.floor((performance.memory?.usedJSHeapSize || 0) / 1000000),
|
|
7688
7699
|
Math.floor((performance.memory?.totalJSHeapSize || 0) / 1000000),
|
|
@@ -7694,14 +7705,18 @@ class ZaplierSDK {
|
|
|
7694
7705
|
window.outerWidth || 0,
|
|
7695
7706
|
Math.floor((window.devicePixelRatio || 1) * 100) / 100, // Round to 2 decimals
|
|
7696
7707
|
// Canvas support (deterministic)
|
|
7697
|
-
typeof document.createElement(
|
|
7708
|
+
typeof document.createElement("canvas").getContext === "function"
|
|
7709
|
+
? 1
|
|
7710
|
+
: 0,
|
|
7698
7711
|
];
|
|
7699
7712
|
// Create deterministic entropy string
|
|
7700
7713
|
const entropyString = entropyComponents.join("|");
|
|
7701
7714
|
// Add deterministic checksum instead of random values
|
|
7702
7715
|
let checksum = 0;
|
|
7703
7716
|
for (let i = 0; i < entropyString.length; i++) {
|
|
7704
|
-
checksum =
|
|
7717
|
+
checksum =
|
|
7718
|
+
((checksum << 5) - checksum + entropyString.charCodeAt(i)) &
|
|
7719
|
+
0xffffffff;
|
|
7705
7720
|
}
|
|
7706
7721
|
const deterministic = Math.abs(checksum).toString(36);
|
|
7707
7722
|
// Advanced hash function with better distribution
|
|
@@ -7843,14 +7858,7 @@ class ZaplierSDK {
|
|
|
7843
7858
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
7844
7859
|
}
|
|
7845
7860
|
const jsonResponse = await response.json();
|
|
7846
|
-
//
|
|
7847
|
-
// (but don't wait for it or use its response)
|
|
7848
|
-
if (this.antiAdblockManager && method === "POST") {
|
|
7849
|
-
// Send in parallel without blocking
|
|
7850
|
-
this.antiAdblockManager.send(data, endpoint).catch(() => {
|
|
7851
|
-
// Silently fail - we already got the response from standard fetch
|
|
7852
|
-
});
|
|
7853
|
-
}
|
|
7861
|
+
// Return immediately - anti-adblock is only used as fallback when fetch fails
|
|
7854
7862
|
return jsonResponse;
|
|
7855
7863
|
}
|
|
7856
7864
|
catch (error) {
|