2019-01-23 16:25:34 +01:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import FirstTimeFlow from './first-time-flow.component'
|
2019-03-05 16:45:01 +01:00
|
|
|
import { getFirstTimeFlowTypeRoute } from './first-time-flow.selectors'
|
2019-01-23 16:25:34 +01:00
|
|
|
import {
|
|
|
|
createNewVaultAndGetSeedPhrase,
|
|
|
|
createNewVaultAndRestore,
|
|
|
|
unlockAndGetSeedPhrase,
|
2019-03-22 00:03:30 +01:00
|
|
|
} from '../../store/actions'
|
2019-01-23 16:25:34 +01:00
|
|
|
|
|
|
|
const mapStateToProps = state => {
|
2019-02-27 15:46:41 +01:00
|
|
|
const { metamask: { completedOnboarding, isInitialized, isUnlocked } } = state
|
2019-01-23 16:25:34 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
completedOnboarding,
|
|
|
|
isInitialized,
|
|
|
|
isUnlocked,
|
2019-03-05 16:45:01 +01:00
|
|
|
nextRoute: getFirstTimeFlowTypeRoute(state),
|
2019-01-23 16:25:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
return {
|
|
|
|
createNewAccount: password => dispatch(createNewVaultAndGetSeedPhrase(password)),
|
|
|
|
createNewAccountFromSeed: (password, seedPhrase) => {
|
|
|
|
return dispatch(createNewVaultAndRestore(password, seedPhrase))
|
|
|
|
},
|
|
|
|
unlockAccount: password => dispatch(unlockAndGetSeedPhrase(password)),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(FirstTimeFlow)
|