@everymatrix/casino-header-controller 1.16.1 → 1.16.2

Sign up to get free protection for your applications and to get access to all the features.
package/index.html CHANGED
@@ -22,7 +22,10 @@
22
22
  </style>
23
23
 
24
24
  <div class="webcomponent">
25
- <casino-header-controller _ngcontent-mup-c29="" session="01347826-ed6c-4305-80c7-1dab6b2fc151" userid="3920216" userroles="everyone,loggedIn,TestDemoCosmin" cmsendpoint="https://wt1-stage.everymatrix.com/apijson" env="stage" lang="en" languageslist="en,ro" endpoint="https://demo-api.stage.norway.everymatrix.com/v1" actionevent="HeaderMenuItemClicked" activecategory="/casino/RNG$new-sub-category$new-sub-category-1" clientstyling="
25
+ <casino-header-controller _ngcontent-mup-c29="" session="01347826-ed6c-4305-80c7-1dab6b2fc151" userid="3920216"
26
+ userroles="everyone,loggedIn,TestDemoCosmin" cmsendpoint="https://wt1-stage.everymatrix.com/apijson" env="stage"
27
+ lang="en" languageslist="es,en,ro" endpoint="https://demo-api.stage.norway.everymatrix.com/v1"
28
+ actionevent="HeaderMenuItemClicked" activecategory="/casino/RNG$new-sub-category$new-sub-category-1" clientstyling="
26
29
  .HeaderWrapper{
27
30
  position: fixed;
28
31
  top: 0;
@@ -30,13 +33,14 @@
30
33
  right: 0;
31
34
  z-index: 99;
32
35
  }
33
-
36
+
34
37
  .HeaderMobileWrapper {
35
38
  .HeaderContainer {
36
39
  height: 55px;
37
40
  }
38
41
  }
39
- " currencyseparator="." currencydecimal="," currencyprecision="2" gmversion="gmcore"></casino-header-controller>
42
+ " currencyseparator="." currencydecimal="," currencyprecision="2" gmversion="gmcore"
43
+ countryflagheader="true" countryflaghamburger='true'customlocaleidentifier=""></casino-header-controller>
40
44
 
41
45
  </div>
42
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-header-controller",
3
- "version": "1.16.1",
3
+ "version": "1.16.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": "a305078a67c4daeeb719b3e79cecee8b7c87f030"
40
+ "gitHead": "d6dc249addf978ca75bc9b3d5f1a80c33649638a"
41
41
  }
@@ -309,6 +309,27 @@
309
309
  window.postMessage({ type: actionevent, itemId: itemData.id, item: itemData, externalLink: itemData.externalLink || false, target: itemData.attrs?.target || null }, window.location.href);
310
310
  }
311
311
 
312
+ const selectLanguage = (operatorLanguage:string): void => {
313
+ selectedLanguage = operatorLanguage;
314
+ isOptionsListVisible = false;
315
+ menuAction('language');
316
+ }
317
+
318
+ const toggleLanguageDropdown = (): void => {
319
+ isOptionsListVisible = !isOptionsListVisible;
320
+ }
321
+
322
+ const determineFlag = (selectedLanguage: string): string => {
323
+ if (customlocaleidentifier) {
324
+ selectedLanguage =
325
+ customlocaleidentifier.includes(selectedLanguage.toLowerCase()) ?
326
+ customlocaleidentifier.slice(-2) :
327
+ selectedLanguage;
328
+ }
329
+
330
+ return selectedLanguage == 'EN' ? 'US' : selectedLanguage.toUpperCase();
331
+ }
332
+
312
333
  const setClientStyling = ():void => {
313
334
  let sheet = document.createElement('style');
314
335
  sheet.innerHTML = clientstyling;
@@ -328,16 +349,6 @@
328
349
  });
329
350
  }
330
351
 
