diff --git a/src/components/nav/Header.tsx b/src/components/nav/Header.tsx index 9d0e03b..3211fa1 100644 --- a/src/components/nav/Header.tsx +++ b/src/components/nav/Header.tsx @@ -6,7 +6,6 @@ import Link from 'components/Link' import SkipLink from 'components/Link/Skip' import MainNav from 'components/nav/MainNav' import DrawerNav from 'components/nav/DrawerNav' -import useDocWhizzScript from './useDocWhizzScript' const Nav = styled(FaencyNav)` position: fixed; @@ -121,7 +120,6 @@ const Header = ({ product }: { product?: string }) => { const [isDrawerOpen, setIsDrawerOpen] = useState(false) const [isHeaderScrolled, setHeaderScrolled] = useState(false) - useDocWhizzScript() const demoLink = useMemo(() => { if (product === 'hub') return 'https://info.traefik.io/traefik-hub-signup' diff --git a/src/components/nav/useDocWhizzScript.jsx b/src/components/nav/useDocWhizzScript.jsx deleted file mode 100644 index 1aa404c..0000000 --- a/src/components/nav/useDocWhizzScript.jsx +++ /dev/null @@ -1,36 +0,0 @@ -import { useEffect, useMemo } from 'react' - -const WHITELISTED_HOSTNAME = ['localhost', 'doc.traefik.io'] - -const useDocWhizzScript = () => { - const { pathname, hostname } = window.location - const product = pathname.split('/')[1] - - const clientId = useMemo(() => { - if (WHITELISTED_HOSTNAME.includes(hostname)) { - if (product === 'traefik') return process.env.REACT_APP_DOCWHIZZ_TRAEFIK_PROXY_USER_ID - if (product === 'traefik-enterprise') return process.env.REACT_APP_DOCWHIZZ_TRAEFIK_EE_USER_ID - - return null - } - return null - }, [hostname, product]) - - useEffect(() => { - if (!!clientId) { - const t = document.createElement('script') - t.setAttribute('data-id', 'docwhizz-script') - t.setAttribute('data-client', clientId) - t.crossOrigin = 'anonymous' - t.src = 'https://widget.docwhizz.com/index.js' - t.type = 'module' - document.head.appendChild(t) - - return () => { - document.head.removeChild(t) - } - } - }, [clientId]) -} - -export default useDocWhizzScript