humanbehavior-js 0.4.20 → 0.4.21

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.
Files changed (53) hide show
  1. package/dist/cjs/angular/index.cjs +799 -13
  2. package/dist/cjs/angular/index.cjs.map +1 -1
  3. package/dist/cjs/index.cjs +815 -13
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/react/index.cjs +800 -14
  6. package/dist/cjs/react/index.cjs.map +1 -1
  7. package/dist/cjs/remix/index.cjs +800 -14
  8. package/dist/cjs/remix/index.cjs.map +1 -1
  9. package/dist/cjs/svelte/index.cjs +799 -13
  10. package/dist/cjs/svelte/index.cjs.map +1 -1
  11. package/dist/cjs/vue/index.cjs +799 -13
  12. package/dist/cjs/vue/index.cjs.map +1 -1
  13. package/dist/esm/angular/index.js +799 -13
  14. package/dist/esm/angular/index.js.map +1 -1
  15. package/dist/esm/index.js +807 -14
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/react/index.js +800 -14
  18. package/dist/esm/react/index.js.map +1 -1
  19. package/dist/esm/remix/index.js +800 -14
  20. package/dist/esm/remix/index.js.map +1 -1
  21. package/dist/esm/svelte/index.js +799 -13
  22. package/dist/esm/svelte/index.js.map +1 -1
  23. package/dist/esm/vue/index.js +799 -13
  24. package/dist/esm/vue/index.js.map +1 -1
  25. package/dist/index.min.js +1 -1
  26. package/dist/index.min.js.map +1 -1
  27. package/dist/types/angular/index.d.ts +60 -1
  28. package/dist/types/index.d.ts +258 -3
  29. package/dist/types/react/index.d.ts +60 -1
  30. package/dist/types/remix/index.d.ts +60 -1
  31. package/dist/types/svelte/index.d.ts +60 -1
  32. package/package/canvas-recording-demo.html +1 -1
  33. package/package/simple-spa.html +1 -1
  34. package/package/src/angular/index.ts +3 -3
  35. package/package/src/react/index.tsx +2 -2
  36. package/package/src/svelte/index.ts +1 -1
  37. package/package/src/tracker.ts +2 -2
  38. package/package/src/vue/index.ts +1 -1
  39. package/package.json +1 -1
  40. package/simple-spa.html +164 -2
  41. package/src/angular/index.ts +3 -3
  42. package/src/api.ts +40 -0
  43. package/src/index.ts +7 -0
  44. package/src/react/index.tsx +2 -2
  45. package/src/svelte/index.ts +1 -1
  46. package/src/tracker.ts +175 -11
  47. package/src/utils/ip-detector.ts +158 -0
  48. package/src/utils/property-detector.ts +345 -0
  49. package/src/utils/property-manager.ts +274 -0
  50. package/src/vue/index.ts +1 -1
  51. package/canvas-recording-demo.html +0 -143
  52. package/clean-console-demo.html +0 -39
  53. package/simple-demo.html +0 -26
@@ -23,6 +23,7 @@ declare class HumanBehaviorTracker {
23
23
  private initialized;
24
24
  initializationPromise: Promise<void> | null;
25
25
  private redactionManager;
26
+ private propertyManager;
26
27
  private originalConsole;
27
28
  private consoleTrackingEnabled;
28
29
  navigationTrackingEnabled: boolean;
@@ -48,6 +49,8 @@ declare class HumanBehaviorTracker {
48
49
  enableAutomaticTracking?: boolean;
49
50
  suppressConsoleErrors?: boolean;
50
51
  recordCanvas?: boolean;
52
+ enableAutomaticProperties?: boolean;
53
+ propertyDenylist?: string[];
51
54
  automaticTrackingOptions?: {
52
55
  trackButtons?: boolean;
53
56
  trackLinks?: boolean;
@@ -56,7 +59,10 @@ declare class HumanBehaviorTracker {
56
59
  includeClasses?: boolean;
57
60
  };
58
61
  }): HumanBehaviorTracker;
59
- constructor(apiKey: string | undefined, ingestionUrl?: string);
62
+ constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
63
+ enableAutomaticProperties?: boolean;
64
+ propertyDenylist?: string[];
65
+ });
60
66
  private init;
