mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-05 05:00:03 +00:00
Revert/undo-788f5083-ef8657bb (#8353)
This reverts the addition of GTM for 1.38, as it was still present in the built files. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8353-Revert-undo-788f5083-ef8657bb-2f66d73d365081818d43fcaab220a4ef) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -26,7 +26,6 @@ import { t } from '@/i18n'
|
||||
import { WORKSPACE_STORAGE_KEYS } from '@/platform/auth/workspace/workspaceConstants'
|
||||
import { isCloud } from '@/platform/distribution/types'
|
||||
import { useTelemetry } from '@/platform/telemetry'
|
||||
import { pushDataLayerEvent as pushDataLayerEventBase } from '@/platform/telemetry/gtm'
|
||||
import { useDialogService } from '@/services/dialogService'
|
||||
import { useApiKeyAuthStore } from '@/stores/apiKeyAuthStore'
|
||||
import type { AuthHeader } from '@/types/authTypes'
|
||||
@@ -82,42 +81,6 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
|
||||
const buildApiUrl = (path: string) => `${getComfyApiBaseUrl()}${path}`
|
||||
|
||||
function pushDataLayerEvent(event: Record<string, unknown>): void {
|
||||
if (!isCloud || typeof window === 'undefined') return
|
||||
|
||||
try {
|
||||
pushDataLayerEventBase(event)
|
||||
} catch (error) {
|
||||
console.warn('Failed to push data layer event', error)
|
||||
}
|
||||
}
|
||||
|
||||
async function hashSha256(value: string): Promise<string | undefined> {
|
||||
if (typeof crypto === 'undefined' || !crypto.subtle) return
|
||||
if (typeof TextEncoder === 'undefined') return
|
||||
const data = new TextEncoder().encode(value)
|
||||
const hash = await crypto.subtle.digest('SHA-256', data)
|
||||
return Array.from(new Uint8Array(hash))
|
||||
.map((b) => b.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
}
|
||||
|
||||
async function trackSignUp(method: 'email' | 'google' | 'github') {
|
||||
if (!isCloud || typeof window === 'undefined') return
|
||||
|
||||
try {
|
||||
const userId = currentUser.value?.uid
|
||||
const hashedUserId = userId ? await hashSha256(userId) : undefined
|
||||
pushDataLayerEvent({
|
||||
event: 'sign_up',
|
||||
method,
|
||||
...(hashedUserId ? { user_id: hashedUserId } : {})
|
||||
})
|
||||
} catch (error) {
|
||||
console.warn('Failed to track sign up', error)
|
||||
}
|
||||
}
|
||||
|
||||
// Providers
|
||||
const googleProvider = new GoogleAuthProvider()
|
||||
googleProvider.addScope('email')
|
||||
@@ -384,7 +347,6 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
method: 'email',
|
||||
is_new_user: true
|
||||
})
|
||||
await trackSignUp('email')
|
||||
}
|
||||
|
||||
return result
|
||||
@@ -403,9 +365,6 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
method: 'google',
|
||||
is_new_user: isNewUser
|
||||
})
|
||||
if (isNewUser) {
|
||||
await trackSignUp('google')
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
@@ -424,9 +383,6 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
method: 'github',
|
||||
is_new_user: isNewUser
|
||||
})
|
||||
if (isNewUser) {
|
||||
await trackSignUp('github')
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user