@mushi-mushi/web 1.32.2 → 1.32.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/dist/headless.cjs +49 -31
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.js +49 -31
- package/dist/headless.js.map +1 -1
- package/dist/index.cjs +125 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -6
- package/dist/index.d.ts +25 -6
- package/dist/index.js +126 -51
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +11 -11
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
|
|
1
|
+
import { MushiInitConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiReporterTimelineItem, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiReporterUpdates, MushiApiCascadeConfig, MushiErrorFilter } from '@mushi-mushi/core';
|
|
2
|
+
export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiInitConfig, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
|
|
3
3
|
import { g as ScreenshotFailureReason } from './timeline-B8nMyZyM.cjs';
|
|
4
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-B8nMyZyM.cjs';
|
|
5
5
|
export { MushiLocale, getAvailableLocales, getLocale } from './i18n/index.cjs';
|
|
6
6
|
|
|
7
7
|
declare class Mushi {
|
|
8
8
|
private constructor();
|
|
9
|
-
static init(config
|
|
9
|
+
static init(config?: MushiInitConfig): MushiSDKInstance;
|
|
10
10
|
static getInstance(): MushiSDKInstance | null;
|
|
11
11
|
static destroy(): void;
|
|
12
12
|
static diagnose(): Promise<MushiDiagnosticsResult>;
|
|
@@ -437,9 +437,17 @@ declare class MushiWidget {
|
|
|
437
437
|
private captureFormDrafts;
|
|
438
438
|
/** Replay values (and focus + caret) into fields a patch just created. */
|
|
439
439
|
private restoreFormDrafts;
|
|
440
|
-
/**
|
|
440
|
+
/**
|
|
441
|
+
* Queries `avoidSelectors` and returns a top offset clearing the ones in the
|
|
442
|
+
* top half of the viewport, or null. A bottom tab bar is ignored here: clearing
|
|
443
|
+
* it from the top edge would push the widget off-screen.
|
|
444
|
+
*/
|
|
441
445
|
private computeAvoidTopPx;
|
|
442
|
-
/**
|
|
446
|
+
/**
|
|
447
|
+
* Bottom offset so a bottom-anchored trigger clears avoided elements in the
|
|
448
|
+
* bottom half of the viewport (tab bars, fixed CTAs). A top header is ignored
|
|
449
|
+
* here: clearing it from the bottom edge would push the widget off-screen.
|
|
450
|
+
*/
|
|
443
451
|
private computeAvoidBottomPx;
|
|
444
452
|
private applyInsetVars;
|
|
445
453
|
/** Storage key for the FAB position, scoped to projectId when available. */
|
|
@@ -528,22 +536,33 @@ declare class MushiWidget {
|
|
|
528
536
|
private handleMagicLinkSend;
|
|
529
537
|
/** Open the widget on "Your reports" (`sdk.openReporter()`, the banner's link, a toast). */
|
|
530
538
|
openReporter(): void;
|
|
539
|
+
/** @internal */
|
|
531
540
|
getRecorderStep(): WidgetStep;
|
|
532
|
-
/** QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
541
|
+
/** @internal QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
533
542
|
getRecorderCategoryStepIA(): {
|
|
534
543
|
sectionLabel: string;
|
|
535
544
|
moreToggle: boolean;
|
|
536
545
|
footerStepIndicators: number;
|
|
537
546
|
};
|
|
547
|
+
/** @internal */
|
|
538
548
|
getRecorderTrigger(): Element | null;
|
|
549
|
+
/** @internal */
|
|
539
550
|
getRecorderCategoryButton(category: MushiReportCategory): Element | null;
|
|
551
|
+
/** @internal */
|
|
540
552
|
getRecorderIntentButton(label: string): Element | null;
|
|
553
|
+
/** @internal */
|
|
541
554
|
getRecorderSubmitButton(): Element | null;
|
|
555
|
+
/** @internal */
|
|
542
556
|
recorderClickTrigger(): void;
|
|
557
|
+
/** @internal */
|
|
543
558
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
559
|
+
/** @internal */
|
|
544
560
|
recorderSelectIntent(label: string): void;
|
|
561
|
+
/** @internal */
|
|
545
562
|
recorderFocusDescription(): void;
|
|
563
|
+
/** @internal */
|
|
546
564
|
recorderSubmit(): void;
|
|
565
|
+
/** @internal */
|
|
547
566
|
recorderOpenMyReports(): void;
|
|
548
567
|
}
|
|
549
568
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
|
|
1
|
+
import { MushiInitConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiPrivacyConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiReporterTimelineItem, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiReporterUpdates, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig, MushiErrorFilter } from '@mushi-mushi/core';
|
|
2
|
+
export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiInitConfig, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
|
|
3
3
|
|
|
4
4
|
declare class Mushi {
|
|
5
5
|
private constructor();
|
|
6
|
-
static init(config
|
|
6
|
+
static init(config?: MushiInitConfig): MushiSDKInstance;
|
|
7
7
|
static getInstance(): MushiSDKInstance | null;
|
|
8
8
|
static destroy(): void;
|
|
9
9
|
static diagnose(): Promise<MushiDiagnosticsResult>;
|
|
@@ -455,9 +455,17 @@ declare class MushiWidget {
|
|
|
455
455
|
private captureFormDrafts;
|
|
456
456
|
/** Replay values (and focus + caret) into fields a patch just created. */
|
|
457
457
|
private restoreFormDrafts;
|
|
458
|
-
/**
|
|
458
|
+
/**
|
|
459
|
+
* Queries `avoidSelectors` and returns a top offset clearing the ones in the
|
|
460
|
+
* top half of the viewport, or null. A bottom tab bar is ignored here: clearing
|
|
461
|
+
* it from the top edge would push the widget off-screen.
|
|
462
|
+
*/
|
|
459
463
|
private computeAvoidTopPx;
|
|
460
|
-
/**
|
|
464
|
+
/**
|
|
465
|
+
* Bottom offset so a bottom-anchored trigger clears avoided elements in the
|
|
466
|
+
* bottom half of the viewport (tab bars, fixed CTAs). A top header is ignored
|
|
467
|
+
* here: clearing it from the bottom edge would push the widget off-screen.
|
|
468
|
+
*/
|
|
461
469
|
private computeAvoidBottomPx;
|
|
462
470
|
private applyInsetVars;
|
|
463
471
|
/** Storage key for the FAB position, scoped to projectId when available. */
|
|
@@ -546,22 +554,33 @@ declare class MushiWidget {
|
|
|
546
554
|
private handleMagicLinkSend;
|
|
547
555
|
/** Open the widget on "Your reports" (`sdk.openReporter()`, the banner's link, a toast). */
|
|
548
556
|
openReporter(): void;
|
|
557
|
+
/** @internal */
|
|
549
558
|
getRecorderStep(): WidgetStep;
|
|
550
|
-
/** QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
559
|
+
/** @internal QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
551
560
|
getRecorderCategoryStepIA(): {
|
|
552
561
|
sectionLabel: string;
|
|
553
562
|
moreToggle: boolean;
|
|
554
563
|
footerStepIndicators: number;
|
|
555
564
|
};
|
|
565
|
+
/** @internal */
|
|
556
566
|
getRecorderTrigger(): Element | null;
|
|
567
|
+
/** @internal */
|
|
557
568
|
getRecorderCategoryButton(category: MushiReportCategory): Element | null;
|
|
569
|
+
/** @internal */
|
|
558
570
|
getRecorderIntentButton(label: string): Element | null;
|
|
571
|
+
/** @internal */
|
|
559
572
|
getRecorderSubmitButton(): Element | null;
|
|
573
|
+
/** @internal */
|
|
560
574
|
recorderClickTrigger(): void;
|
|
575
|
+
/** @internal */
|
|
561
576
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
577
|
+
/** @internal */
|
|
562
578
|
recorderSelectIntent(label: string): void;
|
|
579
|
+
/** @internal */
|
|
563
580
|
recorderFocusDescription(): void;
|
|
581
|
+
/** @internal */
|
|
564
582
|
recorderSubmit(): void;
|
|
583
|
+
/** @internal */
|
|
565
584
|
recorderOpenMyReports(): void;
|
|
566
585
|
}
|
|
567
586
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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_TIER_COLORS, readPageFaviconHref, scrubUrl, resolveEnvConfig, diagnoseEnvConfig, validateConfig, expandPreset, createLogger, noopLogger, createApiClient, initSessionTracker, getReporterToken, trackPageView, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, initEventTracker, getSessionId, createBreadcrumbBuffer, sha256Hex, 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 } from '@mushi-mushi/core';
|
|
1
|
+
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, initSessionTracker, getReporterToken, trackPageView, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, initEventTracker, getSessionId, createBreadcrumbBuffer, sha256Hex, 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 } from '@mushi-mushi/core';
|
|
2
2
|
import { isPlausibleReporterEmail, reporterToastMessage, reporterCopy } from '@mushi-mushi/core/reporter-ui';
|
|
3
3
|
import { reporterChannels, subscribeBrowserPush } from '@mushi-mushi/core/reporter-channels';
|
|
4
4
|
|
|
@@ -1323,16 +1323,26 @@ function intentOptions(ctx) {
|
|
|
1323
1323
|
const list = ctx.locale.step2.intents[id] ?? [];
|
|
1324
1324
|
return list.slice(0, -1).slice(0, 4);
|
|
1325
1325
|
}
|
|
1326
|
+
function reportTypeIds(config) {
|
|
1327
|
+
const primary = [...BUILTIN_CHIPS];
|
|
1328
|
+
if (config.featureRequestCard !== false) primary.push("idea");
|
|
1329
|
+
const seen = new Set(primary);
|
|
1330
|
+
const more = [];
|
|
1331
|
+
for (const { id } of config.categories ?? []) {
|
|
1332
|
+
if (seen.has(id)) continue;
|
|
1333
|
+
seen.add(id);
|
|
1334
|
+
more.push(id);
|
|
1335
|
+
}
|
|
1336
|
+
return { primary, more };
|
|
1337
|
+
}
|
|
1326
1338
|
function reportView(ctx) {
|
|
1327
1339
|
const t = ctx.locale;
|
|
1328
1340
|
const p = t.panel;
|
|
1329
1341
|
const s3 = t.step3;
|
|
1330
|
-
const
|
|
1331
|
-
|
|
1332
|
-
const custom = ctx.config.categories ?? [];
|
|
1333
|
-
if (ctx.showAllCategories) ids.push(...custom.map((c) => c.id));
|
|
1342
|
+
const { primary, more: extra } = reportTypeIds(ctx.config);
|
|
1343
|
+
const ids = ctx.showAllCategories ? [...primary, ...extra] : primary;
|
|
1334
1344
|
const chips = ids.map((id, i) => chip(ctx, id, i, ids.includes(ctx.chip ?? "") ? ctx.chip : null)).join("");
|
|
1335
|
-
const more =
|
|
1345
|
+
const more = extra.length && !ctx.showAllCategories ? btn("show-all-categories", esc(p.more), "mushi-chip mushi-chip-more") : "";
|
|
1336
1346
|
const intents = intentOptions(ctx);
|
|
1337
1347
|
const intentRow = intents.length ? `<div class="mushi-chips mushi-intents" role="radiogroup" aria-label="${esc(chipLabel(ctx, ctx.chip))}">${intents.map((it, i) => `<button type="button" class="mushi-chip mushi-chip-sm" role="radio" aria-checked="${ctx.intent === it}" tabindex="${ctx.intent === it || !ctx.intent && i === 0 ? "0" : "-1"}" data-action="intent" data-intent="${esc(it)}">${esc(it)}</button>`).join("")}</div>` : "";
|
|
1338
1348
|
const shotLabel = ctx.screenshotCapturing ? s3.screenshotCapturing : ctx.screenshotError ? s3.screenshotRetry : s3.screenshotButton;
|
|
@@ -2069,19 +2079,27 @@ var MushiWidget = class _MushiWidget {
|
|
|
2069
2079
|
this.onColorSchemeChange = null;
|
|
2070
2080
|
}
|
|
2071
2081
|
/* ── Host chrome contract ────────────────────────────────────────────────
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2082
|
+
The host element must never create an invisible full-screen touch blocker.
|
|
2083
|
+
We own these inline styles; only the shadow internals opt back into
|
|
2084
|
+
pointer events. Idempotent.
|
|
2085
|
+
|
|
2086
|
+
The host must not form a stacking context either. A `position: fixed`
|
|
2087
|
+
element always does, and so does any positioned element with a z-index;
|
|
2088
|
+
either one ranks every surface inside the shadow root at the host's
|
|
2089
|
+
level, so `bannerConfig.zIndex` could never put the banner under the
|
|
2090
|
+
host app's own sheets. The host is an absolute 0×0 box with
|
|
2091
|
+
`z-index: auto`, and the trigger, panel, toast and banner each carry
|
|
2092
|
+
their own z-index, which is then compared directly with the page's. */
|
|
2075
2093
|
syncHostChromeState() {
|
|
2076
2094
|
const s = this.host.style;
|
|
2077
|
-
s.setProperty("position", "
|
|
2095
|
+
s.setProperty("position", "absolute");
|
|
2078
2096
|
s.setProperty("top", "0");
|
|
2079
2097
|
s.setProperty("left", "0");
|
|
2080
2098
|
s.setProperty("width", "0");
|
|
2081
2099
|
s.setProperty("height", "0");
|
|
2082
2100
|
s.setProperty("overflow", "visible");
|
|
2083
2101
|
s.setProperty("pointer-events", "none");
|
|
2084
|
-
s.setProperty("z-index",
|
|
2102
|
+
s.setProperty("z-index", "auto");
|
|
2085
2103
|
s.setProperty("margin", "0");
|
|
2086
2104
|
s.setProperty("padding", "0");
|
|
2087
2105
|
s.setProperty("border", "none");
|
|
@@ -2246,7 +2264,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
2246
2264
|
if (richLayout) {
|
|
2247
2265
|
const body = document.createElement("div");
|
|
2248
2266
|
body.className = "mushi-banner-body";
|
|
2249
|
-
const labelText = bc.label === false ? null : bc.label ??
|
|
2267
|
+
const labelText = bc.label === false ? null : bc.label ?? MUSHI_COPY.bannerLabel;
|
|
2250
2268
|
if (labelText) {
|
|
2251
2269
|
const pill = document.createElement("span");
|
|
2252
2270
|
pill.className = "mushi-banner-pill";
|
|
@@ -2601,32 +2619,44 @@ var MushiWidget = class _MushiWidget {
|
|
|
2601
2619
|
}
|
|
2602
2620
|
}
|
|
2603
2621
|
}
|
|
2604
|
-
/**
|
|
2622
|
+
/**
|
|
2623
|
+
* Queries `avoidSelectors` and returns a top offset clearing the ones in the
|
|
2624
|
+
* top half of the viewport, or null. A bottom tab bar is ignored here: clearing
|
|
2625
|
+
* it from the top edge would push the widget off-screen.
|
|
2626
|
+
*/
|
|
2605
2627
|
computeAvoidTopPx(gap = 8) {
|
|
2606
2628
|
const sels = this.config.avoidSelectors;
|
|
2607
2629
|
if (!sels?.length) return null;
|
|
2630
|
+
const mid = window.innerHeight / 2;
|
|
2608
2631
|
let maxBottom = 0;
|
|
2609
2632
|
for (const sel of sels) {
|
|
2610
2633
|
try {
|
|
2611
2634
|
const el = document.querySelector(sel);
|
|
2612
2635
|
if (!el) continue;
|
|
2613
2636
|
const r = el.getBoundingClientRect();
|
|
2637
|
+
if ((r.top + r.bottom) / 2 >= mid) continue;
|
|
2614
2638
|
if (r.bottom > maxBottom && r.width > 0 && r.height > 0) maxBottom = r.bottom;
|
|
2615
2639
|
} catch {
|
|
2616
2640
|
}
|
|
2617
2641
|
}
|
|
2618
2642
|
return maxBottom > 0 ? Math.ceil(maxBottom) + gap : null;
|
|
2619
2643
|
}
|
|
2620
|
-
/**
|
|
2644
|
+
/**
|
|
2645
|
+
* Bottom offset so a bottom-anchored trigger clears avoided elements in the
|
|
2646
|
+
* bottom half of the viewport (tab bars, fixed CTAs). A top header is ignored
|
|
2647
|
+
* here: clearing it from the bottom edge would push the widget off-screen.
|
|
2648
|
+
*/
|
|
2621
2649
|
computeAvoidBottomPx(gap = 8) {
|
|
2622
2650
|
const sels = this.config.avoidSelectors;
|
|
2623
2651
|
if (!sels?.length) return null;
|
|
2652
|
+
const mid = window.innerHeight / 2;
|
|
2624
2653
|
let maxClearance = 0;
|
|
2625
2654
|
for (const sel of sels) {
|
|
2626
2655
|
try {
|
|
2627
2656
|
const el = document.querySelector(sel);
|
|
2628
2657
|
if (!el) continue;
|
|
2629
2658
|
const r = el.getBoundingClientRect();
|
|
2659
|
+
if ((r.top + r.bottom) / 2 <= mid) continue;
|
|
2630
2660
|
if (r.width > 0 && r.height > 0) {
|
|
2631
2661
|
const clearance = window.innerHeight - r.top + gap;
|
|
2632
2662
|
if (clearance > maxClearance) maxClearance = clearance;
|
|
@@ -3559,10 +3589,13 @@ var MushiWidget = class _MushiWidget {
|
|
|
3559
3589
|
void this.loadReporterReports();
|
|
3560
3590
|
}
|
|
3561
3591
|
/* ── Marketing / Playwright recorder (debug GIF capture) ─────────── */
|
|
3592
|
+
// Hooks for `window.__mushiRecorder` (marketing-recorder.ts, `debug: true`
|
|
3593
|
+
// only). Tagged @internal: not supported public API, may change any release.
|
|
3594
|
+
/** @internal */
|
|
3562
3595
|
getRecorderStep() {
|
|
3563
3596
|
return this.step;
|
|
3564
3597
|
}
|
|
3565
|
-
/** QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
3598
|
+
/** @internal QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
3566
3599
|
getRecorderCategoryStepIA() {
|
|
3567
3600
|
return {
|
|
3568
3601
|
sectionLabel: this.shadow.querySelector("#mushi-title")?.textContent?.trim() ?? "",
|
|
@@ -3570,22 +3603,28 @@ var MushiWidget = class _MushiWidget {
|
|
|
3570
3603
|
footerStepIndicators: 0
|
|
3571
3604
|
};
|
|
3572
3605
|
}
|
|
3606
|
+
/** @internal */
|
|
3573
3607
|
getRecorderTrigger() {
|
|
3574
3608
|
return this.triggerEl;
|
|
3575
3609
|
}
|
|
3610
|
+
/** @internal */
|
|
3576
3611
|
getRecorderCategoryButton(category) {
|
|
3577
3612
|
return this.shadow.querySelector(`[data-category="${category}"]`);
|
|
3578
3613
|
}
|
|
3614
|
+
/** @internal */
|
|
3579
3615
|
getRecorderIntentButton(label) {
|
|
3580
3616
|
return Array.from(this.shadow.querySelectorAll("[data-intent]")).find((el) => el.dataset.intent === label) ?? null;
|
|
3581
3617
|
}
|
|
3618
|
+
/** @internal */
|
|
3582
3619
|
getRecorderSubmitButton() {
|
|
3583
3620
|
return this.shadow.querySelector('[data-action="submit"]');
|
|
3584
3621
|
}
|
|
3622
|
+
/** @internal */
|
|
3585
3623
|
recorderClickTrigger() {
|
|
3586
3624
|
if (this.isOpen) this.close();
|
|
3587
3625
|
this.open();
|
|
3588
3626
|
}
|
|
3627
|
+
/** @internal */
|
|
3589
3628
|
recorderSelectCategory(category) {
|
|
3590
3629
|
if (!this.isOpen) this.open();
|
|
3591
3630
|
this.step = "report";
|
|
@@ -3593,17 +3632,21 @@ var MushiWidget = class _MushiWidget {
|
|
|
3593
3632
|
this.intent = null;
|
|
3594
3633
|
this.render();
|
|
3595
3634
|
}
|
|
3635
|
+
/** @internal */
|
|
3596
3636
|
recorderSelectIntent(label) {
|
|
3597
3637
|
if (!this.isOpen || this.step !== "report") return;
|
|
3598
3638
|
this.intent = label;
|
|
3599
3639
|
this.render();
|
|
3600
3640
|
}
|
|
3641
|
+
/** @internal */
|
|
3601
3642
|
recorderFocusDescription() {
|
|
3602
3643
|
this.shadow.querySelector('[data-role="description"]')?.focus();
|
|
3603
3644
|
}
|
|
3645
|
+
/** @internal */
|
|
3604
3646
|
recorderSubmit() {
|
|
3605
3647
|
this.submitReport();
|
|
3606
3648
|
}
|
|
3649
|
+
/** @internal */
|
|
3607
3650
|
recorderOpenMyReports() {
|
|
3608
3651
|
void this.loadReporterReports();
|
|
3609
3652
|
}
|
|
@@ -3767,10 +3810,8 @@ function exposeMarketingRecorder(widget) {
|
|
|
3767
3810
|
}
|
|
3768
3811
|
|
|
3769
3812
|
// src/history-patch.ts
|
|
3770
|
-
var
|
|
3771
|
-
var
|
|
3772
|
-
var nativePushState = null;
|
|
3773
|
-
var nativeReplaceState = null;
|
|
3813
|
+
var prevPushState = null;
|
|
3814
|
+
var prevReplaceState = null;
|
|
3774
3815
|
var pushWrapper = null;
|
|
3775
3816
|
var replaceWrapper = null;
|
|
3776
3817
|
var popListener = null;
|
|
@@ -3802,24 +3843,24 @@ function notifyPop() {
|
|
|
3802
3843
|
}
|
|
3803
3844
|
function ensurePatch() {
|
|
3804
3845
|
if (patched || typeof window === "undefined") return;
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
const
|
|
3811
|
-
|
|
3812
|
-
notifyPush();
|
|
3846
|
+
const prevPush = history.pushState;
|
|
3847
|
+
const prevReplace = history.replaceState;
|
|
3848
|
+
prevPushState = prevPush;
|
|
3849
|
+
prevReplaceState = prevReplace;
|
|
3850
|
+
const push = function historyPatchPushState(...args) {
|
|
3851
|
+
const ret = prevPush.apply(history, args);
|
|
3852
|
+
if (pushWrapper === push) notifyPush();
|
|
3813
3853
|
return ret;
|
|
3814
3854
|
};
|
|
3815
|
-
|
|
3816
|
-
const
|
|
3817
|
-
|
|
3818
|
-
notifyReplace();
|
|
3855
|
+
const replace = function historyPatchReplaceState(...args) {
|
|
3856
|
+
const ret = prevReplace.apply(history, args);
|
|
3857
|
+
if (replaceWrapper === replace) notifyReplace();
|
|
3819
3858
|
return ret;
|
|
3820
3859
|
};
|
|
3821
|
-
|
|
3822
|
-
|
|
3860
|
+
pushWrapper = push;
|
|
3861
|
+
replaceWrapper = replace;
|
|
3862
|
+
history.pushState = push;
|
|
3863
|
+
history.replaceState = replace;
|
|
3823
3864
|
popListener = () => notifyPop();
|
|
3824
3865
|
window.addEventListener("popstate", popListener);
|
|
3825
3866
|
patched = true;
|
|
@@ -3830,22 +3871,22 @@ function uninstallPatch() {
|
|
|
3830
3871
|
window.removeEventListener("popstate", popListener);
|
|
3831
3872
|
popListener = null;
|
|
3832
3873
|
}
|
|
3833
|
-
if (pushWrapper && history.pushState === pushWrapper &&
|
|
3834
|
-
history.pushState =
|
|
3874
|
+
if (pushWrapper && history.pushState === pushWrapper && prevPushState) {
|
|
3875
|
+
history.pushState = prevPushState;
|
|
3835
3876
|
}
|
|
3836
|
-
if (replaceWrapper && history.replaceState === replaceWrapper &&
|
|
3837
|
-
history.replaceState =
|
|
3877
|
+
if (replaceWrapper && history.replaceState === replaceWrapper && prevReplaceState) {
|
|
3878
|
+
history.replaceState = prevReplaceState;
|
|
3838
3879
|
}
|
|
3839
3880
|
pushWrapper = null;
|
|
3840
3881
|
replaceWrapper = null;
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
nativePushState = null;
|
|
3844
|
-
nativeReplaceState = null;
|
|
3882
|
+
prevPushState = null;
|
|
3883
|
+
prevReplaceState = null;
|
|
3845
3884
|
patched = false;
|
|
3846
3885
|
}
|
|
3847
3886
|
function subscribeHistory(sub) {
|
|
3848
3887
|
ensurePatch();
|
|
3888
|
+
if (!patched) return () => {
|
|
3889
|
+
};
|
|
3849
3890
|
subscribers.add(sub);
|
|
3850
3891
|
return () => {
|
|
3851
3892
|
subscribers.delete(sub);
|
|
@@ -4071,6 +4112,14 @@ function installActivityListeners(projectId) {
|
|
|
4071
4112
|
removeActivityListeners();
|
|
4072
4113
|
}
|
|
4073
4114
|
listenersInstalled = true;
|
|
4115
|
+
try {
|
|
4116
|
+
attachActivityListeners(projectId);
|
|
4117
|
+
} catch (err) {
|
|
4118
|
+
removeActivityListeners();
|
|
4119
|
+
throw err;
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
function attachActivityListeners(projectId) {
|
|
4074
4123
|
const emitRoute = () => {
|
|
4075
4124
|
const route = location.pathname;
|
|
4076
4125
|
if (route === lastRoute) return;
|
|
@@ -4409,6 +4458,10 @@ function createNetworkCapture(options = {}) {
|
|
|
4409
4458
|
const _prevXhrState = xhrStateMap.get(this);
|
|
4410
4459
|
if (_prevXhrState?._listener) {
|
|
4411
4460
|
this.removeEventListener("readystatechange", _prevXhrState._listener);
|
|
4461
|
+
if (_prevXhrState.correlationId) {
|
|
4462
|
+
const idx = _activeCorrelationStack.lastIndexOf(_prevXhrState.correlationId);
|
|
4463
|
+
if (idx !== -1) _activeCorrelationStack.splice(idx, 1);
|
|
4464
|
+
}
|
|
4412
4465
|
}
|
|
4413
4466
|
xhrStateMap.set(this, {
|
|
4414
4467
|
method: String(method).toUpperCase(),
|
|
@@ -4437,6 +4490,8 @@ function createNetworkCapture(options = {}) {
|
|
|
4437
4490
|
if (state.correlationId) _activeCorrelationStack.push(state.correlationId);
|
|
4438
4491
|
const _readystateHandler = () => {
|
|
4439
4492
|
if (this.readyState !== 4) return;
|
|
4493
|
+
this.removeEventListener("readystatechange", _readystateHandler);
|
|
4494
|
+
state._listener = void 0;
|
|
4440
4495
|
if (state.shouldRecord) {
|
|
4441
4496
|
const duration = Date.now() - state.startTime;
|
|
4442
4497
|
const entry = {
|
|
@@ -4462,7 +4517,19 @@ function createNetworkCapture(options = {}) {
|
|
|
4462
4517
|
state._listener = _readystateHandler;
|
|
4463
4518
|
this.addEventListener("readystatechange", _readystateHandler);
|
|
4464
4519
|
}
|
|
4465
|
-
|
|
4520
|
+
try {
|
|
4521
|
+
originalXhrSend.call(this, body);
|
|
4522
|
+
} catch (err) {
|
|
4523
|
+
if (state?.correlationId) {
|
|
4524
|
+
const idx = _activeCorrelationStack.lastIndexOf(state.correlationId);
|
|
4525
|
+
if (idx !== -1) _activeCorrelationStack.splice(idx, 1);
|
|
4526
|
+
}
|
|
4527
|
+
if (state?._listener) {
|
|
4528
|
+
this.removeEventListener("readystatechange", state._listener);
|
|
4529
|
+
state._listener = void 0;
|
|
4530
|
+
}
|
|
4531
|
+
throw err;
|
|
4532
|
+
}
|
|
4466
4533
|
};
|
|
4467
4534
|
}
|
|
4468
4535
|
const xhrOpenWrapper = OriginalXHR ? XMLHttpRequest.prototype.open : null;
|
|
@@ -5169,8 +5236,10 @@ function createTimelineCapture() {
|
|
|
5169
5236
|
onReplace: () => recordRoute("replaceState"),
|
|
5170
5237
|
onPop: () => recordRoute("popstate")
|
|
5171
5238
|
});
|
|
5172
|
-
window
|
|
5173
|
-
document
|
|
5239
|
+
const hasWindow = typeof window !== "undefined";
|
|
5240
|
+
const hasDocument = typeof document !== "undefined";
|
|
5241
|
+
if (hasWindow) window.addEventListener("hashchange", handleHashChange);
|
|
5242
|
+
if (hasDocument) document.addEventListener("click", handleClick, true);
|
|
5174
5243
|
return {
|
|
5175
5244
|
setScreen(screen) {
|
|
5176
5245
|
record({
|
|
@@ -5209,8 +5278,8 @@ function createTimelineCapture() {
|
|
|
5209
5278
|
},
|
|
5210
5279
|
destroy() {
|
|
5211
5280
|
unsubHistory();
|
|
5212
|
-
window.removeEventListener("hashchange", handleHashChange);
|
|
5213
|
-
document.removeEventListener("click", handleClick, true);
|
|
5281
|
+
if (hasWindow) window.removeEventListener("hashchange", handleHashChange);
|
|
5282
|
+
if (hasDocument) document.removeEventListener("click", handleClick, true);
|
|
5214
5283
|
}
|
|
5215
5284
|
};
|
|
5216
5285
|
}
|
|
@@ -6051,7 +6120,7 @@ function createProactiveManager(config = {}) {
|
|
|
6051
6120
|
|
|
6052
6121
|
// src/version.ts
|
|
6053
6122
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
6054
|
-
var MUSHI_SDK_VERSION = "1.32.
|
|
6123
|
+
var MUSHI_SDK_VERSION = "1.32.3" ;
|
|
6055
6124
|
function resolveReportAppVersion(config, environment) {
|
|
6056
6125
|
if (config.appVersion) return config.appVersion;
|
|
6057
6126
|
const vercelId = config.integrations?.vercel?.analyticsId;
|
|
@@ -6062,7 +6131,7 @@ var instance = null;
|
|
|
6062
6131
|
var Mushi = class {
|
|
6063
6132
|
constructor() {
|
|
6064
6133
|
}
|
|
6065
|
-
static init(config) {
|
|
6134
|
+
static init(config = {}) {
|
|
6066
6135
|
if (instance) {
|
|
6067
6136
|
createLogger({ scope: "mushi", level: "warn", format: "pretty" }).warn("Already initialized \u2014 call destroy() first to reinitialize");
|
|
6068
6137
|
return instance;
|
|
@@ -6489,7 +6558,8 @@ function createInstance(config) {
|
|
|
6489
6558
|
screenshotCaptureInFlight = true;
|
|
6490
6559
|
try {
|
|
6491
6560
|
const result = await provider();
|
|
6492
|
-
if (result) return result;
|
|
6561
|
+
if (result?.startsWith("data:image/")) return result;
|
|
6562
|
+
if (result) log.warn("screenshotProvider must resolve to a data:image/ URL; ignoring", { prefix: result.slice(0, 16) });
|
|
6493
6563
|
} catch (err) {
|
|
6494
6564
|
log.warn("screenshotProvider threw, falling back to built-in capturer", {
|
|
6495
6565
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -6532,7 +6602,7 @@ function createInstance(config) {
|
|
|
6532
6602
|
widget = new MushiWidget(bootstrapConfig.widget, {
|
|
6533
6603
|
onSubmit: async ({ category, userCategory, description, intent }) => {
|
|
6534
6604
|
log.info("Report submitted", { category, userCategory, intent });
|
|
6535
|
-
proactiveManager?.recordSubmission();
|
|
6605
|
+
if (pendingProactiveTrigger) proactiveManager?.recordSubmission();
|
|
6536
6606
|
await autoCaptureScreenshot("submit");
|
|
6537
6607
|
const outcome = await submitReport(category, description, intent, userCategory);
|
|
6538
6608
|
return outcome ?? { reportId: null, queuedOffline: true };
|
|
@@ -7467,7 +7537,11 @@ function createInstance(config) {
|
|
|
7467
7537
|
breadcrumbs.add({ category: "lifecycle", level: "info", message: "Mushi.identifyWithToken() refreshed" });
|
|
7468
7538
|
return;
|
|
7469
7539
|
}
|
|
7470
|
-
|
|
7540
|
+
const sub = claims.sub;
|
|
7541
|
+
void sha256Hex(sub).then((hash) => {
|
|
7542
|
+
if (userInfo?.id === sub) updateSessionIdentity(hash);
|
|
7543
|
+
}).catch(() => {
|
|
7544
|
+
});
|
|
7471
7545
|
userInfo = {
|
|
7472
7546
|
id: claims.sub,
|
|
7473
7547
|
...claims.email ? { email: claims.email } : {},
|
|
@@ -7485,6 +7559,7 @@ function createInstance(config) {
|
|
|
7485
7559
|
} else {
|
|
7486
7560
|
userInfo = null;
|
|
7487
7561
|
lastIdentifySig = null;
|
|
7562
|
+
updateSessionIdentity(null);
|
|
7488
7563
|
widget.setIdentifiedUser(null);
|
|
7489
7564
|
breadcrumbs.add({ category: "lifecycle", level: "info", message: "Mushi.identifyWithToken(null)" });
|
|
7490
7565
|
}
|