@zaplier/sdk 1.1.2 → 1.1.4
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 +52 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +52 -150
- package/dist/index.esm.js.map +1 -1
- package/dist/sdk.js +52 -150
- 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/package.json +1 -1
package/dist/sdk.js
CHANGED
|
@@ -5696,156 +5696,51 @@
|
|
|
5696
5696
|
timezone: browser?.timezone || "unknown",
|
|
5697
5697
|
// PRIORITY 3: Primary language only (most stable language preference)
|
|
5698
5698
|
// Remove secondary languages as they can change more frequently
|
|
5699
|
-
primaryLanguage:
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5699
|
+
primaryLanguage: (() => {
|
|
5700
|
+
try {
|
|
5701
|
+
const languages = browser?.languages;
|
|
5702
|
+
if (Array.isArray(languages) && languages.length > 0 && languages[0]) {
|
|
5703
|
+
return languages[0].toLowerCase().split("-")[0]; // Only language code (en, pt, fr), not region
|
|
5704
|
+
}
|
|
5705
|
+
// Fallback to navigator.language if browser.languages is not available
|
|
5706
|
+
if (typeof navigator !== 'undefined' && navigator.language) {
|
|
5707
|
+
return navigator.language.toLowerCase().split("-")[0];
|
|
5708
|
+
}
|
|
5709
|
+
return "unknown";
|
|
5710
|
+
}
|
|
5711
|
+
catch {
|
|
5712
|
+
return "unknown";
|
|
5713
|
+
}
|
|
5714
|
+
})(),
|
|
5704
5715
|
// PRIORITY 4: Platform (ultra-stable - OS doesn't change)
|
|
5705
5716
|
platform: (browser?.platform || "unknown").toLowerCase(),
|
|
5706
5717
|
// PRIORITY 5: Device type (critical for differentiation, ultra-stable)
|
|
5707
5718
|
deviceType,
|
|
5708
|
-
// PRIORITY 6:
|
|
5709
|
-
//
|
|
5710
|
-
//
|
|
5711
|
-
//
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
if (width >= 2560)
|
|
5734
|
-
return "qhd"; // QHD/WQHD
|
|
5735
|
-
// Standard high-resolution displays
|
|
5736
|
-
if (width >= 2048)
|
|
5737
|
-
return "qxga"; // QXGA
|
|
5738
|
-
if (width >= 1920)
|
|
5739
|
-
return "fhd"; // Full HD 1080p
|
|
5740
|
-
if (width >= 1680)
|
|
5741
|
-
return "wsxga+"; // WSXGA+
|
|
5742
|
-
if (width >= 1600)
|
|
5743
|
-
return "uxga"; // UXGA
|
|
5744
|
-
if (width >= 1440)
|
|
5745
|
-
return "wxga++"; // WXGA++
|
|
5746
|
-
if (width >= 1366)
|
|
5747
|
-
return "hd"; // HD 720p
|
|
5748
|
-
if (width >= 1280)
|
|
5749
|
-
return "sxga"; // SXGA
|
|
5750
|
-
// Tablet and mobile displays
|
|
5751
|
-
if (width >= 1024)
|
|
5752
|
-
return "xga"; // XGA (tablets)
|
|
5753
|
-
if (width >= 768)
|
|
5754
|
-
return "svga"; // SVGA (small tablets)
|
|
5755
|
-
if (width >= 640)
|
|
5756
|
-
return "vga"; // VGA (phones)
|
|
5757
|
-
if (width >= 480)
|
|
5758
|
-
return "hvga"; // HVGA (older phones)
|
|
5759
|
-
if (width >= 320)
|
|
5760
|
-
return "qvga"; // QVGA (legacy phones)
|
|
5761
|
-
return "minimal"; // Sub-QVGA
|
|
5762
|
-
};
|
|
5763
|
-
// Enhanced aspect ratio classification for device type hints
|
|
5764
|
-
const getAspectRatioClass = (width, height) => {
|
|
5765
|
-
if (height === 0)
|
|
5766
|
-
return "unknown";
|
|
5767
|
-
const ratio = width / height;
|
|
5768
|
-
// Ultra-wide displays (gaming, productivity)
|
|
5769
|
-
if (ratio >= 3.0)
|
|
5770
|
-
return "super_ultrawide"; // 32:9+
|
|
5771
|
-
if (ratio >= 2.3)
|
|
5772
|
-
return "ultrawide"; // 21:9
|
|
5773
|
-
if (ratio >= 2.0)
|
|
5774
|
-
return "wide"; // 18:9
|
|
5775
|
-
// Standard desktop ratios
|
|
5776
|
-
if (ratio >= 1.7 && ratio <= 1.8)
|
|
5777
|
-
return "standard"; // 16:9
|
|
5778
|
-
if (ratio >= 1.6 && ratio <= 1.67)
|
|
5779
|
-
return "classic"; // 16:10, 5:3
|
|
5780
|
-
if (ratio >= 1.3 && ratio <= 1.35)
|
|
5781
|
-
return "traditional"; // 4:3
|
|
5782
|
-
// Mobile/portrait ratios
|
|
5783
|
-
if (ratio >= 0.5 && ratio <= 0.8)
|
|
5784
|
-
return "mobile_portrait"; // Phones in portrait
|
|
5785
|
-
if (ratio >= 0.4 && ratio <= 0.5)
|
|
5786
|
-
return "tall_mobile"; // Modern tall phones
|
|
5787
|
-
return "custom"; // Non-standard ratio
|
|
5788
|
-
};
|
|
5789
|
-
// Ensure w and h are valid numbers
|
|
5790
|
-
const width = w || 0;
|
|
5791
|
-
const height = h || 0;
|
|
5792
|
-
// Screen density class based on common DPR patterns
|
|
5793
|
-
const getDensityClass = (pixelRatio) => {
|
|
5794
|
-
if (!pixelRatio)
|
|
5795
|
-
return "standard";
|
|
5796
|
-
if (pixelRatio >= 3.0)
|
|
5797
|
-
return "ultra_high"; // iPhone Plus, high-end Android
|
|
5798
|
-
if (pixelRatio >= 2.0)
|
|
5799
|
-
return "high"; // Retina, standard high-DPI
|
|
5800
|
-
if (pixelRatio >= 1.5)
|
|
5801
|
-
return "medium"; // Mid-range displays
|
|
5802
|
-
if (pixelRatio >= 1.25)
|
|
5803
|
-
return "enhanced"; // Slightly enhanced DPI
|
|
5804
|
-
return "standard"; // Standard 1x displays
|
|
5805
|
-
};
|
|
5806
|
-
// CRITICAL: Do NOT include exact dimensions in stableCoreVector for mobile!
|
|
5807
|
-
// Reason: Screen dimensions change when:
|
|
5808
|
-
// - Chrome address bar appears/disappears (scroll behavior)
|
|
5809
|
-
// - Virtual keyboard opens/closes
|
|
5810
|
-
// - Screen rotates (portrait ↔ landscape)
|
|
5811
|
-
// - Browser zoom changes
|
|
5812
|
-
// These changes would cause stableCoreHash to change, breaking visitor identification
|
|
5813
|
-
//
|
|
5814
|
-
// INSTEAD: Use ONLY stable screen characteristics (bucket, aspect, density)
|
|
5815
|
-
// For device differentiation (S22 vs A54), use:
|
|
5816
|
-
// - screenFrame (bezel measurements)
|
|
5817
|
-
// - Combination of bucket + hardware + display
|
|
5818
|
-
// - Vector similarity in IdentityResolver
|
|
5819
|
-
return {
|
|
5820
|
-
bucket: getScreenBucket(width),
|
|
5821
|
-
aspectClass: getAspectRatioClass(width, height),
|
|
5822
|
-
densityClass: getDensityClass(screen.pixelRatio || window.devicePixelRatio),
|
|
5823
|
-
// Simplified ratio for matching (rounded to prevent micro-variations)
|
|
5824
|
-
ratio: height > 0 ? Math.round((width / height) * 100) / 100 : 0,
|
|
5825
|
-
// Size category for general device classification
|
|
5826
|
-
sizeCategory: width >= 2560
|
|
5827
|
-
? "large"
|
|
5828
|
-
: width >= 1920
|
|
5829
|
-
? "desktop"
|
|
5830
|
-
: width >= 1024
|
|
5831
|
-
? "laptop"
|
|
5832
|
-
: width >= 768
|
|
5833
|
-
? "tablet"
|
|
5834
|
-
: "mobile",
|
|
5835
|
-
// ❌ REMOVED: exact dimensions (causes instability on mobile)
|
|
5836
|
-
// Device differentiation is now handled by:
|
|
5837
|
-
// 1. screenFrame (bezel measurements - stable)
|
|
5838
|
-
// 2. hardware + display combination
|
|
5839
|
-
// 3. Vector similarity in IdentityResolver
|
|
5840
|
-
};
|
|
5841
|
-
})()
|
|
5842
|
-
: {
|
|
5843
|
-
bucket: "unknown",
|
|
5844
|
-
aspectClass: "unknown",
|
|
5845
|
-
densityClass: "unknown",
|
|
5846
|
-
ratio: 0,
|
|
5847
|
-
sizeCategory: "unknown",
|
|
5848
|
-
},
|
|
5719
|
+
// ❌ PRIORITY 6: Screen - REMOVED FROM stableCoreVector
|
|
5720
|
+
// REASON: Screen properties are UNSTABLE across all device types:
|
|
5721
|
+
//
|
|
5722
|
+
// Desktop:
|
|
5723
|
+
// - DevTools changes viewport (lateral vs bottom)
|
|
5724
|
+
// - Browser zoom changes dimensions
|
|
5725
|
+
// - Window resize changes available space
|
|
5726
|
+
//
|
|
5727
|
+
// Mobile:
|
|
5728
|
+
// - Address bar appears/disappears on scroll
|
|
5729
|
+
// - Virtual keyboard opens/closes
|
|
5730
|
+
// - Screen rotation (portrait ↔ landscape)
|
|
5731
|
+
// - Pull-to-refresh changes viewport
|
|
5732
|
+
//
|
|
5733
|
+
// RESULT: Even "bucket" detection is unreliable due to viewport changes
|
|
5734
|
+
//
|
|
5735
|
+
// SOLUTION: Device differentiation now relies ONLY on:
|
|
5736
|
+
// 1. screenFrame (bezel measurements - MORE stable)
|
|
5737
|
+
// 2. hardware (cores, memory, arch - STABLE)
|
|
5738
|
+
// 3. display (color depth, gamut - STABLE)
|
|
5739
|
+
// 4. platform + deviceType + ua (ULTRA-STABLE)
|
|
5740
|
+
// 5. timezone + primaryLanguage (USER-STABLE)
|
|
5741
|
+
//
|
|
5742
|
+
// Note: screen is still collected in full fingerprint for analytics,
|
|
5743
|
+
// but excluded from stableCoreHash to ensure visitor identification stability
|
|
5849
5744
|
// CRITICAL: Do NOT include availability flags (canvas/webgl/audio) in stableCoreVector
|
|
5850
5745
|
// These flags can change between requests due to timeouts, permissions, or hardware issues
|
|
5851
5746
|
// and would cause the stableCoreHash to change, breaking visitor identification
|
|
@@ -6036,12 +5931,13 @@
|
|
|
6036
5931
|
};
|
|
6037
5932
|
// ADDITIONAL ENTROPY: Add a deterministic but unique component based on ultra-stable signals
|
|
6038
5933
|
// This helps prevent collisions while maintaining deterministic behavior
|
|
5934
|
+
// Note: screen removed as it's unstable (viewport changes)
|
|
6039
5935
|
const entropyComponents = [
|
|
6040
5936
|
coreVector.ua || "",
|
|
6041
5937
|
coreVector.platform || "",
|
|
6042
5938
|
coreVector.deviceType || "",
|
|
6043
|
-
coreVector.screen?.bucket || "",
|
|
6044
5939
|
coreVector.timezone || "",
|
|
5940
|
+
coreVector.primaryLanguage || "",
|
|
6045
5941
|
].filter(Boolean);
|
|
6046
5942
|
if (entropyComponents.length >= 3) {
|
|
6047
5943
|
// Create a stable entropy string from the most stable components
|
|
@@ -6066,15 +5962,18 @@
|
|
|
6066
5962
|
// - Screen frame (can vary slightly)
|
|
6067
5963
|
// - Vendor flavors (can change)
|
|
6068
5964
|
// - Exact hardware values (use buckets)
|
|
6069
|
-
// DEBUG: Log coreVector components
|
|
5965
|
+
// DEBUG: Log coreVector components for monitoring
|
|
6070
5966
|
if (opts.debug ||
|
|
6071
5967
|
(typeof window !== "undefined" && window._rabbitTrackerDebug)) {
|
|
6072
5968
|
console.log("[RabbitTracker DEBUG] coreVector components:", {
|
|
6073
5969
|
ua: coreVector.ua,
|
|
6074
5970
|
platform: coreVector.platform,
|
|
6075
5971
|
deviceType: coreVector.deviceType,
|
|
6076
|
-
screenBucket: coreVector.screen?.bucket,
|
|
6077
5972
|
timezone: coreVector.timezone,
|
|
5973
|
+
primaryLanguage: coreVector.primaryLanguage,
|
|
5974
|
+
hasHardware: !!coreVector.hardware,
|
|
5975
|
+
hasDisplay: !!coreVector.display,
|
|
5976
|
+
hasScreenFrame: !!coreVector.screenFrame,
|
|
6078
5977
|
_entropy: coreVector._entropy,
|
|
6079
5978
|
});
|
|
6080
5979
|
}
|
|
@@ -6120,7 +6019,10 @@
|
|
|
6120
6019
|
ua: coreVector.ua,
|
|
6121
6020
|
deviceType: coreVector.deviceType,
|
|
6122
6021
|
platform: coreVector.platform,
|
|
6123
|
-
|
|
6022
|
+
timezone: coreVector.timezone,
|
|
6023
|
+
hasScreenFrame: !!coreVector.screenFrame,
|
|
6024
|
+
hardwareClass: coreVector.hardware?.class,
|
|
6025
|
+
displayClass: coreVector.display?.class,
|
|
6124
6026
|
totalComponentsInHash: Object.keys(enhancedComponentValues).length,
|
|
6125
6027
|
});
|
|
6126
6028
|
}
|