Skip to content

Commit 68eef54

Browse files
authored
feat(feedback): Return the eventId into the onSubmitSuccess callback (#16835)
Fixes #16836
1 parent ccb129b commit 68eef54

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

packages/core/src/types-hoist/feedback/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export interface FeedbackCallbacks {
197197
*
198198
* After this you'll see a SuccessMessage on the screen for a moment.
199199
*/
200-
onSubmitSuccess?: (data: FeedbackFormData) => void;
200+
onSubmitSuccess?: (data: FeedbackFormData, eventId: string) => void;
201201

202202
/**
203203
* Callback when feedback is unsuccessfully submitted

packages/feedback/src/modal/components/Dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export function Dialog({ open, onFormSubmitted, ...props }: Props): VNode {
3030
}, [timeoutId]);
3131

3232
const onSubmitSuccess = useCallback(
33-
(data: FeedbackFormData) => {
34-
props.onSubmitSuccess(data);
33+
(data: FeedbackFormData, eventId: string) => {
34+
props.onSubmitSuccess(data, eventId);
3535
setTimeoutId(
3636
setTimeout(() => {
3737
onFormSubmitted();

packages/feedback/src/modal/components/Form.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface Props extends Pick<FeedbackInternalOptions, 'showEmail' | 'show
1818
defaultName: string;
1919
onFormClose: () => void;
2020
onSubmit: SendFeedback;
21-
onSubmitSuccess: (data: FeedbackFormData) => void;
21+
onSubmitSuccess: (data: FeedbackFormData, eventId: string) => void;
2222
onSubmitError: (error: Error) => void;
2323
screenshotInput: ReturnType<FeedbackScreenshotIntegration['createInput']> | undefined;
2424
}
@@ -118,7 +118,7 @@ export function Form({
118118
}
119119

120120
try {
121-
await onSubmit(
121+
const eventId = await onSubmit(
122122
{
123123
name: data.name,
124124
email: data.email,
@@ -128,7 +128,7 @@ export function Form({
128128
},
129129
{ attachments: data.attachments },
130130
);
131-
onSubmitSuccess(data);
131+
onSubmitSuccess(data, eventId);
132132
} catch (error) {
133133
DEBUG_BUILD && logger.error(error);
134134
setError(error as string);

packages/feedback/src/modal/integration.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ export const feedbackModalIntegration = ((): FeedbackModalIntegration => {
7777
options.onFormClose?.();
7878
}}
7979
onSubmit={sendFeedback}
80-
onSubmitSuccess={(data: FeedbackFormData) => {
80+
onSubmitSuccess={(data: FeedbackFormData, eventId: string) => {
8181
renderContent(false);
82-
options.onSubmitSuccess?.(data);
82+
options.onSubmitSuccess?.(data, eventId);
8383
}}
8484
onSubmitError={(error: Error) => {
8585
options.onSubmitError?.(error);

packages/feedback/src/util/mergeOptions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export function mergeOptions(
2323
optionOverrides.onFormClose?.();
2424
defaultOptions.onFormClose?.();
2525
},
26-
onSubmitSuccess: (data: FeedbackFormData) => {
27-
optionOverrides.onSubmitSuccess?.(data);
28-
defaultOptions.onSubmitSuccess?.(data);
26+
onSubmitSuccess: (data: FeedbackFormData, eventId: string) => {
27+
optionOverrides.onSubmitSuccess?.(data, eventId);
28+
defaultOptions.onSubmitSuccess?.(data, eventId);
2929
},
3030
onSubmitError: (error: Error) => {
3131
optionOverrides.onSubmitError?.(error);

0 commit comments

Comments
 (0)