humanbehavior-js 0.4.16 → 0.4.17

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 (89) hide show
  1. package/dist/cjs/wizard/index.cjs +6 -8
  2. package/dist/cjs/wizard/index.cjs.map +1 -1
  3. package/dist/cli/ai-auto-install.js +6 -8
  4. package/dist/cli/ai-auto-install.js.map +1 -1
  5. package/dist/esm/wizard/index.js +6 -8
  6. package/dist/esm/wizard/index.js.map +1 -1
  7. package/package/WIZARD_USAGE_GUIDE.md +381 -0
  8. package/package/canvas-recording-demo.html +143 -0
  9. package/package/clean-console-demo.html +39 -0
  10. package/package/dist/cjs/angular/index.cjs +14354 -0
  11. package/package/dist/cjs/angular/index.cjs.map +1 -0
  12. package/package/dist/cjs/index.cjs +14323 -0
  13. package/package/dist/cjs/index.cjs.map +1 -0
  14. package/package/dist/cjs/install-wizard.cjs +1530 -0
  15. package/package/dist/cjs/install-wizard.cjs.map +1 -0
  16. package/package/dist/cjs/react/index.cjs +14478 -0
  17. package/package/dist/cjs/react/index.cjs.map +1 -0
  18. package/package/dist/cjs/remix/index.cjs +14452 -0
  19. package/package/dist/cjs/remix/index.cjs.map +1 -0
  20. package/package/dist/cjs/svelte/index.cjs +14308 -0
  21. package/package/dist/cjs/svelte/index.cjs.map +1 -0
  22. package/package/dist/cjs/vue/index.cjs +14317 -0
  23. package/package/dist/cjs/vue/index.cjs.map +1 -0
  24. package/package/dist/cjs/wizard/index.cjs +3446 -0
  25. package/package/dist/cjs/wizard/index.cjs.map +1 -0
  26. package/package/dist/cli/ai-auto-install.cjs +57161 -0
  27. package/package/dist/cli/ai-auto-install.cjs.map +1 -0
  28. package/package/dist/cli/ai-auto-install.js +1969 -0
  29. package/package/dist/cli/ai-auto-install.js.map +1 -0
  30. package/package/dist/cli/auto-install.cjs +56352 -0
  31. package/package/dist/cli/auto-install.cjs.map +1 -0
  32. package/package/dist/cli/auto-install.js +1957 -0
  33. package/package/dist/cli/auto-install.js.map +1 -0
  34. package/package/dist/esm/angular/index.js +14350 -0
  35. package/package/dist/esm/angular/index.js.map +1 -0
  36. package/package/dist/esm/index.js +14309 -0
  37. package/package/dist/esm/index.js.map +1 -0
  38. package/package/dist/esm/install-wizard.js +1507 -0
  39. package/package/dist/esm/install-wizard.js.map +1 -0
  40. package/package/dist/esm/react/index.js +14472 -0
  41. package/package/dist/esm/react/index.js.map +1 -0
  42. package/package/dist/esm/remix/index.js +14448 -0
  43. package/package/dist/esm/remix/index.js.map +1 -0
  44. package/package/dist/esm/svelte/index.js +14306 -0
  45. package/package/dist/esm/svelte/index.js.map +1 -0
  46. package/package/dist/esm/vue/index.js +14315 -0
  47. package/package/dist/esm/vue/index.js.map +1 -0
  48. package/package/dist/esm/wizard/index.js +3415 -0
  49. package/package/dist/esm/wizard/index.js.map +1 -0
  50. package/package/dist/index.min.js +2 -0
  51. package/package/dist/index.min.js.map +1 -0
  52. package/package/dist/types/angular/index.d.ts +267 -0
  53. package/package/dist/types/index.d.ts +373 -0
  54. package/package/dist/types/install-wizard.d.ts +156 -0
  55. package/package/dist/types/react/index.d.ts +255 -0
  56. package/package/dist/types/remix/index.d.ts +246 -0
  57. package/package/dist/types/svelte/index.d.ts +232 -0
  58. package/package/dist/types/vue/index.d.ts +15 -0
  59. package/package/dist/types/wizard/index.d.ts +523 -0
  60. package/package/package.json +105 -0
  61. package/package/readme.md +281 -0
  62. package/package/rollup.config.js +422 -0
  63. package/package/simple-demo.html +26 -0
  64. package/package/simple-spa.html +838 -0
  65. package/package/src/angular/index.ts +79 -0
  66. package/package/src/api.ts +376 -0
  67. package/package/src/index.ts +28 -0
  68. package/package/src/react/AutoInstallWizard.tsx +557 -0
  69. package/package/src/react/browser.ts +8 -0
  70. package/package/src/react/index.tsx +308 -0
  71. package/package/src/redact.ts +521 -0
  72. package/package/src/remix/index.ts +16 -0
  73. package/package/src/svelte/index.ts +14 -0
  74. package/package/src/tracker.ts +1319 -0
  75. package/package/src/types/clack.d.ts +31 -0
  76. package/package/src/utils/logger.ts +144 -0
  77. package/package/src/vue/index.ts +29 -0
  78. package/package/src/wizard/README.md +114 -0
  79. package/package/src/wizard/ai/ai-install-wizard.ts +897 -0
  80. package/package/src/wizard/ai/manual-framework-wizard.ts +238 -0
  81. package/package/src/wizard/cli/ai-auto-install.ts +243 -0
  82. package/package/src/wizard/cli/auto-install.ts +224 -0
  83. package/package/src/wizard/core/install-wizard.ts +1744 -0
  84. package/package/src/wizard/index.ts +23 -0
  85. package/package/src/wizard/services/centralized-ai-service.ts +668 -0
  86. package/package/src/wizard/services/remote-ai-service.ts +240 -0
  87. package/package/tsconfig.json +24 -0
  88. package/package.json +1 -1
  89. package/src/wizard/cli/ai-auto-install.ts +4 -6
