diff --git a/src/root.component.jsx b/src/root.component.jsx index 509befe..369d0bb 100644 --- a/src/root.component.jsx +++ b/src/root.component.jsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import React from "react"; import { Provider } from "react-redux"; import { Router, Redirect } from "@reach/router"; import MyTeamsList from "./routes/MyTeamsList"; @@ -21,32 +21,6 @@ import "./styles/main.vendor.scss"; import styles from "./styles/main.module.scss"; export default function Root() { - useEffect(() => { - const script = window.document.createElement("script"); - script.innerHTML = ` - window._chatlio = window._chatlio || []; - ! function() { - var t = document.getElementById("chatlio-widget-embed"); - if (t && window.ChatlioReact && _chatlio.init) return void _chatlio.init(t, ChatlioReact); - for (var e = function(t) { - return function() { - _chatlio.push([t].concat(arguments)) - } - }, i = ["configure", "identify", "track", "show", "hide", "isShown", "isOnline", "page", "open", "showOrHide"], a = 0; a < i.length; a++) _chatlio[i[a]] || (_chatlio[i[a]] = e(i[a])); - var n = document.createElement("script"), - c = document.getElementsByTagName("script")[0]; - n.id = "chatlio-widget-embed", n.src = "https://w.chatlio.com/w.chatlio-widget.js", n.async = !0, n.setAttribute("data-embed-version", "2.3"); - n.setAttribute('data-widget-id', 'df6d6a4d-7193-4eaf-648b-4569f0e6b262'); - c.parentNode.insertBefore(n, c); - }(); - `; - window.document.body.appendChild(script); - return () => { - window.document.body.removeChild( - document.querySelector("#chatlio-widget") - ); - }; - }, []); return (
diff --git a/src/routes/CreateNewTeam/index.jsx b/src/routes/CreateNewTeam/index.jsx index d65d24b..fd30406 100644 --- a/src/routes/CreateNewTeam/index.jsx +++ b/src/routes/CreateNewTeam/index.jsx @@ -3,12 +3,38 @@ * * Container for Create New Team subroutes */ -import React from "react"; +import React, { useEffect } from "react"; import { useSelector } from "react-redux"; import CustomerScroll from "components/CustomerScroll"; import "./styles.module.scss"; const CreateNewTeam = (props) => { + useEffect(() => { + const script = window.document.createElement("script"); + script.innerHTML = ` + window._chatlio = window._chatlio || []; + ! function() { + var t = document.getElementById("chatlio-widget-embed"); + if (t && window.ChatlioReact && _chatlio.init) return void _chatlio.init(t, ChatlioReact); + for (var e = function(t) { + return function() { + _chatlio.push([t].concat(arguments)) + } + }, i = ["configure", "identify", "track", "show", "hide", "isShown", "isOnline", "page", "open", "showOrHide"], a = 0; a < i.length; a++) _chatlio[i[a]] || (_chatlio[i[a]] = e(i[a])); + var n = document.createElement("script"), + c = document.getElementsByTagName("script")[0]; + n.id = "chatlio-widget-embed", n.src = "https://w.chatlio.com/w.chatlio-widget.js", n.async = !0, n.setAttribute("data-embed-version", "2.3"); + n.setAttribute('data-widget-id', 'df6d6a4d-7193-4eaf-648b-4569f0e6b262'); + c.parentNode.insertBefore(n, c); + }(); + `; + window.document.body.appendChild(script); + return () => { + window.document.body.removeChild( + document.querySelector("#chatlio-widget") + ); + }; + }, []); const { isLoading } = useSelector((state) => state.searchedRoles); return (