-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MMI] updates onboarding flow for MMI (#20905)
Updates the amount of steps during onboarding for a MMI user, by reducing the number of screens one has to go through. Meaning the user will go from the Welcome screen to -> Create Password screen -> Pin Extension screen -> Continue to MMI screen. ## Pre-merge author checklist - [x] I've clearly explained: - [x] What problem this PR is solving - [x] How this problem was solved - [x] How reviewers can test my changes - [x] Sufficient automated test coverage has been added ## Pre-merge reviewer checklist - [x] Manual testing (e.g. pull and build branch, run in browser, test code being changed) - [ ] **IF** this PR fixes a bug in the release milestone, add this PR to the release milestone If further QA is required (e.g. new feature, complex testing steps, large refactor), add the `Extension QA Board` label. In this case, a QA Engineer approval will be be required. --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com> Co-authored-by: Brad Decker <bhdecker84@gmail.com>
- Loading branch information
1 parent
4c67c06
commit 945dc7f
Showing
23 changed files
with
1,275 additions
and
189 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.onboarding-successful { | ||
@include screen-sm-min { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
max-width: 600px; | ||
} |
50 changes: 50 additions & 0 deletions
50
ui/pages/institutional/onboarding-successful/onboarding-successful.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { Box, Text } from '../../../components/component-library'; | ||
import Button from '../../../components/ui/button'; | ||
import { | ||
TextVariant, | ||
TextAlign, | ||
FontWeight, | ||
} from '../../../helpers/constants/design-system'; | ||
import { useI18nContext } from '../../../hooks/useI18nContext'; | ||
import { setCompletedOnboarding } from '../../../store/actions'; | ||
import { getMMIConfiguration } from '../../../selectors/institutional/selectors'; | ||
|
||
export default function OnboardingSuccessful() { | ||
const t = useI18nContext(); | ||
const dispatch = useDispatch(); | ||
const { portfolio } = useSelector(getMMIConfiguration); | ||
|
||
return ( | ||
<div className="onboarding-successful" data-testid="onboarding-successful"> | ||
<Box textAlign={TextAlign.Center}> | ||
<Text | ||
variant={TextVariant.headingLg} | ||
fontWeight={FontWeight.Bold} | ||
margin={6} | ||
> | ||
{t('extensionInsallCompleteTitle')} | ||
</Text> | ||
<Text marginTop={6} marginBottom={6}> | ||
{t('extensionInsallCompleteDescription')} | ||
</Text> | ||
</Box> | ||
|
||
<Box marginTop={6}> | ||
<Button | ||
data-testid="onboarding-continue-button" | ||
type="primary" | ||
large | ||
rounded | ||
onClick={async () => { | ||
await dispatch(setCompletedOnboarding()); | ||
window.open(portfolio.url); | ||
}} | ||
> | ||
{t('continueMmiOnboarding')} | ||
</Button> | ||
</Box> | ||
</div> | ||
); | ||
} |
16 changes: 16 additions & 0 deletions
16
ui/pages/institutional/onboarding-successful/onboarding-successful.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import OnboardingSuccessful from './onboarding-successful'; | ||
|
||
export default { | ||
title: 'Pages/Institutional/OnboardingSuccessful', | ||
}; | ||
|
||
export const DefaultStory = () => { | ||
return ( | ||
<div style={{ maxHeight: '2000px' }}> | ||
<OnboardingSuccessful /> | ||
</div> | ||
); | ||
}; | ||
|
||
DefaultStory.storyName = 'Default'; |
44 changes: 44 additions & 0 deletions
44
ui/pages/institutional/onboarding-successful/onboarding-successful.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import configureMockStore from 'redux-mock-store'; | ||
import thunk from 'redux-thunk'; | ||
import { | ||
renderWithProvider, | ||
setBackgroundConnection, | ||
} from '../../../../test/jest'; | ||
import OnboardingSuccessful from './onboarding-successful'; | ||
|
||
const mockHistoryPush = jest.fn(); | ||
|
||
const completeOnboardingStub = jest | ||
.fn() | ||
.mockImplementation(() => Promise.resolve()); | ||
|
||
jest.mock('react-router-dom', () => ({ | ||
...jest.requireActual('react-router-dom'), | ||
useHistory: () => ({ | ||
push: mockHistoryPush, | ||
}), | ||
})); | ||
|
||
describe('Successful Onboarding View', () => { | ||
const mockStore = { | ||
metamask: { | ||
providerConfig: { | ||
type: 'test', | ||
}, | ||
}, | ||
}; | ||
const store = configureMockStore([thunk])(mockStore); | ||
setBackgroundConnection({ completeOnboarding: completeOnboardingStub }); | ||
|
||
afterEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
it('should render the onboarding-successful view', () => { | ||
const { getByTestId } = renderWithProvider(<OnboardingSuccessful />, store); | ||
const continueButton = getByTestId('onboarding-continue-button'); | ||
expect(getByTestId('onboarding-successful')).toBeInTheDocument(); | ||
expect(continueButton).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.