diff --git a/src/components/overlays/ActivateServiceSubscription/index.tsx b/src/components/overlays/ActivateServiceSubscription/index.tsx index 1806fc8d1e..e3bbc6a684 100644 --- a/src/components/overlays/ActivateServiceSubscription/index.tsx +++ b/src/components/overlays/ActivateServiceSubscription/index.tsx @@ -40,6 +40,8 @@ import { useFetchServiceTechnicalUserProfilesQuery, } from 'features/serviceManagement/apiSlice' import { Link } from 'react-router-dom' +import { type LogData } from 'services/LogService' +import { error } from 'services/NotifyService' const ProfileHelpURL = '/documentation/?path=user%2F05.+Service%28s%29%2F03.+Service+Subscription%2F01.+Service+Subscription.md' @@ -75,7 +77,7 @@ export default function ActivateserviceSubscription({ [data] ) - const handleConfrim = async () => { + const handleConfirm = async () => { setLoading(true) try { const result = await subscribe({ @@ -85,9 +87,9 @@ export default function ActivateserviceSubscription({ setActivationResponse(true) setTechuserInfo(result) setLoading(false) - } catch (error) { + } catch (e) { setLoading(false) - console.log(error) + error('ERROR ON SERVICE SUBSCRIPTION', '', e as LogData) } } @@ -296,7 +298,7 @@ export default function ActivateserviceSubscription({ sx={{ marginLeft: '10px' }} /> ) : ( - )} diff --git a/src/components/overlays/AddMultipleUser/index.tsx b/src/components/overlays/AddMultipleUser/index.tsx index 48a3c29e70..a4409576a8 100644 --- a/src/components/overlays/AddMultipleUser/index.tsx +++ b/src/components/overlays/AddMultipleUser/index.tsx @@ -68,6 +68,7 @@ import Papa from 'papaparse' import { AddUserDeny } from '../AddUser/AddUserDeny' import { error } from 'services/NotifyService' import ArrowForwardIcon from '@mui/icons-material/ArrowForward' +import LogService from 'services/LogService' const HelpPageURL = '/documentation/?path=user%2F03.+User+Management%2F01.+User+Account%2F04.+Create+new+user+account+%28bulk%29.md' @@ -170,10 +171,10 @@ export default function AddMultipleUser() { } // Add an ESLint exception until there is a solution // eslint-disable-next-line - } catch (error: any) { + } catch (e: any) { setLoading(false) - setIsError(error.data.errors.document[0]) - console.log(error) + setIsError(e.data.errors.document[0]) + LogService.error(e as string) } } diff --git a/src/components/overlays/AddTechnicalUser/index.tsx b/src/components/overlays/AddTechnicalUser/index.tsx index adebf51513..cde7b9354b 100644 --- a/src/components/overlays/AddTechnicalUser/index.tsx +++ b/src/components/overlays/AddTechnicalUser/index.tsx @@ -44,6 +44,7 @@ import { ServerResponseOverlay } from '../ServerResponse' import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline' import HelpOutlineIcon from '@mui/icons-material/HelpOutline' import './style.scss' +import LogService from 'services/LogService' export const AddTechnicalUser = () => { const { t } = useTranslation() @@ -68,7 +69,7 @@ export const AddTechnicalUser = () => { setError(false) dispatch(updateData(UPDATES.TECHUSER_LIST)) } catch (err) { - console.log(err) + LogService.error(err as string) setLoading(false) setError(true) } diff --git a/src/components/overlays/DeleteTechnicalUser/index.tsx b/src/components/overlays/DeleteTechnicalUser/index.tsx index 8287d2c016..3d02994200 100644 --- a/src/components/overlays/DeleteTechnicalUser/index.tsx +++ b/src/components/overlays/DeleteTechnicalUser/index.tsx @@ -32,6 +32,7 @@ import { updateData, UPDATES } from 'features/control/updates' import { closeOverlay } from 'features/control/overlay' import DeleteUserContent from 'components/shared/basic/DeleteObjectContent' import { SuccessErrorType } from 'features/admin/appuserApiSlice' +import { error } from 'services/LogService' export const DeleteTechnicalUser = ({ id }: { id: string }) => { const { t } = useTranslation() @@ -82,24 +83,23 @@ export const DeleteTechnicalUser = ({ id }: { id: string }) => { }) } catch (err: unknown) { deleteUserError(err) + error(err as string) } } return data ? ( - <> - - + ) : null } diff --git a/src/components/overlays/EnableIDP/EnableIDPContent.tsx b/src/components/overlays/EnableIDP/EnableIDPContent.tsx index 4999892776..dffc0b6981 100644 --- a/src/components/overlays/EnableIDP/EnableIDPContent.tsx +++ b/src/components/overlays/EnableIDP/EnableIDPContent.tsx @@ -28,6 +28,7 @@ import type { IHashMap } from 'types/MainTypes' import { useTranslation } from 'react-i18next' import ValidatingInput from 'components/shared/basic/Input/ValidatingInput' import { getApiBase } from 'services/EnvironmentService' +import { error } from 'services/LogService' import UserService from 'services/UserService' const EnableIDPForm = ({ @@ -102,7 +103,7 @@ export const EnableIDPContent = ({ setUserId(data.userId) }) .catch((e) => { - console.log(e) + error(e as string) }) }, [identityProviderId, companyUserId]) diff --git a/src/components/overlays/EnableIDP/index.tsx b/src/components/overlays/EnableIDP/index.tsx index 690969e2b2..7186616cb5 100644 --- a/src/components/overlays/EnableIDP/index.tsx +++ b/src/components/overlays/EnableIDP/index.tsx @@ -43,6 +43,7 @@ import { EnableIDPContent } from './EnableIDPContent' import { useFetchOwnUserDetailsQuery } from 'features/admin/userApiSlice' import { OVERLAYS } from 'types/Constants' import { success } from 'services/NotifyService' +import { error, type LogData } from 'services/LogService' export const EnableIDP = ({ id }: { id: string }) => { const { t } = useTranslation('idp') @@ -98,10 +99,11 @@ export const EnableIDP = ({ id }: { id: string }) => { success(t('enable.success')) } catch (err) { setShowError(true) + error('Error occurred while updating IDP user:', err as LogData) } setLoading(false) } catch (err) { - console.log(err) + error('Error occurred while enabling IDP for the user', err as LogData) } } diff --git a/src/components/overlays/UpdateCompanyRole/index.tsx b/src/components/overlays/UpdateCompanyRole/index.tsx index 7809264d44..1f0e1f4be1 100644 --- a/src/components/overlays/UpdateCompanyRole/index.tsx +++ b/src/components/overlays/UpdateCompanyRole/index.tsx @@ -54,6 +54,8 @@ import { } from 'features/companyRoles/slice' import { useFetchFrameDocumentByIdMutation } from 'features/appManagement/apiSlice' import uniq from 'lodash.uniq' +import LogService, { type LogData } from 'services/LogService' +import { error } from 'services/NotifyService' export enum AgreementStatus { ACTIVE = 'ACTIVE', @@ -139,8 +141,8 @@ export default function UpdateCompanyRole({ roles }: { roles: string[] }) { const fileType = response.headers.get('content-type') const file = response.data download(file, fileType, documentName) - } catch (error) { - console.error(error, 'ERROR WHILE FETCHING DOCUMENT') + } catch (e) { + error('ERROR WHILE FETCHING DOCUMENT', '', e as LogData) } } @@ -208,8 +210,8 @@ export default function UpdateCompanyRole({ roles }: { roles: string[] }) { await updateCompanyRoles(filterRoles).unwrap() dispatch(setCompanyRoleSuccess(true)) close() - } catch (error) { - console.log(error) + } catch (e) { + LogService.error(e as string) dispatch(setCompanyRoleError(true)) close() } diff --git a/src/components/pages/Admin/RegistrationRequests/index.tsx b/src/components/pages/Admin/RegistrationRequests/index.tsx index 224bc7c8a6..d28bf78354 100644 --- a/src/components/pages/Admin/RegistrationRequests/index.tsx +++ b/src/components/pages/Admin/RegistrationRequests/index.tsx @@ -38,6 +38,7 @@ import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline' import AddBpnOveraly from './ConfirmationOverlay/AddBpnOverlay' import ConfirmCancelOverlay from './ConfirmationOverlay/ConfirmCancelOverlay' import { useGetCompanyDetailQuery } from 'features/admin/registration/apiSlice' +import { info } from 'services/LogService' enum TableField { DETAIL = 'detail', @@ -109,7 +110,7 @@ export default function RegistrationRequests() { await approveRequest(selectedRequestId) .unwrap() .then((payload) => { - console.log('fulfilled', payload) + info('fulfilled', payload) }) .catch((error) => { setShowErrorAlert(error.data.title) @@ -121,7 +122,7 @@ export default function RegistrationRequests() { }) .unwrap() .then((payload) => { - console.log('fulfilled', payload) + info('fulfilled', payload) }) .catch((error) => { setShowErrorAlert(error.data.title) diff --git a/src/components/pages/AdminBoardDetail/BoardDocuments/index.tsx b/src/components/pages/AdminBoardDetail/BoardDocuments/index.tsx index ef44c31f59..975b4239cd 100644 --- a/src/components/pages/AdminBoardDetail/BoardDocuments/index.tsx +++ b/src/components/pages/AdminBoardDetail/BoardDocuments/index.tsx @@ -30,6 +30,8 @@ import { import { useFetchDocumentByIdMutation } from 'features/apps/apiSlice' import { download } from 'utils/downloadUtils' import { DocumentTypeId } from 'features/appManagement/apiSlice' +import { type LogData } from 'services/LogService' +import { error } from 'services/NotifyService' export default function BoardDocuments({ type, @@ -56,8 +58,8 @@ export default function BoardDocuments({ const fileType = response.headers.get('content-type') const file = response.data download(file, fileType, documentName) - } catch (error) { - console.error(error, 'ERROR WHILE FETCHING DOCUMENT') + } catch (e) { + error('ERROR WHILE FETCHING DOCUMENT', '', e as LogData) } } diff --git a/src/components/pages/AppDetail/AppDetailDocuments/index.tsx b/src/components/pages/AppDetail/AppDetailDocuments/index.tsx index d90b561acc..54992cadbe 100644 --- a/src/components/pages/AppDetail/AppDetailDocuments/index.tsx +++ b/src/components/pages/AppDetail/AppDetailDocuments/index.tsx @@ -30,6 +30,8 @@ import { type DocumentData, DocumentTypeId, } from 'features/appManagement/apiSlice' +import { error } from 'services/NotifyService' +import { type LogData } from 'services/LogService' export default function AppDetailDocuments({ item, @@ -50,8 +52,8 @@ export default function AppDetailDocuments({ const fileType = response.headers.get('content-type') const file = response.data download(file, fileType, documentName) - } catch (error) { - console.error(error, 'ERROR WHILE FETCHING DOCUMENT') + } catch (e) { + error('ERROR WHILE FETCHING DOCUMENT', '', e as LogData) } } return ( diff --git a/src/components/pages/AppDetail/AppDetailHeader/index.tsx b/src/components/pages/AppDetail/AppDetailHeader/index.tsx index 803d4a6cf2..b65b19ba98 100644 --- a/src/components/pages/AppDetail/AppDetailHeader/index.tsx +++ b/src/components/pages/AppDetail/AppDetailHeader/index.tsx @@ -34,6 +34,7 @@ import { useEffect, useState } from 'react' import { SubscriptionStatus } from 'features/apps/types' import { useFetchDocumentByIdMutation } from 'features/apps/apiSlice' import CommonService from 'services/CommonService' +import { error } from 'services/LogService' import type { UseCaseType } from 'features/appManagement/types' import { userHasPortalRole } from 'services/AccessService' import type { RootState } from 'features/store' @@ -185,8 +186,8 @@ export default function AppDetailHeader({ }).unwrap() const file = response.data setImage(URL.createObjectURL(file)) - } catch (error) { - console.log(error) + } catch (e) { + error(e as string) } } diff --git a/src/components/pages/AppMarketplace/FavoriteSection/FavoriteItem.tsx b/src/components/pages/AppMarketplace/FavoriteSection/FavoriteItem.tsx index b7ec3b5d35..bcbcbce88e 100644 --- a/src/components/pages/AppMarketplace/FavoriteSection/FavoriteItem.tsx +++ b/src/components/pages/AppMarketplace/FavoriteSection/FavoriteItem.tsx @@ -71,8 +71,8 @@ export default function FavoriteItem({ documentId: id, }).unwrap() setCardImage(URL.createObjectURL(result.data)) - } catch (error) { - console.log(error) + } catch (e) { + error(e as string) } } diff --git a/src/components/pages/AppOverview/AddRolesOverlay.tsx b/src/components/pages/AppOverview/AddRolesOverlay.tsx index 269916f6c5..a917679585 100644 --- a/src/components/pages/AppOverview/AddRolesOverlay.tsx +++ b/src/components/pages/AppOverview/AddRolesOverlay.tsx @@ -41,6 +41,7 @@ import { useState } from 'react' import { useUpdateActiveAppMutation } from 'features/appManagement/apiSlice' import { useNavigate } from 'react-router-dom' import { error, success } from 'services/NotifyService' +import { info } from 'services/LogService' interface AddRolesOverlayProps { openDialog: boolean @@ -79,10 +80,10 @@ const AddRolesOverlay = ({ .forEach((file: File) => { const reader = new FileReader() reader.onerror = () => { - console.log('file reading has failed') + info('file reading has failed') } reader.onabort = () => { - console.log('file reading was aborted') + info('file reading was aborted') } reader.onload = () => { const str = reader.result diff --git a/src/components/pages/AppOverview/AppOverViewDetails.tsx b/src/components/pages/AppOverview/AppOverViewDetails.tsx index ca870257bf..017f1a4ed1 100644 --- a/src/components/pages/AppOverview/AppOverViewDetails.tsx +++ b/src/components/pages/AppOverview/AppOverViewDetails.tsx @@ -39,6 +39,8 @@ import { } from 'features/appManagement/types' import CommonValidateAndPublish from 'components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish' import { useFetchDocumentByIdMutation } from 'features/apps/apiSlice' +import { type LogData } from 'services/LogService' +import { error } from 'services/NotifyService' export default function AppOverViewDetails({ item, @@ -104,8 +106,8 @@ export default function AppOverViewDetails({ }).unwrap() const file = response.data setCardImage(URL.createObjectURL(file)) - } catch (error) { - console.error(error, 'ERROR WHILE FETCHING IMAGE') + } catch (e) { + error('ERROR WHILE FETCHING IMAGE', '', e as LogData) } }, [fetchDocumentById, id] diff --git a/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx b/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx index f326a4fdac..fa3a07707f 100644 --- a/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx +++ b/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx @@ -46,6 +46,8 @@ import type { store } from 'features/store' import { setSuccessType } from 'features/appSubscription/slice' import { Link } from 'react-router-dom' import { useFetchTechnicalUserProfilesQuery } from 'features/appManagement/apiSlice' +import { type LogData } from 'services/LogService' +import { error } from 'services/NotifyService' const TentantHelpURL = '/documentation/?path=user%2F04.+App%28s%29%2F05.+App+Subscription%2F04.+Subscription+Activation+%28App+Provider%29.md' @@ -99,8 +101,8 @@ const ActivateSubscriptionOverlay = ({ offerUrl: inputURL, }).unwrap() setActivationResponse(subscriptionData) - } catch (error) { - console.log(error) + } catch (e) { + error('ERROR WHILE ADDING USER SUBSCRIPTION', '', e as LogData) } setLoading(false) } diff --git a/src/components/pages/IDPManagement/IDPList.tsx b/src/components/pages/IDPManagement/IDPList.tsx index 0a0d19fa67..b114b882ed 100644 --- a/src/components/pages/IDPManagement/IDPList.tsx +++ b/src/components/pages/IDPManagement/IDPList.tsx @@ -34,6 +34,7 @@ import { import IDPStateProgress from './IDPStateProgress' import { show } from 'features/control/overlay' import { OVERLAYS } from 'types/Constants' +import LogService from 'services/LogService' import { error, success } from 'services/NotifyService' import { type IdentityProvider, @@ -65,8 +66,8 @@ const MenuItemOpenOverlay = ({ try { e.stopPropagation() dispatch(show(overlay, id)) - } catch (error) { - console.log(error) + } catch (e) { + LogService.error(e as string) } } diff --git a/src/components/pages/InviteBusinessPartner/InviteList/index.tsx b/src/components/pages/InviteBusinessPartner/InviteList/index.tsx index 70e3762580..960fc4132c 100644 --- a/src/components/pages/InviteBusinessPartner/InviteList/index.tsx +++ b/src/components/pages/InviteBusinessPartner/InviteList/index.tsx @@ -33,6 +33,7 @@ import dayjs from 'dayjs' import { setSearchInput } from 'features/appManagement/actions' import { updateInviteSelector } from 'features/control/updates' import { isCompanyName } from 'types/Patterns' +import { info } from 'services/LogService' interface FetchHookArgsType { expr: string @@ -127,7 +128,7 @@ export const InviteList = ({ disabled={true} color="secondary" onClick={() => { - console.log('on details click: Company Name', row.companyName) + info('on details click: Company Name', row.companyName) }} > diff --git a/src/components/pages/NotificationCenter/NotificationItem.tsx b/src/components/pages/NotificationCenter/NotificationItem.tsx index 0ea6570e15..f60b9b4f05 100644 --- a/src/components/pages/NotificationCenter/NotificationItem.tsx +++ b/src/components/pages/NotificationCenter/NotificationItem.tsx @@ -32,6 +32,7 @@ import { import { useState } from 'react' import { Trans, useTranslation } from 'react-i18next' import { NavLink } from 'react-router-dom' +import { info } from 'services/LogService' import UserService from 'services/UserService' import relativeTime from 'dayjs/plugin/relativeTime' import './style.scss' @@ -262,7 +263,7 @@ export default function NotificationItem({ item.isRead = flag setUserRead(flag) } catch (error: unknown) { - console.log(error) + info(error as string) } } diff --git a/src/components/pages/OSPConsent/CompanyDetails.tsx b/src/components/pages/OSPConsent/CompanyDetails.tsx index 4b0adf8782..f831524d18 100644 --- a/src/components/pages/OSPConsent/CompanyDetails.tsx +++ b/src/components/pages/OSPConsent/CompanyDetails.tsx @@ -41,6 +41,8 @@ import { getApiBase } from 'services/EnvironmentService' import UserService from 'services/UserService' import { download } from 'utils/downloadUtils' import './style.scss' +import { type LogData } from 'services/LogService' +import { error } from 'services/NotifyService' enum uniqueIdTypeText { COMMERCIAL_REG_NUMBER = 'Commercial Registration Number', @@ -146,27 +148,24 @@ export const CompanyDetails = ({ const handleDownloadClick = (documentId: string, documentName: string) => { if (!documentId) return - try { - fetch( - `${getApiBase()}/api/registration/registrationDocuments/${documentId}`, - { - method: 'GET', - headers: { - authorization: `Bearer ${UserService.getToken()}`, - }, - } - ) - .then(async (res) => { - const fileType = res.headers.get('content-type') ?? '' - const file = await res.blob() - download(file, fileType, documentName) - }) - .catch((error) => { - console.log(error) - }) - } catch (error) { - console.error(error, 'ERROR WHILE FETCHING DOCUMENT') - } + + fetch( + `${getApiBase()}/api/registration/registrationDocuments/${documentId}`, + { + method: 'GET', + headers: { + authorization: `Bearer ${UserService.getToken()}`, + }, + } + ) + .then(async (res) => { + const fileType = res.headers.get('content-type') ?? '' + const file = await res.blob() + download(file, fileType, documentName) + }) + .catch((e) => { + error('ERROR WHILE FETCHING DOCUMENT', '', e as LogData) + }) } const renderTermsText = (agreement: AgreementData) => { diff --git a/src/components/pages/SemanticHub/ModelDetailDialog.tsx b/src/components/pages/SemanticHub/ModelDetailDialog.tsx index 81b6eae8f1..110a7be38f 100644 --- a/src/components/pages/SemanticHub/ModelDetailDialog.tsx +++ b/src/components/pages/SemanticHub/ModelDetailDialog.tsx @@ -51,6 +51,7 @@ import { useDeleteModelByIdMutation, } from 'features/semanticModels/apiSlice' import { getSemanticApiBase } from 'services/EnvironmentService' +import { info } from 'services/LogService' import { getHeaders } from 'services/RequestService' interface ModelDetailDialogProps { @@ -111,7 +112,7 @@ const ModelDetailDialog = ({ show, onClose }: ModelDetailDialogProps) => { } }) .catch((err) => { - console.log(err) + info(err) }) setShowDeleteBtn( userHasSemanticHubRole(ROLES.SEMANTICHUB_DELETE) && @@ -214,7 +215,7 @@ const ModelDetailDialog = ({ show, onClose }: ModelDetailDialogProps) => { )} {diagramError.length > 0 && ( - t('content.semantichub.detail.fileError') + {t('content.semantichub.detail.fileError')} )} diff --git a/src/components/pages/ServiceAdminBoardDetail/index.tsx b/src/components/pages/ServiceAdminBoardDetail/index.tsx index a5e4002e8b..fe04bb6237 100644 --- a/src/components/pages/ServiceAdminBoardDetail/index.tsx +++ b/src/components/pages/ServiceAdminBoardDetail/index.tsx @@ -42,6 +42,8 @@ import { Grid, Box, Divider } from '@mui/material' import { download } from 'utils/downloadUtils' import { DocumentTypeText } from 'features/apps/types' import { DocumentTypeId } from 'features/appManagement/apiSlice' +import { type LogData } from 'services/LogService' +import { error } from 'services/NotifyService' enum TableData { SUCCESS = 'SUCCESS', @@ -87,8 +89,8 @@ export default function ServiceAdminBoardDetail() { const fileType = response.headers.get('content-type') const file = response.data download(file, fileType, item.documentName) - } catch (error) { - console.error(error, 'ERROR WHILE FETCHING DOCUMENT') + } catch (e) { + error('ERROR WHILE FETCHING DOCUMENT', '', e as LogData) } } diff --git a/src/components/pages/ServiceMarketplaceDetail/MarketplaceDocuments/index.tsx b/src/components/pages/ServiceMarketplaceDetail/MarketplaceDocuments/index.tsx index ec1d58ee82..9ceb6e496a 100644 --- a/src/components/pages/ServiceMarketplaceDetail/MarketplaceDocuments/index.tsx +++ b/src/components/pages/ServiceMarketplaceDetail/MarketplaceDocuments/index.tsx @@ -29,6 +29,8 @@ import type { } from 'features/serviceMarketplace/serviceApiSlice' import { useFetchDocumentMutation } from 'features/serviceManagement/apiSlice' import { DocumentTypeId } from 'features/appManagement/apiSlice' +import { type LogData } from 'services/LogService' +import { error } from 'services/NotifyService' export default function MarketplaceDocuments({ item, @@ -51,8 +53,8 @@ export default function MarketplaceDocuments({ const fileType = response.headers.get('content-type') const file = response.data download(file, fileType, documentName) - } catch (error) { - console.error(error, 'ERROR WHILE FETCHING DOCUMENT') + } catch (e) { + error('ERROR WHILE FETCHING DOCUMENT', '', e as LogData) } } diff --git a/src/components/pages/Test/index.dropzone.tsx b/src/components/pages/Test/index.dropzone.tsx index 20014d6d70..9dc21ae93f 100644 --- a/src/components/pages/Test/index.dropzone.tsx +++ b/src/components/pages/Test/index.dropzone.tsx @@ -23,6 +23,7 @@ import { Cards } from '@catena-x/portal-shared-components' import { appToCard } from 'features/apps/mapper' import { isString } from 'lodash' import { useState } from 'react' +import { info } from 'services/LogService' import ItemProcessor from './ItemProcessor' export default function Test() { @@ -45,10 +46,10 @@ export default function Test() { .forEach((file: File) => { const reader = new FileReader() reader.onabort = () => { - console.log('file reading was aborted') + info('file reading was aborted') } reader.onerror = () => { - console.log('file reading has failed') + info('file reading has failed') } reader.onload = () => { const str = reader.result @@ -66,10 +67,10 @@ export default function Test() { .forEach((file: File) => { const reader = new FileReader() reader.onabort = () => { - console.log('file reading was aborted') + info('file reading was aborted') } reader.onerror = () => { - console.log('file reading has failed') + info('file reading has failed') } reader.onload = () => { const str = reader.result @@ -89,7 +90,7 @@ export default function Test() { acceptFormat={{ 'application/json': [] }} maxFilesToUpload={20} /> - +
diff --git a/src/components/pages/Test/index.form.tsx b/src/components/pages/Test/index.form.tsx index 8a1f98f125..1f84e72e97 100644 --- a/src/components/pages/Test/index.form.tsx +++ b/src/components/pages/Test/index.form.tsx @@ -23,6 +23,7 @@ import BasicInput, { InputType } from 'components/shared/basic/Input/BasicInput' import { Button, Checkbox } from '@catena-x/portal-shared-components' import { useState } from 'react' import { isMail } from 'types/Patterns' +import { info } from 'services/LogService' const TestValueBar = ({ onValue }: { onValue: (value: string) => void }) => { return ( @@ -87,7 +88,7 @@ const BasicFormTest = () => { error ? 'password length must be at least 8 characters' : undefined } onValue={(value?: string) => { - console.log(value) + info(value!) }} />
 {
         }
         validate={(expr) => expr.length >= 8}
         onValid={(_name: string, value?: string) => {
-          console.log(value ?? '')
+          info(value ?? '')
         }}
         debounceTime={Number.parseInt(debounceTime)}
       />
diff --git a/src/components/pages/Test/index.image.tsx b/src/components/pages/Test/index.image.tsx
index c71419ffa2..06c66f9369 100644
--- a/src/components/pages/Test/index.image.tsx
+++ b/src/components/pages/Test/index.image.tsx
@@ -25,6 +25,7 @@ import {
 import { useEffect, useState } from 'react'
 import { getApiBase, getAssetBase } from 'services/EnvironmentService'
 import { fetchImageWithToken } from 'services/ImageService'
+import { info } from 'services/LogService'
 
 export default function ImageTest() {
   const style = { margin: '10px', width: '240px', height: '240px' }
@@ -37,7 +38,7 @@ export default function ImageTest() {
         setData(URL.createObjectURL(new Blob([buffer], { type: 'image/png' })))
       })
       .catch((err) => {
-        console.log(err)
+        info(err)
       })
   }, [])
 
diff --git a/src/components/shared/basic/ProgressVerificationButton/index.tsx b/src/components/shared/basic/ProgressVerificationButton/index.tsx
index 1d913bf17b..5de9420b59 100644
--- a/src/components/shared/basic/ProgressVerificationButton/index.tsx
+++ b/src/components/shared/basic/ProgressVerificationButton/index.tsx
@@ -41,6 +41,7 @@ import './style.scss'
 import { useReducer } from 'react'
 import { useDispatch } from 'react-redux'
 import { refreshApplicationRequest } from 'features/admin/registration/slice'
+import { info } from 'services/LogService'
 
 enum ActionKind {
   SET_RETRIGGER_LOADING = 'SET_RETRIGGER_LOADING',
@@ -170,7 +171,7 @@ export const ProgressVerificationButton = ({
     await approveChecklist(selectedRequestId)
       .unwrap()
       .then((payload) => {
-        console.log('fulfilled', payload)
+        info('fulfilled', payload)
       })
       .catch((error) => {
         setState({ type: ActionKind.SET_ERROR, payload: error.data.title })
@@ -192,7 +193,7 @@ export const ProgressVerificationButton = ({
     })
       .unwrap()
       .then((payload) => {
-        console.log('fulfilled', payload)
+        info('fulfilled', payload)
       })
       .catch((error) => {
         setState({ type: ActionKind.SET_ERROR, payload: error.data.title })
@@ -206,10 +207,7 @@ export const ProgressVerificationButton = ({
 
   const onRetrigger = () => {
     if (!selectedRequestId) return
-    console.log(
-      'props.retriggerableProcessSteps',
-      props.retriggerableProcessSteps
-    )
+    info('props.retriggerableProcessSteps', props.retriggerableProcessSteps)
     setState({ type: ActionKind.SET_RETRIGGER_LOADING, payload: true })
     props.retriggerableProcessSteps &&
       props.retriggerableProcessSteps.forEach(async (process: string) => {
diff --git a/src/components/shared/basic/ReleaseProcess/AppMarketCard/index.tsx b/src/components/shared/basic/ReleaseProcess/AppMarketCard/index.tsx
index a2820b5ffc..9f6dca9d9e 100644
--- a/src/components/shared/basic/ReleaseProcess/AppMarketCard/index.tsx
+++ b/src/components/shared/basic/ReleaseProcess/AppMarketCard/index.tsx
@@ -78,6 +78,8 @@ import { useFetchDocumentByIdMutation } from 'features/apps/apiSlice'
 import { download } from 'utils/downloadUtils'
 import { extractFileData } from 'utils/fileUtils'
 import { isStepCompleted } from '../AppStepHelper'
+import { error } from 'services/NotifyService'
+import { type LogData } from 'services/LogService'
 
 type FormDataType = {
   title: string
@@ -303,9 +305,9 @@ export default function AppMarketCard() {
       const file = response.data
       setFileStatus(documentId, documentName, UploadStatus.UPLOAD_SUCCESS)
       setCardImage(URL.createObjectURL(file))
-    } catch (error) {
+    } catch (e) {
       setFileStatus(documentId, documentName, UploadStatus.UPLOAD_SUCCESS)
-      console.error(error, 'ERROR WHILE FETCHING IMAGE')
+      error('ERROR WHILE FETCHING IMAGE', '', e as LogData)
     }
   }
 
diff --git a/src/components/shared/basic/ReleaseProcess/OfferCard/index.tsx b/src/components/shared/basic/ReleaseProcess/OfferCard/index.tsx
index 0f12a31526..787f68cda0 100644
--- a/src/components/shared/basic/ReleaseProcess/OfferCard/index.tsx
+++ b/src/components/shared/basic/ReleaseProcess/OfferCard/index.tsx
@@ -64,6 +64,7 @@ import {
 } from 'features/serviceManagement/actions'
 import { ButtonLabelTypes } from '..'
 import RetryOverlay from '../components/RetryOverlay'
+import { type LogData } from 'services/LogService'
 import { success, error } from 'services/NotifyService'
 import { DocumentTypeId } from 'features/appManagement/apiSlice'
 import { PAGES } from 'types/Constants'
@@ -178,8 +179,8 @@ export default function OfferCard() {
           id: documentId,
           status: UploadStatus.UPLOAD_SUCCESS,
         })
-      } catch (error) {
-        console.error(error, 'ERROR WHILE FETCHING IMAGE')
+      } catch (e) {
+        error('ERROR WHILE FETCHING IMAGE', '', e as LogData)
       }
     },
     [fetchDocumentById, serviceId, setValue]
diff --git a/src/components/shared/basic/ReleaseProcess/TechnicalIntegration/index.tsx b/src/components/shared/basic/ReleaseProcess/TechnicalIntegration/index.tsx
index 7f24181961..35443a8990 100644
--- a/src/components/shared/basic/ReleaseProcess/TechnicalIntegration/index.tsx
+++ b/src/components/shared/basic/ReleaseProcess/TechnicalIntegration/index.tsx
@@ -61,6 +61,7 @@ import {
   type TechnicalUserProfiles,
 } from 'features/appManagement/types'
 import { error, success } from 'services/NotifyService'
+import { info } from 'services/LogService'
 import { ButtonLabelTypes } from '..'
 import { TechUserTable } from './TechUserTable'
 import { AddTechUserForm } from './AddTechUserForm'
@@ -236,10 +237,10 @@ export default function TechnicalIntegration() {
       .forEach((file: File) => {
         const reader = new FileReader()
         reader.onabort = () => {
-          console.log('file reading was aborted')
+          info('file reading was aborted')
         }
         reader.onerror = () => {
-          console.log('file reading has failed')
+          info('file reading has failed')
         }
         reader.onload = () => {
           const str = reader.result
diff --git a/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx b/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx
index 5300966abb..77ce73813b 100644
--- a/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx
+++ b/src/components/shared/basic/ReleaseProcess/components/CommonContractAndConsent.tsx
@@ -68,6 +68,7 @@ import {
   setServiceRedirectStatus,
 } from 'features/serviceManagement/slice'
 import { ButtonLabelTypes } from '..'
+import { type LogData } from 'services/LogService'
 import { error, success } from 'services/NotifyService'
 
 type AgreementDataType = {
@@ -429,8 +430,8 @@ export default function CommonContractAndConsent({
         const file = response.data
 
         download(file, fileType, documentName)
-      } catch (error) {
-        console.error(error, 'ERROR WHILE FETCHING DOCUMENT')
+      } catch (e) {
+        error('ERROR WHILE FETCHING DOCUMENT', '', e as LogData)
       }
   }
 
@@ -446,8 +447,8 @@ export default function CommonContractAndConsent({
         const file = response.data
 
         download(file, fileType, documentName)
-      } catch (error) {
-        console.error(error, 'ERROR WHILE FETCHING DOCUMENT')
+      } catch (e) {
+        error('ERROR WHILE FETCHING DOCUMENT', '', e as LogData)
       }
   }
 
diff --git a/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx b/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx
index 445a2612c5..1af4b3be42 100644
--- a/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx
+++ b/src/components/shared/basic/ReleaseProcess/components/CommonValidateAndPublish.tsx
@@ -76,6 +76,7 @@ import { Apartment, Person, LocationOn, Web, Info } from '@mui/icons-material'
 import '../../../../pages/AppDetail/AppDetailPrivacy/style.scss'
 import 'components/styles/document.scss'
 import { TechUserTable } from '../TechnicalIntegration/TechUserTable'
+import LogService, { type LogData } from 'services/LogService'
 
 export interface DefaultValueType {
   images: Array
@@ -168,7 +169,7 @@ export default function CommonValidateAndPublish({
         const file = response.data
         setCardImage(URL.createObjectURL(file))
       } catch (error) {
-        console.error(error, 'ERROR WHILE FETCHING IMAGE')
+        LogService.error('ERROR WHILE FETCHING IMAGE', error as LogData)
       }
     },
     [fetchDocumentById, id]
@@ -214,7 +215,7 @@ export default function CommonValidateAndPublish({
 
       download(file, fileType, documentName)
     } catch (error) {
-      console.error(error, 'ERROR WHILE FETCHING DOCUMENT')
+      LogService.error('ERROR WHILE FETCHING DOCUMENT', error as LogData)
     }
   }
 
diff --git a/src/components/shared/basic/SearchResultItem/index.tsx b/src/components/shared/basic/SearchResultItem/index.tsx
index 8d89a8f6fa..447e3897b3 100644
--- a/src/components/shared/basic/SearchResultItem/index.tsx
+++ b/src/components/shared/basic/SearchResultItem/index.tsx
@@ -134,7 +134,6 @@ export const SearchResultItem = ({
         },
       }}
       onClick={() => {
-        console.log(item.category)
         switch (item.category) {
           case SearchCategory.PAGE:
             dispatch(setAppear({ SEARCH: false }))
diff --git a/src/components/shared/basic/UserDetailInfo/UserDetailCard.tsx b/src/components/shared/basic/UserDetailInfo/UserDetailCard.tsx
index 3ebc5c93f9..1f558c4cab 100644
--- a/src/components/shared/basic/UserDetailInfo/UserDetailCard.tsx
+++ b/src/components/shared/basic/UserDetailInfo/UserDetailCard.tsx
@@ -32,6 +32,7 @@ import EditIcon from '@mui/icons-material/ModeEditOutlineOutlined'
 import { OVERLAYS } from 'types/Constants'
 import { useParams } from 'react-router-dom'
 import ContentCopyIcon from '@mui/icons-material/ContentCopy'
+import { info } from 'services/LogService'
 
 export type UserDetail = {
   companyUserId: string
@@ -74,7 +75,7 @@ export const UserDetailCard = ({
   const copyText = (value: string | string[]) => {
     setCopied(true)
     navigator.clipboard.writeText(value as string).catch((err) => {
-      console.log(err)
+      info(err)
     })
   }
 
diff --git a/src/features/info/search/actions.ts b/src/features/info/search/actions.ts
index 6b1a932efd..c368c21c33 100644
--- a/src/features/info/search/actions.ts
+++ b/src/features/info/search/actions.ts
@@ -46,6 +46,7 @@ import {
   hasAccessAction,
   hasAccessOverlay,
 } from 'services/AccessService'
+import { error, type LogData } from 'services/LogService'
 import { initialPaginResult } from 'types/MainTypes'
 import type { AppMarketplaceApp } from 'features/apps/types'
 import { store } from 'features/store'
@@ -245,8 +246,8 @@ const fetchSearch = createAsyncThunk(
           )
           .map((item: TenantUser) => userToSearchItem(item)),
       ].flat()
-    } catch (error: unknown) {
-      console.error('api call error:', error)
+    } catch (e: unknown) {
+      error('api call error:', e as LogData)
       throw Error(`${name}/fetch error`)
     }
   }
diff --git a/src/services/CommonService.ts b/src/services/CommonService.ts
index ec009fd95f..8ef771decd 100644
--- a/src/services/CommonService.ts
+++ b/src/services/CommonService.ts
@@ -25,6 +25,7 @@ import type { ImageType } from '@catena-x/portal-shared-components'
 import { fetchImageWithToken } from './ImageService'
 import type { RoleDescData } from 'components/pages/RoleDetails'
 import type { RolesData } from 'features/companyRoles/companyRoleApiSlice'
+import { info } from './LogService'
 
 const getName = (app: AppMarketplaceApp) => app.name ?? ''
 const getDescription = (app: AppMarketplaceApp) =>
@@ -82,7 +83,7 @@ const getRoleDescription = (callback: (data: RoleDescData[]) => void) => {
       callback(data)
     })
     .catch((err) => {
-      console.log(err)
+      info('Fetching Role Description Failed', err)
     })
 }
 
@@ -95,8 +96,8 @@ const getCompanyRoleUpdateData = (callback: (data: RolesData) => void) => {
     .then((data) => {
       callback(data)
     })
-    .catch((error: unknown) => {
-      console.log('Fetching Company Roles Data Failed', error)
+    .catch((error) => {
+      info('Fetching Company Roles Data Failed', error)
     })
 }
 
diff --git a/src/services/I18nService.ts b/src/services/I18nService.ts
index 633ec83557..0941171cc1 100644
--- a/src/services/I18nService.ts
+++ b/src/services/I18nService.ts
@@ -36,6 +36,7 @@ import servicereleaseEN from '../assets/locales/en/servicerelease.json'
 import registrationDE from '../assets/locales/de/registration.json'
 import registrationEN from '../assets/locales/en/registration.json'
 import type { NotificationType } from 'features/notification/types'
+import { error } from './LogService'
 
 const resources = {
   de: {
@@ -75,7 +76,7 @@ const init = (): void => {
       },
     })
     .catch((e) => {
-      console.error('Translation library init got error:', e)
+      error('Translation library init got error:', e)
     })
 }