@everymatrix/casino-categories-slider 0.0.398 → 0.0.399

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-categories-slider",
3
- "version": "0.0.398",
3
+ "version": "0.0.399",
4
4
  "main": "dist/casino-categories-slider.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": "a6034652886209b6fcdc64d039abe2fb2760c472"
39
+ "gitHead": "863d8e5a7c2dbb42ec688b5c165c7cc727b86a42"
40
40
  }
@@ -34,6 +34,7 @@
34
34
  let isLoggedIn:boolean = false;
35
35
  let playerID:string = '';
36
36
  let activeIndex:number = 0;
37
+ let deviceSegregationValue:string = '';
37
38
 
38
39
  let isLoading:boolean = true;
39
40
  let error:string;
@@ -76,19 +77,8 @@
76
77
  if (mostplayed) {
77
78
  let url:URL = new URL(`${endpoint}/player/${userid}/games/most-played`);
78
79
 
79
- let device = getDevice(userAgent);
80
-
81
- if (device) {
82
- if (device === 'PC') {
83
- url.searchParams.append('device', 'Desktop');
84
- } else {
85
- url.searchParams.append('device', 'Mobile');
86
- }
87
- } else {
88
- url.searchParams.append('device', 'All');
89
- }
90
-
91
80
  url.searchParams.append('rounds', mostplayedrounds);
81
+ url.searchParams.append('device', deviceSegregationValue);
92
82
 
93
83
  return new Promise((resolve, reject) => {
94
84
  fetch(url.href)
@@ -111,19 +101,8 @@
111
101
  if (lastplayed) {
112
102
  let url:URL = new URL(`${endpoint}/player/${userid}/games/last-played`);
113
103
 
114
- let device = getDevice(userAgent);
115
-
116
- if (device) {
117
- if (device === 'PC') {
118
- url.searchParams.append('device', 'Desktop');
119
- } else {
120
- url.searchParams.append('device', 'Mobile');
121
- }
122
- } else {
123
- url.searchParams.append('device', 'All');
124
- }
125
-
126
104
  url.searchParams.append('period', lastplayedperiod);
105
+ url.searchParams.append('device', deviceSegregationValue);
127
106
 
128
107
 
129
108
  fetch(url.href)
@@ -238,13 +217,30 @@
238
217
  isLoading = !favoritesLoaded && !mostPlayedLoaded && !lastPlayedLoaded && !categoriesLoaded;
239
218
  }
240
219
 
220
+ const setDevice = ():void => {
221
+ let device = getDevice(userAgent)
222
+
223
+ if(device){
224
+ if(device === 'PC'){
225
+ deviceSegregationValue = 'dk';
226
+ } else if(device === 'iPad' || device === 'iPhone') {
227
+ deviceSegregationValue = 'ios';
228
+ } else {
229
+ deviceSegregationValue = 'mtWeb';
230
+ }
231
+ }
232
+
233
+ }
234
+
241
235
  const initialLoad = ():void => {
236
+ setDevice();
237
+
242
238
  if (!checkAttrs()) {
243
239
  let url:any = new URL(`${endpoint}/casino/groups/${datasource}`);
244
240
 
245
241
  url.searchParams.append('datasource', datasource);
246
- url.searchParams.append('platform', getDevice(userAgent));
247
242
  url.searchParams.append('language', lang);
243
+ url.searchParams.append('device', deviceSegregationValue);
248
244
 
249
245
  fetch(url)
250
246
  .then((res:any) => res.json())
@@ -257,9 +253,11 @@
257
253
  if( item.games.total > 0) {
258
254
  filtered = true;
259
255
  //exclude filtered categories
260
- for (let element of arrayFilteredCategories){
261
- if( item.flags == element ) filtered = false;
262
- }
256
+ if( filteredcategories ){
257
+ for (let element of arrayFilteredCategories){
258
+ if( item.flags == element ) filtered = false;
259
+ }
260
+ }
263
261
  };
264
262
  return filtered;
265
263
  });