@ -101,11 +101,12 @@ export default class MetaMetricsOptIn extends Component {
< / d i v >
< / d i v >
< div className = "metametrics-opt-in__footer" >
< div className = "metametrics-opt-in__footer" >
< PageContainerFooter
< PageContainerFooter
onCancel = { ( ) => {
onCancel = { async ( ) => {
setParticipateInMetaMetrics ( false ) . then ( ( ) => {
await setParticipateInMetaMetrics ( false )
const promise =
participateInMetaMetrics === true
try {
? metricsEvent ( {
if ( participateInMetaMetrics === true ) {
await metricsEvent ( {
eventOpts : {
eventOpts : {
category : 'Onboarding' ,
category : 'Onboarding' ,
action : 'Metrics Option' ,
action : 'Metrics Option' ,
@ -113,32 +114,33 @@ export default class MetaMetricsOptIn extends Component {
} ,
} ,
isOptIn : true ,
isOptIn : true ,
} )
} )
: Promise . resolve ( )
}
} finally {
promise . then ( ( ) => {
history . push ( nextRoute )
history . push ( nextRoute )
} )
}
} )
} }
} }
cancelText = { t ( 'noThanks' ) }
cancelText = { t ( 'noThanks' ) }
hideCancel = { false }
hideCancel = { false }
onSubmit = { ( ) => {
onSubmit = { async ( ) => {
setParticipateInMetaMetrics ( true ) . then ( ( [ _ , metaMetricsId ] ) => {
const [ , metaMetricsId ] = await setParticipateInMetaMetrics (
const promise =
true ,
participateInMetaMetrics === false
)
? metricsEvent ( {
try {
const metrics = [ ]
if ( participateInMetaMetrics === false ) {
metrics . push (
metricsEvent ( {
eventOpts : {
eventOpts : {
category : 'Onboarding' ,
category : 'Onboarding' ,
action : 'Metrics Option' ,
action : 'Metrics Option' ,
name : 'Metrics Opt In' ,
name : 'Metrics Opt In' ,
} ,
} ,
isOptIn : true ,
isOptIn : true ,
} )
} ) ,
: Promise . resolve ( )
)
}
promise
metrics . push (
. then ( ( ) => {
metricsEvent ( {
return metricsEvent ( {
eventOpts : {
eventOpts : {
category : 'Onboarding' ,
category : 'Onboarding' ,
action : 'Import or Create' ,
action : 'Import or Create' ,
@ -146,12 +148,12 @@ export default class MetaMetricsOptIn extends Component {
} ,
} ,
isOptIn : true ,
isOptIn : true ,
metaMetricsId ,
metaMetricsId ,
} )
} ) ,
} )
)
. then ( ( ) => {
await Promise . all ( metrics )
} finally {
history . push ( nextRoute )
history . push ( nextRoute )
} )
}
} )
} }
} }
submitText = { t ( 'affirmAgree' ) }
submitText = { t ( 'affirmAgree' ) }
submitButtonType = "primary"
submitButtonType = "primary"