mirror of
https://github.com/hexastack/hexabot
synced 2024-11-24 04:53:41 +00:00
45 lines
1.3 KiB
HTML
45 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Widget Embed</title>
|
|
<script
|
|
crossorigin
|
|
src="https://unpkg.com/react@18/umd/react.production.min.js"
|
|
></script>
|
|
<script
|
|
crossorigin
|
|
src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"
|
|
></script>
|
|
<link rel="stylesheet" href="./style.css" />
|
|
<script src="./hexabot-widget.umd.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="hb-chat-widget"></div>
|
|
<script>
|
|
// Create the shadow root and attach it to the widget container
|
|
const createElement = (tag, props = {}) => Object.assign(document.createElement(tag), props);
|
|
const shadowContainer = createElement("div");
|
|
document
|
|
.getElementById('hb-chat-widget')
|
|
.attachShadow({ mode: 'open' })
|
|
.append(
|
|
shadowContainer,
|
|
createElement("link", {
|
|
rel: "stylesheet",
|
|
href: "./style.css"
|
|
})
|
|
);
|
|
ReactDOM.render(
|
|
React.createElement(HexabotWidget, {
|
|
apiUrl: 'http://localhost:4000',
|
|
channel: 'web-channel',
|
|
token: 'token123',
|
|
}),
|
|
shadowContainer,
|
|
);
|
|
</script>
|
|
</body>
|
|
</html>
|