import { API , BaseClient , Scope } from "@sentry/core" ; import { DsnLike , Event , EventHint } from "@sentry/types" ; import { getGlobalObject , logger } from "@sentry/utils" ; import { MiniappBackend , MiniappOptions } from "./backend" ; import { SDK_NAME , SDK_VERSION } from "./version" ; /**
 * All properties the report dialog supports
 */ export interface ReportDialogOptions { [ key ] : any ; eventId ? : string ; dsn ? : DsnLike ; user ? : { email ? : string ; name ? : string ; } ; lang ? : string ; title ? : string ; subtitle ? : string ; subtitle2 ? : string ; labelName ? : string ; labelEmail ? : string ; labelComments ? : string ; labelClose ? : string ; labelSubmit ? : string ; errorGeneric ? : string ; errorFormEntry ? : string ; successMessage ? : string ; /** Callback after reportDialog showed up */ onLoad ? ( ) : void ; } see MiniappOptions see SentryClient export class MiniappClient extends BaseClient < MiniappBackend , MiniappOptions > { param options public constructor ( options = { } ) { super ( MiniappBackend , options ) ; } inheritDoc protected _prepareEvent ( event , scope ? , hint ? ) { event . platform = event . platform || "javascript" ; event . sdk = { ... event . sdk , name : SDK_NAME , packages : [ ... ( ( event . sdk && event . sdk . packages ) || [ ] ) , { name : "npm:@sentry/miniapp" , version : SDK_VERSION } ] , version : SDK_VERSION } ; return super . _prepareEvent ( event , scope , hint ) ; } param options public showReportDialog ( options = { } ) { const document = getGlobalObject < Window > ( ) . document ; if ( ! document ) { return ; } if ( ! this . _isEnabled ( ) ) { logger . error ( "Trying to call showReportDialog with Sentry Client is disabled" ) ; return ; } const dsn = options . dsn || this . getDsn ( ) ; if ( ! options . eventId ) { logger . error ( "Missing `eventId` option in showReportDialog call" ) ; return ; } if ( ! dsn ) { logger . error ( "Missing `Dsn` option in showReportDialog call" ) ; return ; } const script = document . createElement ( "script" ) ; script . async = true ; script . src = new API ( dsn ) . getReportDialogEndpoint ( options ) ; if ( options . onLoad ) { script . onload = options . onLoad ; } ( document . head || document . body ) . appendChild ( script ) ; } }