@everymatrix/casino-page 0.0.99 → 0.0.103

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-page",
3
- "version": "0.0.99",
3
+ "version": "0.0.103",
4
4
  "main": "dist/casino-page.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": "e1d8e342dfc965336d29503748fc0cfd1698d7a9"
39
+ "gitHead": "f950ca0b8f4c9cf3c54f5587effefeadf3f6fa52"
40
40
  }
@@ -47,6 +47,7 @@
47
47
  let searchFocus:Boolean = false;
48
48
  let lobbyScreen:Boolean = true;
49
49
  let mostPlayedScreen:Boolean = false;
50
+ let mostPlayedEmpty:Boolean = false;
50
51
  let adjustingScroll:Boolean = false;
51
52
  let searchBarCleared:Boolean = true;
52
53
 
@@ -114,40 +115,35 @@
114
115
 
115
116
  case 'MOSTPLAYED':
116
117
  if (mostplayed == 'true') {
117
- /*getMostPlayedGames({
118
- limit: 10,
118
+ isLoading = true;
119
+
120
+ getMostPlayedGames({
121
+ limit: 100,
119
122
  device: getDevice(userAgent),
120
- rounds: 25 //50
123
+ rounds: 50
121
124
  }).then((res:any) => {
122
- // if (res.count > 0) { // After NorWAy fix
123
- if (res.count >= 0) {
125
+ isLoading = false;
126
+
127
+ if (res.count > 0) {
124
128
  let promises:any = [];
129
+
125
130
  res.items = [{gameId: '15786'}, {gameId: '15788'}];
126
131
  res.items.forEach((item:any) => {
127
- let url = new URL(getGameUrl + `/${item.gameId}`);
132
+ let url = new URL(`${endpoint}/casino/games/${item.gameId}`);
128
133
 
129
- promises.push(xhrFetch(url));
134
+ url.searchParams.append("datasource", datasource);
135
+
136
+ promises.push(fetch(url).then((res:any) => res.json()));
130
137
  });
131
138
 
132
139
  Promise.all(promises).then((values:any) => {
133
140
  mostPlayedGames = values.map((item:any) => item[0]);
141
+
134
142
  window.postMessage({ type: 'MostPlayedData', mostPlayedGames }, window.location.href);
135
143
  });
144
+ } else {
145
+ mostPlayedEmpty = true;
136
146
  }
137
- });*/
138
- let mostPlayedGames = getMostPlayedGamesFromCookie();
139
- let promises:any = [];
140
-
141
- mostPlayedGames.forEach((item:any) => {
142
- let url = new URL(`${endpoint}/casino/games/${item.gameId}`);
143
-
144
- promises.push(fetch(url).then((res:any) => res.json()));
145
- });
146
-
147
- Promise.all(promises).then((values:any) => {
148
- mostPlayedGames = values.map((item:any) => item[0]);
149
-
150
- window.postMessage({ type: 'MostPlayedData', mostPlayedGames }, window.location.href);
151
147
  });
152
148
 
153
149
  activeCategory = '';
@@ -207,11 +203,6 @@
207
203
  addSearchedItem(e.data.gameId);
208
204
  break;
209
205
 
210
- // @TODO Remove this for MostPlayed Mock
211
- case 'MostPlayedGameAdd':
212
- addMostPlayedItem(e.data.gameId);
213
- break;
214
-
215
206
  case 'UpdateFilters':
216
207
  updateFilters(e.data.vendorsArray);
217
208
  setFilterNumberValue();
@@ -499,24 +490,6 @@
499
490
  }
500
491
  }
501
492
 
502
- // @TODO Remove this for MostPlayedMock
503
- const getMostPlayedGamesFromCookie = () => {
504
- let games = getCookieValue('mostPlayed');
505
- let gamesArray:Array<any> = [];
506
-
507
- if (games) {
508
- gamesArray = games.split(',');
509
- }
510
-
511
- let returnValue = [];
512
-
513
- for (let i in gamesArray) {
514
- returnValue.push({'gameId': gamesArray[i]});
515
- }
516
-
517
- return returnValue;
518
- }
519
-
520
493
  const onFocus = () => {
521
494
  if (endpoint && datasource && lang) {
522
495
  searchFocus = true;
@@ -568,25 +541,6 @@
568
541
  }
569
542
  }
570
543
 
571
- // @TODO Remove this for MostPlayedMock
572
- const addMostPlayedItem = (gameID:any) => {
573
- mostPlayedValues = getCookieValue('mostPlayed');
574
-
575
- if (mostPlayedValues) {
576
- mostPlayedValues = mostPlayedValues.split(',');
577
- } else {
578
- mostPlayedValues = [];
579
- }
580
-
581
- if (mostPlayedValues.indexOf(gameID) === -1) {
582
- let value;
583
-
584
- mostPlayedValues.push(gameID);
585
- value = mostPlayedValues.join(',');
586
- document.cookie = "mostPlayed=" + value;
587
- }
588
- }
589
-
590
544
  const addSearchedItem = (gameID:any) => {
591
545
  searchedValues = getCookieValue('searchedGamesWds');
592
546
 
@@ -604,6 +558,17 @@
604
558
  }
605
559
  }
606
560
 
561
+ // @TODO let's do some small changes around here in order to have this search functionality pretty written, 'cuz right now is kinda shitty
562
+ const searchValueChanged = () => {
563
+ if (searchValue.length >= 2) {
564
+ searchBarCleared = true;
565
+ } else {
566
+ searchBarCleared = false;
567
+ }
568
+ }
569
+
570
+ $: searchValue && searchValueChanged();
571
+
607
572
  $: if (searchValue.length >= 2) {
608
573
  searched = true;
609
574
 
@@ -1021,20 +986,24 @@
1021
986
  {clientstylingurl}
1022
987
  />
1023
988
  {:else if mostPlayedScreen}
1024
- <casino-games-category-section
1025
- session={session}
1026
- userid={userid}
1027
- endpoint={endpoint}
1028
- datasource={datasource}
1029
- lang={lang}
1030
- favorites={favorites}
1031
- categoryid="MOSTPLAYED"
1032
- categoryindex="1"
1033
- categorygames="9"
1034
- class="CategoryContainer"
1035
- {clientstyling}
1036
- {clientstylingurl}
1037
- />
989
+ {#if mostPlayedEmpty}
990
+ <p class="SearchLoading">You have no games played!</p>
991
+ {:else}
992
+ <casino-games-category-section
993
+ session={session}
994
+ userid={userid}
995
+ endpoint={endpoint}
996
+ datasource={datasource}
997
+ lang={lang}
998
+ favorites={favorites}
999
+ categoryid="MOSTPLAYED"
1000
+ categoryindex="1"
1001
+ categorygames="9"
1002
+ class="CategoryContainer"
1003
+ {clientstyling}
1004
+ {clientstylingurl}
1005
+ />
1006
+ {/if}
1038
1007
  {:else}
1039
1008
  {#if !recentSearches}
1040
1009
  <casino-games-category-section