mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
refactor(suite): Delete types.ts from @suite/analytics
This commit is contained in:
@@ -106,7 +106,6 @@
|
||||
/suite/analytics @jvaclavik
|
||||
/suite/analytics/src/events @kolomaznikt
|
||||
/suite/analytics/src/constants.ts @kolomaznikt
|
||||
/suite/analytics/src/types.ts @kolomaznikt
|
||||
|
||||
# Mobile analytics
|
||||
/suite-native/analytics @jvaclavik
|
||||
|
||||
@@ -63,7 +63,7 @@ const analyticsMiddleware = createMiddlewareWithExtraDeps(
|
||||
const result = next(action);
|
||||
|
||||
const state: AppState = getState();
|
||||
const { legacyAnalytics, analytics } = extra.services;
|
||||
const { analytics } = extra.services;
|
||||
|
||||
if (isAnyOf(firmwareUpdate.fulfilled, firmwareUpdate.rejected)(action)) {
|
||||
const { device, toBtcOnly, toFwVersion, error = '' } = action.payload ?? {};
|
||||
@@ -87,7 +87,7 @@ const analyticsMiddleware = createMiddlewareWithExtraDeps(
|
||||
|
||||
switch (action.type) {
|
||||
case connectThpDeviceThunk.fulfilled.type:
|
||||
legacyAnalytics.report({
|
||||
analytics.report({
|
||||
type: EventTypeShared.DeviceConnectionDeviceConfirmation,
|
||||
payload: { option: 'confirmed' },
|
||||
});
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { Analytics, QueuedAnalytics } from '@trezor/analytics-uploader';
|
||||
|
||||
import { SuiteDesktopLegacyAnalyticsEvents } from './types';
|
||||
|
||||
export type DesktopLegacyAnalyticsDep = {
|
||||
legacyAnalytics: Analytics<SuiteDesktopLegacyAnalyticsEvents>;
|
||||
legacyAnalytics: Analytics<any>;
|
||||
};
|
||||
|
||||
/** @deprecated use `createAnalytics` instead */
|
||||
export const createLegacyAnalytics = (): Analytics<SuiteDesktopLegacyAnalyticsEvents> =>
|
||||
new QueuedAnalytics<SuiteDesktopLegacyAnalyticsEvents>({
|
||||
export const createLegacyAnalytics = (): Analytics<any> =>
|
||||
new QueuedAnalytics<any>({
|
||||
version: process.env.VERSION!,
|
||||
app: 'suite',
|
||||
useQueue: true,
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { Analytics } from '@trezor/analytics-uploader';
|
||||
|
||||
import { SuiteDesktopLegacyAnalyticsEvents } from './types';
|
||||
|
||||
// @TODO: we have to type dispatch correctly in desktop/native/common
|
||||
export const getTypedDesktopLegacyAnalytics = (legacyAnalytics: Analytics<any>) =>
|
||||
legacyAnalytics as unknown as Analytics<SuiteDesktopLegacyAnalyticsEvents>;
|
||||
export const getTypedDesktopLegacyAnalytics = (legacyAnalytics: Analytics<any>) => legacyAnalytics;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
export { createLegacyAnalytics, type DesktopLegacyAnalyticsDep } from './createLegacyAnalytics';
|
||||
export { createAnalytics, type DesktopAnalyticsDep } from './createAnalytics';
|
||||
export type { SuiteDesktopLegacyAnalyticsEvents } from './types';
|
||||
export type { OnboardingAnalytics, AppUpdateEvent, FirmwareSource } from './definitions';
|
||||
export { EventType, AppUpdateEventStatus } from './constants';
|
||||
export { getTypedDesktopLegacyAnalytics } from './getTypedDesktopLegacyAnalytics';
|
||||
export { getTypedDesktopAnalytics } from './getTypedDesktopAnalytics';
|
||||
export type { AnalyticsDesktopEvents, SuiteReadyPayload } from './analyticsEvents';
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
/** @deprecated use `AnalyticsDesktopEvents` */
|
||||
export type SuiteDesktopLegacyAnalyticsEvents = never;
|
||||
@@ -1,16 +1,12 @@
|
||||
import { AnalyticsDesktopEvents, SuiteDesktopLegacyAnalyticsEvents } from '@suite/analytics';
|
||||
import { AnalyticsDesktopEvents } from '@suite/analytics';
|
||||
import { NetworkSymbol } from '@suite-common/wallet-config';
|
||||
import { urlSearchParams } from '@trezor/suite/src//utils/suite/metadata';
|
||||
export type Requests = ReturnType<typeof urlSearchParams>[];
|
||||
|
||||
/**
|
||||
* Union of legacy and migrated (new) desktop analytics events.
|
||||
* Use this for e2e so findAnalyticsEventByType works for both legacy events
|
||||
* and events migrated from legacyAnalytics to the new analytics (e.g. DeviceConnect).
|
||||
* Desktop analytics events for e2e (findAnalyticsEventByType).
|
||||
*/
|
||||
export type SuiteDesktopAnalyticsEventsForE2e =
|
||||
| SuiteDesktopLegacyAnalyticsEvents
|
||||
| AnalyticsDesktopEvents;
|
||||
export type SuiteDesktopAnalyticsEventsForE2e = AnalyticsDesktopEvents;
|
||||
|
||||
export type ExtractByEventType<EventType> = Extract<
|
||||
SuiteDesktopAnalyticsEventsForE2e,
|
||||
|
||||
Reference in New Issue
Block a user