humanbehavior-js 0.2.2 → 0.2.3
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/index.js +14 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +14 -22
- package/dist/esm/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/types/index.d.ts +5 -6
- package/package.json +1 -1
- package/src/tracker.ts +15 -22
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/.tsbuildinfo +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/api.js +0 -312
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/api.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/index.js +0 -19
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/index.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/react/index.js +0 -222
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/react/index.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/redact.js +0 -416
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/redact.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/tracker.js +0 -950
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/tracker.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/utils/logger.js +0 -117
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/utils/logger.js.map +0 -1
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState, createContext, useContext, useCallback, useMemo, useRef } from "react";
|
|
4
|
-
import { HumanBehaviorTracker } from "..";
|
|
5
|
-
import { logError, logWarn, logDebug } from "../utils/logger";
|
|
6
|
-
// Check if we're in a browser environment
|
|
7
|
-
const isBrowser = () => typeof window !== 'undefined';
|
|
8
|
-
// Default context to prevent unnecessary re-renders
|
|
9
|
-
const defaultContext = {
|
|
10
|
-
humanBehavior: null,
|
|
11
|
-
queueEvent: (event) => {
|
|
12
|
-
// In server-side, just no-op
|
|
13
|
-
if (typeof window === 'undefined') {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
logWarn('HumanBehavior not initialized yet, event queued:', event);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const HumanBehaviorContext = createContext(null);
|
|
20
|
-
export const HumanBehaviorProvider = ({ apiKey, client, children, options }) => {
|
|
21
|
-
const [humanBehavior, setHumanBehavior] = useState(client || null);
|
|
22
|
-
const [eventQueue, setEventQueue] = useState([]);
|
|
23
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
24
|
-
const [isInitialized, setIsInitialized] = useState(false);
|
|
25
|
-
// Use refs to avoid dependency issues in useEffect
|
|
26
|
-
const apiKeyRef = useRef(apiKey);
|
|
27
|
-
const clientRef = useRef(client);
|
|
28
|
-
const eventQueueRef = useRef(eventQueue);
|
|
29
|
-
// Update refs when props change
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
apiKeyRef.current = apiKey;
|
|
32
|
-
clientRef.current = client;
|
|
33
|
-
}, [apiKey, client]);
|
|
34
|
-
// Update eventQueue ref when queue changes
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
eventQueueRef.current = eventQueue;
|
|
37
|
-
}, [eventQueue]);
|
|
38
|
-
// Memoized queueEvent function to prevent unnecessary re-renders
|
|
39
|
-
const queueEvent = useCallback((event) => {
|
|
40
|
-
setEventQueue(prev => [...prev, event]);
|
|
41
|
-
}, []);
|
|
42
|
-
// Handle mounting state
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
setIsMounted(true);
|
|
45
|
-
}, []);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
var _a;
|
|
48
|
-
// Only run in browser
|
|
49
|
-
if (!(isBrowser())) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// Skip if not mounted yet (handles Next.js hydration)
|
|
53
|
-
if (!isMounted) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
// If client is provided, use that
|
|
57
|
-
if (clientRef.current) {
|
|
58
|
-
setHumanBehavior(clientRef.current);
|
|
59
|
-
setIsInitialized(true);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
// If no client is provided, apiKey is required
|
|
63
|
-
if (!apiKeyRef.current || apiKeyRef.current.trim() === '') {
|
|
64
|
-
logError("An apiKey is required when no client is provided");
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (humanBehavior !== null) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
// Create new tracker instance with the validated apiKey
|
|
71
|
-
const tracker = new HumanBehaviorTracker(apiKeyRef.current.trim(), 'https://ingest.humanbehavior.co');
|
|
72
|
-
setHumanBehavior(tracker);
|
|
73
|
-
// Wait for initialization to complete
|
|
74
|
-
(_a = tracker.initializationPromise) === null || _a === void 0 ? void 0 : _a.then(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
yield tracker.start();
|
|
76
|
-
setIsInitialized(true);
|
|
77
|
-
// Process any queued events
|
|
78
|
-
const currentQueue = eventQueueRef.current;
|
|
79
|
-
if (currentQueue.length > 0) {
|
|
80
|
-
for (const event of currentQueue) {
|
|
81
|
-
if (event.type === 'identify') {
|
|
82
|
-
logDebug('Processing queued identify event', event.userProperties);
|
|
83
|
-
try {
|
|
84
|
-
yield tracker.addUserInfo(event.userProperties);
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
logError('Failed to process queued user info:', error);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
tracker.addEvent(event);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
setEventQueue([]); // Clear the queue
|
|
95
|
-
}
|
|
96
|
-
})).catch(error => {
|
|
97
|
-
logError('Failed to initialize HumanBehaviorTracker:', error);
|
|
98
|
-
});
|
|
99
|
-
}, [isMounted, humanBehavior]); // Removed apiKey, client, eventQueue from dependencies
|
|
100
|
-
// Memoized context value to prevent unnecessary re-renders
|
|
101
|
-
const contextValue = useMemo(() => {
|
|
102
|
-
if (!isMounted) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
if (!isInitialized) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
return humanBehavior;
|
|
109
|
-
}, [isMounted, isInitialized, humanBehavior]);
|
|
110
|
-
// If not in browser, render children without context
|
|
111
|
-
if (!(isBrowser())) {
|
|
112
|
-
return _jsx(_Fragment, { children: children });
|
|
113
|
-
}
|
|
114
|
-
return (_jsxs(HumanBehaviorContext.Provider, { value: contextValue, children: [_jsx(HumanBehaviorPageView, {}), children] }));
|
|
115
|
-
};
|
|
116
|
-
// No-op implementation for server-side
|
|
117
|
-
const serverSideImplementation = {
|
|
118
|
-
addEvent: () => { },
|
|
119
|
-
addUserInfo: () => __awaiter(void 0, void 0, void 0, function* () { }),
|
|
120
|
-
start: () => { },
|
|
121
|
-
stop: () => { },
|
|
122
|
-
viewLogs: () => { },
|
|
123
|
-
};
|
|
124
|
-
// Memoized queuing implementation for initialization period
|
|
125
|
-
const createQueuingImplementation = (queueEvent) => ({
|
|
126
|
-
addEvent: (event) => {
|
|
127
|
-
queueEvent(event);
|
|
128
|
-
},
|
|
129
|
-
addUserInfo: (userProperties) => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
-
queueEvent({
|
|
131
|
-
type: 'identify',
|
|
132
|
-
userProperties,
|
|
133
|
-
});
|
|
134
|
-
}),
|
|
135
|
-
start: () => {
|
|
136
|
-
// Start will be called automatically when initialized
|
|
137
|
-
},
|
|
138
|
-
stop: () => {
|
|
139
|
-
// Stop is a no-op when not initialized
|
|
140
|
-
},
|
|
141
|
-
viewLogs: () => {
|
|
142
|
-
logWarn('Logs are not available until HumanBehaviorTracker is initialized');
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
export const useHumanBehavior = () => {
|
|
146
|
-
const tracker = useContext(HumanBehaviorContext);
|
|
147
|
-
if (!tracker) {
|
|
148
|
-
throw new Error('useHumanBehavior must be used within a HumanBehaviorProvider');
|
|
149
|
-
}
|
|
150
|
-
return tracker;
|
|
151
|
-
};
|
|
152
|
-
// Custom hook for managing redaction fields dynamically
|
|
153
|
-
export const useRedaction = () => {
|
|
154
|
-
const tracker = useHumanBehavior();
|
|
155
|
-
const setRedactedFields = useCallback((fields) => {
|
|
156
|
-
tracker.setRedactedFields(fields);
|
|
157
|
-
}, [tracker]);
|
|
158
|
-
const isRedactionActive = useCallback(() => {
|
|
159
|
-
return tracker.isRedactionActive();
|
|
160
|
-
}, [tracker]);
|
|
161
|
-
const getRedactedFields = useCallback(() => {
|
|
162
|
-
return tracker.getRedactedFields();
|
|
163
|
-
}, [tracker]);
|
|
164
|
-
return {
|
|
165
|
-
setRedactedFields,
|
|
166
|
-
isRedactionActive,
|
|
167
|
-
getRedactedFields
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
// Custom hook for managing user info
|
|
171
|
-
export const useUserTracking = () => {
|
|
172
|
-
const tracker = useHumanBehavior();
|
|
173
|
-
const addUserInfo = useCallback((userId, userProperties) => __awaiter(void 0, void 0, void 0, function* () {
|
|
174
|
-
try {
|
|
175
|
-
yield tracker.addUserInfo({ userId, userProperties });
|
|
176
|
-
return { success: true };
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
logError('Failed to add user info:', error);
|
|
180
|
-
return { success: false, error };
|
|
181
|
-
}
|
|
182
|
-
}), [tracker]);
|
|
183
|
-
return {
|
|
184
|
-
addUserInfo
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
// Automatic page tracking component (similar to PostHog's PostHogPageView)
|
|
188
|
-
function HumanBehaviorPageView() {
|
|
189
|
-
const tracker = useContext(HumanBehaviorContext);
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
if (tracker && typeof window !== 'undefined') {
|
|
192
|
-
// Track initial page load
|
|
193
|
-
tracker.trackPageView();
|
|
194
|
-
// Listen for route changes (for SPAs)
|
|
195
|
-
const handleRouteChange = () => {
|
|
196
|
-
tracker.trackPageView();
|
|
197
|
-
};
|
|
198
|
-
// Listen for popstate (back/forward navigation)
|
|
199
|
-
window.addEventListener('popstate', handleRouteChange);
|
|
200
|
-
// Listen for pushstate/replacestate (programmatic navigation)
|
|
201
|
-
const originalPushState = history.pushState;
|
|
202
|
-
const originalReplaceState = history.replaceState;
|
|
203
|
-
history.pushState = function (...args) {
|
|
204
|
-
originalPushState.apply(this, args);
|
|
205
|
-
handleRouteChange();
|
|
206
|
-
};
|
|
207
|
-
history.replaceState = function (...args) {
|
|
208
|
-
originalReplaceState.apply(this, args);
|
|
209
|
-
handleRouteChange();
|
|
210
|
-
};
|
|
211
|
-
return () => {
|
|
212
|
-
window.removeEventListener('popstate', handleRouteChange);
|
|
213
|
-
history.pushState = originalPushState;
|
|
214
|
-
history.replaceState = originalReplaceState;
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
}, [tracker]);
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
// Export the tracker class for direct use
|
|
221
|
-
export { HumanBehaviorTracker };
|
|
222
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/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,iBAAiB,EAAE,CAAC;YACtB,CAAC,CAAC;YAEF,OAAO,GAAG,EAAE;gBACV,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;gBAC1D,OAAO,CAAC,SAAS,GAAG,iBAAiB,CAAC;gBACtC,OAAO,CAAC,YAAY,GAAG,oBAAoB,CAAC;YAC9C,CAAC,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,IAAI,CAAC;AACd,CAAC;AAED,0CAA0C;AAC1C,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/redact.js
DELETED
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
// Redaction functionality for sensitive input fields
|
|
2
|
-
// This module provides methods to redact sensitive input fields in event recordings
|
|
3
|
-
import { logDebug, logWarn } from './utils/logger';
|
|
4
|
-
// Check if we're in a browser environment
|
|
5
|
-
const isBrowser = typeof window !== 'undefined';
|
|
6
|
-
export class RedactionManager {
|
|
7
|
-
constructor(options) {
|
|
8
|
-
this.redactedText = '[REDACTED]';
|
|
9
|
-
this.userSelectedFields = new Set(); // User-selected fields to redact
|
|
10
|
-
this.excludeSelectors = [
|
|
11
|
-
'[data-no-redact="true"]',
|
|
12
|
-
'.human-behavior-no-redact'
|
|
13
|
-
];
|
|
14
|
-
if (options === null || options === void 0 ? void 0 : options.redactedText) {
|
|
15
|
-
this.redactedText = options.redactedText;
|
|
16
|
-
}
|
|
17
|
-
if (options === null || options === void 0 ? void 0 : options.excludeSelectors) {
|
|
18
|
-
this.excludeSelectors = [...this.excludeSelectors, ...options.excludeSelectors];
|
|
19
|
-
}
|
|
20
|
-
if (options === null || options === void 0 ? void 0 : options.userFields) {
|
|
21
|
-
this.setFieldsToRedact(options.userFields);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Set specific fields to be redacted
|
|
26
|
-
* @param fields Array of CSS selectors for fields to redact
|
|
27
|
-
*/
|
|
28
|
-
setFieldsToRedact(fields) {
|
|
29
|
-
this.userSelectedFields.clear();
|
|
30
|
-
fields.forEach(field => this.userSelectedFields.add(field));
|
|
31
|
-
if (fields.length > 0) {
|
|
32
|
-
logDebug(`Redaction: Active for ${fields.length} field(s):`, fields);
|
|
33
|
-
// Debug: Check if elements exist
|
|
34
|
-
fields.forEach(selector => {
|
|
35
|
-
const elements = document.querySelectorAll(selector);
|
|
36
|
-
logDebug(`Redaction: Found ${elements.length} element(s) for selector '${selector}'`);
|
|
37
|
-
elements.forEach((el, index) => {
|
|
38
|
-
logDebug(`Redaction: Element ${index} for '${selector}':`, el);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
logDebug('Redaction: Disabled - no fields selected');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Check if redaction is currently active (has fields selected)
|
|
48
|
-
*/
|
|
49
|
-
isActive() {
|
|
50
|
-
return this.userSelectedFields.size > 0;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get the currently selected fields for redaction
|
|
54
|
-
*/
|
|
55
|
-
getSelectedFields() {
|
|
56
|
-
return Array.from(this.userSelectedFields);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Process an event and redact sensitive data if needed
|
|
60
|
-
*/
|
|
61
|
-
processEvent(event) {
|
|
62
|
-
// Only process if we have fields selected for redaction
|
|
63
|
-
if (this.userSelectedFields.size === 0) {
|
|
64
|
-
return event;
|
|
65
|
-
}
|
|
66
|
-
// Clone the event to avoid modifying the original
|
|
67
|
-
const processedEvent = JSON.parse(JSON.stringify(event));
|
|
68
|
-
// Handle different event types
|
|
69
|
-
if (processedEvent.type === 3) { // IncrementalSnapshot
|
|
70
|
-
if (processedEvent.data.source === 5) { // Input event
|
|
71
|
-
const shouldRedact = this.isFieldSelected(processedEvent.data);
|
|
72
|
-
if (shouldRedact) {
|
|
73
|
-
logDebug('Redaction: Processing input event for redaction');
|
|
74
|
-
this.redactInputEvent(processedEvent.data);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// Also check for other sources that might contain text changes
|
|
78
|
-
else if (processedEvent.data.source === 0) { // DOM mutations
|
|
79
|
-
this.redactDOMEvent(processedEvent.data);
|
|
80
|
-
}
|
|
81
|
-
// Handle other sources that might contain text
|
|
82
|
-
else if (processedEvent.data.source === 2) { // Mouse/Touch interaction
|
|
83
|
-
this.redactMouseEvent(processedEvent.data);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (processedEvent.type === 2) { // FullSnapshot
|
|
87
|
-
this.redactFullSnapshot(processedEvent.data);
|
|
88
|
-
}
|
|
89
|
-
return processedEvent;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Redact sensitive data in input events
|
|
93
|
-
*/
|
|
94
|
-
redactInputEvent(inputData) {
|
|
95
|
-
// Check if this input event is from a field we want to redact
|
|
96
|
-
if (!this.isFieldSelected(inputData)) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
logDebug('Redaction: Redacting input event with text:', inputData.text);
|
|
100
|
-
// Redact all text-related properties that could contain input data
|
|
101
|
-
const textProperties = ['text', 'value', 'content', 'data', 'input', 'textContent'];
|
|
102
|
-
textProperties.forEach(prop => {
|
|
103
|
-
if (inputData[prop] !== undefined && typeof inputData[prop] === 'string') {
|
|
104
|
-
inputData[prop] = this.redactedText;
|
|
105
|
-
logDebug(`Redaction: Redacted property '${prop}'`);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
// Also check for any other string properties that might contain input data
|
|
109
|
-
Object.keys(inputData).forEach(key => {
|
|
110
|
-
if (typeof inputData[key] === 'string' && inputData[key].length > 0) {
|
|
111
|
-
inputData[key] = this.redactedText;
|
|
112
|
-
logDebug(`Redaction: Redacted additional property '${key}'`);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
// Handle nested objects that might contain text data
|
|
116
|
-
if (inputData.attributes && typeof inputData.attributes === 'object') {
|
|
117
|
-
if (inputData.attributes.value && typeof inputData.attributes.value === 'string') {
|
|
118
|
-
inputData.attributes.value = this.redactedText;
|
|
119
|
-
logDebug('Redaction: Redacted nested value attribute');
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
logDebug('Redaction: Input event redaction complete');
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Redact sensitive data in DOM mutation events
|
|
126
|
-
*/
|
|
127
|
-
redactDOMEvent(domData) {
|
|
128
|
-
// Check for text changes in DOM mutations
|
|
129
|
-
if (domData.texts && Array.isArray(domData.texts)) {
|
|
130
|
-
domData.texts.forEach((textChange) => {
|
|
131
|
-
if (textChange.text && typeof textChange.text === 'string' &&
|
|
132
|
-
this.shouldRedactDOMChange(textChange)) {
|
|
133
|
-
textChange.text = this.redactedText;
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
// Also check for attribute changes that might contain input data
|
|
138
|
-
if (domData.attributes && Array.isArray(domData.attributes)) {
|
|
139
|
-
domData.attributes.forEach((attrChange) => {
|
|
140
|
-
if (attrChange.attributes && attrChange.attributes.value &&
|
|
141
|
-
typeof attrChange.attributes.value === 'string' &&
|
|
142
|
-
this.shouldRedactDOMChange(attrChange)) {
|
|
143
|
-
attrChange.attributes.value = this.redactedText;
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
// Check for any other properties that might contain text data
|
|
148
|
-
if (domData.adds && Array.isArray(domData.adds)) {
|
|
149
|
-
domData.adds.forEach((add) => {
|
|
150
|
-
if (add.node && add.node.textContent && typeof add.node.textContent === 'string' &&
|
|
151
|
-
this.shouldRedactDOMChange(add)) {
|
|
152
|
-
add.node.textContent = this.redactedText;
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Check if a DOM change should be redacted based on its ID
|
|
159
|
-
*/
|
|
160
|
-
shouldRedactDOMChange(changeData) {
|
|
161
|
-
if (!isBrowser)
|
|
162
|
-
return false;
|
|
163
|
-
try {
|
|
164
|
-
// Check if this change has an ID that we can use to find the element
|
|
165
|
-
const elementId = changeData.id;
|
|
166
|
-
if (elementId !== undefined) {
|
|
167
|
-
// Try to find the element by data-rrweb-id attribute
|
|
168
|
-
let element = document.querySelector(`[data-rrweb-id="${elementId}"]`);
|
|
169
|
-
if (element) {
|
|
170
|
-
return this.shouldRedactElement(element);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
// Also check for nodeId which is another way rrweb identifies elements
|
|
174
|
-
const nodeId = changeData.nodeId;
|
|
175
|
-
if (nodeId !== undefined) {
|
|
176
|
-
const element = document.querySelector(`[data-rrweb-id="${nodeId}"]`);
|
|
177
|
-
if (element) {
|
|
178
|
-
return this.shouldRedactElement(element);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
catch (e) {
|
|
184
|
-
logWarn('Error checking if DOM change should be redacted:', e);
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Redact sensitive data in mouse/touch interaction events
|
|
190
|
-
*/
|
|
191
|
-
redactMouseEvent(mouseData) {
|
|
192
|
-
// Mouse events typically don't contain text data, but check for any text properties
|
|
193
|
-
if (mouseData.text && typeof mouseData.text === 'string' &&
|
|
194
|
-
this.isFieldSelected(mouseData)) {
|
|
195
|
-
mouseData.text = this.redactedText;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Redact sensitive data in full snapshot events
|
|
200
|
-
*/
|
|
201
|
-
redactFullSnapshot(snapshotData) {
|
|
202
|
-
if (snapshotData.node && snapshotData.node.type === 2) { // Element node
|
|
203
|
-
this.redactNode(snapshotData.node);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Recursively redact sensitive data in DOM nodes
|
|
208
|
-
*/
|
|
209
|
-
redactNode(node) {
|
|
210
|
-
if (!node)
|
|
211
|
-
return;
|
|
212
|
-
// Check if this node should be redacted
|
|
213
|
-
if (node.type === 2 && node.tagName &&
|
|
214
|
-
(node.tagName.toLowerCase() === 'input' || node.tagName.toLowerCase() === 'textarea')) {
|
|
215
|
-
// Check if this input/textarea should be redacted
|
|
216
|
-
if (this.shouldRedactNode(node)) {
|
|
217
|
-
// Redact value attribute
|
|
218
|
-
if (node.attributes && node.attributes.value) {
|
|
219
|
-
node.attributes.value = this.redactedText;
|
|
220
|
-
}
|
|
221
|
-
// Redact text content
|
|
222
|
-
if (node.textContent) {
|
|
223
|
-
node.textContent = this.redactedText;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
// Recursively process child nodes
|
|
228
|
-
if (node.childNodes && Array.isArray(node.childNodes)) {
|
|
229
|
-
node.childNodes.forEach((childNode) => {
|
|
230
|
-
this.redactNode(childNode);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Check if a node should be redacted based on its attributes
|
|
236
|
-
*/
|
|
237
|
-
shouldRedactNode(node) {
|
|
238
|
-
if (!node.attributes)
|
|
239
|
-
return false;
|
|
240
|
-
// Check if any of our selectors would match this node
|
|
241
|
-
for (const selector of this.userSelectedFields) {
|
|
242
|
-
if (this.selectorMatchesNode(selector, node)) {
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Check if a CSS selector would match a node based on its attributes
|
|
250
|
-
*/
|
|
251
|
-
selectorMatchesNode(selector, node) {
|
|
252
|
-
if (!node.attributes)
|
|
253
|
-
return false;
|
|
254
|
-
// Create a temporary element to test the selector
|
|
255
|
-
try {
|
|
256
|
-
const tempElement = document.createElement(node.tagName || 'div');
|
|
257
|
-
// Copy attributes from the node to the temp element
|
|
258
|
-
if (node.attributes) {
|
|
259
|
-
Object.keys(node.attributes).forEach(key => {
|
|
260
|
-
tempElement.setAttribute(key, node.attributes[key]);
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
// Test if the selector matches this element
|
|
264
|
-
return tempElement.matches(selector);
|
|
265
|
-
}
|
|
266
|
-
catch (e) {
|
|
267
|
-
// If matches() is not supported or fails, fall back to basic attribute checking
|
|
268
|
-
return this.basicSelectorMatch(selector, node);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Basic selector matching for environments where matches() is not available
|
|
273
|
-
*/
|
|
274
|
-
basicSelectorMatch(selector, node) {
|
|
275
|
-
if (!node.attributes)
|
|
276
|
-
return false;
|
|
277
|
-
// Handle simple selectors like 'input[type="password"]'
|
|
278
|
-
if (selector.includes('input[type=')) {
|
|
279
|
-
const typeMatch = selector.match(/input\[type="([^"]+)"\]/);
|
|
280
|
-
if (typeMatch && node.tagName === 'input' && node.attributes.type === typeMatch[1]) {
|
|
281
|
-
return true;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
// Handle ID selectors like '#email'
|
|
285
|
-
if (selector.startsWith('#')) {
|
|
286
|
-
const id = selector.substring(1);
|
|
287
|
-
return node.attributes.id === id;
|
|
288
|
-
}
|
|
289
|
-
// Handle class selectors like '.sensitive-field'
|
|
290
|
-
if (selector.startsWith('.')) {
|
|
291
|
-
const className = selector.substring(1);
|
|
292
|
-
return node.attributes.class && node.attributes.class.includes(className);
|
|
293
|
-
}
|
|
294
|
-
// Handle tag selectors like 'input'
|
|
295
|
-
if (!selector.includes('[') && !selector.includes('.')) {
|
|
296
|
-
return node.tagName && node.tagName.toLowerCase() === selector.toLowerCase();
|
|
297
|
-
}
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Check if an event is from a field that should be redacted
|
|
302
|
-
*/
|
|
303
|
-
isFieldSelected(eventData) {
|
|
304
|
-
if (!isBrowser)
|
|
305
|
-
return false;
|
|
306
|
-
try {
|
|
307
|
-
// For input events (source 5), we need to determine if this is a sensitive field
|
|
308
|
-
if (eventData.source === 5) { // Input event
|
|
309
|
-
const elementId = eventData.id;
|
|
310
|
-
if (elementId !== undefined) {
|
|
311
|
-
// Try to find the element by data-rrweb-id attribute
|
|
312
|
-
let element = document.querySelector(`[data-rrweb-id="${elementId}"]`);
|
|
313
|
-
if (element) {
|
|
314
|
-
return this.shouldRedactElement(element);
|
|
315
|
-
}
|
|
316
|
-
// Fallback: Try to find by nodeId if available
|
|
317
|
-
if (eventData.nodeId !== undefined) {
|
|
318
|
-
element = document.querySelector(`[data-rrweb-id="${eventData.nodeId}"]`);
|
|
319
|
-
if (element) {
|
|
320
|
-
return this.shouldRedactElement(element);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
// More aggressive approach: Check all elements that match our selectors
|
|
324
|
-
// and see if any of them are currently focused or have the same ID
|
|
325
|
-
for (const selector of this.userSelectedFields) {
|
|
326
|
-
const matchingElements = document.querySelectorAll(selector);
|
|
327
|
-
if (matchingElements.length > 0) {
|
|
328
|
-
// Check if any of these elements are currently focused
|
|
329
|
-
for (const el of matchingElements) {
|
|
330
|
-
if (el === document.activeElement) {
|
|
331
|
-
logDebug('Redaction: Found focused element matching selector:', selector);
|
|
332
|
-
return true;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
// If we still can't find it, try a more direct approach
|
|
338
|
-
// Look for any input element that might be the active one
|
|
339
|
-
const activeElement = document.activeElement;
|
|
340
|
-
if (activeElement && this.shouldRedactElement(activeElement)) {
|
|
341
|
-
logDebug('Redaction: Active element should be redacted');
|
|
342
|
-
return true;
|
|
343
|
-
}
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
// For other event types, try to find the element
|
|
348
|
-
const elementId = eventData.id;
|
|
349
|
-
if (elementId !== undefined) {
|
|
350
|
-
// First try to find by data-rrweb-id attribute
|
|
351
|
-
let element = document.querySelector(`[data-rrweb-id="${elementId}"]`);
|
|
352
|
-
if (element) {
|
|
353
|
-
return this.shouldRedactElement(element);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
// Also check for nodeId which is another way rrweb identifies elements
|
|
357
|
-
const nodeId = eventData.nodeId;
|
|
358
|
-
if (nodeId !== undefined) {
|
|
359
|
-
const element = document.querySelector(`[data-rrweb-id="${nodeId}"]`);
|
|
360
|
-
if (element) {
|
|
361
|
-
return this.shouldRedactElement(element);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
// For DOM mutations, check if the target element should be redacted
|
|
365
|
-
if (eventData.target && eventData.target.id) {
|
|
366
|
-
const element = document.querySelector(`[data-rrweb-id="${eventData.target.id}"]`);
|
|
367
|
-
if (element) {
|
|
368
|
-
return this.shouldRedactElement(element);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return false;
|
|
372
|
-
}
|
|
373
|
-
catch (e) {
|
|
374
|
-
logWarn('Error checking if field should be redacted:', e);
|
|
375
|
-
return false;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Check if an element should be redacted based on user-selected fields
|
|
380
|
-
*/
|
|
381
|
-
shouldRedactElement(element) {
|
|
382
|
-
// Check if element is excluded from redaction
|
|
383
|
-
for (const excludeSelector of this.excludeSelectors) {
|
|
384
|
-
if (element.matches(excludeSelector) || element.closest(excludeSelector)) {
|
|
385
|
-
return false;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
// Check if element matches any of the user-selected fields
|
|
389
|
-
for (const selector of this.userSelectedFields) {
|
|
390
|
-
if (element.matches(selector)) {
|
|
391
|
-
return true;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Get the original value of a redacted element (for debugging)
|
|
398
|
-
*/
|
|
399
|
-
getOriginalValue(element) {
|
|
400
|
-
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
|
|
401
|
-
return element.value;
|
|
402
|
-
}
|
|
403
|
-
return undefined;
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Check if an element is currently being redacted
|
|
407
|
-
*/
|
|
408
|
-
isElementRedacted(element) {
|
|
409
|
-
return this.shouldRedactElement(element);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
// Export a default instance
|
|
413
|
-
export const redactionManager = new RedactionManager();
|
|
414
|
-
// Export the class for custom instances
|
|
415
|
-
export default RedactionManager;
|
|
416
|
-
//# sourceMappingURL=redact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,oFAAoF;AAEpF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEnD,0CAA0C;AAC1C,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AAQhD,MAAM,OAAO,gBAAgB;IAQzB,YAAY,OAA0B;QAP9B,iBAAY,GAAW,YAAY,CAAC;QACpC,uBAAkB,GAAgB,IAAI,GAAG,EAAE,CAAC,CAAC,iCAAiC;QAC9E,qBAAgB,GAAa;YACjC,yBAAyB;YACzB,2BAA2B;SAC9B,CAAC;QAGE,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,EAAE,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QAC7C,CAAC;QACD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,EAAE,CAAC;YAC5B,IAAI,CAAC,gBAAgB,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAAE,GAAG,OAAO,CAAC,gBAAg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