Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4605,8 +4605,9 @@ export default class MetamaskController extends EventEmitter {
const newHdEntropyIndex = this.getHDEntropyIndex();

this.metaMetricsController.trackEvent({
event: MetaMetricsEventName.ImportSecretRecoveryPhraseCompleted,
event: MetaMetricsEventName.ImportSecretRecoveryPhrase,
properties: {
status: 'completed',
// eslint-disable-next-line @typescript-eslint/naming-convention
hd_entropy_index: newHdEntropyIndex,
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
3 changes: 1 addition & 2 deletions shared/constants/metametrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,7 @@ export enum MetaMetricsEventName {
EncryptionPublicKeyRequested = 'Encryption Requested',
ErrorOccured = 'Error occured',
ExternalLinkClicked = 'External Link Clicked',
ImportSecretRecoveryPhraseClicked = 'Import Secret Recovery Phrase Clicked',
ImportSecretRecoveryPhraseCompleted = 'Import Secret Recovery Phrase Completed',
ImportSecretRecoveryPhrase = 'Import Secret Recovery Phrase',
KeyExportSelected = 'Key Export Selected',
KeyExportRequested = 'Key Export Requested',
KeyExportFailed = 'Key Export Failed',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ export const AddWalletModal: React.FC<AddWalletModalProps> = ({
const handleOptionClick = (option: WalletOption) => {
onClose?.();

if (option.id === 'import-wallet') {
// Track the event for the selected option.
trackEvent({
category: MetaMetricsEventCategory.Navigation,
event: MetaMetricsEventName.ImportSecretRecoveryPhrase,
properties: {
status: 'started',
location: 'Add Wallet Modal',
},
});
}

// Hardware wallet connections require expanded view
if (option.id === 'hardware-wallet') {
if (
Expand Down
7 changes: 5 additions & 2 deletions ui/components/multichain/account-menu/account-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,11 @@ export const AccountMenu = ({
onClick={() => {
trackEvent({
category: MetaMetricsEventCategory.Navigation,
event:
MetaMetricsEventName.ImportSecretRecoveryPhraseClicked,
event: MetaMetricsEventName.ImportSecretRecoveryPhrase,
properties: {
status: 'started',
location: 'Account Menu',
},
});
history.push(IMPORT_SRP_ROUTE);
onClose();
Expand Down
15 changes: 14 additions & 1 deletion ui/pages/multi-srp/import-srp/import-srp.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useContext } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom-v5-compat';
import { useI18nContext } from '../../../hooks/useI18nContext';
Expand Down Expand Up @@ -32,6 +32,8 @@ import {
TextAlign,
TextVariant,
} from '../../../helpers/constants/design-system';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import { MetaMetricsEventName } from '../../../../shared/constants/metametrics';

export const ImportSrp = () => {
const t = useI18nContext();
Expand All @@ -41,6 +43,7 @@ export const ImportSrp = () => {
const [secretRecoveryPhrase, setSecretRecoveryPhrase] = useState('');
const isSocialLoginEnabled = useSelector(getIsSocialLoginFlow);
const isSeedlessPasswordOutdated = useSelector(getIsSeedlessPasswordOutdated);
const trackEvent = useContext(MetaMetricsContext);

// Providing duplicate SRP throws an error in metamask-controller, which results in a warning in the UI
// We want to hide the warning when the component unmounts
Expand All @@ -64,7 +67,17 @@ export const ImportSrp = () => {
return;
}
}

trackEvent({
event: MetaMetricsEventName.ImportSecretRecoveryPhrase,
properties: {
status: 'continue_button_clicked',
location: 'Multi SRP Import',
},
});

await dispatch(importMnemonicToVault(secretRecoveryPhrase));

navigate(DEFAULT_ROUTE);
dispatch(setShowNewSrpAddedToast(true));
} catch (error) {
Expand Down
Loading