@mushi-mushi/web 1.35.0 → 1.37.3
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 +1 -1
- package/dist/chunks/chunk-ONXNS7MQ.js +35 -0
- package/dist/chunks/chunk-ONXNS7MQ.js.map +1 -0
- package/dist/chunks/screenshot-dom-K3N2HPNN.js +653 -0
- package/dist/chunks/screenshot-dom-K3N2HPNN.js.map +1 -0
- package/dist/headless.cjs +744 -271
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +1 -1
- package/dist/headless.d.ts +4 -0
- package/dist/headless.js +744 -271
- package/dist/headless.js.map +1 -1
- package/dist/index.cjs +748 -271
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +52 -275
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +20 -19
- package/dist/test-utils.cjs +596 -0
- package/dist/test-utils.cjs.map +1 -1
- package/dist/test-utils.js +596 -0
- package/dist/test-utils.js.map +1 -1
- package/dist/{timeline-B8nMyZyM.d.cts → timeline-BUrJ4n9r.d.cts} +4 -0
- package/package.json +11 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MushiInitConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiReporterTimelineItem, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiReporterUpdates, MushiApiCascadeConfig, MushiErrorFilter } from '@mushi-mushi/core';
|
|
2
2
|
export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiInitConfig, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
|
|
3
|
-
import { g as ScreenshotFailureReason } from './timeline-
|
|
4
|
-
export { C as ConsoleCapture, E as ElementSelector, N as NetworkCapture, P as PerformanceCapture, S as ScreenshotCapture, T as TimelineCapture, c as createConsoleCapture, a as createElementSelector, b as createNetworkCapture, d as createPerformanceCapture, e as createScreenshotCapture, f as createTimelineCapture } from './timeline-
|
|
3
|
+
import { g as ScreenshotFailureReason } from './timeline-BUrJ4n9r.cjs';
|
|
4
|
+
export { C as ConsoleCapture, E as ElementSelector, N as NetworkCapture, P as PerformanceCapture, S as ScreenshotCapture, T as TimelineCapture, c as createConsoleCapture, a as createElementSelector, b as createNetworkCapture, d as createPerformanceCapture, e as createScreenshotCapture, f as createTimelineCapture } from './timeline-BUrJ4n9r.cjs';
|
|
5
5
|
export { MushiLocale, getAvailableLocales, getLocale } from './i18n/index.cjs';
|
|
6
6
|
|
|
7
7
|
declare class Mushi {
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ interface ScreenshotCaptureOptions {
|
|
|
28
28
|
* - error: anything else
|
|
29
29
|
*/
|
|
30
30
|
type ScreenshotFailureReason = 'taint' | 'timeout' | 'unsupported' | 'csp' | 'error';
|
|
31
|
+
/**
|
|
32
|
+
* The capture code lives in ./screenshot-dom and loads on the first
|
|
33
|
+
* screenshot, so a page that never takes one never downloads it.
|
|
34
|
+
*/
|
|
31
35
|
declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
|
|
32
36
|
|
|
33
37
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { ALWAYS_REDACT_SELECTORS, createScreenshotCapture } from './chunks/chunk-ONXNS7MQ.js';
|
|
2
|
+
export { createScreenshotCapture } from './chunks/chunk-ONXNS7MQ.js';
|
|
1
3
|
import { mushiPalette, resolveWidgetAccent, MUSHI_REPORTER_STATUS, MUSHI_GEOMETRY, MUSHI_Z, MUSHI_MOTION, MUSHI_TYPE, MUSHI_BANNER_BRAND_BORDER, MUSHI_BANNER_NEON, MUSHI_INVERSE, MUSHI_ON_ACCENT, MUSHI_ACCENT_SHADOW, MUSHI_COPY, MUSHI_TIER_COLORS, readPageFaviconHref, scrubUrl, resolveEnvConfig, diagnoseEnvConfig, validateConfig, expandPreset, createLogger, noopLogger, createApiClient, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, initEventTracker, getSessionId, createBreadcrumbBuffer, sha256Hex, getReporterToken, trackEvent, flushEvents, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, captureEnvironment, newUuid, getEventAnonymousId, setEventConsent, parseIdentityToken, updateSessionIdentity, updateEventIdentity, normaliseThrown, shouldDropCapturedError, destroyEventTracker, destroySessionTracker, markPageUnloading, flushLastOutboundOnUnload, DEFAULT_API_ENDPOINT, MUSHI_INTERNAL_INIT_MARKER, MUSHI_DURATION, MUSHI_SPACING, MUSHI_RADIUS, isLikelyGenericFavicon, MUSHI_INTERNAL_HEADER, MUSHI_COLORS_LIGHT, resolveProjectDomain, projectInitials, projectFaviconUrlCandidates, initSessionTracker, trackPageView } from '@mushi-mushi/core';
|
|
4
|
+
import { collectDiagnostics } from '@mushi-mushi/core/diagnostics';
|
|
2
5
|
import { isPlausibleReporterEmail, reporterToastMessage, reporterCopy } from '@mushi-mushi/core/reporter-ui';
|
|
3
6
|
import { reporterChannels, subscribeBrowserPush } from '@mushi-mushi/core/reporter-channels';
|
|
4
7
|
|
|
5
|
-
// src/capture/compress-screenshot.ts
|
|
6
8
|
async function compressScreenshotDataUrl(dataUrl, maxBytes = MAX_SCREENSHOT_DATA_URL_BYTES) {
|
|
7
9
|
if (!dataUrl.startsWith("data:image/")) return dataUrl;
|
|
8
10
|
if (estimateDataUrlBytes(dataUrl) <= maxBytes) return dataUrl;
|
|
@@ -4821,36 +4823,51 @@ function createConsoleCapture() {
|
|
|
4821
4823
|
const originals = {};
|
|
4822
4824
|
const wrappers = {};
|
|
4823
4825
|
const levels = ["log", "warn", "error", "info", "debug"];
|
|
4826
|
+
const str = (arg) => {
|
|
4827
|
+
if (arg instanceof Error) return `${arg.name}: ${arg.message}`;
|
|
4828
|
+
try {
|
|
4829
|
+
return typeof arg === "string" ? arg : JSON.stringify(arg);
|
|
4830
|
+
} catch {
|
|
4831
|
+
return String(arg);
|
|
4832
|
+
}
|
|
4833
|
+
};
|
|
4834
|
+
const record = (level, message, err, extra) => {
|
|
4835
|
+
const entry = { level, message: message.slice(0, MAX_MESSAGE_LENGTH), timestamp: Date.now(), ...extra };
|
|
4836
|
+
if (err instanceof Error && err.stack) entry.stack = err.stack.slice(0, 1e3);
|
|
4837
|
+
entries.push(entry);
|
|
4838
|
+
if (entries.length > MAX_ENTRIES2) entries.shift();
|
|
4839
|
+
};
|
|
4824
4840
|
for (const level of levels) {
|
|
4825
4841
|
const original = console[level];
|
|
4826
4842
|
originals[level] = original;
|
|
4827
4843
|
const wrapper = (...args) => {
|
|
4828
|
-
const message = args.map((arg) => {
|
|
4829
|
-
try {
|
|
4830
|
-
return typeof arg === "string" ? arg : JSON.stringify(arg);
|
|
4831
|
-
} catch {
|
|
4832
|
-
return String(arg);
|
|
4833
|
-
}
|
|
4834
|
-
}).join(" ").slice(0, MAX_MESSAGE_LENGTH);
|
|
4835
4844
|
const correlationId = getActiveCorrelationId();
|
|
4836
|
-
|
|
4845
|
+
record(
|
|
4837
4846
|
level,
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
if (level === "error" && args[0] instanceof Error) {
|
|
4843
|
-
entry.stack = args[0].stack?.slice(0, 1e3);
|
|
4844
|
-
}
|
|
4845
|
-
entries.push(entry);
|
|
4846
|
-
if (entries.length > MAX_ENTRIES2) {
|
|
4847
|
-
entries.shift();
|
|
4848
|
-
}
|
|
4847
|
+
args.map(str).join(" "),
|
|
4848
|
+
level === "error" ? args.find((a) => a instanceof Error) : void 0,
|
|
4849
|
+
correlationId ? { correlationId } : void 0
|
|
4850
|
+
);
|
|
4849
4851
|
original.call(console, ...args);
|
|
4850
4852
|
};
|
|
4851
4853
|
wrappers[level] = wrapper;
|
|
4852
4854
|
console[level] = wrapper;
|
|
4853
4855
|
}
|
|
4856
|
+
const onUncaught = (event) => {
|
|
4857
|
+
if (event.type === "unhandledrejection") {
|
|
4858
|
+
const reason = event.reason;
|
|
4859
|
+
record("error", `Unhandled rejection: ${str(reason)}`, reason);
|
|
4860
|
+
} else {
|
|
4861
|
+
const e = event;
|
|
4862
|
+
const where = e.filename ? ` (${e.filename}:${e.lineno}:${e.colno})` : "";
|
|
4863
|
+
record("error", `Uncaught ${str(e.error ?? (e.message || "error"))}${where}`, e.error);
|
|
4864
|
+
}
|
|
4865
|
+
};
|
|
4866
|
+
const canListen = typeof window !== "undefined" && typeof window.addEventListener === "function";
|
|
4867
|
+
if (canListen) {
|
|
4868
|
+
window.addEventListener("error", onUncaught);
|
|
4869
|
+
window.addEventListener("unhandledrejection", onUncaught);
|
|
4870
|
+
}
|
|
4854
4871
|
return {
|
|
4855
4872
|
getEntries() {
|
|
4856
4873
|
return [...entries];
|
|
@@ -4864,261 +4881,13 @@ function createConsoleCapture() {
|
|
|
4864
4881
|
console[level] = originals[level];
|
|
4865
4882
|
}
|
|
4866
4883
|
}
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
// src/capture/screenshot.ts
|
|
4872
|
-
function createScreenshotCapture(options = {}) {
|
|
4873
|
-
let activeOptions = options;
|
|
4874
|
-
async function take() {
|
|
4875
|
-
try {
|
|
4876
|
-
if (typeof document === "undefined") return null;
|
|
4877
|
-
const canvas = document.createElement("canvas");
|
|
4878
|
-
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
4879
|
-
if (!ctx) {
|
|
4880
|
-
activeOptions.onFailed?.("unsupported");
|
|
4881
|
-
emitScreenshotFailed("unsupported");
|
|
4882
|
-
return null;
|
|
4884
|
+
if (canListen) {
|
|
4885
|
+
window.removeEventListener("error", onUncaught);
|
|
4886
|
+
window.removeEventListener("unhandledrejection", onUncaught);
|
|
4883
4887
|
}
|
|
4884
|
-
const width = window.innerWidth;
|
|
4885
|
-
const height = window.innerHeight;
|
|
4886
|
-
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
4887
|
-
canvas.width = width * dpr;
|
|
4888
|
-
canvas.height = height * dpr;
|
|
4889
|
-
ctx.scale(dpr, dpr);
|
|
4890
|
-
const safeDocument = buildPrivacySafeDocument(activeOptions.privacy);
|
|
4891
|
-
const svgData = `
|
|
4892
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
|
|
4893
|
-
<foreignObject width="100%" height="100%">
|
|
4894
|
-
<div xmlns="http://www.w3.org/1999/xhtml">
|
|
4895
|
-
${new XMLSerializer().serializeToString(safeDocument)}
|
|
4896
|
-
</div>
|
|
4897
|
-
</foreignObject>
|
|
4898
|
-
</svg>
|
|
4899
|
-
`;
|
|
4900
|
-
const img = new Image();
|
|
4901
|
-
const url = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgData)}`;
|
|
4902
|
-
let cspBlocked = false;
|
|
4903
|
-
const onViolation = (e) => {
|
|
4904
|
-
const v = e;
|
|
4905
|
-
if (/^img-src|^default-src/.test(v.violatedDirective ?? "") && /^data/.test(v.blockedURI ?? "")) cspBlocked = true;
|
|
4906
|
-
};
|
|
4907
|
-
document.addEventListener("securitypolicyviolation", onViolation);
|
|
4908
|
-
return new Promise((resolve) => {
|
|
4909
|
-
let settled = false;
|
|
4910
|
-
const settle = (value, reason) => {
|
|
4911
|
-
if (settled) return;
|
|
4912
|
-
settled = true;
|
|
4913
|
-
clearTimeout(timer);
|
|
4914
|
-
document.removeEventListener("securitypolicyviolation", onViolation);
|
|
4915
|
-
if (reason) {
|
|
4916
|
-
activeOptions.onFailed?.(reason);
|
|
4917
|
-
emitScreenshotFailed(reason);
|
|
4918
|
-
}
|
|
4919
|
-
resolve(value);
|
|
4920
|
-
};
|
|
4921
|
-
const timer = setTimeout(() => settle(null, "timeout"), 5e3);
|
|
4922
|
-
img.onload = () => {
|
|
4923
|
-
try {
|
|
4924
|
-
ctx.drawImage(img, 0, 0, width, height);
|
|
4925
|
-
if (isCanvasBlank(ctx, width, height)) {
|
|
4926
|
-
settle(null, "unsupported");
|
|
4927
|
-
return;
|
|
4928
|
-
}
|
|
4929
|
-
settle(canvas.toDataURL("image/jpeg", 0.7));
|
|
4930
|
-
} catch {
|
|
4931
|
-
settle(null, "taint");
|
|
4932
|
-
}
|
|
4933
|
-
};
|
|
4934
|
-
img.onerror = () => setTimeout(() => settle(null, cspBlocked ? "csp" : "error"), 0);
|
|
4935
|
-
img.src = url;
|
|
4936
|
-
});
|
|
4937
|
-
} catch {
|
|
4938
|
-
activeOptions.onFailed?.("error");
|
|
4939
|
-
emitScreenshotFailed("error");
|
|
4940
|
-
return null;
|
|
4941
|
-
}
|
|
4942
|
-
}
|
|
4943
|
-
return {
|
|
4944
|
-
take,
|
|
4945
|
-
updateOptions(nextOptions) {
|
|
4946
|
-
activeOptions = nextOptions;
|
|
4947
4888
|
}
|
|
4948
4889
|
};
|
|
4949
4890
|
}
|
|
4950
|
-
function emitScreenshotFailed(reason) {
|
|
4951
|
-
try {
|
|
4952
|
-
document.dispatchEvent(new CustomEvent("mushi:screenshot_failed", { detail: { reason }, bubbles: false }));
|
|
4953
|
-
} catch {
|
|
4954
|
-
}
|
|
4955
|
-
}
|
|
4956
|
-
var ALWAYS_REDACT_SELECTORS = 'input[type="password"],input[autocomplete^="cc-"],[data-private],[data-mushi-mask]';
|
|
4957
|
-
var DEFAULT_REDACT_SELECTORS = ["[data-mushi-redact]"];
|
|
4958
|
-
function buildPrivacySafeDocument(privacy) {
|
|
4959
|
-
const clone = document.documentElement.cloneNode(true);
|
|
4960
|
-
clone.querySelector("#mushi-mushi-widget")?.remove();
|
|
4961
|
-
stripTaintSources(clone);
|
|
4962
|
-
inlineDocumentStyles(clone);
|
|
4963
|
-
freezeMotion(clone);
|
|
4964
|
-
fillViewport(clone);
|
|
4965
|
-
const redactSelectors = [
|
|
4966
|
-
ALWAYS_REDACT_SELECTORS,
|
|
4967
|
-
...privacy?.redactSelectors ?? DEFAULT_REDACT_SELECTORS
|
|
4968
|
-
];
|
|
4969
|
-
for (const selector of redactSelectors) {
|
|
4970
|
-
for (const el of safeQueryAll(clone, selector)) {
|
|
4971
|
-
redactElement(el);
|
|
4972
|
-
}
|
|
4973
|
-
}
|
|
4974
|
-
for (const selector of privacy?.blockSelectors ?? []) {
|
|
4975
|
-
for (const el of safeQueryAll(clone, selector)) {
|
|
4976
|
-
el.remove();
|
|
4977
|
-
}
|
|
4978
|
-
}
|
|
4979
|
-
for (const selector of privacy?.maskSelectors ?? []) {
|
|
4980
|
-
for (const el of safeQueryAll(clone, selector)) {
|
|
4981
|
-
maskElement(el);
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
return clone;
|
|
4985
|
-
}
|
|
4986
|
-
function safeQueryAll(root, selector) {
|
|
4987
|
-
try {
|
|
4988
|
-
return Array.from(root.querySelectorAll(selector));
|
|
4989
|
-
} catch {
|
|
4990
|
-
return [];
|
|
4991
|
-
}
|
|
4992
|
-
}
|
|
4993
|
-
function redactElement(el) {
|
|
4994
|
-
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
4995
|
-
el.value = "";
|
|
4996
|
-
el.setAttribute("value", "");
|
|
4997
|
-
}
|
|
4998
|
-
el.textContent = "";
|
|
4999
|
-
el.setAttribute(
|
|
5000
|
-
"style",
|
|
5001
|
-
`${el.getAttribute("style") ?? ""};background:#000!important;color:#000!important;text-shadow:none!important;border-color:#000!important;`
|
|
5002
|
-
);
|
|
5003
|
-
el.setAttribute("data-mushi-redacted", "true");
|
|
5004
|
-
while (el.firstChild) el.removeChild(el.firstChild);
|
|
5005
|
-
}
|
|
5006
|
-
function stripTaintSources(root) {
|
|
5007
|
-
const pageOrigin = typeof location !== "undefined" ? location.origin : "";
|
|
5008
|
-
for (const el of root.querySelectorAll("img, video, iframe, object, embed, picture")) {
|
|
5009
|
-
el.remove();
|
|
5010
|
-
}
|
|
5011
|
-
for (const link of root.querySelectorAll('link[rel="stylesheet"], link[as="style"]')) {
|
|
5012
|
-
link.remove();
|
|
5013
|
-
}
|
|
5014
|
-
for (const styleEl of root.querySelectorAll("style")) {
|
|
5015
|
-
const cleaned = stripCssUrlRefs(styleEl.textContent ?? "", pageOrigin);
|
|
5016
|
-
if (cleaned !== styleEl.textContent) styleEl.textContent = cleaned;
|
|
5017
|
-
}
|
|
5018
|
-
for (const el of root.querySelectorAll("[style]")) {
|
|
5019
|
-
const s = el.getAttribute("style");
|
|
5020
|
-
if (!s) continue;
|
|
5021
|
-
const cleaned = stripCssUrlRefs(s, pageOrigin);
|
|
5022
|
-
if (cleaned !== s) el.setAttribute("style", cleaned);
|
|
5023
|
-
}
|
|
5024
|
-
for (const script of root.querySelectorAll("script")) {
|
|
5025
|
-
script.remove();
|
|
5026
|
-
}
|
|
5027
|
-
}
|
|
5028
|
-
function stripCssUrlRefs(css, pageOrigin) {
|
|
5029
|
-
return css.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi, (_match, _q, href) => {
|
|
5030
|
-
const trimmed = href.trim();
|
|
5031
|
-
if (!trimmed || trimmed.startsWith("data:") || trimmed.startsWith("#")) return _match;
|
|
5032
|
-
if (isCrossOriginUrl(trimmed, pageOrigin)) return "none";
|
|
5033
|
-
return _match;
|
|
5034
|
-
});
|
|
5035
|
-
}
|
|
5036
|
-
function inlineDocumentStyles(clone) {
|
|
5037
|
-
const pageOrigin = typeof location !== "undefined" ? location.origin : "";
|
|
5038
|
-
const chunks = [];
|
|
5039
|
-
const sheets = [
|
|
5040
|
-
...Array.from(document.styleSheets),
|
|
5041
|
-
...document.adoptedStyleSheets ?? []
|
|
5042
|
-
];
|
|
5043
|
-
for (const sheet of sheets) {
|
|
5044
|
-
const owner = sheet.ownerNode;
|
|
5045
|
-
if (owner instanceof Element && owner.tagName === "STYLE") continue;
|
|
5046
|
-
chunks.push(serializeSheet(sheet));
|
|
5047
|
-
}
|
|
5048
|
-
const css = stripCssUrlRefs(chunks.filter(Boolean).join("\n"), pageOrigin);
|
|
5049
|
-
if (!css) return;
|
|
5050
|
-
const styleEl = document.createElement("style");
|
|
5051
|
-
styleEl.textContent = css;
|
|
5052
|
-
(clone.querySelector("head") ?? clone).appendChild(styleEl);
|
|
5053
|
-
}
|
|
5054
|
-
var FREEZE_MOTION_CSS = "*,*::before,*::after{animation:none!important;transition:none!important}";
|
|
5055
|
-
function fillViewport(clone) {
|
|
5056
|
-
const clear = (c) => !c || c === "transparent" || /^rgba\(.*,\s*0\)$/.test(c);
|
|
5057
|
-
let bg = getComputedStyle(document.documentElement).backgroundColor;
|
|
5058
|
-
if (clear(bg) && document.body) bg = getComputedStyle(document.body).backgroundColor;
|
|
5059
|
-
const root = clone;
|
|
5060
|
-
root.style.setProperty("background-color", clear(bg) ? "Canvas" : bg);
|
|
5061
|
-
root.style.setProperty("min-height", `${window.innerHeight}px`);
|
|
5062
|
-
}
|
|
5063
|
-
function freezeMotion(clone) {
|
|
5064
|
-
const styleEl = document.createElement("style");
|
|
5065
|
-
styleEl.textContent = FREEZE_MOTION_CSS;
|
|
5066
|
-
(clone.querySelector("head") ?? clone).appendChild(styleEl);
|
|
5067
|
-
}
|
|
5068
|
-
function serializeSheet(sheet) {
|
|
5069
|
-
let rules;
|
|
5070
|
-
try {
|
|
5071
|
-
rules = sheet.cssRules;
|
|
5072
|
-
} catch {
|
|
5073
|
-
return "";
|
|
5074
|
-
}
|
|
5075
|
-
let text = "";
|
|
5076
|
-
for (const rule of Array.from(rules)) {
|
|
5077
|
-
if (rule instanceof CSSImportRule) {
|
|
5078
|
-
if (rule.styleSheet) text += serializeSheet(rule.styleSheet);
|
|
5079
|
-
continue;
|
|
5080
|
-
}
|
|
5081
|
-
text += `${rule.cssText}
|
|
5082
|
-
`;
|
|
5083
|
-
}
|
|
5084
|
-
return text;
|
|
5085
|
-
}
|
|
5086
|
-
function isCanvasBlank(ctx, width, height) {
|
|
5087
|
-
try {
|
|
5088
|
-
const stepX = Math.max(1, Math.floor(width / 8));
|
|
5089
|
-
const stepY = Math.max(1, Math.floor(height / 8));
|
|
5090
|
-
for (let y = 0; y < height; y += stepY) {
|
|
5091
|
-
for (let x = 0; x < width; x += stepX) {
|
|
5092
|
-
if (ctx.getImageData(x, y, 1, 1).data[3] !== 0) return false;
|
|
5093
|
-
}
|
|
5094
|
-
}
|
|
5095
|
-
return true;
|
|
5096
|
-
} catch {
|
|
5097
|
-
return false;
|
|
5098
|
-
}
|
|
5099
|
-
}
|
|
5100
|
-
function isCrossOriginUrl(raw, pageOrigin) {
|
|
5101
|
-
if (!raw || raw.startsWith("data:") || raw.startsWith("blob:")) return false;
|
|
5102
|
-
try {
|
|
5103
|
-
const resolved = new URL(raw, typeof location !== "undefined" ? location.href : "http://localhost/");
|
|
5104
|
-
return Boolean(pageOrigin) && resolved.origin !== pageOrigin;
|
|
5105
|
-
} catch {
|
|
5106
|
-
return true;
|
|
5107
|
-
}
|
|
5108
|
-
}
|
|
5109
|
-
function maskElement(el) {
|
|
5110
|
-
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
5111
|
-
el.value = "";
|
|
5112
|
-
el.setAttribute("value", "");
|
|
5113
|
-
el.setAttribute("placeholder", "\u2022\u2022\u2022\u2022");
|
|
5114
|
-
}
|
|
5115
|
-
el.textContent = el.children.length === 0 ? "\u2022\u2022\u2022\u2022" : el.textContent;
|
|
5116
|
-
el.setAttribute(
|
|
5117
|
-
"style",
|
|
5118
|
-
`${el.getAttribute("style") ?? ""};background:#8f8f8f!important;color:transparent!important;text-shadow:none!important;`
|
|
5119
|
-
);
|
|
5120
|
-
el.setAttribute("data-mushi-masked", "true");
|
|
5121
|
-
}
|
|
5122
4891
|
|
|
5123
4892
|
// src/capture/performance.ts
|
|
5124
4893
|
var INP_DURATION_THRESHOLD_MS = 40;
|
|
@@ -5774,7 +5543,7 @@ function createLiteReplay(maxMs) {
|
|
|
5774
5543
|
}
|
|
5775
5544
|
};
|
|
5776
5545
|
}
|
|
5777
|
-
var
|
|
5546
|
+
var DEFAULT_REDACT_SELECTORS = ['input[type="password"]', "[data-mushi-redact]"];
|
|
5778
5547
|
var RRWEB_SPECIFIER = "rrweb";
|
|
5779
5548
|
var rrwebModule = null;
|
|
5780
5549
|
var warnedMissingRrweb = false;
|
|
@@ -5825,7 +5594,7 @@ async function createReplayCapture(opts) {
|
|
|
5825
5594
|
const events = [];
|
|
5826
5595
|
let stopFn = null;
|
|
5827
5596
|
let recording = false;
|
|
5828
|
-
const redactSelectors = [.../* @__PURE__ */ new Set([...
|
|
5597
|
+
const redactSelectors = [.../* @__PURE__ */ new Set([...DEFAULT_REDACT_SELECTORS, ...opts.redactSelectors ?? []])];
|
|
5829
5598
|
const stop = () => {
|
|
5830
5599
|
stopFn?.();
|
|
5831
5600
|
stopFn = null;
|
|
@@ -6354,7 +6123,7 @@ function createProactiveManager(config = {}) {
|
|
|
6354
6123
|
|
|
6355
6124
|
// src/version.ts
|
|
6356
6125
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
6357
|
-
var MUSHI_SDK_VERSION = "1.
|
|
6126
|
+
var MUSHI_SDK_VERSION = "1.37.3" ;
|
|
6358
6127
|
function resolveReportAppVersion(config, environment) {
|
|
6359
6128
|
if (config.appVersion) return config.appVersion;
|
|
6360
6129
|
const vercelId = config.integrations?.vercel?.analyticsId;
|
|
@@ -6691,6 +6460,7 @@ function createInstance(config) {
|
|
|
6691
6460
|
let userInfo = null;
|
|
6692
6461
|
let lastIdentifySig = null;
|
|
6693
6462
|
const customMetadata = {};
|
|
6463
|
+
let diagnosticsProvider = null;
|
|
6694
6464
|
const stickyTags = {};
|
|
6695
6465
|
const breadcrumbs = createBreadcrumbBuffer({ max: 50 });
|
|
6696
6466
|
breadcrumbs.add({
|
|
@@ -7366,6 +7136,7 @@ function createInstance(config) {
|
|
|
7366
7136
|
log.warn("Screenshot dropped \u2014 could not compress under wire budget");
|
|
7367
7137
|
}
|
|
7368
7138
|
const capturedEnvironment = captureEnvironment();
|
|
7139
|
+
const hostDiagnostics = await collectDiagnostics(diagnosticsProvider);
|
|
7369
7140
|
const report = {
|
|
7370
7141
|
id: newUuid(),
|
|
7371
7142
|
projectId: config.projectId,
|
|
@@ -7383,6 +7154,7 @@ function createInstance(config) {
|
|
|
7383
7154
|
...replayCap ? { replayEvents: replayCap.flush() } : {},
|
|
7384
7155
|
metadata: {
|
|
7385
7156
|
...customMetadata,
|
|
7157
|
+
...hostDiagnostics ?? {},
|
|
7386
7158
|
...userInfo ? { user: userInfo } : {},
|
|
7387
7159
|
...sentryCtx?.release ? { sentryRelease: sentryCtx.release } : {}
|
|
7388
7160
|
},
|
|
@@ -7567,6 +7339,9 @@ function createInstance(config) {
|
|
|
7567
7339
|
setMetadata(key, value) {
|
|
7568
7340
|
customMetadata[key] = value;
|
|
7569
7341
|
},
|
|
7342
|
+
setDiagnosticsProvider(provider) {
|
|
7343
|
+
diagnosticsProvider = provider;
|
|
7344
|
+
},
|
|
7570
7345
|
setScreen(screen) {
|
|
7571
7346
|
timelineCap.setScreen(screen);
|
|
7572
7347
|
},
|
|
@@ -8177,6 +7952,8 @@ function createNoopInstance() {
|
|
|
8177
7952
|
},
|
|
8178
7953
|
setMetadata: () => {
|
|
8179
7954
|
},
|
|
7955
|
+
setDiagnosticsProvider: () => {
|
|
7956
|
+
},
|
|
8180
7957
|
setScreen: () => {
|
|
8181
7958
|
},
|
|
8182
7959
|
isOpen: () => false,
|
|
@@ -8356,6 +8133,6 @@ function stringifyConsoleArg(arg) {
|
|
|
8356
8133
|
}
|
|
8357
8134
|
}
|
|
8358
8135
|
|
|
8359
|
-
export { Mushi, MushiWidget, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager,
|
|
8136
|
+
export { Mushi, MushiWidget, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager, createTimelineCapture, getAvailableLocales, getLocale, getWidgetPreviewTokens, getWidgetThemeVars, setupProactiveTriggers };
|
|
8360
8137
|
//# sourceMappingURL=index.js.map
|
|
8361
8138
|
//# sourceMappingURL=index.js.map
|