analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
48 lines • 1.36 kB
TypeScript
/**
* Options for writing a cookie
*/
export interface CookieOptions {
/**
* Cookie Domain attribute; omitted when undefined (host-only cookie)
*/
domain?: string;
/**
* Cookie Path attribute (default '/')
*/
path?: string;
/**
* Max-Age in seconds
*/
maxAge?: number;
/**
* SameSite attribute (default 'Lax')
*/
sameSite?: 'Lax' | 'Strict' | 'None';
/**
* Adds the Secure attribute when true
*/
secure?: boolean;
}
/**
* Reads a cookie value by name
*
* @param name - The cookie name
* @returns The decoded cookie value, or null when absent or malformed
*/
export declare const getCookie: (name: string) => string | null;
/**
* Writes a cookie with the given options
*
* @param name - The cookie name
* @param value - The cookie value (URL-encoded before writing)
* @param options - Cookie attributes (domain, path, maxAge, sameSite, secure)
*/
export declare const setCookie: (name: string, value: string, options?: CookieOptions) => void;
/**
* Removes a cookie by expiring it immediately
*
* @param name - The cookie name
* @param options - Domain and path must match the cookie being removed
*/
export declare const removeCookie: (name: string, options?: Pick<CookieOptions, "domain" | "path">) => void;
//# sourceMappingURL=cookieUtils.d.ts.map