From c843a1757f24f1a9b5b4bd1a63d925340f088da4 Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Mon, 8 Apr 2024 19:39:43 +0530 Subject: [PATCH] fix: chat with us key handling --- web/components/workspace/help-section.tsx | 22 +++++++++++---------- web/lib/wrappers/crisp-wrapper.tsx | 24 +++++++++++------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/web/components/workspace/help-section.tsx b/web/components/workspace/help-section.tsx index 65500469e..680fd910b 100644 --- a/web/components/workspace/help-section.tsx +++ b/web/components/workspace/help-section.tsx @@ -142,16 +142,18 @@ export const WorkspaceHelpSection: React.FC = observe ))} - + {process.env.NEXT_PUBLIC_CRISP_ID && ( + + )}
Version: v{packageJson.version}
diff --git a/web/lib/wrappers/crisp-wrapper.tsx b/web/lib/wrappers/crisp-wrapper.tsx index 85f62ba3c..5ada03761 100644 --- a/web/lib/wrappers/crisp-wrapper.tsx +++ b/web/lib/wrappers/crisp-wrapper.tsx @@ -18,21 +18,19 @@ const CrispWrapper: FC = (props) => { const { children, user } = props; useEffect(() => { - if (typeof window && user?.email) { + if (typeof window && user?.email && process.env.NEXT_PUBLIC_CRISP_ID) { window.$crisp = []; window.CRISP_WEBSITE_ID = process.env.NEXT_PUBLIC_CRISP_ID; - if (window.CRISP_WEBSITE_ID != null) { - (function () { - const d = document; - const s = d.createElement("script"); - s.src = "https://client.crisp.chat/l.js"; - s.async = true; - d.getElementsByTagName("head")[0].appendChild(s); - window.$crisp.push(["set", "user:email", [user.email]]); - window.$crisp.push(["do", "chat:hide"]); - window.$crisp.push(["do", "chat:close"]); - })(); - } + (function () { + const d = document; + const s = d.createElement("script"); + s.src = "https://client.crisp.chat/l.js"; + s.async = true; + d.getElementsByTagName("head")[0].appendChild(s); + window.$crisp.push(["set", "user:email", [user.email]]); + window.$crisp.push(["do", "chat:hide"]); + window.$crisp.push(["do", "chat:close"]); + })(); } }, [user?.email]);