@sailfish-ai/recorder 1.10.13 → 1.11.0

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.
Files changed (93) hide show
  1. package/README.md +309 -7
  2. package/dist/babel-plugin-sailfish-source.cjs.br +0 -0
  3. package/dist/babel-plugin-sailfish-source.cjs.gz +0 -0
  4. package/dist/babel-plugin-sailfish-source.js.br +0 -0
  5. package/dist/babel-plugin-sailfish-source.js.gz +0 -0
  6. package/dist/chunkSerializer.js.br +0 -0
  7. package/dist/chunkSerializer.js.gz +0 -0
  8. package/dist/chunks/{chunkSerializer-CodMnuS3.js → chunkSerializer-CRDpgzTs.js} +1 -1
  9. package/dist/chunks/chunkSerializer-CRDpgzTs.js.br +0 -0
  10. package/dist/chunks/chunkSerializer-CRDpgzTs.js.gz +0 -0
  11. package/dist/chunks/{chunkSerializer-Dk1eF3S8.js → chunkSerializer-ZzIoYlP2.js} +1 -1
  12. package/dist/chunks/chunkSerializer-ZzIoYlP2.js.br +0 -0
  13. package/dist/chunks/chunkSerializer-ZzIoYlP2.js.gz +0 -0
  14. package/dist/chunks/{index-DW416eVj.js → index-BQn1Q-2-.js} +36 -32
  15. package/dist/chunks/index-BQn1Q-2-.js.br +0 -0
  16. package/dist/chunks/index-BQn1Q-2-.js.gz +0 -0
  17. package/dist/chunks/{index-DvLh2k6O.js → index-Dq_tjmkZ.js} +30 -26
  18. package/dist/chunks/index-Dq_tjmkZ.js.br +0 -0
  19. package/dist/chunks/index-Dq_tjmkZ.js.gz +0 -0
  20. package/dist/constants.js.br +0 -0
  21. package/dist/constants.js.gz +0 -0
  22. package/dist/deviceInfo.js.br +0 -0
  23. package/dist/deviceInfo.js.gz +0 -0
  24. package/dist/env.js.br +0 -0
  25. package/dist/env.js.gz +0 -0
  26. package/dist/errorInterceptor.js.br +0 -0
  27. package/dist/errorInterceptor.js.gz +0 -0
  28. package/dist/eventStore.js.br +0 -0
  29. package/dist/eventStore.js.gz +0 -0
  30. package/dist/exponentialBackoff.js.br +0 -0
  31. package/dist/exponentialBackoff.js.gz +0 -0
  32. package/dist/fiberHook.js.br +0 -0
  33. package/dist/fiberHook.js.gz +0 -0
  34. package/dist/frameworkDetection.js.br +0 -0
  35. package/dist/frameworkDetection.js.gz +0 -0
  36. package/dist/graphql.js.br +0 -0
  37. package/dist/graphql.js.gz +0 -0
  38. package/dist/headlessDetection.js.br +0 -0
  39. package/dist/headlessDetection.js.gz +0 -0
  40. package/dist/inAppReportIssueModal/index.js.br +0 -0
  41. package/dist/inAppReportIssueModal/index.js.gz +0 -0
  42. package/dist/inAppReportIssueModal/integrations.js.br +0 -0
  43. package/dist/inAppReportIssueModal/integrations.js.gz +0 -0
  44. package/dist/inAppReportIssueModal/state.js.br +0 -0
  45. package/dist/inAppReportIssueModal/state.js.gz +0 -0
  46. package/dist/inAppReportIssueModal/ui.js.br +0 -0
  47. package/dist/inAppReportIssueModal/ui.js.gz +0 -0
  48. package/dist/index.js +44 -34
  49. package/dist/index.js.br +0 -0
  50. package/dist/index.js.gz +0 -0
  51. package/dist/notifyEventStore.js.br +0 -0
  52. package/dist/notifyEventStore.js.gz +0 -0
  53. package/dist/recorder.cjs +1 -1
  54. package/dist/recorder.cjs.br +0 -0
  55. package/dist/recorder.cjs.gz +0 -0
  56. package/dist/recorder.js +1 -1
  57. package/dist/recorder.js.br +0 -0
  58. package/dist/recorder.js.gz +0 -0
  59. package/dist/recorder.umd.cjs +8883 -0
  60. package/dist/recorder.umd.cjs.br +0 -0
  61. package/dist/recorder.umd.cjs.gz +0 -0
  62. package/dist/recording.js.br +0 -0
  63. package/dist/recording.js.gz +0 -0
  64. package/dist/segmentHelpers.js.br +0 -0
  65. package/dist/segmentHelpers.js.gz +0 -0
  66. package/dist/sendSailfishMessages.js.br +0 -0
  67. package/dist/sendSailfishMessages.js.gz +0 -0
  68. package/dist/session.js.br +0 -0
  69. package/dist/session.js.gz +0 -0
  70. package/dist/snippet-auto-init.js +44 -0
  71. package/dist/snippet-auto-init.js.br +0 -0
  72. package/dist/snippet-auto-init.js.gz +0 -0
  73. package/dist/sourceLocation.js.br +0 -0
  74. package/dist/sourceLocation.js.gz +0 -0
  75. package/dist/types/index.d.ts +3 -1
  76. package/dist/types/snippet-auto-init.d.ts +1 -0
  77. package/dist/types/umd-entry.d.ts +9 -0
  78. package/dist/umd-entry.js +11 -0
  79. package/dist/utils.js.br +0 -0
  80. package/dist/utils.js.gz +0 -0
  81. package/dist/uuid.js.br +0 -0
  82. package/dist/uuid.js.gz +0 -0
  83. package/dist/websocket.js.br +0 -0
  84. package/dist/websocket.js.gz +0 -0
  85. package/package.json +9 -5
  86. package/dist/chunks/chunkSerializer-CodMnuS3.js.br +0 -0
  87. package/dist/chunks/chunkSerializer-CodMnuS3.js.gz +0 -0
  88. package/dist/chunks/chunkSerializer-Dk1eF3S8.js.br +0 -0
  89. package/dist/chunks/chunkSerializer-Dk1eF3S8.js.gz +0 -0
  90. package/dist/chunks/index-DW416eVj.js.br +0 -0
  91. package/dist/chunks/index-DW416eVj.js.gz +0 -0
  92. package/dist/chunks/index-DvLh2k6O.js.br +0 -0
  93. package/dist/chunks/index-DvLh2k6O.js.gz +0 -0
