@everymatrix/player-bonus-history 1.37.12 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-bonus-history",
3
- "version": "1.37.12",
3
+ "version": "1.39.0",
4
4
  "main": "dist/player-bonus-history",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "284346262a669a2f5a5891d7ba9327b0c94aa44c"
38
+ "gitHead": "d3dbfca9fcdc2d9df9a01f60f283ed699ec828fb"
39
39
  }
@@ -16,6 +16,10 @@
16
16
  export let clientstyling:string = '';
17
17
  export let clientstylingurl:string = '';
18
18
  export let translationurl:string = '';
19
+ // both bonushistorystatus and bonushistorytype need to be set on the widget
20
+ // before the other attributes used to call getBonuses() in order for these filters to work
21
+ export let bonushistorystatus:string = '';
22
+ export let bonushistorytype:string = '';
19
23
 
20
24
  let customStylingContainer:HTMLElement;
21
25
  let isLoading:boolean = false;
@@ -61,13 +65,28 @@
61
65
  window.postMessage({type: 'PlayerAccountMenuActive', isMobile}, window.location.href);
62
66
  }
63
67
 
64
- const getBonuses = (offset:number):void => {
68
+ const getBonuses = (offset:number, status, type):void => {
65
69
  let url:URL = new URL(`${endpoint}/v1/player/${playerid}/bonusWallet`);
66
70
 
67
71
  let startDate:string = new Date(bonusCalendarStartDate).toISOString();
68
72
  let endDate:string = new Date(bonusCalendarEndDate).toISOString();
69
-
70
- let filter:string = `status=closed,status=forfeited,status=released,status=expired,type=standard,type=freeround,type=freebet,granted=[${startDate}~${endDate}]`;
73
+
74
+ let filter:string = '', statuses:string = '', types:string = '';
75
+
76
+ if (status) {
77
+ let bonusStatusArray:Array<string> = status.split(',');
78
+ let modifiedStatuses = bonusStatusArray.map(status => `status=${status}`);
79
+ statuses = modifiedStatuses.join(',');
80
+ filter = filter + statuses + ',';
81
+ }
82
+
83
+ if (type) {
84
+ let bonusTypesArray:Array<string> = type.split(',');
85
+ let modifiedTypes = bonusTypesArray.map(type => `type=${type}`);
86
+ types = modifiedTypes.join(',');
87
+ filter = filter + types + ',';
88
+ }
89
+ filter = filter + `granted=[${startDate}~${endDate}]`;
71
90
 
72
91
  url.searchParams.append('filter', filter);
73
92
  url.searchParams.append('pagination', `offset=${offset},limit=${bonusesPerPage}`);
@@ -148,7 +167,9 @@
148
167
 
149
168
  $: lang && initialLoad();
150
169
  $: startCalendar && endCalendar && setCalendarEventListener();
151
- $: session && playerid && endpoint && getBonuses(0);
170
+ $: if (session && playerid && endpoint) {
171
+ getBonuses(0, bonushistorystatus, bonushistorytype)
172
+ }
152
173
  $: clientstylingurl && customStylingContainer && setClientStylingURL();
153
174
  $: clientstyling && customStylingContainer && setClientStyling();
154
175
  $: translationurl && setTranslationUrl();
@@ -182,7 +203,7 @@
182
203
  <vaadin-date-picker bind:this={endCalendar} max={maxDate} value={maxDate} placeholder="To" class="VaadinDatePicker"></vaadin-date-picker>
183
204
  </div>
184
205
  </div>
185
- <button class="BonusesCalendarFilter {isMobile ? 'BonusesCalendarFilterMobile' : ''}" on:click={() => getBonuses(0)}>{$_('dateFilter')}</button>
206
+ <button class="BonusesCalendarFilter {isMobile ? 'BonusesCalendarFilterMobile' : ''}" on:click={() => getBonuses(0, bonushistorystatus, bonushistorytype)}>{$_('dateFilter')}</button>
186
207
  </div>
187
208
  <div class="BonusesGrid {isMobile ? 'BonusesGridMobile' : ''}">
188
209
  {#if bonusesList.length === 0}
@@ -224,13 +245,13 @@
224
245
  </div>
225
246
  {#if bonusesList.length !== 0}
226
247
  <div class="BonusesPaginationWrapper {isMobile ? 'BonusesPaginationWrapperMobile' : ''}">
227
- <span class="BonusesFirst {currentPage === 0 ? 'Inactive' : ''}" on:click={() => getBonuses(0)}>&vert;&lt;</span>
228
- <span class="BonusesPrev {currentPage === 0 ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesPrevPage)}>&lt;</span>
248
+ <span class="BonusesFirst {currentPage === 0 ? 'Inactive' : ''}" on:click={() => getBonuses(0, bonushistorystatus, bonushistorytype)}>&vert;&lt;</span>
249
+ <span class="BonusesPrev {currentPage === 0 ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesPrevPage, bonushistorystatus, bonushistorytype)}>&lt;</span>
229
250
  {#each Array(numberOfPages) as _, i}
230
- <span class="BonusesPage {i === currentPage ? 'BonusPageActive' : ''}" on:click={() => getBonuses(i*bonusesPerPage)}>{i+1}</span>
251
+ <span class="BonusesPage {i === currentPage ? 'BonusPageActive' : ''}" on:click={() => getBonuses(i*bonusesPerPage, bonushistorystatus, bonushistorytype)}>{i+1}</span>
231
252
  {/each}
232
- <span class="BonusesNext {currentPage === (numberOfPages - 1) ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesNextPage)}>&gt;</span>
233
- <span class="BonusesLast {currentPage === (numberOfPages - 1) ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesLastPage)}>&gt;&vert;</span>
253
+ <span class="BonusesNext {currentPage === (numberOfPages - 1) ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesNextPage, bonushistorystatus, bonushistorytype)}>&gt;</span>
254
+ <span class="BonusesLast {currentPage === (numberOfPages - 1) ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesLastPage, bonushistorystatus, bonushistorytype)}>&gt;&vert;</span>
234
255
  </div>
235
256
  {/if}
236
257
  </div>