@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/sdk.js CHANGED
@@ -5705,147 +5705,31 @@
5705
5705
  platform: (browser?.platform || "unknown").toLowerCase(),
5706
5706
  // PRIORITY 5: Device type (critical for differentiation, ultra-stable)
5707
5707
  deviceType,
5708
- // PRIORITY 6: Enhanced screen resolution - ONLY for mobile/tablet
5709
- // CRITICAL: Desktop screen detection is UNSTABLE with DevTools (viewport changes)
5710
- // For desktop, we rely on hardware + display + platform for differentiation
5711
- // For mobile/tablet, screen is STABLE (no DevTools viewport issues)
5712
- screen: screen && (deviceType === "mobile" || deviceType === "tablet")
5713
- ? (() => {
5714
- // Use enhanced screen buckets for modern display landscape
5715
- const dims = [screen.width, screen.height].sort((a, b) => b - a);
5716
- const w = dims[0];
5717
- const h = dims[1];
5718
- // Enhanced screen bucketing based on 2024 display standards
5719
- const getScreenBucket = (width, height) => {
5720
- // Ultra-high resolution displays (2024: 8K, 5K, etc.)
5721
- if (width >= 7680)
5722
- return "8k"; // 8K displays
5723
- if (width >= 5120)
5724
- return "5k"; // 5K displays (iMac, etc.)
5725
- if (width >= 4096)
5726
- return "4k_cinema"; // Cinema 4K
5727
- if (width >= 3840)
5728
- return "4k_uhd"; // 4K UHD standard
5729
- if (width >= 3440)
5730
- return "ultrawide"; // Ultrawide QHD
5731
- if (width >= 2880)
5732
- return "retina_4k"; // Retina 4K/5K scaled
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
- },
5708
+ // PRIORITY 6: Screen - REMOVED FROM stableCoreVector
5709
+ // REASON: Screen properties are UNSTABLE across all device types:
5710
+ //
5711
+ // Desktop:
5712
+ // - DevTools changes viewport (lateral vs bottom)
5713
+ // - Browser zoom changes dimensions
5714
+ // - Window resize changes available space
5715
+ //
5716
+ // Mobile:
5717
+ // - Address bar appears/disappears on scroll
5718
+ // - Virtual keyboard opens/closes
5719
+ // - Screen rotation (portrait ↔ landscape)
5720
+ // - Pull-to-refresh changes viewport
5721
+ //
5722
+ // RESULT: Even "bucket" detection is unreliable due to viewport changes
5723
+ //
5724
+ // SOLUTION: Device differentiation now relies ONLY on:
5725
+ // 1. screenFrame (bezel measurements - MORE stable)
5726
+ // 2. hardware (cores, memory, arch - STABLE)
5727
+ // 3. display (color depth, gamut - STABLE)
5728
+ // 4. platform + deviceType + ua (ULTRA-STABLE)
5729
+ // 5. timezone + primaryLanguage (USER-STABLE)
5730
+ //
5731
+ // Note: screen is still collected in full fingerprint for analytics,
5732
+ // but excluded from stableCoreHash to ensure visitor identification stability
5849
5733
  // CRITICAL: Do NOT include availability flags (canvas/webgl/audio) in stableCoreVector
5850
5734
  // These flags can change between requests due to timeouts, permissions, or hardware issues
5851
5735
  // and would cause the stableCoreHash to change, breaking visitor identification
@@ -6036,12 +5920,13 @@
6036
5920
  };
6037
5921
  // ADDITIONAL ENTROPY: Add a deterministic but unique component based on ultra-stable signals
6038
5922
  // This helps prevent collisions while maintaining deterministic behavior
5923
+ // Note: screen removed as it's unstable (viewport changes)
6039
5924
  const entropyComponents = [
6040
5925
  coreVector.ua || "",
6041
5926
  coreVector.platform || "",
6042
5927
  coreVector.deviceType || "",
6043
- coreVector.screen?.bucket || "",
6044
5928
  coreVector.timezone || "",
5929
+ coreVector.primaryLanguage || "",
6045
5930
  ].filter(Boolean);
6046
5931
  if (entropyComponents.length >= 3) {
6047
5932
  // Create a stable entropy string from the most stable components
@@ -6066,15 +5951,18 @@
6066
5951
  // - Screen frame (can vary slightly)
6067
5952
  // - Vendor flavors (can change)
6068
5953
  // - Exact hardware values (use buckets)
6069
- // DEBUG: Log coreVector components to identify DevTools instability
5954
+ // DEBUG: Log coreVector components for monitoring
6070
5955
  if (opts.debug ||
6071
5956
  (typeof window !== "undefined" && window._rabbitTrackerDebug)) {
6072
5957
  console.log("[RabbitTracker DEBUG] coreVector components:", {
6073
5958
  ua: coreVector.ua,
6074
5959
  platform: coreVector.platform,
6075
5960
  deviceType: coreVector.deviceType,
6076
- screenBucket: coreVector.screen?.bucket,
6077
5961
  timezone: coreVector.timezone,
5962
+ primaryLanguage: coreVector.primaryLanguage,
5963
+ hasHardware: !!coreVector.hardware,
5964
+ hasDisplay: !!coreVector.display,
5965
+ hasScreenFrame: !!coreVector.screenFrame,
6078
5966
  _entropy: coreVector._entropy,
6079
5967
  });
6080
5968
  }
@@ -6120,7 +6008,10 @@
6120
6008
  ua: coreVector.ua,
6121
6009
  deviceType: coreVector.deviceType,
6122
6010
  platform: coreVector.platform,
6123
- screenBucket: coreVector.screen?.bucket,
6011
+ timezone: coreVector.timezone,
6012
+ hasScreenFrame: !!coreVector.screenFrame,
6013
+ hardwareClass: coreVector.hardware?.class,
6014
+ displayClass: coreVector.display?.class,
6124
6015
  totalComponentsInHash: Object.keys(enhancedComponentValues).length,
6125
6016
  });
6126
6017
  }