@mushi-mushi/web 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +247 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +247 -54
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +348 -249
- package/dist/mushi.loader.global.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -137,6 +137,8 @@ declare class MushiWidget {
|
|
|
137
137
|
* landing on the intent picker the user explicitly skipped.
|
|
138
138
|
*/
|
|
139
139
|
private viaFeatureRequest;
|
|
140
|
+
/** Whether the category list is fully expanded (progressive disclosure). */
|
|
141
|
+
private showAllCategories;
|
|
140
142
|
private screenshotAttached;
|
|
141
143
|
private screenshotCapturing;
|
|
142
144
|
private screenshotError;
|
|
@@ -190,6 +192,7 @@ declare class MushiWidget {
|
|
|
190
192
|
private lastSubmitQueuedOffline;
|
|
191
193
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
192
194
|
private bannerDismissed;
|
|
195
|
+
private bannerResizeObserver;
|
|
193
196
|
/** Persisted FAB position when draggable is enabled. */
|
|
194
197
|
private fabPos;
|
|
195
198
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
@@ -320,11 +323,18 @@ declare class MushiWidget {
|
|
|
320
323
|
private syncAttachedLaunchers;
|
|
321
324
|
private syncSmartHide;
|
|
322
325
|
private shouldRenderTrigger;
|
|
323
|
-
/** Height of the banner in px —
|
|
326
|
+
/** Height of the banner in px — used as a fallback before first layout. */
|
|
324
327
|
private static readonly BANNER_HEIGHT;
|
|
325
|
-
/** CSS property applied to
|
|
328
|
+
/** CSS property applied to documentElement so host-app content doesn't slide under the banner. */
|
|
326
329
|
private static readonly BODY_NUDGE_PROP;
|
|
327
330
|
private applyBodyNudge;
|
|
331
|
+
/**
|
|
332
|
+
* Schedule a height measurement after the next paint and set up a ResizeObserver
|
|
333
|
+
* so --mushi-banner-offset always tracks the actual rendered banner height
|
|
334
|
+
* (which can exceed BANNER_HEIGHT when safe-area-inset-top is in play on iOS,
|
|
335
|
+
* or when rich-layout text wraps on narrow viewports).
|
|
336
|
+
*/
|
|
337
|
+
private trackBannerHeight;
|
|
328
338
|
private removeBodyNudge;
|
|
329
339
|
private renderBanner;
|
|
330
340
|
private effectiveTrigger;
|
|
@@ -397,6 +407,12 @@ declare class MushiWidget {
|
|
|
397
407
|
getRecorderIntentButton(label: string): Element | null;
|
|
398
408
|
getRecorderSubmitButton(): Element | null;
|
|
399
409
|
recorderClickTrigger(): void;
|
|
410
|
+
/**
|
|
411
|
+
* Open the widget directly to the reporter's "My reports" history view.
|
|
412
|
+
* Can be called from host apps via `sdk.openReporter()` or triggered by
|
|
413
|
+
* the banner's "My reports" link button.
|
|
414
|
+
*/
|
|
415
|
+
openReporter(): void;
|
|
400
416
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
401
417
|
recorderSelectIntent(label: string): void;
|
|
402
418
|
recorderFocusDescription(): void;
|
|
@@ -431,6 +447,8 @@ interface ScreenshotCapture {
|
|
|
431
447
|
}
|
|
432
448
|
interface ScreenshotCaptureOptions {
|
|
433
449
|
privacy?: MushiPrivacyConfig;
|
|
450
|
+
/** Callback invoked when capture fails (taint, security policy, etc.). */
|
|
451
|
+
onFailed?: (reason: 'taint' | 'error') => void;
|
|
434
452
|
}
|
|
435
453
|
declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
|
|
436
454
|
|
package/dist/index.d.ts
CHANGED
|
@@ -137,6 +137,8 @@ declare class MushiWidget {
|
|
|
137
137
|
* landing on the intent picker the user explicitly skipped.
|
|
138
138
|
*/
|
|
139
139
|
private viaFeatureRequest;
|
|
140
|
+
/** Whether the category list is fully expanded (progressive disclosure). */
|
|
141
|
+
private showAllCategories;
|
|
140
142
|
private screenshotAttached;
|
|
141
143
|
private screenshotCapturing;
|
|
142
144
|
private screenshotError;
|
|
@@ -190,6 +192,7 @@ declare class MushiWidget {
|
|
|
190
192
|
private lastSubmitQueuedOffline;
|
|
191
193
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
192
194
|
private bannerDismissed;
|
|
195
|
+
private bannerResizeObserver;
|
|
193
196
|
/** Persisted FAB position when draggable is enabled. */
|
|
194
197
|
private fabPos;
|
|
195
198
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
@@ -320,11 +323,18 @@ declare class MushiWidget {
|
|
|
320
323
|
private syncAttachedLaunchers;
|
|
321
324
|
private syncSmartHide;
|
|
322
325
|
private shouldRenderTrigger;
|
|
323
|
-
/** Height of the banner in px —
|
|
326
|
+
/** Height of the banner in px — used as a fallback before first layout. */
|
|
324
327
|
private static readonly BANNER_HEIGHT;
|
|
325
|
-
/** CSS property applied to
|
|
328
|
+
/** CSS property applied to documentElement so host-app content doesn't slide under the banner. */
|
|
326
329
|
private static readonly BODY_NUDGE_PROP;
|
|
327
330
|
private applyBodyNudge;
|
|
331
|
+
/**
|
|
332
|
+
* Schedule a height measurement after the next paint and set up a ResizeObserver
|
|
333
|
+
* so --mushi-banner-offset always tracks the actual rendered banner height
|
|
334
|
+
* (which can exceed BANNER_HEIGHT when safe-area-inset-top is in play on iOS,
|
|
335
|
+
* or when rich-layout text wraps on narrow viewports).
|
|
336
|
+
*/
|
|
337
|
+
private trackBannerHeight;
|
|
328
338
|
private removeBodyNudge;
|
|
329
339
|
private renderBanner;
|
|
330
340
|
private effectiveTrigger;
|
|
@@ -397,6 +407,12 @@ declare class MushiWidget {
|
|
|
397
407
|
getRecorderIntentButton(label: string): Element | null;
|
|
398
408
|
getRecorderSubmitButton(): Element | null;
|
|
399
409
|
recorderClickTrigger(): void;
|
|
410
|
+
/**
|
|
411
|
+
* Open the widget directly to the reporter's "My reports" history view.
|
|
412
|
+
* Can be called from host apps via `sdk.openReporter()` or triggered by
|
|
413
|
+
* the banner's "My reports" link button.
|
|
414
|
+
*/
|
|
415
|
+
openReporter(): void;
|
|
400
416
|
recorderSelectCategory(category: MushiReportCategory): void;
|
|
401
417
|
recorderSelectIntent(label: string): void;
|
|
402
418
|
recorderFocusDescription(): void;
|
|
@@ -431,6 +447,8 @@ interface ScreenshotCapture {
|
|
|
431
447
|
}
|
|
432
448
|
interface ScreenshotCaptureOptions {
|
|
433
449
|
privacy?: MushiPrivacyConfig;
|
|
450
|
+
/** Callback invoked when capture fails (taint, security policy, etc.). */
|
|
451
|
+
onFailed?: (reason: 'taint' | 'error') => void;
|
|
434
452
|
}
|
|
435
453
|
declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
|
|
436
454
|
|
package/dist/index.js
CHANGED
|
@@ -485,9 +485,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
485
485
|
|
|
486
486
|
.mushi-panel {
|
|
487
487
|
position: fixed;
|
|
488
|
-
width:
|
|
488
|
+
width: 360px;
|
|
489
489
|
max-width: calc(100vw - 32px);
|
|
490
|
-
max-height: min(
|
|
490
|
+
max-height: min(480px, calc(100dvh - 120px - var(--mushi-keyboard-inset, 0px)));
|
|
491
491
|
background: ${paper};
|
|
492
492
|
border: 1px solid ${ruleStrong};
|
|
493
493
|
border-radius: 6px;
|
|
@@ -573,12 +573,12 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
573
573
|
}
|
|
574
574
|
|
|
575
575
|
.mushi-header {
|
|
576
|
-
padding: 18px
|
|
576
|
+
padding: 13px 18px 10px;
|
|
577
577
|
border-bottom: 1px solid ${rule};
|
|
578
578
|
display: grid;
|
|
579
579
|
grid-template-columns: auto 1fr auto;
|
|
580
580
|
align-items: end;
|
|
581
|
-
gap:
|
|
581
|
+
gap: 10px;
|
|
582
582
|
}
|
|
583
583
|
.mushi-header-mark {
|
|
584
584
|
display: inline-flex;
|
|
@@ -653,17 +653,22 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
653
653
|
background: none;
|
|
654
654
|
border: none;
|
|
655
655
|
cursor: pointer;
|
|
656
|
-
padding: 0;
|
|
656
|
+
padding: 3px 0;
|
|
657
657
|
margin: 0 0 2px;
|
|
658
|
+
min-height: 22px;
|
|
658
659
|
color: ${inkMuted};
|
|
659
660
|
font-family: ${fontMono};
|
|
660
|
-
font-size:
|
|
661
|
+
font-size: 11px;
|
|
661
662
|
font-weight: 500;
|
|
662
|
-
letter-spacing: 0.
|
|
663
|
+
letter-spacing: 0.06em;
|
|
663
664
|
text-transform: uppercase;
|
|
664
665
|
line-height: 1.2;
|
|
665
666
|
border-radius: 0;
|
|
667
|
+
display: inline-flex;
|
|
668
|
+
align-items: center;
|
|
669
|
+
gap: 4px;
|
|
666
670
|
transition: color 150ms ${easeStamp};
|
|
671
|
+
white-space: nowrap;
|
|
667
672
|
}
|
|
668
673
|
.mushi-close:hover { color: ${widgetAccent}; }
|
|
669
674
|
.mushi-back:hover { color: ${ink}; }
|
|
@@ -696,9 +701,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
696
701
|
display: grid;
|
|
697
702
|
grid-template-columns: auto 1fr auto;
|
|
698
703
|
align-items: center;
|
|
699
|
-
gap:
|
|
704
|
+
gap: 12px;
|
|
700
705
|
width: 100%;
|
|
701
|
-
padding:
|
|
706
|
+
padding: 11px 0;
|
|
702
707
|
border: none;
|
|
703
708
|
border-bottom: 1px solid ${rule};
|
|
704
709
|
background: transparent;
|
|
@@ -1368,6 +1373,20 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1368
1373
|
.mushi-success-receipt-warn {
|
|
1369
1374
|
color: ${widgetAccent};
|
|
1370
1375
|
}
|
|
1376
|
+
.mushi-success-my-reports {
|
|
1377
|
+
display: block;
|
|
1378
|
+
margin: 12px auto 0;
|
|
1379
|
+
font-size: 12px;
|
|
1380
|
+
font-family: ${fontMono};
|
|
1381
|
+
color: ${widgetAccent};
|
|
1382
|
+
text-decoration: underline;
|
|
1383
|
+
text-underline-offset: 2px;
|
|
1384
|
+
background: none;
|
|
1385
|
+
border: none;
|
|
1386
|
+
cursor: pointer;
|
|
1387
|
+
padding: 4px 2px;
|
|
1388
|
+
}
|
|
1389
|
+
.mushi-success-my-reports:hover { opacity: 0.75; }
|
|
1371
1390
|
.mushi-success-sla {
|
|
1372
1391
|
margin-top: 2px;
|
|
1373
1392
|
font-family: ${fontDisplay};
|
|
@@ -1859,6 +1878,28 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1859
1878
|
}
|
|
1860
1879
|
.mushi-banner.neon .mushi-banner-dismiss:hover { background: rgba(0,0,0,0.18) !important; }
|
|
1861
1880
|
|
|
1881
|
+
/* "My reports" link in the simple (non-rich) banner layout */
|
|
1882
|
+
.mushi-banner-my-reports {
|
|
1883
|
+
background: transparent;
|
|
1884
|
+
border: none;
|
|
1885
|
+
cursor: pointer;
|
|
1886
|
+
font-size: 11px;
|
|
1887
|
+
font-family: ${fontMono};
|
|
1888
|
+
opacity: 0.75;
|
|
1889
|
+
color: inherit;
|
|
1890
|
+
padding: 2px 6px;
|
|
1891
|
+
border-radius: 3px;
|
|
1892
|
+
white-space: nowrap;
|
|
1893
|
+
flex-shrink: 0;
|
|
1894
|
+
transition: opacity 0.15s, background 0.15s;
|
|
1895
|
+
margin-left: 4px;
|
|
1896
|
+
}
|
|
1897
|
+
.mushi-banner-my-reports:hover {
|
|
1898
|
+
opacity: 1;
|
|
1899
|
+
background: rgba(0,0,0,0.10);
|
|
1900
|
+
}
|
|
1901
|
+
.mushi-banner.neon .mushi-banner-my-reports:hover { background: rgba(0,0,0,0.18); }
|
|
1902
|
+
|
|
1862
1903
|
@keyframes mushi-banner-slide-in {
|
|
1863
1904
|
from { transform: translateY(calc(-1 * 100%)); opacity: 0.5; }
|
|
1864
1905
|
to { transform: translateY(0); opacity: 1; }
|
|
@@ -1886,6 +1927,56 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1886
1927
|
|
|
1887
1928
|
.mushi-community-footer{display:flex;align-items:center;gap:8px;padding:10px 0 2px;border-top:1px solid ${isDark ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.07)"};margin-top:8px;flex-wrap:wrap}
|
|
1888
1929
|
.mushi-community-btn{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
1930
|
+
/* \u2500\u2500 "More issue types \u2192" toggle (progressive disclosure) \u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1931
|
+
.mushi-more-toggle {
|
|
1932
|
+
display: flex;
|
|
1933
|
+
align-items: center;
|
|
1934
|
+
gap: 8px;
|
|
1935
|
+
width: 100%;
|
|
1936
|
+
padding: 11px 0;
|
|
1937
|
+
border: none;
|
|
1938
|
+
border-top: 1px dashed ${rule};
|
|
1939
|
+
background: transparent;
|
|
1940
|
+
cursor: pointer;
|
|
1941
|
+
color: ${inkMuted};
|
|
1942
|
+
font-family: ${fontBody};
|
|
1943
|
+
font-size: 13px;
|
|
1944
|
+
text-align: left;
|
|
1945
|
+
transition: color 180ms ${easeStamp};
|
|
1946
|
+
}
|
|
1947
|
+
.mushi-more-toggle:hover { color: ${widgetAccent}; }
|
|
1948
|
+
.mushi-more-toggle:hover .mushi-more-toggle-arrow { transform: translateX(3px); }
|
|
1949
|
+
.mushi-more-toggle-text { flex: 1; }
|
|
1950
|
+
.mushi-more-toggle-count {
|
|
1951
|
+
font-family: ${fontMono};
|
|
1952
|
+
font-size: 10px;
|
|
1953
|
+
letter-spacing: 0.08em;
|
|
1954
|
+
text-transform: uppercase;
|
|
1955
|
+
color: ${inkFaint};
|
|
1956
|
+
background: ${isDark ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.06)"};
|
|
1957
|
+
padding: 2px 6px;
|
|
1958
|
+
border-radius: 10px;
|
|
1959
|
+
}
|
|
1960
|
+
.mushi-more-toggle-arrow {
|
|
1961
|
+
font-size: 14px;
|
|
1962
|
+
opacity: 0.5;
|
|
1963
|
+
transition: transform 180ms ${easeStamp};
|
|
1964
|
+
}
|
|
1965
|
+
/* \u2500\u2500 Step slide-in \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1966
|
+
@keyframes mushi-step-in {
|
|
1967
|
+
0% { opacity: 0; transform: translateX(8px); }
|
|
1968
|
+
100% { opacity: 1; transform: translateX(0); }
|
|
1969
|
+
}
|
|
1970
|
+
.mushi-body {
|
|
1971
|
+
animation: mushi-step-in 160ms ease both;
|
|
1972
|
+
}
|
|
1973
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1974
|
+
.mushi-body { animation: none; }
|
|
1975
|
+
}
|
|
1976
|
+
/* Expanded secondary categories animate in */
|
|
1977
|
+
.mushi-categories-expanded {
|
|
1978
|
+
animation: mushi-step-in 180ms ease both;
|
|
1979
|
+
}
|
|
1889
1980
|
.mushi-link-btn{background:none;border:none;padding:4px 2px;cursor:pointer;color:${widgetAccent};font-size:12px;font-family:${fontMono};text-decoration:underline;text-underline-offset:2px}
|
|
1890
1981
|
.mushi-link-btn:hover{opacity:0.8}
|
|
1891
1982
|
.mushi-link-btn:focus-visible,.mushi-nav-item:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;border-radius:2px}
|
|
@@ -1926,7 +2017,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1926
2017
|
|
|
1927
2018
|
// src/version.ts
|
|
1928
2019
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
1929
|
-
var MUSHI_SDK_VERSION = "1.
|
|
2020
|
+
var MUSHI_SDK_VERSION = "1.18.0" ;
|
|
1930
2021
|
|
|
1931
2022
|
// src/widget-helpers.ts
|
|
1932
2023
|
var CATEGORY_ICONS = {
|
|
@@ -2129,7 +2220,7 @@ function renderBrandFooter(ctx) {
|
|
|
2129
2220
|
function renderHeader(ctx, opts) {
|
|
2130
2221
|
const t = ctx.locale;
|
|
2131
2222
|
const { title, showBack = false, step, eyebrow } = opts;
|
|
2132
|
-
const eyebrowHtml = showBack ? `<button type="button" class="mushi-back" data-action="back" aria-label="${t.widget.back}">\u2190</button>` : `<span class="mushi-header-eyebrow">${eyebrow ?? "Mushi \xB7 Report"}</span>`;
|
|
2223
|
+
const eyebrowHtml = showBack ? `<button type="button" class="mushi-back" data-action="back" aria-label="${t.widget.back}">\u2190 ${escapeHtml(t.widget.back)}</button>` : `<span class="mushi-header-eyebrow">${eyebrow ?? "Mushi \xB7 Report"}</span>`;
|
|
2133
2224
|
const counterHtml = step ? `<span class="mushi-step-counter" aria-label="Step ${step} of ${TOTAL_STEPS}"><b>${pad2(step)}</b> / ${pad2(TOTAL_STEPS)}</span>` : "";
|
|
2134
2225
|
return `
|
|
2135
2226
|
<div class="mushi-header">
|
|
@@ -2167,16 +2258,28 @@ function renderCategoryStep(ctx) {
|
|
|
2167
2258
|
label: t.step1.categories[id],
|
|
2168
2259
|
desc: t.step1.categoryDescriptions[id]
|
|
2169
2260
|
}));
|
|
2170
|
-
const
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2261
|
+
const renderEntry = ({ id, icon, label, desc }) => `
|
|
2262
|
+
<button type="button" class="mushi-option-btn" data-category="${escapeHtml(id)}" role="radio" aria-checked="false">
|
|
2263
|
+
<span class="mushi-option-icon" aria-hidden="true">${escapeHtml(icon)}</span>
|
|
2264
|
+
<div class="mushi-option-text">
|
|
2265
|
+
<span class="mushi-option-label">${escapeHtml(label)}</span>
|
|
2266
|
+
${desc ? `<span class="mushi-option-desc">${escapeHtml(desc)}</span>` : ""}
|
|
2267
|
+
</div>
|
|
2268
|
+
<span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
|
|
2269
|
+
</button>
|
|
2270
|
+
`;
|
|
2271
|
+
const isCustom = ctx.config.categories && ctx.config.categories.length > 0;
|
|
2272
|
+
const PRIMARY_LIMIT = 1;
|
|
2273
|
+
const primaryEntries = isCustom ? categoryEntries : categoryEntries.slice(0, PRIMARY_LIMIT);
|
|
2274
|
+
const secondaryEntries = isCustom ? [] : categoryEntries.slice(PRIMARY_LIMIT);
|
|
2275
|
+
const hasMore = secondaryEntries.length > 0;
|
|
2276
|
+
const primaryCategories = primaryEntries.map(renderEntry).join("");
|
|
2277
|
+
const secondaryCategories = secondaryEntries.map(renderEntry).join("");
|
|
2278
|
+
const secondaryHtml = hasMore ? ctx.showAllCategories ? `<div class="mushi-categories-expanded">${secondaryCategories}</div>` : `<button type="button" class="mushi-more-toggle" data-action="show-all-categories">
|
|
2279
|
+
<span class="mushi-more-toggle-text">More issue types</span>
|
|
2280
|
+
<span class="mushi-more-toggle-count">${secondaryEntries.length} more</span>
|
|
2281
|
+
<span class="mushi-more-toggle-arrow" aria-hidden="true">\u2192</span>
|
|
2282
|
+
</button>` : "";
|
|
2180
2283
|
return `
|
|
2181
2284
|
${renderHeader(ctx, { title: t.step1.heading, step: STEP_NUMBER.category })}
|
|
2182
2285
|
${ctx.config.betaMode?.enabled ? renderBetaStrip(ctx) : ""}
|
|
@@ -2199,7 +2302,8 @@ function renderCategoryStep(ctx) {
|
|
|
2199
2302
|
</div>
|
|
2200
2303
|
<span class="mushi-option-arrow" aria-hidden="true">\u2192</span>
|
|
2201
2304
|
</button>` : ""}
|
|
2202
|
-
${
|
|
2305
|
+
${primaryCategories}
|
|
2306
|
+
${secondaryHtml}
|
|
2203
2307
|
${ctx.rewardsState ? renderRewardsNudge(ctx) : ""}
|
|
2204
2308
|
<div class="mushi-community-footer">
|
|
2205
2309
|
<button type="button" class="mushi-link-btn mushi-community-btn" data-action="open-account">
|
|
@@ -2586,7 +2690,7 @@ function renderSuccessStep(ctx) {
|
|
|
2586
2690
|
const stamp = ctx.submittedAt ?? /* @__PURE__ */ new Date();
|
|
2587
2691
|
const time = stamp.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false });
|
|
2588
2692
|
return `
|
|
2589
|
-
${renderHeader(ctx, { title: t.widget.title, eyebrow: "Mushi \xB7 Receipt" })}
|
|
2693
|
+
${renderHeader(ctx, { title: t.widget.title, showBack: true, eyebrow: "Mushi \xB7 Receipt" })}
|
|
2590
2694
|
<div class="mushi-body">
|
|
2591
2695
|
<div class="mushi-success">
|
|
2592
2696
|
<div class="mushi-success-stamp" aria-hidden="true">
|
|
@@ -2598,6 +2702,9 @@ function renderSuccessStep(ctx) {
|
|
|
2598
2702
|
${renderSuccessReceipt(ctx)}
|
|
2599
2703
|
${ctx.rewardsState ? renderSuccessRewards(ctx) : ""}
|
|
2600
2704
|
${ctx.config.betaMode?.enabled ? renderBetaSuccessFooter(ctx) : ""}
|
|
2705
|
+
<button type="button" class="mushi-link-btn mushi-success-my-reports" data-action="view-my-reports">
|
|
2706
|
+
\u{1F4EC} Track this report ›
|
|
2707
|
+
</button>
|
|
2601
2708
|
</div>
|
|
2602
2709
|
</div>
|
|
2603
2710
|
`;
|
|
@@ -2798,6 +2905,8 @@ var MushiWidget = class _MushiWidget {
|
|
|
2798
2905
|
* landing on the intent picker the user explicitly skipped.
|
|
2799
2906
|
*/
|
|
2800
2907
|
viaFeatureRequest = false;
|
|
2908
|
+
/** Whether the category list is fully expanded (progressive disclosure). */
|
|
2909
|
+
showAllCategories = false;
|
|
2801
2910
|
screenshotAttached = false;
|
|
2802
2911
|
screenshotCapturing = false;
|
|
2803
2912
|
screenshotError = false;
|
|
@@ -2851,6 +2960,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
2851
2960
|
lastSubmitQueuedOffline = false;
|
|
2852
2961
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
2853
2962
|
bannerDismissed = false;
|
|
2963
|
+
bannerResizeObserver = null;
|
|
2854
2964
|
/** Persisted FAB position when draggable is enabled. */
|
|
2855
2965
|
fabPos = null;
|
|
2856
2966
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
@@ -3004,6 +3114,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3004
3114
|
close() {
|
|
3005
3115
|
if (!this.isOpen) return;
|
|
3006
3116
|
this.isOpen = false;
|
|
3117
|
+
this.showAllCategories = false;
|
|
3007
3118
|
this.render();
|
|
3008
3119
|
this.callbacks.onClose();
|
|
3009
3120
|
}
|
|
@@ -3373,27 +3484,49 @@ var MushiWidget = class _MushiWidget {
|
|
|
3373
3484
|
const action = this.config.environments[this.detectEnvironment()];
|
|
3374
3485
|
return action !== "never" && action !== "manual";
|
|
3375
3486
|
}
|
|
3376
|
-
/** Height of the banner in px —
|
|
3487
|
+
/** Height of the banner in px — used as a fallback before first layout. */
|
|
3377
3488
|
static BANNER_HEIGHT = 36;
|
|
3378
|
-
/** CSS property applied to
|
|
3489
|
+
/** CSS property applied to documentElement so host-app content doesn't slide under the banner. */
|
|
3379
3490
|
static BODY_NUDGE_PROP = "--mushi-banner-offset";
|
|
3380
|
-
applyBodyNudge(position) {
|
|
3381
|
-
const h = `${
|
|
3491
|
+
applyBodyNudge(position, heightPx = _MushiWidget.BANNER_HEIGHT) {
|
|
3492
|
+
const h = `${heightPx}px`;
|
|
3493
|
+
document.documentElement.style.setProperty(_MushiWidget.BODY_NUDGE_PROP, h);
|
|
3382
3494
|
if (position === "top") {
|
|
3383
|
-
document.
|
|
3384
|
-
|
|
3495
|
+
if (document.body.dataset.mushiBannerNudged === "top") {
|
|
3496
|
+
document.body.style.paddingTop = h;
|
|
3497
|
+
} else if (!document.body.style.paddingTop) {
|
|
3385
3498
|
document.body.style.paddingTop = h;
|
|
3386
3499
|
document.body.dataset.mushiBannerNudged = "top";
|
|
3387
3500
|
}
|
|
3388
3501
|
} else {
|
|
3389
|
-
document.
|
|
3390
|
-
|
|
3502
|
+
if (document.body.dataset.mushiBannerNudged === "bottom") {
|
|
3503
|
+
document.body.style.paddingBottom = h;
|
|
3504
|
+
} else if (!document.body.style.paddingBottom) {
|
|
3391
3505
|
document.body.style.paddingBottom = h;
|
|
3392
3506
|
document.body.dataset.mushiBannerNudged = "bottom";
|
|
3393
3507
|
}
|
|
3394
3508
|
}
|
|
3395
3509
|
}
|
|
3510
|
+
/**
|
|
3511
|
+
* Schedule a height measurement after the next paint and set up a ResizeObserver
|
|
3512
|
+
* so --mushi-banner-offset always tracks the actual rendered banner height
|
|
3513
|
+
* (which can exceed BANNER_HEIGHT when safe-area-inset-top is in play on iOS,
|
|
3514
|
+
* or when rich-layout text wraps on narrow viewports).
|
|
3515
|
+
*/
|
|
3516
|
+
trackBannerHeight(banner, position) {
|
|
3517
|
+
const update = () => {
|
|
3518
|
+
const h = banner.getBoundingClientRect().height;
|
|
3519
|
+
if (h > 0) this.applyBodyNudge(position, h);
|
|
3520
|
+
};
|
|
3521
|
+
requestAnimationFrame(update);
|
|
3522
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
3523
|
+
this.bannerResizeObserver = new ResizeObserver(update);
|
|
3524
|
+
this.bannerResizeObserver.observe(banner);
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3396
3527
|
removeBodyNudge() {
|
|
3528
|
+
this.bannerResizeObserver?.disconnect();
|
|
3529
|
+
this.bannerResizeObserver = null;
|
|
3397
3530
|
document.documentElement.style.removeProperty(_MushiWidget.BODY_NUDGE_PROP);
|
|
3398
3531
|
const nudged = document.body.dataset.mushiBannerNudged;
|
|
3399
3532
|
if (nudged === "top") {
|
|
@@ -3502,6 +3635,8 @@ var MushiWidget = class _MushiWidget {
|
|
|
3502
3635
|
}, true);
|
|
3503
3636
|
}
|
|
3504
3637
|
}
|
|
3638
|
+
appendDivider(true);
|
|
3639
|
+
appendAction("\u{1F4EC} My reports", () => this.openReporter(), true);
|
|
3505
3640
|
banner.appendChild(nav);
|
|
3506
3641
|
banner.appendChild(dismissBtn);
|
|
3507
3642
|
} else {
|
|
@@ -3517,10 +3652,17 @@ var MushiWidget = class _MushiWidget {
|
|
|
3517
3652
|
featBtn.addEventListener("click", () => this.open({ featureRequest: true }));
|
|
3518
3653
|
banner.appendChild(featBtn);
|
|
3519
3654
|
}
|
|
3655
|
+
const myReportsBtn = document.createElement("button");
|
|
3656
|
+
myReportsBtn.className = "mushi-banner-my-reports";
|
|
3657
|
+
myReportsBtn.textContent = "\u{1F4EC} My reports";
|
|
3658
|
+
myReportsBtn.setAttribute("aria-label", "View my submitted reports");
|
|
3659
|
+
myReportsBtn.addEventListener("click", () => this.openReporter());
|
|
3660
|
+
banner.appendChild(myReportsBtn);
|
|
3520
3661
|
banner.appendChild(dismissBtn);
|
|
3521
3662
|
}
|
|
3522
3663
|
this.shadow.appendChild(banner);
|
|
3523
3664
|
this.applyBodyNudge(position);
|
|
3665
|
+
this.trackBannerHeight(banner, position);
|
|
3524
3666
|
}
|
|
3525
3667
|
effectiveTrigger() {
|
|
3526
3668
|
if (!this.config.smartHide || typeof window === "undefined") return this.config.trigger;
|
|
@@ -3574,6 +3716,8 @@ var MushiWidget = class _MushiWidget {
|
|
|
3574
3716
|
const theme = this.getTheme();
|
|
3575
3717
|
const pos = this.config.position;
|
|
3576
3718
|
const t = this.locale;
|
|
3719
|
+
this.bannerResizeObserver?.disconnect();
|
|
3720
|
+
this.bannerResizeObserver = null;
|
|
3577
3721
|
this.shadow.innerHTML = "";
|
|
3578
3722
|
const style = document.createElement("style");
|
|
3579
3723
|
style.textContent = getWidgetStyles(theme, this.config.accent ?? "", this.config.accentText ?? "");
|
|
@@ -3977,7 +4121,8 @@ var MushiWidget = class _MushiWidget {
|
|
|
3977
4121
|
categoryIcon: (id) => this.categoryIcon(id),
|
|
3978
4122
|
assistantTurns: this.assistantTurns,
|
|
3979
4123
|
assistantSending: this.assistantSending,
|
|
3980
|
-
assistantError: this.assistantError
|
|
4124
|
+
assistantError: this.assistantError,
|
|
4125
|
+
showAllCategories: this.showAllCategories
|
|
3981
4126
|
};
|
|
3982
4127
|
}
|
|
3983
4128
|
attachHandlers(panel) {
|
|
@@ -4008,9 +4153,22 @@ var MushiWidget = class _MushiWidget {
|
|
|
4008
4153
|
this.step = "category";
|
|
4009
4154
|
} else if (this.step === "assistant") {
|
|
4010
4155
|
this.step = "category";
|
|
4156
|
+
} else if (this.step === "account") {
|
|
4157
|
+
this.step = "category";
|
|
4158
|
+
} else if (this.step === "cross-app-reports") {
|
|
4159
|
+
this.step = "account";
|
|
4160
|
+
} else if (this.step === "success") {
|
|
4161
|
+
this.step = "category";
|
|
4162
|
+
this.selectedCategory = null;
|
|
4163
|
+
this.selectedIntent = null;
|
|
4164
|
+
this.viaFeatureRequest = false;
|
|
4011
4165
|
}
|
|
4012
4166
|
this.render();
|
|
4013
4167
|
});
|
|
4168
|
+
panel.querySelector('[data-action="show-all-categories"]')?.addEventListener("click", () => {
|
|
4169
|
+
this.showAllCategories = true;
|
|
4170
|
+
this.render();
|
|
4171
|
+
});
|
|
4014
4172
|
panel.querySelector('[data-action="assistant"]')?.addEventListener("click", () => {
|
|
4015
4173
|
this.openAssistantTab();
|
|
4016
4174
|
});
|
|
@@ -4127,6 +4285,9 @@ var MushiWidget = class _MushiWidget {
|
|
|
4127
4285
|
panel.querySelector('[data-action="reporter-not-fixed"]')?.addEventListener("click", () => {
|
|
4128
4286
|
void this.submitReporterReopen();
|
|
4129
4287
|
});
|
|
4288
|
+
panel.querySelector('[data-action="view-my-reports"]')?.addEventListener("click", () => {
|
|
4289
|
+
void this.loadReporterReports();
|
|
4290
|
+
});
|
|
4130
4291
|
panel.querySelector('[data-action="copy-report-id"]')?.addEventListener("click", (e) => {
|
|
4131
4292
|
const btn = e.currentTarget;
|
|
4132
4293
|
const id = btn.dataset.copyId;
|
|
@@ -4447,6 +4608,18 @@ var MushiWidget = class _MushiWidget {
|
|
|
4447
4608
|
if (this.isOpen) this.close();
|
|
4448
4609
|
this.open();
|
|
4449
4610
|
}
|
|
4611
|
+
/**
|
|
4612
|
+
* Open the widget directly to the reporter's "My reports" history view.
|
|
4613
|
+
* Can be called from host apps via `sdk.openReporter()` or triggered by
|
|
4614
|
+
* the banner's "My reports" link button.
|
|
4615
|
+
*/
|
|
4616
|
+
openReporter() {
|
|
4617
|
+
if (!this.isOpen) {
|
|
4618
|
+
this.isOpen = true;
|
|
4619
|
+
this.render();
|
|
4620
|
+
}
|
|
4621
|
+
void this.loadReporterReports();
|
|
4622
|
+
}
|
|
4450
4623
|
recorderSelectCategory(category) {
|
|
4451
4624
|
if (!this.isOpen) this.open();
|
|
4452
4625
|
if (this.step !== "category") {
|
|
@@ -5093,19 +5266,26 @@ function createScreenshotCapture(options = {}) {
|
|
|
5093
5266
|
try {
|
|
5094
5267
|
ctx.drawImage(img, 0, 0, width, height);
|
|
5095
5268
|
URL.revokeObjectURL(url);
|
|
5096
|
-
|
|
5269
|
+
const dataUrl = canvas.toDataURL("image/jpeg", 0.7);
|
|
5270
|
+
resolve(dataUrl);
|
|
5097
5271
|
} catch {
|
|
5098
5272
|
URL.revokeObjectURL(url);
|
|
5099
|
-
|
|
5273
|
+
activeOptions.onFailed?.("taint");
|
|
5274
|
+
emitScreenshotFailed("taint");
|
|
5275
|
+
resolve(null);
|
|
5100
5276
|
}
|
|
5101
5277
|
};
|
|
5102
5278
|
img.onerror = () => {
|
|
5103
5279
|
URL.revokeObjectURL(url);
|
|
5104
|
-
|
|
5280
|
+
activeOptions.onFailed?.("error");
|
|
5281
|
+
emitScreenshotFailed("error");
|
|
5282
|
+
resolve(null);
|
|
5105
5283
|
};
|
|
5106
5284
|
img.src = url;
|
|
5107
5285
|
});
|
|
5108
5286
|
} catch {
|
|
5287
|
+
activeOptions.onFailed?.("error");
|
|
5288
|
+
emitScreenshotFailed("error");
|
|
5109
5289
|
return null;
|
|
5110
5290
|
}
|
|
5111
5291
|
}
|
|
@@ -5116,6 +5296,12 @@ function createScreenshotCapture(options = {}) {
|
|
|
5116
5296
|
}
|
|
5117
5297
|
};
|
|
5118
5298
|
}
|
|
5299
|
+
function emitScreenshotFailed(reason) {
|
|
5300
|
+
try {
|
|
5301
|
+
document.dispatchEvent(new CustomEvent("mushi:screenshot_failed", { detail: { reason }, bubbles: false }));
|
|
5302
|
+
} catch {
|
|
5303
|
+
}
|
|
5304
|
+
}
|
|
5119
5305
|
var DEFAULT_REDACT_SELECTORS = [
|
|
5120
5306
|
'input[type="password"]',
|
|
5121
5307
|
"[data-mushi-redact]"
|
|
@@ -5171,10 +5357,28 @@ function stripTaintSources(root) {
|
|
|
5171
5357
|
const href = link.getAttribute("href");
|
|
5172
5358
|
if (!href || isCrossOriginUrl(href, pageOrigin)) link.remove();
|
|
5173
5359
|
}
|
|
5360
|
+
for (const styleEl of root.querySelectorAll("style")) {
|
|
5361
|
+
const cleaned = stripCssUrlRefs(styleEl.textContent ?? "", pageOrigin);
|
|
5362
|
+
if (cleaned !== styleEl.textContent) styleEl.textContent = cleaned;
|
|
5363
|
+
}
|
|
5364
|
+
for (const el of root.querySelectorAll("[style]")) {
|
|
5365
|
+
const s = el.getAttribute("style");
|
|
5366
|
+
if (!s) continue;
|
|
5367
|
+
const cleaned = stripCssUrlRefs(s, pageOrigin);
|
|
5368
|
+
if (cleaned !== s) el.setAttribute("style", cleaned);
|
|
5369
|
+
}
|
|
5174
5370
|
for (const script of root.querySelectorAll("script")) {
|
|
5175
5371
|
script.remove();
|
|
5176
5372
|
}
|
|
5177
5373
|
}
|
|
5374
|
+
function stripCssUrlRefs(css, pageOrigin) {
|
|
5375
|
+
return css.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi, (_match, _q, href) => {
|
|
5376
|
+
const trimmed = href.trim();
|
|
5377
|
+
if (!trimmed || trimmed.startsWith("data:") || trimmed.startsWith("#")) return _match;
|
|
5378
|
+
if (isCrossOriginUrl(trimmed, pageOrigin)) return "none";
|
|
5379
|
+
return _match;
|
|
5380
|
+
});
|
|
5381
|
+
}
|
|
5178
5382
|
function isCrossOriginUrl(raw, pageOrigin) {
|
|
5179
5383
|
if (!raw || raw.startsWith("data:") || raw.startsWith("blob:")) return false;
|
|
5180
5384
|
try {
|
|
@@ -5184,24 +5388,6 @@ function isCrossOriginUrl(raw, pageOrigin) {
|
|
|
5184
5388
|
return true;
|
|
5185
5389
|
}
|
|
5186
5390
|
}
|
|
5187
|
-
function buildDegradedScreenshot(width, height) {
|
|
5188
|
-
const canvas = document.createElement("canvas");
|
|
5189
|
-
const ctx = canvas.getContext("2d");
|
|
5190
|
-
if (!ctx) return null;
|
|
5191
|
-
canvas.width = width;
|
|
5192
|
-
canvas.height = height;
|
|
5193
|
-
ctx.fillStyle = "#111827";
|
|
5194
|
-
ctx.fillRect(0, 0, width, height);
|
|
5195
|
-
ctx.fillStyle = "#e5e7eb";
|
|
5196
|
-
ctx.font = "13px system-ui, sans-serif";
|
|
5197
|
-
ctx.fillText("Screenshot: layout captured (external media stripped)", 16, 28);
|
|
5198
|
-
ctx.fillText(`${width}\xD7${height}px`, 16, 48);
|
|
5199
|
-
try {
|
|
5200
|
-
return canvas.toDataURL("image/jpeg", 0.7);
|
|
5201
|
-
} catch {
|
|
5202
|
-
return null;
|
|
5203
|
-
}
|
|
5204
|
-
}
|
|
5205
5391
|
function maskElement(el) {
|
|
5206
5392
|
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
5207
5393
|
el.value = "";
|
|
@@ -6545,7 +6731,9 @@ function createInstance(config) {
|
|
|
6545
6731
|
projectId: bootstrapConfig.projectId,
|
|
6546
6732
|
apiKey: bootstrapConfig.apiKey,
|
|
6547
6733
|
...bootstrapConfig.apiEndpoint ? { apiEndpoint: bootstrapConfig.apiEndpoint } : {},
|
|
6548
|
-
getUserToken: () => userToken
|
|
6734
|
+
getUserToken: () => userToken,
|
|
6735
|
+
sdkPackage: MUSHI_SDK_PACKAGE,
|
|
6736
|
+
sdkVersion: MUSHI_SDK_VERSION
|
|
6549
6737
|
});
|
|
6550
6738
|
const preFilter = createPreFilter(bootstrapConfig.preFilter);
|
|
6551
6739
|
const offlineQueue = createOfflineQueue(bootstrapConfig.offline);
|
|
@@ -7353,6 +7541,9 @@ function createInstance(config) {
|
|
|
7353
7541
|
setTrigger(trigger) {
|
|
7354
7542
|
widget.setTrigger(trigger);
|
|
7355
7543
|
},
|
|
7544
|
+
openReporter() {
|
|
7545
|
+
widget.openReporter();
|
|
7546
|
+
},
|
|
7356
7547
|
close() {
|
|
7357
7548
|
widget.close();
|
|
7358
7549
|
},
|
|
@@ -7924,6 +8115,8 @@ function createNoopInstance() {
|
|
|
7924
8115
|
},
|
|
7925
8116
|
setTrigger: () => {
|
|
7926
8117
|
},
|
|
8118
|
+
openReporter: () => {
|
|
8119
|
+
},
|
|
7927
8120
|
destroy: () => {
|
|
7928
8121
|
instance = null;
|
|
7929
8122
|
},
|