Skip to content

Commit 7f6d9fa

Browse files
committed
feat(browser)!: Remove captureUserFeedback method
1 parent 65531f3 commit 7f6d9fa

File tree

13 files changed

+10
-46
lines changed

13 files changed

+10
-46
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Sentry.captureUserFeedback({
1+
Sentry.captureFeedback({
22
eventId: 'test_event_id',
33
email: 'test_email',
44
comments: 'test_comments',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ window.Sentry = Sentry;
55
Sentry.init({
66
dsn: 'https://public@dsn.ingest.sentry.io/1337',
77
beforeSend(event) {
8-
Sentry.captureUserFeedback({
8+
Sentry.captureFeedback({
99
event_id: event.event_id,
1010
name: 'John Doe',
1111
email: 'john@doe.com',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ window.Sentry = Sentry;
55
Sentry.init({
66
dsn: 'https://public@dsn.ingest.sentry.io/1337',
77
beforeSend(event) {
8-
Sentry.captureUserFeedback({
8+
Sentry.captureFeedback({
99
event_id: event.event_id,
1010
name: 'John Doe',
1111
email: 'john@doe.com',

docs/migration/v8-to-v9.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ Sentry.init({
128128
- The `urlEncode` method has been removed. There is no replacement.
129129
- The `getDomElement` method has been removed. There is no replacement.
130130

131+
### `@sentry/browser`
132+
133+
- The `captureUserFeedback` method has been removed. Use `captureFeedback` instead as a drop-in replacement.
134+
131135
### `@sentry/nestjs`
132136

133137
- Removed `WithSentry` decorator. Use `SentryExceptionCaptured` instead.

packages/browser/src/client.ts

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ import type {
88
ParameterizedString,
99
Scope,
1010
SeverityLevel,
11-
UserFeedback,
1211
} from '@sentry/core';
13-
import { BaseClient, applySdkMetadata, getSDKSource, logger } from '@sentry/core';
14-
import { DEBUG_BUILD } from './debug-build';
12+
import { BaseClient, applySdkMetadata, getSDKSource } from '@sentry/core';
1513
import { eventFromException, eventFromMessage } from './eventbuilder';
1614
import { WINDOW } from './helpers';
1715
import type { BrowserTransportOptions } from './transports/types';
18-
import { createUserFeedbackEnvelope } from './userfeedback';
1916

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

108-
/**
109-
* Sends user feedback to Sentry.
110-
*
111-
* @deprecated Use `captureFeedback` instead.
112-
*/
113-
public captureUserFeedback(feedback: UserFeedback): void {
114-
if (!this._isEnabled()) {
115-
DEBUG_BUILD && logger.warn('SDK not enabled, will not capture user feedback.');
116-
return;
117-
}
118-
119-
const envelope = createUserFeedbackEnvelope(feedback, {
120-
metadata: this.getSdkMetadata(),
121-
dsn: this.getDsn(),
122-
tunnel: this.getOptions().tunnel,
123-
});
124-
125-
// sendEnvelope should not throw
126-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
127-
this.sendEnvelope(envelope);
128-
}
129-
130105
/**
131106
* @inheritDoc
132107
*/

packages/browser/src/exports.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export {
2727
addIntegration,
2828
captureException,
2929
captureEvent,
30+
captureFeedback,
3031
captureMessage,
3132
close,
3233
createTransport,
@@ -92,8 +93,6 @@ export {
9293
init,
9394
onLoad,
9495
showReportDialog,
95-
// eslint-disable-next-line deprecation/deprecation
96-
captureUserFeedback,
9796
} from './sdk';
9897

9998
export { breadcrumbsIntegration } from './integrations/breadcrumbs';

packages/browser/src/sdk.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
consoleSandbox,
33
dedupeIntegration,
44
functionToStringIntegration,
5-
getClient,
65
getCurrentScope,
76
getIntegrationsToSetup,
87
getReportDialogEndpoint,
@@ -13,7 +12,7 @@ import {
1312
stackParserFromStackParserOptions,
1413
supportsFetch,
1514
} from '@sentry/core';
16-
import type { Client, DsnLike, Integration, Options, UserFeedback } from '@sentry/core';
15+
import type { Client, DsnLike, Integration, Options } from '@sentry/core';
1716
import type { BrowserClientOptions, BrowserOptions } from './client';
1817
import { BrowserClient } from './client';
1918
import { DEBUG_BUILD } from './debug-build';
@@ -307,16 +306,3 @@ export function forceLoad(): void {
307306
export function onLoad(callback: () => void): void {
308307
callback();
309308
}
310-
311-
/**
312-
* Captures user feedback and sends it to Sentry.
313-
*
314-
* @deprecated Use `captureFeedback` instead.
315-
*/
316-
export function captureUserFeedback(feedback: UserFeedback): void {
317-
const client = getClient<BrowserClient>();
318-
if (client) {
319-
// eslint-disable-next-line deprecation/deprecation
320-
client.captureUserFeedback(feedback);
321-
}
322-
}

0 commit comments

Comments
 (0)