humanbehavior-js 0.4.12 → 0.4.13
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/canvas-recording-demo.html +143 -0
- package/dist/cjs/angular/index.cjs +22 -6
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +11 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +19 -11
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +19 -11
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +13 -3
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +18 -2
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/esm/angular/index.js +22 -6
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +11 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +19 -11
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +19 -11
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +13 -3
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +18 -2
- 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 +21 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/react/index.d.ts +4 -0
- package/dist/types/remix/index.d.ts +4 -0
- package/dist/types/svelte/index.d.ts +9 -1
- package/dist/types/vue/index.d.ts +5 -0
- package/package.json +1 -1
- package/readme.md +20 -1
- package/src/angular/index.ts +31 -6
- package/src/react/index.tsx +12 -13
- package/src/svelte/index.ts +8 -2
- package/src/tracker.ts +13 -1
- package/src/vue/index.ts +12 -1
|
@@ -13169,6 +13169,7 @@ class HumanBehaviorTracker {
|
|
|
13169
13169
|
* This is the main entry point - call this once per page
|
|
13170
13170
|
*/
|
|
13171
13171
|
static init(apiKey, options) {
|
|
13172
|
+
var _a;
|
|
13172
13173
|
// ✅ SUPPRESS COMMON RRWEB ERRORS FOR CLEAN CONSOLE
|
|
13173
13174
|
if (isBrowser && (options === null || options === void 0 ? void 0 : options.suppressConsoleErrors) !== false) {
|
|
13174
13175
|
// Suppress canvas security errors
|
|
@@ -13227,6 +13228,8 @@ class HumanBehaviorTracker {
|
|
|
13227
13228
|
}
|
|
13228
13229
|
// Create new tracker instance
|
|
13229
13230
|
const tracker = new HumanBehaviorTracker(apiKey, options === null || options === void 0 ? void 0 : options.ingestionUrl);
|
|
13231
|
+
// Store canvas recording preference
|
|
13232
|
+
tracker.recordCanvas = (_a = options === null || options === void 0 ? void 0 : options.recordCanvas) !== null && _a !== void 0 ? _a : false;
|
|
13230
13233
|
// Set redacted fields if specified
|
|
13231
13234
|
if (options === null || options === void 0 ? void 0 : options.redactFields) {
|
|
13232
13235
|
tracker.setRedactedFields(options.redactFields);
|
|
@@ -13265,6 +13268,7 @@ class HumanBehaviorTracker {
|
|
|
13265
13268
|
this.sessionStartTime = Date.now();
|
|
13266
13269
|
this.rrwebRecord = null;
|
|
13267
13270
|
this.fullSnapshotTimeout = null;
|
|
13271
|
+
this.recordCanvas = false; // Store canvas recording preference
|
|
13268
13272
|
if (!apiKey) {
|
|
13269
13273
|
throw new Error('Human Behavior API Key is required');
|
|
13270
13274
|
}
|
|
@@ -13849,7 +13853,13 @@ class HumanBehaviorTracker {
|
|
|
13849
13853
|
collectFonts: false, // Disable font collection to reduce errors
|
|
13850
13854
|
inlineStylesheet: true, // Keep styles for proper session replay
|
|
13851
13855
|
recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
|
|
13852
|
-
|
|
13856
|
+
// ✅ CANVAS RECORDING - PostHog-style protection against overwhelm
|
|
13857
|
+
recordCanvas: this.recordCanvas, // Opt-in only
|
|
13858
|
+
sampling: this.recordCanvas ? { canvas: 4 } : undefined, // 4 FPS throttle
|
|
13859
|
+
dataURLOptions: this.recordCanvas ? {
|
|
13860
|
+
type: 'image/webp',
|
|
13861
|
+
quality: 0.4
|
|
13862
|
+
} : undefined, // WebP with 40% quality
|
|
13853
13863
|
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
13854
13864
|
// Rely on initial FullSnapshot + navigation-triggered ones only
|
|
13855
13865
|
});
|
|
@@ -14298,7 +14308,13 @@ class HumanBehaviorModule {
|
|
|
14298
14308
|
{
|
|
14299
14309
|
provide: HumanBehaviorTracker,
|
|
14300
14310
|
useFactory: (apiKey) => {
|
|
14301
|
-
return HumanBehaviorTracker.init(apiKey
|
|
14311
|
+
return HumanBehaviorTracker.init(apiKey, {
|
|
14312
|
+
ingestionUrl: config.ingestionUrl,
|
|
14313
|
+
logLevel: config.logLevel,
|
|
14314
|
+
redactFields: config.redactFields,
|
|
14315
|
+
suppressConsoleErrors: config.suppressConsoleErrors,
|
|
14316
|
+
recordCanvas: config.recordCanvas, // Pass canvas recording option
|
|
14317
|
+
});
|
|
14302
14318
|
},
|
|
14303
14319
|
deps: ['HUMANBEHAVIOR_API_KEY']
|
|
14304
14320
|
}
|
|
@@ -14308,8 +14324,8 @@ class HumanBehaviorModule {
|
|
|
14308
14324
|
}
|
|
14309
14325
|
// Angular service for dependency injection
|
|
14310
14326
|
class HumanBehaviorService {
|
|
14311
|
-
constructor(apiKey) {
|
|
14312
|
-
this.tracker = HumanBehaviorTracker.init(apiKey);
|
|
14327
|
+
constructor(apiKey, options) {
|
|
14328
|
+
this.tracker = HumanBehaviorTracker.init(apiKey, options);
|
|
14313
14329
|
}
|
|
14314
14330
|
// Expose core tracker methods
|
|
14315
14331
|
identifyUser(userProperties) {
|
|
@@ -14326,8 +14342,8 @@ class HumanBehaviorService {
|
|
|
14326
14342
|
}
|
|
14327
14343
|
}
|
|
14328
14344
|
// Helper function for standalone Angular initialization
|
|
14329
|
-
function initializeHumanBehavior(apiKey) {
|
|
14330
|
-
return HumanBehaviorTracker.init(apiKey);
|
|
14345
|
+
function initializeHumanBehavior(apiKey, options) {
|
|
14346
|
+
return HumanBehaviorTracker.init(apiKey, options);
|
|
14331
14347
|
}
|
|
14332
14348
|
|
|
14333
14349
|
export { HumanBehaviorModule, HumanBehaviorService, initializeHumanBehavior };
|