@mushi-mushi/web 1.25.0 → 1.27.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/SECURITY.md +49 -0
- package/dist/headless.cjs +1206 -0
- package/dist/headless.cjs.map +1 -0
- package/dist/headless.d.cts +88 -0
- package/dist/headless.d.ts +88 -0
- package/dist/headless.js +1194 -0
- package/dist/headless.js.map +1 -0
- 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 +593 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -62
- package/dist/index.d.ts +53 -62
- package/dist/index.js +594 -150
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +333 -282
- package/dist/mushi.loader.global.js.map +1 -1
- package/dist/otel.cjs +60 -0
- package/dist/otel.cjs.map +1 -0
- package/dist/otel.d.cts +80 -0
- package/dist/otel.d.ts +80 -0
- package/dist/otel.js +58 -0
- package/dist/otel.js.map +1 -0
- package/dist/timeline-BuqAn2FH.d.cts +63 -0
- package/dist/timeline-BuqAn2FH.d.ts +63 -0
- package/package.json +27 -5
package/dist/index.cjs
CHANGED
|
@@ -118,6 +118,8 @@ var en = {
|
|
|
118
118
|
sendAriaLabel: "Send",
|
|
119
119
|
hubDescription: "Get help using this app",
|
|
120
120
|
thinking: "Thinking\u2026",
|
|
121
|
+
fileReportCta: "File a report instead",
|
|
122
|
+
stillStuckCta: "Still stuck? File a report",
|
|
121
123
|
errors: {
|
|
122
124
|
noResponse: "No response \u2014 check your connection and try again.",
|
|
123
125
|
generic: "Could not reach the assistant. Try again in a moment."
|
|
@@ -196,6 +198,14 @@ var en = {
|
|
|
196
198
|
delivering: "Delivering to the team\u2026",
|
|
197
199
|
queuedOffline: "Queued offline",
|
|
198
200
|
queuedHint: "We'll send it the moment you're back online.",
|
|
201
|
+
rateLimited: "Sending too fast",
|
|
202
|
+
rateLimitedHint: "Wait about a minute \u2014 we queued this report and will retry automatically.",
|
|
203
|
+
quotaBlocked: "Could not accept this report",
|
|
204
|
+
quotaBlockedHint: "This project's quota or plan blocked the send. Ask the app owner to check Billing.",
|
|
205
|
+
permanentFailed: "Could not send this report",
|
|
206
|
+
permanentFailedHint: "The payload was rejected (often too large). Try again with a shorter note or without a screenshot.",
|
|
207
|
+
retrying: "Queued \u2014 retrying",
|
|
208
|
+
retryingHint: "We could not reach the server just now. We'll keep trying in the background.",
|
|
199
209
|
trackOnMushi: "Track on Mushi",
|
|
200
210
|
slaDefault: "We will review your report.",
|
|
201
211
|
screenshotDropped: "Sent without the screenshot \u2014 it was too large to attach."
|
|
@@ -288,6 +298,8 @@ var ja = {
|
|
|
288
298
|
sendAriaLabel: "\u9001\u4FE1",
|
|
289
299
|
hubDescription: "\u3053\u306E\u30A2\u30D7\u30EA\u306E\u4F7F\u3044\u65B9\u3092\u805E\u304F",
|
|
290
300
|
thinking: "\u8003\u3048\u4E2D\u2026",
|
|
301
|
+
fileReportCta: "\u4EE3\u308F\u308A\u306B\u30D0\u30B0\u3092\u5831\u544A",
|
|
302
|
+
stillStuckCta: "\u89E3\u6C7A\u3057\u306A\u3044\u5834\u5408\u306F\u5831\u544A\u3059\u308B",
|
|
291
303
|
errors: {
|
|
292
304
|
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",
|
|
293
305
|
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"
|
|
@@ -366,6 +378,14 @@ var ja = {
|
|
|
366
378
|
delivering: "\u30C1\u30FC\u30E0\u306B\u9001\u4FE1\u4E2D\u2026",
|
|
367
379
|
queuedOffline: "\u30AA\u30D5\u30E9\u30A4\u30F3\u5F85\u6A5F\u4E2D",
|
|
368
380
|
queuedHint: "\u30AA\u30F3\u30E9\u30A4\u30F3\u306B\u623B\u308A\u6B21\u7B2C\u9001\u4FE1\u3057\u307E\u3059\u3002",
|
|
381
|
+
rateLimited: "\u9001\u4FE1\u304C\u65E9\u3059\u304E\u307E\u3059",
|
|
382
|
+
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",
|
|
383
|
+
quotaBlocked: "\u3053\u306E\u30EC\u30DD\u30FC\u30C8\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
384
|
+
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",
|
|
385
|
+
permanentFailed: "\u30EC\u30DD\u30FC\u30C8\u3092\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
386
|
+
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",
|
|
387
|
+
retrying: "\u30AD\u30E5\u30FC \u2014 \u518D\u8A66\u884C\u4E2D",
|
|
388
|
+
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",
|
|
369
389
|
trackOnMushi: "Mushi\u3067\u8FFD\u8DE1",
|
|
370
390
|
slaDefault: "\u30EC\u30DD\u30FC\u30C8\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002",
|
|
371
391
|
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"
|
|
@@ -458,6 +478,8 @@ var th = {
|
|
|
458
478
|
sendAriaLabel: "\u0E2A\u0E48\u0E07",
|
|
459
479
|
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",
|
|
460
480
|
thinking: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E04\u0E34\u0E14\u2026",
|
|
481
|
+
fileReportCta: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E41\u0E17\u0E19",
|
|
482
|
+
stillStuckCta: "\u0E22\u0E31\u0E07\u0E41\u0E01\u0E49\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49? \u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19",
|
|
461
483
|
errors: {
|
|
462
484
|
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",
|
|
463
485
|
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"
|
|
@@ -536,6 +558,14 @@ var th = {
|
|
|
536
558
|
delivering: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2A\u0E48\u0E07\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E17\u0E35\u0E21\u2026",
|
|
537
559
|
queuedOffline: "\u0E04\u0E34\u0E27\u0E2D\u0E2D\u0E1F\u0E44\u0E25\u0E19\u0E4C",
|
|
538
560
|
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",
|
|
561
|
+
rateLimited: "\u0E2A\u0E48\u0E07\u0E16\u0E35\u0E48\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B",
|
|
562
|
+
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",
|
|
563
|
+
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",
|
|
564
|
+
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",
|
|
565
|
+
permanentFailed: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E19\u0E35\u0E49\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49",
|
|
566
|
+
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",
|
|
567
|
+
retrying: "\u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E04\u0E34\u0E27 \u2014 \u0E01\u0E33\u0E25\u0E31\u0E07\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48",
|
|
568
|
+
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",
|
|
539
569
|
trackOnMushi: "\u0E15\u0E34\u0E14\u0E15\u0E32\u0E21\u0E1A\u0E19 Mushi",
|
|
540
570
|
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",
|
|
541
571
|
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"
|
|
@@ -628,6 +658,8 @@ var es = {
|
|
|
628
658
|
sendAriaLabel: "Enviar",
|
|
629
659
|
hubDescription: "Obt\xE9n ayuda para usar esta app",
|
|
630
660
|
thinking: "Pensando\u2026",
|
|
661
|
+
fileReportCta: "Enviar un informe en su lugar",
|
|
662
|
+
stillStuckCta: "\xBFSigues atascado? Env\xEDa un informe",
|
|
631
663
|
errors: {
|
|
632
664
|
noResponse: "Sin respuesta \u2014 revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",
|
|
633
665
|
generic: "No se pudo contactar al asistente. Int\xE9ntalo en un momento."
|
|
@@ -706,6 +738,14 @@ var es = {
|
|
|
706
738
|
delivering: "Enviando al equipo\u2026",
|
|
707
739
|
queuedOffline: "En cola sin conexi\xF3n",
|
|
708
740
|
queuedHint: "Lo enviaremos en cuanto vuelvas a estar en l\xEDnea.",
|
|
741
|
+
rateLimited: "Demasiado r\xE1pido",
|
|
742
|
+
rateLimitedHint: "Espera un minuto \u2014 encolamos el reporte y lo reintentaremos autom\xE1ticamente.",
|
|
743
|
+
quotaBlocked: "No se pudo aceptar este reporte",
|
|
744
|
+
quotaBlockedHint: "La cuota o el plan del proyecto bloque\xF3 el env\xEDo. Pide al due\xF1o que revise Billing.",
|
|
745
|
+
permanentFailed: "No se pudo enviar este reporte",
|
|
746
|
+
permanentFailedHint: "El payload fue rechazado (a menudo por tama\xF1o). Intenta con un texto m\xE1s corto o sin captura.",
|
|
747
|
+
retrying: "En cola \u2014 reintentando",
|
|
748
|
+
retryingHint: "No pudimos llegar al servidor ahora. Seguiremos intentando en segundo plano.",
|
|
709
749
|
trackOnMushi: "Seguir en Mushi",
|
|
710
750
|
slaDefault: "Revisaremos tu reporte.",
|
|
711
751
|
screenshotDropped: "Enviado sin la captura de pantalla \u2014 era demasiado grande para adjuntarla."
|
|
@@ -729,6 +769,14 @@ function getLocale(code) {
|
|
|
729
769
|
function getAvailableLocales() {
|
|
730
770
|
return Object.keys(locales);
|
|
731
771
|
}
|
|
772
|
+
function hexToRgbTriplet(hex) {
|
|
773
|
+
const h = hex.replace("#", "");
|
|
774
|
+
const full = h.length === 3 ? h[0] + h[0] + h[1] + h[1] + h[2] + h[2] : h.slice(0, 6);
|
|
775
|
+
const r = parseInt(full.slice(0, 2), 16);
|
|
776
|
+
const g = parseInt(full.slice(2, 4), 16);
|
|
777
|
+
const b = parseInt(full.slice(4, 6), 16);
|
|
778
|
+
return `${r},${g},${b}`;
|
|
779
|
+
}
|
|
732
780
|
function getWidgetThemeVars(theme, accent = "", accentText = "") {
|
|
733
781
|
const isDark = theme === "dark";
|
|
734
782
|
const mode = isDark ? "dark" : "light";
|
|
@@ -749,6 +797,8 @@ function getWidgetThemeVars(theme, accent = "", accentText = "") {
|
|
|
749
797
|
widgetAccentWash: accentResolved.accentWash,
|
|
750
798
|
widgetAccentInk: accentResolved.accentInk,
|
|
751
799
|
widgetAccentShadow: isDark ? core.MUSHI_ACCENT_SHADOW.dark : core.MUSHI_ACCENT_SHADOW.light,
|
|
800
|
+
accentRgb: hexToRgbTriplet(accentResolved.accent),
|
|
801
|
+
shadowInk: isDark ? "0,0,0" : "14,13,11",
|
|
752
802
|
ok: pal.ok,
|
|
753
803
|
danger: pal.danger,
|
|
754
804
|
onAccent: core.MUSHI_ON_ACCENT,
|
|
@@ -808,6 +858,8 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
808
858
|
widgetAccentWash,
|
|
809
859
|
widgetAccentInk,
|
|
810
860
|
widgetAccentShadow,
|
|
861
|
+
accentRgb,
|
|
862
|
+
shadowInk,
|
|
811
863
|
ok,
|
|
812
864
|
danger,
|
|
813
865
|
onAccent,
|
|
@@ -828,12 +880,31 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
828
880
|
zBanner,
|
|
829
881
|
fabSize
|
|
830
882
|
} = v;
|
|
831
|
-
const { sizeBody, lineBody } = core.MUSHI_TYPE;
|
|
883
|
+
const { sizeBody, sizeLabel, lineBody } = core.MUSHI_TYPE;
|
|
832
884
|
const { durationFast } = core.MUSHI_MOTION;
|
|
885
|
+
const {
|
|
886
|
+
instant: durInstant,
|
|
887
|
+
fast: durFast,
|
|
888
|
+
base: durBase,
|
|
889
|
+
panel: durPanel,
|
|
890
|
+
slow: durSlow,
|
|
891
|
+
ring: durRing
|
|
892
|
+
} = core.MUSHI_DURATION;
|
|
833
893
|
const { bannerHeight, gutter, panelWidth, panelMaxHeight, panelSheetBreakpoint, edgeTabWidth } = core.MUSHI_GEOMETRY;
|
|
834
|
-
const panelLauncherGap = fabSize +
|
|
894
|
+
const panelLauncherGap = fabSize + core.MUSHI_SPACING.comfy;
|
|
835
895
|
const { base: zBase } = core.MUSHI_Z;
|
|
836
896
|
const controlRadius = core.MUSHI_RADIUS.control;
|
|
897
|
+
const cardRadius = core.MUSHI_RADIUS.card;
|
|
898
|
+
const {
|
|
899
|
+
tight: spaceTight,
|
|
900
|
+
snug: spaceSnug,
|
|
901
|
+
comfy: spaceComfy,
|
|
902
|
+
roomy: spaceRoomy,
|
|
903
|
+
lounge: spaceLounge,
|
|
904
|
+
open: spaceOpen,
|
|
905
|
+
wide: spaceWide
|
|
906
|
+
} = core.MUSHI_SPACING;
|
|
907
|
+
const touchMin = 44;
|
|
837
908
|
return `
|
|
838
909
|
:host {
|
|
839
910
|
all: initial;
|
|
@@ -845,6 +916,23 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
845
916
|
-moz-osx-font-smoothing: grayscale;
|
|
846
917
|
font-feature-settings: 'ss01', 'cv11'; /* nicer system-ui glyphs where supported */
|
|
847
918
|
--mushi-ok: ${ok};
|
|
919
|
+
/* Spacing + radius scales (MUSHI_SPACING / MUSHI_RADIUS) \u2014 prefer these
|
|
920
|
+
over literal px so web + RN stay aligned with brand.tokens.json. */
|
|
921
|
+
--mushi-space-tight: ${spaceTight}px;
|
|
922
|
+
--mushi-space-snug: ${spaceSnug}px;
|
|
923
|
+
--mushi-space-comfy: ${spaceComfy}px;
|
|
924
|
+
--mushi-space-roomy: ${spaceRoomy}px;
|
|
925
|
+
--mushi-space-lounge: ${spaceLounge}px;
|
|
926
|
+
--mushi-space-open: ${spaceOpen}px;
|
|
927
|
+
--mushi-space-wide: ${spaceWide}px;
|
|
928
|
+
--mushi-radius-control: ${controlRadius}px;
|
|
929
|
+
--mushi-radius-card: ${cardRadius}px;
|
|
930
|
+
--mushi-touch-min: ${touchMin}px;
|
|
931
|
+
/* Derived channel vars \u2014 accent RGB triplet + shadow-ink triplet.
|
|
932
|
+
Lets Shadow-DOM CSS compose rgba() values that respect host-accent
|
|
933
|
+
overrides and dark-mode ink without repeating the hex guard. */
|
|
934
|
+
--mushi-accent-rgb: ${accentRgb};
|
|
935
|
+
--mushi-shadow-ink: ${shadowInk};
|
|
848
936
|
/* SDK contract: the host element is always pass-through. Only the
|
|
849
937
|
interactive surfaces (.mushi-trigger, .mushi-banner, .mushi-panel)
|
|
850
938
|
opt back into pointer events so the widget never creates an
|
|
@@ -864,6 +952,8 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
864
952
|
position: fixed;
|
|
865
953
|
width: ${fabSize}px;
|
|
866
954
|
height: ${fabSize}px;
|
|
955
|
+
min-width: var(--mushi-touch-min);
|
|
956
|
+
min-height: var(--mushi-touch-min);
|
|
867
957
|
border: 1px solid ${ruleStrong};
|
|
868
958
|
border-radius: ${controlRadius}px;
|
|
869
959
|
background: ${paper};
|
|
@@ -877,9 +967,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
877
967
|
line-height: 1;
|
|
878
968
|
box-shadow:
|
|
879
969
|
0 1px 0 ${rule},
|
|
880
|
-
0 6px 14px -8px rgba(
|
|
970
|
+
0 6px 14px -8px rgba(${shadowInk},0.35),
|
|
881
971
|
inset 0 -3px 0 ${widgetAccent};
|
|
882
|
-
transition: transform ${durationFast}ms ${easeStamp},
|
|
972
|
+
transition: transform ${durationFast}ms ${easeStamp}, opacity ${durationFast}ms ${easeStamp};
|
|
883
973
|
overflow: visible;
|
|
884
974
|
isolation: isolate;
|
|
885
975
|
}
|
|
@@ -899,14 +989,15 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
899
989
|
transform: translateY(-2px) rotate(-1.5deg);
|
|
900
990
|
box-shadow:
|
|
901
991
|
0 1px 0 ${rule},
|
|
902
|
-
0 14px 24px -10px rgba(
|
|
992
|
+
0 14px 24px -10px rgba(${shadowInk},0.45),
|
|
993
|
+
0 0 20px -6px rgba(${accentRgb},0.22),
|
|
903
994
|
inset 0 -3px 0 ${widgetAccent};
|
|
904
995
|
}
|
|
905
996
|
.mushi-trigger:active {
|
|
906
997
|
transform: translateY(0) rotate(0);
|
|
907
998
|
box-shadow:
|
|
908
999
|
0 1px 0 ${rule},
|
|
909
|
-
0 2px 4px -2px rgba(
|
|
1000
|
+
0 2px 4px -2px rgba(${shadowInk},0.35),
|
|
910
1001
|
inset 0 -2px 0 ${widgetAccent};
|
|
911
1002
|
}
|
|
912
1003
|
.mushi-trigger:focus-visible {
|
|
@@ -918,9 +1009,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
918
1009
|
can compose with the hover transform without fighting it. Respects
|
|
919
1010
|
prefers-reduced-motion. */
|
|
920
1011
|
@keyframes mushi-trigger-pulse {
|
|
921
|
-
0% { box-shadow: 0 0 0 0 rgba(
|
|
922
|
-
70% { box-shadow: 0 0 0 16px rgba(
|
|
923
|
-
100% { box-shadow: 0 0 0 0 rgba(
|
|
1012
|
+
0% { box-shadow: 0 0 0 0 rgba(${accentRgb},0.55), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
|
|
1013
|
+
70% { box-shadow: 0 0 0 16px rgba(${accentRgb},0), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
|
|
1014
|
+
100% { box-shadow: 0 0 0 0 rgba(${accentRgb},0), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
|
|
924
1015
|
}
|
|
925
1016
|
.mushi-trigger-pulse {
|
|
926
1017
|
animation: mushi-trigger-pulse 800ms ${easeStamp} 3;
|
|
@@ -947,13 +1038,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
947
1038
|
.mushi-trigger.edge-tab {
|
|
948
1039
|
width: ${edgeTabWidth}px;
|
|
949
1040
|
height: 88px;
|
|
950
|
-
border-radius:
|
|
1041
|
+
border-radius: ${controlRadius}px 0 0 ${controlRadius}px;
|
|
951
1042
|
writing-mode: vertical-rl;
|
|
952
1043
|
text-orientation: upright;
|
|
953
1044
|
font-size: 16px;
|
|
954
1045
|
box-shadow:
|
|
955
1046
|
0 1px 0 ${rule},
|
|
956
|
-
0 10px 24px -14px rgba(
|
|
1047
|
+
0 10px 24px -14px rgba(${shadowInk},0.45),
|
|
957
1048
|
inset -3px 0 0 ${widgetAccent};
|
|
958
1049
|
}
|
|
959
1050
|
.mushi-trigger.edge-tab.bottom-right,
|
|
@@ -963,10 +1054,10 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
963
1054
|
.mushi-trigger.edge-tab.bottom-left,
|
|
964
1055
|
.mushi-trigger.edge-tab.top-left {
|
|
965
1056
|
left: var(--mushi-left, 0);
|
|
966
|
-
border-radius: 0
|
|
1057
|
+
border-radius: 0 ${controlRadius}px ${controlRadius}px 0;
|
|
967
1058
|
box-shadow:
|
|
968
1059
|
0 1px 0 ${rule},
|
|
969
|
-
0 10px 24px -14px rgba(
|
|
1060
|
+
0 10px 24px -14px rgba(${shadowInk},0.45),
|
|
970
1061
|
inset 3px 0 0 ${widgetAccent};
|
|
971
1062
|
}
|
|
972
1063
|
.mushi-trigger.shrunk {
|
|
@@ -995,7 +1086,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
995
1086
|
transition: none !important;
|
|
996
1087
|
box-shadow:
|
|
997
1088
|
0 1px 0 ${rule},
|
|
998
|
-
0 20px 40px -12px rgba(
|
|
1089
|
+
0 20px 40px -12px rgba(${shadowInk},0.55),
|
|
999
1090
|
inset 0 -3px 0 ${widgetAccent};
|
|
1000
1091
|
opacity: 0.92;
|
|
1001
1092
|
}
|
|
@@ -1019,13 +1110,14 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1019
1110
|
border-radius: 6px;
|
|
1020
1111
|
box-shadow:
|
|
1021
1112
|
0 1px 0 ${rule},
|
|
1022
|
-
0 24px 56px -20px rgba(
|
|
1023
|
-
0 8px 16px -8px rgba(
|
|
1113
|
+
0 24px 56px -20px rgba(${shadowInk},0.30),
|
|
1114
|
+
0 8px 16px -8px rgba(${shadowInk},0.20);
|
|
1024
1115
|
overflow: hidden;
|
|
1025
1116
|
display: flex;
|
|
1026
1117
|
flex-direction: column;
|
|
1027
1118
|
transform-origin: var(--mushi-origin, bottom right);
|
|
1028
|
-
|
|
1119
|
+
/* Keyboard inset \u2014 layout exception (IME), not decorative (docs/MOTION.md) */
|
|
1120
|
+
transition: bottom ${durInstant}ms ease, top ${durInstant}ms ease, max-height ${durInstant}ms ease;
|
|
1029
1121
|
}
|
|
1030
1122
|
/* Keyboard-safe: on narrow viewports lift above the keyboard */
|
|
1031
1123
|
.mushi-panel.keyboard-open {
|
|
@@ -1046,7 +1138,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1046
1138
|
bottom: calc(var(--mushi-keyboard-inset, 0px) + 4px) !important;
|
|
1047
1139
|
}
|
|
1048
1140
|
}
|
|
1049
|
-
.mushi-panel.open { animation: mushi-stamp-in
|
|
1141
|
+
.mushi-panel.open { animation: mushi-stamp-in ${durPanel}ms ${easeStamp} both; }
|
|
1050
1142
|
.mushi-panel.closed { display: none; }
|
|
1051
1143
|
.mushi-panel.bottom-right {
|
|
1052
1144
|
bottom: var(--mushi-panel-bottom, calc(var(--mushi-bottom, ${gutter}px) + ${panelLauncherGap}px));
|
|
@@ -1172,7 +1264,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1172
1264
|
font-size: 16px;
|
|
1173
1265
|
line-height: 1;
|
|
1174
1266
|
border-radius: 0;
|
|
1175
|
-
transition:
|
|
1267
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
1176
1268
|
}
|
|
1177
1269
|
.mushi-back {
|
|
1178
1270
|
align-self: flex-start;
|
|
@@ -1193,7 +1285,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1193
1285
|
display: inline-flex;
|
|
1194
1286
|
align-items: center;
|
|
1195
1287
|
gap: 4px;
|
|
1196
|
-
transition:
|
|
1288
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
1197
1289
|
white-space: nowrap;
|
|
1198
1290
|
}
|
|
1199
1291
|
.mushi-close:hover { color: ${widgetAccent}; }
|
|
@@ -1227,24 +1319,29 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1227
1319
|
display: grid;
|
|
1228
1320
|
grid-template-columns: auto 1fr auto;
|
|
1229
1321
|
align-items: center;
|
|
1230
|
-
gap:
|
|
1322
|
+
gap: ${spaceComfy}px;
|
|
1231
1323
|
width: 100%;
|
|
1232
|
-
|
|
1324
|
+
min-height: var(--mushi-touch-min);
|
|
1325
|
+
padding: ${spaceComfy}px 0;
|
|
1233
1326
|
border: none;
|
|
1234
1327
|
border-bottom: 1px solid ${rule};
|
|
1235
1328
|
background: transparent;
|
|
1236
1329
|
cursor: pointer;
|
|
1237
1330
|
color: inherit;
|
|
1238
1331
|
text-align: left;
|
|
1239
|
-
transition:
|
|
1332
|
+
transition: transform ${durBase}ms ${easeStamp}, opacity ${durBase}ms ${easeStamp};
|
|
1240
1333
|
position: relative;
|
|
1241
1334
|
}
|
|
1242
1335
|
.mushi-option-btn:last-child { border-bottom: none; }
|
|
1243
|
-
.mushi-option-btn:hover {
|
|
1336
|
+
.mushi-option-btn:hover {
|
|
1337
|
+
transform: translateX(6px);
|
|
1338
|
+
color: ${widgetAccent};
|
|
1339
|
+
background: linear-gradient(90deg, rgba(${accentRgb},0.07), transparent 55%);
|
|
1340
|
+
}
|
|
1244
1341
|
.mushi-option-btn:hover .mushi-option-arrow { opacity: 1; transform: translateX(0); color: ${widgetAccent}; }
|
|
1245
1342
|
.mushi-option-btn:focus-visible {
|
|
1246
1343
|
outline: none;
|
|
1247
|
-
|
|
1344
|
+
transform: translateX(6px);
|
|
1248
1345
|
box-shadow: inset 2px 0 0 ${widgetAccent};
|
|
1249
1346
|
}
|
|
1250
1347
|
.mushi-option-icon {
|
|
@@ -1272,7 +1369,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1272
1369
|
color: ${inkFaint};
|
|
1273
1370
|
opacity: 0;
|
|
1274
1371
|
transform: translateX(-4px);
|
|
1275
|
-
transition: opacity
|
|
1372
|
+
transition: opacity ${durBase}ms ${easeStamp}, transform ${durBase}ms ${easeStamp};
|
|
1276
1373
|
}
|
|
1277
1374
|
/* Feature-request and Reports-inbox entries sit above the five
|
|
1278
1375
|
category cards as discoverable shortcuts. We give them a subtle
|
|
@@ -1283,7 +1380,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1283
1380
|
.mushi-reports-entry {
|
|
1284
1381
|
padding-left: 10px;
|
|
1285
1382
|
border-left: 2px solid ${inkFaint};
|
|
1286
|
-
transition:
|
|
1383
|
+
transition: opacity ${durBase}ms ${easeStamp}, transform ${durBase}ms ${easeStamp};
|
|
1287
1384
|
}
|
|
1288
1385
|
.mushi-feature-entry:hover,
|
|
1289
1386
|
.mushi-reports-entry:hover {
|
|
@@ -1306,7 +1403,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1306
1403
|
color: ${ink};
|
|
1307
1404
|
cursor: pointer;
|
|
1308
1405
|
text-align: left;
|
|
1309
|
-
transition:
|
|
1406
|
+
transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
|
|
1310
1407
|
}
|
|
1311
1408
|
.mushi-report-row:hover,
|
|
1312
1409
|
.mushi-report-row:focus-visible {
|
|
@@ -1393,7 +1490,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1393
1490
|
font-size: 18px;
|
|
1394
1491
|
line-height: 1;
|
|
1395
1492
|
color: ${inkFaint};
|
|
1396
|
-
transition:
|
|
1493
|
+
transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
|
|
1397
1494
|
}
|
|
1398
1495
|
.mushi-report-row:hover .mushi-report-chevron,
|
|
1399
1496
|
.mushi-report-row:focus-visible .mushi-report-chevron {
|
|
@@ -1483,7 +1580,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1483
1580
|
font-family: ${fontBody};
|
|
1484
1581
|
font-size: 11px;
|
|
1485
1582
|
cursor: pointer;
|
|
1486
|
-
transition:
|
|
1583
|
+
transition: opacity ${durInstant}ms ${easeStamp}, transform ${durInstant}ms ${easeStamp};
|
|
1487
1584
|
white-space: nowrap;
|
|
1488
1585
|
}
|
|
1489
1586
|
.mushi-example-chip:hover {
|
|
@@ -1509,7 +1606,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1509
1606
|
letter-spacing: 0.04em;
|
|
1510
1607
|
color: ${inkFaint};
|
|
1511
1608
|
pointer-events: none;
|
|
1512
|
-
transition:
|
|
1609
|
+
transition: opacity ${durFast}ms ${easeStamp};
|
|
1513
1610
|
}
|
|
1514
1611
|
|
|
1515
1612
|
.mushi-textarea {
|
|
@@ -1525,7 +1622,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1525
1622
|
line-height: 1.5;
|
|
1526
1623
|
resize: vertical;
|
|
1527
1624
|
outline: none;
|
|
1528
|
-
transition:
|
|
1625
|
+
transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
|
|
1529
1626
|
}
|
|
1530
1627
|
.mushi-textarea::placeholder {
|
|
1531
1628
|
color: ${inkFaint};
|
|
@@ -1553,7 +1650,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1553
1650
|
letter-spacing: 0.04em;
|
|
1554
1651
|
text-transform: uppercase;
|
|
1555
1652
|
cursor: pointer;
|
|
1556
|
-
transition:
|
|
1653
|
+
transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
|
|
1557
1654
|
}
|
|
1558
1655
|
.mushi-attach-btn:hover {
|
|
1559
1656
|
color: ${ink};
|
|
@@ -1647,7 +1744,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1647
1744
|
border: 1.5px solid currentColor;
|
|
1648
1745
|
border-top-color: transparent;
|
|
1649
1746
|
border-radius: 50%;
|
|
1650
|
-
animation: mushi-spin
|
|
1747
|
+
animation: mushi-spin ${durRing}ms linear infinite;
|
|
1651
1748
|
}
|
|
1652
1749
|
|
|
1653
1750
|
.mushi-footer {
|
|
@@ -1669,19 +1766,20 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1669
1766
|
position: relative;
|
|
1670
1767
|
display: inline-flex;
|
|
1671
1768
|
align-items: center;
|
|
1672
|
-
gap:
|
|
1673
|
-
|
|
1769
|
+
gap: ${spaceSnug}px;
|
|
1770
|
+
min-height: var(--mushi-touch-min);
|
|
1771
|
+
padding: ${spaceComfy}px ${spaceLounge}px;
|
|
1674
1772
|
border: 1px solid ${widgetAccent};
|
|
1675
|
-
border-radius:
|
|
1676
|
-
background: ${widgetAccent};
|
|
1773
|
+
border-radius: ${controlRadius}px;
|
|
1774
|
+
background: linear-gradient(160deg, ${widgetAccent} 0%, ${widgetAccentShadow} 100%);
|
|
1677
1775
|
color: ${onAccent};
|
|
1678
1776
|
font-family: ${fontMono};
|
|
1679
|
-
font-size:
|
|
1777
|
+
font-size: ${sizeLabel}px;
|
|
1680
1778
|
letter-spacing: 0.16em;
|
|
1681
1779
|
text-transform: uppercase;
|
|
1682
1780
|
cursor: pointer;
|
|
1683
1781
|
overflow: hidden;
|
|
1684
|
-
transition: transform
|
|
1782
|
+
transition: transform ${durFast}ms ${easeStamp}, opacity ${durFast}ms ${easeStamp};
|
|
1685
1783
|
box-shadow: 0 2px 0 ${widgetAccentShadow};
|
|
1686
1784
|
}
|
|
1687
1785
|
.mushi-submit::after {
|
|
@@ -1691,12 +1789,15 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1691
1789
|
background: radial-gradient(circle at center, rgba(255,255,255,0.35) 0%, transparent 60%);
|
|
1692
1790
|
opacity: 0;
|
|
1693
1791
|
transform: scale(0.4);
|
|
1694
|
-
transition: opacity
|
|
1792
|
+
transition: opacity ${durPanel}ms ${easeStamp}, transform ${durSlow}ms ${easeStamp};
|
|
1695
1793
|
pointer-events: none;
|
|
1696
1794
|
}
|
|
1697
1795
|
.mushi-submit:hover {
|
|
1698
1796
|
transform: translateY(-1px);
|
|
1699
|
-
box-shadow:
|
|
1797
|
+
box-shadow:
|
|
1798
|
+
0 3px 0 ${widgetAccentShadow},
|
|
1799
|
+
0 0 0 3px rgba(${accentRgb},0.18),
|
|
1800
|
+
0 4px 16px -4px rgba(${accentRgb},0.35);
|
|
1700
1801
|
}
|
|
1701
1802
|
.mushi-submit:hover::after { opacity: 1; transform: scale(1.4); }
|
|
1702
1803
|
.mushi-submit:active { transform: translateY(1px); box-shadow: 0 1px 0 ${widgetAccentShadow}; }
|
|
@@ -1710,7 +1811,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1710
1811
|
}
|
|
1711
1812
|
.mushi-submit-arrow {
|
|
1712
1813
|
display: inline-block;
|
|
1713
|
-
transition: transform
|
|
1814
|
+
transition: transform ${durBase}ms ${easeStamp};
|
|
1714
1815
|
}
|
|
1715
1816
|
.mushi-submit:hover .mushi-submit-arrow { transform: translateX(3px); }
|
|
1716
1817
|
|
|
@@ -1740,7 +1841,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1740
1841
|
display: inline-flex;
|
|
1741
1842
|
align-items: baseline;
|
|
1742
1843
|
gap: 4px;
|
|
1743
|
-
transition:
|
|
1844
|
+
transition: opacity ${durFast}ms ${easeStamp};
|
|
1744
1845
|
}
|
|
1745
1846
|
.mushi-step-num.done { color: ${inkMuted}; text-decoration: line-through; text-decoration-color: ${inkFaint}; }
|
|
1746
1847
|
.mushi-step-num.active {
|
|
@@ -1780,6 +1881,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1780
1881
|
transform: rotate(-90deg);
|
|
1781
1882
|
transform-origin: center;
|
|
1782
1883
|
animation: mushi-stamp-ring 700ms ${easeStamp} 80ms forwards;
|
|
1884
|
+
filter: drop-shadow(0 0 6px rgba(${accentRgb},0.5));
|
|
1783
1885
|
}
|
|
1784
1886
|
.mushi-success-stamp-label {
|
|
1785
1887
|
font-family: ${fontDisplay};
|
|
@@ -1848,11 +1950,11 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1848
1950
|
font-size: 12px;
|
|
1849
1951
|
letter-spacing: 0.02em;
|
|
1850
1952
|
cursor: pointer;
|
|
1851
|
-
transition:
|
|
1953
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
1852
1954
|
}
|
|
1853
1955
|
.mushi-success-receipt-id:hover,
|
|
1854
1956
|
.mushi-success-receipt-id:focus-visible {
|
|
1855
|
-
background: rgba(
|
|
1957
|
+
background: rgba(${accentRgb},0.06);
|
|
1856
1958
|
border-color: ${widgetAccent};
|
|
1857
1959
|
color: ${widgetAccent};
|
|
1858
1960
|
outline: none;
|
|
@@ -1875,7 +1977,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1875
1977
|
letter-spacing: 0.10em;
|
|
1876
1978
|
text-transform: uppercase;
|
|
1877
1979
|
text-decoration: none;
|
|
1878
|
-
transition: filter
|
|
1980
|
+
transition: filter ${durInstant}ms ease;
|
|
1879
1981
|
}
|
|
1880
1982
|
.mushi-success-receipt-track:hover,
|
|
1881
1983
|
.mushi-success-receipt-track:focus-visible {
|
|
@@ -1993,9 +2095,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1993
2095
|
}
|
|
1994
2096
|
.mushi-tier-bar-fill {
|
|
1995
2097
|
height: 100%;
|
|
2098
|
+
width: 100%;
|
|
1996
2099
|
background: ${widgetAccent};
|
|
1997
2100
|
border-radius: 2px;
|
|
1998
|
-
|
|
2101
|
+
/* Meter fill \u2014 scaleX keeps compositor-friendly motion (docs/MOTION.md). */
|
|
2102
|
+
transform-origin: left center;
|
|
2103
|
+
transform: scaleX(var(--mushi-tier-pct, 0));
|
|
2104
|
+
transition: transform ${durSlow}ms ${easeStamp};
|
|
1999
2105
|
}
|
|
2000
2106
|
.mushi-rewards-next-label {
|
|
2001
2107
|
font-family: ${fontMono};
|
|
@@ -2021,7 +2127,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2021
2127
|
letter-spacing: 0.06em;
|
|
2022
2128
|
margin-bottom: 10px;
|
|
2023
2129
|
opacity: 0;
|
|
2024
|
-
animation: mushi-pts-pop
|
|
2130
|
+
animation: mushi-pts-pop ${durSlow}ms ${easeStamp} 900ms forwards;
|
|
2025
2131
|
}
|
|
2026
2132
|
.success-bar { margin: 0 0 5px; }
|
|
2027
2133
|
|
|
@@ -2040,7 +2146,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2040
2146
|
margin: 0 16px 2px;
|
|
2041
2147
|
padding: 9px 12px;
|
|
2042
2148
|
background: ${widgetAccentWash};
|
|
2043
|
-
border: 1px solid ${isDark ? "
|
|
2149
|
+
border: 1px solid rgba(${accentRgb},${isDark ? "0.22" : "0.16"});
|
|
2044
2150
|
border-radius: 4px;
|
|
2045
2151
|
display: flex;
|
|
2046
2152
|
flex-direction: column;
|
|
@@ -2119,7 +2225,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2119
2225
|
content: '\u25B6';
|
|
2120
2226
|
font-size: 7px;
|
|
2121
2227
|
opacity: 0.6;
|
|
2122
|
-
transition: transform
|
|
2228
|
+
transition: transform ${durInstant}ms ${easeStamp};
|
|
2123
2229
|
}
|
|
2124
2230
|
|
|
2125
2231
|
.mushi-changelog[open] .mushi-changelog-summary::before {
|
|
@@ -2147,7 +2253,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2147
2253
|
margin-top: 14px;
|
|
2148
2254
|
padding: 10px 14px;
|
|
2149
2255
|
background: ${widgetAccentWash};
|
|
2150
|
-
border: 1px solid ${isDark ? "
|
|
2256
|
+
border: 1px solid rgba(${accentRgb},${isDark ? "0.18" : "0.14"});
|
|
2151
2257
|
border-radius: 4px;
|
|
2152
2258
|
display: flex;
|
|
2153
2259
|
flex-direction: column;
|
|
@@ -2190,7 +2296,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2190
2296
|
white-space: nowrap;
|
|
2191
2297
|
overflow: hidden;
|
|
2192
2298
|
z-index: var(--mushi-banner-z, ${zBanner});
|
|
2193
|
-
animation: mushi-banner-slide-in
|
|
2299
|
+
animation: mushi-banner-slide-in ${durPanel}ms ${easeStamp} both;
|
|
2194
2300
|
}
|
|
2195
2301
|
|
|
2196
2302
|
.mushi-banner.top { top: 0; padding-top: env(safe-area-inset-top, 0px); }
|
|
@@ -2347,7 +2453,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2347
2453
|
letter-spacing: inherit;
|
|
2348
2454
|
text-decoration: none;
|
|
2349
2455
|
opacity: 0.88;
|
|
2350
|
-
transition: opacity
|
|
2456
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
2351
2457
|
flex-shrink: 0;
|
|
2352
2458
|
}
|
|
2353
2459
|
.mushi-banner-link:hover { opacity: 1; }
|
|
@@ -2375,7 +2481,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2375
2481
|
cursor: pointer;
|
|
2376
2482
|
font: inherit;
|
|
2377
2483
|
letter-spacing: inherit;
|
|
2378
|
-
transition:
|
|
2484
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
2379
2485
|
flex-shrink: 0;
|
|
2380
2486
|
height: 24px;
|
|
2381
2487
|
line-height: 1;
|
|
@@ -2397,7 +2503,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2397
2503
|
flex-shrink: 0;
|
|
2398
2504
|
color: inherit;
|
|
2399
2505
|
border-radius: 3px;
|
|
2400
|
-
transition: opacity
|
|
2506
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
2401
2507
|
}
|
|
2402
2508
|
.mushi-banner-dismiss:hover {
|
|
2403
2509
|
opacity: 1;
|
|
@@ -2418,7 +2524,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2418
2524
|
border-radius: 3px;
|
|
2419
2525
|
white-space: nowrap;
|
|
2420
2526
|
flex-shrink: 0;
|
|
2421
|
-
transition: opacity
|
|
2527
|
+
transition: opacity ${durInstant}ms ${easeStamp};
|
|
2422
2528
|
margin-left: 4px;
|
|
2423
2529
|
}
|
|
2424
2530
|
.mushi-banner-my-reports:hover {
|
|
@@ -2480,7 +2586,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2480
2586
|
font-family: ${fontBody};
|
|
2481
2587
|
font-size: 13px;
|
|
2482
2588
|
text-align: left;
|
|
2483
|
-
transition:
|
|
2589
|
+
transition: opacity ${durFast}ms ${easeStamp};
|
|
2484
2590
|
}
|
|
2485
2591
|
.mushi-more-toggle:hover { color: ${widgetAccent}; }
|
|
2486
2592
|
.mushi-more-toggle:hover .mushi-more-toggle-arrow { transform: translateX(3px); }
|
|
@@ -2498,7 +2604,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2498
2604
|
.mushi-more-toggle-arrow {
|
|
2499
2605
|
font-size: 14px;
|
|
2500
2606
|
opacity: 0.5;
|
|
2501
|
-
transition: transform
|
|
2607
|
+
transition: transform ${durFast}ms ${easeStamp};
|
|
2502
2608
|
}
|
|
2503
2609
|
/* \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 */
|
|
2504
2610
|
@keyframes mushi-step-in {
|
|
@@ -2513,12 +2619,12 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2513
2619
|
}
|
|
2514
2620
|
/* Expanded secondary categories animate in */
|
|
2515
2621
|
.mushi-categories-expanded {
|
|
2516
|
-
animation: mushi-step-in
|
|
2622
|
+
animation: mushi-step-in ${durFast}ms ${easeStamp} both;
|
|
2517
2623
|
}
|
|
2518
2624
|
.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}
|
|
2519
2625
|
.mushi-link-btn:hover{opacity:0.8}
|
|
2520
2626
|
.mushi-link-btn:focus-visible,.mushi-nav-item:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;border-radius:2px}
|
|
2521
|
-
.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:
|
|
2627
|
+
.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}}
|
|
2522
2628
|
.mushi-nav-item:hover{background:${isDark ? "rgba(255,255,255,0.09)" : "rgba(0,0,0,0.07)"}}
|
|
2523
2629
|
.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}
|
|
2524
2630
|
.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}
|
|
@@ -2541,14 +2647,22 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2541
2647
|
.mushi-assistant-log{flex:1;min-height:120px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;padding:4px 2px 8px}
|
|
2542
2648
|
.mushi-assistant-greeting{font:400 14px/1.5 ${fontBody};color:${inkMuted};padding:6px 2px}
|
|
2543
2649
|
.mushi-assistant-suggestions{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
|
|
2544
|
-
.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:
|
|
2545
|
-
.mushi-assistant-chip:hover{background
|
|
2650
|
+
.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}}
|
|
2651
|
+
.mushi-assistant-chip:hover{background:rgba(${accentRgb},${isDark ? "0.22" : "0.14"})}
|
|
2546
2652
|
.mushi-assistant-chip:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
|
|
2547
2653
|
.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}
|
|
2548
2654
|
.mushi-assistant-msg-user{align-self:flex-end;background:${widgetAccent};color:${inverse};border-bottom-right-radius:4px}
|
|
2549
2655
|
.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}
|
|
2550
2656
|
.mushi-assistant-thinking{opacity:0.6;font-size:18px;letter-spacing:2px}
|
|
2551
|
-
.mushi-assistant-error{align-self:flex-start;color:${danger};font-size:12px;padding:4px 2px}
|
|
2657
|
+
.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}
|
|
2658
|
+
.mushi-assistant-recovery{display:flex;flex-wrap:wrap;gap:6px;margin-top:2px}
|
|
2659
|
+
.mushi-assistant-recovery-footer{margin-top:4px;padding-top:4px}
|
|
2660
|
+
.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}
|
|
2661
|
+
.mushi-assistant-report-cta:hover{opacity:0.92}
|
|
2662
|
+
.mushi-assistant-report-cta:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
|
|
2663
|
+
.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}
|
|
2664
|
+
.mushi-assistant-report-link:hover{opacity:0.85}
|
|
2665
|
+
.mushi-assistant-report-link:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
|
|
2552
2666
|
.mushi-assistant-form{display:flex;align-items:flex-end;gap:8px;border-top:1px solid ${rule};padding-top:8px}
|
|
2553
2667
|
.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}}
|
|
2554
2668
|
.mushi-assistant-input:focus-visible{outline:2px solid ${widgetAccent};outline-offset:1px}
|
|
@@ -2561,7 +2675,56 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2561
2675
|
|
|
2562
2676
|
// src/version.ts
|
|
2563
2677
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
2564
|
-
var MUSHI_SDK_VERSION = "1.
|
|
2678
|
+
var MUSHI_SDK_VERSION = "1.27.0" ;
|
|
2679
|
+
var ASSISTANT_SESSION_STORAGE_KEY = "mushi-assistant-session-v1";
|
|
2680
|
+
function loadAssistantSession() {
|
|
2681
|
+
try {
|
|
2682
|
+
if (typeof sessionStorage === "undefined") return null;
|
|
2683
|
+
const raw = sessionStorage.getItem(ASSISTANT_SESSION_STORAGE_KEY);
|
|
2684
|
+
if (!raw) return null;
|
|
2685
|
+
const parsed = JSON.parse(raw);
|
|
2686
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
2687
|
+
const record = parsed;
|
|
2688
|
+
const turns = Array.isArray(record.turns) ? record.turns : null;
|
|
2689
|
+
if (!turns) return null;
|
|
2690
|
+
const normalized = [];
|
|
2691
|
+
for (const item of turns) {
|
|
2692
|
+
if (!item || typeof item !== "object") continue;
|
|
2693
|
+
const t = item;
|
|
2694
|
+
if (t.role !== "user" && t.role !== "assistant") continue;
|
|
2695
|
+
if (typeof t.text !== "string") continue;
|
|
2696
|
+
const turn = { role: t.role, text: t.text };
|
|
2697
|
+
if (Array.isArray(t.options)) {
|
|
2698
|
+
const options = t.options.filter((o) => typeof o === "string");
|
|
2699
|
+
if (options.length) turn.options = options;
|
|
2700
|
+
}
|
|
2701
|
+
if (t.offerReport === true) turn.offerReport = true;
|
|
2702
|
+
normalized.push(turn);
|
|
2703
|
+
}
|
|
2704
|
+
const threadId = typeof record.threadId === "string" && record.threadId.length > 0 ? record.threadId : null;
|
|
2705
|
+
return { turns: normalized, threadId };
|
|
2706
|
+
} catch {
|
|
2707
|
+
return null;
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
function saveAssistantSession(snapshot) {
|
|
2711
|
+
try {
|
|
2712
|
+
if (typeof sessionStorage === "undefined") return;
|
|
2713
|
+
if (!snapshot.turns.length && !snapshot.threadId) {
|
|
2714
|
+
sessionStorage.removeItem(ASSISTANT_SESSION_STORAGE_KEY);
|
|
2715
|
+
return;
|
|
2716
|
+
}
|
|
2717
|
+
sessionStorage.setItem(ASSISTANT_SESSION_STORAGE_KEY, JSON.stringify(snapshot));
|
|
2718
|
+
} catch {
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
function clearAssistantSession() {
|
|
2722
|
+
try {
|
|
2723
|
+
if (typeof sessionStorage === "undefined") return;
|
|
2724
|
+
sessionStorage.removeItem(ASSISTANT_SESSION_STORAGE_KEY);
|
|
2725
|
+
} catch {
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2565
2728
|
var CATEGORY_ICONS = {
|
|
2566
2729
|
bug: "\u26A0\uFE0F",
|
|
2567
2730
|
slow: "\u{1F40C}",
|
|
@@ -2769,10 +2932,18 @@ function renderAssistantStep(ctx) {
|
|
|
2769
2932
|
${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) => {
|
|
2770
2933
|
const cls = turn.role === "user" ? "mushi-assistant-msg-user" : "mushi-assistant-msg-bot";
|
|
2771
2934
|
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>` : "";
|
|
2772
|
-
|
|
2935
|
+
const reportCta = turn.offerReport ? `<div class="mushi-assistant-recovery">
|
|
2936
|
+
<button type="button" class="mushi-assistant-report-cta" data-action="assistant-report">${escapeHtml(t.assistant.fileReportCta)}</button>
|
|
2937
|
+
</div>` : "";
|
|
2938
|
+
return `<div class="mushi-assistant-msg ${cls}">${escapeHtml(turn.text)}</div>${opts}${reportCta}`;
|
|
2773
2939
|
}).join("");
|
|
2774
2940
|
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>` : "";
|
|
2775
|
-
const error = ctx.assistantError ? `<div class="mushi-assistant-error" role="alert">${escapeHtml(ctx.assistantError)}
|
|
2941
|
+
const error = ctx.assistantError ? `<div class="mushi-assistant-error" role="alert">${escapeHtml(ctx.assistantError)}
|
|
2942
|
+
<button type="button" class="mushi-assistant-report-cta" data-action="assistant-report">${escapeHtml(t.assistant.fileReportCta)}</button>
|
|
2943
|
+
</div>` : "";
|
|
2944
|
+
const stillStuck = !empty && !ctx.assistantSending && !ctx.assistantError ? `<div class="mushi-assistant-recovery mushi-assistant-recovery-footer">
|
|
2945
|
+
<button type="button" class="mushi-assistant-report-link" data-action="assistant-report">${escapeHtml(t.assistant.stillStuckCta)}</button>
|
|
2946
|
+
</div>` : "";
|
|
2776
2947
|
return `
|
|
2777
2948
|
${renderHeader(ctx, { title: label, showBack: true })}
|
|
2778
2949
|
<div class="mushi-assistant">
|
|
@@ -2780,6 +2951,7 @@ function renderAssistantStep(ctx) {
|
|
|
2780
2951
|
${transcript}
|
|
2781
2952
|
${thinking}
|
|
2782
2953
|
${error}
|
|
2954
|
+
${stillStuck}
|
|
2783
2955
|
</div>
|
|
2784
2956
|
<form class="mushi-assistant-form" data-action="assistant-send">
|
|
2785
2957
|
<textarea
|
|
@@ -3307,6 +3479,7 @@ function renderDetailsStep(ctx) {
|
|
|
3307
3479
|
class="mushi-textarea"
|
|
3308
3480
|
placeholder="${escapeHtml(t.step3.descriptionPlaceholder)}"
|
|
3309
3481
|
rows="4"
|
|
3482
|
+
maxlength="4000"
|
|
3310
3483
|
aria-label="${escapeHtml(t.step3.heading)}"
|
|
3311
3484
|
autofocus
|
|
3312
3485
|
></textarea>
|
|
@@ -3376,12 +3549,15 @@ function renderSuccessStep(ctx) {
|
|
|
3376
3549
|
}
|
|
3377
3550
|
function renderSuccessReceipt(ctx) {
|
|
3378
3551
|
const s = ctx.locale.flows.success;
|
|
3379
|
-
|
|
3552
|
+
const failureKind = ctx.lastSubmitFailureKind;
|
|
3553
|
+
if (failureKind === "rate_limited" || failureKind === "quota" || failureKind === "permanent" || failureKind === "retrying" || ctx.lastSubmitQueuedOffline) {
|
|
3554
|
+
const label = failureKind === "rate_limited" ? s.rateLimited : failureKind === "quota" ? s.quotaBlocked : failureKind === "permanent" ? s.permanentFailed : failureKind === "retrying" ? s.retrying : s.queuedOffline;
|
|
3555
|
+
const hint = failureKind === "rate_limited" ? s.rateLimitedHint : failureKind === "quota" ? s.quotaBlockedHint : failureKind === "permanent" ? s.permanentFailedHint : failureKind === "retrying" ? s.retryingHint : s.queuedHint;
|
|
3380
3556
|
return `
|
|
3381
3557
|
<div class="mushi-success-receipt" role="status">
|
|
3382
3558
|
<div class="mushi-success-receipt-row mushi-success-receipt-warn">
|
|
3383
|
-
<span class="mushi-success-receipt-label">${escapeHtml(
|
|
3384
|
-
<span class="mushi-success-receipt-hint">${escapeHtml(
|
|
3559
|
+
<span class="mushi-success-receipt-label">${escapeHtml(label)}</span>
|
|
3560
|
+
<span class="mushi-success-receipt-hint">${escapeHtml(hint)}</span>
|
|
3385
3561
|
</div>
|
|
3386
3562
|
</div>
|
|
3387
3563
|
`;
|
|
@@ -3472,7 +3648,7 @@ function renderRewardsNudge(ctx) {
|
|
|
3472
3648
|
</div>
|
|
3473
3649
|
${nextTier ? `
|
|
3474
3650
|
<div class="mushi-tier-bar-track" role="progressbar" aria-valuenow="${pct}" aria-valuemin="0" aria-valuemax="100" aria-label="Progress to ${escapeHtml(nextTier.displayName)}">
|
|
3475
|
-
<div class="mushi-tier-bar-fill" style="
|
|
3651
|
+
<div class="mushi-tier-bar-fill" style="--mushi-tier-pct:${pct / 100}"></div>
|
|
3476
3652
|
</div>
|
|
3477
3653
|
<div class="mushi-rewards-next-label">${nextLabel}</div>
|
|
3478
3654
|
` : ""}
|
|
@@ -3496,7 +3672,7 @@ function renderSuccessRewards(ctx) {
|
|
|
3496
3672
|
<div class="mushi-success-pts-award">+${pointsForReport} pts</div>
|
|
3497
3673
|
${nextTier ? `
|
|
3498
3674
|
<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)}">
|
|
3499
|
-
<div class="mushi-tier-bar-fill" style="
|
|
3675
|
+
<div class="mushi-tier-bar-fill" style="--mushi-tier-pct:${pctAfter / 100}"></div>
|
|
3500
3676
|
</div>
|
|
3501
3677
|
<div class="mushi-rewards-next-label">${nextLabel}</div>
|
|
3502
3678
|
` : ""}
|
|
@@ -3505,6 +3681,12 @@ function renderSuccessRewards(ctx) {
|
|
|
3505
3681
|
}
|
|
3506
3682
|
|
|
3507
3683
|
// src/widget.ts
|
|
3684
|
+
function looksUnsureAssistantAnswer(text) {
|
|
3685
|
+
const lower = text.toLowerCase();
|
|
3686
|
+
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(
|
|
3687
|
+
lower
|
|
3688
|
+
) || /わかりません|分かりません|不明|報告して/.test(text);
|
|
3689
|
+
}
|
|
3508
3690
|
var MushiWidget = class _MushiWidget {
|
|
3509
3691
|
constructor(config = {}, callbacks, sdkVersion = MUSHI_SDK_VERSION) {
|
|
3510
3692
|
this.sdkVersion = sdkVersion;
|
|
@@ -3551,6 +3733,11 @@ var MushiWidget = class _MushiWidget {
|
|
|
3551
3733
|
};
|
|
3552
3734
|
this.callbacks = callbacks;
|
|
3553
3735
|
this.locale = getLocale(this.config.locale === "auto" ? void 0 : this.config.locale);
|
|
3736
|
+
const saved = loadAssistantSession();
|
|
3737
|
+
if (saved?.turns.length) {
|
|
3738
|
+
this.assistantTurns = saved.turns;
|
|
3739
|
+
this.assistantThreadId = saved.threadId;
|
|
3740
|
+
}
|
|
3554
3741
|
this.host = document.createElement("div");
|
|
3555
3742
|
this.host.id = "mushi-mushi-widget";
|
|
3556
3743
|
this.shadow = this.host.attachShadow({ mode: "open" });
|
|
@@ -3558,6 +3745,9 @@ var MushiWidget = class _MushiWidget {
|
|
|
3558
3745
|
sdkVersion;
|
|
3559
3746
|
host;
|
|
3560
3747
|
shadow;
|
|
3748
|
+
/** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
|
|
3749
|
+
colorSchemeMq = null;
|
|
3750
|
+
onColorSchemeChange = null;
|
|
3561
3751
|
config;
|
|
3562
3752
|
callbacks;
|
|
3563
3753
|
locale;
|
|
@@ -3656,6 +3846,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3656
3846
|
* Drives a different success copy so the user knows the report
|
|
3657
3847
|
* hasn't actually reached the console yet. */
|
|
3658
3848
|
lastSubmitQueuedOffline = false;
|
|
3849
|
+
lastSubmitFailureKind;
|
|
3659
3850
|
lastSubmitScreenshotDropped = false;
|
|
3660
3851
|
/** Whether the user has clicked ✕ on the header banner this session. */
|
|
3661
3852
|
bannerDismissed = false;
|
|
@@ -3700,6 +3891,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3700
3891
|
document.body.appendChild(this.host);
|
|
3701
3892
|
this.syncAttachedLaunchers();
|
|
3702
3893
|
this.syncSmartHide();
|
|
3894
|
+
this.bindColorSchemeListener();
|
|
3703
3895
|
this.render();
|
|
3704
3896
|
this.mountedAt = Date.now();
|
|
3705
3897
|
}
|
|
@@ -3800,6 +3992,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3800
3992
|
this.removeSelectorHint();
|
|
3801
3993
|
this.lastReportId = null;
|
|
3802
3994
|
this.lastSubmitQueuedOffline = false;
|
|
3995
|
+
this.lastSubmitFailureKind = void 0;
|
|
3803
3996
|
this.lastSubmitScreenshotDropped = false;
|
|
3804
3997
|
this.viaFeatureRequest = false;
|
|
3805
3998
|
this.clearFormDrafts();
|
|
@@ -3861,6 +4054,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3861
4054
|
this.assistantSending = true;
|
|
3862
4055
|
this.assistantError = null;
|
|
3863
4056
|
this.assistantTurns.push({ role: "user", text });
|
|
4057
|
+
this.persistAssistantSession();
|
|
3864
4058
|
this.render();
|
|
3865
4059
|
try {
|
|
3866
4060
|
const reply = await this.callbacks.onAssistantAsk(text, this.assistantThreadId);
|
|
@@ -3870,11 +4064,19 @@ var MushiWidget = class _MushiWidget {
|
|
|
3870
4064
|
this.assistantTurns.push({
|
|
3871
4065
|
role: "assistant",
|
|
3872
4066
|
text: reply.question ?? "Could you tell me a bit more?",
|
|
3873
|
-
...reply.options && reply.options.length ? { options: reply.options } : {}
|
|
4067
|
+
...reply.options && reply.options.length ? { options: reply.options } : {},
|
|
4068
|
+
offerReport: true
|
|
3874
4069
|
});
|
|
3875
4070
|
} else {
|
|
3876
|
-
|
|
4071
|
+
const answerText = reply.text ?? "\u2026";
|
|
4072
|
+
const unsure = looksUnsureAssistantAnswer(answerText);
|
|
4073
|
+
this.assistantTurns.push({
|
|
4074
|
+
role: "assistant",
|
|
4075
|
+
text: answerText,
|
|
4076
|
+
...unsure ? { offerReport: true } : {}
|
|
4077
|
+
});
|
|
3877
4078
|
}
|
|
4079
|
+
this.persistAssistantSession();
|
|
3878
4080
|
} else {
|
|
3879
4081
|
this.assistantError = this.locale.assistant.errors.noResponse;
|
|
3880
4082
|
}
|
|
@@ -3889,6 +4091,33 @@ var MushiWidget = class _MushiWidget {
|
|
|
3889
4091
|
}, 0);
|
|
3890
4092
|
}
|
|
3891
4093
|
}
|
|
4094
|
+
/** Persist Ask turns for same-tab reload survival (UX only). */
|
|
4095
|
+
persistAssistantSession() {
|
|
4096
|
+
saveAssistantSession({
|
|
4097
|
+
turns: this.assistantTurns,
|
|
4098
|
+
threadId: this.assistantThreadId
|
|
4099
|
+
});
|
|
4100
|
+
}
|
|
4101
|
+
/** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
|
|
4102
|
+
clearAssistantTranscript() {
|
|
4103
|
+
this.assistantTurns = [];
|
|
4104
|
+
this.assistantThreadId = null;
|
|
4105
|
+
this.assistantError = null;
|
|
4106
|
+
clearAssistantSession();
|
|
4107
|
+
if (this.step === "assistant") this.render();
|
|
4108
|
+
}
|
|
4109
|
+
/** Escape hatch from Ask → report category picker (no login required). */
|
|
4110
|
+
openReportFromAssistant() {
|
|
4111
|
+
this.selectedCategory = null;
|
|
4112
|
+
this.selectedIntent = null;
|
|
4113
|
+
this.viaFeatureRequest = false;
|
|
4114
|
+
this.step = "category";
|
|
4115
|
+
if (!this.isOpen) {
|
|
4116
|
+
this.isOpen = true;
|
|
4117
|
+
this.callbacks.onOpen();
|
|
4118
|
+
}
|
|
4119
|
+
this.render();
|
|
4120
|
+
}
|
|
3892
4121
|
/**
|
|
3893
4122
|
* Briefly highlight the trigger button (a soft pulse + tooltip) without
|
|
3894
4123
|
* opening the full reporter panel. Use for first-session welcome nudges
|
|
@@ -4138,6 +4367,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4138
4367
|
clearTimeout(this.smartHideTimer);
|
|
4139
4368
|
this.smartHideTimer = null;
|
|
4140
4369
|
}
|
|
4370
|
+
this.unbindColorSchemeListener();
|
|
4141
4371
|
this.smartHideCleanup?.();
|
|
4142
4372
|
this.smartHideCleanup = null;
|
|
4143
4373
|
this.teardownViewportHandlers();
|
|
@@ -4148,6 +4378,33 @@ var MushiWidget = class _MushiWidget {
|
|
|
4148
4378
|
this.removeBodyNudge();
|
|
4149
4379
|
this.host.remove();
|
|
4150
4380
|
}
|
|
4381
|
+
/** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
|
|
4382
|
+
bindColorSchemeListener() {
|
|
4383
|
+
this.unbindColorSchemeListener();
|
|
4384
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
4385
|
+
const theme = this.config.theme;
|
|
4386
|
+
if (theme !== "auto" && theme !== "inherit") return;
|
|
4387
|
+
this.colorSchemeMq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
4388
|
+
this.onColorSchemeChange = () => {
|
|
4389
|
+
if (this.host.isConnected) this.render();
|
|
4390
|
+
};
|
|
4391
|
+
if (typeof this.colorSchemeMq.addEventListener === "function") {
|
|
4392
|
+
this.colorSchemeMq.addEventListener("change", this.onColorSchemeChange);
|
|
4393
|
+
} else if (typeof this.colorSchemeMq.addListener === "function") {
|
|
4394
|
+
this.colorSchemeMq.addListener(this.onColorSchemeChange);
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
unbindColorSchemeListener() {
|
|
4398
|
+
if (this.colorSchemeMq && this.onColorSchemeChange) {
|
|
4399
|
+
if (typeof this.colorSchemeMq.removeEventListener === "function") {
|
|
4400
|
+
this.colorSchemeMq.removeEventListener("change", this.onColorSchemeChange);
|
|
4401
|
+
} else if (typeof this.colorSchemeMq.removeListener === "function") {
|
|
4402
|
+
this.colorSchemeMq.removeListener(this.onColorSchemeChange);
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
this.colorSchemeMq = null;
|
|
4406
|
+
this.onColorSchemeChange = null;
|
|
4407
|
+
}
|
|
4151
4408
|
/* ── Host chrome contract ────────────────────────────────────────────────
|
|
4152
4409
|
The host element must never create an invisible full-screen touch blocker.
|
|
4153
4410
|
We own these inline styles — consumer CSS can only win with `!important`,
|
|
@@ -4933,6 +5190,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4933
5190
|
leaderboardLoading: this.leaderboardLoading,
|
|
4934
5191
|
leaderboardEntries: this.leaderboardEntries,
|
|
4935
5192
|
lastSubmitQueuedOffline: this.lastSubmitQueuedOffline,
|
|
5193
|
+
lastSubmitFailureKind: this.lastSubmitFailureKind,
|
|
4936
5194
|
lastSubmitScreenshotDropped: this.lastSubmitScreenshotDropped,
|
|
4937
5195
|
featureBoard: this.featureBoard,
|
|
4938
5196
|
crossAppReports: this.crossAppReports,
|
|
@@ -5013,6 +5271,11 @@ var MushiWidget = class _MushiWidget {
|
|
|
5013
5271
|
if (value) void this.sendAssistantMessage(value);
|
|
5014
5272
|
});
|
|
5015
5273
|
});
|
|
5274
|
+
panel.querySelectorAll('[data-action="assistant-report"]').forEach((btn) => {
|
|
5275
|
+
btn.addEventListener("click", () => {
|
|
5276
|
+
this.openReportFromAssistant();
|
|
5277
|
+
});
|
|
5278
|
+
});
|
|
5016
5279
|
{
|
|
5017
5280
|
const form = panel.querySelector('[data-action="assistant-send"]');
|
|
5018
5281
|
if (form) {
|
|
@@ -5217,6 +5480,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5217
5480
|
this.submittedAt = /* @__PURE__ */ new Date();
|
|
5218
5481
|
this.lastReportId = null;
|
|
5219
5482
|
this.lastSubmitQueuedOffline = false;
|
|
5483
|
+
this.lastSubmitFailureKind = void 0;
|
|
5220
5484
|
this.lastSubmitScreenshotDropped = false;
|
|
5221
5485
|
this.render();
|
|
5222
5486
|
const outcomeP = (async () => {
|
|
@@ -5250,6 +5514,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5250
5514
|
if (outcome) {
|
|
5251
5515
|
this.lastReportId = outcome.reportId ?? null;
|
|
5252
5516
|
this.lastSubmitQueuedOffline = Boolean(outcome.queuedOffline);
|
|
5517
|
+
this.lastSubmitFailureKind = outcome.failureKind;
|
|
5253
5518
|
this.lastSubmitScreenshotDropped = Boolean(outcome.screenshotDropped);
|
|
5254
5519
|
this.render();
|
|
5255
5520
|
}
|
|
@@ -6070,59 +6335,6 @@ function renderConsentBanner(projectId, config) {
|
|
|
6070
6335
|
});
|
|
6071
6336
|
document.body.appendChild(consentHost);
|
|
6072
6337
|
}
|
|
6073
|
-
|
|
6074
|
-
// src/capture/console.ts
|
|
6075
|
-
var MAX_ENTRIES = 50;
|
|
6076
|
-
var MAX_MESSAGE_LENGTH = 500;
|
|
6077
|
-
function createConsoleCapture() {
|
|
6078
|
-
const entries = [];
|
|
6079
|
-
const originals = {};
|
|
6080
|
-
const wrappers = {};
|
|
6081
|
-
const levels = ["log", "warn", "error", "info", "debug"];
|
|
6082
|
-
for (const level of levels) {
|
|
6083
|
-
const original = console[level];
|
|
6084
|
-
originals[level] = original;
|
|
6085
|
-
const wrapper = (...args) => {
|
|
6086
|
-
const message = args.map((arg) => {
|
|
6087
|
-
try {
|
|
6088
|
-
return typeof arg === "string" ? arg : JSON.stringify(arg);
|
|
6089
|
-
} catch {
|
|
6090
|
-
return String(arg);
|
|
6091
|
-
}
|
|
6092
|
-
}).join(" ").slice(0, MAX_MESSAGE_LENGTH);
|
|
6093
|
-
const entry = {
|
|
6094
|
-
level,
|
|
6095
|
-
message,
|
|
6096
|
-
timestamp: Date.now()
|
|
6097
|
-
};
|
|
6098
|
-
if (level === "error" && args[0] instanceof Error) {
|
|
6099
|
-
entry.stack = args[0].stack?.slice(0, 1e3);
|
|
6100
|
-
}
|
|
6101
|
-
entries.push(entry);
|
|
6102
|
-
if (entries.length > MAX_ENTRIES) {
|
|
6103
|
-
entries.shift();
|
|
6104
|
-
}
|
|
6105
|
-
original.call(console, ...args);
|
|
6106
|
-
};
|
|
6107
|
-
wrappers[level] = wrapper;
|
|
6108
|
-
console[level] = wrapper;
|
|
6109
|
-
}
|
|
6110
|
-
return {
|
|
6111
|
-
getEntries() {
|
|
6112
|
-
return [...entries];
|
|
6113
|
-
},
|
|
6114
|
-
clear() {
|
|
6115
|
-
entries.length = 0;
|
|
6116
|
-
},
|
|
6117
|
-
destroy() {
|
|
6118
|
-
for (const level of levels) {
|
|
6119
|
-
if (originals[level] && console[level] === wrappers[level]) {
|
|
6120
|
-
console[level] = originals[level];
|
|
6121
|
-
}
|
|
6122
|
-
}
|
|
6123
|
-
}
|
|
6124
|
-
};
|
|
6125
|
-
}
|
|
6126
6338
|
var DEFAULT_INTERNAL_URL_MATCHERS = [
|
|
6127
6339
|
/\/v1\/sdk(?:\/|$)/,
|
|
6128
6340
|
/\/v1\/reports(?:\/|$)/,
|
|
@@ -6186,7 +6398,7 @@ function readHeader(headers, name) {
|
|
|
6186
6398
|
}
|
|
6187
6399
|
|
|
6188
6400
|
// src/capture/network.ts
|
|
6189
|
-
var
|
|
6401
|
+
var MAX_ENTRIES = 30;
|
|
6190
6402
|
var TRACEPARENT_VERSION = "00";
|
|
6191
6403
|
function generateTraceparent() {
|
|
6192
6404
|
const traceBytes = crypto.getRandomValues(new Uint8Array(16));
|
|
@@ -6210,9 +6422,21 @@ function matchesCorsUrls(url, corsUrls) {
|
|
|
6210
6422
|
}
|
|
6211
6423
|
return false;
|
|
6212
6424
|
}
|
|
6425
|
+
var _activeCorrelationStack = [];
|
|
6426
|
+
function getActiveCorrelationId() {
|
|
6427
|
+
return _activeCorrelationStack[_activeCorrelationStack.length - 1];
|
|
6428
|
+
}
|
|
6429
|
+
function generateCorrelationId() {
|
|
6430
|
+
const bytes = crypto.getRandomValues(new Uint8Array(4));
|
|
6431
|
+
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
6432
|
+
}
|
|
6213
6433
|
function createNetworkCapture(options = {}) {
|
|
6214
6434
|
const entries = [];
|
|
6215
6435
|
const originalFetch = globalThis.fetch;
|
|
6436
|
+
const OriginalXHR = typeof XMLHttpRequest !== "undefined" ? XMLHttpRequest : null;
|
|
6437
|
+
const originalXhrOpen = OriginalXHR ? XMLHttpRequest.prototype.open : null;
|
|
6438
|
+
const originalXhrSend = OriginalXHR ? XMLHttpRequest.prototype.send : null;
|
|
6439
|
+
const originalXhrSetRequestHeader = OriginalXHR ? XMLHttpRequest.prototype.setRequestHeader : null;
|
|
6216
6440
|
let activeOptions = options;
|
|
6217
6441
|
let fetchWrapper;
|
|
6218
6442
|
globalThis.fetch = fetchWrapper = async function mushiFetchInterceptor(input, init) {
|
|
@@ -6221,6 +6445,7 @@ function createNetworkCapture(options = {}) {
|
|
|
6221
6445
|
const url = getRequestUrl(input);
|
|
6222
6446
|
const internalKind = getInternalRequestKind(input, init);
|
|
6223
6447
|
const shouldRecord = !internalKind && !shouldIgnoreMushiUrl(url, activeOptions);
|
|
6448
|
+
const correlationId = shouldRecord ? generateCorrelationId() : void 0;
|
|
6224
6449
|
let traceId;
|
|
6225
6450
|
let patchedInit = init;
|
|
6226
6451
|
const tp = activeOptions.tracePropagation;
|
|
@@ -6234,6 +6459,7 @@ function createNetworkCapture(options = {}) {
|
|
|
6234
6459
|
}
|
|
6235
6460
|
patchedInit = { ...init, headers: existingHeaders };
|
|
6236
6461
|
}
|
|
6462
|
+
if (correlationId) _activeCorrelationStack.push(correlationId);
|
|
6237
6463
|
try {
|
|
6238
6464
|
const response = await originalFetch.call(globalThis, input, patchedInit);
|
|
6239
6465
|
if (shouldRecord) {
|
|
@@ -6243,7 +6469,9 @@ function createNetworkCapture(options = {}) {
|
|
|
6243
6469
|
status: response.status,
|
|
6244
6470
|
duration: Date.now() - startTime,
|
|
6245
6471
|
timestamp: startTime,
|
|
6246
|
-
|
|
6472
|
+
captureMethod: "fetch",
|
|
6473
|
+
...traceId ? { traceId } : {},
|
|
6474
|
+
...correlationId ? { correlationId } : {}
|
|
6247
6475
|
});
|
|
6248
6476
|
}
|
|
6249
6477
|
return response;
|
|
@@ -6256,15 +6484,99 @@ function createNetworkCapture(options = {}) {
|
|
|
6256
6484
|
duration: Date.now() - startTime,
|
|
6257
6485
|
timestamp: startTime,
|
|
6258
6486
|
error: error instanceof Error ? error.message : "Network error",
|
|
6259
|
-
|
|
6487
|
+
captureMethod: "fetch",
|
|
6488
|
+
...traceId ? { traceId } : {},
|
|
6489
|
+
...correlationId ? { correlationId } : {}
|
|
6260
6490
|
});
|
|
6261
6491
|
}
|
|
6262
6492
|
throw error;
|
|
6493
|
+
} finally {
|
|
6494
|
+
if (correlationId) {
|
|
6495
|
+
const idx = _activeCorrelationStack.lastIndexOf(correlationId);
|
|
6496
|
+
if (idx !== -1) _activeCorrelationStack.splice(idx, 1);
|
|
6497
|
+
}
|
|
6263
6498
|
}
|
|
6264
6499
|
};
|
|
6500
|
+
const xhrStateMap = typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : null;
|
|
6501
|
+
if (OriginalXHR && originalXhrOpen && originalXhrSend && originalXhrSetRequestHeader && xhrStateMap) {
|
|
6502
|
+
const _originalOpen = originalXhrOpen;
|
|
6503
|
+
XMLHttpRequest.prototype.open = function mushiXhrOpen(...args) {
|
|
6504
|
+
const [method, url] = args;
|
|
6505
|
+
const urlStr = typeof url === "string" ? url : String(url);
|
|
6506
|
+
const shouldRecord = !shouldIgnoreMushiUrl(urlStr, activeOptions);
|
|
6507
|
+
const correlationId = shouldRecord ? generateCorrelationId() : void 0;
|
|
6508
|
+
let traceId;
|
|
6509
|
+
let storedTraceparent;
|
|
6510
|
+
const tp = activeOptions.tracePropagation;
|
|
6511
|
+
if (shouldRecord && tp?.enabled && tp.corsUrls?.length && matchesCorsUrls(urlStr, tp.corsUrls)) {
|
|
6512
|
+
const generated = generateTraceparent();
|
|
6513
|
+
traceId = generated.traceId;
|
|
6514
|
+
storedTraceparent = generated.traceparent;
|
|
6515
|
+
}
|
|
6516
|
+
const _prevXhrState = xhrStateMap.get(this);
|
|
6517
|
+
if (_prevXhrState?._listener) {
|
|
6518
|
+
this.removeEventListener("readystatechange", _prevXhrState._listener);
|
|
6519
|
+
}
|
|
6520
|
+
xhrStateMap.set(this, {
|
|
6521
|
+
method: String(method).toUpperCase(),
|
|
6522
|
+
url: truncateUrl(urlStr),
|
|
6523
|
+
startTime: 0,
|
|
6524
|
+
// set in .send()
|
|
6525
|
+
shouldRecord,
|
|
6526
|
+
...traceId ? { traceId } : {},
|
|
6527
|
+
...correlationId ? { correlationId } : {},
|
|
6528
|
+
// Attach the traceparent string as an extra prop for injection in .send().
|
|
6529
|
+
...storedTraceparent ? { _traceparent: storedTraceparent } : {}
|
|
6530
|
+
});
|
|
6531
|
+
_originalOpen.apply(this, args);
|
|
6532
|
+
};
|
|
6533
|
+
XMLHttpRequest.prototype.send = function mushiXhrSend(body) {
|
|
6534
|
+
const state = xhrStateMap.get(this);
|
|
6535
|
+
if (state) {
|
|
6536
|
+
state.startTime = Date.now();
|
|
6537
|
+
const xhrTraceparent = state._traceparent;
|
|
6538
|
+
if (xhrTraceparent) {
|
|
6539
|
+
originalXhrSetRequestHeader.call(this, "traceparent", xhrTraceparent);
|
|
6540
|
+
if (activeOptions.sessionId) {
|
|
6541
|
+
originalXhrSetRequestHeader.call(this, "x-mushi-session", activeOptions.sessionId);
|
|
6542
|
+
}
|
|
6543
|
+
}
|
|
6544
|
+
if (state.correlationId) _activeCorrelationStack.push(state.correlationId);
|
|
6545
|
+
const _readystateHandler = () => {
|
|
6546
|
+
if (this.readyState !== 4) return;
|
|
6547
|
+
if (state.shouldRecord) {
|
|
6548
|
+
const duration = Date.now() - state.startTime;
|
|
6549
|
+
const entry = {
|
|
6550
|
+
method: state.method,
|
|
6551
|
+
url: state.url,
|
|
6552
|
+
status: this.status,
|
|
6553
|
+
duration,
|
|
6554
|
+
timestamp: state.startTime,
|
|
6555
|
+
captureMethod: "xhr",
|
|
6556
|
+
...state.traceId ? { traceId: state.traceId } : {},
|
|
6557
|
+
...state.correlationId ? { correlationId: state.correlationId } : {}
|
|
6558
|
+
};
|
|
6559
|
+
if (this.status === 0) {
|
|
6560
|
+
entry.error = "XHR network error or aborted";
|
|
6561
|
+
}
|
|
6562
|
+
addEntry(entry);
|
|
6563
|
+
}
|
|
6564
|
+
if (state.correlationId) {
|
|
6565
|
+
const idx = _activeCorrelationStack.lastIndexOf(state.correlationId);
|
|
6566
|
+
if (idx !== -1) _activeCorrelationStack.splice(idx, 1);
|
|
6567
|
+
}
|
|
6568
|
+
};
|
|
6569
|
+
state._listener = _readystateHandler;
|
|
6570
|
+
this.addEventListener("readystatechange", _readystateHandler);
|
|
6571
|
+
}
|
|
6572
|
+
originalXhrSend.call(this, body);
|
|
6573
|
+
};
|
|
6574
|
+
}
|
|
6575
|
+
const xhrOpenWrapper = OriginalXHR ? XMLHttpRequest.prototype.open : null;
|
|
6576
|
+
const xhrSendWrapper = OriginalXHR ? XMLHttpRequest.prototype.send : null;
|
|
6265
6577
|
function addEntry(entry) {
|
|
6266
6578
|
entries.push(entry);
|
|
6267
|
-
if (entries.length >
|
|
6579
|
+
if (entries.length > MAX_ENTRIES) {
|
|
6268
6580
|
entries.shift();
|
|
6269
6581
|
}
|
|
6270
6582
|
}
|
|
@@ -6282,22 +6594,86 @@ function createNetworkCapture(options = {}) {
|
|
|
6282
6594
|
if (globalThis.fetch === fetchWrapper) {
|
|
6283
6595
|
globalThis.fetch = originalFetch;
|
|
6284
6596
|
}
|
|
6597
|
+
if (OriginalXHR && originalXhrOpen && originalXhrSend) {
|
|
6598
|
+
if (xhrOpenWrapper && XMLHttpRequest.prototype.open === xhrOpenWrapper) {
|
|
6599
|
+
XMLHttpRequest.prototype.open = originalXhrOpen;
|
|
6600
|
+
}
|
|
6601
|
+
if (xhrSendWrapper && XMLHttpRequest.prototype.send === xhrSendWrapper) {
|
|
6602
|
+
XMLHttpRequest.prototype.send = originalXhrSend;
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
6285
6605
|
}
|
|
6286
6606
|
};
|
|
6287
6607
|
}
|
|
6288
6608
|
function truncateUrl(url) {
|
|
6609
|
+
const scrubbed = core.scrubUrl(url);
|
|
6289
6610
|
try {
|
|
6290
|
-
const parsed = new URL(
|
|
6611
|
+
const parsed = new URL(scrubbed);
|
|
6291
6612
|
const path = parsed.pathname + parsed.search;
|
|
6292
6613
|
if (path.length > 200) {
|
|
6293
6614
|
return parsed.origin + path.slice(0, 200) + "...";
|
|
6294
6615
|
}
|
|
6295
6616
|
return parsed.origin + path;
|
|
6296
6617
|
} catch {
|
|
6297
|
-
return
|
|
6618
|
+
return scrubbed.slice(0, 200);
|
|
6298
6619
|
}
|
|
6299
6620
|
}
|
|
6300
6621
|
|
|
6622
|
+
// src/capture/console.ts
|
|
6623
|
+
var MAX_ENTRIES2 = 50;
|
|
6624
|
+
var MAX_MESSAGE_LENGTH = 500;
|
|
6625
|
+
function createConsoleCapture() {
|
|
6626
|
+
const entries = [];
|
|
6627
|
+
const originals = {};
|
|
6628
|
+
const wrappers = {};
|
|
6629
|
+
const levels = ["log", "warn", "error", "info", "debug"];
|
|
6630
|
+
for (const level of levels) {
|
|
6631
|
+
const original = console[level];
|
|
6632
|
+
originals[level] = original;
|
|
6633
|
+
const wrapper = (...args) => {
|
|
6634
|
+
const message = args.map((arg) => {
|
|
6635
|
+
try {
|
|
6636
|
+
return typeof arg === "string" ? arg : JSON.stringify(arg);
|
|
6637
|
+
} catch {
|
|
6638
|
+
return String(arg);
|
|
6639
|
+
}
|
|
6640
|
+
}).join(" ").slice(0, MAX_MESSAGE_LENGTH);
|
|
6641
|
+
const correlationId = getActiveCorrelationId();
|
|
6642
|
+
const entry = {
|
|
6643
|
+
level,
|
|
6644
|
+
message,
|
|
6645
|
+
timestamp: Date.now(),
|
|
6646
|
+
...correlationId ? { correlationId } : {}
|
|
6647
|
+
};
|
|
6648
|
+
if (level === "error" && args[0] instanceof Error) {
|
|
6649
|
+
entry.stack = args[0].stack?.slice(0, 1e3);
|
|
6650
|
+
}
|
|
6651
|
+
entries.push(entry);
|
|
6652
|
+
if (entries.length > MAX_ENTRIES2) {
|
|
6653
|
+
entries.shift();
|
|
6654
|
+
}
|
|
6655
|
+
original.call(console, ...args);
|
|
6656
|
+
};
|
|
6657
|
+
wrappers[level] = wrapper;
|
|
6658
|
+
console[level] = wrapper;
|
|
6659
|
+
}
|
|
6660
|
+
return {
|
|
6661
|
+
getEntries() {
|
|
6662
|
+
return [...entries];
|
|
6663
|
+
},
|
|
6664
|
+
clear() {
|
|
6665
|
+
entries.length = 0;
|
|
6666
|
+
},
|
|
6667
|
+
destroy() {
|
|
6668
|
+
for (const level of levels) {
|
|
6669
|
+
if (originals[level] && console[level] === wrappers[level]) {
|
|
6670
|
+
console[level] = originals[level];
|
|
6671
|
+
}
|
|
6672
|
+
}
|
|
6673
|
+
}
|
|
6674
|
+
};
|
|
6675
|
+
}
|
|
6676
|
+
|
|
6301
6677
|
// src/capture/screenshot.ts
|
|
6302
6678
|
function createScreenshotCapture(options = {}) {
|
|
6303
6679
|
let activeOptions = options;
|
|
@@ -6831,8 +7207,6 @@ function createElementSelector() {
|
|
|
6831
7207
|
}
|
|
6832
7208
|
return { activate, deactivate, isActive: () => active };
|
|
6833
7209
|
}
|
|
6834
|
-
|
|
6835
|
-
// src/capture/timeline.ts
|
|
6836
7210
|
var MAX_TIMELINE_ENTRIES = 120;
|
|
6837
7211
|
function createTimelineCapture() {
|
|
6838
7212
|
const entries = [];
|
|
@@ -6849,8 +7223,11 @@ function createTimelineCapture() {
|
|
|
6849
7223
|
kind: "route",
|
|
6850
7224
|
payload: {
|
|
6851
7225
|
source,
|
|
6852
|
-
|
|
6853
|
-
|
|
7226
|
+
// Query VALUES are a PII channel (`?token=…`, `?email=…`) — scrub
|
|
7227
|
+
// them at capture, both in the search string and inside hash-router
|
|
7228
|
+
// fragments (`#/path?query`). Keys and paths are preserved.
|
|
7229
|
+
route: core.scrubUrl(`${location.pathname}${location.search}${location.hash}`),
|
|
7230
|
+
href: core.scrubUrl(location.href)
|
|
6854
7231
|
}
|
|
6855
7232
|
});
|
|
6856
7233
|
}
|
|
@@ -6937,6 +7314,18 @@ function normalizeSegment(seg) {
|
|
|
6937
7314
|
if (SLUG_HASHY_RE.test(seg) && /\d/.test(seg)) return "[id]";
|
|
6938
7315
|
return seg;
|
|
6939
7316
|
}
|
|
7317
|
+
function deriveRoute(pathname, hash, templates) {
|
|
7318
|
+
if (hash.startsWith("#/")) {
|
|
7319
|
+
const raw = hash.slice(1);
|
|
7320
|
+
const qIdx = raw.indexOf("?");
|
|
7321
|
+
const hashPath = qIdx === -1 ? raw : raw.slice(0, qIdx);
|
|
7322
|
+
const hashTemplates = templates?.map(
|
|
7323
|
+
(t) => t.startsWith("/#/") ? t.slice(2) : t
|
|
7324
|
+
);
|
|
7325
|
+
return "/#" + normalizeRoute(hashPath, hashTemplates);
|
|
7326
|
+
}
|
|
7327
|
+
return normalizeRoute(pathname, templates);
|
|
7328
|
+
}
|
|
6940
7329
|
function normalizeRoute(pathname, templates) {
|
|
6941
7330
|
const clean = pathname.length > 1 && pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
|
|
6942
7331
|
if (templates?.length) {
|
|
@@ -6980,9 +7369,14 @@ function readTestids() {
|
|
|
6980
7369
|
function readQueryParamKeys() {
|
|
6981
7370
|
if (typeof window === "undefined") return [];
|
|
6982
7371
|
try {
|
|
6983
|
-
const params = new URLSearchParams(window.location.search);
|
|
6984
7372
|
const out = /* @__PURE__ */ new Set();
|
|
6985
|
-
|
|
7373
|
+
const collect = (qs) => {
|
|
7374
|
+
new URLSearchParams(qs).forEach((_, key) => out.add(key));
|
|
7375
|
+
};
|
|
7376
|
+
collect(window.location.search);
|
|
7377
|
+
const hash = window.location.hash;
|
|
7378
|
+
const qIdx = hash.indexOf("?");
|
|
7379
|
+
if (hash.startsWith("#/") && qIdx !== -1) collect(hash.slice(qIdx + 1));
|
|
6986
7380
|
return Array.from(out).sort();
|
|
6987
7381
|
} catch {
|
|
6988
7382
|
return [];
|
|
@@ -7029,7 +7423,11 @@ function createDiscoveryCapture(opts) {
|
|
|
7029
7423
|
let pendingTimer = null;
|
|
7030
7424
|
async function emitForCurrent() {
|
|
7031
7425
|
if (typeof window === "undefined") return;
|
|
7032
|
-
const route =
|
|
7426
|
+
const route = deriveRoute(
|
|
7427
|
+
window.location.pathname,
|
|
7428
|
+
window.location.hash,
|
|
7429
|
+
config.routeTemplates
|
|
7430
|
+
);
|
|
7033
7431
|
const now = Date.now();
|
|
7034
7432
|
const last = lastEmittedAt.get(route) ?? 0;
|
|
7035
7433
|
if (now - last < throttleMs) return;
|
|
@@ -7061,7 +7459,8 @@ function createDiscoveryCapture(opts) {
|
|
|
7061
7459
|
}
|
|
7062
7460
|
function onMaybeNavigation() {
|
|
7063
7461
|
if (typeof window === "undefined") return;
|
|
7064
|
-
const
|
|
7462
|
+
const hashPart = window.location.hash.startsWith("#/") ? window.location.hash : "";
|
|
7463
|
+
const path = window.location.pathname + window.location.search + hashPart;
|
|
7065
7464
|
if (path === lastPath) return;
|
|
7066
7465
|
lastPath = path;
|
|
7067
7466
|
scheduleEmit();
|
|
@@ -7078,10 +7477,12 @@ function createDiscoveryCapture(opts) {
|
|
|
7078
7477
|
onReplace: onNav,
|
|
7079
7478
|
onPop: onNav
|
|
7080
7479
|
});
|
|
7480
|
+
window.addEventListener("hashchange", onNav);
|
|
7081
7481
|
scheduleEmit();
|
|
7082
7482
|
return {
|
|
7083
7483
|
destroy() {
|
|
7084
7484
|
unsubHistory();
|
|
7485
|
+
window.removeEventListener("hashchange", onNav);
|
|
7085
7486
|
if (pendingTimer) {
|
|
7086
7487
|
clearTimeout(pendingTimer);
|
|
7087
7488
|
pendingTimer = null;
|
|
@@ -7900,6 +8301,14 @@ function createInstance(config) {
|
|
|
7900
8301
|
return next;
|
|
7901
8302
|
});
|
|
7902
8303
|
}
|
|
8304
|
+
function scrubConsoleForWire(logs) {
|
|
8305
|
+
if (!logs) return logs;
|
|
8306
|
+
return logs.map((entry) => ({
|
|
8307
|
+
...entry,
|
|
8308
|
+
message: piiScrubber.scrub(entry.message),
|
|
8309
|
+
...entry.stack ? { stack: piiScrubber.scrub(entry.stack) } : {}
|
|
8310
|
+
}));
|
|
8311
|
+
}
|
|
7903
8312
|
function scrubTagsForWire(tags) {
|
|
7904
8313
|
if (!tags) return void 0;
|
|
7905
8314
|
const out = {};
|
|
@@ -8048,7 +8457,9 @@ function createInstance(config) {
|
|
|
8048
8457
|
discoveryCap = null;
|
|
8049
8458
|
}
|
|
8050
8459
|
const replayMode = activeConfig.capture?.replay ?? "off";
|
|
8051
|
-
|
|
8460
|
+
const replaySampleRate = activeConfig.replaySampleRate ?? 1;
|
|
8461
|
+
const replaySampled = replaySampleRate >= 1 || Math.random() < replaySampleRate;
|
|
8462
|
+
if ((replayMode === "rrweb" || replayMode === "lite") && replaySampled) {
|
|
8052
8463
|
const generation = ++replayGeneration;
|
|
8053
8464
|
void createReplayCapture({
|
|
8054
8465
|
redactSelectors: activeConfig.privacy?.redactSelectors
|
|
@@ -8587,6 +8998,13 @@ function createInstance(config) {
|
|
|
8587
8998
|
});
|
|
8588
8999
|
}
|
|
8589
9000
|
}
|
|
9001
|
+
const isAutomatic = pendingProactiveTrigger !== null;
|
|
9002
|
+
if (isAutomatic && config.sampleRate !== void 0 && config.sampleRate < 1) {
|
|
9003
|
+
if (config.sampleRate <= 0 || Math.random() > config.sampleRate) {
|
|
9004
|
+
log.debug("Report dropped by sampleRate", { sampleRate: config.sampleRate, trigger: pendingProactiveTrigger });
|
|
9005
|
+
return void 0;
|
|
9006
|
+
}
|
|
9007
|
+
}
|
|
8590
9008
|
if (!rateLimiter.tryConsume()) {
|
|
8591
9009
|
log.warn("Report throttled \u2014 rate limit exceeded");
|
|
8592
9010
|
return void 0;
|
|
@@ -8594,7 +9012,7 @@ function createInstance(config) {
|
|
|
8594
9012
|
const scrubbedDescription = piiScrubber.scrub(preFilter.truncate(description));
|
|
8595
9013
|
const sentryCtx = config.sentry ? captureSentryContext(config.sentry) : void 0;
|
|
8596
9014
|
const fingerprintHash = await core.getDeviceFingerprintHash().catch(() => null);
|
|
8597
|
-
const consoleLogs = activeConfig.capture?.console === false ? void 0 : consoleCap?.getEntries();
|
|
9015
|
+
const consoleLogs = activeConfig.capture?.console === false ? void 0 : scrubConsoleForWire(consoleCap?.getEntries());
|
|
8598
9016
|
const networkLogs = activeConfig.capture?.network === false ? void 0 : networkCap?.getEntries();
|
|
8599
9017
|
const reportBreadcrumbs = scrubBreadcrumbsForWire(breadcrumbs.getAll());
|
|
8600
9018
|
const stickyTagSnapshot = scrubTagsForWire(
|
|
@@ -8672,10 +9090,11 @@ function createInstance(config) {
|
|
|
8672
9090
|
config.integrations.custom(builder);
|
|
8673
9091
|
}
|
|
8674
9092
|
let finalReport = report;
|
|
8675
|
-
|
|
9093
|
+
const sendHook = config.beforeSend ?? config.beforeSendFeedback;
|
|
9094
|
+
if (sendHook) {
|
|
8676
9095
|
try {
|
|
8677
9096
|
const hookResult = await Promise.race([
|
|
8678
|
-
Promise.resolve(
|
|
9097
|
+
Promise.resolve(sendHook(report)),
|
|
8679
9098
|
// 2s timeout — async hooks must not block the user's "submit"
|
|
8680
9099
|
// for longer than the network would. Falls back to original.
|
|
8681
9100
|
new Promise(
|
|
@@ -8683,12 +9102,12 @@ function createInstance(config) {
|
|
|
8683
9102
|
)
|
|
8684
9103
|
]);
|
|
8685
9104
|
if (hookResult === null) {
|
|
8686
|
-
log.info("Report dropped by
|
|
9105
|
+
log.info("Report dropped by beforeSend hook", { reportId: report.id });
|
|
8687
9106
|
return;
|
|
8688
9107
|
}
|
|
8689
9108
|
finalReport = hookResult;
|
|
8690
9109
|
} catch (err) {
|
|
8691
|
-
log.warn("
|
|
9110
|
+
log.warn("beforeSend hook threw \u2014 sending unmodified report", {
|
|
8692
9111
|
error: err instanceof Error ? err.message : String(err)
|
|
8693
9112
|
});
|
|
8694
9113
|
}
|
|
@@ -8698,7 +9117,7 @@ function createInstance(config) {
|
|
|
8698
9117
|
await offlineQueue.enqueue(finalReport);
|
|
8699
9118
|
log.info("Offline \u2014 report queued", { reportId: finalReport.id });
|
|
8700
9119
|
emit("report:queued", { reportId: finalReport.id });
|
|
8701
|
-
return { reportId: null, queuedOffline: true };
|
|
9120
|
+
return { reportId: null, queuedOffline: true, failureKind: "offline" };
|
|
8702
9121
|
}
|
|
8703
9122
|
let result = await apiClient2.submitReport(finalReport);
|
|
8704
9123
|
if (!result.ok && result.error?.code === "PAYLOAD_TOO_LARGE") {
|
|
@@ -8752,7 +9171,32 @@ function createInstance(config) {
|
|
|
8752
9171
|
level: "error",
|
|
8753
9172
|
message: `Mushi report dropped \u2014 payload too large (${finalReport.id})`
|
|
8754
9173
|
});
|
|
9174
|
+
pendingScreenshot = null;
|
|
9175
|
+
pendingElement = null;
|
|
9176
|
+
pendingProactiveTrigger = null;
|
|
9177
|
+
return { reportId: null, queuedOffline: false, failureKind: "permanent", screenshotDropped };
|
|
8755
9178
|
} else {
|
|
9179
|
+
const code = result.error?.code ?? "";
|
|
9180
|
+
const isRateLimited = code === "HTTP_429" || code.includes("RATE_LIMIT");
|
|
9181
|
+
const isAuth = code === "HTTP_401" || code.includes("UNAUTHORIZED") || code.includes("INVALID_API_KEY") || code.includes("MISSING_API_KEY");
|
|
9182
|
+
const isQuota = code === "HTTP_403" || code.includes("QUOTA") || code.includes("FORBIDDEN") || code === "feature_not_in_plan";
|
|
9183
|
+
if (isAuth || isQuota) {
|
|
9184
|
+
log.warn("Report rejected \u2014 credentials/quota", { reportId: finalReport.id, error: result.error });
|
|
9185
|
+
emit("report:failed", { reportId: finalReport.id, error: result.error });
|
|
9186
|
+
pendingScreenshot = null;
|
|
9187
|
+
pendingElement = null;
|
|
9188
|
+
pendingProactiveTrigger = null;
|
|
9189
|
+
return { reportId: null, queuedOffline: false, failureKind: "quota" };
|
|
9190
|
+
}
|
|
9191
|
+
if (isRateLimited) {
|
|
9192
|
+
log.warn("Report rate-limited \u2014 queued for retry", { reportId: finalReport.id, error: result.error });
|
|
9193
|
+
await offlineQueue.enqueue(finalReport);
|
|
9194
|
+
emit("report:failed", { reportId: finalReport.id, error: result.error });
|
|
9195
|
+
pendingScreenshot = null;
|
|
9196
|
+
pendingElement = null;
|
|
9197
|
+
pendingProactiveTrigger = null;
|
|
9198
|
+
return { reportId: null, queuedOffline: true, failureKind: "rate_limited" };
|
|
9199
|
+
}
|
|
8756
9200
|
log.warn("Report failed, queuing for retry", { reportId: finalReport.id, error: result.error });
|
|
8757
9201
|
await offlineQueue.enqueue(finalReport);
|
|
8758
9202
|
emit("report:failed", { reportId: finalReport.id, error: result.error });
|
|
@@ -8769,7 +9213,7 @@ function createInstance(config) {
|
|
|
8769
9213
|
const serverId = result.data?.reportId ?? report.id;
|
|
8770
9214
|
return { reportId: serverId, queuedOffline: false, screenshotDropped };
|
|
8771
9215
|
}
|
|
8772
|
-
return { reportId: null, queuedOffline: true };
|
|
9216
|
+
return { reportId: null, queuedOffline: true, failureKind: "retrying" };
|
|
8773
9217
|
}
|
|
8774
9218
|
const sdk = {
|
|
8775
9219
|
report(options) {
|