@everymatrix/casino-page 0.0.153 → 0.0.157

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.153",
3
+ "version": "0.0.157",
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": "d095be461c7ed6b32a3559a030e829c82fc251a4"
39
+ "gitHead": "1a7c7259ed6dcca771976ce4a6ae28c62b2bcb45"
40
40
  }
@@ -14,60 +14,62 @@
14
14
 
15
15
  import '@everymatrix/casino-games-category-section';
16
16
 
17
- export let endpoint:String = '';
18
- export let datasource:String = '';
19
- export let lang:String = ''; // Language
20
- export let session:String = ''; // Value for sessionID
21
- export let userid:String = ''; // Value for UserID;
22
- export let clientstyling:String = '';
23
- export let clientstylingurl:String = '';
24
-
25
- export let categorybackground:String = '';
26
- export let visiblegames:String = '6';
17
+ export let endpoint:string = '';
18
+ export let datasource:string = '';
19
+ export let lang:string = ''; // Language
20
+ export let session:string = ''; // Value for sessionID
21
+ export let userid:string = ''; // Value for UserID;
22
+ export let clientstyling:string = '';
23
+ export let clientstylingurl:string = '';
24
+
25
+ export let categorybackground:string = '';
26
+ export let visiblegames:string = '6';
27
27
  export let alternativesearch:string = 'false';
28
- export let favorites:String = '';
29
- export let mostplayed:String = '';
28
+ export let favorites:string = '';
29
+ export let mostplayed:string = '';
30
+ export let lobbyid:string = 'casinodefault'; // identifier for recent searched
30
31
 
31
32
  // CasinoPage loading state
32
- let isLoading:Boolean = false;
33
- let hasErrors:Boolean = false;
34
- let isLoggedIn:Boolean = false;
33
+ let isLoading:boolean = false;
34
+ let hasErrors:boolean = false;
35
+ let isLoggedIn:boolean = false;
36
+ let error:string = '';
35
37
 
36
- let playerID:String;
37
- let sessionID:String;
38
+ let playerID:string;
39
+ let sessionID:string;
38
40
 
39
41
  // CasinoPage state
40
- let favoritesScreen:Boolean = false;
41
- let recentSearches:Boolean = false;
42
- let initialLoaded:Boolean = true;
43
- let searched:Boolean = false;
44
- let gameFocus:Boolean = false;
45
- let lobbyViewAux:Boolean = false;
46
- let closeSearch:Boolean = false;
47
- let searchFocus:Boolean = false;
48
- let lobbyScreen:Boolean = true;
49
- let mostPlayedScreen:Boolean = false;
50
- let mostPlayedEmpty:Boolean = false;
51
- let adjustingScroll:Boolean = false;
52
- let searchBarCleared:Boolean = true;
42
+ let favoritesScreen:boolean = false;
43
+ let recentSearches:boolean = false;
44
+ let initialLoaded:boolean = true;
45
+ let searched:boolean = false;
46
+ let gameFocus:boolean = false;
47
+ let lobbyViewAux:boolean = false;
48
+ let closeSearch:boolean = false;
49
+ let searchFocus:boolean = false;
50
+ let lobbyScreen:boolean = true;
51
+ let mostPlayedScreen:boolean = false;
52
+ let mostPlayedEmpty:boolean = false;
53
+ let adjustingScroll:boolean = false;
54
+ let searchBarCleared:boolean = true;
53
55
 
54
56
  // Needs to be checked if there are relevant
55
57
  let gamesArray = [];
56
58
  let searchArray:Array<CasinoItems>;
57
59
  let categories:Array<CategoriesItems> = [];
58
60
  let shownCategories:Array<CategoriesItems> = [];
59
- let activeCategory:String;
61
+ let activeCategory:string;
60
62
 
61
- let searchValue:String = '';
63
+ let searchValue:string = '';
62
64
  let searchWrapper:HTMLElement;
63
65
  let searchElementWrapper:HTMLElement;
64
66
  let searchPositionTop:number;
65
67
 
66
- let userAgent:String = window.navigator.userAgent;
68
+ let userAgent:string = window.navigator.userAgent;
67
69
  // const scrollOffset:number = getDevice(userAgent) !== 'PC' ? operatorDetail.scrollOffset[0] : operatorDetail.scrollOffset[1];
68
- const scrollOffset:Number = 0;
70
+ const scrollOffset:number = 0;
69
71
 
70
- let scrollTop:Boolean = false;
72
+ let scrollTop:boolean = false;
71
73
  let mostPlayedGames:Array<any> = [];
72
74
 
73
75
  let favoredGamesCollection:Array<string> = [];
@@ -81,7 +83,7 @@
81
83
  let filterVendorsArray:Array<Object> = [];
82
84
  let numberOfFilters:number = 0;
83
85
  let filteredGamesArray:Array<Object> = [];
