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
@@ -9,7 +9,7 @@ export const Empty = ({
}: {
onDrop: (data: DropTargetDropEvent<AffineDNDData>) => void;
}) => {
const { dropTargetRef } = useDropTarget(
const { dropTargetRef } = useDropTarget<AffineDNDData>(
() => ({
onDrop,
}),
@@ -1,4 +1,4 @@
import { mixpanel } from '@affine/core/utils';
import { mixpanel } from '@affine/core/mixpanel';
import type { QuotaQuery } from '@affine/graphql';
import type { WorkspaceScope } from '@toeverything/infra';
import {
@@ -31,20 +31,6 @@ export class TelemetryService extends Service {
}
onApplicationStart() {
if (process.env.MIXPANEL_TOKEN) {
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
track_pageview: true,
persistence: 'localStorage',
api_host: 'https://telemetry.affine.run',
});
mixpanel.register({
appVersion: runtimeConfig.appVersion,
environment: runtimeConfig.appBuildType,
editorVersion: runtimeConfig.editorVersion,
isSelfHosted: Boolean(runtimeConfig.isSelfHosted),
isDesktop: environment.isDesktop,
});
}
const account = this.auth.session.account$.value;
this.updateIdentity(account);
}
@@ -1,4 +1,4 @@
import { mixpanel } from '@affine/core/utils';
import { mixpanel } from '@affine/core/mixpanel';
import { createEvent, Service } from '@toeverything/infra';
import { combineLatest, distinctUntilChanged, map, skip } from 'rxjs';