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,
|
history,
|
||||||
mostRecentOverviewPage,
|
mostRecentOverviewPage,
|
||||||
sign,
|
sign,
|
||||||
|
txData: { type },
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
const { metricsEvent, t } = this.context;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="request-signature__footer">
|
<div className="request-signature__footer">
|
||||||
@ -296,18 +298,21 @@ export default class SignatureRequestOriginal extends Component {
|
|||||||
onClick={async (event) => {
|
onClick={async (event) => {
|
||||||
this._removeBeforeUnload();
|
this._removeBeforeUnload();
|
||||||
await cancel(event);
|
await cancel(event);
|
||||||
this.context.metricsEvent({
|
metricsEvent({
|
||||||
eventOpts: {
|
eventOpts: {
|
||||||
category: 'Transactions',
|
category: 'Transactions',
|
||||||
action: 'Sign Request',
|
action: 'Sign Request',
|
||||||
name: 'Cancel',
|
name: 'Cancel',
|
||||||
},
|
},
|
||||||
|
customVariables: {
|
||||||
|
type,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
clearConfirmTransaction();
|
clearConfirmTransaction();
|
||||||
history.push(mostRecentOverviewPage);
|
history.push(mostRecentOverviewPage);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{this.context.t('cancel')}
|
{t('cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
data-testid="request-signature__sign"
|
data-testid="request-signature__sign"
|
||||||
@ -317,18 +322,21 @@ export default class SignatureRequestOriginal extends Component {
|
|||||||
onClick={async (event) => {
|
onClick={async (event) => {
|
||||||
this._removeBeforeUnload();
|
this._removeBeforeUnload();
|
||||||
await sign(event);
|
await sign(event);
|
||||||
this.context.metricsEvent({
|
metricsEvent({
|
||||||
eventOpts: {
|
eventOpts: {
|
||||||
category: 'Transactions',
|
category: 'Transactions',
|
||||||
action: 'Sign Request',
|
action: 'Sign Request',
|
||||||
name: 'Confirm',
|
name: 'Confirm',
|
||||||
},
|
},
|
||||||
|
customVariables: {
|
||||||
|
type,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
clearConfirmTransaction();
|
clearConfirmTransaction();
|
||||||
history.push(mostRecentOverviewPage);
|
history.push(mostRecentOverviewPage);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{this.context.t('sign')}
|
{t('sign')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -33,7 +33,11 @@ export default class SignatureRequest extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_beforeUnload = (event) => {
|
_beforeUnload = (event) => {
|
||||||
const { clearConfirmTransaction, cancel } = this.props;
|
const {
|
||||||
|
clearConfirmTransaction,
|
||||||
|
cancel,
|
||||||
|
txData: { type },
|
||||||
|
} = this.props;
|
||||||
const { metricsEvent } = this.context;
|
const { metricsEvent } = this.context;
|
||||||
metricsEvent({
|
metricsEvent({
|
||||||
eventOpts: {
|
eventOpts: {
|
||||||
@ -41,6 +45,9 @@ export default class SignatureRequest extends PureComponent {
|
|||||||
action: 'Sign Request',
|
action: 'Sign Request',
|
||||||
name: 'Cancel Sig Request Via Notification Close',
|
name: 'Cancel Sig Request Via Notification Close',
|
||||||
},
|
},
|
||||||
|
customVariables: {
|
||||||
|
type,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
clearConfirmTransaction();
|
clearConfirmTransaction();
|
||||||
cancel(event);
|
cancel(event);
|
||||||
@ -57,22 +64,46 @@ export default class SignatureRequest extends PureComponent {
|
|||||||
const {
|
const {
|
||||||
fromAccount,
|
fromAccount,
|
||||||
txData: {
|
txData: {
|
||||||
msgParams: { data, origin },
|
msgParams: { data, origin, version },
|
||||||
|
type,
|
||||||
},
|
},
|
||||||
cancel,
|
cancel,
|
||||||
sign,
|
sign,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { address: fromAddress } = fromAccount;
|
const { address: fromAddress } = fromAccount;
|
||||||
const { message, domain = {} } = JSON.parse(data);
|
const { message, domain = {} } = JSON.parse(data);
|
||||||
|
const { metricsEvent } = this.context;
|
||||||
|
|
||||||
const onSign = (event) => {
|
const onSign = (event) => {
|
||||||
window.removeEventListener('beforeunload', this._beforeUnload);
|
window.removeEventListener('beforeunload', this._beforeUnload);
|
||||||
sign(event);
|
sign(event);
|
||||||
|
metricsEvent({
|
||||||
|
eventOpts: {
|
||||||
|
category: 'Transactions',
|
||||||
|
action: 'Sign Request',
|
||||||
|
name: 'Confirm',
|
||||||
|
},
|
||||||
|
customVariables: {
|
||||||
|
type,
|
||||||
|
version,
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onCancel = (event) => {
|
const onCancel = (event) => {
|
||||||
window.removeEventListener('beforeunload', this._beforeUnload);
|
window.removeEventListener('beforeunload', this._beforeUnload);
|
||||||
cancel(event);
|
cancel(event);
|
||||||
|
metricsEvent({
|
||||||
|
eventOpts: {
|
||||||
|
category: 'Transactions',
|
||||||
|
action: 'Sign Request',
|
||||||
|
name: 'Cancel',
|
||||||
|
},
|
||||||
|
customVariables: {
|
||||||
|
type,
|
||||||
|
version,
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user