[backport cloud/1.41] fix: use UI flow context for sign_up vs login telemetry (#10399)

Backport of #10388 to `cloud/1.41`

Automatically created by backport workflow.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-10399-backport-cloud-1-41-fix-use-UI-flow-context-for-sign_up-vs-login-telemetry-32c6d73d3650810e89afccd7e6b85a3b)
by [Unito](https://www.unito.io)

Co-authored-by: Christian Byrne <cbyrne@comfy.org>
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Comfy Org PR Bot
2026-03-24 02:41:59 +09:00
committed by GitHub
parent 9f470b22c0
commit b0da48e168
4 changed files with 24 additions and 19 deletions

View File

@@ -183,13 +183,13 @@ const toggleState = () => {
}
const signInWithGoogle = async () => {
if (await authActions.signInWithGoogle()) {
if (await authActions.signInWithGoogle({ isNewUser: !isSignIn.value })) {
onSuccess()
}
}
const signInWithGithub = async () => {
if (await authActions.signInWithGithub()) {
if (await authActions.signInWithGithub({ isNewUser: !isSignIn.value })) {
onSuccess()
}
}

View File

@@ -140,13 +140,19 @@ export const useFirebaseAuthActions = () => {
return result
}, reportError)
const signInWithGoogle = wrapWithErrorHandlingAsync(async () => {
return await authStore.loginWithGoogle()
}, reportError)
const signInWithGoogle = wrapWithErrorHandlingAsync(
async (options?: { isNewUser?: boolean }) => {
return await authStore.loginWithGoogle(options)
},
reportError
)
const signInWithGithub = wrapWithErrorHandlingAsync(async () => {
return await authStore.loginWithGithub()
}, reportError)
const signInWithGithub = wrapWithErrorHandlingAsync(
async (options?: { isNewUser?: boolean }) => {
return await authStore.loginWithGithub(options)
},
reportError
)
const signInWithEmail = wrapWithErrorHandlingAsync(
async (email: string, password: string) => {

View File

@@ -182,14 +182,14 @@ const onSuccess = async () => {
const signInWithGoogle = async () => {
authError.value = ''
if (await authActions.signInWithGoogle()) {
if (await authActions.signInWithGoogle({ isNewUser: true })) {
await onSuccess()
}
}
const signInWithGithub = async () => {
authError.value = ''
if (await authActions.signInWithGithub()) {
if (await authActions.signInWithGithub({ isNewUser: true })) {
await onSuccess()
}
}

View File

@@ -5,7 +5,6 @@ import {
GoogleAuthProvider,
browserLocalPersistence,
createUserWithEmailAndPassword,
getAdditionalUserInfo,
onAuthStateChanged,
onIdTokenChanged,
sendPasswordResetEmail,
@@ -378,18 +377,18 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
return result
}
const loginWithGoogle = async (): Promise<UserCredential> => {
const loginWithGoogle = async (options?: {
isNewUser?: boolean
}): Promise<UserCredential> => {
const result = await executeAuthAction(
(authInstance) => signInWithPopup(authInstance, googleProvider),
{ createCustomer: true }
)
if (isCloud) {
const additionalUserInfo = getAdditionalUserInfo(result)
const isNewUser = additionalUserInfo?.isNewUser ?? false
useTelemetry()?.trackAuth({
method: 'google',
is_new_user: isNewUser,
is_new_user: options?.isNewUser ?? false,
user_id: result.user.uid
})
}
@@ -397,18 +396,18 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
return result
}
const loginWithGithub = async (): Promise<UserCredential> => {
const loginWithGithub = async (options?: {
isNewUser?: boolean
}): Promise<UserCredential> => {
const result = await executeAuthAction(
(authInstance) => signInWithPopup(authInstance, githubProvider),
{ createCustomer: true }
)
if (isCloud) {
const additionalUserInfo = getAdditionalUserInfo(result)
const isNewUser = additionalUserInfo?.isNewUser ?? false
useTelemetry()?.trackAuth({
method: 'github',
is_new_user: isNewUser,
is_new_user: options?.isNewUser ?? false,
user_id: result.user.uid
})
}