@sailfish-ai/recorder 1.7.9 → 1.7.12-alpha5
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/eventStore.js +42 -0
- package/dist/graphql.js +27 -0
- package/dist/index.js +367 -60
- package/dist/modal.js +628 -0
- package/dist/notifyEventStore.js +26 -0
- package/dist/recording.js +25 -18
- package/dist/sailfish-recorder.cjs.js +1 -1
- package/dist/sailfish-recorder.cjs.js.br +0 -0
- package/dist/sailfish-recorder.cjs.js.gz +0 -0
- package/dist/sailfish-recorder.es.js +1 -1
- package/dist/sailfish-recorder.es.js.br +0 -0
- package/dist/sailfish-recorder.es.js.gz +0 -0
- package/dist/sailfish-recorder.umd.js +1 -1
- package/dist/sailfish-recorder.umd.js.br +0 -0
- package/dist/sailfish-recorder.umd.js.gz +0 -0
- package/dist/types/eventStore.d.ts +10 -0
- package/dist/types/graphql.d.ts +2 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/modal.d.ts +7 -0
- package/dist/types/notifyEventStore.d.ts +7 -0
- package/dist/types/recording.d.ts +2 -2
- package/dist/types/types.d.ts +5 -0
- package/dist/types/utils.d.ts +6 -0
- package/dist/types/websocket.d.ts +2 -0
- package/dist/utils.js +41 -0
- package/dist/websocket.js +77 -13
- package/package.json +2 -1
- package/dist/eventCache.js +0 -43
- package/dist/types/eventCache.d.ts +0 -2
package/dist/recording.js
CHANGED
|
@@ -3,8 +3,7 @@ import { getRecordConsolePlugin, } from "@sailfish-rrweb/rrweb-plugin-console-re
|
|
|
3
3
|
// import { NetworkRecordOptions } from "@sailfish-rrweb/rrweb-plugin-network-record";
|
|
4
4
|
import { EventType } from "@sailfish-rrweb/types";
|
|
5
5
|
import { ZendeskAPI } from "react-zendesk";
|
|
6
|
-
import {
|
|
7
|
-
import { initializeWebSocket } from "./websocket";
|
|
6
|
+
import { initializeWebSocket, sendEvent } from "./websocket";
|
|
8
7
|
import { DomContentEventId, DomContentSource, Loading, Complete } from "./constants";
|
|
9
8
|
const MASK_CLASS = "sailfishSanitize";
|
|
10
9
|
const ZENDESK_ELEMENT_ID = "zendesk_chat";
|
|
@@ -40,13 +39,14 @@ export const getUrlAndStoredUuids = () => ({
|
|
|
40
39
|
prev_page_visit_uuid: sessionStorage.getItem("prevPageVisitUUID"),
|
|
41
40
|
href: location.origin + location.pathname,
|
|
42
41
|
});
|
|
43
|
-
export function initializeDomContentEvents() {
|
|
42
|
+
export function initializeDomContentEvents(sessionId) {
|
|
44
43
|
document.addEventListener("readystatechange", () => {
|
|
45
44
|
const timestamp = Date.now();
|
|
46
45
|
const newEvent = {
|
|
47
46
|
type: DomContentEventId,
|
|
48
47
|
data: { source: 0, info: "" },
|
|
49
48
|
timestamp,
|
|
49
|
+
sessionId,
|
|
50
50
|
...getUrlAndStoredUuids(),
|
|
51
51
|
};
|
|
52
52
|
switch (document.readyState) {
|
|
@@ -58,43 +58,51 @@ export function initializeDomContentEvents() {
|
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
if (newEvent.data.info)
|
|
61
|
-
|
|
61
|
+
sendEvent(newEvent);
|
|
62
62
|
});
|
|
63
63
|
document.addEventListener("DOMContentLoaded", () => {
|
|
64
|
-
|
|
64
|
+
sendEvent({
|
|
65
65
|
type: DomContentEventId,
|
|
66
66
|
data: { source: DomContentSource.contentLoaded },
|
|
67
67
|
timestamp: Date.now(),
|
|
68
|
+
sessionId,
|
|
68
69
|
...getUrlAndStoredUuids(),
|
|
69
70
|
});
|
|
70
71
|
});
|
|
71
72
|
window.addEventListener("beforeunload", () => {
|
|
72
|
-
|
|
73
|
+
sendEvent({
|
|
73
74
|
type: DomContentEventId,
|
|
74
75
|
data: { source: DomContentSource.beforeunload },
|
|
75
76
|
timestamp: Date.now(),
|
|
77
|
+
sessionId,
|
|
76
78
|
...getUrlAndStoredUuids(),
|
|
77
79
|
});
|
|
78
80
|
});
|
|
79
81
|
window.addEventListener("unload", () => {
|
|
80
|
-
|
|
82
|
+
sendEvent({
|
|
81
83
|
type: DomContentEventId,
|
|
82
84
|
data: { source: DomContentSource.unload },
|
|
83
85
|
timestamp: Date.now(),
|
|
86
|
+
sessionId,
|
|
84
87
|
...getUrlAndStoredUuids(),
|
|
85
88
|
});
|
|
86
89
|
});
|
|
87
90
|
}
|
|
88
|
-
export function initializeConsolePlugin(consoleRecordSettings) {
|
|
91
|
+
export function initializeConsolePlugin(consoleRecordSettings, sessionId) {
|
|
89
92
|
const { name, observer } = getRecordConsolePlugin(consoleRecordSettings);
|
|
90
|
-
observer((payload) =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
observer((payload) => {
|
|
94
|
+
const eventData = {
|
|
95
|
+
type: EventType.Plugin,
|
|
96
|
+
timestamp: Date.now(),
|
|
97
|
+
data: {
|
|
98
|
+
plugin: name,
|
|
99
|
+
payload,
|
|
100
|
+
},
|
|
101
|
+
sessionId: sessionId,
|
|
102
|
+
...getUrlAndStoredUuids(),
|
|
103
|
+
};
|
|
104
|
+
sendEvent(eventData);
|
|
105
|
+
}, window, consoleRecordSettings);
|
|
98
106
|
}
|
|
99
107
|
export async function initializeRecording(captureSettings, // TODO - Sibyl post-launch - replace type
|
|
100
108
|
// networkRecordSettings: NetworkRecordOptions,
|
|
@@ -106,7 +114,7 @@ backendApi, apiKey, sessionId) {
|
|
|
106
114
|
Object.assign(event, getUrlAndStoredUuids());
|
|
107
115
|
// Attach sessionId to each event
|
|
108
116
|
event.sessionId = sessionId;
|
|
109
|
-
|
|
117
|
+
sendEvent(event);
|
|
110
118
|
},
|
|
111
119
|
maskInputOptions: { text: true }, // Fix the incorrect property name
|
|
112
120
|
maskInputFn,
|
|
@@ -140,7 +148,6 @@ backendApi, apiKey, sessionId) {
|
|
|
140
148
|
ZendeskAPI("messenger:on", "open", handleWidgetOpen);
|
|
141
149
|
ZendeskAPI("messenger:on", "close", handleWidgetClose);
|
|
142
150
|
ZendeskAPI("messenger:on", "unreadMessages", handleUnreadMessages);
|
|
143
|
-
setInterval(() => sendRecordingEvents(webSocket), 10000);
|
|
144
151
|
}
|
|
145
152
|
catch (error) {
|
|
146
153
|
console.error("Error importing plugins!", error);
|