forked from github/plane
fix: chat with us key handling
This commit is contained in:
parent
2ea6d70fac
commit
c843a1757f
@ -142,16 +142,18 @@ export const WorkspaceHelpSection: React.FC<WorkspaceHelpSectionProps> = observe
|
|||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
<button
|
{process.env.NEXT_PUBLIC_CRISP_ID && (
|
||||||
type="button"
|
<button
|
||||||
onClick={handleCrispWindowShow}
|
type="button"
|
||||||
className="flex w-full items-center gap-x-2 rounded px-2 py-1 text-xs hover:bg-custom-background-80"
|
onClick={handleCrispWindowShow}
|
||||||
>
|
className="flex w-full items-center gap-x-2 rounded px-2 py-1 text-xs hover:bg-custom-background-80"
|
||||||
<div className="grid flex-shrink-0 place-items-center">
|
>
|
||||||
<MessagesSquare className="h-3.5 w-3.5 text-custom-text-200" />
|
<div className="grid flex-shrink-0 place-items-center">
|
||||||
</div>
|
<MessagesSquare className="h-3.5 w-3.5 text-custom-text-200" />
|
||||||
<span className="text-xs">Chat with us</span>
|
</div>
|
||||||
</button>
|
<span className="text-xs">Chat with us</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="px-2 pb-1 pt-2 text-[10px]">Version: v{packageJson.version}</div>
|
<div className="px-2 pb-1 pt-2 text-[10px]">Version: v{packageJson.version}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,21 +18,19 @@ const CrispWrapper: FC<ICrispWrapper> = (props) => {
|
|||||||
const { children, user } = props;
|
const { children, user } = props;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof window && user?.email) {
|
if (typeof window && user?.email && process.env.NEXT_PUBLIC_CRISP_ID) {
|
||||||
window.$crisp = [];
|
window.$crisp = [];
|
||||||
window.CRISP_WEBSITE_ID = process.env.NEXT_PUBLIC_CRISP_ID;
|
window.CRISP_WEBSITE_ID = process.env.NEXT_PUBLIC_CRISP_ID;
|
||||||
if (window.CRISP_WEBSITE_ID != null) {
|
(function () {
|
||||||
(function () {
|
const d = document;
|
||||||
const d = document;
|
const s = d.createElement("script");
|
||||||
const s = d.createElement("script");
|
s.src = "https://client.crisp.chat/l.js";
|
||||||
s.src = "https://client.crisp.chat/l.js";
|
s.async = true;
|
||||||
s.async = true;
|
d.getElementsByTagName("head")[0].appendChild(s);
|
||||||
d.getElementsByTagName("head")[0].appendChild(s);
|
window.$crisp.push(["set", "user:email", [user.email]]);
|
||||||
window.$crisp.push(["set", "user:email", [user.email]]);
|
window.$crisp.push(["do", "chat:hide"]);
|
||||||
window.$crisp.push(["do", "chat:hide"]);
|
window.$crisp.push(["do", "chat:close"]);
|
||||||
window.$crisp.push(["do", "chat:close"]);
|
})();
|
||||||
})();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [user?.email]);
|
}, [user?.email]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user