@mushi-mushi/web 1.25.0 → 1.26.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 +2 -2
- package/dist/i18n/index.cjs +40 -0
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +12 -0
- package/dist/i18n/index.d.ts +12 -0
- package/dist/i18n/index.js +40 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +366 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +367 -77
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +440 -389
- package/dist/mushi.loader.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mushiPalette, resolveWidgetAccent, MUSHI_REPORTER_STATUS, MUSHI_GEOMETRY, MUSHI_Z, MUSHI_MOTION, MUSHI_TYPE, MUSHI_BANNER_BRAND_BORDER, MUSHI_BANNER_NEON, MUSHI_INVERSE, MUSHI_ON_ACCENT, MUSHI_ACCENT_SHADOW, MUSHI_TIER_COLORS, readPageFaviconHref, resolveEnvConfig, diagnoseEnvConfig, validateConfig, expandPreset, createLogger, noopLogger, createApiClient, initSessionTracker, getReporterToken, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, createBreadcrumbBuffer, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, captureEnvironment, getSessionId, newUuid, DEFAULT_API_ENDPOINT,
|
|
1
|
+
import { mushiPalette, resolveWidgetAccent, MUSHI_REPORTER_STATUS, MUSHI_GEOMETRY, MUSHI_Z, MUSHI_MOTION, MUSHI_TYPE, MUSHI_BANNER_BRAND_BORDER, MUSHI_BANNER_NEON, MUSHI_INVERSE, MUSHI_ON_ACCENT, MUSHI_ACCENT_SHADOW, MUSHI_TIER_COLORS, readPageFaviconHref, resolveEnvConfig, diagnoseEnvConfig, validateConfig, expandPreset, createLogger, noopLogger, createApiClient, initSessionTracker, getReporterToken, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, createBreadcrumbBuffer, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, captureEnvironment, getSessionId, newUuid, DEFAULT_API_ENDPOINT, MUSHI_DURATION, MUSHI_SPACING, MUSHI_RADIUS, isLikelyGenericFavicon, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INTERNAL_HEADER, MUSHI_COLORS_LIGHT, parseIdentityToken, updateSessionIdentity, normaliseThrown, destroySessionTracker, resolveProjectDomain, projectInitials, projectFaviconUrlCandidates, sha256Hex } from '@mushi-mushi/core';
|
|
2
2
|
|
|
3
3
|
// src/capture/compress-screenshot.ts
|
|
4
4
|
async function compressScreenshotDataUrl(dataUrl, maxBytes = MAX_SCREENSHOT_DATA_URL_BYTES) {
|
|
@@ -116,6 +116,8 @@ var en = {
|
|
|
116
116
|
sendAriaLabel: "Send",
|
|
117
117
|
hubDescription: "Get help using this app",
|
|
118
118
|
thinking: "Thinking\u2026",
|
|
119
|
+
fileReportCta: "File a report instead",
|
|
120
|
+
stillStuckCta: "Still stuck? File a report",
|
|
119
121
|
errors: {
|
|
120
122
|
noResponse: "No response \u2014 check your connection and try again.",
|
|
121
123
|
generic: "Could not reach the assistant. Try again in a moment."
|
|
@@ -194,6 +196,14 @@ var en = {
|
|
|
194
196
|
delivering: "Delivering to the team\u2026",
|
|
195
197
|
queuedOffline: "Queued offline",
|
|
196
198
|
queuedHint: "We'll send it the moment you're back online.",
|
|
199
|
+
rateLimited: "Sending too fast",
|
|
200
|
+
rateLimitedHint: "Wait about a minute \u2014 we queued this report and will retry automatically.",
|
|
201
|
+
quotaBlocked: "Could not accept this report",
|
|
202
|
+
quotaBlockedHint: "This project's quota or plan blocked the send. Ask the app owner to check Billing.",
|
|
203
|
+
permanentFailed: "Could not send this report",
|
|
204
|
+
permanentFailedHint: "The payload was rejected (often too large). Try again with a shorter note or without a screenshot.",
|
|
205
|
+
retrying: "Queued \u2014 retrying",
|
|
206
|
+
retryingHint: "We could not reach the server just now. We'll keep trying in the background.",
|
|
197
207
|
trackOnMushi: "Track on Mushi",
|
|
198
208
|
slaDefault: "We will review your report.",
|
|
199
209
|
screenshotDropped: "Sent without the screenshot \u2014 it was too large to attach."
|
|
@@ -286,6 +296,8 @@ var ja = {
|
|
|
286
296
|
sendAriaLabel: "\u9001\u4FE1",
|
|
287
297
|
hubDescription: "\u3053\u306E\u30A2\u30D7\u30EA\u306E\u4F7F\u3044\u65B9\u3092\u805E\u304F",
|
|
288
298
|
thinking: "\u8003\u3048\u4E2D\u2026",
|
|
299
|
+
fileReportCta: "\u4EE3\u308F\u308A\u306B\u30D0\u30B0\u3092\u5831\u544A",
|
|
300
|
+
stillStuckCta: "\u89E3\u6C7A\u3057\u306A\u3044\u5834\u5408\u306F\u5831\u544A\u3059\u308B",
|
|
289
301
|
errors: {
|
|
290
302
|
noResponse: "\u5FDC\u7B54\u304C\u3042\u308A\u307E\u305B\u3093 \u2014 \u63A5\u7D9A\u3092\u78BA\u8A8D\u3057\u3066\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
291
303
|
generic: "\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
@@ -364,6 +376,14 @@ var ja = {
|
|
|
364
376
|
delivering: "\u30C1\u30FC\u30E0\u306B\u9001\u4FE1\u4E2D\u2026",
|
|
365
377
|
queuedOffline: "\u30AA\u30D5\u30E9\u30A4\u30F3\u5F85\u6A5F\u4E2D",
|
|
366
378
|
queuedHint: "\u30AA\u30F3\u30E9\u30A4\u30F3\u306B\u623B\u308A\u6B21\u7B2C\u9001\u4FE1\u3057\u307E\u3059\u3002",
|
|
379
|
+
rateLimited: "\u9001\u4FE1\u304C\u65E9\u3059\u304E\u307E\u3059",
|
|
380
|
+
rateLimitedHint: "\u7D041\u5206\u5F85\u3063\u3066\u304F\u3060\u3055\u3044\u3002\u30EC\u30DD\u30FC\u30C8\u306F\u30AD\u30E5\u30FC\u306B\u5165\u308A\u3001\u81EA\u52D5\u3067\u518D\u9001\u3057\u307E\u3059\u3002",
|
|
381
|
+
quotaBlocked: "\u3053\u306E\u30EC\u30DD\u30FC\u30C8\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
382
|
+
quotaBlockedHint: "\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u67A0\u307E\u305F\u306F\u30D7\u30E9\u30F3\u3067\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\u3002\u30A2\u30D7\u30EA\u7BA1\u7406\u8005\u306B Billing \u3092\u78BA\u8A8D\u3057\u3066\u3082\u3089\u3063\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
383
|
+
permanentFailed: "\u30EC\u30DD\u30FC\u30C8\u3092\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
384
|
+
permanentFailedHint: "\u30DA\u30A4\u30ED\u30FC\u30C9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\uFF08\u30B5\u30A4\u30BA\u8D85\u904E\u306A\u3069\uFF09\u3002\u77ED\u3044\u6587\u9762\u304B\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306A\u3057\u3067\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
385
|
+
retrying: "\u30AD\u30E5\u30FC \u2014 \u518D\u8A66\u884C\u4E2D",
|
|
386
|
+
retryingHint: "\u3044\u307E\u30B5\u30FC\u30D0\u30FC\u306B\u5C4A\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u3067\u518D\u9001\u3057\u307E\u3059\u3002",
|
|
367
387
|
trackOnMushi: "Mushi\u3067\u8FFD\u8DE1",
|
|
368
388
|
slaDefault: "\u30EC\u30DD\u30FC\u30C8\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002",
|
|
369
389
|
screenshotDropped: "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306F\u30B5\u30A4\u30BA\u8D85\u904E\u306E\u305F\u3081\u6DFB\u4ED8\u3067\u304D\u305A\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u307F\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002"
|
|
@@ -456,6 +476,8 @@ var th = {
|
|
|
456
476
|
sendAriaLabel: "\u0E2A\u0E48\u0E07",
|
|
457
477
|
hubDescription: "\u0E02\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D\u0E43\u0E19\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E41\u0E2D\u0E1B",
|
|
458
478
|
thinking: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E04\u0E34\u0E14\u2026",
|
|
479
|
+
fileReportCta: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E41\u0E17\u0E19",
|
|
480
|
+
stillStuckCta: "\u0E22\u0E31\u0E07\u0E41\u0E01\u0E49\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49? \u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19",
|
|
459
481
|
errors: {
|
|
460
482
|
noResponse: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E01\u0E32\u0E23\u0E15\u0E2D\u0E1A\u0E01\u0E25\u0E31\u0E1A \u2014 \u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E01\u0E32\u0E23\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D\u0E41\u0E25\u0E49\u0E27\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07",
|
|
461
483
|
generic: "\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E0A\u0E48\u0E27\u0E22\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07\u0E43\u0E19\u0E2D\u0E35\u0E01\u0E2A\u0E31\u0E01\u0E04\u0E23\u0E39\u0E48"
|
|
@@ -534,6 +556,14 @@ var th = {
|
|
|
534
556
|
delivering: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2A\u0E48\u0E07\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E17\u0E35\u0E21\u2026",
|
|
535
557
|
queuedOffline: "\u0E04\u0E34\u0E27\u0E2D\u0E2D\u0E1F\u0E44\u0E25\u0E19\u0E4C",
|
|
536
558
|
queuedHint: "\u0E08\u0E30\u0E2A\u0E48\u0E07\u0E17\u0E31\u0E19\u0E17\u0E35\u0E17\u0E35\u0E48\u0E04\u0E38\u0E13\u0E01\u0E25\u0E31\u0E1A\u0E21\u0E32\u0E2D\u0E2D\u0E19\u0E44\u0E25\u0E19\u0E4C",
|
|
559
|
+
rateLimited: "\u0E2A\u0E48\u0E07\u0E16\u0E35\u0E48\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B",
|
|
560
|
+
rateLimitedHint: "\u0E23\u0E2D\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E19\u0E32\u0E17\u0E35 \u2014 \u0E40\u0E23\u0E32\u0E08\u0E31\u0E14\u0E04\u0E34\u0E27\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E19\u0E35\u0E49\u0E44\u0E27\u0E49\u0E41\u0E25\u0E30\u0E08\u0E30\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E43\u0E2B\u0E49\u0E2D\u0E31\u0E15\u0E42\u0E19\u0E21\u0E31\u0E15\u0E34",
|
|
561
|
+
quotaBlocked: "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E23\u0E31\u0E1A\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E19\u0E35\u0E49\u0E44\u0E14\u0E49",
|
|
562
|
+
quotaBlockedHint: "\u0E42\u0E04\u0E27\u0E15\u0E49\u0E32\u0E2B\u0E23\u0E37\u0E2D\u0E41\u0E1E\u0E25\u0E19\u0E02\u0E2D\u0E07\u0E42\u0E1B\u0E23\u0E40\u0E08\u0E01\u0E15\u0E4C\u0E1A\u0E25\u0E47\u0E2D\u0E01\u0E01\u0E32\u0E23\u0E2A\u0E48\u0E07 \u0E02\u0E2D\u0E43\u0E2B\u0E49\u0E40\u0E08\u0E49\u0E32\u0E02\u0E2D\u0E07\u0E41\u0E2D\u0E1B\u0E15\u0E23\u0E27\u0E08 Billing",
|
|
563
|
+
permanentFailed: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E19\u0E35\u0E49\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49",
|
|
564
|
+
permanentFailedHint: "\u0E40\u0E1E\u0E22\u0E4C\u0E42\u0E2B\u0E25\u0E14\u0E16\u0E39\u0E01\u0E1B\u0E0F\u0E34\u0E40\u0E2A\u0E18 (\u0E21\u0E31\u0E01\u0E40\u0E1E\u0E23\u0E32\u0E30\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B) \u0E25\u0E2D\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E2A\u0E31\u0E49\u0E19\u0E25\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E41\u0E19\u0E1A\u0E20\u0E32\u0E1E\u0E2B\u0E19\u0E49\u0E32\u0E08\u0E2D",
|
|
565
|
+
retrying: "\u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E04\u0E34\u0E27 \u2014 \u0E01\u0E33\u0E25\u0E31\u0E07\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48",
|
|
566
|
+
retryingHint: "\u0E15\u0E2D\u0E19\u0E19\u0E35\u0E49\u0E15\u0E34\u0E14\u0E15\u0E48\u0E2D\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E40\u0E23\u0E32\u0E08\u0E30\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E43\u0E19\u0E1E\u0E37\u0E49\u0E19\u0E2B\u0E25\u0E31\u0E07",
|
|
537
567
|
trackOnMushi: "\u0E15\u0E34\u0E14\u0E15\u0E32\u0E21\u0E1A\u0E19 Mushi",
|
|
538
568
|
slaDefault: "\u0E40\u0E23\u0E32\u0E08\u0E30\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13",
|
|
539
569
|
screenshotDropped: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E42\u0E14\u0E22\u0E44\u0E21\u0E48\u0E21\u0E35\u0E20\u0E32\u0E1E\u0E2B\u0E19\u0E49\u0E32\u0E08\u0E2D \u2014 \u0E44\u0E1F\u0E25\u0E4C\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19\u0E01\u0E27\u0E48\u0E32\u0E08\u0E30\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49"
|
|
@@ -626,6 +656,8 @@ var es = {
|
|
|
626
656
|
sendAriaLabel: "Enviar",
|
|
627
657
|
hubDescription: "Obt\xE9n ayuda para usar esta app",
|
|
628
658
|
thinking: "Pensando\u2026",
|
|
659
|
+
fileReportCta: "Enviar un informe en su lugar",
|
|
660
|
+
stillStuckCta: "\xBFSigues atascado? Env\xEDa un informe",
|
|
629
661
|
errors: {
|
|
630
662
|
noResponse: "Sin respuesta \u2014 revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",
|
|
631
663
|
generic: "No se pudo contactar al asistente. Int\xE9ntalo en un momento."
|
|
@@ -704,6 +736,14 @@ var es = {
|
|
|
704
736
|
delivering: "Enviando al equipo\u2026",
|
|
705
737
|
queuedOffline: "En cola sin conexi\xF3n",
|
|
706
738
|
queuedHint: "Lo enviaremos en cuanto vuelvas a estar en l\xEDnea.",
|
|
739
|
+
rateLimited: "Demasiado r\xE1pido",
|
|
740
|
+
rateLimitedHint: "Espera un minuto \u2014 encolamos el reporte y lo reintentaremos autom\xE1ticamente.",
|
|
741
|
+
quotaBlocked: "No se pudo aceptar este reporte",
|
|
742
|
+
quotaBlockedHint: "La cuota o el plan del proyecto bloque\xF3 el env\xEDo. Pide al due\xF1o que revise Billing.",
|
|
743
|
+
permanentFailed: "No se pudo enviar este reporte",
|
|
744
|
+
permanentFailedHint: "El payload fue rechazado (a menudo por tama\xF1o). Intenta con un texto m\xE1s corto o sin captura.",
|
|
745
|
+
retrying: "En cola \u2014 reintentando",
|
|
746
|
+
retryingHint: "No pudimos llegar al servidor ahora. Seguiremos intentando en segundo plano.",
|
|
707
747
|
trackOnMushi: "Seguir en Mushi",
|
|
708
748
|
slaDefault: "Revisaremos tu reporte.",
|
|
709
749
|
screenshotDropped: "Enviado sin la captura de pantalla \u2014 era demasiado grande para adjuntarla."
|
|
@@ -727,6 +767,14 @@ function getLocale(code) {
|
|
|
727
767
|
function getAvailableLocales() {
|
|
728
768
|
return Object.keys(locales);
|
|
729
769
|
}
|
|
770
|
+
function hexToRgbTriplet(hex) {
|
|
771
|
+
const h = hex.replace("#", "");
|
|
772
|
+
const full = h.length === 3 ? h[0] + h[0] + h[1] + h[1] + h[2] + h[2] : h.slice(0, 6);
|
|
773
|
+
const r = parseInt(full.slice(0, 2), 16);
|
|
774
|
+
const g = parseInt(full.slice(2, 4), 16);
|
|
775
|
+
const b = parseInt(full.slice(4, 6), 16);
|
|
776
|
+
return `${r},${g},${b}`;
|
|
777
|
+
}
|
|
730
778
|
function getWidgetThemeVars(theme, accent = "", accentText = "") {
|
|
731
779
|
const isDark = theme === "dark";
|
|
732
780
|
const mode = isDark ? "dark" : "light";
|
|
@@ -747,6 +795,8 @@ function getWidgetThemeVars(theme, accent = "", accentText = "") {
|
|
|
747
795
|
widgetAccentWash: accentResolved.accentWash,
|
|
748
796
|
widgetAccentInk: accentResolved.accentInk,
|
|
749
797
|
widgetAccentShadow: isDark ? MUSHI_ACCENT_SHADOW.dark : MUSHI_ACCENT_SHADOW.light,
|
|
798
|
+
accentRgb: hexToRgbTriplet(accentResolved.accent),
|
|
799
|
+
shadowInk: isDark ? "0,0,0" : "14,13,11",
|
|
750
800
|
ok: pal.ok,
|
|
751
801
|
danger: pal.danger,
|
|
752
802
|
onAccent: MUSHI_ON_ACCENT,
|
|
@@ -806,6 +856,8 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
806
856
|
widgetAccentWash,
|
|
807
857
|
widgetAccentInk,
|
|
808
858
|
widgetAccentShadow,
|
|
859
|
+
accentRgb,
|
|
860
|
+
shadowInk,
|
|
809
861
|
ok,
|
|
810
862
|
danger,
|
|
811
863
|
onAccent,
|
|
@@ -826,12 +878,31 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
826
878
|
zBanner,
|
|
827
879
|
fabSize
|
|
828
880
|
} = v;
|
|
829
|
-
const { sizeBody, lineBody } = MUSHI_TYPE;
|
|
881
|
+
const { sizeBody, sizeLabel, lineBody } = MUSHI_TYPE;
|
|
830
882
|
const { durationFast } = MUSHI_MOTION;
|
|
883
|
+
const {
|
|
884
|
+
instant: durInstant,
|
|
885
|
+
fast: durFast,
|
|
886
|
+
base: durBase,
|
|
887
|
+
panel: durPanel,
|
|
888
|
+
slow: durSlow,
|
|
889
|
+
ring: durRing
|
|
890
|
+
} = MUSHI_DURATION;
|
|
831
891
|
const { bannerHeight, gutter, panelWidth, panelMaxHeight, panelSheetBreakpoint, edgeTabWidth } = MUSHI_GEOMETRY;
|
|
832
|
-
const panelLauncherGap = fabSize +
|
|
892
|
+
const panelLauncherGap = fabSize + MUSHI_SPACING.comfy;
|
|
833
893
|
const { base: zBase } = MUSHI_Z;
|
|
834
894
|
const controlRadius = MUSHI_RADIUS.control;
|
|
895
|
+
const cardRadius = MUSHI_RADIUS.card;
|
|
896
|
+
const {
|
|
897
|
+
tight: spaceTight,
|
|
898
|
+
snug: spaceSnug,
|
|
899
|
+
comfy: spaceComfy,
|
|
900
|
+
roomy: spaceRoomy,
|
|
901
|
+
lounge: spaceLounge,
|
|
902
|
+
open: spaceOpen,
|
|
903
|
+
wide: spaceWide
|
|
904
|
+
} = MUSHI_SPACING;
|
|
905
|
+
const touchMin = 44;
|
|
835
906
|
return `
|
|
836
907
|
:host {
|
|
837
908
|
all: initial;
|
|
@@ -843,6 +914,23 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
843
914
|
-moz-osx-font-smoothing: grayscale;
|
|
844
915
|
font-feature-settings: 'ss01', 'cv11'; /* nicer system-ui glyphs where supported */
|
|
845
916
|
--mushi-ok: ${ok};
|
|
917
|
+
/* Spacing + radius scales (MUSHI_SPACING / MUSHI_RADIUS) \u2014 prefer these
|
|
918
|
+
over literal px so web + RN stay aligned with brand.tokens.json. */
|
|
919
|
+
--mushi-space-tight: ${spaceTight}px;
|
|
920
|
+
--mushi-space-snug: ${spaceSnug}px;
|
|
921
|
+
--mushi-space-comfy: ${spaceComfy}px;
|
|
922
|
+
--mushi-space-roomy: ${spaceRoomy}px;
|
|
923
|
+
--mushi-space-lounge: ${spaceLounge}px;
|
|
924
|
+
--mushi-space-open: ${spaceOpen}px;
|
|
925
|
+
--mushi-space-wide: ${spaceWide}px;
|
|
926
|
+
--mushi-radius-control: ${controlRadius}px;
|
|
927
|
+
--mushi-radius-card: ${cardRadius}px;
|
|
928
|
+
--mushi-touch-min: ${touchMin}px;
|
|
929
|
+
/* Derived channel vars \u2014 accent RGB triplet + shadow-ink triplet.
|
|
930
|
+
Lets Shadow-DOM CSS compose rgba() values that respect host-accent
|
|
931
|
+
overrides and dark-mode ink without repeating the hex guard. */
|
|
932
|
+
--mushi-accent-rgb: ${accentRgb};
|
|
933
|
+
--mushi-shadow-ink: ${shadowInk};
|
|
846
934
|
/* SDK contract: the host element is always pass-through. Only the
|
|
847
935
|
interactive surfaces (.mushi-trigger, .mushi-banner, .mushi-panel)
|
|
848
936
|
opt back into pointer events so the widget never creates an
|
|
@@ -862,6 +950,8 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
862
950
|
position: fixed;
|
|
863
951
|
width: ${fabSize}px;
|
|
864
952
|
height: ${fabSize}px;
|
|
953
|
+
min-width: var(--mushi-touch-min);
|
|
954
|
+
min-height: var(--mushi-touch-min);
|
|
865
955
|
border: 1px solid ${ruleStrong};
|
|
866
956
|
border-radius: ${controlRadius}px;
|
|
867
957
|
background: ${paper};
|
|
@@ -875,9 +965,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
875
965
|
line-height: 1;
|
|
876
966
|
box-shadow:
|
|
877
967
|
0 1px 0 ${rule},
|
|
878
|
-
0 6px 14px -8px rgba(
|
|
968
|
+
0 6px 14px -8px rgba(${shadowInk},0.35),
|
|
879
969
|
inset 0 -3px 0 ${widgetAccent};
|
|
880
|
-
transition: transform ${durationFast}ms ${easeStamp},
|
|
970
|
+
transition: transform ${durationFast}ms ${easeStamp}, opacity ${durationFast}ms ${easeStamp};
|
|
881
971
|
overflow: visible;
|
|
882
972
|
isolation: isolate;
|
|
883
973
|
}
|
|
@@ -897,14 +987,15 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
897
987
|
transform: translateY(-2px) rotate(-1.5deg);
|
|
898
988
|
box-shadow:
|
|
899
989
|
0 1px 0 ${rule},
|
|
900
|
-
0 14px 24px -10px rgba(
|
|
990
|
+
0 14px 24px -10px rgba(${shadowInk},0.45),
|
|
991
|
+
0 0 20px -6px rgba(${accentRgb},0.22),
|
|
901
992
|
inset 0 -3px 0 ${widgetAccent};
|
|
902
993
|
}
|
|
903
994
|
.mushi-trigger:active {
|
|
904
995
|
transform: translateY(0) rotate(0);
|
|
905
996
|
box-shadow:
|
|
906
997
|
0 1px 0 ${rule},
|
|
907
|
-
0 2px 4px -2px rgba(
|
|
998
|
+
0 2px 4px -2px rgba(${shadowInk},0.35),
|
|
908
999
|
inset 0 -2px 0 ${widgetAccent};
|
|
909
1000
|
}
|
|
910
1001
|
.mushi-trigger:focus-visible {
|
|
@@ -916,9 +1007,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
916
1007
|
can compose with the hover transform without fighting it. Respects
|
|
917
1008
|
prefers-reduced-motion. */
|
|
918
1009
|
@keyframes mushi-trigger-pulse {
|
|
919
|
-
0% { box-shadow: 0 0 0 0 rgba(
|
|
920
|
-
70% { box-shadow: 0 0 0 16px rgba(
|
|
921
|
-
100% { box-shadow: 0 0 0 0 rgba(
|
|
1010
|
+
0% { box-shadow: 0 0 0 0 rgba(${accentRgb},0.55), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
|
|
1011
|
+
70% { box-shadow: 0 0 0 16px rgba(${accentRgb},0), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
|
|
1012
|
+
100% { box-shadow: 0 0 0 0 rgba(${accentRgb},0), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
|
|
922
1013
|
}
|
|
923
1014
|
.mushi-trigger-pulse {
|
|
924
1015
|
animation: mushi-trigger-pulse 800ms ${easeStamp} 3;
|
|
@@ -945,13 +1036,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
945
1036
|
.mushi-trigger.edge-tab {
|
|
946
1037
|
width: ${edgeTabWidth}px;
|
|
947
1038
|
height: 88px;
|
|
948
|
-
border-radius:
|
|
1039
|
+
border-radius: ${controlRadius}px 0 0 ${controlRadius}px;
|
|
949
1040
|
writing-mode: vertical-rl;
|
|
950
1041
|
text-orientation: upright;
|
|
951
1042
|
font-size: 16px;
|
|
952
1043
|
box-shadow:
|
|
953
1044
|
0 1px 0 ${rule},
|
|
954
|
-
0 10px 24px -14px rgba(
|
|
1045
|
+
0 10px 24px -14px rgba(${shadowInk},0.45),
|
|
955
1046
|
inset -3px 0 0 ${widgetAccent};
|
|
956
1047
|
}
|
|
957
1048
|
.mushi-trigger.edge-tab.bottom-right,
|
|
@@ -961,10 +1052,10 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
961
1052
|
.mushi-trigger.edge-tab.bottom-left,
|
|
962
1053
|
.mushi-trigger.edge-tab.top-left {
|
|
963
1054
|
left: var(--mushi-left, 0);
|
|
964
|
-
border-radius: 0
|
|
1055
|
+
border-radius: 0 ${controlRadius}px ${controlRadius}px 0;
|
|
965
1056
|
box-shadow:
|
|
966
1057
|
0 1px 0 ${rule},
|
|
967
|
-
0 10px 24px -14px rgba(
|
|
1058
|
+
0 10px 24px -14px rgba(${shadowInk},0.45),
|
|
968
1059
|
inset 3px 0 0 ${widgetAccent};
|
|
969
1060
|
}
|
|
970
1061
|
.mushi-trigger.shrunk {
|
|
@@ -993,7 +1084,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
993
1084
|
transition: none !important;
|
|
994
1085
|
box-shadow:
|
|
995
1086
|
0 1px 0 ${rule},
|
|
996
|
-
0 20px 40px -12px rgba(
|
|
1087
|
+
0 20px 40px -12px rgba(${shadowInk},0.55),
|
|
997
1088
|
inset 0 -3px 0 ${widgetAccent};
|
|
998
1089
|
opacity: 0.92;
|
|
999
1090
|
}
|
|
@@ -1017,13 +1108,14 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1017
1108
|
border-radius: 6px;
|
|
1018
1109
|
box-shadow:
|
|
1019
1110
|
0 1px 0 ${rule},
|
|
1020
|
-
0 24px 56px -20px rgba(
|
|
1021
|
-
0 8px 16px -8px rgba(
|
|
1111
|
+
0 24px 56px -20px rgba(${shadowInk},0.30),
|
|
1112
|
+
0 8px 16px -8px rgba(${shadowInk},0.20);
|
|
1022
1113
|
overflow: hidden;
|
|
1023
1114
|
display: flex;
|
|
1024
1115
|
flex-direction: column;
|
|
1025
1116
|
transform-origin: var(--mushi-origin, bottom right);
|
|
1026
|
-
|
|
1117
|
+
/* Keyboard inset \u2014 layout exception (IME), not decorative (docs/MOTION.md) */
|
|
1118
|
+
transition: bottom ${durInstant}ms ease, top ${durInstant}ms ease, max-height ${durInstant}ms ease;
|
|
1027
1119
|
}
|
|
1028
1120
|
/* Keyboard-safe: on narrow viewports lift above the keyboard */
|
|
1029
1121
|
.mushi-panel.keyboard-open {
|
|
@@ -1044,7 +1136,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1044
1136
|
bottom: calc(var(--mushi-keyboard-inset, 0px) + 4px) !important;
|
|
1045
1137
|
}
|
|
1046
1138
|
}
|
|
1047
|
-
.mushi-panel.open { animation: mushi-stamp-in
|
|
1139
|
+
.mushi-panel.open { animation: mushi-stamp-in ${durPanel}ms ${easeStamp} both; }
|
|
1048
1140
|
.mushi-panel.closed { display: none; }
|
|
1049
1141
|
.mushi-panel.bottom-right {
|
|
1050
1142
|
bottom: var(--mushi-panel-bottom, calc(var(--mushi-bottom, ${gutter}px) + ${panelLauncherGap}px));
|
|
@@ -1170,7 +1262,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1170
1262
|
font-size: 16px;
|
|
1171
1263
|
line-height: 1;
|
|
1172
1264
|
border-radius: 0;
|
|
1173
|
-
transition:
|
|
1265
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
1174
1266
|
}
|
|
1175
1267
|
.mushi-back {
|
|
1176
1268
|
align-self: flex-start;
|
|
@@ -1191,7 +1283,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1191
1283
|
display: inline-flex;
|
|
1192
1284
|
align-items: center;
|
|
1193
1285
|
gap: 4px;
|
|
1194
|
-
transition:
|
|
1286
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
1195
1287
|
white-space: nowrap;
|
|
1196
1288
|
}
|
|
1197
1289
|
.mushi-close:hover { color: ${widgetAccent}; }
|
|
@@ -1225,24 +1317,29 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1225
1317
|
display: grid;
|
|
1226
1318
|
grid-template-columns: auto 1fr auto;
|
|
1227
1319
|
align-items: center;
|
|
1228
|
-
gap:
|
|
1320
|
+
gap: ${spaceComfy}px;
|
|
1229
1321
|
width: 100%;
|
|
1230
|
-
|
|
1322
|
+
min-height: var(--mushi-touch-min);
|
|
1323
|
+
padding: ${spaceComfy}px 0;
|
|
1231
1324
|
border: none;
|
|
1232
1325
|
border-bottom: 1px solid ${rule};
|
|
1233
1326
|
background: transparent;
|
|
1234
1327
|
cursor: pointer;
|
|
1235
1328
|
color: inherit;
|
|
1236
1329
|
text-align: left;
|
|
1237
|
-
transition:
|
|
1330
|
+
transition: transform ${durBase}ms ${easeStamp}, opacity ${durBase}ms ${easeStamp};
|
|
1238
1331
|
position: relative;
|
|
1239
1332
|
}
|
|
1240
1333
|
.mushi-option-btn:last-child { border-bottom: none; }
|
|
1241
|
-
.mushi-option-btn:hover {
|
|
1334
|
+
.mushi-option-btn:hover {
|
|
1335
|
+
transform: translateX(6px);
|
|
1336
|
+
color: ${widgetAccent};
|
|
1337
|
+
background: linear-gradient(90deg, rgba(${accentRgb},0.07), transparent 55%);
|
|
1338
|
+
}
|
|
1242
1339
|
.mushi-option-btn:hover .mushi-option-arrow { opacity: 1; transform: translateX(0); color: ${widgetAccent}; }
|
|
1243
1340
|
.mushi-option-btn:focus-visible {
|
|
1244
1341
|
outline: none;
|
|
1245
|
-
|
|
1342
|
+
transform: translateX(6px);
|
|
1246
1343
|
box-shadow: inset 2px 0 0 ${widgetAccent};
|
|
1247
1344
|
}
|
|
1248
1345
|
.mushi-option-icon {
|
|
@@ -1270,7 +1367,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1270
1367
|
color: ${inkFaint};
|
|
1271
1368
|
opacity: 0;
|
|
1272
1369
|
transform: translateX(-4px);
|
|
1273
|
-
transition: opacity
|
|
1370
|
+
transition: opacity ${durBase}ms ${easeStamp}, transform ${durBase}ms ${easeStamp};
|
|
1274
1371
|
}
|
|
1275
1372
|
/* Feature-request and Reports-inbox entries sit above the five
|
|
1276
1373
|
category cards as discoverable shortcuts. We give them a subtle
|
|
@@ -1281,7 +1378,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1281
1378
|
.mushi-reports-entry {
|
|
1282
1379
|
padding-left: 10px;
|
|
1283
1380
|
border-left: 2px solid ${inkFaint};
|
|
1284
|
-
transition:
|
|
1381
|
+
transition: opacity ${durBase}ms ${easeStamp}, transform ${durBase}ms ${easeStamp};
|
|
1285
1382
|
}
|
|
1286
1383
|
.mushi-feature-entry:hover,
|
|
1287
1384
|
.mushi-reports-entry:hover {
|
|
@@ -1304,7 +1401,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1304
1401
|
color: ${ink};
|
|
1305
1402
|
cursor: pointer;
|
|
1306
1403
|
text-align: left;
|
|
1307
|
-
transition:
|
|
1404
|
+
transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
|
|
1308
1405
|
}
|
|
1309
1406
|
.mushi-report-row:hover,
|
|
1310
1407
|
.mushi-report-row:focus-visible {
|
|
@@ -1391,7 +1488,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1391
1488
|
font-size: 18px;
|
|
1392
1489
|
line-height: 1;
|
|
1393
1490
|
color: ${inkFaint};
|
|
1394
|
-
transition:
|
|
1491
|
+
transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
|
|
1395
1492
|
}
|
|
1396
1493
|
.mushi-report-row:hover .mushi-report-chevron,
|
|
1397
1494
|
.mushi-report-row:focus-visible .mushi-report-chevron {
|
|
@@ -1481,7 +1578,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1481
1578
|
font-family: ${fontBody};
|
|
1482
1579
|
font-size: 11px;
|
|
1483
1580
|
cursor: pointer;
|
|
1484
|
-
transition:
|
|
1581
|
+
transition: opacity ${durInstant}ms ${easeStamp}, transform ${durInstant}ms ${easeStamp};
|
|
1485
1582
|
white-space: nowrap;
|
|
1486
1583
|
}
|
|
1487
1584
|
.mushi-example-chip:hover {
|
|
@@ -1507,7 +1604,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1507
1604
|
letter-spacing: 0.04em;
|
|
1508
1605
|
color: ${inkFaint};
|
|
1509
1606
|
pointer-events: none;
|
|
1510
|
-
transition:
|
|
1607
|
+
transition: opacity ${durFast}ms ${easeStamp};
|
|
1511
1608
|
}
|
|
1512
1609
|
|
|
1513
1610
|
.mushi-textarea {
|
|
@@ -1523,7 +1620,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1523
1620
|
line-height: 1.5;
|
|
1524
1621
|
resize: vertical;
|
|
1525
1622
|
outline: none;
|
|
1526
|
-
transition:
|
|
1623
|
+
transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
|
|
1527
1624
|
}
|
|
1528
1625
|
.mushi-textarea::placeholder {
|
|
1529
1626
|
color: ${inkFaint};
|
|
@@ -1551,7 +1648,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1551
1648
|
letter-spacing: 0.04em;
|
|
1552
1649
|
text-transform: uppercase;
|
|
1553
1650
|
cursor: pointer;
|
|
1554
|
-
transition:
|
|
1651
|
+
transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
|
|
1555
1652
|
}
|
|
1556
1653
|
.mushi-attach-btn:hover {
|
|
1557
1654
|
color: ${ink};
|
|
@@ -1645,7 +1742,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1645
1742
|
border: 1.5px solid currentColor;
|
|
1646
1743
|
border-top-color: transparent;
|
|
1647
1744
|
border-radius: 50%;
|
|
1648
|
-
animation: mushi-spin
|
|
1745
|
+
animation: mushi-spin ${durRing}ms linear infinite;
|
|
1649
1746
|
}
|
|
1650
1747
|
|
|
1651
1748
|
.mushi-footer {
|
|
@@ -1667,19 +1764,20 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1667
1764
|
position: relative;
|
|
1668
1765
|
display: inline-flex;
|
|
1669
1766
|
align-items: center;
|
|
1670
|
-
gap:
|
|
1671
|
-
|
|
1767
|
+
gap: ${spaceSnug}px;
|
|
1768
|
+
min-height: var(--mushi-touch-min);
|
|
1769
|
+
padding: ${spaceComfy}px ${spaceLounge}px;
|
|
1672
1770
|
border: 1px solid ${widgetAccent};
|
|
1673
|
-
border-radius:
|
|
1674
|
-
background: ${widgetAccent};
|
|
1771
|
+
border-radius: ${controlRadius}px;
|
|
1772
|
+
background: linear-gradient(160deg, ${widgetAccent} 0%, ${widgetAccentShadow} 100%);
|
|
1675
1773
|
color: ${onAccent};
|
|
1676
1774
|
font-family: ${fontMono};
|
|
1677
|
-
font-size:
|
|
1775
|
+
font-size: ${sizeLabel}px;
|
|
1678
1776
|
letter-spacing: 0.16em;
|
|
1679
1777
|
text-transform: uppercase;
|
|
1680
1778
|
cursor: pointer;
|
|
1681
1779
|
overflow: hidden;
|
|
1682
|
-
transition: transform
|
|
1780
|
+
transition: transform ${durFast}ms ${easeStamp}, opacity ${durFast}ms ${easeStamp};
|
|
1683
1781
|
box-shadow: 0 2px 0 ${widgetAccentShadow};
|
|
1684
1782
|
}
|
|
1685
1783
|
.mushi-submit::after {
|
|
@@ -1689,12 +1787,15 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1689
1787
|
background: radial-gradient(circle at center, rgba(255,255,255,0.35) 0%, transparent 60%);
|
|
1690
1788
|
opacity: 0;
|
|
1691
1789
|
transform: scale(0.4);
|
|
1692
|
-
transition: opacity
|
|
1790
|
+
transition: opacity ${durPanel}ms ${easeStamp}, transform ${durSlow}ms ${easeStamp};
|
|
1693
1791
|
pointer-events: none;
|
|
1694
1792
|
}
|
|
1695
1793
|
.mushi-submit:hover {
|
|
1696
1794
|
transform: translateY(-1px);
|
|
1697
|
-
box-shadow:
|
|
1795
|
+
box-shadow:
|
|
1796
|
+
0 3px 0 ${widgetAccentShadow},
|
|
1797
|
+
0 0 0 3px rgba(${accentRgb},0.18),
|
|
1798
|
+
0 4px 16px -4px rgba(${accentRgb},0.35);
|
|
1698
1799
|
}
|
|
1699
1800
|
.mushi-submit:hover::after { opacity: 1; transform: scale(1.4); }
|
|
1700
1801
|
.mushi-submit:active { transform: translateY(1px); box-shadow: 0 1px 0 ${widgetAccentShadow}; }
|
|
@@ -1708,7 +1809,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1708
1809
|
}
|
|
1709
1810
|
.mushi-submit-arrow {
|
|
1710
1811
|
display: inline-block;
|
|
1711
|
-
transition: transform
|
|
1812
|
+
transition: transform ${durBase}ms ${easeStamp};
|
|
1712
1813
|
}
|
|
1713
1814
|
.mushi-submit:hover .mushi-submit-arrow { transform: translateX(3px); }
|
|
1714
1815
|
|
|
@@ -1738,7 +1839,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1738
1839
|
display: inline-flex;
|
|
1739
1840
|
align-items: baseline;
|
|
1740
1841
|
gap: 4px;
|
|
1741
|
-
transition:
|
|
1842
|
+
transition: opacity ${durFast}ms ${easeStamp};
|
|
1742
1843
|
}
|
|
1743
1844
|
.mushi-step-num.done { color: ${inkMuted}; text-decoration: line-through; text-decoration-color: ${inkFaint}; }
|
|
1744
1845
|
.mushi-step-num.active {
|
|
@@ -1778,6 +1879,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1778
1879
|
transform: rotate(-90deg);
|
|
1779
1880
|
transform-origin: center;
|
|
1780
1881
|
animation: mushi-stamp-ring 700ms ${easeStamp} 80ms forwards;
|
|
1882
|
+
filter: drop-shadow(0 0 6px rgba(${accentRgb},0.5));
|
|
1781
1883
|
}
|
|
1782
1884
|
.mushi-success-stamp-label {
|
|
1783
1885
|
font-family: ${fontDisplay};
|
|
@@ -1846,11 +1948,11 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1846
1948
|
font-size: 12px;
|
|
1847
1949
|
letter-spacing: 0.02em;
|
|
1848
1950
|
cursor: pointer;
|
|
1849
|
-
transition:
|
|
1951
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
1850
1952
|
}
|
|
1851
1953
|
.mushi-success-receipt-id:hover,
|
|
1852
1954
|
.mushi-success-receipt-id:focus-visible {
|
|
1853
|
-
background: rgba(
|
|
1955
|
+
background: rgba(${accentRgb},0.06);
|
|
1854
1956
|
border-color: ${widgetAccent};
|
|
1855
1957
|
color: ${widgetAccent};
|
|
1856
1958
|
outline: none;
|
|
@@ -1873,7 +1975,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1873
1975
|
letter-spacing: 0.10em;
|
|
1874
1976
|
text-transform: uppercase;
|
|
1875
1977
|
text-decoration: none;
|
|
1876
|
-
transition: filter
|
|
1978
|
+
transition: filter ${durInstant}ms ease;
|
|
1877
1979
|
}
|
|
1878
1980
|
.mushi-success-receipt-track:hover,
|
|
1879
1981
|
.mushi-success-receipt-track:focus-visible {
|
|
@@ -1991,9 +2093,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1991
2093
|
}
|
|
1992
2094
|
.mushi-tier-bar-fill {
|
|
1993
2095
|
height: 100%;
|
|
2096
|
+
width: 100%;
|
|
1994
2097
|
background: ${widgetAccent};
|
|
1995
2098
|
border-radius: 2px;
|
|
1996
|
-
|
|
2099
|
+
/* Meter fill \u2014 scaleX keeps compositor-friendly motion (docs/MOTION.md). */
|
|
2100
|
+
transform-origin: left center;
|
|
2101
|
+
transform: scaleX(var(--mushi-tier-pct, 0));
|
|
2102
|
+
transition: transform ${durSlow}ms ${easeStamp};
|
|
1997
2103
|
}
|
|
1998
2104
|
.mushi-rewards-next-label {
|
|
1999
2105
|
font-family: ${fontMono};
|
|
@@ -2019,7 +2125,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2019
2125
|
letter-spacing: 0.06em;
|
|
2020
2126
|
margin-bottom: 10px;
|
|
2021
2127
|
opacity: 0;
|
|
2022
|
-
animation: mushi-pts-pop
|
|
2128
|
+
animation: mushi-pts-pop ${durSlow}ms ${easeStamp} 900ms forwards;
|
|
2023
2129
|
}
|
|
2024
2130
|
.success-bar { margin: 0 0 5px; }
|
|
2025
2131
|
|
|
@@ -2038,7 +2144,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2038
2144
|
margin: 0 16px 2px;
|
|
2039
2145
|
padding: 9px 12px;
|
|
2040
2146
|
background: ${widgetAccentWash};
|
|
2041
|
-
border: 1px solid ${isDark ? "
|
|
2147
|
+
border: 1px solid rgba(${accentRgb},${isDark ? "0.22" : "0.16"});
|
|
2042
2148
|
border-radius: 4px;
|
|
2043
2149
|
display: flex;
|
|
2044
2150
|
flex-direction: column;
|
|
@@ -2117,7 +2223,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2117
2223
|
content: '\u25B6';
|
|
2118
2224
|
font-size: 7px;
|
|
2119
2225
|
opacity: 0.6;
|
|
2120
|
-
transition: transform
|
|
2226
|
+
transition: transform ${durInstant}ms ${easeStamp};
|
|
2121
2227
|
}
|
|
2122
2228
|
|
|
2123
2229
|
.mushi-changelog[open] .mushi-changelog-summary::before {
|
|
@@ -2145,7 +2251,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2145
2251
|
margin-top: 14px;
|
|
2146
2252
|
padding: 10px 14px;
|
|
2147
2253
|
background: ${widgetAccentWash};
|
|
2148
|
-
border: 1px solid ${isDark ? "
|
|
2254
|
+
border: 1px solid rgba(${accentRgb},${isDark ? "0.18" : "0.14"});
|
|
2149
2255
|
border-radius: 4px;
|
|
2150
2256
|
display: flex;
|
|
2151
2257
|
flex-direction: column;
|
|
@@ -2188,7 +2294,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2188
2294
|
white-space: nowrap;
|
|
2189
2295
|
overflow: hidden;
|
|
2190
2296
|
z-index: var(--mushi-banner-z, ${zBanner});
|
|
2191
|
-
animation: mushi-banner-slide-in
|
|
2297
|
+
animation: mushi-banner-slide-in ${durPanel}ms ${easeStamp} both;
|
|
2192
2298
|
}
|
|
2193
2299
|
|
|
2194
2300
|
.mushi-banner.top { top: 0; padding-top: env(safe-area-inset-top, 0px); }
|
|
@@ -2345,7 +2451,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2345
2451
|
letter-spacing: inherit;
|
|
2346
2452
|
text-decoration: none;
|
|
2347
2453
|
opacity: 0.88;
|
|
2348
|
-
transition: opacity
|
|
2454
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
2349
2455
|
flex-shrink: 0;
|
|
2350
2456
|
}
|
|
2351
2457
|
.mushi-banner-link:hover { opacity: 1; }
|
|
@@ -2373,7 +2479,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2373
2479
|
cursor: pointer;
|
|
2374
2480
|
font: inherit;
|
|
2375
2481
|
letter-spacing: inherit;
|
|
2376
|
-
transition:
|
|
2482
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
2377
2483
|
flex-shrink: 0;
|
|
2378
2484
|
height: 24px;
|
|
2379
2485
|
line-height: 1;
|
|
@@ -2395,7 +2501,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2395
2501
|
flex-shrink: 0;
|
|
2396
2502
|
color: inherit;
|
|
2397
2503
|
border-radius: 3px;
|
|
2398
|
-
transition: opacity
|
|
2504
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
2399
2505
|
}
|
|
2400
2506
|
.mushi-banner-dismiss:hover {
|
|
2401
2507
|
opacity: 1;
|
|
@@ -2416,7 +2522,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2416
2522
|
border-radius: 3px;
|
|
2417
2523
|
white-space: nowrap;
|
|
2418
2524
|
flex-shrink: 0;
|
|
2419
|
-
transition: opacity
|
|
2525
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
2420
2526
|
margin-left: 4px;
|
|
2421
2527
|
}
|
|
2422
2528
|
.mushi-banner-my-reports:hover {
|
|
@@ -2478,7 +2584,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2478
2584
|
font-family: ${fontBody};
|
|
2479
2585
|
font-size: 13px;
|
|
2480
2586
|
text-align: left;
|
|
2481
|
-
transition:
|
|
2587
|
+
transition: opacity ${durFast}ms ${easeStamp};
|
|
2482
2588
|
}
|
|
2483
2589
|
.mushi-more-toggle:hover { color: ${widgetAccent}; }
|
|
2484
2590
|
.mushi-more-toggle:hover .mushi-more-toggle-arrow { transform: translateX(3px); }
|
|
@@ -2496,7 +2602,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2496
2602
|
.mushi-more-toggle-arrow {
|
|
2497
2603
|
font-size: 14px;
|
|
2498
2604
|
opacity: 0.5;
|
|
2499
|
-
transition: transform
|
|
2605
|
+
transition: transform ${durFast}ms ${easeStamp};
|
|
2500
2606
|
}
|
|
2501
2607
|
/* \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 */
|
|
2502
2608
|
@keyframes mushi-step-in {
|
|
@@ -2511,12 +2617,12 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2511
2617
|
}
|
|
2512
2618
|
/* Expanded secondary categories animate in */
|
|
2513
2619
|
.mushi-categories-expanded {
|
|
2514
|
-
animation: mushi-step-in
|
|
2620
|
+
animation: mushi-step-in ${durFast}ms ${easeStamp} both;
|
|
2515
2621
|
}
|
|
2516
2622
|
.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}
|
|
2517
2623
|
.mushi-link-btn:hover{opacity:0.8}
|
|
2518
2624
|
.mushi-link-btn:focus-visible,.mushi-nav-item:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;border-radius:2px}
|
|
2519
|
-
.mushi-nav-item{display:block;width:100%;text-align:left;background:${isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.04)"};border:1px solid ${isDark ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"};border-radius:8px;padding:10px 14px;margin-bottom:8px;cursor:pointer;font-size:13px;color:${ink};transition:
|
|
2625
|
+
.mushi-nav-item{display:block;width:100%;text-align:left;background:${isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.04)"};border:1px solid ${isDark ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"};border-radius:8px;padding:10px 14px;margin-bottom:8px;cursor:pointer;font-size:13px;color:${ink};transition:opacity ${durInstant}ms ${easeStamp}}
|
|
2520
2626
|
.mushi-nav-item:hover{background:${isDark ? "rgba(255,255,255,0.09)" : "rgba(0,0,0,0.07)"}}
|
|
2521
2627
|
.mushi-account-card{display:flex;align-items:center;gap:12px;background:${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.04)"};border-radius:10px;padding:12px 14px;margin-bottom:14px}
|
|
2522
2628
|
.mushi-account-avatar{width:40px;height:40px;border-radius:50%;background:${widgetAccentWash};color:${widgetAccentInk};display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:700;flex-shrink:0}
|
|
@@ -2539,14 +2645,22 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2539
2645
|
.mushi-assistant-log{flex:1;min-height:120px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;padding:4px 2px 8px}
|
|
2540
2646
|
.mushi-assistant-greeting{font:400 14px/1.5 ${fontBody};color:${inkMuted};padding:6px 2px}
|
|
2541
2647
|
.mushi-assistant-suggestions{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
|
|
2542
|
-
.mushi-assistant-chip{background:${widgetAccentWash};color:${widgetAccentInk};border:1px solid ${ruleStrong};border-radius:999px;padding:5px 12px;font-size:12px;cursor:pointer;font-family:${fontBody};transition:
|
|
2543
|
-
.mushi-assistant-chip:hover{background
|
|
2648
|
+
.mushi-assistant-chip{background:${widgetAccentWash};color:${widgetAccentInk};border:1px solid ${ruleStrong};border-radius:999px;padding:5px 12px;font-size:12px;cursor:pointer;font-family:${fontBody};transition:opacity ${durInstant}ms ${easeStamp},transform ${durInstant}ms ${easeStamp}}
|
|
2649
|
+
.mushi-assistant-chip:hover{background:rgba(${accentRgb},${isDark ? "0.22" : "0.14"})}
|
|
2544
2650
|
.mushi-assistant-chip:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
|
|
2545
2651
|
.mushi-assistant-msg{max-width:85%;padding:8px 12px;border-radius:12px;font:400 14px/1.45 ${fontBody};white-space:pre-wrap;word-break:break-word}
|
|
2546
2652
|
.mushi-assistant-msg-user{align-self:flex-end;background:${widgetAccent};color:${inverse};border-bottom-right-radius:4px}
|
|
2547
2653
|
.mushi-assistant-msg-bot{align-self:flex-start;background:${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.05)"};color:${ink};border-bottom-left-radius:4px}
|
|
2548
2654
|
.mushi-assistant-thinking{opacity:0.6;font-size:18px;letter-spacing:2px}
|
|
2549
|
-
.mushi-assistant-error{align-self:flex-start;color:${danger};font-size:12px;padding:4px 2px}
|
|
2655
|
+
.mushi-assistant-error{align-self:flex-start;color:${danger};font-size:12px;padding:4px 2px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}
|
|
2656
|
+
.mushi-assistant-recovery{display:flex;flex-wrap:wrap;gap:6px;margin-top:2px}
|
|
2657
|
+
.mushi-assistant-recovery-footer{margin-top:4px;padding-top:4px}
|
|
2658
|
+
.mushi-assistant-report-cta{background:${widgetAccent};color:${inverse};border:none;border-radius:999px;padding:6px 14px;font-size:12px;cursor:pointer;font-family:${fontBody};font-weight:600}
|
|
2659
|
+
.mushi-assistant-report-cta:hover{opacity:0.92}
|
|
2660
|
+
.mushi-assistant-report-cta:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
|
|
2661
|
+
.mushi-assistant-report-link{background:transparent;color:${widgetAccentInk};border:none;padding:0;font-size:12px;cursor:pointer;font-family:${fontBody};text-decoration:underline;text-underline-offset:2px}
|
|
2662
|
+
.mushi-assistant-report-link:hover{opacity:0.85}
|
|
2663
|
+
.mushi-assistant-report-link:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
|
|
2550
2664
|
.mushi-assistant-form{display:flex;align-items:flex-end;gap:8px;border-top:1px solid ${rule};padding-top:8px}
|
|
2551
2665
|
.mushi-assistant-input{flex:1;resize:none;max-height:120px;border:1px solid ${ruleStrong};border-radius:10px;padding:8px 12px;font:400 14px/1.4 ${fontBody};background:${paper};color:${ink}}
|
|
2552
2666
|
.mushi-assistant-input:focus-visible{outline:2px solid ${widgetAccent};outline-offset:1px}
|
|
@@ -2559,7 +2673,56 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2559
2673
|
|
|
2560
2674
|
// src/version.ts
|
|
2561
2675
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
2562
|
-
var MUSHI_SDK_VERSION = "1.
|
|
2676
|
+
var MUSHI_SDK_VERSION = "1.26.0" ;
|
|
2677
|
+
var ASSISTANT_SESSION_STORAGE_KEY = "mushi-assistant-session-v1";
|
|
2678
|
+
function loadAssistantSession() {
|
|
2679
|
+
try {
|
|
2680
|
+
if (typeof sessionStorage === "undefined") return null;
|
|
2681
|
+
const raw = sessionStorage.getItem(ASSISTANT_SESSION_STORAGE_KEY);
|
|
2682
|
+
if (!raw) return null;
|
|
2683
|
+
const parsed = JSON.parse(raw);
|
|
2684
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
2685
|
+
const record = parsed;
|
|
2686
|
+
const turns = Array.isArray(record.turns) ? record.turns : null;
|
|
2687
|
+
if (!turns) return null;
|
|
2688
|
+
const normalized = [];
|
|
2689
|
+
for (const item of turns) {
|
|
2690
|
+
if (!item || typeof item !== "object") continue;
|
|
2691
|
+
const t = item;
|
|
2692
|
+
if (t.role !== "user" && t.role !== "assistant") continue;
|
|
2693
|
+
if (typeof t.text !== "string") continue;
|
|
2694
|
+
const turn = { role: t.role, text: t.text };
|
|
2695
|
+
if (Array.isArray(t.options)) {
|
|
2696
|
+
const options = t.options.filter((o) => typeof o === "string");
|
|
2697
|
+
if (options.length) turn.options = options;
|
|
2698
|
+
}
|
|
2699
|
+
if (t.offerReport === true) turn.offerReport = true;
|
|
2700
|
+
normalized.push(turn);
|
|
2701
|
+
}
|
|
2702
|
+
const threadId = typeof record.threadId === "string" && record.threadId.length > 0 ? record.threadId : null;
|
|
2703
|
+
return { turns: normalized, threadId };
|
|
2704
|
+
} catch {
|
|
2705
|
+
return null;
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
function saveAssistantSession(snapshot) {
|
|
2709
|
+
try {
|
|
2710
|
+
if (typeof sessionStorage === "undefined") return;
|
|
2711
|
+
if (!snapshot.turns.length && !snapshot.threadId) {
|
|
2712
|
+
sessionStorage.removeItem(ASSISTANT_SESSION_STORAGE_KEY);
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2715
|
+
sessionStorage.setItem(ASSISTANT_SESSION_STORAGE_KEY, JSON.stringify(snapshot));
|
|
2716
|
+
} catch {
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
function clearAssistantSession() {
|
|
2720
|
+
try {
|
|
2721
|
+
if (typeof sessionStorage === "undefined") return;
|
|
2722
|
+
sessionStorage.removeItem(ASSISTANT_SESSION_STORAGE_KEY);
|
|
2723
|
+
} catch {
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2563
2726
|
var CATEGORY_ICONS = {
|
|
2564
2727
|
bug: "\u26A0\uFE0F",
|
|
2565
2728
|
slow: "\u{1F40C}",
|
|
@@ -2767,10 +2930,18 @@ function renderAssistantStep(ctx) {
|
|
|
2767
2930
|
${suggestions.length ? `<div class="mushi-assistant-suggestions">${suggestions.map((s) => `<button type="button" class="mushi-assistant-chip" data-action="assistant-suggest" data-value="${escapeHtml(s)}">${escapeHtml(s)}</button>`).join("")}</div>` : ""}` : ctx.assistantTurns.map((turn) => {
|
|
2768
2931
|
const cls = turn.role === "user" ? "mushi-assistant-msg-user" : "mushi-assistant-msg-bot";
|
|
2769
2932
|
const opts = turn.options && turn.options.length ? `<div class="mushi-assistant-suggestions">${turn.options.map((o) => `<button type="button" class="mushi-assistant-chip" data-action="assistant-suggest" data-value="${escapeHtml(o)}">${escapeHtml(o)}</button>`).join("")}</div>` : "";
|
|
2770
|
-
|
|
2933
|
+
const reportCta = turn.offerReport ? `<div class="mushi-assistant-recovery">
|
|
2934
|
+
<button type="button" class="mushi-assistant-report-cta" data-action="assistant-report">${escapeHtml(t.assistant.fileReportCta)}</button>
|
|
2935
|
+
</div>` : "";
|
|
2936
|
+
return `<div class="mushi-assistant-msg ${cls}">${escapeHtml(turn.text)}</div>${opts}${reportCta}`;
|
|
2771
2937
|
}).join("");
|
|
2772
2938
|
const thinking = ctx.assistantSending ? `<div class="mushi-assistant-msg mushi-assistant-msg-bot mushi-assistant-thinking" role="status" aria-live="polite">${escapeHtml(t.assistant.thinking)}</div>` : "";
|
|
2773
|
-
const error = ctx.assistantError ? `<div class="mushi-assistant-error" role="alert">${escapeHtml(ctx.assistantError)}
|
|
2939
|
+
const error = ctx.assistantError ? `<div class="mushi-assistant-error" role="alert">${escapeHtml(ctx.assistantError)}
|
|
2940
|
+
<button type="button" class="mushi-assistant-report-cta" data-action="assistant-report">${escapeHtml(t.assistant.fileReportCta)}</button>
|
|
2941
|
+
</div>` : "";
|
|
2942
|
+
const stillStuck = !empty && !ctx.assistantSending && !ctx.assistantError ? `<div class="mushi-assistant-recovery mushi-assistant-recovery-footer">
|
|
2943
|
+
<button type="button" class="mushi-assistant-report-link" data-action="assistant-report">${escapeHtml(t.assistant.stillStuckCta)}</button>
|
|
2944
|
+
</div>` : "";
|
|
2774
2945
|
return `
|
|
2775
2946
|
${renderHeader(ctx, { title: label, showBack: true })}
|
|
2776
2947
|
<div class="mushi-assistant">
|
|
@@ -2778,6 +2949,7 @@ function renderAssistantStep(ctx) {
|
|
|
2778
2949
|
${transcript}
|
|
2779
2950
|
${thinking}
|
|
2780
2951
|
${error}
|
|
2952
|
+
${stillStuck}
|
|
2781
2953
|
</div>
|
|
2782
2954
|
<form class="mushi-assistant-form" data-action="assistant-send">
|
|
2783
2955
|
<textarea
|
|
@@ -3305,6 +3477,7 @@ function renderDetailsStep(ctx) {
|
|
|
3305
3477
|
class="mushi-textarea"
|
|
3306
3478
|
placeholder="${escapeHtml(t.step3.descriptionPlaceholder)}"
|
|
3307
3479
|
rows="4"
|
|
3480
|
+
maxlength="4000"
|
|
3308
3481
|
aria-label="${escapeHtml(t.step3.heading)}"
|
|
3309
3482
|
autofocus
|
|
3310
3483
|
></textarea>
|
|
@@ -3374,12 +3547,15 @@ function renderSuccessStep(ctx) {
|
|
|
3374
3547
|
}
|
|
3375
3548
|
function renderSuccessReceipt(ctx) {
|
|
3376
3549
|
const s = ctx.locale.flows.success;
|
|
3377
|
-
|
|
3550
|
+
const failureKind = ctx.lastSubmitFailureKind;
|
|
3551
|
+
if (failureKind === "rate_limited" || failureKind === "quota" || failureKind === "permanent" || failureKind === "retrying" || ctx.lastSubmitQueuedOffline) {
|
|
3552
|
+
const label = failureKind === "rate_limited" ? s.rateLimited : failureKind === "quota" ? s.quotaBlocked : failureKind === "permanent" ? s.permanentFailed : failureKind === "retrying" ? s.retrying : s.queuedOffline;
|
|
3553
|
+
const hint = failureKind === "rate_limited" ? s.rateLimitedHint : failureKind === "quota" ? s.quotaBlockedHint : failureKind === "permanent" ? s.permanentFailedHint : failureKind === "retrying" ? s.retryingHint : s.queuedHint;
|
|
3378
3554
|
return `
|
|
3379
3555
|
<div class="mushi-success-receipt" role="status">
|
|
3380
3556
|
<div class="mushi-success-receipt-row mushi-success-receipt-warn">
|
|
3381
|
-
<span class="mushi-success-receipt-label">${escapeHtml(
|
|
3382
|
-
<span class="mushi-success-receipt-hint">${escapeHtml(
|
|
3557
|
+
<span class="mushi-success-receipt-label">${escapeHtml(label)}</span>
|
|
3558
|
+
<span class="mushi-success-receipt-hint">${escapeHtml(hint)}</span>
|
|
3383
3559
|
</div>
|
|
3384
3560
|
</div>
|
|
3385
3561
|
`;
|
|
@@ -3470,7 +3646,7 @@ function renderRewardsNudge(ctx) {
|
|
|
3470
3646
|
</div>
|
|
3471
3647
|
${nextTier ? `
|
|
3472
3648
|
<div class="mushi-tier-bar-track" role="progressbar" aria-valuenow="${pct}" aria-valuemin="0" aria-valuemax="100" aria-label="Progress to ${escapeHtml(nextTier.displayName)}">
|
|
3473
|
-
<div class="mushi-tier-bar-fill" style="
|
|
3649
|
+
<div class="mushi-tier-bar-fill" style="--mushi-tier-pct:${pct / 100}"></div>
|
|
3474
3650
|
</div>
|
|
3475
3651
|
<div class="mushi-rewards-next-label">${nextLabel}</div>
|
|
3476
3652
|
` : ""}
|
|
@@ -3494,7 +3670,7 @@ function renderSuccessRewards(ctx) {
|
|
|
3494
3670
|
<div class="mushi-success-pts-award">+${pointsForReport} pts</div>
|
|
3495
3671
|
${nextTier ? `
|
|
3496
3672
|
<div class="mushi-tier-bar-track success-bar" role="progressbar" aria-valuenow="${pctAfter}" aria-valuemin="0" aria-valuemax="100" aria-label="Progress to ${escapeHtml(nextTier.displayName)}">
|
|
3497
|
-
<div class="mushi-tier-bar-fill" style="
|
|
3673
|
+
<div class="mushi-tier-bar-fill" style="--mushi-tier-pct:${pctAfter / 100}"></div>
|
|
3498
3674
|
</div>
|
|
3499
3675
|
<div class="mushi-rewards-next-label">${nextLabel}</div>
|
|
3500
3676
|
` : ""}
|
|
@@ -3503,6 +3679,12 @@ function renderSuccessRewards(ctx) {
|
|
|
3503
3679
|
}
|
|
3504
3680
|
|
|
3505
3681
|
// src/widget.ts
|
|
3682
|
+
function looksUnsureAssistantAnswer(text) {
|
|
3683
|
+
const lower = text.toLowerCase();
|
|
3684
|
+
return /i('m| am) not sure|i don't know|not sure|cannot help|can't help|unable to|don't have enough|outside (my|of) (scope|knowledge)|file a (bug )?report|報告/.test(
|
|
3685
|
+
lower
|
|
3686
|
+
) || /わかりません|分かりません|不明|報告して/.test(text);
|
|
3687
|
+
}
|
|
3506
3688
|
var MushiWidget = class _MushiWidget {
|
|
3507
3689
|
constructor(config = {}, callbacks, sdkVersion = MUSHI_SDK_VERSION) {
|
|
3508
3690
|
this.sdkVersion = sdkVersion;
|
|
@@ -3549,6 +3731,11 @@ var MushiWidget = class _MushiWidget {
|
|
|
3549
3731
|
};
|
|
3550
3732
|
this.callbacks = callbacks;
|
|
3551
3733
|
this.locale = getLocale(this.config.locale === "auto" ? void 0 : this.config.locale);
|
|
3734
|
+
const saved = loadAssistantSession();
|
|
3735
|
+
if (saved?.turns.length) {
|
|
3736
|
+
this.assistantTurns = saved.turns;
|
|
3737
|
+
this.assistantThreadId = saved.threadId;
|
|
3738
|
+
}
|
|
3552
3739
|
this.host = document.createElement("div");
|
|
3553
3740
|
this.host.id = "mushi-mushi-widget";
|
|
3554
3741
|
this.shadow = this.host.attachShadow({ mode: "open" });
|
|
@@ -3556,6 +3743,9 @@ var MushiWidget = class _MushiWidget {
|
|
|
3556
3743
|
sdkVersion;
|
|
3557
3744
|
host;
|
|
3558
3745
|
shadow;
|
|
3746
|
+
/** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
|
|
3747
|
+
colorSchemeMq = null;
|
|
3748
|
+
onColorSchemeChange = null;
|
|
3559
3749
|
config;
|
|
3560
3750
|
callbacks;
|
|
3561
3751
|
locale;
|
|
@@ -3654,6 +3844,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3654
3844
|
* Drives a different success copy so the user knows the report
|
|
3655
3845
|
* hasn't actually reached the console yet. */
|
|
3656
3846
|
lastSubmitQueuedOffline = false;
|
|
3847
|
+
lastSubmitFailureKind;
|
|
3657
3848
|
lastSubmitScreenshotDropped = false;
|
|
3658
3849
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
3659
3850
|
bannerDismissed = false;
|
|
@@ -3698,6 +3889,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3698
3889
|
document.body.appendChild(this.host);
|
|
3699
3890
|
this.syncAttachedLaunchers();
|
|
3700
3891
|
this.syncSmartHide();
|
|
3892
|
+
this.bindColorSchemeListener();
|
|
3701
3893
|
this.render();
|
|
3702
3894
|
this.mountedAt = Date.now();
|
|
3703
3895
|
}
|
|
@@ -3798,6 +3990,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3798
3990
|
this.removeSelectorHint();
|
|
3799
3991
|
this.lastReportId = null;
|
|
3800
3992
|
this.lastSubmitQueuedOffline = false;
|
|
3993
|
+
this.lastSubmitFailureKind = void 0;
|
|
3801
3994
|
this.lastSubmitScreenshotDropped = false;
|
|
3802
3995
|
this.viaFeatureRequest = false;
|
|
3803
3996
|
this.clearFormDrafts();
|
|
@@ -3859,6 +4052,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3859
4052
|
this.assistantSending = true;
|
|
3860
4053
|
this.assistantError = null;
|
|
3861
4054
|
this.assistantTurns.push({ role: "user", text });
|
|
4055
|
+
this.persistAssistantSession();
|
|
3862
4056
|
this.render();
|
|
3863
4057
|
try {
|
|
3864
4058
|
const reply = await this.callbacks.onAssistantAsk(text, this.assistantThreadId);
|
|
@@ -3868,11 +4062,19 @@ var MushiWidget = class _MushiWidget {
|
|
|
3868
4062
|
this.assistantTurns.push({
|
|
3869
4063
|
role: "assistant",
|
|
3870
4064
|
text: reply.question ?? "Could you tell me a bit more?",
|
|
3871
|
-
...reply.options && reply.options.length ? { options: reply.options } : {}
|
|
4065
|
+
...reply.options && reply.options.length ? { options: reply.options } : {},
|
|
4066
|
+
offerReport: true
|
|
3872
4067
|
});
|
|
3873
4068
|
} else {
|
|
3874
|
-
|
|
4069
|
+
const answerText = reply.text ?? "\u2026";
|
|
4070
|
+
const unsure = looksUnsureAssistantAnswer(answerText);
|
|
4071
|
+
this.assistantTurns.push({
|
|
4072
|
+
role: "assistant",
|
|
4073
|
+
text: answerText,
|
|
4074
|
+
...unsure ? { offerReport: true } : {}
|
|
4075
|
+
});
|
|
3875
4076
|
}
|
|
4077
|
+
this.persistAssistantSession();
|
|
3876
4078
|
} else {
|
|
3877
4079
|
this.assistantError = this.locale.assistant.errors.noResponse;
|
|
3878
4080
|
}
|
|
@@ -3887,6 +4089,33 @@ var MushiWidget = class _MushiWidget {
|
|
|
3887
4089
|
}, 0);
|
|
3888
4090
|
}
|
|
3889
4091
|
}
|
|
4092
|
+
/** Persist Ask turns for same-tab reload survival (UX only). */
|
|
4093
|
+
persistAssistantSession() {
|
|
4094
|
+
saveAssistantSession({
|
|
4095
|
+
turns: this.assistantTurns,
|
|
4096
|
+
threadId: this.assistantThreadId
|
|
4097
|
+
});
|
|
4098
|
+
}
|
|
4099
|
+
/** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
|
|
4100
|
+
clearAssistantTranscript() {
|
|
4101
|
+
this.assistantTurns = [];
|
|
4102
|
+
this.assistantThreadId = null;
|
|
4103
|
+
this.assistantError = null;
|
|
4104
|
+
clearAssistantSession();
|
|
4105
|
+
if (this.step === "assistant") this.render();
|
|
4106
|
+
}
|
|
4107
|
+
/** Escape hatch from Ask → report category picker (no login required). */
|
|
4108
|
+
openReportFromAssistant() {
|
|
4109
|
+
this.selectedCategory = null;
|
|
4110
|
+
this.selectedIntent = null;
|
|
4111
|
+
this.viaFeatureRequest = false;
|
|
4112
|
+
this.step = "category";
|
|
4113
|
+
if (!this.isOpen) {
|
|
4114
|
+
this.isOpen = true;
|
|
4115
|
+
this.callbacks.onOpen();
|
|
4116
|
+
}
|
|
4117
|
+
this.render();
|
|
4118
|
+
}
|
|
3890
4119
|
/**
|
|
3891
4120
|
* Briefly highlight the trigger button (a soft pulse + tooltip) without
|
|
3892
4121
|
* opening the full reporter panel. Use for first-session welcome nudges
|
|
@@ -4136,6 +4365,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4136
4365
|
clearTimeout(this.smartHideTimer);
|
|
4137
4366
|
this.smartHideTimer = null;
|
|
4138
4367
|
}
|
|
4368
|
+
this.unbindColorSchemeListener();
|
|
4139
4369
|
this.smartHideCleanup?.();
|
|
4140
4370
|
this.smartHideCleanup = null;
|
|
4141
4371
|
this.teardownViewportHandlers();
|
|
@@ -4146,6 +4376,33 @@ var MushiWidget = class _MushiWidget {
|
|
|
4146
4376
|
this.removeBodyNudge();
|
|
4147
4377
|
this.host.remove();
|
|
4148
4378
|
}
|
|
4379
|
+
/** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
|
|
4380
|
+
bindColorSchemeListener() {
|
|
4381
|
+
this.unbindColorSchemeListener();
|
|
4382
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
4383
|
+
const theme = this.config.theme;
|
|
4384
|
+
if (theme !== "auto" && theme !== "inherit") return;
|
|
4385
|
+
this.colorSchemeMq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
4386
|
+
this.onColorSchemeChange = () => {
|
|
4387
|
+
if (this.host.isConnected) this.render();
|
|
4388
|
+
};
|
|
4389
|
+
if (typeof this.colorSchemeMq.addEventListener === "function") {
|
|
4390
|
+
this.colorSchemeMq.addEventListener("change", this.onColorSchemeChange);
|
|
4391
|
+
} else if (typeof this.colorSchemeMq.addListener === "function") {
|
|
4392
|
+
this.colorSchemeMq.addListener(this.onColorSchemeChange);
|
|
4393
|
+
}
|
|
4394
|
+
}
|
|
4395
|
+
unbindColorSchemeListener() {
|
|
4396
|
+
if (this.colorSchemeMq && this.onColorSchemeChange) {
|
|
4397
|
+
if (typeof this.colorSchemeMq.removeEventListener === "function") {
|
|
4398
|
+
this.colorSchemeMq.removeEventListener("change", this.onColorSchemeChange);
|
|
4399
|
+
} else if (typeof this.colorSchemeMq.removeListener === "function") {
|
|
4400
|
+
this.colorSchemeMq.removeListener(this.onColorSchemeChange);
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
this.colorSchemeMq = null;
|
|
4404
|
+
this.onColorSchemeChange = null;
|
|
4405
|
+
}
|
|
4149
4406
|
/* ── Host chrome contract ────────────────────────────────────────────────
|
|
4150
4407
|
The host element must never create an invisible full-screen touch blocker.
|
|
4151
4408
|
We own these inline styles — consumer CSS can only win with `!important`,
|
|
@@ -4931,6 +5188,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4931
5188
|
leaderboardLoading: this.leaderboardLoading,
|
|
4932
5189
|
leaderboardEntries: this.leaderboardEntries,
|
|
4933
5190
|
lastSubmitQueuedOffline: this.lastSubmitQueuedOffline,
|
|
5191
|
+
lastSubmitFailureKind: this.lastSubmitFailureKind,
|
|
4934
5192
|
lastSubmitScreenshotDropped: this.lastSubmitScreenshotDropped,
|
|
4935
5193
|
featureBoard: this.featureBoard,
|
|
4936
5194
|
crossAppReports: this.crossAppReports,
|
|
@@ -5011,6 +5269,11 @@ var MushiWidget = class _MushiWidget {
|
|
|
5011
5269
|
if (value) void this.sendAssistantMessage(value);
|
|
5012
5270
|
});
|
|
5013
5271
|
});
|
|
5272
|
+
panel.querySelectorAll('[data-action="assistant-report"]').forEach((btn) => {
|
|
5273
|
+
btn.addEventListener("click", () => {
|
|
5274
|
+
this.openReportFromAssistant();
|
|
5275
|
+
});
|
|
5276
|
+
});
|
|
5014
5277
|
{
|
|
5015
5278
|
const form = panel.querySelector('[data-action="assistant-send"]');
|
|
5016
5279
|
if (form) {
|
|
@@ -5215,6 +5478,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5215
5478
|
this.submittedAt = /* @__PURE__ */ new Date();
|
|
5216
5479
|
this.lastReportId = null;
|
|
5217
5480
|
this.lastSubmitQueuedOffline = false;
|
|
5481
|
+
this.lastSubmitFailureKind = void 0;
|
|
5218
5482
|
this.lastSubmitScreenshotDropped = false;
|
|
5219
5483
|
this.render();
|
|
5220
5484
|
const outcomeP = (async () => {
|
|
@@ -5248,6 +5512,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5248
5512
|
if (outcome) {
|
|
5249
5513
|
this.lastReportId = outcome.reportId ?? null;
|
|
5250
5514
|
this.lastSubmitQueuedOffline = Boolean(outcome.queuedOffline);
|
|
5515
|
+
this.lastSubmitFailureKind = outcome.failureKind;
|
|
5251
5516
|
this.lastSubmitScreenshotDropped = Boolean(outcome.screenshotDropped);
|
|
5252
5517
|
this.render();
|
|
5253
5518
|
}
|
|
@@ -8696,7 +8961,7 @@ function createInstance(config) {
|
|
|
8696
8961
|
await offlineQueue.enqueue(finalReport);
|
|
8697
8962
|
log.info("Offline \u2014 report queued", { reportId: finalReport.id });
|
|
8698
8963
|
emit("report:queued", { reportId: finalReport.id });
|
|
8699
|
-
return { reportId: null, queuedOffline: true };
|
|
8964
|
+
return { reportId: null, queuedOffline: true, failureKind: "offline" };
|
|
8700
8965
|
}
|
|
8701
8966
|
let result = await apiClient2.submitReport(finalReport);
|
|
8702
8967
|
if (!result.ok && result.error?.code === "PAYLOAD_TOO_LARGE") {
|
|
@@ -8750,7 +9015,32 @@ function createInstance(config) {
|
|
|
8750
9015
|
level: "error",
|
|
8751
9016
|
message: `Mushi report dropped \u2014 payload too large (${finalReport.id})`
|
|
8752
9017
|
});
|
|
9018
|
+
pendingScreenshot = null;
|
|
9019
|
+
pendingElement = null;
|
|
9020
|
+
pendingProactiveTrigger = null;
|
|
9021
|
+
return { reportId: null, queuedOffline: false, failureKind: "permanent", screenshotDropped };
|
|
8753
9022
|
} else {
|
|
9023
|
+
const code = result.error?.code ?? "";
|
|
9024
|
+
const isRateLimited = code === "HTTP_429" || code.includes("RATE_LIMIT");
|
|
9025
|
+
const isAuth = code === "HTTP_401" || code.includes("UNAUTHORIZED") || code.includes("INVALID_API_KEY") || code.includes("MISSING_API_KEY");
|
|
9026
|
+
const isQuota = code === "HTTP_403" || code.includes("QUOTA") || code.includes("FORBIDDEN") || code === "feature_not_in_plan";
|
|
9027
|
+
if (isAuth || isQuota) {
|
|
9028
|
+
log.warn("Report rejected \u2014 credentials/quota", { reportId: finalReport.id, error: result.error });
|
|
9029
|
+
emit("report:failed", { reportId: finalReport.id, error: result.error });
|
|
9030
|
+
pendingScreenshot = null;
|
|
9031
|
+
pendingElement = null;
|
|
9032
|
+
pendingProactiveTrigger = null;
|
|
9033
|
+
return { reportId: null, queuedOffline: false, failureKind: "quota" };
|
|
9034
|
+
}
|
|
9035
|
+
if (isRateLimited) {
|
|
9036
|
+
log.warn("Report rate-limited \u2014 queued for retry", { reportId: finalReport.id, error: result.error });
|
|
9037
|
+
await offlineQueue.enqueue(finalReport);
|
|
9038
|
+
emit("report:failed", { reportId: finalReport.id, error: result.error });
|
|
9039
|
+
pendingScreenshot = null;
|
|
9040
|
+
pendingElement = null;
|
|
9041
|
+
pendingProactiveTrigger = null;
|
|
9042
|
+
return { reportId: null, queuedOffline: true, failureKind: "rate_limited" };
|
|
9043
|
+
}
|
|
8754
9044
|
log.warn("Report failed, queuing for retry", { reportId: finalReport.id, error: result.error });
|
|
8755
9045
|
await offlineQueue.enqueue(finalReport);
|
|
8756
9046
|
emit("report:failed", { reportId: finalReport.id, error: result.error });
|
|
@@ -8767,7 +9057,7 @@ function createInstance(config) {
|
|
|
8767
9057
|
const serverId = result.data?.reportId ?? report.id;
|
|
8768
9058
|
return { reportId: serverId, queuedOffline: false, screenshotDropped };
|
|
8769
9059
|
}
|
|
8770
|
-
return { reportId: null, queuedOffline: true };
|
|
9060
|
+
return { reportId: null, queuedOffline: true, failureKind: "retrying" };
|
|
8771
9061
|
}
|
|
8772
9062
|
const sdk = {
|
|
8773
9063
|
report(options) {
|