@mushi-mushi/web 1.14.1 → 1.17.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/CONTRIBUTING.md +50 -9
- package/README.md +4 -1
- package/dist/index.cjs +403 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -4
- package/dist/index.d.ts +41 -4
- package/dist/index.js +404 -68
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +2172 -0
- package/dist/mushi.loader.global.js.map +1 -0
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
|
|
1
|
+
import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
|
|
2
2
|
export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
|
|
3
3
|
|
|
4
4
|
declare class Mushi {
|
|
@@ -36,7 +36,7 @@ declare class Mushi {
|
|
|
36
36
|
* - Behaviour-preserving move: bodies are identical to the pre-split widget.ts.
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap' | 'account' | 'cross-app-reports';
|
|
39
|
+
type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap' | 'account' | 'cross-app-reports' | 'assistant';
|
|
40
40
|
interface WidgetRewardsState {
|
|
41
41
|
tier: {
|
|
42
42
|
slug: string;
|
|
@@ -104,6 +104,14 @@ interface WidgetCallbacks {
|
|
|
104
104
|
/** Called when the user signs out of the in-widget community session.
|
|
105
105
|
* Host should clear any persisted tester JWT. */
|
|
106
106
|
onTesterSignOut?(): void;
|
|
107
|
+
/** Whether the assistant tab should be shown at all. */
|
|
108
|
+
assistantEnabled?: boolean;
|
|
109
|
+
/** Tab label + greeting + starter suggestions for the empty thread. */
|
|
110
|
+
assistantLabel?: string;
|
|
111
|
+
assistantGreeting?: string;
|
|
112
|
+
assistantSuggestions?: string[];
|
|
113
|
+
/** Send one assistant turn; resolves with the structured reply. */
|
|
114
|
+
onAssistantAsk?(message: string, threadId: string | null): Promise<MushiAssistantReply | null>;
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
declare class MushiWidget {
|
|
@@ -182,6 +190,7 @@ declare class MushiWidget {
|
|
|
182
190
|
private lastSubmitQueuedOffline;
|
|
183
191
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
184
192
|
private bannerDismissed;
|
|
193
|
+
private bannerResizeObserver;
|
|
185
194
|
/** Persisted FAB position when draggable is enabled. */
|
|
186
195
|
private fabPos;
|
|
187
196
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
@@ -203,6 +212,10 @@ declare class MushiWidget {
|
|
|
203
212
|
private magicLinkEmail;
|
|
204
213
|
private magicLinkError;
|
|
205
214
|
private magicLinkSending;
|
|
215
|
+
private assistantTurns;
|
|
216
|
+
private assistantThreadId;
|
|
217
|
+
private assistantSending;
|
|
218
|
+
private assistantError;
|
|
206
219
|
constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks, sdkVersion?: string);
|
|
207
220
|
mount(): void;
|
|
208
221
|
getIsMounted(): boolean;
|
|
@@ -223,6 +236,10 @@ declare class MushiWidget {
|
|
|
223
236
|
featureRequest?: boolean;
|
|
224
237
|
}): void;
|
|
225
238
|
close(): void;
|
|
239
|
+
/** Open the panel directly on the assistant ("Ask") tab. */
|
|
240
|
+
openAssistantTab(): void;
|
|
241
|
+
/** Send one assistant turn and re-render as the reply streams back. */
|
|
242
|
+
sendAssistantMessage(message: string): Promise<void>;
|
|
226
243
|
/**
|
|
227
244
|
* Briefly highlight the trigger button (a soft pulse + tooltip) without
|
|
228
245
|
* opening the full reporter panel. Use for first-session welcome nudges
|
|
@@ -304,11 +321,18 @@ declare class MushiWidget {
|
|
|
304
321
|
private syncAttachedLaunchers;
|
|
305
322
|
private syncSmartHide;
|
|
306
323
|
private shouldRenderTrigger;
|
|
307
|
-
/** Height of the banner in px —
|
|
324
|
+
/** Height of the banner in px — used as a fallback before first layout. */
|
|
308
325
|
private static readonly BANNER_HEIGHT;
|
|
309
|
-
/** CSS property applied to
|
|
326
|
+
/** CSS property applied to documentElement so host-app content doesn't slide under the banner. */
|
|
310
327
|
private static readonly BODY_NUDGE_PROP;
|
|
311
328
|
private applyBodyNudge;
|
|
329
|
+
/**
|
|
330
|
+
* Schedule a height measurement after the next paint and set up a ResizeObserver
|
|
331
|
+
* so --mushi-banner-offset always tracks the actual rendered banner height
|
|
332
|
+
* (which can exceed BANNER_HEIGHT when safe-area-inset-top is in play on iOS,
|
|
333
|
+
* or when rich-layout text wraps on narrow viewports).
|
|
334
|
+
*/
|
|
335
|
+
private trackBannerHeight;
|
|
312
336
|
private removeBodyNudge;
|
|
313
337
|
private renderBanner;
|
|
314
338
|
private effectiveTrigger;
|
|
@@ -327,6 +351,11 @@ declare class MushiWidget {
|
|
|
327
351
|
* sticky nav bars, and sign-in CTAs.
|
|
328
352
|
*/
|
|
329
353
|
private computeAvoidTopPx;
|
|
354
|
+
/**
|
|
355
|
+
* Minimum bottom-offset in px so a bottom-anchored trigger clears avoided
|
|
356
|
+
* elements (tab bars, fixed CTAs). Mirrors {@link computeAvoidTopPx}.
|
|
357
|
+
*/
|
|
358
|
+
private computeAvoidBottomPx;
|
|
330
359
|
private applyInsetVars;
|
|
331
360
|
/** Storage key for the FAB position, scoped to projectId when available. */
|
|
332
361
|
private fabStorageKey;
|
|
@@ -376,6 +405,12 @@ declare class MushiWidget {
|
|
|
376
405
|
getRecorderIntentButton(label: string): Element | null;
|
|
377
406
|
getRecorderSubmitButton(): Element | null;
|
|
378
407
|
recorderClickTrigger(): void;
|
|
408
|
+
/**
|
|
409
|
+
* Open the widget directly to the reporter's "My reports" history view.
|
|
410
|
+
* Can be called from host apps via `sdk.openReporter()` or triggered by
|
|
411
|
+
* the banner's "My reports" link button.
|
|
412
|
+
*/
|
|
413
|
+
openReporter(): void;
|
|
379
414
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
380
415
|
recorderSelectIntent(label: string): void;
|
|
381
416
|
recorderFocusDescription(): void;
|
|
@@ -410,6 +445,8 @@ interface ScreenshotCapture {
|
|
|
410
445
|
}
|
|
411
446
|
interface ScreenshotCaptureOptions {
|
|
412
447
|
privacy?: MushiPrivacyConfig;
|
|
448
|
+
/** Callback invoked when capture fails (taint, security policy, etc.). */
|
|
449
|
+
onFailed?: (reason: 'taint' | 'error') => void;
|
|
413
450
|
}
|
|
414
451
|
declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
|
|
415
452
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
|
|
1
|
+
import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
|
|
2
2
|
export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
|
|
3
3
|
|
|
4
4
|
declare class Mushi {
|
|
@@ -36,7 +36,7 @@ declare class Mushi {
|
|
|
36
36
|
* - Behaviour-preserving move: bodies are identical to the pre-split widget.ts.
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap' | 'account' | 'cross-app-reports';
|
|
39
|
+
type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap' | 'account' | 'cross-app-reports' | 'assistant';
|
|
40
40
|
interface WidgetRewardsState {
|
|
41
41
|
tier: {
|
|
42
42
|
slug: string;
|
|
@@ -104,6 +104,14 @@ interface WidgetCallbacks {
|
|
|
104
104
|
/** Called when the user signs out of the in-widget community session.
|
|
105
105
|
* Host should clear any persisted tester JWT. */
|
|
106
106
|
onTesterSignOut?(): void;
|
|
107
|
+
/** Whether the assistant tab should be shown at all. */
|
|
108
|
+
assistantEnabled?: boolean;
|
|
109
|
+
/** Tab label + greeting + starter suggestions for the empty thread. */
|
|
110
|
+
assistantLabel?: string;
|
|
111
|
+
assistantGreeting?: string;
|
|
112
|
+
assistantSuggestions?: string[];
|
|
113
|
+
/** Send one assistant turn; resolves with the structured reply. */
|
|
114
|
+
onAssistantAsk?(message: string, threadId: string | null): Promise<MushiAssistantReply | null>;
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
declare class MushiWidget {
|
|
@@ -182,6 +190,7 @@ declare class MushiWidget {
|
|
|
182
190
|
private lastSubmitQueuedOffline;
|
|
183
191
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
184
192
|
private bannerDismissed;
|
|
193
|
+
private bannerResizeObserver;
|
|
185
194
|
/** Persisted FAB position when draggable is enabled. */
|
|
186
195
|
private fabPos;
|
|
187
196
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
@@ -203,6 +212,10 @@ declare class MushiWidget {
|
|
|
203
212
|
private magicLinkEmail;
|
|
204
213
|
private magicLinkError;
|
|
205
214
|
private magicLinkSending;
|
|
215
|
+
private assistantTurns;
|
|
216
|
+
private assistantThreadId;
|
|
217
|
+
private assistantSending;
|
|
218
|
+
private assistantError;
|
|
206
219
|
constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks, sdkVersion?: string);
|
|
207
220
|
mount(): void;
|
|
208
221
|
getIsMounted(): boolean;
|
|
@@ -223,6 +236,10 @@ declare class MushiWidget {
|
|
|
223
236
|
featureRequest?: boolean;
|
|
224
237
|
}): void;
|
|
225
238
|
close(): void;
|
|
239
|
+
/** Open the panel directly on the assistant ("Ask") tab. */
|
|
240
|
+
openAssistantTab(): void;
|
|
241
|
+
/** Send one assistant turn and re-render as the reply streams back. */
|
|
242
|
+
sendAssistantMessage(message: string): Promise<void>;
|
|
226
243
|
/**
|
|
227
244
|
* Briefly highlight the trigger button (a soft pulse + tooltip) without
|
|
228
245
|
* opening the full reporter panel. Use for first-session welcome nudges
|
|
@@ -304,11 +321,18 @@ declare class MushiWidget {
|
|
|
304
321
|
private syncAttachedLaunchers;
|
|
305
322
|
private syncSmartHide;
|
|
306
323
|
private shouldRenderTrigger;
|
|
307
|
-
/** Height of the banner in px —
|
|
324
|
+
/** Height of the banner in px — used as a fallback before first layout. */
|
|
308
325
|
private static readonly BANNER_HEIGHT;
|
|
309
|
-
/** CSS property applied to
|
|
326
|
+
/** CSS property applied to documentElement so host-app content doesn't slide under the banner. */
|
|
310
327
|
private static readonly BODY_NUDGE_PROP;
|
|
311
328
|
private applyBodyNudge;
|
|
329
|
+
/**
|
|
330
|
+
* Schedule a height measurement after the next paint and set up a ResizeObserver
|
|
331
|
+
* so --mushi-banner-offset always tracks the actual rendered banner height
|
|
332
|
+
* (which can exceed BANNER_HEIGHT when safe-area-inset-top is in play on iOS,
|
|
333
|
+
* or when rich-layout text wraps on narrow viewports).
|
|
334
|
+
*/
|
|
335
|
+
private trackBannerHeight;
|
|
312
336
|
private removeBodyNudge;
|
|
313
337
|
private renderBanner;
|
|
314
338
|
private effectiveTrigger;
|
|
@@ -327,6 +351,11 @@ declare class MushiWidget {
|
|
|
327
351
|
* sticky nav bars, and sign-in CTAs.
|
|
328
352
|
*/
|
|
329
353
|
private computeAvoidTopPx;
|
|
354
|
+
/**
|
|
355
|
+
* Minimum bottom-offset in px so a bottom-anchored trigger clears avoided
|
|
356
|
+
* elements (tab bars, fixed CTAs). Mirrors {@link computeAvoidTopPx}.
|
|
357
|
+
*/
|
|
358
|
+
private computeAvoidBottomPx;
|
|
330
359
|
private applyInsetVars;
|
|
331
360
|
/** Storage key for the FAB position, scoped to projectId when available. */
|
|
332
361
|
private fabStorageKey;
|
|
@@ -376,6 +405,12 @@ declare class MushiWidget {
|
|
|
376
405
|
getRecorderIntentButton(label: string): Element | null;
|
|
377
406
|
getRecorderSubmitButton(): Element | null;
|
|
378
407
|
recorderClickTrigger(): void;
|
|
408
|
+
/**
|
|
409
|
+
* Open the widget directly to the reporter's "My reports" history view.
|
|
410
|
+
* Can be called from host apps via `sdk.openReporter()` or triggered by
|
|
411
|
+
* the banner's "My reports" link button.
|
|
412
|
+
*/
|
|
413
|
+
openReporter(): void;
|
|
379
414
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
380
415
|
recorderSelectIntent(label: string): void;
|
|
381
416
|
recorderFocusDescription(): void;
|
|
@@ -410,6 +445,8 @@ interface ScreenshotCapture {
|
|
|
410
445
|
}
|
|
411
446
|
interface ScreenshotCaptureOptions {
|
|
412
447
|
privacy?: MushiPrivacyConfig;
|
|
448
|
+
/** Callback invoked when capture fails (taint, security policy, etc.). */
|
|
449
|
+
onFailed?: (reason: 'taint' | 'error') => void;
|
|
413
450
|
}
|
|
414
451
|
declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
|
|
415
452
|
|