@mushi-mushi/web 1.18.0 → 1.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md CHANGED
@@ -27,12 +27,24 @@ pnpm build
27
27
 
28
28
  ```bash
29
29
  pnpm dev # Start all dev servers (admin on :6464)
30
+ ```
31
+
32
+ | Surface | URL |
33
+ | --- | --- |
34
+ | Admin console | http://localhost:6464 |
35
+ | Docs site | http://localhost:3000 |
36
+ | CLI console override | `MUSHI_CONSOLE_URL=http://localhost:6464` |
37
+
38
+ ```bash
30
39
  pnpm test # Run Vitest across all packages
31
40
  pnpm typecheck # TypeScript checks
32
41
  pnpm lint # ESLint
33
42
  pnpm format # Prettier
43
+ pnpm smoke:cli-setup # Playwright: onboarding ?setup=cli + success panel (skips headless if unsigned)
34
44
  ```
35
45
 
46
+ Set `CLI_SETUP_SMOKE_STRICT=1` to fail the smoke script when Playwright is not signed in (CI gate).
47
+
36
48
  Ad-hoc screenshots captured during UI reviews can live temporarily at the repo
37
49
  root, but root-level `*.png` files are intentionally ignored. Canonical
38
50
  screenshots that should be versioned belong under `docs/screenshots/`.
package/README.md CHANGED
@@ -30,6 +30,7 @@ Browser SDK for Mushi Mushi — embeddable bug reporting widget with Shadow DOM
30
30
  - **Repro timeline** (0.10+) — auto-captures route changes, clicks, and SDK lifecycle into a normalised `MushiReport.timeline`; pair with `Mushi.setScreen({ name, route, feature })` for screen-level grouping in the admin
31
31
  - **Session replay** (1.11+) — opt-in `capture.replay: 'rrweb' | 'lite' | 'sentry' | 'off'` records a rolling buffer that attaches to the report on submit. rrweb masks all text and inputs by default, records continuously from init, and trims while preserving the most recent full snapshot so replays stay playable. Default `'off'`
32
32
  - **Screenshot annotation** (1.11+) — a "Mark up" button in the panel opens an interactive overlay (highlight / blur / arrow) so reporters can circle the problem and redact sensitive regions before submitting
33
+ - **Screenshot preview & consent** (1.19+) — the details step renders the attached screenshot as a visible `<img>` preview (not just a checkmark label) with a **Remove** control and a configurable privacy caption (`widget.screenshotSensitiveHint`: `true` = localized default, `string` = custom copy, `false` = hide caption). Preview stays in sync through the annotate flow. See [`docs/SDK_SCREENSHOT_PREVIEW.md`](../../docs/SDK_SCREENSHOT_PREVIEW.md)
33
34
  - **Payload size guard** (1.11+) — reports are size-checked client-side; oversized payloads are progressively degraded (drop replay buffer → drop screenshot) and dropped with a `report:failed` event if still too large, so a single large report can never wedge the offline queue
34
35
  - **Two-way replies** (0.11+) — the panel ships a "Your reports" view that polls comments authored by the dev team and lets the reporter reply, all signed with HMAC against the public API key (no auth user required)
35
36
  - **Passive inventory discovery** (0.12+) — opt-in `capture.discoverInventory` ships throttled, PII-free observations (route template, page title, `[data-testid]` values, recent fetch paths, query-param **keys** only, sha256 of user/session id) to `POST /v1/sdk/discovery`. The Mushi server aggregates them into a 30-day `discovery_observed_inventory` view and Claude Sonnet drafts a first-pass `inventory.yaml` proposal you can accept on `/inventory ▸ Discovery`. See `MushiDiscoverInventoryConfig` in [`@mushi-mushi/core`](../core)
@@ -88,7 +89,7 @@ Each trigger respects its config flag — set `rageClick: false` to disable rage
88
89
 
89
90
  ## Bundle Size
90
91
 
91
- ~7 KB brotli, enforced at **70 KB gzipped** (105 KB uncompressed) via `size-limit` in CI — budget raised for the 2026 editorial widget refresh. Requires `@mushi-mushi/core` as a dependency (not bundled inline). The `./test-utils` entry is a separate artifact and is never pulled into production bundles.
92
+ ~7 KB brotli, enforced at **72 KB gzipped** (105 KB uncompressed) via `size-limit` in CI — budget raised for the 2026 editorial widget refresh + screenshot preview/consent surface. Requires `@mushi-mushi/core` as a dependency (not bundled inline). The `./test-utils` entry is a separate artifact and is never pulled into production bundles.
92
93
 
