-
Notifications
You must be signed in to change notification settings - Fork 17
/
js-example.html
43 lines (40 loc) · 1.57 KB
/
js-example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!-- Load React first and then, ReactDOM. Also, these two libs' version should be same -->
<script crossorigin src="https://unpkg.com/[email protected]/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script>
<!-- Load chat-ai-widget script and set process.env to prevent it get undefined -->
<script>process = { env: { NODE_ENV: '' } }</script>
<script
crossorigin
src="https://unpkg.com/@sendbird/chat-ai-widget@latest/dist/index.umd.js"
></script>
<link href="https://unpkg.com/@sendbird/chat-ai-widget@latest/dist/style.css" rel="stylesheet" />
<!--Optional; to enable JSX syntax-->
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<title>chat-ai-widget Example</title>
</head>
<body>
<!-- div element for chat-ai-widget container -->
<div id="root"></div>
<!-- Initialize chat-ai-widget and render the widget component -->
<script type="text/babel">
const { ChatAiWidget } = window.ChatAiWidget
const App = () => {
return (
<ChatAiWidget
applicationId="AE8F7EEA-4555-4F86-AD8B-5E0BD86BFE67"
botId="khan-academy-bot"
/**
* Pass other necessary props here
*/
/>
)
}
ReactDOM.createRoot(document.querySelector('#root')).render(<div><App/></div>);
</script>
</body>
</html>