humanbehavior-js 0.4.21 → 0.4.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "humanbehavior-js",
3
- "version": "0.4.21",
3
+ "version": "0.4.22",
4
4
  "description": "SDK for HumanBehavior session and event recording",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
package/src/tracker.ts CHANGED
@@ -77,7 +77,7 @@ export class HumanBehaviorTracker {
77
77
  }): HumanBehaviorTracker {
78
78
  // ✅ SUPPRESS COMMON RRWEB ERRORS FOR CLEAN CONSOLE
79
79
  if (isBrowser && options?.suppressConsoleErrors !== false) {
80
- // Suppress canvas security errors
80
+ // Suppress canvas security errors and network errors
81
81
  const originalConsoleError = console.error;
82
82
  console.error = (...args: any[]) => {
83
83
  const message = args.join(' ');
@@ -89,9 +89,15 @@ export class HumanBehaviorTracker {
89
89
  message.includes('CORS') ||
90
90
  message.includes('Access-Control-Allow-Origin') ||
91
91
  message.includes('Failed to load resource') ||
92
- message.includes('net::ERR_BLOCKED_BY_CLIENT')
92
+ message.includes('net::ERR_BLOCKED_BY_CLIENT') ||
93
+ message.includes('NetworkError when attempting to fetch resource') ||
94
+ message.includes('Failed to fetch') ||
95
+ message.includes('TypeError: NetworkError') ||
96
+ message.includes('HumanBehavior ERROR') ||
97
+ message.includes('Failed to track custom event') ||
98
+ message.includes('Error sending custom event')
93
99
  ) {
94
- // Silently suppress these common rrweb errors
100
+ // Silently suppress these common errors
95
101
  return;
96
102
  }
97
103
  originalConsoleError.apply(console, args);
@@ -107,9 +113,13 @@ export class HumanBehaviorTracker {
107
113
  message.includes('CORS') ||
108
114
  message.includes('Access-Control-Allow-Origin') ||
109
115
  message.includes('Failed to load resource') ||
110
- message.includes('net::ERR_BLOCKED_BY_CLIENT')
116
+ message.includes('net::ERR_BLOCKED_BY_CLIENT') ||
117
+ message.includes('NetworkError when attempting to fetch resource') ||
118
+ message.includes('Failed to fetch') ||
119
+ message.includes('Custom event network error') ||
120
+ message.includes('Request blocked by ad blocker')
111
121
  ) {
112
- // Silently suppress these common rrweb warnings
122
+ // Silently suppress these common warnings
113
123
  return;
114
124
  }
115
125
  originalConsoleWarn.apply(console, args);
@@ -123,7 +133,9 @@ export class HumanBehaviorTracker {
123
133
  message.includes('Tainted canvases') ||
124
134
  message.includes('toDataURL') ||
125
135
  message.includes('Cross-Origin') ||
126
- message.includes('CORS')
136
+ message.includes('CORS') ||
137
+ message.includes('NetworkError') ||
138
+ message.includes('Failed to fetch')
127
139
  ) {
128
140
  event.preventDefault();
129
141
  return false;