@everymatrix/casino-games-category-section 1.34.1 → 1.34.2

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
@@ -33,8 +33,8 @@
33
33
  <casino-games-category-section
34
34
  endpoint="https://demo-api.stage.norway.everymatrix.com"
35
35
  lang="en"
36
- session="f139354a-99d2-48c6-8b07-7542fe53311c"
37
- userid="4506648"
36
+ session="201d23b1-52f0-4a95-a97f-299712b613e3"
37
+ userid="3884262"
38
38
  favorites="true"
39
39
  fetchviaevent="false"
40
40
  displayedgamecount="8"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-games-category-section",
3
- "version": "1.34.1",
3
+ "version": "1.34.2",
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": "5ce0bbd8d4005bb9f6fbed830e8882a14e79712a"
38
+ "gitHead": "99004a0501ea8fb9219aac803a986e470f556838"
39
39
  }
@@ -159,15 +159,17 @@
159
159
  .then((res:any) => res.json())
160
160
  .then((updatedArray:any) => {
161
161
  isLoading = false;
162
-
162
+ favoriteGames = [];
163
163
  if (updatedArray) {
164
- favoriteGames = updatedArray.items;
165
- favoriteGames.forEach((fav) => {
166
- if (!listOfGamesIDs.includes(fav.id)) {
167
- listOfGamesIDs.push(fav.id);
168
- }
169
- });
170
- window.postMessage({ type: 'UpdateFavoritesCount', favoriteGames});
164
+ updatedArray.items.forEach((item: any) => {
165
+ if (item.gameModel) {
166
+ favoriteGames.push(item);
167
+ if (!listOfGamesIDs.includes(item.id)) {
168
+ listOfGamesIDs.push(item.id);
169
+ }
170
+ }
171
+ });
172
+ window.postMessage({ type: 'UpdateFavoritesCount', favoriteGames});
171
173
  } else {
172
174
  favoriteGames = [];
173
175
  }
@@ -491,16 +493,7 @@
491
493
  }
492
494
 
493
495
  //Adding fav. statement to variables
494
- const checkFavorite = (gameId:string) => {
495
- if (favoriteGames) {
496
- if (favoriteGames.findIndex(obj => obj.id == gameId) !== -1) {
497
- return true;
498
- } else {
499
- return false;
500
- }
501
- }
502
- return false;
503
- }
496
+ const checkFavorite = (gameId: string) => favoriteGames?.some(obj => obj.id === gameId) ?? false;
504
497
 
505
498
  let addFavoredGame = async (url, sessionID, gameID) => {
506
499
  // Wait for the updateFavoredList to complete