Skip to content

Commit

Permalink
refactor: remove unused logrocket (#4924)
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy authored Dec 1, 2023
1 parent 0dcb0c6 commit c155ae1
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 112 deletions.
1 change: 0 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@
"nunito",
"codesee",
"ehlo",
"logrocket",
"backoff",
"isequal",
"Scriptable",
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/prod-deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
echo REACT_APP_SENTRY_DSN="https://[email protected]/6250907" >> .env
echo REACT_APP_ENVIRONMENT=production >> .env
echo REACT_APP_SEGMENT_KEY=${{ secrets.WEB_SEGMENT_KEY }} >> .env
echo REACT_APP_LOGROCKET_ID=${{ secrets.LOGROCKET_ID }} >> .env
echo REACT_APP_MAIL_SERVER_DOMAIN="eu.inbound-mail.novu.co" >> .env
echo REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID=${{ secrets.PROD_LAUNCH_DARKLY_CLIENT_SIDE_ID }} >> .env
Expand All @@ -65,7 +64,6 @@ jobs:
REACT_APP_WEBHOOK_URL: https://eu.webhook.novu.co
REACT_APP_WIDGET_EMBED_PATH: https://eu.embed.novu.co/embed.umd.min.js
REACT_APP_NOVU_APP_ID: ${{ secrets.NOVU_APP_ID }}
REACT_APP_LOGROCKET_ID: ${{ secrets.LOGROCKET_ID }}
REACT_APP_SENTRY_DSN: https://[email protected]/6250907
REACT_APP_ENVIRONMENT: production
REACT_APP_MAIL_SERVER_DOMAIN: eu.inbound-mail.novu.co
Expand Down Expand Up @@ -128,7 +126,6 @@ jobs:
echo REACT_APP_SENTRY_DSN="https://[email protected]/6250907" >> .env
echo REACT_APP_ENVIRONMENT=production >> .env
echo REACT_APP_SEGMENT_KEY=${{ secrets.WEB_SEGMENT_KEY }} >> .env
echo REACT_APP_LOGROCKET_ID=${{ secrets.LOGROCKET_ID }} >> .env
echo REACT_APP_MAIL_SERVER_DOMAIN="inbound-mail.novu.co" >> .env
echo REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID=${{ secrets.PROD_LAUNCH_DARKLY_CLIENT_SIDE_ID }} >> .env
Expand All @@ -145,7 +142,6 @@ jobs:
REACT_APP_WEBHOOK_URL: https://webhook.novu.co
REACT_APP_WIDGET_EMBED_PATH: https://embed.novu.co/embed.umd.min.js
REACT_APP_NOVU_APP_ID: ${{ secrets.NOVU_APP_ID }}
REACT_APP_LOGROCKET_ID: ${{ secrets.LOGROCKET_ID }}
REACT_APP_SENTRY_DSN: https://[email protected]/6250907
REACT_APP_ENVIRONMENT: production
REACT_APP_MAIL_SERVER_DOMAIN: inbound-mail.novu.co
Expand Down
1 change: 0 additions & 1 deletion apps/web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ REACT_APP_SENTRY_DSN=
REACT_APP_BLUEPRINTS_API_URL=
REACT_APP_MAIL_SERVER_DOMAIN=
REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID=
REACT_APP_LOGROCKET_ID=
IS_TEMPLATE_STORE_ENABLED=
IS_MULTI_PROVIDER_CONFIGURATION_ENABLED=
IS_MULTI_TENANCY_ENABLED=
2 changes: 0 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@
"lodash.get": "^4.3.2",
"lodash.isequal": "^4.5.0",
"lodash.set": "^4.3.2",
"logrocket": "^3.0.1",
"logrocket-react": "^5.0.1",
"polished": "^4.1.3",
"react": "^17.0.1",
"react-ace": "^9.4.3",
Expand Down
53 changes: 2 additions & 51 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { HelmetProvider } from 'react-helmet-async';
import { Route, Routes, BrowserRouter } from 'react-router-dom';
import { withLDProvider } from 'launchdarkly-react-client-sdk';
import LogRocket from 'logrocket';
import setupLogRocketReact from 'logrocket-react';
import { Integrations } from '@sentry/tracing';
import { library } from '@fortawesome/fontawesome-svg-core';
import { far } from '@fortawesome/free-regular-svg-icons';
import { fas } from '@fortawesome/free-solid-svg-icons';

import packageJson from '../package.json';
import { AuthProvider } from './components/providers/AuthProvider';
import { applyToken, getToken } from './hooks';
import { ActivitiesPage } from './pages/activities/ActivitiesPage';
Expand All @@ -27,7 +24,7 @@ import { PasswordResetPage } from './pages/auth/PasswordResetPage';
import { AppLayout } from './components/layout/AppLayout';
import { MembersInvitePage } from './pages/invites/MembersInvitePage';
import CreateOrganizationPage from './pages/auth/CreateOrganizationPage';
import { ENV, LAUNCH_DARKLY_CLIENT_SIDE_ID, SENTRY_DSN, CONTEXT_PATH, LOGROCKET_ID } from './config';
import { ENV, LAUNCH_DARKLY_CLIENT_SIDE_ID, SENTRY_DSN, CONTEXT_PATH } from './config';
import { PromoteChangesPage } from './pages/changes/PromoteChangesPage';
import { LinkVercelProjectPage } from './pages/partner-integrations/LinkVercelProjectPage';
import { ROUTES } from './constants/routes.enum';
Expand Down Expand Up @@ -64,32 +61,6 @@ import { VariantsPage } from './pages/templates/components/VariantsPage';

library.add(far, fas);

if (LOGROCKET_ID && window !== undefined) {
LogRocket.init(LOGROCKET_ID, {
release: packageJson.version,
rootHostname: 'novu.co',
console: {
shouldAggregateConsoleErrors: true,
},
network: {
requestSanitizer: (request) => {
// if the url contains token 'ignore' it
if (request.url.toLowerCase().indexOf('token') !== -1) {
// ignore the request response pair
return null;
}

// remove Authorization header from logrocket
request.headers.Authorization = undefined;

// otherwise log the request normally
return request;
},
},
});
setupLogRocketReact(LogRocket);
}

if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,
Expand Down Expand Up @@ -122,29 +93,9 @@ if (SENTRY_DSN) {
*/
tracesSampleRate: 1.0,
beforeSend(event: Sentry.Event) {
const logRocketSession = LogRocket.sessionURL;

if (logRocketSession !== null || (event as string) !== '' || event !== undefined) {
/*
* Must ignore the next line as this variable could be null but
* can not be null because of the check in the if statement above.
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
event.extra.LogRocket = logRocketSession;

return event;
} else {
return event;
} //else
return event;
},
});

LogRocket.getSessionURL((sessionURL) => {
Sentry.configureScope((scope) => {
scope.setExtra('sessionURL', sessionURL);
});
});
}

const defaultQueryFn = async ({ queryKey }: { queryKey: string }) => {
Expand Down
27 changes: 1 addition & 26 deletions apps/web/src/components/layout/components/HeaderNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { useEffect, useMemo } from 'react';
import { Link } from 'react-router-dom';
import { useIntercom } from 'react-use-intercom';

import LogRocket from 'logrocket';
import { CONTEXT_PATH, INTERCOM_APP_ID, IS_DOCKER_HOSTED, LOGROCKET_ID, REACT_APP_VERSION } from '../../../config';
import { CONTEXT_PATH, INTERCOM_APP_ID, IS_DOCKER_HOSTED, REACT_APP_VERSION } from '../../../config';
import { ROUTES } from '../../../constants/routes.enum';
import {
colors,
Expand Down Expand Up @@ -87,30 +86,6 @@ export function HeaderNav({ isIntercomOpened }: Props) {
}
}, [boot, currentUser, currentOrganization]);

useEffect(() => {
if (!LOGROCKET_ID) return;
if (currentUser && currentOrganization) {
let logrocketTraits;

if (currentUser?.email !== undefined) {
logrocketTraits = {
name: currentUser?.firstName + ' ' + currentUser?.lastName,
organizationId: currentOrganization._id,
organization: currentOrganization.name,
email: currentUser?.email ? currentUser?.email : ' ',
};
} else {
logrocketTraits = {
name: currentUser?.firstName + ' ' + currentUser?.lastName,
organizationId: currentOrganization._id,
organization: currentOrganization.name,
};
}

LogRocket.identify(currentUser?._id, logrocketTraits);
}
}, [currentUser, currentOrganization]);

let themeTitle = 'Match System Appearance';
if (themeStatus === 'dark') {
themeTitle = 'Dark Theme';
Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export const INTERCOM_APP_ID = window._env_.REACT_APP_INTERCOM_APP_ID || process

export const CONTEXT_PATH = getContextPath(NovuComponentEnum.WEB);

export const LOGROCKET_ID = (window._env_.REACT_APP_LOGROCKET_ID || process.env.REACT_APP_LOGROCKET_ID) ?? '';

export const WEBHOOK_URL = isCypress
? window._env_.REACT_APP_WEBHOOK_URL || process.env.REACT_APP_WEBHOOK_URL || 'http://localhost:1341'
: window._env_.REACT_APP_WEBHOOK_URL || process.env.REACT_APP_WEBHOOK_URL || 'http://localhost:3003';
Expand Down
28 changes: 3 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c155ae1

Please sign in to comment.