@everymatrix/casino-tournaments-controller 0.0.259 → 0.0.262
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-tournaments-controller",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.262",
|
|
4
4
|
"main": "dist/casino-tournaments-controller.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"typescript": "^3.9.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@everymatrix/casino-tournaments-details": "^0.0.
|
|
33
|
-
"@everymatrix/casino-tournaments-filter-controller": "^0.0.
|
|
34
|
-
"@everymatrix/casino-tournaments-list-controller": "^0.0.
|
|
35
|
-
"@everymatrix/casino-tournaments-page-controller": "^0.0.
|
|
36
|
-
"@everymatrix/casino-tournaments-thumbnail-controller": "^0.0.
|
|
32
|
+
"@everymatrix/casino-tournaments-details": "^0.0.262",
|
|
33
|
+
"@everymatrix/casino-tournaments-filter-controller": "^0.0.262",
|
|
34
|
+
"@everymatrix/casino-tournaments-list-controller": "^0.0.262",
|
|
35
|
+
"@everymatrix/casino-tournaments-page-controller": "^0.0.262",
|
|
36
|
+
"@everymatrix/casino-tournaments-thumbnail-controller": "^0.0.262",
|
|
37
37
|
"cross-env": "^7.0.3",
|
|
38
38
|
"sirv-cli": "^1.0.0",
|
|
39
39
|
"svelte": "^3.0.0"
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "63a3c79f8f47451d7ca7f8c1dc77bb78bee91df2"
|
|
45
45
|
}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
let lastMonthDate:any = new Date();
|
|
51
51
|
let tournamentsSearchParams:string;
|
|
52
|
-
let tournamentsUpdateEventSource:
|
|
52
|
+
let tournamentsUpdateEventSource:any;
|
|
53
53
|
|
|
54
54
|
lastMonthDate.setMonth(lastMonthDate.getMonth() - 1);
|
|
55
55
|
lastMonthDate = lastMonthDate.toISOString().substring(0, 10);
|
|
@@ -108,8 +108,9 @@
|
|
|
108
108
|
} else {
|
|
109
109
|
tournamentsUrl.searchParams.append('filter', `StartTimeAfter=${lastMonthDate}`);
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
|
|
112
|
+
tournamentsUrl.searchParams.append('platform', getDevice(userAgent));
|
|
113
|
+
tournamentsUrl.searchParams.append('sortType', sortByStatus);
|
|
113
114
|
|
|
114
115
|
if (isLoggedIn) {
|
|
115
116
|
reqHeaders.append("X-SessionID", sessionID);
|
|
@@ -144,20 +145,24 @@
|
|
|
144
145
|
});
|
|
145
146
|
}
|
|
146
147
|
const tournamentsUpdateMessageHandler = (message: any)=>{
|
|
148
|
+
if(message.type != 'message'){
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
147
151
|
let messageData = message.data;
|
|
148
152
|
if(messageData){
|
|
149
153
|
try{
|
|
150
154
|
let updateTourData = JSON.parse(messageData);
|
|
151
|
-
if(!updateTourData || !updateTourData.
|
|
155
|
+
if(!updateTourData || !updateTourData.item){
|
|
152
156
|
return;
|
|
153
157
|
}
|
|
154
|
-
let updateInfo = updateTourData.
|
|
155
|
-
if(updateTourData.
|
|
158
|
+
let updateInfo = updateTourData.item;
|
|
159
|
+
if(updateTourData.messageType == "TournamentUpdate"){
|
|
156
160
|
window.postMessage({type: 'UpdateTournamentView', tournamentData: updateInfo}, window.location.href);
|
|
157
161
|
}
|
|
158
162
|
|
|
159
|
-
if(updateTourData.
|
|
160
|
-
|
|
163
|
+
if(updateTourData.messageType == 'TournamentRemove'){
|
|
164
|
+
//remove tournament from TournamentList by id
|
|
165
|
+
window.postMessage({ type: 'TournamentList', tournamentList: updateTourData.items.items }, window.location.href);
|
|
161
166
|
}
|
|
162
167
|
}catch(err){
|
|
163
168
|
console.error(err);
|
|
@@ -173,13 +178,12 @@
|
|
|
173
178
|
tournamentsUpdateEventSource.removeEventListener('message', tournamentsUpdateMessageHandler);
|
|
174
179
|
tournamentsUpdateEventSource.close();
|
|
175
180
|
}
|
|
176
|
-
let endpointURL:String = `${endpoint}/tournaments/updates
|
|
177
|
-
|
|
178
|
-
headers: {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
});
|
|
181
|
+
let endpointURL:String = `${endpoint}/tournaments/updates?${tournamentsSearchParams}&XSessionId=${session}`;
|
|
182
|
+
if(!EventSource){
|
|
183
|
+
tournamentsUpdateEventSource = new EventSourcePolyfill(endpointURL, {headers: {'accept': 'text/event-stream'}});
|
|
184
|
+
}else{
|
|
185
|
+
tournamentsUpdateEventSource = new EventSource(endpointURL);
|
|
186
|
+
}
|
|
183
187
|
if(typeof(tournamentsUpdateEventSource) != "undefined"){
|
|
184
188
|
tournamentsUpdateEventSource.addEventListener('message', tournamentsUpdateMessageHandler);
|
|
185
189
|
}
|
|
@@ -249,7 +253,9 @@
|
|
|
249
253
|
window.addEventListener('message', messageHandler, false);
|
|
250
254
|
return () => {
|
|
251
255
|
window.removeEventListener('message', messageHandler);
|
|
252
|
-
tournamentsUpdateEventSource
|
|
256
|
+
if(tournamentsUpdateEventSource){
|
|
257
|
+
tournamentsUpdateEventSource.removeEventListener('message', tournamentsUpdateMessageHandler);
|
|
258
|
+
}
|
|
253
259
|
}
|
|
254
260
|
});
|
|
255
261
|
|