Skip to content

Commit

Permalink
Merge branch 'binary-com:master' into shaheer/feature/90115/update_ju…
Browse files Browse the repository at this point in the history
…risdiction
  • Loading branch information
shaheer-deriv committed May 26, 2023
2 parents 68d3b28 + 85638a5 commit f876202
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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', {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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([]);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Stores/traders-hub-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit f876202

Please sign in to comment.