From 3fedeb8816c8608c7565422fe522615a7c8db38d Mon Sep 17 00:00:00 2001 From: Himanshu Date: Fri, 19 Jun 2026 13:10:25 +0530 Subject: [PATCH] feat: add openWebView to ProviderContext --- providers/types.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/providers/types.ts b/providers/types.ts index d33591a..4b88de2 100644 --- a/providers/types.ts +++ b/providers/types.ts @@ -129,10 +129,46 @@ export interface ProviderType { }) => Promise; } +// Options to customize the WAF-solving WebView dialog. +// Options to customize the WAF-solving WebView dialog. +export interface OpenWebViewOptions { + // Title shown in the dialog header. + title?: string; + // Helper text shown under the title. + description?: string; + + headers?: Record; + + waitForCookie?: string; + + force?: boolean; + // If set, the dialog auto-cancels (rejects) after this many milliseconds. + timeoutMs?: number; +} + +// Result returned to the provider after the user solves the challenge. +export interface OpenWebViewResult { + // The page response after the challenge is solved: the rendered HTML of the + // document (document.documentElement.outerHTML). + data: string; + // Cookie header value, e.g. "cf_clearance=abc; other=def". + cookies: string; + // Cookies as a name -> value map. + cookieMap: Record; + // The User-Agent used by the WebView. + userAgent: string; + // The URL that was opened. + url: string; +} + export type ProviderContext = { axios: AxiosStatic; Aes: any; // AES encryption utility, if used getBaseUrl: (providerValue: string) => Promise; commonHeaders: Record; cheerio: typeof cheerio; + openWebView: ( + url: string, + options?: OpenWebViewOptions, + ) => Promise; };