1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/selectors/first-time-flow.js
David Walsh 52a28d52b3 Remove ONBOARDING_V2 flag for release (#16865)
* Remove ONBOARDING_V2 flag for release

* Remove new usage

* Update e2e tests

* Update incremental-security.spec.js

* Fix lint

Co-authored-by: PeterYinusa <peter.yinusa@consensys.net>
2023-01-13 18:37:15 +00:00

40 lines
932 B
JavaScript

import {
DEFAULT_ROUTE,
ONBOARDING_CREATE_PASSWORD_ROUTE,
ONBOARDING_IMPORT_WITH_SRP_ROUTE,
} from '../helpers/constants/routes';
export function getFirstTimeFlowTypeRoute(state) {
const { firstTimeFlowType } = state.metamask;
let nextRoute;
if (firstTimeFlowType === 'create') {
nextRoute = ONBOARDING_CREATE_PASSWORD_ROUTE;
} else if (firstTimeFlowType === 'import') {
nextRoute = ONBOARDING_IMPORT_WITH_SRP_ROUTE;
} else {
nextRoute = DEFAULT_ROUTE;
}
return nextRoute;
}
export const getFirstTimeFlowType = (state) => {
return state.metamask.firstTimeFlowType;
};
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,
};
};