2019-03-05 16:45:01 +01:00
|
|
|
import {
|
|
|
|
DEFAULT_ROUTE,
|
2021-09-30 23:34:11 +02:00
|
|
|
ONBOARDING_CREATE_PASSWORD_ROUTE,
|
|
|
|
ONBOARDING_IMPORT_WITH_SRP_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') {
|
2023-01-13 17:25:01 +01:00
|
|
|
nextRoute = ONBOARDING_CREATE_PASSWORD_ROUTE;
|
2019-03-05 16:45:01 +01:00
|
|
|
} else if (firstTimeFlowType === 'import') {
|
2023-01-13 17:25:01 +01:00
|
|
|
nextRoute = ONBOARDING_IMPORT_WITH_SRP_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
|
|
|
|
2021-10-15 20:52:52 +02:00
|
|
|
export const getFirstTimeFlowType = (state) => {
|
|
|
|
return state.metamask.firstTimeFlowType;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
};
|
|
|
|
};
|