Skip to content

Commit

Permalink
feat(analytics): add reset account events to middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoB committed Aug 28, 2021
1 parent 537a018 commit 031d215
Showing 1 changed file with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3044,6 +3044,77 @@ const analyticsMiddleware = () => (store) => (next) => (action) => {
})
break
}
// TODO STILL NEED TO FIGURE OUT SPECIFICS FOR THIS EVENT
case AT.auth.RESTORE: {
const state = store.getState()
const nabuId = state.profile.userData.getOrElse({})?.id ?? null
const email = state.profile.userData.getOrElse({})?.emailVerified
? state.profile.userData.getOrElse({})?.email
: null
const tier = state.profile.userData.getOrElse({})?.tiers?.current ?? null
const guid = state.walletPath.wallet.guid ?? null

analytics.push(AnalyticsKey.RECOVERY_PHRASE_ENTERED, {
properties: {
guid,
originalTimestamp: getOriginalTimestamp()
},
traits: {
email,
nabuId,
tier
}
})
break
}
case AT.auth.RESET_ACCOUNT_CANCELLED: {
const state = store.getState()
const nabuId = state.profile.userData.getOrElse({})?.id ?? null
const email = state.profile.userData.getOrElse({})?.emailVerified
? state.profile.userData.getOrElse({})?.email
: null
const tier = state.profile.userData.getOrElse({})?.tiers?.current ?? null
const guid = state.walletPath.wallet.guid ?? null
const { origin } = action.paylpad

analytics.push(AnalyticsKey.RESET_ACCOUNT_CANCELLED, {
properties: {
guid,
origin,
originalTimestamp: getOriginalTimestamp()
},
traits: {
email,
nabuId,
tier
}
})
break
}
case AT.auth.RESET_ACCOUNT_CLICKED: {
const state = store.getState()
const nabuId = state.profile.userData.getOrElse({})?.id ?? null
const email = state.profile.userData.getOrElse({})?.emailVerified
? state.profile.userData.getOrElse({})?.email
: null
const tier = state.profile.userData.getOrElse({})?.tiers?.current ?? null
const guid = state.walletPath.wallet.guid ?? null
const { origin } = action.paylpad

analytics.push(AnalyticsKey.RESET_ACCOUNT_CLICKED, {
properties: {
guid,
origin,
originalTimestamp: getOriginalTimestamp()
},
traits: {
email,
nabuId,
tier
}
})
break
}
default: {
break
}
Expand Down

0 comments on commit 031d215

Please sign in to comment.