@everymatrix/casino-slider 0.0.238 → 0.0.242

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/index.html CHANGED
@@ -32,6 +32,6 @@
32
32
  <div class="webcomponent">
33
33
  <casino-slider></casino-slider>
34
34
  </div>
35
-
35
+
36
36
  </body>
37
37
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-slider",
3
- "version": "0.0.238",
3
+ "version": "0.0.242",
4
4
  "main": "dist/casino-slider.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "907a7c1dc6fa627973d37efccc906630b14f646a"
39
+ "gitHead": "3cc82c62fb2a642ad091ac207ae95928c21ba69c"
40
40
  }
@@ -4,6 +4,11 @@
4
4
  import { onMount } from 'svelte';
5
5
  import { getDevice } from 'rvhelper';
6
6
 
7
+ import { _, addNewMessages, setLocale, setupI18n } from './i18n';
8
+ import { CasinoSlider } from './translations';
9
+
10
+ export let sliderdata:Array<any> = [];
11
+ export let onclickeventname:string = 'defaultEvent';
7
12
  export let actionevent:string = 'defaultEvent';
8
13
  export let favoritesnumber:string = '0';
9
14
  export let location:string = '';
@@ -11,16 +16,52 @@
11
16
  export let clientstylingurl:string = '';
12
17
  export let identity:string = '';
13
18
  export let containermaxwidth:string = '';
19
+ export let isprimarymenu:boolean = false;
20
+ export let issecondarymenu:boolean = false;
21
+ export let lang:string = '';
14
22
  export let activeindex:string = '';
15
23
 
24
+ setupI18n({ withLocale: 'en', translations: {}});
25
+
26
+ Object.keys(CasinoSlider).forEach((item:any) => {
27
+ addNewMessages(item, CasinoSlider[item]);
28
+ });
29
+
16
30
  let userAgent:string = window.navigator.userAgent;
17
31
  let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
18
- let sliderdata:string = '';
19
32
 
20
33
  let carousel:any;
21
34
  let activeIndex:number;
22
35
  let customStylingContainer:HTMLElement;
23
36
 
37
+ let fallbackMainMenu = [
38
+ {
39
+ "id": 0,
40
+ "label": $_('fallbackMainMenu.sports'),
41
+ "path": "/sports",
42
+ },
43
+ {
44
+ "id": 1,
45
+ "label": $_('fallbackMainMenu.casino'),
46
+ "path": "/casino",
47
+ },
48
+ {
49
+ "id": 2,
50
+ "label": $_('fallbackMainMenu.liveCasino'),
51
+ "path": "/live-casino",
52
+ },
53
+ {
54
+ "id": 3,
55
+ "label": $_('fallbackMainMenu.virtualSports'),
56
+ "path": "/virtual-sports",
57
+ },
58
+ {
59
+ "id": 4,
60
+ "label": $_('fallbackMainMenu.tournaments'),
61
+ "path": "/tournaments",
62
+ }
63
+ ];
64
+
24
65
  // Clicking on the slider item will trigger this method and send a postmessage on window
25
66
  // @TODO itemId type fix
26
67
  let handleClick = (item:any, index:number):void => {
@@ -68,13 +109,20 @@
68
109
  }
69
110
  }
70
111
 
71
- const messageHandler = (e:any) => {
112
+ const messageHandler = (e:any):void => {
72
113
  if (e.data.type == 'SliderData' && e.data.identity == identity) {
73
114
  sliderdata = e.data.data;
74
115
  }
75
116
  }
76
117
 
118
+ const setActiveLanguage = ():void => {
119
+ setLocale(lang);
120
+ }
121
+
77
122
  onMount(() => {
123
+ if( isprimarymenu && !sliderdata.length ) {
124
+ sliderdata = fallbackMainMenu;
125
+ }
78
126
  window.addEventListener('message', messageHandler, false);
79
127
 
80
128
  return () => {
@@ -85,6 +133,7 @@
85
133
  $: (activeindex || activeindex == 0) && setActiveIndex();
86
134
  $: clientstyling && setClientStyling();
87
135
  $: clientstylingurl && setClientStylingURL();
136
+ $: lang && setActiveLanguage();
88
137
  </script>
89
138
 
90
139
  <div class="CarouselWrapper { (location === 'headerMain') ? 'CarouselWrapperHeaderMain' : '' }" bind:this={customStylingContainer}>
@@ -149,7 +198,7 @@
149
198
  display: flex;
150
199
  flex-direction: row;
151
200
  flex-wrap: nowrap;
152
- justify-content: center;
201
+ justify-content: space-between;
153
202
  width: 100%;
154
203
  color: var(--emfe-w-color-white, #FFFFFF);
155
204
  margin: 0 auto;
package/src/i18n.js ADDED
@@ -0,0 +1,27 @@
1
+ import {
2
+ dictionary,
3
+ locale,
4
+ addMessages,
5
+ _
6
+ } from 'svelte-i18n';
7
+
8
+ function setupI18n({ withLocale: _locale, translations }) {
9
+ locale.subscribe((data) => {
10
+ if (data == null) {
11
+ dictionary.set(translations);
12
+ locale.set(_locale);
13
+ }
14
+ }); // maybe we will need this to make sure that the i18n is set up only once
15
+ /*dictionary.set(translations);
16
+ locale.set(_locale);*/
17
+ }
18
+
19
+ function addNewMessages(lang, dict) {
20
+ addMessages(lang, dict);
21
+ }
22
+
23
+ function setLocale(_locale) {
24
+ locale.set(_locale);
25
+ }
26
+
27
+ export { _, setupI18n, addNewMessages, setLocale };
@@ -0,0 +1,44 @@
1
+ export const CasinoSlider = {
2
+ en: {
3
+ headerItem: {
4
+ login: 'Login',
5
+ register: 'Register',
6
+ deposit: 'Deposit',
7
+ },
8
+ fallbackMainMenu: {
9
+ sports: 'Sports',
10
+ casino: 'Casino',
11
+ liveCasino: 'Live Casino',
12
+ virtualSports: 'Virtual Sports',
13
+ tournaments: 'Tournaments',
14
+ }
15
+ },
16
+ tr: {
17
+ headerItem: {
18
+ login: 'Giriş yapmak',
19
+ register: 'Kayıt olmak',
20
+ deposit: 'Depozito',
21
+ },
22
+ fallbackMainMenu: {
23
+ sports: 'Spor Dalları',
24
+ casino: 'Kumarhane',
25
+ liveCasino: 'Canlı kumarhane',
26
+ virtualSports: 'Sanal Sporlar',
27
+ tournaments: 'Turnuvalar',
28
+ }
29
+ },
30
+ ro: {
31
+ headerItem: {
32
+ login: 'Autentificare',
33
+ register: 'Inregistreaza-te',
34
+ deposit: 'Depozit',
35
+ },
36
+ fallbackMainMenu: {
37
+ sports: 'Sport',
38
+ casino: 'Cazino',
39
+ liveCasino: 'Cazinou live',
40
+ virtualSports: 'Sport virtual',
41
+ tournaments: 'Turnee',
42
+ }
43
+ }
44
+ };