1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| 'use client'
|
| import { useEffect } from 'react'
| import * as Sentry from '@sentry/react'
|
| const isDevelopment = process.env.NODE_ENV === 'development'
|
| const SentryInit = ({
| children,
| }: { children: React.ReactNode }) => {
| useEffect(() => {
| const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn')
| if (!isDevelopment && SENTRY_DSN) {
| Sentry.init({
| dsn: SENTRY_DSN,
| integrations: [
| Sentry.browserTracingIntegration(),
| Sentry.replayIntegration(),
| ],
| tracesSampleRate: 0.1,
| replaysSessionSampleRate: 0.1,
| replaysOnErrorSampleRate: 1.0,
| })
| }
| }, [])
| return children
| }
|
| export default SentryInit
|
|