331
- function selectLanguage(operatorLanguage:string) {
332
- selectedLanguage = operatorLanguage;
333
- isOptionsListVisible = false;
334
- menuAction('language');
335
- }
336
-
337
- function toggleLanguageDropdown() {
338
- isOptionsListVisible = !isOptionsListVisible;
339
- }
340
-
341
352
  onMount(async () => {
342
353
  window.addEventListener('message', messageHandler, false);
343
354
 
@@ -353,7 +364,7 @@
353
364
  $: activecategory && !isLoading && initializeMenu();
354
365
  $: session && setSession();
355
366
  $: lang && setActiveLanguage();
356
- $: cmsendpoint && lang && languageslist && userroles && countryflagheader && initialLoad();
367
+ $: cmsendpoint && lang && languageslist && userroles && initialLoad();
357
368
  $: translationurl && setTranslationUrl();
358
369
  $: clientstyling && customStylingContainer && setClientStyling();
359
370
  $: clientstylingurl && customStylingContainer && setClientStylingURL();
@@ -470,9 +481,10 @@
470
481
  </select>
471
482
  {:else}
472
483
  <div class="LanguageDropdown">
484
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
473
485
  <div class="SelectedOption Item ItemLanguage" on:click={() => toggleLanguageDropdown()}>
474
486
  <span class="FlagIcon">
475
- <img src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${selectedLanguage.toUpperCase() == 'EN' ? 'US' : selectedLanguage.toUpperCase()}.svg`}/>
487
+ <img src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${determineFlag(selectedLanguage)}.svg`}/>
476
488
  </span>
477
489
  <span class="LanguageName">{selectedLanguage}</span>
478
490
  <span class="TriangleInactive {isOptionsListVisible ? 'TriangleActive' : ''}">
@@ -486,7 +498,7 @@
486
498
  {#each languagesArray as operatorLanguage}
487
499
  <div class="LanguageOption" on:click={() => selectLanguage(operatorLanguage)}>
488
500
  <span class="FlagIcon">
489
- <img src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${operatorLanguage.toUpperCase() == 'EN' ? 'US' : operatorLanguage.toUpperCase()}.svg`}/>
501
+ <img src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${determineFlag(operatorLanguage)}.svg`}/>
490
502
  </span>
491
503
  <span class="LanguageName">{operatorLanguage}</span>
492
504
  </div>
@@ -590,7 +602,7 @@
590
602
  <div class="LanguageDropdown">
591
603
  <div class="SelectedOption Item ItemLanguage" on:click={() => toggleLanguageDropdown()}>
592
604
  <span class="FlagIcon">
593
- <img src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${selectedLanguage.toUpperCase() == 'EN' ? 'US' : selectedLanguage.toUpperCase()}.svg`}/>
605
+ <img src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${determineFlag(selectedLanguage)}.svg`}/>
594
606
  </span>
595
607
  <span class="LanguageName">{selectedLanguage}</span>
596
608
  <span class="TriangleInactive {isOptionsListVisible ? 'TriangleActive' : ''}">
@@ -604,7 +616,7 @@
604
616
  {#each languagesArray as operatorLanguage}
605
617
  <div class="LanguageOption" on:click={() => selectLanguage(operatorLanguage)}>
606
618
  <span class="FlagIcon">
607
- <img src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${operatorLanguage.toUpperCase() == 'EN' ? 'US' : operatorLanguage.toUpperCase()}.svg`}/>
619
+ <img src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${determineFlag(operatorLanguage)}.svg`}/>
608
620
  </span>
609
621
  <span class="LanguageName">{operatorLanguage}</span>
610
622
  </div>
@@ -630,7 +642,7 @@
630
642
  {/if}
631
643
  {/if}
632
644
 
633
- <casino-hamburger-menu menuitemsurl={hamburgerURL} {activecategory} {lang} {countryflaghamburger} {languageslist} {clientstyling} {clientstylingurl}></casino-hamburger-menu>
645
+ <casino-hamburger-menu menuitemsurl={hamburgerURL} {activecategory} {lang} {countryflaghamburger} {customlocaleidentifier} {languageslist} {clientstyling} {clientstylingurl}></casino-hamburger-menu>
634
646
 
635
647
  <style lang="scss">
636
648