@zaplier/sdk 1.0.7 → 1.0.9

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 CHANGED
@@ -5650,7 +5650,9 @@ async function collectFingerprint(options = {}) {
5650
5650
  platform: (browser?.platform || "unknown").toLowerCase(),
5651
5651
  // PRIORITY 5: Device type (critical for differentiation, ultra-stable)
5652
5652
  deviceType,
5653
- // PRIORITY 6: Enhanced screen resolution buckets with 2024 display trends
5653
+ // PRIORITY 6: Enhanced screen resolution with exact dimensions for mobile differentiation
5654
+ // For mobile devices, we NEED exact dimensions to differentiate between similar models (S22 vs A54)
5655
+ // For desktop, bucketing is sufficient as hardware varies more
5654
5656
  screen: screen
5655
5657
  ? (() => {
5656
5658
  // Use enhanced screen buckets for modern display landscape
@@ -5745,6 +5747,19 @@ async function collectFingerprint(options = {}) {
5745
5747
  return "enhanced"; // Slightly enhanced DPI
5746
5748
  return "standard"; // Standard 1x displays
5747
5749
  };
5750
+ // CRITICAL: Do NOT include exact dimensions in stableCoreVector for mobile!
5751
+ // Reason: Screen dimensions change when:
5752
+ // - Chrome address bar appears/disappears (scroll behavior)
5753
+ // - Virtual keyboard opens/closes
5754
+ // - Screen rotates (portrait ↔ landscape)
5755
+ // - Browser zoom changes
5756
+ // These changes would cause stableCoreHash to change, breaking visitor identification
5757
+ //
5758
+ // INSTEAD: Use ONLY stable screen characteristics (bucket, aspect, density)
5759
+ // For device differentiation (S22 vs A54), use:
5760
+ // - screenFrame (bezel measurements)
5761
+ // - Combination of bucket + hardware + display
5762
+ // - Vector similarity in IdentityResolver
5748
5763
  return {
5749
5764
  bucket: getScreenBucket(width),
5750
5765
  aspectClass: getAspectRatioClass(width, height),
@@ -5761,6 +5776,11 @@ async function collectFingerprint(options = {}) {
5761
5776
  : width >= 768
5762
5777
  ? "tablet"
5763
5778
  : "mobile",
5779
+ // ❌ REMOVED: exact dimensions (causes instability on mobile)
5780
+ // Device differentiation is now handled by:
5781
+ // 1. screenFrame (bezel measurements - stable)
5782
+ // 2. hardware + display combination
5783
+ // 3. Vector similarity in IdentityResolver
5764
5784
  };
5765
5785
  })()
5766
5786
  : {
@@ -5889,7 +5909,18 @@ async function collectFingerprint(options = {}) {
5889
5909
  : "none",
5890
5910
  };
5891
5911
  })(),
5892
- // PRIORITY 8: Enhanced color and display capabilities bucketing
5912
+ // PRIORITY 8: Screen frame (bezel measurements) for mobile device differentiation
5913
+ // CRITICAL: This is STABLE across page loads and provides device-specific fingerprint
5914
+ // Samsung S22 vs A54 have different screen frames despite similar resolutions
5915
+ screenFrame: deviceSignals$1?.screenFrame
5916
+ ? {
5917
+ top: deviceSignals$1.screenFrame.top || 0,
5918
+ right: deviceSignals$1.screenFrame.right || 0,
5919
+ bottom: deviceSignals$1.screenFrame.bottom || 0,
5920
+ left: deviceSignals$1.screenFrame.left || 0,
5921
+ }
5922
+ : undefined,
5923
+ // PRIORITY 9: Enhanced color and display capabilities bucketing
5893
5924
  display: (() => {
5894
5925
  const depth = deviceSignals$1.colorDepth;
5895
5926
  const gamut = deviceSignals$1.colorGamut;
@@ -5981,10 +6012,29 @@ async function collectFingerprint(options = {}) {
5981
6012
  // - Exact hardware values (use buckets)
5982
6013
  // Generate ultra-stable hash with additional collision resistance
5983
6014
  const stableCoreHash = hashStableCore(coreVector, opts.debug);
5984
- // CRITICAL: Generate enhanced fingerprint hash combining unstable + stable components
5985
- // This prevents collisions by adding stable entropy to the fingerprint hash
6015
+ // CRITICAL: Generate enhanced fingerprint hash combining STABLE components only
6016
+ // Filter out unstable components that change between requests (canvas, webgl, audio)
6017
+ // These components can vary due to GPU state, rendering context, permissions, etc.
6018
+ const unstableComponentKeys = [
6019
+ "canvas",
6020
+ "webgl",
6021
+ "audio", // Visual/audio fingerprints (vary with context)
6022
+ "mathFingerprint",
6023
+ "fontPreferences",
6024
+ "enhancedFonts", // Measurement-based (can timeout/vary)
6025
+ "dateTimeLocale",
6026
+ "accessibilityEnhanced", // Locale/accessibility (can change)
6027
+ "domBlockers",
6028
+ "pluginsEnhanced", // Privacy tools detection (can change)
6029
+ ];
6030
+ const stableComponentValues = {};
6031
+ for (const [key, value] of Object.entries(componentValues)) {
6032
+ if (!unstableComponentKeys.includes(key)) {
6033
+ stableComponentValues[key] = value;
6034
+ }
6035
+ }
5986
6036
  const enhancedComponentValues = {
5987
- ...componentValues, // Unstable components (canvas, webgl, audio, etc.)
6037
+ ...stableComponentValues, // STABLE components only (screen, browser, system, etc.)
5988
6038
  _stableCore: coreVector, // + Ultra-stable components (ua, platform, deviceType, etc.)
5989
6039
  // REMOVED: _hourlyEntropy - was causing visitor ID instability (same user = different IDs)
5990
6040
  };