Skip to content

Commit 782af1d

Browse files
committed
fixup! Refactor tracking props to be explicit, use CryptoAmount We call everything pluginId, making things ambiguous and confusing when we pass pluginId around. In this case it was causing problems with the logging when treating a provider's pluginId as a wallet pluginId.
1 parent 58cfa4c commit 782af1d

File tree

7 files changed

+23
-13
lines changed

7 files changed

+23
-13
lines changed

src/components/scenes/Fio/FioAddressSettingsScene.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class FioAddressSettingsComponent extends React.Component<Props, LocalSta
108108
onLogEvent('Fio_Handle_Bundled_Tx', {
109109
conversionValues: {
110110
conversionType: 'crypto',
111-
cryptoAmount: new CryptoAmount({ nativeAmount: String(fee), currencyConfig: fioWallet.currencyConfig })
111+
cryptoAmount: new CryptoAmount({ nativeAmount: String(fee), currencyConfig: fioWallet.currencyConfig, tokenId: null })
112112
}
113113
})
114114
}

src/components/scenes/Fio/FioDomainSettingsScene.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class FioDomainSettingsComponent extends React.Component<Props, State> {
122122
onLogEvent('Fio_Domain_Renew', {
123123
conversionValues: {
124124
conversionType: 'crypto',
125-
cryptoAmount: new CryptoAmount({ nativeAmount: String(renewalFee), currencyConfig: fioWallet.currencyConfig })
125+
cryptoAmount: new CryptoAmount({ nativeAmount: String(renewalFee), currencyConfig: fioWallet.currencyConfig, tokenId: null })
126126
}
127127
})
128128
}

src/components/scenes/Fio/FioNameConfirmScene.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ class FioNameConfirm extends React.PureComponent<Props> {
121121
conversionValues: {
122122
conversionType: 'crypto',
123123
cryptoAmount: new CryptoAmount({
124+
currencyConfig: paymentWallet.currencyConfig,
124125
nativeAmount: edgeTx.nativeAmount,
125-
currencyConfig: paymentWallet.currencyConfig
126+
tokenId: null
126127
})
127128
}
128129
})
@@ -143,8 +144,9 @@ class FioNameConfirm extends React.PureComponent<Props> {
143144
conversionValues: {
144145
conversionType: 'crypto',
145146
cryptoAmount: new CryptoAmount({
147+
currencyConfig: paymentWallet.currencyConfig,
146148
nativeAmount: edgeTx.nativeAmount,
147-
currencyConfig: paymentWallet.currencyConfig
149+
tokenId: null
148150
})
149151
}
150152
})

src/plugins/gui/providers/banxaProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,7 @@ export const banxaProvider: FiatProviderFactory = {
650650
conversionType: 'sell',
651651
destFiatCurrencyCode: fiatCurrencyCode,
652652
destFiatAmount: priceQuote.fiat_amount,
653-
sourceAmount: CryptoAmount({
654-
pluginId: coreWallet.currencyInfo.pluginId,
653+
sourceAmount: new CryptoAmount({
655654
currencyConfig: coreWallet.currencyConfig,
656655
currencyCode: displayCurrencyCode,
657656
exchangeAmount: coinAmount

src/plugins/gui/providers/kadoProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,7 @@ export const kadoProvider: FiatProviderFactory = {
768768
conversionType: 'sell',
769769
destFiatCurrencyCode: 'USD',
770770
destFiatAmount: fiatAmount,
771-
sourceAmount: CryptoAmount({
772-
pluginId: coreWallet.currencyInfo.pluginId,
771+
sourceAmount: new CryptoAmount({
773772
currencyConfig: coreWallet.currencyConfig,
774773
currencyCode: displayCurrencyCode,
775774
exchangeAmount: paymentExchangeAmount

src/plugins/gui/providers/paybisProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,7 @@ export const paybisProvider: FiatProviderFactory = {
614614
conversionType: 'sell',
615615
destFiatCurrencyCode: fiatCurrencyCode,
616616
destFiatAmount: fiatAmount,
617-
sourceAmount: CryptoAmount({
618-
pluginId: coreWallet.currencyInfo.pluginId,
617+
sourceAmount: new CryptoAmount({
619618
currencyConfig: coreWallet.currencyConfig,
620619
currencyCode: displayCurrencyCode,
621620
exchangeAmount: amount

src/util/tracking.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,18 @@ export type TrackingEventName =
5656

5757
export type OnLogEvent = (event: TrackingEventName, values?: TrackingValues) => void
5858

59-
// Known dollar amount revenue
59+
/**
60+
* Analytics: Known dollar amount revenue
61+
*/
6062
export interface DollarConversionValues {
6163
conversionType: 'dollar'
6264
dollarConversionValue: number
6365
}
6466

65-
// Some unknown revenue based on a send (e.g. FIO handle/domain fees) or swap
67+
/**
68+
* Analytics: Some unknown revenue based on a send (e.g. FIO handle/domain fees)
69+
* or swap
70+
*/
6671
export interface CryptoConversionValues {
6772
conversionType: 'crypto'
6873
cryptoAmount: CryptoAmount
@@ -71,7 +76,9 @@ export interface CryptoConversionValues {
7176
orderId?: string
7277
}
7378

74-
// Sell to fiat
79+
/**
80+
* Analytics: Sell to fiat
81+
*/
7582
export interface SellConversionValues {
7683
conversionType: 'sell'
7784

@@ -85,6 +92,10 @@ export interface SellConversionValues {
8592
orderId?: string // Unique order identifier provided by fiat provider
8693
}
8794

95+
/**
96+
* Culmination of defined tracking value types, including those defined in
97+
* LoginUi.
98+
*/
8899
export interface TrackingValues extends LoginTrackingValues {
89100
error?: unknown | string // Any error
90101

0 commit comments

Comments
 (0)