feat(core): improve mixpanel (#7652)

move @affine/core/utils/mixpanel -> @affine/core/mixpanel

now you can debug mixpanel on browser devtool

![CleanShot 2024-07-30 at 17.32.48@2x.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/g3jz87HxbjOJpXV3FPT7/083c1286-39fd-4569-b4d2-e6e84cf2e797.png)
This commit is contained in:
EYHN
2024-07-30 13:22:16 +00:00
parent ea7066d02c
commit ab92efcfc0
58 changed files with 221 additions and 149 deletions
@@ -3,7 +3,7 @@ import {
pushGlobalLoadingEventAtom,
resolveGlobalLoadingEventAtom,
} from '@affine/component/global-loading';
import { mixpanel } from '@affine/core/utils';
import { mixpanel } from '@affine/core/mixpanel';
import { apis } from '@affine/electron-api';
import { useI18n } from '@affine/i18n';
import type { PageRootService, RootBlockModel } from '@blocksuite/blocks';
@@ -4,9 +4,9 @@ import {
PreconditionStrategy,
registerAffineCommand,
} from '@affine/core/commands';
import { mixpanel } from '@affine/core/mixpanel';
import { CompatibleFavoriteItemsAdapter } from '@affine/core/modules/properties';
import { TelemetryWorkspaceContextService } from '@affine/core/modules/telemetry/services/telemetry';
import { mixpanel } from '@affine/core/utils';
import { WorkspaceFlavour } from '@affine/env/workspace';
import { useI18n } from '@affine/i18n';
import { EdgelessIcon, HistoryIcon, PageIcon } from '@blocksuite/icons/rc';
@@ -1,6 +1,6 @@
import { notify } from '@affine/component';
import { mixpanel } from '@affine/core/mixpanel';
import { getAffineCloudBaseUrl } from '@affine/core/modules/cloud/services/fetch';
import { mixpanel } from '@affine/core/utils';
import { useI18n } from '@affine/i18n';
import type { Disposable } from '@blocksuite/global/utils';
import { useCallback, useEffect, useMemo, useState } from 'react';
@@ -1,5 +1,5 @@
import { useUpgradeNotify } from '@affine/core/components/affine/subscription-landing/notify';
import { mixpanelTrack } from '@affine/core/utils';
import { mixpanel } from '@affine/core/mixpanel';
import { SubscriptionPlan, SubscriptionRecurring } from '@affine/graphql';
import { nanoid } from 'nanoid';
import { useCallback, useEffect } from 'react';
@@ -130,7 +130,7 @@ export const useSubscriptionNotifyReader = () => {
localStorage.removeItem(localStorageKey);
// mixpanel
mixpanelTrack('PlanChangeSucceeded', {
mixpanel.track('PlanChangeSucceeded', {
category: recurring,
type: plan,
control: 'new subscription',
@@ -7,7 +7,8 @@ import { atomWithObservable, atomWithStorage } from 'jotai/utils';
import { useCallback, useState } from 'react';
import { Observable } from 'rxjs';
import { mixpanel, popupWindow } from '../utils';
import { mixpanel } from '../mixpanel';
import { popupWindow } from '../utils';
import { useAsyncCallback } from './affine-async-hooks';
function rpcToObservable<