@mushi-mushi/web 1.30.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/widget-views-DX3OYHGR.js +233 -0
- package/dist/chunks/widget-views-DX3OYHGR.js.map +1 -0
- package/dist/headless.cjs +17 -1
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.js +17 -1
- package/dist/headless.js.map +1 -1
- package/dist/i18n/index.cjs +126 -258
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +95 -43
- package/dist/i18n/index.d.ts +95 -43
- package/dist/i18n/index.js +126 -258
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +1815 -2258
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +172 -204
- package/dist/index.d.ts +267 -247
- package/dist/index.js +1577 -2259
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +12 -495
- package/dist/test-utils.cjs +237 -0
- package/dist/test-utils.cjs.map +1 -1
- package/dist/test-utils.js +237 -0
- package/dist/test-utils.js.map +1 -1
- package/package.json +12 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiPrivacyConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig, MushiErrorFilter } from '@mushi-mushi/core';
|
|
1
|
+
import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiPrivacyConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiReporterTimelineItem, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiReporterUpdates, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, 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
|
|
|
4
4
|
declare class Mushi {
|
|
@@ -37,11 +37,10 @@ declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): Sc
|
|
|
37
37
|
* on the MushiWidget class (DOM structure, state, lifecycle).
|
|
38
38
|
*
|
|
39
39
|
* OVERVIEW:
|
|
40
|
-
* - Pure functions:
|
|
41
|
-
*
|
|
42
|
-
* - Constants:
|
|
43
|
-
*
|
|
44
|
-
* - Shared types: WidgetStep, the reporter status tone union, and the public
|
|
40
|
+
* - Pure functions: relative-time formatting, the submit-shortcut detector,
|
|
41
|
+
* HTML escaping, the reporter timeline builder.
|
|
42
|
+
* - Constants: the feature-request intent wire string, read deadlines.
|
|
43
|
+
* - Shared types: WidgetStep, PendingReply, and the public
|
|
45
44
|
* WidgetRewardsState / WidgetSubmitOutcome / WidgetCallbacks contracts (these
|
|
46
45
|
* three are re-exported from widget.ts so existing `./widget` import sites and
|
|
47
46
|
* the package barrel keep working unchanged).
|
|
@@ -57,7 +56,9 @@ declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): Sc
|
|
|
57
56
|
* - Behaviour-preserving move: bodies are identical to the pre-split widget.ts.
|
|
58
57
|
*/
|
|
59
58
|
|
|
60
|
-
type WidgetStep = '
|
|
59
|
+
type WidgetStep = 'report' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap' | 'account' | 'cross-app-reports' | 'assistant';
|
|
60
|
+
/** One timeline row from GET /v1/reporter/reports/:id (core's shape). */
|
|
61
|
+
type WidgetTimelineEvent = MushiReporterTimelineItem;
|
|
61
62
|
/** Capture failure reasons plus 'permission' (a host screenshotProvider was denied). */
|
|
62
63
|
type ScreenshotErrorReason = ScreenshotFailureReason | 'permission';
|
|
63
64
|
interface WidgetRewardsState {
|
|
@@ -131,6 +132,17 @@ interface WidgetCallbacks {
|
|
|
131
132
|
onReporterReply?(reportId: string, body: string): Promise<void>;
|
|
132
133
|
onReporterFeedback?(reportId: string, signal: string, note?: string): Promise<Record<string, unknown> | null>;
|
|
133
134
|
onReporterReopen?(reportId: string, note?: string): Promise<Record<string, unknown> | null>;
|
|
135
|
+
/** Header card + merged timeline for one report (newer servers); falls back to the comments call. */
|
|
136
|
+
onReporterReportRequest?(reportId: string): Promise<{
|
|
137
|
+
report?: Partial<MushiReporterReport>;
|
|
138
|
+
timeline?: WidgetTimelineEvent[] | null;
|
|
139
|
+
} | null>;
|
|
140
|
+
/** Mark a report's updates read when its thread opens; resolves with the new unread total when known. */
|
|
141
|
+
onReporterMarkRead?(reportId: string): Promise<number | null | void>;
|
|
142
|
+
/** Save an email for status updates on this device's reports (explicit opt-in). */
|
|
143
|
+
onReporterEmailOptIn?(email: string): Promise<void>;
|
|
144
|
+
/** Ask for browser notification permission and register a push subscription. */
|
|
145
|
+
onReporterPushSubscribe?(): Promise<void>;
|
|
134
146
|
onFeatureBoardRequest?(): Promise<Array<Record<string, unknown>>>;
|
|
135
147
|
onFeatureBoardVote?(requestId: string): Promise<{
|
|
136
148
|
voted: boolean;
|
|
@@ -160,7 +172,6 @@ interface WidgetCallbacks {
|
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
declare class MushiWidget {
|
|
163
|
-
private readonly sdkVersion;
|
|
164
175
|
private host;
|
|
165
176
|
private shadow;
|
|
166
177
|
/** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
|
|
@@ -169,53 +180,46 @@ declare class MushiWidget {
|
|
|
169
180
|
private config;
|
|
170
181
|
private callbacks;
|
|
171
182
|
private locale;
|
|
183
|
+
private rc;
|
|
184
|
+
private lang;
|
|
172
185
|
private isOpen;
|
|
173
186
|
private step;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
private
|
|
180
|
-
private
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
private readonly styleEl;
|
|
188
|
+
private styleKey;
|
|
189
|
+
private readonly panel;
|
|
190
|
+
private readonly scroller;
|
|
191
|
+
private readonly regionEls;
|
|
192
|
+
private regionHtml;
|
|
193
|
+
private readonly live;
|
|
194
|
+
private renderedStep;
|
|
195
|
+
private triggerEl;
|
|
196
|
+
private triggerKey;
|
|
197
|
+
private bannerEl;
|
|
198
|
+
private bannerKey;
|
|
199
|
+
private toastEl;
|
|
200
|
+
/** Element focused before open; focus returns here on close (APG dialog). */
|
|
201
|
+
private opener;
|
|
202
|
+
/** Selected type chip: built-in id, `idea`, a custom category id, or null (none picked). */
|
|
203
|
+
private chip;
|
|
204
|
+
private intent;
|
|
205
|
+
/** Host custom categories revealed under "More…". */
|
|
189
206
|
private showAllCategories;
|
|
190
|
-
/**
|
|
207
|
+
/** Header overflow menu. */
|
|
191
208
|
private showMoreNav;
|
|
192
209
|
private screenshotAttached;
|
|
193
210
|
private screenshotCapturing;
|
|
194
211
|
private screenshotError;
|
|
195
212
|
/** Why the last capture failed; drives the actionable hint under the tools. */
|
|
196
213
|
private screenshotErrorReason;
|
|
214
|
+
/** The reporter asked for (or marked up) the screenshot — an auto-capture on open doesn't count as saying something. */
|
|
215
|
+
private screenshotByUser;
|
|
216
|
+
private previewOpen;
|
|
197
217
|
private allowScreenshotRemove;
|
|
198
|
-
/**
|
|
199
|
-
* Whether the screenshot / element-select tools are actually usable
|
|
200
|
-
* (capture module present + not disabled by config). Unavailable tools are
|
|
201
|
-
* hidden from the details step — a rendered button whose handler silently
|
|
202
|
-
* no-ops reads as a bug to the reporter.
|
|
203
|
-
*/
|
|
218
|
+
/** Unusable tools are hidden — a button whose handler no-ops reads as a bug. */
|
|
204
219
|
private screenshotAvailable;
|
|
205
220
|
private elementAvailable;
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
* render() rebuilds the panel with `innerHTML = ''`, which used to destroy
|
|
209
|
-
* whatever the reporter had typed whenever a background refresh (60s inbox
|
|
210
|
-
* poll, visibilitychange refetch, screenshot attach) fired mid-typing.
|
|
211
|
-
* Captured from the live DOM right before teardown, replayed right after.
|
|
212
|
-
*/
|
|
213
|
-
private draftDescription;
|
|
214
|
-
private draftEmail;
|
|
215
|
-
private draftReply;
|
|
216
|
-
private draftFocus;
|
|
217
|
-
private draftSelStart;
|
|
218
|
-
private draftSelEnd;
|
|
221
|
+
/** Field values survive region patches and are the source of truth for validation. */
|
|
222
|
+
private drafts;
|
|
219
223
|
/** Data URL of the attached screenshot, rendered as a visible preview. */
|
|
220
224
|
private screenshotPreview;
|
|
221
225
|
private elementSelected;
|
|
@@ -227,11 +231,6 @@ declare class MushiWidget {
|
|
|
227
231
|
private triggerVisible;
|
|
228
232
|
private triggerShrunk;
|
|
229
233
|
private triggerHiddenByScroll;
|
|
230
|
-
/** Milliseconds since mount — used for the 30s first-time nudge gate. */
|
|
231
|
-
private mountedAt;
|
|
232
|
-
private nudgeShown;
|
|
233
|
-
private nudgeEl;
|
|
234
|
-
private nudgeTimer;
|
|
235
234
|
private sdkFreshness;
|
|
236
235
|
/** Brand-footer ref (SDK sets it once hashed) + once-per-instance impression latch. */
|
|
237
236
|
private brandRef;
|
|
@@ -239,38 +238,35 @@ declare class MushiWidget {
|
|
|
239
238
|
private reporterReports;
|
|
240
239
|
private featureBoard;
|
|
241
240
|
private reporterComments;
|
|
241
|
+
/** Server timeline for the open report, when the host SDK can fetch it. */
|
|
242
|
+
private timeline;
|
|
243
|
+
private pendingReplies;
|
|
244
|
+
private replySeq;
|
|
242
245
|
private selectedReportId;
|
|
243
|
-
/**
|
|
244
|
-
* One flag per surface. A single shared flag used to let a reply (or vote,
|
|
245
|
-
* or reopen) blank the thread it was posted from, and a failed reply
|
|
246
|
-
* replaced the conversation with its error.
|
|
247
|
-
*/
|
|
246
|
+
/** One flag per surface: a reply never blanks the thread it was posted from. */
|
|
248
247
|
private listLoading;
|
|
249
248
|
private threadLoading;
|
|
250
249
|
private actionPending;
|
|
251
|
-
/** List / roadmap load error. */
|
|
252
250
|
private reporterError;
|
|
253
|
-
/** Thread (comments) load error — rendered with Try again. */
|
|
254
251
|
private threadError;
|
|
255
|
-
/** Reply / feedback / reopen / vote error — rendered beside the composer. */
|
|
256
252
|
private actionError;
|
|
253
|
+
/** Reporter channels the host enabled and the server has configured (§4.1). */
|
|
254
|
+
private channels;
|
|
255
|
+
private emailOptInOpen;
|
|
256
|
+
private emailState;
|
|
257
|
+
private pushState;
|
|
257
258
|
private attachedLaunchers;
|
|
258
259
|
private smartHideCleanup;
|
|
259
260
|
private smartHideTimer;
|
|
260
|
-
/** Captured at the
|
|
261
|
-
* ("REPORT · 14:23:07 JST") doesn't drift while the success step
|
|
262
|
-
* is on screen. */
|
|
261
|
+
/** Captured at submit so the receipt time doesn't drift while it is on screen. */
|
|
263
262
|
private submittedAt;
|
|
264
|
-
/** Pending success-state timer
|
|
265
|
-
* otherwise a host that unmounts mid-submit leaks this MushiWidget
|
|
266
|
-
* reference (and re-renders into a detached shadow root). */
|
|
263
|
+
/** Pending success-state timer, cleared by destroy(). */
|
|
267
264
|
private successTimer;
|
|
268
265
|
/**
|
|
269
|
-
* Set on pointerdown inside the panel. A background
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* (bounded, so a lost pointerup can't freeze the panel).
|
|
266
|
+
* Set on pointerdown inside the panel. A background patch that lands
|
|
267
|
+
* between pointerdown and click replaces the button under the pointer and
|
|
268
|
+
* the browser drops the click. render() defers while this is set (bounded,
|
|
269
|
+
* so a lost pointerup can't freeze the panel).
|
|
274
270
|
*/
|
|
275
271
|
private pointerDownAt;
|
|
276
272
|
private renderDeferred;
|
|
@@ -278,16 +274,8 @@ declare class MushiWidget {
|
|
|
278
274
|
private rewardsState;
|
|
279
275
|
private leaderboardEntries;
|
|
280
276
|
private leaderboardLoading;
|
|
281
|
-
/** Server-confirmed id for the just-submitted report.
|
|
282
|
-
* the success step as a copyable receipt + optional deep link to
|
|
283
|
-
* the Mushi console (when `dashboardUrl` is configured). Cleared
|
|
284
|
-
* on every new `open()` so a re-opened widget never reuses a
|
|
285
|
-
* stale id from the previous session. */
|
|
277
|
+
/** Server-confirmed id for the just-submitted report (receipt + Track it). */
|
|
286
278
|
private lastReportId;
|
|
287
|
-
/** True when the just-submitted report was queued offline (no
|
|
288
|
-
* network, or the API errored and went into the retry queue).
|
|
289
|
-
* Drives a different success copy so the user knows the report
|
|
290
|
-
* hasn't actually reached the console yet. */
|
|
291
279
|
private lastSubmitQueuedOffline;
|
|
292
280
|
private lastSubmitFailureKind;
|
|
293
281
|
private lastSubmitScreenshotDropped;
|
|
@@ -298,26 +286,16 @@ declare class MushiWidget {
|
|
|
298
286
|
private fabPos;
|
|
299
287
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
300
288
|
private vvCleanup;
|
|
301
|
-
/**
|
|
302
|
-
* Host-app user identity forwarded via `Mushi.identify()` or
|
|
303
|
-
* `Mushi.identifyWithToken()`. Used to show "Reporting as <name>"
|
|
304
|
-
* in the details step so logged-in users know their report is linked.
|
|
305
|
-
* Independent of the Mushi tester magic-link session below.
|
|
306
|
-
*/
|
|
289
|
+
/** Host-app user identity from `identify()` — shown as "Reporting as <name>". */
|
|
307
290
|
private identifiedUser;
|
|
308
291
|
/** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
|
|
309
292
|
private testerJwt;
|
|
310
|
-
/** Tester identity (public_handle, display_name). */
|
|
311
293
|
private testerInfo;
|
|
312
|
-
/** Cross-app reports for the signed-in tester. */
|
|
313
294
|
private crossAppReports;
|
|
314
295
|
private crossAppLoading;
|
|
315
|
-
/** Global leaderboard entries (from mushi_testers, not org-scoped). */
|
|
316
296
|
private globalLeaderboard;
|
|
317
297
|
private globalLeaderboardLoading;
|
|
318
|
-
/** Reputation for the signed-in tester. */
|
|
319
298
|
private testerReputation;
|
|
320
|
-
/** Whether an in-widget magic-link email was just sent. */
|
|
321
299
|
private magicLinkSent;
|
|
322
300
|
private magicLinkEmail;
|
|
323
301
|
private magicLinkError;
|
|
@@ -326,42 +304,31 @@ declare class MushiWidget {
|
|
|
326
304
|
private assistantThreadId;
|
|
327
305
|
private assistantSending;
|
|
328
306
|
private assistantError;
|
|
329
|
-
constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks
|
|
307
|
+
constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks);
|
|
308
|
+
/** Locale code for core's reporter copy; 'auto' resolves through the browser. */
|
|
309
|
+
private resolveCopy;
|
|
330
310
|
mount(): void;
|
|
331
311
|
getIsMounted(): boolean;
|
|
332
312
|
updateConfig(config?: MushiWidgetConfig): void;
|
|
333
313
|
/** Find a custom category entry by id. Returns undefined for built-in ids. */
|
|
334
314
|
private resolveCustomCategory;
|
|
335
|
-
/**
|
|
336
|
-
* Map a (possibly custom) category id to the built-in `MushiReportCategory`
|
|
337
|
-
* used for the report wire format. Falls back to `'other'`.
|
|
338
|
-
*/
|
|
339
|
-
private resolveBaseCategory;
|
|
340
|
-
/** Icon for the selected category — custom entry's icon or built-in emoji. */
|
|
341
|
-
private categoryIcon;
|
|
342
|
-
/** Label for the selected category — custom entry label or built-in i18n string. */
|
|
343
|
-
private categoryLabel;
|
|
344
315
|
open(options?: {
|
|
345
316
|
category?: MushiReportCategory | string;
|
|
346
317
|
featureRequest?: boolean;
|
|
347
318
|
}): void;
|
|
348
319
|
close(): void;
|
|
349
|
-
/** Open the panel directly on the assistant ("Ask")
|
|
320
|
+
/** Open the panel directly on the assistant ("Ask") view. */
|
|
350
321
|
openAssistantTab(): void;
|
|
351
|
-
|
|
322
|
+
private ensureOpen;
|
|
323
|
+
/** Send one assistant turn and re-render as the reply arrives. */
|
|
352
324
|
sendAssistantMessage(message: string): Promise<void>;
|
|
353
325
|
/** Persist Ask turns for same-tab reload survival (UX only). */
|
|
354
326
|
private persistAssistantSession;
|
|
355
327
|
/** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
|
|
356
328
|
clearAssistantTranscript(): void;
|
|
357
|
-
/** Escape hatch from Ask → report category picker (no login required). */
|
|
358
|
-
private openReportFromAssistant;
|
|
359
329
|
/**
|
|
360
|
-
* Briefly highlight the trigger
|
|
361
|
-
*
|
|
362
|
-
* and other "by the way, this exists" prompts where forcing the panel
|
|
363
|
-
* open would feel aggressive. Honours `position: 'none'` (no-op when
|
|
364
|
-
* the trigger button is hidden).
|
|
330
|
+
* Briefly highlight the trigger (a soft pulse) without opening the panel.
|
|
331
|
+
* No-op when the trigger isn't rendered.
|
|
365
332
|
*/
|
|
366
333
|
pulseTrigger(): void;
|
|
367
334
|
getIsOpen(): boolean;
|
|
@@ -372,12 +339,7 @@ declare class MushiWidget {
|
|
|
372
339
|
setScreenshotAttached(attached: boolean): void;
|
|
373
340
|
/** Provide the captured screenshot data URL so the widget can preview it. */
|
|
374
341
|
setScreenshotPreview(dataUrl: string | null): void;
|
|
375
|
-
/**
|
|
376
|
-
* Resolve the privacy caption shown beside the screenshot preview from the
|
|
377
|
-
* `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
|
|
378
|
-
* it honours console/runtime config): `false` → hidden, a non-empty string →
|
|
379
|
-
* that copy, anything else (`true`/unset) → the localized default.
|
|
380
|
-
*/
|
|
342
|
+
/** Privacy caption beside the preview: `false` hides it, a string replaces it, else the localized default. */
|
|
381
343
|
private resolveScreenshotHint;
|
|
382
344
|
setAllowScreenshotRemove(allow: boolean): void;
|
|
383
345
|
/** Show/hide the attachment tools based on what the SDK can actually do. */
|
|
@@ -391,20 +353,15 @@ declare class MushiWidget {
|
|
|
391
353
|
setScreenshotCapturing(capturing: boolean): void;
|
|
392
354
|
/**
|
|
393
355
|
* Flag (or clear) a failed capture. A call without a reason keeps the more
|
|
394
|
-
* specific one an earlier call recorded for the same attempt
|
|
395
|
-
* module reports 'taint'/'timeout' before the caller's generic failure).
|
|
356
|
+
* specific one an earlier call recorded for the same attempt.
|
|
396
357
|
*/
|
|
397
358
|
setScreenshotError(failed: boolean, reason?: ScreenshotErrorReason): void;
|
|
398
359
|
setElementCapturing(capturing: boolean): void;
|
|
399
|
-
/** Hide the
|
|
400
|
-
* so the user can click any element on the page without the panel
|
|
401
|
-
* intercepting the event. */
|
|
360
|
+
/** Hide the panel (keep the host) during element selection so page clicks reach the page. */
|
|
402
361
|
hidePanel(): void;
|
|
403
362
|
showPanel(): void;
|
|
404
363
|
private showSelectorHint;
|
|
405
364
|
private removeSelectorHint;
|
|
406
|
-
private showNudge;
|
|
407
|
-
private removeNudge;
|
|
408
365
|
setSdkFreshness(info: {
|
|
409
366
|
latest: string | null;
|
|
410
367
|
current: string;
|
|
@@ -419,6 +376,15 @@ declare class MushiWidget {
|
|
|
419
376
|
total_points: number;
|
|
420
377
|
points_30d: number;
|
|
421
378
|
}> | null, loading?: boolean): void;
|
|
379
|
+
/**
|
|
380
|
+
* Which opt-in channels to offer (§4.1). The SDK passes the intersection of
|
|
381
|
+
* the host's `notifications` config and the server's configured channels.
|
|
382
|
+
*/
|
|
383
|
+
setReporterChannels(channels: {
|
|
384
|
+
email?: boolean;
|
|
385
|
+
push?: boolean;
|
|
386
|
+
emailPrefill?: string;
|
|
387
|
+
}): void;
|
|
422
388
|
setIdentifiedUser(user: {
|
|
423
389
|
name?: string;
|
|
424
390
|
email?: string;
|
|
@@ -435,25 +401,10 @@ declare class MushiWidget {
|
|
|
435
401
|
/** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
|
|
436
402
|
private bindColorSchemeListener;
|
|
437
403
|
private unbindColorSchemeListener;
|
|
438
|
-
/**
|
|
439
|
-
* Apply the SDK-owned pass-through layout to the host element so it is
|
|
440
|
-
* always zero-sized and click/touch-transparent. Only the shadow-root
|
|
441
|
-
* internals (`.mushi-trigger`, `.mushi-banner`, `.mushi-panel`) opt back
|
|
442
|
-
* into pointer events. This is idempotent and safe to call repeatedly.
|
|
443
|
-
*/
|
|
444
404
|
private syncHostChromeState;
|
|
445
|
-
/**
|
|
446
|
-
* Returns true when a DOM element matching `hideOnSelector` is currently
|
|
447
|
-
* present in the host document. Used by both the trigger and the banner
|
|
448
|
-
* so a single selector consistently hides ALL SDK-injected launcher
|
|
449
|
-
* surfaces. Invalid selectors are swallowed silently (non-fatal).
|
|
450
|
-
*/
|
|
405
|
+
/** True when an element matching `hideOnSelector` is in the host document (invalid selectors are ignored). */
|
|
451
406
|
private isSuppressedByHost;
|
|
452
|
-
/**
|
|
453
|
-
* Returns a snapshot of the widget's host-layer health for use in
|
|
454
|
-
* `Mushi.diagnose()`. Callers check this to know whether the widget
|
|
455
|
-
* could ever block host-app UI without opening a browser devtools.
|
|
456
|
-
*/
|
|
407
|
+
/** Host-layer health snapshot for `Mushi.diagnose()`. */
|
|
457
408
|
getWidgetDiagnostics(): {
|
|
458
409
|
widgetHostPointerSafe: boolean;
|
|
459
410
|
widgetHostBounds: {
|
|
@@ -471,51 +422,51 @@ declare class MushiWidget {
|
|
|
471
422
|
/** CSS property applied to documentElement so host-app content doesn't slide under the banner. */
|
|
472
423
|
private static readonly BODY_NUDGE_PROP;
|
|
473
424
|
private applyBodyNudge;
|
|
474
|
-
/**
|
|
475
|
-
* Schedule a height measurement after the next paint and set up a ResizeObserver
|
|
476
|
-
* so --mushi-banner-offset always tracks the actual rendered banner height
|
|
477
|
-
* (which can exceed BANNER_HEIGHT when safe-area-inset-top is in play on iOS,
|
|
478
|
-
* or when rich-layout text wraps on narrow viewports).
|
|
479
|
-
*/
|
|
425
|
+
/** Track the real banner height (safe-area insets, wrapped text) into --mushi-banner-offset. */
|
|
480
426
|
private trackBannerHeight;
|
|
481
427
|
private removeBodyNudge;
|
|
428
|
+
/** Rebuild the banner only when something it shows changed. */
|
|
429
|
+
private syncBanner;
|
|
482
430
|
private renderBanner;
|
|
483
431
|
private effectiveTrigger;
|
|
484
432
|
private isMobileSmartHidden;
|
|
485
433
|
private detectEnvironment;
|
|
486
434
|
private isRouteHidden;
|
|
487
435
|
private getTheme;
|
|
488
|
-
/**
|
|
489
|
-
private
|
|
490
|
-
/** Replay captured drafts (value + focus + caret) into a freshly built panel. */
|
|
491
|
-
private restoreFormDrafts;
|
|
492
|
-
private clearFormDrafts;
|
|
493
|
-
private render;
|
|
436
|
+
/** Parse any CSS colour the browser understands into [r, g, b] (null when it can't). */
|
|
437
|
+
private probeRgb;
|
|
494
438
|
/**
|
|
495
|
-
*
|
|
496
|
-
* the
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
* Runs in the host document (not shadow DOM) so it can reach fixed headers,
|
|
501
|
-
* sticky nav bars, and sign-in CTAs.
|
|
439
|
+
* Accent resolution (Plan 018 §1.4, first match wins): `widget.accent` →
|
|
440
|
+
* the host's `--mushi-accent` on :root → `accent-color` of <html> →
|
|
441
|
+
* `<meta name="theme-color">` → the foreground ink (''). Page-sourced values
|
|
442
|
+
* must parse as a colour and keep 3:1 against the panel background, or the
|
|
443
|
+
* Send button could vanish into a page-coloured accent.
|
|
502
444
|
*/
|
|
445
|
+
private resolveAccent;
|
|
446
|
+
/** Style + banner + trigger. Each rebuilds only when its inputs changed. */
|
|
447
|
+
private syncChrome;
|
|
448
|
+
private syncTrigger;
|
|
449
|
+
private buildTrigger;
|
|
450
|
+
private render;
|
|
451
|
+
private renderPanel;
|
|
452
|
+
/** On a new surface: the report textarea, else the title, so screen readers announce where they are. */
|
|
453
|
+
private focusView;
|
|
454
|
+
/** Snapshot field values + caret from the live DOM before a patch. */
|
|
455
|
+
private captureFormDrafts;
|
|
456
|
+
/** Replay values (and focus + caret) into fields a patch just created. */
|
|
457
|
+
private restoreFormDrafts;
|
|
458
|
+
/** Queries `avoidSelectors` and returns a top offset clearing all of them, or null. */
|
|
503
459
|
private computeAvoidTopPx;
|
|
504
|
-
/**
|
|
505
|
-
* Minimum bottom-offset in px so a bottom-anchored trigger clears avoided
|
|
506
|
-
* elements (tab bars, fixed CTAs). Mirrors {@link computeAvoidTopPx}.
|
|
507
|
-
*/
|
|
460
|
+
/** Bottom offset so a bottom-anchored trigger clears avoided elements (tab bars, fixed CTAs). */
|
|
508
461
|
private computeAvoidBottomPx;
|
|
509
462
|
private applyInsetVars;
|
|
510
463
|
/** Storage key for the FAB position, scoped to projectId when available. */
|
|
511
464
|
private fabStorageKey;
|
|
512
|
-
/**
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
|
|
517
|
-
* correct clamp bounds and snap targets. We do this by subtracting the
|
|
518
|
-
* already-applied drag offset from the live getBoundingClientRect() value. */
|
|
465
|
+
/**
|
|
466
|
+
* Move the FAB to a translated offset (relative to its CSS anchor), clamped
|
|
467
|
+
* inside the viewport safe area, optionally snapping to the nearest edge.
|
|
468
|
+
* The base position is derived by subtracting the applied drag offset.
|
|
469
|
+
*/
|
|
519
470
|
private moveFab;
|
|
520
471
|
/** Load previously persisted FAB position. */
|
|
521
472
|
private loadFabPos;
|
|
@@ -525,55 +476,78 @@ declare class MushiWidget {
|
|
|
525
476
|
private attachViewportHandlers;
|
|
526
477
|
private teardownViewportHandlers;
|
|
527
478
|
/**
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
* entry of step2.intents.other in every locale).
|
|
531
|
-
*/
|
|
532
|
-
private detailMode;
|
|
533
|
-
/**
|
|
534
|
-
* Minimum description length, lowered for CJK locales where each character
|
|
535
|
-
* carries more meaning. Used by both the view layer (via renderCtx) and the
|
|
536
|
-
* details-step input validation in attachHandlers.
|
|
479
|
+
* Minimum description length (default 8, Plan 018 §1.1), halved for CJK
|
|
480
|
+
* locales where each character carries more meaning.
|
|
537
481
|
*/
|
|
538
482
|
private effectiveMinLength;
|
|
539
|
-
/**
|
|
540
|
-
private
|
|
541
|
-
/**
|
|
542
|
-
* Build the read-only snapshot + bound helper closures the stateless view
|
|
543
|
-
* layer (widget-render.ts) renders from. Rebuilt once per render() pass so
|
|
544
|
-
* the HTML always reflects current state.
|
|
545
|
-
*/
|
|
546
|
-
private renderCtx;
|
|
547
|
-
private attachHandlers;
|
|
548
|
-
private trapFocus;
|
|
483
|
+
/** Enough words, or something the reporter attached on purpose. */
|
|
484
|
+
private canSend;
|
|
549
485
|
private unreadCount;
|
|
486
|
+
/** Read-only snapshot + helper closures for the stateless view layer. */
|
|
487
|
+
private renderCtx;
|
|
488
|
+
private bindPanelEvents;
|
|
489
|
+
private onKeydown;
|
|
490
|
+
/** Keep Tab inside the open dialog (APG modal pattern). */
|
|
491
|
+
private trapTab;
|
|
492
|
+
private handleAction;
|
|
493
|
+
private goBack;
|
|
494
|
+
private submitReport;
|
|
550
495
|
private loadFeatureBoard;
|
|
551
496
|
private voteFeatureBoard;
|
|
552
497
|
/**
|
|
553
|
-
* Run a thread action (
|
|
554
|
-
*
|
|
555
|
-
* disables, and afterwards the status + comments refresh in place.
|
|
498
|
+
* Run a thread action (feedback / reopen) without leaving or blanking the
|
|
499
|
+
* thread: the action buttons disable, then status + timeline refresh in place.
|
|
556
500
|
*/
|
|
557
501
|
private runThreadAction;
|
|
558
502
|
private submitReporterReopen;
|
|
559
|
-
|
|
503
|
+
private submitReporterFeedback;
|
|
504
|
+
/** Refresh "Your reports" quietly (badge + list + open row); never disturbs what the reporter is typing. */
|
|
560
505
|
refreshReporterInboxQuiet(): Promise<void>;
|
|
561
|
-
/** Patch the "Your reports (N new)" nav label in place, if it is rendered. */
|
|
562
|
-
private updateReportsBadgeText;
|
|
563
506
|
private loadReporterReports;
|
|
564
|
-
/** "Track
|
|
507
|
+
/** "Track it" on the receipt → that report's thread. */
|
|
565
508
|
private openTrackedReport;
|
|
566
509
|
/**
|
|
567
|
-
* Open (or refresh) a thread. The
|
|
568
|
-
*
|
|
569
|
-
* loads. `quiet` keeps the current comments on screen (post-action refresh).
|
|
510
|
+
* Open (or refresh) a thread. The card paints at once from the list row;
|
|
511
|
+
* only the timeline shows a skeleton. `quiet` keeps what is on screen.
|
|
570
512
|
*/
|
|
571
|
-
private
|
|
572
|
-
|
|
513
|
+
private openThread;
|
|
514
|
+
/** Opening a thread marks its updates read so the badge goes down (§2.3). */
|
|
515
|
+
private markRead;
|
|
516
|
+
/** Optimistic reply: the bubble shows at once as "Sending…", then lands or offers Retry. */
|
|
573
517
|
private submitReporterReply;
|
|
518
|
+
private sendPendingReply;
|
|
519
|
+
private saveEmailOptIn;
|
|
520
|
+
private subscribePush;
|
|
521
|
+
/**
|
|
522
|
+
* One toast near the launcher: "The developer replied to your report",
|
|
523
|
+
* "Fixed in v1.4", "3 updates on your reports". Suppressed wherever the
|
|
524
|
+
* launcher is (hidden routes, hideOnSelector, hide()). View opens the thread.
|
|
525
|
+
*/
|
|
526
|
+
showUpdatesToast(reports: MushiReporterReport[]): Promise<boolean>;
|
|
527
|
+
/**
|
|
528
|
+
* Fetch the on-demand views chunk ahead of need (the SDK calls this at idle
|
|
529
|
+
* on a device that has filed a report, so Your reports opens instantly).
|
|
530
|
+
* Devices that never filed one never download it. Never rejects.
|
|
531
|
+
*/
|
|
532
|
+
preloadViews(): Promise<void>;
|
|
533
|
+
/** The toast from GET /v1/reporter/updates (core's wording), naming the report when there is one. */
|
|
534
|
+
showUpdatesFeedToast(updates: MushiReporterUpdates, reports: MushiReporterReport[]): boolean;
|
|
535
|
+
showUpdateToast(update: {
|
|
536
|
+
text: string;
|
|
537
|
+
reportId?: string | null;
|
|
538
|
+
detail?: string;
|
|
539
|
+
}): boolean;
|
|
540
|
+
private removeToast;
|
|
541
|
+
private rememberOpener;
|
|
542
|
+
/** Return focus to whatever opened the dialog; the trigger may have been rebuilt meanwhile. */
|
|
543
|
+
private restoreOpenerFocus;
|
|
544
|
+
/** Polite screen-reader announcement ("Sent", "Reply sent", errors). */
|
|
545
|
+
private announce;
|
|
574
546
|
private handleMagicLinkSend;
|
|
547
|
+
/** Open the widget on "Your reports" (`sdk.openReporter()`, the banner's link, a toast). */
|
|
548
|
+
openReporter(): void;
|
|
575
549
|
getRecorderStep(): WidgetStep;
|
|
576
|
-
/** QA / Playwright:
|
|
550
|
+
/** QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
577
551
|
getRecorderCategoryStepIA(): {
|
|
578
552
|
sectionLabel: string;
|
|
579
553
|
moreToggle: boolean;
|
|
@@ -584,12 +558,6 @@ declare class MushiWidget {
|
|
|
584
558
|
getRecorderIntentButton(label: string): Element | null;
|
|
585
559
|
getRecorderSubmitButton(): Element | null;
|
|
586
560
|
recorderClickTrigger(): void;
|
|
587
|
-
/**
|
|
588
|
-
* Open the widget directly to the reporter's "My reports" history view.
|
|
589
|
-
* Can be called from host apps via `sdk.openReporter()` or triggered by
|
|
590
|
-
* the banner's "My reports" link button.
|
|
591
|
-
*/
|
|
592
|
-
openReporter(): void;
|
|
593
561
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
594
562
|
recorderSelectIntent(label: string): void;
|
|
595
563
|
recorderFocusDescription(): void;
|
|
@@ -658,49 +626,61 @@ interface MushiLocale {
|
|
|
658
626
|
error: string;
|
|
659
627
|
};
|
|
660
628
|
step1: {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
629
|
+
/** @deprecated The 3-step flow is retired (Plan 018); unused since 1.30. */
|
|
630
|
+
heading?: string;
|
|
631
|
+
/** @deprecated Unused since 1.30. */
|
|
632
|
+
reportSectionLabel?: string;
|
|
633
|
+
/** @deprecated Unused since 1.30. */
|
|
634
|
+
moreNavLabel?: string;
|
|
635
|
+
/** Labels of the header overflow menu. */
|
|
666
636
|
moreNav: {
|
|
667
|
-
yourReports
|
|
668
|
-
|
|
669
|
-
|
|
637
|
+
/** @deprecated Unused since 1.30 — see `panel.yourReports`. */
|
|
638
|
+
yourReports?: string;
|
|
639
|
+
/** @deprecated Unused since 1.30. */
|
|
640
|
+
yourReportsDesc?: string;
|
|
641
|
+
/** @deprecated Unused since 1.30. */
|
|
642
|
+
unreadNew?: string;
|
|
670
643
|
communityIdeas: string;
|
|
671
|
-
|
|
644
|
+
/** @deprecated Unused since 1.30. */
|
|
645
|
+
communityIdeasDesc?: string;
|
|
672
646
|
leaderboard: string;
|
|
673
647
|
joinCommunity: string;
|
|
674
648
|
myAccount: string;
|
|
675
649
|
};
|
|
676
650
|
categories: Record<MushiReportCategory, string>;
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
651
|
+
/** @deprecated Unused since 1.30. */
|
|
652
|
+
categoryDescriptions?: Record<MushiReportCategory, string>;
|
|
653
|
+
/** @deprecated Unused since 1.30. */
|
|
654
|
+
moreCategoriesLabel?: string;
|
|
655
|
+
/** @deprecated Unused since 1.30. */
|
|
656
|
+
moreCategoriesCount?: string;
|
|
682
657
|
};
|
|
683
658
|
step2: {
|
|
684
|
-
|
|
659
|
+
/** @deprecated Unused since 1.30. */
|
|
660
|
+
heading?: string;
|
|
661
|
+
/** Optional sub-chips shown after a type is picked (the first four, minus "Other"). */
|
|
685
662
|
intents: Record<MushiReportCategory, string[]>;
|
|
686
663
|
};
|
|
687
664
|
step3: {
|
|
688
|
-
|
|
665
|
+
/** @deprecated Unused since 1.30. */
|
|
666
|
+
heading?: string;
|
|
667
|
+
/** Placeholder of the one-screen report textarea. */
|
|
689
668
|
descriptionPlaceholder: string;
|
|
690
|
-
/** Placeholder
|
|
669
|
+
/** Placeholder when the Idea chip is picked. */
|
|
691
670
|
featurePlaceholder: string;
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
671
|
+
/** @deprecated Unused since 1.30. */
|
|
672
|
+
featureExamples?: string[];
|
|
673
|
+
/** @deprecated Unused since 1.30. */
|
|
674
|
+
otherPlaceholder?: string;
|
|
695
675
|
/** Footer shortcut hint; `{key}` is ⌘ on Apple platforms, Ctrl elsewhere. */
|
|
696
676
|
submitHint: string;
|
|
697
|
-
/**
|
|
698
|
-
charsNeeded
|
|
677
|
+
/** @deprecated Unused since 1.30 — the hint is "Add a few words". */
|
|
678
|
+
charsNeeded?: string;
|
|
699
679
|
screenshotButton: string;
|
|
700
680
|
screenshotAttached: string;
|
|
701
681
|
screenshotCapturing: string;
|
|
702
682
|
/** @deprecated The web widget now shows `screenshotRetry` + `screenshotErrors`; kept for type compatibility. */
|
|
703
|
-
screenshotFailed
|
|
683
|
+
screenshotFailed?: string;
|
|
704
684
|
/** Screenshot button label after a failed capture. */
|
|
705
685
|
screenshotRetry: string;
|
|
706
686
|
/** Offered after a failed capture: user-consented tab share (getDisplayMedia). */
|
|
@@ -723,11 +703,37 @@ interface MushiLocale {
|
|
|
723
703
|
elementCapturing: string;
|
|
724
704
|
elementFailed: string;
|
|
725
705
|
elementSelectorHint: string;
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
706
|
+
/** @deprecated Unused since 1.30. */
|
|
707
|
+
optional?: string;
|
|
708
|
+
/** @deprecated Unused since 1.30 — core `reporterCopy().ui.addWords`. */
|
|
709
|
+
tooShort?: string;
|
|
710
|
+
/** @deprecated Unused since 1.30. */
|
|
711
|
+
examplePrompts?: string[];
|
|
712
|
+
};
|
|
713
|
+
/** One-screen report, header and notification copy (Plan 018 §1). */
|
|
714
|
+
panel: {
|
|
715
|
+
/** Report screen title. */
|
|
716
|
+
title: string;
|
|
717
|
+
/** "More…" chip: reveals the host's own categories. */
|
|
718
|
+
more: string;
|
|
719
|
+
/** Element picker button. */
|
|
720
|
+
pointAt: string;
|
|
721
|
+
remove: string;
|
|
722
|
+
markUp: string;
|
|
723
|
+
/** Privacy line under the attachments. */
|
|
724
|
+
privacy: string;
|
|
725
|
+
send: string;
|
|
726
|
+
/** Header pill that opens "Your reports". */
|
|
727
|
+
yourReports: string;
|
|
728
|
+
/** Badge text on the pill; `{n}` placeholder. */
|
|
729
|
+
newCount: string;
|
|
730
|
+
/** Header overflow menu button label. */
|
|
731
|
+
moreOptions: string;
|
|
732
|
+
/** Title of the report detail view. */
|
|
733
|
+
reportTitle: string;
|
|
734
|
+
/** Web push opt-in button. */
|
|
735
|
+
notifyMe: string;
|
|
736
|
+
notifyOn: string;
|
|
731
737
|
};
|
|
732
738
|
assistant: {
|
|
733
739
|
defaultLabel: string;
|
|
@@ -746,7 +752,8 @@ interface MushiLocale {
|
|
|
746
752
|
};
|
|
747
753
|
};
|
|
748
754
|
flows: {
|
|
749
|
-
|
|
755
|
+
/** @deprecated Unused since 1.30 (no brand eyebrow in the header). */
|
|
756
|
+
eyebrows?: {
|
|
750
757
|
inbox: string;
|
|
751
758
|
roadmap: string;
|
|
752
759
|
community: string;
|
|
@@ -759,8 +766,10 @@ interface MushiLocale {
|
|
|
759
766
|
reports: {
|
|
760
767
|
title: string;
|
|
761
768
|
loading: string;
|
|
762
|
-
empty
|
|
763
|
-
|
|
769
|
+
/** @deprecated Unused since 1.30 — core `ui.empty`. */
|
|
770
|
+
empty?: string;
|
|
771
|
+
/** @deprecated Unused since 1.30. */
|
|
772
|
+
leaderboardLink?: string;
|
|
764
773
|
};
|
|
765
774
|
roadmap: {
|
|
766
775
|
title: string;
|
|
@@ -804,20 +813,26 @@ interface MushiLocale {
|
|
|
804
813
|
unknownApp: string;
|
|
805
814
|
};
|
|
806
815
|
thread: {
|
|
807
|
-
|
|
816
|
+
/** @deprecated Unused since 1.30 — see `panel.reportTitle`. */
|
|
817
|
+
title?: string;
|
|
808
818
|
loading: string;
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
819
|
+
/** @deprecated Unused since 1.30 — core `ui.noReplies`. */
|
|
820
|
+
empty?: string;
|
|
821
|
+
/** @deprecated Unused since 1.30 — core `ui.yes`. */
|
|
822
|
+
confirmFixed?: string;
|
|
823
|
+
/** @deprecated Unused since 1.30 — core `ui.notYet`. */
|
|
824
|
+
notFixed?: string;
|
|
812
825
|
replyPlaceholder: string;
|
|
813
|
-
send
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
826
|
+
/** @deprecated Unused since 1.30 — see `panel.send`. */
|
|
827
|
+
send?: string;
|
|
828
|
+
/** @deprecated Unused since 1.30 — core `ui.loadError`. */
|
|
829
|
+
loadFailed?: string;
|
|
830
|
+
/** @deprecated Unused since 1.30 — core `ui.retry`. */
|
|
831
|
+
retry?: string;
|
|
817
832
|
};
|
|
818
833
|
success: {
|
|
819
|
-
/**
|
|
820
|
-
title
|
|
834
|
+
/** @deprecated Unused since 1.30 — the receipt title is core `ui.sent`. */
|
|
835
|
+
title?: string;
|
|
821
836
|
/** Closes the panel from the success step. */
|
|
822
837
|
done: string;
|
|
823
838
|
trackReport: string;
|
|
@@ -839,14 +854,19 @@ interface MushiLocale {
|
|
|
839
854
|
};
|
|
840
855
|
featureRequest: {
|
|
841
856
|
label: string;
|
|
842
|
-
|
|
857
|
+
/** @deprecated Unused since 1.30. */
|
|
858
|
+
description?: string;
|
|
843
859
|
};
|
|
844
860
|
/** Beta-mode strip on the category step. */
|
|
845
861
|
betaStrip: {
|
|
846
862
|
/** Default status line when the host sets no message; `{appName}` placeholder. */
|
|
847
863
|
defaultMessage: string;
|
|
848
|
-
/**
|
|
864
|
+
/** Optional contact line, rendered as a mailto link; `{email}` placeholder. Nothing is emailed. */
|
|
849
865
|
contactHint: string;
|
|
866
|
+
/** Who sees the report; `{appName}` placeholder. */
|
|
867
|
+
teamSees: string;
|
|
868
|
+
/** Same, when the host gave no app name. */
|
|
869
|
+
teamSeesGeneric: string;
|
|
850
870
|
/** aria-label for the strip. */
|
|
851
871
|
ariaLabel: string;
|
|
852
872
|
};
|