LCOV - code coverage report
Current view: top level - src/platform/telemetry/utils - paymentIntentSource.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 66.7 % 6 4
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { CheckoutEntrySource } from '@comfyorg/account-core/billing'
       2              : 
       3              : import type {
       4              :   AddCreditsClickMetadata,
       5              :   PaymentIntentSource
       6              : } from '@comfyorg/telemetry/types'
       7              : 
       8              : type AddCreditsClickSource = AddCreditsClickMetadata['source']
       9              : 
      10         2356 : const FROM_ADD_CREDITS_CLICK = {
      11              :   credits_panel: 'settings_billing_panel',
      12              :   avatar_menu: 'avatar_menu_plans',
      13              :   settings_billing_panel: 'settings_billing_panel',
      14              :   deep_link: 'deep_link',
      15              :   agent_paywall: 'agent_paywall'
      16              : } as const satisfies Record<AddCreditsClickSource, PaymentIntentSource>
      17              : 
      18         2356 : const FROM_JOURNEY_ENTRY: ReadonlyMap<
      19              :   CheckoutEntrySource,
      20              :   PaymentIntentSource
      21              : > = new Map([
      22              :   ['deep_link', 'deep_link'],
      23              :   ['settings_billing', 'settings_billing_panel'],
      24              :   ['agent_paywall', 'agent_paywall']
      25              : ])
      26              : 
      27              : /** The one source list's value for the control a customer clicked to add credits. */
      28            4 : export function paymentIntentSourceForAddCreditsClick(
      29              :   source: AddCreditsClickSource
      30              : ): PaymentIntentSource {
      31            4 :   return FROM_ADD_CREDITS_CLICK[source]
      32              : }
      33              : 
      34              : /**
      35              :  * The one source list's value for a checkout journey's entry source, when the
      36              :  * entry source names one. `pricing`, `recovery`, `other` and `unknown` say
      37              :  * where the customer was, not which control they used.
      38              :  */
      39            0 : export function paymentIntentSourceForJourneyEntry(
      40              :   source: CheckoutEntrySource
      41              : ): PaymentIntentSource | undefined {
      42            0 :   return FROM_JOURNEY_ENTRY.get(source)
      43              : }
        

Generated by: LCOV version 2.0-1