@@ -0,0 +1,267 @@
1
+ interface RedactionOptions {
2
+ redactedText?: string;
3
+ excludeSelectors?: string[];
4
+ userFields?: string[];
5
+ }
6
+
7
+ declare global {
8
+ interface Window {
9
+ HumanBehaviorTracker: typeof HumanBehaviorTracker;
10
+ __humanBehaviorGlobalTracker?: HumanBehaviorTracker;
11
+ }
12
+ }
13
+ declare class HumanBehaviorTracker {
14
+ private eventIngestionQueue;
15
+ private sessionId;
16
+ private userProperties;
17
+ private isProcessing;
18
+ private flushInterval;
19
+ private readonly FLUSH_INTERVAL_MS;
20
+ private api;
21
+ private endUserId;
22
+ private apiKey;
23
+ private initialized;
24
+ initializationPromise: Promise<void> | null;
25
+ private redactionManager;
26
+ private originalConsole;
27
+ private consoleTrackingEnabled;
28
+ navigationTrackingEnabled: boolean;
29
+ private currentUrl;
30
+ private previousUrl;
31
+ private originalPushState;
32
+ private originalReplaceState;
33
+ private navigationListeners;
34
+ private _connectionBlocked;
35
+ private recordInstance;
36
+ private sessionStartTime;
37
+ private rrwebRecord;
38
+ private fullSnapshotTimeout;
39
+ private recordCanvas;
40
+ /**
41
+ * Initialize the HumanBehavior tracker
42
+ * This is the main entry point - call this once per page
43
+ */
44
+ static init(apiKey: string, options?: {
45
+ ingestionUrl?: string;
46
+ logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
47
+ redactFields?: string[];
48
+ enableAutomaticTracking?: boolean;
49
+ suppressConsoleErrors?: boolean;
50
+ recordCanvas?: boolean;
51
+ automaticTrackingOptions?: {
52
+ trackButtons?: boolean;
53
+ trackLinks?: boolean;
54
+ trackForms?: boolean;
55
+ includeText?: boolean;
56
+ includeClasses?: boolean;
57
+ };
58
+ }): HumanBehaviorTracker;
59
+ constructor(apiKey: string | undefined, ingestionUrl?: string);
60
+ private init;
61
+ private ensureInitialized;
62
+ /**
63
+ * Setup navigation event tracking for SPA navigation
64
+ */
65
+ private setupNavigationTracking;
66
+ /**
67
+ * Track navigation events and send custom events
68
+ */
69
+ trackNavigationEvent(type: string, fromUrl: string, toUrl: string): Promise<void>;
70
+ trackPageView(url?: string): Promise<void>;
71
+ customEvent(eventName: string, properties?: Record<string, any>): Promise<void>;
72
+ /**
73
+ * Setup automatic tracking for buttons, links, and forms
74
+ */
75
+ private setupAutomaticTracking;
76
+ /**
77
+ * Setup automatic button tracking
78
+ */
79
+ private setupAutomaticButtonTracking;
80
+ /**
81
+ * Setup automatic link tracking
82
+ */
83
+ private setupAutomaticLinkTracking;
84
+ /**
85
+ * Setup automatic form tracking
86
+ */
87
+ private setupAutomaticFormTracking;
88
+ /**
89
+ * Cleanup navigation tracking
90
+ */
91
+ private cleanupNavigationTracking;
92
+ static logToStorage(message: string): void;
93
+ /**
94
+ * Configure logging behavior for the SDK
95
+ * @param config Logger configuration options
96
+ */
97
+ static configureLogging(config: {
98
+ level?: 'none' | 'error' | 'warn' | 'info' | 'debug';
99
+ enableConsole?: boolean;
100
+ enableStorage?: boolean;
101
+ }): void;
102
+ /**
103
+ * Enable console event tracking
104
+ */
105
+ enableConsoleTracking(): void;
106
+ /**
107
+ * Disable console event tracking
108
+ */
109
+ disableConsoleTracking(): void;
110
+ private trackConsoleEvent;
111
+ private setupPageUnloadHandler;
112
+ viewLogs(): void;
113
+ /**
114
+ * Add user identification information to the tracker
115
+ * If userId is not provided, will use userProperties.email as the userId (if present)
116
+ */
117
+ identifyUser({ userProperties }: {
118
+ userProperties: Record<string, any>;
119
+ }): Promise<string>;
120
+ /**
121
+ * Get current user attributes
122
+ */
123
+ getUserAttributes(): Record<string, any>;
124
+ start(): Promise<void>;
125
+ /**
126
+ * Manually trigger a FullSnapshot (for navigation events)
127
+ * Delays snapshot to avoid capturing mid-animation states
128
+ */
129
+ private takeFullSnapshot;
130
+ stop(): Promise<void>;
131
+ /**
132
+ * Add an event to the ingestion queue
133
+ * Events are sent directly without processing to avoid corruption
134
+ */
135
+ addEvent(event: any): Promise<void>;
136
+ /**
137
+ * Flush events to the ingestion server
138
+ * Events are sent in chunks to handle large payloads efficiently
139
+ */
140
+ private flush;
141
+ private setCookie;
142
+ getCookie(name: string): string | null;
143
+ /**
144
+ * Delete a cookie by setting its expiration date to the past
145
+ * @param name The name of the cookie to delete
146
+ */
147
+ private deleteCookie;
148
+ /**
149
+ * Clear user data and reset session when user signs out of the site
150
+ * This should be called when a user logs out of your application to prevent
151
+ * data contamination between different users
152
+ */
153
+ logout(): void;
154
+ /**
155
+ * Start redaction functionality for sensitive input fields
156
+ * @param options Optional configuration for redaction behavior
157
+ */
158
+ redact(options?: RedactionOptions): Promise<void>;
159
+ /**
160
+ * Set specific fields to be redacted during session recording
161
+ * Uses rrweb's built-in masking instead of custom redaction processing
162
+ * @param fields Array of CSS selectors for fields to redact (e.g., ['input[type="password"]', '#email-field'])
163
+ */
164
+ setRedactedFields(fields: string[]): void;
165
+ private restartWithNewRedaction;
166
+ /**
167
+ * Check if redaction is currently active
168
+ */
169
+ isRedactionActive(): boolean;
170
+ /**
171
+ * Get the currently selected fields for redaction
172
+ */
173
+ getRedactedFields(): string[];
174
+ /**
175
+ * Get the current session ID
176
+ */
177
+ getSessionId(): string;
178
+ /**
179
+ * Get the current URL being tracked
180
+ */
181
+ getCurrentUrl(): string;
182
+ /**
183
+ * Get current snapshot frequency info
184
+ * Uses configured values (5 minutes, 1000 events)
185
+ */
186
+ getSnapshotFrequencyInfo(): {
187
+ sessionDuration: number;
188
+ currentInterval: number;
189
+ currentThreshold: number;
190
+ phase: string;
191
+ };
192
+ /**
193
+ * Test if the tracker can reach the ingestion server
194
+ */
195
+ testConnection(): Promise<{
196
+ success: boolean;
197
+ error?: string;
198
+ }>;
199
+ /**
200
+ * Get connection status and recommendations
201
+ */
202
+ getConnectionStatus(): {
203
+ blocked: boolean;
204
+ recommendations: string[];
205
+ };
206
+ /**
207
+ * Check if the current user is a preexisting user
208
+ * Returns true if the user has an existing endUserId cookie from a previous session
209
+ */
210
+ isPreexistingUser(): boolean;
211
+ /**
212
+ * Get user information including whether they are preexisting
213
+ */
214
+ getUserInfo(): {
215
+ endUserId: string | null;
216
+ sessionId: string;
217
+ isPreexistingUser: boolean;
218
+ initialized: boolean;
219
+ };
220
+ }
221
+
222
+ declare class HumanBehaviorModule {
223
+ static forRoot(config: {
224
+ apiKey: string;
225
+ ingestionUrl?: string;
226
+ logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
227
+ redactFields?: string[];
228
+ suppressConsoleErrors?: boolean;
229
+ recordCanvas?: boolean;
230
+ }): {
231
+ ngModule: typeof HumanBehaviorModule;
232
+ providers: ({
233
+ provide: string;
234
+ useValue: string;
235
+ useFactory?: undefined;
236
+ deps?: undefined;
237
+ } | {
238
+ provide: typeof HumanBehaviorTracker;
239
+ useFactory: (apiKey: string) => HumanBehaviorTracker;
240
+ deps: string[];
241
+ useValue?: undefined;
242
+ })[];
243
+ };
244
+ }
245
+ declare class HumanBehaviorService {
246
+ private tracker;
247
+ constructor(apiKey: string, options?: {
248
+ ingestionUrl?: string;
249
+ logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
250
+ redactFields?: string[];
251
+ suppressConsoleErrors?: boolean;
252
+ recordCanvas?: boolean;
253
+ });
254
+ identifyUser(userProperties: Record<string, any>): Promise<string>;
255
+ getSessionId(): string;
256
+ setRedactedFields(fields: string[]): void;
257
+ getRedactedFields(): string[];
258
+ }
259
+ declare function initializeHumanBehavior(apiKey: string, options?: {
260
+ ingestionUrl?: string;
261
+ logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
262
+ redactFields?: string[];
263
+ suppressConsoleErrors?: boolean;
264
+ recordCanvas?: boolean;
265
+ }): HumanBehaviorTracker;
266
+
267
+ export { HumanBehaviorModule, HumanBehaviorService, initializeHumanBehavior };
@@ -0,0 +1,373 @@
1
+ interface RedactionOptions {
2
+ redactedText?: string;
3
+ excludeSelectors?: string[];
4
+ userFields?: string[];
5
+ }
6
+ declare class RedactionManager {
7
+ private redactedText;
8
+ private userSelectedFields;
9
+ private excludeSelectors;
10
+ constructor(options?: RedactionOptions);
11
+ /**
12
+ * Set specific fields to be redacted using CSS selectors
13
+ * These selectors are used to configure rrweb's built-in masking
14
+ * @param fields Array of CSS selectors for fields to redact
15
+ */
16
+ setFieldsToRedact(fields: string[]): void;
17
+ /**
18
+ * Check if redaction is currently active (has fields selected)
19
+ */
20
+ isActive(): boolean;
21
+ /**
22
+ * Get the currently selected fields for redaction
23
+ */
24
+ getSelectedFields(): string[];
25
+ /**
26
+ * Process an event and redact sensitive data if needed
27
+ * NOTE: This method is no longer used - events are handled directly by rrweb
28
+ * Kept for backward compatibility but not called in the current implementation
29
+ */
30
+ processEvent(event: any): any;
31
+ /**
32
+ * Redact sensitive data in input events
33
+ */
34
+ private redactInputEvent;
35
+ /**
36
+ * Redact sensitive data in DOM mutation events
37
+ */
38
+ private redactDOMEvent;
39
+ /**
40
+ * Check if a DOM change should be redacted based on its ID
41
+ */
42
+ private shouldRedactDOMChange;
43
+ /**
44
+ * Redact sensitive data in mouse/touch interaction events
45
+ */
46
+ private redactMouseEvent;
47
+ /**
48
+ * Redact sensitive data in full snapshot events
49
+ */
50
+ private redactFullSnapshot;
51
+ /**
52
+ * Recursively redact sensitive data in DOM nodes
53
+ */
54
+ private redactNode;
55
+ /**
56
+ * Check if a node should be redacted based on its attributes
57
+ */
58
+ private shouldRedactNode;
59
+ /**
60
+ * Check if a CSS selector would match a node based on its attributes
61
+ */
62
+ private selectorMatchesNode;
63
+ /**
64
+ * Basic selector matching for environments where matches() is not available
65
+ */
66
+ private basicSelectorMatch;
67
+ /**
68
+ * Check if an event is from a field that should be redacted
69
+ */
70
+ private isFieldSelected;
71
+ /**
72
+ * Get CSS selectors for rrweb masking configuration
73
+ * Used to configure rrweb's maskTextSelector option
74
+ */
75
+ getMaskTextSelector(): string | null;
76
+ /**
77
+ * Check if an element should be redacted (for rrweb maskTextFn/maskInputFn)
78
+ */
79
+ shouldRedactElement(element: HTMLElement): boolean;
80
+ /**
81
+ * Apply rrweb masking classes to DOM elements
82
+ * Adds 'rr-mask' class to elements that should be redacted
83
+ * This enables rrweb's built-in masking functionality
84
+ */
85
+ applyRedactionClasses(): void;
86
+ /**
87
+ * Get the original value of a redacted element (for debugging)
88
+ */
89
+ getOriginalValue(element: HTMLElement): string | undefined;
90
+ /**
91
+ * Check if an element is currently being redacted
92
+ */
93
+ isElementRedacted(element: HTMLElement): boolean;
94
+ }
95
+ declare const redactionManager: RedactionManager;
96
+
97
+ declare global {
98
+ interface Window {
99
+ HumanBehaviorTracker: typeof HumanBehaviorTracker;
100
+ __humanBehaviorGlobalTracker?: HumanBehaviorTracker;
101
+ }
102
+ }
103
+ declare class HumanBehaviorTracker {
104
+ private eventIngestionQueue;
105
+ private sessionId;
106
+ private userProperties;
107
+ private isProcessing;
108
+ private flushInterval;
109
+ private readonly FLUSH_INTERVAL_MS;
110
+ private api;
111
+ private endUserId;
112
+ private apiKey;
113
+ private initialized;
114
+ initializationPromise: Promise<void> | null;
115
+ private redactionManager;
116
+ private originalConsole;
117
+ private consoleTrackingEnabled;
118
+ navigationTrackingEnabled: boolean;
119
+ private currentUrl;
120
+ private previousUrl;
121
+ private originalPushState;
122
+ private originalReplaceState;
123
+ private navigationListeners;
124
+ private _connectionBlocked;
125
+ private recordInstance;
126
+ private sessionStartTime;
127
+ private rrwebRecord;
128
+ private fullSnapshotTimeout;
129
+ private recordCanvas;
130
+ /**
131
+ * Initialize the HumanBehavior tracker
132
+ * This is the main entry point - call this once per page
133
+ */
134
+ static init(apiKey: string, options?: {
135
+ ingestionUrl?: string;
136
+ logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
137
+ redactFields?: string[];
138
+ enableAutomaticTracking?: boolean;
139
+ suppressConsoleErrors?: boolean;
140
+ recordCanvas?: boolean;
141
+ automaticTrackingOptions?: {
142
+ trackButtons?: boolean;
143
+ trackLinks?: boolean;
144
+ trackForms?: boolean;
145
+ includeText?: boolean;
146
+ includeClasses?: boolean;
147
+ };
148
+ }): HumanBehaviorTracker;
149
+ constructor(apiKey: string | undefined, ingestionUrl?: string);
150
+ private init;
151
+ private ensureInitialized;
152
+ /**
153
+ * Setup navigation event tracking for SPA navigation
154
+ */
155
+ private setupNavigationTracking;
156
+ /**
157
+ * Track navigation events and send custom events
158
+ */
159
+ trackNavigationEvent(type: string, fromUrl: string, toUrl: string): Promise<void>;
160
+ trackPageView(url?: string): Promise<void>;
161
+ customEvent(eventName: string, properties?: Record<string, any>): Promise<void>;
162
+ /**
163
+ * Setup automatic tracking for buttons, links, and forms
164
+ */
165
+ private setupAutomaticTracking;
166
+ /**
167
+ * Setup automatic button tracking
168
+ */
169
+ private setupAutomaticButtonTracking;
170
+ /**
171
+ * Setup automatic link tracking
172
+ */
173
+ private setupAutomaticLinkTracking;
174
+ /**
175
+ * Setup automatic form tracking
176
+ */
177
+ private setupAutomaticFormTracking;
178
+ /**
179
+ * Cleanup navigation tracking
180
+ */
181
+ private cleanupNavigationTracking;
182
+ static logToStorage(message: string): void;
183
+ /**
184
+ * Configure logging behavior for the SDK
185
+ * @param config Logger configuration options
186
+ */
187
+ static configureLogging(config: {
188
+ level?: 'none' | 'error' | 'warn' | 'info' | 'debug';
189
+ enableConsole?: boolean;
190
+ enableStorage?: boolean;
191
+ }): void;
192
+ /**
193
+ * Enable console event tracking
194
+ */
195
+ enableConsoleTracking(): void;
196
+ /**
197
+ * Disable console event tracking
198
+ */
199
+ disableConsoleTracking(): void;
200
+ private trackConsoleEvent;
201
+ private setupPageUnloadHandler;
202
+ viewLogs(): void;
203
+ /**
204
+ * Add user identification information to the tracker
205
+ * If userId is not provided, will use userProperties.email as the userId (if present)
206
+ */
207
+ identifyUser({ userProperties }: {
208
+ userProperties: Record<string, any>;
209
+ }): Promise<string>;
210
+ /**
211
+ * Get current user attributes
212
+ */
213
+ getUserAttributes(): Record<string, any>;
214
+ start(): Promise<void>;
215
+ /**
216
+ * Manually trigger a FullSnapshot (for navigation events)
217
+ * Delays snapshot to avoid capturing mid-animation states
218
+ */
219
+ private takeFullSnapshot;
220
+ stop(): Promise<void>;
221
+ /**
222
+ * Add an event to the ingestion queue
223
+ * Events are sent directly without processing to avoid corruption
224
+ */
225
+ addEvent(event: any): Promise<void>;
226
+ /**
227
+ * Flush events to the ingestion server
228
+ * Events are sent in chunks to handle large payloads efficiently
229
+ */
230
+ private flush;
231
+ private setCookie;
232
+ getCookie(name: string): string | null;
233
+ /**
234
+ * Delete a cookie by setting its expiration date to the past
235
+ * @param name The name of the cookie to delete
236
+ */
237
+ private deleteCookie;
238
+ /**
239
+ * Clear user data and reset session when user signs out of the site
240
+ * This should be called when a user logs out of your application to prevent
241
+ * data contamination between different users
242
+ */
243
+ logout(): void;
244
+ /**
245
+ * Start redaction functionality for sensitive input fields
246
+ * @param options Optional configuration for redaction behavior
247
+ */
248
+ redact(options?: RedactionOptions): Promise<void>;
249
+ /**
250
+ * Set specific fields to be redacted during session recording
251
+ * Uses rrweb's built-in masking instead of custom redaction processing
252
+ * @param fields Array of CSS selectors for fields to redact (e.g., ['input[type="password"]', '#email-field'])
253
+ */
254
+ setRedactedFields(fields: string[]): void;
255
+ private restartWithNewRedaction;
256
+ /**
257
+ * Check if redaction is currently active
258
+ */
259
+ isRedactionActive(): boolean;
260
+ /**
261
+ * Get the currently selected fields for redaction
262
+ */
263
+ getRedactedFields(): string[];
264
+ /**
265
+ * Get the current session ID
266
+ */
267
+ getSessionId(): string;
268
+ /**
269
+ * Get the current URL being tracked
270
+ */
271
+ getCurrentUrl(): string;
272
+ /**
273
+ * Get current snapshot frequency info
274
+ * Uses configured values (5 minutes, 1000 events)
275
+ */
276
+ getSnapshotFrequencyInfo(): {
277
+ sessionDuration: number;
278
+ currentInterval: number;
279
+ currentThreshold: number;
280
+ phase: string;
281
+ };
282
+ /**
283
+ * Test if the tracker can reach the ingestion server
284
+ */
285
+ testConnection(): Promise<{
286
+ success: boolean;
287
+ error?: string;
288
+ }>;
289
+ /**
290
+ * Get connection status and recommendations
291
+ */
292
+ getConnectionStatus(): {
293
+ blocked: boolean;
294
+ recommendations: string[];
295
+ };
296
+ /**
297
+ * Check if the current user is a preexisting user
298
+ * Returns true if the user has an existing endUserId cookie from a previous session
299
+ */
300
+ isPreexistingUser(): boolean;
301
+ /**
302
+ * Get user information including whether they are preexisting
303
+ */
304
+ getUserInfo(): {
305
+ endUserId: string | null;
306
+ sessionId: string;
307
+ isPreexistingUser: boolean;
308
+ initialized: boolean;
309
+ };
310
+ }
311
+
312
+ declare const MAX_CHUNK_SIZE_BYTES: number;
313
+ declare function isChunkSizeExceeded(currentChunk: any[], newEvent: any, sessionId: string): boolean;
314
+ declare function validateSingleEventSize(event: any, sessionId: string): void;
315
+ declare function splitLargeEvent(event: any, sessionId: string): any[];
316
+ declare class HumanBehaviorAPI {
317
+ private apiKey;
318
+ private baseUrl;
319
+ constructor({ apiKey, ingestionUrl }: {
320
+ apiKey: string;
321
+ ingestionUrl: string;
322
+ });
323
+ init(sessionId: string, userId: string | null): Promise<{
324
+ sessionId: any;
325
+ endUserId: any;
326
+ }>;
327
+ sendEvents(events: any[], sessionId: string, userId: string): Promise<void>;
328
+ sendEventsChunked(events: any[], sessionId: string, userId?: string): Promise<any[]>;
329
+ sendUserData(userId: string, userData: Record<string, any>, sessionId: string): Promise<any>;
330
+ sendUserAuth(userId: string, userData: Record<string, any>, sessionId: string, authFields: string[]): Promise<any>;
331
+ sendBeaconEvents(events: any[], sessionId: string): boolean;
332
+ sendCustomEvent(sessionId: string, eventName: string, eventProperties?: Record<string, any>): Promise<any>;
333
+ sendCustomEventBatch(sessionId: string, events: Array<{
334
+ eventName: string;
335
+ eventProperties?: Record<string, any>;
336
+ }>): Promise<any>;
337
+ }
338
+
339
+ declare enum LogLevel {
340
+ NONE = 0,
341
+ ERROR = 1,
342
+ WARN = 2,
343
+ INFO = 3,
344
+ DEBUG = 4
345
+ }
346
+ interface LoggerConfig {
347
+ level: LogLevel;
348
+ enableConsole: boolean;
349
+ enableStorage: boolean;
350
+ }
351
+ declare class Logger {
352
+ private config;
353
+ private isBrowser;
354
+ constructor(config?: Partial<LoggerConfig>);
355
+ setConfig(config: Partial<LoggerConfig>): void;
356
+ private shouldLog;
357
+ private formatMessage;
358
+ error(message: string, ...args: any[]): void;
359
+ warn(message: string, ...args: any[]): void;
360
+ info(message: string, ...args: any[]): void;
361
+ debug(message: string, ...args: any[]): void;
362
+ private logToStorage;
363
+ getLogs(): any[];
364
+ clearLogs(): void;
365
+ }
366
+ declare const logger: Logger;
367
+ declare const logError: (message: string, ...args: any[]) => void;
368
+ declare const logWarn: (message: string, ...args: any[]) => void;
369
+ declare const logInfo: (message: string, ...args: any[]) => void;
370
+ declare const logDebug: (message: string, ...args: any[]) => void;
371
+
372
+ export { HumanBehaviorAPI, HumanBehaviorTracker, LogLevel, MAX_CHUNK_SIZE_BYTES, RedactionManager, isChunkSizeExceeded, logDebug, logError, logInfo, logWarn, logger, redactionManager, splitLargeEvent, validateSingleEventSize };
373
+ export type { LoggerConfig, RedactionOptions };