diff --git a/src/lib/scss/custom/pages/_conversation.scss b/src/lib/scss/custom/pages/_conversation.scss index 972693ee..84e86b15 100644 --- a/src/lib/scss/custom/pages/_conversation.scss +++ b/src/lib/scss/custom/pages/_conversation.scss @@ -1,4 +1,4 @@ -.conv-delete-modal { +.delete-modal { button { outline: none !important; box-shadow: none !important; diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte index 7b03b2cf..188e6a44 100644 --- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte +++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte @@ -22,6 +22,8 @@ import ContentLog from './content-log.svelte'; import { replaceNewLine } from '$lib/helpers/http'; import _ from "lodash"; + import Swal from 'sweetalert2/dist/sweetalert2.js'; + import "sweetalert2/src/sweetalert2.scss"; const options = { scrollbars: { @@ -148,8 +150,26 @@ await sendMessageToHub(params.agentId, params.conversationId, text); } - function close() { - window.parent.postMessage({ action: "close" }, "*"); + function endChat() { + if (window.location === window.parent.location) { + // @ts-ignore + Swal.fire({ + title: 'Are you sure?', + text: "You will exit this conversation.", + icon: 'warning', + customClass: 'delete-modal', + showCancelButton: true, + confirmButtonText: 'Yes', + cancelButtonText: 'No' + // @ts-ignore + }).then((result) => { + if (result.value) { + window.close(); + } + }); + } else { + window.parent.postMessage({ action: "close" }, "*"); + } } function closeLog() { @@ -186,7 +206,7 @@ {/if}