Skip to content

Commit 3bfcc1a

Browse files
committed
move report dialog options type to core & add to changelog
1 parent 0624132 commit 3bfcc1a

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
@@ -226,6 +226,7 @@ Since v9, the types have been merged into `@sentry/core`, which removed some of
226226
- The `IntegrationClass` type is no longer exported - it was not used anymore. Instead, use `Integration` or `IntegrationFn`.
227227
- The `samplingContext.request` attribute in the `tracesSampler` has been removed. Use `samplingContext.normalizedRequest` instead. Note that the type of `normalizedRequest` differs from `request`.
228228
- `Client` now always expects the `BaseClient` class - there is no more abstract `Client` that can be implemented! Any `Client` class has to extend from `BaseClient`.
229+
- `ReportDialogOptions` now extends `Record<string, unknown>` instead of `Record<string, any>` - this should not affect most users.
229230

230231
# No Version Support Timeline
231232

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,
@@ -200,35 +200,6 @@ export function init(browserOptions: BrowserOptions = {}): Client | undefined {
200200
return initAndBind(BrowserClient, clientOptions);
201201
}
202202

203-
/**
204-
* All properties the report dialog supports
205-
*/
206-
export interface ReportDialogOptions {
207-
[key: string]: unknown;
208-
eventId?: string;
209-
dsn?: DsnLike;
210-
user?: {
211-
email?: string;
212-
name?: string;
213-
};
214-
lang?: string;
215-
title?: string;
216-
subtitle?: string;
217-
subtitle2?: string;
218-
labelName?: string;
219-
labelEmail?: string;
220-
labelComments?: string;
221-
labelClose?: string;
222-
labelSubmit?: string;
223-
errorGeneric?: string;
224-
errorFormEntry?: string;
225-
successMessage?: string;
226-
/** Callback after reportDialog showed up */
227-
onLoad?(this: void): void;
228-
/** Callback after reportDialog closed */
229-
onClose?(this: void): void;
230-
}
231-
232203
/**
233204
* Present the user with a report dialog.
234205
*

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
@@ -111,6 +111,7 @@ export {
111111
} from './fetch';
112112
export { trpcMiddleware } from './trpc';
113113
export { captureFeedback } from './feedback';
114+
export type { ReportDialogOptions } from './report-dialog';
114115

115116
// eslint-disable-next-line deprecation/deprecation
116117
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)