From 7d2797d2c86dff14354a51f5704816fc0ac223b4 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 27 Nov 2024 18:28:51 +0200 Subject: [PATCH 1/4] Updates capture feedback sample --- .../sdk-api-example/react-native.mdx | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/platform-includes/user-feedback/sdk-api-example/react-native.mdx b/platform-includes/user-feedback/sdk-api-example/react-native.mdx index eaf2457462772..8921ca7ffe1a9 100644 --- a/platform-includes/user-feedback/sdk-api-example/react-native.mdx +++ b/platform-includes/user-feedback/sdk-api-example/react-native.mdx @@ -1,16 +1,35 @@ ```typescript import * as Sentry from "@sentry/react-native"; -import { UserFeedback } from "@sentry/react-native"; +import { SendFeedbackParams } from "@sentry/react-native"; const sentryId = Sentry.captureMessage("My Message"); // OR: const sentryId = Sentry.lastEventId(); -const userFeedback: UserFeedback = { - event_id: sentryId, +const userFeedback: SendFeedbackParams = { name: "John Doe", email: "john@doe.com", - comments: "Hello World!", + message: "Hello World!", + associatedEventId: eventId,// Optional }; Sentry.captureUserFeedback(userFeedback); ``` + +You can also attach further data to the feedback event by passing a hint as a second argument. This is similar to other `capture` methods: + +```javascript +Sentry.captureFeedback( + { message: "I really like your App, thanks!" }, + { + captureContext: { + tags: { key: "value" }, + }, + attachments: [ + { + filename: "screenshot.png", + data: "base64-encoded-image", + }, + ], + } +); +``` \ No newline at end of file From c6da9a9246153c4ded1a809ce5b99db93ff532d9 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 17 Dec 2024 15:02:25 +0200 Subject: [PATCH 2/4] Update platform-includes/user-feedback/sdk-api-example/react-native.mdx Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com> --- .../user-feedback/sdk-api-example/react-native.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/user-feedback/sdk-api-example/react-native.mdx b/platform-includes/user-feedback/sdk-api-example/react-native.mdx index 8921ca7ffe1a9..27a9116b0ac37 100644 --- a/platform-includes/user-feedback/sdk-api-example/react-native.mdx +++ b/platform-includes/user-feedback/sdk-api-example/react-native.mdx @@ -9,7 +9,7 @@ const userFeedback: SendFeedbackParams = { name: "John Doe", email: "john@doe.com", message: "Hello World!", - associatedEventId: eventId,// Optional + associatedEventId: eventId, // Optional }; Sentry.captureUserFeedback(userFeedback); From 1f6763b9f456fbe71f34c224ac08e099faf21294 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 17 Dec 2024 15:03:06 +0200 Subject: [PATCH 3/4] Update platform-includes/user-feedback/sdk-api-example/react-native.mdx Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com> --- .../user-feedback/sdk-api-example/react-native.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/user-feedback/sdk-api-example/react-native.mdx b/platform-includes/user-feedback/sdk-api-example/react-native.mdx index 27a9116b0ac37..4adc13556a1e3 100644 --- a/platform-includes/user-feedback/sdk-api-example/react-native.mdx +++ b/platform-includes/user-feedback/sdk-api-example/react-native.mdx @@ -12,7 +12,7 @@ const userFeedback: SendFeedbackParams = { associatedEventId: eventId, // Optional }; -Sentry.captureUserFeedback(userFeedback); +Sentry.captureFeedback(userFeedback); ``` You can also attach further data to the feedback event by passing a hint as a second argument. This is similar to other `capture` methods: From a44510d0ce12e0abadf7b9da9c3a7ab8631398d4 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 17 Dec 2024 15:09:44 +0200 Subject: [PATCH 4/4] Use the simpler text attachment --- .../user-feedback/sdk-api-example/react-native.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform-includes/user-feedback/sdk-api-example/react-native.mdx b/platform-includes/user-feedback/sdk-api-example/react-native.mdx index 4adc13556a1e3..86e29e5b24324 100644 --- a/platform-includes/user-feedback/sdk-api-example/react-native.mdx +++ b/platform-includes/user-feedback/sdk-api-example/react-native.mdx @@ -26,8 +26,8 @@ Sentry.captureFeedback( }, attachments: [ { - filename: "screenshot.png", - data: "base64-encoded-image", + filename: 'hello.txt', + data: 'Hello, World!', }, ], }