@mushi-mushi/web 1.17.0 → 1.18.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.cjs CHANGED
@@ -487,9 +487,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
487
487
 
488
488
  .mushi-panel {
489
489
  position: fixed;
490
- width: 384px;
490
+ width: 360px;
491
491
  max-width: calc(100vw - 32px);
492
- max-height: min(640px, calc(100dvh - 120px - var(--mushi-keyboard-inset, 0px)));
492
+ max-height: min(480px, calc(100dvh - 120px - var(--mushi-keyboard-inset, 0px)));
493
493
  background: ${paper};
494
494
  border: 1px solid ${ruleStrong};
495
495
  border-radius: 6px;
@@ -575,12 +575,12 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
575
575
  }
576
576
 
577
577
  .mushi-header {
578
- padding: 18px 20px 14px;
578
+ padding: 13px 18px 10px;
579
579
  border-bottom: 1px solid ${rule};
580
580
  display: grid;
581
581
  grid-template-columns: auto 1fr auto;
582
582
  align-items: end;
583
- gap: 12px;
583
+ gap: 10px;
584
584
  }
585
585
  .mushi-header-mark {
586
586
  display: inline-flex;
@@ -655,17 +655,22 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
655
655
  background: none;
656
656
  border: none;
657
657
  cursor: pointer;
658
- padding: 0;
658
+ padding: 3px 0;
659
659
  margin: 0 0 2px;
660
+ min-height: 22px;
660
661
  color: ${inkMuted};
661
662
  font-family: ${fontMono};
662
- font-size: 10px;
663
+ font-size: 11px;
663
664
  font-weight: 500;
664
- letter-spacing: 0.12em;
665
+ letter-spacing: 0.06em;
665
666
  text-transform: uppercase;
666
667
  line-height: 1.2;
667
668
  border-radius: 0;
669
+ display: inline-flex;
670
+ align-items: center;
671
+ gap: 4px;
668
672
  transition: color 150ms ${easeStamp};
673
+ white-space: nowrap;
669
674
  }
670
675
  .mushi-close:hover { color: ${widgetAccent}; }
671
676
  .mushi-back:hover { color: ${ink}; }
@@ -698,9 +703,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
698
703
  display: grid;
699
704
  grid-template-columns: auto 1fr auto;
700
705
  align-items: center;
701
- gap: 14px;
706
+ gap: 12px;
702
707
  width: 100%;
703
- padding: 14px 0;
708
+ padding: 11px 0;
704
709
  border: none;
705
710
  border-bottom: 1px solid ${rule};
706
711
  background: transparent;
@@ -1924,6 +1929,56 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1924
1929
 
