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, Usercentrics, 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.
A GA4 entry’s runtimeOwner leaves gtag.js to a GTM container or other loader, which must keep loading it; dataLayer, config and sink still start. A Usercentrics entry’s leaves the platform’s loader to it the same way, and a GTM owner’s container runs without waiting for consent.
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.
SSR and the first hydration render use a mode: "off" snapshot, which allows every category under native consent. Irreversible consent work must wait for client hydration, when the cookie-backed snapshot is available. The whole-site mode comes from data-replo-consent-mode 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. On Usercentrics a gated script names its service, or null for none, and only that service releases it. Omitting it means no one script: follow categories.
consent/types
@replohq/sdk/consent/types
ScriptRuntimeOwner
Another loader owns GA4’s gtag.js or the Usercentrics loader. On GA4 the SDK keeps dataLayer, the config call and the analytics sink but never injects gtag.js, so if the GTM container (or other code) stops loading it, events queue and never send. On Usercentrics the SDK still blocks scripts and follows the visitor’s answer, so if nothing loads it, gated scripts stay off.