humanbehavior-js 0.4.9 → 0.4.11
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 +55 -17
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +55 -17
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +55 -17
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +55 -17
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +55 -17
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +55 -17
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/cli/ai-auto-install.js +0 -0
- package/dist/esm/angular/index.js +55 -17
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +55 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +55 -17
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +55 -17
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +55 -17
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +55 -17
- 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/api.ts +2 -2
- package/src/tracker.ts +63 -17
package/dist/esm/vue/index.js
CHANGED
|
@@ -12580,7 +12580,7 @@ class HumanBehaviorAPI {
|
|
|
12580
12580
|
sessionId: sessionId,
|
|
12581
12581
|
posthogName: userData.email || userData.name || null // Update user name with email
|
|
12582
12582
|
};
|
|
12583
|
-
|
|
12583
|
+
logDebug('Sending user data to server:', payload);
|
|
12584
12584
|
const response = yield fetch(`${this.baseUrl}/api/ingestion/user`, {
|
|
12585
12585
|
method: 'POST',
|
|
12586
12586
|
headers: {
|
|
@@ -12593,7 +12593,7 @@ class HumanBehaviorAPI {
|
|
|
12593
12593
|
throw new Error(`Failed to send user data: ${response.statusText} with API key: ${this.apiKey}`);
|
|
12594
12594
|
}
|
|
12595
12595
|
const result = yield response.json();
|
|
12596
|
-
|
|
12596
|
+
logDebug('Server response:', result);
|
|
12597
12597
|
return result;
|
|
12598
12598
|
}
|
|
12599
12599
|
catch (error) {
|
|
@@ -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;
|
|
@@ -13762,6 +13799,7 @@ class HumanBehaviorTracker {
|
|
|
13762
13799
|
const originalEndUserId = this.endUserId;
|
|
13763
13800
|
// Store user properties
|
|
13764
13801
|
this.userProperties = userProperties;
|
|
13802
|
+
logDebug('Identifying user:', { userProperties, originalEndUserId, sessionId: this.sessionId });
|
|
13765
13803
|
// Send user data with the original endUserId
|
|
13766
13804
|
yield this.api.sendUserData(originalEndUserId, userProperties, this.sessionId);
|
|
13767
13805
|
// Don't update endUserId - keep it as the original UUID
|
|
@@ -13807,11 +13845,11 @@ class HumanBehaviorTracker {
|
|
|
13807
13845
|
maskInputOptions: { password: true }, // HumanBehavior default
|
|
13808
13846
|
maskInputFn: undefined,
|
|
13809
13847
|
slimDOMOptions: {},
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
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: false, // Disable inline stylesheet to reduce errors
|
|
13851
|
+
recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
|
|
13852
|
+
recordCanvas: false, // Disabled to prevent large data URIs and canvas errors
|
|
13815
13853
|
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
13816
13854
|
// Rely on initial FullSnapshot + navigation-triggered ones only
|
|
13817
13855
|
});
|