Skip to content

ref(core)!: Cleanup internal types, including ReportDialogOptions #14861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/migration/v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ Since v9, the types have been merged into `@sentry/core`, which removed some of
- The `IntegrationClass` type is no longer exported - it was not used anymore. Instead, use `Integration` or `IntegrationFn`.
- The `samplingContext.request` attribute in the `tracesSampler` has been removed. Use `samplingContext.normalizedRequest` instead. Note that the type of `normalizedRequest` differs from `request`.
- `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`.
- `ReportDialogOptions` now extends `Record<string, unknown>` instead of `Record<string, any>` - this should not affect most users.

# No Version Support Timeline

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"circularDepCheck": "lerna run circularDepCheck",
"clean": "run-s clean:build clean:caches",
"clean:build": "lerna run clean",
"clean:caches": "yarn rimraf eslintcache .nxcache && yarn jest --clearCache",
"clean:caches": "yarn rimraf eslintcache .nxcache .nx && yarn jest --clearCache",
"clean:deps": "lerna clean --yes && rm -rf node_modules && yarn",
"clean:tarballs": "rimraf {packages,dev-packages}/*/*.tgz",
"clean:watchman": "watchman watch-del \".\"",
Expand Down
3 changes: 1 addition & 2 deletions packages/browser-utils/src/metrics/inp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ function _trackINP(): () => void {

/**
* Register a listener to cache route information for INP interactions.
* TODO(v9): `latestRoute` no longer needs to be passed in and will be removed in v9.
*/
export function registerInpInteractionListener(_latestRoute?: unknown): void {
export function registerInpInteractionListener(): void {
const handleEntries = ({ entries }: { entries: PerformanceEntry[] }): void => {
const activeSpan = getActiveSpan();
const activeRootSpan = activeSpan && getRootSpan(activeSpan);
Expand Down
3 changes: 1 addition & 2 deletions packages/browser/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ export type {
Thread,
User,
Session,
ReportDialogOptions,
} from '@sentry/core';

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

export type { ReportDialogOptions } from './sdk';

export {
addEventProcessor,
addBreadcrumb,
Expand Down
33 changes: 1 addition & 32 deletions packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Client, DsnLike, Integration, Options } from '@sentry/core';
import type { Client, Integration, Options, ReportDialogOptions } from '@sentry/core';
import {
consoleSandbox,
dedupeIntegration,
Expand Down Expand Up @@ -200,37 +200,6 @@ export function init(browserOptions: BrowserOptions = {}): Client | undefined {
return initAndBind(BrowserClient, clientOptions);
}

/**
* All properties the report dialog supports
*/
export interface ReportDialogOptions {
// TODO(v9): Change this to [key: string]: unknkown;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
eventId?: string;
dsn?: DsnLike;
user?: {
email?: string;
name?: string;
};
lang?: string;
title?: string;
subtitle?: string;
subtitle2?: string;
labelName?: string;
labelEmail?: string;
labelComments?: string;
labelClose?: string;
labelSubmit?: string;
errorGeneric?: string;
errorFormEntry?: string;
successMessage?: string;
/** Callback after reportDialog showed up */
onLoad?(this: void): void;
/** Callback after reportDialog closed */
onClose?(this: void): void;
}

/**
* Present the user with a report dialog.
*
Expand Down
11 changes: 2 additions & 9 deletions packages/core/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ReportDialogOptions } from './report-dialog';
import type { DsnComponents, DsnLike, SdkInfo } from './types-hoist';
import { dsnToString, makeDsn } from './utils-hoist/dsn';

Expand Down Expand Up @@ -44,15 +45,7 @@ export function getEnvelopeEndpointWithUrlEncodedAuth(dsn: DsnComponents, tunnel
}

/** Returns the url to the report dialog endpoint. */
export function getReportDialogEndpoint(
dsnLike: DsnLike,
dialogOptions: {
// TODO(v9): Change this to [key: string]: unknown;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
user?: { name?: string; email?: string };
},
): string {
export function getReportDialogEndpoint(dsnLike: DsnLike, dialogOptions: ReportDialogOptions): string {
const dsn = makeDsn(dsnLike);
if (!dsn) {
return '';
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export {
} from './fetch';
export { trpcMiddleware } from './trpc';
export { captureFeedback } from './feedback';
export type { ReportDialogOptions } from './report-dialog';

// eslint-disable-next-line deprecation/deprecation
export { getCurrentHubShim, getCurrentHub } from './getCurrentHubShim';
Expand Down
29 changes: 29 additions & 0 deletions packages/core/src/report-dialog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { DsnLike } from './types-hoist/dsn';

/**
* All properties the report dialog supports
*/
export interface ReportDialogOptions extends Record<string, unknown> {
eventId?: string;
dsn?: DsnLike;
user?: {
email?: string;
name?: string;
};
lang?: string;
title?: string;
subtitle?: string;
subtitle2?: string;
labelName?: string;
labelEmail?: string;
labelComments?: string;
labelClose?: string;
labelSubmit?: string;
errorGeneric?: string;
errorFormEntry?: string;
successMessage?: string;
/** Callback after reportDialog showed up */
onLoad?(this: void): void;
/** Callback after reportDialog closed */
onClose?(this: void): void;
}
2 changes: 0 additions & 2 deletions packages/core/src/types-hoist/wrappedfunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export type WrappedFunction<T extends Function = Function> = T & {
// TODO(v9): Remove this
[key: string]: any;
__sentry_wrapped__?: WrappedFunction<T>;
__sentry_original__?: T;
};
Loading