import { TurboModuleRegistry, type CodegenTypes, type TurboModule, } from 'react-native'; export type CookieSameSite = 'lax' | 'strict' | 'none'; export type Cookie = { name: string; value: string; path?: string; domain?: string; version?: string; expires?: string; secure?: boolean; httpOnly?: boolean; sameSite?: CookieSameSite; maxAge?: number; }; export type Cookies = Record; export type IOSCookieStore = 'foundation' | 'webKit'; export type CookieChangeEvent = { iosCookieStore: IOSCookieStore; }; export interface Spec extends TurboModule { readonly onCookieChange: CodegenTypes.EventEmitter; startCookieChangeObserving(): void; stopCookieChangeObserving(): void; setCookie( url: string, cookie: Cookie, useWebKit: boolean, validate: boolean ): Promise; setFromResponse(url: string, cookie: string): Promise; getCookies(url: string, useWebKit?: boolean): Promise; getAsArray(url: string, useWebKit?: boolean): Promise>; getCookieHeader(url: string, useWebKit?: boolean): Promise; /** * @deprecated Make the request with `fetch`/Axios and then call `get()`. * The native name is retained for upstream API compatibility. */ getFromResponse(url: string): Promise; clearAll(useWebKit?: boolean): Promise; clearAllStores(): Promise; flush(): Promise; removeSessionCookies( iosClearFoundation: boolean, iosClearWebKit: boolean ): Promise; getAll(useWebKit?: boolean): Promise; getAllAsArray(useWebKit?: boolean): Promise>; clearByName(url: string, name: string, useWebKit?: boolean): Promise; } export default TurboModuleRegistry.getEnforcing('CookieManager');