2021-02-04 19:15:23 +01:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import MetaFoxLogo from '../../../components/ui/metafox-logo';
|
|
|
|
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,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-03-05 16:45:01 +01:00
|
|
|
|
|
|
|
static contextTypes = {
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent: PropTypes.func,
|
2020-03-11 16:00:05 +01:00
|
|
|
t: PropTypes.func,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-03-05 16:45:01 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2022-03-29 15:46:24 +02:00
|
|
|
const { trackEvent, t } = this.context;
|
2019-03-05 16:45:01 +01:00
|
|
|
const {
|
|
|
|
nextRoute,
|
|
|
|
history,
|
|
|
|
setParticipateInMetaMetrics,
|
|
|
|
firstTimeSelectionMetaMetricsName,
|
|
|
|
participateInMetaMetrics,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = this.props;
|
2019-03-05 16:45:01 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="metametrics-opt-in">
|
|
|
|
<div className="metametrics-opt-in__main">
|
2021-10-28 21:59:20 +02:00
|
|
|
<MetaFoxLogo />
|
2019-03-05 16:45:01 +01:00
|
|
|
<div className="metametrics-opt-in__body-graphic">
|
2020-11-11 16:38:15 +01:00
|
|
|
<img src="images/metrics-chart.svg" alt="" />
|
2019-03-05 16:45:01 +01:00
|
|
|
</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"
|
2021-05-15 02:29:26 +02:00
|
|
|
key="neverCollectIP"
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
|
|
|
{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"
|
2021-05-15 02:29:26 +02:00
|
|
|
key="neverSellData"
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
|
|
|
{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 () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
await setParticipateInMetaMetrics(false);
|
2019-03-05 19:14:02 +01:00
|
|
|
|
2020-11-11 23:03:11 +01:00
|
|
|
try {
|
2020-12-14 22:54:33 +01:00
|
|
|
if (
|
|
|
|
participateInMetaMetrics === null ||
|
|
|
|
participateInMetaMetrics === true
|
|
|
|
) {
|
2022-03-29 15:46:24 +02:00
|
|
|
await trackEvent(
|
|
|
|
{
|
2020-11-11 23:03:11 +01:00
|
|
|
category: 'Onboarding',
|
2022-03-29 15:46:24 +02:00
|
|
|
event: 'Metrics Opt Out',
|
|
|
|
properties: {
|
|
|
|
action: 'Metrics Option',
|
|
|
|
legacy_event: true,
|
|
|
|
},
|
2020-11-11 23:03:11 +01:00
|
|
|
},
|
2022-03-29 15:46:24 +02:00
|
|
|
{
|
|
|
|
isOptIn: true,
|
|
|
|
flushImmediately: true,
|
|
|
|
},
|
|
|
|
);
|
2020-11-11 23:03:11 +01:00
|
|
|
}
|
|
|
|
} finally {
|
2021-02-04 19:15:23 +01:00
|
|
|
history.push(nextRoute);
|
2020-11-11 23:03:11 +01:00
|
|
|
}
|
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,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-11-11 23:03:11 +01:00
|
|
|
try {
|
2021-02-04 19:15:23 +01:00
|
|
|
const metrics = [];
|
2020-12-14 22:54:33 +01:00
|
|
|
if (
|
|
|
|
participateInMetaMetrics === null ||
|
|
|
|
participateInMetaMetrics === false
|
|
|
|
) {
|
2020-11-11 23:03:11 +01:00
|
|
|
metrics.push(
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent(
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
category: 'Onboarding',
|
2022-03-29 15:46:24 +02:00
|
|
|
event: 'Metrics Opt In',
|
|
|
|
properties: {
|
|
|
|
action: 'Metrics Option',
|
|
|
|
legacy_event: true,
|
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
2022-03-29 15:46:24 +02:00
|
|
|
{
|
|
|
|
isOptIn: true,
|
|
|
|
flushImmediately: true,
|
|
|
|
},
|
|
|
|
),
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-11-11 23:03:11 +01:00
|
|
|
}
|
|
|
|
metrics.push(
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent(
|
|
|
|
{
|
2020-11-11 23:03:11 +01:00
|
|
|
category: 'Onboarding',
|
2022-03-29 15:46:24 +02:00
|
|
|
event: firstTimeSelectionMetaMetricsName,
|
|
|
|
properties: {
|
|
|
|
action: 'Import or Create',
|
|
|
|
legacy_event: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
isOptIn: true,
|
|
|
|
metaMetricsId,
|
|
|
|
flushImmediately: true,
|
2020-11-11 23:03:11 +01:00
|
|
|
},
|
2022-03-29 15:46:24 +02:00
|
|
|
),
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
await Promise.all(metrics);
|
2020-11-11 23:03:11 +01:00
|
|
|
} finally {
|
2021-02-04 19:15:23 +01:00
|
|
|
history.push(nextRoute);
|
2020-11-11 23:03:11 +01:00
|
|
|
}
|
2019-03-05 16:45:01 +01:00
|
|
|
}}
|
2020-08-21 02:13:14 +02:00
|
|
|
submitText={t('affirmAgree')}
|
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>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-03-05 16:45:01 +01:00
|
|
|
}
|
|
|
|
}
|