84
- let currentCategoryId: string = '';
86
+ let currentCategoryId:string = '';
85
87
  let activeCategoryAux:any = undefined;
86
88
  let customStylingContainer:HTMLElement;
87
89
 
@@ -100,10 +102,6 @@
100
102
  activeCategory = '';
101
103
  mostPlayedScreen = false;
102
104
  scrollTop = true;
103
- // needs to be executed after the lobby has been repopulated
104
- setTimeout(() => {
105
- window.postMessage({ type: 'WidgetTopReference', scrollTop }, window.location.href);
106
- }, 1);
107
105
  break;
108
106
 
109
107
  case 'FAVORITES':
@@ -127,13 +125,12 @@
127
125
  if (res.count > 0) {
128
126
  let promises:any = [];
129
127
 
130
- res.items = [{gameId: '15786'}, {gameId: '15788'}];
131
128
  res.items.forEach((item:any) => {
132
129
  let url = new URL(`${endpoint}/casino/games/${item.gameId}`);
133
130
 
134
- url.searchParams.append("datasource", datasource);
131
+ url.searchParams.append('datasource', datasource);
135
132
 
136
- promises.push(fetch(url).then((res:any) => res.json()));
133
+ promises.push(fetch(url.href).then((res:any) => res.json()));
137
134
  });
138
135
 
139
136
  Promise.all(promises).then((values:any) => {
@@ -266,7 +263,7 @@
266
263
  }
267
264
 
268
265
  return new Promise((resolve, reject) => {
269
- fetch(url)
266
+ fetch(url.href)
270
267
  .then((res:any) => res.json())
271
268
  .then((data:any) => {
272
269
  resolve(data);
@@ -311,7 +308,7 @@
311
308
  });
312
309
 
313
310
  if (favoritesScreen) {
314
- showFavoriteGames(url, sessionID, playerID);
311
+ showFavoriteGames();
315
312
  }
316
313
  }
317
314
  }
@@ -331,7 +328,7 @@
331
328
  receivedFavoriteResults = updatedArray;
332
329
 
333
330
  if (favoritesScreen) {
334
- showFavoriteGames(url, sessionID, playerID);
331
+ showFavoriteGames();
335
332
  }
336
333
 
337
334
  if (receivedFavoriteResults) {
@@ -495,7 +492,7 @@
495
492
  searchFocus = true;
496
493
 
497
494
  if (searchValue.length < 2) {
498
- let recentSearchedGames = getCookieValue('searchedGamesWds');
495
+ let recentSearchedGames = getCookieValue(`searchedGamesWds_${lobbyid}`);
499
496
  let recentSearchedGamesArray:Array<any> = [];
500
497
 
501
498
  if (recentSearchedGames) {
@@ -509,17 +506,27 @@
509
506
 
510
507
  let promises:Array<any> = [];
511
508
  let index = 0;
509
+ let length = recentSearchedGamesArray.length;
512
510
 
513
- for (index = 0; index < recentSearchedGamesArray.length; index++) {
514
- let url:any = new URL(`${endpoint}/casino/games/${recentSearchedGamesArray[index]}`);
515
- promises.push(getGame(url));
516
- }
511
+ if (length > 0) {
512
+ for (index = 0; index < length; index++) {
513
+ let url:any = new URL(`${endpoint}/casino/games/${recentSearchedGamesArray[index]}`);
517
514
 
518
- Promise.all(promises).then((res:any) => {
519
- searchArray = res;
515
+ url.searchParams.append('language', lang);
516
+ url.searchParams.append('datasource', datasource);
517
+ url.searchParams.append('platform', getDevice(userAgent));
520
518
 
521
- sendRecentSearchData({}, searchArray)
522
- });
519
+ promises.push(getGame(url));
520
+ }
521
+
522
+ Promise.all(promises).then((res:any) => {
523
+ searchArray = res;
524
+
525
+ sendRecentSearchData({}, searchArray)
526
+ });
527
+ } else {
528
+ sendRecentSearchData({}, {})
529
+ }
523
530
  }
524
531
  }
525
532
  }
@@ -542,7 +549,7 @@
542
549
  }
543
550
 
544
551
  const addSearchedItem = (gameID:any) => {
545
- searchedValues = getCookieValue('searchedGamesWds');
552
+ searchedValues = getCookieValue(`searchedGamesWds_${lobbyid}`);
546
553
 
547
554
  if (searchedValues) {
548
555
  searchedValues = searchedValues.split(',');
@@ -554,7 +561,7 @@
554
561
 
555
562
  searchedValues.push(gameID);
556
563
  value = searchedValues.join(',');
557
- document.cookie = "searchedGamesWds=" + value;
564
+ document.cookie = `searchedGamesWds_${lobbyid}=` + value;
558
565
  }
559
566
  }
560
567