itube-specs 0.0.807 → 0.0.808

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.807",
4
+ "version": "0.0.808",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -0,0 +1,33 @@
1
+ // Инициализирует Sentry на клиенте. Два режима:
2
+ // - мягкий (флаг выключен): клиент не грузится вовсе, кроме ручного дебага через
3
+ // localStorage.sentry_debug=1 — тогда собираются только ошибки, без трейсов и replay;
4
+ // - полный (SentryFullCollectionEnabled): трейсы, session replay на 100% и tracking
5
+ // компонентов. Грузит производительность.
6
+ // SDK всегда импортируется динамически, чтобы не попадать в бандл в мягком режиме.
7
+ export default defineNuxtPlugin(async (nuxtApp) => {
8
+ const full = useRuntimeConfig().public.featureFlags.SentryFullCollectionEnabled;
9
+ const enabled = full || localStorage.getItem('sentry_debug') === '1';
10
+ if (!enabled) return;
11
+
12
+ const Sentry = await import('@sentry/nuxt');
13
+
14
+ const integrations = [
15
+ Sentry.vueIntegration({
16
+ app: nuxtApp.vueApp,
17
+ attachErrorHandler: true,
18
+ trackComponents: full,
19
+ }),
20
+ ];
21
+
22
+ if (full) {
23
+ integrations.push(Sentry.browserTracingIntegration(), Sentry.replayIntegration());
24
+ }
25
+
26
+ Sentry.init({
27
+ dsn: useRuntimeConfig().public.sentryDsn,
28
+ tracesSampleRate: full ? 1.0 : 0,
29
+ replaysSessionSampleRate: full ? 1.0 : 0,
30
+ replaysOnErrorSampleRate: full ? 1.0 : 0,
31
+ integrations,
32
+ });
33
+ });