File tree Expand file tree Collapse file tree 5 files changed +89
-57
lines changed
Expand file tree Collapse file tree 5 files changed +89
-57
lines changed Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 11import { Providers } from '@/app/providers' ;
2- import IntercomClient from '@/components/intercom ' ;
2+ import CrispClient from '@/components/crisp ' ;
33import '@/styles/tailwind.css' ;
44import { Inter } from 'next/font/google' ;
55const 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 >
Original file line number Diff line number Diff line change 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 ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments