import getStaticConfig from "coral-framework/lib/getStaticConfig" ; import { ErrorReporter } from "./reporter" ; import { SentryErrorReporter } from "./sentry" ; interface Options { /**
     * reporterPrompt when true will ensure that the reporters error boundary
     * element is configured if the reporter supports it to collect user feedback.
     */ reporterFeedbackPrompt ? : boolean ; } function createDevelopmentReporter ( ) { return new SentryErrorReporter ( false , "http://debug@debug/1" , { offlineDebug : true , } ) ; } function createReporter ( window , { reporterFeedbackPrompt = false } = { } ) { const config = getStaticConfig ( window ) ; if ( ! config ) { if ( process . env . NODE_ENV === "development" ) { return createDevelopmentReporter ( ) ; } return ; } if ( ! config . reporter ) { if ( process . env . NODE_ENV === "development" ) { return createDevelopmentReporter ( ) ; } return ; } switch ( config . reporter . name ) { case "sentry" : return new SentryErrorReporter ( reporterFeedbackPrompt , config . reporter . dsn ) ; default : console . error ( `Unsupported error reporter: ${ config . reporter . name }` ) ; return ; } } export default createReporter ;