Skip to content

Commit c5821d9

Browse files
committed
use isBrowser
1 parent 9b94658 commit c5821d9

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

packages/feedback/src/integration.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getCurrentHub } from '@sentry/core';
22
import type { Integration } from '@sentry/types';
3-
import { isNodeEnv, logger } from '@sentry/utils';
3+
import { isBrowser } from '@sentry/utils';
4+
import { logger } from '@sentry/utils';
45

56
import {
67
ACTOR_LABEL,
@@ -25,20 +26,6 @@ import { createDialogStyles } from './widget/Dialog.css';
2526
import { createMainStyles } from './widget/Main.css';
2627
import { SuccessMessage } from './widget/SuccessMessage';
2728

28-
type ElectronProcess = { type?: string };
29-
30-
// Electron renderers with nodeIntegration enabled are detected as Node.js so we specifically test for them
31-
function isElectronNodeRenderer(): boolean {
32-
return typeof process !== 'undefined' && (process as ElectronProcess).type === 'renderer';
33-
}
34-
/**
35-
* Returns true if we are in the browser.
36-
*/
37-
function isBrowser(): boolean {
38-
// eslint-disable-next-line no-restricted-globals
39-
return typeof window !== 'undefined' && (!isNodeEnv() || isElectronNodeRenderer());
40-
}
41-
4229
interface FeedbackConfiguration extends Partial<Omit<FeedbackConfigurationWithDefaults, 'theme'>> {
4330
theme?: {
4431
dark?: Partial<FeedbackTheme>;
@@ -271,7 +258,7 @@ export class Feedback implements Integration {
271258

272259
const userKey = this.options.useSentryUser;
273260
const scope = getCurrentHub().getScope();
274-
const user = scope && scope.getUser();
261+
const user = scope.getUser();
275262

276263
this._dialog = Dialog({
277264
defaultName: (userKey && user && user[userKey.name]) || '',

0 commit comments

Comments
 (0)