@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.cjs CHANGED
@@ -2557,7 +2557,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2557
2557
 
2558
2558
  // src/version.ts
2559
2559
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
2560
- var MUSHI_SDK_VERSION = "1.22.5" ;
2560
+ var MUSHI_SDK_VERSION = "1.23.0" ;
2561
2561
  var CATEGORY_ICONS = {
2562
2562
  bug: "\u26A0\uFE0F",
2563
2563
  slow: "\u{1F40C}",
@@ -7714,11 +7714,11 @@ var Mushi = class {
7714
7714
  return createNoopInstance();
7715
7715
  }
7716
7716
  const resolved = { ...core.resolveEnvConfig(), ...config };
7717
- if (!resolved.projectId) {
7718
- 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");
7719
- }
7720
- if (!resolved.apiKey) {
7721
- 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");
7717
+ if (!resolved.projectId || !resolved.apiKey) {
7718
+ const diagnostics = core.diagnoseEnvConfig();
7719
+ throw new Error(
7720
+ diagnostics.message ?? "[mushi] projectId and apiKey are required \u2014 set NEXT_PUBLIC_MUSHI_* / VITE_MUSHI_* / MUSHI_* or pass them explicitly"
7721
+ );
7722
7722
  }
7723
7723
  if (resolved.enabled === false) {
7724
7724
  return createNoopInstance();
@@ -7738,7 +7738,8 @@ var Mushi = class {
7738
7738
  }
7739
7739
  };
7740
7740
  function createInstance(config) {
7741
- const bootstrapConfig = applyPresetConfig(config);
7741
+ core.validateConfig(config);
7742
+ const bootstrapConfig = core.expandPreset(config);
7742
7743
  const projectId = bootstrapConfig.projectId;
7743
7744
  const reporterTokenForProject = () => core.getReporterToken(projectId);
7744
7745
  let activeConfig = bootstrapConfig;
@@ -9068,63 +9069,6 @@ function createInstance(config) {
9068
9069
  });
9069
9070
  return isolatePublicApi(sdk);
9070
9071
  }
9071
- function applyPresetConfig(config) {
9072
- if (!config.preset) return config;
9073
- const preset = presetDefaults(config.preset);
9074
- return {
9075
- ...config,
9076
- widget: {
9077
- ...preset.widget,
9078
- ...config.widget
9079
- },
9080
- capture: {
9081
- ...preset.capture,
9082
- ...config.capture
9083
- },
9084
- proactive: {
9085
- ...preset.proactive,
9086
- ...config.proactive,
9087
- cooldown: {
9088
- ...preset.proactive?.cooldown,
9089
- ...config.proactive?.cooldown
9090
- }
9091
- }
9092
- };
9093
- }
9094
- function presetDefaults(preset) {
9095
- switch (preset) {
9096
- case "manual-only":
9097
- return {
9098
- widget: { trigger: "manual", outdatedBanner: "console-only" },
9099
- capture: { console: true, network: true, performance: false, screenshot: "on-report", elementSelector: false },
9100
- proactive: { rageClick: false, longTask: false, apiCascade: false, errorBoundary: false }
9101
- };
9102
- case "beta-loud":
9103
- return {
9104
- widget: { trigger: "auto", outdatedBanner: "banner" },
9105
- capture: { console: true, network: true, performance: true, screenshot: "auto", elementSelector: true },
9106
- proactive: { rageClick: true, longTask: true, apiCascade: true, errorBoundary: true }
9107
- };
9108
- case "internal-debug":
9109
- return {
9110
- widget: { trigger: "auto", outdatedBanner: "banner", brandFooter: true },
9111
- capture: { console: true, network: true, performance: true, screenshot: "auto", elementSelector: true },
9112
- proactive: {
9113
- rageClick: true,
9114
- longTask: true,
9115
- apiCascade: true,
9116
- errorBoundary: true,
9117
- cooldown: { maxProactivePerSession: 10, dismissCooldownHours: 0, suppressAfterDismissals: 99 }
9118
- }
9119
- };
9120
- case "production-calm":
9121
- return {
9122
- widget: { trigger: "auto", outdatedBanner: "console-only" },
9123
- capture: { console: true, network: true, performance: false, screenshot: "on-report", elementSelector: false },
9124
- proactive: { rageClick: false, longTask: false, apiCascade: false, errorBoundary: false }
9125
- };
9126
- }
9127
- }
9128
9072
  function resolveApiEndpoint(config) {
9129
9073
  return config.apiEndpoint ?? core.DEFAULT_API_ENDPOINT;
9130
9074
  }