humanbehavior-js 0.4.27 → 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.
- package/README.md +151 -0
- package/package.json +114 -71
- package/packages/angular/dist/index.d.ts +46 -0
- package/packages/angular/dist/index.d.ts.map +1 -0
- package/packages/angular/dist/index.js +2 -0
- package/packages/angular/dist/index.js.map +1 -0
- package/packages/angular/dist/index.mjs +2 -0
- package/packages/angular/dist/index.mjs.map +1 -0
- package/packages/browser/dist/index.d.ts +5 -0
- package/packages/browser/dist/index.d.ts.map +1 -0
- package/packages/browser/dist/index.iife.js +12095 -0
- package/packages/browser/dist/index.iife.js.map +1 -0
- package/packages/browser/dist/index.js +2 -0
- package/packages/browser/dist/index.js.map +1 -0
- package/packages/browser/dist/index.min.js +2 -0
- package/packages/browser/dist/index.min.js.map +1 -0
- package/packages/browser/dist/index.mjs +2 -0
- package/packages/browser/dist/index.mjs.map +1 -0
- package/packages/react/dist/browser.d.ts +2 -0
- package/packages/react/dist/browser.d.ts.map +1 -0
- package/packages/react/dist/index.d.ts +48 -0
- package/packages/react/dist/index.d.ts.map +1 -0
- package/packages/react/dist/index.js +2 -0
- package/packages/react/dist/index.js.map +1 -0
- package/packages/react/dist/index.mjs +2 -0
- package/packages/react/dist/index.mjs.map +1 -0
- package/packages/remix/dist/index.d.ts +8 -0
- package/packages/remix/dist/index.d.ts.map +1 -0
- package/packages/remix/dist/index.js +2 -0
- package/packages/remix/dist/index.js.map +1 -0
- package/packages/remix/dist/index.mjs +2 -0
- package/packages/remix/dist/index.mjs.map +1 -0
- package/packages/svelte/dist/index.d.ts +11 -0
- package/packages/svelte/dist/index.d.ts.map +1 -0
- package/packages/svelte/dist/index.js +2 -0
- package/packages/svelte/dist/index.js.map +1 -0
- package/packages/svelte/dist/index.mjs +2 -0
- package/packages/svelte/dist/index.mjs.map +1 -0
- package/{dist/types/vue → packages/vue/dist}/index.d.ts +4 -5
- package/packages/vue/dist/index.d.ts.map +1 -0
- package/packages/vue/dist/index.js +2 -0
- package/packages/vue/dist/index.js.map +1 -0
- package/packages/vue/dist/index.mjs +2 -0
- package/packages/vue/dist/index.mjs.map +1 -0
- package/packages/wizard/dist/ai/ai-install-wizard.d.ts +145 -0
- package/packages/wizard/dist/ai/ai-install-wizard.d.ts.map +1 -0
- package/packages/wizard/dist/ai/manual-framework-wizard.d.ts +52 -0
- package/packages/wizard/dist/ai/manual-framework-wizard.d.ts.map +1 -0
- package/packages/wizard/dist/cli/ai-auto-install.d.ts +27 -0
- package/packages/wizard/dist/cli/ai-auto-install.d.ts.map +1 -0
- package/{dist → packages/wizard/dist}/cli/ai-auto-install.js +821 -905
- package/packages/wizard/dist/cli/ai-auto-install.js.map +1 -0
- package/packages/wizard/dist/cli/auto-install.d.ts +26 -0
- package/packages/wizard/dist/cli/auto-install.d.ts.map +1 -0
- package/{dist → packages/wizard/dist}/cli/auto-install.js +821 -905
- package/packages/wizard/dist/cli/auto-install.js.map +1 -0
- package/{dist/types → packages/wizard/dist/core}/install-wizard.d.ts +6 -8
- package/packages/wizard/dist/core/install-wizard.d.ts.map +1 -0
- package/packages/wizard/dist/index.d.ts +18 -0
- package/packages/wizard/dist/index.d.ts.map +1 -0
- package/packages/wizard/dist/index.js +2 -0
- package/packages/wizard/dist/index.js.map +1 -0
- package/packages/wizard/dist/index.mjs +2 -0
- package/packages/wizard/dist/index.mjs.map +1 -0
- package/packages/wizard/dist/services/centralized-ai-service.d.ts +159 -0
- package/packages/wizard/dist/services/centralized-ai-service.d.ts.map +1 -0
- package/packages/wizard/dist/services/remote-ai-service.d.ts +58 -0
- package/packages/wizard/dist/services/remote-ai-service.d.ts.map +1 -0
- package/WIZARD_USAGE_GUIDE.md +0 -381
- package/dist/cjs/angular/index.cjs +0 -14979
- package/dist/cjs/angular/index.cjs.map +0 -1
- package/dist/cjs/index.cjs +0 -14964
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/install-wizard.cjs +0 -1576
- package/dist/cjs/install-wizard.cjs.map +0 -1
- package/dist/cjs/react/index.cjs +0 -15103
- package/dist/cjs/react/index.cjs.map +0 -1
- package/dist/cjs/remix/index.cjs +0 -15077
- package/dist/cjs/remix/index.cjs.map +0 -1
- package/dist/cjs/svelte/index.cjs +0 -14933
- package/dist/cjs/svelte/index.cjs.map +0 -1
- package/dist/cjs/vue/index.cjs +0 -14942
- package/dist/cjs/vue/index.cjs.map +0 -1
- package/dist/cjs/wizard/index.cjs +0 -3490
- package/dist/cjs/wizard/index.cjs.map +0 -1
- package/dist/cli/ai-auto-install.js.map +0 -1
- package/dist/cli/auto-install.js.map +0 -1
- package/dist/esm/angular/index.js +0 -14975
- package/dist/esm/angular/index.js.map +0 -1
- package/dist/esm/index.js +0 -14941
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/install-wizard.js +0 -1553
- package/dist/esm/install-wizard.js.map +0 -1
- package/dist/esm/react/index.js +0 -15097
- package/dist/esm/react/index.js.map +0 -1
- package/dist/esm/remix/index.js +0 -15073
- package/dist/esm/remix/index.js.map +0 -1
- package/dist/esm/svelte/index.js +0 -14931
- package/dist/esm/svelte/index.js.map +0 -1
- package/dist/esm/vue/index.js +0 -14940
- package/dist/esm/vue/index.js.map +0 -1
- package/dist/esm/wizard/index.js +0 -3459
- package/dist/esm/wizard/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/dist/types/angular/index.d.ts +0 -357
- package/dist/types/index.d.ts +0 -644
- package/dist/types/react/index.d.ts +0 -345
- package/dist/types/remix/index.d.ts +0 -336
- package/dist/types/svelte/index.d.ts +0 -322
- package/dist/types/wizard/index.d.ts +0 -523
- package/readme.md +0 -335
- package/rollup.config.js +0 -422
- package/simple-spa.html +0 -1000
- package/src/angular/index.ts +0 -79
- package/src/api.ts +0 -416
- package/src/index.ts +0 -35
- package/src/react/AutoInstallWizard.tsx +0 -557
- package/src/react/browser.ts +0 -8
- package/src/react/index.tsx +0 -308
- package/src/redact.ts +0 -327
- package/src/remix/index.ts +0 -16
- package/src/svelte/index.ts +0 -14
- package/src/tracker.ts +0 -1587
- package/src/types/clack.d.ts +0 -31
- package/src/utils/ip-detector.ts +0 -158
- package/src/utils/logger.ts +0 -144
- package/src/utils/property-detector.ts +0 -345
- package/src/utils/property-manager.ts +0 -274
- package/src/vue/index.ts +0 -29
- package/src/wizard/README.md +0 -114
- package/src/wizard/ai/ai-install-wizard.ts +0 -897
- package/src/wizard/ai/manual-framework-wizard.ts +0 -238
- package/src/wizard/cli/ai-auto-install.ts +0 -241
- package/src/wizard/cli/auto-install.ts +0 -224
- package/src/wizard/core/install-wizard.ts +0 -1794
- package/src/wizard/index.ts +0 -23
- package/src/wizard/services/centralized-ai-service.ts +0 -668
- package/src/wizard/services/remote-ai-service.ts +0 -240
- package/tsconfig.json +0 -24
|
@@ -1,322 +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 const humanBehaviorStore: {
|
|
313
|
-
init: (apiKey: string, options?: {
|
|
314
|
-
ingestionUrl?: string;
|
|
315
|
-
logLevel?: "none" | "error" | "warn" | "info" | "debug";
|
|
316
|
-
redactFields?: string[];
|
|
317
|
-
suppressConsoleErrors?: boolean;
|
|
318
|
-
recordCanvas?: boolean;
|
|
319
|
-
}) => HumanBehaviorTracker;
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
export { humanBehaviorStore };
|