@sailfish-ai/recorder 1.11.6 → 1.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -1
- package/dist/chunkSerializer.js +70 -23
- package/dist/chunkSerializer.js.br +0 -0
- package/dist/chunkSerializer.js.gz +0 -0
- package/dist/chunks/chunkSerializer-DDukZpgl.js +116 -0
- package/dist/chunks/chunkSerializer-DDukZpgl.js.br +0 -0
- package/dist/chunks/chunkSerializer-DDukZpgl.js.gz +0 -0
- package/dist/chunks/chunkSerializer-FQtY90Av.js +115 -0
- package/dist/chunks/chunkSerializer-FQtY90Av.js.br +0 -0
- package/dist/chunks/chunkSerializer-FQtY90Av.js.gz +0 -0
- package/dist/chunks/{index-CftVmmO9.js → index-C-qbsfKe.js} +703 -542
- package/dist/chunks/index-C-qbsfKe.js.br +0 -0
- package/dist/chunks/index-C-qbsfKe.js.gz +0 -0
- package/dist/chunks/{index-QXHuV98g.js → index-D6axlCRu.js} +751 -586
- package/dist/chunks/index-D6axlCRu.js.br +0 -0
- package/dist/chunks/index-D6axlCRu.js.gz +0 -0
- package/dist/clockSync.js +196 -0
- package/dist/clockSync.js.br +0 -0
- package/dist/clockSync.js.gz +0 -0
- package/dist/graphql.js +5 -0
- package/dist/graphql.js.br +0 -0
- package/dist/graphql.js.gz +0 -0
- package/dist/inAppReportIssueModal/index.js +4 -1
- package/dist/inAppReportIssueModal/index.js.br +0 -0
- package/dist/inAppReportIssueModal/index.js.gz +0 -0
- package/dist/inAppReportIssueModal/integrations.js +36 -0
- package/dist/inAppReportIssueModal/integrations.js.br +0 -0
- package/dist/inAppReportIssueModal/integrations.js.gz +0 -0
- package/dist/inAppReportIssueModal/state.js +8 -0
- package/dist/inAppReportIssueModal/state.js.br +0 -0
- package/dist/inAppReportIssueModal/state.js.gz +0 -0
- package/dist/index.js +67 -5
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/privacyMask.js +93 -0
- package/dist/privacyMask.js.br +0 -0
- package/dist/privacyMask.js.gz +0 -0
- package/dist/recorder.cjs +2 -2
- package/dist/recorder.cjs.br +0 -0
- package/dist/recorder.cjs.gz +0 -0
- package/dist/recorder.js +25 -22
- package/dist/recorder.js.br +0 -0
- package/dist/recorder.js.gz +0 -0
- package/dist/recorder.umd.cjs +1310 -1127
- package/dist/recorder.umd.cjs.br +0 -0
- package/dist/recorder.umd.cjs.gz +0 -0
- package/dist/recording.js +84 -13
- package/dist/recording.js.br +0 -0
- package/dist/recording.js.gz +0 -0
- package/dist/types/chunkSerializer.d.ts +14 -0
- package/dist/types/clockSync.d.ts +70 -0
- package/dist/types/inAppReportIssueModal/integrations.d.ts +1 -0
- package/dist/types/inAppReportIssueModal/state.d.ts +2 -0
- package/dist/types/index.d.ts +16 -2
- package/dist/types/privacyMask.d.ts +46 -0
- package/dist/types/recording.d.ts +1 -0
- package/dist/types/types.d.ts +23 -0
- package/dist/types/websocket.d.ts +1 -0
- package/dist/websocket.js +111 -0
- package/dist/websocket.js.br +0 -0
- package/dist/websocket.js.gz +0 -0
- package/package.json +1 -1
- package/dist/chunks/chunkSerializer-D7_uK-dD.js +0 -94
- package/dist/chunks/chunkSerializer-D7_uK-dD.js.br +0 -0
- package/dist/chunks/chunkSerializer-D7_uK-dD.js.gz +0 -0
- package/dist/chunks/chunkSerializer-DkWXHnW4.js +0 -95
- package/dist/chunks/chunkSerializer-DkWXHnW4.js.br +0 -0
- package/dist/chunks/chunkSerializer-DkWXHnW4.js.gz +0 -0
- package/dist/chunks/index-CftVmmO9.js.br +0 -0
- package/dist/chunks/index-CftVmmO9.js.gz +0 -0
- package/dist/chunks/index-QXHuV98g.js.br +0 -0
- package/dist/chunks/index-QXHuV98g.js.gz +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import e from "reconnecting-websocket";
|
|
2
5
|
import { EventType as t } from "@sailfish-rrweb/types";
|
|
3
6
|
function readDebugFlag() {
|
|
@@ -35,30 +38,96 @@ function uuidv4() {
|
|
|
35
38
|
return ("x" === e2 ? t2 : 3 & t2 | 8).toString(16);
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
|
-
const n = "X-Sf3-Rid", i = 0, o = 1,
|
|
41
|
+
const n = "X-Sf3-Rid", i = 0, o = 1, s = 2, r = 4, a = "undefined" != typeof performance && "function" == typeof performance.now;
|
|
42
|
+
function monotonicNow() {
|
|
43
|
+
return a ? performance.now() : Date.now();
|
|
44
|
+
}
|
|
45
|
+
function timeOriginMs() {
|
|
46
|
+
return a ? performance.timeOrigin : 0;
|
|
47
|
+
}
|
|
48
|
+
class ClockSyncManager {
|
|
49
|
+
constructor() {
|
|
50
|
+
__publicField(this, "samples", []);
|
|
51
|
+
__publicField(this, "pending", /* @__PURE__ */ new Map());
|
|
52
|
+
__publicField(this, "estimatedOffsetMs", null);
|
|
53
|
+
__publicField(this, "bestRttMs", null);
|
|
54
|
+
__publicField(this, "lastSyncMonoMs", null);
|
|
55
|
+
}
|
|
56
|
+
beginSync(e2) {
|
|
57
|
+
const t2 = { requestId: e2, clientSendMonoMs: monotonicNow() };
|
|
58
|
+
return this.pending.set(e2, t2), t2;
|
|
59
|
+
}
|
|
60
|
+
abandonSync(e2) {
|
|
61
|
+
this.pending.delete(e2);
|
|
62
|
+
}
|
|
63
|
+
recordTimeSyncResponse(e2) {
|
|
64
|
+
const t2 = this.pending.get(e2.requestId);
|
|
65
|
+
if (!t2) return null;
|
|
66
|
+
this.pending.delete(e2.requestId);
|
|
67
|
+
const n2 = monotonicNow(), i2 = n2 - t2.clientSendMonoMs;
|
|
68
|
+
if (i2 < 0 || !isFinite(i2)) return null;
|
|
69
|
+
const o2 = (t2.clientSendMonoMs + n2) / 2, s2 = (e2.serverReceivedAtMs + e2.serverSentAtMs) / 2 - o2, r2 = { clientSendMonoMs: t2.clientSendMonoMs, clientReceiveMonoMs: n2, serverReceiveWallMs: e2.serverReceivedAtMs, serverSendWallMs: e2.serverSentAtMs, rttMs: i2, estimatedOffsetMs: s2, browserWallAtSyncMs: Date.now() };
|
|
70
|
+
return this.samples.push(r2), this.pruneSamples(n2), this.recompute(n2), r2;
|
|
71
|
+
}
|
|
72
|
+
estimateServerTime(e2) {
|
|
73
|
+
return null == this.estimatedOffsetMs ? null : this.estimatedOffsetMs + e2;
|
|
74
|
+
}
|
|
75
|
+
getSyncMetadata() {
|
|
76
|
+
const e2 = monotonicNow(), t2 = null != this.lastSyncMonoMs ? e2 - this.lastSyncMonoMs : null;
|
|
77
|
+
return { offsetMs: this.estimatedOffsetMs, rttMs: this.bestRttMs, syncAgeMs: t2 };
|
|
78
|
+
}
|
|
79
|
+
getBrowserClockSkewMs() {
|
|
80
|
+
if (0 === this.samples.length) return null;
|
|
81
|
+
const e2 = this.samples[this.samples.length - 1], t2 = e2.estimatedOffsetMs + e2.clientReceiveMonoMs;
|
|
82
|
+
return e2.browserWallAtSyncMs - t2;
|
|
83
|
+
}
|
|
84
|
+
reset() {
|
|
85
|
+
this.samples = [], this.pending.clear(), this.estimatedOffsetMs = null, this.bestRttMs = null, this.lastSyncMonoMs = null;
|
|
86
|
+
}
|
|
87
|
+
pruneSamples(e2) {
|
|
88
|
+
if (0 === this.samples.length) return;
|
|
89
|
+
const t2 = e2 - 6e5;
|
|
90
|
+
this.samples = this.samples.filter((e3) => e3.clientReceiveMonoMs >= t2), this.samples.length > 20 && (this.samples = this.samples.slice(this.samples.length - 20));
|
|
91
|
+
}
|
|
92
|
+
recompute(e2) {
|
|
93
|
+
const t2 = this.samples.filter((e3) => e3.rttMs <= 500).sort((e3, t3) => e3.rttMs - t3.rttMs).slice(0, 5);
|
|
94
|
+
if (0 === t2.length) return this.lastSyncMonoMs = e2, void (this.bestRttMs = null);
|
|
95
|
+
const n2 = t2.map((e3) => e3.estimatedOffsetMs).sort((e3, t3) => e3 - t3);
|
|
96
|
+
this.estimatedOffsetMs = n2[Math.floor(n2.length / 2)], this.bestRttMs = t2[0].rttMs, this.lastSyncMonoMs = e2;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
39
99
|
let l = null;
|
|
100
|
+
function getClockSyncManager() {
|
|
101
|
+
return l || (l = new ClockSyncManager()), l;
|
|
102
|
+
}
|
|
103
|
+
function buildEventTimeEnvelope(e2, t2) {
|
|
104
|
+
const n2 = getClockSyncManager(), i2 = n2.getSyncMetadata(), o2 = n2.estimateServerTime(e2);
|
|
105
|
+
return { client: { wallTimeMs: t2, monotonicMs: e2, timeOriginMs: timeOriginMs() }, serverEstimated: { eventTimeMs: o2, offsetMs: i2.offsetMs, rttMs: i2.rttMs, syncAgeMs: i2.syncAgeMs } };
|
|
106
|
+
}
|
|
107
|
+
const c = "recordingEvents";
|
|
108
|
+
let d = null;
|
|
40
109
|
function openDb$1() {
|
|
41
110
|
return (function hasIndexedDB$1() {
|
|
42
111
|
return "undefined" != typeof globalThis && !!globalThis.indexedDB;
|
|
43
|
-
})() ?
|
|
112
|
+
})() ? d || (d = new Promise((e2) => {
|
|
44
113
|
try {
|
|
45
114
|
const t2 = globalThis.indexedDB.open("leapsEventDB", 1);
|
|
46
115
|
t2.onupgradeneeded = () => {
|
|
47
116
|
const e3 = t2.result;
|
|
48
|
-
e3.objectStoreNames.contains(
|
|
117
|
+
e3.objectStoreNames.contains(c) || e3.createObjectStore(c, { keyPath: "id", autoIncrement: true });
|
|
49
118
|
}, t2.onsuccess = () => e2(t2.result), t2.onerror = () => e2(null), t2.onblocked = () => {
|
|
50
119
|
e2(null);
|
|
51
120
|
};
|
|
52
121
|
} catch {
|
|
53
122
|
e2(null);
|
|
54
123
|
}
|
|
55
|
-
}),
|
|
124
|
+
}), d) : Promise.resolve(null);
|
|
56
125
|
}
|
|
57
126
|
function withStore$1(e2, t2) {
|
|
58
127
|
return openDb$1().then((n2) => n2 ? new Promise((i2) => {
|
|
59
128
|
try {
|
|
60
|
-
const o2 = n2.transaction(
|
|
61
|
-
Promise.resolve(t2(
|
|
129
|
+
const o2 = n2.transaction(c, e2), s2 = o2.objectStore(c);
|
|
130
|
+
Promise.resolve(t2(s2)).then((e3) => {
|
|
62
131
|
o2.oncomplete = () => i2(e3), o2.onerror = () => i2(null);
|
|
63
132
|
}).catch(() => i2(null));
|
|
64
133
|
} catch {
|
|
@@ -71,29 +140,29 @@ async function deleteEventsByIds(e2) {
|
|
|
71
140
|
for (const n2 of e2) t2.delete(n2);
|
|
72
141
|
});
|
|
73
142
|
}
|
|
74
|
-
const
|
|
75
|
-
let
|
|
143
|
+
const u = "notifyMessages";
|
|
144
|
+
let p = null;
|
|
76
145
|
function openDb() {
|
|
77
146
|
return (function hasIndexedDB() {
|
|
78
147
|
return "undefined" != typeof globalThis && !!globalThis.indexedDB;
|
|
79
|
-
})() ?
|
|
148
|
+
})() ? p || (p = new Promise((e2) => {
|
|
80
149
|
try {
|
|
81
150
|
const t2 = globalThis.indexedDB.open("leapsNotifyDB", 1);
|
|
82
151
|
t2.onupgradeneeded = () => {
|
|
83
152
|
const e3 = t2.result;
|
|
84
|
-
e3.objectStoreNames.contains(
|
|
153
|
+
e3.objectStoreNames.contains(u) || e3.createObjectStore(u, { keyPath: "id", autoIncrement: true });
|
|
85
154
|
}, t2.onsuccess = () => e2(t2.result), t2.onerror = () => e2(null), t2.onblocked = () => e2(null);
|
|
86
155
|
} catch {
|
|
87
156
|
e2(null);
|
|
88
157
|
}
|
|
89
|
-
}),
|
|
158
|
+
}), p) : Promise.resolve(null);
|
|
90
159
|
}
|
|
91
160
|
async function withStore(e2, t2) {
|
|
92
161
|
const n2 = await openDb();
|
|
93
162
|
return n2 ? new Promise((i2) => {
|
|
94
163
|
try {
|
|
95
|
-
const o2 = n2.transaction(
|
|
96
|
-
Promise.resolve(t2(
|
|
164
|
+
const o2 = n2.transaction(u, e2), s2 = o2.objectStore(u);
|
|
165
|
+
Promise.resolve(t2(s2)).then((e3) => {
|
|
97
166
|
o2.oncomplete = () => i2(e3), o2.onerror = () => i2(null);
|
|
98
167
|
}).catch(() => i2(null));
|
|
99
168
|
} catch {
|
|
@@ -111,25 +180,25 @@ async function deleteNotifyMessageById(e2) {
|
|
|
111
180
|
t2.delete(e2);
|
|
112
181
|
});
|
|
113
182
|
}
|
|
114
|
-
const
|
|
115
|
-
let
|
|
183
|
+
const f = "undefined" != typeof globalThis && void 0 !== globalThis.window, g = "undefined" != typeof globalThis && void 0 !== globalThis.document, m = "undefined" != typeof globalThis && "localStorage" in globalThis, h = "undefined" != typeof globalThis && "sessionStorage" in globalThis, y = "sailfishSessionId", S = "__sailfish_refresh__";
|
|
184
|
+
let b = null;
|
|
116
185
|
function getOrSetSessionId() {
|
|
117
|
-
if (!
|
|
118
|
-
if (
|
|
119
|
-
const e2 = window.name.startsWith(
|
|
186
|
+
if (!f) return uuidv4();
|
|
187
|
+
if (b) return b;
|
|
188
|
+
const e2 = window.name.startsWith(S);
|
|
120
189
|
if (e2 && (window.name = window.name.substring(20)), e2) {
|
|
121
|
-
const e3 = window.sessionStorage.getItem(
|
|
122
|
-
if (e3) return
|
|
190
|
+
const e3 = window.sessionStorage.getItem(y);
|
|
191
|
+
if (e3) return b = e3, e3;
|
|
123
192
|
}
|
|
124
193
|
const t2 = uuidv4();
|
|
125
|
-
|
|
194
|
+
b = t2;
|
|
126
195
|
try {
|
|
127
|
-
window.sessionStorage.setItem(
|
|
196
|
+
window.sessionStorage.setItem(y, t2);
|
|
128
197
|
} catch (e3) {
|
|
129
198
|
}
|
|
130
199
|
return t2;
|
|
131
200
|
}
|
|
132
|
-
let
|
|
201
|
+
let v = false;
|
|
133
202
|
function buildBatches(e2, t2, n2) {
|
|
134
203
|
const i2 = {};
|
|
135
204
|
for (const t3 of e2) {
|
|
@@ -138,41 +207,61 @@ function buildBatches(e2, t2, n2) {
|
|
|
138
207
|
}
|
|
139
208
|
const o2 = [];
|
|
140
209
|
for (const e3 in i2) {
|
|
141
|
-
const
|
|
142
|
-
let
|
|
143
|
-
for (const e4 of
|
|
210
|
+
const s2 = i2[e3];
|
|
211
|
+
let r2 = [], a2 = 0;
|
|
212
|
+
for (const e4 of s2) {
|
|
144
213
|
const i3 = t2(e4);
|
|
145
|
-
|
|
214
|
+
a2 + i3 > n2 && (r2.length > 0 && (o2.push(r2), r2 = [], a2 = 0), i3 > n2) || (r2.push(e4), a2 += i3);
|
|
146
215
|
}
|
|
147
|
-
|
|
216
|
+
r2.length > 0 && o2.push(r2);
|
|
148
217
|
}
|
|
149
218
|
return o2;
|
|
150
219
|
}
|
|
151
220
|
function eventSize(e2) {
|
|
152
221
|
return JSON.stringify(e2).length;
|
|
153
222
|
}
|
|
154
|
-
let
|
|
223
|
+
let w = Date.now;
|
|
155
224
|
function withAppUrlMetadata(e2) {
|
|
156
225
|
var _a;
|
|
157
226
|
return { ...e2 ?? {}, appUrl: (e2 == null ? void 0 : e2.appUrl) ?? ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.href) };
|
|
158
227
|
}
|
|
159
|
-
/[1-9][0-9]{12}/.test(Date.now().toString()) || (
|
|
160
|
-
const
|
|
161
|
-
let
|
|
162
|
-
|
|
228
|
+
/[1-9][0-9]{12}/.test(Date.now().toString()) || (w = () => (/* @__PURE__ */ new Date()).getTime());
|
|
229
|
+
const k = readDebugFlag(), x = "per_session";
|
|
230
|
+
let I = null, T = null, E = false, M = null, C = null;
|
|
231
|
+
let $ = null, F = 0;
|
|
232
|
+
function requestTimeSync() {
|
|
233
|
+
if (!isWebSocketOpen(T)) return;
|
|
234
|
+
const e2 = getClockSyncManager(), t2 = (function makeTimeSyncRequestId() {
|
|
235
|
+
return F += 1, `ts-${F}-${Math.random().toString(36).slice(2, 10)}`;
|
|
236
|
+
})();
|
|
237
|
+
e2.beginSync(t2);
|
|
238
|
+
wsSendPayload({ type: "time-sync-request", requestId: t2, clientSentAtMs: Date.now() }) || e2.abandonSync(t2);
|
|
239
|
+
}
|
|
240
|
+
function enrichEventWithTimeSync(e2) {
|
|
241
|
+
if (!e2 || "object" != typeof e2) return;
|
|
242
|
+
if (e2.client && null != e2.client.monotonicMs) {
|
|
243
|
+
if (!(null == e2.client.timeOriginMs || Math.abs(e2.client.timeOriginMs - timeOriginMs()) <= 1)) return;
|
|
244
|
+
const t3 = buildEventTimeEnvelope(e2.client.monotonicMs, e2.client.wallTimeMs ?? Date.now());
|
|
245
|
+
return void (e2.serverEstimated ? null == e2.serverEstimated.eventTimeMs && null != t3.serverEstimated.eventTimeMs && (e2.serverEstimated = t3.serverEstimated) : e2.serverEstimated = t3.serverEstimated);
|
|
246
|
+
}
|
|
247
|
+
const t2 = buildEventTimeEnvelope(monotonicNow(), Date.now());
|
|
248
|
+
e2.client = t2.client, e2.serverEstimated = t2.serverEstimated;
|
|
249
|
+
}
|
|
250
|
+
let A = "", L = "", R = false;
|
|
251
|
+
const D = [];
|
|
163
252
|
function onNavigationChange(e2) {
|
|
164
|
-
|
|
253
|
+
D.push(e2);
|
|
165
254
|
}
|
|
166
255
|
function _updateHrefCache() {
|
|
167
|
-
|
|
168
|
-
for (const e2 of
|
|
256
|
+
A = window.location.href, L = window.location.origin + window.location.pathname;
|
|
257
|
+
for (const e2 of D) try {
|
|
169
258
|
e2();
|
|
170
259
|
} catch (e3) {
|
|
171
260
|
}
|
|
172
261
|
}
|
|
173
262
|
function ensureHrefCache() {
|
|
174
|
-
if (
|
|
175
|
-
|
|
263
|
+
if (R || "undefined" == typeof window) return;
|
|
264
|
+
R = true, _updateHrefCache(), window.addEventListener("popstate", _updateHrefCache), window.addEventListener("hashchange", _updateHrefCache);
|
|
176
265
|
const e2 = history.pushState;
|
|
177
266
|
history.pushState = function(...t3) {
|
|
178
267
|
e2.apply(this, t3), _updateHrefCache();
|
|
@@ -183,48 +272,48 @@ function ensureHrefCache() {
|
|
|
183
272
|
};
|
|
184
273
|
}
|
|
185
274
|
function getCachedHref() {
|
|
186
|
-
return
|
|
275
|
+
return A || ("undefined" != typeof window ? window.location.href : "");
|
|
187
276
|
}
|
|
188
277
|
function getCachedHrefNoQuery() {
|
|
189
|
-
return
|
|
278
|
+
return L || ("undefined" != typeof window ? window.location.origin + window.location.pathname : "");
|
|
190
279
|
}
|
|
191
|
-
const
|
|
192
|
-
let
|
|
280
|
+
const _ = [];
|
|
281
|
+
let P = null;
|
|
193
282
|
function queueEventForIDB(e2) {
|
|
194
|
-
|
|
283
|
+
_.push(e2), _.length >= 50 ? _flushIDBQueue() : P || (P = setTimeout(_flushIDBQueue, 100));
|
|
195
284
|
}
|
|
196
285
|
function _flushIDBQueue() {
|
|
197
|
-
if (
|
|
286
|
+
if (P && (clearTimeout(P), P = null), 0 === _.length) return;
|
|
198
287
|
!(async function saveEventsToIDB(e2) {
|
|
199
288
|
await withStore$1("readwrite", async (t2) => {
|
|
200
289
|
for (const n2 of e2) t2.add({ timestamp: Date.now(), data: n2 });
|
|
201
290
|
});
|
|
202
|
-
})(
|
|
291
|
+
})(_.splice(0));
|
|
203
292
|
}
|
|
204
|
-
let
|
|
205
|
-
const
|
|
293
|
+
let B = false, O = null, j = null, U = false;
|
|
294
|
+
const N = "sailfish_funcspan_global_state";
|
|
206
295
|
function wsSendPayload(e2) {
|
|
207
|
-
if (!isWebSocketOpen(
|
|
208
|
-
if (
|
|
209
|
-
return
|
|
296
|
+
if (!isWebSocketOpen(T)) return false;
|
|
297
|
+
if (I) try {
|
|
298
|
+
return I.postMessage({ type: "send", payload: e2 }), true;
|
|
210
299
|
} catch {
|
|
211
300
|
return false;
|
|
212
301
|
}
|
|
213
302
|
try {
|
|
214
|
-
return
|
|
303
|
+
return T.send(JSON.stringify(e2)), true;
|
|
215
304
|
} catch {
|
|
216
305
|
return false;
|
|
217
306
|
}
|
|
218
307
|
}
|
|
219
308
|
function wsSendRaw(e2) {
|
|
220
|
-
if (!isWebSocketOpen(
|
|
221
|
-
if (
|
|
222
|
-
return
|
|
309
|
+
if (!isWebSocketOpen(T)) return false;
|
|
310
|
+
if (I) try {
|
|
311
|
+
return I.postMessage({ type: "sendRaw", payload: e2 }), true;
|
|
223
312
|
} catch {
|
|
224
313
|
return false;
|
|
225
314
|
}
|
|
226
315
|
try {
|
|
227
|
-
return
|
|
316
|
+
return T.send(e2), true;
|
|
228
317
|
} catch {
|
|
229
318
|
return false;
|
|
230
319
|
}
|
|
@@ -233,40 +322,40 @@ function saveGlobalFuncSpanState(e2, t2) {
|
|
|
233
322
|
try {
|
|
234
323
|
if ("undefined" == typeof localStorage) return;
|
|
235
324
|
const n2 = { enabled: e2, expirationTimestampMs: t2, savedAt: Date.now() };
|
|
236
|
-
localStorage.setItem(
|
|
325
|
+
localStorage.setItem(N, JSON.stringify(n2)), k && console.log("[Sailfish] Saved funcSpan state to localStorage:", n2);
|
|
237
326
|
} catch (e3) {
|
|
238
|
-
|
|
327
|
+
k && console.warn("[Sailfish] Failed to save funcSpan state to localStorage:", e3);
|
|
239
328
|
}
|
|
240
329
|
}
|
|
241
330
|
function clearGlobalFuncSpanState() {
|
|
242
331
|
try {
|
|
243
332
|
if ("undefined" == typeof localStorage) return;
|
|
244
|
-
localStorage.removeItem(
|
|
333
|
+
localStorage.removeItem(N), k && console.log("[Sailfish] Cleared funcSpan state from localStorage");
|
|
245
334
|
} catch (e2) {
|
|
246
|
-
|
|
335
|
+
k && console.warn("[Sailfish] Failed to clear funcSpan state from localStorage:", e2);
|
|
247
336
|
}
|
|
248
337
|
}
|
|
249
338
|
function clearStaleFuncSpanState() {
|
|
250
|
-
|
|
339
|
+
B = false, j = null, U = false, clearGlobalFuncSpanState(), k && console.log("[Sailfish] Cleared stale function span tracking state (backend validation failed)");
|
|
251
340
|
}
|
|
252
|
-
let
|
|
341
|
+
let q = false;
|
|
253
342
|
function restoreFuncSpanState() {
|
|
254
|
-
if (
|
|
255
|
-
|
|
343
|
+
if (q) return;
|
|
344
|
+
q = true;
|
|
256
345
|
const e2 = (function loadGlobalFuncSpanState() {
|
|
257
346
|
try {
|
|
258
347
|
if ("undefined" == typeof localStorage) return null;
|
|
259
|
-
const e3 = localStorage.getItem(
|
|
348
|
+
const e3 = localStorage.getItem(N);
|
|
260
349
|
if (!e3) return null;
|
|
261
350
|
const t2 = JSON.parse(e3);
|
|
262
|
-
return
|
|
351
|
+
return k && console.log("[Sailfish] Loaded funcSpan state from localStorage:", t2), t2;
|
|
263
352
|
} catch (e3) {
|
|
264
|
-
return
|
|
353
|
+
return k && console.warn("[Sailfish] Failed to load funcSpan state from localStorage:", e3), null;
|
|
265
354
|
}
|
|
266
355
|
})();
|
|
267
|
-
if (e2 && e2.enabled) if (
|
|
268
|
-
Date.now() >=
|
|
269
|
-
} else
|
|
356
|
+
if (e2 && e2.enabled) if (B = true, j = e2.expirationTimestampMs, U = false, k && console.log("[Sailfish] Restored global function span tracking from localStorage:", { enabled: true, expirationTime: j }), null !== j) {
|
|
357
|
+
Date.now() >= j ? (B = false, j = null, clearGlobalFuncSpanState(), k && console.log("[Sailfish] Persisted tracking already expired, cleared state")) : k && console.log("[Sailfish] Function span tracking is active and valid (temporary until WebSocket confirms)");
|
|
358
|
+
} else k && console.log("[Sailfish] Function span tracking is active (no expiration, temporary until WebSocket confirms)");
|
|
270
359
|
}
|
|
271
360
|
function isWebSocketOpen(e2) {
|
|
272
361
|
return (e2 == null ? void 0 : e2.readyState) === WebSocket.OPEN;
|
|
@@ -278,7 +367,7 @@ async function flushNotifyQueue() {
|
|
|
278
367
|
n2.onsuccess = () => t2(n2.result), n2.onerror = () => t2([]);
|
|
279
368
|
})) ?? [];
|
|
280
369
|
})();
|
|
281
|
-
if (isWebSocketOpen(
|
|
370
|
+
if (isWebSocketOpen(T)) try {
|
|
282
371
|
for (const t2 of e2) {
|
|
283
372
|
if (!wsSendRaw(t2.value)) break;
|
|
284
373
|
await deleteNotifyMessageById(t2.id);
|
|
@@ -287,9 +376,9 @@ async function flushNotifyQueue() {
|
|
|
287
376
|
}
|
|
288
377
|
}
|
|
289
378
|
async function flushBufferedEvents() {
|
|
290
|
-
if (isWebSocketOpen(
|
|
379
|
+
if (isWebSocketOpen(T)) if (M) await M;
|
|
291
380
|
else {
|
|
292
|
-
|
|
381
|
+
M = (async () => {
|
|
293
382
|
var _a, _b;
|
|
294
383
|
const e2 = await (async function getAllIndexedEvents() {
|
|
295
384
|
const e3 = await withStore$1("readonly", (e4) => new Promise((t4) => {
|
|
@@ -307,8 +396,8 @@ async function flushBufferedEvents() {
|
|
|
307
396
|
for (const e3 of Object.values(t2)) {
|
|
308
397
|
const t3 = buildBatches(e3, (e4) => eventSize(e4.data), 52428800);
|
|
309
398
|
for (const e4 of t3) {
|
|
310
|
-
if (!isWebSocketOpen(
|
|
311
|
-
const t4 = e4.map((e5) => (e5.data.appUrl || (e5.data.appUrl = getCachedHref()), e5.data)), n2 = e4.map((e5) => e5.id).filter((e5) => null != e5);
|
|
399
|
+
if (!isWebSocketOpen(T)) break;
|
|
400
|
+
const t4 = e4.map((e5) => (e5.data.appUrl || (e5.data.appUrl = getCachedHref()), enrichEventWithTimeSync(e5.data), e5.data)), n2 = e4.map((e5) => e5.id).filter((e5) => null != e5);
|
|
312
401
|
try {
|
|
313
402
|
wsSendPayload({ type: "events", events: t4, mapUuid: window.sfMapUuid }) && await deleteEventsByIds(n2);
|
|
314
403
|
} catch (e5) {
|
|
@@ -317,64 +406,73 @@ async function flushBufferedEvents() {
|
|
|
317
406
|
}
|
|
318
407
|
})();
|
|
319
408
|
try {
|
|
320
|
-
await
|
|
409
|
+
await M;
|
|
321
410
|
} finally {
|
|
322
|
-
|
|
411
|
+
M = null;
|
|
323
412
|
}
|
|
324
413
|
}
|
|
325
414
|
}
|
|
326
415
|
function sendEvent(e2) {
|
|
327
|
-
e2.app_url || (e2.app_url = getCachedHref()), !
|
|
416
|
+
e2.app_url || (e2.app_url = getCachedHref()), enrichEventWithTimeSync(e2), !E && isWebSocketOpen(T) && wsSendPayload({ type: "event", event: e2, mapUuid: window.sfMapUuid }) || queueEventForIDB(e2);
|
|
328
417
|
}
|
|
329
418
|
function handleWsOpen() {
|
|
330
|
-
|
|
419
|
+
k && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (B ? "ENABLED" : "DISABLED"))), (async () => {
|
|
331
420
|
try {
|
|
332
|
-
|
|
421
|
+
E = true, await flushNotifyQueue(), await flushBufferedEvents();
|
|
333
422
|
} finally {
|
|
334
|
-
|
|
423
|
+
E = false;
|
|
335
424
|
}
|
|
336
|
-
null !=
|
|
425
|
+
null != C && clearInterval(C), C = window.setInterval(() => {
|
|
337
426
|
flushBufferedEvents();
|
|
338
427
|
}, 2e3);
|
|
428
|
+
})(), (function kickoffTimeSyncBurst() {
|
|
429
|
+
if ("undefined" != typeof window) for (let e2 = 0; e2 < 3; e2++) window.setTimeout(requestTimeSync, 250 * e2);
|
|
430
|
+
})(), (function startTimeSyncInterval() {
|
|
431
|
+
null == $ && "undefined" != typeof window && ($ = window.setInterval(() => {
|
|
432
|
+
requestTimeSync();
|
|
433
|
+
}, 6e4));
|
|
339
434
|
})();
|
|
340
435
|
}
|
|
341
436
|
function handleWsClose() {
|
|
342
|
-
null !=
|
|
437
|
+
null != C && (clearInterval(C), C = null), (function stopTimeSyncInterval() {
|
|
438
|
+
null != $ && "undefined" != typeof window && (window.clearInterval($), $ = null);
|
|
439
|
+
})(), k && console.log("[Sailfish] WebSocket closed");
|
|
343
440
|
}
|
|
344
441
|
function handleWsMessage(e2) {
|
|
345
442
|
try {
|
|
346
443
|
const t2 = JSON.parse(e2);
|
|
347
|
-
if ("
|
|
444
|
+
if ("time-sync-response" === t2.type) return void getClockSyncManager().recordTimeSyncResponse({ requestId: t2.requestId, serverReceivedAtMs: t2.serverReceivedAtMs, serverSentAtMs: t2.serverSentAtMs });
|
|
445
|
+
if ("funcSpanTrackingControl" === t2.type) if (k && console.log("[Sailfish] Received funcSpanTrackingControl message:", { enabled: t2.enabled, timeoutSeconds: t2.timeoutSeconds, expirationTimestampMs: t2.expirationTimestampMs }), null !== O && (window.clearTimeout(O), O = null), B = t2.enabled, U = false, k && console.log("[Sailfish] Function span tracking " + (t2.enabled ? "ENABLED (GLOBAL)" : "DISABLED (GLOBAL)")), t2.enabled) {
|
|
348
446
|
if (t2.expirationTimestampMs) {
|
|
349
|
-
|
|
350
|
-
const e3 = Date.now(), n2 =
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}, n2)) : (
|
|
447
|
+
j = t2.expirationTimestampMs;
|
|
448
|
+
const e3 = Date.now(), n2 = j - e3;
|
|
449
|
+
k && console.log(`[Sailfish] Server expiration timestamp: ${j}, ms until expiration: ${n2}`), n2 > 0 ? (saveGlobalFuncSpanState(true, j), O = window.setTimeout(() => {
|
|
450
|
+
U || (B = false, j = null, clearGlobalFuncSpanState(), k && console.log("[Sailfish] GLOBAL function span tracking auto-disabled at server expiration time"), wsSendPayload({ type: "funcSpanTrackingExpired", sessionId: getOrSetSessionId(), expiredAt: Date.now() }), k && console.log("[Sailfish] Notified backend that function span tracking expired"));
|
|
451
|
+
}, n2)) : (B = false, j = null, clearGlobalFuncSpanState(), k && console.log("[Sailfish] Tracking already expired, not enabling"));
|
|
354
452
|
} else {
|
|
355
453
|
const e3 = t2.timeoutSeconds || 3600;
|
|
356
|
-
e3 > 0 && (
|
|
357
|
-
|
|
454
|
+
e3 > 0 && (j = Date.now() + 1e3 * e3, saveGlobalFuncSpanState(true, j), O = window.setTimeout(() => {
|
|
455
|
+
U || (B = false, j = null, clearGlobalFuncSpanState(), k && console.log(`[Sailfish] GLOBAL function span tracking auto-disabled after ${e3}s (legacy)`), wsSendPayload({ type: "funcSpanTrackingExpired", sessionId: getOrSetSessionId(), expiredAt: Date.now() }), k && console.log("[Sailfish] Notified backend that function span tracking expired (legacy timeout)"));
|
|
358
456
|
}, 1e3 * e3));
|
|
359
457
|
}
|
|
360
458
|
try {
|
|
361
459
|
const e3 = getOrSetSessionId();
|
|
362
|
-
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: e3, enabled: true, configurationType: "global" }),
|
|
460
|
+
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: e3, enabled: true, configurationType: "global" }), k && console.log(`[Sailfish] GLOBAL tracking session report sent for session: ${e3}`);
|
|
363
461
|
} catch (e3) {
|
|
364
|
-
|
|
462
|
+
k && console.warn("[Sailfish] Failed to send GLOBAL tracking session report:", e3);
|
|
365
463
|
}
|
|
366
|
-
} else
|
|
464
|
+
} else j = null, clearGlobalFuncSpanState();
|
|
367
465
|
} catch (e3) {
|
|
368
466
|
}
|
|
369
467
|
}
|
|
370
|
-
function initializeWebSocket(t2, n2, i2, o2,
|
|
468
|
+
function initializeWebSocket(t2, n2, i2, o2, s2 = false) {
|
|
371
469
|
ensureHrefCache();
|
|
372
|
-
const
|
|
470
|
+
const r2 = (function getWebSocketHost(e2) {
|
|
373
471
|
const t3 = new URL(e2);
|
|
374
472
|
return `${t3.hostname}${t3.port ? `:${t3.port}` : ""}`;
|
|
375
473
|
})(t2);
|
|
376
|
-
let
|
|
377
|
-
if (o2 && (
|
|
474
|
+
let a2 = `${"https:" === new URL(t2).protocol ? "wss" : "ws"}://${r2}/ws/notify/?apiKey=${n2}&sessionId=${i2}&sender=JS%2FTS&version=1.12.4`;
|
|
475
|
+
if (o2 && (a2 += `&envValue=${encodeURIComponent(o2)}`), I = s2 ? (function tryCreateWsWorker() {
|
|
378
476
|
if ("undefined" == typeof Worker) return null;
|
|
379
477
|
try {
|
|
380
478
|
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);
|
|
@@ -382,107 +480,107 @@ function initializeWebSocket(t2, n2, i2, o2, a2 = false) {
|
|
|
382
480
|
} catch {
|
|
383
481
|
return null;
|
|
384
482
|
}
|
|
385
|
-
})() : null,
|
|
386
|
-
const e2 =
|
|
387
|
-
t3.readyState = WebSocket.CLOSED, e2.postMessage({ type: "close" }), e2.terminate(),
|
|
483
|
+
})() : null, I) {
|
|
484
|
+
const e2 = I, t3 = { readyState: WebSocket.CONNECTING, close: () => {
|
|
485
|
+
t3.readyState = WebSocket.CLOSED, e2.postMessage({ type: "close" }), e2.terminate(), I = null, null != C && (clearInterval(C), C = null);
|
|
388
486
|
} };
|
|
389
|
-
return
|
|
487
|
+
return T = t3, I.onmessage = (e3) => {
|
|
390
488
|
const n3 = e3.data;
|
|
391
489
|
"open" === n3.type ? (t3.readyState = WebSocket.OPEN, handleWsOpen()) : "close" === n3.type ? (t3.readyState = WebSocket.CLOSED, handleWsClose()) : "message" === n3.type && handleWsMessage(n3.data);
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
},
|
|
490
|
+
}, I.onerror = () => {
|
|
491
|
+
k && console.warn("[Sailfish] WebSocket worker error");
|
|
492
|
+
}, I.postMessage({ type: "init", wsUrl: a2 }), k && console.log("[Sailfish] WebSocket running in Web Worker (off main thread)"), t3;
|
|
395
493
|
}
|
|
396
|
-
|
|
397
|
-
const l2 = new e(
|
|
494
|
+
k && console.log("[Sailfish] WebSocket running on main thread (Worker unavailable)");
|
|
495
|
+
const l2 = new e(a2, [], { connectionTimeout: 3e4 }), c2 = { get readyState() {
|
|
398
496
|
return l2.readyState;
|
|
399
497
|
}, close: () => {
|
|
400
|
-
l2.close(), null !=
|
|
498
|
+
l2.close(), null != C && (clearInterval(C), C = null);
|
|
401
499
|
} };
|
|
402
|
-
return
|
|
500
|
+
return T = c2, l2.addEventListener("open", () => handleWsOpen()), l2.addEventListener("close", () => handleWsClose()), l2.addEventListener("message", (e2) => handleWsMessage(e2.data)), c2;
|
|
403
501
|
}
|
|
404
502
|
function sendMessage(e2) {
|
|
405
|
-
"sessionId" in e2 || (e2.sessionId = getOrSetSessionId()), e2.app_url || (e2.app_url = getCachedHref()),
|
|
503
|
+
"sessionId" in e2 || (e2.sessionId = getOrSetSessionId()), e2.app_url || (e2.app_url = getCachedHref()), enrichEventWithTimeSync(e2), E || !isWebSocketOpen(T) ? saveNotifyMessageToIDB(JSON.stringify(e2)) : wsSendPayload(e2) || saveNotifyMessageToIDB(JSON.stringify(e2));
|
|
406
504
|
}
|
|
407
505
|
function enableFunctionSpanTracking() {
|
|
408
|
-
if (
|
|
409
|
-
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: true, configurationType:
|
|
410
|
-
} else
|
|
506
|
+
if (k && console.log("[Sailfish] enableFunctionSpanTracking() called - Report Issue recording started (LOCAL MODE)"), B = true, U = true, j = null, null !== O && (window.clearTimeout(O), O = null), isWebSocketOpen(T)) {
|
|
507
|
+
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: true, configurationType: x });
|
|
508
|
+
} else k && console.warn("[Sailfish] WebSocket not open, cannot report LOCAL tracking session");
|
|
411
509
|
}
|
|
412
510
|
function disableFunctionSpanTracking() {
|
|
413
|
-
if (
|
|
414
|
-
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: false, configurationType:
|
|
511
|
+
if (k && console.log("[Sailfish] disableFunctionSpanTracking() called - Report Issue recording stopped"), isWebSocketOpen(T)) {
|
|
512
|
+
wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: false, configurationType: x });
|
|
415
513
|
} else console.warn("[FUNCSPAN STOP] ✗ WebSocket not open, cannot notify tracking end");
|
|
416
|
-
|
|
514
|
+
U && (B = false, U = false, j = null, k && console.log("[Sailfish] LOCAL tracking mode disabled")), null !== O && (window.clearTimeout(O), O = null);
|
|
417
515
|
}
|
|
418
516
|
function isFunctionSpanTrackingEnabled() {
|
|
419
|
-
return
|
|
517
|
+
return B;
|
|
420
518
|
}
|
|
421
519
|
function initializeFunctionSpanTrackingFromApi(e2) {
|
|
422
|
-
e2 && !
|
|
520
|
+
e2 && !B ? (B = true, U = false, j = null, k && console.log("[Sailfish] Function span tracking initialized as ENABLED from API check")) : !e2 && B && (B = false, U = false, j = null, k && console.log("[Sailfish] Function span tracking initialized as DISABLED from API check"));
|
|
423
521
|
}
|
|
424
522
|
function getFuncSpanHeader() {
|
|
425
|
-
if (!
|
|
426
|
-
if (null !==
|
|
427
|
-
if (Date.now() >=
|
|
523
|
+
if (!B) return null;
|
|
524
|
+
if (null !== j) {
|
|
525
|
+
if (Date.now() >= j) return B = false, j = null, clearGlobalFuncSpanState(), k && console.log("[Sailfish] Function span tracking expired on header check - disabling now"), null;
|
|
428
526
|
}
|
|
429
527
|
return { name: "X-Sf3-FunctionSpanCaptureOverride", value: "1-1-10-10-1-1.0-1-0-0" };
|
|
430
528
|
}
|
|
431
|
-
const
|
|
432
|
-
let
|
|
529
|
+
const z = Object.freeze(Object.defineProperty({ __proto__: null, clearStaleFuncSpanState, disableFunctionSpanTracking, enableFunctionSpanTracking, ensureHrefCache, flushBufferedEvents, getCachedHref, getCachedHrefNoQuery, getFuncSpanHeader, initializeFunctionSpanTrackingFromApi, initializeWebSocket, isFunctionSpanTrackingEnabled, onNavigationChange, requestTimeSync, restoreFuncSpanState, sendEvent, sendMessage }, Symbol.toStringTag, { value: "Module" }));
|
|
530
|
+
let H = null, W = null;
|
|
433
531
|
function getIdentifiedUser() {
|
|
434
|
-
return
|
|
532
|
+
return H;
|
|
435
533
|
}
|
|
436
534
|
function identify(e2, t2 = {}, n2 = false) {
|
|
437
535
|
const i2 = { type: "identify", userId: e2, traits: t2 };
|
|
438
|
-
|
|
536
|
+
H && H.userId === e2 && JSON.stringify(H.traits) === JSON.stringify(t2) || (H = { userId: e2, traits: t2, overwrite: n2 }, sendMessage(i2));
|
|
439
537
|
}
|
|
440
538
|
function addOrUpdateMetadata(e2) {
|
|
441
539
|
const t2 = { type: "addOrUpdateMetadata", metadata: e2 };
|
|
442
|
-
|
|
540
|
+
W && JSON.stringify(W) === JSON.stringify(e2) || (W = e2, sendMessage(t2));
|
|
443
541
|
}
|
|
444
542
|
function trackingEvent(e2) {
|
|
445
|
-
sendMessage({ type: "trackingEvent", trackingData: e2, timestamp:
|
|
543
|
+
sendMessage({ type: "trackingEvent", trackingData: e2, timestamp: w() });
|
|
446
544
|
}
|
|
447
|
-
let
|
|
448
|
-
const
|
|
545
|
+
let K = null;
|
|
546
|
+
const V = ["https://api.ipify.org?format=json", "https://api.ip.sb/jsonip", "https://api4.my-ip.io/ip.json"];
|
|
449
547
|
function fetchAndSendIp(e2) {
|
|
450
|
-
|
|
451
|
-
for (const e3 of
|
|
548
|
+
K !== e2 && (K = e2, (async () => {
|
|
549
|
+
for (const e3 of V) try {
|
|
452
550
|
const t2 = new AbortController(), n2 = setTimeout(() => t2.abort(), 5e3), i2 = await fetch(e3, { signal: t2.signal });
|
|
453
551
|
if (clearTimeout(n2), !i2.ok) continue;
|
|
454
|
-
const o2 = await i2.json(),
|
|
455
|
-
if (
|
|
552
|
+
const o2 = await i2.json(), s2 = o2.ip || o2.origin || null;
|
|
553
|
+
if (s2 && "string" == typeof s2 && s2.length <= 45) return void sendMessage({ type: "visitorIp", ip: s2, timestamp: w() });
|
|
456
554
|
} catch {
|
|
457
555
|
}
|
|
458
|
-
|
|
556
|
+
K = null;
|
|
459
557
|
})().catch(() => {
|
|
460
|
-
|
|
558
|
+
K = null;
|
|
461
559
|
}));
|
|
462
560
|
}
|
|
463
|
-
let
|
|
561
|
+
let G = null;
|
|
464
562
|
async function getSourceMapModule() {
|
|
465
|
-
return
|
|
563
|
+
return G || (G = await import("source-map-js")), G;
|
|
466
564
|
}
|
|
467
|
-
const
|
|
565
|
+
const Q = /* @__PURE__ */ new Map(), J = /(?:\(|\s|^)(https?:\/\/[^)\s]+|\/[^)\s]+|[^)\s]+)?\/?([^/]+\.js)(?:\?[^:)]*)?:(\d+):(\d+)/;
|
|
468
566
|
async function getConsumerFor(e2, t2) {
|
|
469
567
|
const n2 = (e2 || `/assets/${t2}`).split("?")[0], i2 = [`${n2}.map`, n2.replace(/\.js$/, ".js.map"), `/assets/${t2}.map`], { SourceMapConsumer: o2 } = await getSourceMapModule();
|
|
470
568
|
for (const e3 of i2) try {
|
|
471
|
-
if (
|
|
569
|
+
if (Q.has(e3)) return Q.get(e3);
|
|
472
570
|
const t3 = await fetch(e3);
|
|
473
571
|
if (!t3.ok) continue;
|
|
474
572
|
const n3 = await t3.json();
|
|
475
573
|
if (!n3 || !n3.mappings || !n3.sources) continue;
|
|
476
574
|
const i3 = await new o2(n3);
|
|
477
|
-
return
|
|
575
|
+
return Q.set(e3, i3), i3;
|
|
478
576
|
} catch {
|
|
479
577
|
}
|
|
480
578
|
return null;
|
|
481
579
|
}
|
|
482
580
|
async function captureError(e2, t2 = false, n2) {
|
|
483
581
|
let i2, o2;
|
|
484
|
-
const
|
|
485
|
-
e2 instanceof Error ? (i2 = e2.message || e2.name, o2 = e2.stack || "No stack trace",
|
|
582
|
+
const s2 = [];
|
|
583
|
+
e2 instanceof Error ? (i2 = e2.message || e2.name, o2 = e2.stack || "No stack trace", s2.push(`${e2.name}: ${i2}`)) : "string" == typeof e2 ? (i2 = e2, o2 = "No stack trace available", s2.push(t2 ? `Uncaught (in promise) ${e2}` : e2)) : (i2 = (function describeNonError(e3) {
|
|
486
584
|
if (null === e3) return "null";
|
|
487
585
|
if (void 0 === e3) return "undefined";
|
|
488
586
|
if ("string" == typeof e3) return e3;
|
|
@@ -496,18 +594,18 @@ async function captureError(e2, t2 = false, n2) {
|
|
|
496
594
|
} catch {
|
|
497
595
|
return Object.prototype.toString.call(e3);
|
|
498
596
|
}
|
|
499
|
-
})(e2), o2 = "No stack trace available",
|
|
500
|
-
const
|
|
597
|
+
})(e2), o2 = "No stack trace available", s2.push(t2 ? `Uncaught (in promise) ${i2}` : i2)), (n2 == null ? void 0 : n2.filename) && s2.push(`at ${n2.filename}:${n2.lineno ?? 0}:${n2.colno ?? 0}`);
|
|
598
|
+
const r2 = await (async function resolveStackTrace(e3) {
|
|
501
599
|
if (!e3) return ["No stack trace available"];
|
|
502
600
|
const t3 = Array.isArray(e3) ? e3 : e3.split("\n"), n3 = [];
|
|
503
601
|
for (const e4 of t3) {
|
|
504
|
-
const t4 = e4.match(
|
|
602
|
+
const t4 = e4.match(J);
|
|
505
603
|
if (!t4) {
|
|
506
604
|
n3.push(e4);
|
|
507
605
|
continue;
|
|
508
606
|
}
|
|
509
|
-
const [, i3, o3,
|
|
510
|
-
if (!Number.isFinite(
|
|
607
|
+
const [, i3, o3, s3, r3] = t4, a3 = parseInt(s3, 10), l3 = Math.max(0, parseInt(r3, 10) - 1);
|
|
608
|
+
if (!Number.isFinite(a3) || !Number.isFinite(l3)) {
|
|
511
609
|
n3.push(e4 + " [Invalid line/column]");
|
|
512
610
|
continue;
|
|
513
611
|
}
|
|
@@ -517,62 +615,62 @@ async function captureError(e2, t2 = false, n2) {
|
|
|
517
615
|
continue;
|
|
518
616
|
}
|
|
519
617
|
const { SourceMapConsumer: d2 } = await getSourceMapModule();
|
|
520
|
-
let u2 = c3.originalPositionFor({ line:
|
|
521
|
-
if (!u2.source || null == u2.line) for (let e5 = 1; e5 <= 20 && (u2 = c3.originalPositionFor({ line:
|
|
618
|
+
let u2 = c3.originalPositionFor({ line: a3, column: l3, bias: d2.GREATEST_LOWER_BOUND });
|
|
619
|
+
if (!u2.source || null == u2.line) for (let e5 = 1; e5 <= 20 && (u2 = c3.originalPositionFor({ line: a3, column: Math.max(0, l3 - e5), bias: d2.GREATEST_LOWER_BOUND }), !u2.source || null == u2.line); e5++) ;
|
|
522
620
|
if (u2.source && null != u2.line) {
|
|
523
621
|
const e5 = u2.name || "anonymous";
|
|
524
622
|
n3.push(`${u2.source}:${u2.line}:${u2.column ?? 0} (${e5})`);
|
|
525
623
|
} else n3.push(`${e4} [No mapping found in ${o3}]`);
|
|
526
624
|
}
|
|
527
625
|
return n3;
|
|
528
|
-
})(o2),
|
|
529
|
-
sendMessage({ type: "event", event: { type: 6, timestamp: c2, data: { payload: { message: i2, stack: o2, trace: l2, filteredStack:
|
|
530
|
-
}
|
|
531
|
-
const
|
|
532
|
-
const
|
|
533
|
-
function sendGraphQLRequest(e2, t2, n2, i2 = 5, o2 = 2e3,
|
|
534
|
-
const
|
|
535
|
-
return
|
|
536
|
-
let
|
|
626
|
+
})(o2), a2 = r2.filter((e3) => !e3.includes("chunk-") && !e3.includes("react-dom")), l2 = a2.length > 0 ? a2 : r2, c2 = Date.now();
|
|
627
|
+
sendMessage({ type: "event", event: { type: 6, timestamp: c2, data: { payload: { message: i2, stack: o2, trace: l2, filteredStack: a2, payload: s2, userAgent: navigator.userAgent, url: window.location.href, timestamp: c2, level: "error" } } } });
|
|
628
|
+
}
|
|
629
|
+
const X = readDebugFlag();
|
|
630
|
+
const Z = readDebugFlag();
|
|
631
|
+
function sendGraphQLRequest(e2, t2, n2, i2 = 5, o2 = 2e3, s2 = 2) {
|
|
632
|
+
const r2 = `${n2.backendApi}/graphql/?apiKey=${n2.apiKey}`;
|
|
633
|
+
return Z && console.log(`Initial GraphQL request for ${e2} at ${r2}`), (function exponentialBackoff(e3, t3, n3 = 5, i3 = 2e3, o3 = 2) {
|
|
634
|
+
let s3 = 0;
|
|
537
635
|
const attemptRequest = async () => {
|
|
538
636
|
try {
|
|
539
637
|
return await e3();
|
|
540
638
|
} catch (e4) {
|
|
541
|
-
if (
|
|
542
|
-
const
|
|
543
|
-
return
|
|
639
|
+
if (s3++, s3 > n3) throw e4;
|
|
640
|
+
const r3 = i3 * Math.pow(o3, s3 - 1);
|
|
641
|
+
return X && console.log(`Attempt ${s3} failed: ${t3}; Retrying in ${r3}ms...`), await new Promise((e5) => setTimeout(e5, r3)), attemptRequest();
|
|
544
642
|
}
|
|
545
643
|
};
|
|
546
644
|
return attemptRequest();
|
|
547
|
-
})(() => fetch(
|
|
548
|
-
if (
|
|
645
|
+
})(() => fetch(r2, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ operationName: e2, query: t2, variables: n2 }) }).then((e3) => {
|
|
646
|
+
if (Z && console.log(`Received response with status: ${e3.status}`), !e3.ok) throw new Error(`GraphQL request failed with status ${e3.status}`);
|
|
549
647
|
return e3.json();
|
|
550
|
-
}), "Sending GraphQL request to Sailfish AI", i2, o2,
|
|
648
|
+
}), "Sending GraphQL request to Sailfish AI", i2, o2, s2);
|
|
551
649
|
}
|
|
552
650
|
function fetchCaptureSettings(e2, t2) {
|
|
553
|
-
return sendGraphQLRequest("GetCaptureSettingsFromApiKey", "\n query GetCaptureSettingsFromApiKey($apiKey: String!) {\n captureSettingsFromApiKey(apiKey: $apiKey) {\n recordCanvas\n recordCrossOriginIframes\n collectFonts\n inlineImages\n recordPassword\n recordRealName\n recordCreditCardInfo\n recordSsn\n recordDob\n sampling\n textEditThrottleEnabled\n }\n }\n ", { apiKey: e2, backendApi: t2 });
|
|
651
|
+
return sendGraphQLRequest("GetCaptureSettingsFromApiKey", "\n query GetCaptureSettingsFromApiKey($apiKey: String!) {\n captureSettingsFromApiKey(apiKey: $apiKey) {\n recordCanvas\n recordCrossOriginIframes\n collectFonts\n inlineImages\n recordPassword\n recordRealName\n recordCreditCardInfo\n recordSsn\n recordDob\n sampling\n textEditThrottleEnabled\n maskInputSelector\n maskTextSelector\n blockSelector\n unmaskSelector\n maskInputOptions\n }\n }\n ", { apiKey: e2, backendApi: t2 });
|
|
554
652
|
}
|
|
555
653
|
function fetchFunctionSpanTrackingEnabled(e2, t2) {
|
|
556
654
|
return sendGraphQLRequest("GetFunctionSpanTrackingEnabledFromApiKey", "\n query GetFunctionSpanTrackingEnabledFromApiKey($apiKey: String!) {\n isFunctionSpanTrackingEnabledFromApiKey(apiKey: $apiKey)\n }\n ", { apiKey: e2, backendApi: t2 });
|
|
557
655
|
}
|
|
558
|
-
function startRecordingSession(e2, t2, n2, i2, o2,
|
|
559
|
-
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:
|
|
656
|
+
function startRecordingSession(e2, t2, n2, i2, o2, s2, r2, a2, l2) {
|
|
657
|
+
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 });
|
|
560
658
|
}
|
|
561
659
|
function sendDomainsToNotPropagateHeaderTo(e2, t2, n2) {
|
|
562
660
|
return sendGraphQLRequest("DomainsToNotPassHeaderTo", "mutation DomainsToNotPassHeaderTo($apiKey: String!, $domains: [String!]!) {\n domainsToNotPassHeaderTo(apiKey: $apiKey, domains: $domains)\n }", { apiKey: e2, domains: t2, backendApi: n2 });
|
|
563
661
|
}
|
|
564
|
-
function createTriageFromRecorder(e2, t2, n2, i2, o2,
|
|
565
|
-
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:
|
|
662
|
+
function createTriageFromRecorder(e2, t2, n2, i2, o2, s2, r2) {
|
|
663
|
+
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 });
|
|
566
664
|
}
|
|
567
665
|
function fetchEngineeringTicketPlatformIntegrations(e2, t2) {
|
|
568
666
|
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 });
|
|
569
667
|
}
|
|
570
|
-
function createTriageAndIssueFromRecorder(e2, t2, n2, i2, o2,
|
|
571
|
-
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:
|
|
668
|
+
function createTriageAndIssueFromRecorder(e2, t2, n2, i2, o2, s2, r2, a2, l2, c2, d2, u2, p2, f2, g2, m2) {
|
|
669
|
+
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 });
|
|
572
670
|
}
|
|
573
|
-
const
|
|
671
|
+
const Y = ["/node_modules/", "/@sailfish-ai/", "/@sailfish-rrweb/", "/dist/", "/webpack/", "/vite/", "/__vite", "/react-dom/", "/react/", "/scheduler/", "/<", "/chrome-extension://", "/extensions/"];
|
|
574
672
|
function shouldSkipFrame(e2) {
|
|
575
|
-
return
|
|
673
|
+
return Y.some((t2) => e2.includes(t2));
|
|
576
674
|
}
|
|
577
675
|
function normalizeFilePath(e2) {
|
|
578
676
|
let t2 = e2;
|
|
@@ -638,8 +736,17 @@ function yieldToMain() {
|
|
|
638
736
|
var _a;
|
|
639
737
|
return "undefined" != typeof globalThis && ((_a = globalThis.scheduler) == null ? void 0 : _a.yield) ? globalThis.scheduler.yield() : new Promise((e2) => setTimeout(e2, 0));
|
|
640
738
|
}
|
|
641
|
-
|
|
642
|
-
|
|
739
|
+
function closestSafe(e2, t2) {
|
|
740
|
+
if (!e2 || !t2) return false;
|
|
741
|
+
try {
|
|
742
|
+
return !!e2.closest(t2);
|
|
743
|
+
} catch {
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
const ee = { color: true, date: true, "datetime-local": true, email: true, month: true, number: true, range: true, search: true, tel: true, text: true, time: true, url: true, week: true, textarea: true, select: true, password: true };
|
|
748
|
+
let te = null;
|
|
749
|
+
const ne = "sailfishSanitize", ie = "zendesk_chat", oe = "Zendesk";
|
|
643
750
|
function zE_safe(...e2) {
|
|
644
751
|
try {
|
|
645
752
|
if ((function hasZendesk() {
|
|
@@ -653,15 +760,15 @@ function maskInputFn(e2, t2) {
|
|
|
653
760
|
var _a;
|
|
654
761
|
if ("hidden" === t2.type) return "";
|
|
655
762
|
const n2 = { creditCard: /\b(?:\d[ -]*?){13,16}\b/, ssn: /\b\d{3}-\d{2}-\d{4}\b/ };
|
|
656
|
-
return t2.
|
|
763
|
+
return t2.hasAttribute("data-cc") || ((_a = t2.getAttribute("autocomplete")) == null ? void 0 : _a.startsWith("cc-")) || n2.creditCard.test(e2) ? "**** **** **** " + e2.slice(-4) : t2.hasAttribute("data-ssn") || n2.ssn.test(e2) ? "***-**-" + e2.slice(-4) : t2.hasAttribute("data-dob") ? "**/**/" + e2.slice(-4) : "*".repeat(e2.length);
|
|
657
764
|
}
|
|
658
|
-
let
|
|
765
|
+
let se = true, re = null, ae = null, le = null, ce = null;
|
|
659
766
|
function invalidateUrlCache() {
|
|
660
|
-
|
|
767
|
+
se = true;
|
|
661
768
|
}
|
|
662
|
-
const getUrlAndStoredUuids = () => (
|
|
663
|
-
|
|
664
|
-
})(), { page_visit_uuid:
|
|
769
|
+
const getUrlAndStoredUuids = () => (se && (function _refreshSessionStorageCache() {
|
|
770
|
+
re = sessionStorage.getItem("pageVisitUUID"), ae = sessionStorage.getItem("prevPageVisitUUID"), le = sessionStorage.getItem("tabVisibilityChanged"), ce = sessionStorage.getItem("tabVisibilityState"), se = false;
|
|
771
|
+
})(), { page_visit_uuid: re, prev_page_visit_uuid: ae, href: getCachedHrefNoQuery(), tabVisibilityChanged: le, tabVisibilityState: ce });
|
|
665
772
|
function initializeDomContentEvents(e2) {
|
|
666
773
|
document.addEventListener("readystatechange", () => {
|
|
667
774
|
const t2 = { type: 24, data: { source: 0, info: "" }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() };
|
|
@@ -670,13 +777,13 @@ function initializeDomContentEvents(e2) {
|
|
|
670
777
|
t2.data.source = i;
|
|
671
778
|
break;
|
|
672
779
|
case "complete":
|
|
673
|
-
t2.data.source =
|
|
780
|
+
t2.data.source = s;
|
|
674
781
|
}
|
|
675
782
|
t2.data.info && sendEvent(t2);
|
|
676
783
|
}), document.addEventListener("DOMContentLoaded", () => {
|
|
677
784
|
sendEvent({ type: 24, data: { source: o }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
|
|
678
785
|
}), window.addEventListener("pagehide", () => {
|
|
679
|
-
sendEvent({ type: 24, data: { source:
|
|
786
|
+
sendEvent({ type: 24, data: { source: r }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
|
|
680
787
|
});
|
|
681
788
|
}
|
|
682
789
|
async function initializePerformancePlugin(e2) {
|
|
@@ -696,14 +803,14 @@ async function initializePerformancePlugin(e2) {
|
|
|
696
803
|
async function initializeConsolePlugin(e2, n2) {
|
|
697
804
|
const { getRecordConsolePlugin: i2 } = await import("@sailfish-rrweb/rrweb-plugin-console-record");
|
|
698
805
|
await yieldToMain();
|
|
699
|
-
const { name: o2, observer:
|
|
700
|
-
|
|
701
|
-
const i3 = e3, [
|
|
806
|
+
const { name: o2, observer: s2 } = i2(e2);
|
|
807
|
+
s2((e3) => {
|
|
808
|
+
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 };
|
|
702
809
|
sendEvent({ type: t.Plugin, timestamp: Date.now(), data: { plugin: o2, payload: u2 }, sessionId: n2, ...getUrlAndStoredUuids() });
|
|
703
810
|
}, window, e2);
|
|
704
811
|
}
|
|
705
|
-
async function initializeRecording(e2, n2, i2, o2,
|
|
706
|
-
const c2 = initializeWebSocket(n2, i2, o2,
|
|
812
|
+
async function initializeRecording(e2, n2, i2, o2, s2, r2 = true, a2 = false, l2 = false) {
|
|
813
|
+
const c2 = initializeWebSocket(n2, i2, o2, s2, a2);
|
|
707
814
|
try {
|
|
708
815
|
const n3 = (function createThrottledEmit(e3, t2 = 1e3) {
|
|
709
816
|
if (!e3) return { emit: (e4) => sendEvent(e4), flush: () => {
|
|
@@ -718,8 +825,8 @@ async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2
|
|
|
718
825
|
const t3 = e4.data, n5 = (t3 == null ? void 0 : t3.adds) && t3.adds.length > 0, i4 = (t3 == null ? void 0 : t3.removes) && t3.removes.length > 0;
|
|
719
826
|
if (n5 || i4) return void sendEvent(e4);
|
|
720
827
|
}
|
|
721
|
-
const
|
|
722
|
-
n4.set(
|
|
828
|
+
const s3 = `3:${o3}:${((_b = e4.data) == null ? void 0 : _b.id) || "unknown"}`;
|
|
829
|
+
n4.set(s3, e4), i3 || (i3 = setInterval(() => {
|
|
723
830
|
0 !== n4.size && (n4.forEach((e5) => sendEvent(e5)), n4.clear());
|
|
724
831
|
}, t2));
|
|
725
832
|
}, flush: () => {
|
|
@@ -735,24 +842,43 @@ async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2
|
|
|
735
842
|
console.warn("[Sailfish] Failed to enable Fiber tracking:", e3);
|
|
736
843
|
}
|
|
737
844
|
const { record: n4 } = await import("@sailfish-rrweb/rrweb-record-only");
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
845
|
+
te = n4, await yieldToMain();
|
|
846
|
+
const i3 = e2.unmaskSelector || void 0, o3 = e2.blockSelector || void 0, s3 = e2.maskTextSelector || void 0, r3 = e2.maskInputSelector || void 0, a3 = { ...e2.maskInputOptions ?? {} }, c3 = r3 ? { ...ee } : a3, d2 = (function buildMaskInputFn(e3) {
|
|
847
|
+
const { baseFn: t2, unmaskSelector: n5, maskInputSelector: i4, adminMaskInputOptions: o4 } = e3;
|
|
848
|
+
return n5 || i4 ? (e4, s4) => {
|
|
849
|
+
if ("hidden" === s4.type) return "";
|
|
850
|
+
if (closestSafe(s4, n5)) return e4;
|
|
851
|
+
const r4 = (s4.type || "").toLowerCase(), a4 = (s4.tagName || "").toLowerCase(), l3 = true === o4[r4] || true === o4[a4], c4 = (function matchesSelectorSafe(e5, t3) {
|
|
852
|
+
if (!t3) return false;
|
|
853
|
+
try {
|
|
854
|
+
return e5.matches(t3);
|
|
855
|
+
} catch {
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
})(s4, i4);
|
|
859
|
+
return l3 || c4 ? t2(e4, s4) : e4;
|
|
860
|
+
} : t2;
|
|
861
|
+
})({ baseFn: maskInputFn, unmaskSelector: i3, maskInputSelector: r3, adminMaskInputOptions: a3 }), u2 = /* @__PURE__ */ (function makeMaskTextFn(e3) {
|
|
862
|
+
return (t2, n5) => closestSafe(n5, e3) ? t2 : t2.replace(/\S/g, "*");
|
|
863
|
+
})(i3);
|
|
864
|
+
if (l2) {
|
|
865
|
+
const { chunkedSnapshot: a4 } = await import("./chunkSerializer-DDukZpgl.js"), l3 = n4.mirror;
|
|
866
|
+
let p2 = true;
|
|
867
|
+
const f2 = [];
|
|
742
868
|
n4({ emit(e3) {
|
|
743
|
-
|
|
744
|
-
}, maskInputOptions:
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
747
|
-
emitWithContext({ type: t.Meta, data: { href: window.location.href, width: document.documentElement.clientWidth || document.body.clientWidth, height: document.documentElement.clientHeight || document.body.clientHeight }, timestamp:
|
|
748
|
-
for (const e3 of
|
|
749
|
-
|
|
750
|
-
} else console.warn("[Sailfish] chunkSnapshot serialization failed; session continues without initial DOM snapshot"),
|
|
869
|
+
p2 ? f2.push(e3) : emitWithContext(e3);
|
|
870
|
+
}, ...e2, maskInputOptions: c3, maskInputFn: d2, maskTextFn: u2, maskInputSelector: r3, maskTextSelector: s3, blockSelector: o3, maskTextClass: e2.maskTextClass ?? ne, recordDOM: false });
|
|
871
|
+
const g2 = Date.now(), m2 = await a4(document, l3, { chunkSize: 500, maxChunkMs: 16, blockClass: e2.blockClass, blockSelector: o3, maskTextClass: e2.maskTextClass ?? ne, maskTextSelector: s3, maskInputSelector: r3, maskInputOptions: c3, maskInputFn: d2, maskTextFn: u2, unmaskSelector: i3 });
|
|
872
|
+
if (m2) {
|
|
873
|
+
emitWithContext({ type: t.Meta, data: { href: window.location.href, width: document.documentElement.clientWidth || document.body.clientWidth, height: document.documentElement.clientHeight || document.body.clientHeight }, timestamp: g2 }), emitWithContext({ type: t.FullSnapshot, data: { node: m2, initialOffset: { left: void 0 !== window.pageXOffset ? window.pageXOffset : document.documentElement.scrollLeft, top: void 0 !== window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop } }, timestamp: g2 });
|
|
874
|
+
for (const e3 of f2) emitWithContext(e3);
|
|
875
|
+
p2 = false;
|
|
876
|
+
} else console.warn("[Sailfish] chunkSnapshot serialization failed; session continues without initial DOM snapshot"), p2 = false;
|
|
751
877
|
} else n4({ emit(e3) {
|
|
752
878
|
emitWithContext(e3);
|
|
753
|
-
}, maskInputOptions:
|
|
879
|
+
}, ...e2, maskInputOptions: c3, maskInputFn: d2, maskTextFn: u2, maskInputSelector: r3, maskTextSelector: s3, blockSelector: o3, maskTextClass: e2.maskTextClass ?? ne });
|
|
754
880
|
};
|
|
755
|
-
if (
|
|
881
|
+
if (r2) {
|
|
756
882
|
let e3 = false;
|
|
757
883
|
const startOnce = () => {
|
|
758
884
|
e3 || (e3 = true, startHeavyWork());
|
|
@@ -782,11 +908,11 @@ async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2
|
|
|
782
908
|
zE_safe("messenger:set", "conversationTags", [`sailfish-session-${o2}`]);
|
|
783
909
|
});
|
|
784
910
|
const handleWidgetOpen = () => {
|
|
785
|
-
|
|
911
|
+
te == null ? void 0 : te.addSailfishEvent(t.SailfishCustom, { action: "customer support chat opened", element_id: ie, provider: oe });
|
|
786
912
|
}, handleWidgetClose = () => {
|
|
787
|
-
|
|
913
|
+
te == null ? void 0 : te.addSailfishEvent(t.SailfishCustom, { action: "customer support chat closed", element_id: ie, provider: oe });
|
|
788
914
|
}, handleUnreadMessages = (e3) => {
|
|
789
|
-
|
|
915
|
+
te == null ? void 0 : te.addSailfishEvent(t.SailfishCustom, { action: "zendesk unreadmessages", element_id: ie, provider: oe });
|
|
790
916
|
};
|
|
791
917
|
suppressConsoleLogsDuringCall(() => {
|
|
792
918
|
zE_safe("messenger:on", "open", handleWidgetOpen), zE_safe("messenger:on", "close", handleWidgetClose), zE_safe("messenger:on", "unreadMessages", handleUnreadMessages);
|
|
@@ -797,7 +923,7 @@ async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2
|
|
|
797
923
|
}
|
|
798
924
|
return c2;
|
|
799
925
|
}
|
|
800
|
-
const
|
|
926
|
+
const de = [(e2) => (function checkNextJs() {
|
|
801
927
|
try {
|
|
802
928
|
if (void 0 !== globalThis.__NEXT_DATA__) return "nextjs";
|
|
803
929
|
} catch {
|
|
@@ -859,35 +985,52 @@ const ae = [(e2) => (function checkNextJs() {
|
|
|
859
985
|
}
|
|
860
986
|
return null;
|
|
861
987
|
}];
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
const
|
|
988
|
+
const ue = "sf-create-issue-preference", pe = "sf-create-eng-ticket-preference";
|
|
989
|
+
function getInitialState() {
|
|
990
|
+
const e2 = (function loadUserPreferences() {
|
|
991
|
+
return { createIssue: m && "true" === localStorage.getItem(ue), createEngTicket: m && "true" === localStorage.getItem(pe) };
|
|
992
|
+
})();
|
|
993
|
+
return { mode: "lookback", description: "", occurredInThisTab: true, createIssue: e2.createIssue, issueName: "", issueDescription: "", createEngTicket: e2.createEngTicket, engTicketTeam: "", engTicketProject: "", engTicketPriority: 0, engTicketLabels: [], engTicketSprint: "", engTicketIssueType: "", engTicketCustomFields: {} };
|
|
994
|
+
}
|
|
995
|
+
let fe = getInitialState(), ge = null, me = null, he = null, ye = false, Se = false;
|
|
996
|
+
function setSprintDefaulted(e2) {
|
|
997
|
+
Se = e2;
|
|
998
|
+
}
|
|
999
|
+
function setTimerInterval(e2) {
|
|
1000
|
+
he = e2;
|
|
1001
|
+
}
|
|
1002
|
+
function setIsRecording(e2) {
|
|
1003
|
+
ye = e2;
|
|
1004
|
+
}
|
|
1005
|
+
const be = ["jira", "linear", "zendesk"];
|
|
1006
|
+
let ve = null;
|
|
1007
|
+
const we = /* @__PURE__ */ new Map();
|
|
865
1008
|
function getIntegrationData() {
|
|
866
|
-
return
|
|
1009
|
+
return ve;
|
|
867
1010
|
}
|
|
868
1011
|
function hasValidIntegration() {
|
|
869
|
-
return null !==
|
|
1012
|
+
return null !== ve && true === ve.installed;
|
|
870
1013
|
}
|
|
871
1014
|
function resolveIntegration(e2) {
|
|
872
1015
|
var _a;
|
|
873
1016
|
if ((e2 == null ? void 0 : e2.errors) && e2.errors.length > 0) return console.error("GraphQL errors fetching integrations:", e2.errors), null;
|
|
874
1017
|
const t2 = (_a = e2 == null ? void 0 : e2.data) == null ? void 0 : _a.getEngineeringTicketPlatformIntegrationsFromApiKey, n2 = (t2 || []).filter((e3) => {
|
|
875
1018
|
var _a2;
|
|
876
|
-
return
|
|
1019
|
+
return be.includes(((_a2 = e3.provider) == null ? void 0 : _a2.toLowerCase()) || "") && true === e3.installed;
|
|
877
1020
|
});
|
|
878
1021
|
if (0 === n2.length) return console.warn("No valid installed integrations found"), null;
|
|
879
1022
|
const i2 = n2.find((e3) => {
|
|
880
1023
|
var _a2;
|
|
881
1024
|
return "jira" === ((_a2 = e3.provider) == null ? void 0 : _a2.toLowerCase());
|
|
882
1025
|
}) || n2[0];
|
|
883
|
-
return (i2 == null ? void 0 : i2.primaryCloudId) &&
|
|
1026
|
+
return (i2 == null ? void 0 : i2.primaryCloudId) && we.set(i2.primaryCloudId, i2), i2;
|
|
884
1027
|
}
|
|
885
1028
|
async function refreshIntegrationData(e2, t2) {
|
|
886
1029
|
try {
|
|
887
1030
|
const n2 = resolveIntegration(await fetchEngineeringTicketPlatformIntegrations(e2, t2));
|
|
888
|
-
return
|
|
1031
|
+
return ve = n2, n2;
|
|
889
1032
|
} catch (e3) {
|
|
890
|
-
return console.error("Error refreshing integration data:", e3),
|
|
1033
|
+
return console.error("Error refreshing integration data:", e3), ve;
|
|
891
1034
|
}
|
|
892
1035
|
}
|
|
893
1036
|
function populateSelectOptions(e2, t2, n2) {
|
|
@@ -912,6 +1055,16 @@ function populatePriorityOptions(e2, t2, n2) {
|
|
|
912
1055
|
}
|
|
913
1056
|
null != n2 ? e2.value = String(n2) : i2 || (e2.value = "0");
|
|
914
1057
|
}
|
|
1058
|
+
function pickDefaultActiveSprint(e2, t2, n2) {
|
|
1059
|
+
const i2 = (e2 || []).filter((e3) => "active" === e3.state);
|
|
1060
|
+
if (!i2.length) return null;
|
|
1061
|
+
const o2 = (function _projectBoardIds(e3, t3) {
|
|
1062
|
+
if (!e3) return [];
|
|
1063
|
+
const n3 = (t3 || []).find((t4) => t4.id === e3 || t4.key === e3);
|
|
1064
|
+
return ((n3 == null ? void 0 : n3.boards) || (n3 == null ? void 0 : n3.board_ids) || []).map((e4) => "object" == typeof e4 ? e4.id : e4);
|
|
1065
|
+
})(t2, n2);
|
|
1066
|
+
return (o2.length ? i2.find((e3) => o2.some((t3) => String(t3) === String(e3.originBoardId))) : null) || i2[0];
|
|
1067
|
+
}
|
|
915
1068
|
function populateSprintOptions(e2, t2, n2) {
|
|
916
1069
|
e2.innerHTML = "";
|
|
917
1070
|
const i2 = document.createElement("option");
|
|
@@ -922,8 +1075,8 @@ function populateSprintOptions(e2, t2, n2) {
|
|
|
922
1075
|
}), n2 && (e2.value = n2);
|
|
923
1076
|
}
|
|
924
1077
|
function getSprintFieldId() {
|
|
925
|
-
if (!(
|
|
926
|
-
const e2 = Array.isArray(
|
|
1078
|
+
if (!(ve == null ? void 0 : ve.fieldConfigurations)) return "customfield_10020";
|
|
1079
|
+
const e2 = Array.isArray(ve.fieldConfigurations) ? ve.fieldConfigurations : [];
|
|
927
1080
|
for (const t2 of e2) {
|
|
928
1081
|
const e3 = (t2.fields || []).find((e4) => {
|
|
929
1082
|
var _a;
|
|
@@ -935,12 +1088,12 @@ function getSprintFieldId() {
|
|
|
935
1088
|
}
|
|
936
1089
|
function updateIssueTypeOptions(e2, t2) {
|
|
937
1090
|
var _a;
|
|
938
|
-
if (!(
|
|
1091
|
+
if (!(ve == null ? void 0 : ve.projects) || !t2) {
|
|
939
1092
|
e2.innerHTML = "";
|
|
940
1093
|
const t3 = document.createElement("option");
|
|
941
1094
|
return t3.value = "", t3.disabled = true, t3.selected = true, t3.textContent = "Select project first...", t3.style.color = "#9ca3af", e2.appendChild(t3), void (e2.style.color = "#9ca3af");
|
|
942
1095
|
}
|
|
943
|
-
const n2 =
|
|
1096
|
+
const n2 = ve.projects.find((e3) => e3.id === t2);
|
|
944
1097
|
if (!n2 || !n2.issue_types) {
|
|
945
1098
|
e2.innerHTML = "";
|
|
946
1099
|
const t3 = document.createElement("option");
|
|
@@ -959,17 +1112,17 @@ function updateIssueTypeOptions(e2, t2) {
|
|
|
959
1112
|
}), n3 = i2.find((e3) => {
|
|
960
1113
|
var _a2;
|
|
961
1114
|
return "task" === ((_a2 = e3.name) == null ? void 0 : _a2.toLowerCase());
|
|
962
|
-
}),
|
|
963
|
-
|
|
1115
|
+
}), s2 = (t3 == null ? void 0 : t3.id) || (n3 == null ? void 0 : n3.id) || ((_a = i2[0]) == null ? void 0 : _a.id);
|
|
1116
|
+
s2 ? (e2.value = s2, e2.style.color = "#000") : (o2.selected = true, e2.style.color = "#9ca3af");
|
|
964
1117
|
}
|
|
965
1118
|
}
|
|
966
1119
|
function getFieldsForProject(e2, t2) {
|
|
967
|
-
if (!(
|
|
968
|
-
const n2 = Array.isArray(
|
|
1120
|
+
if (!(ve == null ? void 0 : ve.fieldConfigurations) || !e2) return [];
|
|
1121
|
+
const n2 = Array.isArray(ve.fieldConfigurations) ? ve.fieldConfigurations.find((n3) => !(n3.project_key !== e2 && String(n3.project_id) !== String(e2) || t2 && String(n3.issue_type_id) !== String(t2))) : ve.fieldConfigurations[e2];
|
|
969
1122
|
return n2 && n2.fields ? n2.fields : [];
|
|
970
1123
|
}
|
|
971
1124
|
function getUsers() {
|
|
972
|
-
return (
|
|
1125
|
+
return (ve == null ? void 0 : ve.users) ? ve.users : [];
|
|
973
1126
|
}
|
|
974
1127
|
function getDefaultReporterAccountId() {
|
|
975
1128
|
const e2 = getUsers(), t2 = getIdentifiedUser();
|
|
@@ -978,16 +1131,16 @@ function getDefaultReporterAccountId() {
|
|
|
978
1131
|
const n3 = e2.filter(t3);
|
|
979
1132
|
return 1 === n3.length ? n3[0] : null;
|
|
980
1133
|
};
|
|
981
|
-
let
|
|
982
|
-
if (!
|
|
1134
|
+
let s2 = i2 ? findUnique((e3) => (e3.email || e3.emailAddress || "").toLowerCase().trim() === i2) : null;
|
|
1135
|
+
if (!s2 && o2 && (s2 = findUnique((e3) => (e3.name || e3.displayName || "").toLowerCase().trim() === o2)), !s2 && i2) {
|
|
983
1136
|
const e3 = i2.split("@")[0];
|
|
984
|
-
e3.length >= 3 && (
|
|
1137
|
+
e3.length >= 3 && (s2 = findUnique((t3) => (t3.name || t3.displayName || "").toLowerCase().trim().includes(e3)));
|
|
985
1138
|
}
|
|
986
|
-
return
|
|
1139
|
+
return s2 && (s2.id || s2.accountId) || null;
|
|
987
1140
|
}
|
|
988
1141
|
function lastReporterStorageKey() {
|
|
989
|
-
if (!
|
|
990
|
-
const e2 =
|
|
1142
|
+
if (!ve) return null;
|
|
1143
|
+
const e2 = ve.primaryCloudId || ve.provider || "";
|
|
991
1144
|
return e2 ? `sf-veritas:lastReporter:${e2}` : null;
|
|
992
1145
|
}
|
|
993
1146
|
function getSavedLastReporterAccountId() {
|
|
@@ -1014,51 +1167,44 @@ function getValidSavedReporterAccountId() {
|
|
|
1014
1167
|
return getUsers().some((t2) => (t2.accountId || t2.id) === e2 && false !== t2.active) ? e2 : null;
|
|
1015
1168
|
}
|
|
1016
1169
|
function getProjectsForTeam(e2) {
|
|
1017
|
-
if (!
|
|
1018
|
-
const t2 =
|
|
1170
|
+
if (!ve) return [];
|
|
1171
|
+
const t2 = ve.teams && Array.isArray(ve.teams) && ve.teams.length > 0;
|
|
1019
1172
|
if (t2 && e2) {
|
|
1020
|
-
const t3 =
|
|
1173
|
+
const t3 = ve.teams.find((t4) => t4.id === e2);
|
|
1021
1174
|
return (t3 == null ? void 0 : t3.projects) || [];
|
|
1022
1175
|
}
|
|
1023
|
-
return !t2 &&
|
|
1176
|
+
return !t2 && ve.projects ? ve.projects : [];
|
|
1024
1177
|
}
|
|
1025
1178
|
function updateFormWithIntegrationData(e2) {
|
|
1026
1179
|
var _a;
|
|
1027
|
-
if (!
|
|
1028
|
-
const t2 =
|
|
1029
|
-
n2 && t2 && (populateSelectOptions(n2,
|
|
1180
|
+
if (!ve) return e2;
|
|
1181
|
+
const t2 = ve.teams && Array.isArray(ve.teams) && ve.teams.length > 0, n2 = document.getElementById("sf-eng-ticket-team");
|
|
1182
|
+
n2 && t2 && (populateSelectOptions(n2, ve.teams, ve.defaultTeam), e2.engTicketTeam ? n2.value = e2.engTicketTeam : e2.engTicketTeam = n2.value);
|
|
1030
1183
|
const i2 = document.getElementById("sf-eng-ticket-project");
|
|
1031
1184
|
if (i2) {
|
|
1032
|
-
populateSelectOptions(i2, t2 ? getProjectsForTeam(e2.engTicketTeam) :
|
|
1185
|
+
populateSelectOptions(i2, t2 ? getProjectsForTeam(e2.engTicketTeam) : ve.projects || [], ve.defaultProject), e2.engTicketProject ? i2.value = e2.engTicketProject : e2.engTicketProject = i2.value;
|
|
1033
1186
|
}
|
|
1034
1187
|
const o2 = document.getElementById("sf-eng-ticket-priority");
|
|
1035
|
-
o2 && (populatePriorityOptions(o2,
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1188
|
+
o2 && (populatePriorityOptions(o2, ve.provider || "", ve.defaultPriority), e2.engTicketPriority ? o2.value = String(e2.engTicketPriority) : e2.engTicketPriority = Number(o2.value));
|
|
1189
|
+
const s2 = document.getElementById("sf-eng-ticket-sprint"), r2 = "jira" === ((_a = ve.provider) == null ? void 0 : _a.toLowerCase());
|
|
1190
|
+
if (s2 && r2 && ve.sprints) {
|
|
1191
|
+
if (!e2.engTicketSprint && !Se) {
|
|
1192
|
+
const t3 = pickDefaultActiveSprint(ve.sprints, e2.engTicketProject, ve.projects || []);
|
|
1193
|
+
(t3 == null ? void 0 : t3.id) && (e2.engTicketSprint = String(t3.id), setSprintDefaulted(true));
|
|
1194
|
+
}
|
|
1195
|
+
populateSprintOptions(s2, ve.sprints, e2.engTicketSprint || void 0), e2.engTicketSprint && (s2.style.color = "");
|
|
1196
|
+
}
|
|
1197
|
+
const a2 = document.getElementById("sf-eng-ticket-type");
|
|
1198
|
+
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;
|
|
1199
|
+
}
|
|
1200
|
+
const ke = Object.freeze(Object.defineProperty({ __proto__: null, fetchIntegrationData: async function fetchIntegrationData(e2, t2) {
|
|
1201
|
+
if (!ve) try {
|
|
1043
1202
|
const n2 = await fetchEngineeringTicketPlatformIntegrations(e2, t2);
|
|
1044
|
-
|
|
1203
|
+
ve = resolveIntegration(n2);
|
|
1045
1204
|
} catch (e3) {
|
|
1046
|
-
console.error("Error fetching integration data:", e3),
|
|
1205
|
+
console.error("Error fetching integration data:", e3), ve = null;
|
|
1047
1206
|
}
|
|
1048
|
-
}, getDefaultReporterAccountId, getFieldsForProject, getIntegrationData, getProjectsForTeam, getSavedLastReporterAccountId, getSprintFieldId, getUsers, getValidSavedReporterAccountId, hasValidIntegration, populatePriorityOptions, populateSelectOptions, populateSprintOptions, refreshIntegrationData, saveLastReporterAccountId, updateFormWithIntegrationData, updateIssueTypeOptions }, Symbol.toStringTag, { value: "Module" }))
|
|
1049
|
-
function getInitialState() {
|
|
1050
|
-
const e2 = (function loadUserPreferences() {
|
|
1051
|
-
return { createIssue: f && "true" === localStorage.getItem(de), createEngTicket: f && "true" === localStorage.getItem(ue) };
|
|
1052
|
-
})();
|
|
1053
|
-
return { mode: "lookback", description: "", occurredInThisTab: true, createIssue: e2.createIssue, issueName: "", issueDescription: "", createEngTicket: e2.createEngTicket, engTicketTeam: "", engTicketProject: "", engTicketPriority: 0, engTicketLabels: [], engTicketSprint: "", engTicketIssueType: "", engTicketCustomFields: {} };
|
|
1054
|
-
}
|
|
1055
|
-
let pe = getInitialState(), fe = null, ge = null, me = null, he = false;
|
|
1056
|
-
function setTimerInterval(e2) {
|
|
1057
|
-
me = e2;
|
|
1058
|
-
}
|
|
1059
|
-
function setIsRecording(e2) {
|
|
1060
|
-
he = e2;
|
|
1061
|
-
}
|
|
1207
|
+
}, getDefaultReporterAccountId, getFieldsForProject, getIntegrationData, getProjectsForTeam, getSavedLastReporterAccountId, getSprintFieldId, getUsers, getValidSavedReporterAccountId, hasValidIntegration, pickDefaultActiveSprint, populatePriorityOptions, populateSelectOptions, populateSprintOptions, refreshIntegrationData, saveLastReporterAccountId, updateFormWithIntegrationData, updateIssueTypeOptions }, Symbol.toStringTag, { value: "Module" }));
|
|
1062
1208
|
function renderCustomMultiSelect(e2, t2, n2, i2, o2 = false) {
|
|
1063
1209
|
return `
|
|
1064
1210
|
<div style="position:relative;">
|
|
@@ -1092,9 +1238,9 @@ function renderCustomMultiSelect(e2, t2, n2, i2, o2 = false) {
|
|
|
1092
1238
|
</div>
|
|
1093
1239
|
`;
|
|
1094
1240
|
}
|
|
1095
|
-
const
|
|
1241
|
+
const xe = { 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 } }, Ie = { shortcuts: { ...xe }, resolveSessionId: null, apiKey: null, backendApi: null, triageBaseUrl: "https://app.sailfishqa.com", deactivateIsolation: () => {
|
|
1096
1242
|
}, integrationData: null, showEngTicketFieldsDefault: false };
|
|
1097
|
-
let
|
|
1243
|
+
let Te = null, Ee = false;
|
|
1098
1244
|
function setupCustomMultiSelectListeners(e2, t2) {
|
|
1099
1245
|
const n2 = document.getElementById(`${e2}-container`), i2 = document.getElementById(`${e2}-dropdown`);
|
|
1100
1246
|
if (!n2 || !i2) return;
|
|
@@ -1111,16 +1257,16 @@ function setupCustomMultiSelectListeners(e2, t2) {
|
|
|
1111
1257
|
</span>`);
|
|
1112
1258
|
}
|
|
1113
1259
|
});
|
|
1114
|
-
const
|
|
1115
|
-
return
|
|
1260
|
+
const s2 = n2.querySelector(".sf-multiselect-chips");
|
|
1261
|
+
return s2 && (s2.innerHTML = o2.join("") || '<span style="color:#9ca3af;">Select...</span>', s2.querySelectorAll(".sf-multiselect-chip-remove").forEach((e4) => {
|
|
1116
1262
|
e4.addEventListener("click", (n3) => {
|
|
1117
1263
|
n3.stopPropagation();
|
|
1118
|
-
const o3 = e4.dataset.value || "",
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1264
|
+
const o3 = e4.dataset.value || "", s3 = i2.querySelector(`.sf-multiselect-option[data-value="${o3}"]`);
|
|
1265
|
+
s3 && (s3.dataset.selected = "false", s3.style.backgroundColor = ""), updateChipsDisplay();
|
|
1266
|
+
const r2 = [];
|
|
1121
1267
|
i2.querySelectorAll(".sf-multiselect-option").forEach((e5) => {
|
|
1122
|
-
"true" === e5.dataset.selected &&
|
|
1123
|
-
}), t2(
|
|
1268
|
+
"true" === e5.dataset.selected && r2.push(e5.dataset.value || "");
|
|
1269
|
+
}), t2(r2);
|
|
1124
1270
|
});
|
|
1125
1271
|
})), e3;
|
|
1126
1272
|
}
|
|
@@ -1129,8 +1275,8 @@ function setupCustomMultiSelectListeners(e2, t2) {
|
|
|
1129
1275
|
n3.stopPropagation();
|
|
1130
1276
|
const i3 = e3, o2 = "true" === i3.dataset.selected;
|
|
1131
1277
|
i3.dataset.selected = String(!o2), i3.style.backgroundColor = o2 ? "" : "#e0f2fe";
|
|
1132
|
-
const
|
|
1133
|
-
t2(
|
|
1278
|
+
const s2 = updateChipsDisplay();
|
|
1279
|
+
t2(s2);
|
|
1134
1280
|
});
|
|
1135
1281
|
}), updateChipsDisplay(), document.addEventListener("click", (e3) => {
|
|
1136
1282
|
const t3 = e3.target;
|
|
@@ -1143,14 +1289,14 @@ function renderDynamicFields(e2, t2) {
|
|
|
1143
1289
|
if (!e2) return void (n2.innerHTML = '<div style="font-size:14px; color:#64748B;">Select a project to see additional fields</div>');
|
|
1144
1290
|
const i2 = getFieldsForProject(e2, t2), o2 = getUsers();
|
|
1145
1291
|
if (!i2 || 0 === i2.length) return void (n2.innerHTML = "");
|
|
1146
|
-
const
|
|
1292
|
+
const s2 = i2.map((e3) => (function renderDynamicField(e4, t3, n3 = []) {
|
|
1147
1293
|
var _a, _b, _c, _d;
|
|
1148
|
-
const i3 = e4.fieldId || e4.key, o3 = e4.name,
|
|
1149
|
-
if (d2.includes(i3) || d2.includes(
|
|
1294
|
+
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"];
|
|
1295
|
+
if (d2.includes(i3) || d2.includes(r2)) return null;
|
|
1150
1296
|
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;";
|
|
1151
|
-
switch (
|
|
1297
|
+
switch (s3) {
|
|
1152
1298
|
case "string":
|
|
1153
|
-
return
|
|
1299
|
+
return a2 && a2.includes("textarea") ? `
|
|
1154
1300
|
<div>
|
|
1155
1301
|
<label for="${i3}" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">
|
|
1156
1302
|
${o3} ${u2}
|
|
@@ -1222,7 +1368,7 @@ function renderDynamicFields(e2, t2) {
|
|
|
1222
1368
|
const e5 = n3.map((e6) => {
|
|
1223
1369
|
const n4 = e6.email ? `${e6.name} (${e6.email})` : e6.name, i4 = t3 === e6.id ? "selected" : "";
|
|
1224
1370
|
return `<option value="${e6.id}" ${i4}>${n4}</option>`;
|
|
1225
|
-
}).join(""),
|
|
1371
|
+
}).join(""), s4 = t3 && n3.some((e6) => e6.id === t3);
|
|
1226
1372
|
return `
|
|
1227
1373
|
<div>
|
|
1228
1374
|
<label for="${i3}" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">
|
|
@@ -1232,10 +1378,10 @@ function renderDynamicFields(e2, t2) {
|
|
|
1232
1378
|
id="${i3}"
|
|
1233
1379
|
class="sf-dynamic-field"
|
|
1234
1380
|
data-field-id="${i3}"
|
|
1235
|
-
style="${p2} appearance:none; cursor:pointer; background-color: white; ${
|
|
1381
|
+
style="${p2} appearance:none; cursor:pointer; background-color: white; ${s4 ? "" : "color: #9ca3af;"}"
|
|
1236
1382
|
${l2 ? "required" : ""}
|
|
1237
1383
|
>
|
|
1238
|
-
<option value="" ${
|
|
1384
|
+
<option value="" ${s4 ? "" : "selected"} style="color: #9ca3af;">Select ${o3.toLowerCase()}...</option>
|
|
1239
1385
|
${e5}
|
|
1240
1386
|
</select>
|
|
1241
1387
|
</div>
|
|
@@ -1268,7 +1414,7 @@ function renderDynamicFields(e2, t2) {
|
|
|
1268
1414
|
}
|
|
1269
1415
|
return null;
|
|
1270
1416
|
case "array":
|
|
1271
|
-
return "labels" ===
|
|
1417
|
+
return "labels" === r2 ? null : c2 && c2.length > 0 ? renderCustomMultiSelect(i3, o3, c2, Array.isArray(t3) ? t3 : [], l2) : null;
|
|
1272
1418
|
case "parent":
|
|
1273
1419
|
case "issuelink":
|
|
1274
1420
|
return `
|
|
@@ -1307,22 +1453,22 @@ function renderDynamicFields(e2, t2) {
|
|
|
1307
1453
|
</div>
|
|
1308
1454
|
` : null;
|
|
1309
1455
|
}
|
|
1310
|
-
})(e3,
|
|
1311
|
-
n2.innerHTML =
|
|
1456
|
+
})(e3, fe.engTicketCustomFields[e3.fieldId || e3.key], o2)).filter(Boolean).join("");
|
|
1457
|
+
n2.innerHTML = s2 || "", i2.forEach((e3) => {
|
|
1312
1458
|
var _a;
|
|
1313
1459
|
const t3 = e3.fieldId || e3.key, n3 = (_a = e3.schema) == null ? void 0 : _a.type, i3 = e3.allowedValues;
|
|
1314
1460
|
"array" === n3 && i3 && i3.length > 0 && setupCustomMultiSelectListeners(t3, (e4) => {
|
|
1315
|
-
|
|
1461
|
+
fe.engTicketCustomFields[t3] = e4;
|
|
1316
1462
|
});
|
|
1317
1463
|
});
|
|
1318
1464
|
}
|
|
1319
1465
|
function generateEngTicketFieldsHTML() {
|
|
1320
1466
|
var _a;
|
|
1321
|
-
const e2 =
|
|
1467
|
+
const e2 = Ie.integrationData;
|
|
1322
1468
|
if (!e2) return "";
|
|
1323
1469
|
const t2 = "jira" === ((_a = e2.provider) == null ? void 0 : _a.toLowerCase());
|
|
1324
1470
|
let n2 = "<div style='display:flex; flex-direction:column; gap:12px;'>";
|
|
1325
|
-
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,
|
|
1471
|
+
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, fe.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;
|
|
1326
1472
|
}
|
|
1327
1473
|
function getShortcutKeyCmdCtrlLabel() {
|
|
1328
1474
|
return (function isMacPlatform() {
|
|
@@ -1336,19 +1482,19 @@ function getShortcutLabelFromContext(e2) {
|
|
|
1336
1482
|
return e3.requireCmdCtrl && t2.push(getShortcutKeyCmdCtrlLabel()), t2.push((function formatShortcutKeyLabel(e4) {
|
|
1337
1483
|
return ({ escape: "esc" }[e4.toLowerCase()] || e4).toUpperCase();
|
|
1338
1484
|
})(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 ? " + " : "");
|
|
1339
|
-
})(
|
|
1485
|
+
})(Ie.shortcuts[e2]);
|
|
1340
1486
|
}
|
|
1341
1487
|
function getSessionIdSafely() {
|
|
1342
|
-
if (!
|
|
1343
|
-
return
|
|
1488
|
+
if (!Ie.resolveSessionId) throw new Error("getSessionId not defined");
|
|
1489
|
+
return Ie.resolveSessionId();
|
|
1344
1490
|
}
|
|
1345
1491
|
function openReportIssueModal(e2) {
|
|
1346
|
-
|
|
1492
|
+
ye ? stopRecording() : (Ee = (e2 == null ? void 0 : e2.showEngTicketFields) ?? Ie.showEngTicketFieldsDefault, injectModalHTML(), Te && document.body.appendChild(Te));
|
|
1347
1493
|
}
|
|
1348
1494
|
function closeModal() {
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
})(),
|
|
1495
|
+
Ie.deactivateIsolation(), document.activeElement instanceof HTMLElement && document.activeElement.blur(), (Te == null ? void 0 : Te.parentNode) && Te.parentNode.removeChild(Te), Te = null, ye || (function resetState() {
|
|
1496
|
+
fe = getInitialState(), ge = null, me = null, Se = false;
|
|
1497
|
+
})(), he && (clearInterval(he), setTimerInterval(null));
|
|
1352
1498
|
}
|
|
1353
1499
|
function activateModalIsolation(e2) {
|
|
1354
1500
|
e2.setAttribute("role", "dialog"), e2.setAttribute("aria-modal", "true"), e2.hasAttribute("tabindex") || e2.setAttribute("tabindex", "-1");
|
|
@@ -1365,10 +1511,10 @@ function activateModalIsolation(e2) {
|
|
|
1365
1511
|
n3 && (e2.contains(n3) || (t3.stopImmediatePropagation(), t3.preventDefault(), refocus()));
|
|
1366
1512
|
}, o2 = ["mousedown", "mouseup", "click", "pointerdown", "pointerup", "touchstart", "touchend", "wheel", "keydown", "keyup", "focus", "focusin", "focusout", "blur"];
|
|
1367
1513
|
o2.forEach((e3) => document.addEventListener(e3, quarantine, true));
|
|
1368
|
-
let
|
|
1369
|
-
const
|
|
1370
|
-
if ((e2.querySelector(":focus") ||
|
|
1371
|
-
|
|
1514
|
+
let s2 = 0, r2 = null;
|
|
1515
|
+
const a2 = t2 instanceof HTMLTextAreaElement ? t2 : null, refocus = () => {
|
|
1516
|
+
if ((e2.querySelector(":focus") || a2 || t2 || e2).focus({ preventScroll: true }), a2 && document.activeElement === a2 && r2) try {
|
|
1517
|
+
a2.setSelectionRange(r2.start, r2.end, "none");
|
|
1372
1518
|
} catch {
|
|
1373
1519
|
}
|
|
1374
1520
|
}, selectionInsideModal = () => {
|
|
@@ -1385,13 +1531,13 @@ function activateModalIsolation(e2) {
|
|
|
1385
1531
|
const watchdog = () => {
|
|
1386
1532
|
const t3 = document.activeElement, n3 = t3 === document.body || null == t3 || !e2.contains(t3), i3 = selectionInsideModal();
|
|
1387
1533
|
n3 && !i3 ? (l2 += 1, l2 >= 2 && (refocus(), l2 = 0)) : (l2 = 0, (() => {
|
|
1388
|
-
if (
|
|
1389
|
-
|
|
1534
|
+
if (a2 && document.activeElement === a2) try {
|
|
1535
|
+
r2 = { start: a2.selectionStart ?? a2.value.length, end: a2.selectionEnd ?? a2.value.length };
|
|
1390
1536
|
} catch {
|
|
1391
1537
|
}
|
|
1392
|
-
})()),
|
|
1538
|
+
})()), s2 = window.requestAnimationFrame(watchdog);
|
|
1393
1539
|
};
|
|
1394
|
-
|
|
1540
|
+
s2 = window.requestAnimationFrame(watchdog);
|
|
1395
1541
|
const onBlurLike = () => {
|
|
1396
1542
|
setTimeout(() => {
|
|
1397
1543
|
const t3 = document.activeElement;
|
|
@@ -1403,13 +1549,13 @@ function activateModalIsolation(e2) {
|
|
|
1403
1549
|
n2.remove(), i2.remove();
|
|
1404
1550
|
} catch {
|
|
1405
1551
|
}
|
|
1406
|
-
o2.forEach((e3) => document.removeEventListener(e3, quarantine, true)), window.removeEventListener("blur", onBlurLike, true), document.removeEventListener("focusout", onBlurLike, true),
|
|
1552
|
+
o2.forEach((e3) => document.removeEventListener(e3, quarantine, true)), window.removeEventListener("blur", onBlurLike, true), document.removeEventListener("focusout", onBlurLike, true), s2 && cancelAnimationFrame(s2);
|
|
1407
1553
|
};
|
|
1408
1554
|
}
|
|
1409
1555
|
function injectModalHTML(e2 = "lookback") {
|
|
1410
|
-
|
|
1556
|
+
Te && (Te.remove(), Te = null), Te = document.createElement("div"), Te.id = "sf-report-issue-modal";
|
|
1411
1557
|
const t2 = "startnow" === e2;
|
|
1412
|
-
|
|
1558
|
+
Te.innerHTML = `
|
|
1413
1559
|
<div style="position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:9998;"></div>
|
|
1414
1560
|
<div style="position:fixed; top:50%; left:50%; transform:translate(-50%, -50%);
|
|
1415
1561
|
background:#fff; border-radius:12px;
|
|
@@ -1464,7 +1610,7 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1464
1610
|
<textarea id="sf-issue-description" placeholder="Add description here"
|
|
1465
1611
|
style="width:100%; height:80px; padding:8px 12px; font-size:14px;
|
|
1466
1612
|
border:1px solid #cbd5e1; border-radius:6px; margin-bottom:20px;
|
|
1467
|
-
resize:none; outline:none;">${
|
|
1613
|
+
resize:none; outline:none;">${fe.description}</textarea>
|
|
1468
1614
|
|
|
1469
1615
|
<!-- When did this happen Section -->
|
|
1470
1616
|
<div id="sf-lookback-container" style="display:${t2 ? "none" : "block"}; margin-bottom:20px;">
|
|
@@ -1530,34 +1676,34 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1530
1676
|
<!-- Checkboxes on same line -->
|
|
1531
1677
|
<div style="display:flex; align-items:center; gap:24px; margin-bottom:16px;">
|
|
1532
1678
|
<label style="display:flex; align-items:center; gap:8px; font-size:14px; font-weight:500; cursor:pointer;">
|
|
1533
|
-
<input type="checkbox" id="sf-create-issue-checkbox" ${
|
|
1679
|
+
<input type="checkbox" id="sf-create-issue-checkbox" ${fe.createIssue ? "checked" : ""}
|
|
1534
1680
|
style="width:16px; height:16px; accent-color:#295DBF; cursor:pointer;">
|
|
1535
1681
|
Create an Issue
|
|
1536
1682
|
</label>
|
|
1537
1683
|
|
|
1538
|
-
<label id="sf-create-eng-ticket-label" style="display:${
|
|
1539
|
-
<input type="checkbox" id="sf-create-eng-ticket-checkbox" ${
|
|
1684
|
+
<label id="sf-create-eng-ticket-label" style="display:${Ie.integrationData && Ee ? "flex" : "none"}; align-items:center; gap:8px; font-size:14px; font-weight:500; cursor:pointer;">
|
|
1685
|
+
<input type="checkbox" id="sf-create-eng-ticket-checkbox" ${fe.createEngTicket ? "checked" : ""}
|
|
1540
1686
|
style="width:16px; height:16px; accent-color:#295DBF; cursor:pointer;">
|
|
1541
1687
|
Create an Eng Ticket
|
|
1542
1688
|
</label>
|
|
1543
1689
|
</div>
|
|
1544
1690
|
|
|
1545
1691
|
<!-- Issue Title Field (always shown when create issue is checked) -->
|
|
1546
|
-
<div id="sf-issue-fields-container" style="display:${
|
|
1692
|
+
<div id="sf-issue-fields-container" style="display:${fe.createIssue ? "block" : "none"};">
|
|
1547
1693
|
<div style="display:flex; flex-direction:column; gap:12px;">
|
|
1548
1694
|
<div>
|
|
1549
1695
|
<label for="sf-issue-name" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">
|
|
1550
1696
|
Title <span style="color:#ef4444;">*</span>
|
|
1551
1697
|
</label>
|
|
1552
1698
|
<input type="text" id="sf-issue-name" placeholder="Enter title"
|
|
1553
|
-
value="${
|
|
1699
|
+
value="${fe.issueName}"
|
|
1554
1700
|
style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none;">
|
|
1555
1701
|
</div>
|
|
1556
1702
|
</div>
|
|
1557
1703
|
</div>
|
|
1558
1704
|
|
|
1559
1705
|
<!-- Engineering Ticket Fields (shown when create eng ticket is checked) -->
|
|
1560
|
-
<div id="sf-eng-ticket-fields-container" style="display:${
|
|
1706
|
+
<div id="sf-eng-ticket-fields-container" style="display:${fe.createEngTicket && Ie.integrationData ? "block" : "none"}; margin-top: ${fe.createIssue ? "12px" : "0"};">
|
|
1561
1707
|
${generateEngTicketFieldsHTML()}
|
|
1562
1708
|
</div>
|
|
1563
1709
|
</div>
|
|
@@ -1600,8 +1746,8 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1600
1746
|
</div>
|
|
1601
1747
|
</div>
|
|
1602
1748
|
</div>
|
|
1603
|
-
`,
|
|
1604
|
-
const e3 =
|
|
1749
|
+
`, fe.mode = e2, document.body.appendChild(Te), (function bindListeners() {
|
|
1750
|
+
const e3 = Te == null ? void 0 : Te.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");
|
|
1605
1751
|
e3 == null ? void 0 : e3.forEach((e4) => {
|
|
1606
1752
|
e4.addEventListener("click", (e5) => {
|
|
1607
1753
|
const t4 = e5.currentTarget.dataset.mode;
|
|
@@ -1609,10 +1755,10 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1609
1755
|
});
|
|
1610
1756
|
}), n2 && (n2.onclick = closeModal);
|
|
1611
1757
|
o2 && o2.addEventListener("change", () => {
|
|
1612
|
-
"lookback" ===
|
|
1758
|
+
"lookback" === fe.mode && (i2.disabled = false, i2.style.opacity = "1", i2.style.cursor = "pointer");
|
|
1613
1759
|
});
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1760
|
+
const s2 = Te == null ? void 0 : Te.querySelectorAll(".sf-collapsible-header");
|
|
1761
|
+
s2 == null ? void 0 : s2.forEach((e4) => {
|
|
1616
1762
|
e4.addEventListener("click", (e5) => {
|
|
1617
1763
|
const t4 = e5.currentTarget, n3 = t4.dataset.target, i3 = document.getElementById(n3), o3 = t4.querySelector(".sf-chevron");
|
|
1618
1764
|
if (i3 && o3) {
|
|
@@ -1623,22 +1769,22 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1623
1769
|
}
|
|
1624
1770
|
});
|
|
1625
1771
|
});
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1628
|
-
const e4 =
|
|
1629
|
-
|
|
1772
|
+
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");
|
|
1773
|
+
r2 && r2.addEventListener("change", () => {
|
|
1774
|
+
const e4 = r2.checked;
|
|
1775
|
+
fe.createIssue = e4, localStorage.setItem(ue, String(e4)), a2 && (a2.style.display = e4 ? "block" : "none"), !e4 && l2 && (l2.checked = false, fe.createEngTicket = false, localStorage.setItem(pe, "false"), c2 && (c2.style.display = "none"));
|
|
1630
1776
|
});
|
|
1631
1777
|
l2 && l2.addEventListener("change", async () => {
|
|
1632
1778
|
var _a;
|
|
1633
1779
|
const e4 = l2.checked;
|
|
1634
|
-
if (
|
|
1635
|
-
if (!hasValidIntegration()) return l2.checked = false,
|
|
1780
|
+
if (fe.createEngTicket = e4, localStorage.setItem(pe, String(e4)), e4 && !fe.createIssue && (fe.createIssue = true, localStorage.setItem(ue, "true"), r2 && (r2.checked = true), a2 && (a2.style.display = "block")), c2 && (c2.style.display = e4 ? "block" : "none"), e4) {
|
|
1781
|
+
if (!hasValidIntegration()) return l2.checked = false, fe.createEngTicket = false, localStorage.setItem(pe, "false"), c2 && (c2.style.display = "none"), void alert("No engineering ticket integration found. Please install and configure an integration (Jira, Linear, or Zendesk) first.");
|
|
1636
1782
|
const e5 = getIntegrationData();
|
|
1637
1783
|
if (e5) {
|
|
1638
|
-
if (!
|
|
1639
|
-
if (getFieldsForProject(
|
|
1784
|
+
if (!fe.engTicketTeam && e5.defaultTeam && (fe.engTicketTeam = e5.defaultTeam), !fe.engTicketProject && e5.defaultProject && (fe.engTicketProject = e5.defaultProject), !fe.engTicketPriority && e5.defaultPriority && (fe.engTicketPriority = e5.defaultPriority), updateFormWithIntegrationData(fe), "jira" === ((_a = e5.provider) == null ? void 0 : _a.toLowerCase()) && fe.engTicketProject && !fe.engTicketCustomFields.reporter) {
|
|
1785
|
+
if (getFieldsForProject(fe.engTicketProject, fe.engTicketIssueType).find((e6) => "reporter" === e6.fieldId)) {
|
|
1640
1786
|
const t5 = getValidSavedReporterAccountId() || getDefaultReporterAccountId();
|
|
1641
|
-
|
|
1787
|
+
fe.engTicketCustomFields.reporter = t5 || e5.jiraReporterAccountId || "";
|
|
1642
1788
|
}
|
|
1643
1789
|
}
|
|
1644
1790
|
const t4 = document.getElementById("sf-eng-ticket-project"), n3 = document.getElementById("sf-eng-ticket-type");
|
|
@@ -1648,11 +1794,11 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1648
1794
|
});
|
|
1649
1795
|
const d2 = document.getElementById("sf-issue-name");
|
|
1650
1796
|
d2 && d2.addEventListener("input", () => {
|
|
1651
|
-
|
|
1797
|
+
fe.issueName = d2.value;
|
|
1652
1798
|
});
|
|
1653
1799
|
bindEngTicketListeners(), t3 && (t3.onclick = () => {
|
|
1654
1800
|
const e4 = document.getElementById("sf-issue-description");
|
|
1655
|
-
e4 && (
|
|
1801
|
+
e4 && (fe.description = e4.value), (function startCountdownThenRecord() {
|
|
1656
1802
|
if (document.getElementById("sf-countdown-overlay")) return;
|
|
1657
1803
|
const e5 = document.createElement("div");
|
|
1658
1804
|
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 ";
|
|
@@ -1662,10 +1808,10 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1662
1808
|
if (t4--, t4 > 0) e5.textContent = t4.toString();
|
|
1663
1809
|
else {
|
|
1664
1810
|
clearInterval(n3), document.body.removeChild(e5), (function setRecordingStartTime(e6) {
|
|
1665
|
-
|
|
1811
|
+
ge = e6;
|
|
1666
1812
|
})(Date.now()), setIsRecording(true);
|
|
1667
1813
|
try {
|
|
1668
|
-
const { enableFunctionSpanTracking: e6 } = await Promise.resolve().then(() =>
|
|
1814
|
+
const { enableFunctionSpanTracking: e6 } = await Promise.resolve().then(() => z);
|
|
1669
1815
|
e6();
|
|
1670
1816
|
} catch (e6) {
|
|
1671
1817
|
console.error("[Report Issue] Failed to enable function span tracking:", e6);
|
|
@@ -1692,7 +1838,7 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1692
1838
|
const t5 = e6.querySelector("#sf-recording-timer");
|
|
1693
1839
|
if (!t5) return;
|
|
1694
1840
|
const n4 = setInterval(() => {
|
|
1695
|
-
const e7 = Date.now() - (
|
|
1841
|
+
const e7 = Date.now() - (ge ?? Date.now()), n5 = Math.floor(e7 / 6e4).toString().padStart(2, "0"), i3 = Math.floor(e7 % 6e4 / 1e3).toString().padStart(2, "0");
|
|
1696
1842
|
t5.textContent = `${n5}:${i3}`;
|
|
1697
1843
|
}, 1e3);
|
|
1698
1844
|
setTimerInterval(n4);
|
|
@@ -1701,33 +1847,33 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1701
1847
|
}, 1e3);
|
|
1702
1848
|
})();
|
|
1703
1849
|
});
|
|
1704
|
-
|
|
1850
|
+
Te == null ? void 0 : Te.addEventListener("click", (e4) => {
|
|
1705
1851
|
var _a;
|
|
1706
1852
|
if (e4.target.closest("#sf-issue-submit-btn")) {
|
|
1707
|
-
const e5 = ((_a = document.getElementById("sf-issue-description")) == null ? void 0 : _a.value) || "", t4 =
|
|
1708
|
-
if (
|
|
1853
|
+
const e5 = ((_a = document.getElementById("sf-issue-description")) == null ? void 0 : _a.value) || "", t4 = fe.mode;
|
|
1854
|
+
if (fe.description = e5, fe.createIssue && !fe.issueName.trim()) return void alert("Issue title is required when creating an issue.");
|
|
1709
1855
|
let n3, i3;
|
|
1710
|
-
if ("startnow" === t4) n3 =
|
|
1856
|
+
if ("startnow" === t4) n3 = ge ?? Date.now() - 3e5, i3 = me ?? Date.now();
|
|
1711
1857
|
else {
|
|
1712
1858
|
const e6 = 60 * Number((o2 == null ? void 0 : o2.value) || "2") * 1e3;
|
|
1713
1859
|
i3 = Date.now(), n3 = i3 - e6;
|
|
1714
1860
|
}
|
|
1715
|
-
if (
|
|
1716
|
-
const o3 = document.getElementById("sf-issue-name"),
|
|
1861
|
+
if (fe.createIssue) {
|
|
1862
|
+
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 = fe.engTicketLabels, m2 = (l3 == null ? void 0 : l3.value) || "", h2 = { ...fe.engTicketCustomFields };
|
|
1717
1863
|
document.querySelectorAll(".sf-dynamic-field").forEach((e6) => {
|
|
1718
1864
|
const t5 = e6, n4 = t5.dataset.fieldId;
|
|
1719
1865
|
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));
|
|
1720
1866
|
});
|
|
1721
|
-
const y2 = document.getElementById("sf-eng-ticket-sprint"),
|
|
1722
|
-
if (
|
|
1867
|
+
const y2 = document.getElementById("sf-eng-ticket-sprint"), S2 = (y2 == null ? void 0 : y2.value) || fe.engTicketSprint;
|
|
1868
|
+
if (S2) {
|
|
1723
1869
|
const e6 = getSprintFieldId();
|
|
1724
|
-
h2[e6] = parseInt(
|
|
1870
|
+
h2[e6] = parseInt(S2, 10);
|
|
1725
1871
|
}
|
|
1726
|
-
closeModal(), (async function createTriageAndIssue(e6, t5, n4, i4, o4,
|
|
1872
|
+
closeModal(), (async function createTriageAndIssue(e6, t5, n4, i4, o4, s4, r4, a4, l4, c4, d4, u3, p3) {
|
|
1727
1873
|
var _a2, _b, _c;
|
|
1728
1874
|
try {
|
|
1729
1875
|
showStatusModal(true);
|
|
1730
|
-
const f3 = await createTriageAndIssueFromRecorder(
|
|
1876
|
+
const f3 = await createTriageAndIssueFromRecorder(Ie.apiKey, Ie.backendApi, getSessionIdSafely(), e6, t5, n4, i4, o4, s4, r4, a4, l4, c4, d4, u3, p3);
|
|
1731
1877
|
if ((_a2 = f3 == null ? void 0 : f3.errors) == null ? void 0 : _a2.length) {
|
|
1732
1878
|
const e7 = f3.errors.map((e8) => e8.message).join("; ");
|
|
1733
1879
|
return console.error("GraphQL error creating triage and issue:", e7), void showStatusModal(false, null, e7);
|
|
@@ -1737,33 +1883,33 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1737
1883
|
} catch (e7) {
|
|
1738
1884
|
console.error("Error creating triage and issue:", e7), showStatusModal(false, null, "Something went wrong. Please try again.");
|
|
1739
1885
|
}
|
|
1740
|
-
})(`${n3}`, `${i3}`, e5, c3, d3,
|
|
1886
|
+
})(`${n3}`, `${i3}`, e5, c3, d3, fe.createEngTicket, u2, p2, f2, g2, m2, h2, "startnow" === t4 ? "RECORDED" : "LOOKBACK");
|
|
1741
1887
|
} else closeModal(), (async function createTriage(e6, t5, n4, i4) {
|
|
1742
1888
|
var _a2, _b, _c;
|
|
1743
1889
|
try {
|
|
1744
1890
|
showStatusModal(true);
|
|
1745
|
-
const o3 = await createTriageFromRecorder(
|
|
1891
|
+
const o3 = await createTriageFromRecorder(Ie.apiKey, Ie.backendApi, getSessionIdSafely(), e6, t5, n4, i4);
|
|
1746
1892
|
if ((_a2 = o3 == null ? void 0 : o3.errors) == null ? void 0 : _a2.length) {
|
|
1747
1893
|
const e7 = o3.errors.map((e8) => e8.message).join("; ");
|
|
1748
1894
|
return console.error("GraphQL error creating triage:", e7), void showStatusModal(false, null, e7);
|
|
1749
1895
|
}
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1896
|
+
const s3 = (_c = (_b = o3 == null ? void 0 : o3.data) == null ? void 0 : _b.createTriageFromRecorder) == null ? void 0 : _c.id;
|
|
1897
|
+
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."));
|
|
1752
1898
|
} catch (e7) {
|
|
1753
1899
|
console.error("Error creating triage:", e7), showStatusModal(false, null, "Something went wrong. Please try again.");
|
|
1754
1900
|
}
|
|
1755
1901
|
})(`${n3}`, `${i3}`, e5, "startnow" === t4 ? "RECORDED" : "LOOKBACK");
|
|
1756
1902
|
}
|
|
1757
1903
|
});
|
|
1758
|
-
})(),
|
|
1904
|
+
})(), Ie.deactivateIsolation = activateModalIsolation(Te), Ie.integrationData && fe.createEngTicket ? initializeEngTicketForm() : Ie.integrationData || (fe.createEngTicket = false), Ie.apiKey && Ie.backendApi && refreshIntegrationData(Ie.apiKey, Ie.backendApi).then((e3) => {
|
|
1759
1905
|
if (!e3 || !document.getElementById("sf-report-issue-modal")) return;
|
|
1760
|
-
|
|
1906
|
+
Ie.integrationData = e3;
|
|
1761
1907
|
const t3 = document.getElementById("sf-eng-ticket-fields-container");
|
|
1762
1908
|
if (t3) {
|
|
1763
1909
|
const e4 = generateEngTicketFieldsHTML();
|
|
1764
|
-
e4 && (t3.innerHTML = e4, initializeEngTicketForm(), bindEngTicketListeners(), updateFormWithIntegrationData(
|
|
1910
|
+
e4 && (t3.innerHTML = e4, initializeEngTicketForm(), bindEngTicketListeners(), updateFormWithIntegrationData(fe), renderDynamicFields(fe.engTicketProject, fe.engTicketIssueType));
|
|
1765
1911
|
}
|
|
1766
|
-
if (
|
|
1912
|
+
if (Ee) {
|
|
1767
1913
|
const e4 = document.getElementById("sf-create-eng-ticket-label");
|
|
1768
1914
|
e4 && (e4.style.display = "flex");
|
|
1769
1915
|
}
|
|
@@ -1771,40 +1917,40 @@ function injectModalHTML(e2 = "lookback") {
|
|
|
1771
1917
|
}
|
|
1772
1918
|
function initializeEngTicketForm() {
|
|
1773
1919
|
var _a;
|
|
1774
|
-
const e2 =
|
|
1920
|
+
const e2 = Ie.integrationData;
|
|
1775
1921
|
if (e2) {
|
|
1776
|
-
if (!
|
|
1777
|
-
if (getFieldsForProject(
|
|
1922
|
+
if (!fe.engTicketTeam && e2.defaultTeam && (fe.engTicketTeam = e2.defaultTeam), !fe.engTicketProject && e2.defaultProject && (fe.engTicketProject = e2.defaultProject), !fe.engTicketPriority && e2.defaultPriority && (fe.engTicketPriority = e2.defaultPriority), updateFormWithIntegrationData(fe), "jira" === ((_a = e2.provider) == null ? void 0 : _a.toLowerCase()) && fe.engTicketProject && !fe.engTicketCustomFields.reporter) {
|
|
1923
|
+
if (getFieldsForProject(fe.engTicketProject, fe.engTicketIssueType).find((e3) => "reporter" === e3.fieldId)) {
|
|
1778
1924
|
const t2 = getValidSavedReporterAccountId() || getDefaultReporterAccountId();
|
|
1779
|
-
|
|
1925
|
+
fe.engTicketCustomFields.reporter = t2 || e2.jiraReporterAccountId || "";
|
|
1780
1926
|
}
|
|
1781
1927
|
}
|
|
1782
|
-
|
|
1928
|
+
fe.engTicketProject && renderDynamicFields(fe.engTicketProject, fe.engTicketIssueType);
|
|
1783
1929
|
}
|
|
1784
1930
|
}
|
|
1785
1931
|
function setActiveTab(e2) {
|
|
1786
|
-
|
|
1787
|
-
const t2 =
|
|
1932
|
+
fe.mode = e2;
|
|
1933
|
+
const t2 = Te == null ? void 0 : Te.querySelector("#sf-tab-lookback"), n2 = Te == null ? void 0 : Te.querySelector("#sf-tab-startnow");
|
|
1788
1934
|
"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");
|
|
1789
1935
|
}
|
|
1790
1936
|
function updateModeSpecificUI(e2) {
|
|
1791
|
-
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"),
|
|
1792
|
-
if (t2 && n2 && i2 && o2 &&
|
|
1793
|
-
i2.style.display = "block",
|
|
1794
|
-
const e3 = null !==
|
|
1795
|
-
if (n2.disabled = !e3, n2.style.opacity = e3 ? "1" : "0.4", n2.style.cursor = e3 ? "pointer" : "not-allowed",
|
|
1796
|
-
const e4 = Math.floor((
|
|
1797
|
-
o2.style.display = "block",
|
|
1937
|
+
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");
|
|
1938
|
+
if (t2 && n2 && i2 && o2 && s2 && r2 && a2) if ("startnow" === e2) {
|
|
1939
|
+
i2.style.display = "block", a2.style.display = "none", r2.style.justifyContent = "space-between", t2.textContent = "I want to reproduce the issue right now.";
|
|
1940
|
+
const e3 = null !== ge && null !== me;
|
|
1941
|
+
if (n2.disabled = !e3, n2.style.opacity = e3 ? "1" : "0.4", n2.style.cursor = e3 ? "pointer" : "not-allowed", ge && me) {
|
|
1942
|
+
const e4 = Math.floor((me - ge) / 1e3), t3 = String(Math.floor(e4 / 60)).padStart(2, "0"), n3 = String(e4 % 60).padStart(2, "0");
|
|
1943
|
+
o2.style.display = "block", s2.textContent = `${t3}:${n3}`;
|
|
1798
1944
|
} else o2.style.display = "none";
|
|
1799
|
-
} else i2.style.display = "none", o2.style.display = "none",
|
|
1945
|
+
} 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";
|
|
1800
1946
|
}
|
|
1801
1947
|
function bindEngTicketListeners() {
|
|
1802
|
-
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"),
|
|
1948
|
+
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");
|
|
1803
1949
|
e2 && e2.addEventListener("change", () => {
|
|
1804
|
-
|
|
1950
|
+
fe.engTicketTeam = e2.value, e2.style.color = e2.value ? "" : "#9ca3af";
|
|
1805
1951
|
const t3 = document.getElementById("sf-eng-ticket-project");
|
|
1806
1952
|
if (t3) {
|
|
1807
|
-
|
|
1953
|
+
fe.engTicketProject = "", fe.engTicketCustomFields = {};
|
|
1808
1954
|
const n3 = getProjectsForTeam(e2.value);
|
|
1809
1955
|
t3.innerHTML = '<option value="">Select project...</option>', n3.forEach((e3) => {
|
|
1810
1956
|
const n4 = document.createElement("option");
|
|
@@ -1813,41 +1959,41 @@ function bindEngTicketListeners() {
|
|
|
1813
1959
|
}
|
|
1814
1960
|
}), t2 && t2.addEventListener("change", () => {
|
|
1815
1961
|
var _a;
|
|
1816
|
-
|
|
1962
|
+
fe.engTicketProject = t2.value, t2.style.color = t2.value ? "" : "#9ca3af", fe.engTicketCustomFields = {};
|
|
1817
1963
|
const e3 = getIntegrationData();
|
|
1818
|
-
if (e3 && o2 && (updateIssueTypeOptions(o2, t2.value),
|
|
1819
|
-
if (getFieldsForProject(t2.value,
|
|
1964
|
+
if (e3 && o2 && (updateIssueTypeOptions(o2, t2.value), fe.engTicketIssueType = o2.value), e3 && "jira" === ((_a = e3.provider) == null ? void 0 : _a.toLowerCase()) && t2.value) {
|
|
1965
|
+
if (getFieldsForProject(t2.value, fe.engTicketIssueType).find((e4) => "reporter" === e4.fieldId)) {
|
|
1820
1966
|
const t3 = getValidSavedReporterAccountId() || getDefaultReporterAccountId();
|
|
1821
|
-
|
|
1967
|
+
fe.engTicketCustomFields.reporter = t3 || e3.jiraReporterAccountId || "";
|
|
1822
1968
|
}
|
|
1823
1969
|
}
|
|
1824
|
-
renderDynamicFields(t2.value,
|
|
1825
|
-
}),
|
|
1826
|
-
|
|
1970
|
+
renderDynamicFields(t2.value, fe.engTicketIssueType);
|
|
1971
|
+
}), s2 && s2.addEventListener("change", () => {
|
|
1972
|
+
fe.engTicketSprint = s2.value, s2.style.color = s2.value ? "" : "#9ca3af", setSprintDefaulted(true);
|
|
1827
1973
|
}), n2 && n2.addEventListener("change", () => {
|
|
1828
|
-
|
|
1974
|
+
fe.engTicketPriority = Number(n2.value);
|
|
1829
1975
|
}), i2 && setupCustomMultiSelectListeners("sf-eng-ticket-labels", (e3) => {
|
|
1830
|
-
|
|
1976
|
+
fe.engTicketLabels = e3;
|
|
1831
1977
|
}), o2 && o2.addEventListener("change", () => {
|
|
1832
|
-
|
|
1978
|
+
fe.engTicketIssueType = o2.value, o2.style.color = o2.value ? "" : "#9ca3af";
|
|
1833
1979
|
const e3 = document.getElementById("sf-eng-ticket-project");
|
|
1834
1980
|
if (e3 && e3.value) {
|
|
1835
|
-
const t3 =
|
|
1836
|
-
|
|
1981
|
+
const t3 = fe.engTicketCustomFields.reporter;
|
|
1982
|
+
fe.engTicketCustomFields = {}, t3 && (fe.engTicketCustomFields.reporter = t3), renderDynamicFields(e3.value, o2.value);
|
|
1837
1983
|
}
|
|
1838
1984
|
});
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1985
|
+
const r2 = document.getElementById("sf-dynamic-fields-container");
|
|
1986
|
+
r2 && (r2.addEventListener("input", (e3) => {
|
|
1841
1987
|
const t3 = e3.target;
|
|
1842
1988
|
if (t3.classList.contains("sf-dynamic-field")) {
|
|
1843
1989
|
const e4 = t3.dataset.fieldId;
|
|
1844
|
-
e4 && ("checkbox" === t3.type ?
|
|
1990
|
+
e4 && ("checkbox" === t3.type ? fe.engTicketCustomFields[e4] = t3.checked : "number" === t3.type ? fe.engTicketCustomFields[e4] = parseFloat(t3.value) || null : fe.engTicketCustomFields[e4] = t3.value);
|
|
1845
1991
|
}
|
|
1846
|
-
}),
|
|
1992
|
+
}), r2.addEventListener("change", (e3) => {
|
|
1847
1993
|
const t3 = e3.target;
|
|
1848
1994
|
if (t3.classList.contains("sf-dynamic-field")) {
|
|
1849
1995
|
const e4 = t3.dataset.fieldId;
|
|
1850
|
-
if (e4 && (
|
|
1996
|
+
if (e4 && (fe.engTicketCustomFields[e4] = t3.value, "reporter" === e4 && t3.value && saveLastReporterAccountId(t3.value)), "SELECT" === t3.tagName) {
|
|
1851
1997
|
const e5 = t3;
|
|
1852
1998
|
e5.style.color = e5.value ? "" : "#9ca3af";
|
|
1853
1999
|
}
|
|
@@ -1857,10 +2003,10 @@ function bindEngTicketListeners() {
|
|
|
1857
2003
|
async function stopRecording() {
|
|
1858
2004
|
var _a;
|
|
1859
2005
|
!(function setRecordingEndTime(e2) {
|
|
1860
|
-
|
|
1861
|
-
})(Date.now()), setIsRecording(false),
|
|
2006
|
+
me = e2;
|
|
2007
|
+
})(Date.now()), setIsRecording(false), he && (clearInterval(he), setTimerInterval(null)), (_a = document.getElementById("sf-recording-indicator")) == null ? void 0 : _a.remove();
|
|
1862
2008
|
try {
|
|
1863
|
-
const { disableFunctionSpanTracking: e2 } = await Promise.resolve().then(() =>
|
|
2009
|
+
const { disableFunctionSpanTracking: e2 } = await Promise.resolve().then(() => z);
|
|
1864
2010
|
e2();
|
|
1865
2011
|
} catch (e2) {
|
|
1866
2012
|
console.error("[Report Issue] Failed to disable function span tracking:", e2);
|
|
@@ -1873,21 +2019,21 @@ async function stopRecording() {
|
|
|
1873
2019
|
t3 && (t3.textContent = "Re-record");
|
|
1874
2020
|
}
|
|
1875
2021
|
const t2 = document.getElementById("sf-recording-timer-label"), n2 = document.getElementById("sf-recording-timer-display");
|
|
1876
|
-
if (t2 && n2 &&
|
|
1877
|
-
const e3 = Math.floor((
|
|
2022
|
+
if (t2 && n2 && ge && me) {
|
|
2023
|
+
const e3 = Math.floor((me - ge) / 1e3), i3 = Math.floor(e3 / 60).toString().padStart(2, "0"), o3 = (e3 % 60).toString().padStart(2, "0");
|
|
1878
2024
|
n2.textContent = `${i3}:${o3}`, t2.style.display = "block";
|
|
1879
2025
|
}
|
|
1880
2026
|
const i2 = document.getElementById("sf-issue-description");
|
|
1881
|
-
i2 && (i2.value =
|
|
2027
|
+
i2 && (i2.value = fe.description);
|
|
1882
2028
|
const o2 = document.querySelector('input[value="startnow"]');
|
|
1883
2029
|
o2 && (o2.checked = true);
|
|
1884
|
-
const
|
|
1885
|
-
if (
|
|
1886
|
-
const e3 = Math.floor(((
|
|
1887
|
-
|
|
2030
|
+
const s2 = document.getElementById("sf-inline-record-chip"), r2 = document.getElementById("sf-inline-record-timer");
|
|
2031
|
+
if (s2 && r2) {
|
|
2032
|
+
const e3 = Math.floor(((me ?? 0) - (ge ?? 0)) / 1e3), t3 = Math.floor(e3 / 60).toString().padStart(2, "0"), n3 = Math.floor(e3 % 60).toString().padStart(2, "0");
|
|
2033
|
+
r2.textContent = `${t3}:${n3}`, r2.style.color = "black", s2.style.display = "flex";
|
|
1888
2034
|
}
|
|
1889
|
-
const
|
|
1890
|
-
|
|
2035
|
+
const a2 = document.getElementById("sf-issue-submit-btn");
|
|
2036
|
+
a2.disabled = false, a2.style.opacity = "1", a2.style.cursor = "pointer";
|
|
1891
2037
|
})();
|
|
1892
2038
|
}
|
|
1893
2039
|
function showStatusModal(e2, t2, n2) {
|
|
@@ -1897,10 +2043,10 @@ function showStatusModal(e2, t2, n2) {
|
|
|
1897
2043
|
var _a2, _b;
|
|
1898
2044
|
(_a2 = document.getElementById("sf-report-issue-modal")) == null ? void 0 : _a2.remove(), (_b = document.getElementById("sf-triage-status-modal")) == null ? void 0 : _b.remove();
|
|
1899
2045
|
})();
|
|
1900
|
-
const o2 = !e3 && i2,
|
|
1901
|
-
|
|
1902
|
-
const
|
|
1903
|
-
|
|
2046
|
+
const o2 = !e3 && i2, s2 = n3 ? `${Ie.triageBaseUrl}/issues/${n3}?from=inAppReportIssue` : t3 ? `${Ie.triageBaseUrl}/triage/${t3}?from=inAppReportIssue` : "", r2 = document.createElement("div");
|
|
2047
|
+
r2.id = "sf-triage-status-modal", Object.assign(r2.style, { position: "fixed", inset: "0", zIndex: "9998", display: "flex", alignItems: "center", justifyContent: "center" });
|
|
2048
|
+
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>';
|
|
2049
|
+
r2.innerHTML = `
|
|
1904
2050
|
<div style="position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:9998;"></div>
|
|
1905
2051
|
<div id="sf-triage-card"
|
|
1906
2052
|
style="position:relative; background:#fff; padding:24px; border-radius:12px; width:300px; max-width:90%;
|
|
@@ -1916,7 +2062,7 @@ function showStatusModal(e2, t2, n2) {
|
|
|
1916
2062
|
</svg>
|
|
1917
2063
|
</button>
|
|
1918
2064
|
|
|
1919
|
-
<h2 style="font-size:18px; font-weight:600; margin-bottom:${e3 || o2 ? 8 : 40}px; line-height:28px;">${
|
|
2065
|
+
<h2 style="font-size:18px; font-weight:600; margin-bottom:${e3 || o2 ? 8 : 40}px; line-height:28px;">${a2}</h2>
|
|
1920
2066
|
${l2}
|
|
1921
2067
|
${c2}
|
|
1922
2068
|
|
|
@@ -1941,28 +2087,28 @@ function showStatusModal(e2, t2, n2) {
|
|
|
1941
2087
|
<style>
|
|
1942
2088
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
1943
2089
|
</style>
|
|
1944
|
-
`, document.body.appendChild(
|
|
1945
|
-
const u2 =
|
|
2090
|
+
`, document.body.appendChild(r2);
|
|
2091
|
+
const u2 = r2.querySelector("#sf-triage-card");
|
|
1946
2092
|
(_a = document.getElementById("sf-triage-modal-close")) == null ? void 0 : _a.addEventListener("click", () => {
|
|
1947
|
-
fadeCardAndRemove(
|
|
2093
|
+
fadeCardAndRemove(r2, u2, 300);
|
|
1948
2094
|
});
|
|
1949
2095
|
const p2 = document.getElementById("sf-copy-triage-link"), f2 = document.getElementById("sf-view-triage-btn");
|
|
1950
2096
|
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", () => {
|
|
1951
|
-
navigator.clipboard.writeText(
|
|
2097
|
+
navigator.clipboard.writeText(s2).then(() => {
|
|
1952
2098
|
const e4 = document.getElementById("sf-copied-status");
|
|
1953
2099
|
e4 && (e4.style.display = "flex");
|
|
1954
2100
|
});
|
|
1955
2101
|
}), f2.disabled = false, f2.addEventListener("click", () => {
|
|
1956
|
-
(t3 || n3) && window.open(
|
|
1957
|
-
}), o2 || setTimeout(() => fadeCardAndRemove(
|
|
2102
|
+
(t3 || n3) && window.open(s2, "_blank");
|
|
2103
|
+
}), o2 || setTimeout(() => fadeCardAndRemove(r2, u2, 300), 1e4));
|
|
1958
2104
|
})(e2, "triage" === (t2 == null ? void 0 : t2.type) ? t2.id : void 0, "issue" === (t2 == null ? void 0 : t2.type) ? t2.id : void 0, n2);
|
|
1959
2105
|
}
|
|
1960
2106
|
function fadeCardAndRemove(e2, t2, n2 = 300) {
|
|
1961
2107
|
t2.style.opacity = "0", t2.addEventListener("transitionend", () => e2.remove(), { once: true }), setTimeout(() => e2.remove(), n2 + 100);
|
|
1962
2108
|
}
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1965
|
-
const t3 = { ...
|
|
2109
|
+
const Me = Object.freeze(Object.defineProperty({ __proto__: null, ReportIssueContext: Ie, openReportIssueModal, setupIssueReporting: function setupIssueReporting(e2) {
|
|
2110
|
+
Ie.apiKey = e2.apiKey, Ie.backendApi = e2.backendApi, Ie.resolveSessionId = e2.getSessionId, Ie.integrationData = e2.integrationData || null, Ie.showEngTicketFieldsDefault = e2.showEngTicketFieldsInReportIssueModalDefault ?? false, e2.customBaseUrl && (Ie.triageBaseUrl = e2.customBaseUrl), Ie.shortcuts = (function mergeShortcutsConfig(e3) {
|
|
2111
|
+
const t3 = { ...xe };
|
|
1966
2112
|
if (!e3) return t3;
|
|
1967
2113
|
"boolean" == typeof e3.enabled && (t3.enabled = e3.enabled);
|
|
1968
2114
|
const n2 = ["openModalExistingMode", "openModalCaptureNewMode", "closeModal", "submitReport", "startRecording", "stopRecording"];
|
|
@@ -1972,54 +2118,55 @@ const Se = Object.freeze(Object.defineProperty({ __proto__: null, ReportIssueCon
|
|
|
1972
2118
|
}
|
|
1973
2119
|
return t3;
|
|
1974
2120
|
})(e2.shortcuts);
|
|
1975
|
-
const { shortcuts: t2 } =
|
|
2121
|
+
const { shortcuts: t2 } = Ie;
|
|
1976
2122
|
window.addEventListener("keydown", (e3) => {
|
|
1977
2123
|
const n2 = (function isTypingInInput() {
|
|
1978
2124
|
const e4 = document.activeElement;
|
|
1979
2125
|
return e4 instanceof HTMLInputElement || e4 instanceof HTMLTextAreaElement || e4 instanceof HTMLElement && e4.isContentEditable;
|
|
1980
|
-
})(), i2 = e3.key.toLowerCase(), o2 = e3.metaKey || e3.ctrlKey,
|
|
2126
|
+
})(), 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) => {
|
|
1981
2127
|
setActiveTab(e4), updateModeSpecificUI(e4);
|
|
1982
2128
|
} : injectModalHTML;
|
|
1983
|
-
if (
|
|
1984
|
-
if (
|
|
1985
|
-
if (
|
|
1986
|
-
if (
|
|
2129
|
+
if (r2 && shortcutUsed("openModalExistingMode")) return e3.preventDefault(), void a2("lookback");
|
|
2130
|
+
if (r2 && shortcutUsed("openModalCaptureNewMode")) return e3.preventDefault(), void a2("startnow");
|
|
2131
|
+
if (s2 && !ye && shortcutUsed("closeModal")) return e3.preventDefault(), void closeModal();
|
|
2132
|
+
if (s2 && shortcutUsed("submitReport")) {
|
|
1987
2133
|
const t3 = document.getElementById("sf-issue-submit-btn");
|
|
1988
2134
|
return void (t3 && !t3.disabled && (e3.preventDefault(), t3.click()));
|
|
1989
2135
|
}
|
|
1990
|
-
if (
|
|
1991
|
-
if (
|
|
2136
|
+
if (ye && i2 === t2.stopRecording.key && o2 === t2.stopRecording.requireCmdCtrl) return e3.preventDefault(), void stopRecording();
|
|
2137
|
+
if (s2 && "startnow" === fe.mode && i2 === t2.startRecording.key && o2 === t2.startRecording.requireCmdCtrl && !n2) {
|
|
1992
2138
|
const t3 = document.getElementById("sf-start-recording-btn");
|
|
1993
2139
|
return void (t3 && (e3.preventDefault(), t3.click()));
|
|
1994
2140
|
}
|
|
1995
2141
|
});
|
|
1996
|
-
} }, Symbol.toStringTag, { value: "Module" })),
|
|
2142
|
+
} }, Symbol.toStringTag, { value: "Module" })), Ce = readDebugFlag(), $e = /* @__PURE__ */ new Map();
|
|
1997
2143
|
function getCachedRegex(e2, t2) {
|
|
1998
2144
|
const n2 = `${e2}|${t2}`;
|
|
1999
|
-
let i2 =
|
|
2000
|
-
return i2 || (i2 = new RegExp(e2, t2),
|
|
2145
|
+
let i2 = $e.get(n2);
|
|
2146
|
+
return i2 || (i2 = new RegExp(e2, t2), $e.set(n2, i2)), i2;
|
|
2001
2147
|
}
|
|
2002
|
-
const
|
|
2148
|
+
const Fe = 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())), Ae = ["t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com", "*.zdassets.com"], Le = [400, 403], Re = "CORS", De = 1, _e = "authorization", Pe = "Authorization", Be = { recordCanvas: false, recordCrossOriginIframes: false, collectFonts: false, inlineImages: false, recordPassword: false, recordRealName: true, recordCreditCardInfo: false, recordSsn: false, recordDob: false, sampling: {}, enableFiberTracking: false, maskInputSelector: "", maskTextSelector: "", blockSelector: "", unmaskSelector: "", maskInputOptions: { password: true } }, Oe = { level: ["info", "log", "warn", "error"], lengthThreshold: 1e4, stringifyOptions: { stringLengthLimit: 1e3, numOfKeysLimit: 20, depthOfLimit: 4 }, logger: "console" };
|
|
2003
2149
|
function maskAuthorizationHeader(e2) {
|
|
2004
|
-
const t2 = e2[
|
|
2150
|
+
const t2 = e2[_e] ? _e : e2[Pe] ? Pe : null;
|
|
2005
2151
|
if (!t2) return;
|
|
2006
2152
|
const n2 = e2[t2], i2 = n2.indexOf(" ");
|
|
2007
2153
|
if (-1 !== i2) {
|
|
2008
|
-
const o2 = n2.slice(0, i2 + 1),
|
|
2009
|
-
|
|
2154
|
+
const o2 = n2.slice(0, i2 + 1), s2 = n2.slice(i2 + 1);
|
|
2155
|
+
s2.length > 8 ? e2[t2] = o2 + s2.slice(0, 4) + "*".repeat(s2.length - 8) + s2.slice(-4) : e2[t2] = o2 + "*".repeat(s2.length);
|
|
2010
2156
|
} else n2.length > 8 ? e2[t2] = n2.slice(0, 4) + "*".repeat(n2.length - 8) + n2.slice(-4) : e2[t2] = "*".repeat(n2.length);
|
|
2011
2157
|
}
|
|
2012
2158
|
function trackDomainChangesOnce() {
|
|
2013
2159
|
const e2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
|
|
2014
2160
|
if (e2.routeWatcherIntervalId) return;
|
|
2015
2161
|
let t2 = window.location.href.split("?")[0];
|
|
2016
|
-
const checkDomainChange = (
|
|
2017
|
-
const
|
|
2018
|
-
if (
|
|
2019
|
-
t2 =
|
|
2020
|
-
const
|
|
2021
|
-
sessionStorage.setItem("pageVisitUUID",
|
|
2022
|
-
|
|
2162
|
+
const checkDomainChange = (n3 = false) => {
|
|
2163
|
+
const i2 = window.location.href.split("?")[0];
|
|
2164
|
+
if (n3 || i2 !== t2) {
|
|
2165
|
+
t2 = i2;
|
|
2166
|
+
const o2 = uuidv4(), s2 = sessionStorage.getItem("pageVisitUUID") ?? "";
|
|
2167
|
+
sessionStorage.setItem("pageVisitUUID", o2), sessionStorage.setItem("prevPageVisitUUID", s2), invalidateUrlCache();
|
|
2168
|
+
const r2 = Date.now();
|
|
2169
|
+
e2.internalDebugLogs && console.log("[sf-recorder] mint pageVisitUUID", { url: i2, newUuid: o2, prevUuid: s2, forceSend: n3, timestamp: r2, stack: new Error().stack }), sendMessage({ type: "routeChange", data: { url: i2, timestamp: r2, page_visit_uuid: o2, prev_page_visit_uuid: s2 } });
|
|
2023
2170
|
}
|
|
2024
2171
|
}, n2 = /* @__PURE__ */ (function debounce(e3, t3) {
|
|
2025
2172
|
let n3;
|
|
@@ -2032,14 +2179,14 @@ function trackDomainChangesOnce() {
|
|
|
2032
2179
|
function sendUserDeviceUuid() {
|
|
2033
2180
|
sendMessage({ type: "userDeviceUuid", userDeviceUuid: (function getOrSetUserDeviceUuid() {
|
|
2034
2181
|
let e2 = null;
|
|
2035
|
-
if (
|
|
2182
|
+
if (m) try {
|
|
2036
2183
|
e2 = localStorage.getItem("sailfishUserDeviceUuid");
|
|
2037
2184
|
} catch {
|
|
2038
2185
|
}
|
|
2039
2186
|
if (!e2) {
|
|
2040
2187
|
e2 = uuidv4();
|
|
2041
2188
|
try {
|
|
2042
|
-
|
|
2189
|
+
m && localStorage.setItem("sailfishUserDeviceUuid", e2);
|
|
2043
2190
|
} catch {
|
|
2044
2191
|
}
|
|
2045
2192
|
}
|
|
@@ -2048,52 +2195,63 @@ function sendUserDeviceUuid() {
|
|
|
2048
2195
|
}
|
|
2049
2196
|
function handleVisibilityChange() {
|
|
2050
2197
|
const e2 = document.visibilityState, t2 = Date.now();
|
|
2051
|
-
"visible" === e2 && getOrSetSessionId();
|
|
2198
|
+
"visible" === e2 && (getOrSetSessionId(), requestTimeSync());
|
|
2052
2199
|
try {
|
|
2053
|
-
sendMessage({ type: "visibilityChange", data: { state: e2, url: window.location.href.split("?")[0], timestamp: t2, ...getUrlAndStoredUuids() } }),
|
|
2200
|
+
sendMessage({ type: "visibilityChange", data: { state: e2, url: window.location.href.split("?")[0], timestamp: t2, ...getUrlAndStoredUuids() } }), Ce && console.log(`[Sailfish] Tab became ${e2}, sent visibility change event`);
|
|
2054
2201
|
} catch (e3) {
|
|
2055
2202
|
console.warn("[Sailfish] Failed to send visibility change event:", e3);
|
|
2056
2203
|
}
|
|
2057
2204
|
sessionStorage.setItem("tabVisibilityChanged", t2.toString()), sessionStorage.setItem("tabVisibilityState", e2), invalidateUrlCache();
|
|
2058
2205
|
}
|
|
2059
2206
|
function clearPageVisitDataFromSessionStorage() {
|
|
2060
|
-
|
|
2207
|
+
h && (sessionStorage.removeItem("pageVisitUUID"), sessionStorage.removeItem("prevPageVisitUUID"), sessionStorage.removeItem("tabVisibilityChanged"), sessionStorage.removeItem("tabVisibilityState"), invalidateUrlCache());
|
|
2061
2208
|
}
|
|
2062
|
-
let
|
|
2209
|
+
let je = false;
|
|
2063
2210
|
function _ensureModuleSideEffects() {
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
window.name =
|
|
2211
|
+
je || (je = true, restoreFuncSpanState(), (function ensureSessionListeners() {
|
|
2212
|
+
v || (v = true, f && window.addEventListener("beforeunload", () => {
|
|
2213
|
+
window.name = S + window.name;
|
|
2067
2214
|
}));
|
|
2068
|
-
})(),
|
|
2215
|
+
})(), f && (sendUserDeviceUuid(), (function sendTimeZone() {
|
|
2069
2216
|
sendMessage({ type: "timeZone", timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
|
|
2070
|
-
})()),
|
|
2217
|
+
})()), g && document.addEventListener("visibilitychange", handleVisibilityChange), f && (window.addEventListener("beforeunload", () => {
|
|
2071
2218
|
clearPageVisitDataFromSessionStorage();
|
|
2072
|
-
}))
|
|
2219
|
+
}), window.addEventListener("online", () => {
|
|
2220
|
+
requestTimeSync();
|
|
2221
|
+
})));
|
|
2073
2222
|
}
|
|
2074
2223
|
function matchParsedUrlAgainstPatterns(e2, t2) {
|
|
2075
|
-
const { hostname: n2, pathname: i2, port: o2 } = e2,
|
|
2224
|
+
const { hostname: n2, pathname: i2, port: o2 } = e2, s2 = n2.startsWith("www.") ? n2.slice(4).toLowerCase() : n2.toLowerCase();
|
|
2076
2225
|
return t2.some((e3) => {
|
|
2077
2226
|
const t3 = String(e3 || "").replace(/^[a-zA-Z]+:\/\//, "");
|
|
2078
|
-
let [n3,
|
|
2079
|
-
n3.includes(":") && ([n3,
|
|
2080
|
-
const l2 = getCachedRegex(`^${n3.replace(/\./g, "\\.").replace(/\*/g, ".*")}$`, "i"), c2 =
|
|
2081
|
-
if (
|
|
2227
|
+
let [n3, r2] = t3.split("/", 2), a2 = "";
|
|
2228
|
+
n3.includes(":") && ([n3, a2] = n3.split(":"));
|
|
2229
|
+
const l2 = getCachedRegex(`^${n3.replace(/\./g, "\\.").replace(/\*/g, ".*")}$`, "i"), c2 = s2.startsWith("www.") ? s2.slice(4) : s2;
|
|
2230
|
+
if (a2 && "*" !== a2 && o2 !== a2) return false;
|
|
2082
2231
|
if (n3.startsWith("*.")) {
|
|
2083
2232
|
const e4 = n3.slice(2).toLowerCase();
|
|
2084
|
-
if (!(
|
|
2085
|
-
if (
|
|
2086
|
-
return getCachedRegex(`^/${
|
|
2233
|
+
if (!(s2 === e4 || c2 === e4 || s2.endsWith("." + e4))) return false;
|
|
2234
|
+
if (r2) {
|
|
2235
|
+
return getCachedRegex(`^/${r2.replace(/\*/g, ".*").replace(/\/$/, "")}`, "i").test(i2);
|
|
2087
2236
|
}
|
|
2088
2237
|
return true;
|
|
2089
2238
|
}
|
|
2090
|
-
if (!l2.test(c2) && !l2.test(
|
|
2091
|
-
if (
|
|
2092
|
-
return getCachedRegex(`^/${
|
|
2239
|
+
if (!l2.test(c2) && !l2.test(s2)) return false;
|
|
2240
|
+
if (r2) {
|
|
2241
|
+
return getCachedRegex(`^/${r2.replace(/\*/g, ".*").replace(/\/$/, "")}`, "i").test(i2);
|
|
2093
2242
|
}
|
|
2094
2243
|
return true;
|
|
2095
2244
|
});
|
|
2096
2245
|
}
|
|
2246
|
+
function toAbsoluteUrl(e2) {
|
|
2247
|
+
if ("string" != typeof e2 || 0 === e2.length) return e2;
|
|
2248
|
+
try {
|
|
2249
|
+
const t2 = "undefined" != typeof window ? window.location.href : "http://localhost/";
|
|
2250
|
+
return new URL(e2, t2).href;
|
|
2251
|
+
} catch {
|
|
2252
|
+
return e2;
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2097
2255
|
function matchUrlWithWildcard(e2, t2) {
|
|
2098
2256
|
let n2, i2;
|
|
2099
2257
|
if ("string" == typeof e2 ? n2 = e2 : "undefined" != typeof URL && e2 instanceof URL ? n2 = e2.href : "undefined" != typeof Request && e2 instanceof Request ? n2 = e2.url : null != e2 && "function" == typeof e2.toString && (n2 = e2.toString()), !n2) return false;
|
|
@@ -2106,7 +2264,7 @@ function matchUrlWithWildcard(e2, t2) {
|
|
|
2106
2264
|
return matchParsedUrlAgainstPatterns(i2, t2);
|
|
2107
2265
|
}
|
|
2108
2266
|
function createSkipHeadersPropagationChecker(e2 = [], t2 = []) {
|
|
2109
|
-
const n2 = [...
|
|
2267
|
+
const n2 = [...Ae, ...e2], i2 = t2.length > 0;
|
|
2110
2268
|
return function shouldSkipHeadersPropagation(e3) {
|
|
2111
2269
|
let o2;
|
|
2112
2270
|
try {
|
|
@@ -2114,12 +2272,12 @@ function createSkipHeadersPropagationChecker(e2 = [], t2 = []) {
|
|
|
2114
2272
|
} catch {
|
|
2115
2273
|
return true;
|
|
2116
2274
|
}
|
|
2117
|
-
const
|
|
2118
|
-
return !(-1 ===
|
|
2275
|
+
const s2 = o2.pathname.toLowerCase(), r2 = s2.lastIndexOf(".");
|
|
2276
|
+
return !(-1 === r2 || !Fe.has(s2.slice(r2))) || (!(!i2 || matchParsedUrlAgainstPatterns(o2, t2)) || !!matchParsedUrlAgainstPatterns(o2, n2));
|
|
2119
2277
|
};
|
|
2120
2278
|
}
|
|
2121
2279
|
function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }, i2 = []) {
|
|
2122
|
-
const o2 = window.fetch,
|
|
2280
|
+
const o2 = window.fetch, s2 = getOrSetSessionId(), r2 = createSkipHeadersPropagationChecker(e2, i2), a2 = ["text/event-stream", "application/x-ndjson", "application/stream+json", "application/grpc", "application/grpc-web"], l2 = ["application/octet-stream"];
|
|
2123
2281
|
window.fetch = new Proxy(o2, { apply: async (e3, i3, o3) => {
|
|
2124
2282
|
let c2, d2 = o3[0], u2 = o3[1] || {};
|
|
2125
2283
|
if ("string" == typeof d2) c2 = d2;
|
|
@@ -2128,113 +2286,115 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
|
|
|
2128
2286
|
if (!(d2 instanceof URL)) return e3.apply(i3, o3);
|
|
2129
2287
|
c2 = d2.href;
|
|
2130
2288
|
}
|
|
2131
|
-
return
|
|
2289
|
+
return r2(c2) ? e3.apply(i3, o3) : (async function injectHeaderWrapper(e4, i4, o4, s3, r3, c3, d3) {
|
|
2132
2290
|
var _a, _b;
|
|
2133
2291
|
if (!c3) return e4.apply(i4, o4);
|
|
2134
2292
|
let u3 = uuidv4();
|
|
2135
|
-
const p2 = getUrlAndStoredUuids(), f2 =
|
|
2293
|
+
const p2 = getUrlAndStoredUuids(), f2 = r3.method || "GET", g2 = Date.now();
|
|
2136
2294
|
let m2, h2 = {}, y2 = null;
|
|
2137
2295
|
try {
|
|
2138
|
-
if (
|
|
2139
|
-
|
|
2296
|
+
if (s3 instanceof Request) {
|
|
2297
|
+
s3.headers.forEach((e5, t3) => {
|
|
2140
2298
|
h2[t3] = e5;
|
|
2141
2299
|
});
|
|
2142
2300
|
try {
|
|
2143
|
-
y2 =
|
|
2301
|
+
y2 = s3.clone();
|
|
2144
2302
|
} catch (e5) {
|
|
2145
2303
|
y2 = null;
|
|
2146
2304
|
}
|
|
2147
|
-
} else
|
|
2305
|
+
} else r3.headers && (r3.headers instanceof Headers ? r3.headers.forEach((e5, t3) => {
|
|
2148
2306
|
h2[t3] = e5;
|
|
2149
|
-
}) : Array.isArray(
|
|
2307
|
+
}) : Array.isArray(r3.headers) ? r3.headers.forEach(([e5, t3]) => {
|
|
2150
2308
|
h2[e5] = t3;
|
|
2151
|
-
}) : h2 = { ...
|
|
2309
|
+
}) : h2 = { ...r3.headers }), m2 = r3.body;
|
|
2152
2310
|
} catch (e5) {
|
|
2153
|
-
|
|
2311
|
+
Ce && console.warn("[Sailfish] Failed to capture request data:", e5);
|
|
2154
2312
|
}
|
|
2155
2313
|
delete h2[n];
|
|
2156
|
-
const
|
|
2157
|
-
|
|
2158
|
-
const
|
|
2159
|
-
h2[n] =
|
|
2314
|
+
const S2 = getFuncSpanHeader();
|
|
2315
|
+
S2 && delete h2[S2.name];
|
|
2316
|
+
const b2 = `${c3}/${p2.page_visit_uuid}/${u3}`;
|
|
2317
|
+
h2[n] = b2, S2 && (h2[S2.name] = S2.value);
|
|
2160
2318
|
maskAuthorizationHeader(h2);
|
|
2161
2319
|
try {
|
|
2162
|
-
let
|
|
2320
|
+
let S3 = await (async function injectHeader(e5, t3, i5, o5, s4, r4, a3) {
|
|
2163
2321
|
const l3 = getFuncSpanHeader();
|
|
2164
2322
|
if (i5 instanceof Request) {
|
|
2165
2323
|
const c4 = i5.clone(), d4 = new Headers(c4.headers);
|
|
2166
|
-
d4.set(n, `${
|
|
2324
|
+
d4.set(n, `${s4}/${r4}/${a3}`), l3 && (d4.set(l3.name, l3.value), Ce && console.log("[Sailfish] Added funcspan header to HTTP Request:", { url: i5.url, header: l3.name }));
|
|
2167
2325
|
const u4 = new Request(c4, { headers: d4 });
|
|
2168
2326
|
return await e5.call(t3, u4, o5);
|
|
2169
2327
|
}
|
|
2170
2328
|
{
|
|
2171
2329
|
const c4 = { ...o5 }, d4 = new Headers(o5.headers || {});
|
|
2172
|
-
return d4.set(n, `${
|
|
2330
|
+
return d4.set(n, `${s4}/${r4}/${a3}`), l3 && (d4.set(l3.name, l3.value), Ce && console.log("[Sailfish] Added funcspan header to HTTP fetch:", { url: "string" == typeof i5 ? i5 : i5.href, header: l3.name })), c4.headers = d4, await e5.call(t3, i5, c4);
|
|
2173
2331
|
}
|
|
2174
|
-
})(e4, i4,
|
|
2175
|
-
|
|
2332
|
+
})(e4, i4, s3, r3, c3, p2.page_visit_uuid, u3), b3 = false;
|
|
2333
|
+
Le.includes(S3.status) && (Ce && console.log("Perform retry as status was fail:", S3), delete h2[n], S3 = await (async function retryWithoutPropagateHeaders(e5, t3, i5, o5) {
|
|
2176
2334
|
try {
|
|
2177
|
-
let o6 = i5[0],
|
|
2335
|
+
let o6 = i5[0], s4 = i5[1] || {};
|
|
2178
2336
|
if ("string" == typeof o6 || o6 instanceof URL) {
|
|
2179
|
-
const i6 = { ...
|
|
2180
|
-
|
|
2337
|
+
const i6 = { ...s4 }, r4 = new Headers(s4.headers || {});
|
|
2338
|
+
r4.delete(n), i6.headers = r4;
|
|
2181
2339
|
return await e5.call(t3, o6, i6);
|
|
2182
2340
|
}
|
|
2183
2341
|
if (o6 instanceof Request) {
|
|
2184
|
-
const i6 = o6.clone(),
|
|
2185
|
-
|
|
2186
|
-
const
|
|
2187
|
-
return await e5.call(t3,
|
|
2342
|
+
const i6 = o6.clone(), r4 = new Headers(i6.headers);
|
|
2343
|
+
r4.delete(n);
|
|
2344
|
+
const a3 = new Request(i6, { headers: r4 });
|
|
2345
|
+
return await e5.call(t3, a3, s4);
|
|
2188
2346
|
}
|
|
2189
2347
|
return e5.apply(t3, i5);
|
|
2190
2348
|
} catch (e6) {
|
|
2191
|
-
throw
|
|
2349
|
+
throw Ce && console.log(`Retry without ${n} for ${o5} also failed:`, e6), e6;
|
|
2192
2350
|
}
|
|
2193
|
-
})(e4, i4, o4, d3),
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2351
|
+
})(e4, i4, o4, d3), b3 = true);
|
|
2352
|
+
const v2 = Date.now(), w2 = (function captureClientTime() {
|
|
2353
|
+
return { wallTimeMs: Date.now(), monotonicMs: monotonicNow(), timeOriginMs: timeOriginMs() };
|
|
2354
|
+
})(), k2 = S3.status, x2 = S3.ok, I2 = x2 ? "" : `Request Error: ${S3.statusText}`;
|
|
2355
|
+
let T2 = null;
|
|
2196
2356
|
try {
|
|
2197
|
-
|
|
2198
|
-
|
|
2357
|
+
T2 = {}, S3.headers.forEach((e5, t3) => {
|
|
2358
|
+
T2[t3] = e5;
|
|
2199
2359
|
});
|
|
2200
2360
|
} catch (e5) {
|
|
2201
|
-
|
|
2361
|
+
Ce && console.warn("[Sailfish] Failed to capture response headers:", e5), T2 = null;
|
|
2202
2362
|
}
|
|
2203
|
-
const
|
|
2204
|
-
|
|
2205
|
-
|
|
2363
|
+
const E2 = { type: 27, timestamp: v2, sessionId: c3, client: w2, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: v2, response_code: k2, success: x2, error: I2, method: f2, url: toAbsoluteUrl(d3), retry_without_trace_id: b3, request_headers: h2, request_body: m2, response_headers: T2, response_body: null }, ...p2 }, sendEventWithBody = (e5) => {
|
|
2364
|
+
E2.data.response_body = e5, y2 ? y2.text().then((e6) => {
|
|
2365
|
+
E2.data.request_body = e6, sendEvent(E2);
|
|
2206
2366
|
}, () => {
|
|
2207
|
-
sendEvent(
|
|
2208
|
-
}) : sendEvent(
|
|
2209
|
-
},
|
|
2367
|
+
sendEvent(E2);
|
|
2368
|
+
}) : sendEvent(E2);
|
|
2369
|
+
}, M2 = 1024 * t2.captureResponseBodyMaxMb * 1024;
|
|
2210
2370
|
if (0 === t2.captureResponseBodyMaxMb) sendEventWithBody(null);
|
|
2211
2371
|
else if ((function shouldSkipBodyCapture(e5) {
|
|
2212
2372
|
const t3 = e5.headers.get("content-type");
|
|
2213
2373
|
if (!t3) return false;
|
|
2214
2374
|
const n2 = t3.toLowerCase();
|
|
2215
2375
|
return l2.some((e6) => n2.includes(e6));
|
|
2216
|
-
})(
|
|
2376
|
+
})(S3)) sendEventWithBody(null);
|
|
2217
2377
|
else if ((function isStreamingResponse(e5) {
|
|
2218
2378
|
const t3 = e5.headers.get("content-type");
|
|
2219
2379
|
if (!t3) return false;
|
|
2220
2380
|
const n2 = t3.toLowerCase();
|
|
2221
|
-
return
|
|
2222
|
-
})(
|
|
2381
|
+
return a2.some((e6) => n2.includes(e6));
|
|
2382
|
+
})(S3)) if (t2.captureStreamingResponseBody) try {
|
|
2223
2383
|
(async function readStreamPrefix(e5, t3, n2) {
|
|
2224
2384
|
const i5 = e5.body;
|
|
2225
2385
|
if (!i5) return null;
|
|
2226
|
-
const o5 = i5.getReader(),
|
|
2227
|
-
let
|
|
2386
|
+
const o5 = i5.getReader(), s4 = new TextDecoder(), r4 = [];
|
|
2387
|
+
let a3 = 0;
|
|
2228
2388
|
const readWithLimit = async () => {
|
|
2229
2389
|
try {
|
|
2230
|
-
for (;
|
|
2390
|
+
for (; a3 < t3; ) {
|
|
2231
2391
|
const { done: e6, value: t4 } = await o5.read();
|
|
2232
2392
|
if (e6) break;
|
|
2233
|
-
|
|
2393
|
+
a3 += t4.byteLength, r4.push(s4.decode(t4, { stream: true }));
|
|
2234
2394
|
}
|
|
2235
|
-
return
|
|
2395
|
+
return r4.push(s4.decode()), r4.join("");
|
|
2236
2396
|
} catch {
|
|
2237
|
-
return
|
|
2397
|
+
return r4.length > 0 ? r4.join("") : null;
|
|
2238
2398
|
} finally {
|
|
2239
2399
|
try {
|
|
2240
2400
|
o5.cancel();
|
|
@@ -2248,7 +2408,7 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
|
|
|
2248
2408
|
o5.cancel();
|
|
2249
2409
|
} catch {
|
|
2250
2410
|
}
|
|
2251
|
-
e6(
|
|
2411
|
+
e6(r4.length > 0 ? r4.join("") : null);
|
|
2252
2412
|
}, n2))]);
|
|
2253
2413
|
} catch {
|
|
2254
2414
|
try {
|
|
@@ -2257,40 +2417,40 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
|
|
|
2257
2417
|
}
|
|
2258
2418
|
return null;
|
|
2259
2419
|
}
|
|
2260
|
-
})(
|
|
2420
|
+
})(S3.clone(), 1024 * t2.captureStreamPrefixKb, t2.captureStreamTimeoutMs).then((e5) => sendEventWithBody(e5), () => sendEventWithBody(null));
|
|
2261
2421
|
} catch {
|
|
2262
2422
|
sendEventWithBody(null);
|
|
2263
2423
|
}
|
|
2264
2424
|
else sendEventWithBody(null);
|
|
2265
2425
|
else {
|
|
2266
|
-
const e5 =
|
|
2267
|
-
if (!isNaN(t3) && t3 >
|
|
2426
|
+
const e5 = S3.headers.get("content-length"), t3 = e5 ? parseInt(e5, 10) : NaN;
|
|
2427
|
+
if (!isNaN(t3) && t3 > M2) sendEventWithBody(null);
|
|
2268
2428
|
else try {
|
|
2269
|
-
|
|
2270
|
-
e6.length >
|
|
2429
|
+
S3.clone().text().then((e6) => {
|
|
2430
|
+
e6.length > M2 ? sendEventWithBody(null) : sendEventWithBody(e6);
|
|
2271
2431
|
}, () => sendEventWithBody(null));
|
|
2272
2432
|
} catch {
|
|
2273
2433
|
sendEventWithBody(null);
|
|
2274
2434
|
}
|
|
2275
2435
|
}
|
|
2276
|
-
return
|
|
2436
|
+
return S3;
|
|
2277
2437
|
} catch (t3) {
|
|
2278
|
-
const n2 = Date.now(),
|
|
2279
|
-
if (t3 instanceof TypeError && ((_b = t3 == null ? void 0 : t3.message) == null ? void 0 : _b.toLowerCase().includes(
|
|
2438
|
+
const n2 = Date.now(), s4 = false, r4 = ((_a = t3.response) == null ? void 0 : _a.status) || 500, a3 = t3.message || "Fetch request failed";
|
|
2439
|
+
if (t3 instanceof TypeError && ((_b = t3 == null ? void 0 : t3.message) == null ? void 0 : _b.toLowerCase().includes(Re.toLowerCase()))) return e4.apply(i4, o4);
|
|
2280
2440
|
let l3 = m2;
|
|
2281
2441
|
if (y2) try {
|
|
2282
2442
|
l3 = await y2.text();
|
|
2283
2443
|
} catch {
|
|
2284
2444
|
l3 = null;
|
|
2285
2445
|
}
|
|
2286
|
-
throw sendEvent({ type: 27, timestamp: n2, sessionId: c3, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: n2, response_code:
|
|
2446
|
+
throw sendEvent({ type: 27, timestamp: n2, sessionId: c3, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: n2, response_code: r4, success: s4, error: a3, method: f2, url: toAbsoluteUrl(d3), request_headers: h2, request_body: l3, response_body: null }, ...p2 }), t3;
|
|
2287
2447
|
}
|
|
2288
|
-
})(e3, i3, o3, d2, u2,
|
|
2448
|
+
})(e3, i3, o3, d2, u2, s2, c2);
|
|
2289
2449
|
} });
|
|
2290
2450
|
}
|
|
2291
|
-
async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo: i2 = ["*"], domainsToNotPropagateHeaderTo: o2 = [], serviceVersion:
|
|
2451
|
+
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: m2, deferRecordingStart: y2, chunkSnapshot: S2, useWsWorker: b2 = true, capturePerformanceMetrics: v2 = true, maskTextClass: w2, maskInputSelector: k2, maskTextSelector: x2, blockSelector: I2, unmaskSelector: T2, maskInputOptions: E2, library: M2, headlessRecording: C2 = false }) {
|
|
2292
2452
|
var _a, _b;
|
|
2293
|
-
if (!
|
|
2453
|
+
if (!C2 && (function isHeadlessOrLighthouse() {
|
|
2294
2454
|
try {
|
|
2295
2455
|
if ("undefined" == typeof navigator) return false;
|
|
2296
2456
|
const e3 = navigator;
|
|
@@ -2301,20 +2461,20 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2301
2461
|
return false;
|
|
2302
2462
|
}
|
|
2303
2463
|
})()) return;
|
|
2304
|
-
const
|
|
2305
|
-
if (
|
|
2306
|
-
const
|
|
2307
|
-
sessionStorage.getItem("pageVisitUUID") || (sessionStorage.setItem("pageVisitUUID", uuidv4()), invalidateUrlCache()),
|
|
2308
|
-
const o3 = XMLHttpRequest.prototype.open,
|
|
2464
|
+
const $2 = m2 ?? y2 ?? true, F2 = getOrSetSessionId(), A2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
|
|
2465
|
+
if (A2.sessionId = F2, A2.apiKey = e2, A2.backendApi = t2, A2.serviceAdditionalMetadata = l2, A2.initialized && A2.sessionId === F2 && A2.ws && 1 === A2.ws.readyState) return void trackDomainChangesOnce();
|
|
2466
|
+
const L2 = { captureStreamingResponseBody: d2, captureResponseBodyMaxMb: u2, captureStreamPrefixKb: p2, captureStreamTimeoutMs: f2 };
|
|
2467
|
+
sessionStorage.getItem("pageVisitUUID") || (sessionStorage.setItem("pageVisitUUID", uuidv4()), invalidateUrlCache()), A2.xhrPatched || (!(function setupXMLHttpRequestInterceptor(e3 = [], t3 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }, i3 = []) {
|
|
2468
|
+
const o3 = XMLHttpRequest.prototype.open, s3 = XMLHttpRequest.prototype.send, r3 = XMLHttpRequest.prototype.setRequestHeader, a3 = getOrSetSessionId(), l3 = createSkipHeadersPropagationChecker(e3, i3);
|
|
2309
2469
|
XMLHttpRequest.prototype.setRequestHeader = function(e4, t4) {
|
|
2310
|
-
return this._capturedRequestHeaders || (this._capturedRequestHeaders = {}), this._capturedRequestHeaders[e4] = t4,
|
|
2470
|
+
return this._capturedRequestHeaders || (this._capturedRequestHeaders = {}), this._capturedRequestHeaders[e4] = t4, r3.call(this, e4, t4);
|
|
2311
2471
|
}, XMLHttpRequest.prototype.open = function(e4, t4, ...n2) {
|
|
2312
2472
|
return this._requestUrl = "string" == typeof t4 && t4.length > 0 ? t4 : null, this._requestMethod = e4, this._capturedRequestHeaders = {}, o3.apply(this, [e4, t4, ...n2]);
|
|
2313
2473
|
}, XMLHttpRequest.prototype.send = function(...e4) {
|
|
2314
2474
|
const i4 = this._requestUrl;
|
|
2315
|
-
if (!i4) return
|
|
2316
|
-
if (l3(i4)) return
|
|
2317
|
-
const o4 = sessionStorage.getItem("pageVisitUUID"),
|
|
2475
|
+
if (!i4) return s3.apply(this, e4);
|
|
2476
|
+
if (l3(i4)) return s3.apply(this, e4);
|
|
2477
|
+
const o4 = sessionStorage.getItem("pageVisitUUID"), r4 = uuidv4(), c3 = `${a3}/${o4}/${r4}`;
|
|
2318
2478
|
try {
|
|
2319
2479
|
this.setRequestHeader(n, c3);
|
|
2320
2480
|
} catch (e5) {
|
|
@@ -2322,19 +2482,19 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2322
2482
|
}
|
|
2323
2483
|
const d3 = getFuncSpanHeader();
|
|
2324
2484
|
if (d3) try {
|
|
2325
|
-
this.setRequestHeader(d3.name, d3.value),
|
|
2485
|
+
this.setRequestHeader(d3.name, d3.value), Ce && console.log("[Sailfish] Added funcspan header to XMLHttpRequest:", { url: i4, header: d3.name });
|
|
2326
2486
|
} catch (e5) {
|
|
2327
|
-
|
|
2487
|
+
Ce && console.warn(`[Sailfish] Could not set funcspan header for ${i4}`, e5);
|
|
2328
2488
|
}
|
|
2329
2489
|
const u3 = Date.now();
|
|
2330
2490
|
let p3 = false;
|
|
2331
|
-
const f3 = e4[0],
|
|
2332
|
-
maskAuthorizationHeader(
|
|
2333
|
-
const emitFinished = (e5, t4, n2, o5,
|
|
2491
|
+
const f3 = e4[0], g3 = { ...this._capturedRequestHeaders };
|
|
2492
|
+
maskAuthorizationHeader(g3);
|
|
2493
|
+
const emitFinished = (e5, t4, n2, o5, s4) => {
|
|
2334
2494
|
if (p3) return;
|
|
2335
2495
|
p3 = true;
|
|
2336
2496
|
const l4 = Date.now();
|
|
2337
|
-
sendEvent({ type: 27, timestamp: l4, sessionId:
|
|
2497
|
+
sendEvent({ type: 27, timestamp: l4, sessionId: a3, data: { request_id: r4, session_id: a3, timestamp_start: u3, timestamp_end: l4, response_code: t4, success: e5, error: n2, method: this._requestMethod, url: toAbsoluteUrl(i4), request_headers: g3, request_body: f3, response_headers: s4, response_body: o5 }, ...getUrlAndStoredUuids() });
|
|
2338
2498
|
};
|
|
2339
2499
|
return this.addEventListener("load", () => {
|
|
2340
2500
|
const e5 = this.status || 0;
|
|
@@ -2357,7 +2517,7 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2357
2517
|
2 === t4.length && (i5[t4[0]] = t4[1]);
|
|
2358
2518
|
});
|
|
2359
2519
|
} catch (e6) {
|
|
2360
|
-
|
|
2520
|
+
Ce && console.warn("[Sailfish] Failed to capture XHR response headers:", e6), i5 = null;
|
|
2361
2521
|
}
|
|
2362
2522
|
if (e5 >= 200 && e5 < 300) emitFinished(true, e5, "", n2, i5);
|
|
2363
2523
|
else {
|
|
@@ -2367,26 +2527,26 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2367
2527
|
}, { once: true }), this.addEventListener("error", () => {
|
|
2368
2528
|
const e5 = this.status || 0, t4 = 0 === e5 ? "Network or CORS failure" : this.statusText || `Error ${e5}`;
|
|
2369
2529
|
emitFinished(false, e5, t4);
|
|
2370
|
-
}, { once: true }),
|
|
2530
|
+
}, { once: true }), s3.apply(this, e4);
|
|
2371
2531
|
};
|
|
2372
|
-
})(o2,
|
|
2532
|
+
})(o2, L2, i2), A2.xhrPatched = true), A2.fetchPatched || (setupFetchInterceptor(o2, L2, i2), A2.fetchPatched = true), await yieldToMain(), A2.domEventsInit || (initializeDomContentEvents(F2), A2.domEventsInit = true), await yieldToMain(), A2.consoleInit || (initializeConsolePlugin(Oe, F2), A2.consoleInit = true), await yieldToMain(), A2.errorInit || (!(function initializeErrorInterceptor() {
|
|
2373
2533
|
window.addEventListener("error", (e3) => {
|
|
2374
2534
|
captureError(e3.error ?? e3.message, false, { filename: e3.filename, lineno: e3.lineno, colno: e3.colno });
|
|
2375
2535
|
}), window.addEventListener("unhandledrejection", (e3) => {
|
|
2376
2536
|
captureError(e3.reason, true);
|
|
2377
2537
|
});
|
|
2378
|
-
})(),
|
|
2379
|
-
|
|
2380
|
-
})({ apiKey: e2, backendApi: t2 }), !isFunctionSpanTrackingEnabled() ||
|
|
2538
|
+
})(), A2.errorInit = true), await yieldToMain(), !A2.perfInit && v2 && (initializePerformancePlugin(F2), A2.perfInit = true), await yieldToMain(), _ensureModuleSideEffects(), (function storeCredentialsAndConnection({ apiKey: e3, backendApi: t3 }) {
|
|
2539
|
+
h && (sessionStorage.setItem("sailfishApiKey", e3), sessionStorage.setItem("sailfishBackendApi", t3));
|
|
2540
|
+
})({ apiKey: e2, backendApi: t2 }), !isFunctionSpanTrackingEnabled() || A2.ws && 1 === A2.ws.readyState || fetchFunctionSpanTrackingEnabled(e2, t2).then((e3) => {
|
|
2381
2541
|
var _a2;
|
|
2382
|
-
((_a2 = e3.data) == null ? void 0 : _a2.isFunctionSpanTrackingEnabledFromApiKey) ?? false ?
|
|
2542
|
+
((_a2 = e3.data) == null ? void 0 : _a2.isFunctionSpanTrackingEnabledFromApiKey) ?? false ? Ce && console.log("[Sailfish] Function span tracking state validated with backend: ACTIVE") : (clearStaleFuncSpanState(), Ce && console.log("[Sailfish] Cleared stale function span tracking state - backend validation shows tracking is not active"));
|
|
2383
2543
|
}).catch((e3) => {
|
|
2384
|
-
|
|
2385
|
-
}),
|
|
2544
|
+
Ce && console.warn("[Sailfish] Failed to validate function span tracking status with backend:", e3);
|
|
2545
|
+
}), A2.sentDoNotPropagateOnce || (sendDomainsToNotPropagateHeaderTo(e2, [...o2, ...Ae], t2).catch((e3) => console.error("Failed to send domains to not propagate header to:", e3)), A2.sentDoNotPropagateOnce = true), (async function gatherAndCacheDeviceInfo() {
|
|
2386
2546
|
sendMessage({ type: "deviceInfo", data: { deviceInfo: { language: navigator.language, userAgent: navigator.userAgent } } });
|
|
2387
|
-
})(), c2 && fetchAndSendIp(
|
|
2547
|
+
})(), c2 && fetchAndSendIp(F2);
|
|
2388
2548
|
try {
|
|
2389
|
-
const n2 =
|
|
2549
|
+
const n2 = a2 ?? (function readGitSha() {
|
|
2390
2550
|
var _a2;
|
|
2391
2551
|
try {
|
|
2392
2552
|
const e3 = globalThis;
|
|
@@ -2403,7 +2563,7 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2403
2563
|
if ("string" == typeof e3 && e3) return e3;
|
|
2404
2564
|
} catch {
|
|
2405
2565
|
}
|
|
2406
|
-
})(), i3 =
|
|
2566
|
+
})(), i3 = r2 ?? "", o3 = s2 ?? "", c3 = M2 ?? "JS/TS", d3 = (function getMapUuidFromWindow() {
|
|
2407
2567
|
try {
|
|
2408
2568
|
const e3 = window;
|
|
2409
2569
|
if (e3 && "string" == typeof e3.sfMapUuid && e3.sfMapUuid) return e3.sfMapUuid;
|
|
@@ -2416,41 +2576,43 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
|
|
|
2416
2576
|
} catch {
|
|
2417
2577
|
}
|
|
2418
2578
|
const n3 = t3, i4 = [];
|
|
2419
|
-
for (const e4 of
|
|
2579
|
+
for (const e4 of de) {
|
|
2420
2580
|
const t4 = e4(n3);
|
|
2421
2581
|
t4 && !i4.includes(t4) && i4.push(t4);
|
|
2422
2582
|
}
|
|
2423
2583
|
return { framework: i4[0] ?? null, additionalFrameworks: i4.slice(1), serviceRole: "frontend" };
|
|
2424
2584
|
})(), f3 = { ...u3, serviceRole: p3.serviceRole, ...null !== p3.framework && { framework: p3.framework }, ...p3.additionalFrameworks.length > 0 && { additionalFrameworks: p3.additionalFrameworks } };
|
|
2425
2585
|
await yieldToMain();
|
|
2426
|
-
const [
|
|
2427
|
-
if (
|
|
2428
|
-
if ((_b =
|
|
2586
|
+
const [m3, h2] = await Promise.all([fetchCaptureSettings(e2, t2), startRecordingSession(e2, F2, t2, i3, o3, d3, n2, c3, f3)]), y3 = { ...Be, ...(_a = m3.data) == null ? void 0 : _a.captureSettingsFromApiKey, enableFiberTracking: g2, ...void 0 !== w2 ? { maskTextClass: w2 } : {}, ...void 0 !== k2 ? { maskInputSelector: k2 } : {}, ...void 0 !== x2 ? { maskTextSelector: x2 } : {}, ...void 0 !== I2 ? { blockSelector: I2 } : {}, ...void 0 !== T2 ? { unmaskSelector: T2 } : {}, ...void 0 !== E2 ? { maskInputOptions: E2 } : {} };
|
|
2587
|
+
if (A2.ws && 1 === A2.ws.readyState) return;
|
|
2588
|
+
if ((_b = h2.data) == null ? void 0 : _b.startRecordingSession) {
|
|
2429
2589
|
const n3 = (l2 == null ? void 0 : l2.env) || (l2 == null ? void 0 : l2.environment);
|
|
2430
2590
|
await yieldToMain();
|
|
2431
|
-
const i4 = await initializeRecording(y3, t2, e2,
|
|
2432
|
-
|
|
2591
|
+
const i4 = await initializeRecording(y3, t2, e2, F2, n3, $2, b2, S2 ?? false);
|
|
2592
|
+
A2.ws = i4, A2.initialized = true, trackDomainChangesOnce(), A2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e3 = "", t3 = "") {
|
|
2433
2593
|
window.sfMapUuid && sendMessage({ type: "mapUuid", data: { mapUuid: window.sfMapUuid, serviceIdentifier: e3, serviceVersion: t3 } });
|
|
2434
|
-
})(
|
|
2435
|
-
} else console.error("Failed to start recording session:",
|
|
2594
|
+
})(r2, s2), A2.sentMapUuidOnce = true);
|
|
2595
|
+
} else console.error("Failed to start recording session:", h2.errors || h2);
|
|
2436
2596
|
} catch (e3) {
|
|
2437
2597
|
console.error("Error starting recording:", e3);
|
|
2438
2598
|
}
|
|
2439
2599
|
}
|
|
2440
2600
|
const initRecorder = async (e2) => {
|
|
2441
2601
|
if ("undefined" == typeof window) return;
|
|
2442
|
-
const t2 = window.__sailfish_recorder || (window.__sailfish_recorder = {})
|
|
2602
|
+
const t2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
|
|
2603
|
+
t2.internalDebugLogs = true === e2.enableInternalDebugLogs;
|
|
2604
|
+
const n2 = getOrSetSessionId();
|
|
2443
2605
|
return clearPageVisitDataFromSessionStorage(), t2.initialized && t2.sessionId === n2 && t2.ws && 1 === t2.ws.readyState ? void 0 : (t2.initPromise || (t2.initPromise = (async () => {
|
|
2444
2606
|
try {
|
|
2445
2607
|
if (t2.hasLoggedInitOnce || (console.log("Initializing Sailfish Recorder (first run) …"), t2.hasLoggedInitOnce = true), await startRecording(e2), !t2.issueReportingInit) {
|
|
2446
|
-
const n3 = e2.backendApi ?? "https://api-service.sailfishqa.com", [{ setupIssueReporting: i2 }, { fetchIntegrationData: o2, getIntegrationData:
|
|
2447
|
-
let
|
|
2608
|
+
const n3 = e2.backendApi ?? "https://api-service.sailfishqa.com", [{ setupIssueReporting: i2 }, { fetchIntegrationData: o2, getIntegrationData: s2 }] = await Promise.all([Promise.resolve().then(() => Me), Promise.resolve().then(() => ke)]);
|
|
2609
|
+
let r2 = null;
|
|
2448
2610
|
try {
|
|
2449
|
-
await o2(e2.apiKey, n3),
|
|
2611
|
+
await o2(e2.apiKey, n3), r2 = s2();
|
|
2450
2612
|
} catch (e3) {
|
|
2451
2613
|
console.warn("[Sailfish] Failed to fetch integration data for issue reporting:", e3);
|
|
2452
2614
|
}
|
|
2453
|
-
i2({ apiKey: e2.apiKey, backendApi: n3, getSessionId: () => getOrSetSessionId(), shortcuts: e2.reportIssueShortcuts, customBaseUrl: e2.customBaseUrl, integrationData:
|
|
2615
|
+
i2({ apiKey: e2.apiKey, backendApi: n3, getSessionId: () => getOrSetSessionId(), shortcuts: e2.reportIssueShortcuts, customBaseUrl: e2.customBaseUrl, integrationData: r2, showEngTicketFieldsInReportIssueModalDefault: e2.showEngTicketFieldsInReportIssueModalDefault }), t2.issueReportingInit = true;
|
|
2454
2616
|
}
|
|
2455
2617
|
} catch (e3) {
|
|
2456
2618
|
console.warn("[Sailfish] Recorder initialization failed:", e3);
|
|
@@ -2460,29 +2622,32 @@ const initRecorder = async (e2) => {
|
|
|
2460
2622
|
})), t2.initPromise);
|
|
2461
2623
|
};
|
|
2462
2624
|
export {
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2625
|
+
initializeDomContentEvents as A,
|
|
2626
|
+
initializeFunctionSpanTrackingFromApi as B,
|
|
2627
|
+
initializePerformancePlugin as C,
|
|
2628
|
+
Be as D,
|
|
2629
|
+
initializeRecording as E,
|
|
2630
|
+
initializeWebSocket as F,
|
|
2631
|
+
invalidateUrlCache as G,
|
|
2632
|
+
isFunctionSpanTrackingEnabled as H,
|
|
2633
|
+
maskInputFn as I,
|
|
2634
|
+
matchUrlWithWildcard as J,
|
|
2635
|
+
w as K,
|
|
2636
|
+
onNavigationChange as L,
|
|
2637
|
+
openReportIssueModal as M,
|
|
2638
|
+
requestTimeSync as N,
|
|
2639
|
+
restoreFuncSpanState as O,
|
|
2640
|
+
sendDomainsToNotPropagateHeaderTo as P,
|
|
2641
|
+
sendEvent as Q,
|
|
2642
|
+
sendGraphQLRequest as R,
|
|
2643
|
+
De as S,
|
|
2644
|
+
sendMessage as T,
|
|
2645
|
+
startRecording as U,
|
|
2646
|
+
startRecordingSession as V,
|
|
2647
|
+
toAbsoluteUrl as W,
|
|
2648
|
+
trackingEvent as X,
|
|
2649
|
+
withAppUrlMetadata as Y,
|
|
2650
|
+
Oe as a,
|
|
2486
2651
|
addOrUpdateMetadata as b,
|
|
2487
2652
|
buildBatches as c,
|
|
2488
2653
|
clearStaleFuncSpanState as d,
|
|
@@ -2506,6 +2671,6 @@ export {
|
|
|
2506
2671
|
getUrlAndStoredUuids as v,
|
|
2507
2672
|
identify as w,
|
|
2508
2673
|
initRecorder as x,
|
|
2509
|
-
|
|
2510
|
-
|
|
2674
|
+
yieldToMain as y,
|
|
2675
|
+
initializeConsolePlugin as z
|
|
2511
2676
|
};
|