LCOV - code coverage report
Current view: top level - packages/account-core/src - turnstileScript.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 33.3 % 3 1
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { createScriptLoader } from './loadExternalScript'
       2              : 
       3              : const TURNSTILE_SRC =
       4              :   'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit'
       5              : 
       6              : export interface TurnstileRenderOptions {
       7              :   sitekey: string
       8              :   theme?: 'light' | 'dark' | 'auto'
       9              :   callback?: (token: string) => void
      10              :   'expired-callback'?: () => void
      11              :   'error-callback'?: () => void
      12              : }
      13              : 
      14              : export interface TurnstileApi {
      15              :   render: (
      16              :     container: string | HTMLElement,
      17              :     options: TurnstileRenderOptions
      18              :   ) => string
      19              :   reset: (widgetId?: string) => void
      20              :   remove: (widgetId: string) => void
      21              : }
      22              : 
      23              : declare global {
      24              :   interface Window {
      25              :     turnstile?: TurnstileApi
      26              :   }
      27              : }
      28              : 
      29           13 : const loadTurnstileScript = createScriptLoader(
      30              :   TURNSTILE_SRC,
      31              :   () => window.turnstile ?? null
      32              : )
      33              : 
      34            0 : export function loadTurnstile(): Promise<TurnstileApi> {
      35            0 :   return loadTurnstileScript()
      36              : }
        

Generated by: LCOV version 2.0-1