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.
- package/clean-console-demo.html +39 -0
- package/dist/cjs/angular/index.cjs +52 -15
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +52 -15
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +52 -15
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +52 -15
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +52 -15
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +52 -15
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/cli/ai-auto-install.js +0 -0
- package/dist/esm/angular/index.js +52 -15
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +52 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +52 -15
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +52 -15
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +52 -15
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +52 -15
- package/dist/esm/vue/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/types/angular/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/react/index.d.ts +1 -0
- package/dist/types/remix/index.d.ts +1 -0
- package/dist/types/svelte/index.d.ts +1 -0
- package/package.json +1 -1
- package/readme.md +26 -2
- package/src/tracker.ts +61 -17
package/dist/cjs/react/index.cjs
CHANGED
|
@@ -13173,6 +13173,53 @@ class HumanBehaviorTracker {
|
|
|
13173
13173
|
* This is the main entry point - call this once per page
|
|
13174
13174
|
*/
|
|
13175
13175
|
static init(apiKey, options) {
|
|
13176
|
+
// ✅ SUPPRESS COMMON RRWEB ERRORS FOR CLEAN CONSOLE
|
|
13177
|
+
if (isBrowser$1 && (options === null || options === void 0 ? void 0 : options.suppressConsoleErrors) !== false) {
|
|
13178
|
+
// Suppress canvas security errors
|
|
13179
|
+
const originalConsoleError = console.error;
|
|
13180
|
+
console.error = (...args) => {
|
|
13181
|
+
const message = args.join(' ');
|
|
13182
|
+
if (message.includes('SecurityError: Failed to execute \'toDataURL\'') ||
|
|
13183
|
+
message.includes('Tainted canvases may not be exported') ||
|
|
13184
|
+
message.includes('Cannot inline img src=') ||
|
|
13185
|
+
message.includes('Cross-Origin') ||
|
|
13186
|
+
message.includes('CORS') ||
|
|
13187
|
+
message.includes('Access-Control-Allow-Origin') ||
|
|
13188
|
+
message.includes('Failed to load resource') ||
|
|
13189
|
+
message.includes('net::ERR_BLOCKED_BY_CLIENT')) {
|
|
13190
|
+
// Silently suppress these common rrweb errors
|
|
13191
|
+
return;
|
|
13192
|
+
}
|
|
13193
|
+
originalConsoleError.apply(console, args);
|
|
13194
|
+
};
|
|
13195
|
+
// Suppress console.warn for similar issues
|
|
13196
|
+
const originalConsoleWarn = console.warn;
|
|
13197
|
+
console.warn = (...args) => {
|
|
13198
|
+
const message = args.join(' ');
|
|
13199
|
+
if (message.includes('Cannot inline img src=') ||
|
|
13200
|
+
message.includes('Cross-Origin') ||
|
|
13201
|
+
message.includes('CORS') ||
|
|
13202
|
+
message.includes('Access-Control-Allow-Origin') ||
|
|
13203
|
+
message.includes('Failed to load resource') ||
|
|
13204
|
+
message.includes('net::ERR_BLOCKED_BY_CLIENT')) {
|
|
13205
|
+
// Silently suppress these common rrweb warnings
|
|
13206
|
+
return;
|
|
13207
|
+
}
|
|
13208
|
+
originalConsoleWarn.apply(console, args);
|
|
13209
|
+
};
|
|
13210
|
+
// Add global error handler for any remaining rrweb errors
|
|
13211
|
+
window.addEventListener('error', (event) => {
|
|
13212
|
+
const message = event.message || '';
|
|
13213
|
+
if (message.includes('SecurityError') ||
|
|
13214
|
+
message.includes('Tainted canvases') ||
|
|
13215
|
+
message.includes('toDataURL') ||
|
|
13216
|
+
message.includes('Cross-Origin') ||
|
|
13217
|
+
message.includes('CORS')) {
|
|
13218
|
+
event.preventDefault();
|
|
13219
|
+
return false;
|
|
13220
|
+
}
|
|
13221
|
+
});
|
|
13222
|
+
}
|
|
13176
13223
|
// Return existing instance if already initialized
|
|
13177
13224
|
if (isBrowser$1 && window.__humanBehaviorGlobalTracker) {
|
|
13178
13225
|
logDebug('Tracker already initialized, returning existing instance');
|
|
@@ -13194,16 +13241,6 @@ class HumanBehaviorTracker {
|
|
|
13194
13241
|
if ((options === null || options === void 0 ? void 0 : options.enableAutomaticTracking) !== false) {
|
|
13195
13242
|
tracker.setupAutomaticTracking(options === null || options === void 0 ? void 0 : options.automaticTrackingOptions);
|
|
13196
13243
|
}
|
|
13197
|
-
// Test connection (non-blocking)
|
|
13198
|
-
if (isBrowser$1) {
|
|
13199
|
-
const testUrl = tracker.api['baseUrl'] + '/api/health';
|
|
13200
|
-
fetch(testUrl, { method: 'HEAD' })
|
|
13201
|
-
.then(() => logDebug('Connection test successful'))
|
|
13202
|
-
.catch((error) => {
|
|
13203
|
-
logWarn('Connection test failed - ad blocker may be active:', error.message);
|
|
13204
|
-
tracker._connectionBlocked = true;
|
|
13205
|
-
});
|
|
13206
|
-
}
|
|
13207
13244
|
// Start tracking
|
|
13208
13245
|
tracker.start();
|
|
13209
13246
|
return tracker;
|
|
@@ -13812,11 +13849,11 @@ class HumanBehaviorTracker {
|
|
|
13812
13849
|
maskInputOptions: { password: true }, // HumanBehavior default
|
|
13813
13850
|
maskInputFn: undefined,
|
|
13814
13851
|
slimDOMOptions: {},
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
recordCanvas: false, // Disabled to prevent large data URIs
|
|
13852
|
+
// ✅ ERROR SUPPRESSION SETTINGS - Disabled to prevent console noise
|
|
13853
|
+
collectFonts: false, // Disable font collection to reduce errors
|
|
13854
|
+
inlineStylesheet: true, // Keep styles for proper session replay
|
|
13855
|
+
recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
|
|
13856
|
+
recordCanvas: false, // Disabled to prevent large data URIs and canvas errors
|
|
13820
13857
|
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
13821
13858
|
// Rely on initial FullSnapshot + navigation-triggered ones only
|
|
13822
13859
|
});
|