@mushi-mushi/web 1.22.5 → 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 +167 -102
- 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 +168 -103
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +239 -225
- package/dist/mushi.loader.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -197,7 +197,8 @@ var en = {
|
|
|
197
197
|
queuedOffline: "Queued offline",
|
|
198
198
|
queuedHint: "We'll send it the moment you're back online.",
|
|
199
199
|
trackOnMushi: "Track on Mushi",
|
|
200
|
-
slaDefault: "We will review your report."
|
|
200
|
+
slaDefault: "We will review your report.",
|
|
201
|
+
screenshotDropped: "Sent without the screenshot \u2014 it was too large to attach."
|
|
201
202
|
},
|
|
202
203
|
featureRequest: {
|
|
203
204
|
label: "Feature request",
|
|
@@ -366,7 +367,8 @@ var ja = {
|
|
|
366
367
|
queuedOffline: "\u30AA\u30D5\u30E9\u30A4\u30F3\u5F85\u6A5F\u4E2D",
|
|
367
368
|
queuedHint: "\u30AA\u30F3\u30E9\u30A4\u30F3\u306B\u623B\u308A\u6B21\u7B2C\u9001\u4FE1\u3057\u307E\u3059\u3002",
|
|
368
369
|
trackOnMushi: "Mushi\u3067\u8FFD\u8DE1",
|
|
369
|
-
slaDefault: "\u30EC\u30DD\u30FC\u30C8\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002"
|
|
370
|
+
slaDefault: "\u30EC\u30DD\u30FC\u30C8\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002",
|
|
371
|
+
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"
|
|
370
372
|
},
|
|
371
373
|
featureRequest: {
|
|
372
374
|
label: "\u6A5F\u80FD\u30EA\u30AF\u30A8\u30B9\u30C8",
|
|
@@ -535,7 +537,8 @@ var th = {
|
|
|
535
537
|
queuedOffline: "\u0E04\u0E34\u0E27\u0E2D\u0E2D\u0E1F\u0E44\u0E25\u0E19\u0E4C",
|
|
536
538
|
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",
|
|
537
539
|
trackOnMushi: "\u0E15\u0E34\u0E14\u0E15\u0E32\u0E21\u0E1A\u0E19 Mushi",
|
|
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"
|
|
540
|
+
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",
|
|
541
|
+
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"
|
|
539
542
|
},
|
|
540
543
|
featureRequest: {
|
|
541
544
|
label: "\u0E02\u0E2D\u0E1F\u0E35\u0E40\u0E08\u0E2D\u0E23\u0E4C",
|
|
@@ -704,7 +707,8 @@ var es = {
|
|
|
704
707
|
queuedOffline: "En cola sin conexi\xF3n",
|
|
705
708
|
queuedHint: "Lo enviaremos en cuanto vuelvas a estar en l\xEDnea.",
|
|
706
709
|
trackOnMushi: "Seguir en Mushi",
|
|
707
|
-
slaDefault: "Revisaremos tu reporte."
|
|
710
|
+
slaDefault: "Revisaremos tu reporte.",
|
|
711
|
+
screenshotDropped: "Enviado sin la captura de pantalla \u2014 era demasiado grande para adjuntarla."
|
|
708
712
|
},
|
|
709
713
|
featureRequest: {
|
|
710
714
|
label: "Solicitud de funci\xF3n",
|
|
@@ -2557,7 +2561,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2557
2561
|
|
|
2558
2562
|
// src/version.ts
|
|
2559
2563
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
2560
|
-
var MUSHI_SDK_VERSION = "1.
|
|
2564
|
+
var MUSHI_SDK_VERSION = "1.24.0" ;
|
|
2561
2565
|
var CATEGORY_ICONS = {
|
|
2562
2566
|
bug: "\u26A0\uFE0F",
|
|
2563
2567
|
slow: "\u{1F40C}",
|
|
@@ -3396,6 +3400,11 @@ function renderSuccessReceipt(ctx) {
|
|
|
3396
3400
|
const idShort = `#${ctx.lastReportId.slice(0, 8)}`;
|
|
3397
3401
|
const dashboard = (ctx.config.dashboardUrl ?? "").replace(/\/$/, "");
|
|
3398
3402
|
const trackHref = dashboard ? `${dashboard}/reports/${encodeURIComponent(ctx.lastReportId)}` : "";
|
|
3403
|
+
const screenshotDroppedNote = ctx.lastSubmitScreenshotDropped ? `
|
|
3404
|
+
<div class="mushi-success-receipt-row mushi-success-receipt-warn">
|
|
3405
|
+
<span class="mushi-success-receipt-hint">${escapeHtml(s.screenshotDropped)}</span>
|
|
3406
|
+
</div>
|
|
3407
|
+
` : "";
|
|
3399
3408
|
return `
|
|
3400
3409
|
<div class="mushi-success-receipt" role="status">
|
|
3401
3410
|
<div class="mushi-success-receipt-row">
|
|
@@ -3417,6 +3426,7 @@ function renderSuccessReceipt(ctx) {
|
|
|
3417
3426
|
rel="noopener noreferrer"
|
|
3418
3427
|
>${escapeHtml(s.trackOnMushi)} <span aria-hidden="true">\u2197</span></a>
|
|
3419
3428
|
` : ""}
|
|
3429
|
+
${screenshotDroppedNote}
|
|
3420
3430
|
${renderSlaLine(ctx)}
|
|
3421
3431
|
</div>
|
|
3422
3432
|
`;
|
|
@@ -3646,6 +3656,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3646
3656
|
* Drives a different success copy so the user knows the report
|
|
3647
3657
|
* hasn't actually reached the console yet. */
|
|
3648
3658
|
lastSubmitQueuedOffline = false;
|
|
3659
|
+
lastSubmitScreenshotDropped = false;
|
|
3649
3660
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
3650
3661
|
bannerDismissed = false;
|
|
3651
3662
|
bannerResizeObserver = null;
|
|
@@ -3789,6 +3800,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3789
3800
|
this.removeSelectorHint();
|
|
3790
3801
|
this.lastReportId = null;
|
|
3791
3802
|
this.lastSubmitQueuedOffline = false;
|
|
3803
|
+
this.lastSubmitScreenshotDropped = false;
|
|
3792
3804
|
this.viaFeatureRequest = false;
|
|
3793
3805
|
this.clearFormDrafts();
|
|
3794
3806
|
if (options?.featureRequest) {
|
|
@@ -4921,6 +4933,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4921
4933
|
leaderboardLoading: this.leaderboardLoading,
|
|
4922
4934
|
leaderboardEntries: this.leaderboardEntries,
|
|
4923
4935
|
lastSubmitQueuedOffline: this.lastSubmitQueuedOffline,
|
|
4936
|
+
lastSubmitScreenshotDropped: this.lastSubmitScreenshotDropped,
|
|
4924
4937
|
featureBoard: this.featureBoard,
|
|
4925
4938
|
crossAppReports: this.crossAppReports,
|
|
4926
4939
|
allowScreenshotRemove: this.allowScreenshotRemove,
|
|
@@ -5204,6 +5217,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5204
5217
|
this.submittedAt = /* @__PURE__ */ new Date();
|
|
5205
5218
|
this.lastReportId = null;
|
|
5206
5219
|
this.lastSubmitQueuedOffline = false;
|
|
5220
|
+
this.lastSubmitScreenshotDropped = false;
|
|
5207
5221
|
this.render();
|
|
5208
5222
|
const outcomeP = (async () => {
|
|
5209
5223
|
try {
|
|
@@ -5236,6 +5250,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5236
5250
|
if (outcome) {
|
|
5237
5251
|
this.lastReportId = outcome.reportId ?? null;
|
|
5238
5252
|
this.lastSubmitQueuedOffline = Boolean(outcome.queuedOffline);
|
|
5253
|
+
this.lastSubmitScreenshotDropped = Boolean(outcome.screenshotDropped);
|
|
5239
5254
|
this.render();
|
|
5240
5255
|
}
|
|
5241
5256
|
if (this.autoCloseTimer !== null) {
|
|
@@ -6312,25 +6327,32 @@ function createScreenshotCapture(options = {}) {
|
|
|
6312
6327
|
const blob = new Blob([svgData], { type: "image/svg+xml;charset=utf-8" });
|
|
6313
6328
|
const url = URL.createObjectURL(blob);
|
|
6314
6329
|
return new Promise((resolve) => {
|
|
6330
|
+
let settled = false;
|
|
6331
|
+
const settle = (value, reason) => {
|
|
6332
|
+
if (settled) return;
|
|
6333
|
+
settled = true;
|
|
6334
|
+
clearTimeout(timer);
|
|
6335
|
+
URL.revokeObjectURL(url);
|
|
6336
|
+
if (reason) {
|
|
6337
|
+
activeOptions.onFailed?.(reason);
|
|
6338
|
+
emitScreenshotFailed(reason);
|
|
6339
|
+
}
|
|
6340
|
+
resolve(value);
|
|
6341
|
+
};
|
|
6342
|
+
const timer = setTimeout(() => settle(null, "error"), 5e3);
|
|
6315
6343
|
img.onload = () => {
|
|
6316
6344
|
try {
|
|
6317
6345
|
ctx.drawImage(img, 0, 0, width, height);
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6346
|
+
if (isCanvasBlank(ctx, width, height)) {
|
|
6347
|
+
settle(null, "error");
|
|
6348
|
+
return;
|
|
6349
|
+
}
|
|
6350
|
+
settle(canvas.toDataURL("image/jpeg", 0.7));
|
|
6321
6351
|
} catch {
|
|
6322
|
-
|
|
6323
|
-
activeOptions.onFailed?.("taint");
|
|
6324
|
-
emitScreenshotFailed("taint");
|
|
6325
|
-
resolve(null);
|
|
6352
|
+
settle(null, "taint");
|
|
6326
6353
|
}
|
|
6327
6354
|
};
|
|
6328
|
-
img.onerror = () =>
|
|
6329
|
-
URL.revokeObjectURL(url);
|
|
6330
|
-
activeOptions.onFailed?.("error");
|
|
6331
|
-
emitScreenshotFailed("error");
|
|
6332
|
-
resolve(null);
|
|
6333
|
-
};
|
|
6355
|
+
img.onerror = () => settle(null, "error");
|
|
6334
6356
|
img.src = url;
|
|
6335
6357
|
});
|
|
6336
6358
|
} catch {
|
|
@@ -6360,6 +6382,7 @@ function buildPrivacySafeDocument(privacy) {
|
|
|
6360
6382
|
const clone = document.documentElement.cloneNode(true);
|
|
6361
6383
|
clone.querySelector("#mushi-mushi-widget")?.remove();
|
|
6362
6384
|
stripTaintSources(clone);
|
|
6385
|
+
inlineDocumentStyles(clone);
|
|
6363
6386
|
const redactSelectors = privacy?.redactSelectors !== void 0 ? privacy.redactSelectors : DEFAULT_REDACT_SELECTORS;
|
|
6364
6387
|
for (const selector of redactSelectors) {
|
|
6365
6388
|
for (const el of safeQueryAll(clone, selector)) {
|
|
@@ -6404,8 +6427,7 @@ function stripTaintSources(root) {
|
|
|
6404
6427
|
el.remove();
|
|
6405
6428
|
}
|
|
6406
6429
|
for (const link of root.querySelectorAll('link[rel="stylesheet"], link[as="style"]')) {
|
|
6407
|
-
|
|
6408
|
-
if (!href || isCrossOriginUrl(href, pageOrigin)) link.remove();
|
|
6430
|
+
link.remove();
|
|
6409
6431
|
}
|
|
6410
6432
|
for (const styleEl of root.querySelectorAll("style")) {
|
|
6411
6433
|
const cleaned = stripCssUrlRefs(styleEl.textContent ?? "", pageOrigin);
|
|
@@ -6429,6 +6451,56 @@ function stripCssUrlRefs(css, pageOrigin) {
|
|
|
6429
6451
|
return _match;
|
|
6430
6452
|
});
|
|
6431
6453
|
}
|
|
6454
|
+
function inlineDocumentStyles(clone) {
|
|
6455
|
+
const pageOrigin = typeof location !== "undefined" ? location.origin : "";
|
|
6456
|
+
const chunks = [];
|
|
6457
|
+
const sheets = [
|
|
6458
|
+
...Array.from(document.styleSheets),
|
|
6459
|
+
...document.adoptedStyleSheets ?? []
|
|
6460
|
+
];
|
|
6461
|
+
for (const sheet of sheets) {
|
|
6462
|
+
const owner = sheet.ownerNode;
|
|
6463
|
+
if (owner instanceof Element && owner.tagName === "STYLE") continue;
|
|
6464
|
+
chunks.push(serializeSheet(sheet));
|
|
6465
|
+
}
|
|
6466
|
+
const css = stripCssUrlRefs(chunks.filter(Boolean).join("\n"), pageOrigin);
|
|
6467
|
+
if (!css) return;
|
|
6468
|
+
const styleEl = document.createElement("style");
|
|
6469
|
+
styleEl.textContent = css;
|
|
6470
|
+
(clone.querySelector("head") ?? clone).appendChild(styleEl);
|
|
6471
|
+
}
|
|
6472
|
+
function serializeSheet(sheet) {
|
|
6473
|
+
let rules;
|
|
6474
|
+
try {
|
|
6475
|
+
rules = sheet.cssRules;
|
|
6476
|
+
} catch {
|
|
6477
|
+
return "";
|
|
6478
|
+
}
|
|
6479
|
+
let text = "";
|
|
6480
|
+
for (const rule of Array.from(rules)) {
|
|
6481
|
+
if (rule instanceof CSSImportRule) {
|
|
6482
|
+
if (rule.styleSheet) text += serializeSheet(rule.styleSheet);
|
|
6483
|
+
continue;
|
|
6484
|
+
}
|
|
6485
|
+
text += `${rule.cssText}
|
|
6486
|
+
`;
|
|
6487
|
+
}
|
|
6488
|
+
return text;
|
|
6489
|
+
}
|
|
6490
|
+
function isCanvasBlank(ctx, width, height) {
|
|
6491
|
+
try {
|
|
6492
|
+
const stepX = Math.max(1, Math.floor(width / 8));
|
|
6493
|
+
const stepY = Math.max(1, Math.floor(height / 8));
|
|
6494
|
+
for (let y = 0; y < height; y += stepY) {
|
|
6495
|
+
for (let x = 0; x < width; x += stepX) {
|
|
6496
|
+
if (ctx.getImageData(x, y, 1, 1).data[3] !== 0) return false;
|
|
6497
|
+
}
|
|
6498
|
+
}
|
|
6499
|
+
return true;
|
|
6500
|
+
} catch {
|
|
6501
|
+
return false;
|
|
6502
|
+
}
|
|
6503
|
+
}
|
|
6432
6504
|
function isCrossOriginUrl(raw, pageOrigin) {
|
|
6433
6505
|
if (!raw || raw.startsWith("data:") || raw.startsWith("blob:")) return false;
|
|
6434
6506
|
try {
|
|
@@ -6585,6 +6657,8 @@ function createPerformanceCapture() {
|
|
|
6585
6657
|
function createElementSelector() {
|
|
6586
6658
|
let active = false;
|
|
6587
6659
|
let overlay = null;
|
|
6660
|
+
let captureLayer = null;
|
|
6661
|
+
let hoveredElement = null;
|
|
6588
6662
|
let resolvePromise = null;
|
|
6589
6663
|
function findNearestTestid(el) {
|
|
6590
6664
|
let cur = el;
|
|
@@ -6615,10 +6689,11 @@ function createElementSelector() {
|
|
|
6615
6689
|
}
|
|
6616
6690
|
function captureElement(el) {
|
|
6617
6691
|
const rect = el.getBoundingClientRect();
|
|
6692
|
+
const className = typeof el.className === "string" ? el.className : el.getAttribute("class") ?? "";
|
|
6618
6693
|
return {
|
|
6619
6694
|
tagName: el.tagName.toLowerCase(),
|
|
6620
6695
|
id: el.id || void 0,
|
|
6621
|
-
className:
|
|
6696
|
+
className: className || void 0,
|
|
6622
6697
|
textContent: el.textContent?.trim().slice(0, 200) || void 0,
|
|
6623
6698
|
xpath: getXPath(el),
|
|
6624
6699
|
rect: {
|
|
@@ -6650,6 +6725,36 @@ function createElementSelector() {
|
|
|
6650
6725
|
document.body.appendChild(el);
|
|
6651
6726
|
return el;
|
|
6652
6727
|
}
|
|
6728
|
+
function createCaptureLayer() {
|
|
6729
|
+
const el = document.createElement("div");
|
|
6730
|
+
el.style.cssText = `
|
|
6731
|
+
position: fixed;
|
|
6732
|
+
inset: 0;
|
|
6733
|
+
z-index: 2147483647;
|
|
6734
|
+
cursor: crosshair;
|
|
6735
|
+
background: transparent;
|
|
6736
|
+
`;
|
|
6737
|
+
document.body.appendChild(el);
|
|
6738
|
+
return el;
|
|
6739
|
+
}
|
|
6740
|
+
function resolveTargetAt(x, y) {
|
|
6741
|
+
const stack = document.elementsFromPoint(x, y);
|
|
6742
|
+
let target = null;
|
|
6743
|
+
for (const el of stack) {
|
|
6744
|
+
if (el === captureLayer || el === overlay) continue;
|
|
6745
|
+
if (el.id === "mushi-mushi-widget" || el.closest("#mushi-mushi-widget")) return null;
|
|
6746
|
+
target = el;
|
|
6747
|
+
break;
|
|
6748
|
+
}
|
|
6749
|
+
let hops = 0;
|
|
6750
|
+
while (target?.shadowRoot && hops < 20) {
|
|
6751
|
+
const inner = target.shadowRoot.elementFromPoint(x, y);
|
|
6752
|
+
if (!inner || inner === target) break;
|
|
6753
|
+
target = inner;
|
|
6754
|
+
hops++;
|
|
6755
|
+
}
|
|
6756
|
+
return target;
|
|
6757
|
+
}
|
|
6653
6758
|
function positionOverlay(target) {
|
|
6654
6759
|
if (!overlay) return;
|
|
6655
6760
|
const rect = target.getBoundingClientRect();
|
|
@@ -6660,28 +6765,34 @@ function createElementSelector() {
|
|
|
6660
6765
|
overlay.style.display = "block";
|
|
6661
6766
|
}
|
|
6662
6767
|
function handleMouseMove(e) {
|
|
6663
|
-
const target = e.
|
|
6664
|
-
if (target
|
|
6768
|
+
const target = resolveTargetAt(e.clientX, e.clientY);
|
|
6769
|
+
if (!target) {
|
|
6770
|
+
hoveredElement = null;
|
|
6771
|
+
if (overlay) overlay.style.display = "none";
|
|
6772
|
+
return;
|
|
6773
|
+
}
|
|
6774
|
+
hoveredElement = target;
|
|
6665
6775
|
positionOverlay(target);
|
|
6666
6776
|
}
|
|
6777
|
+
function swallow(e) {
|
|
6778
|
+
e.preventDefault();
|
|
6779
|
+
e.stopPropagation();
|
|
6780
|
+
}
|
|
6667
6781
|
function handleClick(e) {
|
|
6668
6782
|
e.preventDefault();
|
|
6669
6783
|
e.stopPropagation();
|
|
6670
|
-
const target = e.
|
|
6671
|
-
if (target
|
|
6672
|
-
|
|
6673
|
-
const hitsMushiHost = path.some(
|
|
6674
|
-
(node) => node instanceof Element && node.id === "mushi-mushi-widget"
|
|
6675
|
-
);
|
|
6676
|
-
if (hitsMushiHost) return;
|
|
6677
|
-
const captured = captureElement(target);
|
|
6678
|
-
finish(captured);
|
|
6784
|
+
const target = resolveTargetAt(e.clientX, e.clientY);
|
|
6785
|
+
if (!target) return;
|
|
6786
|
+
finish(captureElement(target));
|
|
6679
6787
|
}
|
|
6680
6788
|
function handleKeyDown(e) {
|
|
6681
6789
|
if (e.key === "Escape") {
|
|
6682
6790
|
finish(null);
|
|
6683
6791
|
}
|
|
6684
6792
|
}
|
|
6793
|
+
function handleScroll() {
|
|
6794
|
+
if (hoveredElement?.isConnected) positionOverlay(hoveredElement);
|
|
6795
|
+
}
|
|
6685
6796
|
function finish(result) {
|
|
6686
6797
|
deactivate();
|
|
6687
6798
|
resolvePromise?.(result);
|
|
@@ -6693,19 +6804,26 @@ function createElementSelector() {
|
|
|
6693
6804
|
resolvePromise = resolve;
|
|
6694
6805
|
active = true;
|
|
6695
6806
|
overlay = createOverlay();
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6807
|
+
captureLayer = createCaptureLayer();
|
|
6808
|
+
captureLayer.addEventListener("mousemove", handleMouseMove);
|
|
6809
|
+
captureLayer.addEventListener("click", handleClick);
|
|
6810
|
+
captureLayer.addEventListener("pointerdown", swallow);
|
|
6811
|
+
captureLayer.addEventListener("mousedown", swallow);
|
|
6812
|
+
captureLayer.addEventListener("mouseup", swallow);
|
|
6699
6813
|
document.addEventListener("keydown", handleKeyDown, true);
|
|
6814
|
+
window.addEventListener("scroll", handleScroll, { capture: true, passive: true });
|
|
6700
6815
|
});
|
|
6701
6816
|
}
|
|
6702
6817
|
function deactivate() {
|
|
6703
6818
|
if (!active) return;
|
|
6704
6819
|
active = false;
|
|
6705
|
-
|
|
6706
|
-
document.removeEventListener("mousemove", handleMouseMove, true);
|
|
6707
|
-
document.removeEventListener("click", handleClick, true);
|
|
6820
|
+
hoveredElement = null;
|
|
6708
6821
|
document.removeEventListener("keydown", handleKeyDown, true);
|
|
6822
|
+
window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
6823
|
+
if (captureLayer) {
|
|
6824
|
+
captureLayer.remove();
|
|
6825
|
+
captureLayer = null;
|
|
6826
|
+
}
|
|
6709
6827
|
if (overlay) {
|
|
6710
6828
|
overlay.remove();
|
|
6711
6829
|
overlay = null;
|
|
@@ -7714,11 +7832,11 @@ var Mushi = class {
|
|
|
7714
7832
|
return createNoopInstance();
|
|
7715
7833
|
}
|
|
7716
7834
|
const resolved = { ...core.resolveEnvConfig(), ...config };
|
|
7717
|
-
if (!resolved.projectId) {
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7835
|
+
if (!resolved.projectId || !resolved.apiKey) {
|
|
7836
|
+
const diagnostics = core.diagnoseEnvConfig();
|
|
7837
|
+
throw new Error(
|
|
7838
|
+
diagnostics.message ?? "[mushi] projectId and apiKey are required \u2014 set NEXT_PUBLIC_MUSHI_* / VITE_MUSHI_* / MUSHI_* or pass them explicitly"
|
|
7839
|
+
);
|
|
7722
7840
|
}
|
|
7723
7841
|
if (resolved.enabled === false) {
|
|
7724
7842
|
return createNoopInstance();
|
|
@@ -7738,7 +7856,8 @@ var Mushi = class {
|
|
|
7738
7856
|
}
|
|
7739
7857
|
};
|
|
7740
7858
|
function createInstance(config) {
|
|
7741
|
-
|
|
7859
|
+
core.validateConfig(config);
|
|
7860
|
+
const bootstrapConfig = core.expandPreset(config);
|
|
7742
7861
|
const projectId = bootstrapConfig.projectId;
|
|
7743
7862
|
const reporterTokenForProject = () => core.getReporterToken(projectId);
|
|
7744
7863
|
let activeConfig = bootstrapConfig;
|
|
@@ -8482,7 +8601,9 @@ function createInstance(config) {
|
|
|
8482
8601
|
...sentryCtx.tags ? { tags: scrubTagsForWire(sentryCtx.tags) } : {}
|
|
8483
8602
|
} : void 0;
|
|
8484
8603
|
const screenshotForWire = pendingScreenshot ? await compressScreenshotDataUrl(pendingScreenshot).catch(() => null) : null;
|
|
8604
|
+
let screenshotDropped = false;
|
|
8485
8605
|
if (pendingScreenshot && !screenshotForWire) {
|
|
8606
|
+
screenshotDropped = true;
|
|
8486
8607
|
log.warn("Screenshot dropped \u2014 could not compress under wire budget");
|
|
8487
8608
|
}
|
|
8488
8609
|
const capturedEnvironment = core.captureEnvironment();
|
|
@@ -8587,6 +8708,7 @@ function createInstance(config) {
|
|
|
8587
8708
|
log.warn("Report still too large \u2014 dropping screenshot and retrying", {
|
|
8588
8709
|
reportId: finalReport.id
|
|
8589
8710
|
});
|
|
8711
|
+
screenshotDropped = true;
|
|
8590
8712
|
finalReport = { ...finalReport, screenshotDataUrl: void 0 };
|
|
8591
8713
|
result = await apiClient2.submitReport(finalReport);
|
|
8592
8714
|
}
|
|
@@ -8640,7 +8762,7 @@ function createInstance(config) {
|
|
|
8640
8762
|
pendingProactiveTrigger = null;
|
|
8641
8763
|
if (result?.ok) {
|
|
8642
8764
|
const serverId = result.data?.reportId ?? report.id;
|
|
8643
|
-
return { reportId: serverId, queuedOffline: false };
|
|
8765
|
+
return { reportId: serverId, queuedOffline: false, screenshotDropped };
|
|
8644
8766
|
}
|
|
8645
8767
|
return { reportId: null, queuedOffline: true };
|
|
8646
8768
|
}
|
|
@@ -9068,63 +9190,6 @@ function createInstance(config) {
|
|
|
9068
9190
|
});
|
|
9069
9191
|
return isolatePublicApi(sdk);
|
|
9070
9192
|
}
|
|
9071
|
-
function applyPresetConfig(config) {
|
|
9072
|
-
if (!config.preset) return config;
|
|
9073
|
-
const preset = presetDefaults(config.preset);
|
|
9074
|
-
return {
|
|
9075
|
-
...config,
|
|
9076
|
-
widget: {
|
|
9077
|
-
...preset.widget,
|
|
9078
|
-
...config.widget
|
|
9079
|
-
},
|
|
9080
|
-
capture: {
|
|
9081
|
-
...preset.capture,
|
|
9082
|
-
...config.capture
|
|
9083
|
-
},
|
|
9084
|
-
proactive: {
|
|
9085
|
-
...preset.proactive,
|
|
9086
|
-
...config.proactive,
|
|
9087
|
-
cooldown: {
|
|
9088
|
-
...preset.proactive?.cooldown,
|
|
9089
|
-
...config.proactive?.cooldown
|
|
9090
|
-
}
|
|
9091
|
-
}
|
|
9092
|
-
};
|
|
9093
|
-
}
|
|
9094
|
-
function presetDefaults(preset) {
|
|
9095
|
-
switch (preset) {
|
|
9096
|
-
case "manual-only":
|
|
9097
|
-
return {
|
|
9098
|
-
widget: { trigger: "manual", outdatedBanner: "console-only" },
|
|
9099
|
-
capture: { console: true, network: true, performance: false, screenshot: "on-report", elementSelector: false },
|
|
9100
|
-
proactive: { rageClick: false, longTask: false, apiCascade: false, errorBoundary: false }
|
|
9101
|
-
};
|
|
9102
|
-
case "beta-loud":
|
|
9103
|
-
return {
|
|
9104
|
-
widget: { trigger: "auto", outdatedBanner: "banner" },
|
|
9105
|
-
capture: { console: true, network: true, performance: true, screenshot: "auto", elementSelector: true },
|
|
9106
|
-
proactive: { rageClick: true, longTask: true, apiCascade: true, errorBoundary: true }
|
|
9107
|
-
};
|
|
9108
|
-
case "internal-debug":
|
|
9109
|
-
return {
|
|
9110
|
-
widget: { trigger: "auto", outdatedBanner: "banner", brandFooter: true },
|
|
9111
|
-
capture: { console: true, network: true, performance: true, screenshot: "auto", elementSelector: true },
|
|
9112
|
-
proactive: {
|
|
9113
|
-
rageClick: true,
|
|
9114
|
-
longTask: true,
|
|
9115
|
-
apiCascade: true,
|
|
9116
|
-
errorBoundary: true,
|
|
9117
|
-
cooldown: { maxProactivePerSession: 10, dismissCooldownHours: 0, suppressAfterDismissals: 99 }
|
|
9118
|
-
}
|
|
9119
|
-
};
|
|
9120
|
-
case "production-calm":
|
|
9121
|
-
return {
|
|
9122
|
-
widget: { trigger: "auto", outdatedBanner: "console-only" },
|
|
9123
|
-
capture: { console: true, network: true, performance: false, screenshot: "on-report", elementSelector: false },
|
|
9124
|
-
proactive: { rageClick: false, longTask: false, apiCascade: false, errorBoundary: false }
|
|
9125
|
-
};
|
|
9126
|
-
}
|
|
9127
|
-
}
|
|
9128
9193
|
function resolveApiEndpoint(config) {
|
|
9129
9194
|
return config.apiEndpoint ?? core.DEFAULT_API_ENDPOINT;
|
|
9130
9195
|
}
|