@mushi-mushi/web 1.29.0 → 1.31.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/README.md +19 -5
- package/dist/chunks/display-capture-5ZJSTBUK.js +34 -0
- package/dist/chunks/display-capture-5ZJSTBUK.js.map +1 -0
- package/dist/chunks/screenshot-annotation-IG7C5B6Z.js +132 -0
- package/dist/chunks/screenshot-annotation-IG7C5B6Z.js.map +1 -0
- package/dist/chunks/widget-views-DX3OYHGR.js +233 -0
- package/dist/chunks/widget-views-DX3OYHGR.js.map +1 -0
- package/dist/headless.cjs +39 -13
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +1 -1
- package/dist/headless.d.ts +72 -2
- package/dist/headless.js +39 -13
- package/dist/headless.js.map +1 -1
- package/dist/i18n/index.cjs +178 -234
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +114 -32
- package/dist/i18n/index.d.ts +114 -32
- package/dist/i18n/index.js +178 -234
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +2495 -4386
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +203 -181
- package/dist/index.d.ts +541 -183
- package/dist/index.js +2011 -4325
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +21 -2279
- package/dist/test-utils.cjs +410 -1
- package/dist/test-utils.cjs.map +1 -1
- package/dist/test-utils.js +410 -1
- package/dist/test-utils.js.map +1 -1
- package/dist/{timeline-BuqAn2FH.d.cts → timeline-B8nMyZyM.d.cts} +12 -2
- package/package.json +19 -4
- package/dist/timeline-BuqAn2FH.d.ts +0 -63
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiApiCascadeConfig, MushiErrorFilter } from '@mushi-mushi/core';
|
|
1
|
+
import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiReporterTimelineItem, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiReporterUpdates, MushiApiCascadeConfig, MushiErrorFilter } 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
|
+
import { g as ScreenshotFailureReason } from './timeline-B8nMyZyM.cjs';
|
|
4
|
+
export { C as ConsoleCapture, E as ElementSelector, N as NetworkCapture, P as PerformanceCapture, S as ScreenshotCapture, T as TimelineCapture, c as createConsoleCapture, a as createElementSelector, b as createNetworkCapture, d as createPerformanceCapture, e as createScreenshotCapture, f as createTimelineCapture } from './timeline-B8nMyZyM.cjs';
|
|
4
5
|
export { MushiLocale, getAvailableLocales, getLocale } from './i18n/index.cjs';
|
|
5
6
|
|
|
6
7
|
declare class Mushi {
|
|
@@ -18,11 +19,10 @@ declare class Mushi {
|
|
|
18
19
|
* on the MushiWidget class (DOM structure, state, lifecycle).
|
|
19
20
|
*
|
|
20
21
|
* OVERVIEW:
|
|
21
|
-
* - Pure functions:
|
|
22
|
-
*
|
|
23
|
-
* - Constants:
|
|
24
|
-
*
|
|
25
|
-
* - Shared types: WidgetStep, the reporter status tone union, and the public
|
|
22
|
+
* - Pure functions: relative-time formatting, the submit-shortcut detector,
|
|
23
|
+
* HTML escaping, the reporter timeline builder.
|
|
24
|
+
* - Constants: the feature-request intent wire string, read deadlines.
|
|
25
|
+
* - Shared types: WidgetStep, PendingReply, and the public
|
|
26
26
|
* WidgetRewardsState / WidgetSubmitOutcome / WidgetCallbacks contracts (these
|
|
27
27
|
* three are re-exported from widget.ts so existing `./widget` import sites and
|
|
28
28
|
* the package barrel keep working unchanged).
|
|
@@ -38,7 +38,11 @@ declare class Mushi {
|
|
|
38
38
|
* - Behaviour-preserving move: bodies are identical to the pre-split widget.ts.
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
-
type WidgetStep = '
|
|
41
|
+
type WidgetStep = 'report' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap' | 'account' | 'cross-app-reports' | 'assistant';
|
|
42
|
+
/** One timeline row from GET /v1/reporter/reports/:id (core's shape). */
|
|
43
|
+
type WidgetTimelineEvent = MushiReporterTimelineItem;
|
|
44
|
+
/** Capture failure reasons plus 'permission' (a host screenshotProvider was denied). */
|
|
45
|
+
type ScreenshotErrorReason = ScreenshotFailureReason | 'permission';
|
|
42
46
|
interface WidgetRewardsState {
|
|
43
47
|
tier: {
|
|
44
48
|
slug: string;
|
|
@@ -96,6 +100,11 @@ interface WidgetCallbacks {
|
|
|
96
100
|
onBrandFooterImpression?(): void;
|
|
97
101
|
onBrandFooterClick?(): void;
|
|
98
102
|
onScreenshotRequest(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Present only when the browser supports getDisplayMedia. Must start the
|
|
105
|
+
* capture synchronously (the picker needs the click's user activation).
|
|
106
|
+
*/
|
|
107
|
+
onScreenshotShareTabRequest?(): void;
|
|
99
108
|
onScreenshotRemove?(): void;
|
|
100
109
|
/** Optional markup pass (highlight / blur / arrow) before submit. */
|
|
101
110
|
onScreenshotAnnotateRequest?(container: HTMLElement): void | Promise<void>;
|
|
@@ -105,6 +114,17 @@ interface WidgetCallbacks {
|
|
|
105
114
|
onReporterReply?(reportId: string, body: string): Promise<void>;
|
|
106
115
|
onReporterFeedback?(reportId: string, signal: string, note?: string): Promise<Record<string, unknown> | null>;
|
|
107
116
|
onReporterReopen?(reportId: string, note?: string): Promise<Record<string, unknown> | null>;
|
|
117
|
+
/** Header card + merged timeline for one report (newer servers); falls back to the comments call. */
|
|
118
|
+
onReporterReportRequest?(reportId: string): Promise<{
|
|
119
|
+
report?: Partial<MushiReporterReport>;
|
|
120
|
+
timeline?: WidgetTimelineEvent[] | null;
|
|
121
|
+
} | null>;
|
|
122
|
+
/** Mark a report's updates read when its thread opens; resolves with the new unread total when known. */
|
|
123
|
+
onReporterMarkRead?(reportId: string): Promise<number | null | void>;
|
|
124
|
+
/** Save an email for status updates on this device's reports (explicit opt-in). */
|
|
125
|
+
onReporterEmailOptIn?(email: string): Promise<void>;
|
|
126
|
+
/** Ask for browser notification permission and register a push subscription. */
|
|
127
|
+
onReporterPushSubscribe?(): Promise<void>;
|
|
108
128
|
onFeatureBoardRequest?(): Promise<Array<Record<string, unknown>>>;
|
|
109
129
|
onFeatureBoardVote?(requestId: string): Promise<{
|
|
110
130
|
voted: boolean;
|
|
@@ -134,7 +154,6 @@ interface WidgetCallbacks {
|
|
|
134
154
|
}
|
|
135
155
|
|
|
136
156
|
declare class MushiWidget {
|
|
137
|
-
private readonly sdkVersion;
|
|
138
157
|
private host;
|
|
139
158
|
private shadow;
|
|
140
159
|
/** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
|
|
@@ -143,51 +162,46 @@ declare class MushiWidget {
|
|
|
143
162
|
private config;
|
|
144
163
|
private callbacks;
|
|
145
164
|
private locale;
|
|
165
|
+
private rc;
|
|
166
|
+
private lang;
|
|
146
167
|
private isOpen;
|
|
147
168
|
private step;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
private
|
|
154
|
-
private
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
169
|
+
private readonly styleEl;
|
|
170
|
+
private styleKey;
|
|
171
|
+
private readonly panel;
|
|
172
|
+
private readonly scroller;
|
|
173
|
+
private readonly regionEls;
|
|
174
|
+
private regionHtml;
|
|
175
|
+
private readonly live;
|
|
176
|
+
private renderedStep;
|
|
177
|
+
private triggerEl;
|
|
178
|
+
private triggerKey;
|
|
179
|
+
private bannerEl;
|
|
180
|
+
private bannerKey;
|
|
181
|
+
private toastEl;
|
|
182
|
+
/** Element focused before open; focus returns here on close (APG dialog). */
|
|
183
|
+
private opener;
|
|
184
|
+
/** Selected type chip: built-in id, `idea`, a custom category id, or null (none picked). */
|
|
185
|
+
private chip;
|
|
186
|
+
private intent;
|
|
187
|
+
/** Host custom categories revealed under "More…". */
|
|
163
188
|
private showAllCategories;
|
|
164
|
-
/**
|
|
189
|
+
/** Header overflow menu. */
|
|
165
190
|
private showMoreNav;
|
|
166
191
|
private screenshotAttached;
|
|
167
192
|
private screenshotCapturing;
|
|
168
193
|
private screenshotError;
|
|
194
|
+
/** Why the last capture failed; drives the actionable hint under the tools. */
|
|
195
|
+
private screenshotErrorReason;
|
|
196
|
+
/** The reporter asked for (or marked up) the screenshot — an auto-capture on open doesn't count as saying something. */
|
|
197
|
+
private screenshotByUser;
|
|
198
|
+
private previewOpen;
|
|
169
199
|
private allowScreenshotRemove;
|
|
170
|
-
/**
|
|
171
|
-
* Whether the screenshot / element-select tools are actually usable
|
|
172
|
-
* (capture module present + not disabled by config). Unavailable tools are
|
|
173
|
-
* hidden from the details step — a rendered button whose handler silently
|
|
174
|
-
* no-ops reads as a bug to the reporter.
|
|
175
|
-
*/
|
|
200
|
+
/** Unusable tools are hidden — a button whose handler no-ops reads as a bug. */
|
|
176
201
|
private screenshotAvailable;
|
|
177
202
|
private elementAvailable;
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
* render() rebuilds the panel with `innerHTML = ''`, which used to destroy
|
|
181
|
-
* whatever the reporter had typed whenever a background refresh (60s inbox
|
|
182
|
-
* poll, visibilitychange refetch, screenshot attach) fired mid-typing.
|
|
183
|
-
* Captured from the live DOM right before teardown, replayed right after.
|
|
184
|
-
*/
|
|
185
|
-
private draftDescription;
|
|
186
|
-
private draftEmail;
|
|
187
|
-
private draftReply;
|
|
188
|
-
private draftFocus;
|
|
189
|
-
private draftSelStart;
|
|
190
|
-
private draftSelEnd;
|
|
203
|
+
/** Field values survive region patches and are the source of truth for validation. */
|
|
204
|
+
private drafts;
|
|
191
205
|
/** Data URL of the attached screenshot, rendered as a visible preview. */
|
|
192
206
|
private screenshotPreview;
|
|
193
207
|
private elementSelected;
|
|
@@ -199,11 +213,6 @@ declare class MushiWidget {
|
|
|
199
213
|
private triggerVisible;
|
|
200
214
|
private triggerShrunk;
|
|
201
215
|
private triggerHiddenByScroll;
|
|
202
|
-
/** Milliseconds since mount — used for the 30s first-time nudge gate. */
|
|
203
|
-
private mountedAt;
|
|
204
|
-
private nudgeShown;
|
|
205
|
-
private nudgeEl;
|
|
206
|
-
private nudgeTimer;
|
|
207
216
|
private sdkFreshness;
|
|
208
217
|
/** Brand-footer ref (SDK sets it once hashed) + once-per-instance impression latch. */
|
|
209
218
|
private brandRef;
|
|
@@ -211,35 +220,44 @@ declare class MushiWidget {
|
|
|
211
220
|
private reporterReports;
|
|
212
221
|
private featureBoard;
|
|
213
222
|
private reporterComments;
|
|
223
|
+
/** Server timeline for the open report, when the host SDK can fetch it. */
|
|
224
|
+
private timeline;
|
|
225
|
+
private pendingReplies;
|
|
226
|
+
private replySeq;
|
|
214
227
|
private selectedReportId;
|
|
215
|
-
|
|
228
|
+
/** One flag per surface: a reply never blanks the thread it was posted from. */
|
|
229
|
+
private listLoading;
|
|
230
|
+
private threadLoading;
|
|
231
|
+
private actionPending;
|
|
216
232
|
private reporterError;
|
|
233
|
+
private threadError;
|
|
234
|
+
private actionError;
|
|
235
|
+
/** Reporter channels the host enabled and the server has configured (§4.1). */
|
|
236
|
+
private channels;
|
|
237
|
+
private emailOptInOpen;
|
|
238
|
+
private emailState;
|
|
239
|
+
private pushState;
|
|
217
240
|
private attachedLaunchers;
|
|
218
241
|
private smartHideCleanup;
|
|
219
242
|
private smartHideTimer;
|
|
220
|
-
/** Captured at the
|
|
221
|
-
* ("REPORT · 14:23:07 JST") doesn't drift while the success step
|
|
222
|
-
* is on screen. */
|
|
243
|
+
/** Captured at submit so the receipt time doesn't drift while it is on screen. */
|
|
223
244
|
private submittedAt;
|
|
224
|
-
/** Pending success-state
|
|
225
|
-
* can clear them — otherwise a host that unmounts mid-submit leaks
|
|
226
|
-
* this MushiWidget reference (and re-renders into a detached shadow
|
|
227
|
-
* root) for up to ~3.3s after destroy. */
|
|
245
|
+
/** Pending success-state timer, cleared by destroy(). */
|
|
228
246
|
private successTimer;
|
|
229
|
-
|
|
247
|
+
/**
|
|
248
|
+
* Set on pointerdown inside the panel. A background patch that lands
|
|
249
|
+
* between pointerdown and click replaces the button under the pointer and
|
|
250
|
+
* the browser drops the click. render() defers while this is set (bounded,
|
|
251
|
+
* so a lost pointerup can't freeze the panel).
|
|
252
|
+
*/
|
|
253
|
+
private pointerDownAt;
|
|
254
|
+
private renderDeferred;
|
|
255
|
+
private readonly onPointerRelease;
|
|
230
256
|
private rewardsState;
|
|
231
257
|
private leaderboardEntries;
|
|
232
258
|
private leaderboardLoading;
|
|
233
|
-
/** Server-confirmed id for the just-submitted report.
|
|
234
|
-
* the success step as a copyable receipt + optional deep link to
|
|
235
|
-
* the Mushi console (when `dashboardUrl` is configured). Cleared
|
|
236
|
-
* on every new `open()` so a re-opened widget never reuses a
|
|
237
|
-
* stale id from the previous session. */
|
|
259
|
+
/** Server-confirmed id for the just-submitted report (receipt + Track it). */
|
|
238
260
|
private lastReportId;
|
|
239
|
-
/** True when the just-submitted report was queued offline (no
|
|
240
|
-
* network, or the API errored and went into the retry queue).
|
|
241
|
-
* Drives a different success copy so the user knows the report
|
|
242
|
-
* hasn't actually reached the console yet. */
|
|
243
261
|
private lastSubmitQueuedOffline;
|
|
244
262
|
private lastSubmitFailureKind;
|
|
245
263
|
private lastSubmitScreenshotDropped;
|
|
@@ -250,26 +268,16 @@ declare class MushiWidget {
|
|
|
250
268
|
private fabPos;
|
|
251
269
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
252
270
|
private vvCleanup;
|
|
253
|
-
/**
|
|
254
|
-
* Host-app user identity forwarded via `Mushi.identify()` or
|
|
255
|
-
* `Mushi.identifyWithToken()`. Used to show "Reporting as <name>"
|
|
256
|
-
* in the details step so logged-in users know their report is linked.
|
|
257
|
-
* Independent of the Mushi tester magic-link session below.
|
|
258
|
-
*/
|
|
271
|
+
/** Host-app user identity from `identify()` — shown as "Reporting as <name>". */
|
|
259
272
|
private identifiedUser;
|
|
260
273
|
/** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
|
|
261
274
|
private testerJwt;
|
|
262
|
-
/** Tester identity (public_handle, display_name). */
|
|
263
275
|
private testerInfo;
|
|
264
|
-
/** Cross-app reports for the signed-in tester. */
|
|
265
276
|
private crossAppReports;
|
|
266
277
|
private crossAppLoading;
|
|
267
|
-
/** Global leaderboard entries (from mushi_testers, not org-scoped). */
|
|
268
278
|
private globalLeaderboard;
|
|
269
279
|
private globalLeaderboardLoading;
|
|
270
|
-
/** Reputation for the signed-in tester. */
|
|
271
280
|
private testerReputation;
|
|
272
|
-
/** Whether an in-widget magic-link email was just sent. */
|
|
273
281
|
private magicLinkSent;
|
|
274
282
|
private magicLinkEmail;
|
|
275
283
|
private magicLinkError;
|
|
@@ -278,42 +286,31 @@ declare class MushiWidget {
|
|
|
278
286
|
private assistantThreadId;
|
|
279
287
|
private assistantSending;
|
|
280
288
|
private assistantError;
|
|
281
|
-
constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks
|
|
289
|
+
constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks);
|
|
290
|
+
/** Locale code for core's reporter copy; 'auto' resolves through the browser. */
|
|
291
|
+
private resolveCopy;
|
|
282
292
|
mount(): void;
|
|
283
293
|
getIsMounted(): boolean;
|
|
284
294
|
updateConfig(config?: MushiWidgetConfig): void;
|
|
285
295
|
/** Find a custom category entry by id. Returns undefined for built-in ids. */
|
|
286
296
|
private resolveCustomCategory;
|
|
287
|
-
/**
|
|
288
|
-
* Map a (possibly custom) category id to the built-in `MushiReportCategory`
|
|
289
|
-
* used for the report wire format. Falls back to `'other'`.
|
|
290
|
-
*/
|
|
291
|
-
private resolveBaseCategory;
|
|
292
|
-
/** Icon for the selected category — custom entry's icon or built-in emoji. */
|
|
293
|
-
private categoryIcon;
|
|
294
|
-
/** Label for the selected category — custom entry label or built-in i18n string. */
|
|
295
|
-
private categoryLabel;
|
|
296
297
|
open(options?: {
|
|
297
298
|
category?: MushiReportCategory | string;
|
|
298
299
|
featureRequest?: boolean;
|
|
299
300
|
}): void;
|
|
300
301
|
close(): void;
|
|
301
|
-
/** Open the panel directly on the assistant ("Ask")
|
|
302
|
+
/** Open the panel directly on the assistant ("Ask") view. */
|
|
302
303
|
openAssistantTab(): void;
|
|
303
|
-
|
|
304
|
+
private ensureOpen;
|
|
305
|
+
/** Send one assistant turn and re-render as the reply arrives. */
|
|
304
306
|
sendAssistantMessage(message: string): Promise<void>;
|
|
305
307
|
/** Persist Ask turns for same-tab reload survival (UX only). */
|
|
306
308
|
private persistAssistantSession;
|
|
307
309
|
/** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
|
|
308
310
|
clearAssistantTranscript(): void;
|
|
309
|
-
/** Escape hatch from Ask → report category picker (no login required). */
|
|
310
|
-
private openReportFromAssistant;
|
|
311
311
|
/**
|
|
312
|
-
* Briefly highlight the trigger
|
|
313
|
-
*
|
|
314
|
-
* and other "by the way, this exists" prompts where forcing the panel
|
|
315
|
-
* open would feel aggressive. Honours `position: 'none'` (no-op when
|
|
316
|
-
* the trigger button is hidden).
|
|
312
|
+
* Briefly highlight the trigger (a soft pulse) without opening the panel.
|
|
313
|
+
* No-op when the trigger isn't rendered.
|
|
317
314
|
*/
|
|
318
315
|
pulseTrigger(): void;
|
|
319
316
|
getIsOpen(): boolean;
|
|
@@ -324,12 +321,7 @@ declare class MushiWidget {
|
|
|
324
321
|
setScreenshotAttached(attached: boolean): void;
|
|
325
322
|
/** Provide the captured screenshot data URL so the widget can preview it. */
|
|
326
323
|
setScreenshotPreview(dataUrl: string | null): void;
|
|
327
|
-
/**
|
|
328
|
-
* Resolve the privacy caption shown beside the screenshot preview from the
|
|
329
|
-
* `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
|
|
330
|
-
* it honours console/runtime config): `false` → hidden, a non-empty string →
|
|
331
|
-
* that copy, anything else (`true`/unset) → the localized default.
|
|
332
|
-
*/
|
|
324
|
+
/** Privacy caption beside the preview: `false` hides it, a string replaces it, else the localized default. */
|
|
333
325
|
private resolveScreenshotHint;
|
|
334
326
|
setAllowScreenshotRemove(allow: boolean): void;
|
|
335
327
|
/** Show/hide the attachment tools based on what the SDK can actually do. */
|
|
@@ -341,17 +333,17 @@ declare class MushiWidget {
|
|
|
341
333
|
/** Surface a failed/cancelled element-selection attempt (mirrors setScreenshotError). */
|
|
342
334
|
setElementError(failed: boolean): void;
|
|
343
335
|
setScreenshotCapturing(capturing: boolean): void;
|
|
344
|
-
|
|
336
|
+
/**
|
|
337
|
+
* Flag (or clear) a failed capture. A call without a reason keeps the more
|
|
338
|
+
* specific one an earlier call recorded for the same attempt.
|
|
339
|
+
*/
|
|
340
|
+
setScreenshotError(failed: boolean, reason?: ScreenshotErrorReason): void;
|
|
345
341
|
setElementCapturing(capturing: boolean): void;
|
|
346
|
-
/** Hide the
|
|
347
|
-
* so the user can click any element on the page without the panel
|
|
348
|
-
* intercepting the event. */
|
|
342
|
+
/** Hide the panel (keep the host) during element selection so page clicks reach the page. */
|
|
349
343
|
hidePanel(): void;
|
|
350
344
|
showPanel(): void;
|
|
351
345
|
private showSelectorHint;
|
|
352
346
|
private removeSelectorHint;
|
|
353
|
-
private showNudge;
|
|
354
|
-
private removeNudge;
|
|
355
347
|
setSdkFreshness(info: {
|
|
356
348
|
latest: string | null;
|
|
357
349
|
current: string;
|
|
@@ -366,6 +358,15 @@ declare class MushiWidget {
|
|
|
366
358
|
total_points: number;
|
|
367
359
|
points_30d: number;
|
|
368
360
|
}> | null, loading?: boolean): void;
|
|
361
|
+
/**
|
|
362
|
+
* Which opt-in channels to offer (§4.1). The SDK passes the intersection of
|
|
363
|
+
* the host's `notifications` config and the server's configured channels.
|
|
364
|
+
*/
|
|
365
|
+
setReporterChannels(channels: {
|
|
366
|
+
email?: boolean;
|
|
367
|
+
push?: boolean;
|
|
368
|
+
emailPrefill?: string;
|
|
369
|
+
}): void;
|
|
369
370
|
setIdentifiedUser(user: {
|
|
370
371
|
name?: string;
|
|
371
372
|
email?: string;
|
|
@@ -382,25 +383,10 @@ declare class MushiWidget {
|
|
|
382
383
|
/** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
|
|
383
384
|
private bindColorSchemeListener;
|
|
384
385
|
private unbindColorSchemeListener;
|
|
385
|
-
/**
|
|
386
|
-
* Apply the SDK-owned pass-through layout to the host element so it is
|
|
387
|
-
* always zero-sized and click/touch-transparent. Only the shadow-root
|
|
388
|
-
* internals (`.mushi-trigger`, `.mushi-banner`, `.mushi-panel`) opt back
|
|
389
|
-
* into pointer events. This is idempotent and safe to call repeatedly.
|
|
390
|
-
*/
|
|
391
386
|
private syncHostChromeState;
|
|
392
|
-
/**
|
|
393
|
-
* Returns true when a DOM element matching `hideOnSelector` is currently
|
|
394
|
-
* present in the host document. Used by both the trigger and the banner
|
|
395
|
-
* so a single selector consistently hides ALL SDK-injected launcher
|
|
396
|
-
* surfaces. Invalid selectors are swallowed silently (non-fatal).
|
|
397
|
-
*/
|
|
387
|
+
/** True when an element matching `hideOnSelector` is in the host document (invalid selectors are ignored). */
|
|
398
388
|
private isSuppressedByHost;
|
|
399
|
-
/**
|
|
400
|
-
* Returns a snapshot of the widget's host-layer health for use in
|
|
401
|
-
* `Mushi.diagnose()`. Callers check this to know whether the widget
|
|
402
|
-
* could ever block host-app UI without opening a browser devtools.
|
|
403
|
-
*/
|
|
389
|
+
/** Host-layer health snapshot for `Mushi.diagnose()`. */
|
|
404
390
|
getWidgetDiagnostics(): {
|
|
405
391
|
widgetHostPointerSafe: boolean;
|
|
406
392
|
widgetHostBounds: {
|
|
@@ -418,51 +404,51 @@ declare class MushiWidget {
|
|
|
418
404
|
/** CSS property applied to documentElement so host-app content doesn't slide under the banner. */
|
|
419
405
|
private static readonly BODY_NUDGE_PROP;
|
|
420
406
|
private applyBodyNudge;
|
|
421
|
-
/**
|
|
422
|
-
* Schedule a height measurement after the next paint and set up a ResizeObserver
|
|
423
|
-
* so --mushi-banner-offset always tracks the actual rendered banner height
|
|
424
|
-
* (which can exceed BANNER_HEIGHT when safe-area-inset-top is in play on iOS,
|
|
425
|
-
* or when rich-layout text wraps on narrow viewports).
|
|
426
|
-
*/
|
|
407
|
+
/** Track the real banner height (safe-area insets, wrapped text) into --mushi-banner-offset. */
|
|
427
408
|
private trackBannerHeight;
|
|
428
409
|
private removeBodyNudge;
|
|
410
|
+
/** Rebuild the banner only when something it shows changed. */
|
|
411
|
+
private syncBanner;
|
|
429
412
|
private renderBanner;
|
|
430
413
|
private effectiveTrigger;
|
|
431
414
|
private isMobileSmartHidden;
|
|
432
415
|
private detectEnvironment;
|
|
433
416
|
private isRouteHidden;
|
|
434
417
|
private getTheme;
|
|
435
|
-
/**
|
|
436
|
-
private
|
|
437
|
-
/** Replay captured drafts (value + focus + caret) into a freshly built panel. */
|
|
438
|
-
private restoreFormDrafts;
|
|
439
|
-
private clearFormDrafts;
|
|
440
|
-
private render;
|
|
418
|
+
/** Parse any CSS colour the browser understands into [r, g, b] (null when it can't). */
|
|
419
|
+
private probeRgb;
|
|
441
420
|
/**
|
|
442
|
-
*
|
|
443
|
-
* the
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
* Runs in the host document (not shadow DOM) so it can reach fixed headers,
|
|
448
|
-
* sticky nav bars, and sign-in CTAs.
|
|
421
|
+
* Accent resolution (Plan 018 §1.4, first match wins): `widget.accent` →
|
|
422
|
+
* the host's `--mushi-accent` on :root → `accent-color` of <html> →
|
|
423
|
+
* `<meta name="theme-color">` → the foreground ink (''). Page-sourced values
|
|
424
|
+
* must parse as a colour and keep 3:1 against the panel background, or the
|
|
425
|
+
* Send button could vanish into a page-coloured accent.
|
|
449
426
|
*/
|
|
427
|
+
private resolveAccent;
|
|
428
|
+
/** Style + banner + trigger. Each rebuilds only when its inputs changed. */
|
|
429
|
+
private syncChrome;
|
|
430
|
+
private syncTrigger;
|
|
431
|
+
private buildTrigger;
|
|
432
|
+
private render;
|
|
433
|
+
private renderPanel;
|
|
434
|
+
/** On a new surface: the report textarea, else the title, so screen readers announce where they are. */
|
|
435
|
+
private focusView;
|
|
436
|
+
/** Snapshot field values + caret from the live DOM before a patch. */
|
|
437
|
+
private captureFormDrafts;
|
|
438
|
+
/** Replay values (and focus + caret) into fields a patch just created. */
|
|
439
|
+
private restoreFormDrafts;
|
|
440
|
+
/** Queries `avoidSelectors` and returns a top offset clearing all of them, or null. */
|
|
450
441
|
private computeAvoidTopPx;
|
|
451
|
-
/**
|
|
452
|
-
* Minimum bottom-offset in px so a bottom-anchored trigger clears avoided
|
|
453
|
-
* elements (tab bars, fixed CTAs). Mirrors {@link computeAvoidTopPx}.
|
|
454
|
-
*/
|
|
442
|
+
/** Bottom offset so a bottom-anchored trigger clears avoided elements (tab bars, fixed CTAs). */
|
|
455
443
|
private computeAvoidBottomPx;
|
|
456
444
|
private applyInsetVars;
|
|
457
445
|
/** Storage key for the FAB position, scoped to projectId when available. */
|
|
458
446
|
private fabStorageKey;
|
|
459
|
-
/**
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
|
|
464
|
-
* correct clamp bounds and snap targets. We do this by subtracting the
|
|
465
|
-
* already-applied drag offset from the live getBoundingClientRect() value. */
|
|
447
|
+
/**
|
|
448
|
+
* Move the FAB to a translated offset (relative to its CSS anchor), clamped
|
|
449
|
+
* inside the viewport safe area, optionally snapping to the nearest edge.
|
|
450
|
+
* The base position is derived by subtracting the applied drag offset.
|
|
451
|
+
*/
|
|
466
452
|
private moveFab;
|
|
467
453
|
/** Load previously persisted FAB position. */
|
|
468
454
|
private loadFabPos;
|
|
@@ -472,36 +458,78 @@ declare class MushiWidget {
|
|
|
472
458
|
private attachViewportHandlers;
|
|
473
459
|
private teardownViewportHandlers;
|
|
474
460
|
/**
|
|
475
|
-
* Minimum description length,
|
|
476
|
-
* carries more meaning.
|
|
477
|
-
* details-step input validation in attachHandlers.
|
|
461
|
+
* Minimum description length (default 8, Plan 018 §1.1), halved for CJK
|
|
462
|
+
* locales where each character carries more meaning.
|
|
478
463
|
*/
|
|
479
464
|
private effectiveMinLength;
|
|
480
|
-
/**
|
|
481
|
-
private
|
|
482
|
-
/**
|
|
483
|
-
* Build the read-only snapshot + bound helper closures the stateless view
|
|
484
|
-
* layer (widget-render.ts) renders from. Rebuilt once per render() pass so
|
|
485
|
-
* the HTML always reflects current state.
|
|
486
|
-
*/
|
|
487
|
-
private renderCtx;
|
|
488
|
-
private attachHandlers;
|
|
489
|
-
private trapFocus;
|
|
465
|
+
/** Enough words, or something the reporter attached on purpose. */
|
|
466
|
+
private canSend;
|
|
490
467
|
private unreadCount;
|
|
468
|
+
/** Read-only snapshot + helper closures for the stateless view layer. */
|
|
469
|
+
private renderCtx;
|
|
470
|
+
private bindPanelEvents;
|
|
471
|
+
private onKeydown;
|
|
472
|
+
/** Keep Tab inside the open dialog (APG modal pattern). */
|
|
473
|
+
private trapTab;
|
|
474
|
+
private handleAction;
|
|
475
|
+
private goBack;
|
|
476
|
+
private submitReport;
|
|
491
477
|
private loadFeatureBoard;
|
|
492
478
|
private voteFeatureBoard;
|
|
479
|
+
/**
|
|
480
|
+
* Run a thread action (feedback / reopen) without leaving or blanking the
|
|
481
|
+
* thread: the action buttons disable, then status + timeline refresh in place.
|
|
482
|
+
*/
|
|
483
|
+
private runThreadAction;
|
|
493
484
|
private submitReporterReopen;
|
|
494
|
-
|
|
485
|
+
private submitReporterFeedback;
|
|
486
|
+
/** Refresh "Your reports" quietly (badge + list + open row); never disturbs what the reporter is typing. */
|
|
495
487
|
refreshReporterInboxQuiet(): Promise<void>;
|
|
496
|
-
/** Patch the "Your reports (N new)" nav label in place, if it is rendered. */
|
|
497
|
-
private updateReportsBadgeText;
|
|
498
488
|
private loadReporterReports;
|
|
499
|
-
|
|
500
|
-
private
|
|
489
|
+
/** "Track it" on the receipt → that report's thread. */
|
|
490
|
+
private openTrackedReport;
|
|
491
|
+
/**
|
|
492
|
+
* Open (or refresh) a thread. The card paints at once from the list row;
|
|
493
|
+
* only the timeline shows a skeleton. `quiet` keeps what is on screen.
|
|
494
|
+
*/
|
|
495
|
+
private openThread;
|
|
496
|
+
/** Opening a thread marks its updates read so the badge goes down (§2.3). */
|
|
497
|
+
private markRead;
|
|
498
|
+
/** Optimistic reply: the bubble shows at once as "Sending…", then lands or offers Retry. */
|
|
501
499
|
private submitReporterReply;
|
|
500
|
+
private sendPendingReply;
|
|
501
|
+
private saveEmailOptIn;
|
|
502
|
+
private subscribePush;
|
|
503
|
+
/**
|
|
504
|
+
* One toast near the launcher: "The developer replied to your report",
|
|
505
|
+
* "Fixed in v1.4", "3 updates on your reports". Suppressed wherever the
|
|
506
|
+
* launcher is (hidden routes, hideOnSelector, hide()). View opens the thread.
|
|
507
|
+
*/
|
|
508
|
+
showUpdatesToast(reports: MushiReporterReport[]): Promise<boolean>;
|
|
509
|
+
/**
|
|
510
|
+
* Fetch the on-demand views chunk ahead of need (the SDK calls this at idle
|
|
511
|
+
* on a device that has filed a report, so Your reports opens instantly).
|
|
512
|
+
* Devices that never filed one never download it. Never rejects.
|
|
513
|
+
*/
|
|
514
|
+
preloadViews(): Promise<void>;
|
|
515
|
+
/** The toast from GET /v1/reporter/updates (core's wording), naming the report when there is one. */
|
|
516
|
+
showUpdatesFeedToast(updates: MushiReporterUpdates, reports: MushiReporterReport[]): boolean;
|
|
517
|
+
showUpdateToast(update: {
|
|
518
|
+
text: string;
|
|
519
|
+
reportId?: string | null;
|
|
520
|
+
detail?: string;
|
|
521
|
+
}): boolean;
|
|
522
|
+
private removeToast;
|
|
523
|
+
private rememberOpener;
|
|
524
|
+
/** Return focus to whatever opened the dialog; the trigger may have been rebuilt meanwhile. */
|
|
525
|
+
private restoreOpenerFocus;
|
|
526
|
+
/** Polite screen-reader announcement ("Sent", "Reply sent", errors). */
|
|
527
|
+
private announce;
|
|
502
528
|
private handleMagicLinkSend;
|
|
529
|
+
/** Open the widget on "Your reports" (`sdk.openReporter()`, the banner's link, a toast). */
|
|
530
|
+
openReporter(): void;
|
|
503
531
|
getRecorderStep(): WidgetStep;
|
|
504
|
-
/** QA / Playwright:
|
|
532
|
+
/** QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
505
533
|
getRecorderCategoryStepIA(): {
|
|
506
534
|
sectionLabel: string;
|
|
507
535
|
moreToggle: boolean;
|
|
@@ -512,12 +540,6 @@ declare class MushiWidget {
|
|
|
512
540
|
getRecorderIntentButton(label: string): Element | null;
|
|
513
541
|
getRecorderSubmitButton(): Element | null;
|
|
514
542
|
recorderClickTrigger(): void;
|
|
515
|
-
/**
|
|
516
|
-
* Open the widget directly to the reporter's "My reports" history view.
|
|
517
|
-
* Can be called from host apps via `sdk.openReporter()` or triggered by
|
|
518
|
-
* the banner's "My reports" link button.
|
|
519
|
-
*/
|
|
520
|
-
openReporter(): void;
|
|
521
543
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
522
544
|
recorderSelectIntent(label: string): void;
|
|
523
545
|
recorderFocusDescription(): void;
|