1925
1930
  .mushi-community-footer{display:flex;align-items:center;gap:8px;padding:10px 0 2px;border-top:1px solid ${isDark ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.07)"};margin-top:8px;flex-wrap:wrap}
1926
1931
  .mushi-community-btn{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1932
+ /* \u2500\u2500 "More issue types \u2192" toggle (progressive disclosure) \u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
1933
+ .mushi-more-toggle {
1934
+ display: flex;
1935
+ align-items: center;
1936
+ gap: 8px;
1937
+ width: 100%;
1938
+ padding: 11px 0;
1939
+ border: none;
1940
+ border-top: 1px dashed ${rule};
1941
+ background: transparent;
1942
+ cursor: pointer;
1943
+ color: ${inkMuted};
1944
+ font-family: ${fontBody};
1945
+ font-size: 13px;
1946
+ text-align: left;
1947
+ transition: color 180ms ${easeStamp};
1948
+ }
1949
+ .mushi-more-toggle:hover { color: ${widgetAccent}; }
1950
+ .mushi-more-toggle:hover .mushi-more-toggle-arrow { transform: translateX(3px); }
1951
+ .mushi-more-toggle-text { flex: 1; }
1952
+ .mushi-more-toggle-count {
1953
+ font-family: ${fontMono};
1954
+ font-size: 10px;
1955
+ letter-spacing: 0.08em;
1956
+ text-transform: uppercase;
1957
+ color: ${inkFaint};
1958
+ background: ${isDark ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.06)"};
1959
+ padding: 2px 6px;
1960
+ border-radius: 10px;
1961
+ }
1962
+ .mushi-more-toggle-arrow {
1963
+ font-size: 14px;
1964
+ opacity: 0.5;
1965
+ transition: transform 180ms ${easeStamp};
1966
+ }
1967
+ /* \u2500\u2500 Step slide-in \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
1968
+ @keyframes mushi-step-in {
1969
+ 0% { opacity: 0; transform: translateX(8px); }
1970
+ 100% { opacity: 1; transform: translateX(0); }
1971
+ }
1972
+ .mushi-body {
1973
+ animation: mushi-step-in 160ms ease both;
1974
+ }
1975
+ @media (prefers-reduced-motion: reduce) {
1976
+ .mushi-body { animation: none; }
1977
+ }
1978
+ /* Expanded secondary categories animate in */
1979
+ .mushi-categories-expanded {
1980
+ animation: mushi-step-in 180ms ease both;
1981
+ }
1927
1982
  .mushi-link-btn{background:none;border:none;padding:4px 2px;cursor:pointer;color:${widgetAccent};font-size:12px;font-family:${fontMono};text-decoration:underline;text-underline-offset:2px}
1928
1983
  .mushi-link-btn:hover{opacity:0.8}
1929
1984
  .mushi-link-btn:focus-visible,.mushi-nav-item:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;border-radius:2px}
@@ -1964,7 +2019,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1964
2019
 
1965
2020
  // src/version.ts
1966
2021
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
1967
- var MUSHI_SDK_VERSION = "1.17.0" ;
2022
+ var MUSHI_SDK_VERSION = "1.18.0" ;
1968
2023
 
1969
2024
  // src/widget-helpers.ts
1970
2025
  var CATEGORY_ICONS = {
@@ -2167,7 +2222,7 @@ function renderBrandFooter(ctx) {
2167
2222
  function renderHeader(ctx, opts) {
2168
2223
  const t = ctx.locale;
2169
2224
  const { title, showBack = false, step, eyebrow } = opts;
2170
- const eyebrowHtml = showBack ? `<button type="button" class="mushi-back" data-action="back" aria-label="${t.widget.back}">\u2190</button>` : `<span class="mushi-header-eyebrow">${eyebrow ?? "Mushi \xB7 Report"}</span>`;
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>`;
2171
2226
  const counterHtml = step ? `<span class="mushi-step-counter" aria-label="Step ${step} of ${TOTAL_STEPS}"><b>${pad2(step)}</b> / ${pad2(TOTAL_STEPS)}</span>` : "";
2172
2227
  return `
2173
2228
  <div class="mushi-header">
@@ -2205,16 +2260,28 @@ function renderCategoryStep(ctx) {
2205
2260
  label: t.step1.categories[id],
2206
2261
  desc: t.step1.categoryDescriptions[id]
2207
2262
  }));
2208
- const categories = categoryEntries.map(({ id, icon, label, desc }) => `
2209
- <button type="button" class="mushi-option-btn" data-category="${escapeHtml(id)}" role="radio" aria-checked="false">
2210
- <span class="mushi-option-icon" aria-hidden="true">${escapeHtml(icon)}</span>
2211
- <div class="mushi-option-text">
2212
- <span class="mushi-option-label">${escapeHtml(label)}</span>
2213
- ${desc ? `<span class="mushi-option-desc">${escapeHtml(desc)}</span>` : ""}
2214
- </div>
2215
- <span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
2216
- </button>
2217
- `).join("");
2263
+ const renderEntry = ({ id, icon, label, desc }) => `
2264
+ <button type="button" class="mushi-option-btn" data-category="${escapeHtml(id)}" role="radio" aria-checked="false">
2265
+ <span class="mushi-option-icon" aria-hidden="true">${escapeHtml(icon)}</span>
2266
+ <div class="mushi-option-text">
2267
+ <span class="mushi-option-label">${escapeHtml(label)}</span>
2268
+ ${desc ? `<span class="mushi-option-desc">${escapeHtml(desc)}</span>` : ""}
2269
+ </div>
2270
+ <span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
2271
+ </button>
2272
+ `;
2273
+ const isCustom = ctx.config.categories && ctx.config.categories.length > 0;
2274
+ const PRIMARY_LIMIT = 1;
2275
+ const primaryEntries = isCustom ? categoryEntries : categoryEntries.slice(0, PRIMARY_LIMIT);
2276
+ const secondaryEntries = isCustom ? [] : categoryEntries.slice(PRIMARY_LIMIT);
2277
+ const hasMore = secondaryEntries.length > 0;
2278
+ const primaryCategories = primaryEntries.map(renderEntry).join("");
2279
+ const secondaryCategories = secondaryEntries.map(renderEntry).join("");
2280
+ const secondaryHtml = hasMore ? ctx.showAllCategories ? `<div class="mushi-categories-expanded">${secondaryCategories}</div>` : `<button type="button" class="mushi-more-toggle" data-action="show-all-categories">
2281
+ <span class="mushi-more-toggle-text">More issue types</span>
2282
+ <span class="mushi-more-toggle-count">${secondaryEntries.length} more</span>
2283
+ <span class="mushi-more-toggle-arrow" aria-hidden="true">\u2192</span>
2284
+ </button>` : "";
2218
2285
  return `
2219
2286
  ${renderHeader(ctx, { title: t.step1.heading, step: STEP_NUMBER.category })}
2220
2287
  ${ctx.config.betaMode?.enabled ? renderBetaStrip(ctx) : ""}
@@ -2237,7 +2304,8 @@ function renderCategoryStep(ctx) {
2237
2304
  </div>
2238
2305
  <span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
2239
2306
  </button>` : ""}
2240
- ${categories}
2307
+ ${primaryCategories}
2308
+ ${secondaryHtml}
2241
2309
  ${ctx.rewardsState ? renderRewardsNudge(ctx) : ""}
2242
2310
  <div class="mushi-community-footer">
2243
2311
  <button type="button" class="mushi-link-btn mushi-community-btn" data-action="open-account">
@@ -2624,7 +2692,7 @@ function renderSuccessStep(ctx) {
2624
2692
  const stamp = ctx.submittedAt ?? /* @__PURE__ */ new Date();
2625
2693
  const time = stamp.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false });
