Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/website/e2e/minimax.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const CTA_HEADING = t('minimax.cta.heading', 'en')
const CTA_PRIMARY = t('minimax.cta.primaryCta', 'en')
const CLOUD_URL = externalLinks.cloud
const CLOUD_RUN_URL = minimaxLinks.cloudRun
const FAQS = minimaxPage.faq.items
const FAQS = minimaxPage.faq?.items ?? []
const FAQ_COUNT = FAQS.length
const FIRST_FAQ = FAQS[0]
const PRICING_HEADING = t('pricing.title', 'en')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const { stop } = useIntersectionObserver(
: t('modelLaunch.tagPremium', locale)
}}
</Badge>
<span class="text-primary-warm-gray text-xs">
<span class="text-xs text-primary-warm-gray">
{{ card.note[locale] }}
</span>
</div>
Expand All @@ -96,7 +96,7 @@ const { stop } = useIntersectionObserver(
rel="noopener"
:aria-label="card.name[locale]"
size="sm"
class="bg-primary-warm-gray hover:bg-primary-comfy-yellow rounded-xl text-primary-comfy-ink hover:text-primary-comfy-ink"
class="hover:bg-primary-comfy-yellow rounded-xl bg-primary-warm-gray text-primary-comfy-ink hover:text-primary-comfy-ink"
>
<ChevronRight class="size-5" :stroke-width="2" />
</IconButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const { locale = 'en', hero } = defineProps<{
class="bg-transparency-white-t4 pointer-events-none absolute top-6 right-6 flex size-12 items-center justify-center rounded-2xl backdrop-blur-sm lg:top-10 lg:right-10 lg:size-[70px] lg:rounded-3xl"
>
<span
class="text-primary-warm-white inline-block size-6 bg-current lg:size-[35px]"
class="inline-block size-6 bg-current text-primary-warm-white lg:size-[35px]"
:style="{
maskImage: `url(${hero.logoSrc})`,
maskSize: 'contain',
Expand Down Expand Up @@ -103,7 +103,7 @@ const { locale = 'en', hero } = defineProps<{
</Badge>
</div>

<p v-if="hero.footnoteKey" class="text-primary-warm-gray mt-6 text-xs">
<p v-if="hero.footnoteKey" class="mt-6 text-xs text-primary-warm-gray">
{{ t(hero.footnoteKey, locale) }}
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const pages: { name: string; page: ModelLaunchPage }[] = [
{ name: 'flux3', page: flux3Page }
]

describe.each(pages)('$name launch page config', ({ page }) => {
describe.for(pages)('$name launch page config', ({ page }) => {
it('gives every gallery card a unique id', () => {
const ids = page.gallery?.cards.map((card) => card.id) ?? []
expect(new Set(ids).size).toBe(ids.length)
Expand Down
8 changes: 6 additions & 2 deletions browser_tests/fixtures/data/cloudWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export const TEAM_BILLING_STATUS = {
billing_status: 'paid',
has_funds: true,
renewal_date: '2099-02-20T00:00:00Z',
team_credit_stop: null
team_credit_stop: null,
max_seats: 30,
occupied_seats: DEFAULT_TEAM_MEMBERS.length
} satisfies IngestBillingStatusResponse

export const ENDED_STANDARD_BILLING_STATUS = {
Expand All @@ -92,7 +94,9 @@ export const ENDED_STANDARD_BILLING_STATUS = {
subscription_duration: 'MONTHLY',
subscription_status: 'ended',
subscription_tier: 'STANDARD',
team_credit_stop: null
team_credit_stop: null,
max_seats: 1,
occupied_seats: 1
} satisfies IngestBillingStatusResponse & { billing_rail: 'stripe' }

export const TEAM_PRO_PLAN: Plan = {
Expand Down
8 changes: 6 additions & 2 deletions browser_tests/tests/dialogs/pricingTableDeepLink.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ const ACTIVE_TEAM_STATUS = {
id: 'team_700',
credits_monthly: 147_700,
stop_usd: 700
}
},
max_seats: 5,
occupied_seats: 1
} satisfies BillingStatusResponse

const ACTIVE_STANDARD_STATUS = {
Expand All @@ -111,7 +113,9 @@ const ACTIVE_STANDARD_STATUS = {
billing_status: 'paid',
has_funds: true,
renewal_date: '2099-02-20T00:00:00Z',
team_credit_stop: null
team_credit_stop: null,
max_seats: 1,
occupied_seats: 1
} satisfies BillingStatusResponse

const ACTIVE_CREATOR_STATUS = {
Expand Down
26 changes: 26 additions & 0 deletions src/platform/telemetry/initHostTelemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,30 @@ describe('initHostTelemetry', () => {
undefined
)
})

it('dispatches canonical billing events through the host registry', () => {
const capture = vi.fn()
window.__comfyDesktop2 = { isRemote: () => false, Telemetry: { capture } }
remoteConfig.value = { enable_telemetry: true }

initHostTelemetry()
useTelemetry()?.trackBillingEvent({
operation: 'subscription_checkout',
stage: 'succeeded',
outcome: 'success',
billing_op_id: 'op-1',
tier: 'pro'
})

expect(capture).toHaveBeenCalledWith(
TelemetryEvents.BILLING_SUBSCRIPTION_CHECKOUT_SUCCEEDED,
{
operation: 'subscription_checkout',
stage: 'succeeded',
outcome: 'success',
billing_op_id: 'op-1',
tier: 'pro'
}
)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ describe('DatadogRumTelemetryProvider', () => {
cycle: 'monthly',
checkout_type: 'new',
payment_intent_source: 'subscribe_to_run',
failure_category: 'provider_decline'
failure_category: 'provider_decline',
duration_ms: 4200
}

new DatadogRumTelemetryProvider().trackBillingEvent(event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,8 @@ describe('PostHogTelemetryProvider', () => {
stage: 'succeeded',
outcome: 'success',
billing_op_id: 'op-cancel',
operation_type: 'cancel'
operation_type: 'cancel',
duration_ms: 4200
},
TelemetryEvents.BILLING_OPERATION_SUCCEEDED
],
Expand Down
48 changes: 48 additions & 0 deletions src/platform/telemetry/providers/host/HostTelemetrySink.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,54 @@ describe('HostTelemetrySink', () => {
)
})

it('forwards canonical billing events using the derived name and payload', () => {
new HostTelemetrySink().trackBillingEvent({
operation: 'operation',
stage: 'succeeded',
outcome: 'success',
billing_op_id: 'op-1',
operation_type: 'subscription',
tier: 'pro',
cycle: 'monthly',
checkout_type: 'new'
})

expect(state.capture).toHaveBeenCalledExactlyOnceWith(
TelemetryEvents.BILLING_OPERATION_SUCCEEDED,
{
operation: 'operation',
stage: 'succeeded',
outcome: 'success',
billing_op_id: 'op-1',
operation_type: 'subscription',
tier: 'pro',
cycle: 'monthly',
checkout_type: 'new'
}
)
})

it('forwards billing failures with their failure category', () => {
new HostTelemetrySink().trackBillingEvent({
operation: 'topup',
stage: 'failed',
outcome: 'failure',
billing_op_id: 'op-2',
failure_category: 'provider_decline'
})

expect(state.capture).toHaveBeenCalledExactlyOnceWith(
TelemetryEvents.BILLING_TOPUP_FAILED,
{
operation: 'topup',
stage: 'failed',
outcome: 'failure',
billing_op_id: 'op-2',
failure_category: 'provider_decline'
}
)
})

it('does nothing when the host bridge is absent', () => {
delete window.__comfyDesktop2

Expand Down
15 changes: 14 additions & 1 deletion src/platform/telemetry/providers/host/HostTelemetrySink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
AddCreditsClickMetadata,
AuthMetadata,
BeginCheckoutMetadata,
BillingTelemetryEvent,
DefaultViewSetMetadata,
EnterLinearMetadata,
ExecutionErrorMetadata,
Expand Down Expand Up @@ -50,7 +51,12 @@ import type {
WorkflowImportMetadata,
WorkflowSavedMetadata
} from '../../types'
import { CANCELLATION_STAGE_EVENTS, TelemetryEvents } from '../../types'
import {
CANCELLATION_STAGE_EVENTS,
TelemetryEvents,
getBillingTelemetryEventName,
getBillingTelemetryEventPayload
} from '../../types'
import { normalizeSurveyResponses } from '../../utils/surveyNormalization'

type HostTelemetryProperties = Parameters<
Expand Down Expand Up @@ -121,6 +127,13 @@ export class HostTelemetrySink implements TelemetryProvider {
this.capture(TelemetryEvents.BEGIN_CHECKOUT, metadata)
}

trackBillingEvent(event: BillingTelemetryEvent): void {
this.capture(
getBillingTelemetryEventName(event),
getBillingTelemetryEventPayload(event)
)
}

trackMonthlySubscriptionSucceeded(
metadata?: SubscriptionSuccessMetadata
): void {
Expand Down
37 changes: 33 additions & 4 deletions src/platform/telemetry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,12 @@ type SubscriptionCheckoutBillingEvent = {
cycle?: BillingCycle
checkout_type?: SubscriptionCheckoutType
payment_intent_source?: PaymentIntentSource
} & (BillingSucceeded | BillingFailed)
/**
* Client-observed end-to-end wall time from this attempt's canonical
* `started` event through to this terminal event.
*/
duration_ms?: number
Comment thread
dante01yoon marked this conversation as resolved.
Resolved
} & (BillingStarted | BillingSucceeded | BillingFailed)

type BillingOperationBillingEvent = {
operation: 'operation'
Expand All @@ -774,7 +779,15 @@ type BillingOperationBillingEvent = {
cycle?: BillingCycle
checkout_type?: SubscriptionCheckoutType
payment_intent_source?: PaymentIntentSource
} & (BillingSucceeded | BillingFailed | BillingTimedOut)
/**
* Client-observed end-to-end wall time from this attempt's canonical
* `started` event through to this terminal event, including the
* initiating API call's latency (not just the poll-observation window).
* On `timeout` this is how long the client watched, not the operation's
* true duration.
*/
duration_ms?: number
} & (BillingStarted | BillingSucceeded | BillingFailed | BillingTimedOut)

type ResubscribeBillingEvent = {
operation: 'resubscribe'
Expand All @@ -785,13 +798,23 @@ type ResubscribeBillingEvent = {
type TopupBillingEvent = {
operation: 'topup'
billing_op_id?: string
} & (BillingSucceeded | BillingFailed)
/**
* Client-observed end-to-end wall time from this attempt's canonical
* `started` event through to this terminal event.
*/
duration_ms?: number
} & (BillingStarted | BillingSucceeded | BillingFailed)

type DowngradeToPersonalBillingEvent = {
operation: 'downgrade_to_personal'
member_removal_count: number
member_removal_failures: number
target_tier?: TierKey
/**
* Client-observed end-to-end wall time from this attempt's canonical
* `started` event through to this terminal event.
*/
duration_ms?: number
} & (BillingStarted | BillingSucceeded | BillingFailed)

export type BillingTelemetryEvent =
Expand Down Expand Up @@ -849,7 +872,9 @@ export function getBillingTelemetryEventPayload(event: BillingTelemetryEvent) {
member_removal_failures: event.member_removal_failures
}),
...('target_tier' in event &&
event.target_tier !== undefined && { target_tier: event.target_tier })
event.target_tier !== undefined && { target_tier: event.target_tier }),
...('duration_ms' in event &&
Comment thread
dante01yoon marked this conversation as resolved.
Resolved
event.duration_ms !== undefined && { duration_ms: event.duration_ms })
}
}

Expand Down Expand Up @@ -1025,15 +1050,19 @@ export const TelemetryEvents = {
BEGIN_CHECKOUT: 'begin_checkout',

// Canonical Billing Lifecycle
BILLING_SUBSCRIPTION_CHECKOUT_STARTED:
'billing.subscription_checkout.started',
BILLING_SUBSCRIPTION_CHECKOUT_SUCCEEDED:
'billing.subscription_checkout.succeeded',
BILLING_SUBSCRIPTION_CHECKOUT_FAILED: 'billing.subscription_checkout.failed',
BILLING_OPERATION_STARTED: 'billing.operation.started',
BILLING_OPERATION_SUCCEEDED: 'billing.operation.succeeded',
BILLING_OPERATION_FAILED: 'billing.operation.failed',
BILLING_OPERATION_TIMEOUT: 'billing.operation.timeout',
BILLING_RESUBSCRIBE_STARTED: 'billing.resubscribe.started',
BILLING_RESUBSCRIBE_SUCCEEDED: 'billing.resubscribe.succeeded',
BILLING_RESUBSCRIBE_FAILED: 'billing.resubscribe.failed',
BILLING_TOPUP_STARTED: 'billing.topup.started',
BILLING_TOPUP_SUCCEEDED: 'billing.topup.succeeded',
BILLING_TOPUP_FAILED: 'billing.topup.failed',
BILLING_DOWNGRADE_TO_PERSONAL_STARTED:
Expand Down
Loading
Loading