import * as Sentry from '@sentry/browser' ; const isProduction = process . env . NODE_ENV !== 'development' ; declare namespace umami { var trackEvent ; } export function trackEvent ( { value , type = 'custom' , } ) { if ( isProduction ) { try { umami && umami . trackEvent ( value , type ) ; } catch ( err ) { } } } export function sendQueryEvent ( query ) { trackEvent ( { value : 'Invoke new search' , type : 'search' } ) ; } export function sendGettingStartedEvent ( ) { trackEvent ( { value : 'Click getting started button' , type : 'search' } ) ; } export function sendExpandEvent ( ) { trackEvent ( { value : 'Expand card' , type : 'search' } ) ; } export function sendAcceptSuggestionEvent ( ) { trackEvent ( { value : 'Accept suggestion' , type : 'suggest' } ) ; } export function sendShuffleSuggestionEvent ( ) { trackEvent ( { value : 'Shuffle suggestion' , type : 'suggest' } ) ; } export function initSentry ( ) { if ( isProduction ) { Sentry . init ( { dsn : 'https://7ab2df74aead499b950ebef190cc40b7@sentry.io/1759299' , } ) ; } } export function sendError ( error , errorInfo ) { return new Promise ( ( resolve ) => { if ( isProduction ) { Sentry . withScope ( ( scope ) => { scope . setExtras ( errorInfo ) ; const eventId = Sentry . captureException ( error ) ; resolve ( eventId ) ; } ) ; } } ) ; }