LCOV - code coverage report
Current view: top level - packages/account-core/src/core/billing - presentation.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 0.0 % 5 0
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : /**
       2              :  * The one place a billing operation is routed to the embedded challenge or
       3              :  * the hosted page. Hosts report whether they can drive an embedded challenge
       4              :  * at all; they never choose the route.
       5              :  *
       6              :  * Every rule fails toward hosted, which works on every rail and needs
       7              :  * nothing from the host but a way to open a URL.
       8              :  */
       9              : import type { BillingPresentation } from './operationState'
      10              : import type { BillingStatusData } from './status'
      11              : 
      12              : export interface PresentationRoutingInput {
      13              :   /** The host can drive an in-page challenge: its provider adapter and key are present. */
      14              :   readonly embeddedCheckoutAvailable: boolean
      15              :   readonly billingRail: BillingStatusData['billing_rail']
      16              :   /** A hosted continuation the command response already carried. */
      17              :   readonly hostedUrl?: string
      18              :   /** An in-page challenge the command response already carried. */
      19              :   readonly clientSecret?: string
      20              : }
      21              : 
      22            0 : export function selectBillingPresentation(
      23              :   input: PresentationRoutingInput
      24              : ): BillingPresentation {
      25              :   // The backend answered with a page and no challenge: it has decided.
      26            0 :   if (input.hostedUrl !== undefined && input.clientSecret === undefined) {
      27            0 :     return 'hosted'
      28              :   }
      29            0 :   if (!input.embeddedCheckoutAvailable) return 'hosted'
      30              :   // Only the workspace Stripe rail exposes payment intents to the client.
      31            0 :   return input.billingRail === 'stripe' ? 'embedded' : 'hosted'
      32              : }
        

Generated by: LCOV version 2.0-1