aumera-on-screen-widget 0.0.9 → 0.0.11
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/df-btn.js +16 -2
- package/package.json +1 -1
package/df-btn.js
CHANGED
|
@@ -2,6 +2,7 @@ const wrapper = document.querySelector("#df-btn");
|
|
|
2
2
|
const config = {
|
|
3
3
|
src: wrapper.getAttribute("src"),
|
|
4
4
|
orgId: wrapper.getAttribute("orgId"),
|
|
5
|
+
env: wrapper.getAttribute("env"),
|
|
5
6
|
width: wrapper.getAttribute("width"),
|
|
6
7
|
height: wrapper.getAttribute("height"),
|
|
7
8
|
openText: wrapper.getAttribute("openText"),
|
|
@@ -299,7 +300,20 @@ if (!config.orgId) {
|
|
|
299
300
|
// Get the detected language
|
|
300
301
|
const detectedLang = getLanguage();
|
|
301
302
|
|
|
302
|
-
//
|
|
303
|
+
// Function to get chat URL based on environment
|
|
304
|
+
function getChatUrl() {
|
|
305
|
+
const env = config.env;
|
|
306
|
+
switch (env) {
|
|
307
|
+
case "dev":
|
|
308
|
+
return "https://chat.dev.aumera.ai";
|
|
309
|
+
case "prod":
|
|
310
|
+
return "https://chat.aumera.ai";
|
|
311
|
+
case "favor":
|
|
312
|
+
return "https://chat.aumera.ai"; // Using prod URL for favor, update if different
|
|
313
|
+
default:
|
|
314
|
+
return "https://chat.aumera.ai";
|
|
315
|
+
}
|
|
316
|
+
}
|
|
303
317
|
|
|
304
318
|
document.write(`
|
|
305
319
|
<button class="df-btn df-closed" onclick="dfToggle()">
|
|
@@ -311,7 +325,7 @@ if (!config.orgId) {
|
|
|
311
325
|
<div class="df-btn-header">
|
|
312
326
|
<div class="df-btn-text">${config.openText || "Chat"}</div>
|
|
313
327
|
</div>
|
|
314
|
-
<iframe class="df-btn-content" src="
|
|
328
|
+
<iframe class="df-btn-content" src="${getChatUrl()}/${detectedLang}/?orgId=${
|
|
315
329
|
config.orgId
|
|
316
330
|
}" allow="microphone *"></iframe>
|
|
317
331
|
</button>
|