1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-18 07:23:21 +01:00
metamask-extension/ui/app/pages/first-time-flow/end-of-flow/end-of-flow.container.js
Mark Stacey 552ea136b7
Fix onboarding library integration (#9835)
The bug with our onboarding library integration was introduced in #8873
because of a change in when `completeOnboarding` was called. We hadn't
realized at the time that the onboarding integration relied upon the
onboarding completing event to know when the onboarding state should
be cleared. Because onboarding is now marked as completed earlier, the
state was cleared just as it was intended to be used.

The onboarding completed event has been moved back to where it was
before: after the user exits the "end of flow" page.

The original problem that #8873 was addressing was a routing issue,
where the user would be redirected back to the seed phrase confirmation
page despite already having confirmed their seed phrase. This was fixed
in a different way here, by updating the routing in the first time flow
switch to skip straight to the end of flow page if the seed phrase has
already been confirmed.

This does involve one user-facing change in behavior; if the user opens
any MetaMask UI before navigating away from the end-of-flow screen,
they will still be considered mid-onboarding so it'll redirect to the
end-of-flow screen. But we do mark onboarding as completed if the user
closes the tab/window while on the end of flow screen, which was
another goal of #8873.
2020-11-10 17:57:08 -03:30

29 lines
763 B
JavaScript

import { connect } from 'react-redux'
import { getOnboardingInitiator } from '../../../selectors'
import { setCompletedOnboarding } from '../../../store/actions'
import EndOfFlow from './end-of-flow.component'
const firstTimeFlowTypeNameMap = {
create: 'New Wallet Created',
import: 'New Wallet Imported',
}
const mapStateToProps = (state) => {
const {
metamask: { firstTimeFlowType },
} = state
return {
completionMetaMetricsName: firstTimeFlowTypeNameMap[firstTimeFlowType],
onboardingInitiator: getOnboardingInitiator(state),
}
}
const mapDispatchToProps = (dispatch) => {
return {
setCompletedOnboarding: () => dispatch(setCompletedOnboarding()),
}
}
export default connect(mapStateToProps, mapDispatchToProps)(EndOfFlow)