UNPKG

c15t

Version:

Headless JavaScript consent management platform for cookie banners, privacy preferences, consent storage, and script gating.

38 lines (37 loc) 1.57 kB
/** * Types for the consent manager initialization. * * @packageDocumentation */ import type { TranslationConfig } from '@c15t/translations'; import type { StoreApi } from 'zustand/vanilla'; import type { ConsentManagerInterface } from '../../client/client-factory'; import type { IABConfig } from '../iab-tcf/types'; import type { ConsentStoreState, SSRInitialData } from '../../store/type'; import type { ConsentBannerResponse } from '../../types/compliance'; export type { ConsentBannerResponse }; /** * Configuration for initializing the consent manager. */ export interface InitConsentManagerConfig { /** The consent manager client for API calls */ manager: ConsentManagerInterface; /** SSR-prefetched data (init + optional GVL) */ ssrData?: Promise<SSRInitialData | undefined>; /** Canonical backend URL for hosted-mode request matching */ backendURL?: string; /** Effective client credentials mode for hosted-mode request matching */ requestCredentials?: RequestCredentials; /** Initial translation configuration to merge with server response */ initialTranslationConfig?: Partial<TranslationConfig>; /** IAB TCF configuration (when provided, IAB manager is lazily created) */ iabConfig?: IABConfig; /** Store state getter */ get: StoreApi<ConsentStoreState>['getState']; /** Store state setter */ set: StoreApi<ConsentStoreState>['setState']; } /** * Subset of config for functions that only need store access. */ export type StoreAccess = Pick<InitConsentManagerConfig, 'get' | 'set'>;