Skip to content

feat(browser)!: Remove captureUserFeedback method #14820

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 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sentry.captureUserFeedback({
Sentry.captureFeedback({
eventId: 'test_event_id',
email: 'test_email',
comments: 'test_comments',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
beforeSend(event) {
Sentry.captureUserFeedback({
Sentry.captureFeedback({
event_id: event.event_id,
name: 'John Doe',
email: '[email protected]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ window.Sentry = Sentry;
Sentry.init({
dsn: 'https://[email protected]/1337',
beforeSend(event) {
Sentry.captureUserFeedback({
Sentry.captureFeedback({
event_id: event.event_id,
name: 'John Doe',
email: '[email protected]',
Expand Down
4 changes: 4 additions & 0 deletions docs/migration/v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ Sentry.init({
- The `urlEncode` method has been removed. There is no replacement.
- The `getDomElement` method has been removed. There is no replacement.

### `@sentry/browser`

- The `captureUserFeedback` method has been removed. Use `captureFeedback` instead as a drop-in replacement.

### `@sentry/nestjs`

- Removed `WithSentry` decorator. Use `SentryExceptionCaptured` instead.
Expand Down
27 changes: 1 addition & 26 deletions packages/browser/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ import type {
ParameterizedString,
Scope,
SeverityLevel,
UserFeedback,
} from '@sentry/core';
import { BaseClient, applySdkMetadata, getSDKSource, logger } from '@sentry/core';
import { DEBUG_BUILD } from './debug-build';
import { BaseClient, applySdkMetadata, getSDKSource } from '@sentry/core';
import { eventFromException, eventFromMessage } from './eventbuilder';
import { WINDOW } from './helpers';
import type { BrowserTransportOptions } from './transports/types';
import { createUserFeedbackEnvelope } from './userfeedback';

/**
* Configuration options for the Sentry Browser SDK.
Expand Down Expand Up @@ -105,28 +102,6 @@ export class BrowserClient extends BaseClient<BrowserClientOptions> {
return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);
}

/**
* Sends user feedback to Sentry.
*
* @deprecated Use `captureFeedback` instead.
*/
public captureUserFeedback(feedback: UserFeedback): void {
if (!this._isEnabled()) {
DEBUG_BUILD && logger.warn('SDK not enabled, will not capture user feedback.');
return;
}

const envelope = createUserFeedbackEnvelope(feedback, {
metadata: this.getSdkMetadata(),
dsn: this.getDsn(),
tunnel: this.getOptions().tunnel,
});

// sendEnvelope should not throw
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.sendEnvelope(envelope);
}

/**
* @inheritDoc
*/
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 @@ -27,6 +27,7 @@ export {
addIntegration,
captureException,
captureEvent,
captureFeedback,
captureMessage,
close,
createTransport,
Expand Down Expand Up @@ -92,8 +93,6 @@ export {
init,
onLoad,
showReportDialog,
// eslint-disable-next-line deprecation/deprecation
captureUserFeedback,
} from './sdk';

export { breadcrumbsIntegration } from './integrations/breadcrumbs';
Expand Down
16 changes: 1 addition & 15 deletions packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
consoleSandbox,
dedupeIntegration,
functionToStringIntegration,
getClient,
getCurrentScope,
getIntegrationsToSetup,
getReportDialogEndpoint,
Expand All @@ -13,7 +12,7 @@ import {
stackParserFromStackParserOptions,
supportsFetch,
} from '@sentry/core';
import type { Client, DsnLike, Integration, Options, UserFeedback } from '@sentry/core';
import type { Client, DsnLike, Integration, Options } from '@sentry/core';
import type { BrowserClientOptions, BrowserOptions } from './client';
import { BrowserClient } from './client';
import { DEBUG_BUILD } from './debug-build';
Expand Down Expand Up @@ -307,16 +306,3 @@ export function forceLoad(): void {
export function onLoad(callback: () => void): void {
callback();
}

/**
* Captures user feedback and sends it to Sentry.
*
* @deprecated Use `captureFeedback` instead.
*/
export function captureUserFeedback(feedback: UserFeedback): void {
const client = getClient<BrowserClient>();
if (client) {
// eslint-disable-next-line deprecation/deprecation
client.captureUserFeedback(feedback);
}
}
Loading