/** * Module variables. * @private */ declare const decode: typeof decodeURIComponent; declare const encode: typeof encodeURIComponent; declare const pairSplitRegExp: RegExp; /** * RegExp to match field-content in RFC 7230 sec 3.2 * * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] * field-vchar = VCHAR / obs-text * obs-text = %x80-FF */ declare const fieldContentRegExp: RegExp; /** * Try decoding a string using a decoding function. * * @param {string} str * @param {function} decode * @private */ declare function tryDecode(str: string, decode: ((encodedURIComponent: string) => string) | boolean): string; declare type CookieSameSite = 'no_restriction' | 'lax' | 'strict'; declare type CookieMatchType = 'equals'; interface Cookie { domain?: string; expires?: number; name: string; path?: string; secure?: boolean; sameSite?: CookieSameSite; value: string; } interface CookieStoreDeleteOptions { name: string; domain?: string; path?: string; } interface CookieStoreGetOptions { name?: string; url?: string; matchType?: CookieMatchType; } interface ParseOptions { decode?: boolean; } interface SerializeOptions { encode?: boolean; maxAge?: number; domain?: string; path?: string; expires?: Date; httpOnly?: boolean; secure?: boolean; sameSite?: boolean | string; } /** * Parse a cookie header. * * Parse the given cookie header string into an object * The object has the various cookies as keys(names) => values * * @param {string} str * @param {object} [options] * @return {object} * @private */ declare function parse(str: any, options?: ParseOptions): Cookie[]; /** * Serialize data into a cookie header. * * Serialize the a name value pair into a cookie string suitable for * http headers. An optional options object specified cookie parameters. * * serialize('foo', 'bar', { httpOnly: true }) * => "foo=bar; httpOnly" * * @param {string} name * @param {string} val * @param {object} [options] * @return {string} * @private */ declare function serialize(name: any, val: any, options?: SerializeOptions): string; declare function sanitizeOptions(arg: unknown): CookieStoreGetOptions | CookieStoreDeleteOptions; declare const CookieStore: { /** * Get a cookie. * * @param {string} name * @return {Promise} */ get(options?: CookieStoreGetOptions['name'] | CookieStoreGetOptions): Promise; /** * Set a cookie. * * @param {string} name * @param {string} value * @return {Promise} */ set(name: string, value: string): Promise; /** * Get multiple cookies. */ getAll(options?: CookieStoreGetOptions['name'] | CookieStoreGetOptions): Promise; /** * Remove a cookie. * * @param {String} name * @return {Promise} */ delete(options: CookieStoreDeleteOptions['name'] | CookieStoreDeleteOptions): Promise; }; interface Window { cookieStore: typeof CookieStore; }