TP-65692 | case collection manager

This commit is contained in:
Aman Chaturvedi
2024-09-04 19:43:16 +05:30
parent 00d7125c0c
commit d4b6ce3714
6 changed files with 69 additions and 16 deletions

View File

@@ -1341,6 +1341,7 @@ export const LocalStorageKeys = {
LAST_AUDIO_SYNC_TIME: 'lastAudioSyncTime',
LAST_ACCOUNTS_SYNC_TIME: 'lastAccountsSyncTime',
LAST_CALENDAR_SYNC_TIME: 'lastCalendarSyncTime',
COSMOS_CASE_COLLECTION_MANAGER_ENABLE: 'cosmosCaseCollectionManager',
};
export const SourceTextFocused = new Set(['Primary Contact', 'Secondary Contact']);

View File

@@ -88,7 +88,7 @@ export enum FOREGROUND_TASKS {
AUDIO_UPLOAD_JOB = 'AUDIO_UPLOAD_JOB',
DATA_SYNC_JOB = 'DATA_SYNC_JOB',
NEARBY_CASES_GEOLOCATION_CHECK = 'NEARBY_CASES_GEOLOCATION_CHECK',
WIFI_DETAILS_SYNC = 'WIFI_DETAILS_SYNC'
WIFI_DETAILS_SYNC = 'WIFI_DETAILS_SYNC',
}
interface ITrackingComponent {
@@ -401,6 +401,12 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
LitmusExperimentNameMap[LitmusExperimentName.ENABLE_IMAGE_GEO_TAGGING],
{ 'x-customer-id': GLOBAL.AGENT_ID }
);
getLitmusExperimentResult(
LitmusExperimentNameMap[LitmusExperimentName.COSMOS_CASE_COLLECTION_MANAGER],
{ 'x-customer-id': GLOBAL.AGENT_ID }
).then((response) => {
setAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, response);
});
updateImageUploadComponent(enableFeedbackImageGeotagging);
if (
MS_CLARITY_PROJECT_ID &&

View File

@@ -65,7 +65,9 @@ export enum ApiKeys {
GET_TELEPHONE_NUMBERS = 'GET_TELEPHONE_NUMBERS',
GET_TELEPHONE_NUMBERS_V2 = 'GET_TELEPHONE_NUMBERS_V2',
FIRESTORE_INCONSISTENCY_INFO = 'FIRESTORE_INCONSISTENCY_INFO',
FIRESTORE_INCONSISTENCY_INFO_V2 = 'FIRESTORE_INCONSISTENCY_INFO_V2',
GET_CASE_DETAILS_FROM_API = 'GET_CASE_DETAILS_FROM_API',
GET_CASE_DETAILS_FROM_API_V2 = 'GET_CASE_DETAILS_FROM_API_V2',
DAILY_COMMITMENT = 'DAILY_COMMITMENT',
GET_PTP_AMOUNT = 'GET_PTP_AMOUNT',
GET_VISIBILITY_STATUS = 'GET_VISIBILITY_STATUS',
@@ -143,9 +145,13 @@ API_URLS[ApiKeys.GET_PERFORMANCE_METRICS] = '/allocation-cycle/agent-performance
API_URLS[ApiKeys.GET_CASH_COLLECTED] = '/allocation-cycle/cash-collected-split';
API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS] =
'/v2/collection-cases/telephones-view/{loanAccountNumber}';
API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS_V2] = '/collections/{loanAccountNumber}/telephones-agent-call-activity-view';
API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO] = '/cases/v2/sync-status';
API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS_V2] =
'/collections/{loanAccountNumber}/telephones-agent-call-activity-view';
API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO] = '/cases/sync-status';
API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO_V2] = '/cases/v2/sync-status';
API_URLS[ApiKeys.GET_CASE_DETAILS_FROM_API] =
'/collection-cases/minimal-collection-case-view/{caseId}';
API_URLS[ApiKeys.GET_CASE_DETAILS_FROM_API_V2] =
'/v2/collection-cases/minimal-collection-case-view/{caseId}';
API_URLS[ApiKeys.DAILY_COMMITMENT] = '/daily-commitment';
API_URLS[ApiKeys.GET_PTP_AMOUNT] = '/ptps-due-view/agent-detail';
@@ -171,10 +177,12 @@ API_URLS[ApiKeys.DUE_AMOUNT_SUMMARY] = '/collection-cases/{loanAccountNumber}/am
API_URLS[ApiKeys.FEE_WAIVER_HISTORY] = '/collection-cases/{loanAccountNumber}/waiver-history';
API_URLS[ApiKeys.FEE_WAIVER_V2] = '/loan/request/{loanAccountNumber}/adjust-component/v2';
API_URLS[ApiKeys.GET_PIN_CODES_DETAILS] = '/api/v1/pincodes/{pinCode}';
API_URLS[ApiKeys.CALL_CUSTOMER] = '/call-recording/call-request/{loanAccountNumber}/{telephoneReferenceId}';
API_URLS[ApiKeys.CALL_CUSTOMER] =
'/call-recording/call-request/{loanAccountNumber}/{telephoneReferenceId}';
API_URLS[ApiKeys.SYNC_ACTIVE_CALL_DETAILS] = '/call-recording/call-status';
API_URLS[ApiKeys.GET_CALL_HISTORY] = '/call-recording/call-history/{loanAccountNumber}';
API_URLS[ApiKeys.SYNC_CALL_FEEDBACK_NUDGE_DETAILS] = '/call-recording/acknowledge-feedback-nudge/{callId}';
API_URLS[ApiKeys.SYNC_CALL_FEEDBACK_NUDGE_DETAILS] =
'/call-recording/acknowledge-feedback-nudge/{callId}';
API_URLS[ApiKeys.FETCH_CUSTOMER_DOCUMENTS] = '/documents/{loanAccountNumber}';
API_URLS[ApiKeys.FETCH_AGENT_DOCUMENTS] = '/documents/agent';
API_URLS[ApiKeys.FETCH_DOCUMENT_SPECIFIC_LANGUAGE] = '/documents/language/{loanAccountNumber}';
@@ -346,7 +354,7 @@ axiosInstance.interceptors.response.use(
);
axiosInstance.defaults.headers.common['Content-Type'] = 'application/json';
axiosInstance.defaults.baseURL = BASE_AV_APP_URL;
axiosInstance.defaults.baseURL = 'https://qa-longhorn-server.np.navi-ppl.in/field-app'//BASE_AV_APP_URL;
// TODO:: Ideally should happen through middlewares.
export const registerNavigateAndDispatch = (dispatchParam: Dispatch<any>) =>

