mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-24 22:09:08 +08:00
fix(core): event flow handle (#14256)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { type CreateCheckoutSessionInput } from '@affine/graphql';
|
||||
import { mixpanel } from '@affine/track';
|
||||
import { tracker } from '@affine/track';
|
||||
import { OnEvent, Service } from '@toeverything/infra';
|
||||
|
||||
import { Subscription } from '../entities/subscription';
|
||||
@@ -18,7 +18,7 @@ export class SubscriptionService extends Service {
|
||||
.map(sub => !!sub)
|
||||
.distinctUntilChanged()
|
||||
.subscribe(ai => {
|
||||
mixpanel.people.set({
|
||||
tracker.people.set({
|
||||
ai,
|
||||
});
|
||||
});
|
||||
@@ -26,7 +26,7 @@ export class SubscriptionService extends Service {
|
||||
.map(sub => !!sub)
|
||||
.distinctUntilChanged()
|
||||
.subscribe(pro => {
|
||||
mixpanel.people.set({
|
||||
tracker.people.set({
|
||||
pro,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mixpanel } from '@affine/track';
|
||||
import { tracker } from '@affine/track';
|
||||
import { OnEvent, Service } from '@toeverything/infra';
|
||||
|
||||
import { UserQuota } from '../entities/user-quota';
|
||||
@@ -13,7 +13,7 @@ export class UserQuotaService extends Service {
|
||||
.map(q => q?.humanReadable.name)
|
||||
.distinctUntilChanged()
|
||||
.subscribe(quota => {
|
||||
mixpanel.people.set({
|
||||
tracker.people.set({
|
||||
quota,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { shallowEqual } from '@affine/component';
|
||||
import { ServerDeploymentType } from '@affine/graphql';
|
||||
import { mixpanel } from '@affine/track';
|
||||
import { tracker } from '@affine/track';
|
||||
import { LiveData, OnEvent, Service } from '@toeverything/infra';
|
||||
|
||||
import type { AuthAccountInfo, Server, ServersService } from '../../cloud';
|
||||
@@ -47,19 +47,19 @@ export class TelemetryService extends Service {
|
||||
const unsubscribe = this.currentAccount$.subscribe(
|
||||
({ account, selfHosted }) => {
|
||||
if (prevAccount) {
|
||||
mixpanel.reset();
|
||||
tracker.reset();
|
||||
}
|
||||
// the isSelfHosted property from environment is not reliable
|
||||
if (selfHosted !== prevSelfHosted) {
|
||||
mixpanel.register({
|
||||
tracker.register({
|
||||
isSelfHosted: selfHosted,
|
||||
});
|
||||
}
|
||||
prevSelfHosted = selfHosted;
|
||||
prevAccount = account ?? null;
|
||||
if (account) {
|
||||
mixpanel.identify(account.id);
|
||||
mixpanel.people.set({
|
||||
tracker.identify(account.id);
|
||||
tracker.people.set({
|
||||
$email: account.email,
|
||||
$name: account.label,
|
||||
$avatar: account.avatar,
|
||||
@@ -78,7 +78,7 @@ export class TelemetryService extends Service {
|
||||
|
||||
registerMiddlewares() {
|
||||
this.disposables.push(
|
||||
mixpanel.middleware((_event, parameters) => {
|
||||
tracker.middleware((_event, parameters) => {
|
||||
const extraContext = this.extractGlobalContext();
|
||||
return {
|
||||
...extraContext,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mixpanel } from '@affine/track';
|
||||
import { tracker } from '@affine/track';
|
||||
import { createEvent, Service } from '@toeverything/infra';
|
||||
import { combineLatest, distinctUntilChanged, map, skip } from 'rxjs';
|
||||
|
||||
@@ -19,7 +19,7 @@ export class WorkbenchService extends Service {
|
||||
)
|
||||
.subscribe(newLocation => {
|
||||
this.eventBus.root.emit(WorkbenchLocationChanged, newLocation);
|
||||
mixpanel.track_pageview({
|
||||
tracker.track_pageview({
|
||||
location: newLocation,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user