chore(core): add mixpanel track (#6202)
This commit is contained in:
@@ -18,6 +18,7 @@ import { useCallback } from 'react';
|
||||
|
||||
import { useCurrentLoginStatus } from '../../../hooks/affine/use-current-login-status';
|
||||
import { useMutation } from '../../../hooks/use-mutation';
|
||||
import { mixpanel } from '../../../utils';
|
||||
import { emailRegex } from '../../../utils/email-regex';
|
||||
import type { AuthPanelProps } from './index';
|
||||
import { OAuth } from './oauth';
|
||||
@@ -97,6 +98,10 @@ export const SignIn: FC<AuthPanelProps> = ({
|
||||
if (res?.status === 403 && res?.url === INTERNAL_BETA_URL) {
|
||||
return setAuthState('noAccess');
|
||||
}
|
||||
// TODO, should always get id from user
|
||||
if ('id' in user) {
|
||||
mixpanel.identify(user.id);
|
||||
}
|
||||
setAuthState('afterSignInSendEmail');
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,8 @@ import bytes from 'bytes';
|
||||
import { useAtom, useSetAtom } from 'jotai';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
|
||||
import { mixpanel } from '../../../utils';
|
||||
|
||||
export const CloudQuotaModal = () => {
|
||||
const t = useAFFiNEI18N();
|
||||
const currentWorkspace = useService(Workspace);
|
||||
@@ -70,6 +72,14 @@ export const CloudQuotaModal = () => {
|
||||
};
|
||||
}, [currentWorkspace.engine.blob, setOpen, workspaceQuota.blobLimit]);
|
||||
|
||||
useEffect(() => {
|
||||
if (userQuota?.humanReadable) {
|
||||
mixpanel.people.set({
|
||||
plan: userQuota.humanReadable.name,
|
||||
});
|
||||
}
|
||||
}, [userQuota]);
|
||||
|
||||
return (
|
||||
<ConfirmModal
|
||||
open={open}
|
||||
|
||||
Reference in New Issue
Block a user