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