@@ -370,7 +370,7 @@ function initializeWebSocket(t2, n2, i2, o2, s2 = false) {
370
370
  const t3 = new URL(e2);
371
371
  return `${t3.hostname}${t3.port ? `:${t3.port}` : ""}`;
372
372
  })(t2);
373
- let r2 = `${"https:" === new URL(t2).protocol ? "wss" : "ws"}://${a2}/ws/notify/?apiKey=${n2}&sessionId=${i2}&sender=JS%2FTS&version=1.10.13`;
373
+ let r2 = `${"https:" === new URL(t2).protocol ? "wss" : "ws"}://${a2}/ws/notify/?apiKey=${n2}&sessionId=${i2}&sender=JS%2FTS&version=1.11.0`;
374
374
  if (o2 && (r2 += `&envValue=${encodeURIComponent(o2)}`), k = s2 ? (function tryCreateWsWorker() {
375
375
  if ("undefined" == typeof Worker) return null;
376
376
  try {
@@ -701,7 +701,7 @@ async function initializeRecording(e2, n2, i2, o2, s2, a2 = true, r2 = false, l2
701
701
  }
702
702
  const { record: n4 } = await import("@sailfish-rrweb/rrweb-record-only");
703
703
  if (J = n4, await yieldToMain(), l2) {
704
- const { chunkedSnapshot: i3 } = await import("./chunkSerializer-Dk1eF3S8.js"), o3 = n4.mirror;
704
+ const { chunkedSnapshot: i3 } = await import("./chunkSerializer-ZzIoYlP2.js"), o3 = n4.mirror;
705
705
  let s3 = true;
706
706
  const a3 = [];
707
707
  n4({ emit(e3) {
@@ -2201,7 +2201,7 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
2201
2201
  })(e3, i3, o3, d2, u2, s2, c2);
2202
2202
  } });
2203
2203
  }
2204
- async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo: i2 = [], domainsToNotPropagateHeaderTo: o2 = [], serviceVersion: s2, serviceIdentifier: a2, gitSha: r2, serviceAdditionalMetadata: l2, enableIpTracking: c2, captureStreamingResponseBody: d2 = true, captureResponseBodyMaxMb: u2 = 10, captureStreamPrefixKb: p2 = 64, captureStreamTimeoutMs: f2 = 1e4, enableFiberTracking: m2 = false, deferRecording: h2, deferRecordingStart: y2, chunkSnapshot: b2, useWsWorker: w2 = true }) {
2204
+ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo: i2 = [], domainsToNotPropagateHeaderTo: o2 = [], serviceVersion: s2, serviceIdentifier: a2, gitSha: r2, serviceAdditionalMetadata: l2, enableIpTracking: c2, captureStreamingResponseBody: d2 = true, captureResponseBodyMaxMb: u2 = 10, captureStreamPrefixKb: p2 = 64, captureStreamTimeoutMs: f2 = 1e4, enableFiberTracking: m2 = false, deferRecording: h2, deferRecordingStart: y2, chunkSnapshot: b2, useWsWorker: w2 = true, library: v2 }) {
2205
2205
  var _a, _b;
2206
2206
  if ((function isHeadlessOrLighthouse() {
2207
2207
  try {
@@ -2214,10 +2214,10 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2214
2214
  return false;
2215
2215
  }
2216
2216
  })()) return;
2217
- const v2 = h2 ?? y2 ?? true, S2 = getOrSetSessionId(), k2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
2218
- if (k2.sessionId = S2, k2.apiKey = e2, k2.backendApi = t2, k2.serviceAdditionalMetadata = l2, k2.initialized && k2.sessionId === S2 && k2.ws && 1 === k2.ws.readyState) return void trackDomainChangesOnce();
2219
- const x2 = { captureStreamingResponseBody: d2, captureResponseBodyMaxMb: u2, captureStreamPrefixKb: p2, captureStreamTimeoutMs: f2 };
2220
- sessionStorage.getItem("pageVisitUUID") || (sessionStorage.setItem("pageVisitUUID", uuidv4()), invalidateUrlCache()), k2.xhrPatched || (!(function setupXMLHttpRequestInterceptor(e3 = [], t3 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }, i3 = []) {
2217
+ const S2 = h2 ?? y2 ?? true, k2 = getOrSetSessionId(), x2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
2218
+ if (x2.sessionId = k2, x2.apiKey = e2, x2.backendApi = t2, x2.serviceAdditionalMetadata = l2, x2.initialized && x2.sessionId === k2 && x2.ws && 1 === x2.ws.readyState) return void trackDomainChangesOnce();
2219
+ const I2 = { captureStreamingResponseBody: d2, captureResponseBodyMaxMb: u2, captureStreamPrefixKb: p2, captureStreamTimeoutMs: f2 };
2220
+ sessionStorage.getItem("pageVisitUUID") || (sessionStorage.setItem("pageVisitUUID", uuidv4()), invalidateUrlCache()), x2.xhrPatched || (!(function setupXMLHttpRequestInterceptor(e3 = [], t3 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }, i3 = []) {
2221
2221
  const o3 = XMLHttpRequest.prototype.open, s3 = XMLHttpRequest.prototype.send, a3 = XMLHttpRequest.prototype.setRequestHeader, r3 = getOrSetSessionId(), l3 = createSkipHeadersPropagationChecker(e3, i3);
2222
2222
  XMLHttpRequest.prototype.setRequestHeader = function(e4, t4) {
2223
2223
  return this._capturedRequestHeaders || (this._capturedRequestHeaders = {}), this._capturedRequestHeaders[e4] = t4, a3.call(this, e4, t4);
@@ -2282,22 +2282,22 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2282
2282
  emitFinished(false, e5, t4);
2283
2283
  }, { once: true }), s3.apply(this, e4);
2284
2284
  };
2285
- })(o2, x2, i2), k2.xhrPatched = true), k2.fetchPatched || (setupFetchInterceptor(o2, x2, i2), k2.fetchPatched = true), await yieldToMain(), k2.domEventsInit || (initializeDomContentEvents(S2), k2.domEventsInit = true), await yieldToMain(), k2.consoleInit || (initializeConsolePlugin(Ae, S2), k2.consoleInit = true), await yieldToMain(), k2.errorInit || (!(function initializeErrorInterceptor() {
2285
+ })(o2, I2, i2), x2.xhrPatched = true), x2.fetchPatched || (setupFetchInterceptor(o2, I2, i2), x2.fetchPatched = true), await yieldToMain(), x2.domEventsInit || (initializeDomContentEvents(k2), x2.domEventsInit = true), await yieldToMain(), x2.consoleInit || (initializeConsolePlugin(Ae, k2), x2.consoleInit = true), await yieldToMain(), x2.errorInit || (!(function initializeErrorInterceptor() {
2286
2286
  window.addEventListener("error", (e3) => {
2287
2287
  captureError(e3.error || e3.message);
2288
2288
  }), window.addEventListener("unhandledrejection", (e3) => {
2289
2289
  captureError(e3.reason, true);
2290
2290
  });
2291
- })(), k2.errorInit = true), await yieldToMain(), _ensureModuleSideEffects(), (function storeCredentialsAndConnection({ apiKey: e3, backendApi: t3 }) {
2291
+ })(), x2.errorInit = true), await yieldToMain(), _ensureModuleSideEffects(), (function storeCredentialsAndConnection({ apiKey: e3, backendApi: t3 }) {
2292
2292
  g && (sessionStorage.setItem("sailfishApiKey", e3), sessionStorage.setItem("sailfishBackendApi", t3));
2293
- })({ apiKey: e2, backendApi: t2 }), !isFunctionSpanTrackingEnabled() || k2.ws && 1 === k2.ws.readyState || fetchFunctionSpanTrackingEnabled(e2, t2).then((e3) => {
2293
+ })({ apiKey: e2, backendApi: t2 }), !isFunctionSpanTrackingEnabled() || x2.ws && 1 === x2.ws.readyState || fetchFunctionSpanTrackingEnabled(e2, t2).then((e3) => {
2294
2294
  var _a2;
2295
2295
  ((_a2 = e3.data) == null ? void 0 : _a2.isFunctionSpanTrackingEnabledFromApiKey) ?? false ? ke && console.log("[Sailfish] Function span tracking state validated with backend: ACTIVE") : (clearStaleFuncSpanState(), ke && console.log("[Sailfish] Cleared stale function span tracking state - backend validation shows tracking is not active"));
2296
2296
  }).catch((e3) => {
2297
2297
  ke && console.warn("[Sailfish] Failed to validate function span tracking status with backend:", e3);
2298
- }), k2.sentDoNotPropagateOnce || (sendDomainsToNotPropagateHeaderTo(e2, [...o2, ...Te], t2).catch((e3) => console.error("Failed to send domains to not propagate header to:", e3)), k2.sentDoNotPropagateOnce = true), (async function gatherAndCacheDeviceInfo() {
2298
+ }), x2.sentDoNotPropagateOnce || (sendDomainsToNotPropagateHeaderTo(e2, [...o2, ...Te], t2).catch((e3) => console.error("Failed to send domains to not propagate header to:", e3)), x2.sentDoNotPropagateOnce = true), (async function gatherAndCacheDeviceInfo() {
2299
2299
  sendMessage({ type: "deviceInfo", data: { deviceInfo: { language: navigator.language, userAgent: navigator.userAgent } } });
2300
- })(), c2 && fetchAndSendIp(S2);
2300
+ })(), c2 && fetchAndSendIp(k2);
2301
2301
  try {
2302
2302
  const n2 = r2 ?? (function readGitSha() {
2303
2303
  var _a2;
@@ -2316,7 +2316,7 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2316
2316
  if ("string" == typeof e3 && e3) return e3;
2317
2317
  } catch {
2318
2318
  }
2319
- })(), i3 = a2 ?? "", o3 = s2 ?? "", c3 = "JS/TS", d3 = (function getMapUuidFromWindow() {
2319
+ })(), i3 = a2 ?? "", o3 = s2 ?? "", c3 = v2 ?? "JS/TS", d3 = (function getMapUuidFromWindow() {
2320
2320
  try {
2321
2321
  const e3 = window;
2322
2322
  if (e3 && "string" == typeof e3.sfMapUuid && e3.sfMapUuid) return e3.sfMapUuid;
@@ -2336,15 +2336,15 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2336
2336
  return { framework: i4[0] ?? null, additionalFrameworks: i4.slice(1), serviceRole: "frontend" };
2337
2337
  })(), f3 = { ...u3, serviceRole: p3.serviceRole, ...null !== p3.framework && { framework: p3.framework }, ...p3.additionalFrameworks.length > 0 && { additionalFrameworks: p3.additionalFrameworks } };
2338
2338
  await yieldToMain();
2339
- const [g2, h3] = await Promise.all([fetchCaptureSettings(e2, t2), startRecordingSession(e2, S2, t2, i3, o3, d3, n2, c3, f3)]), y3 = { ...Me, ...(_a = g2.data) == null ? void 0 : _a.captureSettingsFromApiKey, enableFiberTracking: m2 };
2340
- if (k2.ws && 1 === k2.ws.readyState) return;
2339
+ const [g2, h3] = await Promise.all([fetchCaptureSettings(e2, t2), startRecordingSession(e2, k2, t2, i3, o3, d3, n2, c3, f3)]), y3 = { ...Me, ...(_a = g2.data) == null ? void 0 : _a.captureSettingsFromApiKey, enableFiberTracking: m2 };
2340
+ if (x2.ws && 1 === x2.ws.readyState) return;
2341
2341
  if ((_b = h3.data) == null ? void 0 : _b.startRecordingSession) {
2342
2342
  const n3 = (l2 == null ? void 0 : l2.env) || (l2 == null ? void 0 : l2.environment);
2343
2343
  await yieldToMain();
2344
- const i4 = await initializeRecording(y3, t2, e2, S2, n3, v2, w2, b2 ?? false);
2345
- k2.ws = i4, k2.initialized = true, trackDomainChangesOnce(), k2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e3 = "", t3 = "") {
2344
+ const i4 = await initializeRecording(y3, t2, e2, k2, n3, S2, w2, b2 ?? false);
2345
+ x2.ws = i4, x2.initialized = true, trackDomainChangesOnce(), x2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e3 = "", t3 = "") {
2346
2346
  window.sfMapUuid && sendMessage({ type: "mapUuid", data: { mapUuid: window.sfMapUuid, serviceIdentifier: e3, serviceVersion: t3 } });
2347
- })(a2, s2), k2.sentMapUuidOnce = true);
2347
+ })(a2, s2), x2.sentMapUuidOnce = true);
2348
2348
  } else console.error("Failed to start recording session:", h3.errors || h3);
