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.
@@ -13181,6 +13181,53 @@ class HumanBehaviorTracker {
13181
13181
  * This is the main entry point - call this once per page
13182
13182
  */
13183
13183
  static init(apiKey, options) {
13184
+ // ✅ SUPPRESS COMMON RRWEB ERRORS FOR CLEAN CONSOLE
13185
+ if (isBrowser && (options === null || options === void 0 ? void 0 : options.suppressConsoleErrors) !== false) {
13186
+ // Suppress canvas security errors
13187
+ const originalConsoleError = console.error;
13188
+ console.error = (...args) => {
13189
+ const message = args.join(' ');
13190
+ if (message.includes('SecurityError: Failed to execute \'toDataURL\'') ||
13191
+ message.includes('Tainted canvases may not be exported') ||
13192
+ message.includes('Cannot inline img src=') ||
13193
+ message.includes('Cross-Origin') ||
13194
+ message.includes('CORS') ||
13195
+ message.includes('Access-Control-Allow-Origin') ||
13196
+ message.includes('Failed to load resource') ||
13197
+ message.includes('net::ERR_BLOCKED_BY_CLIENT')) {
13198
+ // Silently suppress these common rrweb errors
13199
+ return;
13200
+ }
13201
+ originalConsoleError.apply(console, args);
13202
+ };
13203
+ // Suppress console.warn for similar issues
13204
+ const originalConsoleWarn = console.warn;
13205
+ console.warn = (...args) => {
13206
+ const message = args.join(' ');
13207
+ if (message.includes('Cannot inline img src=') ||
13208
+ message.includes('Cross-Origin') ||
13209
+ message.includes('CORS') ||
13210
+ message.includes('Access-Control-Allow-Origin') ||
13211
+ message.includes('Failed to load resource') ||
13212
+ message.includes('net::ERR_BLOCKED_BY_CLIENT')) {
13213
+ // Silently suppress these common rrweb warnings
13214
+ return;
13215
+ }
13216
+ originalConsoleWarn.apply(console, args);
13217
+ };
13218
+ // Add global error handler for any remaining rrweb errors
13219
+ window.addEventListener('error', (event) => {
13220
+ const message = event.message || '';
13221
+ if (message.includes('SecurityError') ||
13222
+ message.includes('Tainted canvases') ||
13223
+ message.includes('toDataURL') ||
13224
+ message.includes('Cross-Origin') ||
13225
+ message.includes('CORS')) {
13226
+ event.preventDefault();
13227
+ return false;
13228
+ }
13229
+ });
13230
+ }
13184
13231
  // Return existing instance if already initialized
13185
13232
  if (isBrowser && window.__humanBehaviorGlobalTracker) {
13186
13233
  logDebug('Tracker already initialized, returning existing instance');
@@ -13202,16 +13249,6 @@ class HumanBehaviorTracker {
13202
13249
  if ((options === null || options === void 0 ? void 0 : options.enableAutomaticTracking) !== false) {
13203
13250
  tracker.setupAutomaticTracking(options === null || options === void 0 ? void 0 : options.automaticTrackingOptions);
13204
13251
  }
13205
- // Test connection (non-blocking)
13206
- if (isBrowser) {
13207
- const testUrl = tracker.api['baseUrl'] + '/api/health';
13208
- fetch(testUrl, { method: 'HEAD' })
13209
- .then(() => logDebug('Connection test successful'))
13210
- .catch((error) => {
13211
- logWarn('Connection test failed - ad blocker may be active:', error.message);
13212
- tracker._connectionBlocked = true;
13213
- });
13214
- }
13215
13252
  // Start tracking
13216
13253
  tracker.start();
13217
13254
  return tracker;
@@ -13820,11 +13857,11 @@ class HumanBehaviorTracker {
13820
13857
  maskInputOptions: { password: true }, // HumanBehavior default
13821
13858
  maskInputFn: undefined,
13822
13859
  slimDOMOptions: {},
13823
- collectFonts: false, // HumanBehavior default
13824
- inlineStylesheet: true, // HumanBehavior default
13825
- recordCrossOriginIframes: false, // HumanBehavior default
13826
- // CANVAS RECORDING - Disabled to prevent large data URIs
13827
- recordCanvas: false, // Disabled to prevent large data URIs
13860
+ // ERROR SUPPRESSION SETTINGS - Disabled to prevent console noise
13861
+ collectFonts: false, // Disable font collection to reduce errors
13862
+ inlineStylesheet: true, // Keep styles for proper session replay
13863
+ recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
13864
+ recordCanvas: false, // Disabled to prevent large data URIs and canvas errors
13828
13865
  // ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
13829
13866
  // Rely on initial FullSnapshot + navigation-triggered ones only
13830
13867
  });