diff --git a/src/app/common/hooks/analytics/transactions-analytics.hooks.ts b/src/app/common/hooks/analytics/transactions-analytics.hooks.ts deleted file mode 100644 index 6702512b173..00000000000 --- a/src/app/common/hooks/analytics/transactions-analytics.hooks.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { useEffect, useMemo } from 'react'; - -import { AccountStxBalanceBigNumber } from '@shared/models/account.model'; - -import { useCurrentStacksAccountUnanchoredBalances } from '@app/query/stacks/balance/stx-balance.hooks'; -import { store } from '@app/store'; -import { analyticsActions } from '@app/store/analytics/analytics.actions'; -import { useAnalyticsHasStxDeposits } from '@app/store/analytics/analytics.selectors'; -import { useCurrentNetworkState } from '@app/store/networks/networks.hooks'; - -import { useAnalytics } from './use-analytics'; - -function useIsFirstDeposit(stxBalance: AccountStxBalanceBigNumber | undefined): boolean { - const currentNetwork = useCurrentNetworkState(); - const { chainId: stxChainId } = currentNetwork.chain.stacks; - const hasStxDeposits = useAnalyticsHasStxDeposits()[stxChainId]; - const hasZeroStx = useMemo( - () => stxBalance?.total_received.amount?.isEqualTo(0) || false, - [stxBalance?.total_received] - ); - useEffect(() => { - if (!stxBalance) return; - if (hasZeroStx || !hasStxDeposits) { - store.dispatch( - analyticsActions.hasStxDeposits({ - network: stxChainId, - hasStxDeposits: !hasZeroStx, - }) - ); - } - }, [hasZeroStx, hasStxDeposits, stxChainId, stxBalance]); - return !hasStxDeposits && !hasZeroStx; -} - -export function useTrackFirstDeposit() { - const analytics = useAnalytics(); - const { data: balances } = useCurrentStacksAccountUnanchoredBalances(); - const firstDeposit = useIsFirstDeposit(balances?.stx); - useEffect(() => { - if (!firstDeposit || !balances) return; - void analytics.track('deposit_first_stx', { type: 'stx' }); - }, [analytics, balances, firstDeposit]); -} diff --git a/src/app/pages/home/home.tsx b/src/app/pages/home/home.tsx index 5a78f00a492..d26ce2eda1d 100644 --- a/src/app/pages/home/home.tsx +++ b/src/app/pages/home/home.tsx @@ -2,7 +2,6 @@ import { Route, useNavigate } from 'react-router-dom'; import { RouteUrls } from '@shared/route-urls'; -import { useTrackFirstDeposit } from '@app/common/hooks/analytics/transactions-analytics.hooks'; import { useOnboardingState } from '@app/common/hooks/auth/use-onboarding-state'; import { useOnMount } from '@app/common/hooks/use-on-mount'; import { useRouteHeader } from '@app/common/hooks/use-route-header'; @@ -23,8 +22,6 @@ export function Home() { const navigate = useNavigate(); - useTrackFirstDeposit(); - useRouteHeader( <>