Restore default SkipAgent enabling outside docs
cgen-7baec6e4c0254f34ae1dbfb18cd34612
This commit is contained in:
parent
b3ef9f52d3
commit
2a94352d3d
1 changed files with 3 additions and 9 deletions
|
|
@ -9,21 +9,15 @@ const SkipAgentController = () => {
|
|||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
// Require an explicit opt-in to enable third-party agents.
|
||||
// Set `window.__AETHEX_ENABLE_SKIP_AGENT = true` in the browser console or a hosting config
|
||||
// to opt into loading partner SDKs outside of /docs pages.
|
||||
const optedIn = typeof window !== "undefined" && (window as any).__AETHEX_ENABLE_SKIP_AGENT === true;
|
||||
const onDocs = location.pathname.startsWith(DOCS_PATH_PREFIX);
|
||||
|
||||
if (optedIn && !onDocs) {
|
||||
void setSkipAgentActive(true);
|
||||
} else {
|
||||
// Ensure the agent is disabled by default or on docs routes
|
||||
if (onDocs) {
|
||||
disableSkipAgent();
|
||||
} else {
|
||||
void setSkipAgentActive(true);
|
||||
}
|
||||
|
||||
return () => {
|
||||
// Keep the agent disabled on unmount to avoid leaks across route changes
|
||||
disableSkipAgent();
|
||||
};
|
||||
}, [location.pathname]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue