import { ChatGptResponse, SendMessageParams } from '../types'; import type { RefObject } from 'react'; import type WebView from 'react-native-webview'; export declare const init: (webviewRef: RefObject['current']) => void; /** * Monkey patches fetch to intercept ChatGPT requests and read the JWT * It also injects 2 methods in the global scope to accomplish the following: * 1. Sending messages to the ChatGPT backend directly from the Webview and stream the response back to RN * 2. Removing the theme switcher button from the webview when GPT shows it's at full capacity * * Note: It'd be cool to define the function in normal JS and * use fn.toString() or`${fn}` and wrap it in a IIFE, * but babel messes up the transformations of async/await and breaks the injected code. */ export declare const createGlobalFunctionsInWebviewContext: () => string; /** * Calls a global function in the Webview window object to send a streamed message */ export declare function postStreamedMessage({ accessToken, message, messageId, conversationId, timeout, }: SendMessageParams): void; /** * Sends a normal message to the ChatGPT conversation backend endpoint */ export declare function postMessage({ accessToken, message, messageId, conversationId, timeout, onTokenExpired, }: SendMessageParams): Promise; export declare function reloadWebView(): void; /** * Removes the icon button in the top right corner of the webview screen when * ChatGPT is at full capacity */ export declare function removeThemeSwitcher(): Promise; /** * Checks if ChatGPT servers are overloaded and the normal login page is not accessible */ export declare function checkFullCapacity(): void; /** * Refreshes the webview and checks again if the login page is available */ export declare function retryLogin(): Promise; export declare function navigateToLoginPage(): void; //# sourceMappingURL=index.d.ts.map