@mushi-mushi/web 1.18.0 → 1.19.0

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
@@ -88,7 +88,7 @@ Each trigger respects its config flag — set `rageClick: false` to disable rage
88
88
 
89
89
  ## Bundle Size
90
90
 
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.
91
+ ~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
92
 
93
93
  ## Quick Start
94
94
 
@@ -398,7 +398,7 @@ report — without you having to plumb it through the report payload yourself:
398
398
  const mushi = Mushi.init({ projectId: 'proj_xxx', apiKey: 'mushi_xxx' });
399
399
 
400
400
  // 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' });
401
+ mushi.identify('usr_42', { email: 'aya@example.com', segment: 'beta' });
402
402
 
403
403
  // Sticky scalar tags. Up to 64 keys; values are string | number | boolean.
404
404
  mushi.setTag('feature', 'checkout-v2');
@@ -531,4 +531,4 @@ MIT
531
531
  <!-- mushi-readme-stats-footer -->
532
532
  ---
533
533
 
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>
534
+ <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;
@@ -2019,7 +2051,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2019
2051
 
2020
2052
  // src/version.ts
2021
2053
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
2022
- var MUSHI_SDK_VERSION = "1.18.0" ;
2054
+ var MUSHI_SDK_VERSION = "1.19.0" ;
2023
2055
 
2024
2056
  // src/widget-helpers.ts
