diff --git a/packages/frontend/core/src/components/affine/auth/oauth.tsx b/packages/frontend/core/src/components/affine/auth/oauth.tsx index 3f8b65cdbb984..4ef6a9252c0cd 100644 --- a/packages/frontend/core/src/components/affine/auth/oauth.tsx +++ b/packages/frontend/core/src/components/affine/auth/oauth.tsx @@ -2,6 +2,7 @@ import { Skeleton } from '@affine/component'; import { Button } from '@affine/component/ui/button'; import { UrlService } from '@affine/core/modules/url'; import { OAuthProviderType } from '@affine/graphql'; +import track from '@affine/track'; import { GithubIcon, GoogleDuotoneIcon } from '@blocksuite/icons/rc'; import { useLiveData, useService } from '@toeverything/infra'; import { type ReactElement, useCallback } from 'react'; @@ -86,6 +87,8 @@ function OAuthProvider({ const oauthUrl = BUILD_CONFIG.serverUrlPrefix + `/oauth/login?${params.toString()}`; + track.$.$.auth.signIn({ method: 'oauth', provider }); + popupWindow(oauthUrl); }, [popupWindow, provider, redirectUrl, scheme]); diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/tracker.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/tracker.ts index 0265aac741410..272c6ee6ad372 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/tracker.ts +++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/tracker.ts @@ -255,9 +255,7 @@ export function setupTracker() { }); AIProvider.slots.requestLogin.on(() => { - track.$.$.auth.signIn({ - control: 'aiAction', - }); + track.doc.editor.aiActions.requestSignIn(); }); AIProvider.slots.actions.on(event => { diff --git a/packages/frontend/core/src/components/workspace-selector/user-with-workspace-list/index.tsx b/packages/frontend/core/src/components/workspace-selector/user-with-workspace-list/index.tsx index d66131e302f39..9ed211c19fa8e 100644 --- a/packages/frontend/core/src/components/workspace-selector/user-with-workspace-list/index.tsx +++ b/packages/frontend/core/src/components/workspace-selector/user-with-workspace-list/index.tsx @@ -27,7 +27,7 @@ export const SignInItem = () => { const t = useI18n(); const onClickSignIn = useCallback(() => { - track.$.navigationPanel.workspaceList.signIn(); + track.$.navigationPanel.workspaceList.requestSignIn(); setOpen(state => ({ ...state, openModal: true, diff --git a/packages/frontend/core/src/modules/cloud/services/auth.ts b/packages/frontend/core/src/modules/cloud/services/auth.ts index a011e13559f78..5dfc6a00685c2 100644 --- a/packages/frontend/core/src/modules/cloud/services/auth.ts +++ b/packages/frontend/core/src/modules/cloud/services/auth.ts @@ -146,7 +146,6 @@ export class AuthService extends Service { client: string, /** @deprecated*/ redirectUrl?: string ) { - track.$.$.auth.signIn({ method: 'oauth', provider }); try { const res = await this.fetchService.fetch('/api/oauth/preflight', { method: 'POST', diff --git a/packages/frontend/track/src/events.ts b/packages/frontend/track/src/events.ts index 61e092e4481bc..efe6ec90b3939 100644 --- a/packages/frontend/track/src/events.ts +++ b/packages/frontend/track/src/events.ts @@ -94,7 +94,12 @@ type ShareEvents = | 'copyShareLink' | 'openShareMenu' | 'share'; -type AuthEvents = 'signIn' | 'signInFail' | 'signedIn' | 'signOut'; +type AuthEvents = + | 'requestSignIn' + | 'signIn' + | 'signInFail' + | 'signedIn' + | 'signOut'; type AccountEvents = 'uploadAvatar' | 'removeAvatar' | 'updateUserName'; type PaymentEvents = | 'viewPlans' @@ -143,7 +148,7 @@ const PageEvents = { $: { $: { $: ['createWorkspace', 'checkout'], - auth: ['signIn', 'signedIn', 'signInFail', 'signOut'], + auth: ['requestSignIn', 'signIn', 'signedIn', 'signInFail', 'signOut'], }, sharePanel: { $: ['createShareLink', 'copyShareLink', 'export', 'open'], @@ -220,8 +225,8 @@ const PageEvents = { others: ['navigate'], importModal: ['open'], workspaceList: [ + 'requestSignIn', 'open', - 'signIn', 'createWorkspace', 'createDoc', 'openSettings', @@ -278,6 +283,7 @@ const PageEvents = { formatToolbar: ['bold'], pageRef: ['navigate'], toolbar: ['copyBlockToLink'], + aiActions: ['requestSignIn'], }, inlineDocInfo: { $: ['toggle'],