@everymatrix/casino-games-category-section 1.30.1 → 1.31.0

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
@@ -30,7 +30,14 @@
30
30
  </header>
31
31
 
32
32
  <div class="webcomponent">
33
- <casino-games-category-section></casino-games-category-section>
33
+ <casino-games-category-section
34
+ displayedgamecount="4"
35
+ endpoint="https://demo-api.stage.norway.everymatrix.com"
36
+ lang="en"
37
+ datasource="RNG"
38
+ categoryid="RNG$jacpots"
39
+ fetchviaevent="">
40
+ </casino-games-category-section>
34
41
  </div>
35
42
 
36
43
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-games-category-section",
3
- "version": "1.30.1",
3
+ "version": "1.31.0",
4
4
  "main": "dist/casino-games-category-section.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "fb8f6763064049c1da23e78c065e8c2bca2aa409"
38
+ "gitHead": "2cd63cac8a1345eb832337233e848d196c3d9a7b"
39
39
  }
package/rollup.config.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  allowCrossOrigin: true,
45
45
  historyApiFallback: false,
46
46
  host: 'localhost',
47
- port: 5052,
47
+ port: 5050,
48
48
  }),
49
49
  dev && livereload({ watch: ['', 'dist'] }),
50
50
  typescript({
@@ -3,7 +3,7 @@
3
3
  <script lang="ts">
4
4
  import { onMount } from "svelte";
5
5
  import { platformFavorite, getDevice, isMobile } from 'rvhelper';
6
- import { _, addNewMessages } from './i18n';
6
+ import { _, addNewMessages, setLocale } from './i18n';
7
7
  import type { CategoryData } from './CasinoGamesCategorySection.type';
8
8
  import { TRANSLATIONS } from './translations';
9
9
  import moment from 'moment';
@@ -36,6 +36,8 @@
36
36
  export let addsortingselector:string = 'false';
37
37
  export let filterbylogo:string = '';
38
38
  export let casinogamesgridslider:string = 'false';
39
+ export let fetchviaevent:string = 'false';
40
+ export let displayedgamecount:string = '10';
39
41
 
40
42
  //Revert manually
41
43
  // let livelobbyendpoint = `${endpoint}/lobby/tables`;
@@ -83,7 +85,7 @@
83
85
  let hidden;
84
86
  let visibilityChange;
85
87
  let dataloaded;
86
-
88
+
87
89
  let favoriteGamesData:any = {
88
90
  items: [],
89
91
  count: 0,
@@ -266,7 +268,31 @@
266
268
  });
267
269
  }
268
270
 
271
+ const fetchGamesByCategory = (categoryid, displayedgamecount) => {
272
+ if(categoryid !== ''){
273
+ searched = false;
274
+ lobbyView = true;
275
+ addfilterselector = 'false';
276
+ addsortingselector = 'false';
277
+ showLoadCategory = true;
278
+ searchItem = false;
279
+ validObservers = false;
280
+
281
+ getData(categoryid, 0, +displayedgamecount).then((res:any) => {
282
+ categoryData = res;
283
+ shownCategoryData = categoryData.games.items;
284
+ if (shownCategoryData) {
285
+ shownCategoryData.forEach((item:any) => {
286
+ item.isFavorite = checkFavorite(item.id);
287
+ });
288
+
289
+ }
290
+ });
291
+ }
292
+ }
293
+
269
294
  const messageHandler = (e:any) => {
295
+
270
296
  if (e.data) {
271
297
  switch(e.data.type) {
272
298
  case 'MostPlayedData':
@@ -477,7 +503,7 @@
477
503
  // do nothing
478
504
  break;
479
505
  }
480
- }
506
+ }
481
507
  }
482
508
 
483
509
  // @TODO categoryId type fix
@@ -589,6 +615,10 @@
589
615
  }
590
616
  }
591
617
 
618
+ const setActiveLanguage = ():void => {
619
+ setLocale(lang);
620
+ }
621
+
592
622
  const setClientStyling = ():void => {
593
623
  let sheet = document.createElement('style');
594
624
  sheet.innerHTML = clientstyling;
@@ -609,18 +639,22 @@
609
639
  }
610
640
 
611
641
  onMount(() => {
612
- window.addEventListener('visibilitychange', (e) => handleVisibilityChange())
613
- window.addEventListener('message', messageHandler, false);
614
- if(categoryid === 'FAVORITES') {
615
- window.postMessage({ type: 'GetFavoredGame' }, window.location.href);
616
- }
617
-
618
- return () => {
642
+ if(fetchviaevent === 'true'){
643
+ window.addEventListener('visibilitychange', (e) => handleVisibilityChange())
644
+ window.addEventListener('message', messageHandler, false);
645
+ if(categoryid === 'FAVORITES') {
646
+ window.postMessage({ type: 'GetFavoredGame' }, window.location.href);
647
+ }
648
+
649
+ return () => {
619
650
  window.removeEventListener('message', messageHandler);
620
651
  window.removeEventListener('visibilitychange', messageHandler);
621
652
  }
653
+ }
622
654
  });
623
-
655
+
656
+ $: lang && setActiveLanguage();
657
+ $: endpoint && lang && categoryid && datasource && (fetchviaevent === 'false' || fetchviaevent === '') && displayedgamecount && fetchGamesByCategory(categoryid, displayedgamecount);
624
658
  $: dataloaded && thumbnailContainer && setupObserver();
625
659
  $: lang && categoryid && initialSetup();
626
660
  $: translationurl && setTranslationUrl();
package/src/i18n.js CHANGED
@@ -14,4 +14,8 @@ function addNewMessages(lang, dict) {
14
14
  addMessages(lang, dict);
15
15
  }
16
16
 
17
- export { _, setupI18n, addNewMessages };
17
+ function setLocale(_locale) {
18
+ locale.set(_locale);
19
+ }
20
+
21
+ export { _, setupI18n, addNewMessages, setLocale };