Skip to content

Commit

Permalink
Merge pull request #304 from secretkeylabs/refactor/eng-5791/update-m…
Browse files Browse the repository at this point in the history
…ixpanel-types

refactor: [ENG-5791] Update Mixpanel types
  • Loading branch information
jordankzf authored Jan 3, 2025
2 parents a367bac + 8b9fb70 commit 68dbd82
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions types/mixpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@ type RestoreWalletProps = {
backupType: WalletBackupType;
};

type TokenSelection = {
principal?: string;
selectedToken?: string;
};

type BaseSwapEvent = {
fromTokenUsdValue: string | number;
to?: string;
from?: string;
provider?: string;
toPrincipal?: string;
fromPrincipal?: string;
};

interface SwapAmountEvent extends BaseSwapEvent {
toTokenAmount?: string;
fromTokenAmount?: string;
}

interface SelectSwapQuoteEvent {
provider: string;
from: string;
to: string;
fromPrincipal?: string;
toPrincipal?: string;
}

export type AnalyticsEventProperties = {
[AnalyticsEvents.ClickApp]: {
link: string;
Expand All @@ -73,16 +100,13 @@ export type AnalyticsEventProperties = {
repeat?: number;
batch?: number;
} & CommonProps;
[AnalyticsEvents.InitiateSwapFlow]: {
selectedToken?: string;
principal?: string;
};
[AnalyticsEvents.FetchSwapQuote]: FromToToken & FromToAmount;
[AnalyticsEvents.SelectSwapQuote]: QuoteSwapProps;
[AnalyticsEvents.ConfirmSwap]: QuoteSwapAmountProps;
[AnalyticsEvents.SignSwap]: QuoteSwapAmountProps;
[AnalyticsEvents.SelectTokenToSwapFrom]: SelectSwapTokenProps;
[AnalyticsEvents.SelectTokenToSwapTo]: SelectSwapTokenProps;
[AnalyticsEvents.InitiateSwapFlow]: TokenSelection;
[AnalyticsEvents.FetchSwapQuote]: SwapAmountEvent;
[AnalyticsEvents.ConfirmSwap]: SwapAmountEvent;
[AnalyticsEvents.SignSwap]: SwapAmountEvent;
[AnalyticsEvents.SelectSwapQuote]: SelectSwapQuoteEvent;
[AnalyticsEvents.SelectTokenToSwapFrom]: TokenSelection;
[AnalyticsEvents.SelectTokenToSwapTo]: TokenSelection;
[AnalyticsEvents.SetupWallet]: SetupWalletProps;
[AnalyticsEvents.BackupWallet]: BackupWalletProps;
[AnalyticsEvents.RestoreWallet]: RestoreWalletProps;
Expand Down

0 comments on commit 68dbd82

Please sign in to comment.