Merge pull request #6417 from MetaMask/metrics-updates

Metrics updates
feature/default_network_editable
Whymarrh Whitby 6 years ago committed by GitHub
commit f3f6f8ca68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      ui/app/components/app/send/send-footer/send-footer.component.js
  2. 12
      ui/app/components/app/send/send-footer/send-footer.container.js
  3. 5
      ui/app/components/app/send/send-footer/tests/send-footer-container.test.js
  4. 2
      ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js
  5. 2
      ui/app/helpers/utils/metametrics.util.js
  6. 2
      ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.component.js
  7. 2
      ui/app/pages/confirm-send-ether/confirm-send-ether.component.js
  8. 22
      ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js
  9. 18
      ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/import-with-seed-phrase.component.js

@ -27,6 +27,7 @@ export default class SendFooter extends Component {
unapprovedTxs: PropTypes.object, unapprovedTxs: PropTypes.object,
update: PropTypes.func, update: PropTypes.func,
sendErrors: PropTypes.object, sendErrors: PropTypes.object,
gasChangedLabel: PropTypes.string,
} }
static contextTypes = { static contextTypes = {
@ -57,6 +58,7 @@ export default class SendFooter extends Component {
update, update,
toAccounts, toAccounts,
history, history,
gasChangedLabel,
} = this.props } = this.props
const { metricsEvent } = this.context const { metricsEvent } = this.context
@ -91,6 +93,9 @@ export default class SendFooter extends Component {
action: 'Edit Screen', action: 'Edit Screen',
name: 'Complete', name: 'Complete',
}, },
customVariables: {
gasChanged: gasChangedLabel,
},
}) })
history.push(CONFIRM_TRANSACTION_ROUTE) history.push(CONFIRM_TRANSACTION_ROUTE)
}) })

@ -31,10 +31,21 @@ import {
constructTxParams, constructTxParams,
constructUpdatedTx, constructUpdatedTx,
} from './send-footer.utils' } from './send-footer.utils'
import {
getRenderableEstimateDataForSmallButtonsFromGWEI,
getDefaultActiveButtonIndex,
} from '../../../../selectors/custom-gas'
export default connect(mapStateToProps, mapDispatchToProps)(SendFooter) export default connect(mapStateToProps, mapDispatchToProps)(SendFooter)
function mapStateToProps (state) { function mapStateToProps (state) {
const gasButtonInfo = getRenderableEstimateDataForSmallButtonsFromGWEI(state)
const gasPrice = getGasPrice(state)
const activeButtonIndex = getDefaultActiveButtonIndex(gasButtonInfo, gasPrice)
const gasChangedLabel = activeButtonIndex >= 0
? gasButtonInfo[activeButtonIndex].labelKey
: 'custom'
return { return {
amount: getSendAmount(state), amount: getSendAmount(state),
data: getSendHexData(state), data: getSendHexData(state),
@ -50,6 +61,7 @@ function mapStateToProps (state) {
tokenBalance: getTokenBalance(state), tokenBalance: getTokenBalance(state),
unapprovedTxs: getUnapprovedTxs(state), unapprovedTxs: getUnapprovedTxs(state),
sendErrors: getSendErrors(state), sendErrors: getSendErrors(state),
gasChangedLabel,
} }
} }

@ -46,6 +46,10 @@ proxyquire('../send-footer.container.js', {
}, },
'./send-footer.selectors': { isSendFormInError: (s) => `mockInError:${s}` }, './send-footer.selectors': { isSendFormInError: (s) => `mockInError:${s}` },
'./send-footer.utils': utilsStubs, './send-footer.utils': utilsStubs,
'../../../../selectors/custom-gas': {
getRenderableEstimateDataForSmallButtonsFromGWEI: (s) => ([{ labelKey: `mockLabel:${s}` }]),
getDefaultActiveButtonIndex: () => 0,
},
}) })
describe('send-footer container', () => { describe('send-footer container', () => {
@ -68,6 +72,7 @@ describe('send-footer container', () => {
tokenBalance: 'mockTokenBalance:mockState', tokenBalance: 'mockTokenBalance:mockState',
unapprovedTxs: 'mockUnapprovedTxs:mockState', unapprovedTxs: 'mockUnapprovedTxs:mockState',
sendErrors: 'mockSendErrors:mockState', sendErrors: 'mockSendErrors:mockState',
gasChangedLabel: 'mockLabel:mockState',
}) })
}) })

