UNPKG

c15t

Version:

<div align="center"> <img src="https://c15t.com/logo-icon.png" alt="c15t Logo" width="64" height="64" /> <h1>c15t</h1> <p>Transform privacy consent from a compliance checkbox into a fully observable system</p>

65 lines 2.55 kB
import type { ConsentManagerCallbacks, ConsentManagerInterface, SetConsentRequestBody, SetConsentResponse, ShowConsentBannerResponse, VerifyConsentRequestBody, VerifyConsentResponse } from './client-interface'; import type { FetchOptions, ResponseContext } from './types'; /** * Configuration options for the Offline client */ export interface OfflineClientOptions { /** * Global callbacks for handling API responses */ callbacks?: ConsentManagerCallbacks; } /** * Offline implementation of the consent client interface. * Returns empty successful responses without making any HTTP requests. */ export declare class OfflineClient implements ConsentManagerInterface { /** * Callback functions for client events * @internal */ private callbacks?; /** * Creates a new Offline client instance. * * @param options - Configuration options for the client */ constructor(options?: OfflineClientOptions); /** * Returns the client's configured callbacks. * * @returns The callbacks object or undefined if no callbacks are configured */ getCallbacks(): ConsentManagerCallbacks | undefined; /** * Sets the client's callback functions. */ setCallbacks(callbacks: ConsentManagerCallbacks): void; /** * Creates a response context object for success cases. */ private createResponseContext; /** * Handles empty API response with callbacks. */ private handleOfflineResponse; /** * Checks if a consent banner should be shown. * In offline mode, will always return true unless localStorage has a value. */ showConsentBanner(options?: FetchOptions<ShowConsentBannerResponse>): Promise<ResponseContext<ShowConsentBannerResponse>>; /** * Sets consent preferences for a subject. * In offline mode, saves to localStorage to track that consent was set. */ setConsent(options?: FetchOptions<SetConsentResponse, SetConsentRequestBody>): Promise<ResponseContext<SetConsentResponse>>; /** * Verifies if valid consent exists. */ verifyConsent(options?: FetchOptions<VerifyConsentResponse, VerifyConsentRequestBody>): Promise<ResponseContext<VerifyConsentResponse>>; /** * Makes a custom API request to any endpoint. */ $fetch<ResponseType, BodyType = unknown, QueryType = unknown>(_path: string, options?: FetchOptions<ResponseType, BodyType, QueryType>): Promise<ResponseContext<ResponseType>>; } //# sourceMappingURL=client-offline.d.ts.map