Skip to main content
ReploScripts injects managed scripts and gates each one on consent. You edit the script array, and never hand-write <script> tags for managed scripts.

consent/replo-scripts

@replohq/sdk/consent/replo-scripts

ReploScripts

The single registry component for all managed tracking scripts on the site. Authored once in app/layout.tsx; the agent/miniapp only edit the scripts array. Each entry registers itself and is gated + injected per consent. A consent-platform entry (Cookiebot, or a generic consentPlatform) takes over consent site-wide: scripts carry the platform’s blocking attributes, its loader injects after them so its startup scan sees the full set, and Replo’s own gates follow the platform instead of the native banner.
Also exported

consent/consent-store

@replohq/sdk/consent/consent-store

ConsentState

Framework-agnostic, cookie-backed consent store. Lives as a single module singleton so ReploScripts, the site’s consent banner, and AnalyticsProvider all share the same state regardless of where they sit in the React tree — no provider-ancestor relationship is required. Consent-dependent work (script injection, banner visibility) happens on the client (effects / post-mount), so there is no SSR/hydration mismatch. The client reads the (non-httpOnly) consent cookie directly, so no server seed is needed. The whole-site mode comes from the data-replo-consent-mode attribute on <html>.

isConsentAllowed

Whether a script requiring requiredConsent may load now. mode === "off" allows everything only under Replo’s banner; a delegated CMP answers instead.
Also exported

consent/types

@replohq/sdk/consent/types Exports