Skip to content

Commit

Permalink
feat: chat component
Browse files Browse the repository at this point in the history
  • Loading branch information
darraghoriordan committed Sep 18, 2023
1 parent c2b4075 commit fc0303a
Show file tree
Hide file tree
Showing 4 changed files with 1,306 additions and 384 deletions.
3 changes: 2 additions & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"browserslist": "defaults, not ie <= 11",
"dependencies": {
"@auth0/nextjs-auth0": "3.1.0",
"@babel/core": "7.22.19",
"@babel/core": "7.22.20",
"@babel/plugin-syntax-flow": "^7.22.5",
"@babel/plugin-transform-react-jsx": "^7.22.15",
"@headlessui/react": "1.7.17",
Expand Down Expand Up @@ -50,6 +50,7 @@
"@use-miller/shared-api-client": "workspace:*",
"autoprefixer": "10.4.15",
"clsx": "2.0.0",
"crisp-sdk-web": "1.0.21",
"eslint": "8.49.0",
"eslint-config-next": "13.4.19",
"eslint-config-react-app": "7.0.1",
Expand Down
12 changes: 12 additions & 0 deletions apps/frontend/src/components/CrispChat.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { useEffect } from "react";
import { Crisp } from "crisp-sdk-web";

const CrispChat = () => {
useEffect(() => {
Crisp.configure("0c58d997-a702-4b2d-86be-e84db144747c");
});

return null;
};

export default CrispChat;
13 changes: 4 additions & 9 deletions apps/frontend/src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Head, Html, Main, NextScript } from "next/document";
import dynamic from "next/dynamic.js";
import * as React from "react";
import Script from "next/script";

const CrispWithNoSSR = dynamic(() => import("../components/CrispChat.js"));

export default function Document(props: any) {
return (
Expand All @@ -19,15 +21,8 @@ export default function Document(props: any) {
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&family=Lexend:wght@400;500&display=swap"
/>
<Script type="text/javascript">
{`window.$crisp=[];
window.CRISP_WEBSITE_ID="0c58d997-a702-4b2d-86be-e84db144747c";
(function(){d=document;s=d.createElement("script");
s.src="https://client.crisp.chat/l.js";
s.async=1;d.getElementsByTagName("head")[0].appendChild(s);
})();`}
</Script>{" "}
</Head>
<CrispWithNoSSR />
<body>
<Main />
<NextScript />
Expand Down
Loading

0 comments on commit fc0303a

Please sign in to comment.