@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/dist/index.d.cts CHANGED
@@ -143,6 +143,8 @@ declare class MushiWidget {
143
143
  private screenshotCapturing;
144
144
  private screenshotError;
145
145
  private allowScreenshotRemove;
146
+ /** Data URL of the attached screenshot, rendered as a visible preview. */
147
+ private screenshotPreview;
146
148
  private elementSelected;
147
149
  private elementCapturing;
148
150
  private submitting;
@@ -256,6 +258,15 @@ declare class MushiWidget {
256
258
  setTrigger(trigger: NonNullable<MushiWidgetConfig['trigger']>): void;
257
259
  attachTo(selectorOrElement: string | Element, options?: MushiWidgetConfig): () => void;
258
260
  setScreenshotAttached(attached: boolean): void;
261
+ /** Provide the captured screenshot data URL so the widget can preview it. */
262
+ setScreenshotPreview(dataUrl: string | null): void;
263
+ /**
264
+ * Resolve the privacy caption shown beside the screenshot preview from the
265
+ * `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
266
+ * it honours console/runtime config): `false` → hidden, a non-empty string →
267
+ * that copy, anything else (`true`/unset) → the localized default.
268
+ */
269
+ private resolveScreenshotHint;
259
270
  setAllowScreenshotRemove(allow: boolean): void;
260
271
  setElementSelected(selected: boolean): void;
261
272
  setScreenshotCapturing(capturing: boolean): void;
@@ -507,6 +518,10 @@ interface MushiLocale {
507
518
  screenshotAttached: string;
508
519
  screenshotCapturing: string;
509
520
  screenshotFailed: string;
521
+ /** Alt text for the attached-screenshot preview image. */
522
+ screenshotPreviewAlt: string;
523
+ /** Default privacy caption shown beside the screenshot preview. */
524
+ screenshotSensitiveHint: string;
510
525
  elementButton: string;
511
526
  elementSelected: string;
512
527
  elementCapturing: string;
package/dist/index.d.ts CHANGED
@@ -143,6 +143,8 @@ declare class MushiWidget {
143
143
  private screenshotCapturing;
144
144
  private screenshotError;
145
145
  private allowScreenshotRemove;
146
+ /** Data URL of the attached screenshot, rendered as a visible preview. */
147
+ private screenshotPreview;
146
148
  private elementSelected;
147
149
  private elementCapturing;
148
150
  private submitting;
@@ -256,6 +258,15 @@ declare class MushiWidget {
256
258
  setTrigger(trigger: NonNullable<MushiWidgetConfig['trigger']>): void;
257
259
  attachTo(selectorOrElement: string | Element, options?: MushiWidgetConfig): () => void;
258
260
  setScreenshotAttached(attached: boolean): void;
261
+ /** Provide the captured screenshot data URL so the widget can preview it. */
262
+ setScreenshotPreview(dataUrl: string | null): void;
263
+ /**
264
+ * Resolve the privacy caption shown beside the screenshot preview from the
265
+ * `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
266
+ * it honours console/runtime config): `false` → hidden, a non-empty string →
267
+ * that copy, anything else (`true`/unset) → the localized default.
268
+ */
269
+ private resolveScreenshotHint;
259
270
  setAllowScreenshotRemove(allow: boolean): void;
260
271
  setElementSelected(selected: boolean): void;
261
272
  setScreenshotCapturing(capturing: boolean): void;
@@ -507,6 +518,10 @@ interface MushiLocale {
507
518
  screenshotAttached: string;
508
519
  screenshotCapturing: string;
509
520
  screenshotFailed: string;
521
+ /** Alt text for the attached-screenshot preview image. */
522
+ screenshotPreviewAlt: string;
523
+ /** Default privacy caption shown beside the screenshot preview. */
524
+ screenshotSensitiveHint: string;
510
525
  elementButton: string;
511
526
  elementSelected: string;
512
527
  elementCapturing: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { resolveEnvConfig, createLogger, noopLogger, createApiClient, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, createBreadcrumbBuffer, getReporterToken, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, getSessionId, captureEnvironment, newUuid, DEFAULT_API_ENDPOINT, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INTERNAL_HEADER, parseIdentityToken, normaliseThrown } from '@mushi-mushi/core';
1
+ import { readPageFaviconHref, resolveEnvConfig, createLogger, noopLogger, createApiClient, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, createBreadcrumbBuffer, getReporterToken, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, getSessionId, captureEnvironment, newUuid, DEFAULT_API_ENDPOINT, isLikelyGenericFavicon, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INTERNAL_HEADER, parseIdentityToken, normaliseThrown, resolveProjectDomain, projectInitials, projectFaviconUrlCandidates } from '@mushi-mushi/core';
2
2
 
3
3
  // src/capture/compress-screenshot.ts
4
4
  async function compressScreenshotDataUrl(dataUrl, maxBytes = MAX_SCREENSHOT_DATA_URL_BYTES) {
@@ -82,6 +82,8 @@ var en = {
82
82
  screenshotAttached: "Screenshot attached \u2713",
83
83
  screenshotCapturing: "Taking screenshot\u2026",
84
84
  screenshotFailed: "Couldn't capture \u2014 describe it instead",
85
+ screenshotPreviewAlt: "Preview of the screenshot that will be sent",
86
+ screenshotSensitiveHint: "Check the preview \u2014 remove it if any private info (balances, personal details) is visible.",
85
87
  elementButton: "Select Element",
86
88
  elementSelected: "Element selected \u2713",
87
89
  elementCapturing: "Click anything on the page\u2026",
@@ -142,6 +144,8 @@ var ja = {
142
144
  screenshotAttached: "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u6DFB\u4ED8\u6E08\u307F \u2713",
143
145
  screenshotCapturing: "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u64AE\u5F71\u4E2D\u2026",
144
146
  screenshotFailed: "\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F \u2014 \u6587\u5B57\u3067\u6559\u3048\u3066\u304F\u3060\u3055\u3044",
147
+ screenshotPreviewAlt: "\u9001\u4FE1\u3055\u308C\u308B\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306E\u30D7\u30EC\u30D3\u30E5\u30FC",
148
+ 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",
145
149
  elementButton: "\u8981\u7D20\u3092\u9078\u629E",
146
150
  elementSelected: "\u8981\u7D20\u9078\u629E\u6E08\u307F \u2713",
147
151
  elementCapturing: "\u30DA\u30FC\u30B8\u4E0A\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u2026",
@@ -202,6 +206,8 @@ var th = {
202
206
  screenshotAttached: "\u0E41\u0E19\u0E1A\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u0E41\u0E25\u0E49\u0E27 \u2713",
203
207
  screenshotCapturing: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E16\u0E48\u0E32\u0E22\u0E2A\u0E01\u0E23\u0E35\u0E19\u0E0A\u0E47\u0E2D\u0E15\u2026",
204
208
  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",
209
+ 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",
210
+ 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",
205
211
  elementButton: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A",
206
212
  elementSelected: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E41\u0E25\u0E49\u0E27 \u2713",
207
213
  elementCapturing: "\u0E04\u0E25\u0E34\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u2026",
@@ -262,6 +268,8 @@ var es = {
262
268
  screenshotAttached: "Captura adjunta \u2713",
263
269
  screenshotCapturing: "Tomando captura\u2026",
264
270
  screenshotFailed: "No se pudo capturar \u2014 descr\xEDbelo en su lugar",
271
+ screenshotPreviewAlt: "Vista previa de la captura que se enviar\xE1",
272
+ screenshotSensitiveHint: "Revisa la vista previa \u2014 qu\xEDtala si se ve informaci\xF3n privada (saldos, datos personales).",
265
273
  elementButton: "Seleccionar elemento",
266
274
  elementSelected: "Elemento seleccionado \u2713",
267
275
  elementCapturing: "Haz clic en cualquier elemento\u2026",
@@ -1100,6 +1108,30 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1100
1108
  .mushi-annotate-host:empty {
1101
1109
  margin-top: 0;
1102
1110
  }
1111
+ .mushi-screenshot-preview {
1112
+ margin: 10px 0 0;
1113
+ display: flex;
1114
+ flex-direction: column;
1115
+ gap: 6px;
1116
+ }
1117
+ .mushi-screenshot-preview img {
1118
+ display: block;
1119
+ max-width: 100%;
1120
+ max-height: 160px;
1121
+ width: auto;
1122
+ border: 1px solid ${ruleStrong};
1123
+ border-radius: 3px;
1124
+ object-fit: contain;
1125
+ align-self: flex-start;
1126
+ }
1127
+ .mushi-screenshot-hint {
1128
+ margin: 0;
1129
+ color: ${inkMuted};
1130
+ font-family: ${fontMono};
1131
+ font-size: 10.5px;
1132
+ line-height: 1.4;
1133
+ letter-spacing: 0.02em;
1134
+ }
1103
1135
  .mushi-annotate-toolbar {
1104
1136
  display: flex;
1105
1137
  flex-wrap: wrap;
@@ -1988,7 +2020,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1988
2020
  .mushi-account-info strong{font:700 14px/1.3 inherit;color:${ink}}
1989
2021
  .mushi-account-rank,.mushi-xapp-app-name,.mushi-label{font-size:12px;color:${inkDim};font-family:${fontMono}}
1990
2022
  .mushi-account-rank{display:block}
1991
- .mushi-xapp-app-name{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;margin:0 0 6px}
2023
+ .mushi-xapp-app-head{display:flex;align-items:center;gap:8px;margin:0 0 6px}
2024
+ .mushi-xapp-app-name{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;margin:0}
2025
+ .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}
2026
+ .mushi-app-icon-img{display:block;width:16px;height:16px;object-fit:contain}
2027
+ .mushi-app-icon-initials{font-size:9px;font-weight:700;color:${inkDim};line-height:1}
2028
+ .mushi-app-icon-initials-only{background:${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.04)"}}
2029
+ .mushi-header-host-icon{display:block;width:20px;height:20px;border-radius:4px;object-fit:contain}
1992
2030
  .mushi-xapp-group{margin-bottom:14px}
1993
2031
  .mushi-label{display:block;font-weight:600;margin-bottom:6px}
1994
2032
 
@@ -2017,9 +2055,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2017
2055
 
2018
2056
  // src/version.ts
2019
2057
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
2020
- var MUSHI_SDK_VERSION = "1.18.0" ;
2021
-
2022
- // src/widget-helpers.ts
2058
+ var MUSHI_SDK_VERSION = "1.19.2" ;
2023
2059
  var CATEGORY_ICONS = {
2024
2060
  bug: "\u26A0\uFE0F",
2025
2061
  slow: "\u{1F40C}",
@@ -2139,6 +2175,56 @@ function isSubmitShortcut(e) {
2139
2175
  function escapeHtml(value) {
2140
2176
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
2141
2177
  }
2178
+ function renderAppIconHtml(opts) {
2179
+ const domain = opts.appDomain ?? resolveProjectDomain({
2180
+ project_id: opts.projectId,
2181
+ project_name: opts.appName,
2182
+ project_slug: opts.appSlug ?? ""
2183
+ });
2184
+ const initials = escapeHtml(projectInitials(opts.appName));
2185
+ const candidates = projectFaviconUrlCandidates({
2186
+ project_id: opts.projectId,
2187
+ project_name: opts.appName,
2188
+ project_slug: opts.appSlug ?? "",
2189
+ sdk_origin: opts.appDomain ? `https://${opts.appDomain}` : null
2190
+ });
2191
+ if (!candidates.length) {
2192
+ return `<span class="mushi-app-icon mushi-app-icon-initials-only" aria-hidden="true">${initials}</span>`;
2193
+ }
2194
+ const encoded = escapeHtml(JSON.stringify(candidates));
2195
+ return `<span class="mushi-app-icon" data-mushi-favicon data-candidates="${encoded}" data-initials="${initials}" aria-hidden="true" title="${escapeHtml(domain ?? opts.appName)}">
2196
+ <img class="mushi-app-icon-img" src="${escapeHtml(candidates[0])}" alt="" referrerpolicy="no-referrer" width="16" height="16" />
2197
+ <span class="mushi-app-icon-initials" hidden>${initials}</span>
2198
+ </span>`;
2199
+ }
2200
+ function bindFaviconFallbacks(root) {
2201
+ root.querySelectorAll("[data-mushi-favicon]").forEach((wrap) => {
2202
+ const img = wrap.querySelector(".mushi-app-icon-img");
2203
+ const fallback = wrap.querySelector(".mushi-app-icon-initials");
2204
+ if (!img || !fallback) return;
2205
+ let candidates = [];
2206
+ try {
2207
+ candidates = JSON.parse(wrap.dataset.candidates ?? "[]");
2208
+ } catch {
2209
+ candidates = [];
2210
+ }
2211
+ let index = 0;
2212
+ const tryNext = () => {
2213
+ index += 1;
2214
+ if (index < candidates.length) {
2215
+ img.src = candidates[index];
2216
+ } else {
2217
+ img.remove();
2218
+ fallback.hidden = false;
2219
+ wrap.classList.add("mushi-app-icon-initials-only");
2220
+ }
2221
+ };
2222
+ img.onerror = tryNext;
2223
+ img.onload = () => {
2224
+ if (isLikelyGenericFavicon(img)) tryNext();
2225
+ };
2226
+ });
2227
+ }
2142
2228
 
2143
2229
  // src/widget-render.ts
2144
2230
  function renderStep(ctx) {
@@ -2220,18 +2306,18 @@ function renderBrandFooter(ctx) {
2220
2306
  function renderHeader(ctx, opts) {
2221
2307
  const t = ctx.locale;
2222
2308
  const { title, showBack = false, step, eyebrow } = opts;
2223
- 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>`;
2309
+ 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>`;
2224
2310
  const counterHtml = step ? `<span class="mushi-step-counter" aria-label="Step ${step} of ${TOTAL_STEPS}"><b>${pad2(step)}</b> / ${pad2(TOTAL_STEPS)}</span>` : "";
2225
2311
  return `
2226
2312
  <div class="mushi-header">
2227
- <div class="mushi-header-mark" aria-hidden="true">\u866B</div>
2313
+ <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>
2228
2314
  <div class="mushi-header-titles">
2229
2315
  ${eyebrowHtml}
2230
2316
  <h3>${title}</h3>
2231
2317
  </div>
2232
2318
  <div class="mushi-header-meta">
2233
2319
  ${counterHtml}
2234
- <button type="button" class="mushi-close" data-action="close" aria-label="${t.widget.close}">\u2715</button>
2320
+ <button type="button" class="mushi-close" data-action="close" aria-label="${escapeHtml(t.widget.close)}">\u2715</button>
2235
2321
  </div>
2236
2322
  </div>
2237
2323
  `;
@@ -2283,7 +2369,7 @@ function renderCategoryStep(ctx) {
2283
2369
  return `
2284
2370
  ${renderHeader(ctx, { title: t.step1.heading, step: STEP_NUMBER.category })}
2285
2371
  ${ctx.config.betaMode?.enabled ? renderBetaStrip(ctx) : ""}
2286
- <div class="mushi-body" role="radiogroup" aria-label="${t.step1.heading}">
2372
+ <div class="mushi-body" role="radiogroup" aria-label="${escapeHtml(t.step1.heading)}">
2287
2373
  <button type="button" class="mushi-option-btn mushi-reports-entry" data-action="reports">
2288
2374
  <span class="mushi-option-icon" aria-hidden="true">\u{1F4EC}</span>
2289
2375
  <div class="mushi-option-text">
@@ -2530,24 +2616,42 @@ function renderCrossAppReportsStep(ctx) {
2530
2616
  const grouped = /* @__PURE__ */ new Map();
2531
2617
  for (const r of reports) {
2532
2618
  const key = r.project_id ?? "unknown";
2533
- if (!grouped.has(key)) grouped.set(key, { name: r.app_name ?? "Unknown App", reports: [] });
2619
+ if (!grouped.has(key)) {
2620
+ grouped.set(key, {
2621
+ name: r.app_name ?? "Unknown App",
2622
+ slug: r.app_slug ?? null,
2623
+ domain: r.app_domain ?? null,
2624
+ reports: []
2625
+ });
2626
+ }
2534
2627
  grouped.get(key).reports.push(r);
2535
2628
  }
2536
- const rows = [...grouped.entries()].map(([, group]) => `
2629
+ const rows = [...grouped.entries()].map(([projectId, group]) => {
2630
+ const icon = renderAppIconHtml({
2631
+ projectId,
2632
+ appName: group.name,
2633
+ appSlug: group.slug,
2634
+ appDomain: group.domain
2635
+ });
2636
+ return `
2537
2637
  <div class="mushi-xapp-group">
2538
- <h4 class="mushi-xapp-app-name">${escapeHtml(group.name)}</h4>
2638
+ <div class="mushi-xapp-app-head">
2639
+ ${icon}
2640
+ <h4 class="mushi-xapp-app-name">${escapeHtml(group.name)}</h4>
2641
+ </div>
2539
2642
  ${group.reports.map((r) => {
2540
- const tone = reporterStatusTone(r.status);
2541
- return `
2643
+ const tone = reporterStatusTone(r.status);
2644
+ return `
2542
2645
  <div class="mushi-report-row" data-report-id="${escapeHtml(r.id)}" tabindex="0" role="button">
2543
2646
  <span class="mushi-report-status mushi-status-${tone}">${escapeHtml(reporterStatusShort(r.status))}</span>
2544
2647
  <span class="mushi-report-title">${escapeHtml(r.title ?? r.category)}</span>
2545
2648
  <span class="mushi-report-when">${escapeHtml(formatRelativeTime(r.created_at))}</span>
2546
2649
  </div>
2547
2650
  `;
2548
- }).join("")}
2651
+ }).join("")}
2549
2652
  </div>
2550
- `).join("");
2653
+ `;
2654
+ }).join("");
2551
2655
  return `
2552
2656
  ${renderHeader(ctx, { title: "My reports", showBack: true, eyebrow: "Mushi \xB7 All apps" })}
2553
2657
  <div class="mushi-body">
@@ -2644,9 +2748,9 @@ function renderDetailsStep(ctx) {
2644
2748
  <div class="mushi-textarea-wrap">
2645
2749
  <textarea
2646
2750
  class="mushi-textarea"
2647
- placeholder="${t.step3.descriptionPlaceholder}"
2751
+ placeholder="${escapeHtml(t.step3.descriptionPlaceholder)}"
2648
2752
  rows="4"
2649
- aria-label="${t.step3.heading}"
2753
+ aria-label="${escapeHtml(t.step3.heading)}"
2650
2754
  autofocus
2651
2755
  ></textarea>
2652
2756
  <div class="mushi-char-counter" data-role="char-counter" aria-hidden="true">
@@ -2673,6 +2777,10 @@ function renderDetailsStep(ctx) {
2673
2777
  ${escapeHtml(elementLabel)}
2674
2778
  </button>
2675
2779
  </div>
2780
+ ${ctx.screenshotAttached && ctx.screenshotPreview ? `<figure class="mushi-screenshot-preview">
2781
+ <img src="${escapeHtml(ctx.screenshotPreview)}" alt="${escapeHtml(t.step3.screenshotPreviewAlt)}" />
2782
+ ${ctx.screenshotHint ? `<figcaption class="mushi-screenshot-hint">\u26A0 ${escapeHtml(ctx.screenshotHint)}</figcaption>` : ""}
2783
+ </figure>` : ""}
2676
2784
  <div class="mushi-error" style="display:none" role="alert"></div>
2677
2785
  </div>
2678
2786
  <div class="mushi-footer">
@@ -2865,6 +2973,7 @@ var MushiWidget = class _MushiWidget {
2865
2973
  draggable: config.draggable ?? false,
2866
2974
  brandFooter: config.brandFooter ?? true,
2867
2975
  outdatedBanner: config.outdatedBanner ?? "auto",
2976
+ screenshotSensitiveHint: config.screenshotSensitiveHint ?? true,
2868
2977
  betaMode: config.betaMode ?? {},
2869
2978
  minDescriptionLength: config.minDescriptionLength ?? 20,
2870
2979
  dashboardUrl: config.dashboardUrl ?? "",
@@ -2911,6 +3020,8 @@ var MushiWidget = class _MushiWidget {
2911
3020
  screenshotCapturing = false;
2912
3021
  screenshotError = false;
2913
3022
  allowScreenshotRemove = true;
3023
+ /** Data URL of the attached screenshot, rendered as a visible preview. */
3024
+ screenshotPreview = null;
2914
3025
  elementSelected = false;
2915
3026
  elementCapturing = false;
2916
3027
  submitting = false;
@@ -3022,6 +3133,7 @@ var MushiWidget = class _MushiWidget {
3022
3133
  ...config.draggable !== void 0 ? { draggable: config.draggable } : {},
3023
3134
  ...config.brandFooter !== void 0 ? { brandFooter: config.brandFooter } : {},
3024
3135
  ...config.outdatedBanner !== void 0 ? { outdatedBanner: config.outdatedBanner } : {},
3136
+ ...config.screenshotSensitiveHint !== void 0 ? { screenshotSensitiveHint: config.screenshotSensitiveHint } : {},
3025
3137
  ...config.betaMode !== void 0 ? { betaMode: config.betaMode } : {},
3026
3138
  ...config.minDescriptionLength !== void 0 ? { minDescriptionLength: config.minDescriptionLength } : {},
3027
3139
  ...config.dashboardUrl !== void 0 ? { dashboardUrl: config.dashboardUrl } : {},
@@ -3077,6 +3189,7 @@ var MushiWidget = class _MushiWidget {
3077
3189
  this.screenshotAttached = false;
3078
3190
  this.screenshotCapturing = false;
3079
3191
  this.screenshotError = false;
3192
+ this.screenshotPreview = null;
3080
3193
  this.elementSelected = false;
3081
3194
  this.elementCapturing = false;
3082
3195
  this.submitting = false;
@@ -3215,8 +3328,26 @@ var MushiWidget = class _MushiWidget {
3215
3328
  }
3216
3329
  setScreenshotAttached(attached) {
3217
3330
  this.screenshotAttached = attached;
3331
+ if (!attached) this.screenshotPreview = null;
3332
+ if (this.isOpen) this.render();
3333
+ }
3334
+ /** Provide the captured screenshot data URL so the widget can preview it. */
3335
+ setScreenshotPreview(dataUrl) {
3336
+ this.screenshotPreview = dataUrl;
3218
3337
  if (this.isOpen) this.render();
3219
3338
  }
3339
+ /**
3340
+ * Resolve the privacy caption shown beside the screenshot preview from the
3341
+ * `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
3342
+ * it honours console/runtime config): `false` → hidden, a non-empty string →
3343
+ * that copy, anything else (`true`/unset) → the localized default.
3344
+ */
3345
+ resolveScreenshotHint() {
3346
+ const v = this.config.screenshotSensitiveHint;
3347
+ if (v === false) return null;
3348
+ if (typeof v === "string") return v.trim() ? v : null;
3349
+ return this.locale.step3.screenshotSensitiveHint;
3350
+ }
3220
3351
  setAllowScreenshotRemove(allow) {
3221
3352
  this.allowScreenshotRemove = allow;
3222
3353
  if (this.isOpen) this.render();
@@ -4085,6 +4216,8 @@ var MushiWidget = class _MushiWidget {
4085
4216
  testerInfo: this.testerInfo,
4086
4217
  screenshotCapturing: this.screenshotCapturing,
4087
4218
  screenshotAttached: this.screenshotAttached,
4219
+ screenshotPreview: this.screenshotPreview,
4220
+ screenshotHint: this.resolveScreenshotHint(),
4088
4221
  reporterError: this.reporterError,
4089
4222
  magicLinkError: this.magicLinkError,
4090
4223
  elementCapturing: this.elementCapturing,
@@ -4122,11 +4255,13 @@ var MushiWidget = class _MushiWidget {
4122
4255
  assistantTurns: this.assistantTurns,
4123
4256
  assistantSending: this.assistantSending,
4124
4257
  assistantError: this.assistantError,
4125
- showAllCategories: this.showAllCategories
4258
+ showAllCategories: this.showAllCategories,
4259
+ pageFaviconHref: readPageFaviconHref()
4126
4260
  };
4127
4261
  }
4128
4262
  attachHandlers(panel) {
4129
4263
  const t = this.locale;
4264
+ bindFaviconFallbacks(panel);
4130
4265
  panel.querySelector('[data-action="close"]')?.addEventListener("click", () => this.close());
4131
4266
  panel.querySelector('[data-action="back"]')?.addEventListener("click", () => {
4132
4267
  if (this.step === "intent") {
@@ -4163,6 +4298,7 @@ var MushiWidget = class _MushiWidget {
4163
4298
  this.selectedIntent = null;
4164
4299
  this.viaFeatureRequest = false;
4165
4300
  }
4301
+ if (this.step === "category") this.showAllCategories = false;
4166
4302
  this.render();
4167
4303
  });
4168
4304
  panel.querySelector('[data-action="show-all-categories"]')?.addEventListener("click", () => {
@@ -4723,8 +4859,6 @@ function setConsentGranted(projectId, granted) {
4723
4859
  localStorage.removeItem(getConsentKey(projectId));
4724
4860
  }
4725
4861
  optedIn = granted;
4726
- apiClient?.submitActivity(currentUserId ?? "", [], { optedIn: granted }).catch(() => {
4727
- });
4728
4862
  } catch {
4729
4863
  }
4730
4864
  }
@@ -6959,6 +7093,7 @@ function createInstance(config) {
6959
7093
  log.debug("Auto-capturing screenshot", { when, mode });
6960
7094
  pendingScreenshot = await takeScreenshotWithoutChrome();
6961
7095
  widget.setScreenshotAttached(pendingScreenshot !== null);
7096
+ widget.setScreenshotPreview(pendingScreenshot);
6962
7097
  }
6963
7098
  widget = new MushiWidget(bootstrapConfig.widget, {
6964
7099
  onSubmit: async ({ category, userCategory, description, intent }) => {
@@ -6990,6 +7125,7 @@ function createInstance(config) {
6990
7125
  log.debug("Taking screenshot");
6991
7126
  pendingScreenshot = await takeScreenshotWithoutChrome();
6992
7127
  widget.setScreenshotAttached(pendingScreenshot !== null);
7128
+ widget.setScreenshotPreview(pendingScreenshot);
6993
7129
  },
6994
7130
  onScreenshotRemove: () => {
6995
7131
  log.debug("Screenshot attachment removed");
@@ -7014,6 +7150,7 @@ function createInstance(config) {
7014
7150
  {
7015
7151
  pendingScreenshot = session.getDataUrl();
7016
7152
  widget.setScreenshotAttached(true);
7153
+ widget.setScreenshotPreview(pendingScreenshot);
7017
7154
  }
7018
7155
  session.destroy();
7019
7156
  toolbar.remove();