2021-10-19 19:01:42 +02:00
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
import { useHistory } from 'react-router-dom';
|
|
|
|
import Typography from '../../../components/ui/typography/typography';
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
TypographyVariant,
|
2021-10-19 19:01:42 +02:00
|
|
|
FONT_WEIGHT,
|
|
|
|
TEXT_ALIGN,
|
2023-02-02 21:15:26 +01:00
|
|
|
TextColor,
|
2023-02-23 14:19:28 +01:00
|
|
|
IconColor,
|
2021-10-19 19:01:42 +02:00
|
|
|
} from '../../../helpers/constants/design-system';
|
|
|
|
import Button from '../../../components/ui/button';
|
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
|
|
import { setParticipateInMetaMetrics } from '../../../store/actions';
|
|
|
|
import {
|
|
|
|
getFirstTimeFlowTypeRoute,
|
|
|
|
getFirstTimeFlowType,
|
|
|
|
} from '../../../selectors';
|
|
|
|
|
2022-08-18 23:31:07 +02:00
|
|
|
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
2022-04-22 18:09:10 +02:00
|
|
|
|
2022-04-01 21:11:12 +02:00
|
|
|
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
2023-02-27 17:42:02 +01:00
|
|
|
import {
|
|
|
|
Icon,
|
|
|
|
ICON_NAMES,
|
|
|
|
ICON_SIZES,
|
|
|
|
} from '../../../components/component-library';
|
|
|
|
|
|
|
|
import Box from '../../../components/ui/box/box';
|
2021-10-19 19:01:42 +02:00
|
|
|
|
|
|
|
export default function OnboardingMetametrics() {
|
|
|
|
const t = useI18nContext();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const history = useHistory();
|
|
|
|
|
|
|
|
const nextRoute = useSelector(getFirstTimeFlowTypeRoute);
|
|
|
|
const firstTimeFlowType = useSelector(getFirstTimeFlowType);
|
|
|
|
|
2022-03-29 15:46:24 +02:00
|
|
|
const trackEvent = useContext(MetaMetricsContext);
|
2021-10-19 19:01:42 +02:00
|
|
|
|
|
|
|
const onConfirm = async () => {
|
|
|
|
const [, metaMetricsId] = await dispatch(setParticipateInMetaMetrics(true));
|
|
|
|
try {
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent(
|
|
|
|
{
|
2022-04-22 18:09:10 +02:00
|
|
|
category: EVENT.CATEGORIES.ONBOARDING,
|
2022-08-18 23:31:07 +02:00
|
|
|
event: EVENT_NAMES.WALLET_SETUP_STARTED,
|
2022-03-29 15:46:24 +02:00
|
|
|
properties: {
|
2022-08-18 23:31:07 +02:00
|
|
|
account_type:
|
|
|
|
firstTimeFlowType === 'create'
|
|
|
|
? EVENT.ACCOUNT_TYPES.DEFAULT
|
|
|
|
: EVENT.ACCOUNT_TYPES.IMPORTED,
|
2022-03-29 15:46:24 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
isOptIn: true,
|
|
|
|
metaMetricsId,
|
|
|
|
flushImmediately: true,
|
2021-10-19 19:01:42 +02:00
|
|
|
},
|
2022-03-29 15:46:24 +02:00
|
|
|
);
|
2021-10-19 19:01:42 +02:00
|
|
|
} finally {
|
|
|
|
history.push(nextRoute);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const onCancel = async () => {
|
|
|
|
await dispatch(setParticipateInMetaMetrics(false));
|
2023-02-16 17:06:56 +01:00
|
|
|
history.push(nextRoute);
|
2021-10-19 19:01:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
2022-08-31 01:53:24 +02:00
|
|
|
<div
|
|
|
|
className="onboarding-metametrics"
|
|
|
|
data-testid="onboarding-metametrics"
|
|
|
|
>
|
2021-10-19 19:01:42 +02:00
|
|
|
<Typography
|
2023-02-02 21:15:26 +01:00
|
|
|
variant={TypographyVariant.H2}
|
2021-10-19 19:01:42 +02:00
|
|
|
align={TEXT_ALIGN.CENTER}
|
|
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
|
|
>
|
2022-12-07 19:56:57 +01:00
|
|
|
{t('onboardingMetametricsTitle')}
|
2021-10-19 19:01:42 +02:00
|
|
|
</Typography>
|
2022-05-16 20:38:04 +02:00
|
|
|
<Typography
|
|
|
|
className="onboarding-metametrics__desc"
|
|
|
|
align={TEXT_ALIGN.CENTER}
|
|
|
|
>
|
2022-12-07 19:56:57 +01:00
|
|
|
{t('onboardingMetametricsDescription')}
|
|
|
|
</Typography>
|
|
|
|
<Typography
|
|
|
|
className="onboarding-metametrics__desc"
|
|
|
|
align={TEXT_ALIGN.CENTER}
|
|
|
|
>
|
|
|
|
{t('onboardingMetametricsDescription2')}
|
2021-10-19 19:01:42 +02:00
|
|
|
</Typography>
|
|
|
|
<ul>
|
|
|
|
<li>
|
2023-02-23 14:19:28 +01:00
|
|
|
<Icon
|
|
|
|
name={ICON_NAMES.CHECK}
|
|
|
|
color={IconColor.successDefault}
|
|
|
|
marginInlineEnd={3}
|
|
|
|
/>
|
2022-12-07 19:56:57 +01:00
|
|
|
{t('onboardingMetametricsAllowOptOut')}
|
2021-10-19 19:01:42 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2023-02-23 14:19:28 +01:00
|
|
|
<Icon
|
|
|
|
name={ICON_NAMES.CHECK}
|
|
|
|
color={IconColor.successDefault}
|
|
|
|
marginInlineEnd={3}
|
|
|
|
/>
|
2022-12-07 19:56:57 +01:00
|
|
|
{t('onboardingMetametricsSendAnonymize')}
|
2021-10-19 19:01:42 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2023-02-27 17:42:02 +01:00
|
|
|
<Box>
|
|
|
|
<Icon
|
|
|
|
marginInlineEnd={2}
|
|
|
|
name={ICON_NAMES.CLOSE}
|
|
|
|
size={ICON_SIZES.SM}
|
|
|
|
color={IconColor.errorDefault}
|
|
|
|
/>
|
|
|
|
{t('onboardingMetametricsNeverCollect', [
|
|
|
|
<Typography
|
|
|
|
variant={TypographyVariant.span}
|
|
|
|
key="never"
|
|
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
|
|
marginTop={0}
|
|
|
|
>
|
|
|
|
{t('onboardingMetametricsNeverEmphasis')}
|
|
|
|
</Typography>,
|
|
|
|
])}
|
|
|
|
</Box>
|
2021-10-19 19:01:42 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2023-02-27 17:42:02 +01:00
|
|
|
<Box>
|
|
|
|
<Icon
|
|
|
|
marginInlineEnd={2}
|
|
|
|
name={ICON_NAMES.CLOSE}
|
|
|
|
size={ICON_SIZES.SM}
|
|
|
|
color={IconColor.errorDefault}
|
|
|
|
/>
|
|
|
|
{t('onboardingMetametricsNeverCollectIP', [
|
|
|
|
<Typography
|
|
|
|
variant={TypographyVariant.span}
|
|
|
|
key="never-collect"
|
|
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
|
|
>
|
|
|
|
{t('onboardingMetametricsNeverEmphasis')}
|
|
|
|
</Typography>,
|
|
|
|
])}
|
|
|
|
</Box>
|
2021-10-19 19:01:42 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2023-02-27 17:42:02 +01:00
|
|
|
<Box>
|
|
|
|
<Icon
|
|
|
|
marginInlineEnd={2}
|
|
|
|
name={ICON_NAMES.CLOSE}
|
|
|
|
size={ICON_SIZES.SM}
|
|
|
|
color={IconColor.errorDefault}
|
|
|
|
/>
|
|
|
|
{t('onboardingMetametricsNeverSellData', [
|
|
|
|
<Typography
|
|
|
|
variant={TypographyVariant.span}
|
|
|
|
key="never-sell"
|
|
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
|
|
>
|
|
|
|
{t('onboardingMetametricsNeverEmphasis')}
|
|
|
|
</Typography>,
|
|
|
|
])}
|
|
|
|
</Box>{' '}
|
2021-10-19 19:01:42 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<Typography
|
2023-02-02 21:15:26 +01:00
|
|
|
color={TextColor.textAlternative}
|
2021-10-19 19:01:42 +02:00
|
|
|
align={TEXT_ALIGN.CENTER}
|
2023-02-02 21:15:26 +01:00
|
|
|
variant={TypographyVariant.H6}
|
2021-10-19 19:01:42 +02:00
|
|
|
className="onboarding-metametrics__terms"
|
|
|
|
>
|
2022-12-07 19:56:57 +01:00
|
|
|
{t('onboardingMetametricsDataTerms')}
|
|
|
|
</Typography>
|
|
|
|
<Typography
|
2023-02-02 21:15:26 +01:00
|
|
|
color={TextColor.textAlternative}
|
2022-12-07 19:56:57 +01:00
|
|
|
align={TEXT_ALIGN.CENTER}
|
2023-02-02 21:15:26 +01:00
|
|
|
variant={TypographyVariant.H6}
|
2022-12-07 19:56:57 +01:00
|
|
|
className="onboarding-metametrics__terms"
|
|
|
|
>
|
|
|
|
{t('onboardingMetametricsInfuraTerms', [
|
|
|
|
<a
|
|
|
|
href="https://consensys.net/blog/news/consensys-data-retention-update/"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
key="retention-link"
|
|
|
|
>
|
|
|
|
{t('onboardingMetametricsInfuraTermsPolicyLink')}
|
|
|
|
</a>,
|
2021-10-19 19:01:42 +02:00
|
|
|
<a
|
|
|
|
href="https://metamask.io/privacy.html"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
2022-12-07 19:56:57 +01:00
|
|
|
key="privacy-link"
|
2021-10-19 19:01:42 +02:00
|
|
|
>
|
2022-12-07 19:56:57 +01:00
|
|
|
{t('onboardingMetametricsInfuraTermsPolicy')}
|
2021-10-19 19:01:42 +02:00
|
|
|
</a>,
|
|
|
|
])}
|
|
|
|
</Typography>
|
2022-12-07 19:56:57 +01:00
|
|
|
|
2021-10-19 19:01:42 +02:00
|
|
|
<div className="onboarding-metametrics__buttons">
|
2021-11-10 18:27:10 +01:00
|
|
|
<Button
|
|
|
|
data-testid="metametrics-i-agree"
|
|
|
|
type="primary"
|
2022-12-07 19:56:57 +01:00
|
|
|
large
|
2021-11-10 18:27:10 +01:00
|
|
|
onClick={onConfirm}
|
|
|
|
>
|
2022-12-07 19:56:57 +01:00
|
|
|
{t('onboardingMetametricsAgree')}
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
data-testid="metametrics-no-thanks"
|
|
|
|
type="secondary"
|
|
|
|
large
|
|
|
|
onClick={onCancel}
|
|
|
|
>
|
|
|
|
{t('onboardingMetametricsDisagree')}
|
2021-10-19 19:01:42 +02:00
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|