diff --git a/packages/pn-personagiuridica-webapp/src/App.tsx b/packages/pn-personagiuridica-webapp/src/App.tsx index ef8c362e6a..08cc7d469b 100644 --- a/packages/pn-personagiuridica-webapp/src/App.tsx +++ b/packages/pn-personagiuridica-webapp/src/App.tsx @@ -1,4 +1,4 @@ -import { ErrorInfo, useEffect, useMemo, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useLocation } from 'react-router-dom'; @@ -23,7 +23,6 @@ import { useHasPermissions, useMultiEvent, useTracking, - useUnload, } from '@pagopa-pn/pn-commons'; import { PartyEntity, ProductEntity } from '@pagopa/mui-italia'; @@ -37,8 +36,6 @@ import { getDomicileInfo, getSidemenuInformation } from './redux/sidemenu/action import { RootState } from './redux/store'; import { getConfiguration } from './services/configuration.service'; import { PGAppErrorFactory } from './utility/AppError/PGAppErrorFactory'; -import { TrackEventType } from './utility/events'; -import { trackEventByType } from './utility/mixpanel'; import './utility/onetrust'; // Cfr. PN-6096 @@ -77,7 +74,6 @@ const ActualApp = () => { const currentStatus = useAppSelector((state: RootState) => state.appStatus.currentStatus); const { pathname } = useLocation(); const path = pathname.split('/'); - const source = path[path.length - 1]; const sessionToken = loggedUser.sessionToken; const jwtUser = useMemo( @@ -114,10 +110,6 @@ const ActualApp = () => { [t, organization?.id, i18n.language] ); - useUnload(() => { - trackEventByType(TrackEventType.APP_UNLOAD); - }); - useTracking(MIXPANEL_TOKEN, process.env.NODE_ENV); useEffect(() => { @@ -227,24 +219,11 @@ const ActualApp = () => { }; const handleAssistanceClick = () => { - trackEventByType(TrackEventType.CUSTOMER_CARE_MAILTO, { - source: sessionToken ? 'postlogin' : 'prelogin', - }); /* eslint-disable-next-line functional/immutable-data */ window.location.href = sessionToken ? `${SELFCARE_BASE_URL}/assistenza` : `mailto:${PAGOPA_HELP_EMAIL}`; }; - const handleEventTrackingCallbackAppCrash = (e: Error, eInfo: ErrorInfo) => { - trackEventByType(TrackEventType.APP_CRASH, { - route: source, - stacktrace: { error: e, errorInfo: eInfo }, - }); - }; - - const handleEventTrackingCallbackProductSwitch = (target: string) => { - trackEventByType(TrackEventType.USER_PRODUCT_SWITCH, { target }); - }; const [clickVersion] = useMultiEvent({ callback: () => @@ -267,19 +246,7 @@ const ActualApp = () => { showHeader={!isPrivacyPage} showFooter={!isPrivacyPage} onExitAction={handleUserLogout} - eventTrackingCallbackAppCrash={handleEventTrackingCallbackAppCrash} - eventTrackingCallbackProductSwitch={(target) => - handleEventTrackingCallbackProductSwitch(target) - } - sideMenu={ - - trackEventByType(TrackEventType.USER_NAV_ITEM, { target }) - } - /> - } + sideMenu={} showSideMenu={ !!sessionToken && tosConsent && diff --git a/packages/pn-personagiuridica-webapp/src/components/Contacts/DigitalContactElem.tsx b/packages/pn-personagiuridica-webapp/src/components/Contacts/DigitalContactElem.tsx index 05d294a252..bd064dbdec 100644 --- a/packages/pn-personagiuridica-webapp/src/components/Contacts/DigitalContactElem.tsx +++ b/packages/pn-personagiuridica-webapp/src/components/Contacts/DigitalContactElem.tsx @@ -18,9 +18,6 @@ import { CourtesyChannelType, LegalChannelType } from '../../models/contacts'; import { deleteCourtesyAddress, deleteLegalAddress } from '../../redux/contact/actions'; import { DeleteDigitalAddressParams } from '../../redux/contact/types'; import { useAppDispatch } from '../../redux/hooks'; -import { getContactEventType } from '../../utility/contacts.utility'; -import { EventActions, TrackEventType } from '../../utility/events'; -import { trackEventByType } from '../../utility/mixpanel'; import { useDigitalContactsCodeVerificationContext } from './DigitalContactsCodeVerification.context'; type Props = { @@ -165,11 +162,8 @@ const DigitalContactElem = forwardRef<{ editContact: () => void }, Props>( /* eslint-disable-next-line functional/no-let */ let actionToDispatch: AsyncThunk; if (contactType === LegalChannelType.PEC) { - trackEventByType(TrackEventType.CONTACT_LEGAL_CONTACT, { action: EventActions.DELETE }); actionToDispatch = deleteLegalAddress; } else { - const eventTypeByChannel = getContactEventType(contactType); - trackEventByType(eventTypeByChannel, { action: EventActions.DELETE }); actionToDispatch = deleteCourtesyAddress; } void dispatch(actionToDispatch({ recipientId, senderId, channelType: contactType })) diff --git a/packages/pn-personagiuridica-webapp/src/components/Contacts/DigitalContactsCodeVerification.context.tsx b/packages/pn-personagiuridica-webapp/src/components/Contacts/DigitalContactsCodeVerification.context.tsx index ab8782dbd1..61b04c627d 100644 --- a/packages/pn-personagiuridica-webapp/src/components/Contacts/DigitalContactsCodeVerification.context.tsx +++ b/packages/pn-personagiuridica-webapp/src/components/Contacts/DigitalContactsCodeVerification.context.tsx @@ -24,9 +24,6 @@ import { import { SaveDigitalAddressParams } from '../../redux/contact/types'; import { useAppDispatch, useAppSelector } from '../../redux/hooks'; import { RootState } from '../../redux/store'; -import { getContactEventType } from '../../utility/contacts.utility'; -import { EventActions, TrackEventType } from '../../utility/events'; -import { trackEventByType } from '../../utility/mixpanel'; type ModalProps = { labelRoot: string; @@ -111,14 +108,10 @@ const DigitalContactsCodeVerificationProvider: FC<{ children?: ReactNode }> = ({ const handleCodeVerification = (verificationCode?: string, noCallback: boolean = false) => { /* eslint-disable functional/no-let */ let actionToBeDispatched; - let eventTypeByChannel; - /* eslint-enable functional/no-let */ if (modalProps.digitalDomicileType === LegalChannelType.PEC) { actionToBeDispatched = createOrUpdateLegalAddress; - eventTypeByChannel = TrackEventType.CONTACT_LEGAL_CONTACT; } else { actionToBeDispatched = createOrUpdateCourtesyAddress; - eventTypeByChannel = getContactEventType(modalProps.digitalDomicileType); } if (!actionToBeDispatched) { return; @@ -132,7 +125,6 @@ const DigitalContactsCodeVerificationProvider: FC<{ children?: ReactNode }> = ({ code: verificationCode, }; - trackEventByType(eventTypeByChannel, { action: EventActions.ADD }); void dispatch(actionToBeDispatched(digitalAddressParams)) .unwrap() .then((res) => { diff --git a/packages/pn-personagiuridica-webapp/src/components/Contacts/SpecialContactElem.tsx b/packages/pn-personagiuridica-webapp/src/components/Contacts/SpecialContactElem.tsx index 0d6725efca..27b825e90f 100644 --- a/packages/pn-personagiuridica-webapp/src/components/Contacts/SpecialContactElem.tsx +++ b/packages/pn-personagiuridica-webapp/src/components/Contacts/SpecialContactElem.tsx @@ -7,8 +7,6 @@ import { TableCell, TableRow, TextField, Typography } from '@mui/material'; import { dataRegex, useIsMobile, useSpecialContactsContext } from '@pagopa-pn/pn-commons'; import { CourtesyChannelType, LegalChannelType } from '../../models/contacts'; -import { EventActions, TrackEventType } from '../../utility/events'; -import { trackEventByType } from '../../utility/mixpanel'; import DigitalContactElem from './DigitalContactElem'; type Props = { @@ -105,7 +103,6 @@ const SpecialContactElem = memo(({ address, recipientId }: Props) => { if (status === 'cancelled') { await formik.setFieldValue(id, initialValues[id], true); } - trackEventByType(TrackEventType.CONTACT_SPECIAL_CONTACTS, { action: EventActions.ADD }); }; const formik = useFormik({ diff --git a/packages/pn-personagiuridica-webapp/src/components/Contacts/__test__/DigitalContactElem.test.tsx b/packages/pn-personagiuridica-webapp/src/components/Contacts/__test__/DigitalContactElem.test.tsx index b9e54b44de..1f6b1b5df7 100644 --- a/packages/pn-personagiuridica-webapp/src/components/Contacts/__test__/DigitalContactElem.test.tsx +++ b/packages/pn-personagiuridica-webapp/src/components/Contacts/__test__/DigitalContactElem.test.tsx @@ -12,8 +12,6 @@ import { } from '../../../__test__/test-utils'; import * as api from '../../../api/contacts/Contacts.api'; import { DigitalAddress, LegalChannelType } from '../../../models/contacts'; -import { TrackEventType } from '../../../utility/events'; -import * as trackingFunctions from '../../../utility/mixpanel'; import DigitalContactElem from '../DigitalContactElem'; import { DigitalContactsCodeVerificationProvider } from '../DigitalContactsCodeVerification.context'; @@ -55,9 +53,6 @@ const fields = [ const mockResetModifyValue = vi.fn(); const mockDeleteCbk = vi.fn(); const mockOnConfirm = vi.fn(); -// mock tracking -const createTrackEventSpy = vi.spyOn(trackingFunctions, 'trackEventByType'); -const mockTrackEventFn = vi.fn(); /* In questo test viene testato solo il rendering dei componenti e non il flusso. @@ -69,10 +64,6 @@ Andrea Cimini - 11/09/2023 describe('DigitalContactElem Component', () => { let result: RenderResult | undefined; - beforeEach(() => { - createTrackEventSpy.mockImplementation(mockTrackEventFn); - }); - afterEach(() => { result = undefined; vi.clearAllMocks(); @@ -203,10 +194,6 @@ describe('DigitalContactElem Component', () => { dialog = await waitFor(() => screen.getByRole('dialog')); dialogButtons = dialog?.querySelectorAll('button'); fireEvent.click(dialogButtons![1]); - expect(mockTrackEventFn).toBeCalledTimes(1); - expect(mockTrackEventFn).toBeCalledWith(TrackEventType.CONTACT_LEGAL_CONTACT, { - action: 'delete', - }); await waitFor(() => { expect(dialog).not.toBeInTheDocument(); }); diff --git a/packages/pn-personagiuridica-webapp/src/components/Deleghe/DelegatesByCompany.tsx b/packages/pn-personagiuridica-webapp/src/components/Deleghe/DelegatesByCompany.tsx index 691bdf189a..50bdaa26a7 100644 --- a/packages/pn-personagiuridica-webapp/src/components/Deleghe/DelegatesByCompany.tsx +++ b/packages/pn-personagiuridica-webapp/src/components/Deleghe/DelegatesByCompany.tsx @@ -26,8 +26,6 @@ import { DELEGATION_ACTIONS, getDelegatesByCompany } from '../../redux/delegatio import { useAppDispatch, useAppSelector } from '../../redux/hooks'; import { RootState } from '../../redux/store'; import delegationToItem from '../../utility/delegation.utility'; -import { TrackEventType } from '../../utility/events'; -import { trackEventByType } from '../../utility/mixpanel'; import DelegationDataSwitch from './DelegationDataSwitch'; type Props = { @@ -69,9 +67,8 @@ const DelegatesByCompany = () => { const data = delegationToItem(delegatesByCompany) as Array>; const rows = sortArray(sort.order, sort.orderBy, data); - const handleAddDelegationClick = (source: string) => { + const handleAddDelegationClick = () => { navigate(routes.NUOVA_DELEGA); - trackEventByType(TrackEventType.DELEGATION_DELEGATE_ADD_CTA, { source }); }; const delegatesColumn: Array> = [ @@ -160,7 +157,7 @@ const DelegatesByCompany = () => {