From 9e2dee3613bb414a6ba776ab07ea81156128f4f5 Mon Sep 17 00:00:00 2001 From: runarvestmann Date: Thu, 9 Jan 2025 13:42:27 +0000 Subject: [PATCH] Testing out setStartLanguage method --- .../ChatPanel/BoostChatPanel/BoostChatPanel.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/web/components/ChatPanel/BoostChatPanel/BoostChatPanel.tsx b/apps/web/components/ChatPanel/BoostChatPanel/BoostChatPanel.tsx index bc0d8a2f0d58..8f8ca09140a7 100644 --- a/apps/web/components/ChatPanel/BoostChatPanel/BoostChatPanel.tsx +++ b/apps/web/components/ChatPanel/BoostChatPanel/BoostChatPanel.tsx @@ -73,6 +73,9 @@ export const BoostChatPanel: React.FC< 'wa_lid', ) if (queryParam && ['t10', 't11'].includes(queryParam)) { + window.boost.chatPanel.setStartLanguage( + activeLocale === 'en' ? 'en-US' : 'is-IS', + ) window.boost.chatPanel.show() } }) @@ -81,7 +84,7 @@ export const BoostChatPanel: React.FC< el.id = 'boost-script' document.body.appendChild(el) } - }, [endpoint]) + }, [activeLocale, endpoint]) const { data } = useQuery(GET_NAMESPACE_QUERY, { variables: { @@ -102,7 +105,12 @@ export const BoostChatPanel: React.FC< return ( window.boost.chatPanel.show()} + onClick={() => { + window.boost.chatPanel.setStartLanguage( + activeLocale === 'en' ? 'en-US' : 'is-IS', + ) + window.boost.chatPanel.show() + }} isVisible={showButton} pushUp={pushUp} />