The chrome.cookies.set details (url, name, value, etc.)
A promise that resolves once the write has been attempted
await setCookie({ url: "https://shop.es-drei.de", name: "currency", value: "2" });
export async function setCookie(details: chrome.cookies.SetDetails): Promise<void> {
if (!isCookiesApiAvailable()) {
logger.warn("chrome.cookies unavailable; skipping cookie set", { details });
return;
}
try {
await chrome.cookies.set(details);
} catch (error: unknown) {
logger.warn("Failed to set cookie", { details, error });
}
}
Writes a cookie into the browser cookie jar so the storefront returns it on subsequent requests made with
credentials: "include". No-ops with a warning when the API is unavailable, and swallows write failures (logging them) so a failed seed never aborts the surrounding query.