diff --git a/web/app/kefu/closed/page.tsx b/web/app/kefu/closed/page.tsx new file mode 100644 index 0000000..5e0abdb --- /dev/null +++ b/web/app/kefu/closed/page.tsx @@ -0,0 +1,19 @@ +import { CheckCircle2Icon } from "lucide-react" + +export default function Page() { + return ( +
+
+
+ +
+
+

会话已结束

+

+ 当前客服会话已关闭,感谢您的使用。 +

+
+
+
+ ) +} diff --git a/web/components/kefu/chat-shell.tsx b/web/components/kefu/chat-shell.tsx index ee10e2e..ea53ac1 100644 --- a/web/components/kefu/chat-shell.tsx +++ b/web/components/kefu/chat-shell.tsx @@ -1,7 +1,6 @@ "use client" import { - CheckCircle2Icon, Maximize2Icon, Minimize2Icon, MinusIcon, @@ -19,6 +18,7 @@ import { import { useShallow } from "zustand/react/shallow" import { KefuConnectionStatus } from "@/components/kefu/connection-status" +import { getStandaloneClosedUrl } from "@/components/kefu/close-navigation" import { CustomerMessageEditor } from "@/components/kefu/customer-message-editor" import { KefuMessageList, @@ -89,7 +89,6 @@ export function KefuChatShell() { const [isMaximized, setIsMaximized] = useState(false) const [isCloseDialogOpen, setIsCloseDialogOpen] = useState(false) const [isClosingConversation, setIsClosingConversation] = useState(false) - const [isConversationClosed, setIsConversationClosed] = useState(false) const { title, @@ -219,10 +218,6 @@ export function KefuChatShell() { requestKefuHostToggleMaximize() } - function handleRestartConversation() { - window.location.reload() - } - async function confirmCloseConversation() { if (isClosingConversation) { return @@ -236,7 +231,7 @@ export function KefuChatShell() { if (isEmbedded) { requestKefuHostClose() } else { - setIsConversationClosed(true) + window.location.replace(getStandaloneClosedUrl()) } } catch (closeError) { window.alert(closeError instanceof Error ? closeError.message : "关闭会话失败") @@ -258,47 +253,6 @@ export function KefuChatShell() { return () => window.removeEventListener("keydown", handleKeyDown) }, [isCloseDialogOpen, isClosingConversation]) - if (isConversationClosed) { - return ( -
-
- {/*
-
-
- {title} -
- {subtitle ? ( -
- {subtitle} -
- ) : null} -
-
*/} - -
-
-
- -
-
-
会话已结束
-

- 当前客服会话已关闭,感谢您的使用。 -

-
- {/* */} -
-
-
-
- ) - } - return (
{ + const { getStandaloneClosedUrl } = await loadCloseNavigation() + + assert.equal(getStandaloneClosedUrl(), "/kefu/closed") +}) diff --git a/web/components/kefu/close-navigation.ts b/web/components/kefu/close-navigation.ts new file mode 100644 index 0000000..8f54cf4 --- /dev/null +++ b/web/components/kefu/close-navigation.ts @@ -0,0 +1,5 @@ +export const KEFU_CLOSED_PATH = "/kefu/closed" + +export function getStandaloneClosedUrl() { + return KEFU_CLOSED_PATH +}