-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
46 lines (39 loc) · 1.33 KB
/
index.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
44
45
46
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/assets/images/apple.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>iphone 15 Pro</title>
</head>
<body>
<div id="root"></div>
<script>
const iframe = document.createElement("iframe");
const iframeStyles = (styleString) => {
const style = document.createElement('style');
style.textContent = styleString;
document.head.append(style);
}
iframeStyles(`
.chat-frame {
position: fixed;
bottom: 50px;
right: 50px;
border: none;
}
`)
iframe.src = "http://localhost:3000/chatbot"
iframe.classList.add('chat-frame')
document.body.appendChild(iframe)
window.addEventListener("message", (e) => {
if(e.origin !== "http://localhost:3000") return null
let dimensions = JSON.parse(e.data)
iframe.width = dimensions.width
iframe.height = dimensions.height
iframe.contentWindow.postMessage("e2be6445-0f8d-454e-b04c-e7067600ada6", "http://localhost:3000/")
})
</script>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>