aumera-on-screen-widget 0.0.10 → 0.0.12
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 +19 -8
- 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"),
|
|
@@ -235,9 +236,8 @@ if (!config.orgId) {
|
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
.df-btn-text {
|
|
238
|
-
padding: 0;
|
|
239
|
+
padding: 0 16px 0 0;
|
|
239
240
|
height: 56px;
|
|
240
|
-
font-size: 0;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -299,7 +299,20 @@ if (!config.orgId) {
|
|
|
299
299
|
// Get the detected language
|
|
300
300
|
const detectedLang = getLanguage();
|
|
301
301
|
|
|
302
|
-
//
|
|
302
|
+
// Function to get chat URL based on environment
|
|
303
|
+
function getChatUrl() {
|
|
304
|
+
const env = config.env;
|
|
305
|
+
switch (env) {
|
|
306
|
+
case "dev":
|
|
307
|
+
return "https://chat.dev.aumera.ai";
|
|
308
|
+
case "prod":
|
|
309
|
+
return "https://chat.aumera.ai";
|
|
310
|
+
case "favor":
|
|
311
|
+
return "https://chat.aumera.ai"; // Using prod URL for favor, update if different
|
|
312
|
+
default:
|
|
313
|
+
return "https://chat.aumera.ai";
|
|
314
|
+
}
|
|
315
|
+
}
|
|
303
316
|
|
|
304
317
|
document.write(`
|
|
305
318
|
<button class="df-btn df-closed" onclick="dfToggle()">
|
|
@@ -311,7 +324,7 @@ if (!config.orgId) {
|
|
|
311
324
|
<div class="df-btn-header">
|
|
312
325
|
<div class="df-btn-text">${config.openText || "Chat"}</div>
|
|
313
326
|
</div>
|
|
314
|
-
<iframe class="df-btn-content" src="
|
|
327
|
+
<iframe class="df-btn-content" src="${getChatUrl()}/${detectedLang}/?orgId=${
|
|
315
328
|
config.orgId
|
|
316
329
|
}" allow="microphone *"></iframe>
|
|
317
330
|
</button>
|
|
@@ -415,10 +428,8 @@ if (!config.orgId) {
|
|
|
415
428
|
} else {
|
|
416
429
|
// Set text to openText
|
|
417
430
|
if (btnText) btnText.innerText = config.openText || "Chat";
|
|
418
|
-
//
|
|
419
|
-
|
|
420
|
-
btnText.style.paddingRight = "24px";
|
|
421
|
-
}
|
|
431
|
+
// restore right padding from CSS
|
|
432
|
+
btnText.style.paddingRight = "";
|
|
422
433
|
}
|
|
423
434
|
}
|
|
424
435
|
|