@sailfish-ai/recorder 1.7.47 → 1.7.49

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.
Binary file
Binary file
@@ -0,0 +1,12 @@
1
+ import { v4 as uuidv4 } from "uuid";
2
+ import { HAS_WINDOW } from "./runtimeEnv";
3
+ // Storing the sailfishSessionId in window.name, as window.name retains its value after a page refresh
4
+ // but resets when a new tab (including a duplicated tab) is opened.
5
+ export function getOrSetSessionId() {
6
+ if (!HAS_WINDOW)
7
+ return uuidv4();
8
+ if (!window.name) {
9
+ window.name = uuidv4();
10
+ }
11
+ return window.name;
12
+ }
@@ -25,12 +25,14 @@ export declare const ReportIssueContext: {
25
25
  apiKey: string | null;
26
26
  backendApi: string | null;
27
27
  triageBaseUrl: string;
28
+ deactivateIsolation: () => void;
28
29
  };
29
30
  export declare function setupIssueReporting(options: {
30
31
  apiKey: string;
31
32
  backendApi: string;
32
33
  getSessionId: () => string;
33
34
  shortcuts?: Partial<ShortcutsConfig>;
35
+ customBaseUrl?: string;
34
36
  }): void;
35
- export declare function openReportIssueModal(customBaseUrl?: string): void;
37
+ export declare function openReportIssueModal(): void;
36
38
  export {};
@@ -2,17 +2,6 @@ import { LogRecordOptions } from "@sailfish-rrweb/rrweb-plugin-console-record";
2
2
  import { ShortcutsConfig } from "./inAppReportIssueModal";
3
3
  import { CaptureSettings } from "./types";
4
4
  export declare const STORAGE_VERSION = 1;
5
- export declare const DYNAMIC_PASSED_HOSTS_KEY = "dynamicPassedHosts";
6
- export declare const DYNAMIC_EXCLUDED_HOSTS_KEY = "dynamicExcludedHosts";
7
- export declare const dynamicExcludedHosts: Set<string>;
8
- export declare const dynamicPassedHosts: Set<string>;
9
- /**
10
- * Given a set of excluded hostPaths (like "foo.com/bar", "foo.com/baz", etc.),
11
- * find any path prefixes under each host that appear ≥ threshold times,
12
- * and replace their individual entries with a single wildcard pattern
13
- * (e.g. "foo.com/bar*").
14
- */
15
- export declare function consolidateDynamicExclusions(hostPathSet: Set<string>, threshold?: number): Set<string>;
16
5
  export declare const DEFAULT_CAPTURE_SETTINGS: CaptureSettings;
17
6
  export declare const DEFAULT_CONSOLE_RECORDING_SETTINGS: LogRecordOptions;
18
7
  export declare function matchUrlWithWildcard(input: unknown, patterns: string[]): boolean;
@@ -36,6 +25,7 @@ export declare const initRecorder: (options: {
36
25
  serviceIdentifier?: string;
37
26
  gitSha?: string;
38
27
  serviceAdditionalMetadata?: Record<string, any>;
28
+ customBaseUrl?: string;
39
29
  }) => Promise<void>;
40
30
  export * from "./graphql";
41
31
  export { openReportIssueModal } from "./inAppReportIssueModal";
@@ -0,0 +1,4 @@
1
+ export declare const HAS_WINDOW: boolean;
2
+ export declare const HAS_DOCUMENT: boolean;
3
+ export declare const HAS_LOCAL_STORAGE: boolean;
4
+ export declare const HAS_SESSION_STORAGE: boolean;
@@ -0,0 +1 @@
1
+ export declare function getOrSetSessionId(): string;
package/dist/websocket.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import ReconnectingWebSocket from "reconnecting-websocket";
2
2
  import { deleteEventsByIds, getAllIndexedEvents, saveEventToIDB, } from "./eventStore";
3
3
  import { deleteNotifyMessageById, getAllNotifyMessages, saveNotifyMessageToIDB, } from "./notifyEventStore";
4
+ import { getOrSetSessionId } from "./session";
4
5
  import { buildBatches, eventSize } from "./utils";
5
6
  import version from "./version";
6
7
  const MAX_MESSAGE_SIZE_MB = 50;
@@ -125,6 +126,9 @@ export function initializeWebSocket(backendApi, apiKey, sessionId) {
125
126
  return webSocket;
126
127
  }
127
128
  export function sendMessage(message) {
129
+ if (!("sessionId" in message)) {
130
+ message.sessionId = getOrSetSessionId();
131
+ }
128
132
  const msg = JSON.stringify(message);
129
133
  if (isWebSocketOpen(webSocket)) {
130
134
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailfish-ai/recorder",
3
- "version": "1.7.47",
3
+ "version": "1.7.49",
4
4
  "publishPublicly": true,
5
5
  "main": "dist/sailfish-recorder.umd.js",
6
6
  "types": "dist/types/index.d.ts",