@animuz/embed 0.2.2-rc0 → 0.2.2-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/animuz-chat-widget.min.css +1 -1
- package/dist/animuz-chat-widget.min.js +10 -5
- package/dist/iframe.html +43 -0
- package/package.json +4 -2
package/dist/iframe.html
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<title>Animuz Chat Widget</title>
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body style="margin:0;padding:0;overflow:hidden;">
|
|
11
|
+
<script>
|
|
12
|
+
// Parse query params and merge with defaults
|
|
13
|
+
function getQueryParams() {
|
|
14
|
+
const params = {};
|
|
15
|
+
window.location.search
|
|
16
|
+
.substring(1)
|
|
17
|
+
.split("&")
|
|
18
|
+
.forEach(pair => {
|
|
19
|
+
if (!pair) return;
|
|
20
|
+
const [key, value] = pair.split("=");
|
|
21
|
+
params[decodeURIComponent(key)] = decodeURIComponent(value || "");
|
|
22
|
+
});
|
|
23
|
+
return params;
|
|
24
|
+
}
|
|
25
|
+
const params = getQueryParams();
|
|
26
|
+
// Show error if embedId is not provided
|
|
27
|
+
if (!params.embedId) {
|
|
28
|
+
document.body.innerHTML = '<div style="color:red;font-family:sans-serif;padding:2em;text-align:center;">Error: <b>embedID</b> is required in the iframe URL query string.</div>';
|
|
29
|
+
} else {
|
|
30
|
+
// Optionally, parse query params for config
|
|
31
|
+
window.ANIMUZ_EMBED_CONFIG = {
|
|
32
|
+
openOnLoad: "on",
|
|
33
|
+
hideBubble: true,
|
|
34
|
+
...params
|
|
35
|
+
};
|
|
36
|
+
var script = document.createElement('script');
|
|
37
|
+
script.src = "animuz-chat-widget.min.js";
|
|
38
|
+
document.body.appendChild(script);
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
</body>
|
|
42
|
+
|
|
43
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animuz/embed",
|
|
3
|
-
"version": "0.2.2-
|
|
3
|
+
"version": "0.2.2-rc2",
|
|
4
4
|
"description": "Embeddable chat widget for Rudi by Animuz",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/animuz-chat-widget.min.js",
|
|
7
7
|
"author": "Knight H.",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist/animuz-chat-widget.min.js",
|
|
10
|
-
"dist/animuz-chat-widget.min.css"
|
|
10
|
+
"dist/animuz-chat-widget.min.css",
|
|
11
|
+
"dist/iframe.html"
|
|
11
12
|
],
|
|
12
13
|
"dependencies": {
|
|
13
14
|
"@phosphor-icons/react": "^2.1.7",
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
"markdown-it": "^14.1.0",
|
|
17
18
|
"react": "^18.3.1",
|
|
18
19
|
"react-dom": "^18.3.1",
|
|
20
|
+
"react-helmet": "^6.1.0",
|
|
19
21
|
"sse.js": "^2.5.0",
|
|
20
22
|
"uuid": "^10.0.0"
|
|
21
23
|
},
|