import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import Button from '../../../components/ui/button' import Snackbar from '../../../components/ui/snackbar' import MetaFoxLogo from '../../../components/ui/metafox-logo' import { DEFAULT_ROUTE } from '../../../helpers/constants/routes' import { returnToOnboardingInitiator } from '../onboarding-initiator-util' export default class EndOfFlowScreen extends PureComponent { static contextTypes = { t: PropTypes.func, metricsEvent: PropTypes.func, } static propTypes = { history: PropTypes.object, completeOnboarding: PropTypes.func, completionMetaMetricsName: PropTypes.string, onboardingInitiator: PropTypes.exact({ location: PropTypes.string, tabId: PropTypes.number, }), } onComplete = async () => { const { history, completeOnboarding, completionMetaMetricsName, onboardingInitiator } = this.props await completeOnboarding() this.context.metricsEvent({ eventOpts: { category: 'Onboarding', action: 'Onboarding Complete', name: completionMetaMetricsName, }, }) if (onboardingInitiator) { await returnToOnboardingInitiator(onboardingInitiator) } history.push(DEFAULT_ROUTE) } render () { const { t } = this.context const { onboardingInitiator } = this.props return (