humanbehavior-js 0.4.28 → 0.5.0

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 (140) hide show
  1. package/README.md +151 -0
  2. package/package.json +114 -79
  3. package/packages/angular/dist/index.d.ts +46 -0
  4. package/packages/angular/dist/index.d.ts.map +1 -0
  5. package/packages/angular/dist/index.js +2 -0
  6. package/packages/angular/dist/index.js.map +1 -0
  7. package/packages/angular/dist/index.mjs +2 -0
  8. package/packages/angular/dist/index.mjs.map +1 -0
  9. package/packages/browser/dist/index.d.ts +5 -0
  10. package/packages/browser/dist/index.d.ts.map +1 -0
  11. package/packages/browser/dist/index.iife.js +12095 -0
  12. package/packages/browser/dist/index.iife.js.map +1 -0
  13. package/packages/browser/dist/index.js +2 -0
  14. package/packages/browser/dist/index.js.map +1 -0
  15. package/packages/browser/dist/index.min.js +2 -0
  16. package/packages/browser/dist/index.min.js.map +1 -0
  17. package/packages/browser/dist/index.mjs +2 -0
  18. package/packages/browser/dist/index.mjs.map +1 -0
  19. package/packages/react/dist/browser.d.ts +2 -0
  20. package/packages/react/dist/browser.d.ts.map +1 -0
  21. package/packages/react/dist/index.d.ts +48 -0
  22. package/packages/react/dist/index.d.ts.map +1 -0
  23. package/packages/react/dist/index.js +2 -0
  24. package/packages/react/dist/index.js.map +1 -0
  25. package/packages/react/dist/index.mjs +2 -0
  26. package/packages/react/dist/index.mjs.map +1 -0
  27. package/packages/remix/dist/index.d.ts +8 -0
  28. package/packages/remix/dist/index.d.ts.map +1 -0
  29. package/packages/remix/dist/index.js +2 -0
  30. package/packages/remix/dist/index.js.map +1 -0
  31. package/packages/remix/dist/index.mjs +2 -0
  32. package/packages/remix/dist/index.mjs.map +1 -0
  33. package/packages/svelte/dist/index.d.ts +11 -0
  34. package/packages/svelte/dist/index.d.ts.map +1 -0
  35. package/packages/svelte/dist/index.js +2 -0
  36. package/packages/svelte/dist/index.js.map +1 -0
  37. package/packages/svelte/dist/index.mjs +2 -0
  38. package/packages/svelte/dist/index.mjs.map +1 -0
  39. package/{dist/types/vue → packages/vue/dist}/index.d.ts +4 -5
  40. package/packages/vue/dist/index.d.ts.map +1 -0
  41. package/packages/vue/dist/index.js +2 -0
  42. package/packages/vue/dist/index.js.map +1 -0
  43. package/packages/vue/dist/index.mjs +2 -0
  44. package/packages/vue/dist/index.mjs.map +1 -0
  45. package/packages/wizard/dist/ai/ai-install-wizard.d.ts +145 -0
  46. package/packages/wizard/dist/ai/ai-install-wizard.d.ts.map +1 -0
  47. package/packages/wizard/dist/ai/manual-framework-wizard.d.ts +52 -0
  48. package/packages/wizard/dist/ai/manual-framework-wizard.d.ts.map +1 -0
  49. package/packages/wizard/dist/cli/ai-auto-install.d.ts +27 -0
  50. package/packages/wizard/dist/cli/ai-auto-install.d.ts.map +1 -0
  51. package/{dist → packages/wizard/dist}/cli/ai-auto-install.js +821 -905
  52. package/packages/wizard/dist/cli/ai-auto-install.js.map +1 -0
  53. package/packages/wizard/dist/cli/auto-install.d.ts +26 -0
  54. package/packages/wizard/dist/cli/auto-install.d.ts.map +1 -0
  55. package/{dist → packages/wizard/dist}/cli/auto-install.js +821 -905
  56. package/packages/wizard/dist/cli/auto-install.js.map +1 -0
  57. package/{dist/types → packages/wizard/dist/core}/install-wizard.d.ts +6 -8
  58. package/packages/wizard/dist/core/install-wizard.d.ts.map +1 -0
  59. package/packages/wizard/dist/index.d.ts +18 -0
  60. package/packages/wizard/dist/index.d.ts.map +1 -0
  61. package/packages/wizard/dist/index.js +2 -0
  62. package/packages/wizard/dist/index.js.map +1 -0
  63. package/packages/wizard/dist/index.mjs +2 -0
  64. package/packages/wizard/dist/index.mjs.map +1 -0
  65. package/packages/wizard/dist/services/centralized-ai-service.d.ts +159 -0
  66. package/packages/wizard/dist/services/centralized-ai-service.d.ts.map +1 -0
  67. package/packages/wizard/dist/services/remote-ai-service.d.ts +58 -0
  68. package/packages/wizard/dist/services/remote-ai-service.d.ts.map +1 -0
  69. package/WIZARD_USAGE_GUIDE.md +0 -381
  70. package/dist/cjs/angular/index.cjs +0 -14979
  71. package/dist/cjs/angular/index.cjs.map +0 -1
  72. package/dist/cjs/index.cjs +0 -14964
  73. package/dist/cjs/index.cjs.map +0 -1
  74. package/dist/cjs/install-wizard.cjs +0 -1576
  75. package/dist/cjs/install-wizard.cjs.map +0 -1
  76. package/dist/cjs/react/index.cjs +0 -15103
  77. package/dist/cjs/react/index.cjs.map +0 -1
  78. package/dist/cjs/remix/index.cjs +0 -15077
  79. package/dist/cjs/remix/index.cjs.map +0 -1
  80. package/dist/cjs/svelte/index.cjs +0 -14933
  81. package/dist/cjs/svelte/index.cjs.map +0 -1
  82. package/dist/cjs/vue/index.cjs +0 -14942
  83. package/dist/cjs/vue/index.cjs.map +0 -1
  84. package/dist/cjs/wizard/index.cjs +0 -3490
  85. package/dist/cjs/wizard/index.cjs.map +0 -1
  86. package/dist/cli/ai-auto-install.js.map +0 -1
  87. package/dist/cli/auto-install.js.map +0 -1
  88. package/dist/esm/angular/index.js +0 -14975
  89. package/dist/esm/angular/index.js.map +0 -1
  90. package/dist/esm/index.js +0 -14941
  91. package/dist/esm/index.js.map +0 -1
  92. package/dist/esm/install-wizard.js +0 -1553
  93. package/dist/esm/install-wizard.js.map +0 -1
  94. package/dist/esm/react/index.js +0 -15097
  95. package/dist/esm/react/index.js.map +0 -1
  96. package/dist/esm/remix/index.js +0 -15073
  97. package/dist/esm/remix/index.js.map +0 -1
  98. package/dist/esm/svelte/index.js +0 -14931
  99. package/dist/esm/svelte/index.js.map +0 -1
  100. package/dist/esm/vue/index.js +0 -14940
  101. package/dist/esm/vue/index.js.map +0 -1
  102. package/dist/esm/wizard/index.js +0 -3459
  103. package/dist/esm/wizard/index.js.map +0 -1
  104. package/dist/index.min.js +0 -2
  105. package/dist/index.min.js.map +0 -1
  106. package/dist/types/angular/index.d.ts +0 -357
  107. package/dist/types/index.d.ts +0 -644
  108. package/dist/types/react/index.d.ts +0 -345
  109. package/dist/types/remix/index.d.ts +0 -336
  110. package/dist/types/svelte/index.d.ts +0 -322
  111. package/dist/types/wizard/index.d.ts +0 -523
  112. package/readme.md +0 -335
  113. package/rollup.config.js +0 -422
  114. package/simple-spa.html +0 -1000
  115. package/src/angular/index.ts +0 -79
  116. package/src/api.ts +0 -416
  117. package/src/index.ts +0 -35
  118. package/src/react/AutoInstallWizard.tsx +0 -557
  119. package/src/react/browser.ts +0 -8
  120. package/src/react/index.tsx +0 -308
  121. package/src/redact.ts +0 -327
  122. package/src/remix/index.ts +0 -16
  123. package/src/svelte/index.ts +0 -14
  124. package/src/tracker.ts +0 -1587
  125. package/src/types/clack.d.ts +0 -31
  126. package/src/utils/ip-detector.ts +0 -158
  127. package/src/utils/logger.ts +0 -144
  128. package/src/utils/property-detector.ts +0 -345
  129. package/src/utils/property-manager.ts +0 -274
  130. package/src/vue/index.ts +0 -29
  131. package/src/wizard/README.md +0 -114
  132. package/src/wizard/ai/ai-install-wizard.ts +0 -897
  133. package/src/wizard/ai/manual-framework-wizard.ts +0 -238
  134. package/src/wizard/cli/ai-auto-install.ts +0 -241
  135. package/src/wizard/cli/auto-install.ts +0 -224
  136. package/src/wizard/core/install-wizard.ts +0 -1794
  137. package/src/wizard/index.ts +0 -23
  138. package/src/wizard/services/centralized-ai-service.ts +0 -668
  139. package/src/wizard/services/remote-ai-service.ts +0 -240
  140. package/tsconfig.json +0 -24
