@mushi-mushi/core 1.20.2 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1407,20 +1407,9 @@ function capturePageLoadTiming(win) {
1407
1407
  }
1408
1408
 
1409
1409
  // src/reporter-token.ts
1410
- var STORAGE_KEY = "mushi_reporter_token";
1411
- function getReporterToken() {
1412
- if (typeof localStorage !== "undefined") {
1413
- const existing = localStorage.getItem(STORAGE_KEY);
1414
- if (existing) return existing;
1415
- }
1416
- const token = generateToken();
1417
- if (typeof localStorage !== "undefined") {
1418
- try {
1419
- localStorage.setItem(STORAGE_KEY, token);
1420
- } catch {
1421
- }
1422
- }
1423
- return token;
1410
+ var LEGACY_STORAGE_KEY = "mushi_reporter_token";
1411
+ function storageKey(projectId) {
1412
+ return `mushi:reporter-token:${projectId}`;
1424
1413
  }
1425
1414
  function generateToken() {
1426
1415
  if (typeof crypto !== "undefined" && crypto.randomUUID) {
@@ -1437,6 +1426,38 @@ function generateToken() {
1437
1426
  const hex = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
1438
1427
  return `mushi_${hex}`;
1439
1428
  }
1429
+ function readStoredToken(key) {
1430
+ if (typeof localStorage === "undefined") return null;
1431
+ try {
1432
+ const existing = localStorage.getItem(key);
1433
+ return existing && existing.length > 0 ? existing : null;
1434
+ } catch {
1435
+ return null;
1436
+ }
1437
+ }
1438
+ function writeStoredToken(key, token) {
1439
+ if (typeof localStorage === "undefined") return;
1440
+ try {
1441
+ localStorage.setItem(key, token);
1442
+ } catch {
1443
+ }
1444
+ }
1445
+ function getReporterToken(projectId) {
1446
+ if (!projectId) {
1447
+ const legacy2 = readStoredToken(LEGACY_STORAGE_KEY);
1448
+ if (legacy2) return legacy2;
1449
+ const token2 = generateToken();
1450
+ writeStoredToken(LEGACY_STORAGE_KEY, token2);
1451
+ return token2;
1452
+ }
1453
+ const key = storageKey(projectId);
1454
+ const scoped = readStoredToken(key);
1455
+ if (scoped) return scoped;
1456
+ const legacy = readStoredToken(LEGACY_STORAGE_KEY);
1457
+ const token = legacy ?? generateToken();
1458
+ writeStoredToken(key, token);
1459
+ return token;
1460
+ }
1440
1461
 
1441
1462
  // src/uuid.ts
1442
1463
  function newUuid() {
@@ -1732,6 +1753,42 @@ var MUSHI_COLORS_DARK = {
1732
1753
  ok: "#4ADE80",
1733
1754
  danger: "#F87171"
1734
1755
  };
1756
+ var MUSHI_TIER_COLORS = {
1757
+ free: MUSHI_COLORS_LIGHT.inkMuted,
1758
+ explorer: "#2563EB",
1759
+ contributor: "#7C3AED",
1760
+ champion: "#D97706",
1761
+ default: MUSHI_COLORS_LIGHT.accent
1762
+ };
1763
+ var MUSHI_BANNER_NEON = {
1764
+ bg: "#0FFF50",
1765
+ fg: "#0a1a0a",
1766
+ border: "#00C43A"
1767
+ };
1768
+ var MUSHI_ON_ACCENT = "#FAF7F0";
1769
+ var MUSHI_INVERSE = "#ffffff";
1770
+ var MUSHI_ACCENT_SHADOW = {
1771
+ light: "#9A2A1E",
1772
+ dark: "#7A1F15"
1773
+ };
1774
+ var MUSHI_BANNER_BRAND_BORDER = {
1775
+ light: "#B52F1F",
1776
+ dark: "#C4321E"
1777
+ };
1778
+ var MUSHI_REPORTER_STATUS = {
1779
+ light: {
1780
+ sent: { fg: "#1E4A8C", bg: "rgba(30,74,140,0.08)", border: "rgba(30,74,140,0.16)" },
1781
+ review: { fg: "#8A5A00", bg: "rgba(180,120,0,0.10)", border: "rgba(180,120,0,0.18)" },
1782
+ fixing: { fg: "#9A3D12", bg: "rgba(224,60,44,0.10)", border: "rgba(224,60,44,0.18)" },
1783
+ fixed: { fg: "#1F6B3A", bg: "rgba(31,107,58,0.10)", border: "rgba(31,107,58,0.18)" }
1784
+ },
1785
+ dark: {
1786
+ sent: { fg: "#A8C4FF", bg: "rgba(120,160,255,0.12)", border: "rgba(120,160,255,0.22)" },
1787
+ review: { fg: "#FFD27A", bg: "rgba(255,190,90,0.12)", border: "rgba(255,190,90,0.22)" },
1788
+ fixing: { fg: "#FFB899", bg: "rgba(255,120,60,0.12)", border: "rgba(255,120,60,0.24)" },
1789
+ fixed: { fg: "#8FE3B0", bg: "rgba(80,200,130,0.12)", border: "rgba(80,200,130,0.22)" }
1790
+ }
1791
+ };
1735
1792
  function mushiPalette(mode) {
1736
1793
  return mode === "dark" ? MUSHI_COLORS_DARK : MUSHI_COLORS_LIGHT;
1737
1794
  }
@@ -1778,16 +1835,32 @@ var MUSHI_MOTION = {
1778
1835
  var MUSHI_GEOMETRY = {
1779
1836
  bannerHeight: 36,
1780
1837
  fabSize: 52,
1781
- edgeTabWidth: 28,
1838
+ /** edge-tab launcher width (px) */
1839
+ edgeTabWidth: 32,
1782
1840
  /** default gutter from the screen edge (added on top of safe-area insets) */
1783
1841
  gutter: 24,
1784
- panelWidth: 384,
1842
+ /** Web panel width (px) — matches shipped Shadow DOM widget */
1843
+ panelWidth: 360,
1844
+ /** max panel height before keyboard inset (px) */
1845
+ panelMaxHeight: 480,
1785
1846
  /** below this viewport width the panel becomes a full-width bottom sheet */
1786
1847
  panelSheetBreakpoint: 480
1787
1848
  };
1849
+ function safeWidgetHex(v) {
1850
+ return /^#[0-9a-fA-F]{3,8}$/.test(v) ? v : "";
1851
+ }
1852
+ function resolveWidgetAccent(mode, accent = "", accentText = "") {
1853
+ const pal = mushiPalette(mode);
1854
+ const safeAccent = safeWidgetHex(accent);
1855
+ const safeAccentText = safeWidgetHex(accentText);
1856
+ const resolvedAccent = safeAccent || pal.accent;
1857
+ const accentWash = safeAccent ? mode === "dark" ? `${resolvedAccent}1F` : `${resolvedAccent}14` : pal.accentWash;
1858
+ const accentInk = safeAccentText || pal.accentInk;
1859
+ return { accent: resolvedAccent, accentWash, accentInk };
1860
+ }
1788
1861
  var MUSHI_COPY = {
1789
1862
  bannerLabel: "Beta",
1790
- bannerMessage: "Help us improve \u2014 your feedback shapes what we ship.",
1863
+ bannerMessage: "Found a bug? Tap to report it.",
1791
1864
  bugCta: "Report a bug",
1792
1865
  featureCta: "Feature request",
1793
1866
  triggerText: "\u{1F41B}",
@@ -2041,6 +2114,9 @@ function isSafeFaviconHref(href) {
2041
2114
  exports.DEFAULT_API_ENDPOINT = DEFAULT_API_ENDPOINT;
2042
2115
  exports.MAX_REPORT_PAYLOAD_BYTES = MAX_REPORT_PAYLOAD_BYTES;
2043
2116
  exports.MAX_SCREENSHOT_DATA_URL_BYTES = MAX_SCREENSHOT_DATA_URL_BYTES;
2117
+ exports.MUSHI_ACCENT_SHADOW = MUSHI_ACCENT_SHADOW;
2118
+ exports.MUSHI_BANNER_BRAND_BORDER = MUSHI_BANNER_BRAND_BORDER;
2119
+ exports.MUSHI_BANNER_NEON = MUSHI_BANNER_NEON;
2044
2120
  exports.MUSHI_COLORS_DARK = MUSHI_COLORS_DARK;
2045
2121
  exports.MUSHI_COLORS_LIGHT = MUSHI_COLORS_LIGHT;
2046
2122
  exports.MUSHI_COPY = MUSHI_COPY;
@@ -2048,12 +2124,16 @@ exports.MUSHI_GEOMETRY = MUSHI_GEOMETRY;
2048
2124
  exports.MUSHI_IDENTITY_TOKEN_PREFIX = MUSHI_IDENTITY_TOKEN_PREFIX;
2049
2125
  exports.MUSHI_INTERNAL_HEADER = MUSHI_INTERNAL_HEADER;
2050
2126
  exports.MUSHI_INTERNAL_INIT_MARKER = MUSHI_INTERNAL_INIT_MARKER;
2127
+ exports.MUSHI_INVERSE = MUSHI_INVERSE;
2051
2128
  exports.MUSHI_MOTION = MUSHI_MOTION;
2129
+ exports.MUSHI_ON_ACCENT = MUSHI_ON_ACCENT;
2052
2130
  exports.MUSHI_PROJECT_HEADER = MUSHI_PROJECT_HEADER;
2053
2131
  exports.MUSHI_RADIUS = MUSHI_RADIUS;
2132
+ exports.MUSHI_REPORTER_STATUS = MUSHI_REPORTER_STATUS;
2054
2133
  exports.MUSHI_SDK_PACKAGE_HEADER = MUSHI_SDK_PACKAGE_HEADER;
2055
2134
  exports.MUSHI_SDK_VERSION_HEADER = MUSHI_SDK_VERSION_HEADER;
2056
2135
  exports.MUSHI_SPACING = MUSHI_SPACING;
2136
+ exports.MUSHI_TIER_COLORS = MUSHI_TIER_COLORS;
2057
2137
  exports.MUSHI_TYPE = MUSHI_TYPE;
2058
2138
  exports.MUSHI_USER_TOKEN_HEADER = MUSHI_USER_TOKEN_HEADER;
2059
2139
  exports.MUSHI_Z = MUSHI_Z;
@@ -2076,6 +2156,7 @@ exports.getDeviceFingerprintHash = getDeviceFingerprintHash;
2076
2156
  exports.getReporterToken = getReporterToken;
2077
2157
  exports.getSessionId = getSessionId;
2078
2158
  exports.githubRepoDomainHint = githubRepoDomainHint;
2159
+ exports.hmacSha256Hex = hmacSha256Hex;
2079
2160
  exports.isLikelyGenericFavicon = isLikelyGenericFavicon;
2080
2161
  exports.isUntrustedFaviconUrl = isUntrustedFaviconUrl;
2081
2162
  exports.mushiPalette = mushiPalette;
@@ -2093,6 +2174,9 @@ exports.resolveEnvConfig = resolveEnvConfig;
2093
2174
  exports.resolveProjectDomain = resolveProjectDomain;
2094
2175
  exports.resolveProjectFaviconDomains = resolveProjectFaviconDomains;
2095
2176
  exports.resolveRegionEndpoint = resolveRegionEndpoint;
2177
+ exports.resolveWidgetAccent = resolveWidgetAccent;
2178
+ exports.safeWidgetHex = safeWidgetHex;
2096
2179
  exports.scrubPii = scrubPii;
2180
+ exports.sha256Hex = sha256Hex;
2097
2181
  //# sourceMappingURL=index.cjs.map
2098
2182
  //# sourceMappingURL=index.cjs.map