@everymatrix/casino-page 0.0.95 → 0.0.96

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.95",
3
+ "version": "0.0.96",
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": "c914b1873e8355d7b4604b3321bed9a223b0386f"
39
+ "gitHead": "a5b786cbdb55417fffbe2510fa634b4633cd1eb4"
40
40
  }
@@ -113,45 +113,47 @@
113
113
  break;
114
114
 
115
115
  case 'MOSTPLAYED':
116
- /*getMostPlayedGames({
117
- limit: 10,
118
- device: getDevice(userAgent),
119
- rounds: 25 //50
120
- }).then((res:any) => {
121
- // if (res.count > 0) { // After NorWAy fix
122
- if (res.count >= 0) {
123
- let promises:any = [];
124
- res.items = [{gameId: '15786'}, {gameId: '15788'}];
125
- res.items.forEach((item:any) => {
126
- let url = new URL(getGameUrl + `/${item.gameId}`);
127
-
128
- promises.push(xhrFetch(url));
129
- });
130
-
131
- Promise.all(promises).then((values:any) => {
132
- mostPlayedGames = values.map((item:any) => item[0]);
133
- window.postMessage({ type: 'MostPlayedData', mostPlayedGames }, window.location.href);
134
- });
135
- }
136
- });*/
137
- let mostPlayedGames = getMostPlayedGamesFromCookie();
138
- let promises:any = [];
116
+ if (mostplayed == 'true') {
117
+ /*getMostPlayedGames({
118
+ limit: 10,
119
+ device: getDevice(userAgent),
120
+ rounds: 25 //50
121
+ }).then((res:any) => {
122
+ // if (res.count > 0) { // After NorWAy fix
123
+ if (res.count >= 0) {
124
+ let promises:any = [];
125
+ res.items = [{gameId: '15786'}, {gameId: '15788'}];
126
+ res.items.forEach((item:any) => {
127
+ let url = new URL(getGameUrl + `/${item.gameId}`);
128
+
129
+ promises.push(xhrFetch(url));
130
+ });
131
+
132
+ Promise.all(promises).then((values:any) => {
133
+ mostPlayedGames = values.map((item:any) => item[0]);
134
+ window.postMessage({ type: 'MostPlayedData', mostPlayedGames }, window.location.href);
135
+ });
136
+ }
137
+ });*/
138
+ let mostPlayedGames = getMostPlayedGamesFromCookie();
139
+ let promises:any = [];
139
140
 
140
- mostPlayedGames.forEach((item:any) => {
141
- let url = new URL(`${endpoint}/casino/games/${item.gameId}`);
141
+ mostPlayedGames.forEach((item:any) => {
142
+ let url = new URL(`${endpoint}/casino/games/${item.gameId}`);
142
143
 
143
- promises.push(fetch(url).then((res:any) => res.json()));
144
- });
144
+ promises.push(fetch(url).then((res:any) => res.json()));
145
+ });
145
146
 
146
- Promise.all(promises).then((values:any) => {
147
- mostPlayedGames = values.map((item:any) => item[0]);
147
+ Promise.all(promises).then((values:any) => {
148
+ mostPlayedGames = values.map((item:any) => item[0]);
148
149
 
149
- window.postMessage({ type: 'MostPlayedData', mostPlayedGames }, window.location.href);
150
- });
150
+ window.postMessage({ type: 'MostPlayedData', mostPlayedGames }, window.location.href);
151
+ });
151
152
 
152
- activeCategory = '';
153
- lobbyScreen = false;
154
- mostPlayedScreen = true;
153
+ activeCategory = '';
154
+ lobbyScreen = false;
155
+ mostPlayedScreen = true;
156
+ }
155
157
  break;
156
158
 
157
159
  default:
@@ -292,32 +294,34 @@
292
294
  // --- START of Favorites section
293
295
  //
