Sith/core/static/bundled/sentry-popup-index.ts

25 lines
539 B
TypeScript
Raw Normal View History

2024-10-13 14:47:33 +00:00
import { exportToHtml } from "#core:utils/globals";
// biome-ignore lint/style/noNamespaceImport: this is the recommended way from the documentation
import * as Sentry from "@sentry/browser";
interface LoggedUser {
name: string;
email: string;
}
interface SentryOptions {
dsn: string;
eventId: string;
user?: LoggedUser;
}
exportToHtml("loadSentryPopup", (options: SentryOptions) => {
Sentry.init({
dsn: options.dsn,
});
Sentry.showReportDialog({
eventId: options.eventId,
...(options.user ?? {}),
});
});