Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions app/components/UI/Earn/Views/EarnInputView/EarnInputView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -646,26 +646,27 @@ const EarnInputView = () => {
// Call the original handler first
handleCurrencySwitch();

if (shouldLogStablecoinEvent()) {
trackEvent(
createEventBuilder(MetaMetricsEvents.EARN_INPUT_CURRENCY_SWITCH_CLICKED)
.addProperties({
selected_provider: EVENT_PROVIDERS.CONSENSYS,
text: 'Currency Switch Clicked',
location: EVENT_LOCATIONS.EARN_INPUT_VIEW,
currency_type: !isFiat ? 'fiat' : 'native',
experience: earnToken?.experience?.type,
})
.build(),
);
}
trackEvent(
createEventBuilder(MetaMetricsEvents.EARN_INPUT_CURRENCY_SWITCH_CLICKED)
.addProperties({
selected_provider: EVENT_PROVIDERS.CONSENSYS,
text: 'Currency Switch Clicked',
location: EVENT_LOCATIONS.EARN_INPUT_VIEW,
currency_type: !isFiat ? 'fiat' : 'native',
experience: earnToken?.experience?.type,
token_symbol: earnToken?.symbol,
chain_id: earnToken?.chainId ? toHex(earnToken.chainId) : undefined,
})
.build(),
);
}, [
shouldLogStablecoinEvent,
handleCurrencySwitch,
trackEvent,
createEventBuilder,
isFiat,
earnToken?.experience?.type,
earnToken?.symbol,
earnToken?.chainId,
]);

const getButtonLabel = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { toHex } from '@metamask/controller-utils';
import { Hex } from '@metamask/utils';
import {
useFocusEffect,
Expand Down Expand Up @@ -576,6 +577,10 @@ const EarnWithdrawInputView = () => {
// We want to track the currency switching to. Not the current currency.
currency_type: isFiat ? 'native' : 'fiat',
experience: receiptToken?.experience?.type,
token_symbol: receiptToken?.symbol,
chain_id: receiptToken?.chainId
? toHex(receiptToken.chainId)
: undefined,
})
.build(),
);
Expand All @@ -591,6 +596,10 @@ const EarnWithdrawInputView = () => {
// We want to track the currency switching to. Not the current currency.
currency_type: isFiat ? 'native' : 'fiat',
experience: receiptToken?.experience?.type,
token_symbol: receiptToken?.symbol,
chain_id: receiptToken?.chainId
? toHex(receiptToken.chainId)
: undefined,
})
.build(),
);
Expand All @@ -603,6 +612,8 @@ const EarnWithdrawInputView = () => {
createEventBuilder,
isFiat,
receiptToken?.experience?.type,
receiptToken?.symbol,
receiptToken?.chainId,
]);

const handleQuickAmountPressWithTracking = useCallback(
Expand Down
Loading