humanbehavior-js 0.4.22 → 0.4.24
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/dist/cjs/angular/index.cjs +276 -387
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +272 -383
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/install-wizard.cjs +5 -5
- package/dist/cjs/install-wizard.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +282 -393
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +272 -383
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +272 -383
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +272 -383
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/cjs/wizard/index.cjs +5 -5
- package/dist/cjs/wizard/index.cjs.map +1 -1
- package/dist/cli/ai-auto-install.js +5 -5
- package/dist/cli/ai-auto-install.js.map +1 -1
- package/dist/cli/auto-install.js +5 -5
- package/dist/cli/auto-install.js.map +1 -1
- package/dist/esm/angular/index.js +276 -387
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +272 -383
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install-wizard.js +5 -5
- package/dist/esm/install-wizard.js.map +1 -1
- package/dist/esm/react/index.js +282 -393
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +272 -383
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +272 -383
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +272 -383
- package/dist/esm/vue/index.js.map +1 -1
- package/dist/esm/wizard/index.js +5 -5
- package/dist/esm/wizard/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/types/angular/index.d.ts +39 -9
- package/dist/types/index.d.ts +74 -59
- package/dist/types/install-wizard.d.ts +1 -1
- package/dist/types/react/index.d.ts +40 -10
- package/dist/types/remix/index.d.ts +37 -7
- package/dist/types/svelte/index.d.ts +37 -7
- package/dist/types/wizard/index.d.ts +1 -1
- package/package.json +1 -1
- package/readme.md +59 -5
- package/src/angular/index.ts +4 -4
- package/src/react/index.tsx +10 -10
- package/src/redact.ts +205 -399
- package/src/tracker.ts +103 -19
- package/src/wizard/core/install-wizard.ts +5 -5
|
@@ -2,6 +2,12 @@ interface RedactionOptions {
|
|
|
2
2
|
redactedText?: string;
|
|
3
3
|
excludeSelectors?: string[];
|
|
4
4
|
userFields?: string[];
|
|
5
|
+
redactionStrategy?: {
|
|
6
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
7
|
+
unredactFields?: string[];
|
|
8
|
+
redactFields?: string[];
|
|
9
|
+
};
|
|
10
|
+
legacyRedactFields?: string[];
|
|
5
11
|
}
|
|
6
12
|
|
|
7
13
|
declare global {
|
|
@@ -46,6 +52,11 @@ declare class HumanBehaviorTracker {
|
|
|
46
52
|
ingestionUrl?: string;
|
|
47
53
|
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
48
54
|
redactFields?: string[];
|
|
55
|
+
redactionStrategy?: {
|
|
56
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
57
|
+
unredactFields?: string[];
|
|
58
|
+
redactFields?: string[];
|
|
59
|
+
};
|
|
49
60
|
enableAutomaticTracking?: boolean;
|
|
50
61
|
suppressConsoleErrors?: boolean;
|
|
51
62
|
recordCanvas?: boolean;
|
|
@@ -62,6 +73,12 @@ declare class HumanBehaviorTracker {
|
|
|
62
73
|
constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
|
|
63
74
|
enableAutomaticProperties?: boolean;
|
|
64
75
|
propertyDenylist?: string[];
|
|
76
|
+
redactionStrategy?: {
|
|
77
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
78
|
+
unredactFields?: string[];
|
|
79
|
+
redactFields?: string[];
|
|
80
|
+
};
|
|
81
|
+
redactFields?: string[];
|
|
65
82
|
});
|
|
66
83
|
private init;
|
|
67
84
|
private ensureInitialized;
|
|
@@ -163,20 +180,33 @@ declare class HumanBehaviorTracker {
|
|
|
163
180
|
*/
|
|
164
181
|
redact(options?: RedactionOptions): Promise<void>;
|
|
165
182
|
/**
|
|
166
|
-
* Set specific fields to be redacted
|
|
167
|
-
*
|
|
168
|
-
* @param fields Array of CSS selectors for fields to redact (e.g., ['input[type="password"]', '#email-field'])
|
|
183
|
+
* Set specific fields to be redacted (for visibility-first mode)
|
|
184
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
169
185
|
*/
|
|
170
186
|
setRedactedFields(fields: string[]): void;
|
|
187
|
+
/**
|
|
188
|
+
* Set specific fields to be unredacted (everything else stays redacted by rrweb)
|
|
189
|
+
* @param fields Array of CSS selectors for fields to unredact (e.g., ['#username', '#comment'])
|
|
190
|
+
*/
|
|
191
|
+
setUnredactedFields(fields: string[]): void;
|
|
171
192
|
private restartWithNewRedaction;
|
|
172
193
|
/**
|
|
173
|
-
* Check if
|
|
194
|
+
* Check if any fields are currently unredacted
|
|
195
|
+
*/
|
|
196
|
+
hasUnredactedFields(): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Get the currently unredacted fields
|
|
174
199
|
*/
|
|
175
|
-
|
|
200
|
+
getUnredactedFields(): string[];
|
|
176
201
|
/**
|
|
177
|
-
*
|
|
202
|
+
* Remove specific fields from unredaction (they become redacted again)
|
|
203
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
178
204
|
*/
|
|
179
|
-
|
|
205
|
+
redactFields(fields: string[]): void;
|
|
206
|
+
/**
|
|
207
|
+
* Clear all unredacted fields (everything becomes redacted again)
|
|
208
|
+
*/
|
|
209
|
+
clearUnredactedFields(): void;
|
|
180
210
|
/**
|
|
181
211
|
* Get the current session ID
|
|
182
212
|
*/
|
|
@@ -312,8 +342,8 @@ declare class HumanBehaviorService {
|
|
|
312
342
|
});
|
|
313
343
|
identifyUser(userProperties: Record<string, any>): Promise<string>;
|
|
314
344
|
getSessionId(): string;
|
|
315
|
-
|
|
316
|
-
|
|
345
|
+
setUnredactedFields(fields: string[]): void;
|
|
346
|
+
getUnredactedFields(): string[];
|
|
317
347
|
}
|
|
318
348
|
declare function initializeHumanBehavior(apiKey: string, options?: {
|
|
319
349
|
ingestionUrl?: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,95 +2,86 @@ interface RedactionOptions {
|
|
|
2
2
|
redactedText?: string;
|
|
3
3
|
excludeSelectors?: string[];
|
|
4
4
|
userFields?: string[];
|
|
5
|
+
redactionStrategy?: {
|
|
6
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
7
|
+
unredactFields?: string[];
|
|
8
|
+
redactFields?: string[];
|
|
9
|
+
};
|
|
10
|
+
legacyRedactFields?: string[];
|
|
5
11
|
}
|
|
6
12
|
declare class RedactionManager {
|
|
7
13
|
private redactedText;
|
|
8
|
-
private
|
|
14
|
+
private unredactedFields;
|
|
15
|
+
private redactedFields;
|
|
16
|
+
private redactionMode;
|
|
9
17
|
private excludeSelectors;
|
|
10
18
|
constructor(options?: RedactionOptions);
|
|
11
19
|
/**
|
|
12
|
-
* Set specific fields to be redacted
|
|
13
|
-
* These selectors are used to configure rrweb's built-in masking
|
|
20
|
+
* Set specific fields to be redacted (for visibility-first mode)
|
|
14
21
|
* @param fields Array of CSS selectors for fields to redact
|
|
15
22
|
*/
|
|
16
23
|
setFieldsToRedact(fields: string[]): void;
|
|
17
24
|
/**
|
|
18
|
-
*
|
|
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
|
|
25
|
+
* Set specific fields to be unredacted (everything else stays redacted by rrweb)
|
|
26
|
+
* @param fields Array of CSS selectors for fields to unredact
|
|
33
27
|
*/
|
|
34
|
-
|
|
28
|
+
setFieldsToUnredact(fields: string[]): void;
|
|
35
29
|
/**
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
private redactDOMEvent;
|
|
39
|
-
/**
|
|
40
|
-
* Check if a DOM change should be redacted based on its ID
|
|
30
|
+
* Remove specific fields from unredaction (they become redacted again)
|
|
31
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
41
32
|
*/
|
|
42
|
-
|
|
33
|
+
redactFields(fields: string[]): void;
|
|
43
34
|
/**
|
|
44
|
-
*
|
|
35
|
+
* Clear all unredacted fields (everything becomes redacted again)
|
|
45
36
|
*/
|
|
46
|
-
|
|
37
|
+
clearUnredactedFields(): void;
|
|
47
38
|
/**
|
|
48
|
-
*
|
|
39
|
+
* Check if any fields are currently unredacted
|
|
49
40
|
*/
|
|
50
|
-
|
|
41
|
+
hasUnredactedFields(): boolean;
|
|
51
42
|
/**
|
|
52
|
-
*
|
|
43
|
+
* Get the current redaction mode
|
|
53
44
|
*/
|
|
54
|
-
|
|
45
|
+
getRedactionMode(): 'privacy-first' | 'visibility-first';
|
|
55
46
|
/**
|
|
56
|
-
*
|
|
47
|
+
* Get the currently unredacted fields
|
|
57
48
|
*/
|
|
58
|
-
|
|
49
|
+
getUnredactedFields(): string[];
|
|
59
50
|
/**
|
|
60
|
-
*
|
|
51
|
+
* Get CSS selectors for rrweb masking configuration
|
|
52
|
+
* Returns null if no fields are unredacted (everything stays redacted)
|
|
61
53
|
*/
|
|
62
|
-
|
|
54
|
+
getMaskTextSelector(): string | null;
|
|
63
55
|
/**
|
|
64
|
-
*
|
|
56
|
+
* Apply redaction classes to DOM elements (for visibility-first mode)
|
|
57
|
+
* Adds 'rr-mask' class to elements that should be redacted
|
|
65
58
|
*/
|
|
66
|
-
|
|
59
|
+
applyRedactionClasses(): void;
|
|
67
60
|
/**
|
|
68
|
-
*
|
|
61
|
+
* Apply unredaction classes to DOM elements
|
|
62
|
+
* Removes 'rr-mask' class from elements that should be unredacted
|
|
69
63
|
*/
|
|
70
|
-
|
|
64
|
+
applyUnredactionClasses(): void;
|
|
71
65
|
/**
|
|
72
|
-
*
|
|
73
|
-
* Used to configure rrweb's maskTextSelector option
|
|
66
|
+
* Remove all unredaction classes from DOM elements
|
|
74
67
|
*/
|
|
75
|
-
|
|
68
|
+
removeUnredactionClasses(): void;
|
|
76
69
|
/**
|
|
77
|
-
* Check if
|
|
70
|
+
* Check if a selector represents a password field
|
|
78
71
|
*/
|
|
79
|
-
|
|
72
|
+
private isPasswordSelector;
|
|
80
73
|
/**
|
|
81
|
-
*
|
|
82
|
-
* Adds 'rr-mask' class to elements that should be redacted
|
|
83
|
-
* This enables rrweb's built-in masking functionality
|
|
74
|
+
* Get the original value of an element (for debugging)
|
|
84
75
|
*/
|
|
85
|
-
|
|
76
|
+
getOriginalValue(element: HTMLElement): string | undefined;
|
|
86
77
|
/**
|
|
87
|
-
*
|
|
78
|
+
* Check if an element is currently unredacted
|
|
88
79
|
*/
|
|
89
|
-
|
|
80
|
+
isElementUnredacted(element: HTMLElement): boolean;
|
|
90
81
|
/**
|
|
91
|
-
* Check if an element
|
|
82
|
+
* Check if an element should be unredacted
|
|
92
83
|
*/
|
|
93
|
-
|
|
84
|
+
shouldUnredactElement(element: HTMLElement): boolean;
|
|
94
85
|
}
|
|
95
86
|
declare const redactionManager: RedactionManager;
|
|
96
87
|
|
|
@@ -136,6 +127,11 @@ declare class HumanBehaviorTracker {
|
|
|
136
127
|
ingestionUrl?: string;
|
|
137
128
|
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
138
129
|
redactFields?: string[];
|
|
130
|
+
redactionStrategy?: {
|
|
131
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
132
|
+
unredactFields?: string[];
|
|
133
|
+
redactFields?: string[];
|
|
134
|
+
};
|
|
139
135
|
enableAutomaticTracking?: boolean;
|
|
140
136
|
suppressConsoleErrors?: boolean;
|
|
141
137
|
recordCanvas?: boolean;
|
|
@@ -152,6 +148,12 @@ declare class HumanBehaviorTracker {
|
|
|
152
148
|
constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
|
|
153
149
|
enableAutomaticProperties?: boolean;
|
|
154
150
|
propertyDenylist?: string[];
|
|
151
|
+
redactionStrategy?: {
|
|
152
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
153
|
+
unredactFields?: string[];
|
|
154
|
+
redactFields?: string[];
|
|
155
|
+
};
|
|
156
|
+
redactFields?: string[];
|
|
155
157
|
});
|
|
156
158
|
private init;
|
|
157
159
|
private ensureInitialized;
|
|
@@ -253,20 +255,33 @@ declare class HumanBehaviorTracker {
|
|
|
253
255
|
*/
|
|
254
256
|
redact(options?: RedactionOptions): Promise<void>;
|
|
255
257
|
/**
|
|
256
|
-
* Set specific fields to be redacted
|
|
257
|
-
*
|
|
258
|
-
* @param fields Array of CSS selectors for fields to redact (e.g., ['input[type="password"]', '#email-field'])
|
|
258
|
+
* Set specific fields to be redacted (for visibility-first mode)
|
|
259
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
259
260
|
*/
|
|
260
261
|
setRedactedFields(fields: string[]): void;
|
|
262
|
+
/**
|
|
263
|
+
* Set specific fields to be unredacted (everything else stays redacted by rrweb)
|
|
264
|
+
* @param fields Array of CSS selectors for fields to unredact (e.g., ['#username', '#comment'])
|
|
265
|
+
*/
|
|
266
|
+
setUnredactedFields(fields: string[]): void;
|
|
261
267
|
private restartWithNewRedaction;
|
|
262
268
|
/**
|
|
263
|
-
* Check if
|
|
269
|
+
* Check if any fields are currently unredacted
|
|
270
|
+
*/
|
|
271
|
+
hasUnredactedFields(): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Get the currently unredacted fields
|
|
274
|
+
*/
|
|
275
|
+
getUnredactedFields(): string[];
|
|
276
|
+
/**
|
|
277
|
+
* Remove specific fields from unredaction (they become redacted again)
|
|
278
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
264
279
|
*/
|
|
265
|
-
|
|
280
|
+
redactFields(fields: string[]): void;
|
|
266
281
|
/**
|
|
267
|
-
*
|
|
282
|
+
* Clear all unredacted fields (everything becomes redacted again)
|
|
268
283
|
*/
|
|
269
|
-
|
|
284
|
+
clearUnredactedFields(): void;
|
|
270
285
|
/**
|
|
271
286
|
* Get the current session ID
|
|
272
287
|
*/
|
|
@@ -4,6 +4,12 @@ interface RedactionOptions {
|
|
|
4
4
|
redactedText?: string;
|
|
5
5
|
excludeSelectors?: string[];
|
|
6
6
|
userFields?: string[];
|
|
7
|
+
redactionStrategy?: {
|
|
8
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
9
|
+
unredactFields?: string[];
|
|
10
|
+
redactFields?: string[];
|
|
11
|
+
};
|
|
12
|
+
legacyRedactFields?: string[];
|
|
7
13
|
}
|
|
8
14
|
|
|
9
15
|
declare global {
|
|
@@ -48,6 +54,11 @@ declare class HumanBehaviorTracker {
|
|
|
48
54
|
ingestionUrl?: string;
|
|
49
55
|
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
50
56
|
redactFields?: string[];
|
|
57
|
+
redactionStrategy?: {
|
|
58
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
59
|
+
unredactFields?: string[];
|
|
60
|
+
redactFields?: string[];
|
|
61
|
+
};
|
|
51
62
|
enableAutomaticTracking?: boolean;
|
|
52
63
|
suppressConsoleErrors?: boolean;
|
|
53
64
|
recordCanvas?: boolean;
|
|
@@ -64,6 +75,12 @@ declare class HumanBehaviorTracker {
|
|
|
64
75
|
constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
|
|
65
76
|
enableAutomaticProperties?: boolean;
|
|
66
77
|
propertyDenylist?: string[];
|
|
78
|
+
redactionStrategy?: {
|
|
79
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
80
|
+
unredactFields?: string[];
|
|
81
|
+
redactFields?: string[];
|
|
82
|
+
};
|
|
83
|
+
redactFields?: string[];
|
|
67
84
|
});
|
|
68
85
|
private init;
|
|
69
86
|
private ensureInitialized;
|
|
@@ -165,20 +182,33 @@ declare class HumanBehaviorTracker {
|
|
|
165
182
|
*/
|
|
166
183
|
redact(options?: RedactionOptions): Promise<void>;
|
|
167
184
|
/**
|
|
168
|
-
* Set specific fields to be redacted
|
|
169
|
-
*
|
|
170
|
-
* @param fields Array of CSS selectors for fields to redact (e.g., ['input[type="password"]', '#email-field'])
|
|
185
|
+
* Set specific fields to be redacted (for visibility-first mode)
|
|
186
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
171
187
|
*/
|
|
172
188
|
setRedactedFields(fields: string[]): void;
|
|
189
|
+
/**
|
|
190
|
+
* Set specific fields to be unredacted (everything else stays redacted by rrweb)
|
|
191
|
+
* @param fields Array of CSS selectors for fields to unredact (e.g., ['#username', '#comment'])
|
|
192
|
+
*/
|
|
193
|
+
setUnredactedFields(fields: string[]): void;
|
|
173
194
|
private restartWithNewRedaction;
|
|
174
195
|
/**
|
|
175
|
-
* Check if
|
|
196
|
+
* Check if any fields are currently unredacted
|
|
197
|
+
*/
|
|
198
|
+
hasUnredactedFields(): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Get the currently unredacted fields
|
|
201
|
+
*/
|
|
202
|
+
getUnredactedFields(): string[];
|
|
203
|
+
/**
|
|
204
|
+
* Remove specific fields from unredaction (they become redacted again)
|
|
205
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
176
206
|
*/
|
|
177
|
-
|
|
207
|
+
redactFields(fields: string[]): void;
|
|
178
208
|
/**
|
|
179
|
-
*
|
|
209
|
+
* Clear all unredacted fields (everything becomes redacted again)
|
|
180
210
|
*/
|
|
181
|
-
|
|
211
|
+
clearUnredactedFields(): void;
|
|
182
212
|
/**
|
|
183
213
|
* Get the current session ID
|
|
184
214
|
*/
|
|
@@ -295,9 +325,9 @@ interface HumanBehaviorProviderProps {
|
|
|
295
325
|
declare const HumanBehaviorProvider: ({ apiKey, client, children, options }: HumanBehaviorProviderProps) => React.JSX.Element;
|
|
296
326
|
declare const useHumanBehavior: () => HumanBehaviorTracker;
|
|
297
327
|
declare const useRedaction: () => {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
328
|
+
setUnredactedFields: (fields: string[]) => void;
|
|
329
|
+
hasUnredactedFields: () => boolean;
|
|
330
|
+
getUnredactedFields: () => string[];
|
|
301
331
|
};
|
|
302
332
|
declare const useUserTracking: () => {
|
|
303
333
|
identifyUser: ({ userProperties }: {
|
|
@@ -5,6 +5,12 @@ interface RedactionOptions {
|
|
|
5
5
|
redactedText?: string;
|
|
6
6
|
excludeSelectors?: string[];
|
|
7
7
|
userFields?: string[];
|
|
8
|
+
redactionStrategy?: {
|
|
9
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
10
|
+
unredactFields?: string[];
|
|
11
|
+
redactFields?: string[];
|
|
12
|
+
};
|
|
13
|
+
legacyRedactFields?: string[];
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
declare global {
|
|
@@ -49,6 +55,11 @@ declare class HumanBehaviorTracker {
|
|
|
49
55
|
ingestionUrl?: string;
|
|
50
56
|
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
51
57
|
redactFields?: string[];
|
|
58
|
+
redactionStrategy?: {
|
|
59
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
60
|
+
unredactFields?: string[];
|
|
61
|
+
redactFields?: string[];
|
|
62
|
+
};
|
|
52
63
|
enableAutomaticTracking?: boolean;
|
|
53
64
|
suppressConsoleErrors?: boolean;
|
|
54
65
|
recordCanvas?: boolean;
|
|
@@ -65,6 +76,12 @@ declare class HumanBehaviorTracker {
|
|
|
65
76
|
constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
|
|
66
77
|
enableAutomaticProperties?: boolean;
|
|
67
78
|
propertyDenylist?: string[];
|
|
79
|
+
redactionStrategy?: {
|
|
80
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
81
|
+
unredactFields?: string[];
|
|
82
|
+
redactFields?: string[];
|
|
83
|
+
};
|
|
84
|
+
redactFields?: string[];
|
|
68
85
|
});
|
|
69
86
|
private init;
|
|
70
87
|
private ensureInitialized;
|
|
@@ -166,20 +183,33 @@ declare class HumanBehaviorTracker {
|
|
|
166
183
|
*/
|
|
167
184
|
redact(options?: RedactionOptions): Promise<void>;
|
|
168
185
|
/**
|
|
169
|
-
* Set specific fields to be redacted
|
|
170
|
-
*
|
|
171
|
-
* @param fields Array of CSS selectors for fields to redact (e.g., ['input[type="password"]', '#email-field'])
|
|
186
|
+
* Set specific fields to be redacted (for visibility-first mode)
|
|
187
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
172
188
|
*/
|
|
173
189
|
setRedactedFields(fields: string[]): void;
|
|
190
|
+
/**
|
|
191
|
+
* Set specific fields to be unredacted (everything else stays redacted by rrweb)
|
|
192
|
+
* @param fields Array of CSS selectors for fields to unredact (e.g., ['#username', '#comment'])
|
|
193
|
+
*/
|
|
194
|
+
setUnredactedFields(fields: string[]): void;
|
|
174
195
|
private restartWithNewRedaction;
|
|
175
196
|
/**
|
|
176
|
-
* Check if
|
|
197
|
+
* Check if any fields are currently unredacted
|
|
198
|
+
*/
|
|
199
|
+
hasUnredactedFields(): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Get the currently unredacted fields
|
|
202
|
+
*/
|
|
203
|
+
getUnredactedFields(): string[];
|
|
204
|
+
/**
|
|
205
|
+
* Remove specific fields from unredaction (they become redacted again)
|
|
206
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
177
207
|
*/
|
|
178
|
-
|
|
208
|
+
redactFields(fields: string[]): void;
|
|
179
209
|
/**
|
|
180
|
-
*
|
|
210
|
+
* Clear all unredacted fields (everything becomes redacted again)
|
|
181
211
|
*/
|
|
182
|
-
|
|
212
|
+
clearUnredactedFields(): void;
|
|
183
213
|
/**
|
|
184
214
|
* Get the current session ID
|
|
185
215
|
*/
|
|
@@ -2,6 +2,12 @@ interface RedactionOptions {
|
|
|
2
2
|
redactedText?: string;
|
|
3
3
|
excludeSelectors?: string[];
|
|
4
4
|
userFields?: string[];
|
|
5
|
+
redactionStrategy?: {
|
|
6
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
7
|
+
unredactFields?: string[];
|
|
8
|
+
redactFields?: string[];
|
|
9
|
+
};
|
|
10
|
+
legacyRedactFields?: string[];
|
|
5
11
|
}
|
|
6
12
|
|
|
7
13
|
declare global {
|
|
@@ -46,6 +52,11 @@ declare class HumanBehaviorTracker {
|
|
|
46
52
|
ingestionUrl?: string;
|
|
47
53
|
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
48
54
|
redactFields?: string[];
|
|
55
|
+
redactionStrategy?: {
|
|
56
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
57
|
+
unredactFields?: string[];
|
|
58
|
+
redactFields?: string[];
|
|
59
|
+
};
|
|
49
60
|
enableAutomaticTracking?: boolean;
|
|
50
61
|
suppressConsoleErrors?: boolean;
|
|
51
62
|
recordCanvas?: boolean;
|
|
@@ -62,6 +73,12 @@ declare class HumanBehaviorTracker {
|
|
|
62
73
|
constructor(apiKey: string | undefined, ingestionUrl?: string, options?: {
|
|
63
74
|
enableAutomaticProperties?: boolean;
|
|
64
75
|
propertyDenylist?: string[];
|
|
76
|
+
redactionStrategy?: {
|
|
77
|
+
mode: 'privacy-first' | 'visibility-first';
|
|
78
|
+
unredactFields?: string[];
|
|
79
|
+
redactFields?: string[];
|
|
80
|
+
};
|
|
81
|
+
redactFields?: string[];
|
|
65
82
|
});
|
|
66
83
|
private init;
|
|
67
84
|
private ensureInitialized;
|
|
@@ -163,20 +180,33 @@ declare class HumanBehaviorTracker {
|
|
|
163
180
|
*/
|
|
164
181
|
redact(options?: RedactionOptions): Promise<void>;
|
|
165
182
|
/**
|
|
166
|
-
* Set specific fields to be redacted
|
|
167
|
-
*
|
|
168
|
-
* @param fields Array of CSS selectors for fields to redact (e.g., ['input[type="password"]', '#email-field'])
|
|
183
|
+
* Set specific fields to be redacted (for visibility-first mode)
|
|
184
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
169
185
|
*/
|
|
170
186
|
setRedactedFields(fields: string[]): void;
|
|
187
|
+
/**
|
|
188
|
+
* Set specific fields to be unredacted (everything else stays redacted by rrweb)
|
|
189
|
+
* @param fields Array of CSS selectors for fields to unredact (e.g., ['#username', '#comment'])
|
|
190
|
+
*/
|
|
191
|
+
setUnredactedFields(fields: string[]): void;
|
|
171
192
|
private restartWithNewRedaction;
|
|
172
193
|
/**
|
|
173
|
-
* Check if
|
|
194
|
+
* Check if any fields are currently unredacted
|
|
195
|
+
*/
|
|
196
|
+
hasUnredactedFields(): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Get the currently unredacted fields
|
|
199
|
+
*/
|
|
200
|
+
getUnredactedFields(): string[];
|
|
201
|
+
/**
|
|
202
|
+
* Remove specific fields from unredaction (they become redacted again)
|
|
203
|
+
* @param fields Array of CSS selectors for fields to redact
|
|
174
204
|
*/
|
|
175
|
-
|
|
205
|
+
redactFields(fields: string[]): void;
|
|
176
206
|
/**
|
|
177
|
-
*
|
|
207
|
+
* Clear all unredacted fields (everything becomes redacted again)
|
|
178
208
|
*/
|
|
179
|
-
|
|
209
|
+
clearUnredactedFields(): void;
|
|
180
210
|
/**
|
|
181
211
|
* Get the current session ID
|
|
182
212
|
*/
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -85,7 +85,11 @@ const tracker = HumanBehaviorTracker.init(apiKey, options);
|
|
|
85
85
|
**Options:**
|
|
86
86
|
- `ingestionUrl`: Custom ingestion server URL
|
|
87
87
|
- `logLevel`: 'none' | 'error' | 'warn' | 'info' | 'debug'
|
|
88
|
-
- `redactFields`: Array of CSS selectors to
|
|
88
|
+
- `redactFields`: Array of CSS selectors to unredact (DEPRECATED: Use redactionStrategy instead)
|
|
89
|
+
- `redactionStrategy`: Flexible redaction configuration
|
|
90
|
+
- `mode`: 'privacy-first' | 'visibility-first' (default: 'privacy-first')
|
|
91
|
+
- `unredactFields`: Array of CSS selectors to make visible (when mode: 'privacy-first')
|
|
92
|
+
- `redactFields`: Array of CSS selectors to hide (when mode: 'visibility-first')
|
|
89
93
|
- `suppressConsoleErrors`: Boolean to suppress common rrweb errors (default: true)
|
|
90
94
|
- `recordCanvas`: Boolean to enable canvas recording with PostHog-style protection (default: false)
|
|
91
95
|
|
|
@@ -117,14 +121,64 @@ await tracker.trackNavigationEvent('pushState', '/home', '/about');
|
|
|
117
121
|
|
|
118
122
|
### Data Redaction
|
|
119
123
|
|
|
124
|
+
The SDK supports flexible redaction strategies to protect sensitive data:
|
|
125
|
+
|
|
126
|
+
#### Privacy-First Mode (Default)
|
|
127
|
+
Everything is redacted by default. Specify fields to unredact:
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
// Privacy-first: everything redacted, unredact specific fields
|
|
131
|
+
const tracker = HumanBehaviorTracker.init('your-api-key', {
|
|
132
|
+
redactionStrategy: {
|
|
133
|
+
mode: 'privacy-first',
|
|
134
|
+
unredactFields: ['#username', '#comment', '.public-field']
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### Visibility-First Mode
|
|
140
|
+
Everything is visible by default. Specify fields to redact:
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
// Visibility-first: everything visible, redact specific fields
|
|
144
|
+
const tracker = HumanBehaviorTracker.init('your-api-key', {
|
|
145
|
+
redactionStrategy: {
|
|
146
|
+
mode: 'visibility-first',
|
|
147
|
+
redactFields: ['#password', '#credit-card', '.sensitive-data']
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Legacy Support
|
|
153
|
+
The old `redactFields` option still works (privacy-first mode):
|
|
154
|
+
|
|
120
155
|
```javascript
|
|
121
|
-
//
|
|
122
|
-
tracker.
|
|
156
|
+
// Legacy: same as privacy-first mode
|
|
157
|
+
const tracker = HumanBehaviorTracker.init('your-api-key', {
|
|
158
|
+
redactFields: ['#username', '#email'] // These fields will be unredacted
|
|
159
|
+
});
|
|
160
|
+
```
|
|
123
161
|
|
|
124
|
-
|
|
125
|
-
|
|
162
|
+
#### Dynamic Redaction
|
|
163
|
+
Change redaction settings at runtime:
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
// Privacy-first: add fields to unredact
|
|
167
|
+
tracker.setUnredactedFields(['#new-field', '.another-field']);
|
|
168
|
+
|
|
169
|
+
// Visibility-first: add fields to redact
|
|
170
|
+
tracker.setRedactedFields(['#sensitive-field', '.private-data']);
|
|
171
|
+
|
|
172
|
+
// Clear all settings
|
|
173
|
+
tracker.clearUnredactedFields(); // Privacy-first
|
|
174
|
+
tracker.clearRedactedFields(); // Visibility-first
|
|
126
175
|
```
|
|
127
176
|
|
|
177
|
+
#### Security Features
|
|
178
|
+
- **Password fields always protected** (cannot be unredacted in any mode)
|
|
179
|
+
- **CSS selector validation** (prevents invalid selectors)
|
|
180
|
+
- **Runtime safety checks** (handles DOM errors gracefully)
|
|
181
|
+
|
|
128
182
|
### Debugging
|
|
129
183
|
|
|
130
184
|
```javascript
|
package/src/angular/index.ts
CHANGED
|
@@ -58,12 +58,12 @@ export class HumanBehaviorService {
|
|
|
58
58
|
return this.tracker.getSessionId();
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
return this.tracker.
|
|
61
|
+
setUnredactedFields(fields: string[]) {
|
|
62
|
+
return this.tracker.setUnredactedFields(fields);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
return this.tracker.
|
|
65
|
+
getUnredactedFields() {
|
|
66
|
+
return this.tracker.getUnredactedFields();
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|