61
67
  private ensureInitialized;
62
68
  /**
@@ -217,6 +223,59 @@ declare class HumanBehaviorTracker {
217
223
  isPreexistingUser: boolean;
218
224
  initialized: boolean;
219
225
  };
226
+ /**
227
+ * Set a session property that will be included in all events for this session
228
+ */
229
+ setSessionProperty(key: string, value: any): void;
230
+ /**
231
+ * Set multiple session properties
232
+ */
233
+ setSessionProperties(properties: Record<string, any>): void;
234
+ /**
235
+ * Get a session property
236
+ */
237
+ getSessionProperty(key: string): any;
238
+ /**
239
+ * Remove a session property
240
+ */
241
+ removeSessionProperty(key: string): void;
242
+ /**
243
+ * Set a user property that will be included in all events
244
+ */
245
+ setUserProperty(key: string, value: any): void;
246
+ /**
247
+ * Set multiple user properties
248
+ */
249
+ setUserProperties(properties: Record<string, any>): void;
250
+ /**
251
+ * Get a user property
252
+ */
253
+ getUserProperty(key: string): any;
254
+ /**
255
+ * Remove a user property
256
+ */
257
+ removeUserProperty(key: string): void;
258
+ /**
259
+ * Set a property only if it hasn't been set before
260
+ */
261
+ setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
262
+ /**
263
+ * Clear all session properties
264
+ */
265
+ clearSessionProperties(): void;
266
+ /**
267
+ * Clear all user properties
268
+ */
269
+ clearUserProperties(): void;
270
+ /**
271
+ * Get all properties for debugging
272
+ */
273
+ getAllProperties(): {
274
+ automatic: Record<string, any>;
275
+ session: Record<string, any>;
276
+ user: Record<string, any>;
277
+ initial: Record<string, any>;
278
+ };
220
279
  }
221
280
 
222
281
  declare class HumanBehaviorModule {
@@ -113,6 +113,7 @@ declare class HumanBehaviorTracker {
113
113
  private initialized;
114
114
  initializationPromise: Promise<void> | null;
115
115
  private redactionManager;
116
+ private propertyManager;
116
117
  private originalConsole;
117
118
  private consoleTrackingEnabled;
118
119
  navigationTrackingEnabled: boolean;
@@ -138,6 +139,8 @@ declare class HumanBehaviorTracker {
138
139
  enableAutomaticTracking?: boolean;
139
140
  suppressConsoleErrors?: boolean;
140
141
  recordCanvas?: boolean;
142
+ enableAutomaticProperties?: boolean;
143
+ propertyDenylist?: string[];
141
144
  automaticTrackingOptions?: {
142
145
  trackButtons?: boolean;
143
146
  trackLinks?: boolean;
@@ -146,7 +149,10 @@ declare class HumanBehaviorTracker {
146
149
  includeClasses?: boolean;
147
150
  };
148
151
  }): HumanBehaviorTracker;
149
- constructor(apiKey: string | undefined, ingestionUrl?: string);
152
+ constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
153
+ enableAutomaticProperties?: boolean;
154
+ propertyDenylist?: string[];
155
+ });
150
156
  private init;
151
157
  private ensureInitialized;
152
158
  /**
@@ -307,6 +313,59 @@ declare class HumanBehaviorTracker {
307
313
  isPreexistingUser: boolean;
308
314
  initialized: boolean;
309
315
  };
316
+ /**
317
+ * Set a session property that will be included in all events for this session
318
+ */
319
+ setSessionProperty(key: string, value: any): void;
320
+ /**
321
+ * Set multiple session properties
322
+ */
323
+ setSessionProperties(properties: Record<string, any>): void;
324
+ /**
325
+ * Get a session property
326
+ */
327
+ getSessionProperty(key: string): any;
328
+ /**
329
+ * Remove a session property
330
+ */
331
+ removeSessionProperty(key: string): void;
332
+ /**
333
+ * Set a user property that will be included in all events
334
+ */
335
+ setUserProperty(key: string, value: any): void;
336
+ /**
337
+ * Set multiple user properties
338
+ */
339
+ setUserProperties(properties: Record<string, any>): void;
340
+ /**
341
+ * Get a user property
342
+ */
343
+ getUserProperty(key: string): any;
344
+ /**
345
+ * Remove a user property
346
+ */
347
+ removeUserProperty(key: string): void;
348
+ /**
349
+ * Set a property only if it hasn't been set before
350
+ */
351
+ setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
352
+ /**
353
+ * Clear all session properties
354
+ */
355
+ clearSessionProperties(): void;
356
+ /**
357
+ * Clear all user properties
358
+ */
359
+ clearUserProperties(): void;
360
+ /**
361
+ * Get all properties for debugging
362
+ */
363
+ getAllProperties(): {
364
+ automatic: Record<string, any>;
365
+ session: Record<string, any>;
366
+ user: Record<string, any>;
367
+ initial: Record<string, any>;
368
+ };
310
369
  }
