1
- import React from "react" ;
1
+ import React , { useEffect } from "react" ;
2
2
import { Provider } from "react-redux" ;
3
3
import { Router , Redirect } from "@reach/router" ;
4
4
import MyTeamsList from "./routes/MyTeamsList" ;
@@ -21,6 +21,32 @@ import "./styles/main.vendor.scss";
21
21
import styles from "./styles/main.module.scss" ;
22
22
23
23
export default function Root ( ) {
24
+ useEffect ( ( ) => {
25
+ const script = window . document . createElement ( "script" ) ;
26
+ script . innerHTML = `
27
+ window._chatlio = window._chatlio || [];
28
+ ! function() {
29
+ var t = document.getElementById("chatlio-widget-embed");
30
+ if (t && window.ChatlioReact && _chatlio.init) return void _chatlio.init(t, ChatlioReact);
31
+ for (var e = function(t) {
32
+ return function() {
33
+ _chatlio.push([t].concat(arguments))
34
+ }
35
+ }, 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]));
36
+ var n = document.createElement("script"),
37
+ c = document.getElementsByTagName("script")[0];
38
+ 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");
39
+ n.setAttribute('data-widget-id', 'df6d6a4d-7193-4eaf-648b-4569f0e6b262');
40
+ c.parentNode.insertBefore(n, c);
41
+ }();
42
+ ` ;
43
+ window . document . body . appendChild ( script ) ;
44
+ return ( ) => {
45
+ window . document . body . removeChild (
46
+ document . querySelector ( "#chatlio-widget" )
47
+ ) ;
48
+ } ;
49
+ } , [ ] ) ;
24
50
return (
25
51
< div className = { styles [ "topcoder-micro-frontends-teams-app" ] } >
26
52
< Provider store = { store } >
0 commit comments