@sailfish-ai/recorder 1.7.27 → 1.7.33
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/{modal.js → inAppReportIssueModal.js} +62 -18
- package/dist/index.js +2 -2
- package/dist/recording.js +12 -7
- 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/suppressConsoleLogsDuringCall.js +16 -0
- package/dist/types/{modal.d.ts → inAppReportIssueModal.d.ts} +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/suppressConsoleLogsDuringCall.d.ts +1 -0
- package/dist/websocket.js +13 -9
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function suppressConsoleLogsDuringCall(fn) {
|
|
2
|
+
const originalLog = console.log;
|
|
3
|
+
const originalWarn = console.warn;
|
|
4
|
+
const originalError = console.error;
|
|
5
|
+
console.log = () => { };
|
|
6
|
+
console.warn = () => { };
|
|
7
|
+
console.error = () => { };
|
|
8
|
+
try {
|
|
9
|
+
fn();
|
|
10
|
+
}
|
|
11
|
+
finally {
|
|
12
|
+
console.log = originalLog;
|
|
13
|
+
console.warn = originalWarn;
|
|
14
|
+
console.error = originalError;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const initRecorder: (options: {
|
|
|
33
33
|
enableShortcuts?: boolean;
|
|
34
34
|
}) => Promise<void>;
|
|
35
35
|
export * from "./graphql";
|
|
36
|
-
export { openReportIssueModal } from "./
|
|
36
|
+
export { openReportIssueModal } from "./inAppReportIssueModal";
|
|
37
37
|
export * from "./recording";
|
|
38
38
|
export * from "./sendSailfishMessages";
|
|
39
39
|
export * from "./types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function suppressConsoleLogsDuringCall(fn: () => void): void;
|
package/dist/websocket.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import ReconnectingWebSocket from "reconnecting-websocket";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { deleteEventsByIds, getAllIndexedEvents, saveEventToIDB, } from './eventStore';
|
|
2
|
+
import { deleteEventsByIds, getAllIndexedEvents, saveEventToIDB, } from "./eventStore";
|
|
3
|
+
import { deleteNotifyMessageById, getAllNotifyMessages, saveNotifyMessageToIDB, } from "./notifyEventStore";
|
|
5
4
|
import { buildBatches, eventSize } from "./utils";
|
|
5
|
+
import version from "./version";
|
|
6
6
|
const MAX_MESSAGE_SIZE_MB = 50;
|
|
7
7
|
const MAX_MESSAGE_SIZE_BYTES = MAX_MESSAGE_SIZE_MB * 1024 * 1024;
|
|
8
|
+
const DEBUG = import.meta.env.VITE_DEBUG ? import.meta.env.VITE_DEBUG : false;
|
|
8
9
|
let webSocket = null;
|
|
9
10
|
function isWebSocketOpen(ws) {
|
|
10
11
|
return ws?.readyState === WebSocket.OPEN;
|
|
@@ -27,7 +28,7 @@ export async function flushBufferedEvents() {
|
|
|
27
28
|
const persisted = await getAllIndexedEvents();
|
|
28
29
|
const groupedBySession = {};
|
|
29
30
|
for (const event of persisted) {
|
|
30
|
-
const sessionId = event?.data?.data?.sessionId ??
|
|
31
|
+
const sessionId = event?.data?.data?.sessionId ?? "unknown-session";
|
|
31
32
|
if (!groupedBySession[sessionId])
|
|
32
33
|
groupedBySession[sessionId] = [];
|
|
33
34
|
groupedBySession[sessionId].push(event);
|
|
@@ -37,11 +38,13 @@ export async function flushBufferedEvents() {
|
|
|
37
38
|
for (const batch of idbBatches) {
|
|
38
39
|
if (!isWebSocketOpen(webSocket))
|
|
39
40
|
break;
|
|
40
|
-
const eventsToSend = batch.map(e => e.data);
|
|
41
|
-
const idsToDelete = batch
|
|
41
|
+
const eventsToSend = batch.map((e) => e.data);
|
|
42
|
+
const idsToDelete = batch
|
|
43
|
+
.map((e) => e.id)
|
|
44
|
+
.filter((id) => id != null);
|
|
42
45
|
try {
|
|
43
46
|
const message = JSON.stringify({
|
|
44
|
-
type:
|
|
47
|
+
type: "events",
|
|
45
48
|
events: eventsToSend,
|
|
46
49
|
mapUuid: window.sfMapUuid,
|
|
47
50
|
});
|
|
@@ -54,7 +57,7 @@ export async function flushBufferedEvents() {
|
|
|
54
57
|
}
|
|
55
58
|
export function sendEvent(event) {
|
|
56
59
|
const msg = JSON.stringify({
|
|
57
|
-
type:
|
|
60
|
+
type: "event",
|
|
58
61
|
event,
|
|
59
62
|
mapUuid: window.sfMapUuid,
|
|
60
63
|
});
|
|
@@ -80,7 +83,8 @@ export function initializeWebSocket(backendApi, apiKey, sessionId) {
|
|
|
80
83
|
};
|
|
81
84
|
webSocket = new ReconnectingWebSocket(wsUrl, [], options);
|
|
82
85
|
webSocket.addEventListener("open", () => {
|
|
83
|
-
|
|
86
|
+
if (DEBUG)
|
|
87
|
+
console.log("WebSocket opened.");
|
|
84
88
|
(async () => {
|
|
85
89
|
await flushNotifyQueue();
|
|
86
90
|
setInterval(() => flushBufferedEvents(), 10000);
|