311
370
 
312
371
  declare const MAX_CHUNK_SIZE_BYTES: number;
@@ -324,6 +383,11 @@ declare class HumanBehaviorAPI {
324
383
  sessionId: any;
325
384
  endUserId: any;
326
385
  }>;
386
+ /**
387
+ * Send IP address information to the server
388
+ * This is called after successful initialization
389
+ */
390
+ sendIPInfo(sessionId: string): Promise<void>;
327
391
  sendEvents(events: any[], sessionId: string, userId: string): Promise<void>;
328
392
  sendEventsChunked(events: any[], sessionId: string, userId?: string): Promise<any[]>;
329
393
  sendUserData(userId: string, userData: Record<string, any>, sessionId: string): Promise<any>;
@@ -336,6 +400,197 @@ declare class HumanBehaviorAPI {
336
400
  }>): Promise<any>;
337
401
  }
338
402
 
403
+ /**
404
+ * Automatic Property Detection for HumanBehavior SDK
405
+ * Captures device type, location, and initial referrer information
406
+ */
407
+ interface DeviceInfo {
408
+ device_type: string;
409
+ browser: string;
410
+ browser_version: string;
411
+ os: string;
412
+ os_version: string;
413
+ device_model?: string;
414
+ screen_resolution: string;
415
+ viewport_size: string;
416
+ color_depth: number;
417
+ timezone: string;
418
+ language: string;
419
+ languages: string[];
420
+ raw_user_agent?: string;
421
+ }
422
+ interface LocationInfo {
423
+ current_url: string;
424
+ pathname: string;
425
+ search: string;
426
+ hash: string;
427
+ title: string;
428
+ referrer: string;
429
+ referrer_domain: string;
430
+ initial_referrer: string;
431
+ initial_referrer_domain: string;
432
+ initial_host?: string;
433
+ utm_source?: string;
434
+ utm_medium?: string;
435
+ utm_campaign?: string;
436
+ utm_term?: string;
437
+ utm_content?: string;
438
+ }
439
+ interface AutomaticProperties extends DeviceInfo, LocationInfo {
440
+ }
441
+ /**
442
+ * Get device information
443
+ */
444
+ declare function getDeviceInfo(): DeviceInfo;
445
+ /**
446
+ * Get location information
447
+ */
448
+ declare function getLocationInfo(): LocationInfo;
449
+ /**
450
+ * Get all automatic properties
451
+ */
452
+ declare function getAutomaticProperties(): AutomaticProperties;
453
+ /**
454
+ * Get initial properties that should be captured once per session
455
+ */
456
+ declare function getInitialProperties(): Record<string, any>;
457
+ /**
458
+ * Get current page properties (changes with navigation)
459
+ */
460
+ declare function getCurrentPageProperties(): Record<string, any>;
461
+
462
+ /**
463
+ * Property Manager for HumanBehavior SDK
464
+ * Handles automatic properties, session properties, and user properties
465
+ */
466
+ interface Properties {
467
+ [key: string]: any;
468
+ }
469
+ interface PropertyManagerConfig {
470
+ enableAutomaticProperties?: boolean;
471
+ enableSessionProperties?: boolean;
472
+ enableUserProperties?: boolean;
473
+ propertyDenylist?: string[];
474
+ }
475
+ declare class PropertyManager {
476
+ private config;
477
+ private automaticProperties;
478
+ private sessionProperties;
479
+ private userProperties;
480
+ private initialProperties;
481
+ private isInitialized;
482
+ constructor(config?: PropertyManagerConfig);
483
+ /**
484
+ * Initialize the property manager
485
+ */
486
+ private initialize;
487
+ /**
488
+ * Get all properties for an event
489
+ */
490
+ getEventProperties(eventProperties?: Properties): Properties;
491
+ /**
492
+ * Get automatic properties
493
+ */
494
+ getAutomaticProperties(): Properties;
495
+ /**
496
+ * Get automatic properties with GeoIP data merged in
497
+ */
498
+ getAutomaticPropertiesWithGeoIP(geoIPProperties?: Record<string, any>): Properties;
499
+ /**
500
+ * Set a session property
501
+ */
502
+ setSessionProperty(key: string, value: any): void;
503
+ /**
504
+ * Set multiple session properties
505
+ */
506
+ setSessionProperties(properties: Properties): void;
507
+ /**
508
+ * Get a session property
509
+ */
510
+ getSessionProperty(key: string): any;
511
+ /**
512
+ * Remove a session property
513
+ */
514
+ removeSessionProperty(key: string): void;
515
+ /**
516
+ * Set a user property
517
+ */
518
+ setUserProperty(key: string, value: any): void;
519
+ /**
520
+ * Set multiple user properties
521
+ */
522
+ setUserProperties(properties: Properties): void;
523
+ /**
524
+ * Get a user property
525
+ */
526
+ getUserProperty(key: string): any;
527
+ /**
528
+ * Remove a user property
529
+ */
530
+ removeUserProperty(key: string): void;
531
+ /**
532
+ * Set a property only if it hasn't been set before
533
+ */
534
+ setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
535
+ /**
536
+ * Clear all session properties
537
+ */
538
+ clearSessionProperties(): void;
539
+ /**
540
+ * Clear all user properties
541
+ */
542
+ clearUserProperties(): void;
543
+ /**
544
+ * Reset all properties
545
+ */
546
+ reset(): void;
547
+ /**
548
+ * Load session properties from sessionStorage
549
+ */
550
+ private loadSessionProperties;
551
+ /**
552
+ * Save session properties to sessionStorage
553
+ */
554
+ private saveSessionProperties;
555
+ /**
556
+ * Apply property denylist
557
+ */
558
+ private applyDenylist;
559
+ /**
560
+ * Update automatic properties (call when page changes)
561
+ */
562
+ updateAutomaticProperties(): void;
563
+ /**
564
+ * Get all properties for debugging
565
+ */
566
+ getAllProperties(): {
567
+ automatic: Properties;
568
+ session: Properties;
569
+ user: Properties;
570
+ initial: Properties;
571
+ };
572
+ }
573
+
574
+ /**
575
+ * IP Address Detection Utility
576
+ * Attempts to get the client's public IP address using multiple methods
577
+ */
578
+ interface IPInfo {
579
+ ip: string;
580
+ method: 'stun' | 'public-service' | 'fallback';
581
+ timestamp: number;
582
+ }
583
+ /**
584
+ * Get client's public IP address
585
+ * Tries STUN first (most reliable), then falls back to public services
586
+ */
587
+ declare function getClientIP(): Promise<IPInfo | null>;
588
+ declare function getCachedIP(): Promise<IPInfo | null>;
589
+ /**
590
+ * Clear IP cache (useful for testing or when network changes)
591
+ */
592
+ declare function clearIPCache(): void;
593
+
339
594
  declare enum LogLevel {
340
595
  NONE = 0,
341
596
  ERROR = 1,
@@ -369,5 +624,5 @@ declare const logWarn: (message: string, ...args: any[]) => void;
369
624
  declare const logInfo: (message: string, ...args: any[]) => void;
370
625
  declare const logDebug: (message: string, ...args: any[]) => void;
371
626
 
372
- export { HumanBehaviorAPI, HumanBehaviorTracker, LogLevel, MAX_CHUNK_SIZE_BYTES, RedactionManager, isChunkSizeExceeded, logDebug, logError, logInfo, logWarn, logger, redactionManager, splitLargeEvent, validateSingleEventSize };
373
- export type { LoggerConfig, RedactionOptions };
627
+ export { HumanBehaviorAPI, HumanBehaviorTracker, LogLevel, MAX_CHUNK_SIZE_BYTES, PropertyManager, RedactionManager, clearIPCache, getAutomaticProperties, getCachedIP, getClientIP, getCurrentPageProperties, getDeviceInfo, getInitialProperties, getLocationInfo, isChunkSizeExceeded, logDebug, logError, logInfo, logWarn, logger, redactionManager, splitLargeEvent, validateSingleEventSize };
628
+ export type { AutomaticProperties, DeviceInfo, IPInfo, LocationInfo, LoggerConfig, Properties, PropertyManagerConfig, RedactionOptions };
@@ -25,6 +25,7 @@ declare class HumanBehaviorTracker {
25
25
  private initialized;
26
26
  initializationPromise: Promise<void> | null;
27
27
  private redactionManager;
28
+ private propertyManager;
28
29
  private originalConsole;
29
30
  private consoleTrackingEnabled;
30
31
  navigationTrackingEnabled: boolean;
@@ -50,6 +51,8 @@ declare class HumanBehaviorTracker {
50
51
  enableAutomaticTracking?: boolean;
51
52
  suppressConsoleErrors?: boolean;
52
53
  recordCanvas?: boolean;
54
+ enableAutomaticProperties?: boolean;
55
+ propertyDenylist?: string[];
53
56
  automaticTrackingOptions?: {
54
57
  trackButtons?: boolean;
55
58
  trackLinks?: boolean;
@@ -58,7 +61,10 @@ declare class HumanBehaviorTracker {
58
61
  includeClasses?: boolean;
59
62
  };
60
63
  }): HumanBehaviorTracker;
61
- constructor(apiKey: string | undefined, ingestionUrl?: string);
64
+ constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
65
+ enableAutomaticProperties?: boolean;
66
+ propertyDenylist?: string[];
67
+ });
62
68
  private init;
