From 751b7292c08d0a1b0d1fb2bf7cf1533ba6f713e5 Mon Sep 17 00:00:00 2001 From: Davide Segullo Date: Wed, 26 Jun 2024 13:34:10 +0200 Subject: [PATCH] feat: :sparkles: add new analytics api --- src/constants/analytics.ts | 2 +- src/views/ExportHistoryDropdown.tsx | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/constants/analytics.ts b/src/constants/analytics.ts index 7311b3c5d..08c9e71de 100644 --- a/src/constants/analytics.ts +++ b/src/constants/analytics.ts @@ -96,7 +96,7 @@ export const AnalyticsEvents = unionize( indexerBlockHeight?: number; trailingBlocks?: number; }>(), - + // Export CSV ExportCsvClick: ofType<{}>(), ExportDownloadClick: ofType<{ diff --git a/src/views/ExportHistoryDropdown.tsx b/src/views/ExportHistoryDropdown.tsx index 13b729527..c1dc2204f 100644 --- a/src/views/ExportHistoryDropdown.tsx +++ b/src/views/ExportHistoryDropdown.tsx @@ -5,7 +5,7 @@ import { useMutation } from '@tanstack/react-query'; import { useSelector } from 'react-redux'; import styled from 'styled-components'; -import { AnalyticsEvent } from '@/constants/analytics'; +import { AnalyticsEvents } from '@/constants/analytics'; import { ButtonAction, ButtonSize } from '@/constants/buttons'; import { STRING_KEYS } from '@/constants/localization'; @@ -232,10 +232,12 @@ export const ExportHistoryDropdown = (props: ExportHistoryDropdownProps) => { mutateExportTransfers(); } - track(AnalyticsEvent.ExportDownloadClick, { - trades: checkedTrades, - transfers: checkedTransfers, - }); + track( + AnalyticsEvents.ExportDownloadClick({ + trades: checkedTrades, + transfers: checkedTransfers, + }) + ); }, [checkedTrades, checkedTransfers, mutateExportTrades, mutateExportTransfers] ); @@ -244,7 +246,7 @@ export const ExportHistoryDropdown = (props: ExportHistoryDropdownProps) => { { if (open) { - track(AnalyticsEvent.ExportCsvClick); + track(AnalyticsEvents.ExportCsvClick()); } }} items={[ @@ -256,7 +258,7 @@ export const ExportHistoryDropdown = (props: ExportHistoryDropdownProps) => { onCheckedChange={() => { setCheckedTrades(!checkedTrades); - track(AnalyticsEvent.ExportTradesCheckboxClick, { value: !checkedTrades }); + track(AnalyticsEvents.ExportTradesCheckboxClick({ value: !checkedTrades })); }} /> ), @@ -271,7 +273,7 @@ export const ExportHistoryDropdown = (props: ExportHistoryDropdownProps) => { onCheckedChange={() => { setCheckedTransfers(!checkedTransfers); - track(AnalyticsEvent.ExportTransfersCheckboxClick, { value: !checkedTrades }); + track(AnalyticsEvents.ExportTransfersCheckboxClick({ value: !checkedTrades })); }} /> ),