Chat: Kunde bekommt Mail, wenn das Team schreibt (K17)
Neue Vorlage K17 im Stil von K16 mit Nachricht, Absender und Link auf den Portal-Chat. Hoechstens eine Mail je Kunde im Zeitfenster CHAT_NOTIFY_THROTTLE_MIN (15 Min.), ohne BCC ans Team, nicht ohne E-Mail-Adresse oder Portalzugang. Das Admin-Panel zeigt unter dem Kundennamen, ob der Hinweis rausging. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
37489aa866
commit
00ea4baf65
6 files changed
+176
-7
No files matched your search
+16
-2
@@ -467,6 +467,18 @@ async function pollAdminThread() {
|
||||
}
|
||||
}
|
||||
|
||||
// Ergebnis des Mail-Hinweises an den Kunden (K17) unter dem Namen anzeigen
|
||||
function showAdminChatNotice(notice) {
|
||||
const el = document.getElementById('admin-chat-notice')
|
||||
if (!el || !notice) return
|
||||
const time = new Date().toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })
|
||||
el.textContent = notice.sent
|
||||
? `E-Mail-Hinweis an ${notice.to} gesendet (${time})`
|
||||
: notice.reason === 'throttled'
|
||||
? 'Kein neuer E-Mail-Hinweis: Der Kunde wurde in den letzten 15 Minuten schon benachrichtigt.'
|
||||
: `Kein E-Mail-Hinweis: ${notice.reason}`
|
||||
}
|
||||
|
||||
async function openChatThread(customerId, customerName) {
|
||||
adminChat.activeCustomerId = customerId
|
||||
adminChat.activeCustomerName = customerName || 'Kunde'
|
||||
@@ -476,7 +488,8 @@ async function openChatThread(customerId, customerName) {
|
||||
|
||||
const thread = document.getElementById('admin-chat-thread')
|
||||
thread.innerHTML = `
|
||||
<div style="margin-bottom:8px"><strong>${escapeHtml(adminChat.activeCustomerName)}</strong></div>
|
||||
<div style="margin-bottom:8px"><strong>${escapeHtml(adminChat.activeCustomerName)}</strong>
|
||||
<div class="muted" id="admin-chat-notice" style="font-size:12px"></div></div>
|
||||
<div class="chat-messages" id="admin-chat-messages"></div>
|
||||
<div id="admin-chat-composer"></div>`
|
||||
ChatComposer.trackScroll(document.getElementById('admin-chat-messages'))
|
||||
@@ -489,10 +502,11 @@ async function openChatThread(customerId, customerName) {
|
||||
placeholder: `Antwort an ${adminChat.activeCustomerName}…`,
|
||||
placeholderShort: 'Antwort…',
|
||||
send: async ({ text, attachmentIds }) => {
|
||||
const { message } = await api(`${adminChatUrl(customerId)}/messages`, {
|
||||
const { message, notice } = await api(`${adminChatUrl(customerId)}/messages`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ text, attachmentIds }),
|
||||
})
|
||||
if (adminChat.activeCustomerId === customerId) showAdminChatNotice(notice)
|
||||
return message
|
||||
},
|
||||
onSent: (message) => {
|
||||
|
||||
Reference in new issue
Block a user