@ -112,7 +112,7 @@ export default class TransactionViewBalance extends PureComponent {
eventOpts: { eventOpts: {
category: 'Navigation', category: 'Navigation',
action: 'Home', action: 'Home',
name: 'Clicked Send', name: selectedToken ? 'Clicked Send: Token' : 'Clicked Send: Eth',
}, },
}) })
history.push(SEND_ROUTE) history.push(SEND_ROUTE)

@ -23,6 +23,7 @@ const METAMETRICS_CUSTOM_ERROR_FIELD = 'errorField'
const METAMETRICS_CUSTOM_ERROR_MESSAGE = 'errorMessage' const METAMETRICS_CUSTOM_ERROR_MESSAGE = 'errorMessage'
const METAMETRICS_CUSTOM_RPC_NETWORK_ID = 'networkId' const METAMETRICS_CUSTOM_RPC_NETWORK_ID = 'networkId'
const METAMETRICS_CUSTOM_RPC_CHAIN_ID = 'chainId' const METAMETRICS_CUSTOM_RPC_CHAIN_ID = 'chainId'
const METAMETRICS_CUSTOM_GAS_CHANGED = 'gasChanged'
const METAMETRICS_CUSTOM_NETWORK = 'network' const METAMETRICS_CUSTOM_NETWORK = 'network'
const METAMETRICS_CUSTOM_ENVIRONMENT_TYPE = 'environmentType' const METAMETRICS_CUSTOM_ENVIRONMENT_TYPE = 'environmentType'
@ -43,6 +44,7 @@ const customVariableNameIdMap = {
[METAMETRICS_CUSTOM_RPC_CHAIN_ID]: 2, [METAMETRICS_CUSTOM_RPC_CHAIN_ID]: 2,
[METAMETRICS_CUSTOM_ERROR_FIELD]: 1, [METAMETRICS_CUSTOM_ERROR_FIELD]: 1,
[METAMETRICS_CUSTOM_ERROR_MESSAGE]: 2, [METAMETRICS_CUSTOM_ERROR_MESSAGE]: 2,
[METAMETRICS_CUSTOM_GAS_CHANGED]: 1,
} }
const customDimensionsNameIdMap = { const customDimensionsNameIdMap = {

@ -56,7 +56,7 @@ export default class ConfirmDeployContract extends Component {
render () { render () {
return ( return (
<ConfirmTransactionBase <ConfirmTransactionBase
action={this.context.t('contractDeployment')} actionKey={'contractDeployment'}
dataComponent={this.renderData()} dataComponent={this.renderData()}
/> />
) )

@ -30,7 +30,7 @@ export default class ConfirmSendEther extends Component {
return ( return (
<ConfirmTransactionBase <ConfirmTransactionBase
action={this.context.t('confirm')} actionKey={'confirm'}
hideData={hideData} hideData={hideData}
onEdit={confirmTransactionData => this.handleEdit(confirmTransactionData)} onEdit={confirmTransactionData => this.handleEdit(confirmTransactionData)}
/> />

@ -64,7 +64,7 @@ export default class ConfirmTransactionBase extends Component {
updateGasAndCalculate: PropTypes.func, updateGasAndCalculate: PropTypes.func,
customGas: PropTypes.object, customGas: PropTypes.object,
// Component props // Component props
action: PropTypes.string, actionKey: PropTypes.string,
contentComponent: PropTypes.node, contentComponent: PropTypes.node,
dataComponent: PropTypes.node, dataComponent: PropTypes.node,
detailsComponent: PropTypes.node, detailsComponent: PropTypes.node,
@ -159,7 +159,7 @@ export default class ConfirmTransactionBase extends Component {
} }
handleEditGas () { handleEditGas () {
const { onEditGas, showCustomizeGasModal, action, txData: { origin }, methodData = {} } = this.props const { onEditGas, showCustomizeGasModal, actionKey, txData: { origin }, methodData = {} } = this.props
this.context.metricsEvent({ this.context.metricsEvent({
eventOpts: { eventOpts: {
@ -169,7 +169,7 @@ export default class ConfirmTransactionBase extends Component {
}, },
customVariables: { customVariables: {
recipientKnown: null, recipientKnown: null,
functionType: action || getMethodName(methodData.name) || this.context.t('contractInteraction'), functionType: actionKey || getMethodName(methodData.name) || 'contractInteraction',
origin, origin,
}, },
}) })
@ -292,7 +292,7 @@ export default class ConfirmTransactionBase extends Component {
} }
handleEdit () { handleEdit () {
const { txData, tokenData, tokenProps, onEdit, action, txData: { origin }, methodData = {} } = this.props const { txData, tokenData, tokenProps, onEdit, actionKey, txData: { origin }, methodData = {} } = this.props
this.context.metricsEvent({ this.context.metricsEvent({
eventOpts: { eventOpts: {
@ -302,7 +302,7 @@ export default class ConfirmTransactionBase extends Component {
}, },
customVariables: { customVariables: {
recipientKnown: null, recipientKnown: null,
functionType: action || getMethodName(methodData.name) || this.context.t('contractInteraction'), functionType: actionKey || getMethodName(methodData.name) || 'contractInteraction',
origin, origin,
}, },
}) })
@ -331,7 +331,7 @@ export default class ConfirmTransactionBase extends Component {
handleCancel () { handleCancel () {
const { metricsEvent } = this.context const { metricsEvent } = this.context
const { onCancel, txData, cancelTransaction, history, clearConfirmTransaction, action, txData: { origin }, methodData = {} } = this.props const { onCancel, txData, cancelTransaction, history, clearConfirmTransaction, actionKey, txData: { origin }, methodData = {} } = this.props
if (onCancel) { if (onCancel) {
metricsEvent({ metricsEvent({
@ -342,7 +342,7 @@ export default class ConfirmTransactionBase extends Component {
}, },
customVariables: { customVariables: {
recipientKnown: null, recipientKnown: null,
functionType: action || getMethodName(methodData.name) || this.context.t('contractInteraction'), functionType: actionKey || getMethodName(methodData.name) || 'contractInteraction',
origin, origin,
}, },
}) })
@ -358,7 +358,7 @@ export default class ConfirmTransactionBase extends Component {
handleSubmit () { handleSubmit () {
const { metricsEvent } = this.context const { metricsEvent } = this.context
const { txData: { origin }, sendTransaction, clearConfirmTransaction, txData, history, onSubmit, action, metaMetricsSendCount = 0, setMetaMetricsSendCount, methodData = {} } = this.props const { txData: { origin }, sendTransaction, clearConfirmTransaction, txData, history, onSubmit, actionKey, metaMetricsSendCount = 0, setMetaMetricsSendCount, methodData = {} } = this.props
const { submitting } = this.state const { submitting } = this.state
if (submitting) { if (submitting) {
@ -377,7 +377,7 @@ export default class ConfirmTransactionBase extends Component {
}, },
customVariables: { customVariables: {
recipientKnown: null, recipientKnown: null,
functionType: action || getMethodName(methodData.name) || this.context.t('contractInteraction'), functionType: actionKey || getMethodName(methodData.name) || 'contractInteraction',
origin, origin,
}, },
}) })
@ -517,7 +517,7 @@ export default class ConfirmTransactionBase extends Component {
valid: propsValid = true, valid: propsValid = true,
errorMessage, errorMessage,
errorKey: propsErrorKey, errorKey: propsErrorKey,
action, actionKey,
title, title,
subtitle, subtitle,
hideSubtitle, hideSubtitle,
@ -543,7 +543,7 @@ export default class ConfirmTransactionBase extends Component {
toName={toName} toName={toName}
toAddress={toAddress} toAddress={toAddress}
showEdit={onEdit && !isTxReprice} showEdit={onEdit && !isTxReprice}
action={action || getMethodName(name) || this.context.t('contractInteraction')} action={this.context.t(actionKey) || getMethodName(name) || this.context.t('contractInteraction')}
title={title} title={title}
titleComponent={this.renderTitleComponent()} titleComponent={this.renderTitleComponent()}
subtitle={subtitle} subtitle={subtitle}

@ -36,6 +36,20 @@ export default class ImportWithSeedPhrase extends PureComponent {
.join(' ') .join(' ')
} }
componentWillMount () {
window.onbeforeunload = () => this.context.metricsEvent({
eventOpts: {
category: 'Onboarding',
action: 'Import Seed Phrase',
name: 'Close window on import screen',
},
customVariables: {
errorLabel: 'Seed Phrase Error',
errorMessage: this.state.seedPhraseError,
},
})
}
handleSeedPhraseChange (seedPhrase) { handleSeedPhraseChange (seedPhrase) {
let seedPhraseError = '' let seedPhraseError = ''
@ -172,6 +186,10 @@ export default class ImportWithSeedPhrase extends PureComponent {
action: 'Import Seed Phrase', action: 'Import Seed Phrase',
name: 'Go Back from Onboarding Import', name: 'Go Back from Onboarding Import',
}, },
customVariables: {
errorLabel: 'Seed Phrase Error',
errorMessage: seedPhraseError,
},
}) })
this.props.history.push(INITIALIZE_SELECT_ACTION_ROUTE) this.props.history.push(INITIALIZE_SELECT_ACTION_ROUTE)
}} }}

Loading…
Cancel
Save