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

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,17 @@
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=""
35
+ endpoint="https://demo-api.stage.norway.everymatrix.com"
36
+ lang="en"
37
+ datasource="RNG"
38
+ categoryid="RNG$jacpots"
39
+ fetchviaevent="false"
40
+ gamepagemodalurl="true"
41
+ integratedgameframedesktop="true"
42
+ integratedgameframemobile="true">
43
+ </casino-games-category-section>
34
44
  </div>
35
45
 
36
46
  </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.1",
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": "0b3995d8c9121bfc27eb9aed6a034bbd1583400b"
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';
@@ -28,7 +28,7 @@
28
28
  export let categoryid:string = '';
29
29
  export let showgamename:string = '';
30
30
  export let livecasino:string = 'false';
31
- export let gamepagemodalurl:string = 'false';
31
+ export let gamepagemodalurl:string = 'true';
32
32
  export let integratedgameframedesktop:string = 'false';
33
33
  export let integratedgameframemobile:string = 'false';
34
34
  export let casinomygames:string = 'false';
@@ -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,32 @@
266
268
  });
267
269
  }
268
270
 
271
+ //Standalone fetching games using categoryid when fetchviaevent is false
272
+ const fetchGamesByCategory = (categoryid, displayedgamecount) => {
273
+ if(categoryid !== ''){
274
+ searched = false;
275
+ lobbyView = true;
276
+ addfilterselector = 'false';
277
+ addsortingselector = 'false';
278
+ showLoadCategory = true;
279
+ searchItem = false;
280
+ validObservers = false;
281
+
282
+ getData(categoryid, 0, +displayedgamecount).then((res:any) => {
283
+ categoryData = res;
284
+ shownCategoryData = categoryData.games.items;
285
+ if (shownCategoryData) {
286
+ shownCategoryData.forEach((item:any) => {
287
+ item.isFavorite = checkFavorite(item.id);
288
+ });
289
+
290
+ }
291
+ });
292
+ }
293
+ }
294
+
269
295
  const messageHandler = (e:any) => {
296
+
270
297
  if (e.data) {
271
298
  switch(e.data.type) {
272
299
  case 'MostPlayedData':
@@ -477,7 +504,7 @@
477
504
  // do nothing
478
505
  break;
479
506
  }
480
- }
507
+ }
481
508
  }
482
509
 
483
510
  // @TODO categoryId type fix
@@ -589,6 +616,10 @@
589
616
  }
590
617
  }
591
618
 
619
+ const setActiveLanguage = ():void => {
620
+ setLocale(lang);
621
+ }
622
+
592
623
  const setClientStyling = ():void => {
593
624
  let sheet = document.createElement('style');
594
625
  sheet.innerHTML = clientstyling;
@@ -609,18 +640,22 @@
609
640
  }
610
641
 
611
642
  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 () => {
619
- window.removeEventListener('message', messageHandler);
620
- window.removeEventListener('visibilitychange', messageHandler);
643
+ if(fetchviaevent === 'true'){
644
+ window.addEventListener('visibilitychange', (e) => handleVisibilityChange())
645
+ window.addEventListener('message', messageHandler, false);
646
+ if(categoryid === 'FAVORITES') {
647
+ window.postMessage({ type: 'GetFavoredGame' }, window.location.href);
648
+ }
649
+
650
+ return () => {
651
+ window.removeEventListener('message', messageHandler);
652
+ window.removeEventListener('visibilitychange', messageHandler);
653
+ }
621
654
  }
622
655
  });
623
-
656
+
657
+ $: lang && setActiveLanguage();
658
+ $: (fetchviaevent === 'false' || fetchviaevent === '') && endpoint && lang && categoryid && datasource && displayedgamecount && fetchGamesByCategory(categoryid, displayedgamecount);
624
659
  $: dataloaded && thumbnailContainer && setupObserver();
625
660
  $: lang && categoryid && initialSetup();
626
661
  $: 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 };