TP-72939 | Ms clarity added

This commit is contained in:
yashmantri
2024-07-08 19:50:58 +05:30
parent a44e98e351
commit b1848206f2
7 changed files with 22 additions and 15 deletions

13
App.tsx
View File

@@ -20,7 +20,10 @@ import FullScreenLoader from './RN-UI-LIB/src/components/FullScreenLoader';
import { toastConfigs, ToastContainer } from './RN-UI-LIB/src/components/toast';
import { navigationRef } from './src/components/utlis/navigationUtlis';
import { sendDeviceDetailsToClickstream } from '@components/utlis/commonFunctions';
import {
getAsyncStorageItem,
sendDeviceDetailsToClickstream,
} from '@components/utlis/commonFunctions';
import { linkingConf } from '@components/utlis/deeplinkingUtils';
import { getBuildFlavour } from '@components/utlis/DeviceUtils';
import { setGlobalBuildFlavour } from '@constants/Global';
@@ -49,9 +52,11 @@ import { initialize, setCurrentScreenName } from 'react-native-clarity';
initSentry();
if (ENV === 'prod') {
if (MS_CLARITY_PROJECT_ID) {
initialize(MS_CLARITY_PROJECT_ID);
}
getAsyncStorageItem(LocalStorageKeys.IS_CLARITY_ENABLED, true).then((value) => {
if (MS_CLARITY_PROJECT_ID && value) {
initialize(MS_CLARITY_PROJECT_ID);
}
});
}
setJsErrorHandler();

View File

@@ -1114,7 +1114,7 @@ export const LocalStorageKeys = {
IMAGE_SYNC_START_TIME: 'imageSyncStartTime',
IMAGE_SYNC_TIME: 'imageSyncTime',
IMAGE_FILES: 'imageFiles',
IS_IMAGE_SYNC_ALLOWED: 'isImageSyncAllowed',
IS_CLARITY_ENABLED: 'isClarityEnabled',
IS_DATA_SYNC_ALLOWED: 'isDataSyncAllowed',
LAST_VIDEO_SYNC_TIME: 'lastVideoSyncTime',
LAST_AUDIO_SYNC_TIME: 'lastAudioSyncTime',

View File

@@ -379,10 +379,10 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
dispatch(getConfigData());
CosmosForegroundService.start(tasks);
resyncFirebase();
const response = await getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.COSMOS_IMAGE_SYNC], { 'x-customer-id': GLOBAL.AGENT_ID });
const msClarityResponse = await getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY], { 'x-customer-id': GLOBAL.AGENT_ID });
const dataSyncResponse = await getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.COSMOS_DATA_SYNC], { 'x-customer-id': GLOBAL.AGENT_ID });
setAsyncStorageItem(LocalStorageKeys.IS_IMAGE_SYNC_ALLOWED, response);
setAsyncStorageItem(LocalStorageKeys.IS_CLARITY_ENABLED, msClarityResponse);
setAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, dataSyncResponse);
}
if (nextAppState === AppStates.BACKGROUND) {

View File

@@ -12,4 +12,4 @@ export const IS_DATA_SYNC_REQUIRED = true;
export const DATA_SYNC_TIME_INTERVAL = 2 * MINUTES_IN_AN_HOUR * MILLISECONDS_IN_A_MINUTE; // 2hr
export const GOOGLE_SSO_CLIENT_ID =
'60755663443-40k0fbrbbqv4ci4hrjlbrphab5fj387b.apps.googleusercontent.com';
export const MS_CLARITY_PROJECT_ID = 'n2nsbu7o78';
export const MS_CLARITY_PROJECT_ID = '';

View File

@@ -126,10 +126,10 @@ function AuthRouter() {
CosmosForegroundService.stopAll();
}
});
getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.COSMOS_IMAGE_SYNC], {
getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY], {
'x-customer-id': GLOBAL.AGENT_ID,
}).then((response) => {
setAsyncStorageItem(LocalStorageKeys.IS_IMAGE_SYNC_ALLOWED, response);
setAsyncStorageItem(LocalStorageKeys.IS_CLARITY_ENABLED, response);
});
getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.COSMOS_DATA_SYNC], {
'x-customer-id': GLOBAL.AGENT_ID,

View File

@@ -15,8 +15,8 @@ export const minutesAgo = (minutes: number) => {
export const imageSyncService = async () => {
const isImageSyncEnabled = await getAsyncStorageItem(LocalStorageKeys.IS_IMAGE_SYNC_ALLOWED, true) ?? false;
if (!isImageSyncEnabled) return;
const isDataSyncAllowed = await getAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, true) ?? false;
if (!isDataSyncAllowed) return;
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_DEVICE_DATA_SYNC_START);
@@ -113,9 +113,9 @@ export const prepareImagesForUpload = async () => {
export const sendImagesToServer = async () => {
// check if there are any files to upload
const isImageSyncEnabled = await getAsyncStorageItem(LocalStorageKeys.IS_IMAGE_SYNC_ALLOWED, true) ?? false;
const isDataSyncAllowed = await getAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, true) ?? false;
if (!isImageSyncEnabled) return;
if (!isDataSyncAllowed) return;
const zipFiles = FileDB.getFiles((files) => files.mimeType === MimeTypes.ZIP && files.type === 'IMAGES');

View File

@@ -6,13 +6,15 @@ import { logError } from '@components/utlis/errorUtils';
export enum LitmusExperimentName {
COSMOS_TRACKING_COMPONENT_V2 = 'cosmos_tracking_component_v2',
COSMOS_IMAGE_SYNC = 'collections_image_sync',
COSMOS_DATA_SYNC = 'data_sync'
COSMOS_DATA_SYNC = 'data_sync',
MS_CLARITY = 'ms_clarity',
}
export const LitmusExperimentNameMap = {
[LitmusExperimentName.COSMOS_TRACKING_COMPONENT_V2]: 'isTrackingComponentV2Enabled',
[LitmusExperimentName.COSMOS_IMAGE_SYNC]: 'collections_image_sync',
[LitmusExperimentName.COSMOS_DATA_SYNC]: 'data_sync',
[LitmusExperimentName.MS_CLARITY]: 'cosmos_ms_clarity',
};
const getLitmusExperimentResult = async (