@@ -30,13 +30,29 @@ import { postMessageToReactNative } from "@/utils/messageReactNative"
3030import { isPwa } from "@/utils/pwa"
3131import {
3232 coreDashboardActions ,
33+ type DashboardAction ,
3334 widgetDashboardActions ,
3435} from "@/widgets/registry"
3536
3637import { Menu } from "./Menu"
3738import { ProfileCard } from "./ProfileCard"
3839import styles from "./WalletSection.module.css"
3940
41+ // Widget dashboard buttons that should report a click. Core actions
42+ // (Send/Receive/Swap/...) are intentionally excluded - they only track
43+ // action completion, not the click itself.
44+ type WidgetTabSelectedEventType =
45+ | AnalyticsEventTypes . AICreditsTabSelected
46+ | AnalyticsEventTypes . GoodReserveTabSelected
47+ | AnalyticsEventTypes . SuperfluidCampaignTabSelected
48+
49+ const widgetActionEventType : Record < string , WidgetTabSelectedEventType > = {
50+ "goodwidget.ai-credits" : AnalyticsEventTypes . AICreditsTabSelected ,
51+ "goodwidget.goodreserve" : AnalyticsEventTypes . GoodReserveTabSelected ,
52+ "goodwidget.superfluid-campaign" :
53+ AnalyticsEventTypes . SuperfluidCampaignTabSelected ,
54+ }
55+
4056export default function WalletSection ( {
4157 children,
4258} : {
@@ -199,7 +215,10 @@ export default function WalletSection({
199215 predictions : homeTranslations . predictions ,
200216 walletconnect : homeTranslations . walletConnect ,
201217 }
202- const dashboardActions = [ ...coreDashboardActions , ...widgetDashboardActions ]
218+ const dashboardActions : readonly DashboardAction [ ] = [
219+ ...coreDashboardActions ,
220+ ...widgetDashboardActions ,
221+ ]
203222
204223 return (
205224 < >
@@ -242,13 +261,21 @@ export default function WalletSection({
242261 : action . id === "walletconnect" && sessions . length > 0
243262 ? "connected"
244263 : undefined
264+ const widgetEventType = action . widgetId
265+ ? widgetActionEventType [ action . widgetId ]
266+ : undefined
245267
246268 return (
247269 < Link
248270 key = { action . id }
249271 href = { `/${ locale } /${ action . routeSlug } ` }
250272 scroll = { false }
251273 prefetch = { true }
274+ onClick = {
275+ widgetEventType
276+ ? ( ) => captureEvent ( { type : widgetEventType } )
277+ : undefined
278+ }
252279 >
253280 < RoundButton
254281 icon = { icon }
0 commit comments