@zaplier/sdk 1.1.2 → 1.1.3

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
@@ -5703,147 +5703,31 @@ async function collectFingerprint(options = {}) {
5703
5703
  platform: (browser?.platform || "unknown").toLowerCase(),
5704
5704
  // PRIORITY 5: Device type (critical for differentiation, ultra-stable)
5705
5705
  deviceType,
5706
- // PRIORITY 6: Enhanced screen resolution - ONLY for mobile/tablet
5707
- // CRITICAL: Desktop screen detection is UNSTABLE with DevTools (viewport changes)
5708
- // For desktop, we rely on hardware + display + platform for differentiation
5709
- // For mobile/tablet, screen is STABLE (no DevTools viewport issues)
5710
- screen: screen && (deviceType === "mobile" || deviceType === "tablet")
5711
- ? (() => {
5712
- // Use enhanced screen buckets for modern display landscape
5713
- const dims = [screen.width, screen.height].sort((a, b) => b - a);
5714
- const w = dims[0];
5715
- const h = dims[1];
5716
- // Enhanced screen bucketing based on 2024 display standards
5717
- const getScreenBucket = (width, height) => {
5718
- // Ultra-high resolution displays (2024: 8K, 5K, etc.)
5719
- if (width >= 7680)
5720
- return "8k"; // 8K displays
5721
- if (width >= 5120)
5722
- return "5k"; // 5K displays (iMac, etc.)
5723
- if (width >= 4096)
5724
- return "4k_cinema"; // Cinema 4K
5725
- if (width >= 3840)
5726
- return "4k_uhd"; // 4K UHD standard
5727
- if (width >= 3440)
5728
- return "ultrawide"; // Ultrawide QHD
5729
- if (width >= 2880)
5730
- return "retina_4k"; // Retina 4K/5K scaled
5731
- if (width >= 2560)
5732
- return "qhd"; // QHD/WQHD
5733
- // Standard high-resolution displays
5734
- if (width >= 2048)
5735
- return "qxga"; // QXGA
5736
- if (width >= 1920)
5737
- return "fhd"; // Full HD 1080p
5738
- if (width >= 1680)
5739
- return "wsxga+"; // WSXGA+
5740
- if (width >= 1600)
5741
- return "uxga"; // UXGA
5742
- if (width >= 1440)
5743
- return "wxga++"; // WXGA++
5744
- if (width >= 1366)
5745
- return "hd"; // HD 720p
5746
- if (width >= 1280)
5747
- return "sxga"; // SXGA
5748
- // Tablet and mobile displays
5749
- if (width >= 1024)
5750
- return "xga"; // XGA (tablets)
5751
- if (width >= 768)
5752
- return "svga"; // SVGA (small tablets)
5753
- if (width >= 640)
5754
- return "vga"; // VGA (phones)
5755
- if (width >= 480)
5756
- return "hvga"; // HVGA (older phones)
5757
- if (width >= 320)
5758
- return "qvga"; // QVGA (legacy phones)
5759
- return "minimal"; // Sub-QVGA
5760
- };
5761
- // Enhanced aspect ratio classification for device type hints
5762
- const getAspectRatioClass = (width, height) => {
5763
- if (height === 0)
5764
- return "unknown";
5765
- const ratio = width / height;
5766
- // Ultra-wide displays (gaming, productivity)
5767
- if (ratio >= 3.0)
5768
- return "super_ultrawide"; // 32:9+
5769
- if (ratio >= 2.3)
5770
- return "ultrawide"; // 21:9
5771
- if (ratio >= 2.0)
5772
- return "wide"; // 18:9
5773
- // Standard desktop ratios
5774
- if (ratio >= 1.7 && ratio <= 1.8)
5775
- return "standard"; // 16:9
5776
- if (ratio >= 1.6 && ratio <= 1.67)
5777
- return "classic"; // 16:10, 5:3
5778
- if (ratio >= 1.3 && ratio <= 1.35)
5779
- return "traditional"; // 4:3
5780
- // Mobile/portrait ratios
5781
- if (ratio >= 0.5 && ratio <= 0.8)
5782
- return "mobile_portrait"; // Phones in portrait
5783
- if (ratio >= 0.4 && ratio <= 0.5)
5784
- return "tall_mobile"; // Modern tall phones
5785
- return "custom"; // Non-standard ratio
5786
- };
5787
- // Ensure w and h are valid numbers
5788
- const width = w || 0;
5789
- const height = h || 0;
5790
- // Screen density class based on common DPR patterns
5791
- const getDensityClass = (pixelRatio) => {
5792
- if (!pixelRatio)
5793
- return "standard";
5794
- if (pixelRatio >= 3.0)
5795
- return "ultra_high"; // iPhone Plus, high-end Android
5796
- if (pixelRatio >= 2.0)
5797
- return "high"; // Retina, standard high-DPI
5798
- if (pixelRatio >= 1.5)
5799
- return "medium"; // Mid-range displays
5800
- if (pixelRatio >= 1.25)
5801
- return "enhanced"; // Slightly enhanced DPI
5802
- return "standard"; // Standard 1x displays
5803
- };
5804
- // CRITICAL: Do NOT include exact dimensions in stableCoreVector for mobile!
5805
- // Reason: Screen dimensions change when:
5806
- // - Chrome address bar appears/disappears (scroll behavior)
5807
- // - Virtual keyboard opens/closes
5808
- // - Screen rotates (portrait ↔ landscape)
5809
- // - Browser zoom changes
5810
- // These changes would cause stableCoreHash to change, breaking visitor identification
5811
- //
5812
- // INSTEAD: Use ONLY stable screen characteristics (bucket, aspect, density)
5813
- // For device differentiation (S22 vs A54), use:
5814
- // - screenFrame (bezel measurements)
5815
- // - Combination of bucket + hardware + display
5816
- // - Vector similarity in IdentityResolver
5817
- return {
5818
- bucket: getScreenBucket(width),
5819
- aspectClass: getAspectRatioClass(width, height),
5820
- densityClass: getDensityClass(screen.pixelRatio || window.devicePixelRatio),
5821
- // Simplified ratio for matching (rounded to prevent micro-variations)
5822
- ratio: height > 0 ? Math.round((width / height) * 100) / 100 : 0,
5823
- // Size category for general device classification
5824
- sizeCategory: width >= 2560
5825
- ? "large"
5826
- : width >= 1920
5827
- ? "desktop"
5828
- : width >= 1024
5829
- ? "laptop"
5830
- : width >= 768
5831
- ? "tablet"
5832
- : "mobile",
5833
- // ❌ REMOVED: exact dimensions (causes instability on mobile)
5834
- // Device differentiation is now handled by:
5835
- // 1. screenFrame (bezel measurements - stable)
5836
- // 2. hardware + display combination
5837
- // 3. Vector similarity in IdentityResolver
5838
- };
5839
- })()
5840
- : {
5841
- bucket: "unknown",
5842
- aspectClass: "unknown",
5843
- densityClass: "unknown",
5844
- ratio: 0,
5845
- sizeCategory: "unknown",
5846
- },
5706
+ // PRIORITY 6: Screen - REMOVED FROM stableCoreVector
5707
+ // REASON: Screen properties are UNSTABLE across all device types:
5708
+ //
5709
+ // Desktop:
5710
+ // - DevTools changes viewport (lateral vs bottom)
5711
+ // - Browser zoom changes dimensions
5712
+ // - Window resize changes available space
5713
+ //
5714
+ // Mobile:
5715
+ // - Address bar appears/disappears on scroll
5716
+ // - Virtual keyboard opens/closes
5717
+ // - Screen rotation (portrait ↔ landscape)
5718
+ // - Pull-to-refresh changes viewport
5719
+ //
5720
+ // RESULT: Even "bucket" detection is unreliable due to viewport changes
5721
+ //
5722
+ // SOLUTION: Device differentiation now relies ONLY on:
5723
+ // 1. screenFrame (bezel measurements - MORE stable)
5724
+ // 2. hardware (cores, memory, arch - STABLE)
5725
+ // 3. display (color depth, gamut - STABLE)
5726
+ // 4. platform + deviceType + ua (ULTRA-STABLE)
5727
+ // 5. timezone + primaryLanguage (USER-STABLE)
5728
+ //
5729
+ // Note: screen is still collected in full fingerprint for analytics,
5730
+ // but excluded from stableCoreHash to ensure visitor identification stability
5847
5731
  // CRITICAL: Do NOT include availability flags (canvas/webgl/audio) in stableCoreVector
5848
5732
  // These flags can change between requests due to timeouts, permissions, or hardware issues
5849
5733
  // and would cause the stableCoreHash to change, breaking visitor identification
@@ -6034,12 +5918,13 @@ async function collectFingerprint(options = {}) {
6034
5918
  };
6035
5919
  // ADDITIONAL ENTROPY: Add a deterministic but unique component based on ultra-stable signals
6036
5920
  // This helps prevent collisions while maintaining deterministic behavior
5921
+ // Note: screen removed as it's unstable (viewport changes)
6037
5922
  const entropyComponents = [
6038
5923
  coreVector.ua || "",
6039
5924
  coreVector.platform || "",
6040
5925
  coreVector.deviceType || "",
6041
- coreVector.screen?.bucket || "",
6042
5926
  coreVector.timezone || "",
5927
+ coreVector.primaryLanguage || "",
6043
5928
  ].filter(Boolean);
6044
5929
  if (entropyComponents.length >= 3) {
6045
5930
  // Create a stable entropy string from the most stable components
@@ -6064,15 +5949,18 @@ async function collectFingerprint(options = {}) {
6064
5949
  // - Screen frame (can vary slightly)
6065
5950
  // - Vendor flavors (can change)
6066
5951
  // - Exact hardware values (use buckets)
6067
- // DEBUG: Log coreVector components to identify DevTools instability
5952
+ // DEBUG: Log coreVector components for monitoring
6068
5953
  if (opts.debug ||
6069
5954
  (typeof window !== "undefined" && window._rabbitTrackerDebug)) {
6070
5955
  console.log("[RabbitTracker DEBUG] coreVector components:", {
6071
5956
  ua: coreVector.ua,
6072
5957
  platform: coreVector.platform,
6073
5958
  deviceType: coreVector.deviceType,
6074
- screenBucket: coreVector.screen?.bucket,
6075
5959
  timezone: coreVector.timezone,
5960
+ primaryLanguage: coreVector.primaryLanguage,
5961
+ hasHardware: !!coreVector.hardware,
5962
+ hasDisplay: !!coreVector.display,
5963
+ hasScreenFrame: !!coreVector.screenFrame,
6076
5964
  _entropy: coreVector._entropy,
6077
5965
  });
6078
5966
  }
@@ -6118,7 +6006,10 @@ async function collectFingerprint(options = {}) {
6118
6006
  ua: coreVector.ua,
6119
6007
  deviceType: coreVector.deviceType,
6120
6008
  platform: coreVector.platform,
6121
- screenBucket: coreVector.screen?.bucket,
6009
+ timezone: coreVector.timezone,
6010
+ hasScreenFrame: !!coreVector.screenFrame,
6011
+ hardwareClass: coreVector.hardware?.class,
6012
+ displayClass: coreVector.display?.class,
6122
6013
  totalComponentsInHash: Object.keys(enhancedComponentValues).length,
6123
6014
  });
6124
6015
  }