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
package/dist/cjs/react/index.cjs
CHANGED
|
@@ -13173,6 +13173,7 @@ class HumanBehaviorTracker {
|
|
|
13173
13173
|
* This is the main entry point - call this once per page
|
|
13174
13174
|
*/
|
|
13175
13175
|
static init(apiKey, options) {
|
|
13176
|
+
var _a;
|
|
13176
13177
|
// ✅ SUPPRESS COMMON RRWEB ERRORS FOR CLEAN CONSOLE
|
|
13177
13178
|
if (isBrowser$1 && (options === null || options === void 0 ? void 0 : options.suppressConsoleErrors) !== false) {
|
|
13178
13179
|
// Suppress canvas security errors
|
|
@@ -13231,6 +13232,8 @@ class HumanBehaviorTracker {
|
|
|
13231
13232
|
}
|
|
13232
13233
|
// Create new tracker instance
|
|
13233
13234
|
const tracker = new HumanBehaviorTracker(apiKey, options === null || options === void 0 ? void 0 : options.ingestionUrl);
|
|
13235
|
+
// Store canvas recording preference
|
|
13236
|
+
tracker.recordCanvas = (_a = options === null || options === void 0 ? void 0 : options.recordCanvas) !== null && _a !== void 0 ? _a : false;
|
|
13234
13237
|
// Set redacted fields if specified
|
|
13235
13238
|
if (options === null || options === void 0 ? void 0 : options.redactFields) {
|
|
13236
13239
|
tracker.setRedactedFields(options.redactFields);
|
|
@@ -13269,6 +13272,7 @@ class HumanBehaviorTracker {
|
|
|
13269
13272
|
this.sessionStartTime = Date.now();
|
|
13270
13273
|
this.rrwebRecord = null;
|
|
13271
13274
|
this.fullSnapshotTimeout = null;
|
|
13275
|
+
this.recordCanvas = false; // Store canvas recording preference
|
|
13272
13276
|
if (!apiKey) {
|
|
13273
13277
|
throw new Error('Human Behavior API Key is required');
|
|
13274
13278
|
}
|
|
@@ -13853,7 +13857,13 @@ class HumanBehaviorTracker {
|
|
|
13853
13857
|
collectFonts: false, // Disable font collection to reduce errors
|
|
13854
13858
|
inlineStylesheet: true, // Keep styles for proper session replay
|
|
13855
13859
|
recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
|
|
13856
|
-
|
|
13860
|
+
// ✅ CANVAS RECORDING - PostHog-style protection against overwhelm
|
|
13861
|
+
recordCanvas: this.recordCanvas, // Opt-in only
|
|
13862
|
+
sampling: this.recordCanvas ? { canvas: 4 } : undefined, // 4 FPS throttle
|
|
13863
|
+
dataURLOptions: this.recordCanvas ? {
|
|
13864
|
+
type: 'image/webp',
|
|
13865
|
+
quality: 0.4
|
|
13866
|
+
} : undefined, // WebP with 40% quality
|
|
13857
13867
|
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
13858
13868
|
// Rely on initial FullSnapshot + navigation-triggered ones only
|
|
13859
13869
|
});
|
|
@@ -14330,16 +14340,14 @@ const HumanBehaviorProvider = ({ apiKey, client, children, options }) => {
|
|
|
14330
14340
|
if (humanBehavior !== null) {
|
|
14331
14341
|
return;
|
|
14332
14342
|
}
|
|
14333
|
-
// Create new tracker instance with the validated apiKey
|
|
14334
|
-
const tracker =
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
|
|
14341
|
-
tracker.setRedactedFields(options.redactFields);
|
|
14342
|
-
}
|
|
14343
|
+
// Create new tracker instance with the validated apiKey and options
|
|
14344
|
+
const tracker = HumanBehaviorTracker.init(apiKeyRef.current.trim(), {
|
|
14345
|
+
ingestionUrl: options === null || options === void 0 ? void 0 : options.ingestionUrl,
|
|
14346
|
+
logLevel: options === null || options === void 0 ? void 0 : options.logLevel,
|
|
14347
|
+
redactFields: options === null || options === void 0 ? void 0 : options.redactFields,
|
|
14348
|
+
suppressConsoleErrors: options === null || options === void 0 ? void 0 : options.suppressConsoleErrors,
|
|
14349
|
+
recordCanvas: options === null || options === void 0 ? void 0 : options.recordCanvas, // Pass canvas recording option
|
|
14350
|
+
});
|
|
14343
14351
|
setHumanBehavior(tracker);
|
|
14344
14352
|
// Wait for initialization to complete
|
|
14345
14353
|
(_a = tracker.initializationPromise) === null || _a === void 0 ? void 0 : _a.then(() => __awaiter(void 0, void 0, void 0, function* () {
|