@mushi-mushi/web 1.37.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 +739 -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 +43 -275
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +20 -19
- package/dist/test-utils.cjs +595 -0
- package/dist/test-utils.cjs.map +1 -1
- package/dist/test-utils.js +595 -0
- package/dist/test-utils.js.map +1 -1
- package/dist/{timeline-B8nMyZyM.d.cts → timeline-BUrJ4n9r.d.cts} +4 -0
- package/package.json +8 -2
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,9 +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';
|
|
2
4
|
import { collectDiagnostics } from '@mushi-mushi/core/diagnostics';
|
|
3
5
|
import { isPlausibleReporterEmail, reporterToastMessage, reporterCopy } from '@mushi-mushi/core/reporter-ui';
|
|
4
6
|
import { reporterChannels, subscribeBrowserPush } from '@mushi-mushi/core/reporter-channels';
|
|
5
7
|
|
|
6
|
-
// src/capture/compress-screenshot.ts
|
|
7
8
|
async function compressScreenshotDataUrl(dataUrl, maxBytes = MAX_SCREENSHOT_DATA_URL_BYTES) {
|
|
8
9
|
if (!dataUrl.startsWith("data:image/")) return dataUrl;
|
|
9
10
|
if (estimateDataUrlBytes(dataUrl) <= maxBytes) return dataUrl;
|
|
@@ -4822,36 +4823,51 @@ function createConsoleCapture() {
|
|
|
4822
4823
|
const originals = {};
|
|
4823
4824
|
const wrappers = {};
|
|
4824
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
|
+
};
|
|
4825
4840
|
for (const level of levels) {
|
|
4826
4841
|
const original = console[level];
|
|
4827
4842
|
originals[level] = original;
|
|
4828
4843
|
const wrapper = (...args) => {
|
|
4829
|
-
const message = args.map((arg) => {
|
|
4830
|
-
try {
|
|
4831
|
-
return typeof arg === "string" ? arg : JSON.stringify(arg);
|
|
4832
|
-
} catch {
|
|
4833
|
-
return String(arg);
|
|
4834
|
-
}
|
|
4835
|
-
}).join(" ").slice(0, MAX_MESSAGE_LENGTH);
|
|
4836
4844
|
const correlationId = getActiveCorrelationId();
|
|
4837
|
-
|
|
4845
|
+
record(
|
|
4838
4846
|
level,
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
if (level === "error" && args[0] instanceof Error) {
|
|
4844
|
-
entry.stack = args[0].stack?.slice(0, 1e3);
|
|
4845
|
-
}
|
|
4846
|
-
entries.push(entry);
|
|
4847
|
-
if (entries.length > MAX_ENTRIES2) {
|
|
4848
|
-
entries.shift();
|
|
4849
|
-
}
|
|
4847
|
+
args.map(str).join(" "),
|
|
4848
|
+
level === "error" ? args.find((a) => a instanceof Error) : void 0,
|
|
4849
|
+
correlationId ? { correlationId } : void 0
|
|
4850
|
+
);
|
|
4850
4851
|
original.call(console, ...args);
|
|
4851
4852
|
};
|
|
4852
4853
|
wrappers[level] = wrapper;
|
|
4853
4854
|
console[level] = wrapper;
|
|
4854
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
|
+
}
|
|
4855
4871
|
return {
|
|
4856
4872
|
getEntries() {
|
|
4857
4873
|
return [...entries];
|
|
@@ -4865,261 +4881,13 @@ function createConsoleCapture() {
|
|
|
4865
4881
|
console[level] = originals[level];
|
|
4866
4882
|
}
|
|
4867
4883
|
}
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
// src/capture/screenshot.ts
|
|
4873
|
-
function createScreenshotCapture(options = {}) {
|
|
4874
|
-
let activeOptions = options;
|
|
4875
|
-
async function take() {
|
|
4876
|
-
try {
|
|
4877
|
-
if (typeof document === "undefined") return null;
|
|
4878
|
-
const canvas = document.createElement("canvas");
|
|
4879
|
-
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
4880
|
-
if (!ctx) {
|
|
4881
|
-
activeOptions.onFailed?.("unsupported");
|
|
4882
|
-
emitScreenshotFailed("unsupported");
|
|
4883
|
-
return null;
|
|
4884
|
+
if (canListen) {
|
|
4885
|
+
window.removeEventListener("error", onUncaught);
|
|
4886
|
+
window.removeEventListener("unhandledrejection", onUncaught);
|
|
4884
4887
|
}
|
|
4885
|
-
const width = window.innerWidth;
|
|
4886
|
-
const height = window.innerHeight;
|
|
4887
|
-
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
4888
|
-
canvas.width = width * dpr;
|
|
4889
|
-
canvas.height = height * dpr;
|
|
4890
|
-
ctx.scale(dpr, dpr);
|
|
4891
|
-
const safeDocument = buildPrivacySafeDocument(activeOptions.privacy);
|
|
4892
|
-
const svgData = `
|
|
4893
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
|
|
4894
|
-
<foreignObject width="100%" height="100%">
|
|
4895
|
-
<div xmlns="http://www.w3.org/1999/xhtml">
|
|
4896
|
-
${new XMLSerializer().serializeToString(safeDocument)}
|
|
4897
|
-
</div>
|
|
4898
|
-
</foreignObject>
|
|
4899
|
-
</svg>
|
|
4900
|
-
`;
|
|
4901
|
-
const img = new Image();
|
|
4902
|
-
const url = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgData)}`;
|
|
4903
|
-
let cspBlocked = false;
|
|
4904
|
-
const onViolation = (e) => {
|
|
4905
|
-
const v = e;
|
|
4906
|
-
if (/^img-src|^default-src/.test(v.violatedDirective ?? "") && /^data/.test(v.blockedURI ?? "")) cspBlocked = true;
|
|
4907
|
-
};
|
|
4908
|
-
document.addEventListener("securitypolicyviolation", onViolation);
|
|
4909
|
-
return new Promise((resolve) => {
|
|
4910
|
-
let settled = false;
|
|
4911
|
-
const settle = (value, reason) => {
|
|
4912
|
-
if (settled) return;
|
|
4913
|
-
settled = true;
|
|
4914
|
-
clearTimeout(timer);
|
|
4915
|
-
document.removeEventListener("securitypolicyviolation", onViolation);
|
|
4916
|
-
if (reason) {
|
|
4917
|
-
activeOptions.onFailed?.(reason);
|
|
4918
|
-
emitScreenshotFailed(reason);
|
|
4919
|
-
}
|
|
4920
|
-
resolve(value);
|
|
4921
|
-
};
|
|
4922
|
-
const timer = setTimeout(() => settle(null, "timeout"), 5e3);
|
|
4923
|
-
img.onload = () => {
|
|
4924
|
-
try {
|
|
4925
|
-
ctx.drawImage(img, 0, 0, width, height);
|
|
4926
|
-
if (isCanvasBlank(ctx, width, height)) {
|
|
4927
|
-
settle(null, "unsupported");
|
|
4928
|
-
return;
|
|
4929
|
-
}
|
|
4930
|
-
settle(canvas.toDataURL("image/jpeg", 0.7));
|
|
4931
|
-
} catch {
|
|
4932
|
-
settle(null, "taint");
|
|
4933
|
-
}
|
|
4934
|
-
};
|
|
4935
|
-
img.onerror = () => setTimeout(() => settle(null, cspBlocked ? "csp" : "error"), 0);
|
|
4936
|
-
img.src = url;
|
|
4937
|
-
});
|
|
4938
|
-
} catch {
|
|
4939
|
-
activeOptions.onFailed?.("error");
|
|
4940
|
-
emitScreenshotFailed("error");
|
|
4941
|
-
return null;
|
|
4942
|
-
}
|
|
4943
|
-
}
|
|
4944
|
-
return {
|
|
4945
|
-
take,
|
|
4946
|
-
updateOptions(nextOptions) {
|
|
4947
|
-
activeOptions = nextOptions;
|
|
4948
4888
|
}
|
|
4949
4889
|
};
|
|
4950
4890
|
}
|
|
4951
|
-
function emitScreenshotFailed(reason) {
|
|
4952
|
-
try {
|
|
4953
|
-
document.dispatchEvent(new CustomEvent("mushi:screenshot_failed", { detail: { reason }, bubbles: false }));
|
|
4954
|
-
} catch {
|
|
4955
|
-
}
|
|
4956
|
-
}
|
|
4957
|
-
var ALWAYS_REDACT_SELECTORS = 'input[type="password"],input[autocomplete^="cc-"],[data-private],[data-mushi-mask]';
|
|
4958
|
-
var DEFAULT_REDACT_SELECTORS = ["[data-mushi-redact]"];
|
|
4959
|
-
function buildPrivacySafeDocument(privacy) {
|
|
4960
|
-
const clone = document.documentElement.cloneNode(true);
|
|
4961
|
-
clone.querySelector("#mushi-mushi-widget")?.remove();
|
|
4962
|
-
stripTaintSources(clone);
|
|
4963
|
-
inlineDocumentStyles(clone);
|
|
4964
|
-
freezeMotion(clone);
|
|
4965
|
-
fillViewport(clone);
|
|
4966
|
-
const redactSelectors = [
|
|
4967
|
-
ALWAYS_REDACT_SELECTORS,
|
|
4968
|
-
...privacy?.redactSelectors ?? DEFAULT_REDACT_SELECTORS
|
|
4969
|
-
];
|
|
4970
|
-
for (const selector of redactSelectors) {
|
|
4971
|
-
for (const el of safeQueryAll(clone, selector)) {
|
|
4972
|
-
redactElement(el);
|
|
4973
|
-
}
|
|
4974
|
-
}
|
|
4975
|
-
for (const selector of privacy?.blockSelectors ?? []) {
|
|
4976
|
-
for (const el of safeQueryAll(clone, selector)) {
|
|
4977
|
-
el.remove();
|
|
4978
|
-
}
|
|
4979
|
-
}
|
|
4980
|
-
for (const selector of privacy?.maskSelectors ?? []) {
|
|
4981
|
-
for (const el of safeQueryAll(clone, selector)) {
|
|
4982
|
-
maskElement(el);
|
|
4983
|
-
}
|
|
4984
|
-
}
|
|
4985
|
-
return clone;
|
|
4986
|
-
}
|
|
4987
|
-
function safeQueryAll(root, selector) {
|
|
4988
|
-
try {
|
|
4989
|
-
return Array.from(root.querySelectorAll(selector));
|
|
4990
|
-
} catch {
|
|
4991
|
-
return [];
|
|
4992
|
-
}
|
|
4993
|
-
}
|
|
4994
|
-
function redactElement(el) {
|
|
4995
|
-
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
4996
|
-
el.value = "";
|
|
4997
|
-
el.setAttribute("value", "");
|
|
4998
|
-
}
|
|
4999
|
-
el.textContent = "";
|
|
5000
|
-
el.setAttribute(
|
|
5001
|
-
"style",
|
|
5002
|
-
`${el.getAttribute("style") ?? ""};background:#000!important;color:#000!important;text-shadow:none!important;border-color:#000!important;`
|
|
5003
|
-
);
|
|
5004
|
-
el.setAttribute("data-mushi-redacted", "true");
|
|
5005
|
-
while (el.firstChild) el.removeChild(el.firstChild);
|
|
5006
|
-
}
|
|
5007
|
-
function stripTaintSources(root) {
|
|
5008
|
-
const pageOrigin = typeof location !== "undefined" ? location.origin : "";
|
|
5009
|
-
for (const el of root.querySelectorAll("img, video, iframe, object, embed, picture")) {
|
|
5010
|
-
el.remove();
|
|
5011
|
-
}
|
|
5012
|
-
for (const link of root.querySelectorAll('link[rel="stylesheet"], link[as="style"]')) {
|
|
5013
|
-
link.remove();
|
|
5014
|
-
}
|
|
5015
|
-
for (const styleEl of root.querySelectorAll("style")) {
|
|
5016
|
-
const cleaned = stripCssUrlRefs(styleEl.textContent ?? "", pageOrigin);
|
|
5017
|
-
if (cleaned !== styleEl.textContent) styleEl.textContent = cleaned;
|
|
5018
|
-
}
|
|
5019
|
-
for (const el of root.querySelectorAll("[style]")) {
|
|
5020
|
-
const s = el.getAttribute("style");
|
|
5021
|
-
if (!s) continue;
|
|
5022
|
-
const cleaned = stripCssUrlRefs(s, pageOrigin);
|
|
5023
|
-
if (cleaned !== s) el.setAttribute("style", cleaned);
|
|
5024
|
-
}
|
|
5025
|
-
for (const script of root.querySelectorAll("script")) {
|
|
5026
|
-
script.remove();
|
|
5027
|
-
}
|
|
5028
|
-
}
|
|
5029
|
-
function stripCssUrlRefs(css, pageOrigin) {
|
|
5030
|
-
return css.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi, (_match, _q, href) => {
|
|
5031
|
-
const trimmed = href.trim();
|
|
5032
|
-
if (!trimmed || trimmed.startsWith("data:") || trimmed.startsWith("#")) return _match;
|
|
5033
|
-
if (isCrossOriginUrl(trimmed, pageOrigin)) return "none";
|
|
5034
|
-
return _match;
|
|
5035
|
-
});
|
|
5036
|
-
}
|
|
5037
|
-
function inlineDocumentStyles(clone) {
|
|
5038
|
-
const pageOrigin = typeof location !== "undefined" ? location.origin : "";
|
|
5039
|
-
const chunks = [];
|
|
5040
|
-
const sheets = [
|
|
5041
|
-
...Array.from(document.styleSheets),
|
|
5042
|
-
...document.adoptedStyleSheets ?? []
|
|
5043
|
-
];
|
|
5044
|
-
for (const sheet of sheets) {
|
|
5045
|
-
const owner = sheet.ownerNode;
|
|
5046
|
-
if (owner instanceof Element && owner.tagName === "STYLE") continue;
|
|
5047
|
-
chunks.push(serializeSheet(sheet));
|
|
5048
|
-
}
|
|
5049
|
-
const css = stripCssUrlRefs(chunks.filter(Boolean).join("\n"), pageOrigin);
|
|
5050
|
-
if (!css) return;
|
|
5051
|
-
const styleEl = document.createElement("style");
|
|
5052
|
-
styleEl.textContent = css;
|
|
5053
|
-
(clone.querySelector("head") ?? clone).appendChild(styleEl);
|
|
5054
|
-
}
|
|
5055
|
-
var FREEZE_MOTION_CSS = "*,*::before,*::after{animation:none!important;transition:none!important}";
|
|
5056
|
-
function fillViewport(clone) {
|
|
5057
|
-
const clear = (c) => !c || c === "transparent" || /^rgba\(.*,\s*0\)$/.test(c);
|
|
5058
|
-
let bg = getComputedStyle(document.documentElement).backgroundColor;
|
|
5059
|
-
if (clear(bg) && document.body) bg = getComputedStyle(document.body).backgroundColor;
|
|
5060
|
-
const root = clone;
|
|
5061
|
-
root.style.setProperty("background-color", clear(bg) ? "Canvas" : bg);
|
|
5062
|
-
root.style.setProperty("min-height", `${window.innerHeight}px`);
|
|
5063
|
-
}
|
|
5064
|
-
function freezeMotion(clone) {
|
|
5065
|
-
const styleEl = document.createElement("style");
|
|
5066
|
-
styleEl.textContent = FREEZE_MOTION_CSS;
|
|
5067
|
-
(clone.querySelector("head") ?? clone).appendChild(styleEl);
|
|
5068
|
-
}
|
|
5069
|
-
function serializeSheet(sheet) {
|
|
5070
|
-
let rules;
|
|
5071
|
-
try {
|
|
5072
|
-
rules = sheet.cssRules;
|
|
5073
|
-
} catch {
|
|
5074
|
-
return "";
|
|
5075
|
-
}
|
|
5076
|
-
let text = "";
|
|
5077
|
-
for (const rule of Array.from(rules)) {
|
|
5078
|
-
if (rule instanceof CSSImportRule) {
|
|
5079
|
-
if (rule.styleSheet) text += serializeSheet(rule.styleSheet);
|
|
5080
|
-
continue;
|
|
5081
|
-
}
|
|
5082
|
-
text += `${rule.cssText}
|
|
5083
|
-
`;
|
|
5084
|
-
}
|
|
5085
|
-
return text;
|
|
5086
|
-
}
|
|
5087
|
-
function isCanvasBlank(ctx, width, height) {
|
|
5088
|
-
try {
|
|
5089
|
-
const stepX = Math.max(1, Math.floor(width / 8));
|
|
5090
|
-
const stepY = Math.max(1, Math.floor(height / 8));
|
|
5091
|
-
for (let y = 0; y < height; y += stepY) {
|
|
5092
|
-
for (let x = 0; x < width; x += stepX) {
|
|
5093
|
-
if (ctx.getImageData(x, y, 1, 1).data[3] !== 0) return false;
|
|
5094
|
-
}
|
|
5095
|
-
}
|
|
5096
|
-
return true;
|
|
5097
|
-
} catch {
|
|
5098
|
-
return false;
|
|
5099
|
-
}
|
|
5100
|
-
}
|
|
5101
|
-
function isCrossOriginUrl(raw, pageOrigin) {
|
|
5102
|
-
if (!raw || raw.startsWith("data:") || raw.startsWith("blob:")) return false;
|
|
5103
|
-
try {
|
|
5104
|
-
const resolved = new URL(raw, typeof location !== "undefined" ? location.href : "http://localhost/");
|
|
5105
|
-
return Boolean(pageOrigin) && resolved.origin !== pageOrigin;
|
|
5106
|
-
} catch {
|
|
5107
|
-
return true;
|
|
5108
|
-
}
|
|
5109
|
-
}
|
|
5110
|
-
function maskElement(el) {
|
|
5111
|
-
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
5112
|
-
el.value = "";
|
|
5113
|
-
el.setAttribute("value", "");
|
|
5114
|
-
el.setAttribute("placeholder", "\u2022\u2022\u2022\u2022");
|
|
5115
|
-
}
|
|
5116
|
-
el.textContent = el.children.length === 0 ? "\u2022\u2022\u2022\u2022" : el.textContent;
|
|
5117
|
-
el.setAttribute(
|
|
5118
|
-
"style",
|
|
5119
|
-
`${el.getAttribute("style") ?? ""};background:#8f8f8f!important;color:transparent!important;text-shadow:none!important;`
|
|
5120
|
-
);
|
|
5121
|
-
el.setAttribute("data-mushi-masked", "true");
|
|
5122
|
-
}
|
|
5123
4891
|
|
|
5124
4892
|
// src/capture/performance.ts
|
|
5125
4893
|
var INP_DURATION_THRESHOLD_MS = 40;
|
|
@@ -5775,7 +5543,7 @@ function createLiteReplay(maxMs) {
|
|
|
5775
5543
|
}
|
|
5776
5544
|
};
|
|
5777
5545
|
}
|
|
5778
|
-
var
|
|
5546
|
+
var DEFAULT_REDACT_SELECTORS = ['input[type="password"]', "[data-mushi-redact]"];
|
|
5779
5547
|
var RRWEB_SPECIFIER = "rrweb";
|
|
5780
5548
|
var rrwebModule = null;
|
|
5781
5549
|
var warnedMissingRrweb = false;
|
|
@@ -5826,7 +5594,7 @@ async function createReplayCapture(opts) {
|
|
|
5826
5594
|
const events = [];
|
|
5827
5595
|
let stopFn = null;
|
|
5828
5596
|
let recording = false;
|
|
5829
|
-
const redactSelectors = [.../* @__PURE__ */ new Set([...
|
|
5597
|
+
const redactSelectors = [.../* @__PURE__ */ new Set([...DEFAULT_REDACT_SELECTORS, ...opts.redactSelectors ?? []])];
|
|
5830
5598
|
const stop = () => {
|
|
5831
5599
|
stopFn?.();
|
|
5832
5600
|
stopFn = null;
|
|
@@ -6355,7 +6123,7 @@ function createProactiveManager(config = {}) {
|
|
|
6355
6123
|
|
|
6356
6124
|
// src/version.ts
|
|
6357
6125
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
6358
|
-
var MUSHI_SDK_VERSION = "1.37.
|
|
6126
|
+
var MUSHI_SDK_VERSION = "1.37.3" ;
|
|
6359
6127
|
function resolveReportAppVersion(config, environment) {
|
|
6360
6128
|
if (config.appVersion) return config.appVersion;
|
|
6361
6129
|
const vercelId = config.integrations?.vercel?.analyticsId;
|
|
@@ -8365,6 +8133,6 @@ function stringifyConsoleArg(arg) {
|
|
|
8365
8133
|
}
|
|
8366
8134
|
}
|
|
8367
8135
|
|
|
8368
|
-
export { Mushi, MushiWidget, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager,
|
|
8136
|
+
export { Mushi, MushiWidget, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager, createTimelineCapture, getAvailableLocales, getLocale, getWidgetPreviewTokens, getWidgetThemeVars, setupProactiveTriggers };
|
|
8369
8137
|
//# sourceMappingURL=index.js.map
|
|
8370
8138
|
//# sourceMappingURL=index.js.map
|