mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Adds sign typed data type to metrics payload for sign typed data events (#12291)
* Adding type to metrics event for eth_sign, personal_sign, eth_signTypedData * Adding type to metrics eevents for eth_signTypedData_v3 and eth_signTypedData_v4 * Factoring in version
This commit is contained in:
parent
d4c30d2613
commit
5fdf9641da
@ -285,7 +285,9 @@ export default class SignatureRequestOriginal extends Component {
|
||||
history,
|
||||
mostRecentOverviewPage,
|
||||
sign,
|
||||
txData: { type },
|
||||
} = this.props;
|
||||
const { metricsEvent, t } = this.context;
|
||||
|
||||
return (
|
||||
<div className="request-signature__footer">
|
||||
@ -296,18 +298,21 @@ export default class SignatureRequestOriginal extends Component {
|
||||
onClick={async (event) => {
|
||||
this._removeBeforeUnload();
|
||||
await cancel(event);
|
||||
this.context.metricsEvent({
|
||||
metricsEvent({
|
||||
eventOpts: {
|
||||
category: 'Transactions',
|
||||
action: 'Sign Request',
|
||||
name: 'Cancel',
|
||||
},
|
||||
customVariables: {
|
||||
type,
|
||||
},
|
||||
});
|
||||
clearConfirmTransaction();
|
||||
history.push(mostRecentOverviewPage);
|
||||
}}
|
||||
>
|
||||
{this.context.t('cancel')}
|
||||
{t('cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
data-testid="request-signature__sign"
|
||||
@ -317,18 +322,21 @@ export default class SignatureRequestOriginal extends Component {
|
||||
onClick={async (event) => {
|
||||
this._removeBeforeUnload();
|
||||
await sign(event);
|
||||
this.context.metricsEvent({
|
||||
metricsEvent({
|
||||
eventOpts: {
|
||||
category: 'Transactions',
|
||||
action: 'Sign Request',
|
||||
name: 'Confirm',
|
||||
},
|
||||
customVariables: {
|
||||
type,
|
||||
},
|
||||
});
|
||||
clearConfirmTransaction();
|
||||
history.push(mostRecentOverviewPage);
|
||||
}}
|
||||
>
|
||||
{this.context.t('sign')}
|
||||
{t('sign')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
|
@ -33,7 +33,11 @@ export default class SignatureRequest extends PureComponent {
|
||||
}
|
||||
|
||||
_beforeUnload = (event) => {
|
||||
const { clearConfirmTransaction, cancel } = this.props;
|
||||
const {
|
||||
clearConfirmTransaction,
|
||||
cancel,
|
||||
txData: { type },
|
||||
} = this.props;
|
||||
const { metricsEvent } = this.context;
|
||||
metricsEvent({
|
||||
eventOpts: {
|
||||
@ -41,6 +45,9 @@ export default class SignatureRequest extends PureComponent {
|
||||
action: 'Sign Request',
|
||||
name: 'Cancel Sig Request Via Notification Close',
|
||||
},
|
||||
customVariables: {
|
||||
type,
|
||||
},
|
||||
});
|
||||
clearConfirmTransaction();
|
||||
cancel(event);
|
||||
@ -57,22 +64,46 @@ export default class SignatureRequest extends PureComponent {
|
||||
const {
|
||||
fromAccount,
|
||||
txData: {
|
||||
msgParams: { data, origin },
|
||||
msgParams: { data, origin, version },
|
||||
type,
|
||||
},
|
||||
cancel,
|
||||
sign,
|
||||
} = this.props;
|
||||
const { address: fromAddress } = fromAccount;
|
||||
const { message, domain = {} } = JSON.parse(data);
|
||||
const { metricsEvent } = this.context;
|
||||
|
||||
const onSign = (event) => {
|
||||
window.removeEventListener('beforeunload', this._beforeUnload);
|
||||
sign(event);
|
||||
metricsEvent({
|
||||
eventOpts: {
|
||||
category: 'Transactions',
|
||||
action: 'Sign Request',
|
||||
name: 'Confirm',
|
||||
},
|
||||
customVariables: {
|
||||
type,
|
||||
version,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const onCancel = (event) => {
|
||||
window.removeEventListener('beforeunload', this._beforeUnload);
|
||||
cancel(event);
|
||||
metricsEvent({
|
||||
eventOpts: {
|
||||
category: 'Transactions',
|
||||
action: 'Sign Request',
|
||||
name: 'Cancel',
|
||||
},
|
||||
customVariables: {
|
||||
type,
|
||||
version,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user