Skip to content

Commit 29fe298

Browse files
committed
add live chat to contact form example
1 parent b46c6af commit 29fe298

File tree

4 files changed

+3058
-22
lines changed

4 files changed

+3058
-22
lines changed

pages/index.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1+
import { useEffect } from 'react';
12
import type { NextPage } from 'next';
23
import Head from 'next/head';
34
import { HelpButton } from '../src/components/helpButton';
45

56
const Home: NextPage = () => {
7+
useEffect(() => {
8+
let script = document.createElement('script');
9+
script.async = false;
10+
script.onload = function(){
11+
Plain.init({
12+
appId: 'liveChatApp_01J9XJ0Z9WZC9CXQXMR7FT1BC7',
13+
hideLauncher: true,
14+
});
15+
};
16+
script.src = 'https://chat.cdn-plain.com/index.js';
17+
document.getElementsByTagName('head')[0].appendChild(script);
18+
19+
}, []);
20+
621
return (
722
<>
823
<Head>

0 commit comments

Comments
 (0)