diff --git a/components/operations/BorrowAtMaturity/Installments.tsx b/components/operations/BorrowAtMaturity/Installments.tsx index 2c708475c..8773fe278 100644 --- a/components/operations/BorrowAtMaturity/Installments.tsx +++ b/components/operations/BorrowAtMaturity/Installments.tsx @@ -5,6 +5,7 @@ import { Box, Typography } from '@mui/material'; import { MATURITY_DAYS } from 'utils/utils'; import ModalAlert from 'components/common/modal/ModalAlert'; import InstallmentsOptions from './InstallmentsOptions'; +import { track } from 'utils/mixpanel'; export default function Installments({ setBreakdownSheetOpen }: { setBreakdownSheetOpen: (open: boolean) => void }) { const { t } = useTranslation(); @@ -12,6 +13,10 @@ export default function Installments({ setBreakdownSheetOpen }: { setBreakdownSh const viewBreakdown = useCallback(() => { setBreakdownSheetOpen(true); + track('Button Clicked', { + name: 'Payment Schedule', + location: 'Operations Modal', + }); }, [setBreakdownSheetOpen]); return ( diff --git a/components/operations/BorrowAtMaturity/InstallmentsOptions.tsx b/components/operations/BorrowAtMaturity/InstallmentsOptions.tsx index 5f6b9e2a3..ac2a61f2d 100644 --- a/components/operations/BorrowAtMaturity/InstallmentsOptions.tsx +++ b/components/operations/BorrowAtMaturity/InstallmentsOptions.tsx @@ -6,6 +6,7 @@ import useAccountData from 'hooks/useAccountData'; import { formatUnits } from 'viem'; import { Box, Skeleton, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; +import { track } from 'utils/mixpanel'; type OptionProps = { installments: number; @@ -45,9 +46,15 @@ export default function InstallmentsOptions() { const handleChange = useCallback( (option: { installments: number }) => { + track('Option Selected', { + name: 'Installments', + location: 'Operations Modal', + value: option.installments, + prevValue: installments, + }); onInstallmentsChange(option.installments); }, - [onInstallmentsChange], + [installments, onInstallmentsChange], ); const option = useMemo(() => { diff --git a/hooks/useBorrowInInstallments.ts b/hooks/useBorrowInInstallments.ts index 71629ec29..7bef4d619 100644 --- a/hooks/useBorrowInInstallments.ts +++ b/hooks/useBorrowInInstallments.ts @@ -169,7 +169,22 @@ export default function useBorrowInInstallments() { if (!installmentsBorrow.write) return; installmentsBorrow.write(); } - }, [installmentsBorrow, installmentsBorrowETH, isBorrowETH]); + track('TX Signed', { + contractName: 'InstallmentsRouter', + method: 'borrow', + symbol, + amount: installmentsDetails?.installmentsPrincipal.map(String).join(','), + hash: installmentsBorrowETH.data?.hash || '0x', + maturity: Number(date), + }); + }, [ + date, + installmentsBorrow, + installmentsBorrowETH, + installmentsDetails?.installmentsPrincipal, + isBorrowETH, + symbol, + ]); const needsApproval = useMemo(() => { if (allowance.data === undefined) return true;