Store API Overview

Core API entry points for JavaScript consent management — runtime creation, store access, and subscription patterns.

Entry Points

getOrCreateConsentRuntime(options)

The recommended entry point. Creates both a consent client and a Zustand vanilla store in one call, with built-in caching — calling it again with the same options returns the same instance.

Returns: { consentManager, consentStore, cacheKey }

  • consentManager — The low-level client instance
  • consentStore — Zustand vanilla store with all state and actions
  • cacheKey — Cache key for this runtime instance

configureConsentManager(options)

Lower-level API that creates only the client (no store). Use this when you need full control over store creation.

createConsentManagerStore(manager, options)

Creates a Zustand vanilla store from a client instance. Accepts all store configuration options.

Store Patterns

Reading State

Subscribing to Changes

Window Namespace

The store is also exposed on the window object for debugging and direct access:

The namespace defaults to c15tStore and can be configured via the namespace store option.

Options Reference

Loading…