aumera-on-screen-widget 0.0.6 → 0.0.8
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 +29 -3
- package/package.json +1 -1
package/df-btn.js
CHANGED
|
@@ -126,8 +126,10 @@ if (!config.orgId) {
|
|
|
126
126
|
.df-btn-content {
|
|
127
127
|
display: block;
|
|
128
128
|
border: 0;
|
|
129
|
-
height: ${config.height || "
|
|
129
|
+
height: ${config.height || "75vh"};
|
|
130
|
+
max-height: 75vh;
|
|
130
131
|
width: ${config.width || "414px"};
|
|
132
|
+
max-width: 414px;
|
|
131
133
|
transition: all .45s cubic-bezier(.4, 0, .2, 1);
|
|
132
134
|
${config.position === "left" ? "float: left;" : "float: right;"}
|
|
133
135
|
opacity: 1;
|
|
@@ -168,9 +170,13 @@ if (!config.orgId) {
|
|
|
168
170
|
}
|
|
169
171
|
.df-btn.df-maximized .df-btn-content {
|
|
170
172
|
width: 100vw !important;
|
|
173
|
+
max-width: 100vw !important;
|
|
171
174
|
height: calc(100vh - 56px) !important;
|
|
175
|
+
max-height: calc(100vh - 56px) !important;
|
|
172
176
|
opacity: 1 !important;
|
|
177
|
+
|
|
173
178
|
display: block !important;
|
|
179
|
+
border-radius: 0 !important;
|
|
174
180
|
transition: all .45s cubic-bezier(.4, 0, .2, 1) !important;
|
|
175
181
|
}
|
|
176
182
|
.df-btn.df-closed .df-btn-content {
|
|
@@ -270,6 +276,9 @@ if (!config.orgId) {
|
|
|
270
276
|
// Get the detected language
|
|
271
277
|
const detectedLang = getLanguage();
|
|
272
278
|
|
|
279
|
+
// Check if mobile device
|
|
280
|
+
const isMobileDevice = window.innerWidth <= 768;
|
|
281
|
+
|
|
273
282
|
document.write(`
|
|
274
283
|
<button class="df-btn df-closed" onclick="dfToggle()">
|
|
275
284
|
${
|
|
@@ -280,7 +289,7 @@ if (!config.orgId) {
|
|
|
280
289
|
<div class="df-btn-header">
|
|
281
290
|
<div class="df-btn-text">${config.openText || "Chat"}</div>
|
|
282
291
|
</div>
|
|
283
|
-
<iframe class="df-btn-content" src="https://chat.
|
|
292
|
+
<iframe class="df-btn-content" src="https://chat.aumera.ai/${detectedLang}/?orgId=${
|
|
284
293
|
config.orgId
|
|
285
294
|
}" allow="microphone *"></iframe>
|
|
286
295
|
</button>
|
|
@@ -350,6 +359,10 @@ if (!config.orgId) {
|
|
|
350
359
|
if (btnText) btnText.innerText = "";
|
|
351
360
|
// remove right padding from df-btn-text
|
|
352
361
|
btnText.style.paddingRight = "0";
|
|
362
|
+
|
|
363
|
+
// Only add maximize/minimize button on desktop
|
|
364
|
+
const isMobile = window.innerWidth <= 768;
|
|
365
|
+
|
|
353
366
|
// Add maximize/minimize button (right)
|
|
354
367
|
const maxBtn = document.createElement("div");
|
|
355
368
|
maxBtn.className = "maximize-minimize-btn";
|
|
@@ -367,6 +380,7 @@ if (!config.orgId) {
|
|
|
367
380
|
e.stopPropagation();
|
|
368
381
|
maximizeMinimize();
|
|
369
382
|
});
|
|
383
|
+
|
|
370
384
|
// Add close button (left)
|
|
371
385
|
const closeBtn = document.createElement("div");
|
|
372
386
|
closeBtn.className = "close-btn";
|
|
@@ -416,14 +430,26 @@ if (!config.orgId) {
|
|
|
416
430
|
// Remove onclick from button, handle open/close in JS
|
|
417
431
|
const btn = document.querySelector(".df-btn");
|
|
418
432
|
btn.onclick = null;
|
|
433
|
+
|
|
434
|
+
// Check if mobile for later use
|
|
435
|
+
const isMobile = window.innerWidth <= 768;
|
|
436
|
+
|
|
419
437
|
btn.addEventListener("click", (e) => {
|
|
420
438
|
// Only toggle if chat is closed (popover mode)
|
|
421
439
|
if (btn.classList.contains("df-closed")) {
|
|
422
440
|
dfToggle();
|
|
441
|
+
// On mobile, also add maximized state when opening
|
|
442
|
+
if (window.innerWidth <= 768) {
|
|
443
|
+
btn.classList.add("df-maximized");
|
|
444
|
+
updateHeaderButtons();
|
|
445
|
+
}
|
|
423
446
|
}
|
|
424
447
|
// If open, do nothing (let header buttons handle maximize/minimize/close)
|
|
425
448
|
});
|
|
426
449
|
|
|
427
450
|
// Start the inactivity timer when the page loads (button is initially closed)
|
|
428
|
-
|
|
451
|
+
// But not on mobile since it starts open
|
|
452
|
+
if (!isMobile) {
|
|
453
|
+
startInactivityTimer();
|
|
454
|
+
}
|
|
429
455
|
}
|