mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-23 23:57:15 +01:00
refactor(suite-native): asset_sync analytics event
This commit is contained in:
38
suite-native/analytics/src/events/AssetsSyncEvent.ts
Normal file
38
suite-native/analytics/src/events/AssetsSyncEvent.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { AttributeDef, EventDef } from '@suite-common/analytics';
|
||||
import { NetworkSymbol } from '@suite-common/wallet-config';
|
||||
import { TokenAddress, TokenSymbol } from '@suite-common/wallet-types';
|
||||
|
||||
import { EventType } from '../constants';
|
||||
|
||||
type Attributes = {
|
||||
assetSymbol: AttributeDef<NetworkSymbol>;
|
||||
tokenSymbols?: AttributeDef<TokenSymbol[]>;
|
||||
tokenAddresses?: AttributeDef<TokenAddress[]>;
|
||||
};
|
||||
|
||||
export const assetsSyncEvent: EventDef<Attributes, EventType.AssetsSync> = {
|
||||
name: EventType.AssetsSync,
|
||||
descriptionTrigger: 'User imports an asset to their portfolio.',
|
||||
changelog: [
|
||||
{ version: '23.4.1', notes: 'added' },
|
||||
{ version: '24.3.1', notes: '"tokenAddresses" attribute added' },
|
||||
],
|
||||
|
||||
attributes: {
|
||||
assetSymbol: {
|
||||
changelog: [{ version: '23.4.1', notes: 'added' }],
|
||||
description: 'The symbol of the synced asset',
|
||||
},
|
||||
tokenSymbols: {
|
||||
changelog: [
|
||||
{ version: '23.4.1', notes: 'added' },
|
||||
{ version: '24.3.1', notes: 'renamed from "tokenSymbol" to "tokenSymbols"' },
|
||||
],
|
||||
description: 'The symbols of the synced tokens',
|
||||
},
|
||||
tokenAddresses: {
|
||||
changelog: [{ version: '24.3.1', notes: 'added' }],
|
||||
description: 'The addresses of the synced tokens',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,6 +1,8 @@
|
||||
export { appReadyEvent } from './AppReadyEvent';
|
||||
export { assetDetailEvent } from './assetDetailEvent';
|
||||
export { assetsSyncEvent } from './AssetsSyncEvent';
|
||||
export { earnNavigateEvent } from './earnNavigateEvent';
|
||||
export { earnStakeTilePressedEvent } from './earnStakeTilePressedEvent';
|
||||
export { onboardingCompletedEvent } from './OnboardingCompletedEvent';
|
||||
export { screenChangeEvent } from './ScreenChangeEvent';
|
||||
export { settingsChangeCoinBackendEvent } from './settingsChangeCoinBackendEvent';
|
||||
|
||||
@@ -29,21 +29,6 @@ export type CountryChangeAction = 'submitDefault' | 'submitCustom' | 'cancel';
|
||||
|
||||
/** @deprecated use `AnalyticsNativeEvents` */
|
||||
export type SuiteNativeLegacyAnalyticsEvents =
|
||||
| {
|
||||
type: EventType.AssetsSync;
|
||||
payload: {
|
||||
assetSymbol: NetworkSymbol;
|
||||
tokenSymbols?: TokenSymbol[];
|
||||
tokenAddresses?: TokenAddress[];
|
||||
};
|
||||
}
|
||||
| {
|
||||
type: EventType.ScreenChange;
|
||||
payload: {
|
||||
previousScreen: string;
|
||||
currentScreen: string;
|
||||
};
|
||||
}
|
||||
| {
|
||||
type: EventType.WatchPortfolioTimeframeChange;
|
||||
payload: {
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
StackToStackCompositeNavigationProps,
|
||||
useNavigateToInitialScreen,
|
||||
} from '@suite-native/navigation';
|
||||
import { useLegacyAnalytics } from '@suite-native/services';
|
||||
import { useAnalytics } from '@suite-native/services';
|
||||
import { AccountInfo, TokenInfo } from '@trezor/connect';
|
||||
|
||||
import { importAccountThunk } from '../accountsImportThunks';
|
||||
@@ -52,7 +52,7 @@ export const AccountImportConfirmFormScreen = ({
|
||||
accountInfo,
|
||||
}: AccountImportConfirmFormScreenProps) => {
|
||||
const dispatch = useDispatch();
|
||||
const legacyAnalytics = useLegacyAnalytics();
|
||||
const analytics = useAnalytics();
|
||||
const navigation = useNavigation<NavigationProp>();
|
||||
const navigateToInitialScreen = useNavigateToInitialScreen();
|
||||
const showImportError = useShowImportError(symbol, navigation);
|
||||
@@ -84,7 +84,7 @@ export const AccountImportConfirmFormScreen = ({
|
||||
}),
|
||||
).unwrap();
|
||||
|
||||
legacyAnalytics.report({
|
||||
analytics.report({
|
||||
type: EventType.AssetsSync,
|
||||
payload: {
|
||||
assetSymbol: symbol,
|
||||
|
||||
Reference in New Issue
Block a user