Skip to content

Commit 836ace3

Browse files
authored
📦 NEW: Setup crisp client (#156)
1 parent 4313f2a commit 836ace3

File tree

5 files changed

+89
-57
lines changed

5 files changed

+89
-57
lines changed

‎apps/baseai.dev/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"@headlessui/react": "^1.7.15",
1717
"@headlessui/tailwindcss": "^0.2.0",
1818
"@heroicons/react": "^2.1.3",
19-
"@intercom/messenger-js-sdk": "^0.0.14",
2019
"@mdx-js/loader": "^3.0.0",
2120
"@mdx-js/react": "^3.0.0",
2221
"@next/mdx": "^14.0.4",

‎apps/baseai.dev/src/app/layout.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Providers } from '@/app/providers';
2-
import IntercomClient from '@/components/intercom';
2+
import CrispClient from '@/components/crisp';
33
import '@/styles/tailwind.css';
44
import { Inter } from 'next/font/google';
55
const inter = Inter({ subsets: ['latin'] });
@@ -53,7 +53,7 @@ export default async function RootLayout({
5353
<html lang="en" className="h-full" suppressHydrationWarning>
5454
<body className={`${inter.className}`}>
5555
<Providers>
56-
<IntercomClient />
56+
<CrispClient />
5757
{children}
5858
</Providers>
5959
</body>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use client';
2+
3+
import { useEffect } from 'react';
4+
5+
declare global {
6+
interface Window {
7+
$crisp: any;
8+
CRISP_WEBSITE_ID: string;
9+
}
10+
}
11+
12+
const CrispClient = () => {
13+
useEffect(() => {
14+
if (!process.env.NEXT_PUBLIC_CRISP_WEBSITE_ID) {
15+
return;
16+
}
17+
18+
window.$crisp = [];
19+
window.CRISP_WEBSITE_ID = process.env.NEXT_PUBLIC_CRISP_WEBSITE_ID;
20+
21+
(function() {
22+
const d = document;
23+
const s = d.createElement('script');
24+
s.src = 'https://client.crisp.chat/l.js';
25+
s.async = true;
26+
d.getElementsByTagName('head')[0].appendChild(s);
27+
})();
28+
29+
}, []);
30+
31+
return <></>;
32+
};
33+
34+
export default CrispClient;

‎apps/baseai.dev/src/components/intercom.tsx‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎pnpm-lock.yaml‎

Lines changed: 53 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)