@@ -20,6 +20,18 @@ export const isEuCountry = (clients_country, landing_company) => {
2020 : eu_excluded_regex . test ( clients_country ) ;
2121} ;
2222
23+ export const isMFCountry = ( landing_company ) => {
24+ const mf_shortcode_regex = new RegExp ( "^(maltainvest)$" ) ;
25+ const gaming_shortcode =
26+ ( landing_company && landing_company . gaming_company )
27+ ? landing_company . gaming_company . shortcode
28+ : "" ;
29+
30+ return gaming_shortcode
31+ ? mf_shortcode_regex . test ( gaming_shortcode )
32+ : false ;
33+ }
34+
2335export const init = ( ) => {
2436 const banner = $ ( $banner ) . i18n ( ) ;
2537 const nav = $ ( "body" ) . find ( "nav" ) ;
@@ -33,10 +45,15 @@ const showBanner = () => {
3345 const banner = document . getElementById ( "close_banner_container" ) ;
3446 if ( local_storage . get ( "oauth" ) ) {
3547 liveapi . cached . authorize ( ) . then ( ( ) => {
48+ const current_loginId = local_storage . get ( 'authorize' ) . loginid ;
49+ const getLoginId = loginids ( ) . filter ( item => item . id === current_loginId ) ;
50+ const is_mf_account = getLoginId [ 0 ] . is_mf ;
51+ const is_virtual = getLoginId [ 0 ] . is_virtual ;
3652 const country = local_storage . get ( "authorize" ) . country ;
3753 liveapi . send ( { landing_company : country } ) . then ( ( data ) => {
3854 const landing_company = data . landing_company ;
39- if ( isEuCountry ( country , landing_company ) ) {
55+ if ( isEuCountry ( country , landing_company ) &&
56+ ( is_mf_account || ( isMFCountry ( landing_company ) && is_virtual ) ) ) {
4057 banner . classList . remove ( "invisible" ) ;
4158 } else {
4259 banner . classList . add ( "invisible" ) ;
@@ -64,6 +81,9 @@ liveapi.events.on("login", () => {
6481liveapi . events . on ( "logout" , ( ) => {
6582 showBanner ( ) ;
6683} ) ;
84+ liveapi . events . on ( "switch_account" , ( ) => {
85+ showBanner ( )
86+ } ) ;
6787
6888export default {
6989 init,
0 commit comments