mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Onboarding V2 Cleanups (#12417)
* remove the onboarding V2 feature flags used for dev, some remain until we're ready to make the switch * update route * add setCompletedOnboarding dispatch to submission on privacy-settings view * update privacy-settings test
This commit is contained in:
parent
03e3edb00c
commit
f733857388
@ -3,6 +3,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
width: 500px;
|
width: 500px;
|
||||||
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.two-steps {
|
ul.two-steps {
|
||||||
|
@ -10,11 +10,6 @@ import {
|
|||||||
export default function Authenticated(props) {
|
export default function Authenticated(props) {
|
||||||
const { isUnlocked, completedOnboarding } = props;
|
const { isUnlocked, completedOnboarding } = props;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// For ONBOARDING_V2 dev purposes,
|
|
||||||
// Remove when ONBOARDING_V2 dev complete
|
|
||||||
case process.env.ONBOARDING_V2 === true:
|
|
||||||
return <Redirect to={{ pathname: ONBOARDING_ROUTE }} />;
|
|
||||||
|
|
||||||
case isUnlocked && completedOnboarding:
|
case isUnlocked && completedOnboarding:
|
||||||
return <Route {...props} />;
|
return <Route {...props} />;
|
||||||
case !completedOnboarding:
|
case !completedOnboarding:
|
||||||
|
@ -55,13 +55,6 @@ export default function OnboardingFlow() {
|
|||||||
const nextRoute = useSelector(getFirstTimeFlowTypeRoute);
|
const nextRoute = useSelector(getFirstTimeFlowTypeRoute);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// For ONBOARDING_V2 dev purposes,
|
|
||||||
// Remove when ONBOARDING_V2 dev complete
|
|
||||||
if (process.env.ONBOARDING_V2) {
|
|
||||||
history.push(ONBOARDING_METAMETRICS);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (completedOnboarding && seedPhraseBackedUp) {
|
if (completedOnboarding && seedPhraseBackedUp) {
|
||||||
history.push(DEFAULT_ROUTE);
|
history.push(DEFAULT_ROUTE);
|
||||||
return;
|
return;
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
} from '../../../helpers/constants/design-system';
|
} from '../../../helpers/constants/design-system';
|
||||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||||
import {
|
import {
|
||||||
|
setCompletedOnboarding,
|
||||||
setFeatureFlag,
|
setFeatureFlag,
|
||||||
setUsePhishDetect,
|
setUsePhishDetect,
|
||||||
setUseTokenDetection,
|
setUseTokenDetection,
|
||||||
@ -33,6 +34,7 @@ export default function PrivacySettings() {
|
|||||||
);
|
);
|
||||||
dispatch(setUsePhishDetect(usePhishingDetection));
|
dispatch(setUsePhishDetect(usePhishingDetection));
|
||||||
dispatch(setUseTokenDetection(turnOnTokenDetection));
|
dispatch(setUseTokenDetection(turnOnTokenDetection));
|
||||||
|
dispatch(setCompletedOnboarding());
|
||||||
history.push(ONBOARDING_PIN_EXTENSION_ROUTE);
|
history.push(ONBOARDING_PIN_EXTENSION_ROUTE);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,8 +2,10 @@ import React from 'react';
|
|||||||
import { fireEvent } from '@testing-library/react';
|
import { fireEvent } from '@testing-library/react';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import * as actions from '../../../store/actions';
|
import {
|
||||||
import { renderWithProvider } from '../../../../test/jest';
|
renderWithProvider,
|
||||||
|
setBackgroundConnection,
|
||||||
|
} from '../../../../test/jest';
|
||||||
import PrivacySettings from './privacy-settings';
|
import PrivacySettings from './privacy-settings';
|
||||||
|
|
||||||
describe('Privacy Settings Onboarding View', () => {
|
describe('Privacy Settings Onboarding View', () => {
|
||||||
@ -19,11 +21,15 @@ describe('Privacy Settings Onboarding View', () => {
|
|||||||
const setFeatureFlagStub = jest.fn();
|
const setFeatureFlagStub = jest.fn();
|
||||||
const setUsePhishDetectStub = jest.fn();
|
const setUsePhishDetectStub = jest.fn();
|
||||||
const setUseTokenDetectionStub = jest.fn();
|
const setUseTokenDetectionStub = jest.fn();
|
||||||
|
const completeOnboardingStub = jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(() => Promise.resolve());
|
||||||
|
|
||||||
actions._setBackgroundConnection({
|
setBackgroundConnection({
|
||||||
setFeatureFlag: setFeatureFlagStub,
|
setFeatureFlag: setFeatureFlagStub,
|
||||||
setUsePhishDetect: setUsePhishDetectStub,
|
setUsePhishDetect: setUsePhishDetectStub,
|
||||||
setUseTokenDetection: setUseTokenDetectionStub,
|
setUseTokenDetection: setUseTokenDetectionStub,
|
||||||
|
completeOnboarding: completeOnboardingStub,
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update preferences', () => {
|
it('should update preferences', () => {
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
} from '../../../helpers/constants/design-system';
|
} from '../../../helpers/constants/design-system';
|
||||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||||
import { setFirstTimeFlowType } from '../../../store/actions';
|
import { setFirstTimeFlowType } from '../../../store/actions';
|
||||||
import { INITIALIZE_METAMETRICS_OPT_IN_ROUTE } from '../../../helpers/constants/routes';
|
import { ONBOARDING_METAMETRICS } from '../../../helpers/constants/routes';
|
||||||
|
|
||||||
export default function OnboardingWelcome() {
|
export default function OnboardingWelcome() {
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
@ -23,12 +23,12 @@ export default function OnboardingWelcome() {
|
|||||||
|
|
||||||
const onCreateClick = () => {
|
const onCreateClick = () => {
|
||||||
dispatch(setFirstTimeFlowType('create'));
|
dispatch(setFirstTimeFlowType('create'));
|
||||||
history.push(INITIALIZE_METAMETRICS_OPT_IN_ROUTE);
|
history.push(ONBOARDING_METAMETRICS);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onImportClick = () => {
|
const onImportClick = () => {
|
||||||
dispatch(setFirstTimeFlowType('import'));
|
dispatch(setFirstTimeFlowType('import'));
|
||||||
history.push(INITIALIZE_METAMETRICS_OPT_IN_ROUTE);
|
history.push(ONBOARDING_METAMETRICS);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user