@everymatrix/player-bonus-history 1.0.16 → 1.0.69

Sign up to get free protection for your applications and to get access to all the features.
package/index.html DELETED
@@ -1,21 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset='utf-8'>
5
- <meta name='viewport' content='width=device-width,initial-scale=1'>
6
-
7
- <title>
8
- player-bonus-history
9
- </title>
10
- <link rel="stylesheet" href="public/reset.css">
11
- <script src='dist/player-bonus-history.js'></script>
12
- </head>
13
-
14
- <body>
15
-
16
- <div class="webcomponent">
17
- <player-bonus-history></player-bonus-history>
18
- </div>
19
-
20
- </body>
21
- </html>
package/index.js DELETED
@@ -1 +0,0 @@
1
- import './dist/player-bonus-history.js';
Binary file
package/public/reset.css DELETED
@@ -1,48 +0,0 @@
1
- /* http://meyerweb.com/eric/tools/css/reset/
2
- v2.0 | 20110126
3
- License: none (public domain)
4
- */
5
-
6
- html, body, div, span, applet, object, iframe,
7
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
- a, abbr, acronym, address, big, cite, code,
9
- del, dfn, em, img, ins, kbd, q, s, samp,
10
- small, strike, strong, sub, sup, tt, var,
11
- b, u, i, center,
12
- dl, dt, dd, ol, ul, li,
13
- fieldset, form, label, legend,
14
- table, caption, tbody, tfoot, thead, tr, th, td,
15
- article, aside, canvas, details, embed,
16
- figure, figcaption, footer, header, hgroup,
17
- menu, nav, output, ruby, section, summary,
18
- time, mark, audio, video {
19
- margin: 0;
20
- padding: 0;
21
- border: 0;
22
- font-size: 100%;
23
- font: inherit;
24
- vertical-align: baseline;
25
- }
26
- /* HTML5 display-role reset for older browsers */
27
- article, aside, details, figcaption, figure,
28
- footer, header, hgroup, menu, nav, section {
29
- display: block;
30
- }
31
- body {
32
- line-height: 1;
33
- }
34
- ol, ul {
35
- list-style: none;
36
- }
37
- blockquote, q {
38
- quotes: none;
39
- }
40
- blockquote:before, blockquote:after,
41
- q:before, q:after {
42
- content: '';
43
- content: none;
44
- }
45
- table {
46
- border-collapse: collapse;
47
- border-spacing: 0;
48
- }
package/rollup.config.js DELETED
@@ -1,67 +0,0 @@
1
- import svelte from 'rollup-plugin-svelte';
2
- import commonjs from '@rollup/plugin-commonjs';
3
- import resolve from '@rollup/plugin-node-resolve';
4
- import serve from 'rollup-plugin-dev-server';
5
- import livereload from 'rollup-plugin-livereload';
6
- import { terser } from 'rollup-plugin-terser';
7
- import sveltePreprocess from 'svelte-preprocess';
8
- import typescript from '@rollup/plugin-typescript';
9
- import uglify from 'rollup-plugin-uglify';
10
- import image from '@rollup/plugin-image';
11
-
12
- const production = process.env.NODE_ENV == 'production';
13
- const dev = process.env.NODE_ENV == 'development';
14
-
15
- export default {
16
- input: 'src/index.ts',
17
- output: {
18
- sourcemap: true,
19
- format: 'umd',
20
- name: 'app',
21
- file: 'dist/player-bonus-history.js',
22
- },
23
- plugins: [
24
- svelte({
25
- preprocess: sveltePreprocess(),
26
- compilerOptions: {
27
- // @TODO check generate and hydratable
28
- // generate: 'ssr',
29
- // hydratable: true,
30
- // enable run-time checks when not in production
31
- customElement: true,
32
- dev: !production
33
- }
34
- }),
35
- image(),
36
- commonjs(),
37
- resolve({
38
- browser: true,
39
- dedupe: ['svelte']
40
- }),
41
- dev && serve({
42
- open: true,
43
- verbose: true,
44
- allowCrossOrigin: true,
45
- historyApiFallback: false,
46
- host: 'localhost',
47
- port: 5050,
48
- }),
49
- dev && livereload({ watch: ['', 'dist'] }),
50
- typescript({
51
- sourceMap: !production,
52
- inlineSources: !production,
53
- }),
54
- // If we're building for production (npm run build
55
- // instead of npm run dev), minify
56
- production &&
57
- terser({
58
- output: {
59
- comments: "all"
60
- },
61
- }),
62
- production && uglify.uglify()
63
- ],
64
- watch: {
65
- clearScreen: false
66
- }
67
- };
@@ -1,372 +0,0 @@
1
- <svelte:options tag={null} />
2
- <script lang="ts">
3
- import { onMount } from 'svelte';
4
- import { getDevice } from 'rvhelper';
5
- import moment from 'moment';
6
-
7
- import '@everymatrix/player-bonus-card';
8
- import '@vaadin/vaadin-date-picker/vaadin-date-picker.js';
9
- import { _, addNewMessages, setLocale } from './i18n';
10
- import { PlayerBonusHistoryTranslations } from './translations';
11
-
12
- export let endpoint:string = '';
13
- export let session:string = '';
14
- export let playerid:string = '';
15
- export let lang:string = 'en';
16
- export let translationUrl:string = '';
17
-
18
- let isLoading:boolean = false;
19
- let userAgent:string = window.navigator.userAgent;
20
- let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
21
- let startCalendar:HTMLElement;
22
- let endCalendar:HTMLElement;
23
- let maxDate:string;
24
- let lastMonth:string;
25
-
26
- maxDate = moment(new Date()).format('YYYY-MM-DD');
27
- lastMonth = moment(new Date()).subtract(3, 'months').format('YYYY-MM-DD')
28
-
29
- let bonusCalendarStartDate:string = lastMonth;
30
- let bonusCalendarEndDate:string = maxDate;
31
-
32
- let bonusesPrevPage:number = 0;
33
- let bonusesNextPage:number = 0;
34
- let bonusesLastPage:number = 0;
35
- let numberOfPages:number = 0;
36
- let bonusesPerPage:number = 6;
37
- let currentPage:number = 0;
38
- let bonusesList:Array<Object> = [];
39
-
40
- const setTranslationUrl = ():void => {
41
- let url:string = translationUrl;
42
-
43
- fetch(url).then((res:any) => res.json())
44
- .then((res) => {
45
- Object.keys(res).forEach((item:any):void => {
46
- addNewMessages(item, res[item]);
47
- });
48
- }).catch((err:any) => {
49
- console.log(err);
50
- });
51
- }
52
-
53
- Object.keys(PlayerBonusHistoryTranslations).forEach((item:any) => {
54
- addNewMessages(item, PlayerBonusHistoryTranslations[item]);
55
- });
56
-
57
- const toggleScreen = ():void => {
58
- window.postMessage({type: 'PlayerAccountMenuActive', isMobile}, window.location.href);
59
- }
60
-
61
- const getBonuses = (offset:number):void => {
62
- let url:URL = new URL(`${endpoint}/player/${playerid}/bonusWallet`);
63
-
64
- let startDate:string = new Date(bonusCalendarStartDate).toISOString();
65
- let endDate:string = new Date(bonusCalendarEndDate).toISOString();
66
-
67
- let filter:string = `status=closed,status=forfeited,status=released,status=expired,type=standard,type=freeround,type=freebet,granted=[${startDate}~${endDate}]`;
68
-
69
- url.searchParams.append('filter', filter);
70
- url.searchParams.append('pagination', `offset=${offset},limit=${bonusesPerPage}`);
71
-
72
- let options = {
73
- method: "GET",
74
- headers: {
75
- 'X-SessionId': session,
76
- }
77
- };
78
-
79
- fetch(url.href, options)
80
- .then((res:any) => res.json())
81
- .then((data:any) => {
82
- numberOfPages = (Math.ceil(data.total/bonusesPerPage));
83
-
84
- if ((offset - bonusesPerPage) >= 0) {
85
- bonusesPrevPage = offset - bonusesPerPage;
86
- }
87
-
88
- if ((offset + bonusesPerPage) < data.total) {
89
- bonusesNextPage = offset + bonusesPerPage;
90
- }
91
-
92
- bonusesLastPage = (numberOfPages - 1) * bonusesPerPage;
93
- currentPage = offset / bonusesPerPage;
94
-
95
- bonusesList = data.items;
96
- }, (err:any) => {
97
- console.error(err);
98
- });
99
- }
100
-
101
- const startCalendarHandler = (e:any):void => {
102
- bonusCalendarStartDate = e.target.value;
103
- }
104
-
105
- const endCalendarHandler = (e:any):void => {
106
- bonusCalendarEndDate = e.target.value;
107
- }
108
-
109
- const setCalendarEventListener = ():void => {
110
- startCalendar.addEventListener('change', startCalendarHandler, false);
111
- endCalendar.addEventListener('change', endCalendarHandler, false);
112
- }
113
-
114
- onMount(() => {
115
- return () => {
116
- startCalendar.removeEventListener('change', startCalendarHandler);
117
- endCalendar.removeEventListener('change', endCalendarHandler);
118
- }
119
- });
120
-
121
- const initialLoad = () => {
122
- setLocale(lang);
123
- }
124
-
125
- $: lang && initialLoad();
126
- $: startCalendar && endCalendar && setCalendarEventListener();
127
- $: session && playerid && endpoint && getBonuses(0);
128
- $: translationUrl && setTranslationUrl();
129
- </script>
130
-
131
- {#if isLoading}
132
- <div class="ModalLoader" part="ModalLoader"></div>
133
- {:else}
134
- <div class="BonusesWrapper {isMobile ? 'BonusesWrapperMobile' : ''}" part="BonusesWrapper {isMobile ? 'BonusesWrapperMobile' : ''}">
135
- {#if isMobile}
136
- <div class="MenuReturnButton" part="MenuReturnButton" on:click={() => toggleScreen()}>
137
- <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><defs><style>.aaa{fill:var(--emfe-w-color-primary, #D0046C);}</style></defs><g transform="translate(-20 -158)">
138
- <g transform="translate(20 158)">
139
- <path class="aaa" d="M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z" transform="translate(15 15) rotate(180)"/>
140
- </g></g>
141
- </svg>
142
- <h2 class="BonusesTitleMobile" part="BonusesTitleMobile">{$_('bonusHistory.title')}</h2>
143
- </div>
144
- {/if}
145
- <h2 class="BonusesTitle {isMobile ? 'BonusesTitleNone' : ''}" part="BonusesTitle {isMobile ? 'BonusesTitleNone' : ''}">{$_('bonusHistory.title')}</h2>
146
-
147
- <div class="BonusCalendarWrapper {isMobile ? 'BonusCalendarWrapperMobile' : ''}" part="BonusCalendarWrapper {isMobile ? 'BonusCalendarWrapperMobile' : ''}">
148
- <div class="BonusesCalendarContainer {isMobile ? 'BonusesCalendarContainerMobile' : ''}" part="BonusesCalendarContainer {isMobile ? 'BonusesCalendarContainerMobile' : ''}">
149
- <div class="BonusesCalendarStartDate {isMobile ? 'BonusesCalendarMobile' : ''}" part="BonusesCalendarStartDate {isMobile ? 'BonusesCalendarMobile' : ''}">
150
- <label for="BonusCalendarStartDate">{$_('bonusHistory.dateFrom')}</label>
151
- <vaadin-date-picker bind:this={startCalendar} max={maxDate} value={lastMonth} placeholder="From" class="VaadinDatePicker" part="VaadinDatePicker"></vaadin-date-picker>
152
- </div>
153
- <div class="BonusesCalendarEndDate {isMobile ? 'BonusesCalendarMobile' : ''}" part="BonusesCalendarEndDate {isMobile ? 'BonusesCalendarMobile' : ''}">
154
- <label for="BonusesCalendarEndDate">{$_('bonusHistory.dateTo')}</label>
155
- <vaadin-date-picker bind:this={endCalendar} max={maxDate} value={maxDate} placeholder="To" class="VaadinDatePicker" part="VaadinDatePicker"></vaadin-date-picker>
156
- </div>
157
- </div>
158
- <button class="BonusesCalendarFilter {isMobile ? 'BonusesCalendarFilterMobile' : ''}" part="BonusesCalendarFilter {isMobile ? 'BonusesCalendarFilterMobile' : ''}" on:click={() => getBonuses(0)}>{$_('bonusHistory.dateFilter')}</button>
159
- </div>
160
- <div class="BonusesGrid {isMobile ? 'BonusesGridMobile' : ''}" part="BonusesGrid {isMobile ? 'BonusesGridMobile' : ''}">
161
- {#if bonusesList.length === 0}
162
- <p>{$_('bonusHistory.noBonusHistory')}</p>
163
- {:else}
164
- {#each bonusesList as bonus}
165
- {#if bonus.type === 'freeRound'}
166
- <player-bonus-card
167
- bonuswalletid={bonus.walletId}
168
- bonusdate={bonus.granted}
169
- bonusstatus={bonus.status}
170
- bonusname={bonus.name}
171
- bonustype={bonus.type}
172
- bonuscurrency={bonus.currency}
173
- {lang}
174
- ></player-bonus-card>
175
- {:else}
176
- <player-bonus-card
177
- bonuswalletid={bonus.walletId}
178
- bonusdate={bonus.granted}
179
- bonusstatus={bonus.status}
180
- bonusname={bonus.name}
181
- bonustype={bonus.type}
182
- bonusamount={bonus.grantedAmount}
183
- bonuswageringamount={bonus.totalWR}
184
- bonusremainingamount={bonus.currentAmount}
185
- bonuscurrency={bonus.currency}
186
- {lang}
187
- ></player-bonus-card>
188
- {/if}
189
- {/each}
190
- {/if}
191
- </div>
192
- {#if bonusesList.length !== 0}
193
- <div class="BonusesPaginationWrapper {isMobile ? 'BonusesPaginationWrapperMobile' : ''}" part="BonusesPaginationWrapper {isMobile ? 'BonusesPaginationWrapperMobile' : ''}">
194
- <span class="BonusesFirst {currentPage === 0 ? 'Inactive' : ''}" part="BonusesFirst {currentPage === 0 ? 'Inactive' : ''}" on:click={() => getBonuses(0)}>&vert;&lt;</span>
195
- <span class="BonusesPrev {currentPage === 0 ? 'Inactive' : ''}" part="BonusesPrev {currentPage === 0 ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesPrevPage)}>&lt;</span>
196
- {#each Array(numberOfPages) as _, i}
197
- <span class="BonusesPage {i === currentPage ? 'BonusPageActive' : ''}" part="BonusesPage {i === currentPage ? 'BonusPageActive' : ''}" on:click={() => getBonuses(i*bonusesPerPage)}>{i+1}</span>
198
- {/each}
199
- <span class="BonusesNext {currentPage === (numberOfPages - 1) ? 'Inactive' : ''}" part="BonusesNext {currentPage === (numberOfPages - 1) ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesNextPage)}>&gt;</span>
200
- <span class="BonusesLast {currentPage === (numberOfPages - 1) ? 'Inactive' : ''}" part="BonusesLast {currentPage === (numberOfPages - 1) ? 'Inactive' : ''}" on:click={() => getBonuses(bonusesLastPage)}>&gt;&vert;</span>
201
- </div>
202
- {/if}
203
- </div>
204
- {/if}
205
-
206
- <style lang="scss">
207
-
208
- :host {
209
- font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
210
- }
211
-
212
- .BonusesWrapper {
213
- color: var(--emfe-w-color-contrast, #07072A);
214
- padding: 50px;
215
- max-width: 850px;
216
-
217
- &.BonusesWrapperMobile {
218
- padding: 20px 15px;
219
- max-width: unset;
220
- }
221
- }
222
-
223
- .MenuReturnButton{
224
- color: var(--emfe-w-color-primary, #D0046C);
225
- display: inline-flex;
226
- align-items: center;
227
- column-gap: 10px;
228
- margin-bottom: 10px;
229
- & svg {
230
- fill: var(--emfe-w-color-primary, #D0046C);
231
- }
232
- }
233
-
234
- .BonusesTitle {
235
- font-size: 26px;
236
- color: var(--emfe-w-color-primary, #D0046C);
237
- font-weight: 400;
238
- }
239
-
240
- .BonusesTitleMobile {
241
- font-size: 16px;
242
- }
243
-
244
- .BonusesTitleNone {
245
- display: none;
246
- }
247
-
248
- .BonusCalendarWrapper {
249
- display: flex;
250
- gap: 15px;
251
- padding-bottom: 30px;
252
- align-items: center;
253
- &.BonusCalendarWrapperMobile {
254
- flex-direction: column;
255
- gap: 10px;
256
- padding-bottom: 15px;
257
- }
258
- }
259
-
260
- .BonusesCalendarContainer {
261
- display: flex;
262
- gap: 20px;
263
- &.BonusesCalendarContainerMobile {
264
- flex-direction: row;
265
- gap: 0;
266
- justify-content: space-between;
267
- padding-bottom: 0;
268
- width: 100%;
269
- }
270
- }
271
-
272
- .BonusesCalendarStartDate,
273
- .BonusesCalendarEndDate {
274
- color: var(--emfe-w-color-gray-300, #58586B);
275
- display: flex;
276
- position: relative;
277
- align-items: center;
278
- gap: 10px;
279
- &.BonusesCalendarMobile {
280
- flex-direction: column;
281
- align-items: flex-start;
282
- gap: 5px;
283
- width: 48%;
284
- .VaadinDatePicker {
285
- width: 100%;
286
- }
287
- }
288
-
289
- label {
290
- font-size: 14px;
291
- font-weight: 300;
292
- }
293
-
294
- input {
295
- width: 100%;
296
- height: 44px;
297
- border: 1px solid var(--emfe-w-color-gray-100, #E6E6E6);
298
- border-radius: 5px;
299
- box-sizing: border-box;
300
- padding: 5px 15px;
301
- font-size: 16px;
302
- line-height: 18px;
303
- outline-color: var(--emfe-w-color-primary, #D0046C);
304
- }
305
- }
306
-
307
- .BonusesCalendarFilter {
308
- background: var(--emfe-w-color-primary, #D0046C);
309
- border: 1px solid var(--emfe-w-color-primary, #D0046C);
310
- color: var(--emfe-w-color-white, #FFFFFF);
311
- cursor: pointer;
312
- border-radius: 5px;
313
- width: 120px;
314
- height: 40px;
315
- font-size: 15px;
316
- text-transform: uppercase;
317
- text-align: center;
318
- transition-duration: 0.3s;
319
- box-sizing: border-box;
320
- padding: 10px;
321
- &.BonusesCalendarFilterMobile {
322
- width: 100%;
323
- height: 44px;
324
- }
325
-
326
- &:active {
327
- background: var(--emfe-w-color-primary-600, #99034F);
328
- }
329
- }
330
-
331
- .BonusesGrid {
332
- display: grid;
333
- grid-template-columns: 1fr 1fr;
334
- gap: 50px;
335
-
336
- &.BonusesGridMobile {
337
- grid-template-columns: 1fr;
338
- gap: 20px;
339
- }
340
- }
341
-
342
- .BonusesPaginationWrapper {
343
- margin: 40px 0;
344
- display: flex;
345
- justify-content: center;
346
- &.BonusesPaginationWrapperMobile {
347
- text-align: center;
348
- }
349
- .BonusesFirst, .BonusesPrev, .BonusesNext, .BonusesLast {
350
- color: var(--emfe-w-color-primary, #D0046C);
351
- font-size: 16px;
352
- cursor: pointer;
353
- padding: 5px 10px;
354
- font-weight: 700;
355
- &.Inactive {
356
- color: var(--emfe-w-color-gray-100, #E6E6E6);
357
- cursor: default;
358
- }
359
- }
360
- .BonusesPage {
361
- margin: 0 5px;
362
- color: var(--emfe-w-color-gray-300, #58586B);
363
- font-size: 16px;
364
- cursor: pointer;
365
- padding: 5px 10px;
366
- &.BonusPageActive {
367
- background-color: var(--emfe-w-color-white, #FFFFFF);
368
- font-weight: 700;
369
- }
370
- }
371
- }
372
- </style>
package/src/i18n.js DELETED
@@ -1,27 +0,0 @@
1
- import {
2
- dictionary,
3
- locale,
4
- addMessages,
5
- _
6
- } from 'svelte-i18n';
7
-
8
- function setupI18n({ withLocale: _locale, translations }) {
9
- locale.subscribe((data) => {
10
- if (data == null) {
11
- dictionary.set(translations);
12
- locale.set(_locale);
13
- }
14
- }); // maybe we will need this to make sure that the i18n is set up only once
15
- /*dictionary.set(translations);
16
- locale.set(_locale);*/
17
- }
18
-
19
- function addNewMessages(lang, dict) {
20
- addMessages(lang, dict);
21
- }
22
-
23
- function setLocale(_locale) {
24
- locale.set(_locale);
25
- }
26
-
27
- export { _, setupI18n, addNewMessages, setLocale };
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- import PlayerBonusHistory from './PlayerBonusHistory.svelte';
2
-
3
- !customElements.get('player-bonus-history') && customElements.define('player-bonus-history', PlayerBonusHistory);
4
- export default PlayerBonusHistory;
@@ -1,56 +0,0 @@
1
- export const PlayerBonusHistoryTranslations = {
2
- en: {
3
- bonusHistory: {
4
- title: `Bonus History`,
5
- dateFrom: `From:`,
6
- dateTo: `To:`,
7
- dateFilter: `Filter`,
8
- noBonusHistory: `You have no bonuses for the selected period.`
9
- }
10
- },
11
- zh: {
12
- bonusHistory: {
13
- title: `獎金歷史`,
14
- dateFrom: `從:`,
15
- dateTo: `至:`,
16
- dateFilter: `篩選`,
17
- noBonusHistory: `您目前沒有獎金歷史。`
18
- }
19
- },
20
- fr: {
21
- bonusHistory: {
22
- title: `Historique du bonus`,
23
- dateFrom: `De:`,
24
- dateTo: `A:`,
25
- dateFilter: `Filtre`,
26
- noBonusHistory: `Vous n'avez pas d'historique de bonus pour le moment.`
27
- }
28
- },
29
- ro: {
30
- bonusHistory: {
31
- title: `Istoric bonusuri`,
32
- dateFrom: `De la`,
33
- dateTo: `La`,
34
- dateFilter: `Filtru`,
35
- noBonusHistory: `Nu ai bonusuri pentru perioada selectata.`
36
- }
37
- },
38
- es: {
39
- bonusHistory: {
40
- title: `Historial de bonos`,
41
- dateFrom: `Desde:`,
42
- dateTo: `Para:`,
43
- dateFilter: `Filtro:`,
44
- noBonusHistory: `Actualmente no tienes historial de bonos.`
45
- }
46
- },
47
- pt: {
48
- bonusHistory: {
49
- title: `Histórico de bônus`,
50
- dateFrom: `A partir de:`,
51
- dateTo: `Para:`,
52
- dateFilter: `Filtro:`,
53
- noBonusHistory: `Você não tem histórico de bônus no momento.`
54
- }
55
- },
56
- };
@@ -1,13 +0,0 @@
1
- import { html } from 'lit-element';
2
-
3
- import PlayerBonusHistory from '../src/PlayerBonusHistory';
4
-
5
- // This default export determines where your story goes in the story list
6
- export default {
7
- title: 'PlayerBonusHistory',
8
- };
9
-
10
- // 👇 We create a “template” of how args map to rendering
11
- const PlayerBonusHistory = ({ aProperty }) => html`<player-bonus-history></player-bonus-history>`;
12
-
13
- export const FirstStory = PlayerBonusHistory.bind({});
package/tsconfig.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "@tsconfig/svelte/tsconfig.json",
3
-
4
- "include": ["src/**/*"],
5
- "exclude": ["node_modules/*", "__sapper__/*", "public/*"]
6
- }