mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-10 17:17:55 +00:00
## Summary
Identifies Cloud auth users to Syft via the required `identify(email, {
source })` handoff so Syft enrichment reliably attaches to signup/login
users instead of relying only on GTM page-load capture.
## Changes
- **What**: Adds a cloud-only Syft telemetry provider that reads
`syftdata_source_id` from `remoteConfig`, lazy-loads the Syft SDK
(reusing an already-loaded GTM Syft client when present), and calls
`identify` with `source: 'signup'` or `source: 'login'` on auth and on
session restore. `trackUserLoggedIn()` dedupes against the email already
handled by `trackAuth()` so a fresh login is not identified twice.
- **Dependencies**: None.
## Review Focus
- Preserves the FE-945 startup-blocker fix: the constructor reads only
the `remoteConfig` ref (a plain reactive ref, not Pinia) and never
touches current-user state; the user-email lookup happens only in
`trackUserLoggedIn()`, after app/auth setup. The source id is present at
construction because `main.ts` awaits the anonymous
`refreshRemoteConfig` before `initTelemetry`, and a later authenticated
refresh is picked up reactively on the next `ensureSyftClient()` call.
- SDK loader is idempotent with the current GTM Syft tag during rollout
(one script per `SYFT_SRC`). On load failure it clears its own stub —
guarded by an identity check so it never evicts a real client another
loader installed — letting a subsequent call retry. Long-term cleanup is
to keep one loader path per surface.
- Acceptance should include staging Network verification for
`https://e2.sy-d.io/events` payloads containing an `identify` event for
Google, GitHub, and email auth.
Linear: GTM-168
123 lines
3.3 KiB
TypeScript
123 lines
3.3 KiB
TypeScript
declare const __COMFYUI_FRONTEND_VERSION__: string
|
|
declare const __COMFYUI_FRONTEND_COMMIT__: string
|
|
declare const __SENTRY_ENABLED__: boolean
|
|
declare const __SENTRY_DSN__: string
|
|
declare const __ALGOLIA_APP_ID__: string
|
|
declare const __ALGOLIA_API_KEY__: string
|
|
declare const __USE_PROD_CONFIG__: boolean
|
|
|
|
interface ImpactQueueFunction {
|
|
(...args: unknown[]): void
|
|
a?: unknown[][]
|
|
}
|
|
|
|
interface RewardfulGlobal {
|
|
referral?: string
|
|
affiliate?: { id?: string; token?: string; name?: string }
|
|
campaign?: { id?: string; name?: string }
|
|
}
|
|
|
|
interface RewardfulQueueFunction {
|
|
(method: 'ready', callback: () => void): void
|
|
(...args: unknown[]): void
|
|
q?: unknown[][]
|
|
}
|
|
|
|
type GtagGetFieldName = 'client_id' | 'session_id' | 'session_number'
|
|
|
|
interface GtagGetFieldValueMap {
|
|
client_id: string | number | undefined
|
|
session_id: string | number | undefined
|
|
session_number: string | number | undefined
|
|
}
|
|
|
|
interface GtagFunction {
|
|
<TField extends GtagGetFieldName>(
|
|
command: 'get',
|
|
targetId: string,
|
|
fieldName: TField,
|
|
callback: (value: GtagGetFieldValueMap[TField]) => void
|
|
): void
|
|
(...args: unknown[]): void
|
|
}
|
|
|
|
type SyftDataTraits = Record<string, string | number | null | undefined>
|
|
|
|
interface SyftDataPendingFetch {
|
|
args: unknown[]
|
|
resolve: (value: unknown) => void
|
|
reject: (reason?: unknown) => void
|
|
}
|
|
|
|
interface SyftDataClient {
|
|
identify(email: string, traits?: SyftDataTraits): void
|
|
signup(email: string, traits?: SyftDataTraits): void
|
|
track(event: string, traits?: SyftDataTraits): void
|
|
page(...args: unknown[]): void
|
|
q?: unknown[][]
|
|
fi?: SyftDataPendingFetch[]
|
|
fetchID?: (...args: unknown[]) => Promise<unknown>
|
|
}
|
|
|
|
/** Installed by the Syft UMD instead of SyftDataClient when telemetry is opted out */
|
|
interface SyftDisabledClient {
|
|
enable: () => void
|
|
}
|
|
|
|
interface Window {
|
|
__CONFIG__: {
|
|
gtm_container_id?: string
|
|
ga_measurement_id?: string
|
|
mixpanel_token?: string
|
|
posthog_project_token?: string
|
|
posthog_api_host?: string
|
|
posthog_config?: Record<string, unknown>
|
|
customer_io?: {
|
|
write_key?: string
|
|
site_id?: string
|
|
user_id?: string
|
|
}
|
|
require_whitelist?: boolean
|
|
subscription_required?: boolean
|
|
max_upload_size?: number
|
|
comfy_api_base_url?: string
|
|
comfy_platform_base_url?: string
|
|
firebase_config?: {
|
|
apiKey: string
|
|
authDomain: string
|
|
databaseURL?: string
|
|
projectId: string
|
|
storageBucket: string
|
|
messagingSenderId: string
|
|
appId: string
|
|
measurementId?: string
|
|
}
|
|
server_health_alert?: {
|
|
message: string
|
|
tooltip?: string
|
|
severity?: 'info' | 'warning' | 'error'
|
|
badge?: string
|
|
}
|
|
}
|
|
dataLayer?: Array<Record<string, unknown>>
|
|
gtag?: GtagFunction
|
|
syft?: SyftDataClient | SyftDisabledClient
|
|
syftc?: { sourceId?: string; enabled?: boolean }
|
|
ire_o?: string
|
|
ire?: ImpactQueueFunction
|
|
rewardful?: RewardfulQueueFunction
|
|
Rewardful?: RewardfulGlobal
|
|
}
|
|
|
|
interface Navigator {
|
|
/**
|
|
* Used by the electron API. This is a WICG non-standard API, but is guaranteed to exist in Electron.
|
|
* It is `undefined` in Firefox and older browsers.
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/windowControlsOverlay
|
|
*/
|
|
windowControlsOverlay?: {
|
|
/** When `true`, the window is using custom window style. */
|
|
visible: boolean
|
|
}
|
|
}
|