@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/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
@@ -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;
@@ -2017,7 +2049,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2017
2049
 
2018
2050
  // src/version.ts
2019
2051
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
2020
- var MUSHI_SDK_VERSION = "1.18.0" ;
2052
+ var MUSHI_SDK_VERSION = "1.19.0" ;
2021
2053
 
2022
2054
  // src/widget-helpers.ts
2023
2055
  var CATEGORY_ICONS = {
@@ -2220,7 +2252,7 @@ function renderBrandFooter(ctx) {
2220
2252
  function renderHeader(ctx, opts) {
2221
2253
  const t = ctx.locale;
2222
2254
  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>`;
2255
+ 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
2256
  const counterHtml = step ? `<span class="mushi-step-counter" aria-label="Step ${step} of ${TOTAL_STEPS}"><b>${pad2(step)}</b> / ${pad2(TOTAL_STEPS)}</span>` : "";
2225
2257
  return `
2226
2258
  <div class="mushi-header">
@@ -2231,7 +2263,7 @@ function renderHeader(ctx, opts) {
2231
2263
  </div>
2232
2264
  <div class="mushi-header-meta">
2233
2265
  ${counterHtml}
2234
- <button type="button" class="mushi-close" data-action="close" aria-label="${t.widget.close}">\u2715</button>
2266
+ <button type="button" class="mushi-close" data-action="close" aria-label="${escapeHtml(t.widget.close)}">\u2715</button>
2235
2267
  </div>
2236
2268
  </div>
2237
2269
  `;
@@ -2283,7 +2315,7 @@ function renderCategoryStep(ctx) {
2283
2315
  return `
2284
2316
  ${renderHeader(ctx, { title: t.step1.heading, step: STEP_NUMBER.category })}
2285
2317
  ${ctx.config.betaMode?.enabled ? renderBetaStrip(ctx) : ""}
2286
- <div class="mushi-body" role="radiogroup" aria-label="${t.step1.heading}">
2318
+ <div class="mushi-body" role="radiogroup" aria-label="${escapeHtml(t.step1.heading)}">
2287
2319
  <button type="button" class="mushi-option-btn mushi-reports-entry" data-action="reports">
2288
2320
  <span class="mushi-option-icon" aria-hidden="true">\u{1F4EC}</span>
2289
2321
  <div class="mushi-option-text">
@@ -2644,9 +2676,9 @@ function renderDetailsStep(ctx) {
2644
2676
  <div class="mushi-textarea-wrap">
2645
2677
  <textarea
2646
2678
  class="mushi-textarea"
2647
- placeholder="${t.step3.descriptionPlaceholder}"
2679
+ placeholder="${escapeHtml(t.step3.descriptionPlaceholder)}"
2648
2680
  rows="4"
2649
- aria-label="${t.step3.heading}"
2681
+ aria-label="${escapeHtml(t.step3.heading)}"
2650
2682
  autofocus
2651
2683
  ></textarea>
2652
2684
  <div class="mushi-char-counter" data-role="char-counter" aria-hidden="true">
@@ -2673,6 +2705,10 @@ function renderDetailsStep(ctx) {
2673
2705
  ${escapeHtml(elementLabel)}
2674
2706
  </button>
2675
2707
  </div>
2708
+ ${ctx.screenshotAttached && ctx.screenshotPreview ? `<figure class="mushi-screenshot-preview">
2709
+ <img src="${escapeHtml(ctx.screenshotPreview)}" alt="${escapeHtml(t.step3.screenshotPreviewAlt)}" />
2710
+ ${ctx.screenshotHint ? `<figcaption class="mushi-screenshot-hint">\u26A0 ${escapeHtml(ctx.screenshotHint)}</figcaption>` : ""}
2711
+ </figure>` : ""}
2676
2712
  <div class="mushi-error" style="display:none" role="alert"></div>
2677
2713
  </div>
2678
2714
  <div class="mushi-footer">
@@ -2865,6 +2901,7 @@ var MushiWidget = class _MushiWidget {
2865
2901
  draggable: config.draggable ?? false,
2866
2902
  brandFooter: config.brandFooter ?? true,
2867
2903
  outdatedBanner: config.outdatedBanner ?? "auto",
2904
+ screenshotSensitiveHint: config.screenshotSensitiveHint ?? true,
2868
2905
  betaMode: config.betaMode ?? {},
2869
2906
  minDescriptionLength: config.minDescriptionLength ?? 20,
2870
2907
  dashboardUrl: config.dashboardUrl ?? "",
@@ -2911,6 +2948,8 @@ var MushiWidget = class _MushiWidget {
2911
2948
  screenshotCapturing = false;
2912
2949
  screenshotError = false;
2913
2950
  allowScreenshotRemove = true;
2951
+ /** Data URL of the attached screenshot, rendered as a visible preview. */
2952
+ screenshotPreview = null;
2914
2953
  elementSelected = false;
2915
2954
  elementCapturing = false;
2916
2955
  submitting = false;
@@ -3022,6 +3061,7 @@ var MushiWidget = class _MushiWidget {
3022
3061
  ...config.draggable !== void 0 ? { draggable: config.draggable } : {},
3023
3062
  ...config.brandFooter !== void 0 ? { brandFooter: config.brandFooter } : {},
3024
3063
  ...config.outdatedBanner !== void 0 ? { outdatedBanner: config.outdatedBanner } : {},
3064
+ ...config.screenshotSensitiveHint !== void 0 ? { screenshotSensitiveHint: config.screenshotSensitiveHint } : {},
3025
3065
  ...config.betaMode !== void 0 ? { betaMode: config.betaMode } : {},
3026
3066
  ...config.minDescriptionLength !== void 0 ? { minDescriptionLength: config.minDescriptionLength } : {},
3027
3067
  ...config.dashboardUrl !== void 0 ? { dashboardUrl: config.dashboardUrl } : {},
@@ -3077,6 +3117,7 @@ var MushiWidget = class _MushiWidget {
3077
3117
  this.screenshotAttached = false;
3078
3118
  this.screenshotCapturing = false;
3079
3119
  this.screenshotError = false;
3120
+ this.screenshotPreview = null;
3080
3121
  this.elementSelected = false;
3081
3122
  this.elementCapturing = false;
3082
3123
  this.submitting = false;
@@ -3215,8 +3256,26 @@ var MushiWidget = class _MushiWidget {
3215
3256
  }
3216
3257
  setScreenshotAttached(attached) {
3217
3258
  this.screenshotAttached = attached;
3259
+ if (!attached) this.screenshotPreview = null;
3218
3260
  if (this.isOpen) this.render();
3219
3261
  }
3262
+ /** Provide the captured screenshot data URL so the widget can preview it. */
3263
+ setScreenshotPreview(dataUrl) {
3264
+ this.screenshotPreview = dataUrl;
3265
+ if (this.isOpen) this.render();
3266
+ }
3267
+ /**
3268
+ * Resolve the privacy caption shown beside the screenshot preview from the
3269
+ * `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
3270
+ * it honours console/runtime config): `false` → hidden, a non-empty string →
3271
+ * that copy, anything else (`true`/unset) → the localized default.
3272
+ */
3273
+ resolveScreenshotHint() {
3274
+ const v = this.config.screenshotSensitiveHint;
3275
+ if (v === false) return null;
3276
+ if (typeof v === "string") return v.trim() ? v : null;
3277
+ return this.locale.step3.screenshotSensitiveHint;
3278
+ }
3220
3279
  setAllowScreenshotRemove(allow) {
3221
3280
  this.allowScreenshotRemove = allow;
3222
3281
  if (this.isOpen) this.render();
@@ -4085,6 +4144,8 @@ var MushiWidget = class _MushiWidget {
4085
4144
  testerInfo: this.testerInfo,
4086
4145
  screenshotCapturing: this.screenshotCapturing,
4087
4146
  screenshotAttached: this.screenshotAttached,
4147
+ screenshotPreview: this.screenshotPreview,
4148
+ screenshotHint: this.resolveScreenshotHint(),
4088
4149
  reporterError: this.reporterError,
4089
4150
  magicLinkError: this.magicLinkError,
4090
4151
  elementCapturing: this.elementCapturing,
@@ -4163,6 +4224,7 @@ var MushiWidget = class _MushiWidget {
4163
4224
  this.selectedIntent = null;
4164
4225
  this.viaFeatureRequest = false;
4165
4226
  }
4227
+ if (this.step === "category") this.showAllCategories = false;
4166
4228
  this.render();
4167
4229
  });
4168
4230
  panel.querySelector('[data-action="show-all-categories"]')?.addEventListener("click", () => {
@@ -6959,6 +7021,7 @@ function createInstance(config) {
6959
7021
  log.debug("Auto-capturing screenshot", { when, mode });
6960
7022
  pendingScreenshot = await takeScreenshotWithoutChrome();
6961
7023
  widget.setScreenshotAttached(pendingScreenshot !== null);
7024
+ widget.setScreenshotPreview(pendingScreenshot);
6962
7025
  }
6963
7026
  widget = new MushiWidget(bootstrapConfig.widget, {
6964
7027
  onSubmit: async ({ category, userCategory, description, intent }) => {
@@ -6990,6 +7053,7 @@ function createInstance(config) {
6990
7053
  log.debug("Taking screenshot");
6991
7054
  pendingScreenshot = await takeScreenshotWithoutChrome();
6992
7055
  widget.setScreenshotAttached(pendingScreenshot !== null);
7056
+ widget.setScreenshotPreview(pendingScreenshot);
6993
7057
  },
6994
7058
  onScreenshotRemove: () => {
6995
7059
  log.debug("Screenshot attachment removed");
@@ -7014,6 +7078,7 @@ function createInstance(config) {
7014
7078
  {
7015
7079
  pendingScreenshot = session.getDataUrl();
7016
7080
  widget.setScreenshotAttached(true);
7081
+ widget.setScreenshotPreview(pendingScreenshot);
7017
7082
  }
7018
7083
  session.destroy();
7019
7084
  toolbar.remove();