humanbehavior-js 0.4.10 → 0.4.12

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.
@@ -13169,6 +13169,53 @@ class HumanBehaviorTracker {
13169
13169
  * This is the main entry point - call this once per page
13170
13170
  */
13171
13171
  static init(apiKey, options) {
13172
+ // ✅ SUPPRESS COMMON RRWEB ERRORS FOR CLEAN CONSOLE
13173
+ if (isBrowser && (options === null || options === void 0 ? void 0 : options.suppressConsoleErrors) !== false) {
13174
+ // Suppress canvas security errors
13175
+ const originalConsoleError = console.error;
13176
+ console.error = (...args) => {
13177
+ const message = args.join(' ');
13178
+ if (message.includes('SecurityError: Failed to execute \'toDataURL\'') ||
13179
+ message.includes('Tainted canvases may not be exported') ||
13180
+ message.includes('Cannot inline img src=') ||
13181
+ message.includes('Cross-Origin') ||
13182
+ message.includes('CORS') ||
13183
+ message.includes('Access-Control-Allow-Origin') ||
13184
+ message.includes('Failed to load resource') ||
13185
+ message.includes('net::ERR_BLOCKED_BY_CLIENT')) {
13186
+ // Silently suppress these common rrweb errors
13187
+ return;
13188
+ }
13189
+ originalConsoleError.apply(console, args);
13190
+ };
13191
+ // Suppress console.warn for similar issues
13192
+ const originalConsoleWarn = console.warn;
13193
+ console.warn = (...args) => {
13194
+ const message = args.join(' ');
13195
+ if (message.includes('Cannot inline img src=') ||
13196
+ message.includes('Cross-Origin') ||
13197
+ message.includes('CORS') ||
13198
+ message.includes('Access-Control-Allow-Origin') ||
13199
+ message.includes('Failed to load resource') ||
13200
+ message.includes('net::ERR_BLOCKED_BY_CLIENT')) {
13201
+ // Silently suppress these common rrweb warnings
13202
+ return;
13203
+ }
13204
+ originalConsoleWarn.apply(console, args);
13205
+ };
13206
+ // Add global error handler for any remaining rrweb errors
13207
+ window.addEventListener('error', (event) => {
13208
+ const message = event.message || '';
13209
+ if (message.includes('SecurityError') ||
13210
+ message.includes('Tainted canvases') ||
13211
+ message.includes('toDataURL') ||
13212
+ message.includes('Cross-Origin') ||
13213
+ message.includes('CORS')) {
13214
+ event.preventDefault();
13215
+ return false;
13216
+ }
13217
+ });
13218
+ }
13172
13219
  // Return existing instance if already initialized
13173
13220
  if (isBrowser && window.__humanBehaviorGlobalTracker) {
13174
13221
  logDebug('Tracker already initialized, returning existing instance');
@@ -13190,16 +13237,6 @@ class HumanBehaviorTracker {
13190
13237
  if ((options === null || options === void 0 ? void 0 : options.enableAutomaticTracking) !== false) {
13191
13238
  tracker.setupAutomaticTracking(options === null || options === void 0 ? void 0 : options.automaticTrackingOptions);
13192
13239
  }
13193
- // Test connection (non-blocking)
13194
- if (isBrowser) {
13195
- const testUrl = tracker.api['baseUrl'] + '/api/health';
13196
- fetch(testUrl, { method: 'HEAD' })
13197
- .then(() => logDebug('Connection test successful'))
13198
- .catch((error) => {
13199
- logWarn('Connection test failed - ad blocker may be active:', error.message);
13200
- tracker._connectionBlocked = true;
13201
- });
13202
- }
13203
13240
  // Start tracking
13204
13241
  tracker.start();
13205
13242
  return tracker;
@@ -13808,11 +13845,11 @@ class HumanBehaviorTracker {
13808
13845
  maskInputOptions: { password: true }, // HumanBehavior default
13809
13846
  maskInputFn: undefined,
13810
13847
  slimDOMOptions: {},
13811
- collectFonts: false, // HumanBehavior default
13812
- inlineStylesheet: true, // HumanBehavior default
13813
- recordCrossOriginIframes: false, // HumanBehavior default
13814
- // CANVAS RECORDING - Disabled to prevent large data URIs
13815
- recordCanvas: false, // Disabled to prevent large data URIs
13848
+ // ERROR SUPPRESSION SETTINGS - Disabled to prevent console noise
13849
+ collectFonts: false, // Disable font collection to reduce errors
13850
+ inlineStylesheet: true, // Keep styles for proper session replay
13851
+ recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
13852
+ recordCanvas: false, // Disabled to prevent large data URIs and canvas errors
13816
13853
  // ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
13817
13854
  // Rely on initial FullSnapshot + navigation-triggered ones only
13818
13855
  });