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/cjs/index.cjs
CHANGED
|
@@ -12592,7 +12592,7 @@ class HumanBehaviorAPI {
|
|
|
12592
12592
|
sessionId: sessionId,
|
|
12593
12593
|
posthogName: userData.email || userData.name || null // Update user name with email
|
|
12594
12594
|
};
|
|
12595
|
-
|
|
12595
|
+
logDebug('Sending user data to server:', payload);
|
|
12596
12596
|
const response = yield fetch(`${this.baseUrl}/api/ingestion/user`, {
|
|
12597
12597
|
method: 'POST',
|
|
12598
12598
|
headers: {
|
|
@@ -12605,7 +12605,7 @@ class HumanBehaviorAPI {
|
|
|
12605
12605
|
throw new Error(`Failed to send user data: ${response.statusText} with API key: ${this.apiKey}`);
|
|
12606
12606
|
}
|
|
12607
12607
|
const result = yield response.json();
|
|
12608
|
-
|
|
12608
|
+
logDebug('Server response:', result);
|
|
12609
12609
|
return result;
|
|
12610
12610
|
}
|
|
12611
12611
|
catch (error) {
|
|
@@ -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;
|
|
@@ -13774,6 +13811,7 @@ class HumanBehaviorTracker {
|
|
|
13774
13811
|
const originalEndUserId = this.endUserId;
|
|
13775
13812
|
// Store user properties
|
|
13776
13813
|
this.userProperties = userProperties;
|
|
13814
|
+
logDebug('Identifying user:', { userProperties, originalEndUserId, sessionId: this.sessionId });
|
|
13777
13815
|
// Send user data with the original endUserId
|
|
13778
13816
|
yield this.api.sendUserData(originalEndUserId, userProperties, this.sessionId);
|
|
13779
13817
|
// Don't update endUserId - keep it as the original UUID
|
|
@@ -13819,11 +13857,11 @@ class HumanBehaviorTracker {
|
|
|
13819
13857
|
maskInputOptions: { password: true }, // HumanBehavior default
|
|
13820
13858
|
maskInputFn: undefined,
|
|
13821
13859
|
slimDOMOptions: {},
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
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: false, // Disable inline stylesheet to reduce errors
|
|
13863
|
+
recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
|
|
13864
|
+
recordCanvas: false, // Disabled to prevent large data URIs and canvas errors
|
|
13827
13865
|
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
13828
13866
|
// Rely on initial FullSnapshot + navigation-triggered ones only
|
|
13829
13867
|
});
|