You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
4 years ago
|
import { connect } from 'react-redux';
|
||
|
import { getFirstTimeFlowTypeRoute } from '../../selectors';
|
||
6 years ago
|
import {
|
||
|
createNewVaultAndGetSeedPhrase,
|
||
|
createNewVaultAndRestore,
|
||
|
unlockAndGetSeedPhrase,
|
||
5 years ago
|
verifySeedPhrase,
|
||
4 years ago
|
} from '../../store/actions';
|
||
|
import { INITIALIZE_BACKUP_SEED_PHRASE_ROUTE } from '../../helpers/constants/routes';
|
||
|
import FirstTimeFlow from './first-time-flow.component';
|
||
6 years ago
|
|
||
5 years ago
|
const mapStateToProps = (state, ownProps) => {
|
||
4 years ago
|
const {
|
||
|
metamask: {
|
||
|
completedOnboarding,
|
||
|
isInitialized,
|
||
|
isUnlocked,
|
||
|
seedPhraseBackedUp,
|
||
|
},
|
||
4 years ago
|
} = state;
|
||
4 years ago
|
const showingSeedPhraseBackupAfterOnboarding = Boolean(
|
||
|
ownProps.location.pathname.match(INITIALIZE_BACKUP_SEED_PHRASE_ROUTE),
|
||
4 years ago
|
);
|
||
6 years ago
|
|
||
|
return {
|
||
|
completedOnboarding,
|
||
|
isInitialized,
|
||
|
isUnlocked,
|
||
6 years ago
|
nextRoute: getFirstTimeFlowTypeRoute(state),
|
||
5 years ago
|
showingSeedPhraseBackupAfterOnboarding,
|
||
|
seedPhraseBackedUp,
|
||
4 years ago
|
};
|
||
|
};
|
||
6 years ago
|
|
||
5 years ago
|
const mapDispatchToProps = (dispatch) => {
|
||
6 years ago
|
return {
|
||
4 years ago
|
createNewAccount: (password) =>
|
||
|
dispatch(createNewVaultAndGetSeedPhrase(password)),
|
||
6 years ago
|
createNewAccountFromSeed: (password, seedPhrase) => {
|
||
4 years ago
|
return dispatch(createNewVaultAndRestore(password, seedPhrase));
|
||
6 years ago
|
},
|
||
5 years ago
|
unlockAccount: (password) => dispatch(unlockAndGetSeedPhrase(password)),
|
||
5 years ago
|
verifySeedPhrase: () => verifySeedPhrase(),
|
||
4 years ago
|
};
|
||
|
};
|
||
6 years ago
|
|
||
4 years ago
|
export default connect(mapStateToProps, mapDispatchToProps)(FirstTimeFlow);
|