2019-03-05 16:45:01 +01:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2019-07-09 19:17:58 +02:00
|
|
|
import MetaFoxLogo from '../../../components/ui/metafox-logo'
|
2019-03-22 00:03:30 +01:00
|
|
|
import PageContainerFooter from '../../../components/ui/page-container/page-container-footer'
|
2019-03-05 16:45:01 +01:00
|
|
|
|
|
|
|
export default class MetaMetricsOptIn extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
history: PropTypes.object,
|
|
|
|
setParticipateInMetaMetrics: PropTypes.func,
|
|
|
|
nextRoute: PropTypes.string,
|
|
|
|
firstTimeSelectionMetaMetricsName: PropTypes.string,
|
|
|
|
participateInMetaMetrics: PropTypes.bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
static contextTypes = {
|
|
|
|
metricsEvent: PropTypes.func,
|
2020-03-11 16:00:05 +01:00
|
|
|
t: PropTypes.func,
|
2019-03-05 16:45:01 +01:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2020-03-11 16:00:05 +01:00
|
|
|
const { metricsEvent, t } = this.context
|
2019-03-05 16:45:01 +01:00
|
|
|
const {
|
|
|
|
nextRoute,
|
|
|
|
history,
|
|
|
|
setParticipateInMetaMetrics,
|
|
|
|
firstTimeSelectionMetaMetricsName,
|
|
|
|
participateInMetaMetrics,
|
|
|
|
} = this.props
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="metametrics-opt-in">
|
|
|
|
<div className="metametrics-opt-in__main">
|
2019-07-09 19:17:58 +02:00
|
|
|
<MetaFoxLogo />
|
2019-03-05 16:45:01 +01:00
|
|
|
<div className="metametrics-opt-in__body-graphic">
|
|
|
|
<img src="images/metrics-chart.svg" />
|
|
|
|
</div>
|
2020-11-03 00:41:28 +01:00
|
|
|
<div className="metametrics-opt-in__title">
|
|
|
|
{t('metametricsHelpImproveMetaMask')}
|
|
|
|
</div>
|
2019-03-05 16:45:01 +01:00
|
|
|
<div className="metametrics-opt-in__body">
|
|
|
|
<div className="metametrics-opt-in__description">
|
2020-10-14 18:03:34 +02:00
|
|
|
{t('metametricsOptInDescription')}
|
2019-03-05 16:45:01 +01:00
|
|
|
</div>
|
|
|
|
<div className="metametrics-opt-in__description">
|
2020-10-14 18:03:34 +02:00
|
|
|
{t('metametricsCommitmentsIntro')}
|
2019-03-05 16:45:01 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="metametrics-opt-in__committments">
|
|
|
|
<div className="metametrics-opt-in__row">
|
|
|
|
<i className="fa fa-check" />
|
|
|
|
<div className="metametrics-opt-in__row-description">
|
2020-10-14 18:03:34 +02:00
|
|
|
{t('metametricsCommitmentsAllowOptOut')}
|
2019-03-05 16:45:01 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="metametrics-opt-in__row">
|
|
|
|
<i className="fa fa-check" />
|
|
|
|
<div className="metametrics-opt-in__row-description">
|
2020-10-14 18:03:34 +02:00
|
|
|
{t('metametricsCommitmentsSendAnonymizedEvents')}
|
2019-03-05 16:45:01 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="metametrics-opt-in__row metametrics-opt-in__break-row">
|
|
|
|
<i className="fa fa-times" />
|
|
|
|
<div className="metametrics-opt-in__row-description">
|
2020-11-03 00:41:28 +01:00
|
|
|
{t('metametricsCommitmentsNeverCollectKeysEtc', [
|
|
|
|
<span
|
|
|
|
className="metametrics-opt-in__bold"
|
|
|
|
key="neverCollectKeys"
|
|
|
|
>
|
|
|
|
{t('metametricsCommitmentsBoldNever')}
|
|
|
|
</span>,
|
|
|
|
])}
|
2019-03-05 16:45:01 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="metametrics-opt-in__row">
|
|
|
|
<i className="fa fa-times" />
|
|
|
|
<div className="metametrics-opt-in__row-description">
|
2020-11-03 00:41:28 +01:00
|
|
|
{t('metametricsCommitmentsNeverCollectIP', [
|
|
|
|
<span
|
|
|
|
className="metametrics-opt-in__bold"
|
|
|
|
key="neverCollectKeys"
|
|
|
|
>
|
|
|
|
{t('metametricsCommitmentsBoldNever')}
|
|
|
|
</span>,
|
|
|
|
])}
|
2019-03-05 16:45:01 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="metametrics-opt-in__row">
|
|
|
|
<i className="fa fa-times" />
|
|
|
|
<div className="metametrics-opt-in__row-description">
|
2020-11-03 00:41:28 +01:00
|
|
|
{t('metametricsCommitmentsNeverSellDataForProfit', [
|
|
|
|
<span
|
|
|
|
className="metametrics-opt-in__bold"
|
|
|
|
key="neverCollectKeys"
|
|
|
|
>
|
|
|
|
{t('metametricsCommitmentsBoldNever')}
|
|
|
|
</span>,
|
|
|
|
])}
|
2019-03-05 16:45:01 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="metametrics-opt-in__footer">
|
|
|
|
<PageContainerFooter
|
2020-11-11 23:03:11 +01:00
|
|
|
onCancel={async () => {
|
|
|
|
await setParticipateInMetaMetrics(false)
|
2019-03-05 19:14:02 +01:00
|
|
|
|
2020-11-11 23:03:11 +01:00
|
|
|
try {
|
|
|
|
if (participateInMetaMetrics === true) {
|
|
|
|
await metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Onboarding',
|
|
|
|
action: 'Metrics Option',
|
|
|
|
name: 'Metrics Opt Out',
|
|
|
|
},
|
|
|
|
isOptIn: true,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
history.push(nextRoute)
|
|
|
|
}
|
2019-03-05 16:45:01 +01:00
|
|
|
}}
|
2020-08-21 02:13:14 +02:00
|
|
|
cancelText={t('noThanks')}
|
2019-03-05 16:45:01 +01:00
|
|
|
hideCancel={false}
|
2020-11-11 23:03:11 +01:00
|
|
|
onSubmit={async () => {
|
|
|
|
const [, metaMetricsId] = await setParticipateInMetaMetrics(
|
|
|
|
true,
|
|
|
|
)
|
|
|
|
try {
|
|
|
|
const metrics = []
|
|
|
|
if (participateInMetaMetrics === false) {
|
|
|
|
metrics.push(
|
|
|
|
metricsEvent({
|
2020-11-03 00:41:28 +01:00
|
|
|
eventOpts: {
|
|
|
|
category: 'Onboarding',
|
2020-11-11 23:03:11 +01:00
|
|
|
action: 'Metrics Option',
|
|
|
|
name: 'Metrics Opt In',
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
|
|
|
isOptIn: true,
|
2020-11-11 23:03:11 +01:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
metrics.push(
|
|
|
|
metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Onboarding',
|
|
|
|
action: 'Import or Create',
|
|
|
|
name: firstTimeSelectionMetaMetricsName,
|
|
|
|
},
|
|
|
|
isOptIn: true,
|
|
|
|
metaMetricsId,
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
await Promise.all(metrics)
|
|
|
|
} finally {
|
|
|
|
history.push(nextRoute)
|
|
|
|
}
|
2019-03-05 16:45:01 +01:00
|
|
|
}}
|
2020-08-21 02:13:14 +02:00
|
|
|
submitText={t('affirmAgree')}
|
2019-11-18 16:08:47 +01:00
|
|
|
submitButtonType="primary"
|
2019-03-05 16:45:01 +01:00
|
|
|
disabled={false}
|
|
|
|
/>
|
|
|
|
<div className="metametrics-opt-in__bottom-text">
|
2020-11-03 00:41:28 +01:00
|
|
|
{t('gdprMessage', [
|
2020-03-11 16:00:05 +01:00
|
|
|
<a
|
|
|
|
key="metametrics-bottom-text-wrapper"
|
|
|
|
href="https://metamask.io/privacy.html"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
|
|
|
{t('gdprMessagePrivacyPolicy')}
|
|
|
|
</a>,
|
|
|
|
])}
|
2019-03-05 16:45:01 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|