diff --git a/src/lib/common/LiveChatEntry.svelte b/src/lib/common/LiveChatEntry.svelte
index fc952659..755e41be 100644
--- a/src/lib/common/LiveChatEntry.svelte
+++ b/src/lib/common/LiveChatEntry.svelte
@@ -1,85 +1,86 @@
- {#if showChatBox}
-
-
-
- {/if}
+ {#if showChatBox}
+
+
+
+ {/if}
- {#if showChatIcon}
-
-
-
- {/if}
+ {#if showChatIcon}
+
+
+
+ {/if}
\ No newline at end of file
diff --git a/src/lib/common/ProfileDropdown.svelte b/src/lib/common/ProfileDropdown.svelte
index 6d51f2fa..943250a9 100644
--- a/src/lib/common/ProfileDropdown.svelte
+++ b/src/lib/common/ProfileDropdown.svelte
@@ -15,6 +15,13 @@
if (browser){
resetLocalStorage(true);
}
+
+ const chatFrame = document.getElementById('chat-frame');
+ if (chatFrame) {
+ // @ts-ignore
+ chatFrame.contentWindow.postMessage({ action: "logout" }, "*");
+ }
+
goto('login');
};
@@ -57,7 +64,7 @@
role="button"
tabindex="0"
on:keydown={() => {}}
- on:click={logout}
+ on:click={() => logout()}
>
{$_('Logout')}
diff --git a/src/lib/helpers/enums.js b/src/lib/helpers/enums.js
index 35736909..ed622d67 100644
--- a/src/lib/helpers/enums.js
+++ b/src/lib/helpers/enums.js
@@ -28,7 +28,8 @@ export const RichType = Object.freeze(richType);
const elementType = {
Text: "text",
Video: "video",
- File: "file"
+ File: "file",
+ Web: "web_url"
};
export const ElementType = Object.freeze(elementType);
diff --git a/src/lib/helpers/store.js b/src/lib/helpers/store.js
index 91c6a639..5aa79dec 100644
--- a/src/lib/helpers/store.js
+++ b/src/lib/helpers/store.js
@@ -2,6 +2,7 @@
import { writable } from 'svelte/store';
import { browser } from '$app/environment';
+const userKey = "user";
const conversationKey = "conversation";
const conversationUserStatesKey = "conversation_user_states";
const conversationSearchOptionKey = "conversation_search_option";
@@ -16,7 +17,7 @@ export const userStore = writable({ id: "", full_name: "", expires: 0, token: nu
export function getUserStore() {
if (browser) {
// Access localStorage only if in the browser context
- let json = localStorage.getItem('user');
+ let json = localStorage.getItem(userKey);
if (json)
return JSON.parse(json);
else
@@ -29,7 +30,7 @@ export function getUserStore() {
userStore.subscribe(value => {
if (browser && value.token) {
- localStorage.setItem('user', JSON.stringify(value));
+ localStorage.setItem(userKey, JSON.stringify(value));
}
});
diff --git a/src/lib/scss/custom/pages/_chat.scss b/src/lib/scss/custom/pages/_chat.scss
index bf45728f..e545e573 100644
--- a/src/lib/scss/custom/pages/_chat.scss
+++ b/src/lib/scss/custom/pages/_chat.scss
@@ -749,6 +749,10 @@
margin-left: 0px !important;
border-radius: 10px;
}
+
+ .btn-link {
+ background-color: unset !important;
+ }
}
}
}
diff --git a/src/routes/(home)/+page.svelte b/src/routes/(home)/+page.svelte
index 25f1fd8d..bf8753e5 100644
--- a/src/routes/(home)/+page.svelte
+++ b/src/routes/(home)/+page.svelte
@@ -41,17 +41,17 @@
{#if showHomeImage}
-
-
-
+
+
+
{/if}
{#if showHomeSlogan}
- Let's get started with {PUBLIC_BRAND_NAME}
-
- {PUBLIC_HOME_SLOGAN}
-
+ Let's get started with {PUBLIC_BRAND_NAME}
+
+ {PUBLIC_HOME_SLOGAN}
+
{/if}
diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
index d4bcb4b1..951609da 100644
--- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
+++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
@@ -18,7 +18,8 @@
conversationStore,
conversationUserStateStore,
conversationUserMessageStore,
- conversationUserAttachmentStore
+ conversationUserAttachmentStore,
+ resetLocalStorage
} from '$lib/helpers/store.js';
import {
sendMessageToHub,
@@ -166,6 +167,12 @@
});
onMount(async () => {
+ window.addEventListener('message', e => {
+ if (e.data.action === 'logout') {
+ resetLocalStorage(true);
+ }
+ });
+
autoScrollLog = true;
dialogs = await GetDialogs(params.conversationId);
conversationUser = await getConversationUser(params.conversationId);
diff --git a/src/routes/chat/[agentId]/[conversationId]/rich-content/rc-complex-options.svelte b/src/routes/chat/[agentId]/[conversationId]/rich-content/rc-complex-options.svelte
index 02e18900..f81f3808 100644
--- a/src/routes/chat/[agentId]/[conversationId]/rich-content/rc-complex-options.svelte
+++ b/src/routes/chat/[agentId]/[conversationId]/rich-content/rc-complex-options.svelte
@@ -2,6 +2,7 @@
import { getContext, onMount } from "svelte";
import { fade } from 'svelte/transition';
import { Card, CardBody } from "@sveltestrap/sveltestrap";
+ import { ElementType } from "$lib/helpers/enums";
/** @type {boolean} */
export let disabled = false;
@@ -35,6 +36,8 @@
return {
title: x.title,
payload: x.payload,
+ type: x.type,
+ url: x.url,
is_primary: x.is_primary,
is_secondary: x.is_secondary,
};
@@ -54,6 +57,8 @@
return {
title: x.title,
payload: x.payload,
+ type: x.type,
+ url: x.url,
is_primary: x.is_primary,
is_secondary: x.is_secondary,
};
@@ -75,7 +80,7 @@
* @param {string} payload
*/
function innerConfirm(title, payload) {
- onConfirm && onConfirm(title, payload);
+ onConfirm?.(title, payload);
reset();
}
@@ -106,13 +111,23 @@
{#if card.options?.length > 0}
{#each card.options as option, i (i)}
-
+ {#if option.type === ElementType.Web && option.url}
+
+ {:else}
+
+ {/if}
{/each}
{/if}
diff --git a/src/routes/chat/[agentId]/[conversationId]/rich-content/rc-plain-options.svelte b/src/routes/chat/[agentId]/[conversationId]/rich-content/rc-plain-options.svelte
index ecb0bef9..c65a7a3b 100644
--- a/src/routes/chat/[agentId]/[conversationId]/rich-content/rc-plain-options.svelte
+++ b/src/routes/chat/[agentId]/[conversationId]/rich-content/rc-plain-options.svelte
@@ -57,6 +57,8 @@
return {
title: op.title,
payload: op.payload,
+ type: op.type,
+ url: op.url,
is_primary: op.is_primary,
is_secondary: op.is_secondary,
isClicked: false
@@ -144,15 +146,26 @@
{#if plainOptions || fileOption}
{#each plainOptions as option, index}
-
+ {#if option.type === ElementType.Web && option.url}
+
+ {:else}
+
+ {/if}
{/each}
{#if plainOptions && isMultiSelect}