diff --git a/packages/core/src/App/Components/Elements/LiveChat/live-chat.jsx b/packages/core/src/App/Components/Elements/LiveChat/live-chat.jsx index f1037397c8b3..3b7d1f572e55 100644 --- a/packages/core/src/App/Components/Elements/LiveChat/live-chat.jsx +++ b/packages/core/src/App/Components/Elements/LiveChat/live-chat.jsx @@ -4,8 +4,8 @@ import { Popover, Icon, Text } from '@deriv/components'; import { localize } from '@deriv/translations'; import useLiveChat from 'App/Components/Elements/LiveChat/use-livechat.ts'; -const LiveChat = ({ is_mobile_drawer, has_cookie_account }) => { - const liveChat = useLiveChat(has_cookie_account); +const LiveChat = ({ is_mobile_drawer, has_cookie_account, loginid }) => { + const liveChat = useLiveChat(has_cookie_account, loginid); if (!liveChat.isReady) return null; @@ -36,4 +36,5 @@ const LiveChat = ({ is_mobile_drawer, has_cookie_account }) => { export default connect(({ client }) => ({ has_cookie_account: client.has_cookie_account, + loginid: client.loginid, }))(LiveChat); diff --git a/packages/core/src/App/Components/Elements/LiveChat/use-livechat.ts b/packages/core/src/App/Components/Elements/LiveChat/use-livechat.ts index 6d52e1aab9aa..7e5c9bf7e796 100644 --- a/packages/core/src/App/Components/Elements/LiveChat/use-livechat.ts +++ b/packages/core/src/App/Components/Elements/LiveChat/use-livechat.ts @@ -5,7 +5,7 @@ import Cookies from 'js-cookie'; import { deriv_urls } from '@deriv/shared'; // Todo: Should break this into smaller hooks or utility functions. -const useLiveChat = (has_cookie_account = false) => { +const useLiveChat = (has_cookie_account = false, active_loginid?: string) => { const [isReady, setIsReady] = useState(false); const [reload, setReload] = useState(false); const history = useHistory(); @@ -42,7 +42,7 @@ const useLiveChat = (has_cookie_account = false) => { window.LiveChatWidget?.on('ready', () => { let client_first_name = ''; let client_last_name = ''; - const domain = /^(.)*deriv\.(com|me)$/gi.test(window.location.hostname) + const domain = /^(.)*deriv\.(com|me|be)$/gi.test(window.location.hostname) ? deriv_urls.DERIV_HOST_NAME : 'binary.sx'; const client_information = Cookies.getJSON('client_information', { @@ -121,7 +121,7 @@ const useLiveChat = (has_cookie_account = false) => { } }, [reload, has_cookie_account]); - useEffect(() => liveChatSetup(has_cookie_account), [has_cookie_account]); + useEffect(() => liveChatSetup(has_cookie_account), [has_cookie_account, active_loginid]); return { isReady, diff --git a/packages/core/src/App/Components/Layout/Header/toggle-menu-drawer.jsx b/packages/core/src/App/Components/Layout/Header/toggle-menu-drawer.jsx index f43043129bb8..32959940fca4 100644 --- a/packages/core/src/App/Components/Layout/Header/toggle-menu-drawer.jsx +++ b/packages/core/src/App/Components/Layout/Header/toggle-menu-drawer.jsx @@ -177,6 +177,7 @@ const ToggleMenuDrawer = observer(({ platform_config }) => { is_logged_in, is_logging_in, is_virtual, + loginid, logout: logoutClient, should_allow_authentication, landing_company_shortcode: active_account_landing_company, @@ -193,7 +194,7 @@ const ToggleMenuDrawer = observer(({ platform_config }) => { const { data: is_payment_agent_transfer_visible } = usePaymentAgentTransferVisible(); const { data: is_p2p_enabled } = useIsP2PEnabled(); - const liveChat = useLiveChat(); + const liveChat = useLiveChat(false, loginid); const [is_open, setIsOpen] = React.useState(false); const [transitionExit, setTransitionExit] = React.useState(false); const [primary_routes_config, setPrimaryRoutesConfig] = React.useState([]); diff --git a/packages/core/src/Stores/traders-hub-store.js b/packages/core/src/Stores/traders-hub-store.js index e3afa1aad9c0..1f4bdb2172f7 100644 --- a/packages/core/src/Stores/traders-hub-store.js +++ b/packages/core/src/Stores/traders-hub-store.js @@ -365,7 +365,7 @@ export default class TradersHubStore extends BaseStore { availability: 'All', }, { - name: !this.is_eu_user ? localize('Swap-Free') : '', + name: localize('Swap-Free'), description: getSwapFreeAccountDesc(), platform: CFD_PLATFORMS.MT5, market_type: 'all',