@sailfish-ai/recorder 1.0.0-beta-14 → 1.0.0-beta-2
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/recording.js +5 -33
- package/dist/sailfish-recorder.es.js +554 -54
- package/dist/sailfish-recorder.umd.js +554 -54
- package/dist/types/recording.d.ts +1 -1
- package/dist/websocket.js +1 -1
- package/package.json +1 -1
- package/README.md +0 -1
package/dist/recording.js
CHANGED
|
@@ -1,43 +1,15 @@
|
|
|
1
1
|
import { record } from "@sailfish-rrweb/record";
|
|
2
2
|
import { getRecordConsolePlugin, } from "@sailfish-rrweb/rrweb-plugin-console-record";
|
|
3
|
+
import { getRecordNetworkPlugin, } from "@sailfish-rrweb/rrweb-plugin-network-record";
|
|
3
4
|
import { cacheEvents, sendRecordingEvents } from "./eventCache";
|
|
4
5
|
import { initializeWebSocket } from "./websocket";
|
|
5
6
|
const MASK_CLASS = "sailfishSanitize";
|
|
6
7
|
const DEFAULT_DOMAINS_TO_IGNORE = [];
|
|
7
8
|
function maskInputFn(text, node) {
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
return "";
|
|
11
|
-
}
|
|
12
|
-
const patterns = {
|
|
13
|
-
creditCard: /\b(?:\d[ -]*?){13,16}\b/,
|
|
14
|
-
ssn: /\b\d{3}-\d{2}-\d{4}\b/,
|
|
15
|
-
};
|
|
16
|
-
const MASK_CLASS = "mask"; // Assume this is a known constant
|
|
17
|
-
// Check for data attributes indicating sensitive information
|
|
18
|
-
// Check if element or parents have MASK_CLASS in their className
|
|
19
|
-
if (node.closest(`.${MASK_CLASS}`)) {
|
|
20
|
-
// Mask the input and retain the length of the input
|
|
21
|
-
return "*".repeat(text.length);
|
|
22
|
-
}
|
|
23
|
-
else if (node.hasAttribute("data-cc") ||
|
|
24
|
-
(node.getAttribute("autocomplete")?.startsWith("cc-") ?? false) ||
|
|
25
|
-
patterns.creditCard.test(text)) {
|
|
26
|
-
// Mask all but the last 4 digits of a credit card number
|
|
27
|
-
return "**** **** **** " + text.slice(-4);
|
|
28
|
-
}
|
|
29
|
-
else if (node.hasAttribute("data-ssn") || patterns.ssn.test(text)) {
|
|
30
|
-
// Mask the first 5 digits of an SSN
|
|
31
|
-
return "***-**-" + text.slice(-4);
|
|
32
|
-
}
|
|
33
|
-
else if (node.hasAttribute("data-dob")) {
|
|
34
|
-
// Mask the day and month of a date of birth, revealing only the year
|
|
35
|
-
return "**/**/" + text.slice(-4);
|
|
36
|
-
}
|
|
37
|
-
// Default to returning the original text
|
|
38
|
-
return text;
|
|
9
|
+
// The maskInputFn logic here
|
|
10
|
+
return text; // Placeholder return
|
|
39
11
|
}
|
|
40
|
-
export async function initializeRecording(captureSettings, // TODO - Sibyl
|
|
12
|
+
export async function initializeRecording(captureSettings, // TODO - Sibyl launch - replace type
|
|
41
13
|
consoleRecordSettings, networkRecordSettings, backendApi, apiKey, sessionId) {
|
|
42
14
|
try {
|
|
43
15
|
record({
|
|
@@ -46,7 +18,7 @@ consoleRecordSettings, networkRecordSettings, backendApi, apiKey, sessionId) {
|
|
|
46
18
|
},
|
|
47
19
|
plugins: [
|
|
48
20
|
getRecordConsolePlugin(consoleRecordSettings),
|
|
49
|
-
|
|
21
|
+
getRecordNetworkPlugin(networkRecordSettings),
|
|
50
22
|
],
|
|
51
23
|
maskInputOptions: { text: true }, // Fix the incorrect property name
|
|
52
24
|
maskInputFn,
|