@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/sdk.js CHANGED
@@ -5696,11 +5696,22 @@
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: Array.isArray(browser?.languages) &&
5700
- browser.languages.length > 0 &&
5701
- browser.languages[0]
5702
- ? browser.languages[0].toLowerCase().split("-")[0] // Only language code (en, pt, fr), not region
5703
- : "unknown",
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)
@@ -7589,15 +7600,15 @@
7589
7600
  */
7590
7601
  getBrowserFingerprint() {
7591
7602
  const components = [
7592
- navigator.userAgent || '',
7593
- navigator.platform || '',
7603
+ navigator.userAgent || "",
7604
+ navigator.platform || "",
7594
7605
  screen.width || 0,
7595
7606
  screen.height || 0,
7596
7607
  new Date(2024, 0, 1).getTimezoneOffset(),
7597
- navigator.language || '',
7598
- navigator.hardwareConcurrency || 0
7608
+ navigator.language || "",
7609
+ navigator.hardwareConcurrency || 0,
7599
7610
  ];
7600
- const combined = components.join('|');
7611
+ const combined = components.join("|");
7601
7612
  let hash = 0;
7602
7613
  for (let i = 0; i < combined.length; i++) {
7603
7614
  const char = combined.charCodeAt(i);
@@ -7687,8 +7698,8 @@
7687
7698
  // Use page load time (stable during session) instead of current time
7688
7699
  performance.timeOrigin || 0,
7689
7700
  // Deterministic entropy from browser characteristics
7690
- (navigator.plugins ? navigator.plugins.length : 0),
7691
- (navigator.mimeTypes ? navigator.mimeTypes.length : 0),
7701
+ navigator.plugins ? navigator.plugins.length : 0,
7702
+ navigator.mimeTypes ? navigator.mimeTypes.length : 0,
7692
7703
  // Memory usage pattern (if available, use rounded values for stability)
7693
7704
  Math.floor((performance.memory?.usedJSHeapSize || 0) / 1000000),
7694
7705
  Math.floor((performance.memory?.totalJSHeapSize || 0) / 1000000),
@@ -7700,14 +7711,18 @@
7700
7711
  window.outerWidth || 0,
7701
7712
  Math.floor((window.devicePixelRatio || 1) * 100) / 100, // Round to 2 decimals
7702
7713
  // Canvas support (deterministic)
7703
- typeof document.createElement('canvas').getContext === 'function' ? 1 : 0,
7714
+ typeof document.createElement("canvas").getContext === "function"
7715
+ ? 1
7716
+ : 0,
7704
7717
  ];
7705
7718
  // Create deterministic entropy string
7706
7719
  const entropyString = entropyComponents.join("|");
7707
7720
  // Add deterministic checksum instead of random values
7708
7721
  let checksum = 0;
7709
7722
  for (let i = 0; i < entropyString.length; i++) {
7710
- checksum = ((checksum << 5) - checksum + entropyString.charCodeAt(i)) & 0xffffffff;
7723
+ checksum =
7724
+ ((checksum << 5) - checksum + entropyString.charCodeAt(i)) &
7725
+ 0xffffffff;
7711
7726
  }
7712
7727
  const deterministic = Math.abs(checksum).toString(36);
7713
7728
  // Advanced hash function with better distribution
@@ -7849,14 +7864,7 @@
7849
7864
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
7850
7865
  }
7851
7866
  const jsonResponse = await response.json();
7852
- // If anti-adblock is enabled, also send via anti-adblock as a backup
7853
- // (but don't wait for it or use its response)
7854
- if (this.antiAdblockManager && method === "POST") {
7855
- // Send in parallel without blocking
7856
- this.antiAdblockManager.send(data, endpoint).catch(() => {
7857
- // Silently fail - we already got the response from standard fetch
7858
- });
7859
- }
7867
+ // Return immediately - anti-adblock is only used as fallback when fetch fails
7860
7868
  return jsonResponse;
7861
7869
  }
7862
7870
  catch (error) {