Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-29 19:36:43 +05:00
parent 9aecc175bf
commit e01a65011b
26 changed files with 159 additions and 17 deletions

View file

@ -18,22 +18,50 @@ sealed class CommonSendAnalyticEvents(
/** Recipient address screen opened */
data class AddressScreenOpened(
val categoryName: String,
) : CommonSendAnalyticEvents(category = categoryName, event = "Address Screen Opened")
val source: CommonSendSource,
) : CommonSendAnalyticEvents(
category = categoryName,
event = "Address Screen Opened",
params = mapOf(
SOURCE to source.analyticsName,
),
)
/** Amount screen opened */
data class AmountScreenOpened(
val categoryName: String,
) : CommonSendAnalyticEvents(category = categoryName, event = "Amount Screen Opened")
val source: CommonSendSource,
) : CommonSendAnalyticEvents(
category = categoryName,
event = "Amount Screen Opened",
params = mapOf(
SOURCE to source.analyticsName,
),
)
/** Fee screen opened */
data class FeeScreenOpened(
val categoryName: String,
) : CommonSendAnalyticEvents(category = categoryName, event = "Fee Screen Opened")
val source: CommonSendSource,
) : CommonSendAnalyticEvents(
category = categoryName,
event = "Fee Screen Opened",
params = mapOf(
SOURCE to source.analyticsName,
),
)
/** Confirmation screen opened */
data class ConfirmationScreenOpened(
val categoryName: String,
) : CommonSendAnalyticEvents(category = categoryName, event = "Confirm Screen Opened")
val source: CommonSendSource,
) : CommonSendAnalyticEvents(
category = categoryName,
event = "Confirm Screen Opened",
params = mapOf(
SOURCE to source.analyticsName,
),
)
/** If transaction delays notification is present */
data class NoticeTransactionDelays(
@ -142,4 +170,11 @@ sealed class CommonSendAnalyticEvents(
Fee,
Confirm,
}
enum class CommonSendSource(val analyticsName: String) {
Send("Send"),
SendWithSwap("Send&Swap"),
WalletConnect("WalletConnect"),
NFT("NFT"),
}
}

View file

