advaisor-chatbot 1.2.0 → 1.4.0

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/dist/testchatbot.js +65 -20
  2. package/package.json +1 -1
@@ -1431,23 +1431,47 @@ Please report this to https://github.com/markedjs/marked.`, e) {
1431
1431
  .chat-trigger:hover { transform: scale(1.05); }
1432
1432
 
1433
1433
  .chat-window {
1434
- resize: both;
1435
1434
  position: fixed;
1436
1435
  bottom: 20px;
1437
1436
  right: 20px;
1438
1437
  z-index: 10000;
1438
+
1439
1439
  display: none;
1440
1440
  flex-direction: column;
1441
- background: white;
1442
- box-shadow: 0 10px 25px rgba(0,0,0,0.2);
1443
- border-radius: 12px;
1444
- width: 400px;
1445
- max-width: 90vw;
1446
- height: 600px;
1441
+
1442
+ background: #ffffff;
1443
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
1444
+
1445
+ width: 30vw;
1446
+ max-width: 420px;
1447
+
1448
+ height: 90vh;
1449
+ max-height: 90vh;
1450
+
1451
+ border-radius: 16px;
1447
1452
  overflow: hidden;
1448
- min-width: 280px;
1449
- min-height: 350px;
1450
- transition: width 0.2s ease, height 0.2s ease;
1453
+
1454
+ transition: all 0.25s ease;
1455
+
1456
+ resize: both;
1457
+ min-width: 300px;
1458
+ min-height: 450px;
1459
+ }
1460
+
1461
+ @media (max-width: 768px) {
1462
+ .chat-window {
1463
+ width: 100vw;
1464
+ max-width: 100vw;
1465
+
1466
+ min-height: 85vh;
1467
+ max-height: 85vh;
1468
+ height: auto;
1469
+
1470
+ bottom: 0;
1471
+ right: 0;
1472
+
1473
+ border-radius: 16px 16px 0 0; /* rounded top only */
1474
+ }
1451
1475
  }
1452
1476
 
1453
1477
  .chat-body {
@@ -1570,6 +1594,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
1570
1594
  .header {
1571
1595
  cursor: move;
1572
1596
  user-select: none;
1597
+ touch-action: none;
1573
1598
  }
1574
1599
 
1575
1600
  .history-btn {
@@ -1746,30 +1771,50 @@ Please report this to https://github.com/markedjs/marked.`, e) {
1746
1771
  let isDragging = false;
1747
1772
  let offsetX = 0;
1748
1773
  let offsetY = 0;
1749
- header.addEventListener("mousedown", (e) => {
1774
+ function getEventPosition(e) {
1775
+ if (e.touches && e.touches.length > 0) {
1776
+ return {
1777
+ x: e.touches[0].clientX,
1778
+ y: e.touches[0].clientY
1779
+ };
1780
+ }
1781
+ return {
1782
+ x: e.clientX,
1783
+ y: e.clientY
1784
+ };
1785
+ }
1786
+ function startDrag(e) {
1750
1787
  isDragging = true;
1788
+ const pos = getEventPosition(e);
1751
1789
  const rect = windowEl.getBoundingClientRect();
1752
- offsetX = e.clientX - rect.left;
1753
- offsetY = e.clientY - rect.top;
1790
+ offsetX = pos.x - rect.left;
1791
+ offsetY = pos.y - rect.top;
1754
1792
  windowEl.style.right = "auto";
1755
1793
  windowEl.style.bottom = "auto";
1756
1794
  windowEl.style.left = rect.left + "px";
1757
1795
  windowEl.style.top = rect.top + "px";
1758
- });
1759
- document.addEventListener("mousemove", (e) => {
1796
+ }
1797
+ header.addEventListener("mousedown", startDrag);
1798
+ header.addEventListener("touchstart", startDrag);
1799
+ function onDrag(e) {
1760
1800
  if (!isDragging) return;
1761
- let x2 = e.clientX - offsetX;
1762
- let y2 = e.clientY - offsetY;
1801
+ const pos = getEventPosition(e);
1802
+ let x2 = pos.x - offsetX;
1803
+ let y2 = pos.y - offsetY;
1763
1804
  const maxX = window.innerWidth - windowEl.offsetWidth;
1764
1805
  const maxY = window.innerHeight - windowEl.offsetHeight;
1765
1806
  x2 = Math.max(0, Math.min(x2, maxX));
1766
1807
  y2 = Math.max(0, Math.min(y2, maxY));
1767
1808
  windowEl.style.left = x2 + "px";
1768
1809
  windowEl.style.top = y2 + "px";
1769
- });
1770
- document.addEventListener("mouseup", () => {
1810
+ }
1811
+ document.addEventListener("mousemove", onDrag);
1812
+ document.addEventListener("touchmove", onDrag);
1813
+ function stopDrag() {
1771
1814
  isDragging = false;
1772
- });
1815
+ }
1816
+ document.addEventListener("mouseup", stopDrag);
1817
+ document.addEventListener("touchend", stopDrag);
1773
1818
  windowEl.addEventListener("click", (e) => {
1774
1819
  const sidebar2 = this.shadowRoot.getElementById("sidebar");
1775
1820
  const historyBtn2 = this.shadowRoot.getElementById("history");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "advaisor-chatbot",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Embeddable chatbot component",
5
5
  "main": "dist/testchatbot.js",
6
6
  "scripts": {