63
69
  private ensureInitialized;
64
70
  /**
@@ -219,6 +225,59 @@ declare class HumanBehaviorTracker {
219
225
  isPreexistingUser: boolean;
220
226
  initialized: boolean;
221
227
  };
228
+ /**
229
+ * Set a session property that will be included in all events for this session
230
+ */
231
+ setSessionProperty(key: string, value: any): void;
232
+ /**
233
+ * Set multiple session properties
234
+ */
235
+ setSessionProperties(properties: Record<string, any>): void;
236
+ /**
237
+ * Get a session property
238
+ */
239
+ getSessionProperty(key: string): any;
240
+ /**
241
+ * Remove a session property
242
+ */
243
+ removeSessionProperty(key: string): void;
244
+ /**
245
+ * Set a user property that will be included in all events
246
+ */
247
+ setUserProperty(key: string, value: any): void;
248
+ /**
249
+ * Set multiple user properties
250
+ */
251
+ setUserProperties(properties: Record<string, any>): void;
252
+ /**
253
+ * Get a user property
254
+ */
255
+ getUserProperty(key: string): any;
256
+ /**
257
+ * Remove a user property
258
+ */
259
+ removeUserProperty(key: string): void;
260
+ /**
261
+ * Set a property only if it hasn't been set before
262
+ */
263
+ setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
264
+ /**
265
+ * Clear all session properties
266
+ */
267
+ clearSessionProperties(): void;
268
+ /**
269
+ * Clear all user properties
270
+ */
271
+ clearUserProperties(): void;
272
+ /**
273
+ * Get all properties for debugging
274
+ */
275
+ getAllProperties(): {
276
+ automatic: Record<string, any>;
277
+ session: Record<string, any>;
278
+ user: Record<string, any>;
279
+ initial: Record<string, any>;
280
+ };
222
281
  }
