MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / getReportDialogEndpoint

Function getReportDialogEndpoint

packages/core/src/api.ts:49–84  ·  view source on GitHub ↗
(dsnLike: DsnLike, dialogOptions: ReportDialogOptions)

Source from the content-addressed store, hash-verified

47
48/** Returns the url to the report dialog endpoint. */
49export function getReportDialogEndpoint(dsnLike: DsnLike, dialogOptions: ReportDialogOptions): string {
50 const dsn = makeDsn(dsnLike);
51 if (!dsn) {
52 return '';
53 }
54
55 const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;
56
57 let encodedOptions = `dsn=${dsnToString(dsn)}`;
58 for (const key in dialogOptions) {
59 if (key === 'dsn') {
60 continue;
61 }
62
63 if (key === 'onClose') {
64 continue;
65 }
66
67 if (key === 'user') {
68 const user = dialogOptions.user;
69 if (!user) {
70 continue;
71 }
72 if (user.name) {
73 encodedOptions += `&name=${encodeURIComponent(user.name)}`;
74 }
75 if (user.email) {
76 encodedOptions += `&email=${encodeURIComponent(user.email)}`;
77 }
78 } else {
79 encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] as string)}`;
80 }
81 }
82
83 return `${endpoint}?${encodedOptions}`;
84}

Callers 2

api.test.tsFile · 0.90
showReportDialogFunction · 0.85

Calls 3

makeDsnFunction · 0.90
dsnToStringFunction · 0.90
getBaseApiEndpointFunction · 0.85

Tested by

no test coverage detected