Merge pull request #5 from Uniswap/geocheck-analytics

feat: add analytics for moonpay ip check
This commit is contained in:
Jordan Frankfurt 2022-12-19 11:13:30 -06:00 committed by GitHub
commit 3e0788092e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,4 @@
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { DEFAULT_TXN_DISMISS_MS } from 'constants/misc' import { DEFAULT_TXN_DISMISS_MS } from 'constants/misc'
import { useCallback, useEffect, useMemo, useState } from 'react' import { useCallback, useEffect, useMemo, useState } from 'react'
import { useAppDispatch, useAppSelector } from 'state/hooks' import { useAppDispatch, useAppSelector } from 'state/hooks'
@ -51,6 +52,7 @@ export function useFiatOnrampAvailability(shouldCheck: boolean, callback?: () =>
setLoading(true) setLoading(true)
try { try {
const result = await getMoonpayAvailability() const result = await getMoonpayAvailability()
sendAnalyticsEvent('MoonPay Geochecker', { success: result })
if (stale) return if (stale) return
dispatch(setFiatOnrampAvailability(result)) dispatch(setFiatOnrampAvailability(result))
if (result && callback) { if (result && callback) {