2349
2349
  } catch (e3) {
2350
2350
  console.error("Error starting recording:", e3);
@@ -2354,15 +2354,19 @@ const initRecorder = async (e2) => {
2354
2354
  if ("undefined" == typeof window) return;
2355
2355
  const t2 = window.__sailfish_recorder || (window.__sailfish_recorder = {}), n2 = getOrSetSessionId();
2356
2356
  return clearPageVisitDataFromSessionStorage(), t2.initialized && t2.sessionId === n2 && t2.ws && 1 === t2.ws.readyState ? void 0 : (t2.initPromise || (t2.initPromise = (async () => {
2357
- if (t2.hasLoggedInitOnce || (console.log("Initializing Sailfish Recorder (first run) …"), t2.hasLoggedInitOnce = true), await startRecording(e2), !t2.issueReportingInit) {
2358
- const n3 = e2.backendApi ?? "https://api-service.sailfishqa.com", [{ setupIssueReporting: i2 }, { fetchIntegrationData: o2, getIntegrationData: s2 }] = await Promise.all([Promise.resolve().then(() => Se), Promise.resolve().then(() => ce)]);
2359
- let a2 = null;
2360
- try {
2361
- await o2(e2.apiKey, n3), a2 = s2();
2362
- } catch (e3) {
2363
- console.warn("[Sailfish] Failed to fetch integration data for issue reporting:", e3);
2357
+ try {
2358
+ if (t2.hasLoggedInitOnce || (console.log("Initializing Sailfish Recorder (first run) …"), t2.hasLoggedInitOnce = true), await startRecording(e2), !t2.issueReportingInit) {
2359
+ const n3 = e2.backendApi ?? "https://api-service.sailfishqa.com", [{ setupIssueReporting: i2 }, { fetchIntegrationData: o2, getIntegrationData: s2 }] = await Promise.all([Promise.resolve().then(() => Se), Promise.resolve().then(() => ce)]);
2360
+ let a2 = null;
2361
+ try {
2362
+ await o2(e2.apiKey, n3), a2 = s2();
2363
+ } catch (e3) {
2364
+ console.warn("[Sailfish] Failed to fetch integration data for issue reporting:", e3);
2365
+ }
2366
+ i2({ apiKey: e2.apiKey, backendApi: n3, getSessionId: () => getOrSetSessionId(), shortcuts: e2.reportIssueShortcuts, customBaseUrl: e2.customBaseUrl, integrationData: a2, showEngTicketFieldsInReportIssueModalDefault: e2.showEngTicketFieldsInReportIssueModalDefault }), t2.issueReportingInit = true;
2364
2367
  }
2365
- i2({ apiKey: e2.apiKey, backendApi: n3, getSessionId: () => getOrSetSessionId(), shortcuts: e2.reportIssueShortcuts, customBaseUrl: e2.customBaseUrl, integrationData: a2, showEngTicketFieldsInReportIssueModalDefault: e2.showEngTicketFieldsInReportIssueModalDefault }), t2.issueReportingInit = true;
2368
+ } catch (e3) {
2369
+ console.warn("[Sailfish] Recorder initialization failed:", e3);
2366
2370
  }
2367
2371
  })().finally(() => {
2368
2372
  delete t2.initPromise;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/env.js.br ADDED
Binary file
package/dist/env.js.gz ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/index.js CHANGED
@@ -1028,7 +1028,7 @@ function getMapUuidFromWindow() {
1028
1028
  // Note - we do NOT send serviceIdentifier because
1029
1029
  // it would be 1 serviceIdentifier per frontend user session,
1030
1030
  // which is very wasteful
1031
- export async function startRecording({ apiKey, backendApi = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo = [], domainsToNotPropagateHeaderTo = [], serviceVersion, serviceIdentifier, gitSha, serviceAdditionalMetadata, enableIpTracking, captureStreamingResponseBody = true, captureResponseBodyMaxMb = 10, captureStreamPrefixKb = 64, captureStreamTimeoutMs = 10000, enableFiberTracking = false, deferRecording, deferRecordingStart, chunkSnapshot, useWsWorker = true, }) {
1031
+ export async function startRecording({ apiKey, backendApi = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo = [], domainsToNotPropagateHeaderTo = [], serviceVersion, serviceIdentifier, gitSha, serviceAdditionalMetadata, enableIpTracking, captureStreamingResponseBody = true, captureResponseBodyMaxMb = 10, captureStreamPrefixKb = 64, captureStreamTimeoutMs = 10000, enableFiberTracking = false, deferRecording, deferRecordingStart, chunkSnapshot, useWsWorker = true, library, }) {
1032
1032
  // Synthetic-environment no-op: Lighthouse/PSI, HeadlessChrome, WebPageTest
1033
1033
  // (PTST), Puppeteer/Playwright/Selenium (navigator.webdriver). We skip init
1034
1034
  // entirely to avoid WSS retry noise, third-party perf penalties in audits,
@@ -1145,7 +1145,7 @@ export async function startRecording({ apiKey, backendApi = "https://api-service
1145
1145
  const effectiveGitSha = gitSha ?? readGitSha();
1146
1146
  const effectiveServiceIdentifier = serviceIdentifier ?? "";
1147
1147
  const effectiveServiceVersion = serviceVersion ?? "";
1148
- const effectiveLibrary = "JS/TS";
1148
+ const effectiveLibrary = library ?? "JS/TS";
1149
1149
  const effectiveMapUuid = getMapUuidFromWindow();
1150
1150
  const metadataWithAppUrl = withAppUrlMetadata(serviceAdditionalMetadata);
1151
1151
  // Detect the front-end framework. DOM queries are allowed only when the
@@ -1220,40 +1220,47 @@ export const initRecorder = async (options) => {
1220
1220
  // Coalesce concurrent calls into one promise
1221
1221
  if (!g.initPromise) {
1222
1222
  g.initPromise = (async () => {
1223
- if (!g.hasLoggedInitOnce) {
1224
- // Log only once per window lifecycle to avoid noisy logs when routes remount.
1225
- console.log("Initializing Sailfish Recorder (first run) …");
1226
- g.hasLoggedInitOnce = true;
1227
- }
1228
- await startRecording(options);
1229
- // Set up the issue reporting UI once (lazy-loaded)
1230
- if (!g.issueReportingInit) {
1231
- const backendApiUrl = options.backendApi ?? "https://api-service.sailfishqa.com";
1232
- // Dynamically import issue reporting modules to reduce initial bundle
1233
- const [{ setupIssueReporting }, { fetchIntegrationData, getIntegrationData }] = await Promise.all([
1234
- import("./inAppReportIssueModal"),
1235
- import("./inAppReportIssueModal/integrations"),
1236
- ]);
1237
- // Fetch integration data before setting up issue reporting
1238
- let integrationData = null;
1239
- try {
1240
- await fetchIntegrationData(options.apiKey, backendApiUrl);
1241
- integrationData = getIntegrationData();
1223
+ try {
1224
+ if (!g.hasLoggedInitOnce) {
1225
+ // Log only once per window lifecycle to avoid noisy logs when routes remount.
1226
+ console.log("Initializing Sailfish Recorder (first run) …");
1227
+ g.hasLoggedInitOnce = true;
1242
1228
  }
1243
- catch (error) {
1244
- console.warn("[Sailfish] Failed to fetch integration data for issue reporting:", error);
1245
- // Continue with null integration data - the modal will work without it
1229
+ await startRecording(options);
1230
+ // Set up the issue reporting UI once (lazy-loaded)
1231
+ if (!g.issueReportingInit) {
1232
+ const backendApiUrl = options.backendApi ?? "https://api-service.sailfishqa.com";
1233
+ // Dynamically import issue reporting modules to reduce initial bundle
1234
+ const [{ setupIssueReporting }, { fetchIntegrationData, getIntegrationData }] = await Promise.all([
1235
+ import("./inAppReportIssueModal"),
1236
+ import("./inAppReportIssueModal/integrations"),
1237
+ ]);
1238
+ // Fetch integration data before setting up issue reporting
1239
+ let integrationData = null;
1240
+ try {
1241
+ await fetchIntegrationData(options.apiKey, backendApiUrl);
1242
+ integrationData = getIntegrationData();
1243
+ }
1244
+ catch (error) {
1245
+ console.warn("[Sailfish] Failed to fetch integration data for issue reporting:", error);
1246
+ // Continue with null integration data - the modal will work without it
1247
+ }
1248
+ setupIssueReporting({
1249
+ apiKey: options.apiKey,
1250
+ backendApi: backendApiUrl,
1251
+ getSessionId: () => getOrSetSessionId(),
1252
+ shortcuts: options.reportIssueShortcuts,
1253
+ customBaseUrl: options.customBaseUrl,
1254
+ integrationData,
1255
+ showEngTicketFieldsInReportIssueModalDefault: options.showEngTicketFieldsInReportIssueModalDefault,
1256
+ });
1257
+ g.issueReportingInit = true;
1246
1258
  }
1247
- setupIssueReporting({
1248
- apiKey: options.apiKey,
1249
- backendApi: backendApiUrl,
1250
- getSessionId: () => getOrSetSessionId(),
1251
- shortcuts: options.reportIssueShortcuts,
1252
- customBaseUrl: options.customBaseUrl,
1253
- integrationData,
1254
- showEngTicketFieldsInReportIssueModalDefault: options.showEngTicketFieldsInReportIssueModalDefault,
1255
- });
1256
- g.issueReportingInit = true;
1259
+ }
1260
+ catch (err) {
1261
+ // CRITICAL: Never let Sailfish errors break the customer's application.
1262
+ // Log a warning so developers can debug, but swallow the error.
1263
+ console.warn("[Sailfish] Recorder initialization failed:", err);
1257
1264
  }
1258
1265
  })().finally(() => {
1259
1266
  // Keep all state/flags, but clear the temp promise so a brand-new session can re-init later
@@ -1271,3 +1278,6 @@ export { getOrSetSessionId } from "./session";
1271
1278
  export * from "./types";
1272
1279
  export * from "./utils";
1273
1280
  export * from "./websocket";
1281
+ // Auto-init code for CDN/snippet mode lives in snippet-auto-init.ts
1282
+ // and is only included in the UMD build entry point (not ES/CJS).
1283
+ // This keeps sideEffects: false accurate for tree-shaking.
Binary file
Binary file
Binary file
Binary file
package/dist/recorder.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const e = require("./chunks/index-DW416eVj.js");
3
+ const e = require("./chunks/index-BQn1Q-2-.js");
4
4
  exports.DEFAULT_CAPTURE_SETTINGS = e.DEFAULT_CAPTURE_SETTINGS, exports.DEFAULT_CONSOLE_RECORDING_SETTINGS = e.DEFAULT_CONSOLE_RECORDING_SETTINGS, exports.STORAGE_VERSION = e.STORAGE_VERSION, exports.addOrUpdateMetadata = e.addOrUpdateMetadata, exports.buildBatches = e.buildBatches, exports.clearStaleFuncSpanState = e.clearStaleFuncSpanState, exports.createSkipHeadersPropagationChecker = e.createSkipHeadersPropagationChecker, exports.createTriageAndIssueFromRecorder = e.createTriageAndIssueFromRecorder, exports.createTriageFromRecorder = e.createTriageFromRecorder, exports.disableFunctionSpanTracking = e.disableFunctionSpanTracking, exports.enableFunctionSpanTracking = e.enableFunctionSpanTracking, exports.ensureHrefCache = e.ensureHrefCache, exports.eventSize = e.eventSize, exports.fetchAndSendIp = e.fetchAndSendIp, exports.fetchCaptureSettings = e.fetchCaptureSettings, exports.fetchEngineeringTicketPlatformIntegrations = e.fetchEngineeringTicketPlatformIntegrations, exports.fetchFunctionSpanTrackingEnabled = e.fetchFunctionSpanTrackingEnabled, exports.flushBufferedEvents = e.flushBufferedEvents, exports.getCachedHref = e.getCachedHref, exports.getCachedHrefNoQuery = e.getCachedHrefNoQuery, exports.getFuncSpanHeader = e.getFuncSpanHeader, exports.getOrSetSessionId = e.getOrSetSessionId, exports.getUrlAndStoredUuids = e.getUrlAndStoredUuids, exports.identify = e.identify, exports.initRecorder = e.initRecorder, exports.initializeConsolePlugin = e.initializeConsolePlugin, exports.initializeDomContentEvents = e.initializeDomContentEvents, exports.initializeFunctionSpanTrackingFromApi = e.initializeFunctionSpanTrackingFromApi, exports.initializeRecording = e.initializeRecording, exports.initializeWebSocket = e.initializeWebSocket, exports.invalidateUrlCache = e.invalidateUrlCache, exports.isFunctionSpanTrackingEnabled = e.isFunctionSpanTrackingEnabled, exports.matchUrlWithWildcard = e.matchUrlWithWildcard, Object.defineProperty(exports, "nowTimestamp", { enumerable: true, get: () => e.nowTimestamp }), exports.onNavigationChange = e.onNavigationChange, exports.openReportIssueModal = e.openReportIssueModal, exports.restoreFuncSpanState = e.restoreFuncSpanState, exports.sendDomainsToNotPropagateHeaderTo = e.sendDomainsToNotPropagateHeaderTo, exports.sendEvent = e.sendEvent, exports.sendGraphQLRequest = e.sendGraphQLRequest, exports.sendMessage = e.sendMessage, exports.startRecording = e.startRecording, exports.startRecordingSession = e.startRecordingSession, exports.trackingEvent = e.trackingEvent, exports.withAppUrlMetadata = e.withAppUrlMetadata;
Binary file
Binary file
package/dist/recorder.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, a, S, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, z, A, B, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T } from "./chunks/index-DvLh2k6O.js";
1
+ import { D, a, S, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, z, A, B, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T } from "./chunks/index-Dq_tjmkZ.js";
2
2
  export {
3
3
  D as DEFAULT_CAPTURE_SETTINGS,
4
4
  a as DEFAULT_CONSOLE_RECORDING_SETTINGS,
Binary file
Binary file