1- import { API , captureException , withScope } from '@sentry/core' ;
2- import { DsnLike , Event as SentryEvent , Mechanism , Scope , WrappedFunction } from '@sentry/types' ;
1+ import { captureException , Dsn , getReportDialogEndpoint , ReportDialogOptions , withScope } from '@sentry/core' ;
2+ import { Event as SentryEvent , Mechanism , Scope , WrappedFunction } from '@sentry/types' ;
33import { addExceptionMechanism , addExceptionTypeValue , logger } from '@sentry/utils' ;
44
55let ignoreOnError : number = 0 ;
@@ -160,39 +160,11 @@ export function wrap(
160160 return sentryWrapped ;
161161}
162162
163- /**
164- * All properties the report dialog supports
165- */
166- export interface ReportDialogOptions {
167- // eslint-disable-next-line @typescript-eslint/no-explicit-any
168- [ key : string ] : any ;
169- eventId ?: string ;
170- dsn ?: DsnLike ;
171- user ?: {
172- email ?: string ;
173- name ?: string ;
174- } ;
175- lang ?: string ;
176- title ?: string ;
177- subtitle ?: string ;
178- subtitle2 ?: string ;
179- labelName ?: string ;
180- labelEmail ?: string ;
181- labelComments ?: string ;
182- labelClose ?: string ;
183- labelSubmit ?: string ;
184- errorGeneric ?: string ;
185- errorFormEntry ?: string ;
186- successMessage ?: string ;
187- /** Callback after reportDialog showed up */
188- onLoad ?( ) : void ;
189- }
190-
191163/**
192164 * Injects the Report Dialog script
193165 * @hidden
194166 */
195- export function injectReportDialog ( options : ReportDialogOptions = { } ) : void {
167+ export function injectReportDialog ( options : ReportDialogOptions & { onLoad ? ( ) : void } = { } ) : void {
196168 if ( ! options . eventId ) {
197169 logger . error ( `Missing eventId option in showReportDialog call` ) ;
198170 return ;
@@ -204,7 +176,7 @@ export function injectReportDialog(options: ReportDialogOptions = {}): void {
204176
205177 const script = document . createElement ( 'script' ) ;
206178 script . async = true ;
207- script . src = new API ( options . dsn ) . getReportDialogEndpoint ( options ) ;
179+ script . src = getReportDialogEndpoint ( new Dsn ( options . dsn ) ) ;
208180
209181 if ( options . onLoad ) {
210182 // eslint-disable-next-line @typescript-eslint/unbound-method
0 commit comments