humanbehavior-js 0.5.17 → 0.5.19
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/package.json +8 -43
- package/packages/browser/dist/cjs/index.js +42 -0
- package/packages/browser/dist/cjs/index.js.map +1 -0
- package/packages/browser/dist/esm/index.js +20 -0
- package/packages/browser/dist/esm/index.js.map +1 -0
- package/packages/browser/dist/index.min.js +1 -1
- package/packages/browser/dist/index.min.js.map +1 -1
- package/packages/browser/dist/types/index.d.ts.map +1 -0
- package/packages/core/dist/api.d.ts +30 -0
- package/packages/core/dist/api.d.ts.map +1 -0
- package/packages/core/dist/index.d.ts +13 -0
- package/packages/core/dist/index.d.ts.map +1 -0
- package/packages/core/dist/index.js +2 -0
- package/packages/core/dist/index.js.map +1 -0
- package/packages/core/dist/index.mjs +2 -0
- package/packages/core/dist/index.mjs.map +1 -0
- package/packages/core/dist/redact.d.ts +88 -0
- package/packages/core/dist/redact.d.ts.map +1 -0
- package/packages/core/dist/tracker.d.ts +338 -0
- package/packages/core/dist/tracker.d.ts.map +1 -0
- package/packages/core/dist/utils/global-tracker.d.ts +23 -0
- package/packages/core/dist/utils/global-tracker.d.ts.map +1 -0
- package/packages/core/dist/utils/logger.d.ts +34 -0
- package/packages/core/dist/utils/logger.d.ts.map +1 -0
- package/packages/core/dist/utils/property-detector.d.ts +59 -0
- package/packages/core/dist/utils/property-detector.d.ts.map +1 -0
- package/packages/core/dist/utils/property-manager.d.ts +112 -0
- package/packages/core/dist/utils/property-manager.d.ts.map +1 -0
- package/packages/react/dist/index.js +1 -1
- package/packages/react/dist/index.js.map +1 -1
- package/packages/react/dist/index.mjs +1 -1
- package/packages/react/dist/index.mjs.map +1 -1
- package/packages/angular/dist/index.d.ts +0 -46
- package/packages/angular/dist/index.d.ts.map +0 -1
- package/packages/angular/dist/index.js +0 -2
- package/packages/angular/dist/index.js.map +0 -1
- package/packages/angular/dist/index.mjs +0 -2
- package/packages/angular/dist/index.mjs.map +0 -1
- package/packages/browser/dist/cdn.d.ts +0 -8
- package/packages/browser/dist/cdn.d.ts.map +0 -1
- package/packages/browser/dist/cdn.js +0 -2
- package/packages/browser/dist/cdn.js.map +0 -1
- package/packages/browser/dist/index.d.ts.map +0 -1
- package/packages/browser/dist/index.js +0 -12100
- package/packages/browser/dist/index.js.map +0 -1
- package/packages/browser/dist/index.mjs +0 -12081
- package/packages/browser/dist/index.mjs.map +0 -1
- package/packages/browser/dist/index.umd.js +0 -12113
- package/packages/browser/dist/index.umd.js.map +0 -1
- package/packages/browser/dist/module.cjs.d.ts +0 -10
- package/packages/browser/dist/module.cjs.d.ts.map +0 -1
- package/packages/browser/dist/module.es.d.ts +0 -10
- package/packages/browser/dist/module.es.d.ts.map +0 -1
- package/packages/browser/dist/module.js +0 -2
- package/packages/browser/dist/module.js.map +0 -1
- package/packages/remix/dist/index.d.ts +0 -8
- package/packages/remix/dist/index.d.ts.map +0 -1
- package/packages/remix/dist/index.js +0 -2
- package/packages/remix/dist/index.js.map +0 -1
- package/packages/remix/dist/index.mjs +0 -2
- package/packages/remix/dist/index.mjs.map +0 -1
- package/packages/svelte/dist/index.d.ts +0 -11
- package/packages/svelte/dist/index.d.ts.map +0 -1
- package/packages/svelte/dist/index.js +0 -2
- package/packages/svelte/dist/index.js.map +0 -1
- package/packages/svelte/dist/index.mjs +0 -2
- package/packages/svelte/dist/index.mjs.map +0 -1
- package/packages/vue/dist/index.d.ts +0 -14
- package/packages/vue/dist/index.d.ts.map +0 -1
- package/packages/vue/dist/index.js +0 -2
- package/packages/vue/dist/index.js.map +0 -1
- package/packages/vue/dist/index.mjs +0 -2
- package/packages/vue/dist/index.mjs.map +0 -1
- /package/packages/browser/dist/{index.d.ts → types/index.d.ts} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export 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
|
+
export declare class RedactionManager {
|
|
13
|
+
private redactedText;
|
|
14
|
+
private unredactedFields;
|
|
15
|
+
private redactedFields;
|
|
16
|
+
private redactionMode;
|
|
17
|
+
private excludeSelectors;
|
|
18
|
+
constructor(options?: RedactionOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Set specific fields to be redacted (for visibility-first mode)
|
|
21
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
22
|
+
*/
|
|
23
|
+
setFieldsToRedact(fields: string[]): void;
|
|
24
|
+
/**
|
|
25
|
+
* Set specific fields to be unredacted (everything else stays redacted by rrweb)
|
|
26
|
+
* @param fields Array of CSS selectors for fields to unredact
|
|
27
|
+
*/
|
|
28
|
+
setFieldsToUnredact(fields: string[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Remove specific fields from unredaction (they become redacted again)
|
|
31
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
32
|
+
*/
|
|
33
|
+
redactFields(fields: string[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* Clear all unredacted fields (everything becomes redacted again)
|
|
36
|
+
*/
|
|
37
|
+
clearUnredactedFields(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Check if any fields are currently unredacted
|
|
40
|
+
*/
|
|
41
|
+
hasUnredactedFields(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Get the current redaction mode
|
|
44
|
+
*/
|
|
45
|
+
getRedactionMode(): 'privacy-first' | 'visibility-first';
|
|
46
|
+
/**
|
|
47
|
+
* Get the currently unredacted fields
|
|
48
|
+
*/
|
|
49
|
+
getUnredactedFields(): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Get CSS selectors for rrweb masking configuration
|
|
52
|
+
* Returns null if no fields are unredacted (everything stays redacted)
|
|
53
|
+
*/
|
|
54
|
+
getMaskTextSelector(): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Apply redaction classes to DOM elements (for visibility-first mode)
|
|
57
|
+
* Adds 'rr-mask' class to elements that should be redacted
|
|
58
|
+
*/
|
|
59
|
+
applyRedactionClasses(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Apply unredaction classes to DOM elements
|
|
62
|
+
* Removes 'rr-mask' class from elements that should be unredacted
|
|
63
|
+
*/
|
|
64
|
+
applyUnredactionClasses(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Remove all unredaction classes from DOM elements
|
|
67
|
+
*/
|
|
68
|
+
removeUnredactionClasses(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Check if a selector represents a password field
|
|
71
|
+
*/
|
|
72
|
+
private isPasswordSelector;
|
|
73
|
+
/**
|
|
74
|
+
* Get the original value of an element (for debugging)
|
|
75
|
+
*/
|
|
76
|
+
getOriginalValue(element: HTMLElement): string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Check if an element is currently unredacted
|
|
79
|
+
*/
|
|
80
|
+
isElementUnredacted(element: HTMLElement): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Check if an element should be unredacted
|
|
83
|
+
*/
|
|
84
|
+
shouldUnredactElement(element: HTMLElement): boolean;
|
|
85
|
+
}
|
|
86
|
+
export declare const redactionManager: RedactionManager;
|
|
87
|
+
export default RedactionManager;
|
|
88
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,gBAAgB;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,iBAAiB,CAAC,EAAE;QAChB,IAAI,EAAE,eAAe,GAAG,kBAAkB,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AC;AAGvD,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { RedactionOptions } from './redact';
|
|
2
|
+
export declare class HumanBehaviorTracker {
|
|
3
|
+
private eventQueue;
|
|
4
|
+
private sessionId;
|
|
5
|
+
private userProperties;
|
|
6
|
+
private isProcessing;
|
|
7
|
+
private flushInterval;
|
|
8
|
+
private readonly FLUSH_INTERVAL_MS;
|
|
9
|
+
private readonly MAX_QUEUE_SIZE;
|
|
10
|
+
private api;
|
|
11
|
+
private endUserId;
|
|
12
|
+
private apiKey;
|
|
13
|
+
private initialized;
|
|
14
|
+
initializationPromise: Promise<void> | null;
|
|
15
|
+
private redactionManager;
|
|
16
|
+
private propertyManager;
|
|
17
|
+
private isDomReady;
|
|
18
|
+
private requestQueue;
|
|
19
|
+
private domReadyHandlers;
|
|
20
|
+
private originalConsole;
|
|
21
|
+
private consoleTrackingEnabled;
|
|
22
|
+
navigationTrackingEnabled: boolean;
|
|
23
|
+
private currentUrl;
|
|
24
|
+
private previousUrl;
|
|
25
|
+
private originalPushState;
|
|
26
|
+
private originalReplaceState;
|
|
27
|
+
private navigationListeners;
|
|
28
|
+
private _connectionBlocked;
|
|
29
|
+
private recordInstance;
|
|
30
|
+
private sessionStartTime;
|
|
31
|
+
private rrwebRecord;
|
|
32
|
+
private fullSnapshotTimeout;
|
|
33
|
+
private recordCanvas;
|
|
34
|
+
private isStarted;
|
|
35
|
+
/**
|
|
36
|
+
* Check if the tracker has been started
|
|
37
|
+
*/
|
|
38
|
+
get isTrackerStarted(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* DOM ready detection - more aggressive
|
|
41
|
+
*/
|
|
42
|
+
private setupDomReadyHandler;
|
|
43
|
+
/**
|
|
44
|
+
* Called when DOM is ready - processes queued requests
|
|
45
|
+
*/
|
|
46
|
+
private onDomReady;
|
|
47
|
+
/**
|
|
48
|
+
* Queue a request until DOM is ready
|
|
49
|
+
*/
|
|
50
|
+
private queueRequest;
|
|
51
|
+
/**
|
|
52
|
+
* Process a request (called after DOM is ready)
|
|
53
|
+
*/
|
|
54
|
+
private processRequest;
|
|
55
|
+
/**
|
|
56
|
+
* Register a handler to be called when DOM is ready
|
|
57
|
+
*/
|
|
58
|
+
private registerDomReadyHandler;
|
|
59
|
+
/**
|
|
60
|
+
* Initialize the HumanBehavior tracker
|
|
61
|
+
* This is the main entry point - call this once per page
|
|
62
|
+
*/
|
|
63
|
+
static init(apiKey: string, options?: {
|
|
64
|
+
ingestionUrl?: string;
|
|
65
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
66
|
+
redactFields?: string[];
|
|
67
|
+
redactionStrategy?: {
|
|
68
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
69
|
+
unredactFields?: string[];
|
|
70
|
+
redactFields?: string[];
|
|
71
|
+
};
|
|
72
|
+
enableAutomaticTracking?: boolean;
|
|
73
|
+
suppressConsoleErrors?: boolean;
|
|
74
|
+
recordCanvas?: boolean;
|
|
75
|
+
enableAutomaticProperties?: boolean;
|
|
76
|
+
propertyDenylist?: string[];
|
|
77
|
+
automaticTrackingOptions?: {
|
|
78
|
+
trackButtons?: boolean;
|
|
79
|
+
trackLinks?: boolean;
|
|
80
|
+
trackForms?: boolean;
|
|
81
|
+
includeText?: boolean;
|
|
82
|
+
includeClasses?: boolean;
|
|
83
|
+
};
|
|
84
|
+
maxQueueSize?: number;
|
|
85
|
+
}): HumanBehaviorTracker;
|
|
86
|
+
constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
|
|
87
|
+
enableAutomaticProperties?: boolean;
|
|
88
|
+
propertyDenylist?: string[];
|
|
89
|
+
redactionStrategy?: {
|
|
90
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
91
|
+
unredactFields?: string[];
|
|
92
|
+
redactFields?: string[];
|
|
93
|
+
};
|
|
94
|
+
redactFields?: string[];
|
|
95
|
+
maxQueueSize?: number;
|
|
96
|
+
});
|
|
97
|
+
private init;
|
|
98
|
+
private initServerAsync;
|
|
99
|
+
/**
|
|
100
|
+
* ✅ FIXED: Wait for Kafka-based initialization to complete
|
|
101
|
+
*/
|
|
102
|
+
private ensureInitialized;
|
|
103
|
+
/**
|
|
104
|
+
* Setup navigation event tracking for SPA navigation
|
|
105
|
+
*/
|
|
106
|
+
private setupNavigationTracking;
|
|
107
|
+
/**
|
|
108
|
+
* Track navigation events and send custom events
|
|
109
|
+
*/
|
|
110
|
+
trackNavigationEvent(type: string, fromUrl: string, toUrl: string): Promise<void>;
|
|
111
|
+
trackPageView(url?: string): Promise<void>;
|
|
112
|
+
customEvent(eventName: string, properties?: Record<string, any>): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Setup automatic tracking for buttons, links, and forms
|
|
115
|
+
* TEMPORARILY DISABLED: Automatic custom event tracking
|
|
116
|
+
*/
|
|
117
|
+
private setupAutomaticTracking;
|
|
118
|
+
/**
|
|
119
|
+
* Setup automatic button tracking
|
|
120
|
+
* TEMPORARILY DISABLED: Automatic custom event tracking
|
|
121
|
+
*/
|
|
122
|
+
private setupAutomaticButtonTracking;
|
|
123
|
+
/**
|
|
124
|
+
* Setup automatic link tracking
|
|
125
|
+
* TEMPORARILY DISABLED: Automatic custom event tracking
|
|
126
|
+
*/
|
|
127
|
+
private setupAutomaticLinkTracking;
|
|
128
|
+
/**
|
|
129
|
+
* Setup automatic form tracking
|
|
130
|
+
* TEMPORARILY DISABLED: Automatic custom event tracking
|
|
131
|
+
*/
|
|
132
|
+
private setupAutomaticFormTracking;
|
|
133
|
+
/**
|
|
134
|
+
* Cleanup navigation tracking
|
|
135
|
+
*/
|
|
136
|
+
private cleanupNavigationTracking;
|
|
137
|
+
static logToStorage(message: string): void;
|
|
138
|
+
/**
|
|
139
|
+
* Configure logging behavior for the SDK
|
|
140
|
+
* @param config Logger configuration options
|
|
141
|
+
*/
|
|
142
|
+
static configureLogging(config: {
|
|
143
|
+
level?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
144
|
+
enableConsole?: boolean;
|
|
145
|
+
enableStorage?: boolean;
|
|
146
|
+
}): void;
|
|
147
|
+
/**
|
|
148
|
+
* Enable console event tracking
|
|
149
|
+
*/
|
|
150
|
+
enableConsoleTracking(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Disable console event tracking
|
|
153
|
+
*/
|
|
154
|
+
disableConsoleTracking(): void;
|
|
155
|
+
private trackConsoleEvent;
|
|
156
|
+
private setupPageUnloadHandler;
|
|
157
|
+
viewLogs(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Add user identification information to the tracker
|
|
160
|
+
* If userId is not provided, will use userProperties.email as the userId (if present)
|
|
161
|
+
*/
|
|
162
|
+
identifyUser({ userProperties }: {
|
|
163
|
+
userProperties: Record<string, any>;
|
|
164
|
+
}): Promise<string>;
|
|
165
|
+
/**
|
|
166
|
+
* Get current user attributes
|
|
167
|
+
*/
|
|
168
|
+
getUserAttributes(): Record<string, any>;
|
|
169
|
+
start(): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Manually trigger a FullSnapshot (for navigation events)
|
|
172
|
+
* Delays snapshot to avoid capturing mid-animation states
|
|
173
|
+
*/
|
|
174
|
+
private takeFullSnapshot;
|
|
175
|
+
stop(): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Add an event to the ingestion queue
|
|
178
|
+
* Events are sent directly without processing to avoid corruption
|
|
179
|
+
*/
|
|
180
|
+
addEvent(event: any): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Flush events to the ingestion server
|
|
183
|
+
* Events are sent in chunks to handle large payloads efficiently
|
|
184
|
+
*/
|
|
185
|
+
private flushEvents;
|
|
186
|
+
/**
|
|
187
|
+
* Add an event to the session recording queue
|
|
188
|
+
* These are typically FullSnapshots or IncrementalSnapshots
|
|
189
|
+
*/
|
|
190
|
+
addRecordingEvent(event: any): Promise<void>;
|
|
191
|
+
private setCookie;
|
|
192
|
+
getCookie(name: string): string | null;
|
|
193
|
+
/**
|
|
194
|
+
* Delete a cookie by setting its expiration date to the past
|
|
195
|
+
* @param name The name of the cookie to delete
|
|
196
|
+
*/
|
|
197
|
+
private deleteCookie;
|
|
198
|
+
/**
|
|
199
|
+
* Clear user data and reset session when user signs out of the site
|
|
200
|
+
* This should be called when a user logs out of your application to prevent
|
|
201
|
+
* data contamination between different users
|
|
202
|
+
*/
|
|
203
|
+
logout(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Start redaction functionality for sensitive input fields
|
|
206
|
+
* @param options Optional configuration for redaction behavior
|
|
207
|
+
*/
|
|
208
|
+
redact(options?: RedactionOptions): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Set specific fields to be redacted (for visibility-first mode)
|
|
211
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
212
|
+
*/
|
|
213
|
+
setRedactedFields(fields: string[]): void;
|
|
214
|
+
/**
|
|
215
|
+
* Set specific fields to be unredacted (everything else stays redacted by rrweb)
|
|
216
|
+
* @param fields Array of CSS selectors for fields to unredact (e.g., ['#username', '#comment'])
|
|
217
|
+
*/
|
|
218
|
+
setUnredactedFields(fields: string[]): void;
|
|
219
|
+
private restartWithNewRedaction;
|
|
220
|
+
/**
|
|
221
|
+
* Check if any fields are currently unredacted
|
|
222
|
+
*/
|
|
223
|
+
hasUnredactedFields(): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Get the currently unredacted fields
|
|
226
|
+
*/
|
|
227
|
+
getUnredactedFields(): string[];
|
|
228
|
+
/**
|
|
229
|
+
* Remove specific fields from unredaction (they become redacted again)
|
|
230
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
231
|
+
*/
|
|
232
|
+
redactFields(fields: string[]): void;
|
|
233
|
+
/**
|
|
234
|
+
* Clear all unredacted fields (everything becomes redacted again)
|
|
235
|
+
*/
|
|
236
|
+
clearUnredactedFields(): void;
|
|
237
|
+
/**
|
|
238
|
+
* Get the current session ID
|
|
239
|
+
*/
|
|
240
|
+
getSessionId(): string;
|
|
241
|
+
/**
|
|
242
|
+
* Get the current URL being tracked
|
|
243
|
+
*/
|
|
244
|
+
getCurrentUrl(): string;
|
|
245
|
+
/**
|
|
246
|
+
* Get current snapshot frequency info
|
|
247
|
+
* Uses configured values (5 minutes, 1000 events)
|
|
248
|
+
*/
|
|
249
|
+
getSnapshotFrequencyInfo(): {
|
|
250
|
+
sessionDuration: number;
|
|
251
|
+
currentInterval: number;
|
|
252
|
+
currentThreshold: number;
|
|
253
|
+
phase: string;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Test if the tracker can reach the ingestion server
|
|
257
|
+
*/
|
|
258
|
+
testConnection(): Promise<{
|
|
259
|
+
success: boolean;
|
|
260
|
+
error?: string;
|
|
261
|
+
}>;
|
|
262
|
+
/**
|
|
263
|
+
* Get connection status and recommendations
|
|
264
|
+
*/
|
|
265
|
+
getConnectionStatus(): {
|
|
266
|
+
blocked: boolean;
|
|
267
|
+
recommendations: string[];
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Check if the current user is a preexisting user
|
|
271
|
+
* Returns true if the user has an existing endUserId cookie from a previous session
|
|
272
|
+
*/
|
|
273
|
+
isPreexistingUser(): boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Get user information including whether they are preexisting
|
|
276
|
+
*/
|
|
277
|
+
getUserInfo(): {
|
|
278
|
+
endUserId: string | null;
|
|
279
|
+
sessionId: string;
|
|
280
|
+
isPreexistingUser: boolean;
|
|
281
|
+
initialized: boolean;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Set a session property that will be included in all events for this session
|
|
285
|
+
*/
|
|
286
|
+
setSessionProperty(key: string, value: any): void;
|
|
287
|
+
/**
|
|
288
|
+
* Set multiple session properties
|
|
289
|
+
*/
|
|
290
|
+
setSessionProperties(properties: Record<string, any>): void;
|
|
291
|
+
/**
|
|
292
|
+
* Get a session property
|
|
293
|
+
*/
|
|
294
|
+
getSessionProperty(key: string): any;
|
|
295
|
+
/**
|
|
296
|
+
* Remove a session property
|
|
297
|
+
*/
|
|
298
|
+
removeSessionProperty(key: string): void;
|
|
299
|
+
/**
|
|
300
|
+
* Set a user property that will be included in all events
|
|
301
|
+
*/
|
|
302
|
+
setUserProperty(key: string, value: any): void;
|
|
303
|
+
/**
|
|
304
|
+
* Set multiple user properties
|
|
305
|
+
*/
|
|
306
|
+
setUserProperties(properties: Record<string, any>): void;
|
|
307
|
+
/**
|
|
308
|
+
* Get a user property
|
|
309
|
+
*/
|
|
310
|
+
getUserProperty(key: string): any;
|
|
311
|
+
/**
|
|
312
|
+
* Remove a user property
|
|
313
|
+
*/
|
|
314
|
+
removeUserProperty(key: string): void;
|
|
315
|
+
/**
|
|
316
|
+
* Set a property only if it hasn't been set before
|
|
317
|
+
*/
|
|
318
|
+
setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
|
|
319
|
+
/**
|
|
320
|
+
* Clear all session properties
|
|
321
|
+
*/
|
|
322
|
+
clearSessionProperties(): void;
|
|
323
|
+
/**
|
|
324
|
+
* Clear all user properties
|
|
325
|
+
*/
|
|
326
|
+
clearUserProperties(): void;
|
|
327
|
+
/**
|
|
328
|
+
* Get all properties for debugging
|
|
329
|
+
*/
|
|
330
|
+
getAllProperties(): {
|
|
331
|
+
automatic: Record<string, any>;
|
|
332
|
+
session: Record<string, any>;
|
|
333
|
+
user: Record<string, any>;
|
|
334
|
+
initial: Record<string, any>;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
export default HumanBehaviorTracker;
|
|
338
|
+
//# sourceMappingURL=tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../src/tracker.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAS9D,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,UAAU,CAAa;IAE/B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,cAAc,CAA2B;IACjD,O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AS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAChC;CAGJ;AAOD,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global tracker utility functions
|
|
3
|
+
* Provides helper functions for accessing the global HumanBehavior tracker instance
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Identifies a user using the global HumanBehavior tracker
|
|
7
|
+
* @param userProperties - User properties to identify with
|
|
8
|
+
* @returns Promise<string> - The endUserId if successful, null if tracker not found
|
|
9
|
+
*/
|
|
10
|
+
export declare function identifyUserGlobally(userProperties: Record<string, any>): Promise<string> | null;
|
|
11
|
+
/**
|
|
12
|
+
* Sends an event using the global HumanBehavior tracker
|
|
13
|
+
* @param eventName - Name of the event
|
|
14
|
+
* @param properties - Event properties
|
|
15
|
+
* @returns Promise<boolean> - True if successful, false if tracker not found
|
|
16
|
+
*/
|
|
17
|
+
export declare function sendEventGlobally(eventName: string, properties?: Record<string, any>): Promise<boolean> | null;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if the global HumanBehavior tracker is available
|
|
20
|
+
* @returns boolean - True if tracker is available
|
|
21
|
+
*/
|
|
22
|
+
export declare function isGlobalTrackerAvailable(): boolean;
|
|
23
|
+
//# sourceMappingURL=global-tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-tracker.d.ts","sourceRoot":"","sources":["../../src/utils/global-tracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAShG;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAS9G;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAGlD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
NONE = 0,
|
|
3
|
+
ERROR = 1,
|
|
4
|
+
WARN = 2,
|
|
5
|
+
INFO = 3,
|
|
6
|
+
DEBUG = 4
|
|
7
|
+
}
|
|
8
|
+
export interface LoggerConfig {
|
|
9
|
+
level: LogLevel;
|
|
10
|
+
enableConsole: boolean;
|
|
11
|
+
enableStorage: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare class Logger {
|
|
14
|
+
private config;
|
|
15
|
+
private isBrowser;
|
|
16
|
+
constructor(config?: Partial<LoggerConfig>);
|
|
17
|
+
setConfig(config: Partial<LoggerConfig>): void;
|
|
18
|
+
private shouldLog;
|
|
19
|
+
private formatMessage;
|
|
20
|
+
error(message: string, ...args: any[]): void;
|
|
21
|
+
warn(message: string, ...args: any[]): void;
|
|
22
|
+
info(message: string, ...args: any[]): void;
|
|
23
|
+
debug(message: string, ...args: any[]): void;
|
|
24
|
+
private logToStorage;
|
|
25
|
+
getLogs(): any[];
|
|
26
|
+
clearLogs(): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const logger: Logger;
|
|
29
|
+
export declare const logError: (message: string, ...args: any[]) => void;
|
|
30
|
+
export declare const logWarn: (message: string, ...args: any[]) => void;
|
|
31
|
+
export declare const logInfo: (message: string, ...args: any[]) => void;
|
|
32
|
+
export declare const logDebug: (message: string, ...args: any[]) => void;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +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O,GAAI,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,EAAE,SAAkC,CAAC;AAC1F,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,EAAE,SAAmC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automatic Property Detection for HumanBehavior SDK
|
|
3
|
+
* Captures device type, location, and initial referrer information
|
|
4
|
+
*/
|
|
5
|
+
export interface DeviceInfo {
|
|
6
|
+
device_type: string;
|
|
7
|
+
browser: string;
|
|
8
|
+
browser_version: string;
|
|
9
|
+
os: string;
|
|
10
|
+
os_version: string;
|
|
11
|
+
device_model?: string;
|
|
12
|
+
screen_resolution: string;
|
|
13
|
+
viewport_size: string;
|
|
14
|
+
color_depth: number;
|
|
15
|
+
timezone: string;
|
|
16
|
+
language: string;
|
|
17
|
+
languages: string[];
|
|
18
|
+
raw_user_agent?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface LocationInfo {
|
|
21
|
+
current_url: string;
|
|
22
|
+
pathname: string;
|
|
23
|
+
search: string;
|
|
24
|
+
hash: string;
|
|
25
|
+
title: string;
|
|
26
|
+
referrer: string;
|
|
27
|
+
referrer_domain: string;
|
|
28
|
+
initial_referrer: string;
|
|
29
|
+
initial_referrer_domain: string;
|
|
30
|
+
initial_host?: string;
|
|
31
|
+
utm_source?: string;
|
|
32
|
+
utm_medium?: string;
|
|
33
|
+
utm_campaign?: string;
|
|
34
|
+
utm_term?: string;
|
|
35
|
+
utm_content?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface AutomaticProperties extends DeviceInfo, LocationInfo {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get device information
|
|
41
|
+
*/
|
|
42
|
+
export declare function getDeviceInfo(): DeviceInfo;
|
|
43
|
+
/**
|
|
44
|
+
* Get location information
|
|
45
|
+
*/
|
|
46
|
+
export declare function getLocationInfo(): LocationInfo;
|
|
47
|
+
/**
|
|
48
|
+
* Get all automatic properties
|
|
49
|
+
*/
|
|
50
|
+
export declare function getAutomaticProperties(): AutomaticProperties;
|
|
51
|
+
/**
|
|
52
|
+
* Get initial properties that should be captured once per session
|
|
53
|
+
*/
|
|
54
|
+
export declare function getInitialProperties(): Record<string, any>;
|
|
55
|
+
/**
|
|
56
|
+
* Get current page properties (changes with navigation)
|
|
57
|
+
*/
|
|
58
|
+
export declare function getCurrentPageProperties(): Record<string, any>;
|
|
59
|
+
//# sourceMappingURL=property-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-detector.d.ts","sourceRoot":"","sources":["../../src/utils/property-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,UAAU;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU,EAAE,YAAY;CAAG;AA6KxE;;GAEG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAkC1C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAgC9C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,mBAAmB,CAK5D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAgB1D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAmB9D"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Property Manager for HumanBehavior SDK
|
|
3
|
+
* Handles automatic properties, session properties, and user properties
|
|
4
|
+
*/
|
|
5
|
+
export interface Properties {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export interface PropertyManagerConfig {
|
|
9
|
+
enableAutomaticProperties?: boolean;
|
|
10
|
+
enableSessionProperties?: boolean;
|
|
11
|
+
enableUserProperties?: boolean;
|
|
12
|
+
propertyDenylist?: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare class PropertyManager {
|
|
15
|
+
private config;
|
|
16
|
+
private automaticProperties;
|
|
17
|
+
private sessionProperties;
|
|
18
|
+
private userProperties;
|
|
19
|
+
private initialProperties;
|
|
20
|
+
private isInitialized;
|
|
21
|
+
constructor(config?: PropertyManagerConfig);
|
|
22
|
+
/**
|
|
23
|
+
* Initialize the property manager
|
|
24
|
+
*/
|
|
25
|
+
private initialize;
|
|
26
|
+
/**
|
|
27
|
+
* Get all properties for an event
|
|
28
|
+
*/
|
|
29
|
+
getEventProperties(eventProperties?: Properties): Properties;
|
|
30
|
+
/**
|
|
31
|
+
* Get automatic properties
|
|
32
|
+
*/
|
|
33
|
+
getAutomaticProperties(): Properties;
|
|
34
|
+
/**
|
|
35
|
+
* Get automatic properties with GeoIP data merged in
|
|
36
|
+
*/
|
|
37
|
+
getAutomaticPropertiesWithGeoIP(geoIPProperties?: Record<string, any>): Properties;
|
|
38
|
+
/**
|
|
39
|
+
* Set a session property
|
|
40
|
+
*/
|
|
41
|
+
setSessionProperty(key: string, value: any): void;
|
|
42
|
+
/**
|
|
43
|
+
* Set multiple session properties
|
|
44
|
+
*/
|
|
45
|
+
setSessionProperties(properties: Properties): void;
|
|
46
|
+
/**
|
|
47
|
+
* Get a session property
|
|
48
|
+
*/
|
|
49
|
+
getSessionProperty(key: string): any;
|
|
50
|
+
/**
|
|
51
|
+
* Remove a session property
|
|
52
|
+
*/
|
|
53
|
+
removeSessionProperty(key: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Set a user property
|
|
56
|
+
*/
|
|
57
|
+
setUserProperty(key: string, value: any): void;
|
|
58
|
+
/**
|
|
59
|
+
* Set multiple user properties
|
|
60
|
+
*/
|
|
61
|
+
setUserProperties(properties: Properties): void;
|
|
62
|
+
/**
|
|
63
|
+
* Get a user property
|
|
64
|
+
*/
|
|
65
|
+
getUserProperty(key: string): any;
|
|
66
|
+
/**
|
|
67
|
+
* Remove a user property
|
|
68
|
+
*/
|
|
69
|
+
removeUserProperty(key: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Set a property only if it hasn't been set before
|
|
72
|
+
*/
|
|
73
|
+
setOnce(key: string, value: any, scope?: 'session' | 'user'): void;
|
|
74
|
+
/**
|
|
75
|
+
* Clear all session properties
|
|
76
|
+
*/
|
|
77
|
+
clearSessionProperties(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Clear all user properties
|
|
80
|
+
*/
|
|
81
|
+
clearUserProperties(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Reset all properties
|
|
84
|
+
*/
|
|
85
|
+
reset(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Load session properties from sessionStorage
|
|
88
|
+
*/
|
|
89
|
+
private loadSessionProperties;
|
|
90
|
+
/**
|
|
91
|
+
* Save session properties to sessionStorage
|
|
92
|
+
*/
|
|
93
|
+
private saveSessionProperties;
|
|
94
|
+
/**
|
|
95
|
+
* Apply property denylist
|
|
96
|
+
*/
|
|
97
|
+
private applyDenylist;
|
|
98
|
+
/**
|
|
99
|
+
* Update automatic properties (call when page changes)
|
|
100
|
+
*/
|
|
101
|
+
updateAutomaticProperties(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Get all properties for debugging
|
|
104
|
+
*/
|
|
105
|
+
getAllProperties(): {
|
|
106
|
+
automatic: Properties;
|
|
107
|
+
session: Properties;
|
|
108
|
+
user: Properties;
|
|
109
|
+
initial: Properties;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=property-manager.d.ts.map
|