mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 07:19:41 +00:00
cleanup
(cherry picked from commit d5750dfe6c2536dac3c1824dcbbc8c6e3fb74582)
This commit is contained in:
@@ -3,7 +3,6 @@ import type { OverridedMixpanel } from 'mixpanel-browser'
|
||||
import type {
|
||||
AuthMetadata,
|
||||
CreditTopupMetadata,
|
||||
CreditTopupSucceededMetadata,
|
||||
ExecutionContext,
|
||||
ExecutionErrorMetadata,
|
||||
ExecutionSuccessMetadata,
|
||||
@@ -302,8 +301,8 @@ export class MixpanelTelemetryProvider implements TelemetryProvider {
|
||||
)
|
||||
}
|
||||
|
||||
trackApiCreditTopupSucceeded(metadata: CreditTopupSucceededMetadata): void {
|
||||
this.trackEvent(TelemetryEvents.API_CREDIT_TOPUP_SUCCEEDED, metadata)
|
||||
trackApiCreditTopupSucceeded(): void {
|
||||
this.trackEvent(TelemetryEvents.API_CREDIT_TOPUP_SUCCEEDED)
|
||||
}
|
||||
trackRunButton(options?: { subscribe_to_run?: boolean }): void {
|
||||
if (this.isOnboardingMode) {
|
||||
|
||||
@@ -96,15 +96,6 @@ export interface CreditTopupMetadata {
|
||||
credit_amount: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Credit top-up succeeded metadata
|
||||
*/
|
||||
export interface CreditTopupSucceededMetadata {
|
||||
credit_amount: number
|
||||
payment_method?: string
|
||||
transaction_id?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Workflow import metadata
|
||||
*/
|
||||
@@ -188,7 +179,7 @@ export interface TelemetryProvider {
|
||||
trackMonthlySubscriptionSucceeded(): void
|
||||
trackAddApiCreditButtonClicked(): void
|
||||
trackApiCreditTopupButtonPurchaseClicked(amount: number): void
|
||||
trackApiCreditTopupSucceeded(metadata: CreditTopupSucceededMetadata): void
|
||||
trackApiCreditTopupSucceeded(): void
|
||||
trackRunButton(options?: { subscribe_to_run?: boolean }): void
|
||||
|
||||
// Survey flow events
|
||||
@@ -293,7 +284,6 @@ export type TelemetryEventProperties =
|
||||
| ExecutionErrorMetadata
|
||||
| ExecutionSuccessMetadata
|
||||
| CreditTopupMetadata
|
||||
| CreditTopupSucceededMetadata
|
||||
| WorkflowImportMetadata
|
||||
| TemplateLibraryMetadata
|
||||
| TemplateLibraryClosedMetadata
|
||||
|
||||
@@ -36,7 +36,6 @@ export const useCustomerEventsService = () => {
|
||||
const error = ref<string | null>(null)
|
||||
const { d } = useI18n()
|
||||
const telemetry = useTelemetry()
|
||||
const seenCreditAddedEventIds = new Set<string>()
|
||||
|
||||
const handleRequestError = (
|
||||
err: unknown,
|
||||
@@ -191,28 +190,9 @@ export const useCustomerEventsService = () => {
|
||||
{ errorContext, routeSpecificErrors }
|
||||
)
|
||||
|
||||
if (result?.events?.length) {
|
||||
for (const evt of result.events) {
|
||||
if (evt?.event_id && evt.event_type === EventType.CREDIT_ADDED) {
|
||||
if (!seenCreditAddedEventIds.has(evt.event_id)) {
|
||||
const amount = Number((evt as any)?.params?.amount)
|
||||
if (!Number.isNaN(amount) && amount > 0) {
|
||||
const creditAmountUsd = amount / 100
|
||||
const paymentMethod = (evt as any)?.params?.payment_method as
|
||||
| string
|
||||
| undefined
|
||||
const transactionId = (evt as any)?.params?.transaction_id as
|
||||
| string
|
||||
| undefined
|
||||
telemetry?.trackApiCreditTopupSucceeded({
|
||||
credit_amount: creditAmountUsd,
|
||||
payment_method: paymentMethod,
|
||||
transaction_id: transactionId
|
||||
})
|
||||
}
|
||||
seenCreditAddedEventIds.add(evt.event_id)
|
||||
}
|
||||
}
|
||||
for (const event of result?.events ?? []) {
|
||||
if (event?.event_type === EventType.CREDIT_ADDED) {
|
||||
telemetry?.trackApiCreditTopupSucceeded()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user