294
296
  let getFavoredGames = (url:string, sessionID:string, playerID:string) => {
295
- if (session && playerID) {
296
- let options = {
297
- method: "GET",
298
- headers: {
299
- 'X-SessionID': sessionID,
300
- }
301
- };
297
+ if (favorites == 'true') {
298
+ if (session && playerID) {
299
+ let options = {
300
+ method: "GET",
301
+ headers: {
302
+ 'X-SessionID': sessionID,
303
+ }
304
+ };
302
305
 
303
- fetch(`${url}/player/${playerID}/favorites/`, options)
304
- .then((res:any) => res.json())
305
- .then((updatedArray:Object) => {
306
- receivedFavoriteResults = updatedArray;
306
+ fetch(`${url}/player/${playerID}/favorites/`, options)
307
+ .then((res:any) => res.json())
308
+ .then((updatedArray:Object) => {
309
+ receivedFavoriteResults = updatedArray;
307
310
 
308
- if (receivedFavoriteResults) {
309
- window.postMessage({ type: "UpdateCategoryFavoriteGames", receivedFavoriteResults }, window.location.href);
311
+ if (receivedFavoriteResults) {
312
+ window.postMessage({ type: "UpdateCategoryFavoriteGames", receivedFavoriteResults }, window.location.href);
310
313
 
311
- updatedFavoriteResultsIds = getGamesIds(receivedFavoriteResults.items);
312
- }
314
+ updatedFavoriteResultsIds = getGamesIds(receivedFavoriteResults.items);
315
+ }
313
316
 
314
- return receivedFavoriteResults;
315
- }).catch((err:any) => {
316
- console.error(err);
317
- });
317
+ return receivedFavoriteResults;
318
+ }).catch((err:any) => {
319
+ console.error(err);
320
+ });
318
321
 
319
- if (favoritesScreen) {
320
- showFavoriteGames(url, sessionID, playerID);
322
+ if (favoritesScreen) {
323
+ showFavoriteGames(url, sessionID, playerID);
324
+ }
321
325
  }
322
326
  }
323
327
  }
@@ -390,7 +394,7 @@
390
394
  updateFavoredList(url, sessionID, playerID);
391
395
  })
392
396
  .catch((err:any) => {
393
- console.log('Err', err);
397
+ console.error('Err', err);
394
398
  });
395
399
  }
396
400
 
@@ -644,10 +648,6 @@
644
648
  window.postMessage({ type: "scroll" }, window.location.href);
645
649
  }
646
650
 
647
- const searchOngoing = () => {
648
- console.log("searchValue ", searchValue);
649
- }
650
-
651
651
  const clearSearchbar = () => {
652
652
  searchBarCleared = true;
653
653
  searchValue = '';
@@ -742,6 +742,7 @@
742
742
  const initialSetup = () => {
743
743
  if (!checkAttrs()) {
744
744
  isLoading = true;
745
+
745
746
  if (favorites == 'true') {
746
747
  getFavoredGames(endpoint, sessionID, playerID);
747
748
  }
@@ -865,7 +866,7 @@
865
866
  </svg>
866
867
  </div>
867
868
  {/if}
868
- <input id="SearchField" class="SearchInput" on:focus={onFocus} on:blur={onBlur} bind:this={searchElement} bind:value={searchValue} placeholder="{(getDevice(userAgent) === 'PC') ? $_('casinoPage.search') : $_('casinoPage.searchMobile')}" type="search" on:focus={searchActivated} on:keypress={searchOngoing} />
869
+ <input id="SearchField" class="SearchInput" on:focus={onFocus} on:blur={onBlur} bind:this={searchElement} bind:value={searchValue} placeholder="{(getDevice(userAgent) === 'PC') ? $_('casinoPage.search') : $_('casinoPage.searchMobile')}" type="search" on:focus={searchActivated} />
869
870
  {#if ((getDevice(userAgent) === 'PC') && searchValue.length) || (getDevice(userAgent) !== 'PC') }
870
871
  <span class="{(getDevice(userAgent) === 'PC') ? 'ClearSearchButton' : 'ClearSearchButtonMobile'} " on:click="{() => clearSearchbar()}">
871
872
  <div class="CloseIconContainer">