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