Line data Source code
1 : import type { AutoTopUpCardStatus } from '@comfyorg/account-core/billing'
2 : import { watch } from 'vue'
3 :
4 : import { useTelemetry } from '@comfyorg/telemetry'
5 :
6 5 : export function useAutoTopUpCardViewed(
7 : renderedStatus: () => AutoTopUpCardStatus | undefined
8 : ) {
9 5 : let reportedStatus: AutoTopUpCardStatus | undefined
10 :
11 5 : watch(
12 : renderedStatus,
13 : (status) => {
14 7 : if (!status || status === reportedStatus) return
15 2 : reportedStatus = status
16 7 : useTelemetry()?.trackBillingEvent({
17 : operation: 'auto_top_up_card',
18 : stage: 'viewed',
19 : outcome: 'pending',
20 : status
21 : })
22 : },
23 : { immediate: true }
24 : )
25 : }
|