@everymatrix/casino-engagement-suite-tournament 1.39.0

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.
Files changed (63) hide show
  1. package/dist/casino-engagement-suite-tournament/casino-engagement-suite-tournament.esm.js +1 -0
  2. package/dist/casino-engagement-suite-tournament/index.esm.js +0 -0
  3. package/dist/casino-engagement-suite-tournament/p-75de0549.entry.js +1 -0
  4. package/dist/casino-engagement-suite-tournament/p-86ce7485.js +1 -0
  5. package/dist/cjs/casino-engagement-suite-progress-bar_3.cjs.entry.js +824 -0
  6. package/dist/cjs/casino-engagement-suite-tournament.cjs.js +19 -0
  7. package/dist/cjs/index-e778ddd2.js +1733 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +25 -0
  11. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.css +374 -0
  12. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.js +601 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/shared/GradientRoundedButton.js +12 -0
  15. package/dist/collection/shared/icons.js +8 -0
  16. package/dist/collection/shared/renderBar.js +14 -0
  17. package/dist/collection/utils/api.apdater.js +35 -0
  18. package/dist/collection/utils/translations.js +28 -0
  19. package/dist/collection/utils/types.js +18 -0
  20. package/dist/collection/utils/util.date.js +38 -0
  21. package/dist/collection/utils/utils.js +18 -0
  22. package/dist/components/casino-engagement-suite-progress-bar.js +6 -0
  23. package/dist/components/casino-engagement-suite-progress-bar2.js +94 -0
  24. package/dist/components/casino-engagement-suite-tournament.d.ts +11 -0
  25. package/dist/components/casino-engagement-suite-tournament.js +716 -0
  26. package/dist/components/general-styling-wrapper.js +6 -0
  27. package/dist/components/general-styling-wrapper2.js +103 -0
  28. package/dist/components/index.d.ts +26 -0
  29. package/dist/components/index.js +1 -0
  30. package/dist/esm/casino-engagement-suite-progress-bar_3.entry.js +818 -0
  31. package/dist/esm/casino-engagement-suite-tournament.js +17 -0
  32. package/dist/esm/index-4e611d33.js +1704 -0
  33. package/dist/esm/index.js +1 -0
  34. package/dist/esm/loader.js +17 -0
  35. package/dist/esm/polyfills/core-js.js +11 -0
  36. package/dist/esm/polyfills/css-shim.js +1 -0
  37. package/dist/esm/polyfills/dom.js +79 -0
  38. package/dist/esm/polyfills/es5-html-element.js +1 -0
  39. package/dist/esm/polyfills/index.js +34 -0
  40. package/dist/esm/polyfills/system.js +6 -0
  41. package/dist/index.cjs.js +1 -0
  42. package/dist/index.js +1 -0
  43. package/dist/stencil.config.js +22 -0
  44. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-tournament/.stencil/packages/casino-engagement-suite-tournament/stencil.config.d.ts +2 -0
  45. package/dist/types/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.d.ts +130 -0
  46. package/dist/types/components.d.ts +79 -0
  47. package/dist/types/index.d.ts +1 -0
  48. package/dist/types/shared/GradientRoundedButton.d.ts +5 -0
  49. package/dist/types/shared/icons.d.ts +7 -0
  50. package/dist/types/shared/renderBar.d.ts +1 -0
  51. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  52. package/dist/types/utils/api.apdater.d.ts +31 -0
  53. package/dist/types/utils/translations.d.ts +42 -0
  54. package/dist/types/utils/types.d.ts +95 -0
  55. package/dist/types/utils/util.date.d.ts +6 -0
  56. package/dist/types/utils/utils.d.ts +1 -0
  57. package/loader/cdn.js +3 -0
  58. package/loader/index.cjs.js +3 -0
  59. package/loader/index.d.ts +12 -0
  60. package/loader/index.es2017.js +3 -0
  61. package/loader/index.js +4 -0
  62. package/loader/package.json +10 -0
  63. package/package.json +26 -0
