TP-34788 | Clickstream events added for AM/TLs

This commit is contained in:
Aman Chaturvedi
2023-09-14 16:40:58 +05:30
parent 2df6b54054
commit 1e70711c4d
10 changed files with 77 additions and 8 deletions

View File

@@ -216,11 +216,19 @@ android {
}
}
signingConfigs {
debug {
debug {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
else {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {

View File

@@ -525,6 +525,27 @@ export const CLICKSTREAM_EVENT_NAMES = {
name: 'FA_GEOLOCATION_CAPTURING_FAILED',
description: 'Geolocation capturing failed',
},
// AM/TLs
FA_AGENT_LIST_DROPDOWN_CLICKED: {
name: 'FA_AGENT_LIST_DROPDOWN_CLICKED',
description: 'Agent list dropdown clicked',
},
FA_AGENT_LIST_BUTTON_CLICKED: {
name: 'FA_AGENT_LIST_BUTTON_CLICKED',
description: 'Agent list button clicked',
},
FA_AGENT_LIST_BOTTOMSHEET_LOAD_SUCCESS: {
name: 'FA_AGENT_LIST_BOTTOMSHEET_LOAD_SUCCESS',
description: 'Agent list bottomsheet load success',
},
FA_AGENT_SELECT_BUTTON_CLICKED: {
name: 'FA_AGENT_SELECT_BUTTON_CLICKED',
description: 'Agent select button clicked',
},
FA_AGENT_CASE_LOAD_SUCCESS: {
name: 'FA_AGENT_CASE_LOAD_SUCCESS',
description: 'Agent case load success',
},
} as const;
export enum MimeType {

View File

@@ -106,6 +106,7 @@ const useFirestoreUpdates = () => {
caseUpdates,
isInitialLoad,
isVisitPlanLocked: lockRef?.current?.visitPlanStatus === VisitPlanStatus.LOCKED,
selectedAgent: selectedAgent,
})
);
!isInitialLoad && showCaseUpdationToast(newlyAddedCases, deletedCases);

View File

@@ -12,6 +12,7 @@ import {
CaseAllocationType,
caseVerdict,
ICaseItem,
IReportee,
} from '../screens/allCases/interface';
import { CaseDetail, CONTEXT_TASK_STATUSES, DOCUMENT_TYPE } from '../screens/caseDetails/interface';
import { addClickstreamEvent } from '../services/clickstreamEventService';
@@ -19,6 +20,7 @@ import { getLoanAccountNumber } from '../components/utlis/commonFunctions';
import { getVisitedWidgetsNodeList } from '../components/form/services/forms.service';
import { CollectionCaseWidgetId, CommonCaseWidgetId } from '../types/template.types';
import { IAvatarUri } from '../action/caseListAction';
import { MY_CASE_ITEM } from './userSlice';
export type ICasesMap = { [key: string]: ICaseItem };
interface IAllCasesSlice {
@@ -237,10 +239,11 @@ const allCasesSlice = createSlice({
state.loading = action.payload;
},
updateCaseDetailsFirestore: (state, action) => {
const { caseUpdates, isInitialLoad, isVisitPlanLocked } = action.payload as {
const { caseUpdates, isInitialLoad, isVisitPlanLocked, selectedAgent } = action.payload as {
caseUpdates: CaseUpdates[];
isInitialLoad: boolean;
isVisitPlanLocked: boolean;
selectedAgent: IReportee;
};
let newVisitCaseLoanIds: string[] = [];
let newVisitCollectionCases: string[] = [];
@@ -354,6 +357,11 @@ const allCasesSlice = createSlice({
state.pinnedList = pinnedList;
state.newVisitedCases = newVisitCollectionCases;
if (state.loading) {
if (selectedAgent && selectedAgent.referenceId !== MY_CASE_ITEM.referenceId) {
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_AGENT_CASE_LOAD_SUCCESS, {
selectedAgent: selectedAgent.referenceId,
});
}
state.loading = false;
}

View File

@@ -13,6 +13,8 @@ import fuzzysort from 'fuzzysort';
import { MY_CASE_ITEM, setSelectedAgent } from '../../reducer/userSlice';
import { resetFilters } from '../../reducer/filtersSlice';
import { setGlobalUserData } from '../../constants/Global';
import { addClickstreamEvent } from '../../services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '../../common/Constants';
interface IAgentListItem {
agent: IReportee;
@@ -25,8 +27,12 @@ const AgentListItem: React.FC<IAgentListItem> = ({ agent, leftAdornment, searchQ
const dispatch = useAppDispatch();
const handleAgentSelection = () => {
const selectedAgentId = agent.referenceId;
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_AGENT_SELECT_BUTTON_CLICKED, {
selectedAgentId,
});
dispatch(setSelectedAgent(agent));
setGlobalUserData({ selectedAgentId: agent.referenceId });
setGlobalUserData({ selectedAgentId });
dispatch(resetFilters());
dispatch(resetCasesData());
dispatch(setShowAgentSelectionBottomSheet(false));

View File

@@ -8,12 +8,23 @@ import { getAgentsList } from '../../action/reporteesActions';
import { GenericStyles } from '../../../RN-UI-LIB/src/styles';
import { COLORS } from '../../../RN-UI-LIB/src/styles/colors';
import AgentListViewLoading from './AgentListViewLoading';
import { CLICKSTREAM_EVENT_NAMES } from '../../common/Constants';
import { addClickstreamEvent } from '../../services/clickstreamEventService';
const AgentsListContainer = () => {
interface IAgentsListContainer {
showAgentSelectionBottomSheet: boolean;
}
const AgentsListContainer: React.FC<IAgentsListContainer> = ({ showAgentSelectionBottomSheet }) => {
const [searchQuery, setSearchQuery] = React.useState<string>('');
const { isLoading, agentsList } = useAppSelector((state) => state.reportees);
const dispatch = useAppDispatch();
useEffect(() => {
showAgentSelectionBottomSheet &&
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_AGENT_LIST_BOTTOMSHEET_LOAD_SUCCESS);
}, [showAgentSelectionBottomSheet]);
const scrollAnimation = useRef(new Animated.Value(0)).current;
useEffect(() => {

View File

@@ -355,7 +355,7 @@ const CasesList: React.FC<ICasesList> = ({ casesList = [], isVisitPlan, allCases
setVisible={toggleAgentSelectionBottomSheet}
>
<View style={[GenericStyles.mt16, GenericStyles.fill]}>
<AgentsListContainer />
<AgentsListContainer showAgentSelectionBottomSheet={showAgentSelectionBottomSheet} />
</View>
</BottomSheet>
</View>

View File

@@ -13,6 +13,8 @@ import { MY_CASE_ITEM, VisitPlanStatus } from '../../reducer/userSlice';
import { EmptyListMessages } from './constants';
import { navigateToScreen } from '../../components/utlis/navigationUtlis';
import { dateFormat, DAY_MONTH_DATE_FORMAT } from '../../../RN-UI-LIB/src/utlis/dates';
import { addClickstreamEvent } from '../../services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '../../common/Constants';
interface IEmptyList {
isCompleted?: boolean;
@@ -94,6 +96,11 @@ const EmptyList: React.FC<IEmptyList> = (props) => {
}
};
const handleAgentSelectionCTAClick = () => {
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_AGENT_LIST_BUTTON_CLICKED);
setShowAgentSelectionBottomSheet && setShowAgentSelectionBottomSheet(true);
};
const getBtnDetails = () => {
if (isVisitPlan && !isFilterApplied && !isLockedVisitPlanStatus) {
return {
@@ -104,7 +111,7 @@ const EmptyList: React.FC<IEmptyList> = (props) => {
if (isTeamLead && setShowAgentSelectionBottomSheet) {
return {
btnHandler: () => setShowAgentSelectionBottomSheet(true),
btnHandler: handleAgentSelectionCTAClick,
btnText: 'Select Agent',
};
}

View File

@@ -8,6 +8,8 @@ import { useAppSelector } from '../../hooks';
import { RootState } from '../../store/store';
import { MY_CASE_ITEM, VisitPlanStatus } from '../../reducer/userSlice';
import { dateFormat, DAY_MONTH_DATE_FORMAT } from '../../../RN-UI-LIB/src/utlis/dates';
import { addClickstreamEvent } from '../../services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '../../common/Constants';
interface HeaderLabelProps {
setShowAgentSelectionBottomSheet: (val: boolean) => void;
@@ -29,6 +31,11 @@ const HeaderLabel: React.FC<HeaderLabelProps> = (props) => {
}));
const isTeamLead = useAppSelector((state) => state.user.isTeamLead);
const handleAgentSelectionCTAClick = () => {
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_AGENT_LIST_DROPDOWN_CLICKED);
setShowAgentSelectionBottomSheet(true);
};
const getHeaderLabel = () => {
if (isVisitPlan) {
if (isLockedVisitPlanStatus) {
@@ -45,7 +52,7 @@ const HeaderLabel: React.FC<HeaderLabelProps> = (props) => {
return (
<TouchableOpacity
style={GenericStyles.centerAlignedRow}
onPress={() => setShowAgentSelectionBottomSheet(true)}
onPress={handleAgentSelectionCTAClick}
>
<Heading type="h3" style={[styles.headerLabel]}>
{getHeaderLabel()}