NTP-39209 | added event and notify error in link upi number screen (#15514)
This commit is contained in:
@@ -2115,12 +2115,14 @@ class NaviPayAnalytics private constructor() {
|
||||
fun onUpiNumberScreenLanded(
|
||||
upiNumberLinkedAccounts: List<UpiNumberLinkedAccountEntity>,
|
||||
naviPayCustomerStatusMap: Map<PspType, NaviPayCustomerStatus>?,
|
||||
noOfSavingsAccounts: Int,
|
||||
) {
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
"NaviPay_UpiNumber_Landed_v2",
|
||||
mapOf(
|
||||
"upiNumberAccountsLinked" to upiNumberLinkedAccounts.size.toString(),
|
||||
"naviPayCustomerStatusMap" to naviPayCustomerStatusMap.toString(),
|
||||
"no_of_savings_accounts" to noOfSavingsAccounts.toString(),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -5685,10 +5687,13 @@ class NaviPayAnalytics private constructor() {
|
||||
}
|
||||
|
||||
inner class NaviPayLinkUpiNumber {
|
||||
fun onLinkUpiNumberLanded(source: String) {
|
||||
fun onLinkUpiNumberLanded(source: String, noOfSavingsAccounts: Int) {
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
"NaviPay_PortedOut_Link2Navi_Landed",
|
||||
mapOf("source" to source),
|
||||
mapOf(
|
||||
"source" to source,
|
||||
"no_of_savings_accounts" to noOfSavingsAccounts.toString(),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ import com.navi.pay.common.ui.ThemeRoundedButton
|
||||
import com.navi.pay.common.ui.ThemedRoundedButtonWithLottie
|
||||
import com.navi.pay.common.utils.ErrorEventHandler
|
||||
import com.navi.pay.common.utils.NaviPayEventBus
|
||||
import com.navi.pay.common.viewmodel.NaviPayBaseVM.Companion.ERROR_DEFAULT_TAG
|
||||
import com.navi.pay.destinations.AddNewUpiNumberScreenDestination
|
||||
import com.navi.pay.destinations.UpiNumberScreenDestination
|
||||
import com.navi.pay.entry.NaviPayActivity
|
||||
@@ -158,7 +159,7 @@ fun LinkUpiNumberScreen(
|
||||
LaunchedEffect(Unit) {
|
||||
ErrorEventHandler.errorCtaClickEvent.collectLatest {
|
||||
NaviPayEventBus.resetEventBus()
|
||||
if (it.errorConfig.tag == EXTERNAL_VPA_FETCH_ERROR) {
|
||||
if (it.errorConfig.tag in listOf(EXTERNAL_VPA_FETCH_ERROR, ERROR_DEFAULT_TAG)) {
|
||||
naviPayActivity.finish()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.navi.pay.common.connectivity.NaviPayNetworkConnectivity
|
||||
import com.navi.pay.common.model.view.NaviPayScreenType
|
||||
import com.navi.pay.common.usecase.CheckUpiNumberAvailabilityUseCase
|
||||
import com.navi.pay.common.usecase.LinkedAccountsUseCase
|
||||
import com.navi.pay.common.usecase.RefreshUpiNumbersUseCase
|
||||
import com.navi.pay.common.utils.DeviceInfoProvider
|
||||
import com.navi.pay.common.utils.NaviPayCommonUtils.getHelpCtaData
|
||||
import com.navi.pay.common.utils.fetchUserPhoneNumber
|
||||
@@ -63,7 +62,6 @@ constructor(
|
||||
private val naviPayNetworkConnectivity: NaviPayNetworkConnectivity,
|
||||
private val naviPayActivityDataProvider: NaviPayActivityDataProvider,
|
||||
private val checkUpiNumberAvailabilityUseCase: CheckUpiNumberAvailabilityUseCase,
|
||||
private val refreshUpiNumbersUseCase: RefreshUpiNumbersUseCase,
|
||||
private val naviPayPspManager: NaviPayPspManager,
|
||||
savedStateHandle: SavedStateHandle,
|
||||
) : NaviPayBaseVM() {
|
||||
@@ -122,7 +120,6 @@ constructor(
|
||||
savedStateHandle["source"] ?: LinkUpiNumberScreenSource.PnOrIan
|
||||
|
||||
init {
|
||||
onUserLandedEvent()
|
||||
updatePhoneNumber()
|
||||
handleSuccessPNRedirection()
|
||||
}
|
||||
@@ -168,6 +165,13 @@ constructor(
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
linkedAccountsUseCase.execute(screenName = screenName).collect { linkedAccounts ->
|
||||
val filteredLinkedAccounts = getFilteredLinkedAccounts(linkedAccounts)
|
||||
onUserLandedEvent(noOfSavingsAccounts = filteredLinkedAccounts.size)
|
||||
|
||||
if (filteredLinkedAccounts.isEmpty()) {
|
||||
notifyError(errorConfig = getGenericErrorConfig())
|
||||
return@collect
|
||||
}
|
||||
|
||||
updateLinkedAccounts(filteredLinkedAccounts)
|
||||
updateBankAccountState(BankAccountsState.AccountList(filteredLinkedAccounts))
|
||||
updateSelectedBankAccount(
|
||||
@@ -180,8 +184,11 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun onUserLandedEvent() {
|
||||
naviPayAnalytics.onLinkUpiNumberLanded(source = source.name)
|
||||
private fun onUserLandedEvent(noOfSavingsAccounts: Int) {
|
||||
naviPayAnalytics.onLinkUpiNumberLanded(
|
||||
source = source.name,
|
||||
noOfSavingsAccounts = noOfSavingsAccounts,
|
||||
)
|
||||
}
|
||||
|
||||
private fun onUserOnboarded() {
|
||||
|
||||
@@ -165,19 +165,17 @@ constructor(
|
||||
val isLinkedSuccessfully = _isLinkedSuccessfully.asStateFlow()
|
||||
|
||||
init {
|
||||
updateAndFetchUpiNumberLinkedAccounts()
|
||||
setDeeplinkData()
|
||||
onScreenLandEvent()
|
||||
updateAndFetchUpiNumberLinkedAccounts()
|
||||
}
|
||||
|
||||
private fun onScreenLandEvent() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
_naviPayCustomerStatusMap.update { naviPayCustomerStatusHandler.getCustomerStatusMap() }
|
||||
naviPayAnalytics.onUpiNumberScreenLanded(
|
||||
upiNumberLinkedAccounts = upiNumberLinkedAccountEntitiesState.value,
|
||||
naviPayCustomerStatusMap = naviPayCustomerStatusMap.value,
|
||||
)
|
||||
}
|
||||
private suspend fun onScreenLandEvent(noOfSavingsAccounts: Int) {
|
||||
_naviPayCustomerStatusMap.update { naviPayCustomerStatusHandler.getCustomerStatusMap() }
|
||||
naviPayAnalytics.onUpiNumberScreenLanded(
|
||||
upiNumberLinkedAccounts = upiNumberLinkedAccountEntitiesState.value,
|
||||
naviPayCustomerStatusMap = naviPayCustomerStatusMap.value,
|
||||
noOfSavingsAccounts = noOfSavingsAccounts,
|
||||
)
|
||||
}
|
||||
|
||||
private fun updateAndFetchUpiNumberLinkedAccounts() {
|
||||
@@ -190,6 +188,7 @@ constructor(
|
||||
}
|
||||
val noOfSavingsAccounts = savingAccounts.size
|
||||
if (noOfSavingsAccounts == 0) {
|
||||
onScreenLandEvent(noOfSavingsAccounts = 0)
|
||||
updateScreenUIState(UpiSettingsScreenState.NoUpiNumberLinked)
|
||||
} else {
|
||||
fetchUpiNumberLinkedAccounts()
|
||||
@@ -246,7 +245,7 @@ constructor(
|
||||
}
|
||||
upiNumberLinkedAccountEntities.sortBy { !it.isPrimary }
|
||||
updateUpiNumberLinkedAccountEntitiesState(upiNumberLinkedAccountEntities)
|
||||
|
||||
onScreenLandEvent(noOfSavingsAccounts = savingAccounts.size)
|
||||
countOfUpiNumberLinkedAndBankAccountsEvent()
|
||||
|
||||
if (noUpiNumberLinked()) {
|
||||
|
||||
Reference in New Issue
Block a user