mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix onboarding events (#15608)
This commit is contained in:
parent
f15d8e2f9b
commit
1c9764a6a2
@ -329,19 +329,21 @@ export default class MetaMetricsController {
|
|||||||
// It sets an uninstall URL ("Sorry to see you go!" page),
|
// It sets an uninstall URL ("Sorry to see you go!" page),
|
||||||
// which is opened if a user uninstalls the extension.
|
// which is opened if a user uninstalls the extension.
|
||||||
updateExtensionUninstallUrl(participateInMetaMetrics, metaMetricsId) {
|
updateExtensionUninstallUrl(participateInMetaMetrics, metaMetricsId) {
|
||||||
// TODO: Change it to the right URL once it's available.
|
|
||||||
|
|
||||||
const query = {};
|
const query = {};
|
||||||
if (participateInMetaMetrics) {
|
if (participateInMetaMetrics) {
|
||||||
// We only want to track these things if a user opted into metrics.
|
// We only want to track these things if a user opted into metrics.
|
||||||
query.id = metaMetricsId;
|
query.mmi = Buffer.from(metaMetricsId).toString('base64');
|
||||||
query.env = this.environment;
|
query.env = this.environment;
|
||||||
query.av = this.version;
|
query.av = this.version;
|
||||||
}
|
}
|
||||||
const queryString = new URLSearchParams(query);
|
const queryString = new URLSearchParams(query);
|
||||||
this.extension.runtime.setUninstallURL(
|
|
||||||
`${EXTENSION_UNINSTALL_URL}?${queryString}`,
|
// this.extension not currently defined in tests
|
||||||
);
|
if (this.extension && this.extension.runtime) {
|
||||||
|
this.extension.runtime.setUninstallURL(
|
||||||
|
`${EXTENSION_UNINSTALL_URL}?${queryString}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -364,8 +366,8 @@ export default class MetaMetricsController {
|
|||||||
this.trackEventsAfterMetricsOptIn();
|
this.trackEventsAfterMetricsOptIn();
|
||||||
this.clearEventsAfterMetricsOptIn();
|
this.clearEventsAfterMetricsOptIn();
|
||||||
}
|
}
|
||||||
// TODO: Uncomment the line below once we have a "Sorry to see you go" page ready.
|
|
||||||
// this.updateExtensionUninstallUrl(participateInMetaMetrics, metaMetricsId);
|
this.updateExtensionUninstallUrl(participateInMetaMetrics, metaMetricsId);
|
||||||
return metaMetricsId;
|
return metaMetricsId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ export const EVENT_NAMES = {
|
|||||||
ACCOUNT_ADDED: 'Account Added',
|
ACCOUNT_ADDED: 'Account Added',
|
||||||
ACCOUNT_ADD_SELECTED: 'Account Add Selected',
|
ACCOUNT_ADD_SELECTED: 'Account Add Selected',
|
||||||
ACCOUNT_ADD_FAILED: 'Account Add Failed',
|
ACCOUNT_ADD_FAILED: 'Account Add Failed',
|
||||||
ACCOUNT_PASSWORD_CREATED: 'Account Password Created',
|
ACCOUNT_PASSWORD_CREATED: 'Wallet Password Created',
|
||||||
ACCOUNT_RESET: 'Account Reset',
|
ACCOUNT_RESET: 'Account Reset',
|
||||||
APP_INSTALLED: 'App Installed',
|
APP_INSTALLED: 'App Installed',
|
||||||
APP_UNLOCKED: 'App Unlocked',
|
APP_UNLOCKED: 'App Unlocked',
|
||||||
@ -300,6 +300,8 @@ export const EVENT_NAMES = {
|
|||||||
KEY_EXPORT_CANCELED: 'Key Export Canceled',
|
KEY_EXPORT_CANCELED: 'Key Export Canceled',
|
||||||
KEY_EXPORT_REVEALED: 'Key Material Revealed',
|
KEY_EXPORT_REVEALED: 'Key Material Revealed',
|
||||||
KEY_EXPORT_COPIED: 'Key Material Copied',
|
KEY_EXPORT_COPIED: 'Key Material Copied',
|
||||||
|
METRICS_OPT_IN: 'Metrics Opt In',
|
||||||
|
METRICS_OPT_OUT: 'Metrics Opt Out',
|
||||||
NAV_ACCOUNT_MENU_OPENED: 'Account Menu Opened',
|
NAV_ACCOUNT_MENU_OPENED: 'Account Menu Opened',
|
||||||
NAV_ACCOUNT_DETAILS_OPENED: 'Account Details Opened',
|
NAV_ACCOUNT_DETAILS_OPENED: 'Account Details Opened',
|
||||||
NAV_CONNECTED_SITES_OPENED: 'Connected Sites Opened',
|
NAV_CONNECTED_SITES_OPENED: 'Connected Sites Opened',
|
||||||
@ -311,8 +313,11 @@ export const EVENT_NAMES = {
|
|||||||
NAV_BUY_BUTTON_CLICKED: 'Buy Button Clicked',
|
NAV_BUY_BUTTON_CLICKED: 'Buy Button Clicked',
|
||||||
NAV_SEND_BUTTON_CLICKED: 'Send Button Clicked',
|
NAV_SEND_BUTTON_CLICKED: 'Send Button Clicked',
|
||||||
NAV_SWAP_BUTTON_CLICKED: 'Swap Button Clicked',
|
NAV_SWAP_BUTTON_CLICKED: 'Swap Button Clicked',
|
||||||
NEW_WALLET_CREATED: 'New Wallet Created',
|
SRP_TO_CONFIRM_BACKUP: 'SRP Backup Confirm Displayed',
|
||||||
NEW_WALLET_IMPORTED: 'New Wallet Imported',
|
WALLET_SETUP_STARTED: 'Wallet Setup Selected',
|
||||||
|
WALLET_SETUP_CANCELED: 'Wallet Setup Canceled',
|
||||||
|
WALLET_SETUP_FAILED: 'Wallet Setup Failed',
|
||||||
|
WALLET_CREATED: 'Wallet Created',
|
||||||
NFT_ADDED: 'NFT Added',
|
NFT_ADDED: 'NFT Added',
|
||||||
ONRAMP_PROVIDER_SELECTED: 'On-ramp Provider Selected',
|
ONRAMP_PROVIDER_SELECTED: 'On-ramp Provider Selected',
|
||||||
PERMISSIONS_APPROVED: 'Permissions Approved',
|
PERMISSIONS_APPROVED: 'Permissions Approved',
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import React, { useCallback, useContext, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
|
||||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
|
||||||
import TextField from '../../ui/text-field';
|
import TextField from '../../ui/text-field';
|
||||||
import Button from '../../ui/button';
|
import Button from '../../ui/button';
|
||||||
import CheckBox from '../../ui/check-box';
|
import CheckBox from '../../ui/check-box';
|
||||||
@ -23,7 +21,6 @@ export default function CreateNewVault({
|
|||||||
const [termsChecked, setTermsChecked] = useState(false);
|
const [termsChecked, setTermsChecked] = useState(false);
|
||||||
|
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const trackEvent = useContext(MetaMetricsContext);
|
|
||||||
|
|
||||||
const onPasswordChange = useCallback(
|
const onPasswordChange = useCallback(
|
||||||
(newPassword) => {
|
(newPassword) => {
|
||||||
@ -83,17 +80,8 @@ export default function CreateNewVault({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const toggleTermsCheck = useCallback(() => {
|
const toggleTermsCheck = useCallback(() => {
|
||||||
trackEvent({
|
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
|
||||||
event: 'Check ToS',
|
|
||||||
properties: {
|
|
||||||
action: 'Import Seed Phrase',
|
|
||||||
legacy_event: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
setTermsChecked((currentTermsChecked) => !currentTermsChecked);
|
setTermsChecked((currentTermsChecked) => !currentTermsChecked);
|
||||||
}, [trackEvent]);
|
}, []);
|
||||||
|
|
||||||
const termsOfUse = t('acceptTermsOfUse', [
|
const termsOfUse = t('acceptTermsOfUse', [
|
||||||
<a
|
<a
|
||||||
|
@ -3,7 +3,10 @@ import PropTypes from 'prop-types';
|
|||||||
|
|
||||||
import MetaFoxLogo from '../../../ui/metafox-logo';
|
import MetaFoxLogo from '../../../ui/metafox-logo';
|
||||||
import PageContainerFooter from '../../../ui/page-container/page-container-footer';
|
import PageContainerFooter from '../../../ui/page-container/page-container-footer';
|
||||||
import { EVENT } from '../../../../../shared/constants/metametrics';
|
import {
|
||||||
|
EVENT,
|
||||||
|
EVENT_NAMES,
|
||||||
|
} from '../../../../../shared/constants/metametrics';
|
||||||
|
|
||||||
export default class MetaMetricsOptInModal extends Component {
|
export default class MetaMetricsOptInModal extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@ -113,7 +116,7 @@ export default class MetaMetricsOptInModal extends Component {
|
|||||||
trackEvent(
|
trackEvent(
|
||||||
{
|
{
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Metrics Opt Out',
|
event: EVENT_NAMES.METRICS_OPT_OUT,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Metrics Option',
|
action: 'Metrics Option',
|
||||||
legacy_event: true,
|
legacy_event: true,
|
||||||
@ -134,7 +137,7 @@ export default class MetaMetricsOptInModal extends Component {
|
|||||||
trackEvent(
|
trackEvent(
|
||||||
{
|
{
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Metrics Opt In',
|
event: EVENT_NAMES.METRICS_OPT_IN,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Metrics Option',
|
action: 'Metrics Option',
|
||||||
legacy_event: true,
|
legacy_event: true,
|
||||||
|
@ -5,7 +5,10 @@ import {
|
|||||||
INITIALIZE_END_OF_FLOW_ROUTE,
|
INITIALIZE_END_OF_FLOW_ROUTE,
|
||||||
} from '../../../../helpers/constants/routes';
|
} from '../../../../helpers/constants/routes';
|
||||||
import CreateNewVault from '../../../../components/app/create-new-vault';
|
import CreateNewVault from '../../../../components/app/create-new-vault';
|
||||||
import { EVENT } from '../../../../../shared/constants/metametrics';
|
import {
|
||||||
|
EVENT,
|
||||||
|
EVENT_NAMES,
|
||||||
|
} from '../../../../../shared/constants/metametrics';
|
||||||
|
|
||||||
export default class ImportWithSeedPhrase extends PureComponent {
|
export default class ImportWithSeedPhrase extends PureComponent {
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
@ -24,12 +27,12 @@ export default class ImportWithSeedPhrase extends PureComponent {
|
|||||||
this._onBeforeUnload = () =>
|
this._onBeforeUnload = () =>
|
||||||
this.context.trackEvent({
|
this.context.trackEvent({
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Close window on import screen',
|
event: EVENT_NAMES.WALLET_SETUP_FAILED,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Import Seed Phrase',
|
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||||
legacy_event: true,
|
account_import_type: EVENT.ACCOUNT_IMPORT_TYPES.SRP,
|
||||||
errorLabel: 'Seed Phrase Error',
|
reason: 'Seed Phrase Error',
|
||||||
errorMessage: this.state.seedPhraseError,
|
error: this.state.seedPhraseError,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
window.addEventListener('beforeunload', this._onBeforeUnload);
|
window.addEventListener('beforeunload', this._onBeforeUnload);
|
||||||
@ -46,10 +49,10 @@ export default class ImportWithSeedPhrase extends PureComponent {
|
|||||||
await onSubmit(password, seedPhrase);
|
await onSubmit(password, seedPhrase);
|
||||||
this.context.trackEvent({
|
this.context.trackEvent({
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Import Complete',
|
event: EVENT_NAMES.WALLET_CREATED,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Import Seed Phrase',
|
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||||
legacy_event: true,
|
account_import_type: EVENT.ACCOUNT_IMPORT_TYPES.SRP,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -69,10 +72,11 @@ export default class ImportWithSeedPhrase extends PureComponent {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.context.trackEvent({
|
this.context.trackEvent({
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Go Back from Onboarding Import',
|
event: EVENT_NAMES.WALLET_SETUP_CANCELED,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Import Seed Phrase',
|
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||||
legacy_event: true,
|
account_import_type: EVENT.ACCOUNT_IMPORT_TYPES.SRP,
|
||||||
|
text: 'Back',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.props.history.push(INITIALIZE_SELECT_ACTION_ROUTE);
|
this.props.history.push(INITIALIZE_SELECT_ACTION_ROUTE);
|
||||||
|
@ -20,7 +20,6 @@ export default class EndOfFlowScreen extends PureComponent {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
completionMetaMetricsName: PropTypes.string,
|
|
||||||
setCompletedOnboarding: PropTypes.func,
|
setCompletedOnboarding: PropTypes.func,
|
||||||
onboardingInitiator: PropTypes.exact({
|
onboardingInitiator: PropTypes.exact({
|
||||||
location: PropTypes.string,
|
location: PropTypes.string,
|
||||||
@ -37,16 +36,8 @@ export default class EndOfFlowScreen extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _onOnboardingComplete() {
|
async _onOnboardingComplete() {
|
||||||
const { setCompletedOnboarding, completionMetaMetricsName } = this.props;
|
const { setCompletedOnboarding } = this.props;
|
||||||
await setCompletedOnboarding();
|
await setCompletedOnboarding();
|
||||||
this.context.trackEvent({
|
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
|
||||||
event: completionMetaMetricsName,
|
|
||||||
properties: {
|
|
||||||
action: 'Onboarding Complete',
|
|
||||||
legacy_event: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete = async () => {
|
onComplete = async () => {
|
||||||
|
@ -2,21 +2,10 @@ import { connect } from 'react-redux';
|
|||||||
|
|
||||||
import { getOnboardingInitiator } from '../../../selectors';
|
import { getOnboardingInitiator } from '../../../selectors';
|
||||||
import { setCompletedOnboarding } from '../../../store/actions';
|
import { setCompletedOnboarding } from '../../../store/actions';
|
||||||
import { EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
|
||||||
import EndOfFlow from './end-of-flow.component';
|
import EndOfFlow from './end-of-flow.component';
|
||||||
|
|
||||||
const firstTimeFlowTypeNameMap = {
|
|
||||||
create: EVENT_NAMES.NEW_WALLET_CREATED,
|
|
||||||
import: EVENT_NAMES.NEW_WALLET_IMPORTED,
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
const {
|
|
||||||
metamask: { firstTimeFlowType },
|
|
||||||
} = state;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
completionMetaMetricsName: firstTimeFlowTypeNameMap[firstTimeFlowType],
|
|
||||||
onboardingInitiator: getOnboardingInitiator(state),
|
onboardingInitiator: getOnboardingInitiator(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ import React, { Component } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import MetaFoxLogo from '../../../components/ui/metafox-logo';
|
import MetaFoxLogo from '../../../components/ui/metafox-logo';
|
||||||
import PageContainerFooter from '../../../components/ui/page-container/page-container-footer';
|
import PageContainerFooter from '../../../components/ui/page-container/page-container-footer';
|
||||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||||
import { INITIALIZE_SELECT_ACTION_ROUTE } from '../../../helpers/constants/routes';
|
import { INITIALIZE_SELECT_ACTION_ROUTE } from '../../../helpers/constants/routes';
|
||||||
|
|
||||||
export default class MetaMetricsOptIn extends Component {
|
export default class MetaMetricsOptIn extends Component {
|
||||||
@ -113,7 +113,7 @@ export default class MetaMetricsOptIn extends Component {
|
|||||||
await trackEvent(
|
await trackEvent(
|
||||||
{
|
{
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Metrics Opt In',
|
event: EVENT_NAMES.METRICS_OPT_IN,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Metrics Option',
|
action: 'Metrics Option',
|
||||||
legacy_event: true,
|
legacy_event: true,
|
||||||
|
@ -168,10 +168,10 @@ describe('ConfirmSeedPhrase Component', () => {
|
|||||||
|
|
||||||
expect(trackEventSpy.args[0][0]).toStrictEqual({
|
expect(trackEventSpy.args[0][0]).toStrictEqual({
|
||||||
category: 'Onboarding',
|
category: 'Onboarding',
|
||||||
event: 'Verify Complete',
|
event: 'Wallet Created',
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Seed Phrase Setup',
|
account_type: 'metamask',
|
||||||
legacy_event: true,
|
is_backup_skipped: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(initialize3BoxSpy.calledOnce).toStrictEqual(true);
|
expect(initialize3BoxSpy.calledOnce).toStrictEqual(true);
|
||||||
|
@ -6,7 +6,10 @@ import {
|
|||||||
INITIALIZE_END_OF_FLOW_ROUTE,
|
INITIALIZE_END_OF_FLOW_ROUTE,
|
||||||
INITIALIZE_SEED_PHRASE_ROUTE,
|
INITIALIZE_SEED_PHRASE_ROUTE,
|
||||||
} from '../../../../helpers/constants/routes';
|
} from '../../../../helpers/constants/routes';
|
||||||
import { EVENT } from '../../../../../shared/constants/metametrics';
|
import {
|
||||||
|
EVENT,
|
||||||
|
EVENT_NAMES,
|
||||||
|
} from '../../../../../shared/constants/metametrics';
|
||||||
import { exportAsFile } from '../../../../../shared/modules/export-utils';
|
import { exportAsFile } from '../../../../../shared/modules/export-utils';
|
||||||
import DraggableSeed from './draggable-seed.component';
|
import DraggableSeed from './draggable-seed.component';
|
||||||
|
|
||||||
@ -78,21 +81,31 @@ export default class ConfirmSeedPhrase extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.context.trackEvent({
|
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
|
||||||
event: 'Verify Complete',
|
|
||||||
properties: {
|
|
||||||
action: 'Seed Phrase Setup',
|
|
||||||
legacy_event: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
setSeedPhraseBackedUp(true).then(async () => {
|
setSeedPhraseBackedUp(true).then(async () => {
|
||||||
|
this.context.trackEvent({
|
||||||
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
|
event: EVENT_NAMES.WALLET_CREATED,
|
||||||
|
properties: {
|
||||||
|
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||||
|
is_backup_skipped: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
initializeThreeBox();
|
initializeThreeBox();
|
||||||
history.replace(INITIALIZE_END_OF_FLOW_ROUTE);
|
history.replace(INITIALIZE_END_OF_FLOW_ROUTE);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
|
this.context.trackEvent({
|
||||||
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
|
event: EVENT_NAMES.WALLET_SETUP_FAILED,
|
||||||
|
properties: {
|
||||||
|
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||||
|
is_backup_skipped: false,
|
||||||
|
reason: 'Seed Phrase Creation Error',
|
||||||
|
error: error.message,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,11 +48,8 @@ export default class RevealSeedPhrase extends PureComponent {
|
|||||||
|
|
||||||
this.context.trackEvent({
|
this.context.trackEvent({
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Advance to Verify',
|
event: EVENT_NAMES.SRP_TO_CONFIRM_BACKUP,
|
||||||
properties: {
|
properties: {},
|
||||||
action: 'Seed Phrase Setup',
|
|
||||||
legacy_event: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!isShowingSeedPhrase) {
|
if (!isShowingSeedPhrase) {
|
||||||
@ -70,25 +67,30 @@ export default class RevealSeedPhrase extends PureComponent {
|
|||||||
onboardingInitiator,
|
onboardingInitiator,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
this.context.trackEvent({
|
await Promise.all([setCompletedOnboarding(), setSeedPhraseBackedUp(false)])
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
.then(() => {
|
||||||
event: 'Remind me later',
|
this.context.trackEvent({
|
||||||
properties: {
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
action: 'Seed Phrase Setup',
|
event: EVENT_NAMES.WALLET_CREATED,
|
||||||
legacy_event: true,
|
properties: {
|
||||||
},
|
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||||
});
|
is_backup_skipped: true,
|
||||||
|
},
|
||||||
await Promise.all([setCompletedOnboarding(), setSeedPhraseBackedUp(false)]);
|
});
|
||||||
|
})
|
||||||
this.context.trackEvent({
|
.catch((error) => {
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
console.error(error.message);
|
||||||
event: EVENT_NAMES.NEW_WALLET_CREATED,
|
this.context.trackEvent({
|
||||||
properties: {
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
action: 'Onboarding Complete',
|
event: EVENT_NAMES.WALLET_SETUP_FAILED,
|
||||||
legacy_event: true,
|
properties: {
|
||||||
},
|
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||||
});
|
is_backup_skipped: true,
|
||||||
|
reason: 'Seed Phrase Creation Error',
|
||||||
|
error: error.message,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if (onboardingInitiator) {
|
if (onboardingInitiator) {
|
||||||
await returnToOnboardingInitiatorTab(onboardingInitiator);
|
await returnToOnboardingInitiatorTab(onboardingInitiator);
|
||||||
@ -119,11 +121,8 @@ export default class RevealSeedPhrase extends PureComponent {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.context.trackEvent({
|
this.context.trackEvent({
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Revealed Words',
|
event: EVENT_NAMES.KEY_EXPORT_REVEALED,
|
||||||
properties: {
|
properties: {},
|
||||||
action: 'Seed Phrase Setup',
|
|
||||||
legacy_event: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
this.setState({ isShowingSeedPhrase: true });
|
this.setState({ isShowingSeedPhrase: true });
|
||||||
}}
|
}}
|
||||||
|
@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Button from '../../../components/ui/button';
|
import Button from '../../../components/ui/button';
|
||||||
import MetaFoxLogo from '../../../components/ui/metafox-logo';
|
import MetaFoxLogo from '../../../components/ui/metafox-logo';
|
||||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||||
import {
|
import {
|
||||||
INITIALIZE_CREATE_PASSWORD_ROUTE,
|
INITIALIZE_CREATE_PASSWORD_ROUTE,
|
||||||
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
|
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
|
||||||
@ -37,10 +37,9 @@ export default class SelectAction extends PureComponent {
|
|||||||
trackEvent(
|
trackEvent(
|
||||||
{
|
{
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Selected Create New Wallet',
|
event: EVENT_NAMES.WALLET_SETUP_STARTED,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Import or Create',
|
account_type: EVENT.ACCOUNT_TYPES.DEFAULT,
|
||||||
legacy_event: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -59,10 +58,9 @@ export default class SelectAction extends PureComponent {
|
|||||||
trackEvent(
|
trackEvent(
|
||||||
{
|
{
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Selected Import Wallet',
|
event: EVENT_NAMES.WALLET_SETUP_STARTED,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Import or Create',
|
account_type: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||||
legacy_event: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useContext } from 'react';
|
import React from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
import Box from '../../../components/ui/box';
|
import Box from '../../../components/ui/box';
|
||||||
import Typography from '../../../components/ui/typography';
|
import Typography from '../../../components/ui/typography';
|
||||||
@ -17,32 +17,14 @@ import {
|
|||||||
ONBOARDING_PRIVACY_SETTINGS_ROUTE,
|
ONBOARDING_PRIVACY_SETTINGS_ROUTE,
|
||||||
} from '../../../helpers/constants/routes';
|
} from '../../../helpers/constants/routes';
|
||||||
import { setCompletedOnboarding } from '../../../store/actions';
|
import { setCompletedOnboarding } from '../../../store/actions';
|
||||||
import { getFirstTimeFlowType } from '../../../selectors';
|
|
||||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
|
||||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
|
||||||
|
|
||||||
export default function CreationSuccessful() {
|
export default function CreationSuccessful() {
|
||||||
const firstTimeFlowTypeNameMap = {
|
|
||||||
create: EVENT_NAMES.NEW_WALLET_CREATED,
|
|
||||||
import: EVENT_NAMES.NEW_WALLET_IMPORTED,
|
|
||||||
};
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const firstTimeFlowType = useSelector(getFirstTimeFlowType);
|
|
||||||
|
|
||||||
const trackEvent = useContext(MetaMetricsContext);
|
|
||||||
|
|
||||||
const onComplete = async () => {
|
const onComplete = async () => {
|
||||||
await dispatch(setCompletedOnboarding());
|
await dispatch(setCompletedOnboarding());
|
||||||
trackEvent({
|
|
||||||
event: firstTimeFlowTypeNameMap[firstTimeFlowType],
|
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
|
||||||
properties: {
|
|
||||||
action: 'Onboarding Complete',
|
|
||||||
legacy_event: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
history.push(ONBOARDING_PIN_EXTENSION_ROUTE);
|
history.push(ONBOARDING_PIN_EXTENSION_ROUTE);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
@ -17,15 +17,10 @@ import {
|
|||||||
getParticipateInMetaMetrics,
|
getParticipateInMetaMetrics,
|
||||||
} from '../../../selectors';
|
} from '../../../selectors';
|
||||||
|
|
||||||
import { EVENT } from '../../../../shared/constants/metametrics';
|
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||||
|
|
||||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||||
|
|
||||||
const firstTimeFlowTypeNameMap = {
|
|
||||||
create: 'Selected Create New Wallet',
|
|
||||||
import: 'Selected Import Wallet',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function OnboardingMetametrics() {
|
export default function OnboardingMetametrics() {
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -35,8 +30,6 @@ export default function OnboardingMetametrics() {
|
|||||||
const firstTimeFlowType = useSelector(getFirstTimeFlowType);
|
const firstTimeFlowType = useSelector(getFirstTimeFlowType);
|
||||||
|
|
||||||
const participateInMetaMetrics = useSelector(getParticipateInMetaMetrics);
|
const participateInMetaMetrics = useSelector(getParticipateInMetaMetrics);
|
||||||
const firstTimeSelectionMetaMetricsName =
|
|
||||||
firstTimeFlowTypeNameMap[firstTimeFlowType];
|
|
||||||
|
|
||||||
const trackEvent = useContext(MetaMetricsContext);
|
const trackEvent = useContext(MetaMetricsContext);
|
||||||
|
|
||||||
@ -50,7 +43,7 @@ export default function OnboardingMetametrics() {
|
|||||||
trackEvent(
|
trackEvent(
|
||||||
{
|
{
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Metrics Opt In',
|
event: EVENT_NAMES.METRICS_OPT_IN,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Metrics Option',
|
action: 'Metrics Option',
|
||||||
legacy_event: true,
|
legacy_event: true,
|
||||||
@ -65,10 +58,12 @@ export default function OnboardingMetametrics() {
|
|||||||
trackEvent(
|
trackEvent(
|
||||||
{
|
{
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: firstTimeSelectionMetaMetricsName,
|
event: EVENT_NAMES.WALLET_SETUP_STARTED,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Import or Create',
|
account_type:
|
||||||
legacy_event: true,
|
firstTimeFlowType === 'create'
|
||||||
|
? EVENT.ACCOUNT_TYPES.DEFAULT
|
||||||
|
: EVENT.ACCOUNT_TYPES.IMPORTED,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -93,7 +88,7 @@ export default function OnboardingMetametrics() {
|
|||||||
trackEvent(
|
trackEvent(
|
||||||
{
|
{
|
||||||
category: EVENT.CATEGORIES.ONBOARDING,
|
category: EVENT.CATEGORIES.ONBOARDING,
|
||||||
event: 'Metrics Opt Out',
|
event: EVENT_NAMES.METRICS_OPT_OUT,
|
||||||
properties: {
|
properties: {
|
||||||
action: 'Metrics Option',
|
action: 'Metrics Option',
|
||||||
legacy_event: true,
|
legacy_event: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user