import type { StoredConsent, ConsentConfig, ConsentStorage, KVStorageOptions } from "./types"; /** * Internal options for fetchWithRetry */ interface RetryOptions { maxRetries: number; onRateLimited?: (retryAfter: number | null, attempt: number) => void; } /** * Get cookie value by name */ export declare function getCookie(name: string): string | null; /** * Set cookie with options */ export declare function setCookie(name: string, value: string, options?: { expiry?: number; domain?: string; path?: string; sameSite?: "Strict" | "Lax" | "None"; secure?: boolean; }): void; /** * Delete cookie */ export declare function deleteCookie(name: string, path?: string, domain?: string): void; /** * Get stored consent from cookie */ export declare function getStoredConsent(config?: Partial): StoredConsent | null; /** * Store consent in cookie */ export declare function storeConsent(consent: Omit, config?: Partial): void; /** * Clear stored consent */ export declare function clearConsent(config?: Partial): void; /** * Get consent UID from cookie (used for KV re-identification) */ export declare function getConsentUid(): string | null; /** * Set consent UID cookie for re-identification */ export declare function setConsentUid(uid: string, config?: Partial): void; /** * Clear consent UID cookie */ export declare function clearConsentUid(config?: Partial): void; /** * Fetch consent from remote KV storage * * @param storageUrl - Base URL of the KV storage API * @param uid - User ID to fetch consent for * @param version - Expected consent version (returns null if mismatch) * @param retryOptions - Optional retry configuration for rate limiting */ export declare function fetchRemoteConsent(storageUrl: string, uid: string, version: string, retryOptions?: RetryOptions): Promise; /** * Push consent to remote KV storage. Returns the user ID (generated by worker if not provided). * * @param storageUrl - Base URL of the KV storage API * @param uid - User ID (null for new users - worker will generate) * @param consent - Consent data to store * @param retryOptions - Optional retry configuration for rate limiting */ export declare function pushRemoteConsent(storageUrl: string, uid: string | null, consent: StoredConsent, retryOptions?: RetryOptions): Promise; /** * Create a ConsentStorage backed by a Cloudflare KV Worker * (vue-privacy-worker compatible API). * * Supports automatic retry with exponential backoff on 429 rate limit responses. * * @param url - Base URL of the KV storage API (e.g., '/api/consent') * @param options - Optional configuration for rate limiting behavior * * @example * ```ts * import { createKVStorage } from '@structured-world/vue-privacy'; * * // Basic usage * const manager = createConsentManager({ * gaId: 'G-XXXXXXXXXX', * storage: createKVStorage('/api/consent'), * }); * * // With rate limit callback * const storage = createKVStorage('/api/consent', { * maxRetries: 5, * onRateLimited: (retryAfter, attempt) => { * console.log(`Rate limited, retry ${attempt}. Wait: ${retryAfter ?? 'exponential'}s`); * }, * }); * ``` */ export declare function createKVStorage(url: string, options?: KVStorageOptions): ConsentStorage; export {};