From 67753cf3100e97b3c64f241e0c9f0a0d0a711c8b Mon Sep 17 00:00:00 2001 From: yashmantri Date: Thu, 26 Sep 2024 16:28:36 +0530 Subject: [PATCH 1/2] TP-86072 | Removed Clarity --- App.tsx | 4 +--- package.json | 1 - src/common/ErrorBoundary.tsx | 2 -- src/common/TrackingComponent.tsx | 34 ++----------------------------- src/components/utlis/apiHelper.ts | 2 -- src/constants/Global.ts | 7 ------- src/screens/auth/AuthRouter.tsx | 33 ++---------------------------- yarn.lock | 5 ----- 8 files changed, 5 insertions(+), 83 deletions(-) diff --git a/App.tsx b/App.tsx index 4881a1fe..40db284c 100644 --- a/App.tsx +++ b/App.tsx @@ -40,7 +40,7 @@ import { getPermissionsToRequest } from './src/components/utlis/PermissionUtils' import ScreenshotBlocker from './src/components/utlis/ScreenshotBlocker'; import { initSentry } from './src/components/utlis/sentry'; import { setItem } from './src/components/utlis/storageHelper'; -import { APM_APP_NAME, APM_BASE_URL, ENV } from './src/constants/config'; +import { ENV } from './src/constants/config'; import usePolling from './src/hooks/usePolling'; import AuthRouter from './src/screens/auth/AuthRouter'; import { type TDocumentObj } from './src/screens/caseDetails/interface'; @@ -49,7 +49,6 @@ import { addClickstreamEvent } from './src/services/clickstreamEventService'; import { setJsErrorHandler } from './src/services/exception-handler.service'; import fetchUpdatedRemoteConfig from './src/services/firebaseFetchAndUpdate.service'; import { StorageKeys } from './src/types/storageKeys'; -import { setCurrentScreenName } from 'react-native-clarity'; import CodePushLoadingModal, { CodePushLoadingModalRef } from './CodePushModal'; initSentry(); @@ -199,7 +198,6 @@ function App() { ref={navigationRef} onStateChange={async (state) => { const currentRouteName = getActiveRouteName(state); - setCurrentScreenName(currentRouteName); await analytics().logScreenView({ screen_name: currentRouteName, screen_class: currentRouteName, diff --git a/package.json b/package.json index 85aed337..d4056e70 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "react-native": "0.70.6", "react-native-blob-util": "0.17.3", "react-native-call-log": "2.1.2", - "react-native-clarity": "3.0.0", "react-native-code-push": "7.1.0", "react-native-contacts": "7.0.5", "react-native-device-info": "10.3.0", diff --git a/src/common/ErrorBoundary.tsx b/src/common/ErrorBoundary.tsx index 94b83697..c2c6b28d 100644 --- a/src/common/ErrorBoundary.tsx +++ b/src/common/ErrorBoundary.tsx @@ -11,7 +11,6 @@ import { getAppVersion } from '../components/utlis/commonFunctions'; import { COLORS } from '../../RN-UI-LIB/src/styles/colors'; import { handleCrash } from '../components/utlis/DeviceUtils'; import crashlytics from '@react-native-firebase/crashlytics'; -import { setCustomTag } from 'react-native-clarity'; import { getCurrentScreen } from '@components/utlis/navigationUtlis'; interface IErrorBoundary { @@ -39,7 +38,6 @@ class ErrorBoundary extends Component { }); logError(error); crashlytics().recordError(error); - setCustomTag('jsError', error?.message?.slice(0, 255)); handleCrash({ message: error?.message?.slice(0, 255), screenName: getCurrentScreen()?.name }); } diff --git a/src/common/TrackingComponent.tsx b/src/common/TrackingComponent.tsx index ad9bde92..dd01ba5e 100644 --- a/src/common/TrackingComponent.tsx +++ b/src/common/TrackingComponent.tsx @@ -11,20 +11,12 @@ import CosmosForegroundService, { } from '../services/foregroundServices/foreground.service'; import useIsOnline from '../hooks/useIsOnline'; import { getSyncTime, sendCurrentGeolocationAndBuffer } from '../hooks/capturingApi'; -import { - isTimeDifferenceWithinRange, - setAsyncStorageItem, -} from '../components/utlis/commonFunctions'; +import { isTimeDifferenceWithinRange } from '../components/utlis/commonFunctions'; import { setIsTimeSynced } from '../reducer/foregroundServiceSlice'; import { logError } from '../components/utlis/errorUtils'; import { useAppDispatch, useAppSelector } from '../hooks'; import { dataSyncService } from '../services/dataSync.service'; -import { - DATA_SYNC_TIME_INTERVAL, - ENV, - IS_DATA_SYNC_REQUIRED, - MS_CLARITY_PROJECT_ID, -} from '../constants/config'; +import { DATA_SYNC_TIME_INTERVAL, IS_DATA_SYNC_REQUIRED } from '../constants/config'; import useIsLocationEnabled from '../hooks/useIsLocationEnabled'; import { type ISyncCaseIdPayload, @@ -59,16 +51,10 @@ import { addClickstreamEvent } from '../services/clickstreamEventService'; import { CLICKSTREAM_EVENT_NAMES, LocalStorageKeys } from './Constants'; import useResyncFirebase from '@hooks/useResyncFirebase'; import { imageSyncService, sendImagesToServer } from '@services/imageSyncService'; -import getLitmusExperimentResult, { - LitmusExperimentName, - LitmusExperimentNameMap, -} from '@services/litmusExperiments.service'; -import { GLOBAL } from '@constants/Global'; import { sendAudiosToServer } from '@services/audioSyncService'; import { sendVideosToServer } from '@services/videoSyncService'; import { getSyncUrl } from '@services/syncJsonDataToBe'; import { handleCheckAndUpdatePullToRefreshStateForNearbyCases } from '@screens/allCases/utils'; -import { initialize } from 'react-native-clarity'; import { getWifiDetailsSyncUrl } from '@components/utlis/WifiDetails'; import useFirestoreUpdates from '@hooks/useFirestoreUpdates'; @@ -389,22 +375,6 @@ const TrackingComponent: React.FC = ({ children }) => { dispatch(getConfigData()); CosmosForegroundService.start(tasks); resyncFirebase(); - const msClarityResponse = await getLitmusExperimentResult( - LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY], - { deviceId: GLOBAL.DEVICE_ID } - ); - if ( - MS_CLARITY_PROJECT_ID && - !GLOBAL.MS_CLARITY_INITIALIZED && - msClarityResponse && - ENV === 'prod' - ) { - addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.MS_CLARITY_INITIALIZED, { - deviceId: GLOBAL.DEVICE_ID, - }); - initialize(MS_CLARITY_PROJECT_ID); - GLOBAL.MS_CLARITY_INITIALIZED = true; - } } if (nextAppState === AppStates.BACKGROUND) { await setItem(StorageKeys.APP_BACKGROUND_TIMESTAMP, now); diff --git a/src/components/utlis/apiHelper.ts b/src/components/utlis/apiHelper.ts index a8f1d522..b2d3d5ad 100644 --- a/src/components/utlis/apiHelper.ts +++ b/src/components/utlis/apiHelper.ts @@ -15,7 +15,6 @@ import { } from '../../common/Constants'; import { ToastMessages } from '../../screens/allCases/constants'; import { alfredHandleSWWEvent } from './DeviceUtils'; -import { setCustomTag } from 'react-native-clarity'; export enum ApiKeys { GENERATE_OTP = 'GENERATE_OTP', @@ -310,7 +309,6 @@ axiosInstance.interceptors.response.use( }); } const { config, response } = error; - setCustomTag('apiError', `API Error occured - ${response?.status}`); if (response?.status === 400) { alfredHandleSWWEvent(new Error('API Error occured')); } diff --git a/src/constants/Global.ts b/src/constants/Global.ts index 8f0d8e0b..e0ef9cb5 100644 --- a/src/constants/Global.ts +++ b/src/constants/Global.ts @@ -1,7 +1,6 @@ import { buildFlavour } from '@reducers/metadataSlice'; import { isNullOrUndefined } from '../components/utlis/commonFunctions'; import { setItem } from '@components/utlis/storageHelper'; -import { setCustomUserId } from 'react-native-clarity'; export enum DEVICE_TYPE_ENUM { MOBILE = 'MOBILE', @@ -55,12 +54,6 @@ export const setGlobalBuildFlavour = (buildFlavour: buildFlavour) => { if (buildFlavour) GLOBAL.BUILD_FLAVOUR = buildFlavour; }; -export const setMsClarityConfig = (clarityConfig: IClarityConfiguration) => { - if (clarityConfig?.customUserId) { - setCustomUserId(clarityConfig.customUserId); - } -}; - export const DOCUMENT_NOT_AVAILABLE = 'Document not available'; export const DOCUMENT_DOWNLOAD_STARTED = 'Downloading has started'; export const CUSTOMER_PROFILE_IMAGE = 'Customer Profile Image'; diff --git a/src/screens/auth/AuthRouter.tsx b/src/screens/auth/AuthRouter.tsx index 1dbbd48a..8e8dd9af 100644 --- a/src/screens/auth/AuthRouter.tsx +++ b/src/screens/auth/AuthRouter.tsx @@ -4,12 +4,7 @@ import { getUniqueId, isTablet } from 'react-native-device-info'; import { useAppDispatch, useAppSelector } from '../../hooks'; import { type RootState } from '../../store/store'; import { setAgentAttendance, setDeviceId } from '../../reducer/userSlice'; -import { - DEVICE_TYPE_ENUM, - GLOBAL, - setGlobalUserData, - setMsClarityConfig, -} from '../../constants/Global'; +import { DEVICE_TYPE_ENUM, setGlobalUserData } from '../../constants/Global'; import { registerNavigateAndDispatch } from '../../components/utlis/apiHelper'; import ProtectedRouter from './ProtectedRouter'; import useNativeButtons from '../../hooks/useNativeButton'; @@ -25,19 +20,11 @@ import { alfredSetPhoneNumber, alfredSetUserId, } from '../../components/utlis/DeviceUtils'; -import { getAppVersion, setAsyncStorageItem } from '../../components/utlis/commonFunctions'; +import { getAppVersion } from '../../components/utlis/commonFunctions'; import useScreenshotTracking from '../../hooks/useScreenshotTracking'; import { getSyncTime } from '@hooks/capturingApi'; -import getLitmusExperimentResult, { - LitmusExperimentName, - LitmusExperimentNameMap, -} from '@services/litmusExperiments.service'; -import { CLICKSTREAM_EVENT_NAMES, LocalStorageKeys } from '@common/Constants'; import ModalWrapperForAlfredV2 from '@common/ModalWrapperForAlfredV2'; import IdCardApproved from '@screens/AgentIdCard/IdCardStatus/IdCardApproved'; -import { ENV, MS_CLARITY_PROJECT_ID } from '@constants/config'; -import { initialize } from 'react-native-clarity'; -import { addClickstreamEvent } from '@services/clickstreamEventService'; import CallingFeedbackNudgeBottomSheet from '@screens/caseDetails/CallingFlow/BottomSheets/CallingFeedbackNudgeBottomSheet'; function AuthRouter() { @@ -122,8 +109,6 @@ function AuthRouter() { selectedAgentId: user?.selectedAgent?.referenceId, }); - setMsClarityConfig({ customUserId: user?.user?.referenceId }); - // Sets the dispatch for apiHelper registerNavigateAndDispatch(dispatch); @@ -138,20 +123,6 @@ function AuthRouter() { } }, [isLoggedIn]); - useEffect(() => { - if (deviceId) { - getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY], { - deviceId: deviceId, - }).then((response) => { - if (MS_CLARITY_PROJECT_ID && !GLOBAL.MS_CLARITY_INITIALIZED && response && ENV === 'prod') { - addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.MS_CLARITY_INITIALIZED, { deviceId }); - initialize(MS_CLARITY_PROJECT_ID); - GLOBAL.MS_CLARITY_INITIALIZED = true; - } - }); - } - }, [deviceId]); - // Firebase cloud messaging listener useFCM(); useScreenshotTracking(); diff --git a/yarn.lock b/yarn.lock index bf74192d..0779e2da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7889,11 +7889,6 @@ react-native-call-log@2.1.2: resolved "https://registry.yarnpkg.com/react-native-call-log/-/react-native-call-log-2.1.2.tgz#f80d2fcb45f72118eb8048d5bfdef191fd4a3df3" integrity sha512-nWHmb+QMN/AbbZFEuUGiQePssPgjQr5dibNAURDlqO4S5wuLk1XzxxsLUAVHZnB0FdJoMlajD7tUAXtaoxYwUQ== -react-native-clarity@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/react-native-clarity/-/react-native-clarity-3.0.0.tgz#b9fe0822797aa7c43f8d559d8af6aab3c85c373b" - integrity sha512-z10ebLBKCMjfb2dy+e2/HpXazXDMQxNvhHke174Xc3MVQRBm3obhY7K2PxUZZcUHZays5q/kQRy4imEFAWLYIw== - react-native-code-push@7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/react-native-code-push/-/react-native-code-push-7.1.0.tgz#9767518d684017993ff32875bfd349ce01298d35" From 61147f4399e3d2013c89a66c80e91f0f7c5b8d8d Mon Sep 17 00:00:00 2001 From: yashmantri Date: Thu, 26 Sep 2024 17:35:39 +0530 Subject: [PATCH 2/2] TP-86072 | Removed Clarity --- android/app/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index 64044d15..a8f37996 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -325,6 +325,7 @@ dependencies { implementation("com.google.firebase:firebase-analytics-ktx") implementation 'androidx.core:core-splashscreen:1.0.1' implementation 'com.navi.android:pulse:1.0.1-cosmos' + implementation 'androidx.work:work-runtime-ktx:2.8.1' //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules