@everymatrix/casino-random-game 0.0.274 → 0.0.277

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,7 +32,7 @@
32
32
  <div class="webcomponent">
33
33
  <casino-random-game
34
34
  endpoint="https://demo-api.stage.norway.everymatrix.com/v1"
35
- datasource="RNG"
35
+ datasource="livecasino"
36
36
  gameevent="ShowGameModal"
37
37
  ></casino-random-game>
38
38
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-random-game",
3
- "version": "0.0.274",
3
+ "version": "0.0.277",
4
4
  "main": "dist/casino-random-game.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": "5f4a46f4ce5cd4820b4f3805beaf2130f76cd364"
39
+ "gitHead": "d2e5336b4c4e4506334e1811991a2fbd332110ef"
40
40
  }
@@ -20,13 +20,14 @@
20
20
 
21
21
  let userAgent:string = window.navigator.userAgent;
22
22
 
23
- // setupI18n({ withLocale: 'en', translations: {}});
23
+ setupI18n({ withLocale: 'en', translations: {}});
24
24
 
25
25
  Object.keys(CasinoRandomGameTranslations).forEach((item:any) => {
26
26
  addNewMessages(item, CasinoRandomGameTranslations[item]);
27
27
  });
28
28
 
29
29
  const getRandomGame = ():void => {
30
+ gamesToShow = shuffle(gamesToShow);
30
31
  offset = 0;
31
32
  count = 0;
32
33
  slotDone = false;
@@ -44,8 +45,21 @@
44
45
  }, 100);
45
46
  }
46
47
 
48
+ const shuffle = (array):Array<any> => {
49
+ let currentIndex = array.length, randomIndex;
50
+
51
+ while (currentIndex != 0) {
52
+ randomIndex = Math.floor(Math.random() * currentIndex);
53
+ currentIndex--;
54
+
55
+ [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
56
+ }
57
+
58
+ return array;
59
+ }
60
+
47
61
  const playGame = ():void => {
48
- window.postMessage({ type: gameevent, gameId: randomGame.gId }, window.location.href);
62
+ window.postMessage({ type: gameevent, gameId: randomGame.gId || randomGame.id }, window.location.href);
49
63
  show = false;
50
64
  }
51
65
 
@@ -58,7 +72,7 @@
58
72
 
59
73
  url.searchParams.append('platform', getDevice(userAgent));
60
74
  url.searchParams.append('datasource', datasource);
61
- url.searchParams.append('fields', 'gId,href,thumbnail,name,vendor')
75
+ url.searchParams.append('fields', 'gId,id,href,thumbnail,name,vendor')
62
76
  url.searchParams.append('expand', 'vendor');
63
77
  url.searchParams.append('pagination', 'offset=0,limit=1000');
64
78
 
@@ -67,15 +81,15 @@
67
81
  .then((data:any) => {
68
82
  games = data.items;
69
83
  gamesToShow = games.slice(0, 19);
70
- })
84
+ });
71
85
  }
72
86
 
73
- const initialLoad = () => {
87
+ const setActiveLanguage = () => {
74
88
  setLocale(lang);
75
89
  }
76
90
 
77
- $: lang && initialLoad();
78
- $:endpoint && datasource && fetchGameList();
91
+ $: lang && setActiveLanguage();
92
+ $: endpoint && datasource && fetchGameList();
79
93
  </script>
80
94
 
81
95
  <div part="CustomStylingContainer">