@@ -0,0 +1,601 @@
1
+ import { __rest } from "tslib";
2
+ import { Component, Fragment, Prop, State, h, Event, Listen, Host } from '@stencil/core';
3
+ import { TRANSLATIONS, Tab, localePostprocess } from '../../utils/translations';
4
+ import { classnames } from '../../utils/utils';
5
+ import { TournamentState, LeaderboardPage, DialogType, } from '../../utils/types';
6
+ import { GradientRoundedButton } from '../../shared/GradientRoundedButton';
7
+ import { iconBack, iconClose, iconReward, iconEyeClose, iconEyeOpen, iconQuestion, iconTrophy } from '../../shared/icons';
8
+ import { CloseBar } from '../../shared/renderBar';
9
+ import { addSeconds, formatDate, getDifference, getProgress } from '../../utils/util.date';
10
+ import { leaderboardsAdapter, tournamentAdapter } from '../../utils/api.apdater';
11
+ import "@everymatrix/general-animation-loading";
12
+ import "@everymatrix/general-styling-wrapper";
13
+ import "@everymatrix/casino-engagement-suite-progress-bar";
14
+ export class CasinoEngagementSuiteTournament {
15
+ constructor() {
16
+ /**
17
+ * Language
18
+ */
19
+ this.language = 'en';
20
+ /**
21
+ * Client custom styling via string
22
+ */
23
+ this.clientStyling = '';
24
+ /**
25
+ * Client custom styling via url
26
+ */
27
+ this.clientStylingUrl = '';
28
+ /**
29
+ * Translation via url
30
+ */
31
+ this.translationUrl = '';
32
+ this.tab = Tab.Info;
33
+ this.locale = TRANSLATIONS;
34
+ this.tournamentItem = undefined;
35
+ this.tournamentList = undefined;
36
+ this.leaderboards = [];
37
+ this.isActionJoinPending = false;
38
+ this.isDialogOpen = false;
39
+ this.isShowInfo = false;
40
+ this.page = LeaderboardPage.List;
41
+ this.tournamentInDialog = undefined;
42
+ this.dialog = {
43
+ isOpen: false,
44
+ type: undefined,
45
+ data: undefined,
46
+ };
47
+ this.time = 0;
48
+ this.onClickConfirmJoin = () => {
49
+ this.actionJoin(this.tournamentItem);
50
+ this.nextPage = LeaderboardPage.List;
51
+ };
52
+ this.onClickConfirmUnjoin = () => {
53
+ this.close.emit();
54
+ };
55
+ this.onClickDialogUnjoin = () => {
56
+ this.actionJoin(this.dialog.data);
57
+ this.closeDialog();
58
+ };
59
+ this.onClickDialogJoin = () => {
60
+ this.closeDialog();
61
+ };
62
+ this.onClickBarInLayout = () => {
63
+ this.close.emit();
64
+ };
65
+ this.onClickBarInLayoutDialog = () => {
66
+ this.closeDialog();
67
+ };
68
+ this.onClickShowInfo = () => {
69
+ this.isShowInfo = !this.isShowInfo;
70
+ };
71
+ this.onClickBarTip = () => {
72
+ this.openDialog(DialogType.Tip);
73
+ };
74
+ this.onClickBarBack = () => {
75
+ this.setPage(LeaderboardPage.List);
76
+ };
77
+ }
78
+ setTimeInterval() {
79
+ this.timeHolder = setInterval(() => {
80
+ if (this.tournamentList || this.tournamentItem) {
81
+ this.time += 1;
82
+ }
83
+ else {
84
+ this.time = 0;
85
+ }
86
+ }, 1000);
87
+ }
88
+ updateTournamentListByItem(tournament) {
89
+ this.tournamentList = this.tournamentList.map((_tournament) => {
90
+ if (_tournament.id === tournament.id) {
91
+ return tournamentAdapter(tournament);
92
+ }
93
+ else {
94
+ return _tournament;
95
+ }
96
+ });
97
+ }
98
+ handleEvent(e) {
99
+ const _a = e.data, { type } = _a, rest = __rest(_a, ["type"]);
100
+ switch (type) {
101
+ case 'ShowLeaderboardRewardModal': {
102
+ const { tournament } = rest;
103
+ this.setPage(LeaderboardPage.Confirm, { tournament: tournamentAdapter(tournament) });
104
+ postMessage({ type: 'BarLeaderboardsClick' });
105
+ break;
106
+ }
107
+ case 'UpdateTournamentsItemRes': {
108
+ const tournamentNew = tournamentAdapter(rest.data.item);
109
+ this.tournamentItem = tournamentNew;
110
+ this.updateTournamentListByItem(tournamentNew);
111
+ break;
112
+ }
113
+ case 'UpdateLeaderboardsRes': {
114
+ this.leaderboards = leaderboardsAdapter(rest.data);
115
+ break;
116
+ }
117
+ case 'JoinTournamentRes':
118
+ case 'UnjoinTournamentRes':
119
+ const { success } = rest;
120
+ if (success) {
121
+ this.tournamentItem = Object.assign(Object.assign({}, this.tournamentItem), { playerEnrolled: !!!this.tournamentItem.playerEnrolled });
122
+ switch (this.page) {
123
+ case LeaderboardPage.Item: {
124
+ break;
125
+ }
126
+ case LeaderboardPage.List: {
127
+ this.updateTournamentListByItem(this.tournamentItem);
128
+ break;
129
+ }
130
+ }
131
+ }
132
+ if (this.nextPage) {
133
+ this.setPage(this.nextPage);
134
+ this.nextPage = undefined;
135
+ }
136
+ this.isActionJoinPending = false;
137
+ break;
138
+ }
139
+ }
140
+ get messageSender() {
141
+ return {
142
+ JoinTournamentReq: (tournament) => { var _a; return window.postMessage({ type: 'JoinTournamentReq', bonusCode: (_a = tournament.wallets[0]) === null || _a === void 0 ? void 0 : _a.code }); },
143
+ UnjoinTournamentReq: (tournament) => window.postMessage({ type: 'UnjoinTournamentReq', id: tournament.id }),
144
+ UpdateTournamentsItemReq: (tournament) => window.postMessage({ type: 'UpdateTournamentsItemReq', id: tournament.id }),
145
+ UpdateLeaderboardsReq: (tournament) => window.postMessage({ type: 'UpdateLeaderboardsReq', id: tournament.id }),
146
+ };
147
+ }
148
+ connectedCallback() {
149
+ this.setTimeInterval();
150
+ }
151
+ disconnectedCallback() {
152
+ clearInterval(this.timeHolder);
153
+ }
154
+ actionJoin(tournament) {
155
+ if (this.isActionJoinPending)
156
+ return;
157
+ this.isActionJoinPending = true;
158
+ try {
159
+ if (tournament.playerEnrolled) {
160
+ this.messageSender.UnjoinTournamentReq(tournament);
161
+ }
162
+ else {
163
+ this.messageSender.JoinTournamentReq(tournament);
164
+ }
165
+ }
166
+ catch (e) {
167
+ console.log('error', e);
168
+ return;
169
+ }
170
+ }
171
+ isTournamentClosed(tournament) {
172
+ return [
173
+ TournamentState.Closed,
174
+ TournamentState.Closing
175
+ ].includes(tournament.state);
176
+ }
177
+ setPage(page, metaData) {
178
+ switch (page) {
179
+ case LeaderboardPage.Confirm:
180
+ case LeaderboardPage.Item:
181
+ this.tournamentItem = metaData.tournament;
182
+ if (!this.tournamentItem) {
183
+ this.messageSender.UpdateTournamentsItemReq(metaData.tournament);
184
+ }
185
+ if (this.isTournamentClosed(this.tournamentItem)) {
186
+ this.messageSender.UpdateLeaderboardsReq(this.tournamentItem);
187
+ }
188
+ break;
189
+ case LeaderboardPage.List:
190
+ break;
191
+ }
192
+ this.tab = Tab.Info;
193
+ this.page = page;
194
+ }
195
+ renderPage() {
196
+ switch (this.page) {
197
+ case LeaderboardPage.Confirm: return this.renderPageConfirm();
198
+ case LeaderboardPage.Item: return this.renderPageLeaderboardItem();
199
+ case LeaderboardPage.List: return this.renderPageLeaderboardList();
200
+ }
201
+ }
202
+ render() {
203
+ return (h(Host, null,
204
+ h("general-styling-wrapper", { clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling,
205
+ // @ts-ignore
206
+ targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }),
207
+ this.renderPage()));
208
+ }
209
+ onClickListItemChangePage(tournament) {
210
+ this.setPage(LeaderboardPage.Item, { tournament });
211
+ }
212
+ onClickItemJoin(tournament, e) {
213
+ e.stopPropagation();
214
+ if (tournament.playerEnrolled) {
215
+ this.openDialog(DialogType.Unjoin, tournament);
216
+ }
217
+ else {
218
+ this.actionJoin(tournament);
219
+ this.tournamentItem = tournament;
220
+ }
221
+ }
222
+ onClickTab(tab) {
223
+ this.tab = tab;
224
+ switch (tab) {
225
+ case Tab.Leaderboard:
226
+ this.leaderboards = undefined;
227
+ this.messageSender.UpdateLeaderboardsReq(this.tournamentItem);
228
+ break;
229
+ case Tab.Games:
230
+ this.messageSender.UpdateTournamentsItemReq(this.tournamentItem);
231
+ break;
232
+ }
233
+ }
234
+ renderPageLeaderboardList() {
235
+ var _a;
236
+ if (!this.tournamentList) {
237
+ this.tournamentList = (_a = this.leaderboardsInit) === null || _a === void 0 ? void 0 : _a.map(item => tournamentAdapter(item));
238
+ return h("general-animation-loading", null);
239
+ }
240
+ const { locale } = this;
241
+ if (this.tournamentList.length) {
242
+ return this.renderLeaderboardContainer(h(Fragment, null,
243
+ h("div", { class: "Leaderboards Row" }, this.tournamentList.map(_tournament => (h("div", { class: classnames("LeaderboardsItem", _tournament.playerEnrolled ? ' GradientRounded Hollow' : ''), onClick: this.onClickListItemChangePage.bind(this, _tournament) },
244
+ h("div", { class: "LeaderboardsItemContainer" },
245
+ this.renderTitleContainer(_tournament),
246
+ this.renderTimeBar(_tournament))))))));
247
+ }
248
+ else {
249
+ return (h("div", { class: "NoLeaderboards Row" },
250
+ h("div", null, locale.NoLeaderboards),
251
+ h("div", null, locale.NoLeaderboardsTip)));
252
+ }
253
+ }
254
+ renderPageConfirm() {
255
+ if (!this.tournamentItem)
256
+ return h("general-animation-loading", null);
257
+ const tournamentName = this.tournamentItem.nameOrTitle;
258
+ const { locale } = this;
259
+ return (h("div", { class: "PageConfirmContainer" },
260
+ h("div", { class: "GradientRounded Hollow PageConfirm" },
261
+ h("div", null, iconTrophy),
262
+ h("div", { class: "Title" }, locale.JoinDialog.Tile),
263
+ h("div", { class: "Description", innerHTML: localePostprocess(locale.JoinDialog.Description, { tournamentName }) }),
264
+ h("div", { class: "PageConfirmButtonsGroup" },
265
+ h(GradientRoundedButton, Object.assign({}, {
266
+ statedClasses: {
267
+ isPending: this.isActionJoinPending,
268
+ },
269
+ onClick: this.onClickConfirmJoin,
270
+ innerHTML: locale.JoinDialog.ButtonYes,
271
+ })),
272
+ h(GradientRoundedButton, Object.assign({}, {
273
+ statedClasses: {
274
+ isPending: this.isActionJoinPending,
275
+ isHollow: true,
276
+ },
277
+ onClick: this.onClickConfirmUnjoin,
278
+ innerHTML: locale.JoinDialog.ButtonNo,
279
+ }))))));
280
+ }
281
+ renderPageLeaderboardItem() {
282
+ if (!this.tournamentItem)
283
+ return h("general-animation-loading", null);
284
+ return this.renderLeaderboardContainer(h(Fragment, null,
285
+ this.renderTitleContainer(this.tournamentItem),
286
+ this.renderTabs(),
287
+ this.renderTabbedContent()));
288
+ }
289
+ renderDialogContent() {
290
+ switch (this.dialog.type) {
291
+ case DialogType.Unjoin:
292
+ return this.renderDialogContentUnjoin();
293
+ case DialogType.Tip:
294
+ return (h("div", { class: "Tip" }, this.locale.Tip));
295
+ }
296
+ }
297
+ renderDialogContentUnjoin() {
298
+ const { locale } = this;
299
+ return (h("div", { class: "DialogContentUnjoin" },
300
+ h("div", { class: "DialogContentUnjoinTitle" }, locale.UnjoinDialog.Title),
301
+ h("div", { class: "DialogContentUnjoinDescription", innerHTML: locale.UnjoinDialog.Description }),
302
+ h(GradientRoundedButton, Object.assign({}, {
303
+ statedClasses: {
304
+ isPending: this.isActionJoinPending,
305
+ },
306
+ onClick: this.onClickDialogUnjoin,
307
+ innerHTML: locale.UnjoinDialog.ButtonYes,
308
+ })),
309
+ h(GradientRoundedButton, Object.assign({}, {
310
+ statedClasses: {
311
+ isHollow: true,
312
+ isPending: this.isActionJoinPending,
313
+ },
314
+ onClick: this.onClickDialogJoin,
315
+ innerHTML: locale.UnjoinDialog.ButtonNo,
316
+ }))));
317
+ }
318
+ renderTitleContainer(tournament) {
319
+ const { locale } = this;
320
+ return (h("div", { class: "TitleContainer" },
321
+ h("div", { class: "Title" }, tournament.nameOrTitle),
322
+ tournament.state !== TournamentState.Closed && (h("div", null,
323
+ h(GradientRoundedButton, Object.assign({}, {
324
+ statedClasses: {
325
+ isHollow: tournament.playerEnrolled,
326
+ isPending: this.isActionJoinPending,
327
+ },
328
+ onClick: this.onClickItemJoin.bind(this, tournament),
329
+ innerHTML: tournament.playerEnrolled ? locale.Unjoin : locale.Join,
330
+ }))))));
331
+ }
332
+ renderTabbedContent() {
333
+ switch (this.tab) {
334
+ case Tab.Info: return this.renderInfo();
335
+ case Tab.Leaderboard: return this.renderLeaderboard();
336
+ case Tab.Games: return this.renderGames();
337
+ }
338
+ }
339
+ renderGames() {
340
+ var _a;
341
+ return (h("div", { class: "Games" }, (_a = this.tournamentItem.games) === null || _a === void 0 ? void 0 : _a.map(game => (h("div", null,
342
+ h("img", { src: game.defaultThumbnail, alt: "" }))))));
343
+ }
344
+ renderLeaderboard() {
345
+ if (!this.leaderboards)
346
+ return h("general-animation-loading", null);
347
+ if (!this.leaderboards.length)
348
+ return '';
349
+ return (h("table", { class: "Leaderboards" }, this.leaderboards.map(leaderboard => (h("tr", { class: classnames({ isMe: leaderboard.isMe }) },
350
+ h("td", { class: "LeaderboardRank" },
351
+ h("span", null, leaderboard.rank)),
352
+ h("td", { class: "LeaderboardName" }, leaderboard.shortName),
353
+ h("td", { class: "LeaderboardScore" }, leaderboard.score),
354
+ h("td", { class: "LeaderboardPrize" }, leaderboard.prizeName))))));
355
+ }
356
+ renderTabs() {
357
+ const { locale, tab } = this;
358
+ return (h("div", { class: "TabsContainer" },
359
+ h("div", { class: "Tabs" }, Object.keys(Tab).map((_tab) => (h("div", Object.assign({}, {
360
+ class: classnames({ active: tab === _tab }),
361
+ onClick: this.onClickTab.bind(this, _tab)
362
+ }), locale[_tab]))))));
363
+ }
364
+ renderTimeBar(tournament) {
365
+ return (h("section", { class: "TimeContainer" },
366
+ h("div", { class: 'Time' }, tournament.playerEnrolled ? (h(Fragment, null,
367
+ h("div", null, getDifference(addSeconds(tournament.startTime, this.time), tournament.endTime)),
368
+ h("div", null,
369
+ h(GradientRoundedButton, { statedClasses: {
370
+ isHollow: true,
371
+ isPendding: false,
372
+ }, innerHTML: `${getProgress(tournament.startTime, tournament.endTime)}%` })))) : (h(Fragment, null,
373
+ h("div", null, formatDate(tournament.startTime)),
374
+ h("div", null, formatDate(tournament.endTime))))),
375
+ h("casino-engagement-suite-progress-bar", { value: Number(getProgress(tournament.startTime, tournament.endTime)), "hide-percent": true })));
376
+ }
377
+ renderInfo() {
378
+ var _a, _b;
379
+ const { locale, tournamentItem: tournament, isShowInfo } = this;
380
+ return (h("div", { class: "InfoContainer" },
381
+ this.renderTimeBar(tournament),
382
+ (h("section", { class: "ShowInfo", onClick: this.onClickShowInfo },
383
+ h("p", null,
384
+ h("span", null, isShowInfo ? iconEyeClose : iconEyeOpen),
385
+ h("span", null, locale.LeaderboardDetails)))),
386
+ isShowInfo && (h("section", { class: "Info" },
387
+ h("div", null, tournament.description),
388
+ h("div", { class: "Criterias" },
389
+ h("div", null,
390
+ locale.ScoreCriteria,
391
+ ": ",
392
+ h("span", null, tournament.scoreCriteria)),
393
+ h("div", null,
394
+ locale.MinimumBetCriteria,
395
+ ": ",
396
+ h("span", null, tournament.minBetCount))),
397
+ h("div", { class: "TC" },
398
+ h("a", { href: tournament.termsUrl, target: '_blank' }, locale.TC)))),
399
+ this.isTournamentClosed(this.tournamentItem) && ((_a = this.leaderboards) === null || _a === void 0 ? void 0 : _a.find(l => l.isMe)) && (h("section", { class: "ResultPrize", innerHTML: localePostprocess(locale.TipPrize, this.getResultPrize((_b = this.leaderboards) === null || _b === void 0 ? void 0 : _b.find(l => l.isMe))) })),
400
+ h("section", { class: "Prizes" },
401
+ h("div", { class: "PrizesHeader" },
402
+ iconReward,
403
+ h("span", { class: "PrizesText" }, locale.Prizes)),
404
+ tournament.prizes.map((prize, index) => (h("div", { class: "Prize" },
405
+ index + 1,
406
+ " ",
407
+ locale.Place,
408
+ ": ",
409
+ h("span", { class: "PrizeText" }, prize.name)))))));
410
+ }
411
+ getResultPrize(leaderboard) {
412
+ return {
413
+ prize: leaderboard.prizeName,
414
+ place: leaderboard.rank,
415
+ };
416
+ }
417
+ renderCloseBarInLayout() {
418
+ const { left, middle } = this.getWrapperBarData();
419
+ return (h(CloseBar, Object.assign({}, { left, middle,
420
+ right: (h("span", Object.assign({}, { onClick: this.onClickBarInLayout }), iconClose))
421
+ })));
422
+ }
423
+ renderCloseBarInLayoutDialog() {
424
+ return (h(CloseBar, Object.assign({}, {
425
+ right: (h("span", Object.assign({}, { onClick: this.onClickBarInLayoutDialog }), iconClose))
426
+ })));
427
+ }
428
+ renderLeaderboardContainer(render) {
429
+ const { dialog: { isOpen } } = this;
430
+ return (h("div", { class: "Wrapper" },
431
+ h("div", { class: classnames("WrapperContent", { faded: isOpen }) },
432
+ this.renderCloseBarInLayout(),
433
+ h("div", { class: "Root" },
434
+ h("div", { class: "Main" }, render))),
435
+ h("div", { class: "WrapperUtil" },
436
+ h("dialog", { open: isOpen },
437
+ h("div", null,
438
+ this.renderCloseBarInLayoutDialog(),
439
+ isOpen && this.renderDialogContent())))));
440
+ }
441
+ getWrapperBarData() {
442
+ const { page, locale } = this;
443
+ switch (page) {
444
+ case LeaderboardPage.List:
445
+ return {
446
+ left: h("span", { onClick: this.onClickBarTip }, iconQuestion),
447
+ middle: locale.Leaderboards
448
+ };
449
+ case LeaderboardPage.Item:
450
+ return {
451
+ left: (h("span", { onClick: this.onClickBarBack }, iconBack)),
452
+ middle: '',
453
+ };
454
+ }
455
+ }
456
+ openDialog(type, data = undefined) {
457
+ this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: true, type, data });
458
+ }
459
+ closeDialog() {
460
+ this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: false });
461
+ }
462
+ static get is() { return "casino-engagement-suite-tournament"; }
463
+ static get encapsulation() { return "shadow"; }
464
+ static get originalStyleUrls() { return {
465
+ "$": ["casino-engagement-suite-tournament.scss"]
466
+ }; }
467
+ static get styleUrls() { return {
468
+ "$": ["casino-engagement-suite-tournament.css"]
469
+ }; }
470
+ static get properties() { return {
471
+ "language": {
472
+ "type": "string",
473
+ "mutable": false,
474
+ "complexType": {
475
+ "original": "string",
476
+ "resolved": "string",
477
+ "references": {}
478
+ },
479
+ "required": false,
480
+ "optional": false,
481
+ "docs": {
482
+ "tags": [],
483
+ "text": "Language"
484
+ },
485
+ "attribute": "language",
486
+ "reflect": false,
487
+ "defaultValue": "'en'"
488
+ },
489
+ "clientStyling": {
490
+ "type": "string",
491
+ "mutable": false,
492
+ "complexType": {
493
+ "original": "string",
494
+ "resolved": "string",
495
+ "references": {}
496
+ },
497
+ "required": false,
498
+ "optional": false,
499
+ "docs": {
500
+ "tags": [],
501
+ "text": "Client custom styling via string"
502
+ },
503
+ "attribute": "client-styling",
504
+ "reflect": true,
505
+ "defaultValue": "''"
506
+ },
507
+ "clientStylingUrl": {
508
+ "type": "string",
509
+ "mutable": false,
510
+ "complexType": {
511
+ "original": "string",
512
+ "resolved": "string",
513
+ "references": {}
514
+ },
515
+ "required": false,
516
+ "optional": false,
517
+ "docs": {
518
+ "tags": [],
519
+ "text": "Client custom styling via url"
520
+ },
521
+ "attribute": "client-styling-url",
522
+ "reflect": true,
523
+ "defaultValue": "''"
524
+ },
525
+ "translationUrl": {
526
+ "type": "string",
527
+ "mutable": false,
528
+ "complexType": {
529
+ "original": "string",
530
+ "resolved": "string",
531
+ "references": {}
532
+ },
533
+ "required": false,
534
+ "optional": false,
535
+ "docs": {
536
+ "tags": [],
537
+ "text": "Translation via url"
538
+ },
539
+ "attribute": "translation-url",
540
+ "reflect": true,
541
+ "defaultValue": "''"
542
+ },
543
+ "leaderboardsInit": {
544
+ "type": "unknown",
545
+ "mutable": false,
546
+ "complexType": {
547
+ "original": "TournamentApi[]",
548
+ "resolved": "TournamentApi[]",
549
+ "references": {
550
+ "TournamentApi": {
551
+ "location": "import",
552
+ "path": "../../utils/types"
553
+ }
554
+ }
555
+ },
556
+ "required": false,
557
+ "optional": false,
558
+ "docs": {
559
+ "tags": [],
560
+ "text": "Raw Leaderboards from API for Init"
561
+ }
562
+ }
563
+ }; }
564
+ static get states() { return {
565
+ "tab": {},
566
+ "locale": {},
567
+ "tournamentItem": {},
568
+ "tournamentList": {},
569
+ "leaderboards": {},
570
+ "isActionJoinPending": {},
571
+ "isDialogOpen": {},
572
+ "isShowInfo": {},
573
+ "page": {},
574
+ "tournamentInDialog": {},
575
+ "dialog": {},
576
+ "time": {}
577
+ }; }
578
+ static get events() { return [{
579
+ "method": "close",
580
+ "name": "close",
581
+ "bubbles": true,
582
+ "cancelable": true,
583
+ "composed": true,
584
+ "docs": {
585
+ "tags": [],
586
+ "text": ""
587
+ },
588
+ "complexType": {
589
+ "original": "void",
590
+ "resolved": "void",
591
+ "references": {}
592
+ }
593
+ }]; }
594
+ static get listeners() { return [{
595
+ "name": "message",
596
+ "method": "handleEvent",
597
+ "target": "window",
598
+ "capture": false,
599
+ "passive": false
600
+ }]; }
601
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,12 @@
1
+ import { __rest } from "tslib";
2
+ import { h } from "@stencil/core";
3
+ import { classnames } from "../utils/utils";
4
+ export const GradientRoundedButton = (_a) => {
5
+ var { statedClasses, innerHTML } = _a, props = __rest(_a, ["statedClasses", "innerHTML"]);
6
+ const { isHollow, isPending } = statedClasses;
7
+ return (h("button", Object.assign({}, Object.assign({ class: classnames('GradientRoundedButton', 'GradientRounded', {
8
+ Hollow: isHollow || false,
9
+ Pending: isPending || false,
10
+ }) }, props)),
11
+ h("span", null, innerHTML)));
12
+ };
@@ -0,0 +1,8 @@
1
+ import { h } from "@stencil/core";
2
+ export const iconClose = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg" });
3
+ export const iconQuestion = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg" });
4
+ export const iconEyeOpen = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-open.svg" });
5
+ export const iconEyeClose = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-closed.svg" });
6
+ export const iconBack = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/back.svg" });
7
+ export const iconReward = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/reward.svg" });
8
+ export const iconTrophy = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/cup-congras.svg" });
@@ -0,0 +1,14 @@
1
+ import { h } from "@stencil/core";
2
+ export const CloseBar = (props) => {
3
+ const { left, middle, right } = props;
4
+ const slots = {
5
+ left,
6
+ middle,
7
+ right,
8
+ };
9
+ const getFirstLetterUppercase = (str) => str
10
+ .split('')
11
+ .map((letter, index) => index === 0 ? letter.toUpperCase() : letter)
12
+ .join('');
13
+ return (h("div", { class: "WrapperBar" }, Object.keys(slots).map(slotKey => (h("div", { class: "WrapperBar" + getFirstLetterUppercase(slotKey) }, slots[slotKey] || '')))));
14
+ };
@@ -0,0 +1,35 @@
1
+ export const tournamentAdapter = (tournamentApi) => {
2
+ const keysTime = [
3
+ 'startTime',
4
+ 'endTime',
5
+ 'closeTime',
6
+ 'exhibitionStartTime',
7
+ 'exhibitionEndTime',
8
+ ];
9
+ const tournament = {};
10
+ Object.keys(tournamentApi).map((key) => {
11
+ const value = tournamentApi[key];
12
+ switch (key) {
13
+ case 'games':
14
+ tournament[key] = value.items;
15
+ break;
16
+ default:
17
+ tournament[key] = keysTime.includes(key) ? new Date(value) : value;
18
+ }
19
+ });
20
+ return tournament;
21
+ };
22
+ export const leaderboardsAdapter = (leaderboardRes) => {
23
+ let { item, items: leaderboards } = leaderboardRes;
24
+ if (!item) {
25
+ return leaderboards;
26
+ }
27
+ return leaderboards.map(leaderboard => {
28
+ if (item && item.userID === leaderboard.userID) {
29
+ return Object.assign(Object.assign({}, leaderboard), { isMe: true });
30
+ }
31
+ else {
32
+ return leaderboard;
33
+ }
34
+ });
35
+ };