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.
Files changed (2) hide show
  1. package/df-btn.js +19 -8
  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"),
@@ -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
- // Check if mobile device - removed unused variable
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="https://chat.dev.aumera.ai/${detectedLang}/?orgId=${
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
- // add right padding to df-btn-text only if screen size is greater than 720px
419
- if (window.innerWidth > 720) {
420
- btnText.style.paddingRight = "24px";
421
- }
431
+ // restore right padding from CSS
432
+ btnText.style.paddingRight = "";
422
433
  }
423
434
  }
424
435
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aumera-on-screen-widget",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "A lightweight, customizable chat widget for websites",
5
5
  "main": "df-btn.js",
6
6
  "scripts": {