From 09c6ed35d792639cd2ff621210cfc745e6aba79f Mon Sep 17 00:00:00 2001 From: Maryia <87321516+maryia-deriv@users.noreply.github.com> Date: Mon, 7 Feb 2022 05:48:17 +0300 Subject: [PATCH] Maryia/Hotfix to show correct notifications (#4811) * Maryia/Hotfix to show correct notifications * Maryia/fix for a dev env console error * Maryia/fix for belgium mlt to not show deriv_go popup * Maryia/Fix to set notifications on init and then update --- .../Components/Layout/Header/menu-links.jsx | 18 ++++++++++-------- packages/core/src/Stores/client-store.js | 9 ++++++--- packages/core/src/Stores/notification-store.js | 10 ++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/packages/core/src/App/Components/Layout/Header/menu-links.jsx b/packages/core/src/App/Components/Layout/Header/menu-links.jsx index 7d63932563dd..5e76f4b76ec4 100644 --- a/packages/core/src/App/Components/Layout/Header/menu-links.jsx +++ b/packages/core/src/App/Components/Layout/Header/menu-links.jsx @@ -7,8 +7,10 @@ const MenuLinks = ({ is_logged_in, items }) => ( {!!items.length && (
- {items.map((item, idx) => - item.login_only && item.login_only !== is_logged_in ? null : ( + {items.map((item, idx) => { + const item_text = item.text(); + + return item.login_only && item.login_only !== is_logged_in ? null : ( ( active_class='header__menu-link--active' > - {item.text && ( + {item_text && ( {item.icon} - {item.text()} + {item_text} {item.logo} )} @@ -39,8 +41,8 @@ const MenuLinks = ({ is_logged_in, items }) => ( )} - ) - )} + ); + })}
)}
@@ -54,7 +56,7 @@ MenuLinks.propTypes = { }), is_logged_in: PropTypes.bool, link_to: PropTypes.string, - text: PropTypes.function, + text: PropTypes.func, }) ), }; diff --git a/packages/core/src/Stores/client-store.js b/packages/core/src/Stores/client-store.js index de4c44d6582f..7f5890991dad 100644 --- a/packages/core/src/Stores/client-store.js +++ b/packages/core/src/Stores/client-store.js @@ -565,11 +565,14 @@ export default class ClientStore extends BaseStore { @computed get is_eu() { if (!this.landing_companies) return false; - const { gaming_company, financial_company } = this.landing_companies; + const { gaming_company, financial_company, mt_gaming_company } = this.landing_companies; const financial_shortcode = financial_company?.shortcode; const gaming_shortcode = gaming_company?.shortcode; - return financial_shortcode || gaming_shortcode - ? eu_shortcode_regex.test(financial_shortcode) || eu_shortcode_regex.test(gaming_shortcode) + const mt_gaming_shortcode = mt_gaming_company?.financial.shortcode || mt_gaming_company?.swap_free.shortcode; + return financial_shortcode || gaming_shortcode || mt_gaming_shortcode + ? eu_shortcode_regex.test(financial_shortcode) || + eu_shortcode_regex.test(gaming_shortcode) || + eu_shortcode_regex.test(mt_gaming_shortcode) : eu_excluded_regex.test(this.residence); } diff --git a/packages/core/src/Stores/notification-store.js b/packages/core/src/Stores/notification-store.js index 9c12601a7ee7..66e5a5dca572 100644 --- a/packages/core/src/Stores/notification-store.js +++ b/packages/core/src/Stores/notification-store.js @@ -335,6 +335,16 @@ export default class NotificationStore extends BaseStore { @action.bound init() { this.setClientNotifications(); + reaction( + () => [ + this.root_store.client.is_uk, + this.root_store.client.has_malta_account, + this.root_store.client.can_have_mlt_account, + ], + () => { + this.setClientNotifications(); + } + ); } @action.bound