Skip to content

Commit a36df93

Browse files
committed
move report dialog options type to core & add to changelog
1 parent 1da3aff commit a36df93

File tree

6 files changed

+35
-39
lines changed

6 files changed

+35
-39
lines changed

docs/migration/v8-to-v9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ Since v9, the types have been merged into `@sentry/core`, which removed some of
217217
- The `TransactionNamingScheme` type has been removed. There is no replacement.
218218
- The `Request` type has been removed. Use `RequestEventData` type instead.
219219
- The `IntegrationClass` type is no longer exported - it was not used anymore. Instead, use `Integration` or `IntegrationFn`.
220+
- `ReportDialogOptions` now extends `Record<string, unknown>` instead of `Record<string, any>` - this should not affect most users.
220221

221222
# No Version Support Timeline
222223

packages/browser/src/exports.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ export type {
1313
Thread,
1414
User,
1515
Session,
16+
ReportDialogOptions,
1617
} from '@sentry/core';
1718

1819
export type { BrowserOptions } from './client';
1920

20-
export type { ReportDialogOptions } from './sdk';
21-
2221
export {
2322
addEventProcessor,
2423
addBreadcrumb,

packages/browser/src/sdk.ts

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Client, DsnLike, Integration, Options } from '@sentry/core';
1+
import type { Client, Integration, Options, ReportDialogOptions } from '@sentry/core';
22
import {
33
consoleSandbox,
44
dedupeIntegration,
@@ -207,35 +207,6 @@ export function init(browserOptions: BrowserOptions = {}): Client | undefined {
207207
return initAndBind(BrowserClient, clientOptions);
208208
}
209209

210-
/**
211-
* All properties the report dialog supports
212-
*/
213-
export interface ReportDialogOptions {
214-
[key: string]: unknown;
215-
eventId?: string;
216-
dsn?: DsnLike;
217-
user?: {
218-
email?: string;
219-
name?: string;
220-
};
221-
lang?: string;
222-
title?: string;
223-
subtitle?: string;
224-
subtitle2?: string;
225-
labelName?: string;
226-
labelEmail?: string;
227-
labelComments?: string;
228-
labelClose?: string;
229-
labelSubmit?: string;
230-
errorGeneric?: string;
231-
errorFormEntry?: string;
232-
successMessage?: string;
233-
/** Callback after reportDialog showed up */
234-
onLoad?(this: void): void;
235-
/** Callback after reportDialog closed */
236-
onClose?(this: void): void;
237-
}
238-
239210
/**
240211
* Present the user with a report dialog.
241212
*

packages/core/src/api.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { ReportDialogOptions } from './report-dialog';
12
import type { DsnComponents, DsnLike, SdkInfo } from './types-hoist';
23
import { dsnToString, makeDsn } from './utils-hoist/dsn';
34

@@ -44,13 +45,7 @@ export function getEnvelopeEndpointWithUrlEncodedAuth(dsn: DsnComponents, tunnel
4445
}
4546

4647
/** Returns the url to the report dialog endpoint. */
47-
export function getReportDialogEndpoint(
48-
dsnLike: DsnLike,
49-
dialogOptions: {
50-
[key: string]: unknown;
51-
user?: { name?: string; email?: string };
52-
},
53-
): string {
48+
export function getReportDialogEndpoint(dsnLike: DsnLike, dialogOptions: ReportDialogOptions): string {
5449
const dsn = makeDsn(dsnLike);
5550
if (!dsn) {
5651
return '';

packages/core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export {
107107
} from './fetch';
108108
export { trpcMiddleware } from './trpc';
109109
export { captureFeedback } from './feedback';
110+
export type { ReportDialogOptions } from './report-dialog';
110111

111112
// eslint-disable-next-line deprecation/deprecation
112113
export { getCurrentHubShim, getCurrentHub } from './getCurrentHubShim';

packages/core/src/report-dialog.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import type { DsnLike } from './types-hoist/dsn';
2+
3+
/**
4+
* All properties the report dialog supports
5+
*/
6+
export interface ReportDialogOptions extends Record<string, unknown> {
7+
eventId?: string;
8+
dsn?: DsnLike;
9+
user?: {
10+
email?: string;
11+
name?: string;
12+
};
13+
lang?: string;
14+
title?: string;
15+
subtitle?: string;
16+
subtitle2?: string;
17+
labelName?: string;
18+
labelEmail?: string;
19+
labelComments?: string;
20+
labelClose?: string;
21+
labelSubmit?: string;
22+
errorGeneric?: string;
23+
errorFormEntry?: string;
24+
successMessage?: string;
25+
/** Callback after reportDialog showed up */
26+
onLoad?(this: void): void;
27+
/** Callback after reportDialog closed */
28+
onClose?(this: void): void;
29+
}

0 commit comments

Comments
 (0)