@@ -12,73 +12,54 @@ const DerivBanner = (() => {
1212 el_close_button ,
1313 multiplier_link ;
1414
15- const onLoad = ( ) => {
15+ const redBanner = ( ) => {
1616 const is_deriv_banner_dismissed = localStorage . getItem ( 'is_deriv_banner_dismissed' ) ;
1717
18- BinarySocket . wait ( 'authorize' , 'website_status' , 'landing_company' ) . then ( ( ) => {
18+ if ( ! is_deriv_banner_dismissed ) {
19+ const affiliate_cookie = Cookies . getJSON ( 'affiliate_tracking' ) ;
20+ let affiliate_token ;
1921
20- const eu_country = isEuCountrySelected ( Client . get ( 'residence' ) ) || isEuCountrySelected ( State . getResponse ( 'website_status.clients_country' ) ) ;
22+ if ( affiliate_cookie ) affiliate_token = affiliate_cookie . t ;
23+ else {
24+ const queryString = window . location . search ;
25+ const urlParams = new URLSearchParams ( queryString ) ;
26+ affiliate_token = urlParams . get ( 't' ) ;
27+ }
28+
29+ el_multiplier_banner_container = getElementById ( 'multiplier_banner_container' ) ;
30+ multiplier_link = getElementById ( 'multiplier-link' ) ;
2131
22- if ( eu_country ) return ;
32+ const lang = getLanguage ( ) . toLowerCase ( ) ;
33+ const multiplier_href = `https://deriv.com/${ lang } /trade-types/multiplier/?utm_source=binary&utm_medium=referral&utm_campaign=ww-banner-deriv-1020-en&utm_content=multiplier-banner-synthetic-indices-amplified` ;
2334
24- if ( ! is_deriv_banner_dismissed ) {
25- const affiliate_cookie = Cookies . getJSON ( 'affiliate_tracking' ) ;
26- let affiliate_token ;
35+ multiplier_link . href = affiliate_token ? `${ multiplier_href } &t=${ affiliate_token } ` : multiplier_href ;
2736
28- if ( affiliate_cookie ) affiliate_token = affiliate_cookie . t ;
29- else {
30- const queryString = window . location . search ;
31- const urlParams = new URLSearchParams ( queryString ) ;
32- affiliate_token = urlParams . get ( 't' ) ;
33- }
34-
35- el_multiplier_banner_container = getElementById ( 'multiplier_banner_container' ) ;
36- multiplier_link = getElementById ( 'multiplier-link' ) ;
37+ el_multiplier_banner_container . setVisibility ( 1 ) ;
38+ el_close_button = el_multiplier_banner_container . querySelector ( '.deriv_banner_close' ) || createElement ( 'div' ) ;
39+ el_close_button . addEventListener ( 'click' , onClose ) ;
40+ }
41+ } ;
42+
43+ const onLoad = ( ) => {
3744
38- const lang = getLanguage ( ) . toLowerCase ( ) ;
39- const multiplier_href = `https://deriv.com/${ lang } /trade-types/multiplier/?utm_source=binary&utm_medium=referral&utm_campaign=ww-banner-deriv-1020-en&utm_content=multiplier-banner-synthetic-indices-amplified` ;
45+ BinarySocket . wait ( 'authorize' , 'website_status' , 'landing_company' ) . then ( ( ) => {
4046
41- multiplier_link . href = affiliate_token ? ` ${ multiplier_href } &t= ${ affiliate_token } ` : multiplier_href ;
47+ const eu_country = isEuCountrySelected ( Client . get ( 'residence' ) ) || isEuCountrySelected ( State . getResponse ( 'website_status.clients_country' ) ) ;
4248
43- el_multiplier_banner_container . setVisibility ( 1 ) ;
44- el_close_button = el_multiplier_banner_container . querySelector ( '.deriv_banner_close' ) || createElement ( 'div' ) ;
45- el_close_button . addEventListener ( 'click' , onClose ) ;
46- }
49+ if ( eu_country ) return ;
50+ redBanner ( ) ;
4751 } ) ;
4852 } ;
4953
5054 const loginOnLoad = ( ) => {
51- const is_deriv_banner_dismissed = localStorage . getItem ( 'is_deriv_banner_dismissed' ) ;
5255
5356 BinarySocket . wait ( 'authorize' , 'website_status' , 'landing_company' ) . then ( ( ) => {
5457
5558 const client_account = Client . get ( 'landing_company_shortcode' ) === 'svg' ;
5659
5760 if ( ! client_account ) return ;
61+ redBanner ( ) ;
5862
59- if ( ! is_deriv_banner_dismissed ) {
60- const affiliate_cookie = Cookies . getJSON ( 'affiliate_tracking' ) ;
61- let affiliate_token ;
62-
63- if ( affiliate_cookie ) affiliate_token = affiliate_cookie . t ;
64- else {
65- const queryString = window . location . search ;
66- const urlParams = new URLSearchParams ( queryString ) ;
67- affiliate_token = urlParams . get ( 't' ) ;
68- }
69-
70- el_multiplier_banner_container = getElementById ( 'multiplier_banner_container' ) ;
71- multiplier_link = getElementById ( 'multiplier-link' ) ;
72-
73- const lang = getLanguage ( ) . toLowerCase ( ) ;
74- const multiplier_href = `https://deriv.com/${ lang } /trade-types/multiplier/?utm_source=binary&utm_medium=referral&utm_campaign=ww-banner-deriv-1020-en&utm_content=multiplier-banner-synthetic-indices-amplified` ;
75-
76- multiplier_link . href = affiliate_token ? `${ multiplier_href } &t=${ affiliate_token } ` : multiplier_href ;
77-
78- el_multiplier_banner_container . setVisibility ( 1 ) ;
79- el_close_button = el_multiplier_banner_container . querySelector ( '.deriv_banner_close' ) || createElement ( 'div' ) ;
80- el_close_button . addEventListener ( 'click' , onClose ) ;
81- }
8263 } ) ;
8364 } ;
8465
@@ -97,6 +78,7 @@ const DerivBanner = (() => {
9778 onLoad,
9879 onUnload,
9980 loginOnLoad,
81+ redBanner,
10082 } ;
10183} ) ( ) ;
10284
0 commit comments