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