Skip to content

Commit ec69b68

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 700f3c5 + 18ced89 commit ec69b68

File tree

9 files changed

+522
-418
lines changed

9 files changed

+522
-418
lines changed

apps/frontend/next.config.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ const nextConfig = {
66
experimental: {
77
proxyTimeout: 90_000,
88
},
9+
// Document-Policy header for browser profiling
10+
async headers() {
11+
return [{
12+
source: "/:path*",
13+
headers: [{
14+
key: "Document-Policy",
15+
value: "js-profiling",
16+
}, ],
17+
}, ];
18+
},
919
reactStrictMode: false,
1020
transpilePackages: ['crypto-hash'],
1121
// Enable production sourcemaps for Sentry
@@ -60,15 +70,15 @@ export default withSentryConfig(nextConfig, {
6070
org: process.env.SENTRY_ORG,
6171
project: process.env.SENTRY_PROJECT,
6272
authToken: process.env.SENTRY_AUTH_TOKEN,
63-
73+
6474
// Sourcemap configuration optimized for monorepo
6575
sourcemaps: {
6676
disable: false,
6777
// More comprehensive asset patterns for monorepo
6878
assets: [
6979
".next/static/**/*.js",
7080
".next/static/**/*.js.map",
71-
".next/server/**/*.js",
81+
".next/server/**/*.js",
7282
".next/server/**/*.js.map",
7383
],
7484
ignore: [
@@ -97,7 +107,7 @@ export default withSentryConfig(nextConfig, {
97107
telemetry: false,
98108
silent: process.env.NODE_ENV === 'production',
99109
debug: process.env.NODE_ENV === 'development',
100-
110+
101111
// Error handling for CI/CD
102112
errorHandler: (error) => {
103113
console.warn("Sentry build error occurred:", error.message);

apps/frontend/src/components/new-layout/layout.component.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use client';
1+
'use client';
22

33
import React, { ReactNode, useCallback } from 'react';
44
import { Logo } from '@gitroom/frontend/components/new-layout/logo';
@@ -24,7 +24,6 @@ import { MediaSettingsLayout } from '@gitroom/frontend/components/launches/helpe
2424
import { Toaster } from '@gitroom/react/toaster/toaster';
2525
import { ShowPostSelector } from '@gitroom/frontend/components/post-url-selector/post.url.selector';
2626
import { NewSubscription } from '@gitroom/frontend/components/layout/new.subscription';
27-
import { Onboarding } from '@gitroom/frontend/components/onboarding/onboarding';
2827
import { Support } from '@gitroom/frontend/components/layout/support';
2928
import { ContinueProvider } from '@gitroom/frontend/components/layout/continue.provider';
3029
import { ContextWrapper } from '@gitroom/frontend/components/layout/user.context';
@@ -39,6 +38,7 @@ import NotificationComponent from '@gitroom/frontend/components/notifications/no
3938
import { BillingAfter } from '@gitroom/frontend/components/new-layout/billing.after';
4039
import { OrganizationSelector } from '@gitroom/frontend/components/layout/organization.selector';
4140
import { PreConditionComponent } from '@gitroom/frontend/components/layout/pre-condition.component';
41+
import { AttachToFeedbackIcon } from '@gitroom/frontend/components/new-layout/sentry.feedback.component';
4242

4343
const jakartaSans = Plus_Jakarta_Sans({
4444
weight: ['600', '500'],
@@ -50,6 +50,8 @@ export const LayoutComponent = ({ children }: { children: ReactNode }) => {
5050
const fetch = useFetch();
5151

5252
const { backendUrl, billingEnabled, isGeneral } = useVariables();
53+
54+
// Feedback icon component attaches Sentry feedback to a top-bar icon when DSN is present
5355
const searchParams = useSearchParams();
5456
const load = useCallback(async (path: string) => {
5557
return await (await fetch(path)).json();
@@ -118,6 +120,7 @@ export const LayoutComponent = ({ children }: { children: ReactNode }) => {
118120
<LanguageComponent />
119121
<ChromeExtensionComponent />
120122
<div className="w-[1px] h-[20px] bg-blockSeparator" />
123+
<AttachToFeedbackIcon />
121124
<NotificationComponent />
122125
</div>
123126
</div>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
'use client';
2+
3+
import { FC, useEffect, useRef, useState } from 'react';
4+
import * as Sentry from '@sentry/nextjs';
5+
import { useVariables } from '@gitroom/react/helpers/variable.context';
6+
7+
export const AttachToFeedbackIcon: FC = () => {
8+
const { sentryDsn } = useVariables();
9+
const [feedback, setFeedback] = useState<any>();
10+
const buttonRef = useRef<HTMLButtonElement | null>(null);
11+
12+
useEffect(() => {
13+
if (!sentryDsn) return;
14+
try {
15+
const fb = (Sentry as any).getFeedback?.();
16+
setFeedback(fb);
17+
} catch (e) {
18+
setFeedback(undefined);
19+
}
20+
}, [sentryDsn]);
21+
22+
useEffect(() => {
23+
if (feedback && buttonRef.current) {
24+
const unsubscribe = feedback.attachTo(buttonRef.current);
25+
return unsubscribe;
26+
}
27+
return () => {};
28+
}, [feedback]);
29+
30+
if (!sentryDsn) return null;
31+
32+
return (
33+
<button
34+
ref={buttonRef}
35+
type="button"
36+
aria-label="Feedback"
37+
className="hover:text-newTextColor"
38+
>
39+
<svg
40+
width="24"
41+
height="24"
42+
viewBox="0 0 32 32"
43+
fill="none"
44+
xmlns="http://www.w3.org/2000/svg"
45+
>
46+
<path
47+
d="M27 10H23V6C23 5.46957 22.7893 4.96086 22.4142 4.58579C22.0391 4.21071 21.5304 4 21 4H5C4.46957 4 3.96086 4.21071 3.58579 4.58579C3.21071 4.96086 3 5.46957 3 6V22C3.00059 22.1881 3.05423 22.3723 3.15478 22.5313C3.25532 22.6903 3.39868 22.8177 3.56839 22.8989C3.7381 22.9801 3.92728 23.0118 4.11418 22.9903C4.30108 22.9689 4.47814 22.8951 4.625 22.7775L9 19.25V23C9 23.5304 9.21071 24.0391 9.58579 24.4142C9.96086 24.7893 10.4696 25 11 25H22.6987L27.375 28.7775C27.5519 28.9206 27.7724 28.9991 28 29C28.2652 29 28.5196 28.8946 28.7071 28.7071C28.8946 28.5196 29 28.2652 29 28V12C29 11.4696 28.7893 10.9609 28.4142 10.5858C28.0391 10.2107 27.5304 10 27 10ZM8.31875 17.2225L5 19.9062V6H21V17H8.9475C8.71863 17 8.4967 17.0786 8.31875 17.2225ZM27 25.9062L23.6812 23.2225C23.5043 23.0794 23.2838 23.0009 23.0562 23H11V19H21C21.5304 19 22.0391 18.7893 22.4142 18.4142C22.7893 18.0391 23 17.5304 23 17V12H27V25.9062Z"
48+
fill="currentColor"
49+
/>
50+
</svg>
51+
</button>
52+
);
53+
};

libraries/nestjs-libraries/src/mcp/mcp.settings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
22
import { MainMcp } from '@gitroom/backend/mcp/main.mcp';
33
import { socialIntegrationList } from '@gitroom/nestjs-libraries/integrations/integration.manager';
4-
4+
import * as Sentry from '@sentry/nestjs';
55
export class McpSettings {
66
private _server: McpServer;
77
createServer(organization: string, service: MainMcp) {
8-
this._server = new McpServer(
8+
this._server = Sentry.wrapMcpServerWithSentry(new McpServer(
99
{
1010
name: 'Postiz',
1111
version: '2.0.0',
@@ -17,7 +17,7 @@ export class McpSettings {
1717
', '
1818
)} to schedule you need to have the providerId (you can get it from POSTIZ_PROVIDERS_LIST), user need to specify the schedule date (or now), text, you also can send base64 images and text for the comments. When you get POSTIZ_PROVIDERS_LIST, always display all the options to the user`,
1919
}
20-
);
20+
));
2121

2222
for (const usePrompt of Reflect.getMetadata(
2323
'MCP_PROMPT',

libraries/nestjs-libraries/src/sentry/initialize.sentry.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ export const initializeSentry = (appName: string, allowLogs = false) => {
2626
// Add our Profiling integration
2727
nodeProfilingIntegration(),
2828
Sentry.consoleLoggingIntegration({ levels: ['log', 'error', 'warn'] }),
29+
Sentry.openAIIntegration({
30+
recordInputs: true,
31+
recordOutputs: true,
32+
}),
2933
],
30-
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
34+
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.25,
3135
enableLogs: true,
3236

3337
// Profiling
34-
profileSessionSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
38+
profileSessionSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.45,
3539
profileLifecycle: 'trace',
3640
});
3741
} catch (err) {

libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const initializeSentryClient = (environment: string, dsn: string) =>
66
integrations: [
77
// Add default integrations back
88
Sentry.browserTracingIntegration(),
9+
Sentry.browserProfilingIntegration(),
910
Sentry.replayIntegration({
1011
maskAllText: true,
1112
maskAllInputs: true,
@@ -17,4 +18,6 @@ export const initializeSentryClient = (environment: string, dsn: string) =>
1718
],
1819
replaysSessionSampleRate: environment === 'development' ? 1.0 : 0.5,
1920
replaysOnErrorSampleRate: 1.0,
21+
22+
profilesSampleRate: environment === 'development' ? 1.0 : 0.45,
2023
});

libraries/react-shared-libraries/src/sentry/initialize.sentry.next.basic.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,26 @@ export const initializeSentryBasic = (environment: string, dsn: string, extensio
2626
...extension,
2727
debug: environment === 'development',
2828
tracesSampleRate: environment === 'development' ? 1.0 : 0.3,
29+
30+
// Filtert Events und zeigt das User-Feedback-Modal an
31+
beforeSend(event, hint) {
32+
if (event.exception && event.exception.values) {
33+
for (const exception of event.exception.values) {
34+
// Filtert "Failed to fetch" Fehler heraus
35+
if (exception.value && /Failed to fetch/.test(exception.value)) {
36+
return null; // Verwirft den Event
37+
}
38+
}
39+
}
40+
41+
// Wenn der Event eine Ausnahme ist und nicht gefiltert wurde,
42+
// wird das User-Feedback-Modal angezeigt
43+
if (event.exception && event.event_id) {
44+
Sentry.showReportDialog({ eventId: event.event_id });
45+
}
46+
47+
return event; // Sendet den Event an Sentry
48+
},
2949
});
3050
} catch (err) {}
3151
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@
7373
"@neynar/react": "^0.9.7",
7474
"@postiz/wallets": "^0.0.1",
7575
"@prisma/client": "^6.5.0",
76-
"@sentry/nestjs": "^9.43.0",
77-
"@sentry/nextjs": "^9.43.0",
78-
"@sentry/profiling-node": "^9.43.0",
76+
"@sentry/nestjs": "^10.12.0",
77+
"@sentry/nextjs": "^10.12.0",
78+
"@sentry/profiling-node": "^10.12.0",
7979
"@solana/wallet-adapter-react": "^0.15.35",
8080
"@solana/wallet-adapter-react-ui": "^0.9.35",
8181
"@swc/helpers": "0.5.13",

0 commit comments

Comments
 (0)