@everymatrix/casino-tournaments-controller 0.0.268 → 0.0.271

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.268",
3
+ "version": "0.0.271",
4
4
  "main": "dist/casino-tournaments-controller.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": "c5b78b8fcf6dd4293a5b296177205963840e7289"
39
+ "gitHead": "656de48b1f32eaa465896b097c02035605903871"
40
40
  }
@@ -88,10 +88,27 @@
88
88
  return 'Closing|Closed';
89
89
  }
90
90
 
91
- const getData = (url:string, offset:number, limit:number) => {
91
+ const getData = async (url:string, offset:number, limit:number) => {
92
92
  isLoading = true;
93
93
  tournamentsNumber = 0;
94
94
 
95
+ const res = await fetcher(url, offset, limit)
96
+
97
+ setTimeout(() => {
98
+ window.postMessage({ type: 'TournamentList', tournamentList: res.items }, window.location.href);
99
+ }, 50)
100
+
101
+ isLoading = false;
102
+ }
103
+
104
+ const getDataWithoutfresh = async (url:string, offset:number, limit:number) => {
105
+ const res = await fetcher(url, offset, limit)
106
+
107
+ window.postMessage({ type: 'TournamentListShowMore', tournamentList: res.items }, window.location.href);
108
+ }
109
+
110
+ const fetcher = async (url:string, offset:number, limit:number) => {
111
+
95
112
  let tournamentsUrl:URL = new URL(`${url}/tournaments`);
96
113
  let reqHeaders:Headers = new Headers();
97
114
 
@@ -122,13 +139,11 @@
122
139
  cache: 'no-cache'
123
140
  };
124
141
 
125
- fetch(tournamentsUrl, requestOptions)
142
+ return fetch(tournamentsUrl, requestOptions)
126
143
  .then((res:any) => res.json())
127
144
  .then((res:any) => {
128
- tournamentsNumber = 0;
129
145
  tournamentsSearchParams = tournamentsUrl.searchParams.toString();
130
146
 
131
- setTimeout(() => {
132
147
  tournamentsNumber = res.total;
133
148
 
134
149
  if (tournamentsShownNumber >= tournamentsNumber) {
@@ -139,10 +154,8 @@
139
154
  if(!startingTournamentUpdater){
140
155
  startupTouramentDataChangeListener();
141
156
  }
142
- window.postMessage({ type: 'TournamentList', tournamentList: res.items }, window.location.href);
143
- isLoading = false;
144
- }, 50);
145
- });
157
+ return res
158
+ });
146
159
  }
147
160
  const tournamentsUpdateMessageHandler = (message: any)=>{
148
161
  if(message.type != 'message'){
@@ -189,13 +202,16 @@
189
202
  }
190
203
  }
191
204
 
192
- const showMoreAction = () => {
193
- tournamentsShownNumber += parseInt(showmorestep, 10);
205
+ const showMoreAction = async () => {
206
+ let previousNumber = tournamentsShownNumber
194
207
 
195
- window.postMessage({ type: 'TournamentsPagination', offset: 0, limit: tournamentsShownNumber }, window.location.href);
208
+ const _showmorestep = parseInt(showmorestep, 10);
209
+ tournamentsShownNumber += _showmorestep
196
210
 
197
- getData(endpoint, 0, tournamentsShownNumber);
211
+ window.postMessage({ type: 'TournamentsPagination', offset: 0, limit: tournamentsShownNumber }, window.location.href);
198
212
 
213
+ await getDataWithoutfresh(endpoint, previousNumber, _showmorestep)
214
+
199
215
  if (tournamentsShownNumber >= tournamentsNumber) {
200
216
  allTournamentsShown = true;
201
217
  }
@@ -283,6 +299,7 @@
283
299
  <casino-tournaments-filter-controller
284
300
  filters={filtersArray}
285
301
  activefilters={filters}
302
+ exportparts="FiltersController, MobileClass, Non-MobileClass/empty, Active, FilterButton, "
286
303
  ></casino-tournaments-filter-controller>
287
304
  {/if}
288
305
  </div>
@@ -305,6 +322,10 @@
305
322
  registerevent={registerevent}
306
323
  {lang}
307
324
  {currency}
325
+ exportparts="Thumbnail, Status, Enrolled, CardImg, CardImgFinished, Details, Title, Date, ScoreCriteria, Games, TournamentPrizes, PrizesTitle, Prizes, Prize,
326
+ TournamentDuration, TournamentDates, StartDate, EndDate, ProgressBar, ProgressBarFillEnd, Finished, ProgressBarFillStarting, Remaining, ProgressBarFill,
327
+ TournamentsGamesSlider, SliderNavButton, items, item, PlayNowButton, itemHover, SliderNavButton
328
+ TournamentCard, CardMaxWidth, CardFullSize, elementToFadeOut, elementToFadeIn, ph-item, ph-col-12, ph-picture, ph-row, ph-col-6, big, ph-col-4, empty, ph-col-8, TournamentButtons, LoginButton, RegisterButton, DetailsButton, EnrolledButton, JoinButton, JoinButtonFullSize, spinner, DetailsLargeButton, ErrorText"
308
329
  ></casino-tournaments-list-controller>
309
330
  {/if}
310
331
  </div>