2626
2694
  return `
2627
- ${renderHeader(ctx, { title: t.widget.title, eyebrow: "Mushi \xB7 Receipt" })}
2695
+ ${renderHeader(ctx, { title: t.widget.title, showBack: true, eyebrow: "Mushi \xB7 Receipt" })}
2628
2696
  <div class="mushi-body">
2629
2697
  <div class="mushi-success">
2630
2698
  <div class="mushi-success-stamp" aria-hidden="true">
@@ -2839,6 +2907,8 @@ var MushiWidget = class _MushiWidget {
2839
2907
  * landing on the intent picker the user explicitly skipped.
2840
2908
  */
2841
2909
  viaFeatureRequest = false;
2910
+ /** Whether the category list is fully expanded (progressive disclosure). */
2911
+ showAllCategories = false;
2842
2912
  screenshotAttached = false;
2843
2913
  screenshotCapturing = false;
2844
2914
  screenshotError = false;
@@ -3046,6 +3116,7 @@ var MushiWidget = class _MushiWidget {
3046
3116
  close() {
3047
3117
  if (!this.isOpen) return;
3048
3118
  this.isOpen = false;
3119
+ this.showAllCategories = false;
3049
3120
  this.render();
3050
3121
  this.callbacks.onClose();
3051
3122
  }
@@ -4052,7 +4123,8 @@ var MushiWidget = class _MushiWidget {
4052
4123
  categoryIcon: (id) => this.categoryIcon(id),
4053
4124
  assistantTurns: this.assistantTurns,
4054
4125
  assistantSending: this.assistantSending,
4055
- assistantError: this.assistantError
4126
+ assistantError: this.assistantError,
4127
+ showAllCategories: this.showAllCategories
4056
4128
  };
4057
4129
  }
4058
4130
  attachHandlers(panel) {
@@ -4083,9 +4155,22 @@ var MushiWidget = class _MushiWidget {
4083
4155
  this.step = "category";
4084
4156
  } else if (this.step === "assistant") {
4085
4157
  this.step = "category";
4158
+ } else if (this.step === "account") {
4159
+ this.step = "category";
4160
+ } else if (this.step === "cross-app-reports") {
4161
+ this.step = "account";
4162
+ } else if (this.step === "success") {
4163
+ this.step = "category";
4164
+ this.selectedCategory = null;
4165
+ this.selectedIntent = null;
4166
+ this.viaFeatureRequest = false;
4086
4167
  }
4087
4168
  this.render();
4088
4169
  });
4170
+ panel.querySelector('[data-action="show-all-categories"]')?.addEventListener("click", () => {
4171
+ this.showAllCategories = true;
4172
+ this.render();
4173
+ });
4089
4174
  panel.querySelector('[data-action="assistant"]')?.addEventListener("click", () => {
4090
4175
  this.openAssistantTab();
4091
4176
  });