package.build.npm.cjs.userfeedback.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of browser Show documentation
Show all versions of browser Show documentation
Official Sentry SDK for browsers
Object.defineProperty(exports, '__esModule', { value: true });
const utils = require('@sentry/utils');
/**
* Creates an envelope from a user feedback.
*/
function createUserFeedbackEnvelope(
feedback,
{
metadata,
tunnel,
dsn,
}
,
) {
const headers = {
event_id: feedback.event_id,
sent_at: new Date().toISOString(),
...(metadata &&
metadata.sdk && {
sdk: {
name: metadata.sdk.name,
version: metadata.sdk.version,
},
}),
...(!!tunnel && !!dsn && { dsn: utils.dsnToString(dsn) }),
};
const item = createUserFeedbackEnvelopeItem(feedback);
return utils.createEnvelope(headers, [item]);
}
function createUserFeedbackEnvelopeItem(feedback) {
const feedbackHeaders = {
type: 'user_report',
};
return [feedbackHeaders, feedback];
}
exports.createUserFeedbackEnvelope = createUserFeedbackEnvelope;
//# sourceMappingURL=userfeedback.js.map