fix publication

This commit is contained in:
peter.maquiran
2025-09-17 18:37:35 +01:00
parent 5f7295d41c
commit 3eecedb23f
64 changed files with 1043 additions and 873 deletions
+35 -56
View File
@@ -64,19 +64,9 @@ import { CustomImageCachePageRoutingModule } from './services/file/custom-image-
import { IonicImageLoaderModule } from 'ionic-image-loader-v5';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { MatInputModule } from '@angular/material/input';
import { MatNativeDateModule } from '@angular/material/core';
// The example is using Angular, Import '@sentry/vue' or '@sentry/react' when using a Sibling different than Angular.
import * as SentrySibling from '@sentry/angular';
import * as Sentry from '@sentry/capacitor';
// The e xample is using Angular, Import '@sentry/vue' or '@sentry/react' when using a Sibling different than Angular.
// For automatic instrumentation (highly recommended)
import { Integration } from '@sentry/types';
import { BrowserTracing } from '@sentry/tracing';
import * as SentrySibling from '@sentry/angular';
import { AngularFireModule } from '@angular/fire';
import { AngularFireMessagingModule } from '@angular/fire/messaging';
import { firebaseConfig } from '../firebase-config';
@@ -87,26 +77,26 @@ import { LoggingInterceptorService } from './services/logging-interceptor.servic
import { PopupQuestionPipe } from './modals/popup-question.pipe';
import '@teamhive/capacitor-video-recorder';
import { tokenInterceptor } from './infra/monitoring/interceptors/token.interceptors';
import { InputFilterDirective } from './services/directives/input-filter.directive';
import { DeplomaOptionsPageModule } from './shared/popover/deploma-options/deploma-options.module';
import { DiplomaOptionsPage } from './shared/popover/deploma-options/deploma-options.page';
import { ImageCropperModule } from 'ngx-image-cropper';
import { metricsInterceptor } from './infra/monitoring/interceptors/metter.interceptor';
import {MatMenuModule} from '@angular/material/menu';
import {MatIconModule} from '@angular/material/icon';
import { ChatModule } from './module/chat/chat.module';
import { openTelemetryLogging } from './services/monitoring/opentelemetry/logging';
import { registerLocaleData } from '@angular/common';
import localePt from '@angular/common/locales/pt';
import { LogsDatabase } from './infra/database/dexie/instance/logs/service';
import { UserModule } from './module/user/user.module';
import { Logger } from './services/logger/main/service';
// Register the locale data
registerLocaleData(localePt, 'pt');
import * as Sentry from '@sentry/capacitor';
import { Integration } from '@sentry/types';
import { BrowserTracing } from '@sentry/tracing';
import { LogsDatabase } from './infra/database/dexie/instance/logs/service';
import { AppErrorHandler } from './infra/crash-analytics/app-error-handler';
// Sentry.init(
// {
@@ -117,11 +107,7 @@ registerLocaleData(localePt, 'pt');
// // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// // We recommend adjusting this value in production.
// tracesSampleRate: 1.0,
// integrations: [
// new BrowserTracing({
// tracingOrigins: ['localhost', 'https://gd-api.oapr.gov.ao/api/'],
// }) as Integration,
// ],
// debug: true, // logs to console
// beforeSend(event) {
// console.log('event.exception.values[0].value', event.exception.values[0].value);
@@ -131,19 +117,17 @@ registerLocaleData(localePt, 'pt');
// console.log('event', event)
// })
// openTelemetryLogging.send({
// level: 'info',
// message: event.exception.values[0].value,
// payload: {
// object: {
// sentry: true,
// error: event
// }
// },
// })
// // openTelemetryLogging.send({
// // level: 'info',
// // message: event.exception.values[0].value,
// // payload: {
// // object: {
// // sentry: true,
// // error: event
// // }
// // },
// // })
// }
// console.log('Sentry Event', event);
// // Return event to send it to Sentry
// return event;
// },
@@ -151,18 +135,6 @@ registerLocaleData(localePt, 'pt');
// );
import Tracker from '@openreplay/tracker';
import trackerAssist from '@openreplay/tracker-assist'; // 👈 for errors, logs & stack traces
const tracker = new Tracker({
projectKey: "g8HOZiBi5iUWEsK3Ajw5",
__DISABLE_SECURE_MODE: true, // ✅ allow HTTP + localhost
});
tracker.start()
tracker.use(trackerAssist());
tracker.setUserID('john@doe.com');
(function () {
const httpLogs = [];
@@ -186,9 +158,15 @@ tracker.setUserID('john@doe.com');
let requestPayload = null;
if (config?.body) {
try {
requestPayload = typeof config.body === "string"
? config.body
: JSON.stringify(config.body);
if (typeof config.body === "string") {
requestPayload = config.body;
} else if (config.body !== null && typeof config.body === "object") {
// Keep plain objects/arrays as-is
requestPayload = config.body;
} else {
// For other cases (like FormData, Blob, etc.), attempt safe stringify
requestPayload = JSON.stringify(config.body);
}
} catch {
requestPayload = "[Unserializable body]";
}
@@ -307,7 +285,7 @@ tracker.setUserID('john@doe.com');
timestamp: new Date().toISOString(),
};
if(xhr.status >= 400 || xhr.status === 0) {
if(xhr.status >= 400 && !log.url.includes('petermaquiran.xyz') || xhr.status === 0 && !log.url.includes('petermaquiran.xyz')) {
Logger.error('XHR', log)
}
@@ -398,11 +376,12 @@ tracker.setUserID('john@doe.com');
],
providers: [
{ provide: MAT_DATE_LOCALE, useValue: 'pt' },
{
provide: ErrorHandler,
// Attach the Sentry ErrorHandler
useValue: SentrySibling.createErrorHandler(),
},
//{ provide: ErrorHandler, useClass: AppErrorHandler },
// {
// provide: ErrorHandler,
// // Attach the Sentry ErrorHandler
// useValue: SentrySibling.createErrorHandler(),
// },
StatusBar,
//SplashScreen,
HttpClient,
@@ -433,7 +412,7 @@ tracker.setUserID('john@doe.com');
FFmpeg,
{ provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptorService, multi: true },
tokenInterceptor,
metricsInterceptor
metricsInterceptor,
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]