@ -6,6 +6,7 @@ import com.tangem.blockchain.common.transaction.TransactionFee
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.transaction.error.GetFeeError
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.callbacks.FeeSelectorModelCallback
import com.tangem.features.send.v2.api.entity.FeeSelectorUM
@ -17,6 +18,7 @@ sealed class FeeSelectorParams {
abstract val feeStateConfiguration: FeeStateConfiguration
abstract val feeDisplaySource: FeeDisplaySource
abstract val analyticsCategoryName: String
abstract val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource
data class FeeSelectorBlockParams(
override val state: FeeSelectorUM,
@ -26,6 +28,7 @@ sealed class FeeSelectorParams {
override val feeStateConfiguration: FeeStateConfiguration,
override val feeDisplaySource: FeeDisplaySource,
override val analyticsCategoryName: String,
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
) : FeeSelectorParams()
data class FeeSelectorDetailsParams(
@ -36,6 +39,7 @@ sealed class FeeSelectorParams {
override val feeStateConfiguration: FeeStateConfiguration,
override val feeDisplaySource: FeeDisplaySource,
override val analyticsCategoryName: String,
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val callback: FeeSelectorModelCallback,
) : FeeSelectorParams()

View file

@ -2,8 +2,10 @@ package com.tangem.features.send.v2.api.subcomponents.amount.analytics
import com.tangem.core.analytics.models.AnalyticsEvent
import com.tangem.core.analytics.models.AnalyticsParam.Key.BLOCKCHAIN
import com.tangem.core.analytics.models.AnalyticsParam.Key.SOURCE
import com.tangem.core.analytics.models.AnalyticsParam.Key.TOKEN_PARAM
import com.tangem.core.analytics.models.AnalyticsParam.Key.TYPE
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
sealed class CommonSendAmountAnalyticEvents(
category: String,
@ -26,12 +28,14 @@ sealed class CommonSendAmountAnalyticEvents(
val categoryName: String,
val token: String,
val blockchain: String,
val source: CommonSendAnalyticEvents.CommonSendSource,
) : CommonSendAmountAnalyticEvents(
category = categoryName,
event = "Max Amount Taped",
params = mapOf(
TOKEN_PARAM to token,
BLOCKCHAIN to blockchain,
SOURCE to source.analyticsName,
),
)

View file

@ -3,6 +3,7 @@ package com.tangem.features.send.v2.api.subcomponents.destination
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.entity.PredefinedValues
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationUM
import kotlinx.coroutines.flow.Flow
@ -12,12 +13,14 @@ sealed class SendDestinationComponentParams {
abstract val state: DestinationUM
abstract val analyticsCategoryName: String
abstract val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource
abstract val userWalletId: UserWalletId
abstract val cryptoCurrency: CryptoCurrency
data class DestinationParams(
override val state: DestinationUM,
override val analyticsCategoryName: String,
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
override val cryptoCurrency: CryptoCurrency,
override val userWalletId: UserWalletId,
val title: TextReference,
@ -29,6 +32,7 @@ sealed class SendDestinationComponentParams {
data class DestinationBlockParams(
override val state: DestinationUM,
override val analyticsCategoryName: String,
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
override val userWalletId: UserWalletId,
override val cryptoCurrency: CryptoCurrency,
val blockClickEnableFlow: StateFlow<Boolean>,

View file

@ -2,6 +2,9 @@ package com.tangem.features.send.v2.api.subcomponents.feeSelector.analytics
import com.tangem.core.analytics.models.AnalyticsEvent
import com.tangem.core.analytics.models.AnalyticsParam
import com.tangem.core.analytics.models.AnalyticsParam.Key.FEE_TYPE
import com.tangem.core.analytics.models.AnalyticsParam.Key.SOURCE
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents.CommonSendSource
sealed class CommonSendFeeAnalyticEvents(
category: String,
@ -15,10 +18,14 @@ sealed class CommonSendFeeAnalyticEvents(
data class SelectedFee(
override val categoryName: String,
val feeType: AnalyticsParam.FeeType,
val source: CommonSendSource,
) : CommonSendFeeAnalyticEvents(
category = categoryName,
event = "Fee Selected",
params = mapOf("Fee Type" to feeType.value),
params = mapOf(
FEE_TYPE to feeType.value,
SOURCE to source.analyticsName,
),
)
/** Custom fee selected */

View file

@ -51,6 +51,7 @@ internal class DefaultFeeSelectorBlockComponent @AssistedInject constructor(
feeStateConfiguration = params.feeStateConfiguration,
feeDisplaySource = FeeSelectorParams.FeeDisplaySource.Screen,
analyticsCategoryName = params.analyticsCategoryName,
analyticsSendSource = params.analyticsSendSource,
),
onDismiss = {
model.feeSelectorBottomSheet.dismiss()

View file

@ -150,6 +150,7 @@ internal class FeeSelectorModel @Inject constructor(
CommonSendFeeAnalyticEvents.SelectedFee(
categoryName = params.analyticsCategoryName,
feeType = feeSelectorUM.toAnalyticType(),
source = params.analyticsSendSource,
),
)
val isCustomFeeEdited = feeSelectorUM.selectedFeeItem.fee.amount.value != feeSelectorUM.fees.normal.amount.value
@ -176,7 +177,10 @@ internal class FeeSelectorModel @Inject constructor(
fun showFeeSelector() {
analyticsEventHandler.send(
CommonSendAnalyticEvents.FeeScreenOpened(categoryName = params.analyticsCategoryName),
CommonSendAnalyticEvents.FeeScreenOpened(
categoryName = params.analyticsCategoryName,
source = params.analyticsSendSource,
),
)
analyticsEventHandler.send(
CommonSendAnalyticEvents.ScreenReopened(

View file

@ -93,6 +93,7 @@ internal class DefaultSendComponent @AssistedInject constructor(
analyticsEventHandler.send(
CommonSendAnalyticEvents.ConfirmationScreenOpened(
categoryName = model.analyticCategoryName,
source = model.analyticsSendSource,
),
)
if (model.currentRoute.value.isEditMode) {
@ -101,19 +102,28 @@ internal class DefaultSendComponent @AssistedInject constructor(
}
is SendAmountComponent -> {
analyticsEventHandler.send(
CommonSendAnalyticEvents.AmountScreenOpened(categoryName = model.analyticCategoryName),
CommonSendAnalyticEvents.AmountScreenOpened(
categoryName = model.analyticCategoryName,
source = model.analyticsSendSource,
),
)
activeComponent.updateState(model.uiState.value.amountUM)
}
is DefaultSendDestinationComponent -> {
analyticsEventHandler.send(
CommonSendAnalyticEvents.AddressScreenOpened(categoryName = model.analyticCategoryName),
CommonSendAnalyticEvents.AddressScreenOpened(
categoryName = model.analyticCategoryName,
source = model.analyticsSendSource,
),
)
activeComponent.updateState(model.uiState.value.destinationUM)
}
is SendFeeComponent -> {
analyticsEventHandler.send(
CommonSendAnalyticEvents.FeeScreenOpened(categoryName = model.analyticCategoryName),
CommonSendAnalyticEvents.FeeScreenOpened(
categoryName = model.analyticCategoryName,
source = model.analyticsSendSource,
),
)
}
}
@ -155,6 +165,7 @@ internal class DefaultSendComponent @AssistedInject constructor(
currentRoute = model.currentRoute.filterIsInstance<CommonSendRoute.Destination>(),
isBalanceHidingFlow = model.isBalanceHiddenFlow,
analyticsCategoryName = model.analyticCategoryName,
analyticsSendSource = model.analyticsSendSource,
title = resourceReference(R.string.common_address),
userWalletId = params.userWalletId,
cryptoCurrency = params.currency,
@ -177,6 +188,7 @@ internal class DefaultSendComponent @AssistedInject constructor(
callback = model,
predefinedValues = model.predefinedValues,
isRedesignEnabled = model.uiState.value.isRedesignEnabled,
analyticsSendSource = model.analyticsSendSource,
),
)
}
@ -204,6 +216,7 @@ internal class DefaultSendComponent @AssistedInject constructor(
sendAmount = sendAmount,
destinationAddress = destinationAddress,
callback = model,
analyticsSendSource = model.analyticsSendSource,
),
)
} else {
@ -238,6 +251,7 @@ internal class DefaultSendComponent @AssistedInject constructor(
onSendTransaction = {
innerRouter.replaceAll(CommonSendRoute.ConfirmSuccess)
},
analyticsSendSource = model.analyticsSendSource,
),
feeSelectorComponentFactory = feeSelectorComponentFactory,
)
@ -268,6 +282,7 @@ internal class DefaultSendComponent @AssistedInject constructor(
params = SendDestinationComponentParams.DestinationBlockParams(
state = model.uiState.value.destinationUM,
analyticsCategoryName = model.analyticCategoryName,
analyticsSendSource = model.analyticsSendSource,
userWalletId = model.userWallet.walletId,
cryptoCurrency = cryptoCurrencyStatus.currency,
blockClickEnableFlow = MutableStateFlow(true),

View file

@ -17,6 +17,7 @@ import com.tangem.domain.transaction.error.GetFeeError
import com.tangem.features.send.v2.api.FeeSelectorBlockComponent
import com.tangem.features.send.v2.api.SendNotificationsComponent
import com.tangem.features.send.v2.api.SendNotificationsComponent.Params.NotificationData
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.entity.PredefinedValues
import com.tangem.features.send.v2.api.params.FeeSelectorParams
import com.tangem.features.send.v2.api.subcomponents.destination.SendDestinationComponentParams.DestinationBlockParams
@ -50,6 +51,7 @@ internal class SendConfirmComponent(
params = DestinationBlockParams(
state = model.uiState.value.destinationUM,
analyticsCategoryName = params.analyticsCategoryName,
analyticsSendSource = params.analyticsSendSource,
userWalletId = params.userWallet.walletId,
cryptoCurrency = params.cryptoCurrencyStatus.currency,
blockClickEnableFlow = blockClickEnableFlow.asStateFlow(),
@ -73,6 +75,7 @@ internal class SendConfirmComponent(
cryptoCurrency = params.cryptoCurrencyStatus.currency,
cryptoCurrencyStatusFlow = params.cryptoCurrencyStatusFlow,
isBalanceHidingFlow = params.isBalanceHidingFlow,
analyticsSendSource = params.analyticsSendSource,
),
onResult = model::onAmountResult,
onClick = model::showEditAmount,
@ -90,6 +93,7 @@ internal class SendConfirmComponent(
sendAmount = model.confirmData.enteredAmount.orZero(),
destinationAddress = model.confirmData.enteredDestination.orEmpty(),
blockClickEnableFlow = blockClickEnableFlow.asStateFlow(),
analyticsSendSource = params.analyticsSendSource,
onLoadFee = params.onLoadFee,
),
onResult = model::onFeeResult,
@ -106,6 +110,7 @@ internal class SendConfirmComponent(
feeStateConfiguration = model.feeStateConfiguration,
feeDisplaySource = FeeSelectorParams.FeeDisplaySource.Screen,
analyticsCategoryName = params.analyticsCategoryName,
analyticsSendSource = params.analyticsSendSource,
),
onResult = model::onFeeResult,
)
@ -165,6 +170,7 @@ internal class SendConfirmComponent(
data class Params(
val state: SendUM,
val analyticsCategoryName: String,
val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val userWallet: UserWallet,
val cryptoCurrencyStatus: CryptoCurrencyStatus,
val feeCryptoCurrencyStatus: CryptoCurrencyStatus,

View file

@ -104,6 +104,7 @@ internal class SendModel @Inject constructor(
private val cryptoCurrency = params.currency
val analyticCategoryName = CommonSendAnalyticEvents.SEND_CATEGORY
val analyticsSendSource = CommonSendAnalyticEvents.CommonSendSource.Send
val uiState: StateFlow<SendUM>
field = MutableStateFlow(initialState())

View file

@ -49,6 +49,7 @@ internal class DefaultNFTSendComponent @AssistedInject constructor(
private val stackNavigation = StackNavigation<CommonSendRoute>()
private val analyticsCategoryName = CommonSendAnalyticEvents.NFT_SEND_CATEGORY
private val analyticsSendSource = CommonSendAnalyticEvents.CommonSendSource.NFT
private val innerRouter = InnerRouter<CommonSendRoute>(
stackNavigation = stackNavigation,
@ -83,7 +84,10 @@ internal class DefaultNFTSendComponent @AssistedInject constructor(
when (val activeComponent = stack.active.instance) {
is NFTSendConfirmComponent -> {
analyticsEventHandler.send(
CommonSendAnalyticEvents.ConfirmationScreenOpened(categoryName = analyticsCategoryName),
CommonSendAnalyticEvents.ConfirmationScreenOpened(
categoryName = analyticsCategoryName,
source = analyticsSendSource,
),
)
if (model.currentRouteFlow.value.isEditMode) {
activeComponent.updateState(model.uiState.value)
@ -91,13 +95,19 @@ internal class DefaultNFTSendComponent @AssistedInject constructor(
}
is DefaultSendDestinationComponent -> {
analyticsEventHandler.send(
CommonSendAnalyticEvents.AddressScreenOpened(categoryName = analyticsCategoryName),
CommonSendAnalyticEvents.AddressScreenOpened(
categoryName = analyticsCategoryName,
source = analyticsSendSource,
),
)
activeComponent.updateState(model.uiState.value.destinationUM)
}
is SendFeeComponent -> {
analyticsEventHandler.send(
CommonSendAnalyticEvents.FeeScreenOpened(categoryName = analyticsCategoryName),
CommonSendAnalyticEvents.FeeScreenOpened(
categoryName = analyticsCategoryName,
source = analyticsSendSource,
),
)
}
}
@ -135,6 +145,7 @@ internal class DefaultNFTSendComponent @AssistedInject constructor(
isBalanceHidingFlow = model.isBalanceHiddenFlow,
title = resourceReference(R.string.nft_send),
analyticsCategoryName = analyticsCategoryName,
analyticsSendSource = analyticsSendSource,
userWalletId = params.userWalletId,
cryptoCurrency = model.cryptoCurrency,
callback = model,
@ -159,6 +170,7 @@ internal class DefaultNFTSendComponent @AssistedInject constructor(
onLoadFee = model::loadFee,
destinationAddress = destinationAddress,
callback = model,
analyticsSendSource = analyticsSendSource,
),
)
} else {
@ -181,6 +193,7 @@ internal class DefaultNFTSendComponent @AssistedInject constructor(
currentRoute = model.currentRouteFlow.filterIsInstance<CommonSendRoute.Confirm>(),
isBalanceHidingFlow = model.isBalanceHiddenFlow,
onLoadFee = model::loadFee,
analyticsSendSource = analyticsSendSource,
onSendTransaction = { innerRouter.replaceAll(CommonSendRoute.ConfirmSuccess) },
),
)
@ -198,6 +211,7 @@ internal class DefaultNFTSendComponent @AssistedInject constructor(
params = NFTSendSuccessComponent.Params(
nftSendUMFlow = model.uiState,
analyticsCategoryName = analyticsCategoryName,
analyticsSendSource = analyticsSendSource,
userWallet = model.userWallet,
cryptoCurrencyStatus = model.cryptoCurrencyStatus,
nftAsset = params.nftAsset,

View file

@ -20,6 +20,7 @@ import com.tangem.domain.transaction.error.GetFeeError
import com.tangem.features.nft.component.NFTDetailsBlockComponent
import com.tangem.features.send.v2.api.FeeSelectorBlockComponent
import com.tangem.features.send.v2.api.SendNotificationsComponent
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.entity.PredefinedValues
import com.tangem.features.send.v2.api.params.FeeSelectorParams
import com.tangem.features.send.v2.api.params.FeeSelectorParams.FeeStateConfiguration
@ -57,6 +58,7 @@ internal class NFTSendConfirmComponent @AssistedInject constructor(
params = DestinationBlockParams(
state = model.uiState.value.destinationUM,
analyticsCategoryName = params.analyticsCategoryName,
analyticsSendSource = params.analyticsSendSource,
userWalletId = params.userWallet.walletId,
cryptoCurrency = params.cryptoCurrencyStatus.currency,
blockClickEnableFlow = blockClickEnableFlow.asStateFlow(),
@ -79,6 +81,7 @@ internal class NFTSendConfirmComponent @AssistedInject constructor(
onLoadFee = params.onLoadFee,
destinationAddress = model.confirmData.enteredDestination.orEmpty(),
blockClickEnableFlow = blockClickEnableFlow.asStateFlow(),
analyticsSendSource = params.analyticsSendSource,
),
onResult = model::onFeeResult,
onClick = model::showEditFee,
@ -94,6 +97,7 @@ internal class NFTSendConfirmComponent @AssistedInject constructor(
feeStateConfiguration = FeeStateConfiguration.None,
feeDisplaySource = FeeSelectorParams.FeeDisplaySource.Screen,
analyticsCategoryName = params.analyticsCategoryName,
analyticsSendSource = params.analyticsSendSource,
),
onResult = model::onFeeResult,
)
@ -162,6 +166,7 @@ internal class NFTSendConfirmComponent @AssistedInject constructor(
data class Params(
val state: NFTSendUM,
val analyticsCategoryName: String,
val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val userWallet: UserWallet,
val appCurrency: AppCurrency,
val nftAsset: NFTAsset,

View file

@ -14,6 +14,7 @@ import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.nft.models.NFTAsset
import com.tangem.features.nft.component.NFTDetailsBlockComponent
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.entity.PredefinedValues
import com.tangem.features.send.v2.api.subcomponents.destination.SendDestinationBlockComponent
import com.tangem.features.send.v2.api.subcomponents.destination.SendDestinationComponentParams.DestinationBlockParams
@ -54,6 +55,7 @@ internal class NFTSendSuccessComponent @AssistedInject constructor(
params = DestinationBlockParams(
state = model.uiState.value.destinationUM,
analyticsCategoryName = params.analyticsCategoryName,
analyticsSendSource = params.analyticsSendSource,
userWalletId = params.userWallet.walletId,
cryptoCurrency = params.cryptoCurrencyStatus.currency,
blockClickEnableFlow = MutableStateFlow(false),
@ -77,6 +79,7 @@ internal class NFTSendSuccessComponent @AssistedInject constructor(
data class Params(
val nftSendUMFlow: StateFlow<NFTSendUM>,
val analyticsCategoryName: String,
val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val currentRoute: Flow<CommonSendRoute>,
val cryptoCurrencyStatus: CryptoCurrencyStatus,
val userWallet: UserWallet,

View file

@ -6,6 +6,7 @@ import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.entity.PredefinedValues
import com.tangem.features.send.v2.common.CommonSendRoute
import com.tangem.features.send.v2.subcomponents.amount.SendAmountComponent.ModelCallback
@ -15,6 +16,7 @@ internal sealed class SendAmountComponentParams {
abstract val state: AmountState
abstract val analyticsCategoryName: String
abstract val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource
abstract val userWalletId: UserWalletId
abstract val appCurrency: AppCurrency
abstract val predefinedValues: PredefinedValues
@ -33,6 +35,7 @@ internal sealed class SendAmountComponentParams {
override val cryptoCurrency: CryptoCurrency,
override val cryptoCurrencyStatusFlow: StateFlow<CryptoCurrencyStatus>,
override val isBalanceHidingFlow: StateFlow<Boolean>,
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val callback: ModelCallback,
val currentRoute: StateFlow<CommonSendRoute>,
) : SendAmountComponentParams()
@ -47,6 +50,7 @@ internal sealed class SendAmountComponentParams {
override val cryptoCurrency: CryptoCurrency,
override val cryptoCurrencyStatusFlow: StateFlow<CryptoCurrencyStatus>,
override val isBalanceHidingFlow: StateFlow<Boolean>,
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val userWallet: UserWallet,
val blockClickEnableFlow: StateFlow<Boolean>,
) : SendAmountComponentParams()

View file

@ -246,6 +246,7 @@ internal class SendAmountModel @Inject constructor(
categoryName = analyticsCategoryName,
token = params.cryptoCurrency.symbol,
blockchain = params.cryptoCurrency.network.name,
source = params.analyticsSendSource,
),
)
}

View file

@ -3,6 +3,7 @@ package com.tangem.features.send.v2.subcomponents.destination.analytics
import com.tangem.core.analytics.models.AnalyticsEvent
import com.tangem.core.analytics.models.AnalyticsParam.Key.SOURCE
import com.tangem.core.analytics.models.AnalyticsParam.Key.VALIDATION
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
internal sealed class SendDestinationAnalyticEvents(
category: String,
@ -15,13 +16,15 @@ internal sealed class SendDestinationAnalyticEvents(
/** Address to send entered */
data class AddressEntered(
override val categoryName: String,
val source: EnterAddressSource,
val method: EnterAddressSource,
val isValid: Boolean,
val source: CommonSendAnalyticEvents.CommonSendSource,
) : SendDestinationAnalyticEvents(
category = categoryName,
event = "Address Entered",
params = mapOf(
SOURCE to source.name,
SOURCE to source.analyticsName,
"Method" to method.name,
VALIDATION to if (isValid) "Success" else "Fail",
),
)

View file

@ -275,7 +275,8 @@ internal class SendDestinationModel @Inject constructor(
analyticsEventHandler.send(
SendDestinationAnalyticEvents.AddressEntered(
categoryName = analyticsCategoryName,
source = it,
source = params.analyticsSendSource,
method = it,
isValid = addressValidationResult.isRight(),
),
)

View file

@ -6,6 +6,7 @@ import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.transaction.error.GetFeeError
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.common.CommonSendRoute
import com.tangem.features.send.v2.subcomponents.fee.ui.state.FeeUM
import kotlinx.coroutines.flow.Flow
@ -23,6 +24,7 @@ internal sealed class SendFeeComponentParams {
abstract val sendAmount: BigDecimal
abstract val destinationAddress: String
abstract val onLoadFee: suspend () -> Either<GetFeeError, TransactionFee>
abstract val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource
data class FeeParams(
override val state: FeeUM,
@ -34,6 +36,7 @@ internal sealed class SendFeeComponentParams {
override val sendAmount: BigDecimal,
override val destinationAddress: String,
override val onLoadFee: suspend () -> Either<GetFeeError, TransactionFee>,
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val currentRoute: Flow<CommonSendRoute.Fee>,
val callback: SendFeeComponent.ModelCallback,
) : SendFeeComponentParams()
@ -48,6 +51,7 @@ internal sealed class SendFeeComponentParams {
override val sendAmount: BigDecimal,
override val destinationAddress: String,
override val onLoadFee: suspend () -> Either<GetFeeError, TransactionFee>,
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val blockClickEnableFlow: StateFlow<Boolean>,
) : SendFeeComponentParams()
}

View file

@ -156,6 +156,7 @@ internal class SendFeeModel @Inject constructor(
CommonSendFeeAnalyticEvents.SelectedFee(
categoryName = analyticsCategoryName,
feeType = feeSelectorUM.selectedType.toAnalyticType(feeSelectorUM),
source = params.analyticsSendSource,
),
)

View file

@ -6,6 +6,7 @@ import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.swap.models.SwapDirection
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.swap.v2.impl.amount.entity.SwapAmountUM
import com.tangem.features.swap.v2.impl.sendviaswap.SendWithSwapRoute
import kotlinx.coroutines.flow.Flow
@ -15,6 +16,7 @@ internal sealed class SwapAmountComponentParams {
abstract val amountUM: SwapAmountUM
abstract val analyticsCategoryName: String
abstract val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource
abstract val userWallet: UserWallet
abstract val swapDirection: SwapDirection
abstract val isBalanceHidingFlow: StateFlow<Boolean>
@ -31,6 +33,7 @@ internal sealed class SwapAmountComponentParams {
override val primaryCryptoCurrencyStatusFlow: StateFlow<CryptoCurrencyStatus>,
override val secondaryCryptoCurrency: CryptoCurrency?,
override val filterProviderTypes: List<ExpressProviderType> = emptyList(),
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val title: TextReference,
val callback: SwapAmountComponent.ModelCallback,
val currentRoute: Flow<SendWithSwapRoute>,
@ -45,6 +48,7 @@ internal sealed class SwapAmountComponentParams {
override val primaryCryptoCurrencyStatusFlow: StateFlow<CryptoCurrencyStatus>,
override val secondaryCryptoCurrency: CryptoCurrency?,
override val filterProviderTypes: List<ExpressProviderType> = emptyList(),
override val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val blockClickEnableFlow: StateFlow<Boolean>,
) : SwapAmountComponentParams()
}

View file

@ -224,6 +224,7 @@ internal class SwapAmountModel @Inject constructor(
categoryName = params.analyticsCategoryName,
token = primaryCryptoCurrency.symbol,
blockchain = primaryCryptoCurrency.network.name,
source = params.analyticsSendSource,
),
)
uiState.transformerUpdate(

View file

@ -84,13 +84,19 @@ internal class DefaultSendWithSwapComponent @AssistedInject constructor(
when (val activeComponent = stack.active.instance) {
is SwapAmountComponent -> {
analyticsEventHandler.send(
CommonSendAnalyticEvents.AmountScreenOpened(categoryName = model.analyticCategoryName),
CommonSendAnalyticEvents.AmountScreenOpened(
categoryName = model.analyticCategoryName,
source = model.analyticsSendSource,
),
)
activeComponent.updateState(model.uiState.value.amountUM)
}
is SendDestinationComponent -> {
analyticsEventHandler.send(
CommonSendAnalyticEvents.AddressScreenOpened(categoryName = model.analyticCategoryName),
CommonSendAnalyticEvents.AddressScreenOpened(
categoryName = model.analyticCategoryName,
source = model.analyticsSendSource,
),
)
activeComponent.updateState(model.uiState.value.destinationUM)
}
@ -98,6 +104,7 @@ internal class DefaultSendWithSwapComponent @AssistedInject constructor(
analyticsEventHandler.send(
CommonSendAnalyticEvents.ConfirmationScreenOpened(
categoryName = model.analyticCategoryName,
source = model.analyticsSendSource,
),
)
if (model.currentRoute.value.isEditMode) {
@ -145,6 +152,7 @@ internal class DefaultSendWithSwapComponent @AssistedInject constructor(
callback = model,
userWallet = model.userWallet,
filterProviderTypes = SEND_WITH_SWAP_PROVIDER_TYPES,
analyticsSendSource = model.analyticsSendSource,
),
)
}
@ -162,6 +170,7 @@ internal class DefaultSendWithSwapComponent @AssistedInject constructor(
currentRoute = model.currentRoute.filterIsInstance<DestinationRoute>(),
isBalanceHidingFlow = model.isBalanceHiddenFlow,
analyticsCategoryName = model.analyticCategoryName,
analyticsSendSource = model.analyticsSendSource,
title = resourceReference(R.string.common_address),
userWalletId = params.userWalletId,
cryptoCurrency = secondaryCryptoCurrency,
@ -183,6 +192,7 @@ internal class DefaultSendWithSwapComponent @AssistedInject constructor(
analyticsCategoryName = model.analyticCategoryName,
primaryCryptoCurrencyStatusFlow = model.primaryCryptoCurrencyStatusFlow,
primaryFeePaidCurrencyStatusFlow = model.primaryFeePaidCurrencyStatusFlow,
analyticsSendSource = model.analyticsSendSource,
swapDirection = SwapDirection.Direct,
),
)

View file

@ -17,6 +17,7 @@ import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.swap.models.SwapDirection
import com.tangem.features.send.v2.api.FeeSelectorBlockComponent
import com.tangem.features.send.v2.api.SendNotificationsComponent
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.entity.PredefinedValues
import com.tangem.features.send.v2.api.params.FeeSelectorParams.*
import com.tangem.features.send.v2.api.subcomponents.destination.SendDestinationBlockComponent
@ -62,6 +63,7 @@ internal class SendWithSwapConfirmComponent @AssistedInject constructor(
isBalanceHidingFlow = params.isBalanceHidingFlow,
swapDirection = params.swapDirection,
filterProviderTypes = SEND_WITH_SWAP_PROVIDER_TYPES,
analyticsSendSource = params.analyticsSendSource,
),
onResult = model::onAmountResult,
onClick = model::showEditAmount,
@ -72,6 +74,7 @@ internal class SendWithSwapConfirmComponent @AssistedInject constructor(
params = SendDestinationComponentParams.DestinationBlockParams(
state = model.uiState.value.destinationUM,
analyticsCategoryName = params.analyticsCategoryName,
analyticsSendSource = params.analyticsSendSource,
userWalletId = params.userWallet.walletId,
blockClickEnableFlow = blockClickEnableFlow.asStateFlow(),
cryptoCurrency = model.secondaryCurrency,
@ -91,6 +94,7 @@ internal class SendWithSwapConfirmComponent @AssistedInject constructor(
feeStateConfiguration = FeeStateConfiguration.ExcludeLow,
feeDisplaySource = FeeDisplaySource.Screen,
analyticsCategoryName = params.analyticsCategoryName,
analyticsSendSource = params.analyticsSendSource,
),
onResult = model::onFeeResult,
)
@ -166,6 +170,7 @@ internal class SendWithSwapConfirmComponent @AssistedInject constructor(
data class Params(
val sendWithSwapUM: SendWithSwapUM,
val analyticsCategoryName: String,
val analyticsSendSource: CommonSendAnalyticEvents.CommonSendSource,
val userWallet: UserWallet,
val appCurrency: AppCurrency,
val currentRoute: Flow<SendWithSwapRoute>,

View file

@ -60,6 +60,7 @@ internal class SendWithSwapModel @Inject constructor(
private val params: SendWithSwapComponent.Params = paramsContainer.require()
val analyticCategoryName = CommonSendAnalyticEvents.SEND_CATEGORY
val analyticsSendSource = CommonSendAnalyticEvents.CommonSendSource.SendWithSwap
val initialRoute = SendWithSwapRoute.Amount(false)
val currentRoute = MutableStateFlow<SendWithSwapRoute>(initialRoute)

View file

@ -4,6 +4,7 @@ import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
import com.tangem.domain.walletconnect.WcAnalyticEvents
import com.tangem.features.send.v2.api.FeeSelectorComponent
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.params.FeeSelectorParams.FeeDisplaySource
import com.tangem.features.send.v2.api.params.FeeSelectorParams.FeeSelectorDetailsParams
import com.tangem.features.walletconnect.connections.components.AlertsComponentV2
@ -55,6 +56,7 @@ internal fun getWcCommonScreen(
feeStateConfiguration = model.feeStateConfiguration,
feeDisplaySource = FeeDisplaySource.BottomSheet,
analyticsCategoryName = WcAnalyticEvents.WC_CATEGORY_NAME,
analyticsSendSource = CommonSendAnalyticEvents.CommonSendSource.WalletConnect,
),
)
}

View file

@ -8,6 +8,7 @@ import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
import com.tangem.domain.walletconnect.WcAnalyticEvents
import com.tangem.features.send.v2.api.FeeSelectorBlockComponent
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
import com.tangem.features.send.v2.api.entity.FeeSelectorUM
import com.tangem.features.send.v2.api.params.FeeSelectorParams
import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionFeeState
@ -74,6 +75,7 @@ internal class WcSendTransactionComponent(
feeStateConfiguration = model.feeStateConfiguration,
feeDisplaySource = FeeSelectorParams.FeeDisplaySource.BottomSheet,
analyticsCategoryName = WcAnalyticEvents.WC_CATEGORY_NAME,
analyticsSendSource = CommonSendAnalyticEvents.CommonSendSource.WalletConnect,
),
onResult = model::updateFee,
)