@mushi-mushi/web 1.25.0 → 1.26.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
@@ -61,6 +61,16 @@ interface WidgetSubmitOutcome {
61
61
  * optimistic copy ("queued offline, we'll send it when you're back")
62
62
  * versus the confirmed copy ("received — track at #abc12345"). */
63
63
  queuedOffline?: boolean;
64
+ /**
65
+ * Distinguishes why a submit did not confirm immediately. Lets the
66
+ * receipt tell the truth instead of always saying "queued offline":
67
+ * - offline: navigator says offline, will flush on reconnect
68
+ * - retrying: transient network/5xx — queued for automatic retry
69
+ * - rate_limited: 429 — user should wait before sending more
70
+ * - quota: 403 entitlement/quota — will not succeed on retry
71
+ * - permanent: validation / payload too large — dropped, not queued
72
+ */
73
+ failureKind?: 'offline' | 'retrying' | 'rate_limited' | 'quota' | 'permanent';
64
74
  /** The report went through but its screenshot had to be shed (couldn't
65
75
  * compress under the wire budget, or the server said PAYLOAD_TOO_LARGE).
66
76
  * The success receipt says so instead of implying the image landed. */
@@ -123,6 +133,9 @@ declare class MushiWidget {
123
133
  private readonly sdkVersion;
124
134
  private host;
125
135
  private shadow;
136
+ /** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
137
+ private colorSchemeMq;
138
+ private onColorSchemeChange;
126
139
  private config;
127
140
  private callbacks;
128
141
  private locale;
@@ -221,6 +234,7 @@ declare class MushiWidget {
221
234
  * Drives a different success copy so the user knows the report
222
235
  * hasn't actually reached the console yet. */
223
236
  private lastSubmitQueuedOffline;
237
+ private lastSubmitFailureKind;
224
238
  private lastSubmitScreenshotDropped;
225
239
  /** Whether the user has clicked ✕ on the header banner this session. */
226
240
  private bannerDismissed;
@@ -281,6 +295,12 @@ declare class MushiWidget {
281
295
  openAssistantTab(): void;
282
296
  /** Send one assistant turn and re-render as the reply streams back. */
283
297
  sendAssistantMessage(message: string): Promise<void>;
298
+ /** Persist Ask turns for same-tab reload survival (UX only). */
299
+ private persistAssistantSession;
300
+ /** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
301
+ clearAssistantTranscript(): void;
302
+ /** Escape hatch from Ask → report category picker (no login required). */
303
+ private openReportFromAssistant;
284
304
  /**
285
305
  * Briefly highlight the trigger button (a soft pulse + tooltip) without
286
306
  * opening the full reporter panel. Use for first-session welcome nudges
@@ -351,6 +371,9 @@ declare class MushiWidget {
351
371
  setCrossAppReports(reports: MushiCrossAppReport[] | null, loading?: boolean): void;
352
372
  setTesterReputation(rep: MushiTesterReputation | null): void;
353
373
  destroy(): void;
374
+ /** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
375
+ private bindColorSchemeListener;
376
+ private unbindColorSchemeListener;
354
377
  /**
355
378
  * Apply the SDK-owned pass-through layout to the host element so it is
356
379
  * always zero-sized and click/touch-transparent. Only the shadow-root
@@ -554,6 +577,21 @@ interface TimelineCapture {
554
577
  }
555
578
  declare function createTimelineCapture(): TimelineCapture;
556
579
 
580
+ /**
581
+ * FILE: packages/web/src/build-widget-theme.ts
582
+ * PURPOSE: Resolve Shadow-DOM CSS variables from @mushi-mushi/core tokens.
583
+ *
584
+ * All widget hex literals live here (or in core/design-tokens.ts) so
585
+ * packages/web/src/styles.ts stays a template-only stylesheet and
586
+ * scripts/check-design-tokens.mjs can enforce the single-source rule.
587
+ *
588
+ * hexToRgbTriplet — converts a 6-char validated hex string to a bare
589
+ * "R,G,B" triplet used as rgba() channels in styles.ts template literals:
590
+ * rgba(${accentRgb}, 0.4) — respects host accent overrides
591
+ * rgba(${shadowInk}, 0.35) — correct ink in both light and dark modes
592
+ * Called only on hex values that already passed safeWidgetHex(), so the
593
+ * regex-based extraction is always well-defined on valid 6-char inputs.
594
+ */
557
595
  interface WidgetThemeVars {
558
596
  isDark: boolean;
559
597
  paper: string;
@@ -568,6 +606,18 @@ interface WidgetThemeVars {
568
606
  widgetAccentWash: string;
569
607
  widgetAccentInk: string;
570
608
  widgetAccentShadow: string;
609
+ /**
610
+ * Bare R,G,B triplet for the resolved accent colour (e.g. "224,60,44").
611
+ * Use in template literals: `rgba(${accentRgb}, 0.5)`. This lets host
612
+ * accent overrides and dark-mode variants cascade automatically into
613
+ * every rgba() call — bypassing the hex guard which only rejects #hex.
614
+ */
615
+ accentRgb: string;
616
+ /**
617
+ * Bare R,G,B triplet for drop shadows: "0,0,0" in dark mode, "14,13,11"
618
+ * in light. Prevents light-ink halos from showing on dark paper surfaces.
619
+ */
620
+ shadowInk: string;
571
621
  ok: string;
572
622
  danger: string;
573
623
  onAccent: string;
package/dist/index.d.ts CHANGED
@@ -61,6 +61,16 @@ interface WidgetSubmitOutcome {
61
61
  * optimistic copy ("queued offline, we'll send it when you're back")
62
62
  * versus the confirmed copy ("received — track at #abc12345"). */
63
63
  queuedOffline?: boolean;
64
+ /**
65
+ * Distinguishes why a submit did not confirm immediately. Lets the
66
+ * receipt tell the truth instead of always saying "queued offline":
67
+ * - offline: navigator says offline, will flush on reconnect
68
+ * - retrying: transient network/5xx — queued for automatic retry
69
+ * - rate_limited: 429 — user should wait before sending more
70
+ * - quota: 403 entitlement/quota — will not succeed on retry
71
+ * - permanent: validation / payload too large — dropped, not queued
72
+ */
73
+ failureKind?: 'offline' | 'retrying' | 'rate_limited' | 'quota' | 'permanent';
64
74
  /** The report went through but its screenshot had to be shed (couldn't
65
75
  * compress under the wire budget, or the server said PAYLOAD_TOO_LARGE).
66
76
  * The success receipt says so instead of implying the image landed. */
@@ -123,6 +133,9 @@ declare class MushiWidget {
123
133
  private readonly sdkVersion;
124
134
  private host;
125
135
  private shadow;
136
+ /** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
137
+ private colorSchemeMq;
138
+ private onColorSchemeChange;
126
139
  private config;
127
140
  private callbacks;
128
141
  private locale;
@@ -221,6 +234,7 @@ declare class MushiWidget {
221
234
  * Drives a different success copy so the user knows the report
222
235
  * hasn't actually reached the console yet. */
223
236
  private lastSubmitQueuedOffline;
237
+ private lastSubmitFailureKind;
224
238
  private lastSubmitScreenshotDropped;
225
239
  /** Whether the user has clicked ✕ on the header banner this session. */
226
240
  private bannerDismissed;
@@ -281,6 +295,12 @@ declare class MushiWidget {
281
295
  openAssistantTab(): void;
282
296
  /** Send one assistant turn and re-render as the reply streams back. */
283
297
  sendAssistantMessage(message: string): Promise<void>;
298
+ /** Persist Ask turns for same-tab reload survival (UX only). */
299
+ private persistAssistantSession;
300
+ /** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
301
+ clearAssistantTranscript(): void;
302
+ /** Escape hatch from Ask → report category picker (no login required). */
303
+ private openReportFromAssistant;
284
304
  /**
285
305
  * Briefly highlight the trigger button (a soft pulse + tooltip) without
286
306
  * opening the full reporter panel. Use for first-session welcome nudges
@@ -351,6 +371,9 @@ declare class MushiWidget {
351
371
  setCrossAppReports(reports: MushiCrossAppReport[] | null, loading?: boolean): void;
352
372
  setTesterReputation(rep: MushiTesterReputation | null): void;
353
373
  destroy(): void;
374
+ /** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
375
+ private bindColorSchemeListener;
376
+ private unbindColorSchemeListener;
354
377
  /**
355
378
  * Apply the SDK-owned pass-through layout to the host element so it is
356
379
  * always zero-sized and click/touch-transparent. Only the shadow-root
@@ -554,6 +577,21 @@ interface TimelineCapture {
554
577
  }
555
578
  declare function createTimelineCapture(): TimelineCapture;
556
579
 
580
+ /**
581
+ * FILE: packages/web/src/build-widget-theme.ts
582
+ * PURPOSE: Resolve Shadow-DOM CSS variables from @mushi-mushi/core tokens.
583
+ *
584
+ * All widget hex literals live here (or in core/design-tokens.ts) so
585
+ * packages/web/src/styles.ts stays a template-only stylesheet and
586
+ * scripts/check-design-tokens.mjs can enforce the single-source rule.
587
+ *
588
+ * hexToRgbTriplet — converts a 6-char validated hex string to a bare
589
+ * "R,G,B" triplet used as rgba() channels in styles.ts template literals:
590
+ * rgba(${accentRgb}, 0.4) — respects host accent overrides
591
+ * rgba(${shadowInk}, 0.35) — correct ink in both light and dark modes
592
+ * Called only on hex values that already passed safeWidgetHex(), so the
593
+ * regex-based extraction is always well-defined on valid 6-char inputs.
594
+ */
557
595
  interface WidgetThemeVars {
558
596
  isDark: boolean;
559
597
  paper: string;
@@ -568,6 +606,18 @@ interface WidgetThemeVars {
568
606
  widgetAccentWash: string;
569
607
  widgetAccentInk: string;
570
608
  widgetAccentShadow: string;
609
+ /**
610
+ * Bare R,G,B triplet for the resolved accent colour (e.g. "224,60,44").
611
+ * Use in template literals: `rgba(${accentRgb}, 0.5)`. This lets host
612
+ * accent overrides and dark-mode variants cascade automatically into
613
+ * every rgba() call — bypassing the hex guard which only rejects #hex.
614
+ */
615
+ accentRgb: string;
616
+ /**
617
+ * Bare R,G,B triplet for drop shadows: "0,0,0" in dark mode, "14,13,11"
618
+ * in light. Prevents light-ink halos from showing on dark paper surfaces.
619
+ */
620
+ shadowInk: string;
571
621
  ok: string;
572
622
  danger: string;
573
623
  onAccent: string;