Skip to content

Commit 9c131a0

Browse files
authored
ref: ReportDialogOptions (#1573)
* ref: Add ReportDialogOptions * ref: Add doc comment * feat: Add changelog
1 parent 50b5a51 commit 9c131a0

File tree

3 files changed

+34
-23
lines changed

3 files changed

+34
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- [browser] ref: Expose `ReportDialogOptions`
6+
57
## 4.0.4
68

79
- [browser] feat: Add `forceLoad` and `onLoad` function to be compatible with loader API

packages/browser/src/client.ts

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,31 @@ import { DsnLike, SentryEvent, SentryEventHint } from '@sentry/types';
33
import { getGlobalObject } from '@sentry/utils/misc';
44
import { BrowserBackend, BrowserOptions } from './backend';
55

6+
/**
7+
* All properties the report dialog supports
8+
*/
9+
export interface ReportDialogOptions {
10+
[key: string]: any;
11+
eventId?: string;
12+
dsn?: DsnLike;
13+
user?: {
14+
email?: string;
15+
name?: string;
16+
};
17+
lang?: string;
18+
title?: string;
19+
subtitle?: string;
20+
subtitle2?: string;
21+
labelName?: string;
22+
labelEmail?: string;
23+
labelComments?: string;
24+
labelClose?: string;
25+
labelSubmit?: string;
26+
errorGeneric?: string;
27+
errorFormEntry?: string;
28+
successMessage?: string;
29+
}
30+
631
/**
732
* The Sentry Browser SDK Client.
833
*
@@ -27,28 +52,12 @@ export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
2752
return super.prepareEvent(event, scope, hint);
2853
}
2954

30-
/** JSDoc */
31-
public showReportDialog(options: {
32-
[key: string]: any;
33-
eventId?: string;
34-
dsn?: DsnLike;
35-
user?: {
36-
email?: string;
37-
name?: string;
38-
};
39-
lang?: string;
40-
title?: string;
41-
subtitle?: string;
42-
subtitle2?: string;
43-
labelName?: string;
44-
labelEmail?: string;
45-
labelComments?: string;
46-
labelClose?: string;
47-
labelSubmit?: string;
48-
errorGeneric?: string;
49-
errorFormEntry?: string;
50-
successMessage?: string;
51-
}): void {
55+
/**
56+
* Show a report dialog to the user to send feedback to a specific event.
57+
*
58+
* @param options Set individual options for the dialog
59+
*/
60+
public showReportDialog(options: ReportDialogOptions = {}): void {
5261
// doesn't work without a document (React Native)
5362
const document = (getGlobalObject() as Window).document;
5463
if (!document) {

packages/browser/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export {
2727
} from '@sentry/core';
2828

2929
export { BrowserBackend, BrowserOptions } from './backend';
30-
export { BrowserClient } from './client';
30+
export { BrowserClient, ReportDialogOptions } from './client';
3131
export { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog } from './sdk';
3232
export { SDK_NAME, SDK_VERSION } from './version';
3333

0 commit comments

Comments
 (0)