@sailfish-ai/recorder 1.8.11 → 1.8.12

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/README.md CHANGED
@@ -7,3 +7,5 @@
7
7
  ## Trigger build - 06112025 0854PM GMT+4
8
8
 
9
9
  ## Trigger build - 11182025 1125AM GMT+4
10
+
11
+ ## Trigger build - 02122025 0330PM GMT+4
package/dist/index.js CHANGED
@@ -788,6 +788,7 @@ export async function startRecording({ apiKey, backendApi = "https://api-service
788
788
  g.sessionId = sessionId;
789
789
  g.apiKey = apiKey;
790
790
  g.backendApi = backendApi;
791
+ g.serviceAdditionalMetadata = serviceAdditionalMetadata;
791
792
  // Already fully initialized for this session with an open socket? No-op.
792
793
  if (g.initialized &&
793
794
  g.sessionId === sessionId &&
@@ -842,7 +843,9 @@ export async function startRecording({ apiKey, backendApi = "https://api-service
842
843
  // Create/ensure a server-side recording session once per browser session
843
844
  const sessionResponse = await startRecordingSession(apiKey, sessionId, backendApi, effectiveServiceIdentifier, effectiveServiceVersion, effectiveMapUuid, effectiveGitSha, effectiveLibrary, metadataWithAppUrl);
844
845
  if (sessionResponse.data?.startRecordingSession) {
845
- const websocket = await initializeRecording(captureSettings, backendApi, apiKey, sessionId);
846
+ // Extract env value from serviceAdditionalMetadata
847
+ const envValue = serviceAdditionalMetadata?.env || serviceAdditionalMetadata?.environment;
848
+ const websocket = await initializeRecording(captureSettings, backendApi, apiKey, sessionId, envValue);
846
849
  g.ws = websocket;
847
850
  g.initialized = true;
848
851
  if (!g.sentMapUuidOnce) {
package/dist/recorder.cjs CHANGED
@@ -457,12 +457,14 @@ function sendEvent(e) {
457
457
  saveEventToIDB(a);
458
458
  }
459
459
  }
460
- function initializeWebSocket(e, a, u) {
461
- const m2 = (function getWebSocketHost(e2) {
460
+ function initializeWebSocket(e, a, u, m2) {
461
+ const w2 = (function getWebSocketHost(e2) {
462
462
  const a2 = document.createElement("a");
463
463
  return a2.href = e2, `${a2.hostname}${a2.port ? `:${a2.port}` : ""}`;
464
- })(e), w2 = new URL(e).protocol;
465
- return se = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.11`, [], { connectionTimeout: 3e4 }), se.addEventListener("open", () => {
464
+ })(e);
465
+ let b2 = `${"https:" === new URL(e).protocol ? "wss" : "ws"}://${w2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.12`;
466
+ m2 && (b2 += `&envValue=${encodeURIComponent(m2)}`);
467
+ return se = new $(b2, [], { connectionTimeout: 3e4 }), se.addEventListener("open", () => {
466
468
  ne && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (pe ? "ENABLED" : "DISABLED"))), (async () => {
467
469
  try {
468
470
  ie = true, await flushNotifyQueue(), await flushBufferedEvents();
@@ -7113,8 +7115,8 @@ function initializeConsolePlugin(e, a) {
7113
7115
  sendEvent({ type: pp.Plugin, timestamp: Date.now(), data: { plugin: u, payload: e2 }, sessionId: a, ...getUrlAndStoredUuids() });
7114
7116
  }, window, e);
7115
7117
  }
7116
- async function initializeRecording(e, a, u, m2) {
7117
- const w2 = initializeWebSocket(a, u, m2);
7118
+ async function initializeRecording(e, a, u, m2, w2) {
7119
+ const b2 = initializeWebSocket(a, u, m2, w2);
7118
7120
  try {
7119
7121
  ae({ emit(e2) {
7120
7122
  Object.assign(e2, getUrlAndStoredUuids()), e2.sessionId = m2, sendEvent(e2);
@@ -7143,7 +7145,7 @@ async function initializeRecording(e, a, u, m2) {
7143
7145
  } catch (e2) {
7144
7146
  console.error("Error importing plugins!", e2);
7145
7147
  }
7146
- return w2;
7148
+ return b2;
7147
7149
  }
7148
7150
  let fp = null, mp = null;
7149
7151
  const gp = readDebugFlag(), yp = ["t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com", "*.zdassets.com"], wp = [400, 403], Sp = "CORS", bp = { recordCanvas: false, recordCrossOriginIframes: false, collectFonts: false, inlineImages: false, recordPassword: false, recordRealName: true, recordCreditCardInfo: false, recordSsn: false, recordDob: false, sampling: {} }, vp = { level: ["info", "log", "warn", "error"], lengthThreshold: 1e4, stringifyOptions: { stringLengthLimit: 1e3, numOfKeysLimit: 20, depthOfLimit: 4 }, logger: "console" };
@@ -7337,7 +7339,7 @@ async function startRecording({ apiKey: e, backendApi: a = "https://api-service.
7337
7339
  } catch {
7338
7340
  }
7339
7341
  })(), F2 = getOrSetSessionId(), U2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
7340
- if (U2.sessionId = F2, U2.apiKey = e, U2.backendApi = a, U2.initialized && U2.sessionId === F2 && U2.ws && 1 === U2.ws.readyState) trackDomainChangesOnce();
7342
+ if (U2.sessionId = F2, U2.apiKey = e, U2.backendApi = a, U2.serviceAdditionalMetadata = I2, U2.initialized && U2.sessionId === F2 && U2.ws && 1 === U2.ws.readyState) trackDomainChangesOnce();
7341
7343
  else {
7342
7344
  U2.domEventsInit || (initializeDomContentEvents(F2), U2.domEventsInit = true), U2.consoleInit || (initializeConsolePlugin(vp, F2), U2.consoleInit = true), U2.errorInit || (!(function initializeErrorInterceptor() {
7343
7345
  window.addEventListener("error", (e2) => {
@@ -7415,8 +7417,8 @@ async function startRecording({ apiKey: e, backendApi: a = "https://api-service.
7415
7417
  if (U2.ws && 1 === U2.ws.readyState) return;
7416
7418
  const b2 = withAppUrlMetadata(I2), x3 = await startRecordingSession(e, F2, a, O2, E2, D2, _2, "JS/TS", b2);
7417
7419
  if ((_b = x3.data) == null ? void 0 : _b.startRecordingSession) {
7418
- const u3 = await initializeRecording(m3, a, e, F2);
7419
- U2.ws = u3, U2.initialized = true, U2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e2 = "", a2 = "") {
7420
+ const u3 = (I2 == null ? void 0 : I2.env) || (I2 == null ? void 0 : I2.environment), b3 = await initializeRecording(m3, a, e, F2, u3);
7421
+ U2.ws = b3, U2.initialized = true, U2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e2 = "", a2 = "") {
7420
7422
  window.sfMapUuid && sendMessage({ type: "mapUuid", data: { mapUuid: window.sfMapUuid, serviceIdentifier: e2, serviceVersion: a2 } });
7421
7423
  })(C2, w2), U2.sentMapUuidOnce = true);
7422
7424
  } else console.error("Failed to start recording session:", x3.errors || x3);
package/dist/recorder.js CHANGED
@@ -457,12 +457,14 @@ function sendEvent(e) {
457
457
  saveEventToIDB(a);
458
458
  }
459
459
  }
460
- function initializeWebSocket(e, a, u) {
461
- const m2 = (function getWebSocketHost(e2) {
460
+ function initializeWebSocket(e, a, u, m2) {
461
+ const w2 = (function getWebSocketHost(e2) {
462
462
  const a2 = document.createElement("a");
463
463
  return a2.href = e2, `${a2.hostname}${a2.port ? `:${a2.port}` : ""}`;
464
- })(e), w2 = new URL(e).protocol;
465
- return ie = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.11`, [], { connectionTimeout: 3e4 }), ie.addEventListener("open", () => {
464
+ })(e);
465
+ let b2 = `${"https:" === new URL(e).protocol ? "wss" : "ws"}://${w2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.12`;
466
+ m2 && (b2 += `&envValue=${encodeURIComponent(m2)}`);
467
+ return ie = new $(b2, [], { connectionTimeout: 3e4 }), ie.addEventListener("open", () => {
466
468
  re && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (de ? "ENABLED" : "DISABLED"))), (async () => {
467
469
  try {
468
470
  le = true, await flushNotifyQueue(), await flushBufferedEvents();
@@ -7116,8 +7118,8 @@ function initializeConsolePlugin(e, a) {
7116
7118
  sendEvent({ type: dp.Plugin, timestamp: Date.now(), data: { plugin: u, payload: e2 }, sessionId: a, ...getUrlAndStoredUuids() });
7117
7119
  }, window, e);
7118
7120
  }
7119
- async function initializeRecording(e, a, u, m2) {
7120
- const w2 = initializeWebSocket(a, u, m2);
7121
+ async function initializeRecording(e, a, u, m2, w2) {
7122
+ const b2 = initializeWebSocket(a, u, m2, w2);
7121
7123
  try {
7122
7124
  ae({ emit(e2) {
7123
7125
  Object.assign(e2, getUrlAndStoredUuids()), e2.sessionId = m2, sendEvent(e2);
@@ -7146,7 +7148,7 @@ async function initializeRecording(e, a, u, m2) {
7146
7148
  } catch (e2) {
7147
7149
  console.error("Error importing plugins!", e2);
7148
7150
  }
7149
- return w2;
7151
+ return b2;
7150
7152
  }
7151
7153
  let mp = null, gp = null;
7152
7154
  function identify(e, a = {}, u = false) {
@@ -7351,7 +7353,7 @@ async function startRecording({ apiKey: e, backendApi: a = "https://api-service.
7351
7353
  } catch {
7352
7354
  }
7353
7355
  })(), F2 = getOrSetSessionId(), U2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
7354
- if (U2.sessionId = F2, U2.apiKey = e, U2.backendApi = a, U2.initialized && U2.sessionId === F2 && U2.ws && 1 === U2.ws.readyState) trackDomainChangesOnce();
7356
+ if (U2.sessionId = F2, U2.apiKey = e, U2.backendApi = a, U2.serviceAdditionalMetadata = I2, U2.initialized && U2.sessionId === F2 && U2.ws && 1 === U2.ws.readyState) trackDomainChangesOnce();
7355
7357
  else {
7356
7358
  U2.domEventsInit || (initializeDomContentEvents(F2), U2.domEventsInit = true), U2.consoleInit || (initializeConsolePlugin(kp, F2), U2.consoleInit = true), U2.errorInit || (!(function initializeErrorInterceptor() {
7357
7359
  window.addEventListener("error", (e2) => {
@@ -7429,8 +7431,8 @@ async function startRecording({ apiKey: e, backendApi: a = "https://api-service.
7429
7431
  if (U2.ws && 1 === U2.ws.readyState) return;
7430
7432
  const b2 = withAppUrlMetadata(I2), x3 = await startRecordingSession(e, F2, a, O2, E2, D2, _2, "JS/TS", b2);
7431
7433
  if ((_b = x3.data) == null ? void 0 : _b.startRecordingSession) {
7432
- const u3 = await initializeRecording(m3, a, e, F2);
7433
- U2.ws = u3, U2.initialized = true, U2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e2 = "", a2 = "") {
7434
+ const u3 = (I2 == null ? void 0 : I2.env) || (I2 == null ? void 0 : I2.environment), b3 = await initializeRecording(m3, a, e, F2, u3);
7435
+ U2.ws = b3, U2.initialized = true, U2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e2 = "", a2 = "") {
7434
7436
  window.sfMapUuid && sendMessage({ type: "mapUuid", data: { mapUuid: window.sfMapUuid, serviceIdentifier: e2, serviceVersion: a2 } });
7435
7437
  })(C2, w2), U2.sentMapUuidOnce = true);
7436
7438
  } else console.error("Failed to start recording session:", x3.errors || x3);
Binary file
Binary file
@@ -459,12 +459,14 @@
459
459
  saveEventToIDB(a2);
460
460
  }
461
461
  }
462
- function initializeWebSocket(e2, a2, u2) {
463
- const m2 = (function getWebSocketHost(e3) {
462
+ function initializeWebSocket(e2, a2, u2, m2) {
463
+ const w2 = (function getWebSocketHost(e3) {
464
464
  const a3 = document.createElement("a");
465
465
  return a3.href = e3, `${a3.hostname}${a3.port ? `:${a3.port}` : ""}`;
466
- })(e2), w2 = new URL(e2).protocol;
467
- return ie = new z(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a2}&sessionId=${u2}&sender=JS%2FTS&version=1.8.11`, [], { connectionTimeout: 3e4 }), ie.addEventListener("open", () => {
466
+ })(e2);
467
+ let b2 = `${"https:" === new URL(e2).protocol ? "wss" : "ws"}://${w2}/ws/notify/?apiKey=${a2}&sessionId=${u2}&sender=JS%2FTS&version=1.8.12`;
468
+ m2 && (b2 += `&envValue=${encodeURIComponent(m2)}`);
469
+ return ie = new z(b2, [], { connectionTimeout: 3e4 }), ie.addEventListener("open", () => {
468
470
  re && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (de ? "ENABLED" : "DISABLED"))), (async () => {
469
471
  try {
470
472
  le = true, await flushNotifyQueue(), await flushBufferedEvents();
@@ -7115,8 +7117,8 @@
7115
7117
  sendEvent({ type: dp.Plugin, timestamp: Date.now(), data: { plugin: u2, payload: e3 }, sessionId: a2, ...getUrlAndStoredUuids() });
7116
7118
  }, window, e2);
7117
7119
  }
7118
- async function initializeRecording(e2, a2, u2, m2) {
7119
- const w2 = initializeWebSocket(a2, u2, m2);
7120
+ async function initializeRecording(e2, a2, u2, m2, w2) {
7121
+ const b2 = initializeWebSocket(a2, u2, m2, w2);
7120
7122
  try {
7121
7123
  ae({ emit(e3) {
7122
7124
  Object.assign(e3, getUrlAndStoredUuids()), e3.sessionId = m2, sendEvent(e3);
@@ -7145,7 +7147,7 @@
7145
7147
  } catch (e3) {
7146
7148
  console.error("Error importing plugins!", e3);
7147
7149
  }
7148
- return w2;
7150
+ return b2;
7149
7151
  }
7150
7152
  let mp = null, gp = null;
7151
7153
  const yp = readDebugFlag(), wp = ["t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com", "*.zdassets.com"], Sp = [400, 403], bp = "CORS", vp = { recordCanvas: false, recordCrossOriginIframes: false, collectFonts: false, inlineImages: false, recordPassword: false, recordRealName: true, recordCreditCardInfo: false, recordSsn: false, recordDob: false, sampling: {} }, Cp = { level: ["info", "log", "warn", "error"], lengthThreshold: 1e4, stringifyOptions: { stringLengthLimit: 1e3, numOfKeysLimit: 20, depthOfLimit: 4 }, logger: "console" };
@@ -7339,7 +7341,7 @@
7339
7341
  } catch {
7340
7342
  }
7341
7343
  })(), F2 = getOrSetSessionId(), U2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
7342
- if (U2.sessionId = F2, U2.apiKey = e2, U2.backendApi = a2, U2.initialized && U2.sessionId === F2 && U2.ws && 1 === U2.ws.readyState) trackDomainChangesOnce();
7344
+ if (U2.sessionId = F2, U2.apiKey = e2, U2.backendApi = a2, U2.serviceAdditionalMetadata = I2, U2.initialized && U2.sessionId === F2 && U2.ws && 1 === U2.ws.readyState) trackDomainChangesOnce();
7343
7345
  else {
7344
7346
  U2.domEventsInit || (initializeDomContentEvents(F2), U2.domEventsInit = true), U2.consoleInit || (initializeConsolePlugin(Cp, F2), U2.consoleInit = true), U2.errorInit || (!(function initializeErrorInterceptor() {
7345
7347
  window.addEventListener("error", (e3) => {
@@ -7417,8 +7419,8 @@
7417
7419
  if (U2.ws && 1 === U2.ws.readyState) return;
7418
7420
  const C2 = withAppUrlMetadata(I2), x3 = await startRecordingSession(e2, F2, a2, O2, E2, D2, _2, "JS/TS", C2);
7419
7421
  if ((_b = x3.data) == null ? void 0 : _b.startRecordingSession) {
7420
- const u4 = await initializeRecording(m3, a2, e2, F2);
7421
- U2.ws = u4, U2.initialized = true, U2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e3 = "", a3 = "") {
7422
+ const u4 = (I2 == null ? void 0 : I2.env) || (I2 == null ? void 0 : I2.environment), C3 = await initializeRecording(m3, a2, e2, F2, u4);
7423
+ U2.ws = C3, U2.initialized = true, U2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e3 = "", a3 = "") {
7422
7424
  window.sfMapUuid && sendMessage({ type: "mapUuid", data: { mapUuid: window.sfMapUuid, serviceIdentifier: e3, serviceVersion: a3 } });
7423
7425
  })(b2, w2), U2.sentMapUuidOnce = true);
7424
7426
  } else console.error("Failed to start recording session:", x3.errors || x3);
package/dist/recording.js CHANGED
@@ -155,8 +155,8 @@ export function initializeConsolePlugin(consoleRecordSettings, sessionId) {
155
155
  }
156
156
  export async function initializeRecording(captureSettings, // TODO - Sibyl post-launch - replace type
157
157
  // networkRecordSettings: NetworkRecordOptions,
158
- backendApi, apiKey, sessionId) {
159
- const webSocket = initializeWebSocket(backendApi, apiKey, sessionId);
158
+ backendApi, apiKey, sessionId, envValue) {
159
+ const webSocket = initializeWebSocket(backendApi, apiKey, sessionId, envValue);
160
160
  try {
161
161
  record({
162
162
  emit(event) {
@@ -10,4 +10,4 @@ export declare const getUrlAndStoredUuids: () => {
10
10
  export declare function initializeDomContentEvents(sessionId: string): void;
11
11
  export declare function initializeConsolePlugin(consoleRecordSettings: LogRecordOptions, sessionId: string): void;
12
12
  export declare function initializeRecording(captureSettings: any, // TODO - Sibyl post-launch - replace type
13
- backendApi: string, apiKey: string, sessionId: string): Promise<ReconnectingWebSocket>;
13
+ backendApi: string, apiKey: string, sessionId: string, envValue?: string): Promise<ReconnectingWebSocket>;
@@ -1,7 +1,7 @@
1
1
  import ReconnectingWebSocket from "reconnecting-websocket";
2
2
  export declare function flushBufferedEvents(): Promise<void>;
3
3
  export declare function sendEvent(event: any): void;
4
- export declare function initializeWebSocket(backendApi: string, apiKey: string, sessionId: string): ReconnectingWebSocket;
4
+ export declare function initializeWebSocket(backendApi: string, apiKey: string, sessionId: string, envValue?: string): ReconnectingWebSocket;
5
5
  export declare function sendMessage(message: Record<string, any>): void;
6
6
  /**
7
7
  * Enable function span tracking for this session (e.g., when report issue recording starts)
package/dist/websocket.js CHANGED
@@ -203,14 +203,18 @@ export function sendEvent(event) {
203
203
  saveEventToIDB(enrichedEvent);
204
204
  }
205
205
  }
206
- export function initializeWebSocket(backendApi, apiKey, sessionId) {
206
+ export function initializeWebSocket(backendApi, apiKey, sessionId, envValue) {
207
207
  // Note: Global function span tracking state is now loaded at module initialization time
208
208
  // (see IIFE above) so headers work immediately, even before WebSocket connects.
209
209
  // The WebSocket "funcSpanTrackingControl" message will update the state if needed.
210
210
  const wsHost = getWebSocketHost(backendApi);
211
211
  const apiProtocol = new URL(backendApi).protocol;
212
212
  const wsScheme = apiProtocol === "https:" ? "wss" : "ws";
213
- const wsUrl = `${wsScheme}://${wsHost}/ws/notify/?apiKey=${apiKey}&sessionId=${sessionId}&sender=JS%2FTS&version=${version}`;
213
+ let wsUrl = `${wsScheme}://${wsHost}/ws/notify/?apiKey=${apiKey}&sessionId=${sessionId}&sender=JS%2FTS&version=${version}`;
214
+ // Append envValue if provided
215
+ if (envValue) {
216
+ wsUrl += `&envValue=${encodeURIComponent(envValue)}`;
217
+ }
214
218
  const options = {
215
219
  connectionTimeout: 30000,
216
220
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailfish-ai/recorder",
3
- "version": "1.8.11",
3
+ "version": "1.8.12",
4
4
  "publishPublicly": true,
5
5
  "type": "module",
6
6
  "main": "dist/recorder.cjs",
@@ -37,7 +37,7 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@sailfish-ai/sf-map-utils": "0.4.3",
40
+ "@sailfish-ai/sf-map-utils": "0.4.4",
41
41
  "@sailfish-rrweb/rrweb-plugin-console-record": "0.5.2",
42
42
  "@sailfish-rrweb/rrweb-record-only": "0.5.2",
43
43
  "@sailfish-rrweb/types": "0.5.2",