2018-07-24 20:40:05 +02:00
|
|
|
import Home from './home.component'
|
|
|
|
import { compose } from 'recompose'
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { withRouter } from 'react-router-dom'
|
2019-03-22 00:03:30 +01:00
|
|
|
import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-transaction'
|
2019-08-01 15:24:33 +02:00
|
|
|
import {
|
|
|
|
forceApproveProviderRequestByOrigin,
|
|
|
|
unsetMigratedPrivacyMode,
|
|
|
|
} from '../../store/actions'
|
|
|
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
|
|
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../app/scripts/lib/enums'
|
2019-07-12 17:41:39 +02:00
|
|
|
|
2018-07-24 20:40:05 +02:00
|
|
|
const mapStateToProps = state => {
|
2019-08-01 15:24:33 +02:00
|
|
|
const { activeTab, metamask, appState } = state
|
2018-07-24 20:40:05 +02:00
|
|
|
const {
|
2019-08-01 15:24:33 +02:00
|
|
|
approvedOrigins,
|
2018-07-24 20:40:05 +02:00
|
|
|
lostAccounts,
|
2018-08-28 20:20:30 +02:00
|
|
|
suggestedTokens,
|
2018-09-27 20:19:09 +02:00
|
|
|
providerRequests,
|
2019-08-01 15:24:33 +02:00
|
|
|
migratedPrivacyMode,
|
|
|
|
featureFlags: {
|
|
|
|
privacyMode,
|
|
|
|
} = {},
|
2018-07-24 20:40:05 +02:00
|
|
|
} = metamask
|
|
|
|
const { forgottenPassword } = appState
|
|
|
|
|
2019-08-01 15:24:33 +02:00
|
|
|
const isUnconnected = Boolean(activeTab && privacyMode && !approvedOrigins[activeTab.origin])
|
|
|
|
const isPopup = getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP
|
|
|
|
|
2018-07-24 20:40:05 +02:00
|
|
|
return {
|
|
|
|
lostAccounts,
|
|
|
|
forgottenPassword,
|
2018-08-28 20:20:30 +02:00
|
|
|
suggestedTokens,
|
2018-07-31 07:03:20 +02:00
|
|
|
unconfirmedTransactionsCount: unconfirmedTransactionsCountSelector(state),
|
2018-09-27 20:19:09 +02:00
|
|
|
providerRequests,
|
2019-08-01 15:24:33 +02:00
|
|
|
showPrivacyModeNotification: migratedPrivacyMode,
|
|
|
|
activeTab,
|
|
|
|
viewingUnconnectedDapp: isUnconnected && isPopup,
|
2018-07-24 20:40:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-01 15:24:33 +02:00
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
unsetMigratedPrivacyMode: () => dispatch(unsetMigratedPrivacyMode()),
|
|
|
|
forceApproveProviderRequestByOrigin: (origin) => dispatch(forceApproveProviderRequestByOrigin(origin)),
|
|
|
|
})
|
|
|
|
|
2018-07-24 20:40:05 +02:00
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2019-08-01 15:24:33 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps)
|
2018-07-24 20:40:05 +02:00
|
|
|
)(Home)
|