@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.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
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';
|
|
@@ -19,11 +19,10 @@ declare class Mushi {
|
|
|
19
19
|
* on the MushiWidget class (DOM structure, state, lifecycle).
|
|
20
20
|
*
|
|
21
21
|
* OVERVIEW:
|
|
22
|
-
* - Pure functions:
|
|
23
|
-
*
|
|
24
|
-
* - Constants:
|
|
25
|
-
*
|
|
26
|
-
* - 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
|
|
27
26
|
* WidgetRewardsState / WidgetSubmitOutcome / WidgetCallbacks contracts (these
|
|
28
27
|
* three are re-exported from widget.ts so existing `./widget` import sites and
|
|
29
28
|
* the package barrel keep working unchanged).
|
|
@@ -39,7 +38,9 @@ declare class Mushi {
|
|
|
39
38
|
* - Behaviour-preserving move: bodies are identical to the pre-split widget.ts.
|
|
40
39
|
*/
|
|
41
40
|
|
|
42
|
-
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;
|
|
43
44
|
/** Capture failure reasons plus 'permission' (a host screenshotProvider was denied). */
|
|
44
45
|
type ScreenshotErrorReason = ScreenshotFailureReason | 'permission';
|
|
45
46
|
interface WidgetRewardsState {
|
|
@@ -113,6 +114,17 @@ interface WidgetCallbacks {
|
|
|
113
114
|
onReporterReply?(reportId: string, body: string): Promise<void>;
|
|
114
115
|
onReporterFeedback?(reportId: string, signal: string, note?: string): Promise<Record<string, unknown> | null>;
|
|
115
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>;
|
|
116
128
|
onFeatureBoardRequest?(): Promise<Array<Record<string, unknown>>>;
|
|
117
129
|
onFeatureBoardVote?(requestId: string): Promise<{
|
|
118
130
|
voted: boolean;
|
|
@@ -142,7 +154,6 @@ interface WidgetCallbacks {
|
|
|
142
154
|
}
|
|
143
155
|
|
|
144
156
|
declare class MushiWidget {
|
|
145
|
-
private readonly sdkVersion;
|
|
146
157
|
private host;
|
|
147
158
|
private shadow;
|
|
148
159
|
/** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
|
|
@@ -151,53 +162,46 @@ declare class MushiWidget {
|
|
|
151
162
|
private config;
|
|
152
163
|
private callbacks;
|
|
153
164
|
private locale;
|
|
165
|
+
private rc;
|
|
166
|
+
private lang;
|
|
154
167
|
private isOpen;
|
|
155
168
|
private step;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
private
|
|
162
|
-
private
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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…". */
|
|
171
188
|
private showAllCategories;
|
|
172
|
-
/**
|
|
189
|
+
/** Header overflow menu. */
|
|
173
190
|
private showMoreNav;
|
|
174
191
|
private screenshotAttached;
|
|
175
192
|
private screenshotCapturing;
|
|
176
193
|
private screenshotError;
|
|
177
194
|
/** Why the last capture failed; drives the actionable hint under the tools. */
|
|
178
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;
|
|
179
199
|
private allowScreenshotRemove;
|
|
180
|
-
/**
|
|
181
|
-
* Whether the screenshot / element-select tools are actually usable
|
|
182
|
-
* (capture module present + not disabled by config). Unavailable tools are
|
|
183
|
-
* hidden from the details step — a rendered button whose handler silently
|
|
184
|
-
* no-ops reads as a bug to the reporter.
|
|
185
|
-
*/
|
|
200
|
+
/** Unusable tools are hidden — a button whose handler no-ops reads as a bug. */
|
|
186
201
|
private screenshotAvailable;
|
|
187
202
|
private elementAvailable;
|
|
188
|
-
/**
|
|
189
|
-
|
|
190
|
-
* render() rebuilds the panel with `innerHTML = ''`, which used to destroy
|
|
191
|
-
* whatever the reporter had typed whenever a background refresh (60s inbox
|
|
192
|
-
* poll, visibilitychange refetch, screenshot attach) fired mid-typing.
|
|
193
|
-
* Captured from the live DOM right before teardown, replayed right after.
|
|
194
|
-
*/
|
|
195
|
-
private draftDescription;
|
|
196
|
-
private draftEmail;
|
|
197
|
-
private draftReply;
|
|
198
|
-
private draftFocus;
|
|
199
|
-
private draftSelStart;
|
|
200
|
-
private draftSelEnd;
|
|
203
|
+
/** Field values survive region patches and are the source of truth for validation. */
|
|
204
|
+
private drafts;
|
|
201
205
|
/** Data URL of the attached screenshot, rendered as a visible preview. */
|
|
202
206
|
private screenshotPreview;
|
|
203
207
|
private elementSelected;
|
|
@@ -209,11 +213,6 @@ declare class MushiWidget {
|
|
|
209
213
|
private triggerVisible;
|
|
210
214
|
private triggerShrunk;
|
|
211
215
|
private triggerHiddenByScroll;
|
|
212
|
-
/** Milliseconds since mount — used for the 30s first-time nudge gate. */
|
|
213
|
-
private mountedAt;
|
|
214
|
-
private nudgeShown;
|
|
215
|
-
private nudgeEl;
|
|
216
|
-
private nudgeTimer;
|
|
217
216
|
private sdkFreshness;
|
|
218
217
|
/** Brand-footer ref (SDK sets it once hashed) + once-per-instance impression latch. */
|
|
219
218
|
private brandRef;
|
|
@@ -221,38 +220,35 @@ declare class MushiWidget {
|
|
|
221
220
|
private reporterReports;
|
|
222
221
|
private featureBoard;
|
|
223
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;
|
|
224
227
|
private selectedReportId;
|
|
225
|
-
/**
|
|
226
|
-
* One flag per surface. A single shared flag used to let a reply (or vote,
|
|
227
|
-
* or reopen) blank the thread it was posted from, and a failed reply
|
|
228
|
-
* replaced the conversation with its error.
|
|
229
|
-
*/
|
|
228
|
+
/** One flag per surface: a reply never blanks the thread it was posted from. */
|
|
230
229
|
private listLoading;
|
|
231
230
|
private threadLoading;
|
|
232
231
|
private actionPending;
|
|
233
|
-
/** List / roadmap load error. */
|
|
234
232
|
private reporterError;
|
|
235
|
-
/** Thread (comments) load error — rendered with Try again. */
|
|
236
233
|
private threadError;
|
|
237
|
-
/** Reply / feedback / reopen / vote error — rendered beside the composer. */
|
|
238
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;
|
|
239
240
|
private attachedLaunchers;
|
|
240
241
|
private smartHideCleanup;
|
|
241
242
|
private smartHideTimer;
|
|
242
|
-
/** Captured at the
|
|
243
|
-
* ("REPORT · 14:23:07 JST") doesn't drift while the success step
|
|
244
|
-
* is on screen. */
|
|
243
|
+
/** Captured at submit so the receipt time doesn't drift while it is on screen. */
|
|
245
244
|
private submittedAt;
|
|
246
|
-
/** Pending success-state timer
|
|
247
|
-
* otherwise a host that unmounts mid-submit leaks this MushiWidget
|
|
248
|
-
* reference (and re-renders into a detached shadow root). */
|
|
245
|
+
/** Pending success-state timer, cleared by destroy(). */
|
|
249
246
|
private successTimer;
|
|
250
247
|
/**
|
|
251
|
-
* Set on pointerdown inside the panel. A background
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* (bounded, so a lost pointerup can't freeze the panel).
|
|
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).
|
|
256
252
|
*/
|
|
257
253
|
private pointerDownAt;
|
|
258
254
|
private renderDeferred;
|
|
@@ -260,16 +256,8 @@ declare class MushiWidget {
|
|
|
260
256
|
private rewardsState;
|
|
261
257
|
private leaderboardEntries;
|
|
262
258
|
private leaderboardLoading;
|
|
263
|
-
/** Server-confirmed id for the just-submitted report.
|
|
264
|
-
* the success step as a copyable receipt + optional deep link to
|
|
265
|
-
* the Mushi console (when `dashboardUrl` is configured). Cleared
|
|
266
|
-
* on every new `open()` so a re-opened widget never reuses a
|
|
267
|
-
* stale id from the previous session. */
|
|
259
|
+
/** Server-confirmed id for the just-submitted report (receipt + Track it). */
|
|
268
260
|
private lastReportId;
|
|
269
|
-
/** True when the just-submitted report was queued offline (no
|
|
270
|
-
* network, or the API errored and went into the retry queue).
|
|
271
|
-
* Drives a different success copy so the user knows the report
|
|
272
|
-
* hasn't actually reached the console yet. */
|
|
273
261
|
private lastSubmitQueuedOffline;
|
|
274
262
|
private lastSubmitFailureKind;
|
|
275
263
|
private lastSubmitScreenshotDropped;
|
|
@@ -280,26 +268,16 @@ declare class MushiWidget {
|
|
|
280
268
|
private fabPos;
|
|
281
269
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
282
270
|
private vvCleanup;
|
|
283
|
-
/**
|
|
284
|
-
* Host-app user identity forwarded via `Mushi.identify()` or
|
|
285
|
-
* `Mushi.identifyWithToken()`. Used to show "Reporting as <name>"
|
|
286
|
-
* in the details step so logged-in users know their report is linked.
|
|
287
|
-
* Independent of the Mushi tester magic-link session below.
|
|
288
|
-
*/
|
|
271
|
+
/** Host-app user identity from `identify()` — shown as "Reporting as <name>". */
|
|
289
272
|
private identifiedUser;
|
|
290
273
|
/** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
|
|
291
274
|
private testerJwt;
|
|
292
|
-
/** Tester identity (public_handle, display_name). */
|
|
293
275
|
private testerInfo;
|
|
294
|
-
/** Cross-app reports for the signed-in tester. */
|
|
295
276
|
private crossAppReports;
|
|
296
277
|
private crossAppLoading;
|
|
297
|
-
/** Global leaderboard entries (from mushi_testers, not org-scoped). */
|
|
298
278
|
private globalLeaderboard;
|
|
299
279
|
private globalLeaderboardLoading;
|
|
300
|
-
/** Reputation for the signed-in tester. */
|
|
301
280
|
private testerReputation;
|
|
302
|
-
/** Whether an in-widget magic-link email was just sent. */
|
|
303
281
|
private magicLinkSent;
|
|
304
282
|
private magicLinkEmail;
|
|
305
283
|
private magicLinkError;
|
|
@@ -308,42 +286,31 @@ declare class MushiWidget {
|
|
|
308
286
|
private assistantThreadId;
|
|
309
287
|
private assistantSending;
|
|
310
288
|
private assistantError;
|
|
311
|
-
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;
|
|
312
292
|
mount(): void;
|
|
313
293
|
getIsMounted(): boolean;
|
|
314
294
|
updateConfig(config?: MushiWidgetConfig): void;
|
|
315
295
|
/** Find a custom category entry by id. Returns undefined for built-in ids. */
|
|
316
296
|
private resolveCustomCategory;
|
|
317
|
-
/**
|
|
318
|
-
* Map a (possibly custom) category id to the built-in `MushiReportCategory`
|
|
319
|
-
* used for the report wire format. Falls back to `'other'`.
|
|
320
|
-
*/
|
|
321
|
-
private resolveBaseCategory;
|
|
322
|
-
/** Icon for the selected category — custom entry's icon or built-in emoji. */
|
|
323
|
-
private categoryIcon;
|
|
324
|
-
/** Label for the selected category — custom entry label or built-in i18n string. */
|
|
325
|
-
private categoryLabel;
|
|
326
297
|
open(options?: {
|
|
327
298
|
category?: MushiReportCategory | string;
|
|
328
299
|
featureRequest?: boolean;
|
|
329
300
|
}): void;
|
|
330
301
|
close(): void;
|
|
331
|
-
/** Open the panel directly on the assistant ("Ask")
|
|
302
|
+
/** Open the panel directly on the assistant ("Ask") view. */
|
|
332
303
|
openAssistantTab(): void;
|
|
333
|
-
|
|
304
|
+
private ensureOpen;
|
|
305
|
+
/** Send one assistant turn and re-render as the reply arrives. */
|
|
334
306
|
sendAssistantMessage(message: string): Promise<void>;
|
|
335
307
|
/** Persist Ask turns for same-tab reload survival (UX only). */
|
|
336
308
|
private persistAssistantSession;
|
|
337
309
|
/** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
|
|
338
310
|
clearAssistantTranscript(): void;
|
|
339
|
-
/** Escape hatch from Ask → report category picker (no login required). */
|
|
340
|
-
private openReportFromAssistant;
|
|
341
311
|
/**
|
|
342
|
-
* Briefly highlight the trigger
|
|
343
|
-
*
|
|
344
|
-
* and other "by the way, this exists" prompts where forcing the panel
|
|
345
|
-
* open would feel aggressive. Honours `position: 'none'` (no-op when
|
|
346
|
-
* 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.
|
|
347
314
|
*/
|
|
348
315
|
pulseTrigger(): void;
|
|
349
316
|
getIsOpen(): boolean;
|
|
@@ -354,12 +321,7 @@ declare class MushiWidget {
|
|
|
354
321
|
setScreenshotAttached(attached: boolean): void;
|
|
355
322
|
/** Provide the captured screenshot data URL so the widget can preview it. */
|
|
356
323
|
setScreenshotPreview(dataUrl: string | null): void;
|
|
357
|
-
/**
|
|
358
|
-
* Resolve the privacy caption shown beside the screenshot preview from the
|
|
359
|
-
* `screenshotSensitiveHint` widget config (kept in sync via updateConfig, so
|
|
360
|
-
* it honours console/runtime config): `false` → hidden, a non-empty string →
|
|
361
|
-
* that copy, anything else (`true`/unset) → the localized default.
|
|
362
|
-
*/
|
|
324
|
+
/** Privacy caption beside the preview: `false` hides it, a string replaces it, else the localized default. */
|
|
363
325
|
private resolveScreenshotHint;
|
|
364
326
|
setAllowScreenshotRemove(allow: boolean): void;
|
|
365
327
|
/** Show/hide the attachment tools based on what the SDK can actually do. */
|
|
@@ -373,20 +335,15 @@ declare class MushiWidget {
|
|
|
373
335
|
setScreenshotCapturing(capturing: boolean): void;
|
|
374
336
|
/**
|
|
375
337
|
* Flag (or clear) a failed capture. A call without a reason keeps the more
|
|
376
|
-
* specific one an earlier call recorded for the same attempt
|
|
377
|
-
* module reports 'taint'/'timeout' before the caller's generic failure).
|
|
338
|
+
* specific one an earlier call recorded for the same attempt.
|
|
378
339
|
*/
|
|
379
340
|
setScreenshotError(failed: boolean, reason?: ScreenshotErrorReason): void;
|
|
380
341
|
setElementCapturing(capturing: boolean): void;
|
|
381
|
-
/** Hide the
|
|
382
|
-
* so the user can click any element on the page without the panel
|
|
383
|
-
* intercepting the event. */
|
|
342
|
+
/** Hide the panel (keep the host) during element selection so page clicks reach the page. */
|
|
384
343
|
hidePanel(): void;
|
|
385
344
|
showPanel(): void;
|
|
386
345
|
private showSelectorHint;
|
|
387
346
|
private removeSelectorHint;
|
|
388
|
-
private showNudge;
|
|
389
|
-
private removeNudge;
|
|
390
347
|
setSdkFreshness(info: {
|
|
391
348
|
latest: string | null;
|
|
392
349
|
current: string;
|
|
@@ -401,6 +358,15 @@ declare class MushiWidget {
|
|
|
401
358
|
total_points: number;
|
|
402
359
|
points_30d: number;
|
|
403
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;
|
|
404
370
|
setIdentifiedUser(user: {
|
|
405
371
|
name?: string;
|
|
406
372
|
email?: string;
|
|
@@ -417,25 +383,10 @@ declare class MushiWidget {
|
|
|
417
383
|
/** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
|
|
418
384
|
private bindColorSchemeListener;
|
|
419
385
|
private unbindColorSchemeListener;
|
|
420
|
-
/**
|
|
421
|
-
* Apply the SDK-owned pass-through layout to the host element so it is
|
|
422
|
-
* always zero-sized and click/touch-transparent. Only the shadow-root
|
|
423
|
-
* internals (`.mushi-trigger`, `.mushi-banner`, `.mushi-panel`) opt back
|
|
424
|
-
* into pointer events. This is idempotent and safe to call repeatedly.
|
|
425
|
-
*/
|
|
426
386
|
private syncHostChromeState;
|
|
427
|
-
/**
|
|
428
|
-
* Returns true when a DOM element matching `hideOnSelector` is currently
|
|
429
|
-
* present in the host document. Used by both the trigger and the banner
|
|
430
|
-
* so a single selector consistently hides ALL SDK-injected launcher
|
|
431
|
-
* surfaces. Invalid selectors are swallowed silently (non-fatal).
|
|
432
|
-
*/
|
|
387
|
+
/** True when an element matching `hideOnSelector` is in the host document (invalid selectors are ignored). */
|
|
433
388
|
private isSuppressedByHost;
|
|
434
|
-
/**
|
|
435
|
-
* Returns a snapshot of the widget's host-layer health for use in
|
|
436
|
-
* `Mushi.diagnose()`. Callers check this to know whether the widget
|
|
437
|
-
* could ever block host-app UI without opening a browser devtools.
|
|
438
|
-
*/
|
|
389
|
+
/** Host-layer health snapshot for `Mushi.diagnose()`. */
|
|
439
390
|
getWidgetDiagnostics(): {
|
|
440
391
|
widgetHostPointerSafe: boolean;
|
|
441
392
|
widgetHostBounds: {
|
|
@@ -453,51 +404,51 @@ declare class MushiWidget {
|
|
|
453
404
|
/** CSS property applied to documentElement so host-app content doesn't slide under the banner. */
|
|
454
405
|
private static readonly BODY_NUDGE_PROP;
|
|
455
406
|
private applyBodyNudge;
|
|
456
|
-
/**
|
|
457
|
-
* Schedule a height measurement after the next paint and set up a ResizeObserver
|
|
458
|
-
* so --mushi-banner-offset always tracks the actual rendered banner height
|
|
459
|
-
* (which can exceed BANNER_HEIGHT when safe-area-inset-top is in play on iOS,
|
|
460
|
-
* or when rich-layout text wraps on narrow viewports).
|
|
461
|
-
*/
|
|
407
|
+
/** Track the real banner height (safe-area insets, wrapped text) into --mushi-banner-offset. */
|
|
462
408
|
private trackBannerHeight;
|
|
463
409
|
private removeBodyNudge;
|
|
410
|
+
/** Rebuild the banner only when something it shows changed. */
|
|
411
|
+
private syncBanner;
|
|
464
412
|
private renderBanner;
|
|
465
413
|
private effectiveTrigger;
|
|
466
414
|
private isMobileSmartHidden;
|
|
467
415
|
private detectEnvironment;
|
|
468
416
|
private isRouteHidden;
|
|
469
417
|
private getTheme;
|
|
470
|
-
/**
|
|
418
|
+
/** Parse any CSS colour the browser understands into [r, g, b] (null when it can't). */
|
|
419
|
+
private probeRgb;
|
|
420
|
+
/**
|
|
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.
|
|
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. */
|
|
471
437
|
private captureFormDrafts;
|
|
472
|
-
/** Replay
|
|
438
|
+
/** Replay values (and focus + caret) into fields a patch just created. */
|
|
473
439
|
private restoreFormDrafts;
|
|
474
|
-
|
|
475
|
-
private render;
|
|
476
|
-
/**
|
|
477
|
-
* Queries each `avoidSelectors` element in the host document and returns
|
|
478
|
-
* the minimum top-offset in px so that a top-anchored element clears all
|
|
479
|
-
* of them by `gap` pixels. Returns `null` when no selectors are provided
|
|
480
|
-
* or no matching elements have a non-zero bounding rect.
|
|
481
|
-
*
|
|
482
|
-
* Runs in the host document (not shadow DOM) so it can reach fixed headers,
|
|
483
|
-
* sticky nav bars, and sign-in CTAs.
|
|
484
|
-
*/
|
|
440
|
+
/** Queries `avoidSelectors` and returns a top offset clearing all of them, or null. */
|
|
485
441
|
private computeAvoidTopPx;
|
|
486
|
-
/**
|
|
487
|
-
* Minimum bottom-offset in px so a bottom-anchored trigger clears avoided
|
|
488
|
-
* elements (tab bars, fixed CTAs). Mirrors {@link computeAvoidTopPx}.
|
|
489
|
-
*/
|
|
442
|
+
/** Bottom offset so a bottom-anchored trigger clears avoided elements (tab bars, fixed CTAs). */
|
|
490
443
|
private computeAvoidBottomPx;
|
|
491
444
|
private applyInsetVars;
|
|
492
445
|
/** Storage key for the FAB position, scoped to projectId when available. */
|
|
493
446
|
private fabStorageKey;
|
|
494
|
-
/**
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
|
|
499
|
-
* correct clamp bounds and snap targets. We do this by subtracting the
|
|
500
|
-
* 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
|
+
*/
|
|
501
452
|
private moveFab;
|
|
502
453
|
/** Load previously persisted FAB position. */
|
|
503
454
|
private loadFabPos;
|
|
@@ -507,55 +458,78 @@ declare class MushiWidget {
|
|
|
507
458
|
private attachViewportHandlers;
|
|
508
459
|
private teardownViewportHandlers;
|
|
509
460
|
/**
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
* entry of step2.intents.other in every locale).
|
|
513
|
-
*/
|
|
514
|
-
private detailMode;
|
|
515
|
-
/**
|
|
516
|
-
* Minimum description length, lowered for CJK locales where each character
|
|
517
|
-
* carries more meaning. Used by both the view layer (via renderCtx) and the
|
|
518
|
-
* 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.
|
|
519
463
|
*/
|
|
520
464
|
private effectiveMinLength;
|
|
521
|
-
/**
|
|
522
|
-
private
|
|
523
|
-
/**
|
|
524
|
-
* Build the read-only snapshot + bound helper closures the stateless view
|
|
525
|
-
* layer (widget-render.ts) renders from. Rebuilt once per render() pass so
|
|
526
|
-
* the HTML always reflects current state.
|
|
527
|
-
*/
|
|
528
|
-
private renderCtx;
|
|
529
|
-
private attachHandlers;
|
|
530
|
-
private trapFocus;
|
|
465
|
+
/** Enough words, or something the reporter attached on purpose. */
|
|
466
|
+
private canSend;
|
|
531
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;
|
|
532
477
|
private loadFeatureBoard;
|
|
533
478
|
private voteFeatureBoard;
|
|
534
479
|
/**
|
|
535
|
-
* Run a thread action (
|
|
536
|
-
*
|
|
537
|
-
* disables, and afterwards the status + comments refresh in place.
|
|
480
|
+
* Run a thread action (feedback / reopen) without leaving or blanking the
|
|
481
|
+
* thread: the action buttons disable, then status + timeline refresh in place.
|
|
538
482
|
*/
|
|
539
483
|
private runThreadAction;
|
|
540
484
|
private submitReporterReopen;
|
|
541
|
-
|
|
485
|
+
private submitReporterFeedback;
|
|
486
|
+
/** Refresh "Your reports" quietly (badge + list + open row); never disturbs what the reporter is typing. */
|
|
542
487
|
refreshReporterInboxQuiet(): Promise<void>;
|
|
543
|
-
/** Patch the "Your reports (N new)" nav label in place, if it is rendered. */
|
|
544
|
-
private updateReportsBadgeText;
|
|
545
488
|
private loadReporterReports;
|
|
546
|
-
/** "Track
|
|
489
|
+
/** "Track it" on the receipt → that report's thread. */
|
|
547
490
|
private openTrackedReport;
|
|
548
491
|
/**
|
|
549
|
-
* Open (or refresh) a thread. The
|
|
550
|
-
*
|
|
551
|
-
* loads. `quiet` keeps the current comments on screen (post-action refresh).
|
|
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.
|
|
552
494
|
*/
|
|
553
|
-
private
|
|
554
|
-
|
|
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. */
|
|
555
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;
|
|
556
528
|
private handleMagicLinkSend;
|
|
529
|
+
/** Open the widget on "Your reports" (`sdk.openReporter()`, the banner's link, a toast). */
|
|
530
|
+
openReporter(): void;
|
|
557
531
|
getRecorderStep(): WidgetStep;
|
|
558
|
-
/** QA / Playwright:
|
|
532
|
+
/** QA / Playwright: report-screen IA without piercing the shadow root. */
|
|
559
533
|
getRecorderCategoryStepIA(): {
|
|
560
534
|
sectionLabel: string;
|
|
561
535
|
moreToggle: boolean;
|
|
@@ -566,12 +540,6 @@ declare class MushiWidget {
|
|
|
566
540
|
getRecorderIntentButton(label: string): Element | null;
|
|
567
541
|
getRecorderSubmitButton(): Element | null;
|
|
568
542
|
recorderClickTrigger(): void;
|
|
569
|
-
/**
|
|
570
|
-
* Open the widget directly to the reporter's "My reports" history view.
|
|
571
|
-
* Can be called from host apps via `sdk.openReporter()` or triggered by
|
|
572
|
-
* the banner's "My reports" link button.
|
|
573
|
-
*/
|
|
574
|
-
openReporter(): void;
|
|
575
543
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
576
544
|
recorderSelectIntent(label: string): void;
|
|
577
545
|
recorderFocusDescription(): void;
|