@mushi-mushi/web 1.30.0 → 1.31.1

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 CHANGED
@@ -64,7 +64,8 @@ maintainer deep-dive: [SDK_RUNTIME_CONFIG.md](https://github.com/kensaurus/mushi
64
64
 
65
65
  ## Features
66
66
 
67
- - Shadow-DOM widget with CSS isolation, light/dark auto-theme, keyboard-first (`Esc` / `⌘+Enter`), and `prefers-reduced-motion`.
67
+ - One-screen report: free text first, optional type chips, one attachments row, Send. Reporters see their reports, plain-English statuses, developer replies, and "Fixed in v1.4 — does it work now?" in **Your reports**.
68
+ - Shadow-DOM widget with CSS isolation, host-adaptive theming (CSS tokens), light/dark, keyboard-first (`Esc` / `⌘+Enter`, focus trap), and `prefers-reduced-motion`.
68
69
  - Screenshot, console ring buffer, network (fetch interceptor), Web Vitals, and a repro timeline of routes + clicks.
69
70
  - IndexedDB offline queue with auto-sync, on-device spam pre-filter, client-side rate limiting, and a payload-size guard that degrades instead of wedging the queue.
70
71
  - Host element is zero-sized with `pointer-events: none`; only visible controls opt back in. Verify with `Mushi.diagnose()`.
@@ -121,7 +122,7 @@ Mushi.init({
121
122
  });
122
123
  ```
123
124
 
124
- The details step renders the attached screenshot as a visible preview (not just a checkmark) with a **Remove** control and a configurable privacy caption (`widget.screenshotSensitiveHint`). A "Mark up" overlay lets reporters highlight / blur / arrow before submitting.
125
+ The report screen renders the attached screenshot as a thumbnail (tap to enlarge) with a **Remove** control and a configurable privacy caption (`widget.screenshotSensitiveHint`). A "Mark up" overlay lets reporters highlight / blur / arrow before submitting.
125
126
  </details>
126
127
 
127
128
  <details>
@@ -217,7 +218,7 @@ const mushi = Mushi.init({
217
218
  mushi.show();
218
219
  mushi.hide();
219
220
  mushi.setTrigger('manual'); // switch posture at runtime
220
- mushi.openWith('bug'); // open straight into a category
221
+ mushi.openWith('bug'); // open the report screen with the Bug type picked
221
222
  mushi.attachTo('#support-menu'); // bind the launcher to your element
222
223
  ```
223
224
 
@@ -314,7 +315,20 @@ Screenshot capture uses canvas / SVG `foreignObject` serialization — it does n
314
315
 
315
316
  ## Bundle size
316
317
 
317
- ~7 KB brotli, enforced at 89.5 KB gzipped (105 KB uncompressed) in CI. Requires `@mushi-mushi/core` (installed automatically, not bundled inline). The widget's visual system — washi paper, sumi ink, vermillion 朱 accent, system serif — lives in [`src/styles.ts`](./src/styles.ts).
318
+ ~7 KB brotli, enforced at 89.5 KB gzipped (105 KB uncompressed) in CI. Requires `@mushi-mushi/core` (installed automatically, not bundled inline). The widget looks like part of your app by default: your page's font, system light/dark colours, and an accent taken from `widget.accent`, then your `--mushi-accent`, `accent-color` or `<meta name="theme-color">` (ignored when it would vanish against the panel). Every colour is a CSS token you can set on `:root` or `#mushi-mushi-widget`, and CSS wins over JS config:
319
+
320
+ ```css
321
+ #mushi-mushi-widget {
322
+ --mushi-accent: #b8860b; /* Send button, focus ring */
323
+ --mushi-accent-fg: #000; /* text on the accent */
324
+ --mushi-font: Georgia, serif; /* default: inherit */
325
+ --mushi-bg: Canvas; --mushi-fg: CanvasText;
326
+ /* also: --mushi-muted, --mushi-surface, --mushi-border, --mushi-success,
327
+ --mushi-error, --mushi-radius, --mushi-shadow, --mushi-font-size */
328
+ }
329
+ ```
330
+
331
+ Styles live in [`src/styles.ts`](./src/styles.ts).
318
332
 
319
333
  ## License
320
334
 
@@ -323,4 +337,4 @@ MIT
323
337
  <!-- mushi-readme-stats-footer -->
324
338
  ---
325
339
 
326
- <sub>Monorepo scale (July 2026): 60 edge functions · 383 SQL migrations · 13 outbound plugins · 11 inbound adapters · 19 pipeline agents. Canonical counts: <a href="https://github.com/kensaurus/mushi-mushi/blob/master/docs/stats.md">docs/stats.md</a> · <code>pnpm docs-stats</code></sub>
340
+ <sub>Monorepo scale (July 2026): 64 edge functions · 410 SQL migrations · 13 outbound plugins · 11 inbound adapters · 19 pipeline agents. Canonical counts: <a href="https://github.com/kensaurus/mushi-mushi/blob/master/docs/stats.md">docs/stats.md</a> · <code>pnpm docs-stats</code></sub>
@@ -0,0 +1,233 @@
1
+ import { reporterStatus, fillReporterTemplate, reporterCopy, isReporterConversation, reporterTimelineEntryText } from '@mushi-mushi/core/reporter-ui';
2
+
3
+ // src/widget-views.ts
4
+ var esc;
5
+ var btn;
6
+ var renderHeader;
7
+ var chipLabel;
8
+ var skeleton;
9
+ var formatRelativeTime;
10
+ var renderAppIconHtml;
11
+ function initViews(kit) {
12
+ ({ esc, btn, renderHeader, chipLabel, skeleton, formatRelativeTime, renderAppIconHtml } = kit);
13
+ }
14
+ function pickUpdateToast(reports, lang, repliedText) {
15
+ const unread = reports.filter((r) => (r.unread_count ?? 0) > 0 && !reporterStatus(r, lang).hidden);
16
+ const total = unread.reduce((n, r) => n + (r.unread_count ?? 0), 0);
17
+ if (!total) return null;
18
+ if (unread.length > 1) return { text: fillReporterTemplate(reporterCopy(lang).ui.updates, { n: total }), reportId: null };
19
+ const report = unread[0];
20
+ const status = reporterStatus(report, lang);
21
+ const statusNews = status.key === "fixing" || status.canVerify || !report.last_admin_reply_at && status.key !== "waiting";
22
+ const detail = report.title ?? report.summary ?? void 0;
23
+ return { text: statusNews ? status.label : repliedText, reportId: report.id, ...detail ? { detail } : {} };
24
+ }
25
+ function renderOptIns(ctx) {
26
+ const p = ctx.locale.panel;
27
+ const out = [];
28
+ if (ctx.channels.email && ctx.callbacks.onReporterEmailOptIn) {
29
+ const ui = ctx.rc.ui;
30
+ if (ctx.emailState === "saved") out.push(`<p class="mushi-note" role="status">\u2709 ${esc(ui.emailCheckInbox)}</p>`);
31
+ else {
32
+ out.push(`<label class="mushi-check"><input type="checkbox" data-action="email-optin"${ctx.emailOptInOpen ? " checked" : ""} /> ${esc(ui.emailOptIn)}</label>`);
33
+ if (ctx.emailOptInOpen) {
34
+ out.push(`<div class="mushi-inline-form"><input type="email" class="mushi-input" data-role="optin-email" autocomplete="email" aria-label="${esc(ui.emailOptIn)}" placeholder="${esc(ui.emailPlaceholder)}" value="${esc(ctx.channels.emailPrefill)}" />${btn("save-email", esc(ui.emailSubmit), "mushi-btn", ctx.emailState === "saving" ? ' aria-busy="true"' : "")}</div>${ctx.emailState === "invalid" || ctx.emailState === "error" ? `<p class="mushi-note mushi-error-inline" role="alert">${esc(ctx.emailState === "invalid" ? ui.emailInvalid : ui.emailFailed)}</p>` : ""}`);
35
+ }
36
+ }
37
+ }
38
+ if (ctx.channels.push && ctx.callbacks.onReporterPushSubscribe) {
39
+ out.push(ctx.pushState === "on" ? `<p class="mushi-note" role="status">\u{1F514} ${esc(p.notifyOn)}</p>` : btn("notify-me", `\u{1F514} ${esc(p.notifyMe)}`, "mushi-btn", ctx.pushState === "asking" ? ' aria-busy="true"' : ""));
40
+ if (ctx.pushState === "error") out.push(`<p class="mushi-note mushi-error-inline" role="alert">${esc(ctx.rc.ui.sendFailed)}</p>`);
41
+ }
42
+ return out.length ? `<div class="mushi-optins">${out.join("")}</div>` : "";
43
+ }
44
+ function statusPill(label, tone) {
45
+ return `<span class="mushi-pill mushi-tone-${tone}">${esc(label)}</span>`;
46
+ }
47
+ function reportTitle(r) {
48
+ return r.title ?? r.summary ?? r.description ?? `#${r.id.slice(0, 8)}`;
49
+ }
50
+ function typeLabel(ctx, userCategory) {
51
+ const id = (userCategory ?? "").toLowerCase();
52
+ if (!id || id === "other") return "";
53
+ return chipLabel(ctx, id === "feature_request" ? "idea" : id);
54
+ }
55
+ function orderReports(reports) {
56
+ const at = (r) => Date.parse(r.last_event_at ?? r.created_at) || 0;
57
+ return [...reports].sort((a, b) => Number((b.unread_count ?? 0) > 0) - Number((a.unread_count ?? 0) > 0) || at(b) - at(a));
58
+ }
59
+ function reportRow(ctx, r) {
60
+ const st = reporterStatus(r, ctx.lang);
61
+ if (st.hidden) return "";
62
+ const unread = (r.unread_count ?? 0) > 0;
63
+ const meta = [typeLabel(ctx, r.user_category), r.page, st.othersNote].filter(Boolean).map((x) => esc(String(x))).join(" \xB7 ");
64
+ const news = r.last_event_preview && (unread || st.key === "waiting") ? ctx.rc.ui.developerReplied.replace("{text}", r.last_event_preview) : st.canVerify && st.key !== "fixed_next" ? st.detail : "";
65
+ const title = reportTitle(r);
66
+ return `<button type="button" class="mushi-report-row${unread ? " unread" : ""}" data-report-id="${esc(r.id)}" aria-label="${esc(`${st.label}: ${title}`)}"><span class="mushi-row-top">${statusPill(st.label, st.tone)}<span class="mushi-row-title">${esc(title)}</span><span class="mushi-row-when">${esc(formatRelativeTime(r.last_event_at ?? r.created_at))}</span></span>${meta ? `<span class="mushi-row-meta">${meta}</span>` : ""}${news ? `<span class="mushi-row-news">${esc(news)}</span>` : ""}</button>`;
67
+ }
68
+ function reportsView(ctx) {
69
+ const rc = ctx.rc;
70
+ const rows = orderReports(ctx.reporterReports).map((r) => reportRow(ctx, r)).join("");
71
+ const body = ctx.reporterError ? `<p class="mushi-error-inline" role="alert">${esc(rc.ui.loadError)} ${btn("retry-list", esc(rc.ui.retry), "mushi-link-btn")}</p>${rows}` : rows || (ctx.listLoading ? skeleton(ctx.locale.flows.reports.loading) : `<p class="mushi-empty">${esc(rc.ui.empty)}</p>`);
72
+ return { header: renderHeader(ctx, ctx.locale.flows.reports.title, true), lead: "", body: `<div class="mushi-report-list">${body}</div>`, footer: "" };
73
+ }
74
+ function buildTimeline(ctx, report) {
75
+ const rc = ctx.rc;
76
+ const out = [];
77
+ if (ctx.timeline) {
78
+ for (const e of ctx.timeline) {
79
+ const mine = e.kind === "reporter_comment";
80
+ out.push({
81
+ kind: e.kind,
82
+ at: e.at,
83
+ // Pipeline events re-render from the template in the reporter's
84
+ // language; developer and reporter words are shown as written.
85
+ text: isReporterConversation(e) ? e.body ?? e.text : reporterTimelineEntryText(e, ctx.lang),
86
+ talk: isReporterConversation(e),
87
+ mine,
88
+ who: mine ? rc.ui.you : rc.ui.developer
89
+ });
90
+ }
91
+ } else {
92
+ if (report) out.push({ kind: "received", at: report.created_at, text: rc.timeline.received });
93
+ for (const c of ctx.reporterComments) {
94
+ const mine = c.author_kind === "reporter";
95
+ out.push({ kind: mine ? "reporter_comment" : "comment", at: c.created_at, text: c.body, talk: true, mine, who: mine ? rc.ui.you : c.author_name ?? rc.ui.developer });
96
+ }
97
+ }
98
+ out.sort((a, b) => (Date.parse(a.at) || 0) - (Date.parse(b.at) || 0));
99
+ for (const r of ctx.pendingReplies) out.push({ kind: "reporter_comment", at: "", text: r.body, who: rc.ui.you, talk: true, mine: true, pending: r });
100
+ return out;
101
+ }
102
+ function entryHtml(ctx, e) {
103
+ const when = e.at ? `<time datetime="${esc(e.at)}">${esc(formatRelativeTime(e.at))}</time>` : "";
104
+ if (!e.talk) return `<li class="mushi-event"><span>${esc(e.text)}</span>${when}</li>`;
105
+ const mine = Boolean(e.mine);
106
+ const state = e.pending ? e.pending.state === "sending" ? `<span class="mushi-bubble-state">${esc(ctx.rc.ui.sending)}</span>` : `<span class="mushi-bubble-state mushi-error-inline">${esc(ctx.rc.ui.sendFailed)} \xB7 ${btn("retry-reply", esc(ctx.rc.ui.retry), "mushi-link-btn", ` data-value="${e.pending.id}"`)}</span>` : when;
107
+ return `<li class="mushi-bubble ${mine ? "mine" : "dev"}"><strong>${esc(e.who ?? "")}</strong><p>${esc(e.text)}</p>${state}</li>`;
108
+ }
109
+ function detailView(ctx) {
110
+ const rc = ctx.rc;
111
+ const report = ctx.reporterReports.find((r) => r.id === ctx.selectedReportId);
112
+ const st = reporterStatus(report ?? { status: "new" }, ctx.lang);
113
+ const meta = [report?.page, report?.app_version ? `v${report.app_version}` : "", report ? formatRelativeTime(report.created_at) : ""].filter(Boolean).map((x) => esc(String(x))).join(" \xB7 ");
114
+ const lead = `<div class="mushi-thread-summary"><p class="mushi-card-status">${statusPill(st.label, st.tone)}</p><p class="mushi-note">${esc(st.detail)}${st.othersNote ? ` ${esc(st.othersNote)}.` : ""}</p><p class="mushi-summary-text">${esc(report ? report.description ?? reportTitle(report) : `#${(ctx.selectedReportId ?? "").slice(0, 8)}`)}</p>${report?.screenshot_thumb_url ? `<img class="mushi-card-thumb" src="${esc(report.screenshot_thumb_url)}" alt="" />` : ""}${meta ? `<p class="mushi-note">${meta}</p>` : ""}</div>`;
115
+ const entries = buildTimeline(ctx, report);
116
+ const hasDev = entries.some((e) => e.talk && !e.mine);
117
+ let body;
118
+ if (ctx.threadLoading && entries.length <= 1 && !ctx.pendingReplies.length) {
119
+ body = skeleton(ctx.locale.flows.thread.loading);
120
+ } else {
121
+ body = `${ctx.threadError ? `<p class="mushi-error-inline" role="alert">${esc(rc.ui.loadError)} ${btn("retry-thread", esc(rc.ui.retry), "mushi-link-btn")}</p>` : ""}<ol class="mushi-timeline">${entries.map((e) => entryHtml(ctx, e)).join("")}</ol>${!hasDev && !ctx.threadError && !ctx.threadLoading ? `<p class="mushi-empty">${esc(rc.ui.noReplies)}</p>` : ""}`;
122
+ }
123
+ const busy = ctx.actionPending ? ' disabled aria-busy="true"' : "";
124
+ const verify = st.canVerify ? `<div class="mushi-verify" role="group" aria-label="${esc(st.detail)}">${btn("reporter-confirms", esc(rc.ui.yes), "mushi-btn", busy)}${btn("reporter-not-fixed", esc(rc.ui.notYet), "mushi-btn", busy)}</div>` : "";
125
+ return {
126
+ header: renderHeader(ctx, ctx.locale.panel.reportTitle, true),
127
+ lead,
128
+ body: `<div class="mushi-thread">${body}</div>${renderOptIns(ctx)}`,
129
+ footer: `${verify}${ctx.actionError ? `<p class="mushi-error-inline mushi-thread-action-error" role="alert">${esc(ctx.actionError)}</p>` : ""}<div class="mushi-thread-composer"><textarea class="mushi-input mushi-reply" data-role="reporter-reply" rows="1" maxlength="2000" placeholder="${esc(ctx.locale.flows.thread.replyPlaceholder)}" aria-label="${esc(ctx.locale.flows.thread.replyPlaceholder)}"></textarea>${btn("reporter-reply", "\u2191", "mushi-submit mushi-send", ` aria-label="${esc(ctx.locale.panel.send)}"`)}</div>`
130
+ };
131
+ }
132
+ function assistantView(ctx) {
133
+ const t = ctx.locale.assistant;
134
+ const greeting = ctx.callbacks.assistantGreeting || t.defaultGreeting;
135
+ const chips = (opts) => opts.length ? `<div class="mushi-chips">${opts.map((s) => `<button type="button" class="mushi-chip mushi-chip-sm" data-action="assistant-suggest" data-value="${esc(s)}">${esc(s)}</button>`).join("")}</div>` : "";
136
+ const report = (label, cls = "mushi-link-btn") => btn("assistant-report", esc(label), cls);
137
+ const turns = ctx.assistantTurns.length === 0 ? `<p class="mushi-assistant-greeting">${esc(greeting)}</p>${chips(ctx.callbacks.assistantSuggestions ?? [])}` : ctx.assistantTurns.map((turn) => `<div class="mushi-assistant-msg ${turn.role === "user" ? "mine" : "dev"}">${esc(turn.text)}</div>${chips(turn.options ?? [])}${turn.offerReport ? report(t.fileReportCta, "mushi-btn") : ""}`).join("");
138
+ const thinking = ctx.assistantSending ? `<div class="mushi-assistant-msg dev" role="status" aria-live="polite">${esc(t.thinking)}</div>` : "";
139
+ const error = ctx.assistantError ? `<p class="mushi-error-inline" role="alert">${esc(ctx.assistantError)} ${report(t.fileReportCta)}</p>` : "";
140
+ const stuck = ctx.assistantTurns.length && !ctx.assistantSending && !ctx.assistantError ? report(t.stillStuckCta) : "";
141
+ return {
142
+ header: renderHeader(ctx, ctx.callbacks.assistantLabel || t.defaultLabel, true),
143
+ lead: "",
144
+ body: `<div class="mushi-assistant-log">${turns}${thinking}${error}${stuck}</div>`,
145
+ footer: `<form class="mushi-thread-composer" data-action="assistant-send"><textarea class="mushi-input mushi-reply mushi-assistant-input" rows="1" placeholder="${esc(t.inputPlaceholder)}" aria-label="${esc(t.inputPlaceholder)}"${ctx.assistantSending ? " disabled" : ""}></textarea><button type="submit" class="mushi-submit mushi-send" aria-label="${esc(t.sendAriaLabel)}"${ctx.assistantSending ? " disabled" : ""}>\u2191</button></form>`
146
+ };
147
+ }
148
+ function roadmapView(ctx) {
149
+ const f = ctx.locale.flows.roadmap;
150
+ const rows = ctx.featureBoard.map((ticket) => {
151
+ const id = String(ticket.id ?? "");
152
+ const voted = Boolean(ticket.my_vote);
153
+ const status = ticket.shipped_at ? f.shipped : String(ticket.status_label ?? ticket.status ?? "open");
154
+ return `<div class="mushi-report-row mushi-roadmap-row"><span class="mushi-row-top"><span class="mushi-row-title">${esc(String(ticket.subject ?? f.untitled))}</span></span><span class="mushi-row-meta">${esc(status)} \xB7 ${esc(f.voteCount.replace("{n}", String(Number(ticket.vote_count ?? 0))))}</span>${ctx.callbacks.onFeatureBoardVote ? `<button type="button" class="mushi-btn" data-vote-id="${esc(id)}" aria-pressed="${voted}">${esc(voted ? f.voted : f.vote)}</button>` : ""}</div>`;
155
+ }).join("");
156
+ return {
157
+ header: renderHeader(ctx, f.title, true),
158
+ lead: "",
159
+ body: `${ctx.reporterError ? `<p class="mushi-error-inline" role="alert">${esc(ctx.reporterError)}</p>` : ""}${rows || (ctx.listLoading ? skeleton(f.loading) : `<p class="mushi-empty">${esc(f.empty)}</p>`)}`,
160
+ footer: ""
161
+ };
162
+ }
163
+ function leaderboardView(ctx) {
164
+ const f = ctx.locale.flows.leaderboard;
165
+ const isGlobal = ctx.globalLeaderboard !== null || ctx.globalLeaderboardLoading;
166
+ const entries = isGlobal ? ctx.globalLeaderboard ?? [] : ctx.leaderboardEntries ?? [];
167
+ const loading = isGlobal ? ctx.globalLeaderboardLoading : ctx.leaderboardLoading;
168
+ const rows = entries.map((e, i) => {
169
+ const rank = e.rank || i + 1;
170
+ const me = ctx.testerReputation && e.tester_id === ctx.testerReputation.tester_id;
171
+ return `<li class="mushi-lb-row${me ? " me" : ""}"><span>#${rank}</span><span class="mushi-row-title">${esc(e.public_handle ?? e.display_name ?? f.anon)}</span><span>${(e.points_30d ?? e.total_points).toLocaleString()} pts</span></li>`;
172
+ }).join("");
173
+ const myRank = ctx.testerReputation?.rank;
174
+ return {
175
+ header: renderHeader(ctx, f.title, true),
176
+ lead: "",
177
+ body: `${loading ? skeleton(f.loading) : ""}${!loading && !entries.length ? `<p class="mushi-empty">${esc(f.empty)}</p>` : ""}<ol class="mushi-lb">${rows}</ol>${myRank ? `<p class="mushi-note">${esc(f.myRank.replace("{rank}", String(myRank)))}</p>` : !ctx.testerJwt ? btn("open-account", esc(f.signInPrompt), "mushi-link-btn") : ""}<p class="mushi-note">${esc(f.footer)}</p>`,
178
+ footer: ""
179
+ };
180
+ }
181
+ function accountView(ctx) {
182
+ const f = ctx.locale.flows.account;
183
+ const tester = ctx.testerInfo;
184
+ if (tester) {
185
+ const handle = tester.public_handle ?? tester.display_name ?? ctx.locale.flows.leaderboard.anon;
186
+ const rep = ctx.testerReputation;
187
+ const rank = rep ? f.rankSummary.replace("{rank}", String(rep.rank ?? "\u2014")).replace("{points}", (rep.points_30d ?? 0).toLocaleString()) : "";
188
+ return {
189
+ header: renderHeader(ctx, f.title, true),
190
+ lead: "",
191
+ body: `<div class="mushi-thread-summary"><p class="mushi-summary-text">${esc(handle)}</p>${rank ? `<p class="mushi-note">${esc(rank)}</p>` : ""}</div>${btn("open-cross-app-reports", esc(f.crossAppReports), "mushi-menu-item")}${btn("open-global-leaderboard", esc(f.viewLeaderboard), "mushi-menu-item")}${btn("sign-out-tester", esc(f.signOut), "mushi-link-btn")}`,
192
+ footer: ""
193
+ };
194
+ }
195
+ if (ctx.magicLinkSent) {
196
+ return {
197
+ header: renderHeader(ctx, f.checkEmailTitle, true),
198
+ lead: "",
199
+ body: `<p class="mushi-note">${esc(f.magicLinkSent.replace("{email}", ctx.magicLinkEmail))}</p>${btn("resend-magic-link", esc(f.resendEmail), "mushi-link-btn")}${ctx.magicLinkError ? `<p class="mushi-error-inline" role="alert">${esc(ctx.magicLinkError)}</p>` : ""}`,
200
+ footer: ""
201
+ };
202
+ }
203
+ return {
204
+ header: renderHeader(ctx, f.joinTitle, true),
205
+ lead: "",
206
+ body: `<p class="mushi-note">${esc(f.signInPrompt)}</p><input type="email" class="mushi-input" data-role="magic-link-email" aria-label="${esc(f.emailLabel)}" placeholder="${esc(f.emailPlaceholder)}" autocomplete="email" value="${esc(ctx.magicLinkEmail)}" />${ctx.magicLinkError ? `<p class="mushi-error-inline" role="alert">${esc(ctx.magicLinkError)}</p>` : ""}`,
207
+ footer: `<span></span>${btn("send-magic-link", esc(ctx.magicLinkSending ? f.sending : f.sendLink), "mushi-submit", ctx.magicLinkSending ? ' aria-busy="true"' : "")}`
208
+ };
209
+ }
210
+ function crossAppView(ctx) {
211
+ const f = ctx.locale.flows.crossApp;
212
+ const reports = ctx.crossAppReports ?? [];
213
+ const groups = /* @__PURE__ */ new Map();
214
+ for (const r of reports) {
215
+ const key = r.project_id ?? "unknown";
216
+ if (!groups.has(key)) groups.set(key, { name: r.app_name ?? f.unknownApp, slug: r.app_slug ?? null, domain: r.app_domain ?? null, reports: [] });
217
+ groups.get(key).reports.push(r);
218
+ }
219
+ const html = [...groups.entries()].map(([projectId, g]) => `<section class="mushi-xapp-group"><h3 class="mushi-xapp-app-name">${renderAppIconHtml({ projectId, appName: g.name, appSlug: g.slug, appDomain: g.domain })} ${esc(g.name)}</h3>${g.reports.map((r) => {
220
+ const st = reporterStatus(r, ctx.lang);
221
+ return `<div class="mushi-report-row"><span class="mushi-row-top">${statusPill(st.label, st.tone)}<span class="mushi-row-title">${esc(r.title ?? `#${r.short_id ?? r.id.slice(0, 8)}`)}</span><span class="mushi-row-when">${esc(formatRelativeTime(r.created_at))}</span></span></div>`;
222
+ }).join("")}</section>`).join("");
223
+ return {
224
+ header: renderHeader(ctx, f.title, true),
225
+ lead: "",
226
+ body: `${ctx.crossAppLoading ? skeleton(f.loading) : ""}${!ctx.crossAppLoading && !reports.length ? `<p class="mushi-empty">${esc(f.empty)}</p>` : ""}${html}`,
227
+ footer: ""
228
+ };
229
+ }
230
+
231
+ export { accountView, assistantView, crossAppView, detailView, initViews, leaderboardView, pickUpdateToast, renderOptIns, reportsView, roadmapView };
232
+ //# sourceMappingURL=widget-views-DX3OYHGR.js.map
233
+ //# sourceMappingURL=widget-views-DX3OYHGR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/widget-views.ts"],"names":[],"mappings":";;;AA0BA,IAAI,G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C,CAAA,IAAA,CAAA,GAAS,EAAE,CAAA,EAAG,IAAI,CAAA,CAAA;AAAA,IAC5J,MAAA,EAAQ;AAAA,GACR;AACA","file":"widget-views-DX3OYHGR.js","sourcesContent":["/**\n* FILE: packages/web/src/widget-views.ts\n* PURPOSE: The panel views most visits never open — Your reports (list, detail,\n* timeline, composer), the email / push opt-ins, the update-toast text\n* and the overflow views (Ask, Community ideas, leaderboard, account,\n* cross-app reports). Loaded on demand into dist/chunks/ so a host\n* whose users never open them pays no bytes for them.\n*\n* Runtime imports are limited to the external `@mushi-mushi/core/reporter-ui`:\n* the shared render helpers arrive through `initViews(renderKit)`, so esbuild\n* never hoists main-entry code into a shared chunk.\n*/\nimport type {\nMushiCrossAppReport,\nMushiLeaderboardEntry,\nMushiReporterReport,\n} from '@mushi-mushi/core';\nimport {\nfillReporterTemplate,\nisReporterConversation,\nreporterCopy,\nreporterStatus,\nreporterTimelineEntryText,\n} from '@mushi-mushi/core/reporter-ui';\nimport type { PendingReply } from './widget-helpers';\nimport type { RenderKit, ViewRegions, WidgetRenderCtx } from './widget-render';\nlet esc: RenderKit['esc'];\nlet btn: RenderKit['btn'];\nlet renderHeader: RenderKit['renderHeader'];\nlet chipLabel: RenderKit['chipLabel'];\nlet skeleton: RenderKit['skeleton'];\nlet formatRelativeTime: RenderKit['formatRelativeTime'];\nlet renderAppIconHtml: RenderKit['renderAppIconHtml'];\n/** Called once by the widget right after the chunk loads. */\nexport function initViews(kit: RenderKit): void {\n({ esc, btn, renderHeader, chipLabel, skeleton, formatRelativeTime, renderAppIconHtml } = kit);\n}\n/**\n* The toast for unread updates, or null when there are none. One report:\n* what happened to it (\"Fixed in v1.4\", \"The developer replied…\"). Several:\n* \"3 updates on your reports\".\n*/\nexport function pickUpdateToast(\nreports: MushiReporterReport[],\nlang: string,\nrepliedText: string,\n): { text: string; reportId: string | null; detail?: string } | null {\nconst unread = reports.filter((r) => (r.unread_count ?? 0) > 0 && !reporterStatus(r, lang).hidden);\nconst total = unread.reduce((n, r) => n + (r.unread_count ?? 0), 0);\nif (!total) return null;\nif (unread.length > 1) return { text: fillReporterTemplate(reporterCopy(lang).ui.updates, { n: total }), reportId: null };\nconst report = unread[0]!;\nconst status = reporterStatus(report, lang);\n// A fix (or work on one) is the news; a question or any other update is the\n// developer talking. The report's own title says which report it is.\nconst statusNews = status.key === 'fixing' || status.canVerify || (!report.last_admin_reply_at && status.key !== 'waiting');\nconst detail = report.title ?? report.summary ?? undefined;\nreturn { text: statusNews ? status.label : repliedText, reportId: report.id, ...(detail ? { detail } : {}) };\n}\n/** Email + push opt-ins (§4.1). Never pre-ticked; shown only for configured channels. */\nexport function renderOptIns(ctx: WidgetRenderCtx): string {\nconst p = ctx.locale.panel;\nconst out: string[] = [];\nif (ctx.channels.email && ctx.callbacks.onReporterEmailOptIn) {\nconst ui = ctx.rc.ui;\nif (ctx.emailState === 'saved') out.push(`<p class=\"mushi-note\" role=\"status\">✉ ${esc(ui.emailCheckInbox)}</p>`);\nelse {\nout.push(`<label class=\"mushi-check\"><input type=\"checkbox\" data-action=\"email-optin\"${ctx.emailOptInOpen ? ' checked' : ''} /> ${esc(ui.emailOptIn)}</label>`);\nif (ctx.emailOptInOpen) {\nout.push(`<div class=\"mushi-inline-form\"><input type=\"email\" class=\"mushi-input\" data-role=\"optin-email\" autocomplete=\"email\" aria-label=\"${esc(ui.emailOptIn)}\" placeholder=\"${esc(ui.emailPlaceholder)}\" value=\"${esc(ctx.channels.emailPrefill)}\" />${btn('save-email', esc(ui.emailSubmit), 'mushi-btn', ctx.emailState === 'saving' ? ' aria-busy=\"true\"' : '')}</div>${ctx.emailState === 'invalid' || ctx.emailState === 'error' ? `<p class=\"mushi-note mushi-error-inline\" role=\"alert\">${esc(ctx.emailState === 'invalid' ? ui.emailInvalid : ui.emailFailed)}</p>` : ''}`);\n}\n}\n}\nif (ctx.channels.push && ctx.callbacks.onReporterPushSubscribe) {\nout.push(ctx.pushState === 'on'\n? `<p class=\"mushi-note\" role=\"status\">🔔 ${esc(p.notifyOn)}</p>`\n: btn('notify-me', `🔔 ${esc(p.notifyMe)}`, 'mushi-btn', ctx.pushState === 'asking' ? ' aria-busy=\"true\"' : ''));\nif (ctx.pushState === 'error') out.push(`<p class=\"mushi-note mushi-error-inline\" role=\"alert\">${esc(ctx.rc.ui.sendFailed)}</p>`);\n}\nreturn out.length ? `<div class=\"mushi-optins\">${out.join('')}</div>` : '';\n}\n// ─── Your reports (§2.2) ──────────────────────────────────────────\nfunction statusPill(label: string, tone: string): string {\nreturn `<span class=\"mushi-pill mushi-tone-${tone}\">${esc(label)}</span>`;\n}\nfunction reportTitle(r: MushiReporterReport): string {\nreturn r.title ?? r.summary ?? r.description ?? `#${r.id.slice(0, 8)}`;\n}\n/** Type label for a row: the reporter's own pick, never the internal category. */\nfunction typeLabel(ctx: WidgetRenderCtx, userCategory: string | null | undefined): string {\nconst id = (userCategory ?? '').toLowerCase();\nif (!id || id === 'other') return '';\nreturn chipLabel(ctx, id === 'feature_request' ? 'idea' : id);\n}\n/** Unread first, then newest activity. */\nfunction orderReports(reports: MushiReporterReport[]): MushiReporterReport[] {\nconst at = (r: MushiReporterReport) => Date.parse(r.last_event_at ?? r.created_at) || 0;\nreturn [...reports].sort((a, b) => Number((b.unread_count ?? 0) > 0) - Number((a.unread_count ?? 0) > 0) || at(b) - at(a));\n}\nfunction reportRow(ctx: WidgetRenderCtx, r: MushiReporterReport): string {\nconst st = reporterStatus(r, ctx.lang);\nif (st.hidden) return '';\nconst unread = (r.unread_count ?? 0) > 0;\nconst meta = [typeLabel(ctx, r.user_category), r.page, st.othersNote].filter(Boolean).map((x) => esc(String(x))).join(' · ');\n// Line 3 is the news itself, never a repeat of the pill: the developer's\n// words, or what to do about a fix.\nconst news = r.last_event_preview && (unread || st.key === 'waiting')\n? ctx.rc.ui.developerReplied.replace('{text}', r.last_event_preview)\n: st.canVerify && st.key !== 'fixed_next' ? st.detail : '';\nconst title = reportTitle(r);\nreturn `<button type=\"button\" class=\"mushi-report-row${unread ? ' unread' : ''}\" data-report-id=\"${esc(r.id)}\" aria-label=\"${esc(`${st.label}: ${title}`)}\"><span class=\"mushi-row-top\">${statusPill(st.label, st.tone)}<span class=\"mushi-row-title\">${esc(title)}</span><span class=\"mushi-row-when\">${esc(formatRelativeTime(r.last_event_at ?? r.created_at))}</span></span>${meta ? `<span class=\"mushi-row-meta\">${meta}</span>` : ''}${news ? `<span class=\"mushi-row-news\">${esc(news)}</span>` : ''}</button>`;\n}\nexport function reportsView(ctx: WidgetRenderCtx): ViewRegions {\nconst rc = ctx.rc;\nconst rows = orderReports(ctx.reporterReports).map((r) => reportRow(ctx, r)).join('');\nconst body = ctx.reporterError\n? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(rc.ui.loadError)} ${btn('retry-list', esc(rc.ui.retry), 'mushi-link-btn')}</p>${rows}`\n: rows || (ctx.listLoading ? skeleton(ctx.locale.flows.reports.loading) : `<p class=\"mushi-empty\">${esc(rc.ui.empty)}</p>`);\nreturn { header: renderHeader(ctx, ctx.locale.flows.reports.title, true), lead: '', body: `<div class=\"mushi-report-list\">${body}</div>`, footer: '' };\n}\n// ─── Report detail: card, timeline, composer (§2.3) ──────────────\ninterface Entry { kind: string; at: string; text: string; who?: string; mine?: boolean; talk?: boolean; pending?: PendingReply }\n/** Merge the server timeline (or the comments, on older servers) with replies still in flight. */\nfunction buildTimeline(ctx: WidgetRenderCtx, report: MushiReporterReport | undefined): Entry[] {\nconst rc = ctx.rc;\nconst out: Entry[] = [];\nif (ctx.timeline) {\nfor (const e of ctx.timeline) {\nconst mine = e.kind === 'reporter_comment';\nout.push({\nkind: e.kind,\nat: e.at,\n// Pipeline events re-render from the template in the reporter's\n// language; developer and reporter words are shown as written.\ntext: isReporterConversation(e) ? (e.body ?? e.text) : reporterTimelineEntryText(e, ctx.lang),\ntalk: isReporterConversation(e),\nmine,\nwho: mine ? rc.ui.you : rc.ui.developer,\n});\n}\n} else {\nif (report) out.push({ kind: 'received', at: report.created_at, text: rc.timeline.received });\nfor (const c of ctx.reporterComments) {\nconst mine = c.author_kind === 'reporter';\nout.push({ kind: mine ? 'reporter_comment' : 'comment', at: c.created_at, text: c.body, talk: true, mine, who: mine ? rc.ui.you : (c.author_name ?? rc.ui.developer) });\n}\n}\nout.sort((a, b) => (Date.parse(a.at) || 0) - (Date.parse(b.at) || 0));\nfor (const r of ctx.pendingReplies) out.push({ kind: 'reporter_comment', at: '', text: r.body, who: rc.ui.you, talk: true, mine: true, pending: r });\nreturn out;\n}\nfunction entryHtml(ctx: WidgetRenderCtx, e: Entry): string {\nconst when = e.at ? `<time datetime=\"${esc(e.at)}\">${esc(formatRelativeTime(e.at))}</time>` : '';\nif (!e.talk) return `<li class=\"mushi-event\"><span>${esc(e.text)}</span>${when}</li>`;\nconst mine = Boolean(e.mine);\nconst state = e.pending\n? e.pending.state === 'sending'\n? `<span class=\"mushi-bubble-state\">${esc(ctx.rc.ui.sending)}</span>`\n: `<span class=\"mushi-bubble-state mushi-error-inline\">${esc(ctx.rc.ui.sendFailed)} · ${btn('retry-reply', esc(ctx.rc.ui.retry), 'mushi-link-btn', ` data-value=\"${e.pending.id}\"`)}</span>`\n: when;\nreturn `<li class=\"mushi-bubble ${mine ? 'mine' : 'dev'}\"><strong>${esc(e.who ?? '')}</strong><p>${esc(e.text)}</p>${state}</li>`;\n}\nexport function detailView(ctx: WidgetRenderCtx): ViewRegions {\nconst rc = ctx.rc;\nconst report = ctx.reporterReports.find((r) => r.id === ctx.selectedReportId);\n// Opened via \"Track it\" before the list caught up → it's new.\nconst st = reporterStatus(report ?? { status: 'new' }, ctx.lang);\nconst meta = [report?.page, report?.app_version ? `v${report.app_version}` : '', report ? formatRelativeTime(report.created_at) : '']\n.filter(Boolean).map((x) => esc(String(x))).join(' · ');\nconst lead = `<div class=\"mushi-thread-summary\"><p class=\"mushi-card-status\">${statusPill(st.label, st.tone)}</p><p class=\"mushi-note\">${esc(st.detail)}${st.othersNote ? ` ${esc(st.othersNote)}.` : ''}</p><p class=\"mushi-summary-text\">${esc(report ? (report.description ?? reportTitle(report)) : `#${(ctx.selectedReportId ?? '').slice(0, 8)}`)}</p>${report?.screenshot_thumb_url ? `<img class=\"mushi-card-thumb\" src=\"${esc(report.screenshot_thumb_url)}\" alt=\"\" />` : ''}${meta ? `<p class=\"mushi-note\">${meta}</p>` : ''}</div>`;\nconst entries = buildTimeline(ctx, report);\nconst hasDev = entries.some((e) => e.talk && !e.mine);\nlet body: string;\nif (ctx.threadLoading && entries.length <= 1 && !ctx.pendingReplies.length) {\nbody = skeleton(ctx.locale.flows.thread.loading);\n} else {\nbody = `${ctx.threadError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(rc.ui.loadError)} ${btn('retry-thread', esc(rc.ui.retry), 'mushi-link-btn')}</p>` : ''}<ol class=\"mushi-timeline\">${entries.map((e) => entryHtml(ctx, e)).join('')}</ol>${!hasDev && !ctx.threadError && !ctx.threadLoading ? `<p class=\"mushi-empty\">${esc(rc.ui.noReplies)}</p>` : ''}`;\n}\nconst busy = ctx.actionPending ? ' disabled aria-busy=\"true\"' : '';\nconst verify = st.canVerify\n? `<div class=\"mushi-verify\" role=\"group\" aria-label=\"${esc(st.detail)}\">${btn('reporter-confirms', esc(rc.ui.yes), 'mushi-btn', busy)}${btn('reporter-not-fixed', esc(rc.ui.notYet), 'mushi-btn', busy)}</div>`\n: '';\nreturn {\nheader: renderHeader(ctx, ctx.locale.panel.reportTitle, true),\nlead,\nbody: `<div class=\"mushi-thread\">${body}</div>${renderOptIns(ctx)}`,\nfooter: `${verify}${ctx.actionError ? `<p class=\"mushi-error-inline mushi-thread-action-error\" role=\"alert\">${esc(ctx.actionError)}</p>` : ''}<div class=\"mushi-thread-composer\"><textarea class=\"mushi-input mushi-reply\" data-role=\"reporter-reply\" rows=\"1\" maxlength=\"2000\" placeholder=\"${esc(ctx.locale.flows.thread.replyPlaceholder)}\" aria-label=\"${esc(ctx.locale.flows.thread.replyPlaceholder)}\"></textarea>${btn('reporter-reply', '↑', 'mushi-submit mushi-send', ` aria-label=\"${esc(ctx.locale.panel.send)}\"`)}</div>`,\n};\n}\n// ─── Secondary views (overflow menu) ──────────────────────────────\nexport function assistantView(ctx: WidgetRenderCtx): ViewRegions {\nconst t = ctx.locale.assistant;\nconst greeting = ctx.callbacks.assistantGreeting || t.defaultGreeting;\nconst chips = (opts: string[]) => opts.length\n? `<div class=\"mushi-chips\">${opts.map((s) => `<button type=\"button\" class=\"mushi-chip mushi-chip-sm\" data-action=\"assistant-suggest\" data-value=\"${esc(s)}\">${esc(s)}</button>`).join('')}</div>`\n: '';\nconst report = (label: string, cls = 'mushi-link-btn') => btn('assistant-report', esc(label), cls);\nconst turns = ctx.assistantTurns.length === 0\n? `<p class=\"mushi-assistant-greeting\">${esc(greeting)}</p>${chips(ctx.callbacks.assistantSuggestions ?? [])}`\n: ctx.assistantTurns.map((turn) => `<div class=\"mushi-assistant-msg ${turn.role === 'user' ? 'mine' : 'dev'}\">${esc(turn.text)}</div>${chips(turn.options ?? [])}${turn.offerReport ? report(t.fileReportCta, 'mushi-btn') : ''}`).join('');\nconst thinking = ctx.assistantSending ? `<div class=\"mushi-assistant-msg dev\" role=\"status\" aria-live=\"polite\">${esc(t.thinking)}</div>` : '';\nconst error = ctx.assistantError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(ctx.assistantError)} ${report(t.fileReportCta)}</p>` : '';\nconst stuck = ctx.assistantTurns.length && !ctx.assistantSending && !ctx.assistantError ? report(t.stillStuckCta) : '';\nreturn {\nheader: renderHeader(ctx, ctx.callbacks.assistantLabel || t.defaultLabel, true),\nlead: '',\nbody: `<div class=\"mushi-assistant-log\">${turns}${thinking}${error}${stuck}</div>`,\nfooter: `<form class=\"mushi-thread-composer\" data-action=\"assistant-send\"><textarea class=\"mushi-input mushi-reply mushi-assistant-input\" rows=\"1\" placeholder=\"${esc(t.inputPlaceholder)}\" aria-label=\"${esc(t.inputPlaceholder)}\"${ctx.assistantSending ? ' disabled' : ''}></textarea><button type=\"submit\" class=\"mushi-submit mushi-send\" aria-label=\"${esc(t.sendAriaLabel)}\"${ctx.assistantSending ? ' disabled' : ''}>↑</button></form>`,\n};\n}\nexport function roadmapView(ctx: WidgetRenderCtx): ViewRegions {\nconst f = ctx.locale.flows.roadmap;\nconst rows = ctx.featureBoard.map((ticket) => {\nconst id = String(ticket.id ?? '');\nconst voted = Boolean(ticket.my_vote);\nconst status = ticket.shipped_at ? f.shipped : String(ticket.status_label ?? ticket.status ?? 'open');\nreturn `<div class=\"mushi-report-row mushi-roadmap-row\"><span class=\"mushi-row-top\"><span class=\"mushi-row-title\">${esc(String(ticket.subject ?? f.untitled))}</span></span><span class=\"mushi-row-meta\">${esc(status)} · ${esc(f.voteCount.replace('{n}', String(Number(ticket.vote_count ?? 0))))}</span>${ctx.callbacks.onFeatureBoardVote ? `<button type=\"button\" class=\"mushi-btn\" data-vote-id=\"${esc(id)}\" aria-pressed=\"${voted}\">${esc(voted ? f.voted : f.vote)}</button>` : ''}</div>`;\n}).join('');\nreturn {\nheader: renderHeader(ctx, f.title, true),\nlead: '',\nbody: `${ctx.reporterError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(ctx.reporterError)}</p>` : ''}${rows || (ctx.listLoading ? skeleton(f.loading) : `<p class=\"mushi-empty\">${esc(f.empty)}</p>`)}`,\nfooter: '',\n};\n}\nexport function leaderboardView(ctx: WidgetRenderCtx): ViewRegions {\nconst f = ctx.locale.flows.leaderboard;\nconst isGlobal = ctx.globalLeaderboard !== null || ctx.globalLeaderboardLoading;\nconst entries: Array<Partial<MushiLeaderboardEntry> & { display_name: string | null; points_30d: number; total_points: number }> = isGlobal\n? (ctx.globalLeaderboard ?? [])\n: (ctx.leaderboardEntries ?? []);\nconst loading = isGlobal ? ctx.globalLeaderboardLoading : ctx.leaderboardLoading;\nconst rows = entries.map((e, i) => {\nconst rank = e.rank || i + 1;\nconst me = ctx.testerReputation && e.tester_id === ctx.testerReputation.tester_id;\nreturn `<li class=\"mushi-lb-row${me ? ' me' : ''}\"><span>#${rank}</span><span class=\"mushi-row-title\">${esc(e.public_handle ?? e.display_name ?? f.anon)}</span><span>${(e.points_30d ?? e.total_points).toLocaleString()} pts</span></li>`;\n}).join('');\nconst myRank = ctx.testerReputation?.rank;\nreturn {\nheader: renderHeader(ctx, f.title, true),\nlead: '',\nbody: `${loading ? skeleton(f.loading) : ''}${!loading && !entries.length ? `<p class=\"mushi-empty\">${esc(f.empty)}</p>` : ''}<ol class=\"mushi-lb\">${rows}</ol>${myRank ? `<p class=\"mushi-note\">${esc(f.myRank.replace('{rank}', String(myRank)))}</p>` : !ctx.testerJwt ? btn('open-account', esc(f.signInPrompt), 'mushi-link-btn') : ''}<p class=\"mushi-note\">${esc(f.footer)}</p>`,\nfooter: '',\n};\n}\nexport function accountView(ctx: WidgetRenderCtx): ViewRegions {\nconst f = ctx.locale.flows.account;\nconst tester = ctx.testerInfo;\nif (tester) {\nconst handle = tester.public_handle ?? tester.display_name ?? ctx.locale.flows.leaderboard.anon;\nconst rep = ctx.testerReputation;\nconst rank = rep ? f.rankSummary.replace('{rank}', String(rep.rank ?? '—')).replace('{points}', (rep.points_30d ?? 0).toLocaleString()) : '';\nreturn {\nheader: renderHeader(ctx, f.title, true),\nlead: '',\nbody: `<div class=\"mushi-thread-summary\"><p class=\"mushi-summary-text\">${esc(handle)}</p>${rank ? `<p class=\"mushi-note\">${esc(rank)}</p>` : ''}</div>${btn('open-cross-app-reports', esc(f.crossAppReports), 'mushi-menu-item')}${btn('open-global-leaderboard', esc(f.viewLeaderboard), 'mushi-menu-item')}${btn('sign-out-tester', esc(f.signOut), 'mushi-link-btn')}`,\nfooter: '',\n};\n}\nif (ctx.magicLinkSent) {\nreturn {\nheader: renderHeader(ctx, f.checkEmailTitle, true),\nlead: '',\nbody: `<p class=\"mushi-note\">${esc(f.magicLinkSent.replace('{email}', ctx.magicLinkEmail))}</p>${btn('resend-magic-link', esc(f.resendEmail), 'mushi-link-btn')}${ctx.magicLinkError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(ctx.magicLinkError)}</p>` : ''}`,\nfooter: '',\n};\n}\nreturn {\nheader: renderHeader(ctx, f.joinTitle, true),\nlead: '',\nbody: `<p class=\"mushi-note\">${esc(f.signInPrompt)}</p><input type=\"email\" class=\"mushi-input\" data-role=\"magic-link-email\" aria-label=\"${esc(f.emailLabel)}\" placeholder=\"${esc(f.emailPlaceholder)}\" autocomplete=\"email\" value=\"${esc(ctx.magicLinkEmail)}\" />${ctx.magicLinkError ? `<p class=\"mushi-error-inline\" role=\"alert\">${esc(ctx.magicLinkError)}</p>` : ''}`,\nfooter: `<span></span>${btn('send-magic-link', esc(ctx.magicLinkSending ? f.sending : f.sendLink), 'mushi-submit', ctx.magicLinkSending ? ' aria-busy=\"true\"' : '')}`,\n};\n}\nexport function crossAppView(ctx: WidgetRenderCtx): ViewRegions {\nconst f = ctx.locale.flows.crossApp;\nconst reports = ctx.crossAppReports ?? [];\nconst groups = new Map<string, { name: string; slug: string | null; domain: string | null; reports: MushiCrossAppReport[] }>();\nfor (const r of reports) {\nconst key = r.project_id ?? 'unknown';\nif (!groups.has(key)) groups.set(key, { name: r.app_name ?? f.unknownApp, slug: r.app_slug ?? null, domain: r.app_domain ?? null, reports: [] });\ngroups.get(key)!.reports.push(r);\n}\nconst html = [...groups.entries()].map(([projectId, g]) => `<section class=\"mushi-xapp-group\"><h3 class=\"mushi-xapp-app-name\">${renderAppIconHtml({ projectId, appName: g.name, appSlug: g.slug, appDomain: g.domain })} ${esc(g.name)}</h3>${g.reports.map((r) => {\nconst st = reporterStatus(r, ctx.lang);\n// The internal category never reaches a reporter: untitled rows show their short id.\nreturn `<div class=\"mushi-report-row\"><span class=\"mushi-row-top\">${statusPill(st.label, st.tone)}<span class=\"mushi-row-title\">${esc(r.title ?? `#${r.short_id ?? r.id.slice(0, 8)}`)}</span><span class=\"mushi-row-when\">${esc(formatRelativeTime(r.created_at))}</span></span></div>`;\n}).join('')}</section>`).join('');\nreturn {\nheader: renderHeader(ctx, f.title, true),\nlead: '',\nbody: `${ctx.crossAppLoading ? skeleton(f.loading) : ''}${!ctx.crossAppLoading && !reports.length ? `<p class=\"mushi-empty\">${esc(f.empty)}</p>` : ''}${html}`,\nfooter: '',\n};\n}\n"]}
package/dist/headless.cjs CHANGED
@@ -349,7 +349,7 @@ function createScreenshotCapture(options = {}) {
349
349
  try {
350
350
  if (typeof document === "undefined") return null;
351
351
  const canvas = document.createElement("canvas");
352
- const ctx = canvas.getContext("2d");
352
+ const ctx = canvas.getContext("2d", { willReadFrequently: true });
353
353
  if (!ctx) {
354
354
  activeOptions.onFailed?.("unsupported");
355
355
  emitScreenshotFailed("unsupported");
@@ -434,6 +434,8 @@ function buildPrivacySafeDocument(privacy) {
434
434
  clone.querySelector("#mushi-mushi-widget")?.remove();
435
435
  stripTaintSources(clone);
436
436
  inlineDocumentStyles(clone);
437
+ freezeMotion(clone);
438
+ fillViewport(clone);
437
439
  const redactSelectors = [
438
440
  ALWAYS_REDACT_SELECTORS,
439
441
  ...privacy?.redactSelectors ?? DEFAULT_REDACT_SELECTORS
@@ -523,6 +525,20 @@ function inlineDocumentStyles(clone) {
523
525
  styleEl.textContent = css;
524
526
  (clone.querySelector("head") ?? clone).appendChild(styleEl);
525
527
  }
528
+ var FREEZE_MOTION_CSS = "*,*::before,*::after{animation:none!important;transition:none!important}";
529
+ function fillViewport(clone) {
530
+ const clear = (c) => !c || c === "transparent" || /^rgba\(.*,\s*0\)$/.test(c);
531
+ let bg = getComputedStyle(document.documentElement).backgroundColor;
532
+ if (clear(bg) && document.body) bg = getComputedStyle(document.body).backgroundColor;
533
+ const root = clone;
534
+ root.style.setProperty("background-color", clear(bg) ? "Canvas" : bg);
535
+ root.style.setProperty("min-height", `${window.innerHeight}px`);
536
+ }
537
+ function freezeMotion(clone) {
538
+ const styleEl = document.createElement("style");
539
+ styleEl.textContent = FREEZE_MOTION_CSS;
540
+ (clone.querySelector("head") ?? clone).appendChild(styleEl);
541
+ }
526
542
  function serializeSheet(sheet) {
527
543
  let rules;
528
544
  try {