@mushi-mushi/web 1.23.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +10 -2
- package/README.md +6 -6
- package/SECURITY.md +24 -1
- package/dist/i18n/index.cjs +8 -4
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +1 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +8 -4
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +160 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +160 -39
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +193 -180
- package/dist/mushi.loader.global.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -61,6 +61,10 @@ interface WidgetSubmitOutcome {
|
|
|
61
61
|
* optimistic copy ("queued offline, we'll send it when you're back")
|
|
62
62
|
* versus the confirmed copy ("received — track at #abc12345"). */
|
|
63
63
|
queuedOffline?: boolean;
|
|
64
|
+
/** The report went through but its screenshot had to be shed (couldn't
|
|
65
|
+
* compress under the wire budget, or the server said PAYLOAD_TOO_LARGE).
|
|
66
|
+
* The success receipt says so instead of implying the image landed. */
|
|
67
|
+
screenshotDropped?: boolean;
|
|
64
68
|
}
|
|
65
69
|
interface WidgetCallbacks {
|
|
66
70
|
/**
|
|
@@ -217,6 +221,7 @@ declare class MushiWidget {
|
|
|
217
221
|
* Drives a different success copy so the user knows the report
|
|
218
222
|
* hasn't actually reached the console yet. */
|
|
219
223
|
private lastSubmitQueuedOffline;
|
|
224
|
+
private lastSubmitScreenshotDropped;
|
|
220
225
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
221
226
|
private bannerDismissed;
|
|
222
227
|
private bannerResizeObserver;
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,10 @@ interface WidgetSubmitOutcome {
|
|
|
61
61
|
* optimistic copy ("queued offline, we'll send it when you're back")
|
|
62
62
|
* versus the confirmed copy ("received — track at #abc12345"). */
|
|
63
63
|
queuedOffline?: boolean;
|
|
64
|
+
/** The report went through but its screenshot had to be shed (couldn't
|
|
65
|
+
* compress under the wire budget, or the server said PAYLOAD_TOO_LARGE).
|
|
66
|
+
* The success receipt says so instead of implying the image landed. */
|
|
67
|
+
screenshotDropped?: boolean;
|
|
64
68
|
}
|
|
65
69
|
interface WidgetCallbacks {
|
|
66
70
|
/**
|
|
@@ -217,6 +221,7 @@ declare class MushiWidget {
|
|
|
217
221
|
* Drives a different success copy so the user knows the report
|
|
218
222
|
* hasn't actually reached the console yet. */
|
|
219
223
|
private lastSubmitQueuedOffline;
|
|
224
|
+
private lastSubmitScreenshotDropped;
|
|
220
225
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
221
226
|
private bannerDismissed;
|
|
222
227
|
private bannerResizeObserver;
|
package/dist/index.js
CHANGED
|
@@ -195,7 +195,8 @@ var en = {
|
|
|
195
195
|
queuedOffline: "Queued offline",
|
|
196
196
|
queuedHint: "We'll send it the moment you're back online.",
|
|
197
197
|
trackOnMushi: "Track on Mushi",
|
|
198
|
-
slaDefault: "We will review your report."
|
|
198
|
+
slaDefault: "We will review your report.",
|
|
199
|
+
screenshotDropped: "Sent without the screenshot \u2014 it was too large to attach."
|
|
199
200
|
},
|
|
200
201
|
featureRequest: {
|
|
201
202
|
label: "Feature request",
|
|
@@ -364,7 +365,8 @@ var ja = {
|
|
|
364
365
|
queuedOffline: "\u30AA\u30D5\u30E9\u30A4\u30F3\u5F85\u6A5F\u4E2D",
|
|
365
366
|
queuedHint: "\u30AA\u30F3\u30E9\u30A4\u30F3\u306B\u623B\u308A\u6B21\u7B2C\u9001\u4FE1\u3057\u307E\u3059\u3002",
|
|
366
367
|
trackOnMushi: "Mushi\u3067\u8FFD\u8DE1",
|
|
367
|
-
slaDefault: "\u30EC\u30DD\u30FC\u30C8\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002"
|
|
368
|
+
slaDefault: "\u30EC\u30DD\u30FC\u30C8\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002",
|
|
369
|
+
screenshotDropped: "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306F\u30B5\u30A4\u30BA\u8D85\u904E\u306E\u305F\u3081\u6DFB\u4ED8\u3067\u304D\u305A\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u307F\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002"
|
|
368
370
|
},
|
|
369
371
|
featureRequest: {
|
|
370
372
|
label: "\u6A5F\u80FD\u30EA\u30AF\u30A8\u30B9\u30C8",
|
|
@@ -533,7 +535,8 @@ var th = {
|
|
|
533
535
|
queuedOffline: "\u0E04\u0E34\u0E27\u0E2D\u0E2D\u0E1F\u0E44\u0E25\u0E19\u0E4C",
|
|
534
536
|
queuedHint: "\u0E08\u0E30\u0E2A\u0E48\u0E07\u0E17\u0E31\u0E19\u0E17\u0E35\u0E17\u0E35\u0E48\u0E04\u0E38\u0E13\u0E01\u0E25\u0E31\u0E1A\u0E21\u0E32\u0E2D\u0E2D\u0E19\u0E44\u0E25\u0E19\u0E4C",
|
|
535
537
|
trackOnMushi: "\u0E15\u0E34\u0E14\u0E15\u0E32\u0E21\u0E1A\u0E19 Mushi",
|
|
536
|
-
slaDefault: "\u0E40\u0E23\u0E32\u0E08\u0E30\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13"
|
|
538
|
+
slaDefault: "\u0E40\u0E23\u0E32\u0E08\u0E30\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13",
|
|
539
|
+
screenshotDropped: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E42\u0E14\u0E22\u0E44\u0E21\u0E48\u0E21\u0E35\u0E20\u0E32\u0E1E\u0E2B\u0E19\u0E49\u0E32\u0E08\u0E2D \u2014 \u0E44\u0E1F\u0E25\u0E4C\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19\u0E01\u0E27\u0E48\u0E32\u0E08\u0E30\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49"
|
|
537
540
|
},
|
|
538
541
|
featureRequest: {
|
|
539
542
|
label: "\u0E02\u0E2D\u0E1F\u0E35\u0E40\u0E08\u0E2D\u0E23\u0E4C",
|
|
@@ -702,7 +705,8 @@ var es = {
|
|
|
702
705
|
queuedOffline: "En cola sin conexi\xF3n",
|
|
703
706
|
queuedHint: "Lo enviaremos en cuanto vuelvas a estar en l\xEDnea.",
|
|
704
707
|
trackOnMushi: "Seguir en Mushi",
|
|
705
|
-
slaDefault: "Revisaremos tu reporte."
|
|
708
|
+
slaDefault: "Revisaremos tu reporte.",
|
|
709
|
+
screenshotDropped: "Enviado sin la captura de pantalla \u2014 era demasiado grande para adjuntarla."
|
|
706
710
|
},
|
|
707
711
|
featureRequest: {
|
|
708
712
|
label: "Solicitud de funci\xF3n",
|
|
@@ -2555,7 +2559,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2555
2559
|
|
|
2556
2560
|
// src/version.ts
|
|
2557
2561
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
2558
|
-
var MUSHI_SDK_VERSION = "1.
|
|
2562
|
+
var MUSHI_SDK_VERSION = "1.24.0" ;
|
|
2559
2563
|
var CATEGORY_ICONS = {
|
|
2560
2564
|
bug: "\u26A0\uFE0F",
|
|
2561
2565
|
slow: "\u{1F40C}",
|
|
@@ -3394,6 +3398,11 @@ function renderSuccessReceipt(ctx) {
|
|
|
3394
3398
|
const idShort = `#${ctx.lastReportId.slice(0, 8)}`;
|
|
3395
3399
|
const dashboard = (ctx.config.dashboardUrl ?? "").replace(/\/$/, "");
|
|
3396
3400
|
const trackHref = dashboard ? `${dashboard}/reports/${encodeURIComponent(ctx.lastReportId)}` : "";
|
|
3401
|
+
const screenshotDroppedNote = ctx.lastSubmitScreenshotDropped ? `
|
|
3402
|
+
<div class="mushi-success-receipt-row mushi-success-receipt-warn">
|
|
3403
|
+
<span class="mushi-success-receipt-hint">${escapeHtml(s.screenshotDropped)}</span>
|
|
3404
|
+
</div>
|
|
3405
|
+
` : "";
|
|
3397
3406
|
return `
|
|
3398
3407
|
<div class="mushi-success-receipt" role="status">
|
|
3399
3408
|
<div class="mushi-success-receipt-row">
|
|
@@ -3415,6 +3424,7 @@ function renderSuccessReceipt(ctx) {
|
|
|
3415
3424
|
rel="noopener noreferrer"
|
|
3416
3425
|
>${escapeHtml(s.trackOnMushi)} <span aria-hidden="true">\u2197</span></a>
|
|
3417
3426
|
` : ""}
|
|
3427
|
+
${screenshotDroppedNote}
|
|
3418
3428
|
${renderSlaLine(ctx)}
|
|
3419
3429
|
</div>
|
|
3420
3430
|
`;
|
|
@@ -3644,6 +3654,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3644
3654
|
* Drives a different success copy so the user knows the report
|
|
3645
3655
|
* hasn't actually reached the console yet. */
|
|
3646
3656
|
lastSubmitQueuedOffline = false;
|
|
3657
|
+
lastSubmitScreenshotDropped = false;
|
|
3647
3658
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
3648
3659
|
bannerDismissed = false;
|
|
3649
3660
|
bannerResizeObserver = null;
|
|
@@ -3787,6 +3798,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3787
3798
|
this.removeSelectorHint();
|
|
3788
3799
|
this.lastReportId = null;
|
|
3789
3800
|
this.lastSubmitQueuedOffline = false;
|
|
3801
|
+
this.lastSubmitScreenshotDropped = false;
|
|
3790
3802
|
this.viaFeatureRequest = false;
|
|
3791
3803
|
this.clearFormDrafts();
|
|
3792
3804
|
if (options?.featureRequest) {
|
|
@@ -4919,6 +4931,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4919
4931
|
leaderboardLoading: this.leaderboardLoading,
|
|
4920
4932
|
leaderboardEntries: this.leaderboardEntries,
|
|
4921
4933
|
lastSubmitQueuedOffline: this.lastSubmitQueuedOffline,
|
|
4934
|
+
lastSubmitScreenshotDropped: this.lastSubmitScreenshotDropped,
|
|
4922
4935
|
featureBoard: this.featureBoard,
|
|
4923
4936
|
crossAppReports: this.crossAppReports,
|
|
4924
4937
|
allowScreenshotRemove: this.allowScreenshotRemove,
|
|
@@ -5202,6 +5215,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5202
5215
|
this.submittedAt = /* @__PURE__ */ new Date();
|
|
5203
5216
|
this.lastReportId = null;
|
|
5204
5217
|
this.lastSubmitQueuedOffline = false;
|
|
5218
|
+
this.lastSubmitScreenshotDropped = false;
|
|
5205
5219
|
this.render();
|
|
5206
5220
|
const outcomeP = (async () => {
|
|
5207
5221
|
try {
|
|
@@ -5234,6 +5248,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5234
5248
|
if (outcome) {
|
|
5235
5249
|
this.lastReportId = outcome.reportId ?? null;
|
|
5236
5250
|
this.lastSubmitQueuedOffline = Boolean(outcome.queuedOffline);
|
|
5251
|
+
this.lastSubmitScreenshotDropped = Boolean(outcome.screenshotDropped);
|
|
5237
5252
|
this.render();
|
|
5238
5253
|
}
|
|
5239
5254
|
if (this.autoCloseTimer !== null) {
|
|
@@ -6310,25 +6325,32 @@ function createScreenshotCapture(options = {}) {
|
|
|
6310
6325
|
const blob = new Blob([svgData], { type: "image/svg+xml;charset=utf-8" });
|
|
6311
6326
|
const url = URL.createObjectURL(blob);
|
|
6312
6327
|
return new Promise((resolve) => {
|
|
6328
|
+
let settled = false;
|
|
6329
|
+
const settle = (value, reason) => {
|
|
6330
|
+
if (settled) return;
|
|
6331
|
+
settled = true;
|
|
6332
|
+
clearTimeout(timer);
|
|
6333
|
+
URL.revokeObjectURL(url);
|
|
6334
|
+
if (reason) {
|
|
6335
|
+
activeOptions.onFailed?.(reason);
|
|
6336
|
+
emitScreenshotFailed(reason);
|
|
6337
|
+
}
|
|
6338
|
+
resolve(value);
|
|
6339
|
+
};
|
|
6340
|
+
const timer = setTimeout(() => settle(null, "error"), 5e3);
|
|
6313
6341
|
img.onload = () => {
|
|
6314
6342
|
try {
|
|
6315
6343
|
ctx.drawImage(img, 0, 0, width, height);
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6344
|
+
if (isCanvasBlank(ctx, width, height)) {
|
|
6345
|
+
settle(null, "error");
|
|
6346
|
+
return;
|
|
6347
|
+
}
|
|
6348
|
+
settle(canvas.toDataURL("image/jpeg", 0.7));
|
|
6319
6349
|
} catch {
|
|
6320
|
-
|
|
6321
|
-
activeOptions.onFailed?.("taint");
|
|
6322
|
-
emitScreenshotFailed("taint");
|
|
6323
|
-
resolve(null);
|
|
6350
|
+
settle(null, "taint");
|
|
6324
6351
|
}
|
|
6325
6352
|
};
|
|
6326
|
-
img.onerror = () =>
|
|
6327
|
-
URL.revokeObjectURL(url);
|
|
6328
|
-
activeOptions.onFailed?.("error");
|
|
6329
|
-
emitScreenshotFailed("error");
|
|
6330
|
-
resolve(null);
|
|
6331
|
-
};
|
|
6353
|
+
img.onerror = () => settle(null, "error");
|
|
6332
6354
|
img.src = url;
|
|
6333
6355
|
});
|
|
6334
6356
|
} catch {
|
|
@@ -6358,6 +6380,7 @@ function buildPrivacySafeDocument(privacy) {
|
|
|
6358
6380
|
const clone = document.documentElement.cloneNode(true);
|
|
6359
6381
|
clone.querySelector("#mushi-mushi-widget")?.remove();
|
|
6360
6382
|
stripTaintSources(clone);
|
|
6383
|
+
inlineDocumentStyles(clone);
|
|
6361
6384
|
const redactSelectors = privacy?.redactSelectors !== void 0 ? privacy.redactSelectors : DEFAULT_REDACT_SELECTORS;
|
|
6362
6385
|
for (const selector of redactSelectors) {
|
|
6363
6386
|
for (const el of safeQueryAll(clone, selector)) {
|
|
@@ -6402,8 +6425,7 @@ function stripTaintSources(root) {
|
|
|
6402
6425
|
el.remove();
|
|
6403
6426
|
}
|
|
6404
6427
|
for (const link of root.querySelectorAll('link[rel="stylesheet"], link[as="style"]')) {
|
|
6405
|
-
|
|
6406
|
-
if (!href || isCrossOriginUrl(href, pageOrigin)) link.remove();
|
|
6428
|
+
link.remove();
|
|
6407
6429
|
}
|
|
6408
6430
|
for (const styleEl of root.querySelectorAll("style")) {
|
|
6409
6431
|
const cleaned = stripCssUrlRefs(styleEl.textContent ?? "", pageOrigin);
|
|
@@ -6427,6 +6449,56 @@ function stripCssUrlRefs(css, pageOrigin) {
|
|
|
6427
6449
|
return _match;
|
|
6428
6450
|
});
|
|
6429
6451
|
}
|
|
6452
|
+
function inlineDocumentStyles(clone) {
|
|
6453
|
+
const pageOrigin = typeof location !== "undefined" ? location.origin : "";
|
|
6454
|
+
const chunks = [];
|
|
6455
|
+
const sheets = [
|
|
6456
|
+
...Array.from(document.styleSheets),
|
|
6457
|
+
...document.adoptedStyleSheets ?? []
|
|
6458
|
+
];
|
|
6459
|
+
for (const sheet of sheets) {
|
|
6460
|
+
const owner = sheet.ownerNode;
|
|
6461
|
+
if (owner instanceof Element && owner.tagName === "STYLE") continue;
|
|
6462
|
+
chunks.push(serializeSheet(sheet));
|
|
6463
|
+
}
|
|
6464
|
+
const css = stripCssUrlRefs(chunks.filter(Boolean).join("\n"), pageOrigin);
|
|
6465
|
+
if (!css) return;
|
|
6466
|
+
const styleEl = document.createElement("style");
|
|
6467
|
+
styleEl.textContent = css;
|
|
6468
|
+
(clone.querySelector("head") ?? clone).appendChild(styleEl);
|
|
6469
|
+
}
|
|
6470
|
+
function serializeSheet(sheet) {
|
|
6471
|
+
let rules;
|
|
6472
|
+
try {
|
|
6473
|
+
rules = sheet.cssRules;
|
|
6474
|
+
} catch {
|
|
6475
|
+
return "";
|
|
6476
|
+
}
|
|
6477
|
+
let text = "";
|
|
6478
|
+
for (const rule of Array.from(rules)) {
|
|
6479
|
+
if (rule instanceof CSSImportRule) {
|
|
6480
|
+
if (rule.styleSheet) text += serializeSheet(rule.styleSheet);
|
|
6481
|
+
continue;
|
|
6482
|
+
}
|
|
6483
|
+
text += `${rule.cssText}
|
|
6484
|
+
`;
|
|
6485
|
+
}
|
|
6486
|
+
return text;
|
|
6487
|
+
}
|
|
6488
|
+
function isCanvasBlank(ctx, width, height) {
|
|
6489
|
+
try {
|
|
6490
|
+
const stepX = Math.max(1, Math.floor(width / 8));
|
|
6491
|
+
const stepY = Math.max(1, Math.floor(height / 8));
|
|
6492
|
+
for (let y = 0; y < height; y += stepY) {
|
|
6493
|
+
for (let x = 0; x < width; x += stepX) {
|
|
6494
|
+
if (ctx.getImageData(x, y, 1, 1).data[3] !== 0) return false;
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
return true;
|
|
6498
|
+
} catch {
|
|
6499
|
+
return false;
|
|
6500
|
+
}
|
|
6501
|
+
}
|
|
6430
6502
|
function isCrossOriginUrl(raw, pageOrigin) {
|
|
6431
6503
|
if (!raw || raw.startsWith("data:") || raw.startsWith("blob:")) return false;
|
|
6432
6504
|
try {
|
|
@@ -6583,6 +6655,8 @@ function createPerformanceCapture() {
|
|
|
6583
6655
|
function createElementSelector() {
|
|
6584
6656
|
let active = false;
|
|
6585
6657
|
let overlay = null;
|
|
6658
|
+
let captureLayer = null;
|
|
6659
|
+
let hoveredElement = null;
|
|
6586
6660
|
let resolvePromise = null;
|
|
6587
6661
|
function findNearestTestid(el) {
|
|
6588
6662
|
let cur = el;
|
|
@@ -6613,10 +6687,11 @@ function createElementSelector() {
|
|
|
6613
6687
|
}
|
|
6614
6688
|
function captureElement(el) {
|
|
6615
6689
|
const rect = el.getBoundingClientRect();
|
|
6690
|
+
const className = typeof el.className === "string" ? el.className : el.getAttribute("class") ?? "";
|
|
6616
6691
|
return {
|
|
6617
6692
|
tagName: el.tagName.toLowerCase(),
|
|
6618
6693
|
id: el.id || void 0,
|
|
6619
|
-
className:
|
|
6694
|
+
className: className || void 0,
|
|
6620
6695
|
textContent: el.textContent?.trim().slice(0, 200) || void 0,
|
|
6621
6696
|
xpath: getXPath(el),
|
|
6622
6697
|
rect: {
|
|
@@ -6648,6 +6723,36 @@ function createElementSelector() {
|
|
|
6648
6723
|
document.body.appendChild(el);
|
|
6649
6724
|
return el;
|
|
6650
6725
|
}
|
|
6726
|
+
function createCaptureLayer() {
|
|
6727
|
+
const el = document.createElement("div");
|
|
6728
|
+
el.style.cssText = `
|
|
6729
|
+
position: fixed;
|
|
6730
|
+
inset: 0;
|
|
6731
|
+
z-index: 2147483647;
|
|
6732
|
+
cursor: crosshair;
|
|
6733
|
+
background: transparent;
|
|
6734
|
+
`;
|
|
6735
|
+
document.body.appendChild(el);
|
|
6736
|
+
return el;
|
|
6737
|
+
}
|
|
6738
|
+
function resolveTargetAt(x, y) {
|
|
6739
|
+
const stack = document.elementsFromPoint(x, y);
|
|
6740
|
+
let target = null;
|
|
6741
|
+
for (const el of stack) {
|
|
6742
|
+
if (el === captureLayer || el === overlay) continue;
|
|
6743
|
+
if (el.id === "mushi-mushi-widget" || el.closest("#mushi-mushi-widget")) return null;
|
|
6744
|
+
target = el;
|
|
6745
|
+
break;
|
|
6746
|
+
}
|
|
6747
|
+
let hops = 0;
|
|
6748
|
+
while (target?.shadowRoot && hops < 20) {
|
|
6749
|
+
const inner = target.shadowRoot.elementFromPoint(x, y);
|
|
6750
|
+
if (!inner || inner === target) break;
|
|
6751
|
+
target = inner;
|
|
6752
|
+
hops++;
|
|
6753
|
+
}
|
|
6754
|
+
return target;
|
|
6755
|
+
}
|
|
6651
6756
|
function positionOverlay(target) {
|
|
6652
6757
|
if (!overlay) return;
|
|
6653
6758
|
const rect = target.getBoundingClientRect();
|
|
@@ -6658,28 +6763,34 @@ function createElementSelector() {
|
|
|
6658
6763
|
overlay.style.display = "block";
|
|
6659
6764
|
}
|
|
6660
6765
|
function handleMouseMove(e) {
|
|
6661
|
-
const target = e.
|
|
6662
|
-
if (target
|
|
6766
|
+
const target = resolveTargetAt(e.clientX, e.clientY);
|
|
6767
|
+
if (!target) {
|
|
6768
|
+
hoveredElement = null;
|
|
6769
|
+
if (overlay) overlay.style.display = "none";
|
|
6770
|
+
return;
|
|
6771
|
+
}
|
|
6772
|
+
hoveredElement = target;
|
|
6663
6773
|
positionOverlay(target);
|
|
6664
6774
|
}
|
|
6775
|
+
function swallow(e) {
|
|
6776
|
+
e.preventDefault();
|
|
6777
|
+
e.stopPropagation();
|
|
6778
|
+
}
|
|
6665
6779
|
function handleClick(e) {
|
|
6666
6780
|
e.preventDefault();
|
|
6667
6781
|
e.stopPropagation();
|
|
6668
|
-
const target = e.
|
|
6669
|
-
if (target
|
|
6670
|
-
|
|
6671
|
-
const hitsMushiHost = path.some(
|
|
6672
|
-
(node) => node instanceof Element && node.id === "mushi-mushi-widget"
|
|
6673
|
-
);
|
|
6674
|
-
if (hitsMushiHost) return;
|
|
6675
|
-
const captured = captureElement(target);
|
|
6676
|
-
finish(captured);
|
|
6782
|
+
const target = resolveTargetAt(e.clientX, e.clientY);
|
|
6783
|
+
if (!target) return;
|
|
6784
|
+
finish(captureElement(target));
|
|
6677
6785
|
}
|
|
6678
6786
|
function handleKeyDown(e) {
|
|
6679
6787
|
if (e.key === "Escape") {
|
|
6680
6788
|
finish(null);
|
|
6681
6789
|
}
|
|
6682
6790
|
}
|
|
6791
|
+
function handleScroll() {
|
|
6792
|
+
if (hoveredElement?.isConnected) positionOverlay(hoveredElement);
|
|
6793
|
+
}
|
|
6683
6794
|
function finish(result) {
|
|
6684
6795
|
deactivate();
|
|
6685
6796
|
resolvePromise?.(result);
|
|
@@ -6691,19 +6802,26 @@ function createElementSelector() {
|
|
|
6691
6802
|
resolvePromise = resolve;
|
|
6692
6803
|
active = true;
|
|
6693
6804
|
overlay = createOverlay();
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6805
|
+
captureLayer = createCaptureLayer();
|
|
6806
|
+
captureLayer.addEventListener("mousemove", handleMouseMove);
|
|
6807
|
+
captureLayer.addEventListener("click", handleClick);
|
|
6808
|
+
captureLayer.addEventListener("pointerdown", swallow);
|
|
6809
|
+
captureLayer.addEventListener("mousedown", swallow);
|
|
6810
|
+
captureLayer.addEventListener("mouseup", swallow);
|
|
6697
6811
|
document.addEventListener("keydown", handleKeyDown, true);
|
|
6812
|
+
window.addEventListener("scroll", handleScroll, { capture: true, passive: true });
|
|
6698
6813
|
});
|
|
6699
6814
|
}
|
|
6700
6815
|
function deactivate() {
|
|
6701
6816
|
if (!active) return;
|
|
6702
6817
|
active = false;
|
|
6703
|
-
|
|
6704
|
-
document.removeEventListener("mousemove", handleMouseMove, true);
|
|
6705
|
-
document.removeEventListener("click", handleClick, true);
|
|
6818
|
+
hoveredElement = null;
|
|
6706
6819
|
document.removeEventListener("keydown", handleKeyDown, true);
|
|
6820
|
+
window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
6821
|
+
if (captureLayer) {
|
|
6822
|
+
captureLayer.remove();
|
|
6823
|
+
captureLayer = null;
|
|
6824
|
+
}
|
|
6707
6825
|
if (overlay) {
|
|
6708
6826
|
overlay.remove();
|
|
6709
6827
|
overlay = null;
|
|
@@ -8481,7 +8599,9 @@ function createInstance(config) {
|
|
|
8481
8599
|
...sentryCtx.tags ? { tags: scrubTagsForWire(sentryCtx.tags) } : {}
|
|
8482
8600
|
} : void 0;
|
|
8483
8601
|
const screenshotForWire = pendingScreenshot ? await compressScreenshotDataUrl(pendingScreenshot).catch(() => null) : null;
|
|
8602
|
+
let screenshotDropped = false;
|
|
8484
8603
|
if (pendingScreenshot && !screenshotForWire) {
|
|
8604
|
+
screenshotDropped = true;
|
|
8485
8605
|
log.warn("Screenshot dropped \u2014 could not compress under wire budget");
|
|
8486
8606
|
}
|
|
8487
8607
|
const capturedEnvironment = captureEnvironment();
|
|
@@ -8586,6 +8706,7 @@ function createInstance(config) {
|
|
|
8586
8706
|
log.warn("Report still too large \u2014 dropping screenshot and retrying", {
|
|
8587
8707
|
reportId: finalReport.id
|
|
8588
8708
|
});
|
|
8709
|
+
screenshotDropped = true;
|
|
8589
8710
|
finalReport = { ...finalReport, screenshotDataUrl: void 0 };
|
|
8590
8711
|
result = await apiClient2.submitReport(finalReport);
|
|
8591
8712
|
}
|
|
@@ -8639,7 +8760,7 @@ function createInstance(config) {
|
|
|
8639
8760
|
pendingProactiveTrigger = null;
|
|
8640
8761
|
if (result?.ok) {
|
|
8641
8762
|
const serverId = result.data?.reportId ?? report.id;
|
|
8642
|
-
return { reportId: serverId, queuedOffline: false };
|
|
8763
|
+
return { reportId: serverId, queuedOffline: false, screenshotDropped };
|
|
8643
8764
|
}
|
|
8644
8765
|
return { reportId: null, queuedOffline: true };
|
|
8645
8766
|
}
|