@sailfish-ai/recorder 1.10.9 → 1.10.11
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/chunks/{chunkSerializer-DdlgLmEH.js → chunkSerializer-BCPkBdRj.js} +1 -1
- package/dist/chunks/chunkSerializer-BCPkBdRj.js.br +0 -0
- package/dist/chunks/chunkSerializer-BCPkBdRj.js.gz +0 -0
- package/dist/chunks/{chunkSerializer-B_szIq8O.js → chunkSerializer-COhHoxJ2.js} +1 -1
- package/dist/chunks/chunkSerializer-COhHoxJ2.js.br +0 -0
- package/dist/chunks/chunkSerializer-COhHoxJ2.js.gz +0 -0
- package/dist/chunks/{index-B8gnDRst.js → index-2nktNgJ_.js} +394 -320
- package/dist/chunks/index-2nktNgJ_.js.br +0 -0
- package/dist/chunks/index-2nktNgJ_.js.gz +0 -0
- package/dist/chunks/{index-w2Ted1rp.js → index-DmRBuNoo.js} +292 -218
- package/dist/chunks/index-DmRBuNoo.js.br +0 -0
- package/dist/chunks/index-DmRBuNoo.js.gz +0 -0
- package/dist/frameworkDetection.js +158 -0
- package/dist/graphql.js +12 -6
- package/dist/inAppReportIssueModal/index.js +6 -6
- package/dist/index.js +13 -1
- package/dist/recorder.cjs +1 -1
- package/dist/recorder.js +1 -1
- package/dist/recorder.js.br +0 -0
- package/dist/recorder.js.gz +0 -0
- package/dist/types/frameworkDetection.d.ts +29 -0
- package/dist/types/graphql.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunks/chunkSerializer-B_szIq8O.js.br +0 -0
- package/dist/chunks/chunkSerializer-B_szIq8O.js.gz +0 -0
- package/dist/chunks/chunkSerializer-DdlgLmEH.js.br +0 -0
- package/dist/chunks/chunkSerializer-DdlgLmEH.js.gz +0 -0
- package/dist/chunks/index-B8gnDRst.js.br +0 -0
- package/dist/chunks/index-B8gnDRst.js.gz +0 -0
- package/dist/chunks/index-w2Ted1rp.js.br +0 -0
- package/dist/chunks/index-w2Ted1rp.js.gz +0 -0
|
@@ -57,7 +57,7 @@ function uuidv4() {
|
|
|
57
57
|
return ("x" === e2 ? t2 : 3 & t2 | 8).toString(16);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
const n = "X-Sf3-Rid", i = 0, o = 1, s = 2,
|
|
60
|
+
const n = "X-Sf3-Rid", i = 0, o = 1, s = 2, r = 3, a = 4, l = "recordingEvents";
|
|
61
61
|
let c = null;
|
|
62
62
|
function openDb$1() {
|
|
63
63
|
return (function hasIndexedDB$1() {
|
|
@@ -161,12 +161,12 @@ function buildBatches(e2, t2, n2) {
|
|
|
161
161
|
const o2 = [];
|
|
162
162
|
for (const e3 in i2) {
|
|
163
163
|
const s2 = i2[e3];
|
|
164
|
-
let
|
|
164
|
+
let r2 = [], a2 = 0;
|
|
165
165
|
for (const e4 of s2) {
|
|
166
166
|
const i3 = t2(e4);
|
|
167
|
-
|
|
167
|
+
a2 + i3 > n2 && (r2.length > 0 && (o2.push(r2), r2 = [], a2 = 0), i3 > n2) || (r2.push(e4), a2 += i3);
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
r2.length > 0 && o2.push(r2);
|
|
170
170
|
}
|
|
171
171
|
return o2;
|
|
172
172
|
}
|
|
@@ -178,15 +178,15 @@ function withAppUrlMetadata(e2) {
|
|
|
178
178
|
return { ...e2 ?? {}, appUrl: (e2 == null ? void 0 : e2.appUrl) ?? ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.href) };
|
|
179
179
|
}
|
|
180
180
|
exports.nowTimestamp = Date.now, /[1-9][0-9]{12}/.test(Date.now().toString()) || (exports.nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime());
|
|
181
|
-
const
|
|
181
|
+
const v = readDebugFlag(), S = "per_session";
|
|
182
182
|
let k = null, x = null, I = false, T = null, E = null, C = "", $ = "", F = false;
|
|
183
|
-
const
|
|
183
|
+
const L = [];
|
|
184
184
|
function onNavigationChange(e2) {
|
|
185
|
-
|
|
185
|
+
L.push(e2);
|
|
186
186
|
}
|
|
187
187
|
function _updateHrefCache() {
|
|
188
188
|
C = window.location.href, $ = window.location.origin + window.location.pathname;
|
|
189
|
-
for (const e2 of
|
|
189
|
+
for (const e2 of L) try {
|
|
190
190
|
e2();
|
|
191
191
|
} catch (e3) {
|
|
192
192
|
}
|
|
@@ -209,20 +209,20 @@ function getCachedHref() {
|
|
|
209
209
|
function getCachedHrefNoQuery() {
|
|
210
210
|
return $ || ("undefined" != typeof window ? window.location.origin + window.location.pathname : "");
|
|
211
211
|
}
|
|
212
|
-
const
|
|
212
|
+
const M = [];
|
|
213
213
|
let A = null;
|
|
214
214
|
function queueEventForIDB(e2) {
|
|
215
|
-
|
|
215
|
+
M.push(e2), M.length >= 50 ? _flushIDBQueue() : A || (A = setTimeout(_flushIDBQueue, 100));
|
|
216
216
|
}
|
|
217
217
|
function _flushIDBQueue() {
|
|
218
|
-
if (A && (clearTimeout(A), A = null), 0 ===
|
|
218
|
+
if (A && (clearTimeout(A), A = null), 0 === M.length) return;
|
|
219
219
|
!(async function saveEventsToIDB(e2) {
|
|
220
220
|
await withStore$1("readwrite", async (t2) => {
|
|
221
221
|
for (const n2 of e2) t2.add({ timestamp: Date.now(), data: n2 });
|
|
222
222
|
});
|
|
223
|
-
})(
|
|
223
|
+
})(M.splice(0));
|
|
224
224
|
}
|
|
225
|
-
let R = false, D = null,
|
|
225
|
+
let R = false, D = null, _ = null, P = false;
|
|
226
226
|
const B = "sailfish_funcspan_global_state";
|
|
227
227
|
function wsSendPayload(e2) {
|
|
228
228
|
if (!isWebSocketOpen(x)) return false;
|
|
@@ -254,21 +254,21 @@ function saveGlobalFuncSpanState(e2, t2) {
|
|
|
254
254
|
try {
|
|
255
255
|
if ("undefined" == typeof localStorage) return;
|
|
256
256
|
const n2 = { enabled: e2, expirationTimestampMs: t2, savedAt: Date.now() };
|
|
257
|
-
localStorage.setItem(B, JSON.stringify(n2)),
|
|
257
|
+
localStorage.setItem(B, JSON.stringify(n2)), v && console.log("[Sailfish] Saved funcSpan state to localStorage:", n2);
|
|
258
258
|
} catch (e3) {
|
|
259
|
-
|
|
259
|
+
v && console.warn("[Sailfish] Failed to save funcSpan state to localStorage:", e3);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
function clearGlobalFuncSpanState() {
|
|
263
263
|
try {
|
|
264
264
|
if ("undefined" == typeof localStorage) return;
|
|
265
|
-
localStorage.removeItem(B),
|
|
265
|
+
localStorage.removeItem(B), v && console.log("[Sailfish] Cleared funcSpan state from localStorage");
|
|
266
266
|
} catch (e2) {
|
|
267
|
-
|
|
267
|
+
v && console.warn("[Sailfish] Failed to clear funcSpan state from localStorage:", e2);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
function clearStaleFuncSpanState() {
|
|
271
|
-
R = false,
|
|
271
|
+
R = false, _ = null, P = false, clearGlobalFuncSpanState(), v && console.log("[Sailfish] Cleared stale function span tracking state (backend validation failed)");
|
|
272
272
|
}
|
|
273
273
|
let j = false;
|
|
274
274
|
function restoreFuncSpanState() {
|
|
@@ -280,14 +280,14 @@ function restoreFuncSpanState() {
|
|
|
280
280
|
const e3 = localStorage.getItem(B);
|
|
281
281
|
if (!e3) return null;
|
|
282
282
|
const t2 = JSON.parse(e3);
|
|
283
|
-
return
|
|
283
|
+
return v && console.log("[Sailfish] Loaded funcSpan state from localStorage:", t2), t2;
|
|
284
284
|
} catch (e3) {
|
|
285
|
-
return
|
|
285
|
+
return v && console.warn("[Sailfish] Failed to load funcSpan state from localStorage:", e3), null;
|
|
286
286
|
}
|
|
287
287
|
})();
|
|
288
|
-
if (e2 && e2.enabled) if (R = true,
|
|
289
|
-
Date.now() >=
|
|
290
|
-
} else
|
|
288
|
+
if (e2 && e2.enabled) if (R = true, _ = e2.expirationTimestampMs, P = false, v && console.log("[Sailfish] Restored global function span tracking from localStorage:", { enabled: true, expirationTime: _ }), null !== _) {
|
|
289
|
+
Date.now() >= _ ? (R = false, _ = null, clearGlobalFuncSpanState(), v && console.log("[Sailfish] Persisted tracking already expired, cleared state")) : v && console.log("[Sailfish] Function span tracking is active and valid (temporary until WebSocket confirms)");
|
|
290
|
+
} else v && console.log("[Sailfish] Function span tracking is active (no expiration, temporary until WebSocket confirms)");
|
|
291
291
|
}
|
|
292
292
|
function isWebSocketOpen(e2) {
|
|
293
293
|
return (e2 == null ? void 0 : e2.readyState) === WebSocket.OPEN;
|
|
@@ -345,7 +345,7 @@ function sendEvent(e2) {
|
|
|
345
345
|
e2.app_url || (e2.app_url = getCachedHref()), !I && isWebSocketOpen(x) && wsSendPayload({ type: "event", event: e2, mapUuid: window.sfMapUuid }) || queueEventForIDB(e2);
|
|
346
346
|
}
|
|
347
347
|
function handleWsOpen() {
|
|
348
|
-
|
|
348
|
+
v && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (R ? "ENABLED" : "DISABLED"))), (async () => {
|
|
349
349
|
try {
|
|
350
350
|
I = true, await flushNotifyQueue(), await flushBufferedEvents();
|
|
351
351
|
} finally {
|
|
@@ -357,42 +357,42 @@ function handleWsOpen() {
|
|
|
357
357
|
})();
|
|
358
358
|
}
|
|
359
359
|
function handleWsClose() {
|
|
360
|
-
null != E && (clearInterval(E), E = null),
|
|
360
|
+
null != E && (clearInterval(E), E = null), v && console.log("[Sailfish] WebSocket closed");
|
|
361
361
|
}
|
|
362
362
|
function handleWsMessage(e2) {
|
|
363
363
|
try {
|
|
364
364
|
const t2 = JSON.parse(e2);
|
|
365
|
-
if ("funcSpanTrackingControl" === t2.type) if (
|
|
365
|
+
if ("funcSpanTrackingControl" === t2.type) if (v && console.log("[Sailfish] Received funcSpanTrackingControl message:", { enabled: t2.enabled, timeoutSeconds: t2.timeoutSeconds, expirationTimestampMs: t2.expirationTimestampMs }), null !== D && (window.clearTimeout(D), D = null), R = t2.enabled, P = false, v && console.log("[Sailfish] Function span tracking " + (t2.enabled ? "ENABLED (GLOBAL)" : "DISABLED (GLOBAL)")), t2.enabled) {
|
|
366
366
|
if (t2.expirationTimestampMs) {
|
|
367
|
-
|
|
368
|
-
const e3 = Date.now(), n2 =
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}, n2)) : (R = false,
|
|
367
|
+
_ = t2.expirationTimestampMs;
|
|
368
|
+
const e3 = Date.now(), n2 = _ - e3;
|
|
369
|
+
v && console.log(`[Sailfish] Server expiration timestamp: ${_}, ms until expiration: ${n2}`), n2 > 0 ? (saveGlobalFuncSpanState(true, _), D = window.setTimeout(() => {
|
|
370
|
+
P || (R = false, _ = null, clearGlobalFuncSpanState(), v && console.log("[Sailfish] GLOBAL function span tracking auto-disabled at server expiration time"), wsSendPayload({ type: "funcSpanTrackingExpired", sessionId: getOrSetSessionId(), expiredAt: Date.now() }), v && console.log("[Sailfish] Notified backend that function span tracking expired"));
|
|
371
|
+
}, n2)) : (R = false, _ = null, clearGlobalFuncSpanState(), v && console.log("[Sailfish] Tracking already expired, not enabling"));
|
|
372
372
|
} else {
|
|
373
373
|
const e3 = t2.timeoutSeconds || 3600;
|
|
374
|
-
e3 > 0 && (
|
|
375
|
-
|
|
374
|
+
e3 > 0 && (_ = Date.now() + 1e3 * e3, saveGlobalFuncSpanState(true, _), D = window.setTimeout(() => {
|
|
375
|
+
P || (R = false, _ = null, clearGlobalFuncSpanState(), v && console.log(`[Sailfish] GLOBAL function span tracking auto-disabled after ${e3}s (legacy)`), wsSendPayload({ type: "funcSpanTrackingExpired", sessionId: getOrSetSessionId(), expiredAt: Date.now() }), v && console.log("[Sailfish] Notified backend that function span tracking expired (legacy timeout)"));
|
|
376
376
|
}, 1e3 * e3));
|
|
377
377
|
}
|
|
378
378
|
try {
|
|
379
379
|
const e3 = getOrSetSessionId();
|
|
380
|
-
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: e3, enabled: true, configurationType: "global" }),
|
|
380
|
+
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: e3, enabled: true, configurationType: "global" }), v && console.log(`[Sailfish] GLOBAL tracking session report sent for session: ${e3}`);
|
|
381
381
|
} catch (e3) {
|
|
382
|
-
|
|
382
|
+
v && console.warn("[Sailfish] Failed to send GLOBAL tracking session report:", e3);
|
|
383
383
|
}
|
|
384
|
-
} else
|
|
384
|
+
} else _ = null, clearGlobalFuncSpanState();
|
|
385
385
|
} catch (e3) {
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
function initializeWebSocket(t2, n2, i2, o2, s2 = false) {
|
|
389
389
|
ensureHrefCache();
|
|
390
|
-
const
|
|
390
|
+
const r2 = (function getWebSocketHost(e2) {
|
|
391
391
|
const t3 = new URL(e2);
|
|
392
392
|
return `${t3.hostname}${t3.port ? `:${t3.port}` : ""}`;
|
|
393
393
|
})(t2);
|
|
394
|
-
let
|
|
395
|
-
if (o2 && (
|
|
394
|
+
let a2 = `${"https:" === new URL(t2).protocol ? "wss" : "ws"}://${r2}/ws/notify/?apiKey=${n2}&sessionId=${i2}&sender=JS%2FTS&version=1.10.11`;
|
|
395
|
+
if (o2 && (a2 += `&envValue=${encodeURIComponent(o2)}`), k = s2 ? (function tryCreateWsWorker() {
|
|
396
396
|
if ("undefined" == typeof Worker) return null;
|
|
397
397
|
try {
|
|
398
398
|
const e2 = new Blob(['\nvar ws = null;\nvar wsUrl = "";\nvar reconnectTimer = null;\nvar reconnectDelay = 1000;\nvar MAX_RECONNECT_DELAY = 30000;\nvar CONNECTION_TIMEOUT = 30000;\nvar queue = [];\nvar MAX_QUEUE = 500;\n\nfunction enqueue(str) {\n if (queue.length >= MAX_QUEUE) queue.shift();\n queue.push(str);\n}\n\nfunction drain() {\n while (queue.length > 0) {\n if (!ws || ws.readyState !== 1) break;\n try { ws.send(queue.shift()); } catch (e) { break; }\n }\n}\n\nfunction connect() {\n if (ws && (ws.readyState === 0 || ws.readyState === 1)) return;\n try { ws = new WebSocket(wsUrl); } catch (e) { scheduleReconnect(); return; }\n var tid = setTimeout(function() { if (ws && ws.readyState === 0) ws.close(); }, CONNECTION_TIMEOUT);\n ws.onopen = function() {\n clearTimeout(tid);\n reconnectDelay = 1000;\n drain();\n postMessage({ type: "open" });\n };\n ws.onclose = function() {\n clearTimeout(tid);\n ws = null;\n postMessage({ type: "close" });\n scheduleReconnect();\n };\n ws.onerror = function() {};\n ws.onmessage = function(e) {\n postMessage({ type: "message", data: e.data });\n };\n}\n\nfunction scheduleReconnect() {\n if (reconnectTimer) return;\n reconnectTimer = setTimeout(function() {\n reconnectTimer = null;\n reconnectDelay = Math.min(reconnectDelay * 1.5, MAX_RECONNECT_DELAY);\n connect();\n }, reconnectDelay);\n}\n\nself.onmessage = function(e) {\n var msg = e.data;\n if (msg.type === "init") {\n wsUrl = msg.wsUrl;\n connect();\n } else if (msg.type === "send") {\n try {\n var s = JSON.stringify(msg.payload);\n if (ws && ws.readyState === 1) { ws.send(s); }\n else { enqueue(s); }\n } catch (e) {}\n } else if (msg.type === "sendRaw") {\n if (ws && ws.readyState === 1) {\n try { ws.send(msg.payload); } catch (e) { enqueue(msg.payload); }\n } else { enqueue(msg.payload); }\n } else if (msg.type === "close") {\n if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }\n if (ws) { ws.close(); ws = null; }\n }\n};\n'], { type: "application/javascript" }), t3 = URL.createObjectURL(e2), n3 = new Worker(t3);
|
|
@@ -408,11 +408,11 @@ function initializeWebSocket(t2, n2, i2, o2, s2 = false) {
|
|
|
408
408
|
const n3 = e3.data;
|
|
409
409
|
"open" === n3.type ? (t3.readyState = WebSocket.OPEN, handleWsOpen()) : "close" === n3.type ? (t3.readyState = WebSocket.CLOSED, handleWsClose()) : "message" === n3.type && handleWsMessage(n3.data);
|
|
410
410
|
}, k.onerror = () => {
|
|
411
|
-
|
|
412
|
-
}, k.postMessage({ type: "init", wsUrl:
|
|
411
|
+
v && console.warn("[Sailfish] WebSocket worker error");
|
|
412
|
+
}, k.postMessage({ type: "init", wsUrl: a2 }), v && console.log("[Sailfish] WebSocket running in Web Worker (off main thread)"), t3;
|
|
413
413
|
}
|
|
414
|
-
|
|
415
|
-
const l2 = new e(
|
|
414
|
+
v && console.log("[Sailfish] WebSocket running on main thread (Worker unavailable)");
|
|
415
|
+
const l2 = new e(a2, [], { connectionTimeout: 3e4 }), c2 = { get readyState() {
|
|
416
416
|
return l2.readyState;
|
|
417
417
|
}, close: () => {
|
|
418
418
|
l2.close(), null != E && (clearInterval(E), E = null);
|
|
@@ -423,50 +423,50 @@ function sendMessage(e2) {
|
|
|
423
423
|
"sessionId" in e2 || (e2.sessionId = getOrSetSessionId()), e2.app_url || (e2.app_url = getCachedHref()), I || !isWebSocketOpen(x) ? saveNotifyMessageToIDB(JSON.stringify(e2)) : wsSendPayload(e2) || saveNotifyMessageToIDB(JSON.stringify(e2));
|
|
424
424
|
}
|
|
425
425
|
function enableFunctionSpanTracking() {
|
|
426
|
-
if (
|
|
427
|
-
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: true, configurationType:
|
|
428
|
-
} else
|
|
426
|
+
if (v && console.log("[Sailfish] enableFunctionSpanTracking() called - Report Issue recording started (LOCAL MODE)"), R = true, P = true, _ = null, null !== D && (window.clearTimeout(D), D = null), isWebSocketOpen(x)) {
|
|
427
|
+
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: true, configurationType: S });
|
|
428
|
+
} else v && console.warn("[Sailfish] WebSocket not open, cannot report LOCAL tracking session");
|
|
429
429
|
}
|
|
430
430
|
function disableFunctionSpanTracking() {
|
|
431
|
-
if (
|
|
432
|
-
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: false, configurationType:
|
|
431
|
+
if (v && console.log("[Sailfish] disableFunctionSpanTracking() called - Report Issue recording stopped"), isWebSocketOpen(x)) {
|
|
432
|
+
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: false, configurationType: S });
|
|
433
433
|
} else console.warn("[FUNCSPAN STOP] ✗ WebSocket not open, cannot notify tracking end");
|
|
434
|
-
|
|
434
|
+
P && (R = false, P = false, _ = null, v && console.log("[Sailfish] LOCAL tracking mode disabled")), null !== D && (window.clearTimeout(D), D = null);
|
|
435
435
|
}
|
|
436
436
|
function isFunctionSpanTrackingEnabled() {
|
|
437
437
|
return R;
|
|
438
438
|
}
|
|
439
439
|
function initializeFunctionSpanTrackingFromApi(e2) {
|
|
440
|
-
e2 && !R ? (R = true,
|
|
440
|
+
e2 && !R ? (R = true, P = false, _ = null, v && console.log("[Sailfish] Function span tracking initialized as ENABLED from API check")) : !e2 && R && (R = false, P = false, _ = null, v && console.log("[Sailfish] Function span tracking initialized as DISABLED from API check"));
|
|
441
441
|
}
|
|
442
442
|
function getFuncSpanHeader() {
|
|
443
443
|
if (!R) return null;
|
|
444
|
-
if (null !==
|
|
445
|
-
if (Date.now() >=
|
|
444
|
+
if (null !== _) {
|
|
445
|
+
if (Date.now() >= _) return R = false, _ = null, clearGlobalFuncSpanState(), v && console.log("[Sailfish] Function span tracking expired on header check - disabling now"), null;
|
|
446
446
|
}
|
|
447
447
|
return { name: "X-Sf3-FunctionSpanCaptureOverride", value: "1-1-10-10-1-1.0-1-0-0" };
|
|
448
448
|
}
|
|
449
|
-
const
|
|
450
|
-
let
|
|
451
|
-
let
|
|
452
|
-
const
|
|
449
|
+
const O = Object.freeze(Object.defineProperty({ __proto__: null, clearStaleFuncSpanState, disableFunctionSpanTracking, enableFunctionSpanTracking, ensureHrefCache, flushBufferedEvents, getCachedHref, getCachedHrefNoQuery, getFuncSpanHeader, initializeFunctionSpanTrackingFromApi, initializeWebSocket, isFunctionSpanTrackingEnabled, onNavigationChange, restoreFuncSpanState, sendEvent, sendMessage }, Symbol.toStringTag, { value: "Module" }));
|
|
450
|
+
let z = null, U = null;
|
|
451
|
+
let N = null;
|
|
452
|
+
const q = ["https://api.ipify.org?format=json", "https://api.ip.sb/jsonip", "https://api4.my-ip.io/ip.json"];
|
|
453
453
|
function fetchAndSendIp(e2) {
|
|
454
|
-
|
|
455
|
-
for (const e3 of
|
|
454
|
+
N !== e2 && (N = e2, (async () => {
|
|
455
|
+
for (const e3 of q) try {
|
|
456
456
|
const t2 = new AbortController(), n2 = setTimeout(() => t2.abort(), 5e3), i2 = await fetch(e3, { signal: t2.signal });
|
|
457
457
|
if (clearTimeout(n2), !i2.ok) continue;
|
|
458
458
|
const o2 = await i2.json(), s2 = o2.ip || o2.origin || null;
|
|
459
459
|
if (s2 && "string" == typeof s2 && s2.length <= 45) return void sendMessage({ type: "visitorIp", ip: s2, timestamp: exports.nowTimestamp() });
|
|
460
460
|
} catch {
|
|
461
461
|
}
|
|
462
|
-
|
|
462
|
+
N = null;
|
|
463
463
|
})().catch(() => {
|
|
464
|
-
|
|
464
|
+
N = null;
|
|
465
465
|
}));
|
|
466
466
|
}
|
|
467
|
-
let
|
|
467
|
+
let H = null;
|
|
468
468
|
async function getSourceMapModule() {
|
|
469
|
-
return
|
|
469
|
+
return H || (H = await import("source-map-js")), H;
|
|
470
470
|
}
|
|
471
471
|
const W = /* @__PURE__ */ new Map(), K = /(?:\(|\s|^)(https?:\/\/[^)\s]+|\/[^)\s]+|[^)\s]+)?\/?([^/]+\.js)(?:\?[^:)]*)?:(\d+):(\d+)/;
|
|
472
472
|
async function getConsumerFor(e2, t2) {
|
|
@@ -495,8 +495,8 @@ async function captureError(e2, t2 = false) {
|
|
|
495
495
|
n3.push(e4);
|
|
496
496
|
continue;
|
|
497
497
|
}
|
|
498
|
-
const [, i3, o3, s3,
|
|
499
|
-
if (!Number.isFinite(
|
|
498
|
+
const [, i3, o3, s3, r3] = t4, a3 = parseInt(s3, 10), l2 = Math.max(0, parseInt(r3, 10) - 1);
|
|
499
|
+
if (!Number.isFinite(a3) || !Number.isFinite(l2)) {
|
|
500
500
|
n3.push(e4 + " [Invalid line/column]");
|
|
501
501
|
continue;
|
|
502
502
|
}
|
|
@@ -506,34 +506,34 @@ async function captureError(e2, t2 = false) {
|
|
|
506
506
|
continue;
|
|
507
507
|
}
|
|
508
508
|
const { SourceMapConsumer: d2 } = await getSourceMapModule();
|
|
509
|
-
let u2 = c2.originalPositionFor({ line:
|
|
510
|
-
if (!u2.source || null == u2.line) for (let e5 = 1; e5 <= 20 && (u2 = c2.originalPositionFor({ line:
|
|
509
|
+
let u2 = c2.originalPositionFor({ line: a3, column: l2, bias: d2.GREATEST_LOWER_BOUND });
|
|
510
|
+
if (!u2.source || null == u2.line) for (let e5 = 1; e5 <= 20 && (u2 = c2.originalPositionFor({ line: a3, column: Math.max(0, l2 - e5), bias: d2.GREATEST_LOWER_BOUND }), !u2.source || null == u2.line); e5++) ;
|
|
511
511
|
if (u2.source && null != u2.line) {
|
|
512
512
|
const e5 = u2.name || "anonymous";
|
|
513
513
|
n3.push(`${u2.source}:${u2.line}:${u2.column ?? 0} (${e5})`);
|
|
514
514
|
} else n3.push(`${e4} [No mapping found in ${o3}]`);
|
|
515
515
|
}
|
|
516
516
|
return n3;
|
|
517
|
-
})(i2), s2 = o2.filter((e3) => !e3.includes("chunk-") && !e3.includes("react-dom")),
|
|
518
|
-
sendMessage({ type: "event", event: { type: 6, timestamp:
|
|
517
|
+
})(i2), s2 = o2.filter((e3) => !e3.includes("chunk-") && !e3.includes("react-dom")), r2 = s2.length > 0 ? s2 : o2, a2 = Date.now();
|
|
518
|
+
sendMessage({ type: "event", event: { type: 6, timestamp: a2, data: { payload: { message: n2, stack: i2, trace: r2, filteredStack: s2, userAgent: navigator.userAgent, url: window.location.href, timestamp: a2, level: "error" } } } });
|
|
519
519
|
}
|
|
520
520
|
const G = readDebugFlag();
|
|
521
521
|
const V = readDebugFlag();
|
|
522
522
|
function sendGraphQLRequest(e2, t2, n2, i2 = 5, o2 = 2e3, s2 = 2) {
|
|
523
|
-
const
|
|
524
|
-
return V && console.log(`Initial GraphQL request for ${e2} at ${
|
|
523
|
+
const r2 = `${n2.backendApi}/graphql/?apiKey=${n2.apiKey}`;
|
|
524
|
+
return V && console.log(`Initial GraphQL request for ${e2} at ${r2}`), (function exponentialBackoff(e3, t3, n3 = 5, i3 = 2e3, o3 = 2) {
|
|
525
525
|
let s3 = 0;
|
|
526
526
|
const attemptRequest = async () => {
|
|
527
527
|
try {
|
|
528
528
|
return await e3();
|
|
529
529
|
} catch (e4) {
|
|
530
530
|
if (s3++, s3 > n3) throw e4;
|
|
531
|
-
const
|
|
532
|
-
return G && console.log(`Attempt ${s3} failed: ${t3}; Retrying in ${
|
|
531
|
+
const r3 = i3 * Math.pow(o3, s3 - 1);
|
|
532
|
+
return G && console.log(`Attempt ${s3} failed: ${t3}; Retrying in ${r3}ms...`), await new Promise((e5) => setTimeout(e5, r3)), attemptRequest();
|
|
533
533
|
}
|
|
534
534
|
};
|
|
535
535
|
return attemptRequest();
|
|
536
|
-
})(() => fetch(
|
|
536
|
+
})(() => fetch(r2, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ operationName: e2, query: t2, variables: n2 }) }).then((e3) => {
|
|
537
537
|
if (V && console.log(`Received response with status: ${e3.status}`), !e3.ok) throw new Error(`GraphQL request failed with status ${e3.status}`);
|
|
538
538
|
return e3.json();
|
|
539
539
|
}), "Sending GraphQL request to Sailfish AI", i2, o2, s2);
|
|
@@ -544,20 +544,20 @@ function fetchCaptureSettings(e2, t2) {
|
|
|
544
544
|
function fetchFunctionSpanTrackingEnabled(e2, t2) {
|
|
545
545
|
return sendGraphQLRequest("GetFunctionSpanTrackingEnabledFromApiKey", "\n query GetFunctionSpanTrackingEnabledFromApiKey($apiKey: String!) {\n isFunctionSpanTrackingEnabledFromApiKey(apiKey: $apiKey)\n }\n ", { apiKey: e2, backendApi: t2 });
|
|
546
546
|
}
|
|
547
|
-
function startRecordingSession(e2, t2, n2, i2, o2, s2,
|
|
548
|
-
return sendGraphQLRequest("StartSession", "mutation StartSession(\n $apiKey: UUID!,\n $recordingSessionId: UUID!,\n $serviceIdentifier: String!,\n $serviceVersion: String,\n $mapUuid: String,\n $gitSha: String,\n $library: String,\n $serviceAdditionalMetadata: JSON,\n $startRecordingFilePath: String,\n $startRecordingLineNumber: Int\n ) {\n startRecordingSession(\n companyApiKey: $apiKey,\n sessionId: $recordingSessionId,\n serviceIdentifier: $serviceIdentifier,\n serviceVersion: $serviceVersion,\n mapUuid: $mapUuid,\n gitSha: $gitSha,\n library: $library,\n serviceAdditionalMetadata: $serviceAdditionalMetadata,\n startRecordingFilePath: $startRecordingFilePath,\n startRecordingLineNumber: $startRecordingLineNumber\n ) {\n id\n }\n }", { apiKey: e2, recordingSessionId: t2, backendApi: n2, serviceIdentifier: i2, serviceVersion: o2, mapUuid: s2, gitSha:
|
|
547
|
+
function startRecordingSession(e2, t2, n2, i2, o2, s2, r2, a2, l2) {
|
|
548
|
+
return sendGraphQLRequest("StartSession", "mutation StartSession(\n $apiKey: UUID!,\n $recordingSessionId: UUID!,\n $serviceIdentifier: String!,\n $serviceVersion: String,\n $mapUuid: String,\n $gitSha: String,\n $library: String,\n $serviceAdditionalMetadata: JSON,\n $startRecordingFilePath: String,\n $startRecordingLineNumber: Int\n ) {\n startRecordingSession(\n companyApiKey: $apiKey,\n sessionId: $recordingSessionId,\n serviceIdentifier: $serviceIdentifier,\n serviceVersion: $serviceVersion,\n mapUuid: $mapUuid,\n gitSha: $gitSha,\n library: $library,\n serviceAdditionalMetadata: $serviceAdditionalMetadata,\n startRecordingFilePath: $startRecordingFilePath,\n startRecordingLineNumber: $startRecordingLineNumber\n ) {\n id\n }\n }", { apiKey: e2, recordingSessionId: t2, backendApi: n2, serviceIdentifier: i2, serviceVersion: o2, mapUuid: s2, gitSha: r2, library: a2, serviceAdditionalMetadata: l2, startRecordingFilePath: null, startRecordingLineNumber: null });
|
|
549
549
|
}
|
|
550
550
|
function sendDomainsToNotPropagateHeaderTo(e2, t2, n2) {
|
|
551
551
|
return sendGraphQLRequest("DomainsToNotPassHeaderTo", "mutation DomainsToNotPassHeaderTo($apiKey: String!, $domains: [String!]!) {\n domainsToNotPassHeaderTo(apiKey: $apiKey, domains: $domains)\n }", { apiKey: e2, domains: t2, backendApi: n2 });
|
|
552
552
|
}
|
|
553
|
-
function createTriageFromRecorder(e2, t2, n2, i2, o2, s2) {
|
|
554
|
-
return sendGraphQLRequest("CreateTriageFromRecorder", "mutation CreateTriageFromRecorder(\n $apiKey: String!,\n $recordingSessionId: String!,\n $timestampStart: String!,\n $timestampEnd: String!,\n $description: String\n ) {\n createTriageFromRecorder(\n apiKey: $apiKey,\n recordingSessionId: $recordingSessionId,\n timestampStart: $timestampStart,\n timestampEnd: $timestampEnd,\n description: $description\n ) {\n id\n }\n }\n ", { apiKey: e2, recordingSessionId: n2, timestampStart: i2, timestampEnd: o2, description: s2, backendApi: t2 });
|
|
553
|
+
function createTriageFromRecorder(e2, t2, n2, i2, o2, s2, r2) {
|
|
554
|
+
return sendGraphQLRequest("CreateTriageFromRecorder", "mutation CreateTriageFromRecorder(\n $apiKey: String!,\n $recordingSessionId: String!,\n $timestampStart: String!,\n $timestampEnd: String!,\n $description: String,\n $triageSource: TriageSourceEnum\n ) {\n createTriageFromRecorder(\n apiKey: $apiKey,\n recordingSessionId: $recordingSessionId,\n timestampStart: $timestampStart,\n timestampEnd: $timestampEnd,\n description: $description,\n triageSource: $triageSource\n ) {\n id\n }\n }\n ", { apiKey: e2, recordingSessionId: n2, timestampStart: i2, timestampEnd: o2, description: s2, triageSource: r2, backendApi: t2 });
|
|
555
555
|
}
|
|
556
556
|
function fetchEngineeringTicketPlatformIntegrations(e2, t2) {
|
|
557
557
|
return sendGraphQLRequest("GetEngineeringTicketPlatformIntegrationsFromApiKey", "query GetEngineeringTicketPlatformIntegrationsFromApiKey($apiKey: String!) {\n getEngineeringTicketPlatformIntegrationsFromApiKey(apiKey: $apiKey) {\n pushAutoIdentifiedIssues\n provider\n clientId\n defaultPriority\n defaultProject\n defaultTeam\n primaryCloudId\n installed\n projects\n teams\n workflowStates\n webhookState\n clouds\n labels\n sprints\n users\n fieldConfigurations\n invalidFields\n jiraReporterAccountId\n }\n }", { apiKey: e2, backendApi: t2 });
|
|
558
558
|
}
|
|
559
|
-
function createTriageAndIssueFromRecorder(e2, t2, n2, i2, o2, s2,
|
|
560
|
-
return sendGraphQLRequest("CreateTriageAndIssueFromRecorder", "mutation CreateTriageAndIssueFromRecorder(\n $apiKey: String!,\n $recordingSessionId: String!,\n $timestampStart: String!,\n $timestampEnd: String!,\n $description: String,\n $issueName: String,\n $issueDescription: String,\n $createEngineeringTicket: Boolean,\n $teamId: String,\n $projectId: String,\n $priority: Int,\n $labels: [String!],\n $issueType: String,\n $customFields: JSON\n ) {\n createTriageAndIssueFromRecorder(\n apiKey: $apiKey,\n recordingSessionId: $recordingSessionId,\n timestampStart: $timestampStart,\n timestampEnd: $timestampEnd,\n description: $description,\n issueName: $issueName,\n issueDescription: $issueDescription,\n createEngineeringTicket: $createEngineeringTicket,\n teamId: $teamId,\n projectId: $projectId,\n priority: $priority,\n labels: $labels,\n issueType: $issueType,\n customFields: $customFields\n ) {\n id\n title\n }\n }\n ", { apiKey: e2, recordingSessionId: n2, timestampStart: i2, timestampEnd: o2, description: s2, issueName:
|
|
559
|
+
function createTriageAndIssueFromRecorder(e2, t2, n2, i2, o2, s2, r2, a2, l2, c2, d2, u2, p2, f2, g2, m2) {
|
|
560
|
+
return sendGraphQLRequest("CreateTriageAndIssueFromRecorder", "mutation CreateTriageAndIssueFromRecorder(\n $apiKey: String!,\n $recordingSessionId: String!,\n $timestampStart: String!,\n $timestampEnd: String!,\n $description: String,\n $issueName: String,\n $issueDescription: String,\n $createEngineeringTicket: Boolean,\n $teamId: String,\n $projectId: String,\n $priority: Int,\n $labels: [String!],\n $issueType: String,\n $customFields: JSON,\n $triageSource: TriageSourceEnum\n ) {\n createTriageAndIssueFromRecorder(\n apiKey: $apiKey,\n recordingSessionId: $recordingSessionId,\n timestampStart: $timestampStart,\n timestampEnd: $timestampEnd,\n description: $description,\n issueName: $issueName,\n issueDescription: $issueDescription,\n createEngineeringTicket: $createEngineeringTicket,\n teamId: $teamId,\n projectId: $projectId,\n priority: $priority,\n labels: $labels,\n issueType: $issueType,\n customFields: $customFields,\n triageSource: $triageSource\n ) {\n id\n title\n }\n }\n ", { apiKey: e2, recordingSessionId: n2, timestampStart: i2, timestampEnd: o2, description: s2, issueName: r2, issueDescription: a2, createEngineeringTicket: l2, teamId: c2, projectId: d2, priority: u2, labels: p2, issueType: f2, customFields: g2, triageSource: m2, backendApi: t2 });
|
|
561
561
|
}
|
|
562
562
|
const Q = ["/node_modules/", "/@sailfish-ai/", "/@sailfish-rrweb/", "/dist/", "/webpack/", "/vite/", "/__vite", "/react-dom/", "/react/", "/scheduler/", "/<", "/chrome-extension://", "/extensions/"];
|
|
563
563
|
function shouldSkipFrame(e2) {
|
|
@@ -665,9 +665,9 @@ function initializeDomContentEvents(e2) {
|
|
|
665
665
|
}), document.addEventListener("DOMContentLoaded", () => {
|
|
666
666
|
sendEvent({ type: 24, data: { source: o }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
|
|
667
667
|
}), window.addEventListener("beforeunload", () => {
|
|
668
|
-
sendEvent({ type: 24, data: { source: a }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
|
|
669
|
-
}), window.addEventListener("unload", () => {
|
|
670
668
|
sendEvent({ type: 24, data: { source: r }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
|
|
669
|
+
}), window.addEventListener("unload", () => {
|
|
670
|
+
sendEvent({ type: 24, data: { source: a }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
|
|
671
671
|
});
|
|
672
672
|
}
|
|
673
673
|
async function initializeConsolePlugin(e2, n2) {
|
|
@@ -675,12 +675,12 @@ async function initializeConsolePlugin(e2, n2) {
|
|
|
675
675
|
await yieldToMain();
|
|
676
676
|
const { name: o2, observer: s2 } = i2(e2);
|
|
677
677
|
s2((e3) => {
|
|
678
|
-
const i3 = e3, [s3,
|
|
678
|
+
const i3 = e3, [s3, r2] = getCallerLocationFromTrace(i3 == null ? void 0 : i3.trace, 0), [a2, l2] = getCallerLocation(2), c2 = s3 ?? a2, d2 = r2 ?? l2, u2 = { ...i3, sourceFile: c2, sourceLine: d2 };
|
|
679
679
|
sendEvent({ type: t.EventType.Plugin, timestamp: Date.now(), data: { plugin: o2, payload: u2 }, sessionId: n2, ...getUrlAndStoredUuids() });
|
|
680
680
|
}, window, e2);
|
|
681
681
|
}
|
|
682
|
-
async function initializeRecording(e2, n2, i2, o2, s2,
|
|
683
|
-
const c2 = initializeWebSocket(n2, i2, o2, s2,
|
|
682
|
+
async function initializeRecording(e2, n2, i2, o2, s2, r2 = true, a2 = false, l2 = false) {
|
|
683
|
+
const c2 = initializeWebSocket(n2, i2, o2, s2, a2);
|
|
684
684
|
try {
|
|
685
685
|
const n3 = (function createThrottledEmit(e3, t2 = 1e3) {
|
|
686
686
|
if (!e3) return { emit: (e4) => sendEvent(e4), flush: () => {
|
|
@@ -713,23 +713,23 @@ async function initializeRecording(e2, n2, i2, o2, s2, a2 = true, r2 = false, l2
|
|
|
713
713
|
}
|
|
714
714
|
const { record: n4 } = await import("@sailfish-rrweb/rrweb-record-only");
|
|
715
715
|
if (J = n4, await yieldToMain(), l2) {
|
|
716
|
-
const { chunkedSnapshot: i3 } = await Promise.resolve().then(() => require("./chunkSerializer-
|
|
716
|
+
const { chunkedSnapshot: i3 } = await Promise.resolve().then(() => require("./chunkSerializer-BCPkBdRj.js")), o3 = n4.mirror;
|
|
717
717
|
let s3 = true;
|
|
718
|
-
const
|
|
718
|
+
const r3 = [];
|
|
719
719
|
n4({ emit(e3) {
|
|
720
|
-
s3 ?
|
|
720
|
+
s3 ? r3.push(e3) : emitWithContext(e3);
|
|
721
721
|
}, maskInputOptions: { text: true }, maskInputFn, maskTextClass: X, ...e2, recordDOM: false });
|
|
722
|
-
const
|
|
722
|
+
const a3 = Date.now(), l3 = await i3(document, o3, { chunkSize: 500, maxChunkMs: 16, blockClass: e2.blockClass, blockSelector: e2.blockSelector, maskTextClass: e2.maskTextClass ?? X, maskTextSelector: e2.maskTextSelector });
|
|
723
723
|
if (l3) {
|
|
724
|
-
emitWithContext({ type: t.EventType.Meta, data: { href: window.location.href, width: document.documentElement.clientWidth || document.body.clientWidth, height: document.documentElement.clientHeight || document.body.clientHeight }, timestamp:
|
|
725
|
-
for (const e3 of
|
|
724
|
+
emitWithContext({ type: t.EventType.Meta, data: { href: window.location.href, width: document.documentElement.clientWidth || document.body.clientWidth, height: document.documentElement.clientHeight || document.body.clientHeight }, timestamp: a3 }), emitWithContext({ type: t.EventType.FullSnapshot, data: { node: l3, initialOffset: { left: void 0 !== window.pageXOffset ? window.pageXOffset : document.documentElement.scrollLeft, top: void 0 !== window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop } }, timestamp: a3 });
|
|
725
|
+
for (const e3 of r3) emitWithContext(e3);
|
|
726
726
|
s3 = false;
|
|
727
727
|
} else console.warn("[Sailfish] chunkSnapshot serialization failed; session continues without initial DOM snapshot"), s3 = false;
|
|
728
728
|
} else n4({ emit(e3) {
|
|
729
729
|
emitWithContext(e3);
|
|
730
730
|
}, maskInputOptions: { text: true }, maskInputFn, maskTextClass: X, ...e2 });
|
|
731
731
|
};
|
|
732
|
-
if (
|
|
732
|
+
if (r2) {
|
|
733
733
|
let e3 = false;
|
|
734
734
|
const startOnce = () => {
|
|
735
735
|
e3 || (e3 = true, startHeavyWork());
|
|
@@ -774,9 +774,71 @@ async function initializeRecording(e2, n2, i2, o2, s2, a2 = true, r2 = false, l2
|
|
|
774
774
|
}
|
|
775
775
|
return c2;
|
|
776
776
|
}
|
|
777
|
-
const se = [
|
|
777
|
+
const se = [(e2) => (function checkNextJs() {
|
|
778
|
+
try {
|
|
779
|
+
if (void 0 !== globalThis.__NEXT_DATA__) return "nextjs";
|
|
780
|
+
} catch {
|
|
781
|
+
}
|
|
782
|
+
return null;
|
|
783
|
+
})(), (e2) => (function checkNuxt() {
|
|
784
|
+
try {
|
|
785
|
+
if (void 0 !== globalThis.__NUXT__) return "nuxt";
|
|
786
|
+
} catch {
|
|
787
|
+
}
|
|
788
|
+
return null;
|
|
789
|
+
})(), function checkReact(e2) {
|
|
790
|
+
try {
|
|
791
|
+
if (void 0 !== globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__) return "react";
|
|
792
|
+
} catch {
|
|
793
|
+
}
|
|
794
|
+
if (e2) try {
|
|
795
|
+
if (document.querySelector("[data-reactroot]")) return "react";
|
|
796
|
+
} catch {
|
|
797
|
+
}
|
|
798
|
+
return null;
|
|
799
|
+
}, function checkVue(e2) {
|
|
800
|
+
try {
|
|
801
|
+
if (void 0 !== globalThis.__VUE__) return "vue";
|
|
802
|
+
} catch {
|
|
803
|
+
}
|
|
804
|
+
if (e2) try {
|
|
805
|
+
if (document.querySelector("[data-v-]") || document.querySelector("*[class*='data-v-']")) return "vue";
|
|
806
|
+
const e3 = document.querySelectorAll("*");
|
|
807
|
+
for (let t2 = 0; t2 < Math.min(e3.length, 200); t2++) {
|
|
808
|
+
const n2 = e3[t2];
|
|
809
|
+
for (let e4 = 0; e4 < n2.attributes.length; e4++) if (n2.attributes[e4].name.startsWith("data-v-")) return "vue";
|
|
810
|
+
}
|
|
811
|
+
} catch {
|
|
812
|
+
}
|
|
813
|
+
return null;
|
|
814
|
+
}, function checkAngular(e2) {
|
|
815
|
+
try {
|
|
816
|
+
const e3 = globalThis;
|
|
817
|
+
if (void 0 !== e3.ng && "object" == typeof e3.ng) return "angular";
|
|
818
|
+
if (void 0 !== e3.getAllAngularRootElements) return "angular";
|
|
819
|
+
} catch {
|
|
820
|
+
}
|
|
821
|
+
if (e2) try {
|
|
822
|
+
if (document.querySelector("[ng-version]")) return "angular";
|
|
823
|
+
} catch {
|
|
824
|
+
}
|
|
825
|
+
return null;
|
|
826
|
+
}, function checkSvelte(e2) {
|
|
827
|
+
try {
|
|
828
|
+
const e3 = globalThis;
|
|
829
|
+
if (void 0 !== e3.__SVELTE_HMR) return "svelte";
|
|
830
|
+
if (void 0 !== e3.__svelte) return "svelte";
|
|
831
|
+
} catch {
|
|
832
|
+
}
|
|
833
|
+
if (e2) try {
|
|
834
|
+
if (document.querySelector('[class^="svelte-"], [class*=" svelte-"]')) return "svelte";
|
|
835
|
+
} catch {
|
|
836
|
+
}
|
|
837
|
+
return null;
|
|
838
|
+
}];
|
|
839
|
+
const re = ["jira", "linear", "zendesk"];
|
|
778
840
|
let ae = null;
|
|
779
|
-
const
|
|
841
|
+
const le = /* @__PURE__ */ new Map();
|
|
780
842
|
function getIntegrationData() {
|
|
781
843
|
return ae;
|
|
782
844
|
}
|
|
@@ -788,14 +850,14 @@ function resolveIntegration(e2) {
|
|
|
788
850
|
if ((e2 == null ? void 0 : e2.errors) && e2.errors.length > 0) return console.error("GraphQL errors fetching integrations:", e2.errors), null;
|
|
789
851
|
const t2 = (_a = e2 == null ? void 0 : e2.data) == null ? void 0 : _a.getEngineeringTicketPlatformIntegrationsFromApiKey, n2 = (t2 || []).filter((e3) => {
|
|
790
852
|
var _a2;
|
|
791
|
-
return
|
|
853
|
+
return re.includes(((_a2 = e3.provider) == null ? void 0 : _a2.toLowerCase()) || "") && true === e3.installed;
|
|
792
854
|
});
|
|
793
855
|
if (0 === n2.length) return console.warn("No valid installed integrations found"), null;
|
|
794
856
|
const i2 = n2.find((e3) => {
|
|
795
857
|
var _a2;
|
|
796
858
|
return "jira" === ((_a2 = e3.provider) == null ? void 0 : _a2.toLowerCase());
|
|
797
859
|
}) || n2[0];
|
|
798
|
-
return (i2 == null ? void 0 : i2.primaryCloudId) &&
|
|
860
|
+
return (i2 == null ? void 0 : i2.primaryCloudId) && le.set(i2.primaryCloudId, i2), i2;
|
|
799
861
|
}
|
|
800
862
|
async function refreshIntegrationData(e2, t2) {
|
|
801
863
|
try {
|
|
@@ -906,31 +968,31 @@ function updateFormWithIntegrationData(e2) {
|
|
|
906
968
|
}
|
|
907
969
|
const o2 = document.getElementById("sf-eng-ticket-priority");
|
|
908
970
|
o2 && (populatePriorityOptions(o2, ae.provider || "", ae.defaultPriority), e2.engTicketPriority ? o2.value = String(e2.engTicketPriority) : e2.engTicketPriority = Number(o2.value));
|
|
909
|
-
const s2 = document.getElementById("sf-eng-ticket-sprint"),
|
|
910
|
-
s2 &&
|
|
911
|
-
const
|
|
912
|
-
return
|
|
971
|
+
const s2 = document.getElementById("sf-eng-ticket-sprint"), r2 = "jira" === ((_a = ae.provider) == null ? void 0 : _a.toLowerCase());
|
|
972
|
+
s2 && r2 && ae.sprints && populateSprintOptions(s2, ae.sprints, e2.engTicketSprint || void 0);
|
|
973
|
+
const a2 = document.getElementById("sf-eng-ticket-type");
|
|
974
|
+
return a2 && r2 && e2.engTicketProject && (updateIssueTypeOptions(a2, e2.engTicketProject), e2.engTicketIssueType ? (a2.value = e2.engTicketIssueType, a2.style.color = "#000") : a2.value && (e2.engTicketIssueType = a2.value)), e2;
|
|
913
975
|
}
|
|
914
|
-
const
|
|
976
|
+
const ce = Object.freeze(Object.defineProperty({ __proto__: null, fetchIntegrationData: async function fetchIntegrationData(e2, t2) {
|
|
915
977
|
if (!ae) try {
|
|
916
978
|
const n2 = await fetchEngineeringTicketPlatformIntegrations(e2, t2);
|
|
917
979
|
ae = resolveIntegration(n2);
|
|
918
980
|
} catch (e3) {
|
|
919
981
|
console.error("Error fetching integration data:", e3), ae = null;
|
|
920
982
|
}
|
|
921
|
-
}, getFieldsForProject, getIntegrationData, getProjectsForTeam, getSprintFieldId, getUsers, hasValidIntegration, populatePriorityOptions, populateSelectOptions, populateSprintOptions, refreshIntegrationData, updateFormWithIntegrationData, updateIssueTypeOptions }, Symbol.toStringTag, { value: "Module" })),
|
|
983
|
+
}, getFieldsForProject, getIntegrationData, getProjectsForTeam, getSprintFieldId, getUsers, hasValidIntegration, populatePriorityOptions, populateSelectOptions, populateSprintOptions, refreshIntegrationData, updateFormWithIntegrationData, updateIssueTypeOptions }, Symbol.toStringTag, { value: "Module" })), de = "sf-create-issue-preference", ue = "sf-create-eng-ticket-preference";
|
|
922
984
|
function getInitialState() {
|
|
923
985
|
const e2 = (function loadUserPreferences() {
|
|
924
|
-
return { createIssue: g && "true" === localStorage.getItem(
|
|
986
|
+
return { createIssue: g && "true" === localStorage.getItem(de), createEngTicket: g && "true" === localStorage.getItem(ue) };
|
|
925
987
|
})();
|
|
926
988
|
return { mode: "lookback", description: "", occurredInThisTab: true, createIssue: e2.createIssue, issueName: "", issueDescription: "", createEngTicket: e2.createEngTicket, engTicketTeam: "", engTicketProject: "", engTicketPriority: 0, engTicketLabels: [], engTicketSprint: "", engTicketIssueType: "", engTicketCustomFields: {} };
|
|
927
989
|
}
|
|
928
|
-
let
|
|
990
|
+
let pe = getInitialState(), fe = null, ge = null, me = null, he = false;
|
|
929
991
|
function setTimerInterval(e2) {
|
|
930
|
-
|
|
992
|
+
me = e2;
|
|
931
993
|
}
|
|
932
994
|
function setIsRecording(e2) {
|
|
933
|
-
|
|
995
|
+
he = e2;
|
|
934
996
|
}
|
|
935
997
|
function renderCustomMultiSelect(e2, t2, n2, i2, o2 = false) {
|
|
936
998
|
return `
|
|
@@ -965,9 +1027,9 @@ function renderCustomMultiSelect(e2, t2, n2, i2, o2 = false) {
|
|
|
965
1027
|
</div>
|
|
966
1028
|
`;
|
|
967
1029
|
}
|
|
968
|
-
const
|
|
1030
|
+
const ye = { enabled: false, openModalExistingMode: { key: "e", requireCmdCtrl: false }, openModalCaptureNewMode: { key: "n", requireCmdCtrl: false }, closeModal: { key: "escape", requireCmdCtrl: false }, submitReport: { key: "enter", requireCmdCtrl: true }, startRecording: { key: "r", requireCmdCtrl: false }, stopRecording: { key: "escape", requireCmdCtrl: true } }, be = { shortcuts: { ...ye }, resolveSessionId: null, apiKey: null, backendApi: null, triageBaseUrl: "https://app.sailfishqa.com", deactivateIsolation: () => {
|
|
969
1031
|
}, integrationData: null, showEngTicketFieldsDefault: false };
|
|
970
|
-
let
|
|
1032
|
+
let we = null, ve = false;
|
|
971
1033
|
function setupCustomMultiSelectListeners(e2, t2) {
|
|
972
1034
|
const n2 = document.getElementById(`${e2}-container`), i2 = document.getElementById(`${e2}-dropdown`);
|
|
973
1035
|
if (!n2 || !i2) return;
|
|
@@ -990,10 +1052,10 @@ function setupCustomMultiSelectListeners(e2, t2) {
|
|
|
990
1052
|
n3.stopPropagation();
|
|
991
1053
|
const o3 = e4.dataset.value || "", s3 = i2.querySelector(`.sf-multiselect-option[data-value="${o3}"]`);
|
|
992
1054
|
s3 && (s3.dataset.selected = "false", s3.style.backgroundColor = ""), updateChipsDisplay();
|
|
993
|
-
const
|
|
1055
|
+
const r2 = [];
|
|
994
1056
|
i2.querySelectorAll(".sf-multiselect-option").forEach((e5) => {
|
|
995
|
-
"true" === e5.dataset.selected &&
|
|
996
|
-
}), t2(
|
|
1057
|
+
"true" === e5.dataset.selected && r2.push(e5.dataset.value || "");
|
|
1058
|
+
}), t2(r2);
|
|
997
1059
|
});
|
|
998
1060
|
})), e3;
|
|
999
1061
|
}
|
|
@@ -1018,12 +1080,12 @@ function renderDynamicFields(e2, t2) {
|
|
|
1018
1080
|
if (!i2 || 0 === i2.length) return void (n2.innerHTML = "");
|
|
1019
1081
|
const s2 = i2.map((e3) => (function renderDynamicField(e4, t3, n3 = []) {
|
|
1020
1082
|
var _a, _b, _c, _d;
|
|
1021
|
-
const i3 = e4.fieldId || e4.key, o3 = e4.name, s3 = (_a = e4.schema) == null ? void 0 : _a.type,
|
|
1022
|
-
if (d2.includes(i3) || d2.includes(
|
|
1083
|
+
const i3 = e4.fieldId || e4.key, o3 = e4.name, s3 = (_a = e4.schema) == null ? void 0 : _a.type, r2 = (_b = e4.schema) == null ? void 0 : _b.system, a2 = (_c = e4.schema) == null ? void 0 : _c.custom, l2 = e4.required || false, c2 = e4.allowedValues, d2 = ["summary", "description", "project", "issuetype", "priority"];
|
|
1084
|
+
if (d2.includes(i3) || d2.includes(r2)) return null;
|
|
1023
1085
|
const u2 = l2 ? '<span style="color:#ef4444;">*</span>' : "", p2 = "width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none;";
|
|
1024
1086
|
switch (s3) {
|
|
1025
1087
|
case "string":
|
|
1026
|
-
return
|
|
1088
|
+
return a2 && a2.includes("textarea") ? `
|
|
1027
1089
|
<div>
|
|
1028
1090
|
<label for="${i3}" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">
|
|
1029
1091
|
${o3} ${u2}
|
|
@@ -1141,7 +1203,7 @@ function renderDynamicFields(e2, t2) {
|
|
|
1141
1203
|
}
|
|
1142
1204
|
return null;
|
|
1143
1205
|
case "array":
|
|
1144
|
-
return "labels" ===
|
|
1206
|
+
return "labels" === r2 ? null : c2 && c2.length > 0 ? renderCustomMultiSelect(i3, o3, c2, Array.isArray(t3) ? t3 : [], l2) : null;
|
|
1145
1207
|
case "parent":
|
|
1146
1208
|
case "issuelink":
|
|
1147
1209
|
return `
|
|
@@ -1180,22 +1242,22 @@ function renderDynamicFields(e2, t2) {
|
|
|
1180
1242
|
</div>
|
|
1181
1243
|
` : null;
|
|
1182
1244
|
}
|
|
1183
|
-
})(e3,
|
|
1245
|
+
})(e3, pe.engTicketCustomFields[e3.fieldId || e3.key], o2)).filter(Boolean).join("");
|
|
1184
1246
|
n2.innerHTML = s2 || "", i2.forEach((e3) => {
|
|
1185
1247
|
var _a;
|
|
1186
1248
|
const t3 = e3.fieldId || e3.key, n3 = (_a = e3.schema) == null ? void 0 : _a.type, i3 = e3.allowedValues;
|
|
1187
1249
|
"array" === n3 && i3 && i3.length > 0 && setupCustomMultiSelectListeners(t3, (e4) => {
|
|
1188
|
-
|
|
1250
|
+
pe.engTicketCustomFields[t3] = e4;
|
|
1189
1251
|
});
|
|
1190
1252
|
});
|
|
1191
1253
|
}
|
|
1192
1254
|
function generateEngTicketFieldsHTML() {
|
|
1193
1255
|
var _a;
|
|
1194
|
-
const e2 =
|
|
1256
|
+
const e2 = be.integrationData;
|
|
1195
1257
|
if (!e2) return "";
|
|
1196
1258
|
const t2 = "jira" === ((_a = e2.provider) == null ? void 0 : _a.toLowerCase());
|
|
1197
1259
|
let n2 = "<div style='display:flex; flex-direction:column; gap:12px;'>";
|
|
1198
|
-
return e2.teams && Array.isArray(e2.teams) && e2.teams.length > 0 && (n2 += '\n <div>\n <label for="sf-eng-ticket-team" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Team\n </label>\n <select id="sf-eng-ticket-team"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select team...</option>\n </select>\n </div>\n '), n2 += '\n <div>\n <label for="sf-eng-ticket-project" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Project\n </label>\n <select id="sf-eng-ticket-project"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select project...</option>\n </select>\n </div>\n ', t2 && (n2 += '\n <div>\n <label for="sf-eng-ticket-type" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Issue Type\n </label>\n <select id="sf-eng-ticket-type"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select project first...</option>\n </select>\n </div>\n '), n2 += '\n <div>\n <label for="sf-eng-ticket-priority" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Priority\n </label>\n <select id="sf-eng-ticket-priority"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white;">\n </select>\n </div>\n ', e2.labels && Array.isArray(e2.labels) && e2.labels.length > 0 && (n2 += renderCustomMultiSelect("sf-eng-ticket-labels", "Labels", e2.labels,
|
|
1260
|
+
return e2.teams && Array.isArray(e2.teams) && e2.teams.length > 0 && (n2 += '\n <div>\n <label for="sf-eng-ticket-team" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Team\n </label>\n <select id="sf-eng-ticket-team"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select team...</option>\n </select>\n </div>\n '), n2 += '\n <div>\n <label for="sf-eng-ticket-project" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Project\n </label>\n <select id="sf-eng-ticket-project"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select project...</option>\n </select>\n </div>\n ', t2 && (n2 += '\n <div>\n <label for="sf-eng-ticket-type" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Issue Type\n </label>\n <select id="sf-eng-ticket-type"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select project first...</option>\n </select>\n </div>\n '), n2 += '\n <div>\n <label for="sf-eng-ticket-priority" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Priority\n </label>\n <select id="sf-eng-ticket-priority"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white;">\n </select>\n </div>\n ', e2.labels && Array.isArray(e2.labels) && e2.labels.length > 0 && (n2 += renderCustomMultiSelect("sf-eng-ticket-labels", "Labels", e2.labels, pe.engTicketLabels, false)), t2 && e2.sprints && Array.isArray(e2.sprints) && e2.sprints.length > 0 && (n2 += '\n <div>\n <label for="sf-eng-ticket-sprint" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Sprint\n </label>\n <select id="sf-eng-ticket-sprint"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select sprint...</option>\n </select>\n </div>\n '), n2 += '\n <div id="sf-dynamic-fields-container" style="display: flex; flex-direction: column; gap: 12px;"></div>\n ', n2 += "</div>", n2;
|
|
1199
1261
|
}
|
|
1200
1262
|
function getShortcutKeyCmdCtrlLabel() {
|
|
1201
1263
|
return (function isMacPlatform() {
|
|
@@ -1209,19 +1271,19 @@ function getShortcutLabelFromContext(e2) {
|
|
|
1209
1271
|
return e3.requireCmdCtrl && t2.push(getShortcutKeyCmdCtrlLabel()), t2.push((function formatShortcutKeyLabel(e4) {
|
|
1210
1272
|
return ({ escape: "esc" }[e4.toLowerCase()] || e4).toUpperCase();
|
|
1211
1273
|
})(e3.key)), t2.map((e4) => `<span style="background: #F1F5F9; border:1px solid #cbd5e1; border-radius: 4px; padding: 0 4px; font-weight: 500; font-size: 12px; color: #94A3B8; line-height: 16px;">${e4}</span>`).join(e3.requireCmdCtrl ? " + " : "");
|
|
1212
|
-
})(
|
|
1274
|
+
})(be.shortcuts[e2]);
|
|
1213
1275
|
}
|
|
1214
1276
|
function getSessionIdSafely() {
|
|
1215
|
-
if (!
|
|
1216
|
-
return
|
|
1277
|
+
if (!be.resolveSessionId) throw new Error("getSessionId not defined");
|
|
1278
|
+
return be.resolveSessionId();
|
|
1217
1279
|
}
|
|
1218
1280
|
function openReportIssueModal(e2) {
|
|
1219
|
-
|
|
1281
|
+
he ? stopRecording() : (ve = (e2 == null ? void 0 : e2.showEngTicketFields) ?? be.showEngTicketFieldsDefault, injectModalHTML(), we && document.body.appendChild(we));
|
|
1220
1282
|
}
|
|
1221
1283
|
function closeModal() {
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
})(),
|
|
1284
|
+
be.deactivateIsolation(), document.activeElement instanceof HTMLElement && document.activeElement.blur(), (we == null ? void 0 : we.parentNode) && we.parentNode.removeChild(we), we = null, he || (function resetState() {
|
|
1285
|
+
pe = getInitialState(), fe = null, ge = null;
|
|
1286
|
+
})(), me && (clearInterval(me), setTimerInterval(null));
|
|
1225
1287
|
}
|
|
1226
1288
|
function activateModalIsolation(e2) {
|
|
1227
1289
|
e2.setAttribute("role", "dialog"), e2.setAttribute("aria-modal", "true"), e2.hasAttribute("tabindex") || e2.setAttribute("tabindex", "-1");
|
|
@@ -1238,10 +1300,10 @@ function activateModalIsolation(e2) {
|
|
|
1238
1300
|
n3 && (e2.contains(n3) || (t3.stopImmediatePropagation(), t3.preventDefault(), refocus()));
|
|
1239
1301
|
}, o2 = ["mousedown", "mouseup", "click", "pointerdown", "pointerup", "touchstart", "touchend", "wheel", "keydown", "keyup", "focus", "focusin", "focusout", "blur"];
|
|
1240
1302
|
o2.forEach((e3) => document.addEventListener(e3, quarantine, true));
|
|
1241
|
-
let s2 = 0,
|
|
1242
|
-
const
|
|
1243
|
-
if ((e2.querySelector(":focus") ||
|
|
1244
|
-
|
|
1303
|
+
let s2 = 0, r2 = null;
|
|
1304
|
+
const a2 = t2 instanceof HTMLTextAreaElement ? t2 : null, refocus = () => {
|
|
1305
|
+
if ((e2.querySelector(":focus") || a2 || t2 || e2).focus({ preventScroll: true }), a2 && document.activeElement === a2 && r2) try {
|
|
1306
|
+
a2.setSelectionRange(r2.start, r2.end, "none");
|
|
1245
1307
|
} catch {
|
|
1246
1308
|
}
|
|
1247
1309
|
}, selectionInsideModal = () => {
|
|
@@ -1258,8 +1320,8 @@ function activateModalIsolation(e2) {
|
|
|
1258
1320
|
const watchdog = () => {
|
|
1259
1321
|
const t3 = document.activeElement, n3 = t3 === document.body || null == t3 || !e2.contains(t3), i3 = selectionInsideModal();
|
|
1260
1322
|
n3 && !i3 ? (l2 += 1, l2 >= 2 && (refocus(), l2 = 0)) : (l2 = 0, (() => {
|
|
1261
|
-
if (
|
|
1262
|
-
|
|
1323
|
+
if (a2 && document.activeElement === a2) try {
|
|
1324
|
+
r2 = { start: a2.selectionStart ?? a2.value.length, end: a2.selectionEnd ?? a2.value.length };
|
|
1263
1325
|
} catch {
|
|
1264
1326
|
}
|
|
1265
1327
|
})()), s2 = window.requestAnimationFrame(watchdog);
|
|
@@ -1280,9 +1342,9 @@ function activateModalIsolation(e2) {
|
|
|
1280
1342
|
};
|
|
1281
1343
|
}
|
|
1282
1344
|
function injectModalHTML(e2 = "lookback") {
|
|
1283
|
-
|
|
1345
|
+
we && (we.remove(), we = null), we = document.createElement("div"), we.id = "sf-report-issue-modal";
|
|
1284
1346
|
const t2 = "startnow" === e2;
|
|
1285
|
-
|
|
1347
|
+
we.innerHTML = `
|
|
1286
1348
|
<div style="position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:9998;"></div>
|
|
1287
1349
|
<div style="position:fixed; top:50%; left:50%; transform:translate(-50%, -50%);
|
|
1288
1350
|
background:#fff; border-radius:12px;
|
|
@@ -1337,7 +1399,7 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1337
1399
|
<textarea id="sf-issue-description" placeholder="Add description here"
|
|
1338
1400
|
style="width:100%; height:80px; padding:8px 12px; font-size:14px;
|
|
1339
1401
|
border:1px solid #cbd5e1; border-radius:6px; margin-bottom:20px;
|
|
1340
|
-
resize:none; outline:none;">${
|
|
1402
|
+
resize:none; outline:none;">${pe.description}</textarea>
|
|
1341
1403
|
|
|
1342
1404
|
<!-- When did this happen Section -->
|
|
1343
1405
|
<div id="sf-lookback-container" style="display:${t2 ? "none" : "block"}; margin-bottom:20px;">
|
|
@@ -1403,34 +1465,34 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1403
1465
|
<!-- Checkboxes on same line -->
|
|
1404
1466
|
<div style="display:flex; align-items:center; gap:24px; margin-bottom:16px;">
|
|
1405
1467
|
<label style="display:flex; align-items:center; gap:8px; font-size:14px; font-weight:500; cursor:pointer;">
|
|
1406
|
-
<input type="checkbox" id="sf-create-issue-checkbox" ${
|
|
1468
|
+
<input type="checkbox" id="sf-create-issue-checkbox" ${pe.createIssue ? "checked" : ""}
|
|
1407
1469
|
style="width:16px; height:16px; accent-color:#295DBF; cursor:pointer;">
|
|
1408
1470
|
Create an Issue
|
|
1409
1471
|
</label>
|
|
1410
1472
|
|
|
1411
|
-
<label id="sf-create-eng-ticket-label" style="display:${
|
|
1412
|
-
<input type="checkbox" id="sf-create-eng-ticket-checkbox" ${
|
|
1473
|
+
<label id="sf-create-eng-ticket-label" style="display:${be.integrationData && ve ? "flex" : "none"}; align-items:center; gap:8px; font-size:14px; font-weight:500; cursor:pointer;">
|
|
1474
|
+
<input type="checkbox" id="sf-create-eng-ticket-checkbox" ${pe.createEngTicket ? "checked" : ""}
|
|
1413
1475
|
style="width:16px; height:16px; accent-color:#295DBF; cursor:pointer;">
|
|
1414
1476
|
Create an Eng Ticket
|
|
1415
1477
|
</label>
|
|
1416
1478
|
</div>
|
|
1417
1479
|
|
|
1418
1480
|
<!-- Issue Title Field (always shown when create issue is checked) -->
|
|
1419
|
-
<div id="sf-issue-fields-container" style="display:${
|
|
1481
|
+
<div id="sf-issue-fields-container" style="display:${pe.createIssue ? "block" : "none"};">
|
|
1420
1482
|
<div style="display:flex; flex-direction:column; gap:12px;">
|
|
1421
1483
|
<div>
|
|
1422
1484
|
<label for="sf-issue-name" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">
|
|
1423
1485
|
Title <span style="color:#ef4444;">*</span>
|
|
1424
1486
|
</label>
|
|
1425
1487
|
<input type="text" id="sf-issue-name" placeholder="Enter title"
|
|
1426
|
-
value="${
|
|
1488
|
+
value="${pe.issueName}"
|
|
1427
1489
|
style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none;">
|
|
1428
1490
|
</div>
|
|
1429
1491
|
</div>
|
|
1430
1492
|
</div>
|
|
1431
1493
|
|
|
1432
1494
|
<!-- Engineering Ticket Fields (shown when create eng ticket is checked) -->
|
|
1433
|
-
<div id="sf-eng-ticket-fields-container" style="display:${
|
|
1495
|
+
<div id="sf-eng-ticket-fields-container" style="display:${pe.createEngTicket && be.integrationData ? "block" : "none"}; margin-top: ${pe.createIssue ? "12px" : "0"};">
|
|
1434
1496
|
${generateEngTicketFieldsHTML()}
|
|
1435
1497
|
</div>
|
|
1436
1498
|
</div>
|
|
@@ -1473,8 +1535,8 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1473
1535
|
</div>
|
|
1474
1536
|
</div>
|
|
1475
1537
|
</div>
|
|
1476
|
-
`,
|
|
1477
|
-
const e3 =
|
|
1538
|
+
`, pe.mode = e2, document.body.appendChild(we), (function bindListeners() {
|
|
1539
|
+
const e3 = we == null ? void 0 : we.querySelectorAll(".sf-issue-tab"), t3 = document.getElementById("sf-start-recording-btn"), n2 = document.getElementById("sf-modal-close-btn"), i2 = document.getElementById("sf-issue-submit-btn"), o2 = document.getElementById("sf-lookback-minutes");
|
|
1478
1540
|
e3 == null ? void 0 : e3.forEach((e4) => {
|
|
1479
1541
|
e4.addEventListener("click", (e5) => {
|
|
1480
1542
|
const t4 = e5.currentTarget.dataset.mode;
|
|
@@ -1482,9 +1544,9 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1482
1544
|
});
|
|
1483
1545
|
}), n2 && (n2.onclick = closeModal);
|
|
1484
1546
|
o2 && o2.addEventListener("change", () => {
|
|
1485
|
-
"lookback" ===
|
|
1547
|
+
"lookback" === pe.mode && (i2.disabled = false, i2.style.opacity = "1", i2.style.cursor = "pointer");
|
|
1486
1548
|
});
|
|
1487
|
-
const s2 =
|
|
1549
|
+
const s2 = we == null ? void 0 : we.querySelectorAll(".sf-collapsible-header");
|
|
1488
1550
|
s2 == null ? void 0 : s2.forEach((e4) => {
|
|
1489
1551
|
e4.addEventListener("click", (e5) => {
|
|
1490
1552
|
const t4 = e5.currentTarget, n3 = t4.dataset.target, i3 = document.getElementById(n3), o3 = t4.querySelector(".sf-chevron");
|
|
@@ -1496,20 +1558,20 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1496
1558
|
}
|
|
1497
1559
|
});
|
|
1498
1560
|
});
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
const e4 =
|
|
1502
|
-
|
|
1561
|
+
const r2 = document.getElementById("sf-create-issue-checkbox"), a2 = document.getElementById("sf-issue-fields-container"), l2 = document.getElementById("sf-create-eng-ticket-checkbox"), c2 = document.getElementById("sf-eng-ticket-fields-container");
|
|
1562
|
+
r2 && r2.addEventListener("change", () => {
|
|
1563
|
+
const e4 = r2.checked;
|
|
1564
|
+
pe.createIssue = e4, localStorage.setItem(de, String(e4)), a2 && (a2.style.display = e4 ? "block" : "none"), !e4 && l2 && (l2.checked = false, pe.createEngTicket = false, localStorage.setItem(ue, "false"), c2 && (c2.style.display = "none"));
|
|
1503
1565
|
});
|
|
1504
1566
|
l2 && l2.addEventListener("change", async () => {
|
|
1505
1567
|
var _a;
|
|
1506
1568
|
const e4 = l2.checked;
|
|
1507
|
-
if (
|
|
1508
|
-
if (!hasValidIntegration()) return l2.checked = false,
|
|
1569
|
+
if (pe.createEngTicket = e4, localStorage.setItem(ue, String(e4)), e4 && !pe.createIssue && (pe.createIssue = true, localStorage.setItem(de, "true"), r2 && (r2.checked = true), a2 && (a2.style.display = "block")), c2 && (c2.style.display = e4 ? "block" : "none"), e4) {
|
|
1570
|
+
if (!hasValidIntegration()) return l2.checked = false, pe.createEngTicket = false, localStorage.setItem(ue, "false"), c2 && (c2.style.display = "none"), void alert("No engineering ticket integration found. Please install and configure an integration (Jira, Linear, or Zendesk) first.");
|
|
1509
1571
|
const e5 = getIntegrationData();
|
|
1510
1572
|
if (e5) {
|
|
1511
|
-
if (!
|
|
1512
|
-
getFieldsForProject(
|
|
1573
|
+
if (!pe.engTicketTeam && e5.defaultTeam && (pe.engTicketTeam = e5.defaultTeam), !pe.engTicketProject && e5.defaultProject && (pe.engTicketProject = e5.defaultProject), !pe.engTicketPriority && e5.defaultPriority && (pe.engTicketPriority = e5.defaultPriority), updateFormWithIntegrationData(pe), "jira" === ((_a = e5.provider) == null ? void 0 : _a.toLowerCase()) && e5.jiraReporterAccountId && pe.engTicketProject) {
|
|
1574
|
+
getFieldsForProject(pe.engTicketProject, pe.engTicketIssueType).find((e6) => "reporter" === e6.fieldId) && !pe.engTicketCustomFields.reporter && (pe.engTicketCustomFields.reporter = e5.jiraReporterAccountId);
|
|
1513
1575
|
}
|
|
1514
1576
|
const t4 = document.getElementById("sf-eng-ticket-project"), n3 = document.getElementById("sf-eng-ticket-type");
|
|
1515
1577
|
t4 && t4.value && renderDynamicFields(t4.value, n3 == null ? void 0 : n3.value);
|
|
@@ -1518,11 +1580,11 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1518
1580
|
});
|
|
1519
1581
|
const d2 = document.getElementById("sf-issue-name");
|
|
1520
1582
|
d2 && d2.addEventListener("input", () => {
|
|
1521
|
-
|
|
1583
|
+
pe.issueName = d2.value;
|
|
1522
1584
|
});
|
|
1523
1585
|
bindEngTicketListeners(), t3 && (t3.onclick = () => {
|
|
1524
1586
|
const e4 = document.getElementById("sf-issue-description");
|
|
1525
|
-
e4 && (
|
|
1587
|
+
e4 && (pe.description = e4.value), (function startCountdownThenRecord() {
|
|
1526
1588
|
if (document.getElementById("sf-countdown-overlay")) return;
|
|
1527
1589
|
const e5 = document.createElement("div");
|
|
1528
1590
|
e5.id = "sf-countdown-overlay", e5.style.cssText = "\n position: fixed;\n inset: 0;\n background: rgba(0,0,0,0.6);\n z-index: 10001;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 80px;\n font-weight: bold;\n color: white;\n font-family: sans-serif;\n ";
|
|
@@ -1532,10 +1594,10 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1532
1594
|
if (t4--, t4 > 0) e5.textContent = t4.toString();
|
|
1533
1595
|
else {
|
|
1534
1596
|
clearInterval(n3), document.body.removeChild(e5), (function setRecordingStartTime(e6) {
|
|
1535
|
-
|
|
1597
|
+
fe = e6;
|
|
1536
1598
|
})(Date.now()), setIsRecording(true);
|
|
1537
1599
|
try {
|
|
1538
|
-
const { enableFunctionSpanTracking: e6 } = await Promise.resolve().then(() =>
|
|
1600
|
+
const { enableFunctionSpanTracking: e6 } = await Promise.resolve().then(() => O);
|
|
1539
1601
|
e6();
|
|
1540
1602
|
} catch (e6) {
|
|
1541
1603
|
console.error("[Report Issue] Failed to enable function span tracking:", e6);
|
|
@@ -1562,7 +1624,7 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1562
1624
|
const t5 = e6.querySelector("#sf-recording-timer");
|
|
1563
1625
|
if (!t5) return;
|
|
1564
1626
|
const n4 = setInterval(() => {
|
|
1565
|
-
const e7 = Date.now() - (
|
|
1627
|
+
const e7 = Date.now() - (fe ?? Date.now()), n5 = Math.floor(e7 / 6e4).toString().padStart(2, "0"), i3 = Math.floor(e7 % 6e4 / 1e3).toString().padStart(2, "0");
|
|
1566
1628
|
t5.textContent = `${n5}:${i3}`;
|
|
1567
1629
|
}, 1e3);
|
|
1568
1630
|
setTimerInterval(n4);
|
|
@@ -1571,69 +1633,69 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1571
1633
|
}, 1e3);
|
|
1572
1634
|
})();
|
|
1573
1635
|
});
|
|
1574
|
-
|
|
1636
|
+
we == null ? void 0 : we.addEventListener("click", (e4) => {
|
|
1575
1637
|
var _a;
|
|
1576
1638
|
if (e4.target.closest("#sf-issue-submit-btn")) {
|
|
1577
|
-
const e5 = ((_a = document.getElementById("sf-issue-description")) == null ? void 0 : _a.value) || "", t4 =
|
|
1578
|
-
if (
|
|
1639
|
+
const e5 = ((_a = document.getElementById("sf-issue-description")) == null ? void 0 : _a.value) || "", t4 = pe.mode;
|
|
1640
|
+
if (pe.description = e5, pe.createIssue && !pe.issueName.trim()) return void alert("Issue title is required when creating an issue.");
|
|
1579
1641
|
let n3, i3;
|
|
1580
|
-
if ("startnow" === t4) n3 =
|
|
1642
|
+
if ("startnow" === t4) n3 = fe ?? Date.now() - 3e5, i3 = ge ?? Date.now();
|
|
1581
1643
|
else {
|
|
1582
1644
|
const e6 = 60 * Number((o2 == null ? void 0 : o2.value) || "2") * 1e3;
|
|
1583
1645
|
i3 = Date.now(), n3 = i3 - e6;
|
|
1584
1646
|
}
|
|
1585
|
-
if (
|
|
1586
|
-
const
|
|
1647
|
+
if (pe.createIssue) {
|
|
1648
|
+
const o3 = document.getElementById("sf-issue-name"), s3 = document.getElementById("sf-eng-ticket-team"), r3 = document.getElementById("sf-eng-ticket-project"), a3 = document.getElementById("sf-eng-ticket-priority"), l3 = document.getElementById("sf-eng-ticket-type"), c3 = (o3 == null ? void 0 : o3.value) || "", d3 = e5, u2 = (s3 == null ? void 0 : s3.value) || "", p2 = (r3 == null ? void 0 : r3.value) || "", f2 = a3 ? Number(a3.value) : 0, g2 = pe.engTicketLabels, m2 = (l3 == null ? void 0 : l3.value) || "", h2 = { ...pe.engTicketCustomFields };
|
|
1587
1649
|
document.querySelectorAll(".sf-dynamic-field").forEach((e6) => {
|
|
1588
|
-
const
|
|
1589
|
-
n4 && ("checkbox" ===
|
|
1650
|
+
const t5 = e6, n4 = t5.dataset.fieldId;
|
|
1651
|
+
n4 && ("checkbox" === t5.type ? h2[n4] = t5.checked : "number" === t5.type ? h2[n4] = parseFloat(t5.value) || null : t5.classList.contains("sf-custom-multiselect") || (h2[n4] = t5.value));
|
|
1590
1652
|
});
|
|
1591
|
-
const
|
|
1592
|
-
if (
|
|
1653
|
+
const y2 = document.getElementById("sf-eng-ticket-sprint"), b2 = (y2 == null ? void 0 : y2.value) || pe.engTicketSprint;
|
|
1654
|
+
if (b2) {
|
|
1593
1655
|
const e6 = getSprintFieldId();
|
|
1594
|
-
|
|
1656
|
+
h2[e6] = parseInt(b2, 10);
|
|
1595
1657
|
}
|
|
1596
|
-
closeModal(), (async function createTriageAndIssue(e6,
|
|
1658
|
+
closeModal(), (async function createTriageAndIssue(e6, t5, n4, i4, o4, s4, r4, a4, l4, c4, d4, u3, p3) {
|
|
1597
1659
|
var _a2, _b, _c;
|
|
1598
1660
|
try {
|
|
1599
1661
|
showStatusModal(true);
|
|
1600
|
-
const
|
|
1601
|
-
if ((_a2 =
|
|
1602
|
-
const e7 =
|
|
1662
|
+
const f3 = await createTriageAndIssueFromRecorder(be.apiKey, be.backendApi, getSessionIdSafely(), e6, t5, n4, i4, o4, s4, r4, a4, l4, c4, d4, u3, p3);
|
|
1663
|
+
if ((_a2 = f3 == null ? void 0 : f3.errors) == null ? void 0 : _a2.length) {
|
|
1664
|
+
const e7 = f3.errors.map((e8) => e8.message).join("; ");
|
|
1603
1665
|
return console.error("GraphQL error creating triage and issue:", e7), void showStatusModal(false, null, e7);
|
|
1604
1666
|
}
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1667
|
+
const g3 = (_c = (_b = f3 == null ? void 0 : f3.data) == null ? void 0 : _b.createTriageAndIssueFromRecorder) == null ? void 0 : _c.id;
|
|
1668
|
+
g3 ? showStatusModal(false, { type: "issue", id: g3 }) : (console.error("No Issue ID returned from backend."), showStatusModal(false, null, "No issue was created. Please try again."));
|
|
1607
1669
|
} catch (e7) {
|
|
1608
1670
|
console.error("Error creating triage and issue:", e7), showStatusModal(false, null, "Something went wrong. Please try again.");
|
|
1609
1671
|
}
|
|
1610
|
-
})(`${n3}`, `${i3}`, e5,
|
|
1611
|
-
} else closeModal(), (async function createTriage(e6, t5, n4) {
|
|
1672
|
+
})(`${n3}`, `${i3}`, e5, c3, d3, pe.createEngTicket, u2, p2, f2, g2, m2, h2, "startnow" === t4 ? "RECORDED" : "LOOKBACK");
|
|
1673
|
+
} else closeModal(), (async function createTriage(e6, t5, n4, i4) {
|
|
1612
1674
|
var _a2, _b, _c;
|
|
1613
1675
|
try {
|
|
1614
1676
|
showStatusModal(true);
|
|
1615
|
-
const
|
|
1616
|
-
if ((_a2 =
|
|
1617
|
-
const e7 =
|
|
1677
|
+
const o3 = await createTriageFromRecorder(be.apiKey, be.backendApi, getSessionIdSafely(), e6, t5, n4, i4);
|
|
1678
|
+
if ((_a2 = o3 == null ? void 0 : o3.errors) == null ? void 0 : _a2.length) {
|
|
1679
|
+
const e7 = o3.errors.map((e8) => e8.message).join("; ");
|
|
1618
1680
|
return console.error("GraphQL error creating triage:", e7), void showStatusModal(false, null, e7);
|
|
1619
1681
|
}
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1682
|
+
const s3 = (_c = (_b = o3 == null ? void 0 : o3.data) == null ? void 0 : _b.createTriageFromRecorder) == null ? void 0 : _c.id;
|
|
1683
|
+
s3 ? showStatusModal(false, { type: "triage", id: s3 }) : (console.error("No Triage ID returned from backend."), showStatusModal(false, null, "No triage was created. Please try again."));
|
|
1622
1684
|
} catch (e7) {
|
|
1623
1685
|
console.error("Error creating triage:", e7), showStatusModal(false, null, "Something went wrong. Please try again.");
|
|
1624
1686
|
}
|
|
1625
|
-
})(`${n3}`, `${i3}`, e5);
|
|
1687
|
+
})(`${n3}`, `${i3}`, e5, "startnow" === t4 ? "RECORDED" : "LOOKBACK");
|
|
1626
1688
|
}
|
|
1627
1689
|
});
|
|
1628
|
-
})(),
|
|
1690
|
+
})(), be.deactivateIsolation = activateModalIsolation(we), be.integrationData && pe.createEngTicket ? initializeEngTicketForm() : be.integrationData || (pe.createEngTicket = false), be.apiKey && be.backendApi && refreshIntegrationData(be.apiKey, be.backendApi).then((e3) => {
|
|
1629
1691
|
if (!e3 || !document.getElementById("sf-report-issue-modal")) return;
|
|
1630
|
-
|
|
1692
|
+
be.integrationData = e3;
|
|
1631
1693
|
const t3 = document.getElementById("sf-eng-ticket-fields-container");
|
|
1632
1694
|
if (t3) {
|
|
1633
1695
|
const e4 = generateEngTicketFieldsHTML();
|
|
1634
|
-
e4 && (t3.innerHTML = e4, initializeEngTicketForm(), bindEngTicketListeners(), updateFormWithIntegrationData(
|
|
1696
|
+
e4 && (t3.innerHTML = e4, initializeEngTicketForm(), bindEngTicketListeners(), updateFormWithIntegrationData(pe), renderDynamicFields(pe.engTicketProject, pe.engTicketIssueType));
|
|
1635
1697
|
}
|
|
1636
|
-
if (
|
|
1698
|
+
if (ve) {
|
|
1637
1699
|
const e4 = document.getElementById("sf-create-eng-ticket-label");
|
|
1638
1700
|
e4 && (e4.style.display = "flex");
|
|
1639
1701
|
}
|
|
@@ -1641,37 +1703,37 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1641
1703
|
}
|
|
1642
1704
|
function initializeEngTicketForm() {
|
|
1643
1705
|
var _a;
|
|
1644
|
-
const e2 =
|
|
1706
|
+
const e2 = be.integrationData;
|
|
1645
1707
|
if (e2) {
|
|
1646
|
-
if (!
|
|
1647
|
-
getFieldsForProject(
|
|
1708
|
+
if (!pe.engTicketTeam && e2.defaultTeam && (pe.engTicketTeam = e2.defaultTeam), !pe.engTicketProject && e2.defaultProject && (pe.engTicketProject = e2.defaultProject), !pe.engTicketPriority && e2.defaultPriority && (pe.engTicketPriority = e2.defaultPriority), updateFormWithIntegrationData(pe), "jira" === ((_a = e2.provider) == null ? void 0 : _a.toLowerCase()) && e2.jiraReporterAccountId && pe.engTicketProject) {
|
|
1709
|
+
getFieldsForProject(pe.engTicketProject, pe.engTicketIssueType).find((e3) => "reporter" === e3.fieldId) && !pe.engTicketCustomFields.reporter && (pe.engTicketCustomFields.reporter = e2.jiraReporterAccountId);
|
|
1648
1710
|
}
|
|
1649
|
-
|
|
1711
|
+
pe.engTicketProject && renderDynamicFields(pe.engTicketProject, pe.engTicketIssueType);
|
|
1650
1712
|
}
|
|
1651
1713
|
}
|
|
1652
1714
|
function setActiveTab(e2) {
|
|
1653
|
-
|
|
1654
|
-
const t2 =
|
|
1715
|
+
pe.mode = e2;
|
|
1716
|
+
const t2 = we == null ? void 0 : we.querySelector("#sf-tab-lookback"), n2 = we == null ? void 0 : we.querySelector("#sf-tab-startnow");
|
|
1655
1717
|
"lookback" === e2 ? (t2.style.background = "white", t2.style.color = "#0F172A", n2.style.background = "transparent", n2.style.color = "#64748B") : (n2.style.background = "white", n2.style.color = "#0F172A", t2.style.background = "transparent", t2.style.color = "#64748B");
|
|
1656
1718
|
}
|
|
1657
1719
|
function updateModeSpecificUI(e2) {
|
|
1658
|
-
const t2 = document.querySelector("#sf-issue-mode-info div"), n2 = document.getElementById("sf-issue-submit-btn"), i2 = document.getElementById("sf-record-button-container"), o2 = document.getElementById("sf-recording-timer-label"), s2 = document.getElementById("sf-recording-timer-display"),
|
|
1659
|
-
if (t2 && n2 && i2 && o2 && s2 &&
|
|
1660
|
-
i2.style.display = "block",
|
|
1661
|
-
const e3 = null !==
|
|
1662
|
-
if (n2.disabled = !e3, n2.style.opacity = e3 ? "1" : "0.4", n2.style.cursor = e3 ? "pointer" : "not-allowed",
|
|
1663
|
-
const e4 = Math.floor((
|
|
1720
|
+
const t2 = document.querySelector("#sf-issue-mode-info div"), n2 = document.getElementById("sf-issue-submit-btn"), i2 = document.getElementById("sf-record-button-container"), o2 = document.getElementById("sf-recording-timer-label"), s2 = document.getElementById("sf-recording-timer-display"), r2 = document.getElementById("sf-modal-footer"), a2 = document.getElementById("sf-lookback-container");
|
|
1721
|
+
if (t2 && n2 && i2 && o2 && s2 && r2 && a2) if ("startnow" === e2) {
|
|
1722
|
+
i2.style.display = "block", a2.style.display = "none", r2.style.justifyContent = "space-between", t2.textContent = "I want to reproduce the issue right now.";
|
|
1723
|
+
const e3 = null !== fe && null !== ge;
|
|
1724
|
+
if (n2.disabled = !e3, n2.style.opacity = e3 ? "1" : "0.4", n2.style.cursor = e3 ? "pointer" : "not-allowed", fe && ge) {
|
|
1725
|
+
const e4 = Math.floor((ge - fe) / 1e3), t3 = String(Math.floor(e4 / 60)).padStart(2, "0"), n3 = String(e4 % 60).padStart(2, "0");
|
|
1664
1726
|
o2.style.display = "block", s2.textContent = `${t3}:${n3}`;
|
|
1665
1727
|
} else o2.style.display = "none";
|
|
1666
|
-
} else i2.style.display = "none", o2.style.display = "none",
|
|
1728
|
+
} else i2.style.display = "none", o2.style.display = "none", a2.style.display = "block", r2.style.justifyContent = "flex-end", t2.textContent = "Something already happened. Capture the past few minutes.", n2.disabled = false, n2.style.opacity = "1", n2.style.cursor = "pointer";
|
|
1667
1729
|
}
|
|
1668
1730
|
function bindEngTicketListeners() {
|
|
1669
1731
|
const e2 = document.getElementById("sf-eng-ticket-team"), t2 = document.getElementById("sf-eng-ticket-project"), n2 = document.getElementById("sf-eng-ticket-priority"), i2 = document.getElementById("sf-eng-ticket-labels-container"), o2 = document.getElementById("sf-eng-ticket-type"), s2 = document.getElementById("sf-eng-ticket-sprint");
|
|
1670
1732
|
e2 && e2.addEventListener("change", () => {
|
|
1671
|
-
|
|
1733
|
+
pe.engTicketTeam = e2.value, e2.style.color = e2.value ? "" : "#9ca3af";
|
|
1672
1734
|
const t3 = document.getElementById("sf-eng-ticket-project");
|
|
1673
1735
|
if (t3) {
|
|
1674
|
-
|
|
1736
|
+
pe.engTicketProject = "", pe.engTicketCustomFields = {};
|
|
1675
1737
|
const n3 = getProjectsForTeam(e2.value);
|
|
1676
1738
|
t3.innerHTML = '<option value="">Select project...</option>', n3.forEach((e3) => {
|
|
1677
1739
|
const n4 = document.createElement("option");
|
|
@@ -1680,38 +1742,38 @@ function bindEngTicketListeners() {
|
|
|
1680
1742
|
}
|
|
1681
1743
|
}), t2 && t2.addEventListener("change", () => {
|
|
1682
1744
|
var _a;
|
|
1683
|
-
|
|
1745
|
+
pe.engTicketProject = t2.value, t2.style.color = t2.value ? "" : "#9ca3af", pe.engTicketCustomFields = {};
|
|
1684
1746
|
const e3 = getIntegrationData();
|
|
1685
|
-
if (e3 && o2 && (updateIssueTypeOptions(o2, t2.value),
|
|
1686
|
-
getFieldsForProject(t2.value,
|
|
1747
|
+
if (e3 && o2 && (updateIssueTypeOptions(o2, t2.value), pe.engTicketIssueType = o2.value), e3 && "jira" === ((_a = e3.provider) == null ? void 0 : _a.toLowerCase()) && e3.jiraReporterAccountId && t2.value) {
|
|
1748
|
+
getFieldsForProject(t2.value, pe.engTicketIssueType).find((e4) => "reporter" === e4.fieldId) && (pe.engTicketCustomFields.reporter = e3.jiraReporterAccountId);
|
|
1687
1749
|
}
|
|
1688
|
-
renderDynamicFields(t2.value,
|
|
1750
|
+
renderDynamicFields(t2.value, pe.engTicketIssueType);
|
|
1689
1751
|
}), s2 && s2.addEventListener("change", () => {
|
|
1690
|
-
|
|
1752
|
+
pe.engTicketSprint = s2.value, s2.style.color = s2.value ? "" : "#9ca3af";
|
|
1691
1753
|
}), n2 && n2.addEventListener("change", () => {
|
|
1692
|
-
|
|
1754
|
+
pe.engTicketPriority = Number(n2.value);
|
|
1693
1755
|
}), i2 && setupCustomMultiSelectListeners("sf-eng-ticket-labels", (e3) => {
|
|
1694
|
-
|
|
1756
|
+
pe.engTicketLabels = e3;
|
|
1695
1757
|
}), o2 && o2.addEventListener("change", () => {
|
|
1696
|
-
|
|
1758
|
+
pe.engTicketIssueType = o2.value, o2.style.color = o2.value ? "" : "#9ca3af";
|
|
1697
1759
|
const e3 = document.getElementById("sf-eng-ticket-project");
|
|
1698
1760
|
if (e3 && e3.value) {
|
|
1699
|
-
const t3 =
|
|
1700
|
-
|
|
1761
|
+
const t3 = pe.engTicketCustomFields.reporter;
|
|
1762
|
+
pe.engTicketCustomFields = {}, t3 && (pe.engTicketCustomFields.reporter = t3), renderDynamicFields(e3.value, o2.value);
|
|
1701
1763
|
}
|
|
1702
1764
|
});
|
|
1703
|
-
const
|
|
1704
|
-
|
|
1765
|
+
const r2 = document.getElementById("sf-dynamic-fields-container");
|
|
1766
|
+
r2 && (r2.addEventListener("input", (e3) => {
|
|
1705
1767
|
const t3 = e3.target;
|
|
1706
1768
|
if (t3.classList.contains("sf-dynamic-field")) {
|
|
1707
1769
|
const e4 = t3.dataset.fieldId;
|
|
1708
|
-
e4 && ("checkbox" === t3.type ?
|
|
1770
|
+
e4 && ("checkbox" === t3.type ? pe.engTicketCustomFields[e4] = t3.checked : "number" === t3.type ? pe.engTicketCustomFields[e4] = parseFloat(t3.value) || null : pe.engTicketCustomFields[e4] = t3.value);
|
|
1709
1771
|
}
|
|
1710
|
-
}),
|
|
1772
|
+
}), r2.addEventListener("change", (e3) => {
|
|
1711
1773
|
const t3 = e3.target;
|
|
1712
1774
|
if (t3.classList.contains("sf-dynamic-field")) {
|
|
1713
1775
|
const e4 = t3.dataset.fieldId;
|
|
1714
|
-
if (e4 && (
|
|
1776
|
+
if (e4 && (pe.engTicketCustomFields[e4] = t3.value), "SELECT" === t3.tagName) {
|
|
1715
1777
|
const e5 = t3;
|
|
1716
1778
|
e5.style.color = e5.value ? "" : "#9ca3af";
|
|
1717
1779
|
}
|
|
@@ -1721,10 +1783,10 @@ function bindEngTicketListeners() {
|
|
|
1721
1783
|
async function stopRecording() {
|
|
1722
1784
|
var _a;
|
|
1723
1785
|
!(function setRecordingEndTime(e2) {
|
|
1724
|
-
|
|
1725
|
-
})(Date.now()), setIsRecording(false),
|
|
1786
|
+
ge = e2;
|
|
1787
|
+
})(Date.now()), setIsRecording(false), me && (clearInterval(me), setTimerInterval(null)), (_a = document.getElementById("sf-recording-indicator")) == null ? void 0 : _a.remove();
|
|
1726
1788
|
try {
|
|
1727
|
-
const { disableFunctionSpanTracking: e2 } = await Promise.resolve().then(() =>
|
|
1789
|
+
const { disableFunctionSpanTracking: e2 } = await Promise.resolve().then(() => O);
|
|
1728
1790
|
e2();
|
|
1729
1791
|
} catch (e2) {
|
|
1730
1792
|
console.error("[Report Issue] Failed to disable function span tracking:", e2);
|
|
@@ -1737,21 +1799,21 @@ async function stopRecording() {
|
|
|
1737
1799
|
t3 && (t3.textContent = "Re-record");
|
|
1738
1800
|
}
|
|
1739
1801
|
const t2 = document.getElementById("sf-recording-timer-label"), n2 = document.getElementById("sf-recording-timer-display");
|
|
1740
|
-
if (t2 && n2 &&
|
|
1741
|
-
const e3 = Math.floor((
|
|
1802
|
+
if (t2 && n2 && fe && ge) {
|
|
1803
|
+
const e3 = Math.floor((ge - fe) / 1e3), i3 = Math.floor(e3 / 60).toString().padStart(2, "0"), o3 = (e3 % 60).toString().padStart(2, "0");
|
|
1742
1804
|
n2.textContent = `${i3}:${o3}`, t2.style.display = "block";
|
|
1743
1805
|
}
|
|
1744
1806
|
const i2 = document.getElementById("sf-issue-description");
|
|
1745
|
-
i2 && (i2.value =
|
|
1807
|
+
i2 && (i2.value = pe.description);
|
|
1746
1808
|
const o2 = document.querySelector('input[value="startnow"]');
|
|
1747
1809
|
o2 && (o2.checked = true);
|
|
1748
|
-
const s2 = document.getElementById("sf-inline-record-chip"),
|
|
1749
|
-
if (s2 &&
|
|
1750
|
-
const e3 = Math.floor(((
|
|
1751
|
-
|
|
1810
|
+
const s2 = document.getElementById("sf-inline-record-chip"), r2 = document.getElementById("sf-inline-record-timer");
|
|
1811
|
+
if (s2 && r2) {
|
|
1812
|
+
const e3 = Math.floor(((ge ?? 0) - (fe ?? 0)) / 1e3), t3 = Math.floor(e3 / 60).toString().padStart(2, "0"), n3 = Math.floor(e3 % 60).toString().padStart(2, "0");
|
|
1813
|
+
r2.textContent = `${t3}:${n3}`, r2.style.color = "black", s2.style.display = "flex";
|
|
1752
1814
|
}
|
|
1753
|
-
const
|
|
1754
|
-
|
|
1815
|
+
const a2 = document.getElementById("sf-issue-submit-btn");
|
|
1816
|
+
a2.disabled = false, a2.style.opacity = "1", a2.style.cursor = "pointer";
|
|
1755
1817
|
})();
|
|
1756
1818
|
}
|
|
1757
1819
|
function showStatusModal(e2, t2, n2) {
|
|
@@ -1761,10 +1823,10 @@ function showStatusModal(e2, t2, n2) {
|
|
|
1761
1823
|
var _a2, _b;
|
|
1762
1824
|
(_a2 = document.getElementById("sf-report-issue-modal")) == null ? void 0 : _a2.remove(), (_b = document.getElementById("sf-triage-status-modal")) == null ? void 0 : _b.remove();
|
|
1763
1825
|
})();
|
|
1764
|
-
const o2 = !e3 && i2, s2 = n3 ? `${
|
|
1765
|
-
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1826
|
+
const o2 = !e3 && i2, s2 = n3 ? `${be.triageBaseUrl}/issues/${n3}?from=inAppReportIssue` : t3 ? `${be.triageBaseUrl}/triage/${t3}?from=inAppReportIssue` : "", r2 = document.createElement("div");
|
|
1827
|
+
r2.id = "sf-triage-status-modal", Object.assign(r2.style, { position: "fixed", inset: "0", zIndex: "9998", display: "flex", alignItems: "center", justifyContent: "center" });
|
|
1828
|
+
const a2 = e3 ? "Reporting Issue..." : o2 ? "Failed to report issue" : "Issue reported!", l2 = e3 ? '<p style="font-size:14px; color:#64748b; line-height:20px;">This may take ~10 seconds</p>' : o2 ? `<p style="font-size:14px; color:#ef4444; line-height:20px;">${i2}</p>` : "", c2 = e3 ? '<div style="display:flex; justify-content:center; align-items:center; padding: 40px 0;">\n <div style="width:24px; height:24px; border:2px solid #295dbf; border-top:2px solid white; border-radius:50%; animation:spin 1s linear infinite;"></div>\n </div>' : "", d2 = e3 ? "" : '<div id="sf-copied-status" style="display:none; font-size:12px; font-weight:500; color:white;\n background-color:#22c55e; padding:4px 8px; border-radius:6px; white-space:nowrap; align-items:center; gap:6px;">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M21 7.5L9 19.5L3 13.5L5.25 11.25L9 15L18.75 5.25L21 7.5Z" fill="white"/>\n </svg>\n Copied\n </div>';
|
|
1829
|
+
r2.innerHTML = `
|
|
1768
1830
|
<div style="position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:9998;"></div>
|
|
1769
1831
|
<div id="sf-triage-card"
|
|
1770
1832
|
style="position:relative; background:#fff; padding:24px; border-radius:12px; width:300px; max-width:90%;
|
|
@@ -1780,7 +1842,7 @@ function showStatusModal(e2, t2, n2) {
|
|
|
1780
1842
|
</svg>
|
|
1781
1843
|
</button>
|
|
1782
1844
|
|
|
1783
|
-
<h2 style="font-size:18px; font-weight:600; margin-bottom:${e3 || o2 ? 8 : 40}px; line-height:28px;">${
|
|
1845
|
+
<h2 style="font-size:18px; font-weight:600; margin-bottom:${e3 || o2 ? 8 : 40}px; line-height:28px;">${a2}</h2>
|
|
1784
1846
|
${l2}
|
|
1785
1847
|
${c2}
|
|
1786
1848
|
|
|
@@ -1805,10 +1867,10 @@ function showStatusModal(e2, t2, n2) {
|
|
|
1805
1867
|
<style>
|
|
1806
1868
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
1807
1869
|
</style>
|
|
1808
|
-
`, document.body.appendChild(
|
|
1809
|
-
const u2 =
|
|
1870
|
+
`, document.body.appendChild(r2);
|
|
1871
|
+
const u2 = r2.querySelector("#sf-triage-card");
|
|
1810
1872
|
(_a = document.getElementById("sf-triage-modal-close")) == null ? void 0 : _a.addEventListener("click", () => {
|
|
1811
|
-
fadeCardAndRemove(
|
|
1873
|
+
fadeCardAndRemove(r2, u2, 300);
|
|
1812
1874
|
});
|
|
1813
1875
|
const p2 = document.getElementById("sf-copy-triage-link"), f2 = document.getElementById("sf-view-triage-btn");
|
|
1814
1876
|
e3 ? (p2.disabled = true, p2.style.opacity = "0.4", p2.style.cursor = "not-allowed", f2.disabled = true, f2.style.opacity = "0.4", f2.style.cursor = "not-allowed") : (p2.disabled = false, p2.addEventListener("click", () => {
|
|
@@ -1818,15 +1880,15 @@ function showStatusModal(e2, t2, n2) {
|
|
|
1818
1880
|
});
|
|
1819
1881
|
}), f2.disabled = false, f2.addEventListener("click", () => {
|
|
1820
1882
|
(t3 || n3) && window.open(s2, "_blank");
|
|
1821
|
-
}), o2 || setTimeout(() => fadeCardAndRemove(
|
|
1883
|
+
}), o2 || setTimeout(() => fadeCardAndRemove(r2, u2, 300), 1e4));
|
|
1822
1884
|
})(e2, "triage" === (t2 == null ? void 0 : t2.type) ? t2.id : void 0, "issue" === (t2 == null ? void 0 : t2.type) ? t2.id : void 0, n2);
|
|
1823
1885
|
}
|
|
1824
1886
|
function fadeCardAndRemove(e2, t2, n2 = 300) {
|
|
1825
1887
|
t2.style.opacity = "0", t2.addEventListener("transitionend", () => e2.remove(), { once: true }), setTimeout(() => e2.remove(), n2 + 100);
|
|
1826
1888
|
}
|
|
1827
|
-
const Se = Object.freeze(Object.defineProperty({ __proto__: null, ReportIssueContext:
|
|
1828
|
-
|
|
1829
|
-
const t3 = { ...
|
|
1889
|
+
const Se = Object.freeze(Object.defineProperty({ __proto__: null, ReportIssueContext: be, openReportIssueModal, setupIssueReporting: function setupIssueReporting(e2) {
|
|
1890
|
+
be.apiKey = e2.apiKey, be.backendApi = e2.backendApi, be.resolveSessionId = e2.getSessionId, be.integrationData = e2.integrationData || null, be.showEngTicketFieldsDefault = e2.showEngTicketFieldsInReportIssueModalDefault ?? false, e2.customBaseUrl && (be.triageBaseUrl = e2.customBaseUrl), be.shortcuts = (function mergeShortcutsConfig(e3) {
|
|
1891
|
+
const t3 = { ...ye };
|
|
1830
1892
|
if (!e3) return t3;
|
|
1831
1893
|
"boolean" == typeof e3.enabled && (t3.enabled = e3.enabled);
|
|
1832
1894
|
const n2 = ["openModalExistingMode", "openModalCaptureNewMode", "closeModal", "submitReport", "startRecording", "stopRecording"];
|
|
@@ -1836,36 +1898,36 @@ const Se = Object.freeze(Object.defineProperty({ __proto__: null, ReportIssueCon
|
|
|
1836
1898
|
}
|
|
1837
1899
|
return t3;
|
|
1838
1900
|
})(e2.shortcuts);
|
|
1839
|
-
const { shortcuts: t2 } =
|
|
1901
|
+
const { shortcuts: t2 } = be;
|
|
1840
1902
|
window.addEventListener("keydown", (e3) => {
|
|
1841
1903
|
const n2 = (function isTypingInInput() {
|
|
1842
1904
|
const e4 = document.activeElement;
|
|
1843
1905
|
return e4 instanceof HTMLInputElement || e4 instanceof HTMLTextAreaElement || e4 instanceof HTMLElement && e4.isContentEditable;
|
|
1844
|
-
})(), i2 = e3.key.toLowerCase(), o2 = e3.metaKey || e3.ctrlKey, s2 = !!document.getElementById("sf-report-issue-modal"),
|
|
1906
|
+
})(), i2 = e3.key.toLowerCase(), o2 = e3.metaKey || e3.ctrlKey, s2 = !!document.getElementById("sf-report-issue-modal"), r2 = !n2 && (t2.enabled || s2), shortcutUsed = (e4) => i2 === t2[e4].key && o2 === t2[e4].requireCmdCtrl, a2 = s2 ? (e4) => {
|
|
1845
1907
|
setActiveTab(e4), updateModeSpecificUI(e4);
|
|
1846
1908
|
} : injectModalHTML;
|
|
1847
|
-
if (
|
|
1848
|
-
if (
|
|
1849
|
-
if (s2 && !
|
|
1909
|
+
if (r2 && shortcutUsed("openModalExistingMode")) return e3.preventDefault(), void a2("lookback");
|
|
1910
|
+
if (r2 && shortcutUsed("openModalCaptureNewMode")) return e3.preventDefault(), void a2("startnow");
|
|
1911
|
+
if (s2 && !he && shortcutUsed("closeModal")) return e3.preventDefault(), void closeModal();
|
|
1850
1912
|
if (s2 && shortcutUsed("submitReport")) {
|
|
1851
1913
|
const t3 = document.getElementById("sf-issue-submit-btn");
|
|
1852
1914
|
return void (t3 && !t3.disabled && (e3.preventDefault(), t3.click()));
|
|
1853
1915
|
}
|
|
1854
|
-
if (
|
|
1855
|
-
if (s2 && "startnow" ===
|
|
1916
|
+
if (he && i2 === t2.stopRecording.key && o2 === t2.stopRecording.requireCmdCtrl) return e3.preventDefault(), void stopRecording();
|
|
1917
|
+
if (s2 && "startnow" === pe.mode && i2 === t2.startRecording.key && o2 === t2.startRecording.requireCmdCtrl && !n2) {
|
|
1856
1918
|
const t3 = document.getElementById("sf-start-recording-btn");
|
|
1857
1919
|
return void (t3 && (e3.preventDefault(), t3.click()));
|
|
1858
1920
|
}
|
|
1859
1921
|
});
|
|
1860
|
-
} }, Symbol.toStringTag, { value: "Module" })),
|
|
1922
|
+
} }, Symbol.toStringTag, { value: "Module" })), ke = readDebugFlag(), xe = /* @__PURE__ */ new Map();
|
|
1861
1923
|
function getCachedRegex(e2, t2) {
|
|
1862
1924
|
const n2 = `${e2}|${t2}`;
|
|
1863
|
-
let i2 =
|
|
1864
|
-
return i2 || (i2 = new RegExp(e2, t2),
|
|
1925
|
+
let i2 = xe.get(n2);
|
|
1926
|
+
return i2 || (i2 = new RegExp(e2, t2), xe.set(n2, i2)), i2;
|
|
1865
1927
|
}
|
|
1866
|
-
const
|
|
1928
|
+
const Ie = new Set([".js", ".mjs", ".cjs", ".ts", ".css", ".scss", ".sass", ".less", ".styl", ".stylus", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".avif", ".bmp", ".ico", ".tiff", ".tif", ".heic", ".woff", ".woff2", ".ttf", ".otf", ".eot", ".mp4", ".webm", ".ogv", ".mp3", ".wav", ".flac", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".csv", ".json", ".xml", ".txt", ".zip", ".rar", ".gz", ".tar", ".7z", ".map", ".webmanifest"].map((e2) => e2.toLowerCase())), Te = ["t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com", "*.zdassets.com"], Ee = [400, 403], Ce = "CORS", $e = "authorization", Fe = "Authorization", Le = { recordCanvas: false, recordCrossOriginIframes: false, collectFonts: false, inlineImages: false, recordPassword: false, recordRealName: true, recordCreditCardInfo: false, recordSsn: false, recordDob: false, sampling: {}, enableFiberTracking: false }, Me = { level: ["info", "log", "warn", "error"], lengthThreshold: 1e4, stringifyOptions: { stringLengthLimit: 1e3, numOfKeysLimit: 20, depthOfLimit: 4 }, logger: "console" };
|
|
1867
1929
|
function maskAuthorizationHeader(e2) {
|
|
1868
|
-
const t2 = e2[
|
|
1930
|
+
const t2 = e2[$e] ? $e : e2[Fe] ? Fe : null;
|
|
1869
1931
|
if (!t2) return;
|
|
1870
1932
|
const n2 = e2[t2], i2 = n2.indexOf(" ");
|
|
1871
1933
|
if (-1 !== i2) {
|
|
@@ -1914,7 +1976,7 @@ function handleVisibilityChange() {
|
|
|
1914
1976
|
const e2 = document.visibilityState, t2 = Date.now();
|
|
1915
1977
|
"visible" === e2 && getOrSetSessionId();
|
|
1916
1978
|
try {
|
|
1917
|
-
sendMessage({ type: "visibilityChange", data: { state: e2, url: window.location.href.split("?")[0], timestamp: t2, ...getUrlAndStoredUuids() } }),
|
|
1979
|
+
sendMessage({ type: "visibilityChange", data: { state: e2, url: window.location.href.split("?")[0], timestamp: t2, ...getUrlAndStoredUuids() } }), ke && console.log(`[Sailfish] Tab became ${e2}, sent visibility change event`);
|
|
1918
1980
|
} catch (e3) {
|
|
1919
1981
|
console.warn("[Sailfish] Failed to send visibility change event:", e3);
|
|
1920
1982
|
}
|
|
@@ -1923,9 +1985,9 @@ function handleVisibilityChange() {
|
|
|
1923
1985
|
function clearPageVisitDataFromSessionStorage() {
|
|
1924
1986
|
m && (sessionStorage.removeItem("pageVisitUUID"), sessionStorage.removeItem("prevPageVisitUUID"), sessionStorage.removeItem("tabVisibilityChanged"), sessionStorage.removeItem("tabVisibilityState"), invalidateUrlCache());
|
|
1925
1987
|
}
|
|
1926
|
-
let
|
|
1988
|
+
let Ae = false;
|
|
1927
1989
|
function _ensureModuleSideEffects() {
|
|
1928
|
-
|
|
1990
|
+
Ae || (Ae = true, restoreFuncSpanState(), (function ensureSessionListeners() {
|
|
1929
1991
|
w || (w = true, p && window.addEventListener("beforeunload", () => {
|
|
1930
1992
|
window.name = y + window.name;
|
|
1931
1993
|
}));
|
|
@@ -1944,15 +2006,15 @@ function matchUrlWithWildcard(e2, t2) {
|
|
|
1944
2006
|
} catch {
|
|
1945
2007
|
return false;
|
|
1946
2008
|
}
|
|
1947
|
-
const { hostname: o2, pathname: s2, port:
|
|
1948
|
-
if (!/^https?:$/.test(
|
|
2009
|
+
const { hostname: o2, pathname: s2, port: r2, protocol: a2 } = i2;
|
|
2010
|
+
if (!/^https?:$/.test(a2)) return false;
|
|
1949
2011
|
const l2 = o2.startsWith("www.") ? o2.slice(4).toLowerCase() : o2.toLowerCase();
|
|
1950
2012
|
return t2.some((e3) => {
|
|
1951
2013
|
const t3 = String(e3 || "").replace(/^[a-zA-Z]+:\/\//, "");
|
|
1952
2014
|
let [n3, i3] = t3.split("/", 2), o3 = "";
|
|
1953
2015
|
n3.includes(":") && ([n3, o3] = n3.split(":"));
|
|
1954
|
-
const
|
|
1955
|
-
if (o3 &&
|
|
2016
|
+
const a3 = getCachedRegex(`^${n3.replace(/\./g, "\\.").replace(/\*/g, ".*")}$`, "i"), c2 = l2.startsWith("www.") ? l2.slice(4) : l2;
|
|
2017
|
+
if (o3 && r2 !== o3) return false;
|
|
1956
2018
|
if (n3.startsWith("*.")) {
|
|
1957
2019
|
const e4 = n3.slice(2).toLowerCase();
|
|
1958
2020
|
if (!(l2 === e4 || c2 === e4 || l2.endsWith("." + e4))) return false;
|
|
@@ -1961,7 +2023,7 @@ function matchUrlWithWildcard(e2, t2) {
|
|
|
1961
2023
|
}
|
|
1962
2024
|
return true;
|
|
1963
2025
|
}
|
|
1964
|
-
if (!
|
|
2026
|
+
if (!a3.test(c2) && !a3.test(l2)) return false;
|
|
1965
2027
|
if (i3) {
|
|
1966
2028
|
return getCachedRegex(`^/${i3.replace(/\*/g, ".*").replace(/\/$/, "")}`, "i").test(s2);
|
|
1967
2029
|
}
|
|
@@ -1969,7 +2031,7 @@ function matchUrlWithWildcard(e2, t2) {
|
|
|
1969
2031
|
});
|
|
1970
2032
|
}
|
|
1971
2033
|
function createSkipHeadersPropagationChecker(e2 = []) {
|
|
1972
|
-
const t2 = [...
|
|
2034
|
+
const t2 = [...Te, ...e2];
|
|
1973
2035
|
return function shouldSkipHeadersPropagation(e3) {
|
|
1974
2036
|
let n2;
|
|
1975
2037
|
try {
|
|
@@ -1978,11 +2040,11 @@ function createSkipHeadersPropagationChecker(e2 = []) {
|
|
|
1978
2040
|
return true;
|
|
1979
2041
|
}
|
|
1980
2042
|
const i2 = n2.pathname.toLowerCase(), o2 = i2.lastIndexOf(".");
|
|
1981
|
-
return !(-1 === o2 || !
|
|
2043
|
+
return !(-1 === o2 || !Ie.has(i2.slice(o2))) || !!matchUrlWithWildcard(e3, t2);
|
|
1982
2044
|
};
|
|
1983
2045
|
}
|
|
1984
2046
|
function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }) {
|
|
1985
|
-
const i2 = window.fetch, o2 = getOrSetSessionId(), s2 = createSkipHeadersPropagationChecker(e2),
|
|
2047
|
+
const i2 = window.fetch, o2 = getOrSetSessionId(), s2 = createSkipHeadersPropagationChecker(e2), r2 = ["text/event-stream", "application/x-ndjson", "application/stream+json", "application/grpc", "application/grpc-web"], a2 = ["application/octet-stream"];
|
|
1986
2048
|
window.fetch = new Proxy(i2, { apply: async (e3, i3, l2) => {
|
|
1987
2049
|
let c2, d2 = l2[0], u2 = l2[1] || {};
|
|
1988
2050
|
if ("string" == typeof d2) c2 = d2;
|
|
@@ -2013,7 +2075,7 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
|
|
|
2013
2075
|
h2[e5] = t3;
|
|
2014
2076
|
}) : h2 = { ...l3.headers }), m2 = l3.body;
|
|
2015
2077
|
} catch (e5) {
|
|
2016
|
-
|
|
2078
|
+
ke && console.warn("[Sailfish] Failed to capture request data:", e5);
|
|
2017
2079
|
}
|
|
2018
2080
|
delete h2[n];
|
|
2019
2081
|
const b2 = getFuncSpanHeader();
|
|
@@ -2022,48 +2084,48 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
|
|
|
2022
2084
|
h2[n] = w2, b2 && (h2[b2.name] = b2.value);
|
|
2023
2085
|
maskAuthorizationHeader(h2);
|
|
2024
2086
|
try {
|
|
2025
|
-
let b3 = await (async function injectHeader(e5, t3, i5, o4, s4,
|
|
2087
|
+
let b3 = await (async function injectHeader(e5, t3, i5, o4, s4, r3, a3) {
|
|
2026
2088
|
const l4 = getFuncSpanHeader();
|
|
2027
2089
|
if (i5 instanceof Request) {
|
|
2028
2090
|
const c4 = i5.clone(), d4 = new Headers(c4.headers);
|
|
2029
|
-
d4.set(n, `${s4}/${
|
|
2091
|
+
d4.set(n, `${s4}/${r3}/${a3}`), l4 && (d4.set(l4.name, l4.value), ke && console.log("[Sailfish] Added funcspan header to HTTP Request:", { url: i5.url, header: l4.name }));
|
|
2030
2092
|
const u4 = new Request(c4, { headers: d4 });
|
|
2031
2093
|
return await e5.call(t3, u4, o4);
|
|
2032
2094
|
}
|
|
2033
2095
|
{
|
|
2034
2096
|
const c4 = { ...o4 }, d4 = new Headers(o4.headers || {});
|
|
2035
|
-
return d4.set(n, `${s4}/${
|
|
2097
|
+
return d4.set(n, `${s4}/${r3}/${a3}`), l4 && (d4.set(l4.name, l4.value), ke && console.log("[Sailfish] Added funcspan header to HTTP fetch:", { url: "string" == typeof i5 ? i5 : i5.href, header: l4.name })), c4.headers = d4, await e5.call(t3, i5, c4);
|
|
2036
2098
|
}
|
|
2037
2099
|
})(e4, i4, s3, l3, c3, p2.page_visit_uuid, u3), w3 = false;
|
|
2038
|
-
|
|
2100
|
+
Ee.includes(b3.status) && (ke && console.log("Perform retry as status was fail:", b3), delete h2[n], b3 = await (async function retryWithoutPropagateHeaders(e5, t3, i5, o4) {
|
|
2039
2101
|
try {
|
|
2040
2102
|
let o5 = i5[0], s4 = i5[1] || {};
|
|
2041
2103
|
if ("string" == typeof o5 || o5 instanceof URL) {
|
|
2042
|
-
const i6 = { ...s4 },
|
|
2043
|
-
|
|
2104
|
+
const i6 = { ...s4 }, r3 = new Headers(s4.headers || {});
|
|
2105
|
+
r3.delete(n), i6.headers = r3;
|
|
2044
2106
|
return await e5.call(t3, o5, i6);
|
|
2045
2107
|
}
|
|
2046
2108
|
if (o5 instanceof Request) {
|
|
2047
|
-
const i6 = o5.clone(),
|
|
2048
|
-
|
|
2049
|
-
const
|
|
2050
|
-
return await e5.call(t3,
|
|
2109
|
+
const i6 = o5.clone(), r3 = new Headers(i6.headers);
|
|
2110
|
+
r3.delete(n);
|
|
2111
|
+
const a3 = new Request(i6, { headers: r3 });
|
|
2112
|
+
return await e5.call(t3, a3, s4);
|
|
2051
2113
|
}
|
|
2052
2114
|
return e5.apply(t3, i5);
|
|
2053
2115
|
} catch (e6) {
|
|
2054
|
-
throw
|
|
2116
|
+
throw ke && console.log(`Retry without ${n} for ${o4} also failed:`, e6), e6;
|
|
2055
2117
|
}
|
|
2056
2118
|
})(e4, i4, o3, d3), w3 = true);
|
|
2057
|
-
const
|
|
2119
|
+
const v2 = Date.now(), S2 = b3.status, k2 = b3.ok, x2 = k2 ? "" : `Request Error: ${b3.statusText}`;
|
|
2058
2120
|
let I2 = null;
|
|
2059
2121
|
try {
|
|
2060
2122
|
I2 = {}, b3.headers.forEach((e5, t3) => {
|
|
2061
2123
|
I2[t3] = e5;
|
|
2062
2124
|
});
|
|
2063
2125
|
} catch (e5) {
|
|
2064
|
-
|
|
2126
|
+
ke && console.warn("[Sailfish] Failed to capture response headers:", e5), I2 = null;
|
|
2065
2127
|
}
|
|
2066
|
-
const T2 = { type: 27, timestamp:
|
|
2128
|
+
const T2 = { type: 27, timestamp: v2, sessionId: c3, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: v2, response_code: S2, success: k2, error: x2, method: f2, url: d3, retry_without_trace_id: w3, request_headers: h2, request_body: m2, response_headers: I2, response_body: null }, ...p2 }, sendEventWithBody = (e5) => {
|
|
2067
2129
|
T2.data.response_body = e5, y2 ? y2.text().then((e6) => {
|
|
2068
2130
|
T2.data.request_body = e6, sendEvent(T2);
|
|
2069
2131
|
}, () => {
|
|
@@ -2075,29 +2137,29 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
|
|
|
2075
2137
|
const t3 = e5.headers.get("content-type");
|
|
2076
2138
|
if (!t3) return false;
|
|
2077
2139
|
const n2 = t3.toLowerCase();
|
|
2078
|
-
return
|
|
2140
|
+
return a2.some((e6) => n2.includes(e6));
|
|
2079
2141
|
})(b3)) sendEventWithBody(null);
|
|
2080
2142
|
else if ((function isStreamingResponse(e5) {
|
|
2081
2143
|
const t3 = e5.headers.get("content-type");
|
|
2082
2144
|
if (!t3) return false;
|
|
2083
2145
|
const n2 = t3.toLowerCase();
|
|
2084
|
-
return
|
|
2146
|
+
return r2.some((e6) => n2.includes(e6));
|
|
2085
2147
|
})(b3)) if (t2.captureStreamingResponseBody) try {
|
|
2086
2148
|
(async function readStreamPrefix(e5, t3, n2) {
|
|
2087
2149
|
const i5 = e5.body;
|
|
2088
2150
|
if (!i5) return null;
|
|
2089
|
-
const o4 = i5.getReader(), s4 = new TextDecoder(),
|
|
2090
|
-
let
|
|
2151
|
+
const o4 = i5.getReader(), s4 = new TextDecoder(), r3 = [];
|
|
2152
|
+
let a3 = 0;
|
|
2091
2153
|
const readWithLimit = async () => {
|
|
2092
2154
|
try {
|
|
2093
|
-
for (;
|
|
2155
|
+
for (; a3 < t3; ) {
|
|
2094
2156
|
const { done: e6, value: t4 } = await o4.read();
|
|
2095
2157
|
if (e6) break;
|
|
2096
|
-
|
|
2158
|
+
a3 += t4.byteLength, r3.push(s4.decode(t4, { stream: true }));
|
|
2097
2159
|
}
|
|
2098
|
-
return
|
|
2160
|
+
return r3.push(s4.decode()), r3.join("");
|
|
2099
2161
|
} catch {
|
|
2100
|
-
return
|
|
2162
|
+
return r3.length > 0 ? r3.join("") : null;
|
|
2101
2163
|
} finally {
|
|
2102
2164
|
try {
|
|
2103
2165
|
o4.cancel();
|
|
@@ -2111,7 +2173,7 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
|
|
|
2111
2173
|
o4.cancel();
|
|
2112
2174
|
} catch {
|
|
2113
2175
|
}
|
|
2114
|
-
e6(
|
|
2176
|
+
e6(r3.length > 0 ? r3.join("") : null);
|
|
2115
2177
|
}, n2))]);
|
|
2116
2178
|
} catch {
|
|
2117
2179
|
try {
|
|
@@ -2138,26 +2200,26 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
|
|
|
2138
2200
|
}
|
|
2139
2201
|
return b3;
|
|
2140
2202
|
} catch (t3) {
|
|
2141
|
-
const n2 = Date.now(), s4 = false,
|
|
2142
|
-
if (t3 instanceof TypeError && ((_b = t3 == null ? void 0 : t3.message) == null ? void 0 : _b.toLowerCase().includes(
|
|
2203
|
+
const n2 = Date.now(), s4 = false, r3 = ((_a = t3.response) == null ? void 0 : _a.status) || 500, a3 = t3.message || "Fetch request failed";
|
|
2204
|
+
if (t3 instanceof TypeError && ((_b = t3 == null ? void 0 : t3.message) == null ? void 0 : _b.toLowerCase().includes(Ce.toLowerCase()))) return e4.apply(i4, o3);
|
|
2143
2205
|
let l4 = m2;
|
|
2144
2206
|
if (y2) try {
|
|
2145
2207
|
l4 = await y2.text();
|
|
2146
2208
|
} catch {
|
|
2147
2209
|
l4 = null;
|
|
2148
2210
|
}
|
|
2149
|
-
throw sendEvent({ type: 27, timestamp: n2, sessionId: c3, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: n2, response_code:
|
|
2211
|
+
throw sendEvent({ type: 27, timestamp: n2, sessionId: c3, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: n2, response_code: r3, success: s4, error: a3, method: f2, url: d3, request_headers: h2, request_body: l4, response_body: null }, ...p2 }), t3;
|
|
2150
2212
|
}
|
|
2151
2213
|
})(e3, i3, l2, d2, u2, o2, c2);
|
|
2152
2214
|
} });
|
|
2153
2215
|
}
|
|
2154
|
-
async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo: i2 = [], domainsToNotPropagateHeaderTo: o2 = [], serviceVersion: s2, serviceIdentifier:
|
|
2216
|
+
async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo: i2 = [], domainsToNotPropagateHeaderTo: o2 = [], serviceVersion: s2, serviceIdentifier: r2, gitSha: a2, serviceAdditionalMetadata: l2, enableIpTracking: c2, captureStreamingResponseBody: d2 = true, captureResponseBodyMaxMb: u2 = 10, captureStreamPrefixKb: p2 = 64, captureStreamTimeoutMs: f2 = 1e4, enableFiberTracking: g2 = false, deferRecording: h2, deferRecordingStart: y2, chunkSnapshot: b2, useWsWorker: w2 = true }) {
|
|
2155
2217
|
var _a, _b;
|
|
2156
|
-
const
|
|
2157
|
-
if (k2.sessionId =
|
|
2218
|
+
const v2 = h2 ?? y2 ?? true, S2 = getOrSetSessionId(), k2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
|
|
2219
|
+
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();
|
|
2158
2220
|
const x2 = { captureStreamingResponseBody: d2, captureResponseBodyMaxMb: u2, captureStreamPrefixKb: p2, captureStreamTimeoutMs: f2 };
|
|
2159
2221
|
sessionStorage.getItem("pageVisitUUID") || (sessionStorage.setItem("pageVisitUUID", uuidv4()), invalidateUrlCache()), k2.xhrPatched || (!(function setupXMLHttpRequestInterceptor(e3 = [], t3 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }) {
|
|
2160
|
-
const i3 = XMLHttpRequest.prototype.open, o3 = XMLHttpRequest.prototype.send, s3 = XMLHttpRequest.prototype.setRequestHeader,
|
|
2222
|
+
const i3 = XMLHttpRequest.prototype.open, o3 = XMLHttpRequest.prototype.send, s3 = XMLHttpRequest.prototype.setRequestHeader, r3 = getOrSetSessionId(), a3 = createSkipHeadersPropagationChecker(e3);
|
|
2161
2223
|
XMLHttpRequest.prototype.setRequestHeader = function(e4, t4) {
|
|
2162
2224
|
return this._capturedRequestHeaders || (this._capturedRequestHeaders = {}), this._capturedRequestHeaders[e4] = t4, s3.call(this, e4, t4);
|
|
2163
2225
|
}, XMLHttpRequest.prototype.open = function(e4, t4, ...n2) {
|
|
@@ -2165,8 +2227,8 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2165
2227
|
}, XMLHttpRequest.prototype.send = function(...e4) {
|
|
2166
2228
|
const i4 = this._requestUrl;
|
|
2167
2229
|
if (!i4) return o3.apply(this, e4);
|
|
2168
|
-
if (
|
|
2169
|
-
const s4 = sessionStorage.getItem("pageVisitUUID"), l3 = uuidv4(), c3 = `${
|
|
2230
|
+
if (a3(i4)) return o3.apply(this, e4);
|
|
2231
|
+
const s4 = sessionStorage.getItem("pageVisitUUID"), l3 = uuidv4(), c3 = `${r3}/${s4}/${l3}`;
|
|
2170
2232
|
try {
|
|
2171
2233
|
this.setRequestHeader(n, c3);
|
|
2172
2234
|
} catch (e5) {
|
|
@@ -2174,9 +2236,9 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2174
2236
|
}
|
|
2175
2237
|
const d3 = getFuncSpanHeader();
|
|
2176
2238
|
if (d3) try {
|
|
2177
|
-
this.setRequestHeader(d3.name, d3.value),
|
|
2239
|
+
this.setRequestHeader(d3.name, d3.value), ke && console.log("[Sailfish] Added funcspan header to XMLHttpRequest:", { url: i4, header: d3.name });
|
|
2178
2240
|
} catch (e5) {
|
|
2179
|
-
|
|
2241
|
+
ke && console.warn(`[Sailfish] Could not set funcspan header for ${i4}`, e5);
|
|
2180
2242
|
}
|
|
2181
2243
|
const u3 = Date.now();
|
|
2182
2244
|
let p3 = false;
|
|
@@ -2185,8 +2247,8 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2185
2247
|
const emitFinished = (e5, t4, n2, o4, s5) => {
|
|
2186
2248
|
if (p3) return;
|
|
2187
2249
|
p3 = true;
|
|
2188
|
-
const
|
|
2189
|
-
sendEvent({ type: 27, timestamp:
|
|
2250
|
+
const a4 = Date.now();
|
|
2251
|
+
sendEvent({ type: 27, timestamp: a4, sessionId: r3, data: { request_id: l3, session_id: r3, timestamp_start: u3, timestamp_end: a4, response_code: t4, success: e5, error: n2, method: this._requestMethod, url: i4, request_headers: g3, request_body: f3, response_headers: s5, response_body: o4 }, ...getUrlAndStoredUuids() });
|
|
2190
2252
|
};
|
|
2191
2253
|
return this.addEventListener("load", () => {
|
|
2192
2254
|
const e5 = this.status || 0;
|
|
@@ -2209,7 +2271,7 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2209
2271
|
2 === t4.length && (i5[t4[0]] = t4[1]);
|
|
2210
2272
|
});
|
|
2211
2273
|
} catch (e6) {
|
|
2212
|
-
|
|
2274
|
+
ke && console.warn("[Sailfish] Failed to capture XHR response headers:", e6), i5 = null;
|
|
2213
2275
|
}
|
|
2214
2276
|
if (e5 >= 200 && e5 < 300) emitFinished(true, e5, "", n2, i5);
|
|
2215
2277
|
else {
|
|
@@ -2221,7 +2283,7 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2221
2283
|
emitFinished(false, e5, t4);
|
|
2222
2284
|
}, { once: true }), o3.apply(this, e4);
|
|
2223
2285
|
};
|
|
2224
|
-
})(o2, x2), k2.xhrPatched = true), k2.fetchPatched || (setupFetchInterceptor(o2, x2), k2.fetchPatched = true), await yieldToMain(), k2.domEventsInit || (initializeDomContentEvents(
|
|
2286
|
+
})(o2, x2), k2.xhrPatched = true), k2.fetchPatched || (setupFetchInterceptor(o2, x2), k2.fetchPatched = true), await yieldToMain(), k2.domEventsInit || (initializeDomContentEvents(S2), k2.domEventsInit = true), await yieldToMain(), k2.consoleInit || (initializeConsolePlugin(Me, S2), k2.consoleInit = true), await yieldToMain(), k2.errorInit || (!(function initializeErrorInterceptor() {
|
|
2225
2287
|
window.addEventListener("error", (e3) => {
|
|
2226
2288
|
captureError(e3.error || e3.message);
|
|
2227
2289
|
}), window.addEventListener("unhandledrejection", (e3) => {
|
|
@@ -2231,14 +2293,14 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2231
2293
|
m && (sessionStorage.setItem("sailfishApiKey", e3), sessionStorage.setItem("sailfishBackendApi", t3));
|
|
2232
2294
|
})({ apiKey: e2, backendApi: t2 }), !isFunctionSpanTrackingEnabled() || k2.ws && 1 === k2.ws.readyState || fetchFunctionSpanTrackingEnabled(e2, t2).then((e3) => {
|
|
2233
2295
|
var _a2;
|
|
2234
|
-
((_a2 = e3.data) == null ? void 0 : _a2.isFunctionSpanTrackingEnabledFromApiKey) ?? false ?
|
|
2296
|
+
((_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"));
|
|
2235
2297
|
}).catch((e3) => {
|
|
2236
|
-
|
|
2237
|
-
}), k2.sentDoNotPropagateOnce || (sendDomainsToNotPropagateHeaderTo(e2, [...o2, ...
|
|
2298
|
+
ke && console.warn("[Sailfish] Failed to validate function span tracking status with backend:", e3);
|
|
2299
|
+
}), 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() {
|
|
2238
2300
|
sendMessage({ type: "deviceInfo", data: { deviceInfo: { language: navigator.language, userAgent: navigator.userAgent } } });
|
|
2239
|
-
})(), c2 && fetchAndSendIp(
|
|
2301
|
+
})(), c2 && fetchAndSendIp(S2);
|
|
2240
2302
|
try {
|
|
2241
|
-
const n2 =
|
|
2303
|
+
const n2 = a2 ?? (function readGitSha() {
|
|
2242
2304
|
var _a2;
|
|
2243
2305
|
try {
|
|
2244
2306
|
const e3 = globalThis;
|
|
@@ -2255,47 +2317,59 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2255
2317
|
if ("string" == typeof e3 && e3) return e3;
|
|
2256
2318
|
} catch {
|
|
2257
2319
|
}
|
|
2258
|
-
})(), i3 =
|
|
2320
|
+
})(), i3 = r2 ?? "", o3 = s2 ?? "", c3 = "JS/TS", d3 = (function getMapUuidFromWindow() {
|
|
2259
2321
|
try {
|
|
2260
2322
|
const e3 = window;
|
|
2261
2323
|
if (e3 && "string" == typeof e3.sfMapUuid && e3.sfMapUuid) return e3.sfMapUuid;
|
|
2262
2324
|
} catch {
|
|
2263
2325
|
}
|
|
2264
|
-
})(), u3 = withAppUrlMetadata(l2)
|
|
2326
|
+
})(), u3 = withAppUrlMetadata(l2), p3 = (function detectFramework(e3) {
|
|
2327
|
+
let t3 = false;
|
|
2328
|
+
try {
|
|
2329
|
+
t3 = "undefined" != typeof document && "loading" !== document.readyState;
|
|
2330
|
+
} catch {
|
|
2331
|
+
}
|
|
2332
|
+
const n3 = t3, i4 = [];
|
|
2333
|
+
for (const e4 of se) {
|
|
2334
|
+
const t4 = e4(n3);
|
|
2335
|
+
t4 && !i4.includes(t4) && i4.push(t4);
|
|
2336
|
+
}
|
|
2337
|
+
return { framework: i4[0] ?? null, additionalFrameworks: i4.slice(1), serviceRole: "frontend" };
|
|
2338
|
+
})(), f3 = { ...u3, serviceRole: p3.serviceRole, ...null !== p3.framework && { framework: p3.framework }, ...p3.additionalFrameworks.length > 0 && { additionalFrameworks: p3.additionalFrameworks } };
|
|
2265
2339
|
await yieldToMain();
|
|
2266
|
-
const [
|
|
2340
|
+
const [m2, h3] = await Promise.all([fetchCaptureSettings(e2, t2), startRecordingSession(e2, S2, t2, i3, o3, d3, n2, c3, f3)]), y3 = { ...Le, ...(_a = m2.data) == null ? void 0 : _a.captureSettingsFromApiKey, enableFiberTracking: g2 };
|
|
2267
2341
|
if (k2.ws && 1 === k2.ws.readyState) return;
|
|
2268
|
-
if ((_b =
|
|
2342
|
+
if ((_b = h3.data) == null ? void 0 : _b.startRecordingSession) {
|
|
2269
2343
|
const n3 = (l2 == null ? void 0 : l2.env) || (l2 == null ? void 0 : l2.environment);
|
|
2270
2344
|
await yieldToMain();
|
|
2271
|
-
const i4 = await initializeRecording(
|
|
2345
|
+
const i4 = await initializeRecording(y3, t2, e2, S2, n3, v2, w2, b2 ?? false);
|
|
2272
2346
|
k2.ws = i4, k2.initialized = true, trackDomainChangesOnce(), k2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e3 = "", t3 = "") {
|
|
2273
2347
|
window.sfMapUuid && sendMessage({ type: "mapUuid", data: { mapUuid: window.sfMapUuid, serviceIdentifier: e3, serviceVersion: t3 } });
|
|
2274
|
-
})(
|
|
2275
|
-
} else console.error("Failed to start recording session:",
|
|
2348
|
+
})(r2, s2), k2.sentMapUuidOnce = true);
|
|
2349
|
+
} else console.error("Failed to start recording session:", h3.errors || h3);
|
|
2276
2350
|
} catch (e3) {
|
|
2277
2351
|
console.error("Error starting recording:", e3);
|
|
2278
2352
|
}
|
|
2279
2353
|
}
|
|
2280
|
-
exports.DEFAULT_CAPTURE_SETTINGS =
|
|
2354
|
+
exports.DEFAULT_CAPTURE_SETTINGS = Le, exports.DEFAULT_CONSOLE_RECORDING_SETTINGS = Me, exports.STORAGE_VERSION = 1, exports.addOrUpdateMetadata = function addOrUpdateMetadata(e2) {
|
|
2281
2355
|
const t2 = { type: "addOrUpdateMetadata", metadata: e2 };
|
|
2282
2356
|
U && JSON.stringify(U) === JSON.stringify(e2) || (U = e2, sendMessage(t2));
|
|
2283
2357
|
}, exports.buildBatches = buildBatches, exports.clearStaleFuncSpanState = clearStaleFuncSpanState, exports.createTriageAndIssueFromRecorder = createTriageAndIssueFromRecorder, exports.createTriageFromRecorder = createTriageFromRecorder, exports.disableFunctionSpanTracking = disableFunctionSpanTracking, exports.enableFunctionSpanTracking = enableFunctionSpanTracking, exports.ensureHrefCache = ensureHrefCache, exports.eventSize = eventSize, exports.fetchAndSendIp = fetchAndSendIp, exports.fetchCaptureSettings = fetchCaptureSettings, exports.fetchEngineeringTicketPlatformIntegrations = fetchEngineeringTicketPlatformIntegrations, exports.fetchFunctionSpanTrackingEnabled = fetchFunctionSpanTrackingEnabled, exports.flushBufferedEvents = flushBufferedEvents, exports.getCachedHref = getCachedHref, exports.getCachedHrefNoQuery = getCachedHrefNoQuery, exports.getFuncSpanHeader = getFuncSpanHeader, exports.getOrSetSessionId = getOrSetSessionId, exports.getUrlAndStoredUuids = getUrlAndStoredUuids, exports.identify = function identify(e2, t2 = {}, n2 = false) {
|
|
2284
2358
|
const i2 = { type: "identify", userId: e2, traits: t2 };
|
|
2285
|
-
|
|
2359
|
+
z && z.userId === e2 && JSON.stringify(z.traits) === JSON.stringify(t2) || (z = { userId: e2, traits: t2, overwrite: n2 }, sendMessage(i2));
|
|
2286
2360
|
}, exports.initRecorder = async (e2) => {
|
|
2287
2361
|
if ("undefined" == typeof window) return;
|
|
2288
2362
|
const t2 = window.__sailfish_recorder || (window.__sailfish_recorder = {}), n2 = getOrSetSessionId();
|
|
2289
2363
|
return clearPageVisitDataFromSessionStorage(), t2.initialized && t2.sessionId === n2 && t2.ws && 1 === t2.ws.readyState ? void 0 : (t2.initPromise || (t2.initPromise = (async () => {
|
|
2290
2364
|
if (t2.hasLoggedInitOnce || (console.log("Initializing Sailfish Recorder (first run) …"), t2.hasLoggedInitOnce = true), await startRecording(e2), !t2.issueReportingInit) {
|
|
2291
|
-
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(() =>
|
|
2292
|
-
let
|
|
2365
|
+
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)]);
|
|
2366
|
+
let r2 = null;
|
|
2293
2367
|
try {
|
|
2294
|
-
await o2(e2.apiKey, n3),
|
|
2368
|
+
await o2(e2.apiKey, n3), r2 = s2();
|
|
2295
2369
|
} catch (e3) {
|
|
2296
2370
|
console.warn("[Sailfish] Failed to fetch integration data for issue reporting:", e3);
|
|
2297
2371
|
}
|
|
2298
|
-
i2({ apiKey: e2.apiKey, backendApi: n3, getSessionId: () => getOrSetSessionId(), shortcuts: e2.reportIssueShortcuts, customBaseUrl: e2.customBaseUrl, integrationData:
|
|
2372
|
+
i2({ apiKey: e2.apiKey, backendApi: n3, getSessionId: () => getOrSetSessionId(), shortcuts: e2.reportIssueShortcuts, customBaseUrl: e2.customBaseUrl, integrationData: r2, showEngTicketFieldsInReportIssueModalDefault: e2.showEngTicketFieldsInReportIssueModalDefault }), t2.issueReportingInit = true;
|
|
2299
2373
|
}
|
|
2300
2374
|
})().finally(() => {
|
|
2301
2375
|
delete t2.initPromise;
|