Skip to content

Commit

Permalink
fix(self custody): add send submitted event
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed May 11, 2022
1 parent 0f5bdc3 commit b118780
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { SEND_FORM } from 'blockchain-wallet-v4-frontend/src/modals/SendCrypto/model'

import { actions, actionTypes as AT } from 'data'
import { convertBaseToStandard } from 'data/components/exchange/services'
import {
Expand Down Expand Up @@ -2481,26 +2483,37 @@ const analyticsMiddleware = () => (store) => (next) => (action) => {

break
}
case actions.components.nfts.nftOrderFlowOpen.type: {
case actions.components.sendCrypto.submitTransactionSuccess: {
const state = store.getState()

const nabuId = state.profile.userData.getOrElse({})?.id ?? null

const email = state.profile.userData.getOrElse({})?.emailVerified
? state.profile.userData.getOrElse({})?.email
: null
const tier = state.profile.userData.getOrElse({})?.tiers?.current ?? null
analytics.push(AnalyticsKey.NFT_ORDER_CREATED, {

const feeRate = state.form[SEND_FORM].values.fee
const currency = state.form[SEND_FORM].values.coin
const fromAccountType =
state.form[SEND_FORM].values.from.type === SwapBaseCounterTypes.CUSTODIAL
? AccountType.TRADING
: AccountType.USERKEY
const toAccountType = AccountType.USERKEY

analytics.push(AnalyticsKey.SEND_SUBMITTED, {
properties: {
currency,
fee_rate: feeRate,
from_account_type: fromAccountType,
originalTimestamp: getOriginalTimestamp(),
site_redirect: 'WALLET'
to_account_type: toAccountType
},
traits: {
email,
nabuId,
tier
}
})

break
}
default: {
Expand Down

0 comments on commit b118780

Please sign in to comment.