Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit a6f9fc7

Browse files
authored
Merge pull request #465 from yoution/issue-460
fix: issue #460
2 parents f0199f7 + cf97c91 commit a6f9fc7

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/root.component.jsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useEffect } from "react";
22
import { Provider } from "react-redux";
33
import { Router, Redirect } from "@reach/router";
44
import MyTeamsList from "./routes/MyTeamsList";
@@ -21,6 +21,32 @@ import "./styles/main.vendor.scss";
2121
import styles from "./styles/main.module.scss";
2222

2323
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+
}, []);
2450
return (
2551
<div className={styles["topcoder-micro-frontends-teams-app"]}>
2652
<Provider store={store}>

0 commit comments

Comments
 (0)