@@ -2,15 +2,16 @@ import { createEventEnvelope, getCurrentHub } from '@sentry/core';
22import type { FeedbackEvent , TransportMakeRequestResponse } from '@sentry/types' ;
33
44import { FEEDBACK_API_SOURCE , FEEDBACK_WIDGET_SOURCE } from '../constants' ;
5- import type { SendFeedbackData } from '../types' ;
5+ import type { SendFeedbackData , SendFeedbackOptions } from '../types' ;
66import { prepareFeedbackEvent } from './prepareFeedbackEvent' ;
77
88/**
99 * Send feedback using transport
1010 */
11- export async function sendFeedbackRequest ( {
12- feedback : { message, email, name, source, replay_id, url } ,
13- } : SendFeedbackData ) : Promise < void | TransportMakeRequestResponse > {
11+ export async function sendFeedbackRequest (
12+ { feedback : { message, email, name, source, url } } : SendFeedbackData ,
13+ { includeReplay = true } : SendFeedbackOptions = { } ,
14+ ) : Promise < void | TransportMakeRequestResponse > {
1415 const hub = getCurrentHub ( ) ;
1516 const client = hub . getClient ( ) ;
1617 const transport = client && client . getTransport ( ) ;
@@ -26,7 +27,6 @@ export async function sendFeedbackRequest({
2627 contact_email : email ,
2728 name,
2829 message,
29- replay_id,
3030 url,
3131 source,
3232 } ,
@@ -54,6 +54,10 @@ export async function sendFeedbackRequest({
5454 return ;
5555 }
5656
57+ if ( client && client . emit ) {
58+ client . emit ( 'afterPrepareFeedback' , feedbackEvent , { includeReplay : Boolean ( includeReplay ) } ) ;
59+ }
60+
5761 const envelope = createEventEnvelope (
5862 feedbackEvent ,
5963 dsn ,
0 commit comments