1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 11:01:41 +01:00
metamask-extension/ui/app/pages/first-time-flow/first-time-flow.selectors.js
Whymarrh Whitby 92971d3c87
Migrate codebase to use ESM (#7730)
* Update eslint-plugin-import version

* Convert JS files to use ESM

* Update ESLint rules to check imports

* Fix test:unit:global command env

* Cleanup mock-dev script
2020-01-09 00:04:58 -03:30

36 lines
843 B
JavaScript

import {
INITIALIZE_CREATE_PASSWORD_ROUTE,
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
DEFAULT_ROUTE,
} from '../../helpers/constants/routes'
export function getFirstTimeFlowTypeRoute (state) {
const { firstTimeFlowType } = state.metamask
let nextRoute
if (firstTimeFlowType === 'create') {
nextRoute = INITIALIZE_CREATE_PASSWORD_ROUTE
} else if (firstTimeFlowType === 'import') {
nextRoute = INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE
} else {
nextRoute = DEFAULT_ROUTE
}
return nextRoute
}
export const getOnboardingInitiator = (state) => {
const { onboardingTabs } = state.metamask
if (!onboardingTabs || Object.keys(onboardingTabs).length !== 1) {
return null
}
const location = Object.keys(onboardingTabs)[0]
const tabId = onboardingTabs[location]
return {
location,
tabId,
}
}