mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 09:23:21 +01:00
Convert shared/constants/metametrics to TS (#18353)
We want to convert NetworkController to TypeScript in order to be able to compare differences in the controller between in this repo and the core repo. To do this, however, we need to convert the dependencies of the controller to TypeScript. As a part of this effort, this commit converts `shared/constants/metametrics` to TypeScript. Note that simple objects have been largely replaced with enums. There are some cases where I even split up some of these objects into multiple enums. Co-authored-by: Mark Stacey <markjstacey@gmail.com>
This commit is contained in:
parent
18a304199c
commit
1304ec7af5
@ -24,11 +24,11 @@ import {
|
||||
} from '../../shared/constants/app';
|
||||
import { SECOND } from '../../shared/constants/time';
|
||||
import {
|
||||
REJECT_NOTFICIATION_CLOSE,
|
||||
REJECT_NOTFICIATION_CLOSE_SIG,
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
TRAITS,
|
||||
REJECT_NOTIFICATION_CLOSE,
|
||||
REJECT_NOTIFICATION_CLOSE_SIG,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsUserTrait,
|
||||
} from '../../shared/constants/metametrics';
|
||||
import { checkForLastErrorAndLog } from '../../shared/modules/browser-runtime.utils';
|
||||
import { isManifestV3 } from '../../shared/modules/mv3.utils';
|
||||
@ -738,13 +738,13 @@ export function setupController(initState, initLangCode, overrides) {
|
||||
).forEach((txId) =>
|
||||
controller.txController.txStateManager.setTxStatusRejected(txId),
|
||||
);
|
||||
controller.signController.rejectUnapproved(REJECT_NOTFICIATION_CLOSE_SIG);
|
||||
controller.signController.rejectUnapproved(REJECT_NOTIFICATION_CLOSE_SIG);
|
||||
controller.decryptMessageManager.messages
|
||||
.filter((msg) => msg.status === 'unapproved')
|
||||
.forEach((tx) =>
|
||||
controller.decryptMessageManager.rejectMsg(
|
||||
tx.id,
|
||||
REJECT_NOTFICIATION_CLOSE,
|
||||
REJECT_NOTIFICATION_CLOSE,
|
||||
),
|
||||
);
|
||||
controller.encryptionPublicKeyManager.messages
|
||||
@ -752,7 +752,7 @@ export function setupController(initState, initLangCode, overrides) {
|
||||
.forEach((tx) =>
|
||||
controller.encryptionPublicKeyManager.rejectMsg(
|
||||
tx.id,
|
||||
REJECT_NOTFICIATION_CLOSE,
|
||||
REJECT_NOTIFICATION_CLOSE,
|
||||
),
|
||||
);
|
||||
|
||||
@ -848,11 +848,13 @@ async function openPopup() {
|
||||
const addAppInstalledEvent = () => {
|
||||
if (controller) {
|
||||
controller.metaMetricsController.updateTraits({
|
||||
[TRAITS.INSTALL_DATE_EXT]: new Date().toISOString().split('T')[0], // yyyy-mm-dd
|
||||
[MetaMetricsUserTrait.InstallDateExt]: new Date()
|
||||
.toISOString()
|
||||
.split('T')[0], // yyyy-mm-dd
|
||||
});
|
||||
controller.metaMetricsController.addEventBeforeMetricsOptIn({
|
||||
category: EVENT.CATEGORIES.APP,
|
||||
event: EVENT_NAMES.APP_INSTALLED,
|
||||
category: MetaMetricsEventCategory.App,
|
||||
event: MetaMetricsEventName.AppInstalled,
|
||||
properties: {},
|
||||
});
|
||||
return;
|
||||
|
@ -8,7 +8,10 @@ import {
|
||||
AssetType,
|
||||
TokenStandard,
|
||||
} from '../../../shared/constants/transaction';
|
||||
import { EVENT, EVENT_NAMES } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
|
||||
// By default, poll every 3 minutes
|
||||
const DEFAULT_INTERVAL = MINUTE * 3;
|
||||
@ -167,8 +170,8 @@ export default class DetectTokensController {
|
||||
|
||||
if (tokensWithBalance.length > 0) {
|
||||
this._trackMetaMetricsEvent({
|
||||
event: EVENT_NAMES.TOKEN_DETECTED,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.TokenDetected,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
properties: {
|
||||
tokens: eventTokensDetails,
|
||||
token_standard: TokenStandard.ERC20,
|
||||
|
@ -15,7 +15,7 @@ import { ENVIRONMENT_TYPE_BACKGROUND } from '../../../shared/constants/app';
|
||||
import {
|
||||
METAMETRICS_ANONYMOUS_ID,
|
||||
METAMETRICS_BACKGROUND_PAGE_OBJECT,
|
||||
TRAITS,
|
||||
MetaMetricsUserTrait,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import { SECOND } from '../../../shared/constants/time';
|
||||
import { isManifestV3 } from '../../../shared/modules/mv3.utils';
|
||||
@ -692,38 +692,44 @@ export default class MetaMetricsController {
|
||||
const { traits, previousUserTraits } = this.store.getState();
|
||||
/** @type {MetaMetricsTraits} */
|
||||
const currentTraits = {
|
||||
[TRAITS.ADDRESS_BOOK_ENTRIES]: sum(
|
||||
[MetaMetricsUserTrait.AddressBookEntries]: sum(
|
||||
Object.values(metamaskState.addressBook).map(size),
|
||||
),
|
||||
[TRAITS.INSTALL_DATE_EXT]: traits[TRAITS.INSTALL_DATE_EXT] || '',
|
||||
[TRAITS.LEDGER_CONNECTION_TYPE]: metamaskState.ledgerTransportType,
|
||||
[TRAITS.NETWORKS_ADDED]: Object.values(
|
||||
[MetaMetricsUserTrait.InstallDateExt]:
|
||||
traits[MetaMetricsUserTrait.InstallDateExt] || '',
|
||||
[MetaMetricsUserTrait.LedgerConnectionType]:
|
||||
metamaskState.ledgerTransportType,
|
||||
[MetaMetricsUserTrait.NetworksAdded]: Object.values(
|
||||
metamaskState.networkConfigurations,
|
||||
).map((networkConfiguration) => networkConfiguration.chainId),
|
||||
[TRAITS.NETWORKS_WITHOUT_TICKER]: Object.values(
|
||||
[MetaMetricsUserTrait.NetworksWithoutTicker]: Object.values(
|
||||
metamaskState.networkConfigurations,
|
||||
)
|
||||
.filter(({ ticker }) => !ticker)
|
||||
.map(({ chainId }) => chainId),
|
||||
[TRAITS.NFT_AUTODETECTION_ENABLED]: metamaskState.useNftDetection,
|
||||
[TRAITS.NUMBER_OF_ACCOUNTS]: Object.values(metamaskState.identities)
|
||||
.length,
|
||||
[TRAITS.NUMBER_OF_NFT_COLLECTIONS]: this._getAllUniqueNFTAddressesLength(
|
||||
[MetaMetricsUserTrait.NftAutodetectionEnabled]:
|
||||
metamaskState.useNftDetection,
|
||||
[MetaMetricsUserTrait.NumberOfAccounts]: Object.values(
|
||||
metamaskState.identities,
|
||||
).length,
|
||||
[MetaMetricsUserTrait.NumberOfNftCollections]:
|
||||
this._getAllUniqueNFTAddressesLength(metamaskState.allNfts),
|
||||
[MetaMetricsUserTrait.NumberOfNfts]: this._getAllNFTsFlattened(
|
||||
metamaskState.allNfts,
|
||||
),
|
||||
[TRAITS.NUMBER_OF_NFTS]: this._getAllNFTsFlattened(metamaskState.allNfts)
|
||||
.length,
|
||||
[TRAITS.NUMBER_OF_TOKENS]: this._getNumberOfTokens(metamaskState),
|
||||
[TRAITS.OPENSEA_API_ENABLED]: metamaskState.openSeaEnabled,
|
||||
[TRAITS.THREE_BOX_ENABLED]: false, // deprecated, hard-coded as false
|
||||
[TRAITS.THEME]: metamaskState.theme || 'default',
|
||||
[TRAITS.TOKEN_DETECTION_ENABLED]: metamaskState.useTokenDetection,
|
||||
).length,
|
||||
[MetaMetricsUserTrait.NumberOfTokens]:
|
||||
this._getNumberOfTokens(metamaskState),
|
||||
[MetaMetricsUserTrait.OpenseaApiEnabled]: metamaskState.openSeaEnabled,
|
||||
[MetaMetricsUserTrait.ThreeBoxEnabled]: false, // deprecated, hard-coded as false
|
||||
[MetaMetricsUserTrait.Theme]: metamaskState.theme || 'default',
|
||||
[MetaMetricsUserTrait.TokenDetectionEnabled]:
|
||||
metamaskState.useTokenDetection,
|
||||
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
||||
[TRAITS.DESKTOP_ENABLED]: metamaskState.desktopEnabled || false,
|
||||
[MetaMetricsUserTrait.DesktopEnabled]:
|
||||
metamaskState.desktopEnabled || false,
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
[TRAITS.SECURITY_PROVIDERS]: metamaskState.transactionSecurityCheckEnabled
|
||||
? ['opensea']
|
||||
: [],
|
||||
[MetaMetricsUserTrait.SecurityProviders]:
|
||||
metamaskState.transactionSecurityCheckEnabled ? ['opensea'] : [],
|
||||
};
|
||||
|
||||
if (!previousUserTraits) {
|
||||
|
@ -5,7 +5,7 @@ import { createSegmentMock } from '../lib/segment';
|
||||
import {
|
||||
METAMETRICS_ANONYMOUS_ID,
|
||||
METAMETRICS_BACKGROUND_PAGE_OBJECT,
|
||||
TRAITS,
|
||||
MetaMetricsUserTrait,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import waitUntilCalled from '../../../test/lib/wait-until-called';
|
||||
import {
|
||||
@ -953,22 +953,26 @@ describe('MetaMetricsController', function () {
|
||||
});
|
||||
|
||||
assert.deepEqual(traits, {
|
||||
[TRAITS.ADDRESS_BOOK_ENTRIES]: 3,
|
||||
[TRAITS.INSTALL_DATE_EXT]: '',
|
||||
[TRAITS.LEDGER_CONNECTION_TYPE]: 'web-hid',
|
||||
[TRAITS.NETWORKS_ADDED]: [CHAIN_IDS.MAINNET, CHAIN_IDS.GOERLI, '0xaf'],
|
||||
[TRAITS.NETWORKS_WITHOUT_TICKER]: ['0xaf'],
|
||||
[TRAITS.NFT_AUTODETECTION_ENABLED]: false,
|
||||
[TRAITS.NUMBER_OF_ACCOUNTS]: 2,
|
||||
[TRAITS.NUMBER_OF_NFT_COLLECTIONS]: 3,
|
||||
[TRAITS.NUMBER_OF_NFTS]: 4,
|
||||
[TRAITS.NUMBER_OF_TOKENS]: 5,
|
||||
[TRAITS.OPENSEA_API_ENABLED]: true,
|
||||
[TRAITS.THREE_BOX_ENABLED]: false,
|
||||
[TRAITS.THEME]: 'default',
|
||||
[TRAITS.TOKEN_DETECTION_ENABLED]: true,
|
||||
[TRAITS.DESKTOP_ENABLED]: false,
|
||||
[TRAITS.SECURITY_PROVIDERS]: [],
|
||||
[MetaMetricsUserTrait.AddressBookEntries]: 3,
|
||||
[MetaMetricsUserTrait.InstallDateExt]: '',
|
||||
[MetaMetricsUserTrait.LedgerConnectionType]: 'web-hid',
|
||||
[MetaMetricsUserTrait.NetworksAdded]: [
|
||||
CHAIN_IDS.MAINNET,
|
||||
CHAIN_IDS.GOERLI,
|
||||
'0xaf',
|
||||
],
|
||||
[MetaMetricsUserTrait.NetworksWithoutTicker]: ['0xaf'],
|
||||
[MetaMetricsUserTrait.NftAutodetectionEnabled]: false,
|
||||
[MetaMetricsUserTrait.NumberOfAccounts]: 2,
|
||||
[MetaMetricsUserTrait.NumberOfNftCollections]: 3,
|
||||
[MetaMetricsUserTrait.NumberOfNfts]: 4,
|
||||
[MetaMetricsUserTrait.NumberOfTokens]: 5,
|
||||
[MetaMetricsUserTrait.OpenseaApiEnabled]: true,
|
||||
[MetaMetricsUserTrait.ThreeBoxEnabled]: false,
|
||||
[MetaMetricsUserTrait.Theme]: 'default',
|
||||
[MetaMetricsUserTrait.TokenDetectionEnabled]: true,
|
||||
[MetaMetricsUserTrait.DesktopEnabled]: false,
|
||||
[MetaMetricsUserTrait.SecurityProviders]: [],
|
||||
});
|
||||
});
|
||||
|
||||
@ -1015,10 +1019,10 @@ describe('MetaMetricsController', function () {
|
||||
});
|
||||
|
||||
assert.deepEqual(updatedTraits, {
|
||||
[TRAITS.ADDRESS_BOOK_ENTRIES]: 4,
|
||||
[TRAITS.NUMBER_OF_ACCOUNTS]: 3,
|
||||
[TRAITS.NUMBER_OF_TOKENS]: 1,
|
||||
[TRAITS.OPENSEA_API_ENABLED]: false,
|
||||
[MetaMetricsUserTrait.AddressBookEntries]: 4,
|
||||
[MetaMetricsUserTrait.NumberOfAccounts]: 3,
|
||||
[MetaMetricsUserTrait.NumberOfTokens]: 1,
|
||||
[MetaMetricsUserTrait.OpenseaApiEnabled]: false,
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -26,7 +26,7 @@ import {
|
||||
isPrefixedFormattedHexString,
|
||||
isSafeChainId,
|
||||
} from '../../../../shared/modules/network.utils';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import { createNetworkClient } from './create-network-client';
|
||||
|
||||
/**
|
||||
@ -645,7 +645,7 @@ export default class NetworkController extends EventEmitter {
|
||||
if (!oldNetworkConfigurationId) {
|
||||
this._trackMetaMetricsEvent({
|
||||
event: 'Custom Network Added',
|
||||
category: EVENT.CATEGORIES.NETWORK,
|
||||
category: MetaMetricsEventCategory.Network,
|
||||
referrer: {
|
||||
url: referrer,
|
||||
},
|
||||
|
@ -5,7 +5,7 @@ import nock from 'nock';
|
||||
import sinon from 'sinon';
|
||||
import { ControllerMessenger } from '@metamask/base-controller';
|
||||
import { BUILT_IN_NETWORKS } from '../../../../shared/constants/network';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsNetworkEventSource } from '../../../../shared/constants/metametrics';
|
||||
import NetworkController from './network-controller';
|
||||
|
||||
jest.mock('uuid', () => {
|
||||
@ -6991,7 +6991,7 @@ describe('NetworkController', () => {
|
||||
},
|
||||
{
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
},
|
||||
),
|
||||
).toThrow(
|
||||
@ -7015,7 +7015,7 @@ describe('NetworkController', () => {
|
||||
},
|
||||
{
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
},
|
||||
),
|
||||
).toThrow(
|
||||
@ -7038,7 +7038,7 @@ describe('NetworkController', () => {
|
||||
},
|
||||
{
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
},
|
||||
),
|
||||
).toThrow(
|
||||
@ -7062,7 +7062,7 @@ describe('NetworkController', () => {
|
||||
},
|
||||
{
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
},
|
||||
),
|
||||
).toThrow(new Error('rpcUrl must be a valid URL'));
|
||||
@ -7081,7 +7081,7 @@ describe('NetworkController', () => {
|
||||
},
|
||||
{
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
},
|
||||
),
|
||||
).toThrow(
|
||||
@ -7126,7 +7126,7 @@ describe('NetworkController', () => {
|
||||
|
||||
controller.upsertNetworkConfiguration(rpcUrlNetwork, {
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
});
|
||||
|
||||
expect(
|
||||
@ -7164,7 +7164,7 @@ describe('NetworkController', () => {
|
||||
|
||||
controller.upsertNetworkConfiguration(rpcUrlNetwork, {
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
});
|
||||
|
||||
expect(
|
||||
@ -7213,7 +7213,7 @@ describe('NetworkController', () => {
|
||||
|
||||
controller.upsertNetworkConfiguration(rpcUrlNetwork, {
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
});
|
||||
|
||||
expect(
|
||||
@ -7262,7 +7262,7 @@ describe('NetworkController', () => {
|
||||
};
|
||||
controller.upsertNetworkConfiguration(updatedConfiguration, {
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
});
|
||||
expect(
|
||||
Object.values(controller.store.getState().networkConfigurations),
|
||||
@ -7315,7 +7315,7 @@ describe('NetworkController', () => {
|
||||
},
|
||||
{
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
},
|
||||
);
|
||||
|
||||
@ -7375,7 +7375,7 @@ describe('NetworkController', () => {
|
||||
|
||||
controller.upsertNetworkConfiguration(rpcUrlNetwork, {
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
});
|
||||
|
||||
expect(controller.store.getState().provider).toStrictEqual(
|
||||
@ -7424,7 +7424,7 @@ describe('NetworkController', () => {
|
||||
controller.upsertNetworkConfiguration(rpcUrlNetwork, {
|
||||
setActive: true,
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
});
|
||||
|
||||
expect(controller.store.getState().provider).toStrictEqual({
|
||||
@ -7473,7 +7473,7 @@ describe('NetworkController', () => {
|
||||
|
||||
controller.upsertNetworkConfiguration(newNetworkConfiguration, {
|
||||
referrer: 'https://test-dapp.com',
|
||||
source: EVENT.SOURCE.NETWORK.DAPP,
|
||||
source: MetaMetricsNetworkEventSource.Dapp,
|
||||
});
|
||||
|
||||
expect(
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
AbstractMessage,
|
||||
OriginalRequest,
|
||||
} from '@metamask/message-manager/dist/AbstractMessageManager';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import { detectSIWE } from '../../../shared/modules/siwe';
|
||||
import SignController, {
|
||||
SignControllerMessenger,
|
||||
@ -270,7 +270,7 @@ describe('SignController', () => {
|
||||
expect(metricsEventMock).toHaveBeenCalledTimes(6);
|
||||
expect(metricsEventMock).toHaveBeenLastCalledWith({
|
||||
event: 'Test Reason',
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
properties: {
|
||||
action: 'Sign Request',
|
||||
type: messageMock.type,
|
||||
|
@ -32,7 +32,7 @@ import {
|
||||
AddApprovalRequest,
|
||||
RejectRequest,
|
||||
} from '@metamask/approval-controller';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import { detectSIWE } from '../../../shared/modules/siwe';
|
||||
import PreferencesController from './preferences';
|
||||
|
||||
@ -510,7 +510,7 @@ export default class SignController extends BaseControllerV2<
|
||||
|
||||
this._metricsEvent({
|
||||
event: reason,
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
properties: {
|
||||
action: 'Sign Request',
|
||||
type: message.type,
|
||||
|
@ -39,7 +39,7 @@ import {
|
||||
hexWEIToDecGWEI,
|
||||
} from '../../../../shared/modules/conversion.utils';
|
||||
import { isSwapsDefaultTokenAddress } from '../../../../shared/modules/swaps.utils';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
HARDFORKS,
|
||||
CHAIN_ID_TO_GAS_LIMIT_BUFFER_MAP,
|
||||
@ -2027,7 +2027,7 @@ export default class TransactionController extends EventEmitter {
|
||||
this._trackMetaMetricsEvent({
|
||||
event: 'Swap Failed',
|
||||
sensitiveProperties: { ...txMeta.swapMetaData },
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
});
|
||||
} else {
|
||||
const tokensReceived = getSwapsTokensReceivedFromTxMeta(
|
||||
@ -2062,7 +2062,7 @@ export default class TransactionController extends EventEmitter {
|
||||
|
||||
this._trackMetaMetricsEvent({
|
||||
event: 'Swap Completed',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
...txMeta.swapMetaData,
|
||||
token_to_amount_received: tokensReceived,
|
||||
@ -2414,7 +2414,7 @@ export default class TransactionController extends EventEmitter {
|
||||
// occur.
|
||||
case TransactionMetaMetricsEvent.added:
|
||||
this.createEventFragment({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
initialEvent: TransactionMetaMetricsEvent.added,
|
||||
successEvent: TransactionMetaMetricsEvent.approved,
|
||||
failureEvent: TransactionMetaMetricsEvent.rejected,
|
||||
@ -2436,7 +2436,7 @@ export default class TransactionController extends EventEmitter {
|
||||
case TransactionMetaMetricsEvent.approved:
|
||||
case TransactionMetaMetricsEvent.rejected:
|
||||
this.createEventFragment({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
successEvent: TransactionMetaMetricsEvent.approved,
|
||||
failureEvent: TransactionMetaMetricsEvent.rejected,
|
||||
properties,
|
||||
@ -2458,7 +2458,7 @@ export default class TransactionController extends EventEmitter {
|
||||
// properties to the transaction event.
|
||||
case TransactionMetaMetricsEvent.submitted:
|
||||
this.createEventFragment({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
initialEvent: TransactionMetaMetricsEvent.submitted,
|
||||
successEvent: TransactionMetaMetricsEvent.finalized,
|
||||
properties,
|
||||
@ -2478,7 +2478,7 @@ export default class TransactionController extends EventEmitter {
|
||||
// fragment does not exist.
|
||||
case TransactionMetaMetricsEvent.finalized:
|
||||
this.createEventFragment({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
successEvent: TransactionMetaMetricsEvent.finalized,
|
||||
properties,
|
||||
sensitiveProperties,
|
||||
|
@ -10,7 +10,10 @@ import {
|
||||
getTestAccounts,
|
||||
} from '../../../../test/stub/provider';
|
||||
import mockEstimates from '../../../../test/data/mock-estimates.json';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsTransactionEventSource,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
TransactionStatus,
|
||||
TransactionType,
|
||||
@ -1772,7 +1775,7 @@ describe('Transaction Controller', function () {
|
||||
successEvent: 'Transaction Approved',
|
||||
failureEvent: 'Transaction Rejected',
|
||||
uniqueIdentifier: 'transaction-added-1',
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
persist: true,
|
||||
properties: {
|
||||
chain_id: '0x5',
|
||||
@ -1781,7 +1784,7 @@ describe('Transaction Controller', function () {
|
||||
gas_edit_type: 'none',
|
||||
network: '5',
|
||||
referrer: ORIGIN_METAMASK,
|
||||
source: EVENT.SOURCE.TRANSACTION.USER,
|
||||
source: MetaMetricsTransactionEventSource.User,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
account_type: 'MetaMask',
|
||||
asset_type: AssetType.native,
|
||||
@ -1859,7 +1862,7 @@ describe('Transaction Controller', function () {
|
||||
initialEvent: 'Transaction Submitted',
|
||||
successEvent: 'Transaction Finalized',
|
||||
uniqueIdentifier: 'transaction-submitted-1',
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
persist: true,
|
||||
properties: {
|
||||
chain_id: '0x5',
|
||||
@ -1868,7 +1871,7 @@ describe('Transaction Controller', function () {
|
||||
gas_edit_type: 'none',
|
||||
network: '5',
|
||||
referrer: ORIGIN_METAMASK,
|
||||
source: EVENT.SOURCE.TRANSACTION.USER,
|
||||
source: MetaMetricsTransactionEventSource.User,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
account_type: 'MetaMask',
|
||||
asset_type: AssetType.native,
|
||||
@ -1958,7 +1961,7 @@ describe('Transaction Controller', function () {
|
||||
successEvent: 'Transaction Approved',
|
||||
failureEvent: 'Transaction Rejected',
|
||||
uniqueIdentifier: 'transaction-added-1',
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
persist: true,
|
||||
properties: {
|
||||
chain_id: '0x5',
|
||||
@ -1967,7 +1970,7 @@ describe('Transaction Controller', function () {
|
||||
gas_edit_type: 'none',
|
||||
network: '5',
|
||||
referrer: 'other',
|
||||
source: EVENT.SOURCE.TRANSACTION.DAPP,
|
||||
source: MetaMetricsTransactionEventSource.Dapp,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
account_type: 'MetaMask',
|
||||
asset_type: AssetType.native,
|
||||
@ -2047,7 +2050,7 @@ describe('Transaction Controller', function () {
|
||||
initialEvent: 'Transaction Submitted',
|
||||
successEvent: 'Transaction Finalized',
|
||||
uniqueIdentifier: 'transaction-submitted-1',
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
persist: true,
|
||||
properties: {
|
||||
chain_id: '0x5',
|
||||
@ -2056,7 +2059,7 @@ describe('Transaction Controller', function () {
|
||||
gas_edit_type: 'none',
|
||||
network: '5',
|
||||
referrer: 'other',
|
||||
source: EVENT.SOURCE.TRANSACTION.DAPP,
|
||||
source: MetaMetricsTransactionEventSource.Dapp,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
account_type: 'MetaMask',
|
||||
asset_type: AssetType.native,
|
||||
@ -2138,7 +2141,7 @@ describe('Transaction Controller', function () {
|
||||
successEvent: 'Transaction Approved',
|
||||
failureEvent: 'Transaction Rejected',
|
||||
uniqueIdentifier: 'transaction-added-1',
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
persist: true,
|
||||
properties: {
|
||||
chain_id: '0x5',
|
||||
@ -2147,7 +2150,7 @@ describe('Transaction Controller', function () {
|
||||
gas_edit_type: 'none',
|
||||
network: '5',
|
||||
referrer: 'other',
|
||||
source: EVENT.SOURCE.TRANSACTION.DAPP,
|
||||
source: MetaMetricsTransactionEventSource.Dapp,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
account_type: 'MetaMask',
|
||||
asset_type: AssetType.native,
|
||||
@ -2211,11 +2214,11 @@ describe('Transaction Controller', function () {
|
||||
failureEvent: 'Transaction Rejected',
|
||||
uniqueIdentifier: 'transaction-added-1',
|
||||
persist: true,
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
properties: {
|
||||
network: '5',
|
||||
referrer: 'other',
|
||||
source: EVENT.SOURCE.TRANSACTION.DAPP,
|
||||
source: MetaMetricsTransactionEventSource.Dapp,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
chain_id: '0x5',
|
||||
eip_1559_version: '0',
|
||||
@ -2285,11 +2288,11 @@ describe('Transaction Controller', function () {
|
||||
failureEvent: 'Transaction Rejected',
|
||||
uniqueIdentifier: 'transaction-added-1',
|
||||
persist: true,
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
properties: {
|
||||
network: '5',
|
||||
referrer: 'other',
|
||||
source: EVENT.SOURCE.TRANSACTION.DAPP,
|
||||
source: MetaMetricsTransactionEventSource.Dapp,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
chain_id: '0x5',
|
||||
eip_1559_version: '0',
|
||||
@ -2359,11 +2362,11 @@ describe('Transaction Controller', function () {
|
||||
failureEvent: 'Transaction Rejected',
|
||||
uniqueIdentifier: 'transaction-added-1',
|
||||
persist: true,
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
properties: {
|
||||
network: '5',
|
||||
referrer: 'other',
|
||||
source: EVENT.SOURCE.TRANSACTION.DAPP,
|
||||
source: MetaMetricsTransactionEventSource.Dapp,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
chain_id: '0x5',
|
||||
eip_1559_version: '0',
|
||||
@ -2441,7 +2444,7 @@ describe('Transaction Controller', function () {
|
||||
failureEvent: 'Transaction Rejected',
|
||||
uniqueIdentifier: 'transaction-added-1',
|
||||
persist: true,
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
properties: {
|
||||
chain_id: '0x5',
|
||||
eip_1559_version: '2',
|
||||
@ -2449,7 +2452,7 @@ describe('Transaction Controller', function () {
|
||||
gas_edit_type: 'none',
|
||||
network: '5',
|
||||
referrer: 'other',
|
||||
source: EVENT.SOURCE.TRANSACTION.DAPP,
|
||||
source: MetaMetricsTransactionEventSource.Dapp,
|
||||
transaction_type: TransactionType.simpleSend,
|
||||
account_type: 'MetaMask',
|
||||
asset_type: AssetType.native,
|
||||
|
@ -4,9 +4,9 @@ import { TransactionStatus } from '../../../shared/constants/transaction';
|
||||
import { SECOND } from '../../../shared/constants/time';
|
||||
import { detectSIWE } from '../../../shared/modules/siwe';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
METAMETRIC_KEY_OPT,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsEventUiCustomization,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
|
||||
/**
|
||||
@ -46,50 +46,50 @@ const RATE_LIMIT_MAP = {
|
||||
*/
|
||||
const EVENT_NAME_MAP = {
|
||||
[MESSAGE_TYPE.ETH_SIGN]: {
|
||||
APPROVED: EVENT_NAMES.SIGNATURE_APPROVED,
|
||||
FAILED: EVENT_NAMES.SIGNATURE_FAILED,
|
||||
REJECTED: EVENT_NAMES.SIGNATURE_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.SignatureApproved,
|
||||
FAILED: MetaMetricsEventName.SignatureFailed,
|
||||
REJECTED: MetaMetricsEventName.SignatureRejected,
|
||||
REQUESTED: MetaMetricsEventName.SignatureRequested,
|
||||
},
|
||||
[MESSAGE_TYPE.ETH_SIGN_TYPED_DATA]: {
|
||||
APPROVED: EVENT_NAMES.SIGNATURE_APPROVED,
|
||||
REJECTED: EVENT_NAMES.SIGNATURE_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.SignatureApproved,
|
||||
REJECTED: MetaMetricsEventName.SignatureRejected,
|
||||
REQUESTED: MetaMetricsEventName.SignatureRequested,
|
||||
},
|
||||
[MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V3]: {
|
||||
APPROVED: EVENT_NAMES.SIGNATURE_APPROVED,
|
||||
REJECTED: EVENT_NAMES.SIGNATURE_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.SignatureApproved,
|
||||
REJECTED: MetaMetricsEventName.SignatureRejected,
|
||||
REQUESTED: MetaMetricsEventName.SignatureRequested,
|
||||
},
|
||||
[MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4]: {
|
||||
APPROVED: EVENT_NAMES.SIGNATURE_APPROVED,
|
||||
REJECTED: EVENT_NAMES.SIGNATURE_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.SignatureApproved,
|
||||
REJECTED: MetaMetricsEventName.SignatureRejected,
|
||||
REQUESTED: MetaMetricsEventName.SignatureRequested,
|
||||
},
|
||||
[MESSAGE_TYPE.PERSONAL_SIGN]: {
|
||||
APPROVED: EVENT_NAMES.SIGNATURE_APPROVED,
|
||||
REJECTED: EVENT_NAMES.SIGNATURE_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.SignatureApproved,
|
||||
REJECTED: MetaMetricsEventName.SignatureRejected,
|
||||
REQUESTED: MetaMetricsEventName.SignatureRequested,
|
||||
},
|
||||
[MESSAGE_TYPE.ETH_DECRYPT]: {
|
||||
APPROVED: EVENT_NAMES.DECRYPTION_APPROVED,
|
||||
REJECTED: EVENT_NAMES.DECRYPTION_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.DECRYPTION_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.DecryptionApproved,
|
||||
REJECTED: MetaMetricsEventName.DecryptionRejected,
|
||||
REQUESTED: MetaMetricsEventName.DecryptionRequested,
|
||||
},
|
||||
[MESSAGE_TYPE.ETH_GET_ENCRYPTION_PUBLIC_KEY]: {
|
||||
APPROVED: EVENT_NAMES.ENCRYPTION_PUBLIC_KEY_APPROVED,
|
||||
REJECTED: EVENT_NAMES.ENCRYPTION_PUBLIC_KEY_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.ENCRYPTION_PUBLIC_KEY_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.EncryptionPublicKeyApproved,
|
||||
REJECTED: MetaMetricsEventName.EncryptionPublicKeyRejected,
|
||||
REQUESTED: MetaMetricsEventName.EncryptionPublicKeyRequested,
|
||||
},
|
||||
[MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS]: {
|
||||
APPROVED: EVENT_NAMES.PERMISSIONS_APPROVED,
|
||||
REJECTED: EVENT_NAMES.PERMISSIONS_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.PERMISSIONS_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.PermissionsApproved,
|
||||
REJECTED: MetaMetricsEventName.PermissionsRejected,
|
||||
REQUESTED: MetaMetricsEventName.PermissionsRequested,
|
||||
},
|
||||
[MESSAGE_TYPE.WALLET_REQUEST_PERMISSIONS]: {
|
||||
APPROVED: EVENT_NAMES.PERMISSIONS_APPROVED,
|
||||
REJECTED: EVENT_NAMES.PERMISSIONS_REJECTED,
|
||||
REQUESTED: EVENT_NAMES.PERMISSIONS_REQUESTED,
|
||||
APPROVED: MetaMetricsEventName.PermissionsApproved,
|
||||
REJECTED: MetaMetricsEventName.PermissionsRejected,
|
||||
REQUESTED: MetaMetricsEventName.PermissionsRequested,
|
||||
},
|
||||
};
|
||||
|
||||
@ -162,9 +162,9 @@ export default function createRPCMethodTrackingMiddleware({
|
||||
// 'Provider Method Called'.
|
||||
const event = eventType
|
||||
? eventType.REQUESTED
|
||||
: EVENT_NAMES.PROVIDER_METHOD_CALLED;
|
||||
: MetaMetricsEventName.ProviderMethodCalled;
|
||||
|
||||
if (event === EVENT_NAMES.SIGNATURE_REQUESTED) {
|
||||
if (event === MetaMetricsEventName.SignatureRequested) {
|
||||
eventProperties.signature_type = method;
|
||||
|
||||
const data = req?.params?.[0];
|
||||
@ -190,11 +190,11 @@ export default function createRPCMethodTrackingMiddleware({
|
||||
|
||||
if (securityProviderResponse?.flagAsDangerous === 1) {
|
||||
eventProperties.ui_customizations = [
|
||||
METAMETRIC_KEY_OPT.ui_customizations.flaggedAsMalicious,
|
||||
MetaMetricsEventUiCustomization.FlaggedAsMalicious,
|
||||
];
|
||||
} else if (securityProviderResponse?.flagAsDangerous === 2) {
|
||||
eventProperties.ui_customizations = [
|
||||
METAMETRIC_KEY_OPT.ui_customizations.flaggedAsSafetyUnknown,
|
||||
MetaMetricsEventUiCustomization.FlaggedAsSafetyUnknown,
|
||||
];
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ export default function createRPCMethodTrackingMiddleware({
|
||||
if (isSIWEMessage) {
|
||||
eventProperties.ui_customizations = (
|
||||
eventProperties.ui_customizations || []
|
||||
).concat(METAMETRIC_KEY_OPT.ui_customizations.SIWE);
|
||||
).concat(MetaMetricsEventUiCustomization.Siwe);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -217,7 +217,7 @@ export default function createRPCMethodTrackingMiddleware({
|
||||
|
||||
trackEvent({
|
||||
event,
|
||||
category: EVENT.CATEGORIES.INPAGE_PROVIDER,
|
||||
category: MetaMetricsEventCategory.InpageProvider,
|
||||
referrer: {
|
||||
url: origin,
|
||||
},
|
||||
@ -253,7 +253,7 @@ export default function createRPCMethodTrackingMiddleware({
|
||||
|
||||
trackEvent({
|
||||
event,
|
||||
category: EVENT.CATEGORIES.INPAGE_PROVIDER,
|
||||
category: MetaMetricsEventCategory.InpageProvider,
|
||||
referrer: {
|
||||
url: origin,
|
||||
},
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { errorCodes } from 'eth-rpc-errors';
|
||||
import { MESSAGE_TYPE } from '../../../shared/constants/app';
|
||||
import {
|
||||
EVENT_NAMES,
|
||||
METAMETRIC_KEY_OPT,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsEventUiCustomization,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import { SECOND } from '../../../shared/constants/time';
|
||||
import { detectSIWE } from '../../../shared/modules/siwe';
|
||||
@ -111,7 +111,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
metricsState.participateInMetaMetrics = true;
|
||||
});
|
||||
|
||||
it(`should immediately track a ${EVENT_NAMES.SIGNATURE_REQUESTED} event`, async () => {
|
||||
it(`should immediately track a ${MetaMetricsEventName.SignatureRequested} event`, async () => {
|
||||
const req = {
|
||||
method: MESSAGE_TYPE.ETH_SIGN,
|
||||
origin: 'some.dapp',
|
||||
@ -125,7 +125,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
expect(trackEvent).toHaveBeenCalledTimes(1);
|
||||
expect(trackEvent.mock.calls[0][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
event: MetaMetricsEventName.SignatureRequested,
|
||||
properties: {
|
||||
signature_type: MESSAGE_TYPE.ETH_SIGN,
|
||||
},
|
||||
@ -133,7 +133,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it(`should track a ${EVENT_NAMES.SIGNATURE_APPROVED} event if the user approves`, async () => {
|
||||
it(`should track a ${MetaMetricsEventName.SignatureApproved} event if the user approves`, async () => {
|
||||
const req = {
|
||||
method: MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4,
|
||||
origin: 'some.dapp',
|
||||
@ -148,7 +148,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
expect(trackEvent).toHaveBeenCalledTimes(2);
|
||||
expect(trackEvent.mock.calls[1][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.SIGNATURE_APPROVED,
|
||||
event: MetaMetricsEventName.SignatureApproved,
|
||||
properties: {
|
||||
signature_type: MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4,
|
||||
},
|
||||
@ -156,7 +156,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it(`should track a ${EVENT_NAMES.SIGNATURE_REJECTED} event if the user approves`, async () => {
|
||||
it(`should track a ${MetaMetricsEventName.SignatureRejected} event if the user approves`, async () => {
|
||||
const req = {
|
||||
method: MESSAGE_TYPE.PERSONAL_SIGN,
|
||||
origin: 'some.dapp',
|
||||
@ -171,7 +171,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
expect(trackEvent).toHaveBeenCalledTimes(2);
|
||||
expect(trackEvent.mock.calls[1][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.SIGNATURE_REJECTED,
|
||||
event: MetaMetricsEventName.SignatureRejected,
|
||||
properties: {
|
||||
signature_type: MESSAGE_TYPE.PERSONAL_SIGN,
|
||||
},
|
||||
@ -179,7 +179,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it(`should track a ${EVENT_NAMES.PERMISSIONS_APPROVED} event if the user approves`, async () => {
|
||||
it(`should track a ${MetaMetricsEventName.PermissionsApproved} event if the user approves`, async () => {
|
||||
const req = {
|
||||
method: MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS,
|
||||
origin: 'some.dapp',
|
||||
@ -192,7 +192,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
expect(trackEvent).toHaveBeenCalledTimes(2);
|
||||
expect(trackEvent.mock.calls[1][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.PERMISSIONS_APPROVED,
|
||||
event: MetaMetricsEventName.PermissionsApproved,
|
||||
properties: { method: MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS },
|
||||
referrer: { url: 'some.dapp' },
|
||||
});
|
||||
@ -261,17 +261,17 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
|
||||
expect(trackEvent.mock.calls[1][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.SIGNATURE_APPROVED,
|
||||
event: MetaMetricsEventName.SignatureApproved,
|
||||
properties: {
|
||||
signature_type: MESSAGE_TYPE.PERSONAL_SIGN,
|
||||
ui_customizations: [METAMETRIC_KEY_OPT.ui_customizations.SIWE],
|
||||
ui_customizations: [MetaMetricsEventUiCustomization.Siwe],
|
||||
},
|
||||
referrer: { url: 'some.dapp' },
|
||||
});
|
||||
});
|
||||
|
||||
describe(`when '${MESSAGE_TYPE.ETH_SIGN}' is disabled in advanced settings`, () => {
|
||||
it(`should track ${EVENT_NAMES.SIGNATURE_FAILED} and include error property`, async () => {
|
||||
it(`should track ${MetaMetricsEventName.SignatureFailed} and include error property`, async () => {
|
||||
const mockError = { code: errorCodes.rpc.methodNotFound };
|
||||
const req = {
|
||||
method: MESSAGE_TYPE.ETH_SIGN,
|
||||
@ -289,7 +289,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
|
||||
expect(trackEvent.mock.calls[1][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.SIGNATURE_FAILED,
|
||||
event: MetaMetricsEventName.SignatureFailed,
|
||||
properties: {
|
||||
signature_type: MESSAGE_TYPE.ETH_SIGN,
|
||||
error: mockError,
|
||||
@ -300,7 +300,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
});
|
||||
|
||||
describe('when request is flagged as safe by security provider', () => {
|
||||
it(`should immediately track a ${EVENT_NAMES.SIGNATURE_REQUESTED} event`, async () => {
|
||||
it(`should immediately track a ${MetaMetricsEventName.SignatureRequested} event`, async () => {
|
||||
const req = {
|
||||
method: MESSAGE_TYPE.ETH_SIGN,
|
||||
origin: 'some.dapp',
|
||||
@ -315,7 +315,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
expect(trackEvent).toHaveBeenCalledTimes(1);
|
||||
expect(trackEvent.mock.calls[0][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
event: MetaMetricsEventName.SignatureRequested,
|
||||
properties: {
|
||||
signature_type: MESSAGE_TYPE.ETH_SIGN,
|
||||
},
|
||||
@ -329,7 +329,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
flagAsDangerous = 1;
|
||||
});
|
||||
|
||||
it(`should immediately track a ${EVENT_NAMES.SIGNATURE_REQUESTED} event which is flagged as malicious`, async () => {
|
||||
it(`should immediately track a ${MetaMetricsEventName.SignatureRequested} event which is flagged as malicious`, async () => {
|
||||
const req = {
|
||||
method: MESSAGE_TYPE.ETH_SIGN,
|
||||
origin: 'some.dapp',
|
||||
@ -344,7 +344,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
expect(trackEvent).toHaveBeenCalledTimes(1);
|
||||
expect(trackEvent.mock.calls[0][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
event: MetaMetricsEventName.SignatureRequested,
|
||||
properties: {
|
||||
signature_type: MESSAGE_TYPE.ETH_SIGN,
|
||||
ui_customizations: ['flagged_as_malicious'],
|
||||
@ -359,7 +359,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
flagAsDangerous = 2;
|
||||
});
|
||||
|
||||
it(`should immediately track a ${EVENT_NAMES.SIGNATURE_REQUESTED} event which is flagged as safety unknown`, async () => {
|
||||
it(`should immediately track a ${MetaMetricsEventName.SignatureRequested} event which is flagged as safety unknown`, async () => {
|
||||
const req = {
|
||||
method: MESSAGE_TYPE.ETH_SIGN,
|
||||
origin: 'some.dapp',
|
||||
@ -374,7 +374,7 @@ describe('createRPCMethodTrackingMiddleware', () => {
|
||||
expect(trackEvent).toHaveBeenCalledTimes(1);
|
||||
expect(trackEvent.mock.calls[0][0]).toMatchObject({
|
||||
category: 'inpage_provider',
|
||||
event: EVENT_NAMES.SIGNATURE_REQUESTED,
|
||||
event: MetaMetricsEventName.SignatureRequested,
|
||||
properties: {
|
||||
signature_type: MESSAGE_TYPE.ETH_SIGN,
|
||||
ui_customizations: ['flagged_as_safety_unknown'],
|
||||
|
@ -4,7 +4,7 @@ import { bufferToHex } from 'ethereumjs-util';
|
||||
import { ethErrors } from 'eth-rpc-errors';
|
||||
import log from 'loglevel';
|
||||
import { MESSAGE_TYPE } from '../../../shared/constants/app';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import { METAMASK_CONTROLLER_EVENTS } from '../metamask-controller';
|
||||
import createId from '../../../shared/modules/random-id';
|
||||
import { stripHexPrefix } from '../../../shared/modules/hexstring-utils';
|
||||
@ -237,7 +237,7 @@ export default class DecryptMessageManager extends EventEmitter {
|
||||
if (reason) {
|
||||
this.metricsEvent({
|
||||
event: reason,
|
||||
category: EVENT.CATEGORIES.MESSAGES,
|
||||
category: MetaMetricsEventCategory.Messages,
|
||||
properties: {
|
||||
action: 'Decrypt Message Request',
|
||||
},
|
||||
|
@ -3,7 +3,7 @@ import { ObservableStore } from '@metamask/obs-store';
|
||||
import { ethErrors } from 'eth-rpc-errors';
|
||||
import log from 'loglevel';
|
||||
import { MESSAGE_TYPE } from '../../../shared/constants/app';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import { METAMASK_CONTROLLER_EVENTS } from '../metamask-controller';
|
||||
import createId from '../../../shared/modules/random-id';
|
||||
|
||||
@ -225,7 +225,7 @@ export default class EncryptionPublicKeyManager extends EventEmitter {
|
||||
if (reason) {
|
||||
this.metricsEvent({
|
||||
event: reason,
|
||||
category: EVENT.CATEGORIES.MESSAGES,
|
||||
category: MetaMetricsEventCategory.Messages,
|
||||
properties: {
|
||||
action: 'Encryption public key Request',
|
||||
},
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
isPrefixedFormattedHexString,
|
||||
isSafeChainId,
|
||||
} from '../../../../../shared/modules/network.utils';
|
||||
import { EVENT } from '../../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsNetworkEventSource } from '../../../../../shared/constants/metametrics';
|
||||
|
||||
const addEthereumChain = {
|
||||
methodNames: [MESSAGE_TYPE.ADD_ETHEREUM_CHAIN],
|
||||
@ -262,7 +262,7 @@ async function addEthereumChainHandler(
|
||||
rpcUrl: firstValidRPCUrl,
|
||||
ticker,
|
||||
},
|
||||
{ source: EVENT.SOURCE.NETWORK.DAPP, referrer: origin },
|
||||
{ source: MetaMetricsNetworkEventSource.Dapp, referrer: origin },
|
||||
);
|
||||
|
||||
// Once the network has been added, the requested is considered successful
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { MESSAGE_TYPE } from '../../../../../shared/constants/app';
|
||||
import { EVENT } from '../../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../../shared/constants/metametrics';
|
||||
|
||||
/**
|
||||
* This RPC method is called by the inpage provider whenever it detects the
|
||||
@ -49,7 +49,7 @@ function logWeb3ShimUsageHandler(
|
||||
sendMetrics(
|
||||
{
|
||||
event: `Website Accessed window.web3 Shim`,
|
||||
category: EVENT.CATEGORIES.INPAGE_PROVIDER,
|
||||
category: MetaMetricsEventCategory.InpageProvider,
|
||||
referrer: {
|
||||
url: origin,
|
||||
},
|
||||
|
@ -104,7 +104,10 @@ import {
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
POLLING_TOKEN_ENVIRONMENT_TYPES,
|
||||
} from '../../shared/constants/app';
|
||||
import { EVENT, EVENT_NAMES } from '../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../shared/constants/metametrics';
|
||||
|
||||
import {
|
||||
getTokenIdParam,
|
||||
@ -399,8 +402,8 @@ export default class MetamaskController extends EventEmitter {
|
||||
),
|
||||
onNftAdded: ({ address, symbol, tokenId, standard, source }) =>
|
||||
this.metaMetricsController.trackEvent({
|
||||
event: EVENT_NAMES.NFT_ADDED,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.NftAdded,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
properties: {
|
||||
token_contract_address: address,
|
||||
token_symbol: symbol,
|
||||
@ -1069,7 +1072,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
this.metaMetricsController.trackEvent(
|
||||
{
|
||||
event: 'Tx Status Update: On-Chain Failure',
|
||||
category: EVENT.CATEGORIES.BACKGROUND,
|
||||
category: MetaMetricsEventCategory.Background,
|
||||
properties: {
|
||||
action: 'Transactions',
|
||||
errorMessage: txMeta.simulationFails?.reason,
|
||||
@ -1196,8 +1199,8 @@ export default class MetamaskController extends EventEmitter {
|
||||
const { serviceWorkerLastActiveTime } =
|
||||
this.appStateController.store.getState();
|
||||
const metametricsPayload = {
|
||||
category: EVENT.SOURCE.SERVICE_WORKERS,
|
||||
event: EVENT_NAMES.SERVICE_WORKER_RESTARTED,
|
||||
category: MetaMetricsEventCategory.ServiceWorkers,
|
||||
event: MetaMetricsEventName.ServiceWorkerRestarted,
|
||||
properties: {
|
||||
service_worker_restarted_time:
|
||||
Date.now() - serviceWorkerLastActiveTime,
|
||||
@ -1619,7 +1622,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
(truncatedSnap) => {
|
||||
this.metaMetricsController.trackEvent({
|
||||
event: 'Snap Installed',
|
||||
category: EVENT.CATEGORIES.SNAPS,
|
||||
category: MetaMetricsEventCategory.Snaps,
|
||||
properties: {
|
||||
snap_id: truncatedSnap.id,
|
||||
version: truncatedSnap.version,
|
||||
@ -1633,7 +1636,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
(newSnap, oldVersion) => {
|
||||
this.metaMetricsController.trackEvent({
|
||||
event: 'Snap Updated',
|
||||
category: EVENT.CATEGORIES.SNAPS,
|
||||
category: MetaMetricsEventCategory.Snaps,
|
||||
properties: {
|
||||
snap_id: newSnap.id,
|
||||
old_version: oldVersion,
|
||||
@ -3540,8 +3543,8 @@ export default class MetamaskController extends EventEmitter {
|
||||
if (usePhishDetect && phishingTestResponse?.result) {
|
||||
this.sendPhishingWarning(connectionStream, hostname);
|
||||
this.metaMetricsController.trackEvent({
|
||||
event: EVENT_NAMES.PHISHING_PAGE_DISPLAYED,
|
||||
category: EVENT.CATEGORIES.PHISHING,
|
||||
event: MetaMetricsEventName.PhishingPageDisplayed,
|
||||
category: MetaMetricsEventCategory.Phishing,
|
||||
properties: {
|
||||
url: hostname,
|
||||
},
|
||||
|
@ -1,482 +0,0 @@
|
||||
// Type Imports
|
||||
/**
|
||||
* @typedef {import('../../shared/constants/app').EnvironmentType} EnvironmentType
|
||||
*/
|
||||
|
||||
// Type Declarations
|
||||
/**
|
||||
* Used to attach context of where the user was at in the application when the
|
||||
* event was triggered. Also included as full details of the current page in
|
||||
* page events.
|
||||
*
|
||||
* @typedef {object} MetaMetricsPageObject
|
||||
* @property {string} [path] - the path of the current page (e.g /home)
|
||||
* @property {string} [title] - the title of the current page (e.g 'home')
|
||||
* @property {string} [url] - the fully qualified url of the current page
|
||||
*/
|
||||
|
||||
/**
|
||||
* For metamask, this is the dapp that triggered an interaction
|
||||
*
|
||||
* @typedef {object} MetaMetricsReferrerObject
|
||||
* @property {string} [url] - the origin of the dapp issuing the
|
||||
* notification
|
||||
*/
|
||||
|
||||
/**
|
||||
* We attach context to every meta metrics event that help to qualify our
|
||||
* analytics. This type has all optional values because it represents a
|
||||
* returned object from a method call. Ideally app and userAgent are
|
||||
* defined on every event. This is confirmed in the getTrackMetaMetricsEvent
|
||||
* function, but still provides the consumer a way to override these values if
|
||||
* necessary.
|
||||
*
|
||||
* @typedef {object} MetaMetricsContext
|
||||
* @property {object} app - Application metadata.
|
||||
* @property {string} app.name - the name of the application tracking the event
|
||||
* @property {string} app.version - the version of the application
|
||||
* @property {string} userAgent - the useragent string of the user
|
||||
* @property {MetaMetricsPageObject} [page] - an object representing details of
|
||||
* the current page
|
||||
* @property {MetaMetricsReferrerObject} [referrer] - for metamask, this is the
|
||||
* dapp that triggered an interaction
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} MetaMetricsEventPayload
|
||||
* @property {string} event - event name to track
|
||||
* @property {string} category - category to associate event to
|
||||
* @property {number} [actionId] - Action id to deduplicate event requests from
|
||||
* the UI
|
||||
* @property {string} [environmentType] - The type of environment this event
|
||||
* occurred in. Defaults to the background process type
|
||||
* @property {object} [properties] - object of custom values to track, keys
|
||||
* in this object must be in snake_case
|
||||
* @property {object} [sensitiveProperties] - Object of sensitive values to
|
||||
* track. Keys in this object must be in snake_case. These properties will be
|
||||
* sent in an additional event that excludes the user's metaMetricsId
|
||||
* @property {number} [revenue] - amount of currency that event creates in
|
||||
* revenue for MetaMask
|
||||
* @property {string} [currency] - ISO 4127 format currency for events with
|
||||
* revenue, defaults to US dollars
|
||||
* @property {number} [value] - Abstract business "value" attributable to
|
||||
* customers who trigger this event
|
||||
* @property {MetaMetricsPageObject} [page] - the page/route that the event
|
||||
* occurred on
|
||||
* @property {MetaMetricsReferrerObject} [referrer] - the origin of the dapp
|
||||
* that triggered the event
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} MetaMetricsEventOptions
|
||||
* @property {boolean} [isOptIn] - happened during opt in/out workflow
|
||||
* @property {boolean} [flushImmediately] - When true will automatically flush
|
||||
* the segment queue after tracking the event. Recommended if the result of
|
||||
* tracking the event must be known before UI transition or update
|
||||
* @property {boolean} [excludeMetaMetricsId] - whether to exclude the user's
|
||||
* metametrics id for anonymity
|
||||
* @property {string} [metaMetricsId] - an override for the metaMetricsId in
|
||||
* the event one is created as part of an asynchronous workflow, such as
|
||||
* awaiting the result of the metametrics opt-in function that generates the
|
||||
* user's metametrics id
|
||||
* @property {boolean} [matomoEvent] - is this event a holdover from matomo
|
||||
* that needs further migration? when true, sends the data to a special
|
||||
* segment source that marks the event data as not conforming to our schema
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} MetaMetricsEventFragment
|
||||
* @property {string} successEvent - The event name to fire when the fragment
|
||||
* is closed in an affirmative action.
|
||||
* @property {string} [failureEvent] - The event name to fire when the fragment
|
||||
* is closed with a rejection.
|
||||
* @property {string} [initialEvent] - An event name to fire immediately upon
|
||||
* fragment creation. This is useful for building funnels in mixpanel and for
|
||||
* reduction of code duplication.
|
||||
* @property {string} category - the event category to use for both the success
|
||||
* and failure events
|
||||
* @property {boolean} [persist] - Should this fragment be persisted in
|
||||
* state and progressed after the extension is locked and unlocked.
|
||||
* @property {number} [timeout] - Time in seconds the event should be persisted
|
||||
* for. After the timeout the fragment will be closed as abandoned. if not
|
||||
* supplied the fragment is stored indefinitely.
|
||||
* @property {number} [lastUpdated] - Date.now() when the fragment was last
|
||||
* updated. Used to determine if the timeout has expired and the fragment
|
||||
* should be closed.
|
||||
* @property {object} [properties] - Object of custom values to track, keys in
|
||||
* this object must be in snake_case.
|
||||
* @property {object} [sensitiveProperties] - Object of sensitive values to
|
||||
* track. Keys in this object must be in snake_case. These properties will be
|
||||
* sent in an additional event that excludes the user's metaMetricsId
|
||||
* @property {number} [revenue] - amount of currency that event creates in
|
||||
* revenue for MetaMask if fragment is successful.
|
||||
* @property {string} [currency] - ISO 4127 format currency for events with
|
||||
* revenue, defaults to US dollars
|
||||
* @property {number} [value] - Abstract business "value" attributable to
|
||||
* customers who successfully complete this fragment
|
||||
* @property {MetaMetricsPageObject} [page] - the page/route that the event
|
||||
* occurred on
|
||||
* @property {MetaMetricsReferrerObject} [referrer] - the origin of the dapp
|
||||
* that initiated the event fragment.
|
||||
* @property {string} [uniqueIdentifier] - optional argument to override the
|
||||
* automatic generation of UUID for the event fragment. This is useful when
|
||||
* tracking events for subsystems that already generate UUIDs so to avoid
|
||||
* unnecessary lookups and reduce accidental duplication.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the shape of data sent to the segment.track method.
|
||||
*
|
||||
* @typedef {object} SegmentEventPayload
|
||||
* @property {string} [userId] - The metametrics id for the user
|
||||
* @property {string} [anonymousId] - An anonymousId that is used to track
|
||||
* sensitive data while preserving anonymity.
|
||||
* @property {string} event - name of the event to track
|
||||
* @property {object} properties - properties to attach to the event
|
||||
* @property {MetaMetricsContext} context - the context the event occurred in
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} MetaMetricsPagePayload
|
||||
* @property {string} name - The name of the page that was viewed
|
||||
* @property {object} [params] - The variadic parts of the page url
|
||||
* example (route: `/asset/:asset`, path: `/asset/ETH`)
|
||||
* params: { asset: 'ETH' }
|
||||
* @property {EnvironmentType} environmentType - the environment type that the
|
||||
* page was viewed in
|
||||
* @property {MetaMetricsPageObject} [page] - the details of the page
|
||||
* @property {MetaMetricsReferrerObject} [referrer] - dapp that triggered the page
|
||||
* view
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} MetaMetricsPageOptions
|
||||
* @property {boolean} [isOptInPath] - is the current path one of the pages in
|
||||
* the onboarding workflow? If true and participateInMetaMetrics is null track
|
||||
* the page view
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} Traits
|
||||
* @property {'address_book_entries'} ADDRESS_BOOK_ENTRIES - When the user
|
||||
* adds or modifies addresses in address book the address_book_entries trait
|
||||
* is identified.
|
||||
* @property {'ledger_connection_type'} LEDGER_CONNECTION_TYPE - when ledger
|
||||
* live connnection type is changed we identify the ledger_connection_type
|
||||
* trait
|
||||
* @property {'networks_added'} NETWORKS_ADDED - when user modifies networks
|
||||
* we identify the networks_added trait
|
||||
* @property {'networks_without_ticker'} NETWORKS_WITHOUT_TICKER - when user
|
||||
* modifies networks we identify the networks_without_ticker trait for
|
||||
* networks without a ticker.
|
||||
* @property {'nft_autodetection_enabled'} NFT_AUTODETECTION_ENABLED - when Autodetect NFTs
|
||||
* feature is toggled we identify the nft_autodetection_enabled trait
|
||||
* @property {'number_of_accounts'} NUMBER_OF_ACCOUNTS - when identities
|
||||
* change, we identify the new number_of_accounts trait
|
||||
* @property {'number_of_nft_collections'} NUMBER_OF_NFT_COLLECTIONS - user
|
||||
* trait for number of unique NFT addresses
|
||||
* @property {'number_of_nfts'} NUMBER_OF_NFTS - user trait for number of all NFT addresses
|
||||
* @property {'number_of_tokens'} NUMBER_OF_TOKENS - when the number of tokens change, we
|
||||
* identify the new number_of_tokens trait
|
||||
* @property {'opensea_api_enabled'} OPENSEA_API_ENABLED - when the OpenSea API is enabled
|
||||
* we identify the opensea_api_enabled trait
|
||||
* @property {'three_box_enabled'} THREE_BOX_ENABLED - When 3Box feature is
|
||||
* toggled we identify the 3box_enabled trait. This trait has been deprecated.
|
||||
* @property {'theme'} THEME - when the user's theme changes we identify the theme trait
|
||||
* @property {'token_detection_enabled'} TOKEN_DETECTION_ENABLED - when token detection feature is toggled we
|
||||
* identify the token_detection_enabled trait
|
||||
* @property {'install_date_ext'} INSTALL_DATE_EXT - when the user installed the extension
|
||||
* @property {'desktop_enabled'} [DESKTOP_ENABLED] - optional / does the user have desktop enabled?
|
||||
* @property {'security_providers'} SECURITY_PROVIDERS - when security provider feature is toggled we
|
||||
* identify the security_providers trait
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {Traits}
|
||||
*/
|
||||
|
||||
export const TRAITS = {
|
||||
ADDRESS_BOOK_ENTRIES: 'address_book_entries',
|
||||
INSTALL_DATE_EXT: 'install_date_ext',
|
||||
LEDGER_CONNECTION_TYPE: 'ledger_connection_type',
|
||||
NETWORKS_ADDED: 'networks_added',
|
||||
NETWORKS_WITHOUT_TICKER: 'networks_without_ticker',
|
||||
NFT_AUTODETECTION_ENABLED: 'nft_autodetection_enabled',
|
||||
NUMBER_OF_ACCOUNTS: 'number_of_accounts',
|
||||
NUMBER_OF_NFT_COLLECTIONS: 'number_of_nft_collections',
|
||||
NUMBER_OF_NFTS: 'number_of_nfts',
|
||||
NUMBER_OF_TOKENS: 'number_of_tokens',
|
||||
OPENSEA_API_ENABLED: 'opensea_api_enabled',
|
||||
THEME: 'theme',
|
||||
THREE_BOX_ENABLED: 'three_box_enabled',
|
||||
TOKEN_DETECTION_ENABLED: 'token_detection_enabled',
|
||||
DESKTOP_ENABLED: 'desktop_enabled',
|
||||
SECURITY_PROVIDERS: 'security_providers',
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {object} MetaMetricsTraits
|
||||
* @property {number} [address_book_entries] - The number of entries in the
|
||||
* user's address book.
|
||||
* @property {'ledgerLive' | 'webhid' | 'u2f'} [ledger_connection_type] - the
|
||||
* type of ledger connection set by user preference.
|
||||
* @property {Array<string>} [networks_added] - An array consisting of chainIds
|
||||
* that indicate the networks a user has added to their MetaMask.
|
||||
* @property {Array<string>} [networks_without_ticker] - An array consisting of
|
||||
* chainIds that indicate the networks added by the user that do not have a
|
||||
* ticker.
|
||||
* @property {number} [nft_autodetection_enabled] - does the user have the
|
||||
* use collection/nft detection enabled?
|
||||
* @property {number} [number_of_accounts] - A number representing the number
|
||||
* of identities(accounts) added to the user's MetaMask.
|
||||
* @property {number} [number_of_nft_collections] - A number representing the
|
||||
* amount of different NFT collections the user possesses an NFT from.
|
||||
* @property {number} [number_of_nfts] - A number representing the
|
||||
* amount of all NFTs the user possesses across all networks and accounts.
|
||||
* @property {number} [number_of_tokens] - The total number of token contracts
|
||||
* the user has across all networks and accounts.
|
||||
* @property {boolean} [opensea_api_enabled] - does the user have the OpenSea
|
||||
* API enabled?
|
||||
* @property {boolean} [three_box_enabled] - Does the user have 3box sync
|
||||
* enabled? (deprecated)
|
||||
* @property {string} [theme] - which theme the user has selected
|
||||
* @property {boolean} [token_detection_enabled] - does the user have token detection is enabled?
|
||||
* @property {boolean} [desktop_enabled] - optional / does the user have desktop enabled?
|
||||
* @property {Array<string>} [security_providers] - whether security provider feature toggle is on or off
|
||||
*/
|
||||
|
||||
// Mixpanel converts the zero address value to a truly anonymous event, which
|
||||
// speeds up reporting
|
||||
export const METAMETRICS_ANONYMOUS_ID = '0x0000000000000000';
|
||||
|
||||
/**
|
||||
* This object is used to identify events that are triggered by the background
|
||||
* process.
|
||||
*
|
||||
* @type {MetaMetricsPageObject}
|
||||
*/
|
||||
export const METAMETRICS_BACKGROUND_PAGE_OBJECT = {
|
||||
path: '/background-process',
|
||||
title: 'Background Process',
|
||||
url: '/background-process',
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {object} SegmentInterface
|
||||
* @property {SegmentEventPayload[]} queue - A queue of events to be sent when
|
||||
* the flushAt limit has been reached, or flushInterval occurs
|
||||
* @property {() => void} flush - Immediately flush the queue, resetting it to
|
||||
* an empty array and sending the pending events to Segment
|
||||
* @property {(
|
||||
* payload: SegmentEventPayload,
|
||||
* callback: (err?: Error) => void
|
||||
* ) => void} track - Track an event with Segment, using the internal batching
|
||||
* mechanism to optimize network requests
|
||||
* @property {(payload: object) => void} page - Track a page view with Segment
|
||||
* @property {() => void} identify - Identify an anonymous user. We do not
|
||||
* currently use this method.
|
||||
*/
|
||||
|
||||
export const REJECT_NOTFICIATION_CLOSE = 'Cancel Via Notification Close';
|
||||
export const REJECT_NOTFICIATION_CLOSE_SIG =
|
||||
'Cancel Sig Request Via Notification Close';
|
||||
|
||||
/**
|
||||
* EVENTS
|
||||
*/
|
||||
|
||||
export const EVENT_NAMES = {
|
||||
ACCOUNT_ADDED: 'Account Added',
|
||||
ACCOUNT_ADD_SELECTED: 'Account Add Selected',
|
||||
ACCOUNT_ADD_FAILED: 'Account Add Failed',
|
||||
ACCOUNT_PASSWORD_CREATED: 'Account Password Created',
|
||||
ACCOUNT_RESET: 'Account Reset',
|
||||
APP_INSTALLED: 'App Installed',
|
||||
APP_UNLOCKED: 'App Unlocked',
|
||||
APP_UNLOCKED_FAILED: 'App Unlocked Failed',
|
||||
APP_WINDOW_EXPANDED: 'App Window Expanded',
|
||||
BRIDGE_LINK_CLICKED: 'Bridge Link Clicked',
|
||||
DECRYPTION_APPROVED: 'Decryption Approved',
|
||||
DECRYPTION_REJECTED: 'Decryption Rejected',
|
||||
DECRYPTION_REQUESTED: 'Decryption Requested',
|
||||
ENCRYPTION_PUBLIC_KEY_APPROVED: 'Encryption Approved',
|
||||
ENCRYPTION_PUBLIC_KEY_REJECTED: 'Encryption Rejected',
|
||||
ENCRYPTION_PUBLIC_KEY_REQUESTED: 'Encryption Requested',
|
||||
EXTERNAL_LINK_CLICKED: 'External Link Clicked',
|
||||
KEY_EXPORT_SELECTED: 'Key Export Selected',
|
||||
KEY_EXPORT_REQUESTED: 'Key Export Requested',
|
||||
KEY_EXPORT_FAILED: 'Key Export Failed',
|
||||
KEY_EXPORT_CANCELED: 'Key Export Canceled',
|
||||
KEY_EXPORT_REVEALED: 'Key Material Revealed',
|
||||
KEY_EXPORT_COPIED: 'Key Material Copied',
|
||||
KEY_TOKEN_DETECTION_SELECTED: 'Key Token Detection Selected',
|
||||
KEY_GLOBAL_SECURITY_TOGGLE_SELECTED: 'Key Global Security/Privacy Settings',
|
||||
KEY_BALANCE_TOKEN_PRICE_CHECKER:
|
||||
'Key Show Balance and Token Price Checker Settings',
|
||||
KEY_GAS_FEE_ESTIMATION_BUY_SWAP_TOKENS:
|
||||
'Key Show Gas Fee Estimation, Buy Crypto and Swap Tokens',
|
||||
KEY_AUTO_DETECT_TOKENS: 'Key Autodetect tokens',
|
||||
KEY_BATCH_ACCOUNT_BALANCE_REQUESTS: 'Key Batch account balance requests',
|
||||
METRICS_OPT_IN: 'Metrics Opt In',
|
||||
METRICS_OPT_OUT: 'Metrics Opt Out',
|
||||
NAV_ACCOUNT_MENU_OPENED: 'Account Menu Opened',
|
||||
NAV_ACCOUNT_DETAILS_OPENED: 'Account Details Opened',
|
||||
NAV_CONNECTED_SITES_OPENED: 'Connected Sites Opened',
|
||||
NAV_MAIN_MENU_OPENED: 'Main Menu Opened',
|
||||
NAV_NETWORK_MENU_OPENED: 'Network Menu Opened',
|
||||
NAV_SETTINGS_OPENED: 'Settings Opened',
|
||||
NAV_ACCOUNT_SWITCHED: 'Account Switched',
|
||||
NAV_NETWORK_SWITCHED: 'Network Switched',
|
||||
NAV_BUY_BUTTON_CLICKED: 'Buy Button Clicked',
|
||||
NAV_SEND_BUTTON_CLICKED: 'Send Button Clicked',
|
||||
NAV_SWAP_BUTTON_CLICKED: 'Swap Button Clicked',
|
||||
SRP_TO_CONFIRM_BACKUP: 'SRP Backup Confirm Displayed',
|
||||
WALLET_SETUP_STARTED: 'Wallet Setup Selected',
|
||||
WALLET_SETUP_CANCELED: 'Wallet Setup Canceled',
|
||||
WALLET_SETUP_FAILED: 'Wallet Setup Failed',
|
||||
WALLET_CREATED: 'Wallet Created',
|
||||
NFT_ADDED: 'NFT Added',
|
||||
ONRAMP_PROVIDER_SELECTED: 'On-ramp Provider Selected',
|
||||
PERMISSIONS_APPROVED: 'Permissions Approved',
|
||||
PERMISSIONS_REJECTED: 'Permissions Rejected',
|
||||
PERMISSIONS_REQUESTED: 'Permissions Requested',
|
||||
PHISHING_PAGE_DISPLAYED: 'Phishing Page Displayed',
|
||||
PORTFOLIO_LINK_CLICKED: 'Portfolio Link Clicked',
|
||||
PUBLIC_ADDRESS_COPIED: 'Public Address Copied',
|
||||
PROVIDER_METHOD_CALLED: 'Provider Method Called',
|
||||
SIGNATURE_APPROVED: 'Signature Approved',
|
||||
SIGNATURE_FAILED: 'Signature Failed',
|
||||
SIGNATURE_REJECTED: 'Signature Rejected',
|
||||
SIGNATURE_REQUESTED: 'Signature Requested',
|
||||
TOKEN_IMPORT_BUTTON_CLICKED: 'Import Token Button Clicked',
|
||||
TOKEN_SCREEN_OPENED: 'Token Screen Opened',
|
||||
SUPPORT_LINK_CLICKED: 'Support Link Clicked',
|
||||
TOKEN_ADDED: 'Token Added',
|
||||
TOKEN_DETECTED: 'Token Detected',
|
||||
TOKEN_HIDDEN: 'Token Hidden',
|
||||
TOKEN_IMPORT_CANCELED: 'Token Import Canceled',
|
||||
TOKEN_IMPORT_CLICKED: 'Token Import Clicked',
|
||||
ONBOARDING_WELCOME: 'App Installed',
|
||||
ONBOARDING_WALLET_CREATION_STARTED: 'Wallet Setup Selected',
|
||||
ONBOARDING_WALLET_IMPORT_STARTED: 'Wallet Import Started',
|
||||
ONBOARDING_WALLET_CREATION_ATTEMPTED: 'Wallet Password Created',
|
||||
ONBOARDING_WALLET_SECURITY_STARTED: 'SRP Backup Selected',
|
||||
ONBOARDING_WALLET_SECURITY_SKIP_INITIATED: 'SRP Skip Backup Selected',
|
||||
ONBOARDING_WALLET_SECURITY_SKIP_CONFIRMED: 'SRP Backup Skipped',
|
||||
ONBOARDING_WALLET_SECURITY_SKIP_CANCELED: 'SRP Skip Backup Canceled',
|
||||
ONBOARDING_WALLET_SECURITY_PHRASE_REVEALED: 'SRP Revealed',
|
||||
ONBOARDING_WALLET_SECURITY_PHRASE_WRITTEN_DOWN: 'SRP Backup Confirm Display',
|
||||
ONBOARDING_WALLET_SECURITY_PHRASE_CONFIRMED: 'SRP Backup Confirmed',
|
||||
ONBOARDING_WALLET_CREATION_COMPLETE: 'Wallet Created',
|
||||
ONBOARDING_WALLET_SETUP_COMPLETE: 'Application Opened',
|
||||
ONBOARDING_WALLET_ADVANCED_SETTINGS: 'Settings Updated',
|
||||
ONBOARDING_WALLET_IMPORT_ATTEMPTED: 'Wallet Import Attempted',
|
||||
ONBOARDING_WALLET_VIDEO_PLAY: 'SRP Intro Video Played',
|
||||
ONBOARDING_TWITTER_CLICK: 'External Link Clicked',
|
||||
SERVICE_WORKER_RESTARTED: 'Service Worker Restarted',
|
||||
};
|
||||
|
||||
export const EVENT = {
|
||||
ACCOUNT_TYPES: {
|
||||
DEFAULT: 'metamask',
|
||||
IMPORTED: 'imported',
|
||||
HARDWARE: 'hardware',
|
||||
},
|
||||
ACCOUNT_IMPORT_TYPES: {
|
||||
JSON: 'json',
|
||||
PRIVATE_KEY: 'private_key',
|
||||
SRP: 'srp',
|
||||
},
|
||||
CATEGORIES: {
|
||||
ACCOUNTS: 'Accounts',
|
||||
APP: 'App',
|
||||
AUTH: 'Auth',
|
||||
BACKGROUND: 'Background',
|
||||
ERROR: 'Error',
|
||||
FOOTER: 'Footer',
|
||||
HOME: 'Home',
|
||||
INPAGE_PROVIDER: 'inpage_provider',
|
||||
KEYS: 'Keys',
|
||||
MESSAGES: 'Messages',
|
||||
NAVIGATION: 'Navigation',
|
||||
NETWORK: 'Network',
|
||||
ONBOARDING: 'Onboarding',
|
||||
PHISHING: 'Phishing',
|
||||
RETENTION: 'Retention',
|
||||
SETTINGS: 'Settings',
|
||||
SNAPS: 'Snaps',
|
||||
SWAPS: 'Swaps',
|
||||
TRANSACTIONS: 'Transactions',
|
||||
WALLET: 'Wallet',
|
||||
DESKTOP: 'Desktop',
|
||||
},
|
||||
EXTERNAL_LINK_TYPES: {
|
||||
TRANSACTION_BLOCK_EXPLORER: 'Transaction Block Explorer',
|
||||
BLOCK_EXPLORER: 'Block Explorer',
|
||||
ACCOUNT_TRACKER: 'Account Tracker',
|
||||
TOKEN_TRACKER: 'Token Tracker',
|
||||
},
|
||||
KEY_TYPES: {
|
||||
PKEY: 'private_key',
|
||||
SRP: 'srp',
|
||||
},
|
||||
ONRAMP_PROVIDER_TYPES: {
|
||||
COINBASE: 'coinbase',
|
||||
MOONPAY: 'moonpay',
|
||||
WYRE: 'wyre',
|
||||
TRANSAK: 'transak',
|
||||
SELF_DEPOSIT: 'direct_deposit',
|
||||
},
|
||||
SOURCE: {
|
||||
NETWORK: {
|
||||
CUSTOM_NETWORK_FORM: 'custom_network_form',
|
||||
POPULAR_NETWORK_LIST: 'popular_network_list',
|
||||
DAPP: 'dapp',
|
||||
},
|
||||
SWAPS: {
|
||||
MAIN_VIEW: 'Main View',
|
||||
TOKEN_VIEW: 'Token View',
|
||||
},
|
||||
TOKEN: {
|
||||
CUSTOM: 'custom',
|
||||
DAPP: 'dapp',
|
||||
DETECTED: 'detected',
|
||||
LIST: 'list',
|
||||
},
|
||||
TRANSACTION: {
|
||||
DAPP: 'dapp',
|
||||
USER: 'user',
|
||||
},
|
||||
SERVICE_WORKERS: 'service_workers',
|
||||
},
|
||||
LOCATION: {
|
||||
TOKEN_DETAILS: 'token_details',
|
||||
TOKEN_DETECTION: 'token_detection',
|
||||
TOKEN_MENU: 'token_menu',
|
||||
},
|
||||
};
|
||||
|
||||
// Values below (e.g. 'location') can be used in the "properties"
|
||||
// tracking object as keys, e.g. { location: 'Home' }
|
||||
export const CONTEXT_PROPS = {
|
||||
PAGE_TITLE: 'location',
|
||||
};
|
||||
|
||||
/**
|
||||
* These types correspond to the keys in the METAMETRIC_KEY_OPT object
|
||||
*/
|
||||
export const METAMETRIC_KEY = {
|
||||
UI_CUSTOMIZATIONS: `ui_customizations`,
|
||||
};
|
||||
|
||||
/**
|
||||
* This object maps a METAMETRIC_KEY to an object of possible options
|
||||
*/
|
||||
export const METAMETRIC_KEY_OPT = {
|
||||
[METAMETRIC_KEY.UI_CUSTOMIZATIONS]: {
|
||||
flaggedAsMalicious: 'flagged_as_malicious',
|
||||
flaggedAsSafetyUnknown: 'flagged_as_safety_unknown',
|
||||
SIWE: 'sign_in_with_ethereum',
|
||||
},
|
||||
};
|
642
shared/constants/metametrics.ts
Normal file
642
shared/constants/metametrics.ts
Normal file
@ -0,0 +1,642 @@
|
||||
import type { EnvironmentType } from './app';
|
||||
import { LedgerTransportTypes } from './hardware-wallets';
|
||||
|
||||
/**
|
||||
* Used to attach context of where the user was at in the application when the
|
||||
* event was triggered. Also included as full details of the current page in
|
||||
* page events.
|
||||
*/
|
||||
export type MetaMetricsPageObject = {
|
||||
/**
|
||||
* The path of the current page (e.g. "/home").
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The title of the current page (e.g. "home").
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* The fully qualified URL of the current page.
|
||||
*/
|
||||
url?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* The dapp that triggered an interaction (MetaMask only).
|
||||
*/
|
||||
export type MetaMetricsReferrerObject = {
|
||||
/**
|
||||
* The origin of the dapp issuing the notification.
|
||||
*/
|
||||
url?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* We attach context to every meta metrics event that help to qualify our
|
||||
* analytics. This type has all optional values because it represents a
|
||||
* returned object from a method call. Ideally app and userAgent are
|
||||
* defined on every event. This is confirmed in the getTrackMetaMetricsEvent
|
||||
* function, but still provides the consumer a way to override these values if
|
||||
* necessary.
|
||||
*/
|
||||
type MetaMetricsContext = {
|
||||
/**
|
||||
* Application metadata.
|
||||
*/
|
||||
app: {
|
||||
/**
|
||||
* The name of the application tracking the event.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The version of the application.
|
||||
*/
|
||||
version: string;
|
||||
};
|
||||
/**
|
||||
* The user agent of the application.
|
||||
*/
|
||||
userAgent: string;
|
||||
/**
|
||||
* An object representing details of the current page.
|
||||
*/
|
||||
page?: MetaMetricsPageObject;
|
||||
/**
|
||||
* The dapp that triggered an interaction (MetaMask only).
|
||||
*/
|
||||
referrer?: MetaMetricsReferrerObject;
|
||||
};
|
||||
|
||||
export type MetaMetricsEventPayload = {
|
||||
/**
|
||||
* The event name to track.
|
||||
*/
|
||||
event: string;
|
||||
/**
|
||||
* The category to associate the event to.
|
||||
*/
|
||||
category: string;
|
||||
/**
|
||||
* The action ID to deduplicate event requests from the UI.
|
||||
*/
|
||||
actionId?: number;
|
||||
/**
|
||||
* The type of environment this event occurred in. Defaults to the background
|
||||
* process type.
|
||||
*/
|
||||
environmentType?: string;
|
||||
/**
|
||||
* Custom values to track. Keys in this object must be `snake_case`.
|
||||
*/
|
||||
properties?: object;
|
||||
/**
|
||||
* Sensitive values to track. These properties will be sent in an additional
|
||||
* event that excludes the user's `metaMetricsId`. Keys in this object must be
|
||||
* in `snake_case`.
|
||||
*/
|
||||
sensitiveProperties?: object;
|
||||
/**
|
||||
* Amount of currency that the event creates in revenue for MetaMask.
|
||||
*/
|
||||
revenue?: number;
|
||||
/**
|
||||
* ISO-4127-formatted currency for events with revenue. Defaults to US
|
||||
* dollars.
|
||||
*/
|
||||
currency?: string;
|
||||
/**
|
||||
* Abstract business "value" attributable to customers who trigger this event.
|
||||
*/
|
||||
value?: number;
|
||||
/**
|
||||
* The page/route that the event occurred on.
|
||||
*/
|
||||
page?: MetaMetricsPageObject;
|
||||
/**
|
||||
* The origin of the dapp that triggered this event.
|
||||
*/
|
||||
referrer?: MetaMetricsReferrerObject;
|
||||
};
|
||||
|
||||
export type MetaMetricsEventOptions = {
|
||||
/**
|
||||
* Whether or not the event happened during the opt-in workflow.
|
||||
*/
|
||||
isOptIn?: boolean;
|
||||
/**
|
||||
* Whether the segment queue should be flushed after tracking the event.
|
||||
* Recommended if the result of tracking the event must be known before UI
|
||||
* transition or update.
|
||||
*/
|
||||
flushImmediately?: boolean;
|
||||
/**
|
||||
* Whether to exclude the user's `metaMetricsId` for anonymity.
|
||||
*/
|
||||
excludeMetaMetricsId?: boolean;
|
||||
/**
|
||||
* An override for the `metaMetricsId` in the event (no pun intended) one is
|
||||
* created as a part of an asynchronous workflow, such as awaiting the result
|
||||
* of the MetaMetrics opt-in function that generates the user's
|
||||
* `metaMetricsId`.
|
||||
*/
|
||||
metaMetricsId?: string;
|
||||
/**
|
||||
* Is this event a holdover from Matomo that needs further migration? When
|
||||
* true, sends the data to a special Segment source that marks the event data
|
||||
* as not conforming to our schema.
|
||||
*/
|
||||
matomoEvent?: boolean;
|
||||
};
|
||||
|
||||
export type MetaMetricsEventFragment = {
|
||||
/**
|
||||
* The event name to fire when the fragment is closed in an affirmative action.
|
||||
*/
|
||||
successEvent: string;
|
||||
/**
|
||||
* The event name to fire when the fragment is closed with a rejection.
|
||||
*/
|
||||
failureEvent?: string;
|
||||
/**
|
||||
* An event name to fire immediately upon fragment creation. This is useful
|
||||
* for building funnels in mixpanel and for reduction of code duplication.
|
||||
*/
|
||||
initialEvent?: string;
|
||||
/**
|
||||
* The event category to use for both the success and failure events.
|
||||
*/
|
||||
category: string;
|
||||
/**
|
||||
* Should this fragment be persisted in state and progressed after the
|
||||
* extension is locked and unlocked.
|
||||
*/
|
||||
persist?: boolean;
|
||||
/**
|
||||
* Time in seconds the event should be persisted for. After the timeout the
|
||||
* fragment will be closed as abandoned. If not supplied the fragment is
|
||||
* stored indefinitely.
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* `Date.now()` when the fragment was last updated. Used to determine if the
|
||||
* timeout has expired and the fragment should be closed.
|
||||
*/
|
||||
lastUpdated?: number;
|
||||
/**
|
||||
* Custom values to track. Keys in this object must be `snake_case`.
|
||||
*/
|
||||
properties?: object;
|
||||
/**
|
||||
* Sensitive values to track. These properties will be sent in an additional
|
||||
* event that excludes the user's `metaMetricsId`. Keys in this object must be
|
||||
* in `snake_case`.
|
||||
*/
|
||||
sensitiveProperties?: object;
|
||||
/**
|
||||
* Amount of currency that the event creates in revenue for MetaMask.
|
||||
*/
|
||||
revenue?: number;
|
||||
/**
|
||||
* ISO-4127-formatted currency for events with revenue. Defaults to US
|
||||
* dollars.
|
||||
*/
|
||||
currency?: string;
|
||||
/**
|
||||
* Abstract business "value" attributable to customers who trigger this event.
|
||||
*/
|
||||
value?: number;
|
||||
/**
|
||||
* The page/route that the event occurred on.
|
||||
*/
|
||||
page?: MetaMetricsPageObject;
|
||||
/**
|
||||
* The origin of the dapp that triggered this event.
|
||||
*/
|
||||
referrer?: MetaMetricsReferrerObject;
|
||||
/**
|
||||
* Overrides the automatic generation of UUID for the event fragment. This is
|
||||
* useful when tracking events for subsystems that already generate UUIDs so
|
||||
* to avoid unnecessary lookups and reduce accidental duplication.
|
||||
*/
|
||||
uniqueIdentifier?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Data sent to the `segment.track` method.
|
||||
*/
|
||||
export type SegmentEventPayload = {
|
||||
/**
|
||||
* The MetaMetrics id for the user.
|
||||
*/
|
||||
userId?: string;
|
||||
/**
|
||||
* An anonymous ID that is used to track sensitive data while preserving
|
||||
* anonymity.
|
||||
*/
|
||||
anonymousId?: string;
|
||||
/**
|
||||
* The name of the event to track.
|
||||
*/
|
||||
event: string;
|
||||
/**
|
||||
* Properties to attach to the event.
|
||||
*/
|
||||
properties: object;
|
||||
/**
|
||||
* The context the event occurred in.
|
||||
*/
|
||||
context: MetaMetricsContext;
|
||||
};
|
||||
|
||||
/**
|
||||
* Data sent to MetaMetrics for page views.
|
||||
*/
|
||||
export type MetaMetricsPagePayload = {
|
||||
/**
|
||||
* The name of the page that was viewed.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The variadic parts of the page URL.
|
||||
*
|
||||
* Example: If the route is `/asset/:asset` and the path is `/asset/ETH`,
|
||||
* the `params` property would be `{ asset: 'ETH' }`.
|
||||
*/
|
||||
params?: object;
|
||||
/**
|
||||
* The environment type that the page was viewed in.
|
||||
*/
|
||||
environmentType: EnvironmentType;
|
||||
/**
|
||||
* The details of the page.
|
||||
*/
|
||||
page?: MetaMetricsPageObject;
|
||||
/**
|
||||
* The dapp that triggered the page view.
|
||||
*/
|
||||
referrer?: MetaMetricsReferrerObject;
|
||||
};
|
||||
|
||||
export type MetaMetricsPageOptions = {
|
||||
/**
|
||||
* Is the current path one of the pages in the onboarding workflow? (If this
|
||||
* is true and participateInMetaMetrics is null, then the page view will be
|
||||
* tracked.)
|
||||
*/
|
||||
isOptInPath?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Data sent to MetaMetrics for user traits.
|
||||
*/
|
||||
export type MetaMetricsUserTraits = {
|
||||
/**
|
||||
* The number of entries in the user's address book.
|
||||
*/
|
||||
address_book_entries?: number;
|
||||
/**
|
||||
* The type of ledger connection set by user preference.
|
||||
*/
|
||||
ledger_connection_type?: LedgerTransportTypes;
|
||||
/**
|
||||
* An array consisting of chain IDs that represent the networks added by the
|
||||
* user.
|
||||
*/
|
||||
networks_added?: string[];
|
||||
/**
|
||||
* An array consisting of chain IDs that represent the networks added by the
|
||||
* user that do not have a ticker.
|
||||
*/
|
||||
networks_without_ticker?: string[];
|
||||
/**
|
||||
* Does the user have the Autodetect NFTs feature enabled?
|
||||
*/
|
||||
nft_autodetection_enabled?: number;
|
||||
/**
|
||||
* A number representing the number of identities (accounts) added to the
|
||||
* user's wallet.
|
||||
*/
|
||||
number_of_accounts?: number;
|
||||
/**
|
||||
* A number representing the amount of NFT collections from which the user
|
||||
* possesses NFTs.
|
||||
*/
|
||||
number_of_nft_collections?: number;
|
||||
/**
|
||||
* A number representing the amount of all NFTs the user possesses across all
|
||||
* networks and accounts.
|
||||
*/
|
||||
number_of_nfts?: number;
|
||||
/**
|
||||
* The total number of token contracts the user has across all networks and
|
||||
* accounts.
|
||||
*/
|
||||
number_of_tokens?: number;
|
||||
/**
|
||||
* Does the user have the OpenSea API enabled?
|
||||
*/
|
||||
opensea_api_enabled?: boolean;
|
||||
/**
|
||||
* Does the user have 3Box sync enabled?
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
three_box_enabled?: boolean;
|
||||
/**
|
||||
* Which theme the user has selected.
|
||||
*/
|
||||
theme?: string;
|
||||
/**
|
||||
* Does the user have token detection enabled?
|
||||
*/
|
||||
token_detection_enabled?: boolean;
|
||||
/**
|
||||
* Does the user have desktop enabled?
|
||||
*/
|
||||
desktop_enabled?: boolean;
|
||||
/**
|
||||
* Whether the security provider feature has been enabled.
|
||||
*/
|
||||
security_providers?: string[];
|
||||
};
|
||||
|
||||
export enum MetaMetricsUserTrait {
|
||||
/**
|
||||
* Identified when the user adds or modifies addresses in the address book.
|
||||
*/
|
||||
AddressBookEntries = 'address_book_entries',
|
||||
/**
|
||||
* Identified when the user installed the extension.
|
||||
*/
|
||||
InstallDateExt = 'install_date_ext',
|
||||
/**
|
||||
* Identified when the Ledger Live connection type is changed.
|
||||
*/
|
||||
LedgerConnectionType = 'ledger_connection_type',
|
||||
/**
|
||||
* Identified when the user modifies networks.
|
||||
*/
|
||||
NetworksAdded = 'networks_added',
|
||||
/**
|
||||
* Identified when the user modifies networks that lack a ticker.
|
||||
*/
|
||||
NetworksWithoutTicker = 'networks_without_ticker',
|
||||
/**
|
||||
* Identified when the "Autodetect NFTs" feature is toggled.
|
||||
*/
|
||||
NftAutodetectionEnabled = 'nft_autodetection_enabled',
|
||||
/**
|
||||
* Identified when identities change.
|
||||
*/
|
||||
NumberOfAccounts = 'number_of_accounts',
|
||||
/**
|
||||
* The number of unique NFT addresses.
|
||||
*/
|
||||
NumberOfNftCollections = 'number_of_nft_collections',
|
||||
/**
|
||||
* Identified when the number of NFTs owned by the user changes.
|
||||
*/
|
||||
NumberOfNfts = 'number_of_nfts',
|
||||
/**
|
||||
* Identified when the number of tokens change.
|
||||
*/
|
||||
NumberOfTokens = 'number_of_tokens',
|
||||
/**
|
||||
* Identified when the OpenSea API is enabled.
|
||||
*/
|
||||
OpenSeaApiEnabled = 'opensea_api_enabled',
|
||||
/**
|
||||
* Identified when the user's theme changes.
|
||||
*/
|
||||
Theme = 'theme',
|
||||
/**
|
||||
* Identified when the 3Box feature is toggled.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
ThreeBoxEnabled = 'three_box_enabled',
|
||||
/**
|
||||
* Identified when the token detection feature is toggled.
|
||||
*/
|
||||
TokenDetectionEnabled = 'token_detection_enabled',
|
||||
/**
|
||||
* Identified when the user enables desktop.
|
||||
*/
|
||||
DesktopEnabled = 'desktop_enabled',
|
||||
/**
|
||||
* Identified when the security provider feature is enabled.
|
||||
*/
|
||||
SecurityProviders = 'security_providers',
|
||||
}
|
||||
|
||||
/**
|
||||
* Mixpanel converts the zero address value to a truly anonymous event, which
|
||||
* speeds up reporting
|
||||
*/
|
||||
export const METAMETRICS_ANONYMOUS_ID = '0x0000000000000000';
|
||||
|
||||
/**
|
||||
* Used to identify events that are triggered by the background process.
|
||||
*/
|
||||
export const METAMETRICS_BACKGROUND_PAGE_OBJECT: MetaMetricsPageObject = {
|
||||
path: '/background-process',
|
||||
title: 'Background Process',
|
||||
url: '/background-process',
|
||||
};
|
||||
|
||||
export const REJECT_NOTIFICATION_CLOSE = 'Cancel Via Notification Close';
|
||||
|
||||
export const REJECT_NOTIFICATION_CLOSE_SIG =
|
||||
'Cancel Sig Request Via Notification Close';
|
||||
|
||||
export enum MetaMetricsEventName {
|
||||
AccountAdded = 'Account Added',
|
||||
AccountAddSelected = 'Account Add Selected',
|
||||
AccountAddFailed = 'Account Add Failed',
|
||||
AccountPasswordCreated = 'Account Password Created',
|
||||
AccountReset = 'Account Reset',
|
||||
AppInstalled = 'App Installed',
|
||||
AppUnlocked = 'App Unlocked',
|
||||
AppUnlockedFailed = 'App Unlocked Failed',
|
||||
AppWindowExpanded = 'App Window Expanded',
|
||||
BridgeLinkClicked = 'Bridge Link Clicked',
|
||||
DecryptionApproved = 'Decryption Approved',
|
||||
DecryptionRejected = 'Decryption Rejected',
|
||||
DecryptionRequested = 'Decryption Requested',
|
||||
EncryptionPublicKeyApproved = 'Encryption Approved',
|
||||
EncryptionPublicKeyRejected = 'Encryption Rejected',
|
||||
EncryptionPublicKeyRequested = 'Encryption Requested',
|
||||
ExternalLinkClicked = 'External Link Clicked',
|
||||
KeyExportSelected = 'Key Export Selected',
|
||||
KeyExportRequested = 'Key Export Requested',
|
||||
KeyExportFailed = 'Key Export Failed',
|
||||
KeyExportCanceled = 'Key Export Canceled',
|
||||
KeyExportRevealed = 'Key Material Revealed',
|
||||
KeyExportCopied = 'Key Material Copied',
|
||||
KeyTokenDetectionSelected = 'Key Token Detection Selected',
|
||||
KeyGlobalSecurityToggleSelected = 'Key Global Security/Privacy Settings',
|
||||
KeyBalanceTokenPriceChecker = 'Key Show Balance and Token Price Checker Settings',
|
||||
KeyGasFeeEstimationBuySwapTokens = 'Key Show Gas Fee Estimation, Buy Crypto and Swap Tokens',
|
||||
KeyAutoDetectTokens = 'Key Autodetect tokens',
|
||||
KeyBatchAccountBalanceRequests = 'Key Batch account balance requests',
|
||||
MetricsOptIn = 'Metrics Opt In',
|
||||
MetricsOptOut = 'Metrics Opt Out',
|
||||
NavAccountMenuOpened = 'Account Menu Opened',
|
||||
NavAccountDetailsOpened = 'Account Details Opened',
|
||||
NavConnectedSitesOpened = 'Connected Sites Opened',
|
||||
NavMainMenuOpened = 'Main Menu Opened',
|
||||
NavNetworkMenuOpened = 'Network Menu Opened',
|
||||
NavSettingsOpened = 'Settings Opened',
|
||||
NavAccountSwitched = 'Account Switched',
|
||||
NavNetworkSwitched = 'Network Switched',
|
||||
NavBuyButtonClicked = 'Buy Button Clicked',
|
||||
NavSendButtonClicked = 'Send Button Clicked',
|
||||
NavSwapButtonClicked = 'Swap Button Clicked',
|
||||
SrpToConfirmBackup = 'SRP Backup Confirm Displayed',
|
||||
WalletSetupStarted = 'Wallet Setup Selected',
|
||||
WalletSetupCanceled = 'Wallet Setup Canceled',
|
||||
WalletSetupFailed = 'Wallet Setup Failed',
|
||||
WalletCreated = 'Wallet Created',
|
||||
NftAdded = 'NFT Added',
|
||||
OnrampProviderSelected = 'On-ramp Provider Selected',
|
||||
PermissionsApproved = 'Permissions Approved',
|
||||
PermissionsRejected = 'Permissions Rejected',
|
||||
PermissionsRequested = 'Permissions Requested',
|
||||
PhishingPageDisplayed = 'Phishing Page Displayed',
|
||||
PortfolioLinkClicked = 'Portfolio Link Clicked',
|
||||
PublicAddressCopied = 'Public Address Copied',
|
||||
ProviderMethodCalled = 'Provider Method Called',
|
||||
SignatureApproved = 'Signature Approved',
|
||||
SignatureFailed = 'Signature Failed',
|
||||
SignatureRejected = 'Signature Rejected',
|
||||
SignatureRequested = 'Signature Requested',
|
||||
TokenImportButtonClicked = 'Import Token Button Clicked',
|
||||
TokenScreenOpened = 'Token Screen Opened',
|
||||
SupportLinkClicked = 'Support Link Clicked',
|
||||
TokenAdded = 'Token Added',
|
||||
TokenDetected = 'Token Detected',
|
||||
TokenHidden = 'Token Hidden',
|
||||
TokenImportCanceled = 'Token Import Canceled',
|
||||
TokenImportClicked = 'Token Import Clicked',
|
||||
OnboardingWelcome = 'App Installed',
|
||||
OnboardingWalletCreationStarted = 'Wallet Setup Selected',
|
||||
OnboardingWalletImportStarted = 'Wallet Import Started',
|
||||
OnboardingWalletCreationAttempted = 'Wallet Password Created',
|
||||
OnboardingWalletSecurityStarted = 'SRP Backup Selected',
|
||||
OnboardingWalletSecuritySkipInitiated = 'SRP Skip Backup Selected',
|
||||
OnboardingWalletSecuritySkipConfirmed = 'SRP Backup Skipped',
|
||||
OnboardingWalletSecuritySkipCanceled = 'SRP Skip Backup Canceled',
|
||||
OnboardingWalletSecurityPhraseRevealed = 'SRP Revealed',
|
||||
OnboardingWalletSecurityPhraseWrittenDown = 'SRP Backup Confirm Display',
|
||||
OnboardingWalletSecurityPhraseConfirmed = 'SRP Backup Confirmed',
|
||||
OnboardingWalletCreationComplete = 'Wallet Created',
|
||||
OnboardingWalletSetupComplete = 'Application Opened',
|
||||
OnboardingWalletAdvancedSettings = 'Settings Updated',
|
||||
OnboardingWalletImportAttempted = 'Wallet Import Attempted',
|
||||
OnboardingWalletVideoPlay = 'SRP Intro Video Played',
|
||||
OnboardingTwitterClick = 'External Link Clicked',
|
||||
ServiceWorkerRestarted = 'Service Worker Restarted',
|
||||
}
|
||||
|
||||
export enum MetaMetricsEventAccountType {
|
||||
Default = 'metamask',
|
||||
Imported = 'imported',
|
||||
Hardware = 'hardware',
|
||||
}
|
||||
|
||||
export enum MetaMetricsEventAccountImportType {
|
||||
Json = 'json',
|
||||
PrivateKey = 'private_key',
|
||||
Srp = 'srp',
|
||||
}
|
||||
|
||||
export enum MetaMetricsEventCategory {
|
||||
Accounts = 'Accounts',
|
||||
App = 'App',
|
||||
Auth = 'Auth',
|
||||
Background = 'Background',
|
||||
// The TypeScript ESLint rule is incorrectly marking this line.
|
||||
/* eslint-disable-next-line @typescript-eslint/no-shadow */
|
||||
Error = 'Error',
|
||||
Footer = 'Footer',
|
||||
Home = 'Home',
|
||||
InpageProvider = 'inpage_provider',
|
||||
Keys = 'Keys',
|
||||
Messages = 'Messages',
|
||||
Navigation = 'Navigation',
|
||||
Network = 'Network',
|
||||
Onboarding = 'Onboarding',
|
||||
Phishing = 'Phishing',
|
||||
Retention = 'Retention',
|
||||
Settings = 'Settings',
|
||||
Snaps = 'Snaps',
|
||||
Swaps = 'Swaps',
|
||||
Transactions = 'Transactions',
|
||||
Wallet = 'Wallet',
|
||||
Desktop = 'Desktop',
|
||||
ServiceWorkers = 'service_workers',
|
||||
}
|
||||
|
||||
export enum MetaMetricsEventLinkType {
|
||||
TransactionBlockExplorer = 'Transaction Block Explorer',
|
||||
BlockExplorer = 'Block Explorer',
|
||||
AccountTracker = 'Account Tracker',
|
||||
TokenTracker = 'Token Tracker',
|
||||
}
|
||||
|
||||
export enum MetaMetricsEventKeyType {
|
||||
Pkey = 'private_key',
|
||||
Srp = 'srp',
|
||||
}
|
||||
|
||||
// NOTE: This doesn't seem to be used at all
|
||||
export enum MetaMetricsEventOnrampProviderType {
|
||||
Coinbase = 'coinbase',
|
||||
Moonpay = 'moonpay',
|
||||
Wyre = 'wyre',
|
||||
Transak = 'transak',
|
||||
SelfDeposit = 'direct_deposit',
|
||||
}
|
||||
|
||||
export enum MetaMetricsNetworkEventSource {
|
||||
CustomNetworkForm = 'custom_network_form',
|
||||
PopularNetworkList = 'popular_network_list',
|
||||
Dapp = 'dapp',
|
||||
}
|
||||
|
||||
export enum MetaMetricsSwapsEventSource {
|
||||
MainView = 'Main View',
|
||||
TokenView = 'Token View',
|
||||
}
|
||||
|
||||
export enum MetaMetricsTokenEventSource {
|
||||
Custom = 'custom',
|
||||
Dapp = 'dapp',
|
||||
Detected = 'detected',
|
||||
List = 'list',
|
||||
}
|
||||
|
||||
export enum MetaMetricsTransactionEventSource {
|
||||
Dapp = 'dapp',
|
||||
User = 'user',
|
||||
}
|
||||
|
||||
export enum MetaMetricsEventLocation {
|
||||
TokenDetails = 'token_details',
|
||||
TokenDetection = 'token_detection',
|
||||
TokenMenu = 'token_menu',
|
||||
}
|
||||
|
||||
export enum MetaMetricsEventUiCustomization {
|
||||
FlaggedAsMalicious = 'flagged_as_malicious',
|
||||
FlaggedAsSafetyUnknown = 'flagged_as_safety_unknown',
|
||||
Siwe = 'sign_in_with_ethereum',
|
||||
}
|
||||
|
||||
/**
|
||||
* Values that can used in the "properties" tracking object as keys, e.g. `{
|
||||
* location: 'Home' }`.
|
||||
*/
|
||||
export enum MetaMetricsContextProp {
|
||||
PageTitle = 'location',
|
||||
}
|
@ -6,9 +6,10 @@ import InputAdornment from '@material-ui/core/InputAdornment';
|
||||
import classnames from 'classnames';
|
||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventAccountType,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
|
||||
import Identicon from '../../ui/identicon';
|
||||
@ -209,8 +210,8 @@ export default class AccountMenu extends Component {
|
||||
className="account-menu__account account-menu__item--clickable"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.NAV_ACCOUNT_SWITCHED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.NavAccountSwitched,
|
||||
properties: {
|
||||
location: 'Main Menu',
|
||||
},
|
||||
@ -360,10 +361,10 @@ export default class AccountMenu extends Component {
|
||||
onClick={() => {
|
||||
toggleAccountMenu();
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.ACCOUNT_ADD_SELECTED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.AccountAddSelected,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||
account_type: MetaMetricsEventAccountType.Default,
|
||||
location: 'Main Menu',
|
||||
},
|
||||
});
|
||||
@ -378,10 +379,10 @@ export default class AccountMenu extends Component {
|
||||
onClick={() => {
|
||||
toggleAccountMenu();
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.ACCOUNT_ADD_SELECTED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.AccountAddSelected,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||
account_type: MetaMetricsEventAccountType.Imported,
|
||||
location: 'Main Menu',
|
||||
},
|
||||
});
|
||||
@ -396,10 +397,10 @@ export default class AccountMenu extends Component {
|
||||
onClick={() => {
|
||||
toggleAccountMenu();
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.ACCOUNT_ADD_SELECTED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.AccountAddSelected,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.HARDWARE,
|
||||
account_type: MetaMetricsEventAccountType.Hardware,
|
||||
location: 'Main Menu',
|
||||
},
|
||||
});
|
||||
@ -446,14 +447,16 @@ export default class AccountMenu extends Component {
|
||||
onClick={() => {
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: supportLink,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
global.platform.openTab({ url: supportLink });
|
||||
@ -472,8 +475,8 @@ export default class AccountMenu extends Component {
|
||||
toggleAccountMenu();
|
||||
history.push(SETTINGS_ROUTE);
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.NAV_SETTINGS_OPENED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.NavSettingsOpened,
|
||||
properties: {
|
||||
location: 'Main Menu',
|
||||
},
|
||||
|
@ -37,7 +37,7 @@ import { ADD_NETWORK_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
|
||||
import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
|
||||
import { Icon, ICON_NAMES, ICON_SIZES, Text } from '../../component-library';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsNetworkEventSource } from '../../../../shared/constants/metametrics';
|
||||
|
||||
const AddNetwork = () => {
|
||||
const t = useContext(I18nContext);
|
||||
@ -267,7 +267,8 @@ const AddNetwork = () => {
|
||||
imageUrl: item.rpcPrefs?.imageUrl,
|
||||
chainName: item.nickname,
|
||||
referrer: ORIGIN_METAMASK,
|
||||
source: EVENT.SOURCE.NETWORK.POPULAR_NETWORK_LIST,
|
||||
source:
|
||||
MetaMetricsNetworkEventSource.PopularNetworkList,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
@ -4,7 +4,10 @@ import classnames from 'classnames';
|
||||
import Identicon from '../../ui/identicon';
|
||||
import MetaFoxLogo from '../../ui/metafox-logo';
|
||||
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import NetworkDisplay from '../network-display';
|
||||
|
||||
///: BEGIN:ONLY_INCLUDE_IN(beta)
|
||||
@ -57,8 +60,8 @@ export default class AppHeader extends PureComponent {
|
||||
|
||||
if (networkDropdownOpen === false) {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.NAV_NETWORK_MENU_OPENED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.NavNetworkMenuOpened,
|
||||
properties: {},
|
||||
});
|
||||
showNetworkDropdown();
|
||||
@ -90,8 +93,8 @@ export default class AppHeader extends PureComponent {
|
||||
if (!disabled) {
|
||||
!isAccountMenuOpen &&
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.NAV_MAIN_MENU_OPENED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.NavMainMenuOpened,
|
||||
properties: {},
|
||||
});
|
||||
toggleAccountMenu();
|
||||
|
@ -13,7 +13,7 @@ import { startNewDraftTransaction } from '../../../ducks/send';
|
||||
import { SEND_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { Color, SEVERITIES } from '../../../helpers/constants/design-system';
|
||||
import { INVALID_ASSET_TYPE } from '../../../helpers/constants/error-keys';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import { AssetType } from '../../../../shared/constants/transaction';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
|
||||
@ -68,7 +68,7 @@ const AssetListItem = ({
|
||||
e.stopPropagation();
|
||||
trackEvent({
|
||||
event: 'Clicked Send: Token',
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
action: 'Home',
|
||||
legacy_event: true,
|
||||
|
@ -24,7 +24,10 @@ import {
|
||||
} from '../../../helpers/constants/design-system';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import DetectedToken from '../detected-token/detected-token';
|
||||
import {
|
||||
DetectedTokensBanner,
|
||||
@ -110,8 +113,8 @@ const AssetList = ({ onClickAsset }) => {
|
||||
onTokenClick={(tokenAddress) => {
|
||||
onClickAsset(tokenAddress);
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_SCREEN_OPENED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.TokenScreenOpened,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
token_symbol: primaryCurrencyProperties.suffix,
|
||||
location: 'Home',
|
||||
|
@ -9,8 +9,9 @@ import { useI18nContext } from '../../../../hooks/useI18nContext';
|
||||
import { getDetectedTokensInCurrentNetwork } from '../../../../selectors';
|
||||
import { MetaMetricsContext } from '../../../../contexts/metametrics';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsTokenEventSource,
|
||||
} from '../../../../../shared/constants/metametrics';
|
||||
|
||||
const DetectedTokensLink = ({ className = '', setShowDetectedTokens }) => {
|
||||
@ -25,10 +26,10 @@ const DetectedTokensLink = ({ className = '', setShowDetectedTokens }) => {
|
||||
const onClick = () => {
|
||||
setShowDetectedTokens(true);
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_IMPORT_CLICKED,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.TokenImportClicked,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
properties: {
|
||||
source: EVENT.SOURCE.TOKEN.DETECTED,
|
||||
source: MetaMetricsTokenEventSource.Detected,
|
||||
tokens: detectedTokensDetails,
|
||||
},
|
||||
});
|
||||
|
@ -44,7 +44,10 @@ import {
|
||||
} from '../../../selectors';
|
||||
import useRamps from '../../../hooks/experiences/useRamps';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
ConfirmPageContainerHeader,
|
||||
ConfirmPageContainerContent,
|
||||
@ -250,8 +253,8 @@ const ConfirmPageContainer = (props) => {
|
||||
onClick={() => {
|
||||
openBuyCryptoInPdapp();
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_BUY_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavBuyButtonClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Transaction Confirmation',
|
||||
text: 'Buy',
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
} from '../../../store/actions';
|
||||
import { SECOND } from '../../../../shared/constants/time';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
|
||||
const DESKTOP_ERROR_DESKTOP_OUTDATED_ROUTE = `${DESKTOP_ERROR_ROUTE}/${EXTENSION_ERROR_PAGE_TYPES.DESKTOP_OUTDATED}`;
|
||||
const DESKTOP_ERROR_EXTENSION_OUTDATED_ROUTE = `${DESKTOP_ERROR_ROUTE}/${EXTENSION_ERROR_PAGE_TYPES.EXTENSION_OUTDATED}`;
|
||||
@ -45,7 +45,7 @@ export default function DesktopEnableButton() {
|
||||
await disableDesktop();
|
||||
setDesktopEnabled(false);
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.DESKTOP,
|
||||
category: MetaMetricsEventCategory.Desktop,
|
||||
event: DESKTOP_UPDATE_SETTINGS_EVENT,
|
||||
properties: {
|
||||
desktop_enabled: false,
|
||||
@ -90,7 +90,7 @@ export default function DesktopEnableButton() {
|
||||
}
|
||||
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.DESKTOP,
|
||||
category: MetaMetricsEventCategory.Desktop,
|
||||
event: 'Desktop Button Clicked',
|
||||
properties: {
|
||||
button_action: 'Enable MetaMask Desktop',
|
||||
|
@ -5,8 +5,9 @@ import { useSelector } from 'react-redux';
|
||||
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
||||
import { MetaMetricsContext } from '../../../../contexts/metametrics';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsTokenEventSource,
|
||||
} from '../../../../../shared/constants/metametrics';
|
||||
import { getDetectedTokensInCurrentNetwork } from '../../../../selectors';
|
||||
|
||||
@ -40,10 +41,10 @@ const DetectedTokenSelectionPopover = ({
|
||||
({ address, symbol }) => `${symbol} - ${address}`,
|
||||
);
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_IMPORT_CANCELED,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.TokenImportCanceled,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
properties: {
|
||||
source: EVENT.SOURCE.TOKEN.DETECTED,
|
||||
source: MetaMetricsTokenEventSource.Detected,
|
||||
tokens: eventTokensDetails,
|
||||
},
|
||||
});
|
||||
|
@ -15,7 +15,12 @@ import {
|
||||
AssetType,
|
||||
TokenStandard,
|
||||
} from '../../../../shared/constants/transaction';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventLocation,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsTokenEventSource,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import DetectedTokenSelectionPopover from './detected-token-selection-popover/detected-token-selection-popover';
|
||||
import DetectedTokenIgnoredPopover from './detected-token-ignored-popover/detected-token-ignored-popover';
|
||||
|
||||
@ -58,13 +63,13 @@ const DetectedToken = ({ setShowDetectedTokens }) => {
|
||||
const importSelectedTokens = async (selectedTokens) => {
|
||||
selectedTokens.forEach((importedToken) => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_ADDED,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.TokenAdded,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
sensitiveProperties: {
|
||||
token_symbol: importedToken.symbol,
|
||||
token_contract_address: importedToken.address,
|
||||
token_decimal_precision: importedToken.decimals,
|
||||
source: EVENT.SOURCE.TOKEN.DETECTED,
|
||||
source: MetaMetricsTokenEventSource.Detected,
|
||||
token_standard: TokenStandard.ERC20,
|
||||
asset_type: AssetType.token,
|
||||
},
|
||||
@ -86,11 +91,11 @@ const DetectedToken = ({ setShowDetectedTokens }) => {
|
||||
({ symbol, address }) => `${symbol} - ${address}`,
|
||||
);
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_HIDDEN,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.TokenHidden,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
sensitiveProperties: {
|
||||
tokens: tokensDetailsList,
|
||||
location: EVENT.LOCATION.TOKEN_DETECTION,
|
||||
location: MetaMetricsEventLocation.TokenDetection,
|
||||
token_standard: TokenStandard.ERC20,
|
||||
asset_type: AssetType.token,
|
||||
},
|
||||
|
@ -23,7 +23,11 @@ import { IconColor, Size } from '../../../helpers/constants/design-system';
|
||||
import { getShowTestNetworks } from '../../../selectors';
|
||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
|
||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsNetworkEventSource,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
ADD_POPULAR_CUSTOM_NETWORK,
|
||||
ADVANCED_ROUTE,
|
||||
@ -127,8 +131,8 @@ class NetworkDropdown extends Component {
|
||||
const { trackEvent } = this.context;
|
||||
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.NAV_NETWORK_SWITCHED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.NavNetworkSwitched,
|
||||
properties: {
|
||||
from_network: providerType,
|
||||
to_network: newProviderType,
|
||||
@ -320,7 +324,7 @@ class NetworkDropdown extends Component {
|
||||
},
|
||||
{
|
||||
setActive: true,
|
||||
source: EVENT.SOURCE.NETWORK.CUSTOM_NETWORK_FORM,
|
||||
source: MetaMetricsNetworkEventSource.CustomNetworkForm,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -8,7 +8,10 @@ import Box from '../../ui/box/box';
|
||||
import { TEXT_ALIGN } from '../../../helpers/constants/design-system';
|
||||
import { detectNewTokens } from '../../../store/actions';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
getIsTokenDetectionSupported,
|
||||
getIsTokenDetectionInactiveOnMainnet,
|
||||
@ -51,8 +54,8 @@ export default function ImportTokenLink() {
|
||||
onClick={() => {
|
||||
history.push(IMPORT_TOKEN_ROUTE);
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_IMPORT_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.TokenImportButtonClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Home',
|
||||
},
|
||||
|
@ -22,7 +22,11 @@ import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
|
||||
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app';
|
||||
import { KeyringType } from '../../../../shared/constants/keyring';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventLinkType,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { ICON_NAMES } from '../../component-library';
|
||||
|
||||
@ -50,10 +54,10 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
||||
|
||||
const openBlockExplorer = () => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.EXTERNAL_LINK_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.ExternalLinkClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
link_type: EVENT.EXTERNAL_LINK_TYPES.ACCOUNT_TRACKER,
|
||||
link_type: MetaMetricsEventLinkType.AccountTracker,
|
||||
location: 'Account Options',
|
||||
url_domain: getURLHostName(addressLink),
|
||||
},
|
||||
@ -96,8 +100,8 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.APP_WINDOW_EXPANDED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.AppWindowExpanded,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Account Options',
|
||||
},
|
||||
@ -115,8 +119,8 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
||||
onClick={() => {
|
||||
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }));
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_ACCOUNT_DETAILS_OPENED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavAccountDetailsOpened,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Account Options',
|
||||
},
|
||||
@ -131,8 +135,8 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
||||
data-testid="account-options-menu__connected-sites"
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_CONNECTED_SITES_OPENED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavConnectedSitesOpened,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Account Options',
|
||||
},
|
||||
|
@ -6,7 +6,10 @@ import SelectedAccount from '../selected-account';
|
||||
import ConnectedStatusIndicator from '../connected-status-indicator';
|
||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
|
||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { CONNECTED_ACCOUNTS_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { getOriginOfCurrentTab } from '../../../selectors';
|
||||
@ -44,8 +47,8 @@ export default function MenuBar() {
|
||||
ariaLabel={t('accountOptions')}
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_ACCOUNT_MENU_OPENED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavAccountMenuOpened,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Home',
|
||||
},
|
||||
|
@ -9,8 +9,10 @@ import Button from '../../../ui/button';
|
||||
import { getURLHostName } from '../../../../helpers/utils/util';
|
||||
import { isHardwareKeyring } from '../../../../helpers/utils/hardware';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventLinkType,
|
||||
MetaMetricsEventKeyType,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../../shared/constants/metametrics';
|
||||
import { NETWORKS_ROUTE } from '../../../../helpers/constants/routes';
|
||||
|
||||
@ -65,10 +67,10 @@ export default class AccountDetailsModal extends Component {
|
||||
const openBlockExplorer = () => {
|
||||
const accountLink = getAccountLink(address, chainId, rpcPrefs);
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.EXTERNAL_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.ExternalLinkClicked,
|
||||
properties: {
|
||||
link_type: EVENT.EXTERNAL_LINK_TYPES.ACCOUNT_TRACKER,
|
||||
link_type: MetaMetricsEventLinkType.AccountTracker,
|
||||
location: 'Account Details Modal',
|
||||
url_domain: getURLHostName(accountLink),
|
||||
},
|
||||
@ -115,10 +117,10 @@ export default class AccountDetailsModal extends Component {
|
||||
className="account-details-modal__button"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.ACCOUNTS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_SELECTED,
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
event: MetaMetricsEventName.KeyExportSelected,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.PKEY,
|
||||
key_type: MetaMetricsEventKeyType.Pkey,
|
||||
location: 'Account Details Modal',
|
||||
},
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import { getAccountLink } from '@metamask/etherscan-link';
|
||||
import Modal from '../../modal';
|
||||
import { addressSummary, getURLHostName } from '../../../../helpers/utils/util';
|
||||
import Identicon from '../../../ui/identicon';
|
||||
import { EVENT } from '../../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../../shared/constants/metametrics';
|
||||
import ZENDESK_URLS from '../../../../helpers/constants/zendesk-url';
|
||||
|
||||
export default class ConfirmRemoveAccount extends Component {
|
||||
@ -62,7 +62,7 @@ export default class ConfirmRemoveAccount extends Component {
|
||||
rpcPrefs,
|
||||
);
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.ACCOUNTS,
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
event: 'Clicked Block Explorer Link',
|
||||
properties: {
|
||||
link_type: 'Account Tracker',
|
||||
|
@ -10,8 +10,9 @@ import {
|
||||
stripHexPrefix,
|
||||
} from '../../../../../shared/modules/hexstring-utils';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventKeyType,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../../shared/constants/metametrics';
|
||||
|
||||
export default class ExportPrivateKeyModal extends Component {
|
||||
@ -53,10 +54,10 @@ export default class ExportPrivateKeyModal extends Component {
|
||||
exportAccount(password, address)
|
||||
.then((privateKey) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_REVEALED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportRevealed,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.PKEY,
|
||||
key_type: MetaMetricsEventKeyType.Pkey,
|
||||
},
|
||||
});
|
||||
|
||||
@ -67,10 +68,10 @@ export default class ExportPrivateKeyModal extends Component {
|
||||
})
|
||||
.catch((e) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_FAILED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportFailed,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.PKEY,
|
||||
key_type: MetaMetricsEventKeyType.Pkey,
|
||||
reason: 'incorrect_password',
|
||||
},
|
||||
});
|
||||
@ -108,10 +109,10 @@ export default class ExportPrivateKeyModal extends Component {
|
||||
onClick={() => {
|
||||
copyToClipboard(plainKey);
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_COPIED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportCopied,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.PKEY,
|
||||
key_type: MetaMetricsEventKeyType.Pkey,
|
||||
copy_method: 'clipboard',
|
||||
},
|
||||
});
|
||||
@ -132,10 +133,10 @@ export default class ExportPrivateKeyModal extends Component {
|
||||
className="export-private-key-modal__button export-private-key-modal__button--cancel"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_CANCELED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportCanceled,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.PKEY,
|
||||
key_type: MetaMetricsEventKeyType.Pkey,
|
||||
},
|
||||
});
|
||||
hideModal();
|
||||
@ -159,10 +160,10 @@ export default class ExportPrivateKeyModal extends Component {
|
||||
<Button
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_REQUESTED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportRequested,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.PKEY,
|
||||
key_type: MetaMetricsEventKeyType.Pkey,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
WALLET_SNAP_PERMISSION_KEY,
|
||||
} from '@metamask/rpc-methods';
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import { PageContainerFooter } from '../../ui/page-container';
|
||||
import PermissionsConnectFooter from '../permissions-connect-footer';
|
||||
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
||||
@ -116,7 +116,7 @@ export default class PermissionPageContainer extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.AUTH,
|
||||
category: MetaMetricsEventCategory.Auth,
|
||||
event: 'Tab Opened',
|
||||
properties: {
|
||||
action: 'Connect',
|
||||
|
@ -3,7 +3,7 @@ import { memoize } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import LedgerInstructionField from '../ledger-instruction-field';
|
||||
import { sanitizeMessage, getURLHostName } from '../../../helpers/utils/util';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import SiteOrigin from '../../ui/site-origin';
|
||||
import Button from '../../ui/button';
|
||||
import Typography from '../../ui/typography/typography';
|
||||
@ -196,7 +196,7 @@ export default class SignatureRequest extends PureComponent {
|
||||
const onSign = (event) => {
|
||||
sign(event);
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'Confirm',
|
||||
properties: {
|
||||
action: 'Sign Request',
|
||||
@ -210,7 +210,7 @@ export default class SignatureRequest extends PureComponent {
|
||||
const onCancel = (event) => {
|
||||
cancel(event);
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'Cancel',
|
||||
properties: {
|
||||
action: 'Sign Request',
|
||||
|
@ -4,7 +4,7 @@ import classnames from 'classnames';
|
||||
|
||||
import { getBlockExplorerLink } from '@metamask/etherscan-link';
|
||||
import { formatDate, getURLHostName } from '../../../helpers/utils/util';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import { getValueFromWeiHex } from '../../../../shared/modules/conversion.utils';
|
||||
import TransactionActivityLogIcon from './transaction-activity-log-icon';
|
||||
import { CONFIRMED_STATUS } from './transaction-activity-log.constants';
|
||||
@ -34,7 +34,7 @@ export default class TransactionActivityLog extends PureComponent {
|
||||
const etherscanUrl = getBlockExplorerLink(activity, rpcPrefs);
|
||||
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'Clicked Block Explorer Link',
|
||||
properties: {
|
||||
link_type: 'Transaction Block Explorer',
|
||||
|
@ -12,7 +12,7 @@ import Tooltip from '../../ui/tooltip';
|
||||
import CancelButton from '../cancel-button';
|
||||
import Popover from '../../ui/popover';
|
||||
import { SECOND } from '../../../../shared/constants/time';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import { TransactionType } from '../../../../shared/constants/transaction';
|
||||
import { getURLHostName } from '../../../helpers/utils/util';
|
||||
import TransactionDecoding from '../transaction-decoding';
|
||||
@ -76,7 +76,7 @@ export default class TransactionListItemDetails extends PureComponent {
|
||||
history.push(`${NETWORKS_ROUTE}#blockExplorerUrl`);
|
||||
} else {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'Clicked Block Explorer Link',
|
||||
properties: {
|
||||
link_type: 'Transaction Block Explorer',
|
||||
@ -109,7 +109,7 @@ export default class TransactionListItemDetails extends PureComponent {
|
||||
const { hash } = transaction;
|
||||
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Copied Transaction ID',
|
||||
properties: {
|
||||
action: 'Activity Log',
|
||||
@ -250,7 +250,7 @@ export default class TransactionListItemDetails extends PureComponent {
|
||||
senderAddress={senderAddress}
|
||||
onRecipientClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Copied "To" Address',
|
||||
properties: {
|
||||
action: 'Activity Log',
|
||||
@ -260,7 +260,7 @@ export default class TransactionListItemDetails extends PureComponent {
|
||||
}}
|
||||
onSenderClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Copied "From" Address',
|
||||
properties: {
|
||||
action: 'Activity Log',
|
||||
|
@ -13,7 +13,7 @@ import { CONFIRM_TRANSACTION_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { useShouldShowSpeedUp } from '../../../hooks/useShouldShowSpeedUp';
|
||||
import TransactionStatusLabel from '../transaction-status-label/transaction-status-label';
|
||||
import TransactionIcon from '../transaction-icon';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
TransactionGroupCategory,
|
||||
TransactionStatus,
|
||||
@ -65,7 +65,7 @@ function TransactionListItemInner({
|
||||
event.stopPropagation();
|
||||
trackEvent({
|
||||
event: 'Clicked "Speed Up"',
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
action: 'Activity Log',
|
||||
legacy_event: true,
|
||||
@ -86,7 +86,7 @@ function TransactionListItemInner({
|
||||
event.stopPropagation();
|
||||
trackEvent({
|
||||
event: 'Clicked "Cancel"',
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
action: 'Activity Log',
|
||||
legacy_event: true,
|
||||
|
@ -29,9 +29,10 @@ import IconButton from '../../ui/icon-button';
|
||||
import { isHardwareKeyring } from '../../../helpers/utils/hardware';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsSwapsEventSource,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import Spinner from '../../ui/spinner';
|
||||
import { startNewDraftTransaction } from '../../../ducks/send';
|
||||
@ -110,15 +111,15 @@ const EthOverview = ({ className }) => {
|
||||
});
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.HOME,
|
||||
event: EVENT_NAMES.PORTFOLIO_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Home,
|
||||
event: MetaMetricsEventName.PortfolioLinkClicked,
|
||||
properties: {
|
||||
url: portfolioUrl,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [
|
||||
CONTEXT_PROPS.PAGE_TITLE,
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
@ -154,8 +155,8 @@ const EthOverview = ({ className }) => {
|
||||
onClick={() => {
|
||||
openBuyCryptoInPdapp();
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_BUY_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavBuyButtonClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Home',
|
||||
text: 'Buy',
|
||||
@ -175,8 +176,8 @@ const EthOverview = ({ className }) => {
|
||||
label={t('send')}
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_SEND_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavSendButtonClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
token_symbol: 'ETH',
|
||||
location: 'Home',
|
||||
@ -202,11 +203,11 @@ const EthOverview = ({ className }) => {
|
||||
onClick={() => {
|
||||
if (isSwapsChain) {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_SWAP_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
event: MetaMetricsEventName.NavSwapButtonClicked,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
properties: {
|
||||
token_symbol: 'ETH',
|
||||
location: EVENT.SOURCE.SWAPS.MAIN_VIEW,
|
||||
location: MetaMetricsSwapsEventSource.MainView,
|
||||
text: 'Swap',
|
||||
},
|
||||
});
|
||||
@ -248,8 +249,8 @@ const EthOverview = ({ className }) => {
|
||||
url: `${bridgeUrl}?metamaskEntry=ext`,
|
||||
});
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.BRIDGE_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.BridgeLinkClicked,
|
||||
properties: {
|
||||
location: 'Home',
|
||||
text: 'Bridge',
|
||||
|
@ -27,9 +27,10 @@ import { INVALID_ASSET_TYPE } from '../../../helpers/constants/error-keys';
|
||||
import { showModal } from '../../../store/actions';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsSwapsEventSource,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { AssetType } from '../../../../shared/constants/transaction';
|
||||
import useRamps from '../../../hooks/experiences/useRamps';
|
||||
@ -100,8 +101,8 @@ const TokenOverview = ({ className, token }) => {
|
||||
onClick={() => {
|
||||
openBuyCryptoInPdapp();
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_BUY_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavBuyButtonClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Token Overview',
|
||||
text: 'Buy',
|
||||
@ -114,11 +115,11 @@ const TokenOverview = ({ className, token }) => {
|
||||
className="token-overview__button"
|
||||
onClick={async () => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_SEND_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavSendButtonClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
token_symbol: token.symbol,
|
||||
location: EVENT.SOURCE.SWAPS.TOKEN_VIEW,
|
||||
location: MetaMetricsSwapsEventSource.TokenView,
|
||||
text: 'Send',
|
||||
},
|
||||
});
|
||||
@ -158,11 +159,11 @@ const TokenOverview = ({ className, token }) => {
|
||||
onClick={() => {
|
||||
if (isSwapsChain) {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_SWAP_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
event: MetaMetricsEventName.NavSwapButtonClicked,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
properties: {
|
||||
token_symbol: token.symbol,
|
||||
location: EVENT.SOURCE.SWAPS.TOKEN_VIEW,
|
||||
location: MetaMetricsSwapsEventSource.TokenView,
|
||||
text: 'Swap',
|
||||
},
|
||||
});
|
||||
@ -214,14 +215,16 @@ const TokenOverview = ({ className, token }) => {
|
||||
});
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.HOME,
|
||||
event: EVENT_NAMES.PORTFOLIO_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Home,
|
||||
event: MetaMetricsEventName.PortfolioLinkClicked,
|
||||
properties: {
|
||||
url: portfolioUrl,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
}}
|
||||
|
@ -13,7 +13,11 @@ import {
|
||||
import { NETWORKS_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { Menu, MenuItem } from '../../ui/menu';
|
||||
import { ICON_NAMES, Text } from '../../component-library';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventLinkType,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { getURLHostName } from '../../../helpers/utils/util';
|
||||
import { showModal } from '../../../store/actions';
|
||||
import { TextVariant } from '../../../helpers/constants/design-system';
|
||||
@ -38,10 +42,10 @@ export const AccountListItemMenu = ({
|
||||
const blockExplorerLinkText = useSelector(getBlockExplorerLinkText);
|
||||
const openBlockExplorer = () => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.EXTERNAL_LINK_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.ExternalLinkClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
link_type: EVENT.EXTERNAL_LINK_TYPES.ACCOUNT_TRACKER,
|
||||
link_type: MetaMetricsEventLinkType.AccountTracker,
|
||||
location: 'Account Options',
|
||||
url_domain: getURLHostName(addressLink),
|
||||
},
|
||||
@ -78,8 +82,8 @@ export const AccountListItemMenu = ({
|
||||
onClick={() => {
|
||||
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }));
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_ACCOUNT_DETAILS_OPENED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavAccountDetailsOpened,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Account Options',
|
||||
},
|
||||
|
@ -26,7 +26,11 @@ import {
|
||||
getOriginOfCurrentTab,
|
||||
} from '../../../selectors';
|
||||
import { toggleAccountMenu, setSelectedAccount } from '../../../store/actions';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventAccountType,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
IMPORT_ACCOUNT_ROUTE,
|
||||
NEW_ACCOUNT_ROUTE,
|
||||
@ -96,8 +100,8 @@ export const AccountListMenu = ({ onClose }) => {
|
||||
onClick={() => {
|
||||
dispatch(toggleAccountMenu());
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.NAV_ACCOUNT_SWITCHED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.NavAccountSwitched,
|
||||
properties: {
|
||||
location: 'Main Menu',
|
||||
},
|
||||
@ -124,10 +128,10 @@ export const AccountListMenu = ({ onClose }) => {
|
||||
onClick={() => {
|
||||
dispatch(toggleAccountMenu());
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.ACCOUNT_ADD_SELECTED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.AccountAddSelected,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||
account_type: MetaMetricsEventAccountType.Default,
|
||||
location: 'Main Menu',
|
||||
},
|
||||
});
|
||||
@ -144,10 +148,10 @@ export const AccountListMenu = ({ onClose }) => {
|
||||
onClick={() => {
|
||||
dispatch(toggleAccountMenu());
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.ACCOUNT_ADD_SELECTED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.AccountAddSelected,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||
account_type: MetaMetricsEventAccountType.Imported,
|
||||
location: 'Main Menu',
|
||||
},
|
||||
});
|
||||
@ -164,10 +168,10 @@ export const AccountListMenu = ({ onClose }) => {
|
||||
onClick={() => {
|
||||
dispatch(toggleAccountMenu());
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.ACCOUNT_ADD_SELECTED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.AccountAddSelected,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.HARDWARE,
|
||||
account_type: MetaMetricsEventAccountType.Hardware,
|
||||
location: 'Main Menu',
|
||||
},
|
||||
});
|
||||
|
@ -6,7 +6,11 @@ import classNames from 'classnames';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { getDetectedTokensInCurrentNetwork } from '../../../selectors';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsTokenEventSource,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { BannerAlert } from '../../component-library';
|
||||
|
||||
export const DetectedTokensBanner = ({
|
||||
@ -25,10 +29,10 @@ export const DetectedTokensBanner = ({
|
||||
const handleOnClick = () => {
|
||||
actionButtonOnClick();
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_IMPORT_CLICKED,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.TokenImportClicked,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
properties: {
|
||||
source: EVENT.SOURCE.TOKEN.DETECTED,
|
||||
source: MetaMetricsTokenEventSource.Detected,
|
||||
tokens: detectedTokensDetails,
|
||||
},
|
||||
});
|
||||
|
@ -17,9 +17,9 @@ import { SUPPORT_LINK } from '../../../../shared/lib/ui-utils';
|
||||
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import {
|
||||
EVENT_NAMES,
|
||||
EVENT,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsContextProp,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
|
||||
export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
||||
@ -35,8 +35,8 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
||||
onClick={() => {
|
||||
history.push(CONNECTED_ROUTE);
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_CONNECTED_SITES_OPENED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavConnectedSitesOpened,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Account Options',
|
||||
},
|
||||
@ -55,14 +55,16 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
||||
});
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.HOME,
|
||||
event: EVENT_NAMES.PORTFOLIO_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Home,
|
||||
event: MetaMetricsEventName.PortfolioLinkClicked,
|
||||
properties: {
|
||||
url: portfolioUrl,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
closeMenu();
|
||||
@ -77,8 +79,8 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
||||
onClick={() => {
|
||||
global.platform.openExtensionInBrowser();
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.APP_WINDOW_EXPANDED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.AppWindowExpanded,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Account Options',
|
||||
},
|
||||
@ -96,14 +98,16 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
||||
global.platform.openTab({ url: SUPPORT_LINK });
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.HOME,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Home,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: SUPPORT_LINK,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
closeMenu();
|
||||
@ -117,8 +121,8 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
||||
onClick={() => {
|
||||
history.push(SETTINGS_ROUTE);
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: EVENT_NAMES.NAV_SETTINGS_OPENED,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: MetaMetricsEventName.NavSettingsOpened,
|
||||
properties: {
|
||||
location: 'Main Menu',
|
||||
},
|
||||
|
@ -14,7 +14,10 @@ import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { IMPORT_TOKEN_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { detectNewTokens } from '../../../store/actions';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
getIsTokenDetectionSupported,
|
||||
getIsTokenDetectionInactiveOnMainnet,
|
||||
@ -47,8 +50,8 @@ export const MultichainImportTokenLink = ({ className, ...props }) => {
|
||||
onClick={() => {
|
||||
history.push(IMPORT_TOKEN_ROUTE);
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_IMPORT_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.TokenImportButtonClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Home',
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ import { captureException, captureMessage } from '@sentry/browser';
|
||||
import { omit } from 'lodash';
|
||||
import { getEnvironmentType } from '../../app/scripts/lib/util';
|
||||
import { PATH_NAME_MAP } from '../helpers/constants/routes';
|
||||
import { CONTEXT_PROPS } from '../../shared/constants/metametrics';
|
||||
import { MetaMetricsContextProp } from '../../shared/constants/metametrics';
|
||||
import { useSegmentContext } from '../hooks/useSegmentContext';
|
||||
|
||||
import { trackMetaMetricsEvent, trackMetaMetricsPage } from '../store/actions';
|
||||
@ -67,8 +67,9 @@ export function MetaMetricsProvider({ children }) {
|
||||
if (!payload.properties) {
|
||||
payload.properties = {};
|
||||
}
|
||||
if (fields.includes(CONTEXT_PROPS.PAGE_TITLE)) {
|
||||
payload.properties[CONTEXT_PROPS.PAGE_TITLE] = context.page?.title;
|
||||
if (fields.includes(MetaMetricsContextProp.PageTitle)) {
|
||||
payload.properties[MetaMetricsContextProp.PageTitle] =
|
||||
context.page?.title;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -69,7 +69,7 @@ import {
|
||||
checkNetworkAndAccountSupports1559,
|
||||
} from '../../selectors';
|
||||
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
ERROR_FETCHING_QUOTES,
|
||||
QUOTES_NOT_AVAILABLE_ERROR,
|
||||
@ -726,7 +726,7 @@ export const fetchQuotesAndSetQuoteState = (
|
||||
getCurrentSmartTransactionsEnabled(state);
|
||||
trackEvent({
|
||||
event: 'Quotes Requested',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
token_from: fromTokenSymbol,
|
||||
token_from_amount: String(inputValue),
|
||||
@ -780,7 +780,7 @@ export const fetchQuotesAndSetQuoteState = (
|
||||
if (Object.values(fetchedQuotes)?.length === 0) {
|
||||
trackEvent({
|
||||
event: 'No Quotes Available',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
token_from: fromTokenSymbol,
|
||||
token_from_amount: String(inputValue),
|
||||
@ -801,7 +801,7 @@ export const fetchQuotesAndSetQuoteState = (
|
||||
|
||||
trackEvent({
|
||||
event: 'Quotes Received',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
token_from: fromTokenSymbol,
|
||||
token_from_amount: String(inputValue),
|
||||
@ -902,7 +902,7 @@ export const signAndSendSwapsSmartTransaction = ({
|
||||
};
|
||||
trackEvent({
|
||||
event: 'STX Swap Started',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: swapMetaData,
|
||||
});
|
||||
|
||||
@ -1159,7 +1159,7 @@ export const signAndSendTransactions = (
|
||||
|
||||
trackEvent({
|
||||
event: 'Swap Started',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: swapMetaData,
|
||||
});
|
||||
|
||||
|
@ -32,7 +32,10 @@ import { getNftsDropdownState } from '../../ducks/metamask/metamask';
|
||||
import NftsDetectionNotice from '../../components/app/nfts-detection-notice';
|
||||
import { MetaMetricsContext } from '../../contexts/metametrics';
|
||||
import { AssetType } from '../../../shared/constants/transaction';
|
||||
import { EVENT, EVENT_NAMES } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsTokenEventSource,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
ButtonIcon,
|
||||
ICON_NAMES,
|
||||
@ -101,7 +104,7 @@ export default function AddNft() {
|
||||
);
|
||||
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_ADDED,
|
||||
event: MetaMetricsEventName.TokenAdded,
|
||||
category: 'Wallet',
|
||||
sensitiveProperties: {
|
||||
token_contract_address: nftAddress,
|
||||
@ -109,7 +112,7 @@ export default function AddNft() {
|
||||
tokenId: tokenId.toString(),
|
||||
asset_type: AssetType.NFT,
|
||||
token_standard: tokenDetails?.standard,
|
||||
source: EVENT.SOURCE.TOKEN.CUSTOM,
|
||||
source: MetaMetricsTokenEventSource.Custom,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -16,7 +16,7 @@ import { showModal } from '../../../store/actions';
|
||||
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { getURLHostName } from '../../../helpers/utils/util';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import AssetNavigation from './asset-navigation';
|
||||
import AssetOptions from './asset-options';
|
||||
|
||||
@ -46,7 +46,7 @@ export default function NativeAsset({ nativeCurrency }) {
|
||||
onClickBlockExplorer={() => {
|
||||
trackEvent({
|
||||
event: 'Clicked Block Explorer Link',
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
link_type: 'Account Tracker',
|
||||
action: 'Asset Options',
|
||||
|
@ -18,7 +18,7 @@ import {
|
||||
import { getURLHostName } from '../../../helpers/utils/util';
|
||||
import { showModal } from '../../../store/actions';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import AssetNavigation from './asset-navigation';
|
||||
import AssetOptions from './asset-options';
|
||||
|
||||
@ -58,7 +58,7 @@ export default function TokenAsset({ token }) {
|
||||
onClickBlockExplorer={() => {
|
||||
trackEvent({
|
||||
event: 'Clicked Block Explorer Link',
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
link_type: 'Token Tracker',
|
||||
action: 'Token Options',
|
||||
|
@ -14,7 +14,11 @@ import ZENDESK_URLS from '../../helpers/constants/zendesk-url';
|
||||
import { isEqualCaseInsensitive } from '../../../shared/modules/string-utils';
|
||||
import { getSuggestedAssets } from '../../selectors';
|
||||
import { rejectWatchAsset, acceptWatchAsset } from '../../store/actions';
|
||||
import { EVENT, EVENT_NAMES } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsTokenEventSource,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
AssetType,
|
||||
TokenStandard,
|
||||
@ -118,14 +122,14 @@ const ConfirmAddSuggestedToken = () => {
|
||||
await dispatch(acceptWatchAsset(id));
|
||||
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_ADDED,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.TokenAdded,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
sensitiveProperties: {
|
||||
token_symbol: asset.symbol,
|
||||
token_contract_address: asset.address,
|
||||
token_decimal_precision: asset.decimals,
|
||||
unlisted: asset.unlisted,
|
||||
source: EVENT.SOURCE.TOKEN.DAPP,
|
||||
source: MetaMetricsTokenEventSource.Dapp,
|
||||
token_standard: TokenStandard.ERC20,
|
||||
asset_type: AssetType.token,
|
||||
},
|
||||
|
@ -9,7 +9,7 @@ import Identicon from '../../components/ui/identicon';
|
||||
import Tooltip from '../../components/ui/tooltip';
|
||||
import { PageContainerFooter } from '../../components/ui/page-container';
|
||||
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import { SECOND } from '../../../shared/constants/time';
|
||||
import { Numeric } from '../../../shared/modules/Numeric';
|
||||
import { EtherDenomination } from '../../../shared/constants/common';
|
||||
@ -52,7 +52,7 @@ export default class ConfirmDecryptMessage extends Component {
|
||||
copyMessage = () => {
|
||||
copyToClipboard(this.state.rawMessage);
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.MESSAGES,
|
||||
category: MetaMetricsEventCategory.Messages,
|
||||
event: 'Copy',
|
||||
properties: {
|
||||
action: 'Decrypt Message Copy',
|
||||
@ -286,7 +286,7 @@ export default class ConfirmDecryptMessage extends Component {
|
||||
onCancel={async (event) => {
|
||||
await cancelDecryptMessage(txData, event);
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.MESSAGES,
|
||||
category: MetaMetricsEventCategory.Messages,
|
||||
event: 'Cancel',
|
||||
properties: {
|
||||
action: 'Decrypt Message Request',
|
||||
@ -299,7 +299,7 @@ export default class ConfirmDecryptMessage extends Component {
|
||||
onSubmit={async (event) => {
|
||||
await decryptMessage(txData, event);
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.MESSAGES,
|
||||
category: MetaMetricsEventCategory.Messages,
|
||||
event: 'Confirm',
|
||||
properties: {
|
||||
action: 'Decrypt Message Request',
|
||||
|
@ -6,7 +6,7 @@ import AccountListItem from '../../components/app/account-list-item';
|
||||
import Identicon from '../../components/ui/identicon';
|
||||
import { PageContainerFooter } from '../../components/ui/page-container';
|
||||
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import SiteOrigin from '../../components/ui/site-origin';
|
||||
import { Numeric } from '../../../shared/modules/Numeric';
|
||||
import { EtherDenomination } from '../../../shared/constants/common';
|
||||
@ -185,7 +185,7 @@ export default class ConfirmEncryptionPublicKey extends Component {
|
||||
onCancel={async (event) => {
|
||||
await cancelEncryptionPublicKey(txData, event);
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.MESSAGES,
|
||||
category: MetaMetricsEventCategory.Messages,
|
||||
event: 'Cancel',
|
||||
properties: {
|
||||
action: 'Encryption public key Request',
|
||||
@ -198,7 +198,7 @@ export default class ConfirmEncryptionPublicKey extends Component {
|
||||
onSubmit={async (event) => {
|
||||
await encryptionPublicKey(txData, event);
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.MESSAGES,
|
||||
category: MetaMetricsEventCategory.Messages,
|
||||
event: 'Confirm',
|
||||
properties: {
|
||||
action: 'Encryption public key Request',
|
||||
|
@ -13,7 +13,11 @@ import { MetaMetricsContext } from '../../contexts/metametrics';
|
||||
import { getMostRecentOverviewPage } from '../../ducks/history/history';
|
||||
import { getPendingTokens } from '../../ducks/metamask/metamask';
|
||||
import { addTokens, clearPendingTokens } from '../../store/actions';
|
||||
import { EVENT, EVENT_NAMES } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsTokenEventSource,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
AssetType,
|
||||
TokenStandard,
|
||||
@ -40,16 +44,16 @@ const ConfirmImportToken = () => {
|
||||
|
||||
addedTokenValues.forEach((pendingToken) => {
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.TOKEN_ADDED,
|
||||
category: EVENT.CATEGORIES.WALLET,
|
||||
event: MetaMetricsEventName.TokenAdded,
|
||||
category: MetaMetricsEventCategory.Wallet,
|
||||
sensitiveProperties: {
|
||||
token_symbol: pendingToken.symbol,
|
||||
token_contract_address: pendingToken.address,
|
||||
token_decimal_precision: pendingToken.decimals,
|
||||
unlisted: pendingToken.unlisted,
|
||||
source: pendingToken.isCustom
|
||||
? EVENT.SOURCE.TOKEN.CUSTOM
|
||||
: EVENT.SOURCE.TOKEN.LIST,
|
||||
? MetaMetricsTokenEventSource.Custom
|
||||
: MetaMetricsTokenEventSource.List,
|
||||
token_standard: TokenStandard.ERC20,
|
||||
asset_type: AssetType.token,
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ import UserPreferencedCurrencyDisplay from '../../components/app/user-preference
|
||||
import { PRIMARY, SECONDARY } from '../../helpers/constants/common';
|
||||
import TextField from '../../components/ui/text-field';
|
||||
import SimulationErrorMessage from '../../components/ui/simulation-error-message';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
TransactionType,
|
||||
TransactionStatus,
|
||||
@ -279,7 +279,7 @@ export default class ConfirmTransactionBase extends Component {
|
||||
} = this.props;
|
||||
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'User clicks "Edit" on gas',
|
||||
properties: {
|
||||
action: 'Confirm Screen',
|
||||
@ -672,7 +672,7 @@ export default class ConfirmTransactionBase extends Component {
|
||||
} = this.props;
|
||||
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'Edit Transaction',
|
||||
properties: {
|
||||
action: 'Confirm Screen',
|
||||
@ -881,7 +881,7 @@ export default class ConfirmTransactionBase extends Component {
|
||||
} = this.props;
|
||||
const { trackEvent } = this.context;
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'Confirm: Started',
|
||||
properties: {
|
||||
action: 'Confirm Screen',
|
||||
|
@ -9,7 +9,7 @@ import Dropdown from '../../../components/ui/dropdown';
|
||||
import { getURLHostName } from '../../../helpers/utils/util';
|
||||
|
||||
import { HardwareDeviceNames } from '../../../../shared/constants/hardware-wallets';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
|
||||
class AccountList extends Component {
|
||||
state = {
|
||||
@ -137,7 +137,7 @@ class AccountList extends Component {
|
||||
rpcPrefs,
|
||||
);
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.ACCOUNTS,
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
event: 'Clicked Block Explorer Link',
|
||||
properties: {
|
||||
actions: 'Hardware Connect',
|
||||
|
@ -10,7 +10,11 @@ import {
|
||||
} from '../../../selectors';
|
||||
import { formatBalance } from '../../../helpers/utils/util';
|
||||
import { getMostRecentOverviewPage } from '../../../ducks/history/history';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventAccountType,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { SECOND } from '../../../../shared/constants/time';
|
||||
import {
|
||||
HardwareDeviceNames,
|
||||
@ -253,10 +257,10 @@ class ConnectHardwareForm extends Component {
|
||||
)
|
||||
.then((_) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.ACCOUNTS,
|
||||
event: EVENT_NAMES.ACCOUNT_ADDED,
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
event: MetaMetricsEventName.AccountAdded,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.HARDWARE,
|
||||
account_type: MetaMetricsEventAccountType.Hardware,
|
||||
account_hardware_type: device,
|
||||
},
|
||||
});
|
||||
@ -264,10 +268,10 @@ class ConnectHardwareForm extends Component {
|
||||
})
|
||||
.catch((e) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.ACCOUNTS,
|
||||
event: EVENT_NAMES.ACCOUNT_ADD_FAILED,
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
event: MetaMetricsEventName.AccountAddFailed,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.HARDWARE,
|
||||
account_type: MetaMetricsEventAccountType.Hardware,
|
||||
account_hardware_type: device,
|
||||
error: e.message,
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
HardwareAffiliateTutorialLinks,
|
||||
} from '../../../../shared/constants/hardware-wallets';
|
||||
import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import { isManifestV3 } from '../../../../shared/modules/mv3.utils';
|
||||
import { openWindow } from '../../../helpers/utils/window';
|
||||
|
||||
@ -242,7 +242,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked Ledger Buy Now',
|
||||
});
|
||||
openWindow(HardwareAffiliateLinks.ledger);
|
||||
@ -255,7 +255,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked Ledger Tutorial',
|
||||
});
|
||||
openWindow(HardwareAffiliateTutorialLinks.ledger);
|
||||
@ -310,7 +310,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked GridPlus Buy Now',
|
||||
});
|
||||
openWindow(HardwareAffiliateLinks.gridplus);
|
||||
@ -323,7 +323,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked GidPlus Tutorial',
|
||||
});
|
||||
openWindow(HardwareAffiliateTutorialLinks.gridplus);
|
||||
@ -376,7 +376,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked Trezor Buy Now',
|
||||
});
|
||||
openWindow(HardwareAffiliateLinks.trezor);
|
||||
@ -389,7 +389,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked Trezor Tutorial',
|
||||
});
|
||||
openWindow(HardwareAffiliateTutorialLinks.trezor);
|
||||
@ -430,7 +430,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked Keystone Buy Now',
|
||||
});
|
||||
openWindow(HardwareAffiliateLinks.keystone);
|
||||
@ -443,7 +443,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked Keystone Tutorial',
|
||||
});
|
||||
openWindow(HardwareAffiliateTutorialLinks.keystone);
|
||||
@ -465,7 +465,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked AirGap Vault Buy Now',
|
||||
});
|
||||
openWindow(HardwareAffiliateLinks.airgap);
|
||||
@ -478,7 +478,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked AirGap Vault Tutorial',
|
||||
});
|
||||
openWindow(HardwareAffiliateTutorialLinks.airgap);
|
||||
@ -500,7 +500,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked CoolWallet Buy Now',
|
||||
});
|
||||
openWindow(HardwareAffiliateLinks.coolwallet);
|
||||
@ -513,7 +513,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked CoolWallet Tutorial',
|
||||
});
|
||||
openWindow(HardwareAffiliateTutorialLinks.coolwallet);
|
||||
@ -533,7 +533,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked DCent Buy Now',
|
||||
});
|
||||
openWindow(HardwareAffiliateLinks.dcent);
|
||||
@ -546,7 +546,7 @@ export default class SelectHardware extends Component {
|
||||
type="secondary"
|
||||
onClick={() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
event: 'Clicked DCent Tutorial',
|
||||
});
|
||||
openWindow(HardwareAffiliateTutorialLinks.dcent);
|
||||
|
@ -1,6 +1,11 @@
|
||||
import React, { useContext, useState } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventAccountImportType,
|
||||
MetaMetricsEventAccountType,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { ButtonLink, Label, Text } from '../../../components/component-library';
|
||||
import Box from '../../../components/ui/box';
|
||||
import Dropdown from '../../../components/ui/dropdown';
|
||||
@ -52,18 +57,18 @@ export default function NewAccountImportForm() {
|
||||
function trackImportEvent(strategy, wasSuccessful) {
|
||||
const accountImportType =
|
||||
strategy === 'Private Key'
|
||||
? EVENT.ACCOUNT_IMPORT_TYPES.PRIVATE_KEY
|
||||
: EVENT.ACCOUNT_IMPORT_TYPES.JSON;
|
||||
? MetaMetricsEventAccountImportType.PrivateKey
|
||||
: MetaMetricsEventAccountImportType.Json;
|
||||
|
||||
const event = wasSuccessful
|
||||
? EVENT_NAMES.ACCOUNT_ADDED
|
||||
: EVENT_NAMES.ACCOUNT_ADD_FAILED;
|
||||
? MetaMetricsEventName.AccountAdded
|
||||
: MetaMetricsEventName.AccountAddFailed;
|
||||
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ACCOUNTS,
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
event,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||
account_type: MetaMetricsEventAccountType.Imported,
|
||||
account_import_type: accountImportType,
|
||||
},
|
||||
});
|
||||
|
@ -2,7 +2,11 @@ import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import Button from '../../components/ui/button';
|
||||
import { EVENT, EVENT_NAMES } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventAccountType,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import { getAccountNameErrorMessage } from '../../helpers/utils/accounts';
|
||||
|
||||
export default class NewAccountCreateForm extends Component {
|
||||
@ -27,20 +31,20 @@ export default class NewAccountCreateForm extends Component {
|
||||
createAccount(newAccountName || defaultAccountName)
|
||||
.then(() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.ACCOUNTS,
|
||||
event: EVENT_NAMES.ACCOUNT_ADDED,
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
event: MetaMetricsEventName.AccountAdded,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||
account_type: MetaMetricsEventAccountType.Default,
|
||||
},
|
||||
});
|
||||
history.push(mostRecentOverviewPage);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.ACCOUNTS,
|
||||
event: EVENT_NAMES.ACCOUNT_ADD_FAILED,
|
||||
category: MetaMetricsEventCategory.Accounts,
|
||||
event: MetaMetricsEventName.AccountAddFailed,
|
||||
properties: {
|
||||
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||
account_type: MetaMetricsEventAccountType.Default,
|
||||
error: e.message,
|
||||
},
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ import Typography from '../../components/ui/typography';
|
||||
import Button from '../../components/ui/button';
|
||||
import Box from '../../components/ui/box';
|
||||
import { openCustomProtocol } from '../../../shared/lib/deep-linking';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
|
||||
export function renderDesktopError({
|
||||
type,
|
||||
@ -84,7 +84,7 @@ export function renderDesktopError({
|
||||
onClick();
|
||||
if (typeof trackEvent === 'function') {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.DESKTOP,
|
||||
category: MetaMetricsEventCategory.Desktop,
|
||||
event: 'Desktop Button Clicked',
|
||||
properties: {
|
||||
button_action: action,
|
||||
|
@ -4,9 +4,9 @@ import { getEnvironmentType } from '../../../app/scripts/lib/util';
|
||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../shared/constants/app';
|
||||
import { SUPPORT_REQUEST_LINK } from '../../helpers/constants/common';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
|
||||
class ErrorPage extends PureComponent {
|
||||
@ -50,14 +50,16 @@ class ErrorPage extends PureComponent {
|
||||
onClick={() => {
|
||||
this.context.trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.ERROR,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Error,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: SUPPORT_REQUEST_LINK,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
}}
|
||||
|
@ -3,9 +3,9 @@ import React, { useContext } from 'react';
|
||||
import { SUPPORT_REQUEST_LINK } from '../../../helpers/constants/common';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
|
||||
@ -25,14 +25,16 @@ const BetaHomeFooter = () => {
|
||||
onClick={() => {
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.FOOTER,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Footer,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: SUPPORT_REQUEST_LINK,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
}}
|
||||
|
@ -3,9 +3,9 @@ import React, { useContext } from 'react';
|
||||
import { SUPPORT_REQUEST_LINK } from '../../../helpers/constants/common';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
|
||||
@ -22,14 +22,16 @@ const FlaskHomeFooter = () => {
|
||||
onClick={() => {
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.FOOTER,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Footer,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: SUPPORT_REQUEST_LINK,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
}}
|
||||
|
@ -3,9 +3,9 @@ import PropTypes from 'prop-types';
|
||||
import { Redirect, Route } from 'react-router-dom';
|
||||
///: BEGIN:ONLY_INCLUDE_IN(main)
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
import AssetList from '../../components/app/asset-list';
|
||||
@ -699,15 +699,15 @@ export default class Home extends PureComponent {
|
||||
onClick={() => {
|
||||
this.context.trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.HOME,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Home,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: SUPPORT_LINK,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [
|
||||
CONTEXT_PROPS.PAGE_TITLE,
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
TextColor,
|
||||
TypographyVariant,
|
||||
} from '../../helpers/constants/design-system';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
|
||||
class RestoreVaultPage extends Component {
|
||||
static contextTypes = {
|
||||
@ -41,7 +41,7 @@ class RestoreVaultPage extends Component {
|
||||
leaveImportSeedScreenState();
|
||||
await createNewVaultAndRestore(password, seedPhrase);
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.RETENTION,
|
||||
category: MetaMetricsEventCategory.Retention,
|
||||
event: 'onboardingRestoredVault',
|
||||
properties: {
|
||||
action: 'userEntersSeedPhrase',
|
||||
|
@ -5,7 +5,11 @@ import qrCode from 'qrcode-generator';
|
||||
import { requestRevealSeedWords, showModal } from '../../store/actions';
|
||||
import ExportTextContainer from '../../components/ui/export-text-container';
|
||||
import { getMostRecentOverviewPage } from '../../ducks/history/history';
|
||||
import { EVENT, EVENT_NAMES } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventKeyType,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
TextVariant,
|
||||
SEVERITIES,
|
||||
@ -72,10 +76,10 @@ const RevealSeedPage = () => {
|
||||
dispatch(requestRevealSeedWords(password))
|
||||
.then((revealedSeedWords) => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_REVEALED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportRevealed,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.SRP,
|
||||
key_type: MetaMetricsEventKeyType.Srp,
|
||||
},
|
||||
});
|
||||
setSeedWords(revealedSeedWords);
|
||||
@ -92,10 +96,10 @@ const RevealSeedPage = () => {
|
||||
})
|
||||
.catch((e) => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_FAILED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportFailed,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.SRP,
|
||||
key_type: MetaMetricsEventKeyType.Srp,
|
||||
reason: e.message, // 'incorrect_password',
|
||||
},
|
||||
});
|
||||
@ -158,10 +162,10 @@ const RevealSeedPage = () => {
|
||||
text={seedWords}
|
||||
onClickCopy={() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_COPIED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportCopied,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.SRP,
|
||||
key_type: MetaMetricsEventKeyType.Srp,
|
||||
copy_method: 'clipboard',
|
||||
},
|
||||
});
|
||||
@ -201,10 +205,10 @@ const RevealSeedPage = () => {
|
||||
type={BUTTON_TYPES.SECONDARY}
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_CANCELED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportCanceled,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.SRP,
|
||||
key_type: MetaMetricsEventKeyType.Srp,
|
||||
},
|
||||
});
|
||||
history.push(mostRecentOverviewPage);
|
||||
@ -217,10 +221,10 @@ const RevealSeedPage = () => {
|
||||
size={Size.LG}
|
||||
onClick={(event) => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.KEYS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_REQUESTED,
|
||||
category: MetaMetricsEventCategory.Keys,
|
||||
event: MetaMetricsEventName.KeyExportRequested,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.SRP,
|
||||
key_type: MetaMetricsEventKeyType.Srp,
|
||||
},
|
||||
});
|
||||
handleSubmit(event);
|
||||
|
@ -31,7 +31,10 @@ import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
|
||||
import { getFirstTimeFlowType, getCurrentKeyring } from '../../../selectors';
|
||||
import { FIRST_TIME_FLOW_TYPES } from '../../../helpers/constants/onboarding';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { Icon, ICON_NAMES } from '../../../components/component-library';
|
||||
|
||||
export default function CreatePassword({
|
||||
@ -141,8 +144,8 @@ export default function CreatePassword({
|
||||
}
|
||||
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_CREATION_ATTEMPTED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletCreationAttempted,
|
||||
});
|
||||
|
||||
// If secretRecoveryPhrase is defined we are in import wallet flow
|
||||
|
@ -18,7 +18,10 @@ import {
|
||||
} from '../../../helpers/constants/routes';
|
||||
import { isBeta } from '../../../helpers/utils/build-types';
|
||||
import { getFirstTimeFlowType } from '../../../selectors';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
|
||||
export default function CreationSuccessful() {
|
||||
@ -101,8 +104,8 @@ export default function CreationSuccessful() {
|
||||
rounded
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_CREATION_COMPLETE,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletCreationComplete,
|
||||
properties: {
|
||||
method: firstTimeFlowType,
|
||||
},
|
||||
|
@ -20,7 +20,10 @@ import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
|
||||
import SrpInput from '../../../components/app/srp-input';
|
||||
import { getCurrentKeyring } from '../../../selectors';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
|
||||
export default function ImportSRP({ submitSecretRecoveryPhrase }) {
|
||||
const [secretRecoveryPhrase, setSecretRecoveryPhrase] = useState('');
|
||||
@ -78,8 +81,9 @@ export default function ImportSRP({ submitSecretRecoveryPhrase }) {
|
||||
onClick={() => {
|
||||
submitSecretRecoveryPhrase(secretRecoveryPhrase);
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_SECURITY_PHRASE_CONFIRMED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event:
|
||||
MetaMetricsEventName.OnboardingWalletSecurityPhraseConfirmed,
|
||||
});
|
||||
history.replace(ONBOARDING_CREATE_PASSWORD_ROUTE);
|
||||
}}
|
||||
|
@ -17,7 +17,11 @@ import {
|
||||
getFirstTimeFlowType,
|
||||
} from '../../../selectors';
|
||||
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventAccountType,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import {
|
||||
@ -43,13 +47,13 @@ export default function OnboardingMetametrics() {
|
||||
try {
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.WALLET_SETUP_STARTED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.WalletSetupStarted,
|
||||
properties: {
|
||||
account_type:
|
||||
firstTimeFlowType === 'create'
|
||||
? EVENT.ACCOUNT_TYPES.DEFAULT
|
||||
: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||
? MetaMetricsEventAccountType.Default
|
||||
: MetaMetricsEventAccountType.Imported,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -30,7 +30,10 @@ import { getFirstTimeFlowTypeRoute } from '../../selectors';
|
||||
import { MetaMetricsContext } from '../../contexts/metametrics';
|
||||
import Button from '../../components/ui/button';
|
||||
import { useI18nContext } from '../../hooks/useI18nContext';
|
||||
import { EVENT_NAMES, EVENT } from '../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../shared/constants/metametrics';
|
||||
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
||||
import ExperimentalArea from '../../components/app/flask/experimental-area';
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
@ -191,11 +194,11 @@ export default function OnboardingFlow() {
|
||||
href={TWITTER_URL}
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_TWITTER_CLICK,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingTwitterClick,
|
||||
properties: {
|
||||
text: t('followUsOnTwitter'),
|
||||
location: EVENT_NAMES.ONBOARDING_WALLET_CREATION_COMPLETE,
|
||||
location: MetaMetricsEventName.OnboardingWalletCreationComplete,
|
||||
url: TWITTER_URL,
|
||||
},
|
||||
});
|
||||
|
@ -12,7 +12,10 @@ import {
|
||||
} from '../../../helpers/constants/design-system';
|
||||
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { setCompletedOnboarding } from '../../../store/actions';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { FIRST_TIME_FLOW_TYPES } from '../../../helpers/constants/onboarding';
|
||||
import { getFirstTimeFlowType } from '../../../selectors';
|
||||
@ -32,8 +35,8 @@ export default function OnboardingPinExtension() {
|
||||
} else {
|
||||
await dispatch(setCompletedOnboarding());
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_SETUP_COMPLETE,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletSetupComplete,
|
||||
properties: {
|
||||
wallet_setup_type:
|
||||
firstTimeFlowType === FIRST_TIME_FLOW_TYPES.IMPORT
|
||||
|
@ -34,7 +34,10 @@ import {
|
||||
PRIVACY_POLICY_LINK,
|
||||
} from '../../../../shared/lib/ui-utils';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
|
||||
import { Setting } from './setting';
|
||||
|
||||
@ -77,8 +80,8 @@ export default function PrivacySettings() {
|
||||
}
|
||||
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_ADVANCED_SETTINGS,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletAdvancedSettings,
|
||||
properties: {
|
||||
show_incoming_tx: showIncomingTransactions,
|
||||
use_phising_detection: usePhishingDetection,
|
||||
|
@ -20,7 +20,10 @@ import { ONBOARDING_COMPLETION_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { setSeedPhraseBackedUp } from '../../../store/actions';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import RecoveryPhraseChips from './recovery-phrase-chips';
|
||||
|
||||
export default function ConfirmRecoveryPhrase({ secretRecoveryPhrase = '' }) {
|
||||
@ -105,8 +108,9 @@ export default function ConfirmRecoveryPhrase({ secretRecoveryPhrase = '' }) {
|
||||
onClick={async () => {
|
||||
await dispatch(setSeedPhraseBackedUp(true));
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_SECURITY_PHRASE_CONFIRMED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event:
|
||||
MetaMetricsEventName.OnboardingWalletSecurityPhraseConfirmed,
|
||||
});
|
||||
history.push(ONBOARDING_COMPLETION_ROUTE);
|
||||
}}
|
||||
|
@ -18,7 +18,10 @@ import {
|
||||
ThreeStepProgressBar,
|
||||
threeStepStages,
|
||||
} from '../../../components/app/step-progress-bar';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { Icon, ICON_NAMES } from '../../../components/component-library';
|
||||
import RecoveryPhraseChips from './recovery-phrase-chips';
|
||||
@ -136,9 +139,9 @@ export default function RecoveryPhrase({ secretRecoveryPhrase }) {
|
||||
className="recovery-phrase__footer--button"
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event:
|
||||
EVENT_NAMES.ONBOARDING_WALLET_SECURITY_PHRASE_WRITTEN_DOWN,
|
||||
MetaMetricsEventName.OnboardingWalletSecurityPhraseWrittenDown,
|
||||
});
|
||||
history.push(
|
||||
`${ONBOARDING_CONFIRM_SRP_ROUTE}${isFromReminderParam}`,
|
||||
@ -155,8 +158,9 @@ export default function RecoveryPhrase({ secretRecoveryPhrase }) {
|
||||
className="recovery-phrase__footer--button"
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_SECURITY_PHRASE_REVEALED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event:
|
||||
MetaMetricsEventName.OnboardingWalletSecurityPhraseRevealed,
|
||||
});
|
||||
setPhraseRevealed(true);
|
||||
}}
|
||||
|
@ -19,7 +19,10 @@ import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { ONBOARDING_REVIEW_SRP_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { getCurrentLocale } from '../../../ducks/locale/locale';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import SkipSRPBackup from './skip-srp-backup-popover';
|
||||
|
||||
export default function SecureYourWallet() {
|
||||
@ -38,16 +41,16 @@ export default function SecureYourWallet() {
|
||||
|
||||
const handleClickRecommended = () => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_SECURITY_STARTED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletSecurityStarted,
|
||||
});
|
||||
history.push(`${ONBOARDING_REVIEW_SRP_ROUTE}${isFromReminderParam}`);
|
||||
};
|
||||
|
||||
const handleClickNotRecommended = () => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_SECURITY_SKIP_INITIATED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletSecuritySkipInitiated,
|
||||
});
|
||||
setShowSkipSRPBackupPopover(true);
|
||||
};
|
||||
@ -105,8 +108,8 @@ export default function SecureYourWallet() {
|
||||
className="secure-your-wallet__video"
|
||||
onPlay={() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_VIDEO_PLAY,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletVideoPlay,
|
||||
});
|
||||
}}
|
||||
controls
|
||||
|
@ -18,7 +18,10 @@ import {
|
||||
import { setSeedPhraseBackedUp } from '../../../store/actions';
|
||||
import Checkbox from '../../../components/ui/check-box';
|
||||
import { ONBOARDING_COMPLETION_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import {
|
||||
Icon,
|
||||
@ -45,8 +48,9 @@ export default function SkipSRPBackup({ handleClose }) {
|
||||
<Button
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_SECURITY_SKIP_CANCELED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event:
|
||||
MetaMetricsEventName.OnboardingWalletSecuritySkipCanceled,
|
||||
});
|
||||
handleClose();
|
||||
}}
|
||||
@ -63,8 +67,9 @@ export default function SkipSRPBackup({ handleClose }) {
|
||||
onClick={async () => {
|
||||
await dispatch(setSeedPhraseBackedUp(false));
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_SECURITY_SKIP_CONFIRMED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event:
|
||||
MetaMetricsEventName.OnboardingWalletSecuritySkipConfirmed,
|
||||
});
|
||||
history.push(ONBOARDING_COMPLETION_ROUTE);
|
||||
}}
|
||||
|
@ -13,7 +13,10 @@ import {
|
||||
} from '../../../helpers/constants/design-system';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { setFirstTimeFlowType } from '../../../store/actions';
|
||||
import {
|
||||
ONBOARDING_METAMETRICS,
|
||||
@ -47,8 +50,8 @@ export default function OnboardingWelcome() {
|
||||
const onCreateClick = () => {
|
||||
dispatch(setFirstTimeFlowType('create'));
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_CREATION_STARTED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletCreationStarted,
|
||||
properties: {
|
||||
account_type: 'metamask',
|
||||
},
|
||||
@ -59,8 +62,8 @@ export default function OnboardingWelcome() {
|
||||
const onImportClick = () => {
|
||||
dispatch(setFirstTimeFlowType('import'));
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WALLET_IMPORT_STARTED,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWalletImportStarted,
|
||||
properties: {
|
||||
account_type: 'imported',
|
||||
},
|
||||
@ -69,8 +72,8 @@ export default function OnboardingWelcome() {
|
||||
};
|
||||
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.ONBOARDING,
|
||||
event: EVENT_NAMES.ONBOARDING_WELCOME,
|
||||
category: MetaMetricsEventCategory.Onboarding,
|
||||
event: MetaMetricsEventName.OnboardingWelcome,
|
||||
properties: {
|
||||
message_title: t('welcomeToMetaMask'),
|
||||
app_version: global?.platform?.getVersion(),
|
||||
|
@ -45,7 +45,10 @@ import {
|
||||
hexWEIToDecETH,
|
||||
hexWEIToDecGWEI,
|
||||
} from '../../../../shared/modules/conversion.utils';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import useRamps from '../../../hooks/experiences/useRamps';
|
||||
|
||||
@ -342,8 +345,8 @@ export default function GasDisplay({ gasError }) {
|
||||
onClick={() => {
|
||||
openBuyCryptoInPdapp();
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.NAV_BUY_BUTTON_CLICKED,
|
||||
category: EVENT.CATEGORIES.NAVIGATION,
|
||||
event: MetaMetricsEventName.NavBuyButtonClicked,
|
||||
category: MetaMetricsEventCategory.Navigation,
|
||||
properties: {
|
||||
location: 'Gas Warning Insufficient Funds',
|
||||
text: 'Buy',
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
} from '../../../../../ducks/send';
|
||||
import { useI18nContext } from '../../../../../hooks/useI18nContext';
|
||||
import { MetaMetricsContext } from '../../../../../contexts/metametrics';
|
||||
import { EVENT } from '../../../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../../../shared/constants/metametrics';
|
||||
|
||||
export default function AmountMaxButton() {
|
||||
const isDraftTransactionInvalid = useSelector(isSendFormInvalid);
|
||||
@ -20,7 +20,7 @@ export default function AmountMaxButton() {
|
||||
const onMaxClick = () => {
|
||||
trackEvent({
|
||||
event: 'Clicked "Amount Max"',
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
properties: {
|
||||
action: 'Edit Screen',
|
||||
legacy_event: true,
|
||||
|
@ -7,7 +7,7 @@ import TokenListDisplay from '../../../../components/app/token-list-display';
|
||||
import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display';
|
||||
import { PRIMARY } from '../../../../helpers/constants/common';
|
||||
import { isEqualCaseInsensitive } from '../../../../../shared/modules/string-utils';
|
||||
import { EVENT } from '../../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../../shared/constants/metametrics';
|
||||
import {
|
||||
AssetType,
|
||||
TokenStandard,
|
||||
@ -97,7 +97,7 @@ export default class SendAssetRow extends Component {
|
||||
},
|
||||
() => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'User clicks "Assets" dropdown',
|
||||
properties: {
|
||||
action: 'Send Screen',
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
CONFIRM_TRANSACTION_ROUTE,
|
||||
DEFAULT_ROUTE,
|
||||
} from '../../../helpers/constants/routes';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import { SEND_STAGES } from '../../../ducks/send';
|
||||
|
||||
export default class SendFooter extends Component {
|
||||
@ -56,7 +56,7 @@ export default class SendFooter extends Component {
|
||||
|
||||
Promise.resolve(promise).then(() => {
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'Complete',
|
||||
properties: {
|
||||
action: 'Edit Screen',
|
||||
@ -78,7 +78,7 @@ export default class SendFooter extends Component {
|
||||
const errorMessage = sendErrors[errorField];
|
||||
|
||||
trackEvent({
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
event: 'Error',
|
||||
properties: {
|
||||
action: 'Edit Screen',
|
||||
|
@ -19,7 +19,7 @@ import { isCustomPriceExcessive } from '../../selectors';
|
||||
import { getSendHexDataFeatureFlagState } from '../../ducks/metamask/metamask';
|
||||
import { showQrScanner } from '../../store/actions';
|
||||
import { MetaMetricsContext } from '../../contexts/metametrics';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import { AssetType } from '../../../shared/constants/transaction';
|
||||
import SendHeader from './send-header';
|
||||
import AddRecipient from './send-content/add-recipient';
|
||||
@ -137,7 +137,7 @@ export default function SendTransactionScreen() {
|
||||
scanQrCode={() => {
|
||||
trackEvent({
|
||||
event: 'Used QR scanner',
|
||||
category: EVENT.CATEGORIES.TRANSACTIONS,
|
||||
category: MetaMetricsEventCategory.Transactions,
|
||||
properties: {
|
||||
action: 'Edit Screen',
|
||||
legacy_event: true,
|
||||
|
@ -19,7 +19,10 @@ import {
|
||||
LedgerTransportTypes,
|
||||
LEDGER_USB_VENDOR_ID,
|
||||
} from '../../../../shared/constants/hardware-wallets';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { exportAsFile } from '../../../helpers/utils/export-utils';
|
||||
import ActionableMessage from '../../../components/ui/actionable-message';
|
||||
import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
|
||||
@ -245,8 +248,8 @@ export default class AdvancedTab extends PureComponent {
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
event: EVENT_NAMES.ACCOUNT_RESET,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: MetaMetricsEventName.AccountReset,
|
||||
properties: {},
|
||||
});
|
||||
showResetAccountConfirmationModal();
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
getNumberOfSettingsInSection,
|
||||
handleSettingsRefs,
|
||||
} from '../../../helpers/utils/settings-search';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import Typography from '../../../components/ui/typography/typography';
|
||||
import { Text } from '../../../components/component-library';
|
||||
import {
|
||||
@ -77,7 +77,7 @@ export default class ExperimentalTab extends PureComponent {
|
||||
value={openSeaEnabled}
|
||||
onToggle={(value) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: 'Enabled/Disable OpenSea',
|
||||
properties: {
|
||||
action: 'Enabled/Disable OpenSea',
|
||||
@ -119,7 +119,7 @@ export default class ExperimentalTab extends PureComponent {
|
||||
value={useNftDetection}
|
||||
onToggle={(value) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: 'NFT Detected',
|
||||
properties: {
|
||||
action: 'NFT Detected',
|
||||
@ -193,7 +193,7 @@ export default class ExperimentalTab extends PureComponent {
|
||||
value={transactionSecurityCheckEnabled}
|
||||
onToggle={(value) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: 'Enabled/Disable TransactionSecurityCheck',
|
||||
properties: {
|
||||
action: 'Enabled/Disable TransactionSecurityCheck',
|
||||
|
@ -16,9 +16,9 @@ import {
|
||||
handleSettingsRefs,
|
||||
} from '../../../helpers/utils/settings-search';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import { SUPPORT_LINK } from '../../../../shared/lib/ui-utils';
|
||||
|
||||
@ -127,14 +127,16 @@ export default class InfoTab extends PureComponent {
|
||||
onClick={() => {
|
||||
this.context.trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: SUPPORT_LINK,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
}}
|
||||
@ -163,14 +165,16 @@ export default class InfoTab extends PureComponent {
|
||||
onClick={() => {
|
||||
this.context.trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: SUPPORT_REQUEST_LINK,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
}}
|
||||
|
@ -23,7 +23,7 @@ import {
|
||||
} from '../../../../store/actions';
|
||||
import fetchWithCache from '../../../../../shared/lib/fetch-with-cache';
|
||||
import { usePrevious } from '../../../../hooks/usePrevious';
|
||||
import { EVENT } from '../../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsNetworkEventSource } from '../../../../../shared/constants/metametrics';
|
||||
import {
|
||||
infuraProjectId,
|
||||
FEATURED_RPCS,
|
||||
@ -510,7 +510,7 @@ const NetworksForm = ({
|
||||
},
|
||||
},
|
||||
{
|
||||
source: EVENT.SOURCE.NETWORK.CUSTOM_NETWORK_FORM,
|
||||
source: MetaMetricsNetworkEventSource.CustomNetworkForm,
|
||||
},
|
||||
),
|
||||
);
|
||||
@ -530,7 +530,7 @@ const NetworksForm = ({
|
||||
},
|
||||
{
|
||||
setActive: true,
|
||||
source: EVENT.SOURCE.NETWORK.CUSTOM_NETWORK_FORM,
|
||||
source: MetaMetricsNetworkEventSource.CustomNetworkForm,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -12,7 +12,11 @@ import {
|
||||
getNumberOfSettingsInSection,
|
||||
handleSettingsRefs,
|
||||
} from '../../../helpers/utils/settings-search';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventKeyType,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
COINGECKO_LINK,
|
||||
CRYPTOCOMPARE_LINK,
|
||||
@ -82,7 +86,7 @@ export default class SecurityTab extends PureComponent {
|
||||
|
||||
toggleSetting(value, eventName, eventAction, toggleMethod) {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: eventName,
|
||||
properties: {
|
||||
action: eventAction,
|
||||
@ -110,10 +114,10 @@ export default class SecurityTab extends PureComponent {
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
event: EVENT_NAMES.KEY_EXPORT_SELECTED,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: MetaMetricsEventName.KeyExportSelected,
|
||||
properties: {
|
||||
key_type: EVENT.KEY_TYPES.SRP,
|
||||
key_type: MetaMetricsEventKeyType.Srp,
|
||||
location: 'Settings',
|
||||
},
|
||||
});
|
||||
@ -376,8 +380,8 @@ export default class SecurityTab extends PureComponent {
|
||||
onToggle={(value) => {
|
||||
this.toggleSetting(
|
||||
value,
|
||||
EVENT_NAMES.KEY_AUTO_DETECT_TOKENS,
|
||||
EVENT_NAMES.KEY_AUTO_DETECT_TOKENS,
|
||||
MetaMetricsEventName.KeyAutoDetectTokens,
|
||||
MetaMetricsEventName.KeyAutoDetectTokens,
|
||||
setUseTokenDetection,
|
||||
);
|
||||
}}
|
||||
@ -410,8 +414,8 @@ export default class SecurityTab extends PureComponent {
|
||||
onToggle={(value) => {
|
||||
this.toggleSetting(
|
||||
value,
|
||||
EVENT_NAMES.KEY_BATCH_ACCOUNT_BALANCE_REQUESTS,
|
||||
EVENT_NAMES.KEY_BATCH_ACCOUNT_BALANCE_REQUESTS,
|
||||
MetaMetricsEventName.KeyBatchAccountBalanceRequests,
|
||||
MetaMetricsEventName.KeyBatchAccountBalanceRequests,
|
||||
setUseMultiAccountBalanceChecker,
|
||||
);
|
||||
}}
|
||||
|
@ -12,7 +12,7 @@ import locales from '../../../../app/_locales/index.json';
|
||||
import Jazzicon from '../../../components/ui/jazzicon';
|
||||
import BlockieIdenticon from '../../../components/ui/identicon/blockieIdenticon';
|
||||
import Typography from '../../../components/ui/typography';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
|
||||
import {
|
||||
getNumberOfSettingsInSection,
|
||||
@ -356,7 +356,7 @@ export default class SettingsTab extends PureComponent {
|
||||
|
||||
const onChange = (newTheme) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
category: MetaMetricsEventCategory.Settings,
|
||||
event: 'Theme Changed',
|
||||
properties: {
|
||||
theme_selected: newTheme,
|
||||
|
@ -33,7 +33,7 @@ import {
|
||||
} from '../../../helpers/constants/design-system';
|
||||
import SwapsFooter from '../swaps-footer';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import SwapStepIcon from './swap-step-icon';
|
||||
|
||||
export default function AwaitingSignatures() {
|
||||
@ -58,7 +58,7 @@ export default function AwaitingSignatures() {
|
||||
useEffect(() => {
|
||||
trackEvent({
|
||||
event: 'Awaiting Signature(s) on a HW wallet',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
needs_two_confirmations: needsTwoConfirmations,
|
||||
token_from: sourceTokenInfo?.symbol,
|
||||
|
@ -8,9 +8,9 @@ import { getBlockExplorerLink } from '@metamask/etherscan-link';
|
||||
import { I18nContext } from '../../../contexts/i18n';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import {
|
||||
EVENT,
|
||||
EVENT_NAMES,
|
||||
CONTEXT_PROPS,
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
|
||||
import {
|
||||
@ -168,14 +168,16 @@ export default function AwaitingSwap({
|
||||
onClick={() => {
|
||||
trackEvent(
|
||||
{
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
event: EVENT_NAMES.SUPPORT_LINK_CLICKED,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
event: MetaMetricsEventName.SupportLinkClicked,
|
||||
properties: {
|
||||
url: SUPPORT_LINK,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [CONTEXT_PROPS.PAGE_TITLE],
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
}}
|
||||
@ -201,7 +203,7 @@ export default function AwaitingSwap({
|
||||
setTrackedQuotesExpiredEvent(true);
|
||||
trackEvent({
|
||||
event: 'Quotes Timed Out',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties,
|
||||
});
|
||||
}
|
||||
|
@ -82,7 +82,11 @@ import {
|
||||
isSwapsDefaultTokenAddress,
|
||||
isSwapsDefaultTokenSymbol,
|
||||
} from '../../../../shared/modules/swaps.utils';
|
||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventLinkType,
|
||||
MetaMetricsEventName,
|
||||
} from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP,
|
||||
SWAPS_CHAINID_DEFAULT_TOKEN_MAP,
|
||||
@ -447,7 +451,7 @@ export default function BuildQuote({
|
||||
const trackBuildQuotePageLoadedEvent = useCallback(() => {
|
||||
trackEvent({
|
||||
event: 'Build Quote Page Loaded',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
is_hardware_wallet: hardwareWalletUsed,
|
||||
hardware_wallet_type: hardwareWalletType,
|
||||
@ -486,10 +490,10 @@ export default function BuildQuote({
|
||||
onClick={() => {
|
||||
/* istanbul ignore next */
|
||||
trackEvent({
|
||||
event: EVENT_NAMES.EXTERNAL_LINK_CLICKED,
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
event: MetaMetricsEventName.ExternalLinkClicked,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
properties: {
|
||||
link_type: EVENT.EXTERNAL_LINK_TYPES.TOKEN_TRACKER,
|
||||
link_type: MetaMetricsEventLinkType.TokenTracker,
|
||||
location: 'Swaps Confirmation',
|
||||
url_domain: getURLHostName(blockExplorerTokenLink),
|
||||
},
|
||||
@ -819,7 +823,7 @@ export default function BuildQuote({
|
||||
/* istanbul ignore next */
|
||||
trackEvent({
|
||||
event: 'Clicked Block Explorer Link',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
properties: {
|
||||
link_type: 'Token Tracker',
|
||||
action: 'Swaps Confirmation',
|
||||
|
@ -7,7 +7,7 @@ import isEqual from 'lodash/isEqual';
|
||||
import Box from '../../../components/ui/box';
|
||||
import { I18nContext } from '../../../contexts/i18n';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import {
|
||||
navigateBackToBuildQuote,
|
||||
setSwapsFromToken,
|
||||
@ -28,7 +28,7 @@ export default function CreateNewSwap({ sensitiveTrackingProperties }) {
|
||||
onClick={async () => {
|
||||
trackEvent({
|
||||
event: 'Make Another Swap',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: sensitiveTrackingProperties,
|
||||
});
|
||||
history.push(DEFAULT_ROUTE); // It cleans up Swaps state.
|
||||
|
@ -29,7 +29,7 @@ import {
|
||||
getCurrentSmartTransactionsEnabled,
|
||||
} from '../../../ducks/swaps/swaps';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
|
||||
export default function DropdownSearchList({
|
||||
searchListClassName,
|
||||
@ -95,7 +95,7 @@ export default function DropdownSearchList({
|
||||
const onImportTokenClick = () => {
|
||||
trackEvent({
|
||||
event: 'Token Imported',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
symbol: tokenForImport?.symbol,
|
||||
address: tokenForImport?.address,
|
||||
@ -244,7 +244,7 @@ export default function DropdownSearchList({
|
||||
onClick={() => {
|
||||
trackEvent({
|
||||
event: 'Clicked Block Explorer Link',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
properties: {
|
||||
link_type: 'Token Tracker',
|
||||
action: 'Verify Contract Address',
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
FONT_WEIGHT,
|
||||
} from '../../../helpers/constants/design-system';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
|
||||
import { getUseCurrencyRateCheck } from '../../../selectors';
|
||||
|
||||
const GAS_FEES_LEARN_MORE_URL =
|
||||
@ -95,7 +95,7 @@ export default function FeeCard({
|
||||
/* istanbul ignore next */
|
||||
trackEvent({
|
||||
event: 'Clicked "Gas Fees: Learn More" Link',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
});
|
||||
global.platform.openTab({
|
||||
url: GAS_FEES_LEARN_MORE_URL,
|
||||
|
@ -80,7 +80,7 @@ import {
|
||||
|
||||
import { useGasFeeEstimates } from '../../hooks/useGasFeeEstimates';
|
||||
import FeatureToggledRoute from '../../helpers/higher-order-components/feature-toggled-route';
|
||||
import { EVENT } from '../../../shared/constants/metametrics';
|
||||
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
|
||||
import { TransactionStatus } from '../../../shared/constants/transaction';
|
||||
import { MetaMetricsContext } from '../../contexts/metametrics';
|
||||
import { getSwapsTokensReceivedFromTxMeta } from '../../../shared/lib/transactions-controller-utils';
|
||||
@ -252,7 +252,7 @@ export default function Swap() {
|
||||
const trackExitedSwapsEvent = () => {
|
||||
trackEvent({
|
||||
event: 'Exited Swaps',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
token_from: fetchParams?.sourceTokenInfo?.symbol,
|
||||
token_from_amount: fetchParams?.value,
|
||||
@ -313,7 +313,7 @@ export default function Swap() {
|
||||
const trackErrorStxEvent = useCallback(() => {
|
||||
trackEvent({
|
||||
event: 'Error Smart Transactions',
|
||||
category: EVENT.CATEGORIES.SWAPS,
|
||||
category: MetaMetricsEventCategory.Swaps,
|
||||
sensitiveProperties: {
|
||||
token_from: fetchParams?.sourceTokenInfo?.symbol,
|
||||
token_from_amount: fetchParams?.value,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user