Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions src/components/topbar/CurrentUserPopoverLegacy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
size="sm"
class="text-base-foreground"
data-testid="add-credits-button"
:data-dd-action-name="BILLING_ACTION_NAME.addCreditsPopover"
@click="handleTopUp"
>
{{ $t('subscription.addCredits') }}
Expand Down Expand Up @@ -157,6 +158,7 @@
</template>

<script setup lang="ts">
import { BILLING_ACTION_NAME } from '@/platform/telemetry/billingActionNames'
import { onClickOutside } from '@vueuse/core'
import { storeToRefs } from 'pinia'
import { computed, onMounted, ref, useTemplateRef } from 'vue'
Expand Down
9 changes: 9 additions & 0 deletions src/components/topbar/TopbarSubscribeButton.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ describe('TopbarSubscribeButton', () => {
expect(screen.getByTestId('topbar-subscribe-button')).toBeInTheDocument()
})

it('names its click for RUM independently of the button label', () => {
mockIsCloud.value = true
renderComponent()
expect(screen.getByRole('button')).toHaveAttribute(
'data-dd-action-name',
'billing.subscribe.topbar'
)
})

it('hides on non-cloud distribution', () => {
mockIsCloud.value = false
renderComponent()
Expand Down
2 changes: 2 additions & 0 deletions src/components/topbar/TopbarSubscribeButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
variant="subscribe"
size="sm"
data-testid="topbar-subscribe-button"
:data-dd-action-name="BILLING_ACTION_NAME.subscribeTopbar"
@click="handleClick"
>
{{ $t('subscription.subscribeForMore') }}
</Button>
</template>

<script setup lang="ts">
import { BILLING_ACTION_NAME } from '@/platform/telemetry/billingActionNames'
import Button from '@/components/ui/button/Button.vue'
import { useBillingContext } from '@/composables/billing/useBillingContext'
import { useSubscribeToRunPromptPresence } from '@/platform/cloud/subscription/composables/useSubscribeCtaPresence'
Expand Down
2 changes: 2 additions & 0 deletions src/platform/cloud/subscription/components/CreditsTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
'bg-interface-menu-component-surface-selected text-text-primary'
)
"
:data-dd-action-name="BILLING_ACTION_NAME.addCreditsTile"
@click="handleAddCredits"
>
{{ $t('subscription.addCredits') }}
Expand All @@ -209,6 +210,7 @@
</template>

<script setup lang="ts">
import { BILLING_ACTION_NAME } from '@/platform/telemetry/billingActionNames'
import { cn } from '@comfyorg/tailwind-utils'
import { useEventListener } from '@vueuse/core'
import { computed, onMounted } from 'vue'
Expand Down
2 changes: 2 additions & 0 deletions src/platform/cloud/subscription/components/PricingTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
: 'border-transparent bg-secondary-background hover:bg-secondary-background-hover focus:bg-secondary-background-selected'
)
"
:data-dd-action-name="planCtaActionName(tier.key)"
@click="() => handleSubscribe(tier.key)"
>
{{ getButtonLabel(tier) }}
Expand Down Expand Up @@ -231,6 +232,7 @@
</template>

<script setup lang="ts">
import { planCtaActionName } from '@/platform/telemetry/billingActionNames'
import { cn } from '@comfyorg/tailwind-utils'
import { storeToRefs } from 'pinia'
import Popover from '@/components/common/ImperativePopover.vue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
variant="subscribe"
size="unset"
data-testid="subscribe-to-run-button"
:data-dd-action-name="BILLING_ACTION_NAME.subscribeToRun"
@click="handleSubscribeToRun"
>
<i class="pi pi-lock" />
Expand All @@ -14,6 +15,7 @@
</template>

<script setup lang="ts">
import { BILLING_ACTION_NAME } from '@/platform/telemetry/billingActionNames'
import { registerSubscribeToRunPrompt } from '@/platform/cloud/subscription/composables/useSubscribeCtaPresence'

import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
Expand Down
20 changes: 20 additions & 0 deletions src/platform/telemetry/billingActionNames.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest'

import { BILLING_ACTION_NAME, planCtaActionName } from './billingActionNames'

describe('billing RUM action names', () => {
const names = [
...Object.values(BILLING_ACTION_NAME),
planCtaActionName('standard'),
planCtaActionName('creator'),
planCtaActionName('pro')
]

it('keeps every billing CTA under the prefix the frustration monitor matches', () => {
expect(names.every((name) => name.startsWith('billing.'))).toBe(true)
})

it('gives every billing CTA its own name', () => {
expect(new Set(names).size).toBe(names.length)
})
})
16 changes: 16 additions & 0 deletions src/platform/telemetry/billingActionNames.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** Stable RUM action names for billing CTAs; frustration monitors match the `billing.` prefix. */
export const BILLING_ACTION_NAME = {
addCreditsPopover: 'billing.add_credits.popover',
addCreditsTile: 'billing.add_credits.credits_tile',
addCreditsStatusBanner: 'billing.add_credits.status_banner',
topUpPrimary: 'billing.top_up.primary',
managePlanPopover: 'billing.manage_plan.popover',
upgradePlanPanel: 'billing.upgrade_plan.panel',
subscribeToRun: 'billing.subscribe.run_button',
subscribeTopbar: 'billing.subscribe.topbar',
subscribeTeamPlan: 'billing.plan_cta.team'
} as const