View File

@@ -2,7 +2,12 @@ import firestore from '@react-native-firebase/firestore';
import { useAppDispatch, useAppSelector } from '@hooks';
import store, { type RootState } from '@store';
import { updateCaseDetailsFirestore } from '@reducers/allCasesSlice';
import { CLICKSTREAM_EVENT_NAMES, FirestoreUpdateTypes, SyncedSource } from '@common/Constants';
import {
CLICKSTREAM_EVENT_NAMES,
FirestoreUpdateTypes,
LocalStorageKeys,
SyncedSource,
} from '@common/Constants';
import axiosInstance, { ApiKeys, getApiUrl } from '@utils/apiHelper';
import { getSyncCaseIds } from '@utils/firebaseFallbackUtils';
import { logError } from '@utils/errorUtils';
@@ -15,6 +20,7 @@ import {
getFirestoreResyncIntervalInMinutes,
} from '@common/AgentActivityConfigurableConstants';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { getAsyncStorageItem } from '@components/utlis/commonFunctions';
const selectedAgentReferenceIDForMyCases = 'MY_CASES';
@@ -33,10 +39,19 @@ const useResyncFirebase = () => {
const selectedAgentRefId = store?.getState()?.user?.selectedAgent?.referenceId || '';
const refIdForLoggedInAndSelectedUser =
selectedAgentRefId === selectedAgentReferenceIDForMyCases ? refId : selectedAgentRefId;
const _getCaseDetailsFromApi = (caseId: string) => {
const getCaseDetailsFromApiUrl = getApiUrl(ApiKeys.GET_CASE_DETAILS_FROM_API, {
caseId: caseId,
});
const _getCaseDetailsFromApi = async (caseId: string) => {
const enableCaseCollectionManager =
(await getAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, true)) ??
false;
const getCaseDetailsFromApiUrl = getApiUrl(
enableCaseCollectionManager
? ApiKeys.GET_CASE_DETAILS_FROM_API_V2
: ApiKeys.GET_CASE_DETAILS_FROM_API,
{
caseId: caseId,
}
);
return axiosInstance.get(getCaseDetailsFromApiUrl, {
params: {
@@ -78,10 +93,17 @@ const useResyncFirebase = () => {
if (minutesSinceLastResync < getFirestoreResyncIntervalInMinutes()) {
return;
}
console.log('firebase resync started');
void addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_FIREBASE_RESYNC_STARTED);
const getFirestoreInconsistencyUrl = getApiUrl(ApiKeys.FIRESTORE_INCONSISTENCY_INFO);
const enableCaseCollectionManager =
(await getAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, true)) ??
false;
const getFirestoreInconsistencyUrl = getApiUrl(
enableCaseCollectionManager
? ApiKeys.FIRESTORE_INCONSISTENCY_INFO_V2
: ApiKeys.FIRESTORE_INCONSISTENCY_INFO
);
const casesList = store?.getState()?.allCases?.casesList || [];
const casesPath = `allocations/${refIdForLoggedInAndSelectedUser}/cases`;
const localCases = getSyncCaseIds(casesList);

View File

@@ -5,8 +5,11 @@ import {
import React, { useEffect, useState } from 'react';
import { _map, MILLISECONDS_IN_A_MINUTE } from '../../../RN-UI-LIB/src/utlis/common';
import { getNotifications, notificationAction } from '../../action/notificationActions';
import { SCREEN_ANIMATION_DURATION } from '../../common/Constants';
import { getScreenFocusListenerObj } from '../../components/utlis/commonFunctions';
import { LocalStorageKeys, SCREEN_ANIMATION_DURATION } from '../../common/Constants';
import {
getScreenFocusListenerObj,
setAsyncStorageItem,
} from '../../components/utlis/commonFunctions';
import { useAppDispatch, useAppSelector } from '../../hooks';
import useFirestoreUpdates from '../../hooks/useFirestoreUpdates';
import useIsOnline from '../../hooks/useIsOnline';
@@ -24,7 +27,10 @@ import useResyncFirebase from '@hooks/useResyncFirebase';
import CaseDetailStack from '@screens/caseDetails/CaseDetailStack';
import { getFirestoreResyncIntervalInMinutes } from '@common/AgentActivityConfigurableConstants';
import { getSelfieDocument } from '@actions/profileActions';
import getLitmusExperimentResult, { LitmusExperimentName, LitmusExperimentNameMap } from '@services/litmusExperiments.service';
import getLitmusExperimentResult, {
LitmusExperimentName,
LitmusExperimentNameMap,
} from '@services/litmusExperiments.service';
import { GLOBAL } from '@constants/Global';
import { updateImageUploadComponent } from '@components/form/services/formComponents';
@@ -68,6 +74,14 @@ const ProtectedRouter = () => {
).then((response) => {
updateImageUploadComponent(response);
});
getLitmusExperimentResult(
LitmusExperimentNameMap[LitmusExperimentName.COSMOS_CASE_COLLECTION_MANAGER],
{
'x-customer-id': GLOBAL.AGENT_ID,
}
).then((response) => {
setAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, response);
});
}
}, [isOnline]);

View File

@@ -10,6 +10,7 @@ export enum LitmusExperimentName {
COSMOS_DATA_SYNC = 'data_sync',
MS_CLARITY = 'ms_clarity',
ENABLE_IMAGE_GEO_TAGGING = 'enable_image_geotagging',
COSMOS_CASE_COLLECTION_MANAGER = 'cosmos_case_collection_manager',
}
export const LitmusExperimentNameMap = {
@@ -18,6 +19,7 @@ export const LitmusExperimentNameMap = {
[LitmusExperimentName.COSMOS_DATA_SYNC]: 'data_sync',
[LitmusExperimentName.MS_CLARITY]: 'cosmos_ms_clarity',
[LitmusExperimentName.ENABLE_IMAGE_GEO_TAGGING]: 'enable_image_geotagging',
[LitmusExperimentName.COSMOS_CASE_COLLECTION_MANAGER]: 'cosmos_case_collection_manager',
};
const getLitmusExperimentResult = async (