'use client'; import { useEffect, useRef } from 'react'; import { useConsentContext } from './ConsentContext.js'; /** * Loads a third-party script ONLY after the visitor has granted consent for its * category — the GDPR-correct default for anything that isn't strictly * necessary. Renders nothing until then. Reacts live to the consent context, so * a script appears the moment the visitor accepts in the banner, with no reload. * * Use this for third parties that have NO Google Consent Mode of their own (Meta * Pixel, LinkedIn Insight, chat widgets, custom analytics). GA/GTM are better * handled by Consent Mode (the module's updateConsent already does that) — reach * for ConsentScript when a vendor can't be gated that way. * * Must be rendered inside . * * * * * * Note on withdrawal: once a script has loaded it keeps running for that page * (a