export function planCtaActionName(tierKey: string): string {
return `billing.plan_cta.${tierKey}`
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
size="sm"
class="text-base-foreground"
data-testid="add-credits-button"
:data-dd-action-name="BILLING_ACTION_NAME.addCreditsPopover"
@click="handleTopUp"
>
{{ $t('subscription.addCredits') }}
Expand Down Expand Up @@ -173,6 +174,7 @@
type="button"
class="flex w-full cursor-pointer appearance-none items-center gap-2 border-0 bg-transparent px-4 py-2 text-left hover:bg-secondary-background-hover focus-visible:bg-secondary-background-hover focus-visible:outline-none"
data-testid="manage-plan-menu-item"
:data-dd-action-name="BILLING_ACTION_NAME.managePlanPopover"
@click="handleOpenManagePlanSettings"
>
<i class="icon-[lucide--credit-card] size-4 text-muted-foreground" />
Expand Down Expand Up @@ -254,6 +256,7 @@
</template>

<script setup lang="ts">
import { BILLING_ACTION_NAME } from '@/platform/telemetry/billingActionNames'
import { onClickOutside } from '@vueuse/core'
import { storeToRefs } from 'pinia'
import { computed, ref, useTemplateRef } from 'vue'
Expand Down
2 changes: 2 additions & 0 deletions src/platform/workspace/components/PricingTableWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
: 'border-transparent bg-secondary-background hover:bg-secondary-background-hover focus:bg-secondary-background-selected'
)
"
:data-dd-action-name="planCtaActionName(tier.key)"
@click="() => handleSubscribe(tier.key)"
>
{{ getButtonLabel(tier) }}
Expand Down Expand Up @@ -271,6 +272,7 @@
</template>

<script setup lang="ts">
import { planCtaActionName } from '@/platform/telemetry/billingActionNames'
import { cn } from '@comfyorg/tailwind-utils'
import Popover from '@/components/common/ImperativePopover.vue'
import { computed, onMounted, ref } from 'vue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@
size="lg"
variant="secondary"
class="rounded-lg bg-interface-menu-component-surface-selected px-4 text-sm font-normal text-text-primary"
:data-dd-action-name="BILLING_ACTION_NAME.upgradePlanPanel"
@click="handleUpgrade"
>
{{
Expand Down Expand Up @@ -399,6 +400,7 @@
</template>

<script setup lang="ts">
import { BILLING_ACTION_NAME } from '@/platform/telemetry/billingActionNames'
import { useSettingsHeaderCollapse } from '@/platform/settings/composables/useSettingsHeaderCollapse'
import { cn } from '@comfyorg/tailwind-utils'
import { useTimestamp } from '@vueuse/core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
"
size="lg"
class="h-10 justify-center tabular-nums"
:data-dd-action-name="BILLING_ACTION_NAME.topUpPrimary"
@click="handlePrimaryAction"
>
{{
Expand Down Expand Up @@ -288,6 +289,7 @@
</template>

<script setup lang="ts">
import { BILLING_ACTION_NAME } from '@/platform/telemetry/billingActionNames'
import type { BillingOperationTerminal } from '@comfyorg/account-core/billing'
import {
getTopupAmountPreset,
Expand Down
6 changes: 6 additions & 0 deletions src/platform/workspace/components/UnifiedPricingTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
: 'border-transparent bg-secondary-background hover:bg-secondary-background-hover focus:bg-secondary-background-selected'
)
"
:data-dd-action-name="planCtaActionName(tier.key)"
@click="() => handleSubscribe(tier.key)"
>
{{ getButtonLabel(tier) }}
Expand Down Expand Up @@ -272,6 +273,7 @@
variant="inverted"
:disabled="isTeamButtonDisabled"
class="mt-auto h-10 w-full font-inter text-sm/normal font-bold"
:data-dd-action-name="BILLING_ACTION_NAME.subscribeTeamPlan"
@click="handleSubscribeTeam"
>
{{ teamButtonLabel }}
Expand Down Expand Up @@ -429,6 +431,10 @@
</template>

<script setup lang="ts">
import {
BILLING_ACTION_NAME,
planCtaActionName
} from '@/platform/telemetry/billingActionNames'
import { cn } from '@comfyorg/tailwind-utils'
import { computed, onMounted, ref, watch } from 'vue'
import { I18nT, useI18n } from 'vue-i18n'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-if="banner" class="@container">

Check failure on line 2 in src/platform/workspace/components/dialogs/settings/BillingStatusBanner.vue

View workflow job for this annotation

GitHub Actions / fallow / fallow

High cognitive complexity (high)

Function '<template>' is hard to understand (cognitive: 32, threshold: 15). • Severity: high • Cyclomatic: 13 • Cognitive: 32 • Lines: 384 High cognitive complexity means deeply nested or interleaved logic. Consider flattening control flow or extracting helper functions.
<div
role="status"
class="flex flex-col gap-3 rounded-2xl border border-interface-stroke/60 bg-base-background p-4 @2xl:flex-row @2xl:items-center @2xl:gap-2"
Expand Down Expand Up @@ -36,6 +36,7 @@
v-if="banner.action === 'addCredits'"
variant="secondary"
size="lg"
:data-dd-action-name="BILLING_ACTION_NAME.addCreditsStatusBanner"
@click="handleAddCredits"
>
{{ $t('workspacePanel.billingStatus.outOfCredits.addCredits') }}
Expand Down Expand Up @@ -88,6 +89,7 @@
</template>

<script setup lang="ts">
import { BILLING_ACTION_NAME } from '@/platform/telemetry/billingActionNames'
import { cn } from '@comfyorg/tailwind-utils'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
Expand Down
Loading