增加客服消息声音与浏览器通知
This commit is contained in:
@@ -10,6 +10,7 @@ import EmojiPicker, { insertAtCursor } from '@/components/common/EmojiPicker'
|
||||
import { ChatImage } from '@/components/common/ImagePreview'
|
||||
import MarkdownBody, { stripMarkdown } from '@/components/common/MarkdownBody'
|
||||
import { useAuth } from '@/stores/auth'
|
||||
import { OPEN_AGENT_SESSION_EVENT, useAgentNotifications } from '@/stores/notifications'
|
||||
import {
|
||||
addSessionNote, claimSession, createBlacklist, endSession, getAvailableAgents, getCustomer, getCustomers, getKnowledgeEntries,
|
||||
getCustomerTags, getQuickReplies, getSession, getSessionMessages, getSessions, markSessionRead, sendSessionMessage,
|
||||
@@ -390,6 +391,7 @@ function shortPagePath(url?: string): string {
|
||||
|
||||
const Dashboard = () => {
|
||||
const { user } = useAuth()
|
||||
const { setActiveSessionId } = useAgentNotifications()
|
||||
const [sessions, setSessions] = useState<Session[]>([])
|
||||
const [customers, setCustomers] = useState<Record<number, Customer>>({})
|
||||
const [loading, setLoading] = useState(true)
|
||||
@@ -665,7 +667,18 @@ const Dashboard = () => {
|
||||
|
||||
useEffect(() => {
|
||||
selectedIdRef.current = selectedId
|
||||
}, [selectedId])
|
||||
setActiveSessionId(selectedId)
|
||||
return () => setActiveSessionId(null)
|
||||
}, [selectedId, setActiveSessionId])
|
||||
|
||||
useEffect(() => {
|
||||
const handleOpenSession = (event: Event) => {
|
||||
const sessionId = Number((event as CustomEvent<number>).detail)
|
||||
if (Number.isFinite(sessionId) && sessionId > 0) setSelectedId(sessionId)
|
||||
}
|
||||
window.addEventListener(OPEN_AGENT_SESSION_EVENT, handleOpenSession)
|
||||
return () => window.removeEventListener(OPEN_AGENT_SESSION_EVENT, handleOpenSession)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
loadAllRef.current = loadAll
|
||||
|
||||
@@ -1204,7 +1204,7 @@ const Settings = () => {
|
||||
>
|
||||
<div className="space-y-3 mb-5">
|
||||
{[
|
||||
{ name: 'notify_new_session', title: '新会话提醒', desc: '有新访客进线时提醒(推送通道后续接入)' },
|
||||
{ name: 'notify_new_session', title: '新会话提醒', desc: '有新访客进线时提醒;浏览器通知与声音可在工作台铃铛中配置' },
|
||||
{ name: 'notify_offline_leave', title: '离线留言通知', desc: '访客提交离线留言时提醒' },
|
||||
{ name: 'notify_daily_report', title: '日报推送', desc: '每日服务数据摘要' },
|
||||
].map(item => (
|
||||
|
||||
Reference in New Issue
Block a user