@ -101,57 +101,59 @@ 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
? metricsEvent ( {
eventOpts : {
category : 'Onboarding' ,
action : 'Metrics Option' ,
name : 'Metrics Opt Out' ,
} ,
isOptIn : true ,
} )
: Promise . resolve ( )
promise . then ( ( ) => {
try {
history . push ( nextRoute )
if ( participateInMetaMetrics === true ) {
} )
await metricsEvent ( {
} )
eventOpts : {
category : 'Onboarding' ,
action : 'Metrics Option' ,
name : 'Metrics Opt Out' ,
} ,
isOptIn : true ,
} )
}
} finally {
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 {
eventOpts : {
const metrics = [ ]
category : 'Onboarding' ,
if ( participateInMetaMetrics === false ) {
action : 'Metrics Option' ,
metrics . push (
name : 'Metrics Opt In' ,
metricsEvent ( {
} ,
isOptIn : true ,
} )
: Promise . resolve ( )
promise
. then ( ( ) => {
return metricsEvent ( {
eventOpts : {
eventOpts : {
category : 'Onboarding' ,
category : 'Onboarding' ,
action : 'Import or Create ' ,
action : 'Metrics Option' ,
name : firstTimeSelectionMetaMetricsName ,
name : 'Metrics Opt In' ,
} ,
} ,
isOptIn : true ,
isOptIn : true ,
metaMetricsId ,
} ) ,
} )
)
} )
}
. then ( ( ) => {
metrics . push (
history . push ( nextRoute )
metricsEvent ( {
} )
eventOpts : {
} )
category : 'Onboarding' ,
action : 'Import or Create' ,
name : firstTimeSelectionMetaMetricsName ,
} ,
isOptIn : true ,
metaMetricsId ,
} ) ,
)
await Promise . all ( metrics )
} finally {
history . push ( nextRoute )
}
} }
} }
submitText = { t ( 'affirmAgree' ) }
submitText = { t ( 'affirmAgree' ) }
submitButtonType = "primary"
submitButtonType = "primary"