2019-03-05 16:45:01 +01:00
|
|
|
import {
|
|
|
|
INITIALIZE_CREATE_PASSWORD_ROUTE,
|
|
|
|
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
|
|
|
|
DEFAULT_ROUTE,
|
2021-02-04 19:15:23 +01:00
|
|
|
} from '../helpers/constants/routes';
|
2019-03-05 16:45:01 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export function getFirstTimeFlowTypeRoute(state) {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { firstTimeFlowType } = state.metamask;
|
2019-03-05 16:45:01 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
let nextRoute;
|
2019-03-05 16:45:01 +01:00
|
|
|
if (firstTimeFlowType === 'create') {
|
2021-02-04 19:15:23 +01:00
|
|
|
nextRoute = INITIALIZE_CREATE_PASSWORD_ROUTE;
|
2019-03-05 16:45:01 +01:00
|
|
|
} else if (firstTimeFlowType === 'import') {
|
2021-02-04 19:15:23 +01:00
|
|
|
nextRoute = INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE;
|
2019-03-05 16:45:01 +01:00
|
|
|
} else {
|
2021-02-04 19:15:23 +01:00
|
|
|
nextRoute = DEFAULT_ROUTE;
|
2019-03-05 16:45:01 +01:00
|
|
|
}
|
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
return nextRoute;
|
2019-03-05 16:45:01 +01:00
|
|
|
}
|
2019-11-22 18:03:51 +01:00
|
|
|
|
2020-01-09 04:34:58 +01:00
|
|
|
export const getOnboardingInitiator = (state) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { onboardingTabs } = state.metamask;
|
2019-11-22 18:03:51 +01:00
|
|
|
|
|
|
|
if (!onboardingTabs || Object.keys(onboardingTabs).length !== 1) {
|
2021-02-04 19:15:23 +01:00
|
|
|
return null;
|
2019-11-22 18:03:51 +01:00
|
|
|
}
|
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const location = Object.keys(onboardingTabs)[0];
|
|
|
|
const tabId = onboardingTabs[location];
|
2019-11-22 18:03:51 +01:00
|
|
|
return {
|
|
|
|
location,
|
|
|
|
tabId,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|