@developpement/tp-chatbot-widget 0.0.12 → 0.0.14
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/package.json +1 -1
- package/src/chatbot.css +12 -16
- package/src/chatbot.js +22 -20
package/package.json
CHANGED
package/src/chatbot.css
CHANGED
|
@@ -50,11 +50,7 @@
|
|
|
50
50
|
transition: all 0.25s ease;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.tp-chatbot-window.open {
|
|
54
|
-
opacity: 1;
|
|
55
|
-
transform: translateY(0) scale(1);
|
|
56
|
-
pointer-events: all;
|
|
57
|
-
}
|
|
53
|
+
.tp-chatbot-window.open { opacity: 1; visibility: visible; transform: scale(1) translateY(0); pointer-events: all; }
|
|
58
54
|
|
|
59
55
|
/* ─── Header ─────────────────────────────────────────────────────────────── */
|
|
60
56
|
|
|
@@ -476,43 +472,43 @@
|
|
|
476
472
|
|
|
477
473
|
/* ─── Markdown content ───────────────────────────────────────────────────── */
|
|
478
474
|
|
|
479
|
-
.tp-
|
|
480
|
-
.tp-
|
|
481
|
-
.tp-
|
|
475
|
+
.tp-md h1,
|
|
476
|
+
.tp-md h2,
|
|
477
|
+
.tp-md h3 {
|
|
482
478
|
font-size: 13px;
|
|
483
479
|
font-weight: 700;
|
|
484
480
|
margin: 8px 0 3px;
|
|
485
481
|
color: #1a1a2e;
|
|
486
482
|
}
|
|
487
483
|
|
|
488
|
-
.tp-
|
|
484
|
+
.tp-md p {
|
|
489
485
|
margin: 3px 0;
|
|
490
486
|
}
|
|
491
487
|
|
|
492
|
-
.tp-
|
|
493
|
-
.tp-
|
|
488
|
+
.tp-md ul,
|
|
489
|
+
.tp-md ol {
|
|
494
490
|
margin: 4px 0 4px 16px;
|
|
495
491
|
padding: 0;
|
|
496
492
|
}
|
|
497
493
|
|
|
498
|
-
.tp-
|
|
494
|
+
.tp-md li {
|
|
499
495
|
margin: 2px 0;
|
|
500
496
|
}
|
|
501
497
|
|
|
502
|
-
.tp-
|
|
498
|
+
.tp-md strong {
|
|
503
499
|
font-weight: 700;
|
|
504
500
|
}
|
|
505
501
|
|
|
506
|
-
.tp-
|
|
502
|
+
.tp-md em {
|
|
507
503
|
font-style: italic;
|
|
508
504
|
}
|
|
509
505
|
|
|
510
|
-
.tp-
|
|
506
|
+
.tp-md a {
|
|
511
507
|
color: #7b1fa2;
|
|
512
508
|
text-decoration: underline;
|
|
513
509
|
}
|
|
514
510
|
|
|
515
|
-
.tp-
|
|
511
|
+
.tp-md code {
|
|
516
512
|
background: #f0ecf8;
|
|
517
513
|
padding: 1px 5px;
|
|
518
514
|
border-radius: 4px;
|
package/src/chatbot.js
CHANGED
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
style.textContent = `
|
|
38
38
|
tp-chatbot * { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
|
|
39
39
|
.tp-chatbot-host { position: fixed; bottom: 24px; z-index: 9999; display: flex; flex-direction: column; align-items: flex-end; width: 380px; }
|
|
40
|
-
.tp-chatbot-window { position: absolute; bottom: 72px; left: 0; right: auto; width: 380px; height: 580px; background: #fff; border-radius: 20px; box-shadow: 0 8px 40px rgba(0,0,0,0.14); display:
|
|
41
|
-
.tp-chatbot-window.open { opacity: 1; transform: scale(1) translateY(0); pointer-events: all; }
|
|
40
|
+
.tp-chatbot-window { position: absolute; bottom: 72px; left: 0; right: auto; width: 380px; height: 580px; background: #fff; border-radius: 20px; box-shadow: 0 8px 40px rgba(0,0,0,0.14); display: none; flex-direction: column; overflow: hidden; opacity: 0; transform: scale(0.92) translateY(12px); pointer-events: none; z-index: 9999; transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease; }
|
|
41
|
+
.tp-chatbot-window.open { opacity: 1; visibility: visible; transform: scale(1) translateY(0); pointer-events: all; }
|
|
42
42
|
.tp-chatbot-bubble { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.18s, box-shadow 0.18s; margin-left: auto; flex-shrink: 0; }
|
|
43
43
|
.tp-chatbot-bubble:hover { transform: scale(1.07); }
|
|
44
44
|
.tp-header { padding: 14px 16px 0; color: white; }
|
|
@@ -939,23 +939,25 @@
|
|
|
939
939
|
}
|
|
940
940
|
|
|
941
941
|
toggleChat() {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
} else {
|
|
954
|
-
window_el.classList.remove('open');
|
|
955
|
-
bubble.innerHTML = icon('msg', 22, 'color:white');
|
|
956
|
-
if (this.is_fullscreen) this.exitFullscreen(true);
|
|
957
|
-
}
|
|
942
|
+
this.is_open = !this.is_open;
|
|
943
|
+
const window_el = this.querySelector('#tp-window');
|
|
944
|
+
const bubble = this.querySelector('#tp-bubble');
|
|
945
|
+
if (this.is_open) {
|
|
946
|
+
window_el.style.display = 'flex';
|
|
947
|
+
setTimeout(() => window_el.classList.add('open'), 10);
|
|
948
|
+
bubble.innerHTML = icon('close', 22, 'color:white');
|
|
949
|
+
if (this.is_minimized) {
|
|
950
|
+
this.is_minimized = false;
|
|
951
|
+
window_el.style.height = WINDOW_HEIGHT;
|
|
952
|
+
window_el.style.overflow = 'hidden';
|
|
958
953
|
}
|
|
954
|
+
} else {
|
|
955
|
+
window_el.classList.remove('open');
|
|
956
|
+
setTimeout(() => { window_el.style.display = 'none'; }, 250);
|
|
957
|
+
bubble.innerHTML = icon('msg', 22, 'color:white');
|
|
958
|
+
if (this.is_fullscreen) this.exitFullscreen(true);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
959
961
|
|
|
960
962
|
getHeaders(content_type = false) {
|
|
961
963
|
const headers = {};
|
|
@@ -1485,9 +1487,9 @@
|
|
|
1485
1487
|
});
|
|
1486
1488
|
const data = await response.json();
|
|
1487
1489
|
const m = this.getMessages(),
|
|
1488
|
-
status = data.result?.status;
|
|
1490
|
+
status = data.result?.result?.status;
|
|
1489
1491
|
let msg = '';
|
|
1490
|
-
if (status === 'outside_hours') msg = m.outside_hours(data.result.next_opening);
|
|
1492
|
+
if (status === 'outside_hours') msg = m.outside_hours(data.result.result.next_opening);
|
|
1491
1493
|
else if (status === 'no_agents') msg = m.no_agents;
|
|
1492
1494
|
else if (status === 'waiting_agent') msg = m.waiting_agent;
|
|
1493
1495
|
else if (status === 'waiting_agent_already') msg = m.waiting_agent_already;
|