mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 21:57:06 +01:00
a8c1756816
* Remove 3box feature and delete ThreeBoxController Lint locale messages lavamoat policy updates * Restore 3Box user trait with value `false` The 3Box user trait has been restored and hard-coded as `false`. This ensures that users don't get stuck in our metrics as having this trait. A deprecation comment has been left in various places for this trait. * Remove unused state * Remove additional 3box-related things * Run `yarn-deduplicate` * Restore migration that was lost while rebasing * Remove obsolete override * Remove additional unused resolutions/dependencies * Update LavaMoat policies * Remove obsolete security advisory ignore entries * Remove 3Box fixture builder method * Update unit tests Co-authored-by: Mark Stacey <markjstacey@gmail.com>
99 lines
2.9 KiB
JavaScript
99 lines
2.9 KiB
JavaScript
import React, { PureComponent } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import {
|
|
INITIALIZE_SELECT_ACTION_ROUTE,
|
|
INITIALIZE_END_OF_FLOW_ROUTE,
|
|
} from '../../../../helpers/constants/routes';
|
|
import CreateNewVault from '../../../../components/app/create-new-vault';
|
|
import {
|
|
EVENT,
|
|
EVENT_NAMES,
|
|
} from '../../../../../shared/constants/metametrics';
|
|
|
|
export default class ImportWithSeedPhrase extends PureComponent {
|
|
static contextTypes = {
|
|
t: PropTypes.func,
|
|
trackEvent: PropTypes.func,
|
|
};
|
|
|
|
static propTypes = {
|
|
history: PropTypes.object,
|
|
onSubmit: PropTypes.func.isRequired,
|
|
setSeedPhraseBackedUp: PropTypes.func,
|
|
};
|
|
|
|
UNSAFE_componentWillMount() {
|
|
this._onBeforeUnload = () =>
|
|
this.context.trackEvent({
|
|
category: EVENT.CATEGORIES.ONBOARDING,
|
|
event: EVENT_NAMES.WALLET_SETUP_FAILED,
|
|
properties: {
|
|
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
|
account_import_type: EVENT.ACCOUNT_IMPORT_TYPES.SRP,
|
|
reason: 'Seed Phrase Error',
|
|
error: this.state.seedPhraseError,
|
|
},
|
|
});
|
|
window.addEventListener('beforeunload', this._onBeforeUnload);
|
|
}
|
|
|
|
componentWillUnmount() {
|
|
window.removeEventListener('beforeunload', this._onBeforeUnload);
|
|
}
|
|
|
|
handleImport = async (password, seedPhrase) => {
|
|
const { history, onSubmit, setSeedPhraseBackedUp } = this.props;
|
|
|
|
await onSubmit(password, seedPhrase);
|
|
this.context.trackEvent({
|
|
category: EVENT.CATEGORIES.ONBOARDING,
|
|
event: EVENT_NAMES.WALLET_CREATED,
|
|
properties: {
|
|
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
|
account_import_type: EVENT.ACCOUNT_IMPORT_TYPES.SRP,
|
|
},
|
|
});
|
|
|
|
await setSeedPhraseBackedUp(true);
|
|
history.replace(INITIALIZE_END_OF_FLOW_ROUTE);
|
|
};
|
|
|
|
render() {
|
|
const { t } = this.context;
|
|
|
|
return (
|
|
<div className="first-time-flow__import">
|
|
<div className="first-time-flow__create-back">
|
|
<a
|
|
onClick={(e) => {
|
|
e.preventDefault();
|
|
this.context.trackEvent({
|
|
category: EVENT.CATEGORIES.ONBOARDING,
|
|
event: EVENT_NAMES.WALLET_SETUP_CANCELED,
|
|
properties: {
|
|
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
|
account_import_type: EVENT.ACCOUNT_IMPORT_TYPES.SRP,
|
|
text: 'Back',
|
|
},
|
|
});
|
|
this.props.history.push(INITIALIZE_SELECT_ACTION_ROUTE);
|
|
}}
|
|
href="#"
|
|
>
|
|
{`< ${t('back')}`}
|
|
</a>
|
|
</div>
|
|
<div className="first-time-flow__header">
|
|
{t('importAccountSeedPhrase')}
|
|
</div>
|
|
<div className="first-time-flow__text-block">{t('secretPhrase')}</div>
|
|
<CreateNewVault
|
|
includeTerms
|
|
onSubmit={this.handleImport}
|
|
submitText={t('import')}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|