93
94
  ## Quick Start
94
95
 
@@ -398,7 +399,7 @@ report — without you having to plumb it through the report payload yourself:
398
399
  const mushi = Mushi.init({ projectId: 'proj_xxx', apiKey: 'mushi_xxx' });
399
400
 
400
401
  // Identify the active reporter (also sent to Sentry if @sentry/browser is loaded).
401
- mushi.identify({ id: 'usr_42', email: 'aya@example.com', segment: 'beta' });
402
+ mushi.identify('usr_42', { email: 'aya@example.com', segment: 'beta' });
402
403
 
403
404
  // Sticky scalar tags. Up to 64 keys; values are string | number | boolean.
404
405
  mushi.setTag('feature', 'checkout-v2');
@@ -531,4 +532,4 @@ MIT
531
532
  <!-- mushi-readme-stats-footer -->
532
533
  ---
533
534
 
534
- <sub>Monorepo scale (June 2026): 47 edge functions · 256 SQL migrations · 13 outbound plugins · 11 inbound adapters · 18 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>
535
+ <sub>Monorepo scale (June 2026): 50 edge functions · 278 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>
package/dist/index.cjs CHANGED
@@ -84,6 +84,8 @@ var en = {
84
84
  screenshotAttached: "Screenshot attached \u2713",
85
85
  screenshotCapturing: "Taking screenshot\u2026",
86
86
  screenshotFailed: "Couldn't capture \u2014 describe it instead",
87
+ screenshotPreviewAlt: "Preview of the screenshot that will be sent",
88
+ screenshotSensitiveHint: "Check the preview \u2014 remove it if any private info (balances, personal details) is visible.",
87
89
  elementButton: "Select Element",
88
90
  elementSelected: "Element selected \u2713",
89
91
  elementCapturing: "Click anything on the page\u2026",
@@ -144,6 +146,8 @@ var ja = {
144
146
  screenshotAttached: "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u6DFB\u4ED8\u6E08\u307F \u2713",
145
147
  screenshotCapturing: "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u64AE\u5F71\u4E2D\u2026",
146
148
  screenshotFailed: "\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F \u2014 \u6587\u5B57\u3067\u6559\u3048\u3066\u304F\u3060\u3055\u3044",
149
+ screenshotPreviewAlt: "\u9001\u4FE1\u3055\u308C\u308B\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306E\u30D7\u30EC\u30D3\u30E5\u30FC",
150
+ screenshotSensitiveHint: "\u30D7\u30EC\u30D3\u30E5\u30FC\u3092\u78BA\u8A8D\u3057\u3001\u6B8B\u9AD8\u3084\u500B\u4EBA\u60C5\u5831\u306A\u3069\u304C\u5199\u3063\u3066\u3044\u308C\u3070\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
147
151
  elementButton: "\u8981\u7D20\u3092\u9078\u629E",
148
152
  elementSelected: "\u8981\u7D20\u9078\u629E\u6E08\u307F \u2713",
149
153
  elementCapturing: "\u30DA\u30FC\u30B8\u4E0A\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u2026",
@@ -204,6 +208,8 @@ var th = {
204
208
  screenshotAttached: "\u0E41\u0E19\u0E1A\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u0E41\u0E25\u0E49\u0E27 \u2713",
205
209
  screenshotCapturing: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E16\u0E48\u0E32\u0E22\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u2026",
206
210
  screenshotFailed: "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E16\u0E48\u0E32\u0E22\u0E20\u0E32\u0E1E\u0E44\u0E14\u0E49 \u2014 \u0E42\u0E1B\u0E23\u0E14\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E41\u0E17\u0E19",
211
+ screenshotPreviewAlt: "\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u0E17\u0E35\u0E48\u0E08\u0E30\u0E16\u0E39\u0E01\u0E2A\u0E48\u0E07",
212
+ screenshotSensitiveHint: "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E20\u0E32\u0E1E \u2014 \u0E2B\u0E32\u0E01\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E15\u0E31\u0E27 (\u0E22\u0E2D\u0E14\u0E40\u0E07\u0E34\u0E19 \u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E1A\u0E38\u0E04\u0E04\u0E25) \u0E42\u0E1B\u0E23\u0E14\u0E25\u0E1A\u0E2D\u0E2D\u0E01",
207
213
  elementButton: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A",
208
214
  elementSelected: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E41\u0E25\u0E49\u0E27 \u2713",
209
215
  elementCapturing: "\u0E04\u0E25\u0E34\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u2026",
@@ -264,6 +270,8 @@ var es = {
264
270
  screenshotAttached: "Captura adjunta \u2713",
265
271
  screenshotCapturing: "Tomando captura\u2026",
266
272
  screenshotFailed: "No se pudo capturar \u2014 descr\xEDbelo en su lugar",
273
+ screenshotPreviewAlt: "Vista previa de la captura que se enviar\xE1",
274
+ screenshotSensitiveHint: "Revisa la vista previa \u2014 qu\xEDtala si se ve informaci\xF3n privada (saldos, datos personales).",
267
275
  elementButton: "Seleccionar elemento",
268
276
  elementSelected: "Elemento seleccionado \u2713",
269
277
  elementCapturing: "Haz clic en cualquier elemento\u2026",
@@ -1102,6 +1110,30 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1102
1110
  .mushi-annotate-host:empty {
1103
1111
  margin-top: 0;
1104
1112
  }
1113
+ .mushi-screenshot-preview {
1114
+ margin: 10px 0 0;
1115
+ display: flex;
1116
+ flex-direction: column;
1117
+ gap: 6px;
1118
+ }
1119
+ .mushi-screenshot-preview img {
1120
+ display: block;
1121
+ max-width: 100%;
1122
+ max-height: 160px;
1123
+ width: auto;
1124
+ border: 1px solid ${ruleStrong};
1125
+ border-radius: 3px;
1126
+ object-fit: contain;
1127
+ align-self: flex-start;
1128
+ }
1129
+ .mushi-screenshot-hint {
1130
+ margin: 0;
1131
+ color: ${inkMuted};
1132
+ font-family: ${fontMono};
1133
+ font-size: 10.5px;
1134
+ line-height: 1.4;
1135
+ letter-spacing: 0.02em;
1136
+ }
1105
1137
  .mushi-annotate-toolbar {
1106
1138
  display: flex;
1107
1139
  flex-wrap: wrap;
@@ -1990,7 +2022,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1990
2022
  .mushi-account-info strong{font:700 14px/1.3 inherit;color:${ink}}
1991
2023
  .mushi-account-rank,.mushi-xapp-app-name,.mushi-label{font-size:12px;color:${inkDim};font-family:${fontMono}}
1992
2024
  .mushi-account-rank{display:block}
1993
- .mushi-xapp-app-name{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;margin:0 0 6px}
2025
+ .mushi-xapp-app-head{display:flex;align-items:center;gap:8px;margin:0 0 6px}
2026
+ .mushi-xapp-app-name{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;margin:0}
2027
+ .mushi-app-icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:6px;border:1px solid ${isDark ? "rgba(255,255,255,0.12)" : "rgba(0,0,0,0.1)"};background:#fff;overflow:hidden;flex-shrink:0}
2028
+ .mushi-app-icon-img{display:block;width:16px;height:16px;object-fit:contain}
2029
+ .mushi-app-icon-initials{font-size:9px;font-weight:700;color:${inkDim};line-height:1}
2030
+ .mushi-app-icon-initials-only{background:${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.04)"}}
2031
+ .mushi-header-host-icon{display:block;width:20px;height:20px;border-radius:4px;object-fit:contain}
1994
2032
  .mushi-xapp-group{margin-bottom:14px}
1995
2033
  .mushi-label{display:block;font-weight:600;margin-bottom:6px}
1996
2034
 
@@ -2019,9 +2057,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2019
2057
 
2020
2058
  // src/version.ts
2021
2059
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
2022
- var MUSHI_SDK_VERSION = "1.18.0" ;
2023
-
2024
- // src/widget-helpers.ts
2060
+ var MUSHI_SDK_VERSION = "1.19.2" ;
2025
2061
  var CATEGORY_ICONS = {
2026
2062
  bug: "\u26A0\uFE0F",
2027
2063
  slow: "\u{1F40C}",
@@ -2141,6 +2177,56 @@ function isSubmitShortcut(e) {
2141
2177
  function escapeHtml(value) {
2142
2178
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
2143
2179
  }
2180
+ function renderAppIconHtml(opts) {
2181
+ const domain = opts.appDomain ?? core.resolveProjectDomain({
2182
+ project_id: opts.projectId,
2183
+ project_name: opts.appName,
2184
+ project_slug: opts.appSlug ?? ""
2185
+ });
2186
+ const initials = escapeHtml(core.projectInitials(opts.appName));
2187
+ const candidates = core.projectFaviconUrlCandidates({
2188
+ project_id: opts.projectId,
2189
+ project_name: opts.appName,
2190
+ project_slug: opts.appSlug ?? "",
2191
+ sdk_origin: opts.appDomain ? `https://${opts.appDomain}` : null
2192
+ });
2193
+ if (!candidates.length) {
2194
+ return `<span class="mushi-app-icon mushi-app-icon-initials-only" aria-hidden="true">${initials}</span>`;
2195
+ }
2196
+ const encoded = escapeHtml(JSON.stringify(candidates));
2197
+ return `<span class="mushi-app-icon" data-mushi-favicon data-candidates="${encoded}" data-initials="${initials}" aria-hidden="true" title="${escapeHtml(domain ?? opts.appName)}">
2198
+ <img class="mushi-app-icon-img" src="${escapeHtml(candidates[0])}" alt="" referrerpolicy="no-referrer" width="16" height="16" />
2199
+ <span class="mushi-app-icon-initials" hidden>${initials}</span>
2200
+ </span>`;
2201
+ }
2202
+ function bindFaviconFallbacks(root) {
2203
+ root.querySelectorAll("[data-mushi-favicon]").forEach((wrap) => {
2204
+ const img = wrap.querySelector(".mushi-app-icon-img");
2205
+ const fallback = wrap.querySelector(".mushi-app-icon-initials");
2206
+ if (!img || !fallback) return;
2207
+ let candidates = [];
2208
+ try {
2209
+ candidates = JSON.parse(wrap.dataset.candidates ?? "[]");
2210
+ } catch {
2211
+ candidates = [];
2212
+ }
2213
+ let index = 0;
2214
+ const tryNext = () => {
2215
+ index += 1;
2216
+ if (index < candidates.length) {
2217
+ img.src = candidates[index];
2218
+ } else {
2219
+ img.remove();
2220
+ fallback.hidden = false;
2221
+ wrap.classList.add("mushi-app-icon-initials-only");
2222
+ }
2223
+ };
2224
+ img.onerror = tryNext;
2225
+ img.onload = () => {
2226
+ if (core.isLikelyGenericFavicon(img)) tryNext();
2227
+ };
2228
+ });
2229
+ }
2144
2230
 
2145
2231
  // src/widget-render.ts
2146
2232
  function renderStep(ctx) {
@@ -2222,18 +2308,18 @@ function renderBrandFooter(ctx) {
2222
2308
  function renderHeader(ctx, opts) {
2223
2309
  const t = ctx.locale;
2224
2310
  const { title, showBack = false, step, eyebrow } = opts;
2225
- const eyebrowHtml = showBack ? `<button type="button" class="mushi-back" data-action="back" aria-label="${t.widget.back}">\u2190 ${escapeHtml(t.widget.back)}</button>` : `<span class="mushi-header-eyebrow">${eyebrow ?? "Mushi \xB7 Report"}</span>`;
2311
+ const eyebrowHtml = showBack ? `<button type="button" class="mushi-back" data-action="back" aria-label="${escapeHtml(t.widget.back)}">\u2190 ${escapeHtml(t.widget.back)}</button>` : `<span class="mushi-header-eyebrow">${escapeHtml(eyebrow ?? "Mushi \xB7 Report")}</span>`;
2226
2312
  const counterHtml = step ? `<span class="mushi-step-counter" aria-label="Step ${step} of ${TOTAL_STEPS}"><b>${pad2(step)}</b> / ${pad2(TOTAL_STEPS)}</span>` : "";
2227
2313
  return `
2228
2314
  <div class="mushi-header">
2229
- <div class="mushi-header-mark" aria-hidden="true">\u866B</div>
2315
+ <div class="mushi-header-mark" aria-hidden="true">${ctx.pageFaviconHref ? `<img class="mushi-header-host-icon" src="${escapeHtml(ctx.pageFaviconHref)}" alt="" referrerpolicy="no-referrer" width="20" height="20" />` : "\u866B"}</div>
2230
2316
  <div class="mushi-header-titles">
2231
2317
  ${eyebrowHtml}
2232
2318
  <h3>${title}</h3>
2233
2319
  </div>
2234
2320
  <div class="mushi-header-meta">
2235
2321
  ${counterHtml}
2236
- <button type="button" class="mushi-close" data-action="close" aria-label="${t.widget.close}">\u2715</button>
2322
+ <button type="button" class="mushi-close" data-action="close" aria-label="${escapeHtml(t.widget.close)}">\u2715</button>
2237
2323
  </div>
2238
2324
  </div>
2239
2325
  `;
@@ -2285,7 +2371,7 @@ function renderCategoryStep(ctx) {
2285
2371
  return `
2286
2372
  ${renderHeader(ctx, { title: t.step1.heading, step: STEP_NUMBER.category })}
2287
2373
  ${ctx.config.betaMode?.enabled ? renderBetaStrip(ctx) : ""}
2288
- <div class="mushi-body" role="radiogroup" aria-label="${t.step1.heading}">
2374
+ <div class="mushi-body" role="radiogroup" aria-label="${escapeHtml(t.step1.heading)}">
2289
2375
  <button type="button" class="mushi-option-btn mushi-reports-entry" data-action="reports">
2290
2376
  <span class="mushi-option-icon" aria-hidden="true">\u{1F4EC}</span>
2291
2377
  <div class="mushi-option-text">
@@ -2532,24 +2618,42 @@ function renderCrossAppReportsStep(ctx) {
2532
2618
  const grouped = /* @__PURE__ */ new Map();
2533
2619
  for (const r of reports) {
2534
2620
  const key = r.project_id ?? "unknown";
2535
- if (!grouped.has(key)) grouped.set(key, { name: r.app_name ?? "Unknown App", reports: [] });
2621
+ if (!grouped.has(key)) {
2622
+ grouped.set(key, {
2623
+ name: r.app_name ?? "Unknown App",
2624
+ slug: r.app_slug ?? null,
2625
+ domain: r.app_domain ?? null,
2626
+ reports: []
2627
+ });
2628
+ }
2536
2629
  grouped.get(key).reports.push(r);
2537
2630
  }
2538
- const rows = [...grouped.entries()].map(([, group]) => `
2631
+ const rows = [...grouped.entries()].map(([projectId, group]) => {
2632
+ const icon = renderAppIconHtml({
2633
+ projectId,
2634
+ appName: group.name,
2635
+ appSlug: group.slug,
2636
+ appDomain: group.domain
2637
+ });
2638
+ return `
2539
2639
  <div class="mushi-xapp-group">
2540
- <h4 class="mushi-xapp-app-name">${escapeHtml(group.name)}</h4>
2640
+ <div class="mushi-xapp-app-head">
2641
+ ${icon}
2642
+ <h4 class="mushi-xapp-app-name">${escapeHtml(group.name)}</h4>
2643
+ </div>
2541
2644
  ${group.reports.map((r) => {
2542
- const tone = reporterStatusTone(r.status);
2543
- return `
2645
+ const tone = reporterStatusTone(r.status);
2646
+ return `
2544
2647
  <div class="mushi-report-row" data-report-id="${escapeHtml(r.id)}" tabindex="0" role="button">
2545
2648
  <span class="mushi-report-status mushi-status-${tone}">${escapeHtml(reporterStatusShort(r.status))}</span>
2546
2649
  <span class="mushi-report-title">${escapeHtml(r.title ?? r.category)}</span>
2547
2650
  <span class="mushi-report-when">${escapeHtml(formatRelativeTime(r.created_at))}</span>
2548
2651
  </div>
2549
2652
  `;
2550
- }).join("")}
2653
+ }).join("")}
2551
2654
  </div>
2552
- `).join("");
2655
+ `;
2656
+ }).join("");
2553
2657
  return `
2554
2658
  ${renderHeader(ctx, { title: "My reports", showBack: true, eyebrow: "Mushi \xB7 All apps" })}
2555
2659
  <div class="mushi-body">
@@ -2646,9 +2750,9 @@ function renderDetailsStep(ctx) {
2646
2750
  <div class="mushi-textarea-wrap">
2647
2751
  <textarea
2648
2752
  class="mushi-textarea"
2649
- placeholder="${t.step3.descriptionPlaceholder}"
2753
+ placeholder="${escapeHtml(t.step3.descriptionPlaceholder)}"
2650
2754
  rows="4"
2651
- aria-label="${t.step3.heading}"
2755
+ aria-label="${escapeHtml(t.step3.heading)}"
2652
2756
  autofocus
2653
2757
  ></textarea>
2654
2758
  <div class="mushi-char-counter" data-role="char-counter" aria-hidden="true">
@@ -2675,6 +2779,10 @@ function renderDetailsStep(ctx) {
2675
2779
  ${escapeHtml(elementLabel)}
2676
2780
  </button>
2677
2781
  </div>
2782
+ ${ctx.screenshotAttached && ctx.screenshotPreview ? `<figure class="mushi-screenshot-preview">
2783
+ <img src="${escapeHtml(ctx.screenshotPreview)}" alt="${escapeHtml(t.step3.screenshotPreviewAlt)}" />
2784
+ ${ctx.screenshotHint ? `<figcaption class="mushi-screenshot-hint">\u26A0 ${escapeHtml(ctx.screenshotHint)}</figcaption>` : ""}
2785
+ </figure>` : ""}
2678
2786
  <div class="mushi-error" style="display:none" role="alert"></div>
2679
2787
  </div>
2680
2788
  <div class="mushi-footer">
@@ -2867,6 +2975,7 @@ var MushiWidget = class _MushiWidget {
2867
2975
  draggable: config.draggable ?? false,
2868
2976
  brandFooter: config.brandFooter ?? true,
2869
2977
  outdatedBanner: config.outdatedBanner ?? "auto",
2978
+ screenshotSensitiveHint: config.screenshotSensitiveHint ?? true,
2870
2979
  betaMode: config.betaMode ?? {},
2871
2980
  minDescriptionLength: config.minDescriptionLength ?? 20,
2872
2981
  dashboardUrl: config.dashboardUrl ?? "",
@@ -2913,6 +3022,8 @@ var MushiWidget = class _MushiWidget {
2913
3022
  screenshotCapturing = false;
2914
3023
  screenshotError = false;
2915
3024
  allowScreenshotRemove = true;
3025
+ /** Data URL of the attached screenshot, rendered as a visible preview. */
3026
+ screenshotPreview = null;
2916
3027
  elementSelected = false;
2917
3028
  elementCapturing = false;
2918
3029
  submitting = false;
@@ -3024,6 +3135,7 @@ var MushiWidget = class _MushiWidget {
3024
3135
  ...config.draggable !== void 0 ? { draggable: config.draggable } : {},
3025
3136
  ...config.brandFooter !== void 0 ? { brandFooter: config.brandFooter } : {},
3026
3137
  ...config.outdatedBanner !== void 0 ? { outdatedBanner: config.outdatedBanner } : {},
3138
+ ...config.screenshotSensitiveHint !== void 0 ? { screenshotSensitiveHint: config.screenshotSensitiveHint } : {},
3027
3139
  ...config.betaMode !== void 0 ? { betaMode: config.betaMode } : {},
3028
3140
  ...config.minDescriptionLength !== void 0 ? { minDescriptionLength: config.minDescriptionLength } : {},
3029
3141
  ...config.dashboardUrl !== void 0 ? { dashboardUrl: config.dashboardUrl } : {},
@@ -3079,6 +3191,7 @@ var MushiWidget = class _MushiWidget {
3079
3191
  this.screenshotAttached = false;
3080
3192
  this.screenshotCapturing = false;
3081
3193
  this.screenshotError = false;
3194
+ this.screenshotPreview = null;
3082
3195
  this.elementSelected = false;
3083
3196
  this.elementCapturing = false;
3084
3197
  this.submitting = false;
@@ -3217,8 +3330,26 @@ var MushiWidget = class _MushiWidget {
3217
3330
  }
3218
3331
  setScreenshotAttached(attached) {
3219
3332
  this.screenshotAttached = attached;
3333
+ if (!attached) this.screenshotPreview = null;
3334
+ if (this.isOpen) this.render();
3335
+ }
3336
+ /** Provide the captured screenshot data URL so the widget can preview it. */
3337
+ setScreenshotPreview(dataUrl) {
3338
+ this.screenshotPreview = dataUrl;
3220
3339
  if (this.isOpen) this.render();
3221
3340
  }
3341
+ /**
3342
+ * Resolve the privacy caption shown beside the screenshot preview from the
3343
+ * `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
3344
+ * it honours console/runtime config): `false` → hidden, a non-empty string →
3345
+ * that copy, anything else (`true`/unset) → the localized default.
3346
+ */
3347
+ resolveScreenshotHint() {
3348
+ const v = this.config.screenshotSensitiveHint;
3349
+ if (v === false) return null;
3350
+ if (typeof v === "string") return v.trim() ? v : null;
3351
+ return this.locale.step3.screenshotSensitiveHint;
3352
+ }
3222
3353
  setAllowScreenshotRemove(allow) {
3223
3354
  this.allowScreenshotRemove = allow;
3224
3355
  if (this.isOpen) this.render();
@@ -4087,6 +4218,8 @@ var MushiWidget = class _MushiWidget {
4087
4218
  testerInfo: this.testerInfo,
4088
4219
  screenshotCapturing: this.screenshotCapturing,
4089
4220
  screenshotAttached: this.screenshotAttached,
4221
+ screenshotPreview: this.screenshotPreview,
4222
+ screenshotHint: this.resolveScreenshotHint(),
4090
4223
  reporterError: this.reporterError,
4091
4224
  magicLinkError: this.magicLinkError,
4092
4225
  elementCapturing: this.elementCapturing,
@@ -4124,11 +4257,13 @@ var MushiWidget = class _MushiWidget {
4124
4257
  assistantTurns: this.assistantTurns,
4125
4258
  assistantSending: this.assistantSending,
4126
4259
  assistantError: this.assistantError,
4127
- showAllCategories: this.showAllCategories
4260
+ showAllCategories: this.showAllCategories,
4261
+ pageFaviconHref: core.readPageFaviconHref()
4128
4262
  };
4129
4263
  }
4130
4264
  attachHandlers(panel) {
4131
4265
  const t = this.locale;
4266
+ bindFaviconFallbacks(panel);
4132
4267
  panel.querySelector('[data-action="close"]')?.addEventListener("click", () => this.close());
4133
4268
  panel.querySelector('[data-action="back"]')?.addEventListener("click", () => {
4134
4269
  if (this.step === "intent") {
@@ -4165,6 +4300,7 @@ var MushiWidget = class _MushiWidget {
4165
4300
  this.selectedIntent = null;
4166
4301
  this.viaFeatureRequest = false;
4167
4302
  }
4303
+ if (this.step === "category") this.showAllCategories = false;
4168
4304
  this.render();
4169
4305
  });
4170
4306
  panel.querySelector('[data-action="show-all-categories"]')?.addEventListener("click", () => {
@@ -4725,8 +4861,6 @@ function setConsentGranted(projectId, granted) {
4725
4861
  localStorage.removeItem(getConsentKey(projectId));
4726
4862
  }
4727
4863
  optedIn = granted;
4728
- apiClient?.submitActivity(currentUserId ?? "", [], { optedIn: granted }).catch(() => {
4729
- });
4730
4864
  } catch {
4731
4865
  }
4732
4866
  }
@@ -6961,6 +7095,7 @@ function createInstance(config) {
6961
7095
  log.debug("Auto-capturing screenshot", { when, mode });
6962
7096
  pendingScreenshot = await takeScreenshotWithoutChrome();
6963
7097
  widget.setScreenshotAttached(pendingScreenshot !== null);
7098
+ widget.setScreenshotPreview(pendingScreenshot);
6964
7099
  }
6965
7100
  widget = new MushiWidget(bootstrapConfig.widget, {
6966
7101
  onSubmit: async ({ category, userCategory, description, intent }) => {
@@ -6992,6 +7127,7 @@ function createInstance(config) {
6992
7127
  log.debug("Taking screenshot");
6993
7128
  pendingScreenshot = await takeScreenshotWithoutChrome();
6994
7129
  widget.setScreenshotAttached(pendingScreenshot !== null);
7130
+ widget.setScreenshotPreview(pendingScreenshot);
6995
7131
  },
6996
7132
  onScreenshotRemove: () => {
6997
7133
  log.debug("Screenshot attachment removed");
@@ -7016,6 +7152,7 @@ function createInstance(config) {
7016
7152
  {
7017
7153
  pendingScreenshot = session.getDataUrl();
7018
7154
  widget.setScreenshotAttached(true);
7155
+ widget.setScreenshotPreview(pendingScreenshot);
7019
7156
  }
7020
7157
  session.destroy();
7021
7158
  toolbar.remove();