223
282
 
224
283
  interface HumanBehaviorProviderProps {
@@ -26,6 +26,7 @@ declare class HumanBehaviorTracker {
26
26
  private initialized;
27
27
  initializationPromise: Promise<void> | null;
28
28
  private redactionManager;
29
+ private propertyManager;
29
30
  private originalConsole;
30
31
  private consoleTrackingEnabled;
31
32
  navigationTrackingEnabled: boolean;
@@ -51,6 +52,8 @@ declare class HumanBehaviorTracker {
51
52
  enableAutomaticTracking?: boolean;
52
53
  suppressConsoleErrors?: boolean;
53
54
  recordCanvas?: boolean;
55
+ enableAutomaticProperties?: boolean;
56
+ propertyDenylist?: string[];
54
57
  automaticTrackingOptions?: {
55
58
  trackButtons?: boolean;
56
59
  trackLinks?: boolean;
@@ -59,7 +62,10 @@ declare class HumanBehaviorTracker {
59
62
  includeClasses?: boolean;
60
63
  };
61
64
  }): HumanBehaviorTracker;
62
- constructor(apiKey: string | undefined, ingestionUrl?: string);
65
+ constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
66
+ enableAutomaticProperties?: boolean;
67
+ propertyDenylist?: string[];
68
+ });
63
69
  private init;
