diff --git a/.env b/.env
index 9ef0c84..ef5dcea 100644
--- a/.env
+++ b/.env
@@ -4,4 +4,5 @@ REACT_APP_API_ADDRESS=https://api-dev-gepafin.memento.credit
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
-REACT_APP_EVALUATION_FLOW_ID=1
\ No newline at end of file
+REACT_APP_EVALUATION_FLOW_ID=1
+REACT_APP_LOCAL_DEVELOPMENT=1
\ No newline at end of file
diff --git a/package.json b/package.json
index e15d21d..e58a0a4 100644
--- a/package.json
+++ b/package.json
@@ -8,8 +8,8 @@
"@date-fns/tz": "1.1.2",
"@emailjs/browser": "^4.4.1",
"@emotion/styled": "11.13.0",
- "@number-flow/react": "0.2.0",
- "@sentry/browser": "^8.41.0",
+ "@number-flow/react": "0.4.2",
+ "@sentry/browser": "^8.42.0",
"@tanstack/react-table": "^8.20.5",
"@wordpress/i18n": "5.8.0",
"@wordpress/react-i18n": "4.8.0",
diff --git a/src/components/ErrorBoundary/index.js b/src/components/ErrorBoundary/index.js
new file mode 100644
index 0000000..4ac790c
--- /dev/null
+++ b/src/components/ErrorBoundary/index.js
@@ -0,0 +1,41 @@
+import React, { Component } from 'react';
+import * as Sentry from '@sentry/browser';
+
+const LOCAL_DEVELOPMENT = process.env.REACT_APP_LOCAL_DEVELOPMENT;
+
+class ErrorBoundary extends Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ builderError: false
+ };
+ }
+
+ static getDerivedStateFromError(error) {
+ try {
+ if (LOCAL_DEVELOPMENT !== '1') {
+ Sentry.init({
+ dsn: "https://e7b2134f7d816f663bb83e51b106a694@o4508381921738752.ingest.de.sentry.io/4508381935501392",
+ environment: process.env.NODE_ENV || "development"
+ });
+
+ Sentry.captureException(error);
+ }
+ } catch (err) {
+ console.log('err')
+ console.log(err);
+ }
+ return { builderError: true };
+ }
+
+ render() {
+ if (this.state.builderError) {
+ return
@@ -174,6 +183,23 @@ const AddCompany = () => {
/>
+ {APP_EVALUATION_FLOW_ID === '2'
+ ?
+
+
: null}
+
{
config={{ required: __('È obbligatorio', 'gepafin') }}
/>
-
+ {APP_EVALUATION_FLOW_ID === '1'
+ ?
+ : }
diff --git a/src/pages/Applications/index.js b/src/pages/Applications/index.js
index 08b1012..ad3393f 100644
--- a/src/pages/Applications/index.js
+++ b/src/pages/Applications/index.js
@@ -5,6 +5,7 @@ import { useNavigate } from 'react-router-dom';
// components
import MyLatestSubmissionsTable from '../DashboardBeneficiario/components/MyLatestSubmissionsTable';
import { Button } from 'primereact/button';
+import ErrorBoundary from '../../components/ErrorBoundary';
const Applications = () => {
const navigate = useNavigate();
@@ -22,7 +23,7 @@ const Applications = () => {
-
+
diff --git a/src/pages/BandiBeneficiario/index.js b/src/pages/BandiBeneficiario/index.js
index be925d3..5a191be 100644
--- a/src/pages/BandiBeneficiario/index.js
+++ b/src/pages/BandiBeneficiario/index.js
@@ -8,6 +8,7 @@ import { useStore } from '../../store';
// components
import AllBandiAccordion from './components/AllBandiAccordion';
+import ErrorBoundary from '../../components/ErrorBoundary';
const BandiBeneficiario = () => {
const chosenCompanyId = useStore().main.chosenCompanyId();
@@ -34,7 +35,7 @@ const BandiBeneficiario = () => {
> : null}
)
diff --git a/src/pages/DashboardBeneficiario/index.js b/src/pages/DashboardBeneficiario/index.js
index 66ac510..cc12f6e 100644
--- a/src/pages/DashboardBeneficiario/index.js
+++ b/src/pages/DashboardBeneficiario/index.js
@@ -14,6 +14,7 @@ import DashboardService from '../../service/dashboard-service';
import LatestBandiTable from './components/LatestBandiTable';
import MyLatestSubmissionsTable from './components/MyLatestSubmissionsTable';
import { Button } from 'primereact/button';
+import ErrorBoundary from '../../components/ErrorBoundary';
const DashboardBeneficiario = () => {
const navigate = useNavigate();
@@ -85,7 +86,7 @@ const DashboardBeneficiario = () => {
{__('Domande in lavorazione', 'gepafin')}
-
+
@@ -105,7 +106,7 @@ const DashboardBeneficiario = () => {
{__('Bandi disponibili', 'gepafin')}
-
+
diff --git a/src/service/network-service.js b/src/service/network-service.js
index c2c9b22..fa0ef72 100644
--- a/src/service/network-service.js
+++ b/src/service/network-service.js
@@ -1,6 +1,7 @@
import { storeGet } from '../store';
import * as Sentry from "@sentry/browser";
+const LOCAL_DEVELOPMENT = process.env.REACT_APP_LOCAL_DEVELOPMENT;
export class NetworkService {
static TOKEN_KEY
@@ -9,19 +10,21 @@ export class NetworkService {
static logApiError = (endpoint, status = 0, resp) => {
try {
if ([500].includes(status)) {
- Sentry.init({
- dsn: "https://e7b2134f7d816f663bb83e51b106a694@o4508381921738752.ingest.de.sentry.io/4508381935501392",
- environment: process.env.NODE_ENV || "development"
- });
+ if (LOCAL_DEVELOPMENT !== '1') {
+ Sentry.init({
+ dsn: "https://e7b2134f7d816f663bb83e51b106a694@o4508381921738752.ingest.de.sentry.io/4508381935501392",
+ environment: process.env.NODE_ENV || "development"
+ });
- const error = new Error(`Status ${status}`);
- Sentry.captureException(`Error in endpoint: ${endpoint}`, {
- level: 'error',
- extra: {
- originalError: error,
- details: resp
- }
- });
+ const error = new Error(`Status ${status}`);
+ Sentry.captureException(`Error in endpoint: ${endpoint}`, {
+ level: 'error',
+ extra: {
+ originalError: error,
+ details: resp
+ }
+ });
+ }
}
} catch (err) {
console.log(err);