You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
189 lines
6.7 KiB
189 lines
6.7 KiB
4 years ago
|
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';
|
||
6 years ago
|
|
||
|
export default class MetaMetricsOptIn extends Component {
|
||
|
static propTypes = {
|
||
|
history: PropTypes.object,
|
||
|
setParticipateInMetaMetrics: PropTypes.func,
|
||
|
nextRoute: PropTypes.string,
|
||
|
firstTimeSelectionMetaMetricsName: PropTypes.string,
|
||
|
participateInMetaMetrics: PropTypes.bool,
|
||
4 years ago
|
};
|
||
6 years ago
|
|
||
|
static contextTypes = {
|
||
|
metricsEvent: PropTypes.func,
|
||
5 years ago
|
t: PropTypes.func,
|
||
4 years ago
|
};
|
||
6 years ago
|
|
||
4 years ago
|
render() {
|
||
4 years ago
|
const { metricsEvent, t } = this.context;
|
||
6 years ago
|
const {
|
||
|
nextRoute,
|
||
|
history,
|
||
|
setParticipateInMetaMetrics,
|
||
|
firstTimeSelectionMetaMetricsName,
|
||
|
participateInMetaMetrics,
|
||
4 years ago
|
} = this.props;
|
||
6 years ago
|
|
||
|
return (
|
||
|
<div className="metametrics-opt-in">
|
||
|
<div className="metametrics-opt-in__main">
|
||
5 years ago
|
<MetaFoxLogo />
|
||
6 years ago
|
<div className="metametrics-opt-in__body-graphic">
|
||
4 years ago
|
<img src="images/metrics-chart.svg" alt="" />
|
||
6 years ago
|
</div>
|
||
4 years ago
|
<div className="metametrics-opt-in__title">
|
||
|
{t('metametricsHelpImproveMetaMask')}
|
||
|
</div>
|
||
6 years ago
|
<div className="metametrics-opt-in__body">
|
||
|
<div className="metametrics-opt-in__description">
|
||
4 years ago
|
{t('metametricsOptInDescription')}
|
||
6 years ago
|
</div>
|
||
|
<div className="metametrics-opt-in__description">
|
||
4 years ago
|
{t('metametricsCommitmentsIntro')}
|
||
6 years ago
|
</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">
|
||
4 years ago
|
{t('metametricsCommitmentsAllowOptOut')}
|
||
6 years ago
|
</div>
|
||
|
</div>
|
||
|
<div className="metametrics-opt-in__row">
|
||
|
<i className="fa fa-check" />
|
||
|
<div className="metametrics-opt-in__row-description">
|
||
4 years ago
|
{t('metametricsCommitmentsSendAnonymizedEvents')}
|
||
6 years ago
|
</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">
|
||
4 years ago
|
{t('metametricsCommitmentsNeverCollectKeysEtc', [
|
||
|
<span
|
||
|
className="metametrics-opt-in__bold"
|
||
|
key="neverCollectKeys"
|
||
|
>
|
||
|
{t('metametricsCommitmentsBoldNever')}
|
||
|
</span>,
|
||
|
])}
|
||
6 years ago
|
</div>
|
||
|
</div>
|
||
|
<div className="metametrics-opt-in__row">
|
||
|
<i className="fa fa-times" />
|
||
|
<div className="metametrics-opt-in__row-description">
|
||
4 years ago
|
{t('metametricsCommitmentsNeverCollectIP', [
|
||
|
<span
|
||
|
className="metametrics-opt-in__bold"
|
||
|
key="neverCollectKeys"
|
||
|
>
|
||
|
{t('metametricsCommitmentsBoldNever')}
|
||
|
</span>,
|
||
|
])}
|
||
6 years ago
|
</div>
|
||
|
</div>
|
||
|
<div className="metametrics-opt-in__row">
|
||
|
<i className="fa fa-times" />
|
||
|
<div className="metametrics-opt-in__row-description">
|
||
4 years ago
|
{t('metametricsCommitmentsNeverSellDataForProfit', [
|
||
|
<span
|
||
|
className="metametrics-opt-in__bold"
|
||
|
key="neverCollectKeys"
|
||
|
>
|
||
|
{t('metametricsCommitmentsBoldNever')}
|
||
|
</span>,
|
||
|
])}
|
||
6 years ago
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div className="metametrics-opt-in__footer">
|
||
|
<PageContainerFooter
|
||
4 years ago
|
onCancel={async () => {
|
||
4 years ago
|
await setParticipateInMetaMetrics(false);
|
||
6 years ago
|
|
||
4 years ago
|
try {
|
||
4 years ago
|
if (
|
||
|
participateInMetaMetrics === null ||
|
||
|
participateInMetaMetrics === true
|
||
|
) {
|
||
4 years ago
|
await metricsEvent({
|
||
|
eventOpts: {
|
||
|
category: 'Onboarding',
|
||
|
action: 'Metrics Option',
|
||
|
name: 'Metrics Opt Out',
|
||
|
},
|
||
|
isOptIn: true,
|
||
4 years ago
|
flushImmediately: true,
|
||
4 years ago
|
});
|
||
4 years ago
|
}
|
||
|
} finally {
|
||
4 years ago
|
history.push(nextRoute);
|
||
4 years ago
|
}
|
||
6 years ago
|
}}
|
||
4 years ago
|
cancelText={t('noThanks')}
|
||
6 years ago
|
hideCancel={false}
|
||
4 years ago
|
onSubmit={async () => {
|
||
|
const [, metaMetricsId] = await setParticipateInMetaMetrics(
|
||
|
true,
|
||
4 years ago
|
);
|
||
4 years ago
|
try {
|
||
4 years ago
|
const metrics = [];
|
||
4 years ago
|
if (
|
||
|
participateInMetaMetrics === null ||
|
||
|
participateInMetaMetrics === false
|
||
|
) {
|
||
4 years ago
|
metrics.push(
|
||
|
metricsEvent({
|
||
4 years ago
|
eventOpts: {
|
||
|
category: 'Onboarding',
|
||
4 years ago
|
action: 'Metrics Option',
|
||
|
name: 'Metrics Opt In',
|
||
4 years ago
|
},
|
||
|
isOptIn: true,
|
||
4 years ago
|
flushImmediately: true,
|
||
4 years ago
|
}),
|
||
4 years ago
|
);
|
||
4 years ago
|
}
|
||
|
metrics.push(
|
||
|
metricsEvent({
|
||
|
eventOpts: {
|
||
|
category: 'Onboarding',
|
||
|
action: 'Import or Create',
|
||
|
name: firstTimeSelectionMetaMetricsName,
|
||
|
},
|
||
|
isOptIn: true,
|
||
|
metaMetricsId,
|
||
4 years ago
|
flushImmediately: true,
|
||
4 years ago
|
}),
|
||
4 years ago
|
);
|
||
|
await Promise.all(metrics);
|
||
4 years ago
|
} finally {
|
||
4 years ago
|
history.push(nextRoute);
|
||
4 years ago
|
}
|
||
6 years ago
|
}}
|
||
4 years ago
|
submitText={t('affirmAgree')}
|
||
5 years ago
|
submitButtonType="primary"
|
||
6 years ago
|
disabled={false}
|
||
|
/>
|
||
|
<div className="metametrics-opt-in__bottom-text">
|
||
4 years ago
|
{t('gdprMessage', [
|
||
5 years ago
|
<a
|
||
|
key="metametrics-bottom-text-wrapper"
|
||
|
href="https://metamask.io/privacy.html"
|
||
|
target="_blank"
|
||
|
rel="noopener noreferrer"
|
||
4 years ago
|
>
|
||
|
{t('gdprMessagePrivacyPolicy')}
|
||
|
</a>,
|
||
|
])}
|
||
6 years ago
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
4 years ago
|
);
|
||
6 years ago
|
}
|
||
|
}
|