64
70
  private ensureInitialized;
65
71
  /**
@@ -220,6 +226,59 @@ declare class HumanBehaviorTracker {
220
226
  isPreexistingUser: boolean;
221
227
  initialized: boolean;
222
228
  };
229
+ /**
230
+ * Set a session property that will be included in all events for this session
231
+ */
232
+ setSessionProperty(key: string, value: any): void;
233
+ /**
234
+ * Set multiple session properties
235
+ */
236
+ setSessionProperties(properties: Record<string, any>): void;
237
+ /**
238
+ * Get a session property
239
+ */
240
+ getSessionProperty(key: string): any;
241
+ /**
242
+ * Remove a session property
243
+ */
244
+ removeSessionProperty(key: string): void;
245
+ /**
246
+ * Set a user property that will be included in all events
247
+ */
248
+ setUserProperty(key: string, value: any): void;
249
+ /**
250
+ * Set multiple user properties
251
+ */
252
+ setUserProperties(properties: Record<string, any>): void;
253
+ /**
254
+ * Get a user property
255
+ */
256
+ getUserProperty(key: string): any;
257
+ /**
258
+ * Remove a user property
259
+ */
260
+ removeUserProperty(key: string): void;
261
+ /**
262
+ * Set a property only if it hasn't been set before
263
+ */
264
+ setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
265
+ /**
266
+ * Clear all session properties
267
+ */
268
+ clearSessionProperties(): void;
269
+ /**
270
+ * Clear all user properties
271
+ */
272
+ clearUserProperties(): void;
273
+ /**
274
+ * Get all properties for debugging
275
+ */
276
+ getAllProperties(): {
277
+ automatic: Record<string, any>;
278
+ session: Record<string, any>;
279
+ user: Record<string, any>;
280
+ initial: Record<string, any>;
281
+ };
223
282
  }
224
283
 
225
284
  interface HumanBehaviorProviderProps {
@@ -23,6 +23,7 @@ declare class HumanBehaviorTracker {
23
23
  private initialized;
24
24
  initializationPromise: Promise<void> | null;
25
25
  private redactionManager;
26
+ private propertyManager;
26
27
  private originalConsole;
27
28
  private consoleTrackingEnabled;
28
29
  navigationTrackingEnabled: boolean;
@@ -48,6 +49,8 @@ declare class HumanBehaviorTracker {
48
49
  enableAutomaticTracking?: boolean;
49
50
  suppressConsoleErrors?: boolean;
50
51
  recordCanvas?: boolean;
52
+ enableAutomaticProperties?: boolean;
53
+ propertyDenylist?: string[];
51
54
  automaticTrackingOptions?: {
52
55
  trackButtons?: boolean;
53
56
  trackLinks?: boolean;
@@ -56,7 +59,10 @@ declare class HumanBehaviorTracker {
56
59
  includeClasses?: boolean;
57
60
  };
58
61
  }): HumanBehaviorTracker;
59
- constructor(apiKey: string | undefined, ingestionUrl?: string);
62
+ constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
63
+ enableAutomaticProperties?: boolean;
64
+ propertyDenylist?: string[];
65
+ });
60
66
  private init;
