@everymatrix/casino-engagement-suite-tournament 1.45.14 → 1.46.1
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/dist/casino-engagement-suite-tournament/casino-engagement-suite-tournament.esm.js +1 -1
- package/dist/casino-engagement-suite-tournament/index.esm.js +1 -1
- package/dist/casino-engagement-suite-tournament/p-2dc46ff5.js +2 -0
- package/dist/casino-engagement-suite-tournament/{p-0f4e94ab.entry.js → p-e969a6a6.entry.js} +1 -1
- package/dist/casino-engagement-suite-tournament/p-ecf7465a.js +1 -0
- package/dist/cjs/casino-engagement-suite-progress-bar_3.cjs.entry.js +2 -2
- package/dist/cjs/casino-engagement-suite-tournament-81cbca40.js +733 -0
- package/dist/cjs/casino-engagement-suite-tournament.cjs.js +2 -2
- package/dist/cjs/{index-16d5d7c3.js → index-6f030cde.js} +28 -43
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.css +101 -68
- package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.js +168 -313
- package/dist/collection/shared/GradientRoundedButton.js +1 -1
- package/dist/collection/shared/renderBar.js +2 -2
- package/dist/collection/shared/renders.dialog.js +49 -0
- package/dist/collection/shared/renders.js +8 -0
- package/dist/collection/shared/renders.page.js +117 -0
- package/dist/collection/shared/renders.tab.js +30 -0
- package/dist/collection/shared/renders.util.js +18 -0
- package/dist/collection/utils/api.apdater.js +2 -2
- package/dist/collection/utils/bussiness.js +38 -0
- package/dist/collection/utils/message.js +63 -0
- package/dist/collection/utils/translations.js +8 -9
- package/dist/collection/utils/types.js +5 -5
- package/dist/collection/utils/util.date.js +1 -1
- package/dist/collection/utils/utils.js +6 -2
- package/dist/esm/casino-engagement-suite-progress-bar_3.entry.js +2 -2
- package/dist/esm/casino-engagement-suite-tournament-65c77450.js +731 -0
- package/dist/esm/casino-engagement-suite-tournament.js +3 -3
- package/dist/esm/{index-3962add4.js → index-224e880a.js} +29 -43
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/stencil.config.dev.js +2 -0
- package/dist/types/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.d.ts +27 -52
- package/dist/types/components.d.ts +16 -0
- package/dist/types/shared/GradientRoundedButton.d.ts +1 -1
- package/dist/types/shared/renderBar.d.ts +1 -1
- package/dist/types/shared/renders.d.ts +6 -0
- package/dist/types/shared/renders.dialog.d.ts +2 -0
- package/dist/types/shared/renders.page.d.ts +2 -0
- package/dist/types/shared/renders.tab.d.ts +3 -0
- package/dist/types/shared/renders.util.d.ts +2 -0
- package/dist/types/utils/api.apdater.d.ts +1 -1
- package/dist/types/utils/bussiness.d.ts +32 -0
- package/dist/types/utils/message.d.ts +17 -0
- package/dist/types/utils/translations.d.ts +8 -9
- package/dist/types/utils/types.d.ts +14 -5
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/casino-engagement-suite-tournament/p-1bf11325.js +0 -2
- package/dist/casino-engagement-suite-tournament/p-5df3ac81.js +0 -1
- package/dist/cjs/casino-engagement-suite-tournament-1b738bb2.js +0 -560
- package/dist/esm/casino-engagement-suite-tournament-d8471680.js +0 -558
|
@@ -1,141 +1,81 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { TRANSLATIONS, Tab
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { addSeconds, formatDate, getDifference, getProgress } from "../../utils/util.date";
|
|
10
|
-
import { leaderboardsAdapter, tournamentAdapter } from "../../utils/api.apdater";
|
|
2
|
+
import { h, Host } from "@stencil/core";
|
|
3
|
+
import { TRANSLATIONS, Tab } from "../../utils/translations";
|
|
4
|
+
import { getNewItems } from "../../utils/utils";
|
|
5
|
+
import { LeaderboardPage, DialogType } from "../../utils/types";
|
|
6
|
+
import { isTournamentClosed } from "../../utils/bussiness";
|
|
7
|
+
import { renders } from "../../shared/renders";
|
|
8
|
+
import { messageReceiver, messageSender } from "../../utils/message";
|
|
11
9
|
import "../../../../../../svelte/general-animation-loading/es2015/general-animation-loading";
|
|
12
10
|
import "../../../../../general-styling-wrapper/dist/types/index";
|
|
13
11
|
import "../../../../../casino-engagement-suite-progress-bar/dist/types/index";
|
|
14
12
|
export class CasinoEngagementSuiteTournament {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
this.isActionJoinPending = false;
|
|
56
|
-
this.isDialogOpen = false;
|
|
57
|
-
this.isShowInfo = false;
|
|
58
|
-
this.page = LeaderboardPage.List;
|
|
59
|
-
this.tournamentInDialog = undefined;
|
|
60
|
-
this.dialog = {
|
|
61
|
-
isOpen: false,
|
|
62
|
-
type: undefined,
|
|
63
|
-
data: undefined,
|
|
64
|
-
};
|
|
65
|
-
this.time = 0;
|
|
13
|
+
handleEvent(e) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const _c = e.data, { type } = _c, rest = __rest(_c, ["type"]);
|
|
16
|
+
(_b = (_a = messageReceiver(this)) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b.call(null, rest);
|
|
17
|
+
}
|
|
18
|
+
checkNewIdList() {
|
|
19
|
+
if (this.newIdList.length > 0) {
|
|
20
|
+
this.addLabel('new');
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
this.removeLabel('new');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
syncBarState(newTournamentList, oldTournamentList) {
|
|
27
|
+
if (!oldTournamentList) {
|
|
28
|
+
// init
|
|
29
|
+
this.checkNewIdList();
|
|
30
|
+
if (this.gifts.length) {
|
|
31
|
+
this.addLabel('win');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const items = getNewItems(newTournamentList, oldTournamentList, (newItem, oldItem) => newItem.id === oldItem.id);
|
|
36
|
+
this.newIdList = [...this.newIdList, ...items.map((item) => item.id)];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
showPropWatcher(newValue, oldValue) {
|
|
40
|
+
if (oldValue == false && newValue == true) {
|
|
41
|
+
this.checkGift();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
addLabel(tag) {
|
|
45
|
+
if (!this.labels.includes(tag)) {
|
|
46
|
+
this.labels.push(tag);
|
|
47
|
+
}
|
|
48
|
+
messageSender.UpdateSuiteBarState(this.labels);
|
|
49
|
+
}
|
|
50
|
+
removeLabel(tag) {
|
|
51
|
+
this.labels = this.labels.filter((label) => label != tag);
|
|
52
|
+
messageSender.UpdateSuiteBarState(this.labels);
|
|
66
53
|
}
|
|
67
54
|
setTimeInterval() {
|
|
68
55
|
this.timeHolder = setInterval(() => {
|
|
69
|
-
|
|
70
|
-
this.time += 1;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.time = 0;
|
|
74
|
-
}
|
|
56
|
+
this.time = (this.tournamentList || this.tournamentItem) ? this.time + 1 : 0;
|
|
75
57
|
}, 1000);
|
|
76
58
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
handleEvent(e) {
|
|
88
|
-
const _a = e.data, { type } = _a, rest = __rest(_a, ["type"]);
|
|
89
|
-
switch (type) {
|
|
90
|
-
case 'ShowLeaderboardRewardModal': {
|
|
91
|
-
const { tournament } = rest;
|
|
92
|
-
this.setPage(LeaderboardPage.Confirm, { tournament: tournamentAdapter(tournament) });
|
|
93
|
-
postMessage({ type: 'BarLeaderboardsClick' });
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
case 'UpdateTournamentsItemRes': {
|
|
97
|
-
const tournamentNew = tournamentAdapter(rest.data.item);
|
|
98
|
-
this.tournamentItem = tournamentNew;
|
|
99
|
-
this.updateTournamentListByItem(tournamentNew);
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
case 'UpdateLeaderboardsRes': {
|
|
103
|
-
this.leaderboards = leaderboardsAdapter(rest.data);
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case 'JoinTournamentRes':
|
|
107
|
-
case 'UnjoinTournamentRes':
|
|
108
|
-
const { success } = rest;
|
|
109
|
-
if (success) {
|
|
110
|
-
this.tournamentItem = Object.assign(Object.assign({}, this.tournamentItem), { playerEnrolled: !!!this.tournamentItem.playerEnrolled });
|
|
111
|
-
switch (this.page) {
|
|
112
|
-
case LeaderboardPage.Item: {
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case LeaderboardPage.List: {
|
|
116
|
-
this.updateTournamentListByItem(this.tournamentItem);
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
59
|
+
checkGift() {
|
|
60
|
+
//check gift
|
|
61
|
+
if (this.gifts.length) {
|
|
62
|
+
const onClose = () => {
|
|
63
|
+
if (this.dialog.type === DialogType.gift) {
|
|
64
|
+
this.gifts = this.gifts.slice(1);
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
this.checkGift();
|
|
67
|
+
}, 300);
|
|
120
68
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
break;
|
|
69
|
+
};
|
|
70
|
+
this.openDialog(DialogType.gift, this.gifts[0], onClose);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.removeLabel('win');
|
|
127
74
|
}
|
|
128
|
-
}
|
|
129
|
-
get messageSender() {
|
|
130
|
-
return {
|
|
131
|
-
JoinTournamentReq: (tournament) => { var _a; return window.postMessage({ type: 'JoinTournamentReq', bonusCode: (_a = tournament.wallets[0]) === null || _a === void 0 ? void 0 : _a.code }); },
|
|
132
|
-
UnjoinTournamentReq: (tournament) => window.postMessage({ type: 'UnjoinTournamentReq', id: tournament.id }),
|
|
133
|
-
UpdateTournamentsItemReq: (tournament) => window.postMessage({ type: 'UpdateTournamentsItemReq', id: tournament.id }),
|
|
134
|
-
UpdateLeaderboardsReq: (tournament) => window.postMessage({ type: 'UpdateLeaderboardsReq', id: tournament.id }),
|
|
135
|
-
};
|
|
136
75
|
}
|
|
137
76
|
connectedCallback() {
|
|
138
77
|
this.setTimeInterval();
|
|
78
|
+
messageSender.UpdateLeaderboardsPlayerReq();
|
|
139
79
|
}
|
|
140
80
|
disconnectedCallback() {
|
|
141
81
|
clearInterval(this.timeHolder);
|
|
@@ -146,10 +86,10 @@ export class CasinoEngagementSuiteTournament {
|
|
|
146
86
|
this.isActionJoinPending = true;
|
|
147
87
|
try {
|
|
148
88
|
if (tournament.playerEnrolled) {
|
|
149
|
-
|
|
89
|
+
messageSender.UnjoinTournamentReq(tournament);
|
|
150
90
|
}
|
|
151
91
|
else {
|
|
152
|
-
|
|
92
|
+
messageSender.JoinTournamentReq(tournament);
|
|
153
93
|
}
|
|
154
94
|
}
|
|
155
95
|
catch (e) {
|
|
@@ -157,204 +97,70 @@ export class CasinoEngagementSuiteTournament {
|
|
|
157
97
|
return;
|
|
158
98
|
}
|
|
159
99
|
}
|
|
160
|
-
isTournamentClosed(tournament) {
|
|
161
|
-
return [
|
|
162
|
-
TournamentState.Closed,
|
|
163
|
-
TournamentState.Closing
|
|
164
|
-
].includes(tournament.state);
|
|
165
|
-
}
|
|
166
100
|
setPage(page, metaData) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.messageSender.UpdateLeaderboardsReq(this.tournamentItem);
|
|
176
|
-
}
|
|
177
|
-
break;
|
|
178
|
-
case LeaderboardPage.List:
|
|
179
|
-
break;
|
|
101
|
+
if (page == LeaderboardPage.item) {
|
|
102
|
+
this.tournamentItem = metaData.tournament;
|
|
103
|
+
if (!this.tournamentItem) {
|
|
104
|
+
messageSender.UpdateTournamentsItemReq(metaData.tournament);
|
|
105
|
+
}
|
|
106
|
+
if (isTournamentClosed(this.tournamentItem)) {
|
|
107
|
+
messageSender.UpdateLeaderboardsReq(this.tournamentItem);
|
|
108
|
+
}
|
|
180
109
|
}
|
|
181
|
-
this.tab = Tab.
|
|
110
|
+
this.tab = Tab.info;
|
|
182
111
|
this.page = page;
|
|
183
112
|
}
|
|
184
|
-
renderPage() {
|
|
185
|
-
switch (this.page) {
|
|
186
|
-
case LeaderboardPage.Confirm: return this.renderPageConfirm();
|
|
187
|
-
case LeaderboardPage.Item: return this.renderPageLeaderboardItem();
|
|
188
|
-
case LeaderboardPage.List: return this.renderPageLeaderboardList();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
113
|
render() {
|
|
192
|
-
return (h(Host, { key: '
|
|
114
|
+
return (h(Host, { key: 'f9e9ea96e0fddd20d3f12141c7cf66588ab94ccd' }, h("general-styling-wrapper", { key: 'aea948ea6c8f8cc5e4aaea5812873d3fe7045568', clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling,
|
|
193
115
|
// @ts-ignore
|
|
194
|
-
targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }), this.
|
|
195
|
-
}
|
|
196
|
-
onClickListItemChangePage(tournament) {
|
|
197
|
-
this.setPage(LeaderboardPage.Item, { tournament });
|
|
198
|
-
}
|
|
199
|
-
onClickItemJoin(tournament, e) {
|
|
200
|
-
e.stopPropagation();
|
|
201
|
-
if (tournament.playerEnrolled) {
|
|
202
|
-
this.openDialog(DialogType.Unjoin, tournament);
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
this.actionJoin(tournament);
|
|
206
|
-
this.tournamentItem = tournament;
|
|
207
|
-
}
|
|
116
|
+
targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }), this.renders.page[this.page]()));
|
|
208
117
|
}
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
this.leaderboards = undefined;
|
|
214
|
-
this.messageSender.UpdateLeaderboardsReq(this.tournamentItem);
|
|
215
|
-
break;
|
|
216
|
-
case Tab.Games:
|
|
217
|
-
this.messageSender.UpdateTournamentsItemReq(this.tournamentItem);
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
118
|
+
openDialog(type, data = undefined, onClose = undefined) {
|
|
119
|
+
this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: true, onClose,
|
|
120
|
+
type,
|
|
121
|
+
data });
|
|
220
122
|
}
|
|
221
|
-
|
|
222
|
-
var _a;
|
|
223
|
-
if (!this.tournamentList) {
|
|
224
|
-
this.tournamentList = (_a = this.leaderboardsInit) === null || _a === void 0 ? void 0 : _a.map(item => tournamentAdapter(item));
|
|
225
|
-
return h("general-animation-loading", null);
|
|
226
|
-
}
|
|
227
|
-
const { locale } = this;
|
|
228
|
-
if (this.tournamentList.length) {
|
|
229
|
-
return this.renderLeaderboardContainer(h(Fragment, null, h("div", { class: "Leaderboards Row" }, this.tournamentList.map(_tournament => (h("div", { class: classnames("LeaderboardsItem", _tournament.playerEnrolled ? ' GradientRounded Hollow' : ''), onClick: this.onClickListItemChangePage.bind(this, _tournament) }, h("div", { class: "LeaderboardsItemContainer" }, this.renderTitleContainer(_tournament), this.renderTimeBar(_tournament))))))));
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
return (h("div", { class: "NoLeaderboards Row" }, h("div", null, locale.NoLeaderboards), h("div", null, locale.NoLeaderboardsTip)));
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
renderPageConfirm() {
|
|
236
|
-
if (!this.tournamentItem)
|
|
237
|
-
return h("general-animation-loading", null);
|
|
238
|
-
const tournamentName = this.tournamentItem.nameOrTitle;
|
|
239
|
-
const { locale } = this;
|
|
240
|
-
return (h("div", { class: "PageConfirmContainer" }, h("div", { class: "GradientRounded Hollow PageConfirm" }, h("div", null, iconTrophy), h("div", { class: "Title" }, locale.JoinDialog.Tile), h("div", { class: "Description", innerHTML: localePostprocess(locale.JoinDialog.Description, { tournamentName }) }), h("div", { class: "PageConfirmButtonsGroup" }, h(GradientRoundedButton, { statedClasses: {
|
|
241
|
-
isPending: this.isActionJoinPending,
|
|
242
|
-
},
|
|
243
|
-
onClick: this.onClickConfirmJoin,
|
|
244
|
-
innerHTML: locale.JoinDialog.ButtonYes }), h(GradientRoundedButton, { statedClasses: {
|
|
245
|
-
isPending: this.isActionJoinPending,
|
|
246
|
-
isHollow: true,
|
|
247
|
-
},
|
|
248
|
-
onClick: this.onClickConfirmUnjoin,
|
|
249
|
-
innerHTML: locale.JoinDialog.ButtonNo })))));
|
|
250
|
-
}
|
|
251
|
-
renderPageLeaderboardItem() {
|
|
252
|
-
if (!this.tournamentItem)
|
|
253
|
-
return h("general-animation-loading", null);
|
|
254
|
-
return this.renderLeaderboardContainer(h(Fragment, null, this.renderTitleContainer(this.tournamentItem), this.renderTabs(), this.renderTabbedContent()));
|
|
255
|
-
}
|
|
256
|
-
renderDialogContent() {
|
|
257
|
-
switch (this.dialog.type) {
|
|
258
|
-
case DialogType.Unjoin:
|
|
259
|
-
return this.renderDialogContentUnjoin();
|
|
260
|
-
case DialogType.Tip:
|
|
261
|
-
return (h("div", { class: "Tip" }, this.locale.Tip));
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
renderDialogContentUnjoin() {
|
|
265
|
-
const { locale } = this;
|
|
266
|
-
return (h("div", { class: "DialogContentUnjoin" }, h("div", { class: "DialogContentUnjoinTitle" }, locale.UnjoinDialog.Title), h("div", { class: "DialogContentUnjoinDescription", innerHTML: locale.UnjoinDialog.Description }), h(GradientRoundedButton, { statedClasses: {
|
|
267
|
-
isPending: this.isActionJoinPending,
|
|
268
|
-
},
|
|
269
|
-
onClick: this.onClickDialogUnjoin,
|
|
270
|
-
innerHTML: locale.UnjoinDialog.ButtonYes }), h(GradientRoundedButton, { statedClasses: {
|
|
271
|
-
isHollow: true,
|
|
272
|
-
isPending: this.isActionJoinPending,
|
|
273
|
-
},
|
|
274
|
-
onClick: this.onClickDialogJoin,
|
|
275
|
-
innerHTML: locale.UnjoinDialog.ButtonNo })));
|
|
276
|
-
}
|
|
277
|
-
renderTitleContainer(tournament) {
|
|
278
|
-
const { locale } = this;
|
|
279
|
-
return (h("div", { class: "TitleContainer" }, h("div", { class: "Title" }, tournament.nameOrTitle), tournament.state !== TournamentState.Closed && (h("div", null, h(GradientRoundedButton, { statedClasses: {
|
|
280
|
-
isHollow: tournament.playerEnrolled,
|
|
281
|
-
isPending: this.isActionJoinPending,
|
|
282
|
-
},
|
|
283
|
-
onClick: this.onClickItemJoin.bind(this, tournament),
|
|
284
|
-
innerHTML: tournament.playerEnrolled ? locale.Unjoin : locale.Join })))));
|
|
285
|
-
}
|
|
286
|
-
renderTabbedContent() {
|
|
287
|
-
switch (this.tab) {
|
|
288
|
-
case Tab.Info: return this.renderInfo();
|
|
289
|
-
case Tab.Leaderboard: return this.renderLeaderboard();
|
|
290
|
-
case Tab.Games: return this.renderGames();
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
renderGames() {
|
|
123
|
+
closeDialog() {
|
|
294
124
|
var _a;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
renderLeaderboard() {
|
|
298
|
-
if (!this.leaderboards)
|
|
299
|
-
return h("general-animation-loading", null);
|
|
300
|
-
if (!this.leaderboards.length)
|
|
301
|
-
return '';
|
|
302
|
-
return (h("table", { class: "Leaderboards" }, this.leaderboards.map(leaderboard => (h("tr", { class: classnames({ isMe: leaderboard.isMe }) }, h("td", { class: "LeaderboardRank" }, h("span", null, leaderboard.rank)), h("td", { class: "LeaderboardName" }, leaderboard.shortName), h("td", { class: "LeaderboardScore" }, leaderboard.score), h("td", { class: "LeaderboardPrize" }, leaderboard.prizeName))))));
|
|
125
|
+
(_a = this.dialog.onClose) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
126
|
+
this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: false, onClose: undefined });
|
|
303
127
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
128
|
+
constructor() {
|
|
129
|
+
this.gifts = [];
|
|
130
|
+
this.labels = [];
|
|
131
|
+
this.language = 'en';
|
|
132
|
+
this.show = false;
|
|
133
|
+
this.clientStyling = '';
|
|
134
|
+
this.clientStylingUrl = '';
|
|
135
|
+
this.translationUrl = '';
|
|
136
|
+
this.device = 'Mobile';
|
|
137
|
+
this.leaderboardsInit = undefined;
|
|
138
|
+
this.tab = Tab.info;
|
|
139
|
+
this.locale = TRANSLATIONS;
|
|
140
|
+
this.tournamentItem = undefined;
|
|
141
|
+
this.tournamentList = undefined;
|
|
142
|
+
this.leaderboards = [];
|
|
143
|
+
this.isActionJoinPending = false;
|
|
144
|
+
this.isDialogOpen = false;
|
|
145
|
+
this.isShowInfo = false;
|
|
146
|
+
this.page = LeaderboardPage.list;
|
|
147
|
+
this.tournamentInDialog = undefined;
|
|
148
|
+
this.dialog = {
|
|
149
|
+
isOpen: false,
|
|
150
|
+
type: undefined,
|
|
151
|
+
data: undefined,
|
|
152
|
+
onClose: undefined
|
|
324
153
|
};
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const { dialog: { isOpen } } = this;
|
|
336
|
-
return (h("div", { class: "Wrapper" }, h("div", { class: classnames("WrapperContent", { faded: isOpen }) }, this.renderCloseBarInLayout(), h("div", { class: "Root" }, h("div", { class: "Main" }, render))), h("div", { class: "WrapperUtil" }, h("dialog", { open: isOpen }, h("div", null, this.renderCloseBarInLayoutDialog(), isOpen && this.renderDialogContent())))));
|
|
337
|
-
}
|
|
338
|
-
getWrapperBarData() {
|
|
339
|
-
const { page, locale } = this;
|
|
340
|
-
switch (page) {
|
|
341
|
-
case LeaderboardPage.List:
|
|
342
|
-
return {
|
|
343
|
-
left: h("span", { onClick: this.onClickBarTip }, iconQuestion),
|
|
344
|
-
middle: locale.Leaderboards
|
|
345
|
-
};
|
|
346
|
-
case LeaderboardPage.Item:
|
|
347
|
-
return {
|
|
348
|
-
left: (h("span", { onClick: this.onClickBarBack }, iconBack)),
|
|
349
|
-
middle: '',
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
openDialog(type, data = undefined) {
|
|
354
|
-
this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: true, type, data });
|
|
355
|
-
}
|
|
356
|
-
closeDialog() {
|
|
357
|
-
this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: false });
|
|
154
|
+
this.time = 0;
|
|
155
|
+
this.newIdList = [];
|
|
156
|
+
// bind all renders
|
|
157
|
+
this.renders = {};
|
|
158
|
+
Object.keys(renders).forEach((key) => {
|
|
159
|
+
this.renders[key] = {};
|
|
160
|
+
Object.keys(renders[key]).forEach((subKey) => {
|
|
161
|
+
this.renders[key][subKey] = renders[key][subKey].bind(this, this);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
358
164
|
}
|
|
359
165
|
static get is() { return "casino-engagement-suite-tournament"; }
|
|
360
166
|
static get encapsulation() { return "shadow"; }
|
|
@@ -388,6 +194,24 @@ export class CasinoEngagementSuiteTournament {
|
|
|
388
194
|
"reflect": false,
|
|
389
195
|
"defaultValue": "'en'"
|
|
390
196
|
},
|
|
197
|
+
"show": {
|
|
198
|
+
"type": "boolean",
|
|
199
|
+
"mutable": false,
|
|
200
|
+
"complexType": {
|
|
201
|
+
"original": "boolean",
|
|
202
|
+
"resolved": "boolean",
|
|
203
|
+
"references": {}
|
|
204
|
+
},
|
|
205
|
+
"required": false,
|
|
206
|
+
"optional": false,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": "if widget is showing"
|
|
210
|
+
},
|
|
211
|
+
"attribute": "show",
|
|
212
|
+
"reflect": false,
|
|
213
|
+
"defaultValue": "false"
|
|
214
|
+
},
|
|
391
215
|
"clientStyling": {
|
|
392
216
|
"type": "string",
|
|
393
217
|
"mutable": false,
|
|
@@ -442,6 +266,24 @@ export class CasinoEngagementSuiteTournament {
|
|
|
442
266
|
"reflect": true,
|
|
443
267
|
"defaultValue": "''"
|
|
444
268
|
},
|
|
269
|
+
"device": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"mutable": false,
|
|
272
|
+
"complexType": {
|
|
273
|
+
"original": "\"Mobile\" | \"Tablet\" | \"Desktop\"",
|
|
274
|
+
"resolved": "\"Desktop\" | \"Mobile\" | \"Tablet\"",
|
|
275
|
+
"references": {}
|
|
276
|
+
},
|
|
277
|
+
"required": false,
|
|
278
|
+
"optional": false,
|
|
279
|
+
"docs": {
|
|
280
|
+
"tags": [],
|
|
281
|
+
"text": "User's device type"
|
|
282
|
+
},
|
|
283
|
+
"attribute": "device",
|
|
284
|
+
"reflect": false,
|
|
285
|
+
"defaultValue": "'Mobile' as 'Mobile' | 'Tablet' | 'Desktop'"
|
|
286
|
+
},
|
|
445
287
|
"leaderboardsInit": {
|
|
446
288
|
"type": "unknown",
|
|
447
289
|
"mutable": false,
|
|
@@ -478,7 +320,8 @@ export class CasinoEngagementSuiteTournament {
|
|
|
478
320
|
"page": {},
|
|
479
321
|
"tournamentInDialog": {},
|
|
480
322
|
"dialog": {},
|
|
481
|
-
"time": {}
|
|
323
|
+
"time": {},
|
|
324
|
+
"newIdList": {}
|
|
482
325
|
};
|
|
483
326
|
}
|
|
484
327
|
static get events() {
|
|
@@ -499,6 +342,18 @@ export class CasinoEngagementSuiteTournament {
|
|
|
499
342
|
}
|
|
500
343
|
}];
|
|
501
344
|
}
|
|
345
|
+
static get watchers() {
|
|
346
|
+
return [{
|
|
347
|
+
"propName": "newIdList",
|
|
348
|
+
"methodName": "checkNewIdList"
|
|
349
|
+
}, {
|
|
350
|
+
"propName": "tournamentList",
|
|
351
|
+
"methodName": "syncBarState"
|
|
352
|
+
}, {
|
|
353
|
+
"propName": "show",
|
|
354
|
+
"methodName": "showPropWatcher"
|
|
355
|
+
}];
|
|
356
|
+
}
|
|
502
357
|
static get listeners() {
|
|
503
358
|
return [{
|
|
504
359
|
"name": "message",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { h } from "@stencil/core";
|
|
3
3
|
import { classnames } from "../utils/utils";
|
|
4
|
-
export const
|
|
4
|
+
export const renderGradientRoundedButton = (_a) => {
|
|
5
5
|
var { statedClasses, innerHTML } = _a, props = __rest(_a, ["statedClasses", "innerHTML"]);
|
|
6
6
|
const { isHollow, isPending } = statedClasses;
|
|
7
7
|
return (h("button", Object.assign({ class: classnames('GradientRoundedButton', 'GradientRounded', {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { iconTrophy } from "./icons";
|
|
3
|
+
import { localePostprocess } from "../utils/translations";
|
|
4
|
+
import { renderGradientRoundedButton } from "./GradientRoundedButton";
|
|
5
|
+
var GradientButton;
|
|
6
|
+
(function (GradientButton) {
|
|
7
|
+
GradientButton["normal"] = "normal";
|
|
8
|
+
GradientButton["unjoinYes"] = "unjoinYes";
|
|
9
|
+
GradientButton["unjoinNo"] = "unjoinNo";
|
|
10
|
+
})(GradientButton || (GradientButton = {}));
|
|
11
|
+
const renderButton = (instance, buttonType) => {
|
|
12
|
+
const { locale } = instance;
|
|
13
|
+
const buttonCollector = {
|
|
14
|
+
normal: {
|
|
15
|
+
innerHTML: locale.WinDialog.ButtonContinue
|
|
16
|
+
},
|
|
17
|
+
unjoinYes: {
|
|
18
|
+
onClick: () => instance.actionJoin(instance.dialog.data),
|
|
19
|
+
innerHTML: locale.UnjoinDialog.ButtonYes
|
|
20
|
+
},
|
|
21
|
+
unjoinNo: {
|
|
22
|
+
statedClasses: {
|
|
23
|
+
isHollow: true,
|
|
24
|
+
},
|
|
25
|
+
innerHTML: locale.UnjoinDialog.ButtonNo,
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const props = buttonCollector[buttonType];
|
|
29
|
+
return renderGradientRoundedButton({
|
|
30
|
+
statedClasses: Object.assign({ isPending: instance.isActionJoinPending }, props.statedClasses),
|
|
31
|
+
onClick: () => {
|
|
32
|
+
var _a;
|
|
33
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call();
|
|
34
|
+
instance.closeDialog();
|
|
35
|
+
},
|
|
36
|
+
innerHTML: props.innerHTML,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export const dialog = {
|
|
40
|
+
gift(instance) {
|
|
41
|
+
const { name: tournamentName } = instance.gifts[0];
|
|
42
|
+
const { locale } = instance;
|
|
43
|
+
return (h("div", { class: "PageConfirmContainer" }, h("div", { class: "PageConfirm" }, h("div", null, iconTrophy), h("div", { class: "Title" }, locale.WinDialog.Tile), h("div", { class: "Description", innerHTML: localePostprocess(locale.WinDialog.Description, { tournamentName }) }), h("div", { class: "PageConfirmButtonsGroup" }, renderButton(instance, GradientButton.normal)))));
|
|
44
|
+
},
|
|
45
|
+
unjoin(instance) {
|
|
46
|
+
const { locale } = instance;
|
|
47
|
+
return (h("div", { class: "DialogContentUnjoin" }, h("div", { class: "DialogContentUnjoinTitle" }, locale.UnjoinDialog.Title), h("div", { class: "DialogContentUnjoinDescription", innerHTML: locale.UnjoinDialog.Description }), renderButton(instance, GradientButton.unjoinYes), renderButton(instance, GradientButton.unjoinNo)));
|
|
48
|
+
}
|
|
49
|
+
};
|