import * as Sentry from '@sentry/nextjs'; const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN || ''; if (SENTRY_DSN) { Sentry.init({ dsn: SENTRY_DSN, environment: process.env.NODE_ENV || 'development', enabled: process.env.NODE_ENV !== 'development', tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.2 : 0, replaysSessionSampleRate: 0, replaysOnErrorSampleRate: 1.0, ignoreErrors: [ /_AutofillCallbackHandler/, /NetworkError/, /webkit\.messageHandlers/, /Non-Error promise rejection captured/, /^Loading CSS chunk.*failed/, /^Loading chunk.*failed/, /^Failed to fetch dynamically imported module/, ], denyUrls: [ /extensions\//i, /^chrome:\/\//i, /webappstoolbars/i, /safari-extension:/i, /mypersonalassistant/i, ], initialScope: { tags: { project: 'novalon-website', version: process.env.npm_package_version || 'unknown', deployment: process.env.NODE_ENV || 'unknown', }, user: { id: 'anonymous', segment: 'visitor', }, }, beforeSend(event) { if (event.request?.url) { event.request.url = event.request.url.replace(/\/[a-f0-9]{32}/gi, '/[hash]'); } if (event.breadcrumbs) { event.breadcrumbs = event.breadcrumbs.filter((breadcrumb) => { return !( breadcrumb.category === 'console' && breadcrumb.level === 'log' ); }); } return event; }, integrations: [ Sentry.browserTracingIntegration(), Sentry.replayIntegration({ maskAllText: true, blockAllMedia: true, }), ], }); console.log('[Sentry] Client-side monitoring initialized'); } else { console.warn('[Sentry] NEXT_PUBLIC_SENTRY_DSN not configured, error monitoring disabled'); } export default Sentry;