@mushi-mushi/web 1.22.5 → 1.23.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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { mushiPalette, resolveWidgetAccent, MUSHI_REPORTER_STATUS, MUSHI_GEOMETRY, MUSHI_Z, MUSHI_MOTION, MUSHI_TYPE, MUSHI_BANNER_BRAND_BORDER, MUSHI_BANNER_NEON, MUSHI_INVERSE, MUSHI_ON_ACCENT, MUSHI_ACCENT_SHADOW, MUSHI_TIER_COLORS, readPageFaviconHref, resolveEnvConfig, createLogger, noopLogger, createApiClient, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, createBreadcrumbBuffer, getReporterToken, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, captureEnvironment, getSessionId, newUuid, DEFAULT_API_ENDPOINT, MUSHI_RADIUS, MUSHI_SPACING, isLikelyGenericFavicon, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INTERNAL_HEADER, MUSHI_COLORS_LIGHT, parseIdentityToken, normaliseThrown, resolveProjectDomain, projectInitials, projectFaviconUrlCandidates, sha256Hex } from '@mushi-mushi/core';
1
+ import { mushiPalette, resolveWidgetAccent, MUSHI_REPORTER_STATUS, MUSHI_GEOMETRY, MUSHI_Z, MUSHI_MOTION, MUSHI_TYPE, MUSHI_BANNER_BRAND_BORDER, MUSHI_BANNER_NEON, MUSHI_INVERSE, MUSHI_ON_ACCENT, MUSHI_ACCENT_SHADOW, MUSHI_TIER_COLORS, readPageFaviconHref, resolveEnvConfig, diagnoseEnvConfig, validateConfig, expandPreset, createLogger, noopLogger, createApiClient, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, createBreadcrumbBuffer, getReporterToken, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, captureEnvironment, getSessionId, newUuid, DEFAULT_API_ENDPOINT, MUSHI_RADIUS, MUSHI_SPACING, isLikelyGenericFavicon, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INTERNAL_HEADER, MUSHI_COLORS_LIGHT, parseIdentityToken, normaliseThrown, resolveProjectDomain, projectInitials, projectFaviconUrlCandidates, sha256Hex } from '@mushi-mushi/core';
2
2
 
3
3
  // src/capture/compress-screenshot.ts
4
4
  async function compressScreenshotDataUrl(dataUrl, maxBytes = MAX_SCREENSHOT_DATA_URL_BYTES) {
@@ -2555,7 +2555,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2555
2555
 
2556
2556
  // src/version.ts
2557
2557
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
2558
- var MUSHI_SDK_VERSION = "1.22.5" ;
2558
+ var MUSHI_SDK_VERSION = "1.23.0" ;
2559
2559
  var CATEGORY_ICONS = {
2560
2560
  bug: "\u26A0\uFE0F",
2561
2561
  slow: "\u{1F40C}",
@@ -7712,11 +7712,11 @@ var Mushi = class {
7712
7712
  return createNoopInstance();
7713
7713
  }
7714
7714
  const resolved = { ...resolveEnvConfig(), ...config };
7715
- if (!resolved.projectId) {
7716
- throw new Error("[mushi] projectId is required \u2014 set NEXT_PUBLIC_MUSHI_PROJECT_ID / VITE_MUSHI_PROJECT_ID / MUSHI_PROJECT_ID or pass it explicitly");
7717
- }
7718
- if (!resolved.apiKey) {
7719
- throw new Error("[mushi] apiKey is required \u2014 set NEXT_PUBLIC_MUSHI_API_KEY / VITE_MUSHI_API_KEY / MUSHI_API_KEY or pass it explicitly");
7715
+ if (!resolved.projectId || !resolved.apiKey) {
7716
+ const diagnostics = diagnoseEnvConfig();
7717
+ throw new Error(
7718
+ diagnostics.message ?? "[mushi] projectId and apiKey are required \u2014 set NEXT_PUBLIC_MUSHI_* / VITE_MUSHI_* / MUSHI_* or pass them explicitly"
7719
+ );
7720
7720
  }
7721
7721
  if (resolved.enabled === false) {
7722
7722
  return createNoopInstance();
@@ -7736,7 +7736,8 @@ var Mushi = class {
7736
7736
  }
7737
7737
  };
7738
7738
  function createInstance(config) {
7739
- const bootstrapConfig = applyPresetConfig(config);
7739
+ validateConfig(config);
7740
+ const bootstrapConfig = expandPreset(config);
7740
7741
  const projectId = bootstrapConfig.projectId;
7741
7742
  const reporterTokenForProject = () => getReporterToken(projectId);
7742
7743
  let activeConfig = bootstrapConfig;
@@ -9066,63 +9067,6 @@ function createInstance(config) {
9066
9067
  });
9067
9068
  return isolatePublicApi(sdk);
9068
9069
  }
9069
- function applyPresetConfig(config) {
9070
- if (!config.preset) return config;
9071
- const preset = presetDefaults(config.preset);
9072
- return {
9073
- ...config,
9074
- widget: {
9075
- ...preset.widget,
9076
- ...config.widget
9077
- },
9078
- capture: {
9079
- ...preset.capture,
9080
- ...config.capture
9081
- },
9082
- proactive: {
9083
- ...preset.proactive,
9084
- ...config.proactive,
9085
- cooldown: {
9086
- ...preset.proactive?.cooldown,
9087
- ...config.proactive?.cooldown
9088
- }
9089
- }
9090
- };
9091
- }
9092
- function presetDefaults(preset) {
9093
- switch (preset) {
9094
- case "manual-only":
9095
- return {
9096
- widget: { trigger: "manual", outdatedBanner: "console-only" },
9097
- capture: { console: true, network: true, performance: false, screenshot: "on-report", elementSelector: false },
9098
- proactive: { rageClick: false, longTask: false, apiCascade: false, errorBoundary: false }
9099
- };
9100
- case "beta-loud":
9101
- return {
9102
- widget: { trigger: "auto", outdatedBanner: "banner" },
9103
- capture: { console: true, network: true, performance: true, screenshot: "auto", elementSelector: true },
9104
- proactive: { rageClick: true, longTask: true, apiCascade: true, errorBoundary: true }
9105
- };
9106
- case "internal-debug":
9107
- return {
9108
- widget: { trigger: "auto", outdatedBanner: "banner", brandFooter: true },
9109
- capture: { console: true, network: true, performance: true, screenshot: "auto", elementSelector: true },
9110
- proactive: {
9111
- rageClick: true,
9112
- longTask: true,
9113
- apiCascade: true,
9114
- errorBoundary: true,
9115
- cooldown: { maxProactivePerSession: 10, dismissCooldownHours: 0, suppressAfterDismissals: 99 }
9116
- }
9117
- };
9118
- case "production-calm":
9119
- return {
9120
- widget: { trigger: "auto", outdatedBanner: "console-only" },
9121
- capture: { console: true, network: true, performance: false, screenshot: "on-report", elementSelector: false },
9122
- proactive: { rageClick: false, longTask: false, apiCascade: false, errorBoundary: false }
9123
- };
9124
- }
9125
- }
9126
9070
  function resolveApiEndpoint(config) {
9127
9071
  return config.apiEndpoint ?? DEFAULT_API_ENDPOINT;
9128
9072
  }