Skip to content

Commit 5370a99

Browse files
committed
Updates SDK API
1 parent 817eac8 commit 5370a99

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

packages/core/src/js/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export type {
44
SdkInfo,
55
Event,
66
Exception,
7+
SendFeedbackParams,
78
SeverityLevel,
89
StackFrame,
910
Stacktrace,
@@ -59,7 +60,17 @@ export { SDK_NAME, SDK_VERSION } from './version';
5960
export type { ReactNativeOptions } from './options';
6061
export { ReactNativeClient } from './client';
6162

62-
export { init, wrap, nativeCrash, flush, close, captureUserFeedback, withScope, crashedLastRun } from './sdk';
63+
export {
64+
init,
65+
wrap,
66+
nativeCrash,
67+
flush,
68+
close,
69+
captureFeedback,
70+
captureUserFeedback,
71+
withScope,
72+
crashedLastRun,
73+
} from './sdk';
6374
export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
6475

6576
export {

packages/core/src/js/sdk.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
defaultStackParser,
55
makeFetchTransport,
66
} from '@sentry/react';
7-
import type { Breadcrumb, BreadcrumbHint, Integration, Scope, UserFeedback } from '@sentry/types';
7+
import type { Breadcrumb, BreadcrumbHint, Integration, Scope, SendFeedbackParams, UserFeedback } from '@sentry/types';
88
import { logger, stackParserFromStackParserOptions } from '@sentry/utils';
99
import * as React from 'react';
1010

@@ -219,9 +219,23 @@ export async function close(): Promise<void> {
219219

220220
/**
221221
* Captures user feedback and sends it to Sentry.
222+
* @deprecated Use `Sentry.captureFeedback` instead.
222223
*/
223224
export function captureUserFeedback(feedback: UserFeedback): void {
224-
getClient<ReactNativeClient>()?.captureUserFeedback(feedback);
225+
const feedbackParams = {
226+
name: feedback.name,
227+
email: feedback.email,
228+
message: feedback.comments,
229+
associatedEventId: feedback.event_id,
230+
};
231+
captureFeedback(feedbackParams);
232+
}
233+
234+
/**
235+
* Captures user feedback and sends it to Sentry.
236+
*/
237+
export function captureFeedback(feedbackParams: SendFeedbackParams): void {
238+
getClient<ReactNativeClient>()?.captureFeedback(feedbackParams);
225239
}
226240

227241
/**

0 commit comments

Comments
 (0)