@getpinax/widget 1.0.0-beta.1 → 1.0.0-beta.2
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 +270 -24
- package/dist/a11y/scan.d.ts +25 -0
- package/dist/api.d.ts +25 -4
- package/dist/capture/breadcrumbs.d.ts +1 -1
- package/dist/capture/network.d.ts +1 -1
- package/dist/capture/signature.d.ts +5 -0
- package/dist/capture/text.d.ts +17 -1
- package/dist/chunks/{editor-DbHLGwOA.mjs → editor-0Kr31Uly.mjs} +35 -35
- package/dist/chunks/{privacy-DmU6v5Fr.mjs → privacy-B_b1_Y1n.mjs} +2 -2
- package/dist/chunks/{recorder-BUtEB_em.mjs → recorder-tu4yugLw.mjs} +52 -37
- package/dist/chunks/scan-CFQwrtAQ.mjs +46137 -0
- package/dist/chunks/text-D9SaDBT0.mjs +36 -0
- package/dist/chunks/{widget-CkR1Ptzb.mjs → widget-BpTBdX2R.mjs} +530 -219
- package/dist/editor-loader.d.ts +3 -0
- package/dist/editor-loader.embed.d.ts +2 -1
- package/dist/fixcheck.d.ts +11 -0
- package/dist/index.d.ts +41 -2
- package/dist/known.d.ts +27 -0
- package/dist/pinax-axe.js +46167 -0
- package/dist/pinax-editor.js +252 -252
- package/dist/pinax-recorder.js +52 -39
- package/dist/pinax.js +28 -6
- package/dist/pinax.mjs +598 -369
- package/dist/preview.d.ts +14 -1
- package/dist/preview.mjs +36 -23
- package/dist/privacy.d.ts +4 -2
- package/dist/queue.d.ts +2 -1
- package/dist/replay/recorder.d.ts +10 -0
- package/dist/replay/sanitize.d.ts +9 -3
- package/dist/report.d.ts +21 -2
- package/dist/settings.d.ts +11 -2
- package/dist/types.d.ts +113 -3
- package/dist/ui/widget.d.ts +82 -2
- package/package.json +5 -4
- package/dist/chunks/text-8QYEyRYs.mjs +0 -18
package/dist/pinax.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
|
|
1
|
+
import { a as e, c as t, d as n, i as r, l as i, o as a, s as o, t as s, u as c } from "./chunks/widget-BpTBdX2R.mjs";
|
|
2
|
+
import { a as l, i as u, n as d, r as f } from "./chunks/text-D9SaDBT0.mjs";
|
|
3
|
+
import { o as p } from "./chunks/privacy-B_b1_Y1n.mjs";
|
|
4
|
+
function m(e) {
|
|
4
5
|
return (e || "https://api.getpinax.com").replace(/\/+$/, "");
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
+
function h(e, t) {
|
|
7
8
|
let n = e ?? (t ? "" : "https://cdn.getpinax.com");
|
|
8
9
|
return n ? n.replace(/\/+$/, "") : null;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function g(e, t) {
|
|
11
12
|
return `${e}/config/${encodeURIComponent(t)}.json`;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function _(e, t, n) {
|
|
14
15
|
return `${e}/v1/widget/${encodeURIComponent(t)}/${n}`;
|
|
15
16
|
}
|
|
16
|
-
async function
|
|
17
|
+
async function v(e, t) {
|
|
17
18
|
let n = await e(t, { credentials: "omit" });
|
|
18
19
|
if (!n.ok) return {
|
|
19
20
|
status: n.status,
|
|
@@ -27,19 +28,19 @@ async function m(e, t) {
|
|
|
27
28
|
}
|
|
28
29
|
async function ee(e, t, n, r = null) {
|
|
29
30
|
if (r) try {
|
|
30
|
-
let { config: t } = await
|
|
31
|
+
let { config: t } = await v(e, g(r, n));
|
|
31
32
|
if (t) return t;
|
|
32
33
|
} catch {}
|
|
33
|
-
return (await
|
|
34
|
+
return (await v(e, _(t, n, "config"))).config;
|
|
34
35
|
}
|
|
35
|
-
function te(
|
|
36
|
+
function te(e, t, r, i) {
|
|
36
37
|
try {
|
|
37
38
|
if (!new URL(i).searchParams.has("pinax_verify")) return;
|
|
38
|
-
|
|
39
|
+
e(_(t, r, "ping"), {
|
|
39
40
|
method: "POST",
|
|
40
41
|
credentials: "omit",
|
|
41
42
|
headers: { "Content-Type": "application/json" },
|
|
42
|
-
body: JSON.stringify({ url:
|
|
43
|
+
body: JSON.stringify({ url: n(i) })
|
|
43
44
|
}).catch(() => {});
|
|
44
45
|
} catch {}
|
|
45
46
|
}
|
|
@@ -49,10 +50,10 @@ var ne = {
|
|
|
49
50
|
413: "That screenshot is too big to send. Remove it and try again.",
|
|
50
51
|
429: "Too many reports from this device. Please try again in a few minutes."
|
|
51
52
|
};
|
|
52
|
-
async function
|
|
53
|
+
async function y(e, t, n, r) {
|
|
53
54
|
let i;
|
|
54
55
|
try {
|
|
55
|
-
i = await e(
|
|
56
|
+
i = await e(_(t, n, "reports"), {
|
|
56
57
|
method: "POST",
|
|
57
58
|
credentials: "omit",
|
|
58
59
|
headers: { "Content-Type": "application/json" },
|
|
@@ -82,15 +83,15 @@ async function re(e, t, n, r) {
|
|
|
82
83
|
message: ne[o] ?? (o === 400 && a?.message ? a.message : "Something went wrong. Please try again.")
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
|
-
var
|
|
86
|
-
async function
|
|
86
|
+
var re = 4e3;
|
|
87
|
+
async function ie(e, t, n, r, i = re) {
|
|
87
88
|
let a = typeof AbortController == "function" ? new AbortController() : null, o, s = new Promise((e) => {
|
|
88
89
|
o = setTimeout(() => {
|
|
89
90
|
a?.abort(), e(null);
|
|
90
91
|
}, i);
|
|
91
92
|
}), c = (async () => {
|
|
92
93
|
try {
|
|
93
|
-
let i = await e(
|
|
94
|
+
let i = await e(_(t, n, "follow-up"), {
|
|
94
95
|
method: "POST",
|
|
95
96
|
credentials: "omit",
|
|
96
97
|
headers: { "Content-Type": "application/json" },
|
|
@@ -114,21 +115,50 @@ async function ae(e, t, n, r, i = ie) {
|
|
|
114
115
|
clearTimeout(o);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
+
function b(e, t, n, r, i = "fix-check") {
|
|
118
119
|
try {
|
|
119
|
-
e(
|
|
120
|
+
e(_(t, n, i), {
|
|
120
121
|
method: "POST",
|
|
121
122
|
credentials: "omit",
|
|
122
123
|
keepalive: !0,
|
|
123
124
|
headers: { "Content-Type": "application/json" },
|
|
124
125
|
body: JSON.stringify({
|
|
125
126
|
checkId: r.checkId.slice(0, 64),
|
|
126
|
-
signature: r.signature.slice(0, 300)
|
|
127
|
+
signature: r.signature.slice(0, 300),
|
|
128
|
+
...i === "sighting" && r.basket ? { basket: r.basket } : {},
|
|
129
|
+
...r.consent ? { consent: !0 } : {}
|
|
127
130
|
})
|
|
128
131
|
}).catch(() => {});
|
|
129
132
|
} catch {}
|
|
130
133
|
}
|
|
131
|
-
|
|
134
|
+
function ae(e, t, n) {
|
|
135
|
+
return n ? `${n}/count/${encodeURIComponent(t)}` : _(e, t, "count");
|
|
136
|
+
}
|
|
137
|
+
function oe(e, t, n, r) {
|
|
138
|
+
try {
|
|
139
|
+
e(ae(t, n, r), {
|
|
140
|
+
method: "POST",
|
|
141
|
+
credentials: "omit",
|
|
142
|
+
keepalive: !0
|
|
143
|
+
}).catch(() => {});
|
|
144
|
+
} catch {}
|
|
145
|
+
}
|
|
146
|
+
async function se(e, t, n) {
|
|
147
|
+
try {
|
|
148
|
+
return (await e(t, {
|
|
149
|
+
method: "POST",
|
|
150
|
+
credentials: "omit",
|
|
151
|
+
headers: { "Content-Type": "application/json" },
|
|
152
|
+
body: JSON.stringify(n)
|
|
153
|
+
})).ok;
|
|
154
|
+
} catch {
|
|
155
|
+
return !1;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function ce(e, t, n, r, i) {
|
|
159
|
+
return se(e, _(t, n, `known/${encodeURIComponent(r)}/me-too`), i ? { email: i.trim().slice(0, 254) } : {});
|
|
160
|
+
}
|
|
161
|
+
var le = "input,textarea,select,[contenteditable]:not([contenteditable=false]),[data-pinax-mask],.pinax-mask", ue = "[data-pinax-mask],.pinax-mask", de = "a[href],button,input,select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=radio],[role=switch],[role=option],[contenteditable]:not([contenteditable=false])", fe = {
|
|
132
162
|
button: "button",
|
|
133
163
|
submit: "button",
|
|
134
164
|
reset: "button",
|
|
@@ -138,27 +168,27 @@ var h = "input,textarea,select,[contenteditable]:not([contenteditable=false]),[d
|
|
|
138
168
|
range: "slider",
|
|
139
169
|
search: "searchbox"
|
|
140
170
|
};
|
|
141
|
-
function
|
|
171
|
+
function x(e, t) {
|
|
142
172
|
try {
|
|
143
173
|
return e.matches(t);
|
|
144
174
|
} catch {
|
|
145
175
|
return !1;
|
|
146
176
|
}
|
|
147
177
|
}
|
|
148
|
-
function
|
|
178
|
+
function S(e, t) {
|
|
149
179
|
try {
|
|
150
180
|
return e.closest(t);
|
|
151
181
|
} catch {
|
|
152
182
|
return null;
|
|
153
183
|
}
|
|
154
184
|
}
|
|
155
|
-
var
|
|
156
|
-
function
|
|
185
|
+
var C = (e) => e.replace(/\s+/g, " ").trim();
|
|
186
|
+
function pe(e) {
|
|
157
187
|
if (e.tagName !== "INPUT") return !1;
|
|
158
188
|
let t = e, n = (t.getAttribute("autocomplete") ?? "").toLowerCase(), r = `${t.name} ${t.id}`.toLowerCase();
|
|
159
189
|
return t.type === "password" || n.includes("cc-") || n.includes("password") || /\b(card|cc|cvc|cvv|iban)/.test(r);
|
|
160
190
|
}
|
|
161
|
-
function
|
|
191
|
+
function w(e) {
|
|
162
192
|
let t = e.getAttribute("role")?.trim().split(/\s+/)[0];
|
|
163
193
|
if (t) return t;
|
|
164
194
|
let n = e.tagName.toLowerCase();
|
|
@@ -166,7 +196,7 @@ function x(e) {
|
|
|
166
196
|
case "a": return e.hasAttribute("href") ? "link" : "text";
|
|
167
197
|
case "button":
|
|
168
198
|
case "summary": return "button";
|
|
169
|
-
case "input": return
|
|
199
|
+
case "input": return fe[e.type?.toLowerCase()] ?? "textbox";
|
|
170
200
|
case "textarea": return "textbox";
|
|
171
201
|
case "select": return "combobox";
|
|
172
202
|
case "img": return "image";
|
|
@@ -176,11 +206,11 @@ function x(e) {
|
|
|
176
206
|
case "h4":
|
|
177
207
|
case "h5":
|
|
178
208
|
case "h6": return "heading";
|
|
179
|
-
default: return
|
|
209
|
+
default: return x(e, "[contenteditable]:not([contenteditable=false])") ? "textbox" : n;
|
|
180
210
|
}
|
|
181
211
|
}
|
|
182
|
-
function
|
|
183
|
-
if (
|
|
212
|
+
function T(e, t = 120) {
|
|
213
|
+
if (x(e, le) || S(e, ue)) return "";
|
|
184
214
|
let n = "", r = (e) => {
|
|
185
215
|
if (n.length > t) return;
|
|
186
216
|
if (e.nodeType === 3) {
|
|
@@ -189,7 +219,7 @@ function S(e, t = 120) {
|
|
|
189
219
|
}
|
|
190
220
|
if (e.nodeType !== 1) return;
|
|
191
221
|
let i = e, a = i.tagName;
|
|
192
|
-
if (a !== "SCRIPT" && a !== "STYLE" && a !== "TEMPLATE" && !
|
|
222
|
+
if (a !== "SCRIPT" && a !== "STYLE" && a !== "TEMPLATE" && !x(i, le) && i.getAttribute("aria-hidden") !== "true") {
|
|
193
223
|
if (a === "IMG") n += ` ${i.getAttribute("alt") ?? ""} `;
|
|
194
224
|
else {
|
|
195
225
|
for (let e of i.childNodes) r(e);
|
|
@@ -198,51 +228,51 @@ function S(e, t = 120) {
|
|
|
198
228
|
}
|
|
199
229
|
};
|
|
200
230
|
for (let t of e.childNodes) r(t);
|
|
201
|
-
return
|
|
231
|
+
return C(n);
|
|
202
232
|
}
|
|
203
|
-
function
|
|
233
|
+
function me(e) {
|
|
204
234
|
let t = e.getAttribute("aria-labelledby");
|
|
205
235
|
if (!t) return "";
|
|
206
236
|
let n = e.ownerDocument;
|
|
207
|
-
return
|
|
237
|
+
return C(t.split(/\s+/).map((e) => {
|
|
208
238
|
let t = n.getElementById(e);
|
|
209
|
-
return t ?
|
|
239
|
+
return t ? T(t) : "";
|
|
210
240
|
}).join(" "));
|
|
211
241
|
}
|
|
212
|
-
function
|
|
242
|
+
function he(e) {
|
|
213
243
|
let t = e;
|
|
214
|
-
return
|
|
244
|
+
return C((t.labels ? [...t.labels] : []).map((e) => T(e)).join(" ")) || C(t.getAttribute("placeholder") ?? "") || C(t.getAttribute("title") ?? "") || C(t.getAttribute("name") ?? "");
|
|
215
245
|
}
|
|
216
|
-
function
|
|
217
|
-
if (
|
|
218
|
-
let t =
|
|
246
|
+
function ge(e) {
|
|
247
|
+
if (S(e, ue)) return "";
|
|
248
|
+
let t = C(e.getAttribute("aria-label") ?? "");
|
|
219
249
|
if (t) return t;
|
|
220
|
-
let n =
|
|
250
|
+
let n = me(e);
|
|
221
251
|
if (n) return n;
|
|
222
252
|
let r = e.tagName;
|
|
223
253
|
if (r === "INPUT") {
|
|
224
254
|
let t = e.type?.toLowerCase();
|
|
225
|
-
return t === "submit" || t === "button" || t === "reset" ?
|
|
255
|
+
return t === "submit" || t === "button" || t === "reset" ? C(e.getAttribute("value") ?? "") : t === "image" ? C(e.getAttribute("alt") ?? "") : he(e);
|
|
226
256
|
}
|
|
227
|
-
return r === "TEXTAREA" || r === "SELECT" ?
|
|
257
|
+
return r === "TEXTAREA" || r === "SELECT" ? he(e) : x(e, "[contenteditable]:not([contenteditable=false])") ? C(e.getAttribute("title") ?? "") : r === "IMG" ? C(e.getAttribute("alt") ?? "") : T(e) || C(e.getAttribute("title") ?? "");
|
|
228
258
|
}
|
|
229
|
-
function
|
|
230
|
-
let
|
|
231
|
-
if (!
|
|
232
|
-
let
|
|
233
|
-
if (
|
|
234
|
-
let
|
|
235
|
-
return
|
|
259
|
+
function _e(e) {
|
|
260
|
+
let t = S(e, de);
|
|
261
|
+
if (!t) return d(w(e), 200);
|
|
262
|
+
let n = t;
|
|
263
|
+
if (pe(n)) return n.type === "password" ? "password field" : "card field";
|
|
264
|
+
let r = w(n), i = d(ge(n), 60).replace(/"/g, "'");
|
|
265
|
+
return d(i ? `${r} "${i}"` : r, 200);
|
|
236
266
|
}
|
|
237
|
-
function
|
|
267
|
+
function E(e = location.href) {
|
|
238
268
|
try {
|
|
239
|
-
let
|
|
240
|
-
return
|
|
269
|
+
let t = new URL(l(e));
|
|
270
|
+
return d(u(`${t.pathname}${t.search}`), 500);
|
|
241
271
|
} catch {
|
|
242
272
|
return "/";
|
|
243
273
|
}
|
|
244
274
|
}
|
|
245
|
-
function
|
|
275
|
+
function ve(e, t = {}) {
|
|
246
276
|
let n = t.doc ?? document, r = t.ignore ?? (() => !1), i = "", a = null, o = (t) => {
|
|
247
277
|
try {
|
|
248
278
|
e.push(t);
|
|
@@ -259,8 +289,8 @@ function pe(e, t = {}) {
|
|
|
259
289
|
a = null, o({
|
|
260
290
|
kind: "click",
|
|
261
291
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
262
|
-
path:
|
|
263
|
-
target:
|
|
292
|
+
path: E(),
|
|
293
|
+
target: _e(t)
|
|
264
294
|
});
|
|
265
295
|
} catch {}
|
|
266
296
|
}, l = (e) => {
|
|
@@ -268,23 +298,23 @@ function pe(e, t = {}) {
|
|
|
268
298
|
if (r(e.target)) return;
|
|
269
299
|
let t = s(e.target);
|
|
270
300
|
if (!t) return;
|
|
271
|
-
let n =
|
|
301
|
+
let n = S(t, de) ?? t;
|
|
272
302
|
if (n.tagName === "INPUT" && /^(checkbox|radio)$/i.test(n.type) || n === a) return;
|
|
273
303
|
a = n, o({
|
|
274
304
|
kind: "input",
|
|
275
305
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
276
|
-
path:
|
|
277
|
-
target:
|
|
306
|
+
path: E(),
|
|
307
|
+
target: _e(n)
|
|
278
308
|
});
|
|
279
309
|
} catch {}
|
|
280
310
|
}, u = () => {
|
|
281
311
|
try {
|
|
282
|
-
let e =
|
|
312
|
+
let e = location.pathname + location.search;
|
|
283
313
|
if (e === i) return;
|
|
284
314
|
i = e, a = null, o({
|
|
285
315
|
kind: "navigation",
|
|
286
316
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
287
|
-
path:
|
|
317
|
+
path: E()
|
|
288
318
|
});
|
|
289
319
|
} catch {}
|
|
290
320
|
};
|
|
@@ -296,120 +326,120 @@ function pe(e, t = {}) {
|
|
|
296
326
|
};
|
|
297
327
|
}
|
|
298
328
|
// src/capture/console.ts
|
|
299
|
-
var
|
|
329
|
+
var ye = [
|
|
300
330
|
"error",
|
|
301
331
|
"warn",
|
|
302
332
|
"log",
|
|
303
333
|
"info",
|
|
304
334
|
"debug"
|
|
305
|
-
],
|
|
306
|
-
function
|
|
335
|
+
], D = 2e3, O = 4e3;
|
|
336
|
+
function be(e, t = 0) {
|
|
307
337
|
if (typeof e == "string") return e;
|
|
308
338
|
if (e instanceof Error) return `${e.name}: ${e.message}`;
|
|
309
339
|
if (e == null) return String(e);
|
|
310
340
|
if (typeof e == "function") return `[function ${e.name || ""}]`;
|
|
311
341
|
if (typeof e != "object") return String(e);
|
|
312
342
|
if (typeof Node < "u" && e instanceof Node) return `[${e.nodeName.toLowerCase()}]`;
|
|
313
|
-
if (
|
|
343
|
+
if (t > 0) return Array.isArray(e) ? "[…]" : "{…}";
|
|
314
344
|
try {
|
|
315
|
-
let
|
|
316
|
-
if (
|
|
317
|
-
if (
|
|
318
|
-
|
|
345
|
+
let t = /* @__PURE__ */ new WeakSet(), n = JSON.stringify(e, (e, n) => {
|
|
346
|
+
if (n && typeof n == "object") {
|
|
347
|
+
if (t.has(n)) return "[circular]";
|
|
348
|
+
t.add(n);
|
|
319
349
|
}
|
|
320
|
-
return
|
|
350
|
+
return n;
|
|
321
351
|
});
|
|
322
|
-
return
|
|
352
|
+
return d(n ?? String(e), D);
|
|
323
353
|
} catch {
|
|
324
354
|
return Object.prototype.toString.call(e);
|
|
325
355
|
}
|
|
326
356
|
}
|
|
327
|
-
function
|
|
328
|
-
return
|
|
357
|
+
function xe(e) {
|
|
358
|
+
return d(e.map((e) => be(e)).join(" "), D);
|
|
329
359
|
}
|
|
330
|
-
function
|
|
331
|
-
let
|
|
332
|
-
return
|
|
360
|
+
function Se(e) {
|
|
361
|
+
let t = e.find((e) => e instanceof Error);
|
|
362
|
+
return t?.stack ? d(t.stack, O) : void 0;
|
|
333
363
|
}
|
|
334
|
-
function
|
|
364
|
+
function Ce() {
|
|
335
365
|
let e = (/* @__PURE__ */ Error()).stack;
|
|
336
366
|
if (!e) return;
|
|
337
|
-
let
|
|
338
|
-
return
|
|
367
|
+
let t = e.split("\n"), n = t[0].startsWith("Error") ? 3 : 2, r = t.slice(n).join("\n");
|
|
368
|
+
return r ? d(r, O) : void 0;
|
|
339
369
|
}
|
|
340
|
-
function
|
|
341
|
-
let
|
|
370
|
+
function we(e, t = window) {
|
|
371
|
+
let n = t.console, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = !1, o = (t) => {
|
|
342
372
|
try {
|
|
343
373
|
e.push(t);
|
|
344
374
|
} catch {}
|
|
345
375
|
};
|
|
346
|
-
for (let e of
|
|
347
|
-
let t =
|
|
376
|
+
for (let e of ye) {
|
|
377
|
+
let t = n?.[e];
|
|
348
378
|
if (typeof t != "function") continue;
|
|
349
|
-
let
|
|
350
|
-
if (!
|
|
351
|
-
|
|
379
|
+
let s = function(...n) {
|
|
380
|
+
if (!a) {
|
|
381
|
+
a = !0;
|
|
352
382
|
try {
|
|
353
|
-
|
|
383
|
+
o({
|
|
354
384
|
level: e,
|
|
355
|
-
message:
|
|
356
|
-
stack:
|
|
385
|
+
message: xe(n),
|
|
386
|
+
stack: Se(n) ?? (e === "error" || e === "warn" ? Ce() : void 0),
|
|
357
387
|
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
358
388
|
});
|
|
359
389
|
} catch {} finally {
|
|
360
|
-
|
|
390
|
+
a = !1;
|
|
361
391
|
}
|
|
362
392
|
}
|
|
363
393
|
return t.apply(this, n);
|
|
364
394
|
};
|
|
365
|
-
|
|
395
|
+
s.__pinaxOriginal = t, r.set(e, t), i.set(e, s);
|
|
366
396
|
try {
|
|
367
|
-
|
|
397
|
+
n[e] = s;
|
|
368
398
|
} catch {}
|
|
369
399
|
}
|
|
370
|
-
let
|
|
400
|
+
let s = (e) => {
|
|
371
401
|
try {
|
|
372
402
|
if (!e.message && !e.error) return;
|
|
373
|
-
let
|
|
374
|
-
|
|
403
|
+
let t = e.error, n = e.filename ? ` (${e.filename}:${e.lineno}:${e.colno})` : "";
|
|
404
|
+
o({
|
|
375
405
|
level: "error",
|
|
376
|
-
message:
|
|
377
|
-
stack:
|
|
406
|
+
message: d(`Uncaught ${t?.name ? `${t.name}: ${t.message}` : e.message}${n}`, D),
|
|
407
|
+
stack: t?.stack ? d(t.stack, O) : void 0,
|
|
378
408
|
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
379
409
|
});
|
|
380
410
|
} catch {}
|
|
381
|
-
},
|
|
411
|
+
}, c = (e) => {
|
|
382
412
|
try {
|
|
383
|
-
let
|
|
384
|
-
|
|
413
|
+
let t = e.reason;
|
|
414
|
+
o({
|
|
385
415
|
level: "error",
|
|
386
|
-
message:
|
|
387
|
-
stack:
|
|
416
|
+
message: d(`Unhandled promise rejection: ${be(t)}`, D),
|
|
417
|
+
stack: t instanceof Error && t.stack ? d(t.stack, O) : void 0,
|
|
388
418
|
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
389
419
|
});
|
|
390
420
|
} catch {}
|
|
391
421
|
};
|
|
392
|
-
return
|
|
393
|
-
|
|
394
|
-
for (let [e, t] of
|
|
395
|
-
|
|
422
|
+
return t.addEventListener("error", s), t.addEventListener("unhandledrejection", c), () => {
|
|
423
|
+
t.removeEventListener("error", s), t.removeEventListener("unhandledrejection", c);
|
|
424
|
+
for (let [e, t] of r) try {
|
|
425
|
+
n[e] === i.get(e) && (n[e] = t);
|
|
396
426
|
} catch {}
|
|
397
427
|
};
|
|
398
428
|
}
|
|
399
429
|
// src/capture/ua.ts
|
|
400
|
-
var
|
|
430
|
+
var Te = {
|
|
401
431
|
"10.0": "10/11",
|
|
402
432
|
"6.3": "8.1",
|
|
403
433
|
"6.2": "8",
|
|
404
434
|
"6.1": "7"
|
|
405
435
|
};
|
|
406
|
-
function
|
|
436
|
+
function k(e, t) {
|
|
407
437
|
return t.exec(e)?.[1];
|
|
408
438
|
}
|
|
409
|
-
function
|
|
439
|
+
function A(e) {
|
|
410
440
|
if (e) return e.replace(/_/g, ".").split(".").slice(0, 2).join(".");
|
|
411
441
|
}
|
|
412
|
-
function
|
|
442
|
+
function Ee(e, t = 0) {
|
|
413
443
|
let n = { deviceType: "desktop" };
|
|
414
444
|
for (let [t, r] of [
|
|
415
445
|
["Edge", /Edg(?:e|A|iOS)?\/([\d.]+)/],
|
|
@@ -419,139 +449,139 @@ function ye(e, t = 0) {
|
|
|
419
449
|
["Chrome", /(?:Chrome|CriOS)\/([\d.]+)/],
|
|
420
450
|
["Safari", /Version\/([\d.]+).*Safari\//]
|
|
421
451
|
]) {
|
|
422
|
-
let i =
|
|
452
|
+
let i = k(e, r);
|
|
423
453
|
if (i) {
|
|
424
|
-
n.browser = t, n.browserVersion =
|
|
454
|
+
n.browser = t, n.browserVersion = A(i);
|
|
425
455
|
break;
|
|
426
456
|
}
|
|
427
457
|
}
|
|
428
458
|
!n.browser && /AppleWebKit/.test(e) && /Mobile\//.test(e) && (n.browser = "Safari (in-app)");
|
|
429
459
|
let r = /iPad/.test(e) || /Macintosh/.test(e) && t > 1;
|
|
430
|
-
if (/iPhone|iPod/.test(e)) n.os = `iOS ${k(
|
|
460
|
+
if (/iPhone|iPod/.test(e)) n.os = `iOS ${A(k(e, /OS ([\d_]+) like Mac/)) ?? ""}`.trim(), n.deviceType = "mobile", n.deviceModel = /iPod/.test(e) ? "iPod" : "iPhone";
|
|
431
461
|
else if (r) {
|
|
432
|
-
let t = k(
|
|
462
|
+
let t = A(k(e, /OS ([\d_]+) like Mac/));
|
|
433
463
|
n.os = t ? `iPadOS ${t}` : "iPadOS", n.deviceType = "tablet", n.deviceModel = "iPad";
|
|
434
464
|
} else if (/Android/.test(e)) {
|
|
435
|
-
n.os = `Android ${
|
|
436
|
-
let t =
|
|
465
|
+
n.os = `Android ${k(e, /Android ([\d.]+)/) ?? ""}`.trim(), n.deviceType = /Mobile/.test(e) ? "mobile" : "tablet";
|
|
466
|
+
let t = k(e, /Android [\d.]+;(?: [a-z]{2}[-_][a-z]{2};)? ([^;)]+?)(?: Build\/[^;)]*)?\)/i);
|
|
437
467
|
t && t !== "K" && !/^wv$/.test(t) && (n.deviceModel = t.trim());
|
|
438
468
|
} else if (/CrOS/.test(e)) n.os = "ChromeOS";
|
|
439
469
|
else if (/Windows NT/.test(e)) {
|
|
440
|
-
let t =
|
|
441
|
-
n.os = t &&
|
|
442
|
-
} else /Mac OS X/.test(e) ? n.os = `macOS ${k(
|
|
470
|
+
let t = k(e, /Windows NT ([\d.]+)/);
|
|
471
|
+
n.os = t && Te[t] ? `Windows ${Te[t]}` : "Windows";
|
|
472
|
+
} else /Mac OS X/.test(e) ? n.os = `macOS ${A(k(e, /Mac OS X ([\d_.]+)/)) ?? ""}`.trim() : /Linux/.test(e) && (n.os = "Linux");
|
|
443
473
|
return n.deviceType === "desktop" && /Mobi|Tablet|Kindle|Silk/.test(e) && (n.deviceType = /Tablet|Kindle|Silk/.test(e) ? "tablet" : "mobile"), n;
|
|
444
474
|
}
|
|
445
475
|
// src/capture/env.ts
|
|
446
|
-
var
|
|
447
|
-
function
|
|
476
|
+
var j = (e) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.round(e)) : 0;
|
|
477
|
+
function De(e = /* @__PURE__ */ new Date()) {
|
|
448
478
|
let t = (e, t = 2) => String(Math.abs(e)).padStart(t, "0"), n = -e.getTimezoneOffset(), r = n >= 0 ? "+" : "-";
|
|
449
479
|
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(), 3)}${r}${t(Math.trunc(n / 60))}:${t(n % 60)}`;
|
|
450
480
|
}
|
|
451
|
-
function
|
|
452
|
-
let
|
|
481
|
+
function Oe(e = window) {
|
|
482
|
+
let t = e.navigator, n = t?.userAgent ?? "", r = Ee(n, t?.maxTouchPoints ?? 0), i = "UTC";
|
|
453
483
|
try {
|
|
454
|
-
|
|
484
|
+
i = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
455
485
|
} catch {}
|
|
456
|
-
let
|
|
486
|
+
let a = (e, t) => e ? d(e, t) : void 0;
|
|
457
487
|
return {
|
|
458
|
-
userAgent:
|
|
459
|
-
browser:
|
|
460
|
-
browserVersion:
|
|
461
|
-
os:
|
|
462
|
-
deviceType:
|
|
463
|
-
deviceModel:
|
|
488
|
+
userAgent: d(n, 1e3),
|
|
489
|
+
browser: a(r.browser, 100),
|
|
490
|
+
browserVersion: a(r.browserVersion, 50),
|
|
491
|
+
os: a(r.os, 100),
|
|
492
|
+
deviceType: r.deviceType,
|
|
493
|
+
deviceModel: a(r.deviceModel, 100),
|
|
464
494
|
screen: {
|
|
465
|
-
w:
|
|
466
|
-
h:
|
|
495
|
+
w: j(e.screen?.width),
|
|
496
|
+
h: j(e.screen?.height)
|
|
467
497
|
},
|
|
468
498
|
viewport: {
|
|
469
|
-
w:
|
|
470
|
-
h:
|
|
499
|
+
w: j(e.innerWidth),
|
|
500
|
+
h: j(e.innerHeight)
|
|
471
501
|
},
|
|
472
502
|
pixelRatio: Math.min(10, Math.max(0, e.devicePixelRatio || 1)),
|
|
473
|
-
timeZone:
|
|
474
|
-
language:
|
|
475
|
-
occurredAt:
|
|
503
|
+
timeZone: d(i, 100),
|
|
504
|
+
language: a(t?.language, 35),
|
|
505
|
+
occurredAt: De()
|
|
476
506
|
};
|
|
477
507
|
}
|
|
478
|
-
function
|
|
508
|
+
function ke(e, t) {
|
|
479
509
|
return e === 0 || e >= 400 || t > 2e3;
|
|
480
510
|
}
|
|
481
|
-
function
|
|
482
|
-
let
|
|
511
|
+
function Ae(e, t = window, n = {}) {
|
|
512
|
+
let r = n.now ?? (() => typeof performance < "u" ? performance.now() : Date.now()), i = t.location?.href, a = n.ignore ?? (() => !1), o = (t, n, o, s, c) => {
|
|
483
513
|
try {
|
|
484
|
-
let
|
|
485
|
-
if (!
|
|
486
|
-
let
|
|
487
|
-
if (
|
|
488
|
-
|
|
489
|
-
method: t
|
|
490
|
-
url:
|
|
491
|
-
status: Math.min(999, Math.max(0,
|
|
492
|
-
durationMs: Math.min(6e5,
|
|
493
|
-
at:
|
|
514
|
+
let l = Math.max(0, Math.round(r() - s));
|
|
515
|
+
if (!ke(o, l)) return;
|
|
516
|
+
let u = f(n, i);
|
|
517
|
+
if (a(u)) return;
|
|
518
|
+
e.push({
|
|
519
|
+
method: d(t.toUpperCase(), 10),
|
|
520
|
+
url: d(u, 2e3),
|
|
521
|
+
status: Math.min(999, Math.max(0, o | 0)),
|
|
522
|
+
durationMs: Math.min(6e5, l),
|
|
523
|
+
at: c
|
|
494
524
|
});
|
|
495
525
|
} catch {}
|
|
496
|
-
},
|
|
497
|
-
if (typeof
|
|
498
|
-
let e = (e,
|
|
499
|
-
let
|
|
526
|
+
}, s = [], c = t.fetch;
|
|
527
|
+
if (typeof c == "function") {
|
|
528
|
+
let e = (e, n) => {
|
|
529
|
+
let i = "GET", a = "", s = r(), l = (/* @__PURE__ */ new Date()).toISOString();
|
|
500
530
|
try {
|
|
501
|
-
typeof e == "string" ?
|
|
531
|
+
typeof e == "string" ? a = e : e instanceof URL ? a = e.href : e && typeof e.url == "string" && (a = e.url, i = e.method || i), n?.method && (i = n.method);
|
|
502
532
|
} catch {}
|
|
503
|
-
let
|
|
533
|
+
let u = c.call(t, e, n);
|
|
504
534
|
try {
|
|
505
|
-
|
|
535
|
+
u.then((e) => o(i, a, e?.status ?? 0, s, l), () => o(i, a, 0, s, l));
|
|
506
536
|
} catch {}
|
|
507
|
-
return
|
|
537
|
+
return u;
|
|
508
538
|
};
|
|
509
539
|
try {
|
|
510
|
-
|
|
511
|
-
|
|
540
|
+
t.fetch = e, s.push(() => {
|
|
541
|
+
t.fetch === e && (t.fetch = c);
|
|
512
542
|
});
|
|
513
543
|
} catch {}
|
|
514
544
|
}
|
|
515
|
-
let
|
|
516
|
-
if (
|
|
517
|
-
let e =
|
|
545
|
+
let l = t.XMLHttpRequest;
|
|
546
|
+
if (l?.prototype) {
|
|
547
|
+
let e = l.prototype, t = e.open, n = e.send, i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakSet(), u = function(e, n, ...r) {
|
|
518
548
|
try {
|
|
519
|
-
|
|
549
|
+
i.set(this, {
|
|
520
550
|
method: String(e),
|
|
521
551
|
url: String(n)
|
|
522
552
|
});
|
|
523
553
|
} catch {}
|
|
524
|
-
return t.call(this, e, n, ...
|
|
525
|
-
},
|
|
554
|
+
return t.call(this, e, n, ...r);
|
|
555
|
+
}, d = function(e) {
|
|
526
556
|
try {
|
|
527
|
-
let e =
|
|
528
|
-
e && (
|
|
557
|
+
let e = i.get(this);
|
|
558
|
+
e && (a.set(this, {
|
|
529
559
|
m: e,
|
|
530
|
-
start:
|
|
560
|
+
start: r(),
|
|
531
561
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
532
562
|
aborted: !1
|
|
533
|
-
}),
|
|
534
|
-
let e =
|
|
563
|
+
}), c.has(this) || (c.add(this), this.addEventListener("abort", () => {
|
|
564
|
+
let e = a.get(this);
|
|
535
565
|
e && (e.aborted = !0);
|
|
536
566
|
}), this.addEventListener("loadend", () => {
|
|
537
|
-
let e =
|
|
538
|
-
|
|
567
|
+
let e = a.get(this);
|
|
568
|
+
a.delete(this), e && !e.aborted && o(e.m.method, e.m.url, this.status, e.start, e.startedAt);
|
|
539
569
|
})));
|
|
540
570
|
} catch {}
|
|
541
571
|
return n.call(this, e);
|
|
542
572
|
};
|
|
543
|
-
e.open =
|
|
544
|
-
e.open ===
|
|
573
|
+
e.open = u, e.send = d, s.push(() => {
|
|
574
|
+
e.open === u && (e.open = t), e.send === d && (e.send = n);
|
|
545
575
|
});
|
|
546
576
|
}
|
|
547
577
|
return () => {
|
|
548
|
-
for (let e of
|
|
578
|
+
for (let e of s) try {
|
|
549
579
|
e();
|
|
550
580
|
} catch {}
|
|
551
581
|
};
|
|
552
582
|
}
|
|
553
583
|
// src/capture/ring.ts
|
|
554
|
-
var
|
|
584
|
+
var M = class {
|
|
555
585
|
constructor(e) {
|
|
556
586
|
this.capacity = e, this.items = [], this.listeners = /* @__PURE__ */ new Set();
|
|
557
587
|
}
|
|
@@ -575,37 +605,40 @@ var j = class {
|
|
|
575
605
|
}
|
|
576
606
|
};
|
|
577
607
|
// src/editor-loader.ts
|
|
578
|
-
function
|
|
579
|
-
return import("./chunks/editor-
|
|
608
|
+
function je() {
|
|
609
|
+
return import("./chunks/editor-0Kr31Uly.mjs");
|
|
580
610
|
}
|
|
581
|
-
function
|
|
582
|
-
return import("./chunks/recorder-
|
|
611
|
+
function Me() {
|
|
612
|
+
return import("./chunks/recorder-tu4yugLw.mjs");
|
|
613
|
+
}
|
|
614
|
+
function Ne() {
|
|
615
|
+
return import("./chunks/scan-CFQwrtAQ.mjs");
|
|
583
616
|
}
|
|
584
617
|
// src/capture/signature.ts
|
|
585
|
-
function
|
|
586
|
-
return e.replace(/https?:\/\/\S+/g, "<url>").replace(/\b[0-9a-f]{8,}\b/gi, "<id>").replace(/\d+/g, "<n>").replace(/\s+/g, " ").trim().slice(0, 200);
|
|
618
|
+
function Pe(e) {
|
|
619
|
+
return p(e).replace(/https?:\/\/\S+/g, "<url>").replace(/\b[0-9a-f]{8,}\b/gi, "<id>").replace(/\d+/g, "<n>").replace(/\s+/g, " ").trim().slice(0, 200);
|
|
587
620
|
}
|
|
588
|
-
function
|
|
621
|
+
function N(e, t) {
|
|
589
622
|
let n = (Array.isArray(e) ? e : []).filter((e) => e.level === "error");
|
|
590
|
-
if (n[0]?.message) return `console:${
|
|
623
|
+
if (n[0]?.message) return `console:${Pe(n[0].message)}`;
|
|
591
624
|
let r = (Array.isArray(t) ? t : []).find((e) => e.status === 0 || e.status >= 500);
|
|
592
625
|
if (r) {
|
|
593
626
|
let e = r.url;
|
|
594
627
|
try {
|
|
595
628
|
e = new URL(r.url).pathname;
|
|
596
629
|
} catch {}
|
|
597
|
-
return `network:${r.method.toUpperCase()} ${
|
|
630
|
+
return `network:${r.method.toUpperCase()} ${Pe(e)} ${r.status === 0 ? "failed" : "5xx"}`;
|
|
598
631
|
}
|
|
599
632
|
return null;
|
|
600
633
|
}
|
|
601
634
|
// src/fixcheck.ts
|
|
602
|
-
function
|
|
603
|
-
return e.level === "error" ?
|
|
635
|
+
function P(e) {
|
|
636
|
+
return e.level === "error" ? N([e], []) : null;
|
|
604
637
|
}
|
|
605
|
-
function
|
|
606
|
-
return
|
|
638
|
+
function Fe(e) {
|
|
639
|
+
return N([], [e]);
|
|
607
640
|
}
|
|
608
|
-
function
|
|
641
|
+
function F(e) {
|
|
609
642
|
let t = e.path ?? (() => location.pathname), n = e.random ?? Math.random, r = e.now ?? Date.now, i = [], a = /* @__PURE__ */ new Set(), o = r(), s = null, c = (t) => {
|
|
610
643
|
if (t) {
|
|
611
644
|
for (let n of i) if (!(n.signature !== t || a.has(n.id))) {
|
|
@@ -620,16 +653,16 @@ function Te(e) {
|
|
|
620
653
|
return Number.isNaN(t) || t >= o - 1;
|
|
621
654
|
}, u = (r) => {
|
|
622
655
|
let u = t();
|
|
623
|
-
if (s = u, o = r, a = /* @__PURE__ */ new Set(), i = e.checks.filter((t) =>
|
|
624
|
-
for (let t of e.console.toArray()) l(t.at) && c(
|
|
625
|
-
for (let t of e.network.toArray()) l(t.at) && c(
|
|
656
|
+
if (s = u, o = r, a = /* @__PURE__ */ new Set(), i = e.checks.filter((t) => Ie(t.path, u) && e.sampleRate > 0 && n() < e.sampleRate), i.length) {
|
|
657
|
+
for (let t of e.console.toArray()) l(t.at) && c(P(t));
|
|
658
|
+
for (let t of e.network.toArray()) l(t.at) && c(Fe(t));
|
|
626
659
|
}
|
|
627
660
|
}, d = e.console.subscribe((e) => {
|
|
628
|
-
i.length && c(
|
|
661
|
+
i.length && c(P(e));
|
|
629
662
|
}), f = e.network.subscribe((e) => {
|
|
630
|
-
i.length && c(
|
|
663
|
+
i.length && c(Fe(e));
|
|
631
664
|
}), p = typeof performance < "u" && performance.timeOrigin ? performance.timeOrigin : r();
|
|
632
|
-
return u(Math.min(p, r())), {
|
|
665
|
+
return u(e.since ?? Math.min(p, r())), {
|
|
633
666
|
navigated: () => {
|
|
634
667
|
t() !== s && u(r());
|
|
635
668
|
},
|
|
@@ -638,23 +671,52 @@ function Te(e) {
|
|
|
638
671
|
}
|
|
639
672
|
};
|
|
640
673
|
}
|
|
641
|
-
function
|
|
674
|
+
function Ie(e, t) {
|
|
675
|
+
return e === "*" || Le(e, t);
|
|
676
|
+
}
|
|
677
|
+
function Le(e, t) {
|
|
642
678
|
let n = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e;
|
|
643
679
|
return n(e) === n(t);
|
|
644
680
|
}
|
|
681
|
+
function Re(e) {
|
|
682
|
+
let t = e.path ?? (() => location.pathname), n = /* @__PURE__ */ new Set(), r = t(), i = e.known.flatMap((e) => e.signature ? [{
|
|
683
|
+
id: e.id,
|
|
684
|
+
path: "*",
|
|
685
|
+
signature: e.signature
|
|
686
|
+
}] : []), a = i.length ? F({
|
|
687
|
+
checks: i,
|
|
688
|
+
sampleRate: 1,
|
|
689
|
+
random: () => 0,
|
|
690
|
+
console: e.console,
|
|
691
|
+
network: e.network,
|
|
692
|
+
report: (e) => n.add(e.id),
|
|
693
|
+
path: t,
|
|
694
|
+
now: e.now
|
|
695
|
+
}) : null;
|
|
696
|
+
return {
|
|
697
|
+
matches: () => ze(e.known, t(), n),
|
|
698
|
+
navigated: () => {
|
|
699
|
+
t() !== r && (r = t(), n.clear()), a?.navigated();
|
|
700
|
+
},
|
|
701
|
+
stop: () => a?.stop()
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
function ze(e, t, n = /* @__PURE__ */ new Set()) {
|
|
705
|
+
return e.filter((e) => n.has(e.id) || e.paths.some((e) => Le(e, t))).slice(0, 3);
|
|
706
|
+
}
|
|
645
707
|
// src/mount.ts
|
|
646
|
-
var
|
|
647
|
-
function
|
|
648
|
-
let t = e.getElementById(
|
|
708
|
+
var I = "pinax-widget-root";
|
|
709
|
+
function Be(e = document) {
|
|
710
|
+
let t = e.getElementById(I);
|
|
649
711
|
if (t?.shadowRoot) return t.shadowRoot;
|
|
650
712
|
let n = e.createElement("div");
|
|
651
|
-
return n.id =
|
|
713
|
+
return n.id = I, n.className = "ph-no-capture fs-exclude", n.setAttribute("data-hj-suppress", ""), n.setAttribute("data-clarity-mask", "true"), n.setAttribute("data-private", ""), n.style.cssText = "all: initial; position: fixed; z-index: 2147483647;", e.body.appendChild(n), n.attachShadow({ mode: "open" });
|
|
652
714
|
}
|
|
653
|
-
function
|
|
654
|
-
e.getElementById(
|
|
715
|
+
function Ve(e = document) {
|
|
716
|
+
e.getElementById(I)?.remove();
|
|
655
717
|
}
|
|
656
718
|
// src/navigation.ts
|
|
657
|
-
function
|
|
719
|
+
function He(e, t = window) {
|
|
658
720
|
let n = !0, r = !1, i = () => {
|
|
659
721
|
if (!n || r) return;
|
|
660
722
|
r = !0;
|
|
@@ -690,46 +752,58 @@ function ke(e, t = window) {
|
|
|
690
752
|
};
|
|
691
753
|
}
|
|
692
754
|
// src/paths.ts
|
|
693
|
-
var
|
|
694
|
-
function
|
|
695
|
-
let t =
|
|
755
|
+
var L = /* @__PURE__ */ new Map();
|
|
756
|
+
function Ue(e) {
|
|
757
|
+
let t = L.get(e);
|
|
696
758
|
if (!t) {
|
|
697
|
-
let n =
|
|
698
|
-
t = RegExp(`^${n}$`),
|
|
759
|
+
let n = R(e.trim()).split("*").map((e) => e.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*");
|
|
760
|
+
t = RegExp(`^${n}$`), L.size > 200 && L.clear(), L.set(e, t);
|
|
699
761
|
}
|
|
700
762
|
return t;
|
|
701
763
|
}
|
|
702
|
-
function
|
|
764
|
+
function R(e) {
|
|
703
765
|
return e.length > 1 ? e.replace(/\/+$/, "") || "/" : e;
|
|
704
766
|
}
|
|
705
|
-
function
|
|
767
|
+
function We(e) {
|
|
706
768
|
try {
|
|
707
769
|
return decodeURI(e);
|
|
708
770
|
} catch {
|
|
709
771
|
return e;
|
|
710
772
|
}
|
|
711
773
|
}
|
|
712
|
-
function
|
|
774
|
+
function Ge(e, t) {
|
|
713
775
|
if (typeof e != "string" || !e.trim()) return !1;
|
|
714
|
-
let n =
|
|
776
|
+
let n = Ue(e), r = R(t || "/"), i = [r, `${r === "/" ? "" : r}/`], a = We(r);
|
|
715
777
|
return a !== r && i.push(a, `${a}/`), i.some((e) => n.test(e));
|
|
716
778
|
}
|
|
717
|
-
function
|
|
718
|
-
return e?.length ? e.some((e) =>
|
|
779
|
+
function Ke(e, t) {
|
|
780
|
+
return e?.length ? e.some((e) => Ge(e, t)) : !1;
|
|
719
781
|
}
|
|
720
782
|
// src/queue.ts
|
|
721
|
-
var
|
|
783
|
+
var qe = 36e5, Je = 8, z = (e) => `pinax:queue:${e}`, B = /* @__PURE__ */ new Map(), Ye = (e) => Date.now() - e.queuedAt <= qe, Xe = (e) => {
|
|
784
|
+
let t = e;
|
|
785
|
+
return !!t && typeof t.queuedAt == "number" && typeof t.tries == "number" && typeof t.body?.page?.url == "string";
|
|
786
|
+
};
|
|
722
787
|
function V(e, t) {
|
|
788
|
+
let n;
|
|
723
789
|
try {
|
|
724
|
-
let
|
|
725
|
-
|
|
790
|
+
let r = e.getItem(z(t)), i = r ? JSON.parse(r) : [];
|
|
791
|
+
n = Array.isArray(i) ? i : [];
|
|
726
792
|
} catch {
|
|
727
793
|
return [];
|
|
728
794
|
}
|
|
795
|
+
let r = n.filter((e) => Xe(e) && Ye(e)), i = r.some((e) => "email" in e.body || "user" in e.body);
|
|
796
|
+
if (r.length === n.length && !i) return r;
|
|
797
|
+
for (let e of n) !r.includes(e) && e?.id && B.delete(e.id);
|
|
798
|
+
let a = r.map((e) => ({
|
|
799
|
+
...e,
|
|
800
|
+
body: Ze(e.body)
|
|
801
|
+
}));
|
|
802
|
+
return H(e, t, a), a;
|
|
729
803
|
}
|
|
730
804
|
function H(e, t, n) {
|
|
731
805
|
try {
|
|
732
|
-
return n.length ? e.setItem(
|
|
806
|
+
return n.length ? e.setItem(z(t), JSON.stringify(n)) : e.removeItem(z(t)), !0;
|
|
733
807
|
} catch {
|
|
734
808
|
return !1;
|
|
735
809
|
}
|
|
@@ -741,45 +815,56 @@ function U() {
|
|
|
741
815
|
return null;
|
|
742
816
|
}
|
|
743
817
|
}
|
|
744
|
-
function
|
|
745
|
-
let {
|
|
818
|
+
function Ze(e) {
|
|
819
|
+
let { email: t, user: r, console: i, screenshot: a, annotations: o, replay: s, ...c } = e;
|
|
746
820
|
return {
|
|
747
|
-
...
|
|
821
|
+
...c,
|
|
748
822
|
page: {
|
|
749
|
-
...
|
|
750
|
-
url:
|
|
823
|
+
...c.page,
|
|
824
|
+
url: n(c.page.url)
|
|
751
825
|
}
|
|
752
826
|
};
|
|
753
827
|
}
|
|
754
|
-
|
|
828
|
+
var Qe = () => `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`;
|
|
829
|
+
function $e(e, t) {
|
|
755
830
|
let n = U();
|
|
756
|
-
|
|
757
|
-
|
|
831
|
+
if (!n) return !1;
|
|
832
|
+
let r = V(n, e), i = r.slice(0, Math.max(0, r.length - 4));
|
|
833
|
+
for (let e of i) e.id && B.delete(e.id);
|
|
834
|
+
let a = Qe(), o = H(n, e, [...r.slice(-4), {
|
|
835
|
+
id: a,
|
|
836
|
+
body: Ze(t),
|
|
758
837
|
queuedAt: Date.now(),
|
|
759
838
|
tries: 0
|
|
760
|
-
}])
|
|
839
|
+
}]);
|
|
840
|
+
return o && (t.email || t.user) && B.set(a, {
|
|
841
|
+
...t.email && { email: t.email },
|
|
842
|
+
...t.user && { user: t.user }
|
|
843
|
+
}), o;
|
|
761
844
|
}
|
|
762
|
-
function
|
|
845
|
+
function et(e) {
|
|
763
846
|
let t = U();
|
|
764
847
|
return t ? V(t, e).length : 0;
|
|
765
848
|
}
|
|
766
849
|
var W = !1;
|
|
767
|
-
async function
|
|
850
|
+
async function tt(e, t, n) {
|
|
768
851
|
let r = U();
|
|
769
852
|
if (r && !W && (typeof navigator > "u" || navigator.onLine !== !1)) {
|
|
770
853
|
W = !0;
|
|
771
854
|
try {
|
|
772
855
|
let i = V(r, n), a = [];
|
|
773
856
|
for (let r of i) {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
857
|
+
let i = r.id ? B.get(r.id) : void 0, o = await y(e, t, n, {
|
|
858
|
+
...r.body,
|
|
859
|
+
...i
|
|
860
|
+
});
|
|
861
|
+
!o.ok && o.retry && r.tries + 1 < Je ? a.push({
|
|
777
862
|
...r,
|
|
778
863
|
tries: r.tries + 1
|
|
779
|
-
});
|
|
864
|
+
}) : r.id && B.delete(r.id);
|
|
780
865
|
}
|
|
781
|
-
let o = V(r, n).
|
|
782
|
-
H(r, n, [...a, ...
|
|
866
|
+
let o = new Set(i.map((e) => e.id)), s = V(r, n).filter((e) => !o.has(e.id));
|
|
867
|
+
H(r, n, [...a, ...s]);
|
|
783
868
|
} finally {
|
|
784
869
|
W = !1;
|
|
785
870
|
}
|
|
@@ -790,7 +875,7 @@ var G = {
|
|
|
790
875
|
opened: "Pinax Widget Opened",
|
|
791
876
|
submitted: "Feedback Submitted"
|
|
792
877
|
};
|
|
793
|
-
function
|
|
878
|
+
function nt(e = window) {
|
|
794
879
|
try {
|
|
795
880
|
let t = e.analytics;
|
|
796
881
|
return !t || typeof t != "object" && typeof t != "function" ? null : typeof t.track == "function" ? t : null;
|
|
@@ -798,34 +883,34 @@ function K(e = window) {
|
|
|
798
883
|
return null;
|
|
799
884
|
}
|
|
800
885
|
}
|
|
801
|
-
function
|
|
886
|
+
function rt(e, t) {
|
|
802
887
|
return typeof e == "boolean" ? e : t === !0;
|
|
803
888
|
}
|
|
804
|
-
function
|
|
889
|
+
function it(e, t) {
|
|
805
890
|
try {
|
|
806
|
-
|
|
891
|
+
nt()?.track?.(e, t);
|
|
807
892
|
} catch {}
|
|
808
893
|
}
|
|
809
|
-
function
|
|
810
|
-
|
|
894
|
+
function at() {
|
|
895
|
+
it(G.opened, { source: "pinax" });
|
|
811
896
|
}
|
|
812
|
-
function
|
|
897
|
+
function ot(e) {
|
|
813
898
|
let t = {
|
|
814
899
|
source: "pinax",
|
|
815
900
|
type: e.type.toLowerCase()
|
|
816
901
|
};
|
|
817
|
-
typeof e.rating == "number" && (t.rating = e.rating), e.reportId && (t.reportId = e.reportId), e.queued && (t.queued = !0),
|
|
902
|
+
typeof e.rating == "number" && (t.rating = e.rating), e.reportId && (t.reportId = e.reportId), e.queued && (t.queued = !0), it(G.submitted, t);
|
|
818
903
|
}
|
|
819
|
-
function
|
|
904
|
+
function st() {
|
|
820
905
|
try {
|
|
821
|
-
let e =
|
|
906
|
+
let e = nt()?.user?.()?.id?.();
|
|
822
907
|
return typeof e == "string" && e.trim() ? e.trim().slice(0, 200) : typeof e == "number" && Number.isFinite(e) ? String(e) : null;
|
|
823
908
|
} catch {
|
|
824
909
|
return null;
|
|
825
910
|
}
|
|
826
911
|
}
|
|
827
912
|
// src/index.ts
|
|
828
|
-
var
|
|
913
|
+
var ct = 8e3, K = null, q, J, Y, lt, X = (e, t) => (lt ?? window.fetch).call(window, e, t);
|
|
829
914
|
function Z(e, t) {
|
|
830
915
|
try {
|
|
831
916
|
(console.warn.__pinaxOriginal ?? console.warn).call(console, `Pinax: ${e}`, t ?? "");
|
|
@@ -838,204 +923,348 @@ function Q(e) {
|
|
|
838
923
|
Z("capture could not start", e);
|
|
839
924
|
}
|
|
840
925
|
}
|
|
841
|
-
function
|
|
842
|
-
if (
|
|
843
|
-
if (!
|
|
844
|
-
let
|
|
845
|
-
|
|
846
|
-
let
|
|
847
|
-
options:
|
|
848
|
-
api:
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
926
|
+
function ut(t) {
|
|
927
|
+
if (K) return;
|
|
928
|
+
if (!t?.key) throw Error("Pinax: init() needs a website key");
|
|
929
|
+
let n = m(t.apiUrl), i = h(t.cdnUrl, t.apiUrl);
|
|
930
|
+
lt = typeof window.fetch == "function" ? window.fetch : void 0;
|
|
931
|
+
let c = {
|
|
932
|
+
options: t,
|
|
933
|
+
api: n,
|
|
934
|
+
cdn: i,
|
|
935
|
+
root: Be(),
|
|
936
|
+
user: q,
|
|
937
|
+
console: new M(50),
|
|
938
|
+
network: new M(50),
|
|
939
|
+
breadcrumbs: new M(20),
|
|
940
|
+
replayStarting: !1,
|
|
941
|
+
replaySampled: !1,
|
|
942
|
+
consent: {
|
|
943
|
+
diagnostics: !1,
|
|
944
|
+
replay: !1,
|
|
945
|
+
...J
|
|
946
|
+
},
|
|
947
|
+
running: !1,
|
|
948
|
+
watchers: {},
|
|
949
|
+
counted: !1,
|
|
854
950
|
stopCapture: {},
|
|
855
951
|
onNavigate: [],
|
|
856
952
|
cleanups: [],
|
|
857
953
|
openWhenReady: !1,
|
|
858
954
|
alive: !0
|
|
859
955
|
};
|
|
860
|
-
|
|
861
|
-
let e =
|
|
862
|
-
|
|
956
|
+
K = c, q = void 0, J = void 0, Q(() => {
|
|
957
|
+
let e = dt(we(c.console));
|
|
958
|
+
c.stopCapture.console = e, c.cleanups.push(e);
|
|
863
959
|
}), Q(() => {
|
|
864
|
-
let
|
|
865
|
-
|
|
960
|
+
let e = dt(Ae(c.network, window, { ignore: (e) => e.startsWith(`${n}/v1/widget/`) || i !== null && (e.startsWith(g(i, t.key)) || e.startsWith(ae(n, t.key, i))) }));
|
|
961
|
+
c.stopCapture.network = e, c.cleanups.push(e);
|
|
866
962
|
});
|
|
867
|
-
let
|
|
963
|
+
let l = c.root.host;
|
|
868
964
|
Q(() => {
|
|
869
|
-
let e =
|
|
870
|
-
|
|
871
|
-
}),
|
|
872
|
-
|
|
965
|
+
let e = ve(c.breadcrumbs, { ignore: (e) => e instanceof Node && l.contains(e) });
|
|
966
|
+
c.onNavigate.push(e.navigated), c.cleanups.push(e.stop);
|
|
967
|
+
}), c.onNavigate.push(() => {
|
|
968
|
+
c.watchers.fixChecks?.navigated(), c.watchers.sightings?.navigated();
|
|
969
|
+
}), c.cleanups.push(() => {
|
|
970
|
+
bt(c), wt(c);
|
|
971
|
+
}), Q(() => c.cleanups.push(He(() => {
|
|
972
|
+
for (let e of c.onNavigate) try {
|
|
873
973
|
e();
|
|
874
974
|
} catch {}
|
|
875
975
|
})));
|
|
876
|
-
let
|
|
877
|
-
|
|
976
|
+
let u = () => {
|
|
977
|
+
tt(X, n, t.key).catch(() => {});
|
|
878
978
|
};
|
|
879
|
-
window.addEventListener("online",
|
|
880
|
-
if (!
|
|
881
|
-
if (!
|
|
979
|
+
window.addEventListener("online", u), c.cleanups.push(() => window.removeEventListener("online", u)), ee(X, n, t.key, i).then((i) => {
|
|
980
|
+
if (!c.alive) return;
|
|
981
|
+
if (!i) {
|
|
882
982
|
Z("this website key was not found");
|
|
883
983
|
return;
|
|
884
984
|
}
|
|
885
|
-
let
|
|
886
|
-
|
|
887
|
-
...
|
|
888
|
-
settings:
|
|
889
|
-
branding:
|
|
890
|
-
ai:
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
user: () => a.user,
|
|
904
|
-
opened: u ? Ve : void 0,
|
|
905
|
-
followUp: s.followUp ? ({ type: n, message: r }) => ae(X, t, e.key, {
|
|
906
|
-
type: n,
|
|
985
|
+
let l = r(i.ai, i.samplingRate), d = o(i.settings);
|
|
986
|
+
c.config = {
|
|
987
|
+
...i,
|
|
988
|
+
settings: d,
|
|
989
|
+
branding: e(i.branding),
|
|
990
|
+
ai: l,
|
|
991
|
+
known: a(i.known, d.knownIssues)
|
|
992
|
+
}, ft(c), c.replaySampled = l.replay && Math.random() < l.replaySampleRate, te(X, n, t.key, location.href), et(t.key) && u();
|
|
993
|
+
let f = It(i.allowedDomains, location.hostname);
|
|
994
|
+
if (i.enabled && !f && Z(`${location.hostname} isn't one of this website's allowed domains, so the button is hidden. Add it under Websites in Pinax.`), c.running = i.enabled && f, ht(c), !c.running) return;
|
|
995
|
+
let p = xt(c), m = rt(t.segment, c.config.settings.segment), h = new s(c.root, c.config, {
|
|
996
|
+
takeScreenshot: async () => (await je()).takeScreenshot(c.root.host, { autoBlur: l.autoBlur }),
|
|
997
|
+
markUp: async (e) => (await je()).markUp(c.root, e),
|
|
998
|
+
submit: (e) => Ot(c, e, m),
|
|
999
|
+
user: () => c.user,
|
|
1000
|
+
opened: m ? at : void 0,
|
|
1001
|
+
followUp: l.followUp ? ({ type: e, message: r }) => ie(X, n, t.key, {
|
|
1002
|
+
type: e,
|
|
907
1003
|
message: r,
|
|
908
1004
|
pagePath: location.pathname
|
|
909
|
-
}) : void 0
|
|
1005
|
+
}) : void 0,
|
|
1006
|
+
knownIssues: p,
|
|
1007
|
+
meToo: (e, r) => ce(X, n, t.key, e, r),
|
|
1008
|
+
attachments: () => Dt(c)
|
|
910
1009
|
});
|
|
911
|
-
|
|
912
|
-
let { hidePaths:
|
|
913
|
-
if (
|
|
914
|
-
let e = () =>
|
|
915
|
-
e(),
|
|
1010
|
+
c.ui = h;
|
|
1011
|
+
let { hidePaths: g, hideButton: _ } = c.config.settings;
|
|
1012
|
+
if (g.length && !_) {
|
|
1013
|
+
let e = () => h.setPathHidden(Ke(g, location.pathname));
|
|
1014
|
+
e(), c.onNavigate.push(e);
|
|
916
1015
|
}
|
|
917
|
-
|
|
1016
|
+
c.openWhenReady && h.open();
|
|
918
1017
|
}).catch((e) => {
|
|
919
|
-
|
|
1018
|
+
c.alive && Z("could not load widget settings", e);
|
|
920
1019
|
});
|
|
921
1020
|
}
|
|
922
|
-
function
|
|
1021
|
+
function dt(e) {
|
|
923
1022
|
let t = !1;
|
|
924
1023
|
return () => {
|
|
925
1024
|
t || (t = !0, e());
|
|
926
1025
|
};
|
|
927
1026
|
}
|
|
928
|
-
function
|
|
1027
|
+
function ft(e) {
|
|
929
1028
|
let t = e.config?.settings.capture;
|
|
930
1029
|
t && (t.console || (Q(() => e.stopCapture.console?.()), e.console.clear()), t.network || (Q(() => e.stopCapture.network?.()), e.network.clear()));
|
|
931
1030
|
}
|
|
932
|
-
function
|
|
1031
|
+
function pt(e) {
|
|
1032
|
+
let t = e.options.consent;
|
|
1033
|
+
return t === "wait" || t !== "none" && e.config?.settings.consent?.required === !0;
|
|
1034
|
+
}
|
|
1035
|
+
function mt(e) {
|
|
1036
|
+
return pt(e) || e.config?.settings.consent?.required === !0;
|
|
1037
|
+
}
|
|
1038
|
+
function $(e) {
|
|
1039
|
+
let t = pt(e);
|
|
1040
|
+
return {
|
|
1041
|
+
diagnostics: !t || e.consent.diagnostics,
|
|
1042
|
+
replay: !t || e.consent.replay
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
function ht(e) {
|
|
1046
|
+
try {
|
|
1047
|
+
gt(e);
|
|
1048
|
+
} catch (e) {
|
|
1049
|
+
Z("could not apply consent", e);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
function gt(e) {
|
|
1053
|
+
if (!e.alive || !e.config) return;
|
|
1054
|
+
let t = $(e);
|
|
1055
|
+
e.config.settings.consent?.required && t.diagnostics && !e.counted && (e.counted = !0, oe(X, e.api, e.options.key, e.cdn)), e.running && (t.diagnostics ? (vt(e), yt(e)) : bt(e), t.replay && e.replaySampled ? Ct(e) : wt(e)), e.ui?.refresh();
|
|
1056
|
+
}
|
|
1057
|
+
var _t = (e) => mt(e) && $(e).diagnostics ? !0 : void 0;
|
|
1058
|
+
function vt(e) {
|
|
933
1059
|
let t = e.config?.ai;
|
|
934
|
-
!t?.fixChecks.length
|
|
935
|
-
|
|
1060
|
+
!e.watchers.fixChecks && t?.fixChecks.length && (t.fixCheckSampleRate <= 0 || Q(() => {
|
|
1061
|
+
e.watchers.fixChecks = F({
|
|
936
1062
|
checks: t.fixChecks,
|
|
937
1063
|
sampleRate: t.fixCheckSampleRate,
|
|
938
1064
|
console: e.console,
|
|
939
1065
|
network: e.network,
|
|
940
|
-
|
|
1066
|
+
since: e.watchersSince,
|
|
1067
|
+
report: (t) => b(X, e.api, e.options.key, {
|
|
941
1068
|
checkId: t.id,
|
|
942
|
-
signature: t.signature
|
|
1069
|
+
signature: t.signature,
|
|
1070
|
+
consent: _t(e)
|
|
943
1071
|
})
|
|
944
1072
|
});
|
|
945
|
-
|
|
946
|
-
|
|
1073
|
+
}));
|
|
1074
|
+
}
|
|
1075
|
+
function yt(e) {
|
|
1076
|
+
let t = e.config?.ai;
|
|
1077
|
+
!e.watchers.sightings && t?.watches.length && (t.fixCheckSampleRate <= 0 || Q(() => {
|
|
1078
|
+
e.watchers.sightings = F({
|
|
1079
|
+
checks: t.watches.map((e) => ({
|
|
1080
|
+
...e,
|
|
1081
|
+
path: "*"
|
|
1082
|
+
})),
|
|
1083
|
+
sampleRate: t.fixCheckSampleRate,
|
|
1084
|
+
console: e.console,
|
|
1085
|
+
network: e.network,
|
|
1086
|
+
since: e.watchersSince,
|
|
1087
|
+
report: (t) => b(X, e.api, e.options.key, {
|
|
1088
|
+
checkId: t.id,
|
|
1089
|
+
signature: t.signature,
|
|
1090
|
+
basket: Y,
|
|
1091
|
+
consent: _t(e)
|
|
1092
|
+
}, "sighting")
|
|
1093
|
+
});
|
|
1094
|
+
}));
|
|
1095
|
+
}
|
|
1096
|
+
function bt(e) {
|
|
1097
|
+
let { fixChecks: t, sightings: n } = e.watchers;
|
|
1098
|
+
(t || n) && (e.watchers = {}, e.watchersSince = Date.now() + 2, Q(() => t?.stop()), Q(() => n?.stop()));
|
|
1099
|
+
}
|
|
1100
|
+
function xt(e) {
|
|
1101
|
+
let t = e.config?.known;
|
|
1102
|
+
if (!t?.length) return;
|
|
1103
|
+
let n;
|
|
1104
|
+
return Q(() => {
|
|
1105
|
+
let r = Re({
|
|
1106
|
+
known: t,
|
|
1107
|
+
console: e.console,
|
|
1108
|
+
network: e.network
|
|
1109
|
+
});
|
|
1110
|
+
e.onNavigate.push(r.navigated), e.cleanups.push(r.stop), n = r.matches;
|
|
1111
|
+
}), n;
|
|
947
1112
|
}
|
|
948
|
-
function
|
|
1113
|
+
function St(e) {
|
|
949
1114
|
let t = () => {
|
|
950
1115
|
let t = window.requestIdleCallback;
|
|
951
1116
|
typeof t == "function" ? t(e, { timeout: 3e3 }) : setTimeout(e, 200);
|
|
952
1117
|
};
|
|
953
1118
|
document.readyState === "complete" ? t() : window.addEventListener("load", t, { once: !0 });
|
|
954
1119
|
}
|
|
955
|
-
function
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1120
|
+
function Ct(e) {
|
|
1121
|
+
if (e.recorder || e.replayStarting) return;
|
|
1122
|
+
e.replayStarting = !0;
|
|
1123
|
+
let t = () => e.alive && e.running && e.replaySampled && $(e).replay;
|
|
1124
|
+
St(() => {
|
|
1125
|
+
t() ? Me().then((n) => {
|
|
1126
|
+
e.replayStarting = !1, !e.recorder && t() && (e.recorder = n.startRecorder({
|
|
1127
|
+
exclude: `#${e.root.host.id}`,
|
|
1128
|
+
mask: e.config?.ai?.replayMask
|
|
1129
|
+
}), e.ui?.refresh());
|
|
1130
|
+
}).catch((t) => {
|
|
1131
|
+
e.replayStarting = !1, Z("session replay could not start", t);
|
|
1132
|
+
}) : e.replayStarting = !1;
|
|
962
1133
|
});
|
|
963
1134
|
}
|
|
964
|
-
|
|
1135
|
+
function wt(e) {
|
|
1136
|
+
let t = e.recorder;
|
|
1137
|
+
e.recorder = void 0, t && Q(() => t.stop());
|
|
1138
|
+
}
|
|
1139
|
+
async function Tt(e) {
|
|
965
1140
|
if (!e.recorder) return null;
|
|
1141
|
+
let n;
|
|
1142
|
+
try {
|
|
1143
|
+
return await Promise.race([e.recorder.exportReplay(t.replayChars).catch(() => null), new Promise((e) => {
|
|
1144
|
+
n = setTimeout(() => e(null), 5e3);
|
|
1145
|
+
})]);
|
|
1146
|
+
} finally {
|
|
1147
|
+
clearTimeout(n);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
async function Et(e) {
|
|
966
1151
|
let t;
|
|
967
1152
|
try {
|
|
968
|
-
return await Promise.race([
|
|
969
|
-
t = setTimeout(() => e(null),
|
|
1153
|
+
return await Promise.race([Ne().then((t) => t.scanPage({ exclude: `#${e.root.host.id}` })).catch(() => null), new Promise((e) => {
|
|
1154
|
+
t = setTimeout(() => e(null), ct);
|
|
970
1155
|
})]);
|
|
971
1156
|
} finally {
|
|
972
1157
|
clearTimeout(t);
|
|
973
1158
|
}
|
|
974
1159
|
}
|
|
975
|
-
|
|
976
|
-
let
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1160
|
+
function Dt(e) {
|
|
1161
|
+
let t = $(e), n = e.config?.settings.capture, r = n?.console !== !1, i = n?.network !== !1;
|
|
1162
|
+
return {
|
|
1163
|
+
logs: t.diagnostics && (r && e.console.size > 0 || i && e.network.size > 0 || e.breadcrumbs.size > 0),
|
|
1164
|
+
askLogs: !t.diagnostics && (r || i),
|
|
1165
|
+
replay: t.replay && !!e.recorder && typeof CompressionStream == "function"
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
async function Ot(e, t, r = !1) {
|
|
1169
|
+
let a = t.type === "ACCESSIBILITY" ? await Et(e) : void 0, o = $(e), s = (o.diagnostics || t.includeLogs === !0) && t.listed?.logs !== !1, l = o.replay && t.listed?.replay !== !1, u = r && o.diagnostics && !e.user?.id ? st() : null, d = u ? {
|
|
1170
|
+
...e.user,
|
|
1171
|
+
id: u
|
|
1172
|
+
} : e.user, f = e.config?.settings.capture, p = c({
|
|
1173
|
+
type: t.type,
|
|
1174
|
+
message: t.message,
|
|
1175
|
+
rating: t.rating,
|
|
1176
|
+
email: t.email,
|
|
1177
|
+
user: d,
|
|
1178
|
+
screenshot: t.shot?.dataUrl,
|
|
1179
|
+
annotations: t.shot?.annotations,
|
|
1180
|
+
followUp: t.followUp,
|
|
1181
|
+
fields: t.fields,
|
|
1182
|
+
barrier: t.barrier,
|
|
1183
|
+
a11yScan: a,
|
|
1184
|
+
hp: t.hp,
|
|
1185
|
+
elapsedMs: t.elapsedMs,
|
|
1186
|
+
consent: mt(e) ? o : void 0,
|
|
1187
|
+
includeLogs: t.includeLogs
|
|
991
1188
|
}, {
|
|
992
1189
|
page: {
|
|
993
|
-
url:
|
|
1190
|
+
url: n(location.href),
|
|
994
1191
|
title: document.title || void 0
|
|
995
1192
|
},
|
|
996
|
-
environment:
|
|
997
|
-
console:
|
|
998
|
-
network:
|
|
999
|
-
breadcrumbs:
|
|
1193
|
+
environment: Oe(),
|
|
1194
|
+
console: !s || f?.console === !1 ? [] : e.console.toArray(),
|
|
1195
|
+
network: !s || f?.network === !1 ? [] : e.network.toArray(),
|
|
1196
|
+
breadcrumbs: s ? e.breadcrumbs.toArray() : []
|
|
1000
1197
|
});
|
|
1001
|
-
|
|
1002
|
-
let
|
|
1003
|
-
|
|
1004
|
-
type:
|
|
1005
|
-
rating:
|
|
1006
|
-
reportId:
|
|
1198
|
+
l && i(p, await Tt(e));
|
|
1199
|
+
let m = await y(X, e.api, e.options.key, p), h = (e, n) => {
|
|
1200
|
+
r && ot({
|
|
1201
|
+
type: t.type,
|
|
1202
|
+
rating: t.rating,
|
|
1203
|
+
reportId: n,
|
|
1007
1204
|
queued: e
|
|
1008
1205
|
});
|
|
1009
1206
|
};
|
|
1010
|
-
return
|
|
1207
|
+
return m.ok ? (h(!1, m.id || void 0), { status: "sent" }) : m.retry && $e(e.options.key, p) ? (h(!0), { status: "queued" }) : {
|
|
1011
1208
|
status: "error",
|
|
1012
|
-
message:
|
|
1209
|
+
message: m.message
|
|
1013
1210
|
};
|
|
1014
1211
|
}
|
|
1015
|
-
function
|
|
1016
|
-
|
|
1212
|
+
function kt() {
|
|
1213
|
+
K ? K.ui ? K.ui.open() : K.config || (K.openWhenReady = !0) : Z("call init() before open()");
|
|
1214
|
+
}
|
|
1215
|
+
function At(e) {
|
|
1216
|
+
let t;
|
|
1217
|
+
if (typeof e == "boolean") t = {
|
|
1218
|
+
diagnostics: e,
|
|
1219
|
+
replay: e
|
|
1220
|
+
};
|
|
1221
|
+
else if (e && typeof e == "object") {
|
|
1222
|
+
t = {};
|
|
1223
|
+
for (let n of ["diagnostics", "replay"]) e[n] !== void 0 && (t[n] = e[n] === !0);
|
|
1224
|
+
} else {
|
|
1225
|
+
Z("consent() takes true, false or { diagnostics, replay }");
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
K ? (K.consent = {
|
|
1229
|
+
...K.consent,
|
|
1230
|
+
...t
|
|
1231
|
+
}, ht(K)) : J = {
|
|
1232
|
+
...J,
|
|
1233
|
+
...t
|
|
1234
|
+
};
|
|
1017
1235
|
}
|
|
1018
|
-
function
|
|
1236
|
+
function jt(e) {
|
|
1019
1237
|
let t = e ? { ...e } : void 0;
|
|
1020
|
-
|
|
1238
|
+
K ? K.user = t : q = t;
|
|
1239
|
+
}
|
|
1240
|
+
function Mt(e) {
|
|
1241
|
+
Y = Nt(e);
|
|
1242
|
+
}
|
|
1243
|
+
function Nt(e) {
|
|
1244
|
+
if (!e || typeof e != "object") return;
|
|
1245
|
+
let { value: t, currency: n } = e, r = typeof n == "string" ? n.trim().toUpperCase() : "";
|
|
1246
|
+
if (!(typeof t != "number" || !Number.isFinite(t) || t <= 0 || t > 1e7 || !/^[A-Z]{3}$/.test(r))) return {
|
|
1247
|
+
value: Math.round(t * 100) / 100,
|
|
1248
|
+
currency: r
|
|
1249
|
+
};
|
|
1021
1250
|
}
|
|
1022
|
-
function
|
|
1023
|
-
if (
|
|
1024
|
-
|
|
1025
|
-
for (let e of
|
|
1251
|
+
function Pt() {
|
|
1252
|
+
if (K) {
|
|
1253
|
+
K.alive = !1, K.ui?.destroy();
|
|
1254
|
+
for (let e of K.cleanups.reverse()) try {
|
|
1026
1255
|
e();
|
|
1027
1256
|
} catch {}
|
|
1028
1257
|
}
|
|
1029
|
-
|
|
1258
|
+
Ve(), K = null, q = void 0, J = void 0, Y = void 0;
|
|
1030
1259
|
}
|
|
1031
|
-
function
|
|
1032
|
-
return
|
|
1260
|
+
function Ft() {
|
|
1261
|
+
return K;
|
|
1033
1262
|
}
|
|
1034
|
-
function
|
|
1263
|
+
function It(e, t) {
|
|
1035
1264
|
if (!e) return !0;
|
|
1036
1265
|
let n = t.toLowerCase();
|
|
1037
1266
|
return e.some((e) => e.toLowerCase() === n);
|
|
1038
1267
|
}
|
|
1039
|
-
export {
|
|
1268
|
+
export { Nt as cleanBasket, At as consent, Pt as destroy, Ft as getState, jt as identify, ut as init, kt as open, Mt as setBasket };
|
|
1040
1269
|
|
|
1041
1270
|
//# sourceMappingURL=pinax.mjs.map
|