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

fix: issue #460 #465

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/root.component.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useEffect } from "react";
import { Provider } from "react-redux";
import { Router, Redirect } from "@reach/router";
import MyTeamsList from "./routes/MyTeamsList";
Expand All @@ -21,6 +21,32 @@ 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 (
<div className={styles["topcoder-micro-frontends-teams-app"]}>
<Provider store={store}>
Expand Down