LCOV - code coverage report
Current view: top level - src/platform/auth/sso - ssoRequiredInline.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 13.3 % 15 2
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { onUnmounted, readonly, shallowRef } from 'vue'
       2              : 
       3              : import type {
       4              :   SsoRequiredTrigger,
       5              :   SsoSurface
       6              : } from '@comfyorg/account-core/telemetry'
       7              : 
       8              : import type { SsoRequiredContext } from '@/platform/auth/sso/ssoRequiredContext'
       9              : import {
      10              :   abandonSsoFlow,
      11              :   trackSsoRequiredShown
      12              : } from '@/platform/auth/sso/ssoTelemetry'
      13              : 
      14         2356 : const hostSurfaces: SsoSurface[] = []
      15         2356 : const notice = shallowRef<SsoRequiredContext>()
      16              : 
      17              : /**
      18              :  * Shows the refusal on the auth page that hosts it, in that page's brand
      19              :  * design system, instead of the app-styled shared dialog. False without one.
      20              :  */
      21            0 : export function presentInline(
      22              :   context: SsoRequiredContext,
      23              :   trigger: SsoRequiredTrigger
      24              : ): boolean {
      25            0 :   const surface = hostSurfaces.at(-1)
      26            0 :   if (!surface) return false
      27            0 :   if (!notice.value) trackSsoRequiredShown(surface, trigger, 'notice')
      28            0 :   notice.value = { ...notice.value, ...context }
      29            0 :   return true
      30              : }
      31              : 
      32              : /** Makes the calling auth page the place an SSO refusal is shown. */
      33            0 : export function useSsoRequiredInlineHost(surface: SsoSurface) {
      34            0 :   hostSurfaces.push(surface)
      35            0 :   onUnmounted(() => {
      36            0 :     hostSurfaces.splice(hostSurfaces.lastIndexOf(surface), 1)
      37            0 :     if (notice.value) abandonSsoFlow()
      38            0 :     notice.value = undefined
      39              :   })
      40            0 :   return { notice: readonly(notice) }
      41              : }
        

Generated by: LCOV version 2.0-1