@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 +101 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -7
- package/dist/index.d.ts +118 -7
- package/dist/index.js +91 -18
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -23,6 +23,13 @@ interface MushiConfig {
|
|
|
23
23
|
assistant?: MushiAssistantConfig;
|
|
24
24
|
debug?: boolean;
|
|
25
25
|
enabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Host app release identifier stored on `reports.app_version` at ingest.
|
|
28
|
+
* Pairs with `environment.buildId` (from `<meta name="mushi:build">`) for
|
|
29
|
+
* deploy-level provenance. Falls back to `integrations.vercel.analyticsId`
|
|
30
|
+
* when omitted (legacy Vercel Analytics wiring).
|
|
31
|
+
*/
|
|
32
|
+
appVersion?: string;
|
|
26
33
|
/** Hook called before a report is sent. Return null to cancel, or return the (possibly modified) report. */
|
|
27
34
|
beforeSendFeedback?: (report: MushiReport) => MushiReport | null | Promise<MushiReport | null>;
|
|
28
35
|
/** Called once if the app crashed during the previous session. */
|
|
@@ -1504,6 +1511,8 @@ interface MushiRuntimeSdkConfig {
|
|
|
1504
1511
|
triggerMode?: 'shake' | 'button' | 'both' | 'none';
|
|
1505
1512
|
minDescriptionLength?: number;
|
|
1506
1513
|
};
|
|
1514
|
+
/** When false, the widget skips background reporter-inbox polling. Default true. */
|
|
1515
|
+
reporterNotificationsEnabled?: boolean;
|
|
1507
1516
|
}
|
|
1508
1517
|
interface MushiSdkVersionInfo {
|
|
1509
1518
|
package: string;
|
|
@@ -1730,7 +1739,59 @@ declare function createOfflineQueue(config?: MushiOfflineConfig): OfflineQueue;
|
|
|
1730
1739
|
*/
|
|
1731
1740
|
declare function captureEnvironment(): MushiEnvironment;
|
|
1732
1741
|
|
|
1733
|
-
|
|
1742
|
+
/**
|
|
1743
|
+
* FILE: reporter-token.ts
|
|
1744
|
+
* PURPOSE: Stable, project-scoped anonymous reporter identity for the My Reports inbox.
|
|
1745
|
+
*
|
|
1746
|
+
* OVERVIEW:
|
|
1747
|
+
* - Each Mushi project gets its own localStorage key so multi-project hosts on the
|
|
1748
|
+
* same origin (e.g. kensaur.us/glot-it vs /other-app) never share a token.
|
|
1749
|
+
* - One-time migration copies the legacy global `mushi_reporter_token` into the
|
|
1750
|
+
* first projectId requested, preserving existing inbox history for that project.
|
|
1751
|
+
*
|
|
1752
|
+
* USAGE:
|
|
1753
|
+
* - `getReporterToken(projectId)` from web/RN/Capacitor SDK before submit or inbox calls.
|
|
1754
|
+
*/
|
|
1755
|
+
/**
|
|
1756
|
+
* Return a stable reporter token scoped to `projectId`.
|
|
1757
|
+
* Legacy callers without a projectId still work but should migrate — the global
|
|
1758
|
+
* key is read once and re-homed into the namespaced slot.
|
|
1759
|
+
*/
|
|
1760
|
+
declare function getReporterToken(projectId?: string): string;
|
|
1761
|
+
|
|
1762
|
+
/**
|
|
1763
|
+
* FILE: packages/core/src/digest.ts
|
|
1764
|
+
* PURPOSE: SHA-256 and HMAC-SHA-256 helpers that work in every JS runtime —
|
|
1765
|
+
* including Hermes (React Native) which has no global `crypto` object.
|
|
1766
|
+
*
|
|
1767
|
+
* OVERVIEW:
|
|
1768
|
+
* Fast path: when `globalThis.crypto?.subtle` is available (browser, Deno,
|
|
1769
|
+
* Bun, Node ≥ 20 where Web Crypto is exposed globally, React Native with a
|
|
1770
|
+
* crypto polyfill) we delegate to the native Web Crypto API which is
|
|
1771
|
+
* hardware-accelerated and produces identical output.
|
|
1772
|
+
*
|
|
1773
|
+
* Fallback: `@noble/hashes` — pure-JS, audited, zero-dependency implementation
|
|
1774
|
+
* of SHA-256 and HMAC used when native crypto is absent (Hermes cold start
|
|
1775
|
+
* before any polyfill loads, worker environments without crypto, SSR edge runtimes).
|
|
1776
|
+
*
|
|
1777
|
+
* Both paths are spec-identical (same test vectors) and are exercised by
|
|
1778
|
+
* `digest.test.ts`.
|
|
1779
|
+
*
|
|
1780
|
+
* USAGE:
|
|
1781
|
+
* import { sha256Hex, hmacSha256Hex } from './digest';
|
|
1782
|
+
* const hash = await sha256Hex('hello');
|
|
1783
|
+
* const sig = await hmacSha256Hex('secret', 'message');
|
|
1784
|
+
*/
|
|
1785
|
+
/**
|
|
1786
|
+
* SHA-256 of `value`, returned as a lowercase hex string.
|
|
1787
|
+
* Uses Web Crypto when available, falls back to @noble/hashes.
|
|
1788
|
+
*/
|
|
1789
|
+
declare function sha256Hex(value: string): Promise<string>;
|
|
1790
|
+
/**
|
|
1791
|
+
* HMAC-SHA-256 of `value` with `secret`, returned as a lowercase hex string.
|
|
1792
|
+
* Uses Web Crypto when available, falls back to @noble/hashes.
|
|
1793
|
+
*/
|
|
1794
|
+
declare function hmacSha256Hex(secret: string, value: string): Promise<string>;
|
|
1734
1795
|
|
|
1735
1796
|
/**
|
|
1736
1797
|
* RFC-4122 v4 UUID generator with a capability ladder so it works in every
|
|
@@ -1996,8 +2057,8 @@ declare const noopLogger: Logger;
|
|
|
1996
2057
|
*
|
|
1997
2058
|
* Colour values mirror the historical washi/vermillion palette previously
|
|
1998
2059
|
* inlined in `@mushi-mushi/web`'s styles.ts so the visual identity is
|
|
1999
|
-
* unchanged;
|
|
2000
|
-
*
|
|
2060
|
+
* unchanged; `@mushi-mushi/web` imports mushiPalette() + MUSHI_* here
|
|
2061
|
+
* instead of duplicating hex literals.
|
|
2001
2062
|
*/
|
|
2002
2063
|
type MushiThemeMode = 'light' | 'dark';
|
|
2003
2064
|
interface MushiColorPalette {
|
|
@@ -2032,6 +2093,41 @@ interface MushiColorPalette {
|
|
|
2032
2093
|
declare const MUSHI_COLORS_LIGHT: MushiColorPalette;
|
|
2033
2094
|
/** Dark-mode palette. */
|
|
2034
2095
|
declare const MUSHI_COLORS_DARK: MushiColorPalette;
|
|
2096
|
+
/** Reward tier accent colours — editorial palette, not Tailwind defaults. */
|
|
2097
|
+
declare const MUSHI_TIER_COLORS: {
|
|
2098
|
+
readonly free: string;
|
|
2099
|
+
readonly explorer: "#2563EB";
|
|
2100
|
+
readonly contributor: "#7C3AED";
|
|
2101
|
+
readonly champion: "#D97706";
|
|
2102
|
+
readonly default: string;
|
|
2103
|
+
};
|
|
2104
|
+
/** Neon beta banner — web `.mushi-banner.neon` + RN sheet header parity. */
|
|
2105
|
+
declare const MUSHI_BANNER_NEON: {
|
|
2106
|
+
readonly bg: "#0FFF50";
|
|
2107
|
+
readonly fg: "#0a1a0a";
|
|
2108
|
+
readonly border: "#00C43A";
|
|
2109
|
+
};
|
|
2110
|
+
/** On-accent button text (hanko stamp, submit CTA). */
|
|
2111
|
+
declare const MUSHI_ON_ACCENT = "#FAF7F0";
|
|
2112
|
+
/** Pure white for assistant bubbles on accent backgrounds. */
|
|
2113
|
+
declare const MUSHI_INVERSE = "#ffffff";
|
|
2114
|
+
/** Submit-button depth shadow (accent ink, mode-specific). */
|
|
2115
|
+
declare const MUSHI_ACCENT_SHADOW: {
|
|
2116
|
+
readonly light: "#9A2A1E";
|
|
2117
|
+
readonly dark: "#7A1F15";
|
|
2118
|
+
};
|
|
2119
|
+
/** Brand banner border under vermillion strip. */
|
|
2120
|
+
declare const MUSHI_BANNER_BRAND_BORDER: {
|
|
2121
|
+
readonly light: "#B52F1F";
|
|
2122
|
+
readonly dark: "#C4321E";
|
|
2123
|
+
};
|
|
2124
|
+
/** Reporter inbox status chip colours (fg / bg / border). */
|
|
2125
|
+
interface MushiReporterStatusTone {
|
|
2126
|
+
fg: string;
|
|
2127
|
+
bg: string;
|
|
2128
|
+
border: string;
|
|
2129
|
+
}
|
|
2130
|
+
declare const MUSHI_REPORTER_STATUS: Record<MushiThemeMode, Record<'sent' | 'review' | 'fixing' | 'fixed', MushiReporterStatusTone>>;
|
|
2035
2131
|
/** Resolve the palette for a theme mode. */
|
|
2036
2132
|
declare function mushiPalette(mode: MushiThemeMode): MushiColorPalette;
|
|
2037
2133
|
/**
|
|
@@ -2093,20 +2189,35 @@ declare const MUSHI_MOTION: {
|
|
|
2093
2189
|
declare const MUSHI_GEOMETRY: {
|
|
2094
2190
|
readonly bannerHeight: 36;
|
|
2095
2191
|
readonly fabSize: 52;
|
|
2096
|
-
|
|
2192
|
+
/** edge-tab launcher width (px) */
|
|
2193
|
+
readonly edgeTabWidth: 32;
|
|
2097
2194
|
/** default gutter from the screen edge (added on top of safe-area insets) */
|
|
2098
2195
|
readonly gutter: 24;
|
|
2099
|
-
|
|
2196
|
+
/** Web panel width (px) — matches shipped Shadow DOM widget */
|
|
2197
|
+
readonly panelWidth: 360;
|
|
2198
|
+
/** max panel height before keyboard inset (px) */
|
|
2199
|
+
readonly panelMaxHeight: 480;
|
|
2100
2200
|
/** below this viewport width the panel becomes a full-width bottom sheet */
|
|
2101
2201
|
readonly panelSheetBreakpoint: 480;
|
|
2102
2202
|
};
|
|
2203
|
+
/** Safe hex validator for user-supplied accent overrides (Shadow DOM CSS injection guard). */
|
|
2204
|
+
declare function safeWidgetHex(v: string): string;
|
|
2205
|
+
/**
|
|
2206
|
+
* Resolve widget accent colours, honouring optional host overrides while
|
|
2207
|
+
* falling back to the canonical palette from mushiPalette().
|
|
2208
|
+
*/
|
|
2209
|
+
declare function resolveWidgetAccent(mode: MushiThemeMode, accent?: string, accentText?: string): {
|
|
2210
|
+
accent: string;
|
|
2211
|
+
accentWash: string;
|
|
2212
|
+
accentInk: string;
|
|
2213
|
+
};
|
|
2103
2214
|
/**
|
|
2104
2215
|
* Default user-facing copy. Centralised so apps stop drifting on the banner
|
|
2105
2216
|
* label / CTA wording (seen as inconsistent across the four host apps).
|
|
2106
2217
|
*/
|
|
2107
2218
|
declare const MUSHI_COPY: {
|
|
2108
2219
|
readonly bannerLabel: "Beta";
|
|
2109
|
-
readonly bannerMessage: "
|
|
2220
|
+
readonly bannerMessage: "Found a bug? Tap to report it.";
|
|
2110
2221
|
readonly bugCta: "Report a bug";
|
|
2111
2222
|
readonly featureCta: "Feature request";
|
|
2112
2223
|
readonly triggerText: "🐛";
|
|
@@ -2233,4 +2344,4 @@ declare function projectInitialsThemeIndex(projectId: string): number;
|
|
|
2233
2344
|
*/
|
|
2234
2345
|
declare function readPageFaviconHref(): string | null;
|
|
2235
2346
|
|
|
2236
|
-
export { type ApiClientOptions, type BreadcrumbBuffer, type BreadcrumbBufferOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MAX_REPORT_PAYLOAD_BYTES, MAX_SCREENSHOT_DATA_URL_BYTES, MUSHI_COLORS_DARK, MUSHI_COLORS_LIGHT, MUSHI_COPY, MUSHI_GEOMETRY, MUSHI_IDENTITY_TOKEN_PREFIX, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, MUSHI_MOTION, MUSHI_PROJECT_HEADER, MUSHI_RADIUS, MUSHI_SDK_PACKAGE_HEADER, MUSHI_SDK_VERSION_HEADER, MUSHI_SPACING, MUSHI_TYPE, MUSHI_USER_TOKEN_HEADER, MUSHI_Z, type MushiActivityEvent, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiAssistantConfig, type MushiAssistantReply, type MushiAssistantStep, type MushiBannerConfig, type MushiBannerLink, type MushiBetaChangelogEntry, type MushiBetaModeConfig, type MushiBreadcrumb, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiCaptureExceptionOptions, type MushiColorPalette, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiCrossAppReport, type MushiCustomCategory, type MushiDiagnosticsResult, type MushiDiscoverInventoryConfig, type MushiDiscoveryEventPayload, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiHallOfFameEntry, type MushiIdentityClaims, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiLeaderboardEntry, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPageContext, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiReputationResult, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiSentryContext, type MushiTesterReputation, type MushiThemeMode, type MushiTierResult, type MushiTimelineEntry, type MushiTimelineKind, type MushiTokenSnapshot, type MushiTracePropagationConfig, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type NormalisedException, type OfflineQueue, type PayloadGuardResult, type PiiScrubberConfig, type PreFilterResult, type ProjectFaviconSource, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, type ResolvedEnvConfig, buildIdentityClaims, buildSdkIngestHeaders, captureEnvironment, checkReportPayloadSize, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, estimateJsonBytes, faviconUrlCandidates, formatBytes, getDeviceFingerprintHash, getReporterToken, getSessionId, githubRepoDomainHint, isLikelyGenericFavicon, isUntrustedFaviconUrl, mushiPalette, mushiTokens, newUuid, noopLogger, normaliseThrown, originToDomain, parseIdentityToken, projectFaviconUrlCandidates, projectInitials, projectInitialsThemeIndex, readPageFaviconHref, resolveEnvConfig, resolveProjectDomain, resolveProjectFaviconDomains, resolveRegionEndpoint, scrubPii };
|
|
2347
|
+
export { type ApiClientOptions, type BreadcrumbBuffer, type BreadcrumbBufferOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MAX_REPORT_PAYLOAD_BYTES, MAX_SCREENSHOT_DATA_URL_BYTES, MUSHI_ACCENT_SHADOW, MUSHI_BANNER_BRAND_BORDER, MUSHI_BANNER_NEON, MUSHI_COLORS_DARK, MUSHI_COLORS_LIGHT, MUSHI_COPY, MUSHI_GEOMETRY, MUSHI_IDENTITY_TOKEN_PREFIX, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INVERSE, MUSHI_MOTION, MUSHI_ON_ACCENT, MUSHI_PROJECT_HEADER, MUSHI_RADIUS, MUSHI_REPORTER_STATUS, MUSHI_SDK_PACKAGE_HEADER, MUSHI_SDK_VERSION_HEADER, MUSHI_SPACING, MUSHI_TIER_COLORS, MUSHI_TYPE, MUSHI_USER_TOKEN_HEADER, MUSHI_Z, type MushiActivityEvent, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiAssistantConfig, type MushiAssistantReply, type MushiAssistantStep, type MushiBannerConfig, type MushiBannerLink, type MushiBetaChangelogEntry, type MushiBetaModeConfig, type MushiBreadcrumb, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiCaptureExceptionOptions, type MushiColorPalette, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiCrossAppReport, type MushiCustomCategory, type MushiDiagnosticsResult, type MushiDiscoverInventoryConfig, type MushiDiscoveryEventPayload, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiHallOfFameEntry, type MushiIdentityClaims, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiLeaderboardEntry, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPageContext, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiReputationResult, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiSentryContext, type MushiTesterReputation, type MushiThemeMode, type MushiTierResult, type MushiTimelineEntry, type MushiTimelineKind, type MushiTokenSnapshot, type MushiTracePropagationConfig, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type NormalisedException, type OfflineQueue, type PayloadGuardResult, type PiiScrubberConfig, type PreFilterResult, type ProjectFaviconSource, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, type ResolvedEnvConfig, buildIdentityClaims, buildSdkIngestHeaders, captureEnvironment, checkReportPayloadSize, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, estimateJsonBytes, faviconUrlCandidates, formatBytes, getDeviceFingerprintHash, getReporterToken, getSessionId, githubRepoDomainHint, hmacSha256Hex, isLikelyGenericFavicon, isUntrustedFaviconUrl, mushiPalette, mushiTokens, newUuid, noopLogger, normaliseThrown, originToDomain, parseIdentityToken, projectFaviconUrlCandidates, projectInitials, projectInitialsThemeIndex, readPageFaviconHref, resolveEnvConfig, resolveProjectDomain, resolveProjectFaviconDomains, resolveRegionEndpoint, resolveWidgetAccent, safeWidgetHex, scrubPii, sha256Hex };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,13 @@ interface MushiConfig {
|
|
|
23
23
|
assistant?: MushiAssistantConfig;
|
|
24
24
|
debug?: boolean;
|
|
25
25
|
enabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Host app release identifier stored on `reports.app_version` at ingest.
|
|
28
|
+
* Pairs with `environment.buildId` (from `<meta name="mushi:build">`) for
|
|
29
|
+
* deploy-level provenance. Falls back to `integrations.vercel.analyticsId`
|
|
30
|
+
* when omitted (legacy Vercel Analytics wiring).
|
|
31
|
+
*/
|
|
32
|
+
appVersion?: string;
|
|
26
33
|
/** Hook called before a report is sent. Return null to cancel, or return the (possibly modified) report. */
|
|
27
34
|
beforeSendFeedback?: (report: MushiReport) => MushiReport | null | Promise<MushiReport | null>;
|
|
28
35
|
/** Called once if the app crashed during the previous session. */
|
|
@@ -1504,6 +1511,8 @@ interface MushiRuntimeSdkConfig {
|
|
|
1504
1511
|
triggerMode?: 'shake' | 'button' | 'both' | 'none';
|
|
1505
1512
|
minDescriptionLength?: number;
|
|
1506
1513
|
};
|
|
1514
|
+
/** When false, the widget skips background reporter-inbox polling. Default true. */
|
|
1515
|
+
reporterNotificationsEnabled?: boolean;
|
|
1507
1516
|
}
|
|
1508
1517
|
interface MushiSdkVersionInfo {
|
|
1509
1518
|
package: string;
|
|
@@ -1730,7 +1739,59 @@ declare function createOfflineQueue(config?: MushiOfflineConfig): OfflineQueue;
|
|
|
1730
1739
|
*/
|
|
1731
1740
|
declare function captureEnvironment(): MushiEnvironment;
|
|
1732
1741
|
|
|
1733
|
-
|
|
1742
|
+
/**
|
|
1743
|
+
* FILE: reporter-token.ts
|
|
1744
|
+
* PURPOSE: Stable, project-scoped anonymous reporter identity for the My Reports inbox.
|
|
1745
|
+
*
|
|
1746
|
+
* OVERVIEW:
|
|
1747
|
+
* - Each Mushi project gets its own localStorage key so multi-project hosts on the
|
|
1748
|
+
* same origin (e.g. kensaur.us/glot-it vs /other-app) never share a token.
|
|
1749
|
+
* - One-time migration copies the legacy global `mushi_reporter_token` into the
|
|
1750
|
+
* first projectId requested, preserving existing inbox history for that project.
|
|
1751
|
+
*
|
|
1752
|
+
* USAGE:
|
|
1753
|
+
* - `getReporterToken(projectId)` from web/RN/Capacitor SDK before submit or inbox calls.
|
|
1754
|
+
*/
|
|
1755
|
+
/**
|
|
1756
|
+
* Return a stable reporter token scoped to `projectId`.
|
|
1757
|
+
* Legacy callers without a projectId still work but should migrate — the global
|
|
1758
|
+
* key is read once and re-homed into the namespaced slot.
|
|
1759
|
+
*/
|
|
1760
|
+
declare function getReporterToken(projectId?: string): string;
|
|
1761
|
+
|
|
1762
|
+
/**
|
|
1763
|
+
* FILE: packages/core/src/digest.ts
|
|
1764
|
+
* PURPOSE: SHA-256 and HMAC-SHA-256 helpers that work in every JS runtime —
|
|
1765
|
+
* including Hermes (React Native) which has no global `crypto` object.
|
|
1766
|
+
*
|
|
1767
|
+
* OVERVIEW:
|
|
1768
|
+
* Fast path: when `globalThis.crypto?.subtle` is available (browser, Deno,
|
|
1769
|
+
* Bun, Node ≥ 20 where Web Crypto is exposed globally, React Native with a
|
|
1770
|
+
* crypto polyfill) we delegate to the native Web Crypto API which is
|
|
1771
|
+
* hardware-accelerated and produces identical output.
|
|
1772
|
+
*
|
|
1773
|
+
* Fallback: `@noble/hashes` — pure-JS, audited, zero-dependency implementation
|
|
1774
|
+
* of SHA-256 and HMAC used when native crypto is absent (Hermes cold start
|
|
1775
|
+
* before any polyfill loads, worker environments without crypto, SSR edge runtimes).
|
|
1776
|
+
*
|
|
1777
|
+
* Both paths are spec-identical (same test vectors) and are exercised by
|
|
1778
|
+
* `digest.test.ts`.
|
|
1779
|
+
*
|
|
1780
|
+
* USAGE:
|
|
1781
|
+
* import { sha256Hex, hmacSha256Hex } from './digest';
|
|
1782
|
+
* const hash = await sha256Hex('hello');
|
|
1783
|
+
* const sig = await hmacSha256Hex('secret', 'message');
|
|
1784
|
+
*/
|
|
1785
|
+
/**
|
|
1786
|
+
* SHA-256 of `value`, returned as a lowercase hex string.
|
|
1787
|
+
* Uses Web Crypto when available, falls back to @noble/hashes.
|
|
1788
|
+
*/
|
|
1789
|
+
declare function sha256Hex(value: string): Promise<string>;
|
|
1790
|
+
/**
|
|
1791
|
+
* HMAC-SHA-256 of `value` with `secret`, returned as a lowercase hex string.
|
|
1792
|
+
* Uses Web Crypto when available, falls back to @noble/hashes.
|
|
1793
|
+
*/
|
|
1794
|
+
declare function hmacSha256Hex(secret: string, value: string): Promise<string>;
|
|
1734
1795
|
|
|
1735
1796
|
/**
|
|
1736
1797
|
* RFC-4122 v4 UUID generator with a capability ladder so it works in every
|
|
@@ -1996,8 +2057,8 @@ declare const noopLogger: Logger;
|
|
|
1996
2057
|
*
|
|
1997
2058
|
* Colour values mirror the historical washi/vermillion palette previously
|
|
1998
2059
|
* inlined in `@mushi-mushi/web`'s styles.ts so the visual identity is
|
|
1999
|
-
* unchanged;
|
|
2000
|
-
*
|
|
2060
|
+
* unchanged; `@mushi-mushi/web` imports mushiPalette() + MUSHI_* here
|
|
2061
|
+
* instead of duplicating hex literals.
|
|
2001
2062
|
*/
|
|
2002
2063
|
type MushiThemeMode = 'light' | 'dark';
|
|
2003
2064
|
interface MushiColorPalette {
|
|
@@ -2032,6 +2093,41 @@ interface MushiColorPalette {
|
|
|
2032
2093
|
declare const MUSHI_COLORS_LIGHT: MushiColorPalette;
|
|
2033
2094
|
/** Dark-mode palette. */
|
|
2034
2095
|
declare const MUSHI_COLORS_DARK: MushiColorPalette;
|
|
2096
|
+
/** Reward tier accent colours — editorial palette, not Tailwind defaults. */
|
|
2097
|
+
declare const MUSHI_TIER_COLORS: {
|
|
2098
|
+
readonly free: string;
|
|
2099
|
+
readonly explorer: "#2563EB";
|
|
2100
|
+
readonly contributor: "#7C3AED";
|
|
2101
|
+
readonly champion: "#D97706";
|
|
2102
|
+
readonly default: string;
|
|
2103
|
+
};
|
|
2104
|
+
/** Neon beta banner — web `.mushi-banner.neon` + RN sheet header parity. */
|
|
2105
|
+
declare const MUSHI_BANNER_NEON: {
|
|
2106
|
+
readonly bg: "#0FFF50";
|
|
2107
|
+
readonly fg: "#0a1a0a";
|
|
2108
|
+
readonly border: "#00C43A";
|
|
2109
|
+
};
|
|
2110
|
+
/** On-accent button text (hanko stamp, submit CTA). */
|
|
2111
|
+
declare const MUSHI_ON_ACCENT = "#FAF7F0";
|
|
2112
|
+
/** Pure white for assistant bubbles on accent backgrounds. */
|
|
2113
|
+
declare const MUSHI_INVERSE = "#ffffff";
|
|
2114
|
+
/** Submit-button depth shadow (accent ink, mode-specific). */
|
|
2115
|
+
declare const MUSHI_ACCENT_SHADOW: {
|
|
2116
|
+
readonly light: "#9A2A1E";
|
|
2117
|
+
readonly dark: "#7A1F15";
|
|
2118
|
+
};
|
|
2119
|
+
/** Brand banner border under vermillion strip. */
|
|
2120
|
+
declare const MUSHI_BANNER_BRAND_BORDER: {
|
|
2121
|
+
readonly light: "#B52F1F";
|
|
2122
|
+
readonly dark: "#C4321E";
|
|
2123
|
+
};
|
|
2124
|
+
/** Reporter inbox status chip colours (fg / bg / border). */
|
|
2125
|
+
interface MushiReporterStatusTone {
|
|
2126
|
+
fg: string;
|
|
2127
|
+
bg: string;
|
|
2128
|
+
border: string;
|
|
2129
|
+
}
|
|
2130
|
+
declare const MUSHI_REPORTER_STATUS: Record<MushiThemeMode, Record<'sent' | 'review' | 'fixing' | 'fixed', MushiReporterStatusTone>>;
|
|
2035
2131
|
/** Resolve the palette for a theme mode. */
|
|
2036
2132
|
declare function mushiPalette(mode: MushiThemeMode): MushiColorPalette;
|
|
2037
2133
|
/**
|
|
@@ -2093,20 +2189,35 @@ declare const MUSHI_MOTION: {
|
|
|
2093
2189
|
declare const MUSHI_GEOMETRY: {
|
|
2094
2190
|
readonly bannerHeight: 36;
|
|
2095
2191
|
readonly fabSize: 52;
|
|
2096
|
-
|
|
2192
|
+
/** edge-tab launcher width (px) */
|
|
2193
|
+
readonly edgeTabWidth: 32;
|
|
2097
2194
|
/** default gutter from the screen edge (added on top of safe-area insets) */
|
|
2098
2195
|
readonly gutter: 24;
|
|
2099
|
-
|
|
2196
|
+
/** Web panel width (px) — matches shipped Shadow DOM widget */
|
|
2197
|
+
readonly panelWidth: 360;
|
|
2198
|
+
/** max panel height before keyboard inset (px) */
|
|
2199
|
+
readonly panelMaxHeight: 480;
|
|
2100
2200
|
/** below this viewport width the panel becomes a full-width bottom sheet */
|
|
2101
2201
|
readonly panelSheetBreakpoint: 480;
|
|
2102
2202
|
};
|
|
2203
|
+
/** Safe hex validator for user-supplied accent overrides (Shadow DOM CSS injection guard). */
|
|
2204
|
+
declare function safeWidgetHex(v: string): string;
|
|
2205
|
+
/**
|
|
2206
|
+
* Resolve widget accent colours, honouring optional host overrides while
|
|
2207
|
+
* falling back to the canonical palette from mushiPalette().
|
|
2208
|
+
*/
|
|
2209
|
+
declare function resolveWidgetAccent(mode: MushiThemeMode, accent?: string, accentText?: string): {
|
|
2210
|
+
accent: string;
|
|
2211
|
+
accentWash: string;
|
|
2212
|
+
accentInk: string;
|
|
2213
|
+
};
|
|
2103
2214
|
/**
|
|
2104
2215
|
* Default user-facing copy. Centralised so apps stop drifting on the banner
|
|
2105
2216
|
* label / CTA wording (seen as inconsistent across the four host apps).
|
|
2106
2217
|
*/
|
|
2107
2218
|
declare const MUSHI_COPY: {
|
|
2108
2219
|
readonly bannerLabel: "Beta";
|
|
2109
|
-
readonly bannerMessage: "
|
|
2220
|
+
readonly bannerMessage: "Found a bug? Tap to report it.";
|
|
2110
2221
|
readonly bugCta: "Report a bug";
|
|
2111
2222
|
readonly featureCta: "Feature request";
|
|
2112
2223
|
readonly triggerText: "🐛";
|
|
@@ -2233,4 +2344,4 @@ declare function projectInitialsThemeIndex(projectId: string): number;
|
|
|
2233
2344
|
*/
|
|
2234
2345
|
declare function readPageFaviconHref(): string | null;
|
|
2235
2346
|
|
|
2236
|
-
export { type ApiClientOptions, type BreadcrumbBuffer, type BreadcrumbBufferOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MAX_REPORT_PAYLOAD_BYTES, MAX_SCREENSHOT_DATA_URL_BYTES, MUSHI_COLORS_DARK, MUSHI_COLORS_LIGHT, MUSHI_COPY, MUSHI_GEOMETRY, MUSHI_IDENTITY_TOKEN_PREFIX, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, MUSHI_MOTION, MUSHI_PROJECT_HEADER, MUSHI_RADIUS, MUSHI_SDK_PACKAGE_HEADER, MUSHI_SDK_VERSION_HEADER, MUSHI_SPACING, MUSHI_TYPE, MUSHI_USER_TOKEN_HEADER, MUSHI_Z, type MushiActivityEvent, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiAssistantConfig, type MushiAssistantReply, type MushiAssistantStep, type MushiBannerConfig, type MushiBannerLink, type MushiBetaChangelogEntry, type MushiBetaModeConfig, type MushiBreadcrumb, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiCaptureExceptionOptions, type MushiColorPalette, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiCrossAppReport, type MushiCustomCategory, type MushiDiagnosticsResult, type MushiDiscoverInventoryConfig, type MushiDiscoveryEventPayload, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiHallOfFameEntry, type MushiIdentityClaims, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiLeaderboardEntry, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPageContext, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiReputationResult, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiSentryContext, type MushiTesterReputation, type MushiThemeMode, type MushiTierResult, type MushiTimelineEntry, type MushiTimelineKind, type MushiTokenSnapshot, type MushiTracePropagationConfig, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type NormalisedException, type OfflineQueue, type PayloadGuardResult, type PiiScrubberConfig, type PreFilterResult, type ProjectFaviconSource, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, type ResolvedEnvConfig, buildIdentityClaims, buildSdkIngestHeaders, captureEnvironment, checkReportPayloadSize, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, estimateJsonBytes, faviconUrlCandidates, formatBytes, getDeviceFingerprintHash, getReporterToken, getSessionId, githubRepoDomainHint, isLikelyGenericFavicon, isUntrustedFaviconUrl, mushiPalette, mushiTokens, newUuid, noopLogger, normaliseThrown, originToDomain, parseIdentityToken, projectFaviconUrlCandidates, projectInitials, projectInitialsThemeIndex, readPageFaviconHref, resolveEnvConfig, resolveProjectDomain, resolveProjectFaviconDomains, resolveRegionEndpoint, scrubPii };
|
|
2347
|
+
export { type ApiClientOptions, type BreadcrumbBuffer, type BreadcrumbBufferOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MAX_REPORT_PAYLOAD_BYTES, MAX_SCREENSHOT_DATA_URL_BYTES, MUSHI_ACCENT_SHADOW, MUSHI_BANNER_BRAND_BORDER, MUSHI_BANNER_NEON, MUSHI_COLORS_DARK, MUSHI_COLORS_LIGHT, MUSHI_COPY, MUSHI_GEOMETRY, MUSHI_IDENTITY_TOKEN_PREFIX, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INVERSE, MUSHI_MOTION, MUSHI_ON_ACCENT, MUSHI_PROJECT_HEADER, MUSHI_RADIUS, MUSHI_REPORTER_STATUS, MUSHI_SDK_PACKAGE_HEADER, MUSHI_SDK_VERSION_HEADER, MUSHI_SPACING, MUSHI_TIER_COLORS, MUSHI_TYPE, MUSHI_USER_TOKEN_HEADER, MUSHI_Z, type MushiActivityEvent, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiAssistantConfig, type MushiAssistantReply, type MushiAssistantStep, type MushiBannerConfig, type MushiBannerLink, type MushiBetaChangelogEntry, type MushiBetaModeConfig, type MushiBreadcrumb, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiCaptureExceptionOptions, type MushiColorPalette, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiCrossAppReport, type MushiCustomCategory, type MushiDiagnosticsResult, type MushiDiscoverInventoryConfig, type MushiDiscoveryEventPayload, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiHallOfFameEntry, type MushiIdentityClaims, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiLeaderboardEntry, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPageContext, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiReputationResult, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiSentryContext, type MushiTesterReputation, type MushiThemeMode, type MushiTierResult, type MushiTimelineEntry, type MushiTimelineKind, type MushiTokenSnapshot, type MushiTracePropagationConfig, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type NormalisedException, type OfflineQueue, type PayloadGuardResult, type PiiScrubberConfig, type PreFilterResult, type ProjectFaviconSource, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, type ResolvedEnvConfig, buildIdentityClaims, buildSdkIngestHeaders, captureEnvironment, checkReportPayloadSize, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, estimateJsonBytes, faviconUrlCandidates, formatBytes, getDeviceFingerprintHash, getReporterToken, getSessionId, githubRepoDomainHint, hmacSha256Hex, isLikelyGenericFavicon, isUntrustedFaviconUrl, mushiPalette, mushiTokens, newUuid, noopLogger, normaliseThrown, originToDomain, parseIdentityToken, projectFaviconUrlCandidates, projectInitials, projectInitialsThemeIndex, readPageFaviconHref, resolveEnvConfig, resolveProjectDomain, resolveProjectFaviconDomains, resolveRegionEndpoint, resolveWidgetAccent, safeWidgetHex, scrubPii, sha256Hex };
|
package/dist/index.js
CHANGED
|
@@ -1405,20 +1405,9 @@ function capturePageLoadTiming(win) {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
|
|
1407
1407
|
// src/reporter-token.ts
|
|
1408
|
-
var
|
|
1409
|
-
function
|
|
1410
|
-
|
|
1411
|
-
const existing = localStorage.getItem(STORAGE_KEY);
|
|
1412
|
-
if (existing) return existing;
|
|
1413
|
-
}
|
|
1414
|
-
const token = generateToken();
|
|
1415
|
-
if (typeof localStorage !== "undefined") {
|
|
1416
|
-
try {
|
|
1417
|
-
localStorage.setItem(STORAGE_KEY, token);
|
|
1418
|
-
} catch {
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
return token;
|
|
1408
|
+
var LEGACY_STORAGE_KEY = "mushi_reporter_token";
|
|
1409
|
+
function storageKey(projectId) {
|
|
1410
|
+
return `mushi:reporter-token:${projectId}`;
|
|
1422
1411
|
}
|
|
1423
1412
|
function generateToken() {
|
|
1424
1413
|
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
@@ -1435,6 +1424,38 @@ function generateToken() {
|
|
|
1435
1424
|
const hex = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1436
1425
|
return `mushi_${hex}`;
|
|
1437
1426
|
}
|
|
1427
|
+
function readStoredToken(key) {
|
|
1428
|
+
if (typeof localStorage === "undefined") return null;
|
|
1429
|
+
try {
|
|
1430
|
+
const existing = localStorage.getItem(key);
|
|
1431
|
+
return existing && existing.length > 0 ? existing : null;
|
|
1432
|
+
} catch {
|
|
1433
|
+
return null;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
function writeStoredToken(key, token) {
|
|
1437
|
+
if (typeof localStorage === "undefined") return;
|
|
1438
|
+
try {
|
|
1439
|
+
localStorage.setItem(key, token);
|
|
1440
|
+
} catch {
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
function getReporterToken(projectId) {
|
|
1444
|
+
if (!projectId) {
|
|
1445
|
+
const legacy2 = readStoredToken(LEGACY_STORAGE_KEY);
|
|
1446
|
+
if (legacy2) return legacy2;
|
|
1447
|
+
const token2 = generateToken();
|
|
1448
|
+
writeStoredToken(LEGACY_STORAGE_KEY, token2);
|
|
1449
|
+
return token2;
|
|
1450
|
+
}
|
|
1451
|
+
const key = storageKey(projectId);
|
|
1452
|
+
const scoped = readStoredToken(key);
|
|
1453
|
+
if (scoped) return scoped;
|
|
1454
|
+
const legacy = readStoredToken(LEGACY_STORAGE_KEY);
|
|
1455
|
+
const token = legacy ?? generateToken();
|
|
1456
|
+
writeStoredToken(key, token);
|
|
1457
|
+
return token;
|
|
1458
|
+
}
|
|
1438
1459
|
|
|
1439
1460
|
// src/uuid.ts
|
|
1440
1461
|
function newUuid() {
|
|
@@ -1730,6 +1751,42 @@ var MUSHI_COLORS_DARK = {
|
|
|
1730
1751
|
ok: "#4ADE80",
|
|
1731
1752
|
danger: "#F87171"
|
|
1732
1753
|
};
|
|
1754
|
+
var MUSHI_TIER_COLORS = {
|
|
1755
|
+
free: MUSHI_COLORS_LIGHT.inkMuted,
|
|
1756
|
+
explorer: "#2563EB",
|
|
1757
|
+
contributor: "#7C3AED",
|
|
1758
|
+
champion: "#D97706",
|
|
1759
|
+
default: MUSHI_COLORS_LIGHT.accent
|
|
1760
|
+
};
|
|
1761
|
+
var MUSHI_BANNER_NEON = {
|
|
1762
|
+
bg: "#0FFF50",
|
|
1763
|
+
fg: "#0a1a0a",
|
|
1764
|
+
border: "#00C43A"
|
|
1765
|
+
};
|
|
1766
|
+
var MUSHI_ON_ACCENT = "#FAF7F0";
|
|
1767
|
+
var MUSHI_INVERSE = "#ffffff";
|
|
1768
|
+
var MUSHI_ACCENT_SHADOW = {
|
|
1769
|
+
light: "#9A2A1E",
|
|
1770
|
+
dark: "#7A1F15"
|
|
1771
|
+
};
|
|
1772
|
+
var MUSHI_BANNER_BRAND_BORDER = {
|
|
1773
|
+
light: "#B52F1F",
|
|
1774
|
+
dark: "#C4321E"
|
|
1775
|
+
};
|
|
1776
|
+
var MUSHI_REPORTER_STATUS = {
|
|
1777
|
+
light: {
|
|
1778
|
+
sent: { fg: "#1E4A8C", bg: "rgba(30,74,140,0.08)", border: "rgba(30,74,140,0.16)" },
|
|
1779
|
+
review: { fg: "#8A5A00", bg: "rgba(180,120,0,0.10)", border: "rgba(180,120,0,0.18)" },
|
|
1780
|
+
fixing: { fg: "#9A3D12", bg: "rgba(224,60,44,0.10)", border: "rgba(224,60,44,0.18)" },
|
|
1781
|
+
fixed: { fg: "#1F6B3A", bg: "rgba(31,107,58,0.10)", border: "rgba(31,107,58,0.18)" }
|
|
1782
|
+
},
|
|
1783
|
+
dark: {
|
|
1784
|
+
sent: { fg: "#A8C4FF", bg: "rgba(120,160,255,0.12)", border: "rgba(120,160,255,0.22)" },
|
|
1785
|
+
review: { fg: "#FFD27A", bg: "rgba(255,190,90,0.12)", border: "rgba(255,190,90,0.22)" },
|
|
1786
|
+
fixing: { fg: "#FFB899", bg: "rgba(255,120,60,0.12)", border: "rgba(255,120,60,0.24)" },
|
|
1787
|
+
fixed: { fg: "#8FE3B0", bg: "rgba(80,200,130,0.12)", border: "rgba(80,200,130,0.22)" }
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1733
1790
|
function mushiPalette(mode) {
|
|
1734
1791
|
return mode === "dark" ? MUSHI_COLORS_DARK : MUSHI_COLORS_LIGHT;
|
|
1735
1792
|
}
|
|
@@ -1776,16 +1833,32 @@ var MUSHI_MOTION = {
|
|
|
1776
1833
|
var MUSHI_GEOMETRY = {
|
|
1777
1834
|
bannerHeight: 36,
|
|
1778
1835
|
fabSize: 52,
|
|
1779
|
-
|
|
1836
|
+
/** edge-tab launcher width (px) */
|
|
1837
|
+
edgeTabWidth: 32,
|
|
1780
1838
|
/** default gutter from the screen edge (added on top of safe-area insets) */
|
|
1781
1839
|
gutter: 24,
|
|
1782
|
-
|
|
1840
|
+
/** Web panel width (px) — matches shipped Shadow DOM widget */
|
|
1841
|
+
panelWidth: 360,
|
|
1842
|
+
/** max panel height before keyboard inset (px) */
|
|
1843
|
+
panelMaxHeight: 480,
|
|
1783
1844
|
/** below this viewport width the panel becomes a full-width bottom sheet */
|
|
1784
1845
|
panelSheetBreakpoint: 480
|
|
1785
1846
|
};
|
|
1847
|
+
function safeWidgetHex(v) {
|
|
1848
|
+
return /^#[0-9a-fA-F]{3,8}$/.test(v) ? v : "";
|
|
1849
|
+
}
|
|
1850
|
+
function resolveWidgetAccent(mode, accent = "", accentText = "") {
|
|
1851
|
+
const pal = mushiPalette(mode);
|
|
1852
|
+
const safeAccent = safeWidgetHex(accent);
|
|
1853
|
+
const safeAccentText = safeWidgetHex(accentText);
|
|
1854
|
+
const resolvedAccent = safeAccent || pal.accent;
|
|
1855
|
+
const accentWash = safeAccent ? mode === "dark" ? `${resolvedAccent}1F` : `${resolvedAccent}14` : pal.accentWash;
|
|
1856
|
+
const accentInk = safeAccentText || pal.accentInk;
|
|
1857
|
+
return { accent: resolvedAccent, accentWash, accentInk };
|
|
1858
|
+
}
|
|
1786
1859
|
var MUSHI_COPY = {
|
|
1787
1860
|
bannerLabel: "Beta",
|
|
1788
|
-
bannerMessage: "
|
|
1861
|
+
bannerMessage: "Found a bug? Tap to report it.",
|
|
1789
1862
|
bugCta: "Report a bug",
|
|
1790
1863
|
featureCta: "Feature request",
|
|
1791
1864
|
triggerText: "\u{1F41B}",
|
|
@@ -2036,6 +2109,6 @@ function isSafeFaviconHref(href) {
|
|
|
2036
2109
|
}
|
|
2037
2110
|
}
|
|
2038
2111
|
|
|
2039
|
-
export { DEFAULT_API_ENDPOINT, MAX_REPORT_PAYLOAD_BYTES, MAX_SCREENSHOT_DATA_URL_BYTES, MUSHI_COLORS_DARK, MUSHI_COLORS_LIGHT, MUSHI_COPY, MUSHI_GEOMETRY, MUSHI_IDENTITY_TOKEN_PREFIX, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, MUSHI_MOTION, MUSHI_PROJECT_HEADER, MUSHI_RADIUS, MUSHI_SDK_PACKAGE_HEADER, MUSHI_SDK_VERSION_HEADER, MUSHI_SPACING, MUSHI_TYPE, MUSHI_USER_TOKEN_HEADER, MUSHI_Z, REGION_ENDPOINTS, buildIdentityClaims, buildSdkIngestHeaders, captureEnvironment, checkReportPayloadSize, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, estimateJsonBytes, faviconUrlCandidates, formatBytes, getDeviceFingerprintHash, getReporterToken, getSessionId, githubRepoDomainHint, isLikelyGenericFavicon, isUntrustedFaviconUrl, mushiPalette, mushiTokens, newUuid, noopLogger, normaliseThrown, originToDomain, parseIdentityToken, projectFaviconUrlCandidates, projectInitials, projectInitialsThemeIndex, readPageFaviconHref, resolveEnvConfig, resolveProjectDomain, resolveProjectFaviconDomains, resolveRegionEndpoint, scrubPii };
|
|
2112
|
+
export { DEFAULT_API_ENDPOINT, MAX_REPORT_PAYLOAD_BYTES, MAX_SCREENSHOT_DATA_URL_BYTES, MUSHI_ACCENT_SHADOW, MUSHI_BANNER_BRAND_BORDER, MUSHI_BANNER_NEON, MUSHI_COLORS_DARK, MUSHI_COLORS_LIGHT, MUSHI_COPY, MUSHI_GEOMETRY, MUSHI_IDENTITY_TOKEN_PREFIX, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INVERSE, MUSHI_MOTION, MUSHI_ON_ACCENT, MUSHI_PROJECT_HEADER, MUSHI_RADIUS, MUSHI_REPORTER_STATUS, MUSHI_SDK_PACKAGE_HEADER, MUSHI_SDK_VERSION_HEADER, MUSHI_SPACING, MUSHI_TIER_COLORS, MUSHI_TYPE, MUSHI_USER_TOKEN_HEADER, MUSHI_Z, REGION_ENDPOINTS, buildIdentityClaims, buildSdkIngestHeaders, captureEnvironment, checkReportPayloadSize, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, estimateJsonBytes, faviconUrlCandidates, formatBytes, getDeviceFingerprintHash, getReporterToken, getSessionId, githubRepoDomainHint, hmacSha256Hex, isLikelyGenericFavicon, isUntrustedFaviconUrl, mushiPalette, mushiTokens, newUuid, noopLogger, normaliseThrown, originToDomain, parseIdentityToken, projectFaviconUrlCandidates, projectInitials, projectInitialsThemeIndex, readPageFaviconHref, resolveEnvConfig, resolveProjectDomain, resolveProjectFaviconDomains, resolveRegionEndpoint, resolveWidgetAccent, safeWidgetHex, scrubPii, sha256Hex };
|
|
2040
2113
|
//# sourceMappingURL=index.js.map
|
|
2041
2114
|
//# sourceMappingURL=index.js.map
|