From cb367ded0af986420ee3ed3d5b83306efcb944b1 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Mon, 24 Feb 2025 14:53:39 +0530 Subject: [PATCH 1/2] NTP-38623 | Clickstream added --- src/common/Constants.ts | 19 +++++++++++++++++- src/common/DialerAppUpdate.tsx | 12 ++++++++++- .../BottomSheets/CallViaBottomSheet.tsx | 20 +++++++++++-------- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/common/Constants.ts b/src/common/Constants.ts index 34f698a2..7f8ded4a 100644 --- a/src/common/Constants.ts +++ b/src/common/Constants.ts @@ -1467,7 +1467,24 @@ export const CLICKSTREAM_EVENT_NAMES = { FA_CALL_SYNC_SELF_CALL_ERROR: { name: 'FA_CALL_SYNC_SELF_CALL_ERROR', description: 'Call sync self call error', - } + }, + FA_DIALER_APP_BLOCKER_SCREEN_LOADED: { + name: 'FA_DIALER_APP_BLOCKER_SCREEN_LOADED', + description: 'Dialer app blocker screen loaded', + }, + FA_DIALER_APP_UPDATE_SCREEN_LOADED: { + name: 'FA_DIALER_APP_UPDATE_SCREEN_LOADED', + description: 'Dialer app update screen loaded', + }, + FA_CALL_VIA_INHOUSE_DIALER: { + name: 'FA_CALL_VIA_INHOUSE_DIALER', + description: 'Call via inhouse dialer app', + }, + FA_CALL_VIA_EXOTEL: { + name: 'FA_CALL_VIA_INHOUSE_DIALER_APP_FAILED', + description: 'Call via inhouse dialer app failed', + }, + } as const; export enum MimeType { diff --git a/src/common/DialerAppUpdate.tsx b/src/common/DialerAppUpdate.tsx index 97cb7525..fe18747c 100644 --- a/src/common/DialerAppUpdate.tsx +++ b/src/common/DialerAppUpdate.tsx @@ -1,5 +1,5 @@ import { Linking, Pressable, StyleSheet, View } from 'react-native'; -import React from 'react'; +import React, { useEffect } from 'react'; import Text from '@rn-ui-lib/components/Text'; import Layout from '@screens/layout/Layout'; import { GenericStyles } from '@rn-ui-lib/styles'; @@ -8,6 +8,8 @@ import Button from '@rn-ui-lib/components/Button'; import { useAppSelector } from '@hooks'; import DialerAppIcon from '@assets/icons/DialerAppIcon'; import { COLORS } from '@rn-ui-lib/colors'; +import { addClickstreamEvent } from '@services/clickstreamEventService'; +import { CLICKSTREAM_EVENT_NAMES } from './Constants'; interface IDialerAppUpdate { onAppUpdate: () => void; @@ -24,6 +26,14 @@ const DialerAppUpdate: React.FC = ({ onAppUpdate }) => { ); }; + useEffect(() => { + addClickstreamEvent( + isAppInstalled + ? CLICKSTREAM_EVENT_NAMES.FA_DIALER_APP_UPDATE_SCREEN_LOADED + : CLICKSTREAM_EVENT_NAMES.FA_DIALER_APP_BLOCKER_SCREEN_LOADED + ); + }, []); + return ( diff --git a/src/screens/caseDetails/CallingFlow/BottomSheets/CallViaBottomSheet.tsx b/src/screens/caseDetails/CallingFlow/BottomSheets/CallViaBottomSheet.tsx index 88e6667c..2181eb6e 100644 --- a/src/screens/caseDetails/CallingFlow/BottomSheets/CallViaBottomSheet.tsx +++ b/src/screens/caseDetails/CallingFlow/BottomSheets/CallViaBottomSheet.tsx @@ -22,7 +22,7 @@ import { setCallAttemptedOn } from '@reducers/telephoneNumbersSlice'; import { makeACallToCustomer } from '@actions/callRecordingActions'; import { logError } from '@components/utlis/errorUtils'; import { launchCallIntent } from '@components/utlis/callModuleUtils'; -import { getExotelNumber } from "@common/AgentActivityConfigurableConstants"; +import { getExotelNumber } from '@common/AgentActivityConfigurableConstants'; import { DIALER_APP_FILE_PATH } from '@common/utils'; interface ICallViaBottomSheet { @@ -88,23 +88,27 @@ const CallViaBottomSheet = (props: ICallViaBottomSheet) => { ]; const callCustomer = (callVia: CallVia) => { if (callVia === CallVia.ANDROID) { + addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_CALL_VIA_INHOUSE_DIALER); launchCallIntent(`+91${mobileNumber}`, getExotelNumber(), DIALER_APP_FILE_PATH, (error) => { if (error) { // In case any failure happens we will show download dialer app bottom sheet dispatch(setCallViaBottomSheet(false)); dispatch(setShowDialerBottomSheet(true)); } - }) + }); } else if (callVia === CallVia.EXOTEL) { PhoneStateModule.getCurrentCallState() .then((callState: string) => { if (isCallInactiveOrUnknown(callState as PhoneStateType)) { - dispatch(setCallDetails({ - caseId, - customerName, - telephoneNo: mobileNumber, - telephoneReferenceId: referenceId - })); + addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_CALL_VIA_EXOTEL); + dispatch( + setCallDetails({ + caseId, + customerName, + telephoneNo: mobileNumber, + telephoneReferenceId: referenceId, + }) + ); } else { dispatch(setCallCannotInitiateBottomSheet(true)); } From a01d5e740dc716b1c5b7d8736c6b59fec46737e9 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Mon, 24 Feb 2025 18:37:27 +0530 Subject: [PATCH 2/2] NTP-38623 | Clickstream added --- .../CallingFlow/BottomSheets/CallViaBottomSheet.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/screens/caseDetails/CallingFlow/BottomSheets/CallViaBottomSheet.tsx b/src/screens/caseDetails/CallingFlow/BottomSheets/CallViaBottomSheet.tsx index 2181eb6e..9f4e0ce5 100644 --- a/src/screens/caseDetails/CallingFlow/BottomSheets/CallViaBottomSheet.tsx +++ b/src/screens/caseDetails/CallingFlow/BottomSheets/CallViaBottomSheet.tsx @@ -88,7 +88,9 @@ const CallViaBottomSheet = (props: ICallViaBottomSheet) => { ]; const callCustomer = (callVia: CallVia) => { if (callVia === CallVia.ANDROID) { - addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_CALL_VIA_INHOUSE_DIALER); + addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_CALL_VIA_INHOUSE_DIALER, { + mobileNumber, + }); launchCallIntent(`+91${mobileNumber}`, getExotelNumber(), DIALER_APP_FILE_PATH, (error) => { if (error) { // In case any failure happens we will show download dialer app bottom sheet