61
67
  private ensureInitialized;
62
68
  /**
@@ -217,6 +223,59 @@ declare class HumanBehaviorTracker {
217
223
  isPreexistingUser: boolean;
218
224
  initialized: boolean;
219
225
  };
226
+ /**
227
+ * Set a session property that will be included in all events for this session
228
+ */
229
+ setSessionProperty(key: string, value: any): void;
230
+ /**
231
+ * Set multiple session properties
232
+ */
233
+ setSessionProperties(properties: Record<string, any>): void;
234
+ /**
235
+ * Get a session property
236
+ */
237
+ getSessionProperty(key: string): any;
238
+ /**
239
+ * Remove a session property
240
+ */
241
+ removeSessionProperty(key: string): void;
242
+ /**
243
+ * Set a user property that will be included in all events
244
+ */
245
+ setUserProperty(key: string, value: any): void;
246
+ /**
247
+ * Set multiple user properties
248
+ */
249
+ setUserProperties(properties: Record<string, any>): void;
250
+ /**
251
+ * Get a user property
252
+ */
253
+ getUserProperty(key: string): any;
254
+ /**
255
+ * Remove a user property
256
+ */
257
+ removeUserProperty(key: string): void;
258
+ /**
259
+ * Set a property only if it hasn't been set before
260
+ */
261
+ setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
262
+ /**
263
+ * Clear all session properties
264
+ */
265
+ clearSessionProperties(): void;
266
+ /**
267
+ * Clear all user properties
268
+ */
269
+ clearUserProperties(): void;
270
+ /**
271
+ * Get all properties for debugging
272
+ */
273
+ getAllProperties(): {
274
+ automatic: Record<string, any>;
275
+ session: Record<string, any>;
276
+ user: Record<string, any>;
277
+ initial: Record<string, any>;
278
+ };
220
279
  }
221
280
 
222
281
  declare const humanBehaviorStore: {
@@ -53,7 +53,7 @@
53
53
  tracker = HumanBehaviorTracker.init('13c3e029-ca45-4a3c-a33b-f5dcb297e31c', {
54
54
  logLevel: 'warn',
55
55
  suppressConsoleErrors: true,
56
- recordCanvas: enableCanvas // PostHog-style protection
56
+ recordCanvas: enableCanvas // protection
57
57
  });
58
58
 
59
59
  updateStatus();
@@ -581,7 +581,7 @@
581
581
  addLog(`endUserId changed: ${originalEndUserId !== newEndUserId ? 'YES (BAD)' : 'NO (GOOD)'}`);
582
582
  addLog(`User authenticated: ${userId}`);
583
583
 
584
- // The endUserId should stay the same, but posthogName will be updated with email
584
+ // The endUserId should stay the same, but user name will be updated
585
585
  addLog('✅ endUserId maintained for session continuity');
586
586
  addLog('✅ posthogName will be updated with email for UI display');
587
587
 
@@ -8,7 +8,7 @@ export class HumanBehaviorModule {
8
8
  logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
9
9
  redactFields?: string[];
10
10
  suppressConsoleErrors?: boolean;
11
- recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
11
+ recordCanvas?: boolean; // Enable canvas recording with protection
12
12
  }) {
13
13
  return {
14
14
  ngModule: HumanBehaviorModule,
@@ -44,7 +44,7 @@ export class HumanBehaviorService {
44
44
  logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
45
45
  redactFields?: string[];
46
46
  suppressConsoleErrors?: boolean;
47
- recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
47
+ recordCanvas?: boolean; // Enable canvas recording with protection
48
48
  }) {
49
49
  this.tracker = HumanBehaviorTracker.init(apiKey, options);
50
50
  }
@@ -73,7 +73,7 @@ export function initializeHumanBehavior(apiKey: string, options?: {
73
73
  logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
74
74
  redactFields?: string[];
75
75
  suppressConsoleErrors?: boolean;
76
- recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
76
+ recordCanvas?: boolean; // Enable canvas recording with protection
77
77
  }): HumanBehaviorTracker {
78
78
  return HumanBehaviorTracker.init(apiKey, options);
79
79
  }