@@ -1,357 +0,0 @@
1
- interface RedactionOptions {
2
- redactedText?: string;
3
- excludeSelectors?: string[];
4
- userFields?: string[];
5
- redactionStrategy?: {
6
- mode: 'privacy-first' | 'visibility-first';
7
- unredactFields?: string[];
8
- redactFields?: string[];
9
- };
10
- legacyRedactFields?: string[];
11
- }
12
-
13
- declare global {
14
- interface Window {
15
- HumanBehaviorTracker: typeof HumanBehaviorTracker;
16
- __humanBehaviorGlobalTracker?: HumanBehaviorTracker;
17
- }
18
- }
19
- declare class HumanBehaviorTracker {
20
- private eventIngestionQueue;
21
- private sessionId;
22
- private userProperties;
23
- private isProcessing;
24
- private flushInterval;
25
- private readonly FLUSH_INTERVAL_MS;
26
- private readonly MAX_QUEUE_SIZE;
27
- private api;
28
- private endUserId;
29
- private apiKey;
30
- private initialized;
31
- initializationPromise: Promise<void> | null;
32
- private redactionManager;
33
- private propertyManager;
34
- private originalConsole;
35
- private consoleTrackingEnabled;
36
- navigationTrackingEnabled: boolean;
37
- private currentUrl;
38
- private previousUrl;
39
- private originalPushState;
40
- private originalReplaceState;
41
- private navigationListeners;
42
- private _connectionBlocked;
43
- private recordInstance;
44
- private sessionStartTime;
45
- private rrwebRecord;
46
- private fullSnapshotTimeout;
47
- private recordCanvas;
48
- /**
49
- * Initialize the HumanBehavior tracker
50
- * This is the main entry point - call this once per page
51
- */
52
- static init(apiKey: string, options?: {
53
- ingestionUrl?: string;
54
- logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
55
- redactFields?: string[];
56
- redactionStrategy?: {
57
- mode: 'privacy-first' | 'visibility-first';
58
- unredactFields?: string[];
59
- redactFields?: string[];
60
- };
61
- enableAutomaticTracking?: boolean;
62
- suppressConsoleErrors?: boolean;
63
- recordCanvas?: boolean;
64
- enableAutomaticProperties?: boolean;
65
- propertyDenylist?: string[];
66
- automaticTrackingOptions?: {
67
- trackButtons?: boolean;
68
- trackLinks?: boolean;
69
- trackForms?: boolean;
70
- includeText?: boolean;
71
- includeClasses?: boolean;
72
- };
73
- }): HumanBehaviorTracker;
74
- constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
75
- enableAutomaticProperties?: boolean;
76
- propertyDenylist?: string[];
77
- redactionStrategy?: {
78
- mode: 'privacy-first' | 'visibility-first';
79
- unredactFields?: string[];
80
- redactFields?: string[];
81
- };
82
- redactFields?: string[];
83
- });
84
- private init;
85
- private ensureInitialized;
86
- /**
87
- * Setup navigation event tracking for SPA navigation
88
- */
89
- private setupNavigationTracking;
90
- /**
91
- * Track navigation events and send custom events
92
- */
93
- trackNavigationEvent(type: string, fromUrl: string, toUrl: string): Promise<void>;
94
- trackPageView(url?: string): Promise<void>;
95
- customEvent(eventName: string, properties?: Record<string, any>): Promise<void>;
96
- /**
97
- * Setup automatic tracking for buttons, links, and forms
98
- */
99
- private setupAutomaticTracking;
100
- /**
101
- * Setup automatic button tracking
102
- */
103
- private setupAutomaticButtonTracking;
104
- /**
105
- * Setup automatic link tracking
106
- */
107
- private setupAutomaticLinkTracking;
108
- /**
109
- * Setup automatic form tracking
110
- */
111
- private setupAutomaticFormTracking;
112
- /**
113
- * Cleanup navigation tracking
114
- */
115
- private cleanupNavigationTracking;
116
- static logToStorage(message: string): void;
117
- /**
118
- * Configure logging behavior for the SDK
119
- * @param config Logger configuration options
120
- */
121
- static configureLogging(config: {
122
- level?: 'none' | 'error' | 'warn' | 'info' | 'debug';
123
- enableConsole?: boolean;
124
- enableStorage?: boolean;
125
- }): void;
126
- /**
127
- * Enable console event tracking
128
- */
129
- enableConsoleTracking(): void;
130
- /**
131
- * Disable console event tracking
132
- */
133
- disableConsoleTracking(): void;
134
- private trackConsoleEvent;
135
- private setupPageUnloadHandler;
136
- viewLogs(): void;
137
- /**
138
- * Add user identification information to the tracker
139
- * If userId is not provided, will use userProperties.email as the userId (if present)
140
- */
141
- identifyUser({ userProperties }: {
142
- userProperties: Record<string, any>;
143
- }): Promise<string>;
144
- /**
145
- * Get current user attributes
146
- */
147
- getUserAttributes(): Record<string, any>;
148
- start(): Promise<void>;
149
- /**
150
- * Manually trigger a FullSnapshot (for navigation events)
151
- * Delays snapshot to avoid capturing mid-animation states
152
- */
153
- private takeFullSnapshot;
154
- stop(): Promise<void>;
155
- /**
156
- * Add an event to the ingestion queue
157
- * Events are sent directly without processing to avoid corruption
158
- */
159
- addEvent(event: any): Promise<void>;
160
- /**
161
- * Flush events to the ingestion server
162
- * Events are sent in chunks to handle large payloads efficiently
163
- */
164
- private flush;
165
- private setCookie;
166
- getCookie(name: string): string | null;
167
- /**
168
- * Delete a cookie by setting its expiration date to the past
169
- * @param name The name of the cookie to delete
170
- */
171
- private deleteCookie;
172
- /**
173
- * Clear user data and reset session when user signs out of the site
174
- * This should be called when a user logs out of your application to prevent
175
- * data contamination between different users
176
- */
177
- logout(): void;
178
- /**
179
- * Start redaction functionality for sensitive input fields
180
- * @param options Optional configuration for redaction behavior
181
- */
182
- redact(options?: RedactionOptions): Promise<void>;
183
- /**
184
- * Set specific fields to be redacted (for visibility-first mode)
185
- * @param fields Array of CSS selectors for fields to redact
186
- */
187
- setRedactedFields(fields: string[]): void;
188
- /**
189
- * Set specific fields to be unredacted (everything else stays redacted by rrweb)
190
- * @param fields Array of CSS selectors for fields to unredact (e.g., ['#username', '#comment'])
191
- */
192
- setUnredactedFields(fields: string[]): void;
193
- private restartWithNewRedaction;
194
- /**
195
- * Check if any fields are currently unredacted
196
- */
197
- hasUnredactedFields(): boolean;
198
- /**
199
- * Get the currently unredacted fields
200
- */
201
- getUnredactedFields(): string[];
202
- /**
203
- * Remove specific fields from unredaction (they become redacted again)
204
- * @param fields Array of CSS selectors for fields to redact
205
- */
206
- redactFields(fields: string[]): void;
207
- /**
208
- * Clear all unredacted fields (everything becomes redacted again)
209
- */
210
- clearUnredactedFields(): void;
211
- /**
212
- * Get the current session ID
213
- */
214
- getSessionId(): string;
215
- /**
216
- * Get the current URL being tracked
217
- */
218
- getCurrentUrl(): string;
219
- /**
220
- * Get current snapshot frequency info
221
- * Uses configured values (5 minutes, 1000 events)
222
- */
223
- getSnapshotFrequencyInfo(): {
224
- sessionDuration: number;
225
- currentInterval: number;
226
- currentThreshold: number;
227
- phase: string;
228
- };
229
- /**
230
- * Test if the tracker can reach the ingestion server
231
- */
232
- testConnection(): Promise<{
233
- success: boolean;
234
- error?: string;
235
- }>;
236
- /**
237
- * Get connection status and recommendations
238
- */
239
- getConnectionStatus(): {
240
- blocked: boolean;
241
- recommendations: string[];
242
- };
243
- /**
244
- * Check if the current user is a preexisting user
245
- * Returns true if the user has an existing endUserId cookie from a previous session
246
- */
247
- isPreexistingUser(): boolean;
248
- /**
249
- * Get user information including whether they are preexisting
250
- */
251
- getUserInfo(): {
252
- endUserId: string | null;
253
- sessionId: string;
254
- isPreexistingUser: boolean;
255
- initialized: boolean;
256
- };
257
- /**
258
- * Set a session property that will be included in all events for this session
259
- */
260
- setSessionProperty(key: string, value: any): void;
261
- /**
262
- * Set multiple session properties
263
- */
264
- setSessionProperties(properties: Record<string, any>): void;
265
- /**
266
- * Get a session property
267
- */
268
- getSessionProperty(key: string): any;
269
- /**
270
- * Remove a session property
271
- */
272
- removeSessionProperty(key: string): void;
273
- /**
274
- * Set a user property that will be included in all events
275
- */
276
- setUserProperty(key: string, value: any): void;
277
- /**
278
- * Set multiple user properties
279
- */
280
- setUserProperties(properties: Record<string, any>): void;
281
- /**
282
- * Get a user property
283
- */
284
- getUserProperty(key: string): any;
285
- /**
286
- * Remove a user property
287
- */
288
- removeUserProperty(key: string): void;
289
- /**
290
- * Set a property only if it hasn't been set before
291
- */
292
- setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
293
- /**
294
- * Clear all session properties
295
- */
296
- clearSessionProperties(): void;
297
- /**
298
- * Clear all user properties
299
- */
300
- clearUserProperties(): void;
301
- /**
302
- * Get all properties for debugging
303
- */
304
- getAllProperties(): {
305
- automatic: Record<string, any>;
306
- session: Record<string, any>;
307
- user: Record<string, any>;
308
- initial: Record<string, any>;
309
- };
310
- }
311
-
312
- declare class HumanBehaviorModule {
313
- static forRoot(config: {
314
- apiKey: string;
315
- ingestionUrl?: string;
316
- logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
317
- redactFields?: string[];
318
- suppressConsoleErrors?: boolean;
319
- recordCanvas?: boolean;
320
- }): {
321
- ngModule: typeof HumanBehaviorModule;
322
- providers: ({
323
- provide: string;
324
- useValue: string;
325
- useFactory?: undefined;
326
- deps?: undefined;
327
- } | {
328
- provide: typeof HumanBehaviorTracker;
329
- useFactory: (apiKey: string) => HumanBehaviorTracker;
330
- deps: string[];
331
- useValue?: undefined;
332
- })[];
333
- };
334
- }
335
- declare class HumanBehaviorService {
336
- private tracker;
337
- constructor(apiKey: string, options?: {
338
- ingestionUrl?: string;
339
- logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
340
- redactFields?: string[];
341
- suppressConsoleErrors?: boolean;
342
- recordCanvas?: boolean;
343
- });
344
- identifyUser(userProperties: Record<string, any>): Promise<string>;
345
- getSessionId(): string;
346
- setUnredactedFields(fields: string[]): void;
347
- getUnredactedFields(): string[];
348
- }
349
- declare function initializeHumanBehavior(apiKey: string, options?: {
350
- ingestionUrl?: string;
351
- logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
352
- redactFields?: string[];
353
- suppressConsoleErrors?: boolean;
354
- recordCanvas?: boolean;
355
- }): HumanBehaviorTracker;
356
-
357
- export { HumanBehaviorModule, HumanBehaviorService, initializeHumanBehavior };