@everymatrix/casino-header-controller 1.12.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-header-controller",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "main": "dist/casino-header-controller.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "5ba32db088ec6ebf8eb6110b6172d8c9409b9f70"
40
+ "gitHead": "22bb69e504862fb909bc5d21d62ba4178aaefe3d"
41
41
  }
@@ -4,7 +4,7 @@
4
4
  import { onMount } from "svelte";
5
5
  import { isMobile, getDevice } from 'rvhelper';
6
6
  import { _, addNewMessages, setLocale, setupI18n } from './i18n';
7
- import { CasinoHeaderController } from './translations';
7
+ import { TRANSLATIONS } from './translations';
8
8
 
9
9
  import '@everymatrix/casino-slider';
10
10
  import '@everymatrix/casino-hamburger-menu';
@@ -35,7 +35,8 @@
35
35
  export let clientstyling:string = '';
36
36
  export let clientstylingurl:string = '';
37
37
 
38
- let activeIndex:string;
38
+ let primaryActiveIndex:string;
39
+ let secondaryActiveIndex:string;
39
40
  let identity:string = "HeaderMenu";
40
41
  let customStylingContainer:HTMLElement;
41
42
 
@@ -54,8 +55,8 @@
54
55
  });
55
56
  }
56
57
 
57
- Object.keys(CasinoHeaderController).forEach((item:any) => {
58
- addNewMessages(item, CasinoHeaderController[item]);
58
+ Object.keys(TRANSLATIONS).forEach((item:any) => {
59
+ addNewMessages(item, TRANSLATIONS[item]);
59
60
  });
60
61
 
61
62
  const genericIcon:string = `<svg version="1.1" fill="#fff" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="width: 30px; color: #fff;" x="0px" y="0px"
@@ -226,15 +227,20 @@
226
227
  })
227
228
  }
228
229
 
229
- const setActiveIndex = ():void => {
230
- activeIndex = mainMenuArray.find(item => {
230
+ const initializeMenu = ():void => {
231
+ primaryActiveIndex = setActiveIndex(activecategory, mainMenuArray);
232
+ secondaryActiveIndex = setActiveIndex(activecategory, secondaryMenuArray);
233
+ }
234
+
235
+ const setActiveIndex = (activecategory, menuList) => {
236
+ return menuList.find(item => {
231
237
  if ( activecategory.indexOf('/sport') > -1 ) {
232
- return item.path.indexOf(activecategory) > -1
238
+ return item.path.indexOf(activecategory) > -1;
233
239
  } else {
234
240
  //Opted for this solution so that when you go back from casino categories slider it will change the active index when its required from header too
235
- return item.path.indexOf(activecategory.split('/')[1]) > -1
241
+ return item.path.split('/').indexOf(activecategory.split('/')[1]) > -1;
236
242
  }
237
- })?.id;
243
+ })?.id || -1;
238
244
  }
239
245
 
240
246
  const sendSliderData = ():void => {
@@ -243,7 +249,6 @@
243
249
 
244
250
  const getHeaderMenusData = (url:any):Promise<any> => {
245
251
  isLoading = true;
246
-
247
252
  return new Promise((resolve, reject) => {
248
253
  fetch(url)
249
254
  .then((res: any) => res.json())
@@ -318,7 +323,7 @@
318
323
  }
319
324
  });
320
325
 
321
- $: activecategory && !isLoading && setActiveIndex();
326
+ $: activecategory && !isLoading && initializeMenu();
322
327
  $: session && setSession();
323
328
  $: lang && setActiveLanguage();
324
329
  $: cmsendpoint && lang && languageslist && userroles && initialLoad();
@@ -360,7 +365,7 @@
360
365
  <div class="HeaderTopActions" part="HeaderTopActions">
361
366
  <div class="HeaderItemsMenu PrimaryMenu" part="HeaderItemsMenu PrimaryMenu">
362
367
  <player-account-balance-modal {session} {userid} {endpoint} {lang} {clientstyling} {clientstylingurl} {customlocaleidentifier} {gmversion} {displaybalanceoption}/>
363
- <div class="Item ItemDeposit" part="Item ItemDeposit" on:click={() => menuAction('deposit')}>{$_('headerItem.deposit')}</div>
368
+ <div class="Item ItemDeposit" part="Item ItemDeposit" on:click={() => menuAction('deposit')}>{$_('deposit')}</div>
364
369
  <div class="Item ItemAccount" part="Item ItemAccount" on:click={() => menuAction('myaccount')}>
365
370
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16.429" viewBox="0 0 15 16.429">
366
371
  <defs>
@@ -400,7 +405,7 @@
400
405
  use:sendSliderData
401
406
  isprimarymenu=true
402
407
  {actionevent}
403
- activeindex={activeIndex}
408
+ activeindex={primaryActiveIndex}
404
409
  {endpoint}
405
410
  {lang}
406
411
  location="headerMain"
@@ -413,7 +418,7 @@
413
418
  <div class="HeaderTopActions" part="HeaderItemsMenu">
414
419
  <div class="HeaderItemsMenu PrimaryMenu" part="HeaderItemsMenu PrimaryMenu">
415
420
  <player-account-balance-modal {session} {userid} {endpoint} {lang} {clientstyling} {clientstylingurl} {customlocaleidentifier} {gmversion} {displaybalanceoption}/>
416
- <div class="Item ItemDeposit" part="Item ItemDeposit" on:click={() => menuAction('deposit')}>{$_('headerItem.deposit')}</div>
421
+ <div class="Item ItemDeposit" part="Item ItemDeposit" on:click={() => menuAction('deposit')}>{$_('deposit')}</div>
417
422
  <div class="Item ItemAccount" part="Item ItemAccount" on:click={() => menuAction('myaccount')}>
418
423
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16.429" viewBox="0 0 15 16.429">
419
424
  <defs>
@@ -440,7 +445,7 @@
440
445
  <nav class="HeaderSecondaryNav" part="HeaderSecondaryNav">
441
446
  <ul class="HeaderItemsMenuSecondary" part="HeaderItemsMenuSecondary">
442
447
  {#each secondaryMenuArray as secondaryItem}
443
- <li class="ItemSecondary" part="ItemSecondary">
448
+ <li class="ItemSecondary {secondaryActiveIndex?.toString().indexOf('$') > -1 ? (secondaryActiveIndex?.split("$").pop() == secondaryItem.id.split("$").pop() ? 'active': '') : (secondaryActiveIndex == secondaryItem.id ? 'active': '')}" part="ItemSecondary">
444
449
  <button on:click={() => navigationTrigger(secondaryItem)}>{secondaryItem.label}</button>
445
450
  </li>
446
451
  {/each}
@@ -478,8 +483,8 @@
478
483
 
479
484
  <div class="HeaderTopActions" part="HeaderTopActions">
480
485
  <div class="HeaderItemsMenu" part="HeaderItemsMenu">
481
- <div class="Item ItemLogin" part="Item ItemLogin" on:click={()=>menuAction('login')}>{$_('headerItem.login')}</div>
482
- <div class="Item ItemRegister" part="Item ItemRegister" on:click={()=>menuAction('register')}>{$_('headerItem.register')}</div>
486
+ <div class="Item ItemLogin" part="Item ItemLogin" on:click={()=>menuAction('login')}>{$_('login')}</div>
487
+ <div class="Item ItemRegister" part="Item ItemRegister" on:click={()=>menuAction('register')}>{$_('register')}</div>
483
488
  </div>
484
489
  </div>
485
490
  </div>
@@ -504,7 +509,7 @@
504
509
  use:sendSliderData
505
510
  isprimarymenu=true
506
511
  {actionevent}
507
- activeindex={activeIndex}
512
+ activeindex={primaryActiveIndex}
508
513
  location="headerMain"
509
514
  {endpoint}
510
515
  {lang}
@@ -515,8 +520,8 @@
515
520
  </nav>
516
521
  <div class="HeaderTopActions" part="HeaderTopActions">
517
522
  <div class="HeaderItemsMenu" part="HeaderItemsMenu">
518
- <div class="Item ItemLogin" part="Item ItemLogin" tabindex="0" on:click={()=>menuAction('login')}>{$_('headerItem.login')}</div>
519
- <div class="Item ItemRegister" part="Item ItemRegister" tabindex="0" on:click={()=>menuAction('register')}>{$_('headerItem.register')}</div>
523
+ <div class="Item ItemLogin" part="Item ItemLogin" tabindex="0" on:click={()=>menuAction('login')}>{$_('login')}</div>
524
+ <div class="Item ItemRegister" part="Item ItemRegister" tabindex="0" on:click={()=>menuAction('register')}>{$_('register')}</div>
520
525
  <select bind:value={selectedLanguage} class="Item ItemLanguage" part="Item ItemLanguage" on:change={()=>menuAction('language')}>
521
526
  {#each languagesArray as operatorLanguage}
522
527
  <option value={operatorLanguage}>{operatorLanguage}</option>
@@ -528,7 +533,7 @@
528
533
  <nav class="HeaderSecondaryNav" part="HeaderSecondaryNav">
529
534
  <ul class="HeaderItemsMenuSecondary" part="HeaderItemsMenuSecondary">
530
535
  {#each secondaryMenuArray as secondaryItem}
531
- <li class="ItemSecondary" part="ItemSecondary">
536
+ <li class="ItemSecondary {secondaryActiveIndex?.toString().indexOf('$') > -1 ? (secondaryActiveIndex?.split("$").pop() == secondaryItem.id.split("$").pop() ? 'active': '') : (secondaryActiveIndex == secondaryItem.id ? 'active': '')}" part="ItemSecondary">
532
537
  <button on:click={() => navigationTrigger(secondaryItem)}>{secondaryItem.label}</button>
533
538
  </li>
534
539
  {/each}
@@ -716,10 +721,13 @@
716
721
  }
717
722
 
718
723
  .HeaderItemsMenuSecondary .ItemSecondary {
724
+ width: auto;
725
+ height: 100%;
726
+ display: flex;
727
+ justify-content: center;
719
728
  padding: 0 15px;
720
729
  font-weight: 600;
721
730
  transition-duration: 0.15s;
722
- cursor: pointer;
723
731
 
724
732
  button {
725
733
  color: var(--emfe-w-color-white, #FFFFFF);
@@ -730,7 +738,6 @@
730
738
  font-weight: 600;
731
739
  text-transform: uppercase;
732
740
  cursor: pointer;
733
-
734
741
  &:hover {
735
742
  color: var(--emfe-w-color-primary, #D0046C);
736
743
  }
@@ -748,6 +755,9 @@
748
755
  outline: none;
749
756
  }
750
757
  }
758
+ &.active {
759
+ background: var(--emfe-w-color-primary, #D0046C);
760
+ }
751
761
  }
752
762
 
753
763
  .HeaderSliderMobile {
@@ -1,72 +1,44 @@
1
- export const CasinoHeaderController = {
2
- en: {
3
- headerItem: {
4
- login: 'Login',
5
- register: 'Register',
6
- deposit: 'Deposit',
7
- },
8
- fallbackSecondaryMenu: {
9
- promotions: 'Promotions',
10
- }
1
+ export const TRANSLATIONS = {
2
+ "en": {
3
+ "login": "Login",
4
+ "register": "Register",
5
+ "deposit": "Deposit",
6
+ "promotions": "Promotions"
11
7
  },
12
- 'zh-hk': {
13
- headerItem: {
14
- login: '登錄',
15
- register: '登記',
16
- deposit: '訂金',
17
- },
18
- fallbackSecondaryMenu: {
19
- promotions: '促销活动',
20
- }
8
+ "zh-hk": {
9
+ "login": "登錄",
10
+ "register": "登記",
11
+ "deposit": "訂金",
12
+ "promotions": "促销活动"
21
13
  },
22
- fr: {
23
- headerItem: {
24
- login: 'Connexion',
25
- register: 'Enregistrer',
26
- deposit: 'Dépôt',
27
- },
28
- fallbackSecondaryMenu: {
29
- promotions: 'Promotions',
30
- }
14
+ "fr": {
15
+ "login": "Connexion",
16
+ "register": "Enregistrer",
17
+ "deposit": "Dépôt",
18
+ "promotions": "Promotions"
31
19
  },
32
- tr: {
33
- headerItem: {
34
- login: 'Giriş yapmak',
35
- register: 'Kayıt olmak',
36
- deposit: 'Depozito',
37
- },
38
- fallbackSecondaryMenu: {
39
- promotions: 'Promosyonlar',
40
- }
20
+ "tr": {
21
+ "login": "Giriş yapmak",
22
+ "register": "Kayıt olmak",
23
+ "deposit": "Depozito",
24
+ "promotions": "Promosyonlar"
41
25
  },
42
- ro: {
43
- headerItem: {
44
- login: 'Autentificare',
45
- register: 'Inregistrare',
46
- deposit: 'Depozit',
47
- },
48
- fallbackSecondaryMenu: {
49
- promotions: 'Promotii',
50
- }
26
+ "ro": {
27
+ "login": "Autentificare",
28
+ "register": "Inregistrare",
29
+ "deposit": "Depozit",
30
+ "promotions": "Promotii"
51
31
  },
52
- es: {
53
- headerItem: {
54
- login: 'Iniciar sesión',
55
- register: 'Regístrate',
56
- deposit: 'Deposita',
57
- },
58
- fallbackSecondaryMenu: {
59
- promotions: 'Promociones',
60
- }
32
+ "es": {
33
+ "login": "Iniciar sesión",
34
+ "register": "Regístrate",
35
+ "deposit": "Deposita",
36
+ "promotions": "Promociones"
61
37
  },
62
- pt: {
63
- headerItem: {
64
- login: 'Entrar',
65
- register: 'Registro',
66
- deposit: 'Depósito',
67
- },
68
- fallbackSecondaryMenu: {
69
- promotions: 'Promoções',
70
- }
71
- },
72
- };
38
+ "pt": {
39
+ "login": "Entrar",
40
+ "register": "Registro",
41
+ "deposit": "Depósito",
42
+ "promotions": "Promoções"
43
+ }
44
+ }