humanbehavior-js 0.4.11 → 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 +23 -7
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +12 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +20 -12
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +20 -12
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +14 -4
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +19 -3
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/esm/angular/index.js +23 -7
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +12 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +20 -12
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +20 -12
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +14 -4
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +19 -3
- 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 +14 -2
- package/src/vue/index.ts +12 -1
package/dist/cjs/vue/index.cjs
CHANGED
|
@@ -13171,6 +13171,7 @@ class HumanBehaviorTracker {
|
|
|
13171
13171
|
* This is the main entry point - call this once per page
|
|
13172
13172
|
*/
|
|
13173
13173
|
static init(apiKey, options) {
|
|
13174
|
+
var _a;
|
|
13174
13175
|
// ✅ SUPPRESS COMMON RRWEB ERRORS FOR CLEAN CONSOLE
|
|
13175
13176
|
if (isBrowser && (options === null || options === void 0 ? void 0 : options.suppressConsoleErrors) !== false) {
|
|
13176
13177
|
// Suppress canvas security errors
|
|
@@ -13229,6 +13230,8 @@ class HumanBehaviorTracker {
|
|
|
13229
13230
|
}
|
|
13230
13231
|
// Create new tracker instance
|
|
13231
13232
|
const tracker = new HumanBehaviorTracker(apiKey, options === null || options === void 0 ? void 0 : options.ingestionUrl);
|
|
13233
|
+
// Store canvas recording preference
|
|
13234
|
+
tracker.recordCanvas = (_a = options === null || options === void 0 ? void 0 : options.recordCanvas) !== null && _a !== void 0 ? _a : false;
|
|
13232
13235
|
// Set redacted fields if specified
|
|
13233
13236
|
if (options === null || options === void 0 ? void 0 : options.redactFields) {
|
|
13234
13237
|
tracker.setRedactedFields(options.redactFields);
|
|
@@ -13267,6 +13270,7 @@ class HumanBehaviorTracker {
|
|
|
13267
13270
|
this.sessionStartTime = Date.now();
|
|
13268
13271
|
this.rrwebRecord = null;
|
|
13269
13272
|
this.fullSnapshotTimeout = null;
|
|
13273
|
+
this.recordCanvas = false; // Store canvas recording preference
|
|
13270
13274
|
if (!apiKey) {
|
|
13271
13275
|
throw new Error('Human Behavior API Key is required');
|
|
13272
13276
|
}
|
|
@@ -13849,9 +13853,15 @@ class HumanBehaviorTracker {
|
|
|
13849
13853
|
slimDOMOptions: {},
|
|
13850
13854
|
// ✅ ERROR SUPPRESSION SETTINGS - Disabled to prevent console noise
|
|
13851
13855
|
collectFonts: false, // Disable font collection to reduce errors
|
|
13852
|
-
inlineStylesheet:
|
|
13856
|
+
inlineStylesheet: true, // Keep styles for proper session replay
|
|
13853
13857
|
recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
|
|
13854
|
-
|
|
13858
|
+
// ✅ CANVAS RECORDING - PostHog-style protection against overwhelm
|
|
13859
|
+
recordCanvas: this.recordCanvas, // Opt-in only
|
|
13860
|
+
sampling: this.recordCanvas ? { canvas: 4 } : undefined, // 4 FPS throttle
|
|
13861
|
+
dataURLOptions: this.recordCanvas ? {
|
|
13862
|
+
type: 'image/webp',
|
|
13863
|
+
quality: 0.4
|
|
13864
|
+
} : undefined, // WebP with 40% quality
|
|
13855
13865
|
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
13856
13866
|
// Rely on initial FullSnapshot + navigation-triggered ones only
|
|
13857
13867
|
});
|
|
@@ -14289,7 +14299,13 @@ if (typeof window !== 'undefined') {
|
|
|
14289
14299
|
|
|
14290
14300
|
const HumanBehaviorPlugin = {
|
|
14291
14301
|
install: (app, options) => {
|
|
14292
|
-
const tracker = HumanBehaviorTracker.init(options.apiKey
|
|
14302
|
+
const tracker = HumanBehaviorTracker.init(options.apiKey, {
|
|
14303
|
+
ingestionUrl: options.ingestionUrl,
|
|
14304
|
+
logLevel: options.logLevel,
|
|
14305
|
+
redactFields: options.redactFields,
|
|
14306
|
+
suppressConsoleErrors: options.suppressConsoleErrors,
|
|
14307
|
+
recordCanvas: options.recordCanvas, // Pass canvas recording option
|
|
14308
|
+
});
|
|
14293
14309
|
// Make tracker available globally
|
|
14294
14310
|
app.config.globalProperties.$humanBehavior = tracker;
|
|
14295
14311
|
// Also provide it via inject/provide
|