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' ;
3
3
import { addExceptionMechanism , addExceptionTypeValue , logger } from '@sentry/utils' ;
4
4
5
5
let ignoreOnError : number = 0 ;
@@ -160,39 +160,11 @@ export function wrap(
160
160
return sentryWrapped ;
161
161
}
162
162
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
-
191
163
/**
192
164
* Injects the Report Dialog script
193
165
* @hidden
194
166
*/
195
- export function injectReportDialog ( options : ReportDialogOptions = { } ) : void {
167
+ export function injectReportDialog ( options : ReportDialogOptions & { onLoad ? ( ) : void } = { } ) : void {
196
168
if ( ! options . eventId ) {
197
169
logger . error ( `Missing eventId option in showReportDialog call` ) ;
198
170
return ;
@@ -204,7 +176,7 @@ export function injectReportDialog(options: ReportDialogOptions = {}): void {
204
176
205
177
const script = document . createElement ( 'script' ) ;
206
178
script . async = true ;
207
- script . src = new API ( options . dsn ) . getReportDialogEndpoint ( options ) ;
179
+ script . src = getReportDialogEndpoint ( new Dsn ( options . dsn ) ) ;
208
180
209
181
if ( options . onLoad ) {
210
182
// eslint-disable-next-line @typescript-eslint/unbound-method
0 commit comments