2025
2057
  var CATEGORY_ICONS = {
@@ -2222,7 +2254,7 @@ function renderBrandFooter(ctx) {
2222
2254
  function renderHeader(ctx, opts) {
2223
2255
  const t = ctx.locale;
2224
2256
  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>`;
2257
+ 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
2258
  const counterHtml = step ? `<span class="mushi-step-counter" aria-label="Step ${step} of ${TOTAL_STEPS}"><b>${pad2(step)}</b> / ${pad2(TOTAL_STEPS)}</span>` : "";
2227
2259
  return `
2228
2260
  <div class="mushi-header">
@@ -2233,7 +2265,7 @@ function renderHeader(ctx, opts) {
2233
2265
  </div>
2234
2266
  <div class="mushi-header-meta">
2235
2267
  ${counterHtml}
2236
- <button type="button" class="mushi-close" data-action="close" aria-label="${t.widget.close}">\u2715</button>
2268
+ <button type="button" class="mushi-close" data-action="close" aria-label="${escapeHtml(t.widget.close)}">\u2715</button>
2237
2269
  </div>
2238
2270
  </div>
2239
2271
  `;
@@ -2285,7 +2317,7 @@ function renderCategoryStep(ctx) {
2285
2317
  return `
2286
2318
  ${renderHeader(ctx, { title: t.step1.heading, step: STEP_NUMBER.category })}
2287
2319
  ${ctx.config.betaMode?.enabled ? renderBetaStrip(ctx) : ""}
2288
- <div class="mushi-body" role="radiogroup" aria-label="${t.step1.heading}">
2320
+ <div class="mushi-body" role="radiogroup" aria-label="${escapeHtml(t.step1.heading)}">
2289
2321
  <button type="button" class="mushi-option-btn mushi-reports-entry" data-action="reports">
2290
2322
  <span class="mushi-option-icon" aria-hidden="true">\u{1F4EC}</span>
2291
2323
  <div class="mushi-option-text">
@@ -2646,9 +2678,9 @@ function renderDetailsStep(ctx) {
2646
2678
  <div class="mushi-textarea-wrap">
2647
2679
  <textarea
2648
2680
  class="mushi-textarea"
2649
- placeholder="${t.step3.descriptionPlaceholder}"
2681
+ placeholder="${escapeHtml(t.step3.descriptionPlaceholder)}"
2650
2682
  rows="4"
2651
- aria-label="${t.step3.heading}"
2683
+ aria-label="${escapeHtml(t.step3.heading)}"
2652
2684
  autofocus
2653
2685
  ></textarea>
2654
2686
  <div class="mushi-char-counter" data-role="char-counter" aria-hidden="true">
@@ -2675,6 +2707,10 @@ function renderDetailsStep(ctx) {
2675
2707
  ${escapeHtml(elementLabel)}
2676
2708
  </button>
2677
2709
  </div>
2710
+ ${ctx.screenshotAttached && ctx.screenshotPreview ? `<figure class="mushi-screenshot-preview">
2711
+ <img src="${escapeHtml(ctx.screenshotPreview)}" alt="${escapeHtml(t.step3.screenshotPreviewAlt)}" />
2712
+ ${ctx.screenshotHint ? `<figcaption class="mushi-screenshot-hint">\u26A0 ${escapeHtml(ctx.screenshotHint)}</figcaption>` : ""}
2713
+ </figure>` : ""}
2678
2714
  <div class="mushi-error" style="display:none" role="alert"></div>
2679
2715
  </div>
2680
2716
  <div class="mushi-footer">
@@ -2867,6 +2903,7 @@ var MushiWidget = class _MushiWidget {
2867
2903
  draggable: config.draggable ?? false,
2868
2904
  brandFooter: config.brandFooter ?? true,
2869
2905
  outdatedBanner: config.outdatedBanner ?? "auto",
2906
+ screenshotSensitiveHint: config.screenshotSensitiveHint ?? true,
2870
2907
  betaMode: config.betaMode ?? {},
2871
2908
  minDescriptionLength: config.minDescriptionLength ?? 20,
2872
2909
  dashboardUrl: config.dashboardUrl ?? "",
@@ -2913,6 +2950,8 @@ var MushiWidget = class _MushiWidget {
2913
2950
  screenshotCapturing = false;
2914
2951
  screenshotError = false;
2915
2952
  allowScreenshotRemove = true;
2953
+ /** Data URL of the attached screenshot, rendered as a visible preview. */
2954
+ screenshotPreview = null;
2916
2955
  elementSelected = false;
2917
2956
  elementCapturing = false;
2918
2957
  submitting = false;
@@ -3024,6 +3063,7 @@ var MushiWidget = class _MushiWidget {
3024
3063
  ...config.draggable !== void 0 ? { draggable: config.draggable } : {},
3025
3064
  ...config.brandFooter !== void 0 ? { brandFooter: config.brandFooter } : {},
3026
3065
  ...config.outdatedBanner !== void 0 ? { outdatedBanner: config.outdatedBanner } : {},
3066
+ ...config.screenshotSensitiveHint !== void 0 ? { screenshotSensitiveHint: config.screenshotSensitiveHint } : {},
3027
3067
  ...config.betaMode !== void 0 ? { betaMode: config.betaMode } : {},
3028
3068
  ...config.minDescriptionLength !== void 0 ? { minDescriptionLength: config.minDescriptionLength } : {},
3029
3069
  ...config.dashboardUrl !== void 0 ? { dashboardUrl: config.dashboardUrl } : {},
@@ -3079,6 +3119,7 @@ var MushiWidget = class _MushiWidget {
3079
3119
  this.screenshotAttached = false;
3080
3120
  this.screenshotCapturing = false;
3081
3121
  this.screenshotError = false;
3122
+ this.screenshotPreview = null;
3082
3123
  this.elementSelected = false;
3083
3124
  this.elementCapturing = false;
3084
3125
  this.submitting = false;
@@ -3217,8 +3258,26 @@ var MushiWidget = class _MushiWidget {
3217
3258
  }
3218
3259
  setScreenshotAttached(attached) {
3219
3260
  this.screenshotAttached = attached;
3261
+ if (!attached) this.screenshotPreview = null;
3220
3262
  if (this.isOpen) this.render();
3221
3263
  }
3264
+ /** Provide the captured screenshot data URL so the widget can preview it. */
3265
+ setScreenshotPreview(dataUrl) {
3266
+ this.screenshotPreview = dataUrl;
3267
+ if (this.isOpen) this.render();
3268
+ }
3269
+ /**
3270
+ * Resolve the privacy caption shown beside the screenshot preview from the
3271
+ * `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
3272
+ * it honours console/runtime config): `false` → hidden, a non-empty string →
3273
+ * that copy, anything else (`true`/unset) → the localized default.
3274
+ */
3275
+ resolveScreenshotHint() {
3276
+ const v = this.config.screenshotSensitiveHint;
3277
+ if (v === false) return null;
3278
+ if (typeof v === "string") return v.trim() ? v : null;
3279
+ return this.locale.step3.screenshotSensitiveHint;
3280
+ }
3222
3281
  setAllowScreenshotRemove(allow) {
3223
3282
  this.allowScreenshotRemove = allow;
3224
3283
  if (this.isOpen) this.render();
@@ -4087,6 +4146,8 @@ var MushiWidget = class _MushiWidget {
4087
4146
  testerInfo: this.testerInfo,
4088
4147
  screenshotCapturing: this.screenshotCapturing,
4089
4148
  screenshotAttached: this.screenshotAttached,
4149
+ screenshotPreview: this.screenshotPreview,
4150
+ screenshotHint: this.resolveScreenshotHint(),
4090
4151
  reporterError: this.reporterError,
4091
4152
  magicLinkError: this.magicLinkError,
4092
4153
  elementCapturing: this.elementCapturing,
@@ -4165,6 +4226,7 @@ var MushiWidget = class _MushiWidget {
4165
4226
  this.selectedIntent = null;
4166
4227
  this.viaFeatureRequest = false;
4167
4228
  }
4229
+ if (this.step === "category") this.showAllCategories = false;
4168
4230
  this.render();
4169
4231
  });
4170
4232
  panel.querySelector('[data-action="show-all-categories"]')?.addEventListener("click", () => {
@@ -6961,6 +7023,7 @@ function createInstance(config) {
6961
7023
  log.debug("Auto-capturing screenshot", { when, mode });
6962
7024
  pendingScreenshot = await takeScreenshotWithoutChrome();
6963
7025
  widget.setScreenshotAttached(pendingScreenshot !== null);
7026
+ widget.setScreenshotPreview(pendingScreenshot);
6964
7027
  }
6965
7028
  widget = new MushiWidget(bootstrapConfig.widget, {
6966
7029
  onSubmit: async ({ category, userCategory, description, intent }) => {
@@ -6992,6 +7055,7 @@ function createInstance(config) {
6992
7055
  log.debug("Taking screenshot");
6993
7056
  pendingScreenshot = await takeScreenshotWithoutChrome();
6994
7057
  widget.setScreenshotAttached(pendingScreenshot !== null);
7058
+ widget.setScreenshotPreview(pendingScreenshot);
6995
7059
  },
6996
7060
  onScreenshotRemove: () => {
6997
7061
  log.debug("Screenshot attachment removed");
@@ -7016,6 +7080,7 @@ function createInstance(config) {
7016
7080
  {
7017
7081
  pendingScreenshot = session.getDataUrl();
7018
7082
  widget.setScreenshotAttached(true);
7083
+ widget.setScreenshotPreview(pendingScreenshot);
7019
7084
  }
7020
7085
  session.destroy();
7021
7086
  toolbar.remove();