Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions frontend/package-lock.json

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

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"@ngrx/router-store": "^17.2.0",
"@ngrx/store": "^17.2.0",
"@openmina/shared": "^0.102.0",
"@sentry/angular": "^8.35.0",
"@sentry/tracing": "^7.114.0",
"base-x": "^5.0.0",
"bs58check": "^4.0.0",
"buffer": "^6.0.3",
Expand Down
15 changes: 13 additions & 2 deletions frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorHandler, Injectable, LOCALE_ID, NgModule } from '@angular/core';
import { APP_INITIALIZER, ErrorHandler, Injectable, LOCALE_ID, NgModule, Provider } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
Expand Down Expand Up @@ -33,6 +33,8 @@ import { HttpClientModule } from '@angular/common/http';
import { NewNodeComponent } from './layout/new-node/new-node.component';
import { ReactiveFormsModule } from '@angular/forms';
import { WebNodeLandingPageComponent } from '@app/layout/web-node-landing-page/web-node-landing-page.component';
import * as Sentry from '@sentry/angular';
import { Router } from '@angular/router';

registerLocaleData(localeFr, 'fr');
registerLocaleData(localeEn, 'en');
Expand All @@ -41,7 +43,8 @@ registerLocaleData(localeEn, 'en');
export class AppGlobalErrorhandler implements ErrorHandler {
constructor(private errorHandlerService: GlobalErrorHandlerService) {}

handleError(error: any) {
handleError(error: any): void {
Sentry.captureException(error);
this.errorHandlerService.handleError(error);
console.error(error);
}
Expand Down Expand Up @@ -88,6 +91,14 @@ export class AppGlobalErrorhandler implements ErrorHandler {
THEME_PROVIDER,
{ provide: ErrorHandler, useClass: AppGlobalErrorhandler, deps: [GlobalErrorHandlerService] },
{ provide: LOCALE_ID, useValue: 'en' },
{ provide: ErrorHandler, useValue: Sentry.createErrorHandler() },
{ provide: Sentry.TraceService, deps: [Router] },
{
provide: APP_INITIALIZER,
useFactory: () => () => {},
deps: [Sentry.TraceService],
multi: true,
},
],
bootstrap: [AppComponent],
})
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/shared/constants/store-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Selector, Store } from '@ngrx/store';
import { MinaState } from '@app/app.setup';
import { concatLatestFrom } from '@ngrx/effects';
import { TypedAction } from '@ngrx/store/src/models';
import * as Sentry from '@sentry/angular';

export const catchErrorAndRepeat = <T>(errType: MinaErrorType, type: string, payload?: any): OperatorFunction<T, ErrorAdd | T | FeatureAction<any>> => {
return (source: Observable<T>) =>
Expand All @@ -21,6 +22,7 @@ export const catchErrorAndRepeat = <T>(errType: MinaErrorType, type: string, pay

export const addError = (error: HttpErrorResponse | Error, type: MinaErrorType): ErrorAdd => {
console.error(error);
Sentry.captureException(error, { tags: { type } });
return {
type: ADD_ERROR,
payload: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export interface MinaEnv {
hideNodeStats?: boolean;
canAddNodes?: boolean;
showWebNodeLandingPage?: boolean;
sentry?: {
dsn: string;
tracingOrigins: string[];
};
globalConfig?: {
features?: FeaturesConfig;
graphQL?: string;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions frontend/src/assets/environments/webnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export default {
'benchmarks': ['wallets'],
},
},
sentry: {
dsn: 'https://69aba72a6290383494290cf285ab13b3@o4508216158584832.ingest.de.sentry.io/4508216160616528',
tracingOrigins: ['https://www.openmina.com'],
},
configs: [
{
name: 'Web Node',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export const environment: Readonly<MinaEnv> = {
hideToolbar: env.hideToolbar,
canAddNodes: env.canAddNodes,
showWebNodeLandingPage: env.showWebNodeLandingPage,
sentry: env.sentry,
};
27 changes: 27 additions & 0 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from '@app/app.module';
import { CONFIG } from '@shared/constants/config';
import * as Sentry from '@sentry/angular';
import type { ErrorEvent } from '@sentry/types/build/types/event';

if (CONFIG.production) {
initSentry();
}

platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));

function initSentry(): void {
if (CONFIG.sentry) {
Sentry.init({
dsn: CONFIG.sentry.dsn,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],
tracesSampleRate: 1.0,
tracePropagationTargets: [...CONFIG.sentry?.tracingOrigins, ...CONFIG.configs.map((config) => config.url).filter(Boolean)],
replaysSessionSampleRate: 1.0,
replaysOnErrorSampleRate: 0.1,
beforeSend: (event: ErrorEvent) => {
event.fingerprint = [(Math.random() * 10000000).toString()];
return event;
},
});
}
}
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.