@everymatrix/casino-engagement-suite-tournament 1.46.0 → 1.47.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.
- 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/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.d.ts +2 -0
- package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.dev.d.ts +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
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.d.ts +0 -2
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.dev.d.ts +0 -2
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
import { h, H as Host, r as registerInstance, c as createEvent } from './index-224e880a.js';
|
|
2
|
+
|
|
3
|
+
/******************************************************************************
|
|
4
|
+
Copyright (c) Microsoft Corporation.
|
|
5
|
+
|
|
6
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
+
purpose with or without fee is hereby granted.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
|
|
18
|
+
function __rest(s, e) {
|
|
19
|
+
var t = {};
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
21
|
+
t[p] = s[p];
|
|
22
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
23
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
24
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
25
|
+
t[p[i]] = s[p[i]];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
31
|
+
var e = new Error(message);
|
|
32
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var Tab;
|
|
36
|
+
(function (Tab) {
|
|
37
|
+
Tab["info"] = "info";
|
|
38
|
+
Tab["leaderboard"] = "leaderboard";
|
|
39
|
+
Tab["games"] = "games";
|
|
40
|
+
})(Tab || (Tab = {}));
|
|
41
|
+
var Time;
|
|
42
|
+
(function (Time) {
|
|
43
|
+
Time["Starts"] = "Starts";
|
|
44
|
+
Time["Ends"] = "Ends";
|
|
45
|
+
})(Time || (Time = {}));
|
|
46
|
+
const localePostprocess = (translationText, props) => {
|
|
47
|
+
Object.keys(props).map((key) => {
|
|
48
|
+
translationText = translationText.replace(`{${key}}`, props[key]);
|
|
49
|
+
});
|
|
50
|
+
return translationText;
|
|
51
|
+
};
|
|
52
|
+
const TRANSLATIONS = Object.assign(Object.assign(Object.assign({ Join: 'Join', Unjoin: 'Unjoin' }, Tab), Time), { TC: 'Terms & Conditions', ScoreCriteria: 'Score Criteria', MinimumBetCriteria: 'Minimum bet criteria', Place: 'place', Prizes: 'Rewards', LeaderboardDetails: 'Leaderboard Details', UnjoinDialog: {
|
|
53
|
+
Title: 'Quit Leaderboard?',
|
|
54
|
+
Description: 'Any progress on the current Leaderboard won’t be kept and you can not rejoin the Leaderboard any more. <br /><br />Would you still like to quit?',
|
|
55
|
+
ButtonYes: 'Yes, I want to quit leaderboard',
|
|
56
|
+
ButtonNo: 'No, Stay on the leaderboard'
|
|
57
|
+
}, WinDialog: {
|
|
58
|
+
Tile: 'Congratulations!',
|
|
59
|
+
Description: 'You won <span>{tournamentName}</span>!',
|
|
60
|
+
ButtonContinue: 'Continue'
|
|
61
|
+
}, NoLeaderboards: 'No Leaderboards yet', NoLeaderboardsTip: 'Try winning tickets to Leaderboards as rewards or launching other booster games', Leaderboards: 'Leaderboards', TipPrize: 'You took <span>{place}</span> place and win <span>{prize}</span>', Tip: 'Competition where your real money bets contribute towards the leaderboard score calculation to win the leaderboard reward.' });
|
|
62
|
+
|
|
63
|
+
const classnames = (...args) => {
|
|
64
|
+
let classnameArray = [];
|
|
65
|
+
args.map((arg) => {
|
|
66
|
+
switch (typeof arg) {
|
|
67
|
+
case 'string':
|
|
68
|
+
classnameArray.push(arg);
|
|
69
|
+
break;
|
|
70
|
+
case 'object':
|
|
71
|
+
Object.keys(arg).map((k) => {
|
|
72
|
+
if (arg[k]) {
|
|
73
|
+
classnameArray.push(k);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return classnameArray.join(' ');
|
|
80
|
+
};
|
|
81
|
+
const getNewItems = (newList, oldList, getCondition) => {
|
|
82
|
+
const newItems = newList.filter((newItem) => !oldList.some((oldItem) => getCondition(newItem, oldItem)));
|
|
83
|
+
return newItems;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var LeaderboardPage;
|
|
87
|
+
(function (LeaderboardPage) {
|
|
88
|
+
LeaderboardPage["list"] = "list";
|
|
89
|
+
LeaderboardPage["item"] = "item";
|
|
90
|
+
})(LeaderboardPage || (LeaderboardPage = {}));
|
|
91
|
+
var TournamentState;
|
|
92
|
+
(function (TournamentState) {
|
|
93
|
+
TournamentState["Running"] = "Running";
|
|
94
|
+
TournamentState["Unstarted"] = "Unstarted";
|
|
95
|
+
TournamentState["Closed"] = "Closed";
|
|
96
|
+
TournamentState["Closing"] = "Closing";
|
|
97
|
+
})(TournamentState || (TournamentState = {}));
|
|
98
|
+
var DialogType;
|
|
99
|
+
(function (DialogType) {
|
|
100
|
+
DialogType["unjoin"] = "unjoin";
|
|
101
|
+
DialogType["tip"] = "tip";
|
|
102
|
+
DialogType["gift"] = "gift";
|
|
103
|
+
})(DialogType || (DialogType = {}));
|
|
104
|
+
|
|
105
|
+
const getMaxRankStr = (list) => {
|
|
106
|
+
let itemHaveMaxRank;
|
|
107
|
+
list.map((item) => {
|
|
108
|
+
var _a;
|
|
109
|
+
const rank = (_a = item.leaderBoard) === null || _a === void 0 ? void 0 : _a.rank;
|
|
110
|
+
if (!rank) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!itemHaveMaxRank) {
|
|
114
|
+
itemHaveMaxRank = item;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
if (rank < itemHaveMaxRank.leaderBoard.rank) {
|
|
119
|
+
itemHaveMaxRank = item;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
if (!itemHaveMaxRank) {
|
|
124
|
+
return '-';
|
|
125
|
+
}
|
|
126
|
+
const maxRankStr = `${itemHaveMaxRank.leaderBoard.rank} / ${itemHaveMaxRank.endRank}`;
|
|
127
|
+
return maxRankStr;
|
|
128
|
+
};
|
|
129
|
+
const isTournamentClosed = (tournament) => {
|
|
130
|
+
return [TournamentState.Closed, TournamentState.Closing].includes(tournament.state);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const iconClose = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg" });
|
|
134
|
+
const iconQuestion = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg" });
|
|
135
|
+
const iconEyeOpen = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-open.svg" });
|
|
136
|
+
const iconEyeClose = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-closed.svg" });
|
|
137
|
+
const iconBack = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/back.svg" });
|
|
138
|
+
const iconReward = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/reward.svg" });
|
|
139
|
+
const iconTrophy = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/cup-congras.svg" });
|
|
140
|
+
|
|
141
|
+
const renderGradientRoundedButton = (_a) => {
|
|
142
|
+
var { statedClasses, innerHTML } = _a, props = __rest(_a, ["statedClasses", "innerHTML"]);
|
|
143
|
+
const { isHollow, isPending } = statedClasses;
|
|
144
|
+
return (h("button", Object.assign({ class: classnames('GradientRoundedButton', 'GradientRounded', {
|
|
145
|
+
Hollow: isHollow || false,
|
|
146
|
+
Pending: isPending || false,
|
|
147
|
+
}) }, props),
|
|
148
|
+
h("span", null, innerHTML)));
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
var GradientButton;
|
|
152
|
+
(function (GradientButton) {
|
|
153
|
+
GradientButton["normal"] = "normal";
|
|
154
|
+
GradientButton["unjoinYes"] = "unjoinYes";
|
|
155
|
+
GradientButton["unjoinNo"] = "unjoinNo";
|
|
156
|
+
})(GradientButton || (GradientButton = {}));
|
|
157
|
+
const renderButton = (instance, buttonType) => {
|
|
158
|
+
const { locale } = instance;
|
|
159
|
+
const buttonCollector = {
|
|
160
|
+
normal: {
|
|
161
|
+
innerHTML: locale.WinDialog.ButtonContinue
|
|
162
|
+
},
|
|
163
|
+
unjoinYes: {
|
|
164
|
+
onClick: () => instance.actionJoin(instance.dialog.data),
|
|
165
|
+
innerHTML: locale.UnjoinDialog.ButtonYes
|
|
166
|
+
},
|
|
167
|
+
unjoinNo: {
|
|
168
|
+
statedClasses: {
|
|
169
|
+
isHollow: true,
|
|
170
|
+
},
|
|
171
|
+
innerHTML: locale.UnjoinDialog.ButtonNo,
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const props = buttonCollector[buttonType];
|
|
175
|
+
return renderGradientRoundedButton({
|
|
176
|
+
statedClasses: Object.assign({ isPending: instance.isActionJoinPending }, props.statedClasses),
|
|
177
|
+
onClick: () => {
|
|
178
|
+
var _a;
|
|
179
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call();
|
|
180
|
+
instance.closeDialog();
|
|
181
|
+
},
|
|
182
|
+
innerHTML: props.innerHTML,
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
const dialog = {
|
|
186
|
+
gift(instance) {
|
|
187
|
+
const { name: tournamentName } = instance.gifts[0];
|
|
188
|
+
const { locale } = instance;
|
|
189
|
+
return (h("div", { class: "PageConfirmContainer" },
|
|
190
|
+
h("div", { class: "PageConfirm" },
|
|
191
|
+
h("div", null, iconTrophy),
|
|
192
|
+
h("div", { class: "Title" }, locale.WinDialog.Tile),
|
|
193
|
+
h("div", { class: "Description", innerHTML: localePostprocess(locale.WinDialog.Description, { tournamentName }) }),
|
|
194
|
+
h("div", { class: "PageConfirmButtonsGroup" }, renderButton(instance, GradientButton.normal)))));
|
|
195
|
+
},
|
|
196
|
+
unjoin(instance) {
|
|
197
|
+
const { locale } = instance;
|
|
198
|
+
return (h("div", { class: "DialogContentUnjoin" },
|
|
199
|
+
h("div", { class: "DialogContentUnjoinTitle" }, locale.UnjoinDialog.Title),
|
|
200
|
+
h("div", { class: "DialogContentUnjoinDescription", innerHTML: locale.UnjoinDialog.Description }),
|
|
201
|
+
renderButton(instance, GradientButton.unjoinYes),
|
|
202
|
+
renderButton(instance, GradientButton.unjoinNo)));
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const tournamentAdapter = (tournamentApi) => {
|
|
207
|
+
const keysTime = [
|
|
208
|
+
'startTime',
|
|
209
|
+
'endTime',
|
|
210
|
+
'closeTime',
|
|
211
|
+
'exhibitionStartTime',
|
|
212
|
+
'exhibitionEndTime'
|
|
213
|
+
];
|
|
214
|
+
const tournament = {};
|
|
215
|
+
Object.keys(tournamentApi).map((key) => {
|
|
216
|
+
const value = tournamentApi[key];
|
|
217
|
+
switch (key) {
|
|
218
|
+
case 'games':
|
|
219
|
+
tournament[key] = value.items;
|
|
220
|
+
break;
|
|
221
|
+
default:
|
|
222
|
+
tournament[key] = keysTime.includes(key) ? new Date(value) : value;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return tournament;
|
|
226
|
+
};
|
|
227
|
+
const leaderboardsAdapter = (leaderboardRes) => {
|
|
228
|
+
let { item, items: leaderboards } = leaderboardRes;
|
|
229
|
+
if (!item) {
|
|
230
|
+
return leaderboards;
|
|
231
|
+
}
|
|
232
|
+
return leaderboards.map((leaderboard) => {
|
|
233
|
+
if (item && item.userID === leaderboard.userID) {
|
|
234
|
+
return Object.assign(Object.assign({}, leaderboard), { isMe: true });
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
return leaderboard;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const renderCloseBar = (attr) => {
|
|
243
|
+
const { left, middle, right } = attr;
|
|
244
|
+
const slots = {
|
|
245
|
+
left,
|
|
246
|
+
middle,
|
|
247
|
+
right,
|
|
248
|
+
};
|
|
249
|
+
const getFirstLetterUppercase = (str) => str
|
|
250
|
+
.split('')
|
|
251
|
+
.map((letter, index) => index === 0 ? letter.toUpperCase() : letter)
|
|
252
|
+
.join('');
|
|
253
|
+
return (h("div", { class: "WrapperBar" }, Object.keys(slots).map(slotKey => (h("div", { class: "WrapperBar" + getFirstLetterUppercase(slotKey) }, slots[slotKey] || '')))));
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
function formatDate(date) {
|
|
257
|
+
const options = {
|
|
258
|
+
year: 'numeric',
|
|
259
|
+
month: 'long',
|
|
260
|
+
day: 'numeric',
|
|
261
|
+
hour: '2-digit',
|
|
262
|
+
minute: '2-digit',
|
|
263
|
+
hour12: false
|
|
264
|
+
};
|
|
265
|
+
return date.toLocaleDateString('en-US', options).replace(' at', ',');
|
|
266
|
+
}
|
|
267
|
+
function addSeconds(date, seconds) {
|
|
268
|
+
const result = new Date(date);
|
|
269
|
+
result.setSeconds(result.getSeconds() + seconds);
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
function getDifference(startDate, endDate) {
|
|
273
|
+
const diffMs = Math.abs(endDate.getTime() - startDate.getTime()); // Difference in milliseconds
|
|
274
|
+
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); // Difference in days
|
|
275
|
+
const diffHours = Math.floor((diffMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); // Remaining hours
|
|
276
|
+
const diffMinutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60)); // Remaining minutes
|
|
277
|
+
// Format the output
|
|
278
|
+
const formattedDiff = `${String(diffDays).padStart(2, '0')}d:${String(diffHours).padStart(2, '0')}h:${String(diffMinutes).padStart(2, '0')}m`;
|
|
279
|
+
return formattedDiff;
|
|
280
|
+
}
|
|
281
|
+
function getProgress(startDate, endDate) {
|
|
282
|
+
return ((100 * (new Date().getTime() - startDate.getTime())) / (endDate.getTime() - startDate.getTime())).toFixed(0);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const renderTimeBar = (instance, tournament) => {
|
|
286
|
+
return (h("section", { class: "TimeContainer" },
|
|
287
|
+
h("div", { class: 'Time' }, tournament.playerEnrolled ? ([
|
|
288
|
+
h("div", null, getDifference(addSeconds(tournament.startTime, instance.time), tournament.endTime)),
|
|
289
|
+
h("div", null, renderGradientRoundedButton({
|
|
290
|
+
statedClasses: {
|
|
291
|
+
isHollow: true,
|
|
292
|
+
isPendding: false,
|
|
293
|
+
},
|
|
294
|
+
innerHTML: `${getProgress(tournament.startTime, tournament.endTime)}%`
|
|
295
|
+
}))
|
|
296
|
+
]) : ([
|
|
297
|
+
h("div", null, formatDate(tournament.startTime)),
|
|
298
|
+
h("div", null, formatDate(tournament.endTime))
|
|
299
|
+
])),
|
|
300
|
+
h("casino-engagement-suite-progress-bar", { value: Number(getProgress(tournament.startTime, tournament.endTime)), "hide-percent": true })));
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const messageSender = {
|
|
304
|
+
UpdateSuiteBarState: (labels) => window.postMessage({ type: 'UpdateLeaderboardState', labels }),
|
|
305
|
+
JoinTournamentReq: (tournament) => { var _a, _b; return window.postMessage({ type: 'JoinTournamentReq', bonusCode: (_b = (_a = tournament.wallets) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.code }); },
|
|
306
|
+
UnjoinTournamentReq: (tournament) => window.postMessage({ type: 'UnjoinTournamentReq', id: tournament.id }),
|
|
307
|
+
UpdateTournamentsItemReq: (tournament) => window.postMessage({ type: 'UpdateTournamentsItemReq', id: tournament.id }),
|
|
308
|
+
UpdateLeaderboardsReq: (tournament, query) => window.postMessage({ type: 'UpdateLeaderboardsReq', id: tournament.id, query }),
|
|
309
|
+
UpdateLeaderboardsPlayerReq: () => window.postMessage({ type: 'UpdateLeaderboardsPlayerReq' })
|
|
310
|
+
};
|
|
311
|
+
const messageReceiver = (instance) => {
|
|
312
|
+
const receiver = {
|
|
313
|
+
UpdateLeaderboardsPlayerRes: (rest) => {
|
|
314
|
+
const rankStr = getMaxRankStr(rest.data.items);
|
|
315
|
+
window.postMessage({ type: 'UpdateLeaderboardState', rank: rankStr });
|
|
316
|
+
},
|
|
317
|
+
UpdateLeaderboardStateReq: () => {
|
|
318
|
+
window.postMessage({ type: 'UpdateLeaderboardState', labels: ['win', 'new'] });
|
|
319
|
+
},
|
|
320
|
+
UpdateTournamentsItemRes: (rest) => {
|
|
321
|
+
const tournamentNew = tournamentAdapter(rest.data.item);
|
|
322
|
+
instance.tournamentItem = tournamentNew;
|
|
323
|
+
updateTournamentListByItem(instance, tournamentNew);
|
|
324
|
+
},
|
|
325
|
+
UpdateLeaderboardsRes: (rest) => {
|
|
326
|
+
instance.leaderboards = leaderboardsAdapter(rest.data);
|
|
327
|
+
},
|
|
328
|
+
JoinTournamentRes: (rest) => commonJoinRes(instance, rest),
|
|
329
|
+
UnjoinTournamentRes: (rest) => commonJoinRes(instance, rest)
|
|
330
|
+
};
|
|
331
|
+
return receiver;
|
|
332
|
+
};
|
|
333
|
+
const commonJoinRes = (instance, rest) => {
|
|
334
|
+
const { success } = rest;
|
|
335
|
+
if (success) {
|
|
336
|
+
instance.tournamentItem = Object.assign(Object.assign({}, instance.tournamentItem), { playerEnrolled: !!!instance.tournamentItem.playerEnrolled });
|
|
337
|
+
switch (instance.page) {
|
|
338
|
+
case LeaderboardPage.item: {
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
case LeaderboardPage.list: {
|
|
342
|
+
updateTournamentListByItem(instance, instance.tournamentItem);
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (instance.nextPage) {
|
|
348
|
+
instance.setPage(instance.nextPage);
|
|
349
|
+
instance.nextPage = undefined;
|
|
350
|
+
}
|
|
351
|
+
instance.isActionJoinPending = false;
|
|
352
|
+
};
|
|
353
|
+
const updateTournamentListByItem = (instance, tournament) => {
|
|
354
|
+
instance.tournamentList = instance.tournamentList.map((_tournament) => {
|
|
355
|
+
if (_tournament.id === tournament.id) {
|
|
356
|
+
return tournamentAdapter(tournament);
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
return _tournament;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
const page = {
|
|
365
|
+
list(instance) {
|
|
366
|
+
var _a;
|
|
367
|
+
if (!instance.tournamentList) {
|
|
368
|
+
instance.tournamentList = (_a = instance.leaderboardsInit) === null || _a === void 0 ? void 0 : _a.map(item => tournamentAdapter(item));
|
|
369
|
+
return h("general-animation-loading", null);
|
|
370
|
+
}
|
|
371
|
+
const { locale } = instance;
|
|
372
|
+
if (instance.tournamentList.length) {
|
|
373
|
+
const onClickListItemChangePage = (tournament) => {
|
|
374
|
+
instance.setPage(LeaderboardPage.item, { tournament });
|
|
375
|
+
instance.newIdList = instance.newIdList.filter(id => id !== tournament.id);
|
|
376
|
+
};
|
|
377
|
+
return renderLeaderboardContainer(instance, h("div", { class: "Leaderboards Row" }, instance.tournamentList.map(_tournament => (h("div", { class: classnames("LeaderboardsItem", _tournament.playerEnrolled ? ' GradientRounded Hollow' : ''), onClick: () => onClickListItemChangePage(_tournament) },
|
|
378
|
+
h("div", { class: "LeaderboardsItemContainer" },
|
|
379
|
+
renderTitleContainer(instance, _tournament),
|
|
380
|
+
renderTimeBar(instance, _tournament)),
|
|
381
|
+
h("div", { class: "LeaderboardLabels" }, instance.newIdList.includes(_tournament.id) && (h("div", { class: "LeaderboardLabel" },
|
|
382
|
+
h("span", null, "new")))))))));
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
return renderLeaderboardContainer(instance, h("div", { class: "NoLeaderboards Row" },
|
|
386
|
+
h("div", null, locale.NoLeaderboards),
|
|
387
|
+
h("div", null, locale.NoLeaderboardsTip)));
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
item(instance) {
|
|
391
|
+
if (!instance.tournamentItem)
|
|
392
|
+
return h("general-animation-loading", null);
|
|
393
|
+
const renderTabs = () => {
|
|
394
|
+
const { locale, tab } = instance;
|
|
395
|
+
const onClickTab = (tab) => {
|
|
396
|
+
instance.tab = tab;
|
|
397
|
+
switch (tab) {
|
|
398
|
+
case Tab.leaderboard:
|
|
399
|
+
instance.leaderboards = undefined;
|
|
400
|
+
messageSender.UpdateLeaderboardsReq(instance.tournamentItem);
|
|
401
|
+
break;
|
|
402
|
+
case Tab.games:
|
|
403
|
+
messageSender.UpdateTournamentsItemReq(instance.tournamentItem);
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
return (h("div", { class: "TabsContainer" },
|
|
408
|
+
h("div", { class: "Tabs" }, Object.keys(Tab).map((_tab) => (h("div", { class: classnames({ active: tab === _tab }),
|
|
409
|
+
onClick: () => onClickTab(_tab) }, locale[_tab]))))));
|
|
410
|
+
};
|
|
411
|
+
return renderLeaderboardContainer(instance, [
|
|
412
|
+
renderTitleContainer(instance, instance.tournamentItem),
|
|
413
|
+
renderTabs(),
|
|
414
|
+
instance.renders.tab[instance.tab]()
|
|
415
|
+
]);
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
const renderTitleContainer = (instance, tournament) => {
|
|
419
|
+
const { locale } = instance;
|
|
420
|
+
const onClickItemJoin = (tournament) => {
|
|
421
|
+
if (tournament.playerEnrolled) {
|
|
422
|
+
instance.openDialog(DialogType.unjoin, tournament);
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
instance.actionJoin(tournament);
|
|
426
|
+
instance.tournamentItem = tournament;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
return (h("div", { class: "TitleContainer" },
|
|
430
|
+
h("div", { class: "Title" }, tournament.nameOrTitle),
|
|
431
|
+
tournament.state !== TournamentState.Closed && (h("div", null, renderGradientRoundedButton({
|
|
432
|
+
statedClasses: {
|
|
433
|
+
isHollow: tournament.playerEnrolled,
|
|
434
|
+
isPending: instance.isActionJoinPending,
|
|
435
|
+
},
|
|
436
|
+
onClick: (e) => {
|
|
437
|
+
e.stopPropagation();
|
|
438
|
+
onClickItemJoin(tournament);
|
|
439
|
+
},
|
|
440
|
+
innerHTML: tournament.playerEnrolled ? locale.Unjoin : locale.Join,
|
|
441
|
+
})))));
|
|
442
|
+
};
|
|
443
|
+
const renderLeaderboardContainer = (instance, render) => {
|
|
444
|
+
const { dialog: { isOpen } } = instance;
|
|
445
|
+
const renderBar = renderCloseBar({
|
|
446
|
+
right: (h("span", { onClick: () => instance.closeDialog() }, iconClose))
|
|
447
|
+
});
|
|
448
|
+
const renderDialogContent = () => {
|
|
449
|
+
switch (instance.dialog.type) {
|
|
450
|
+
case DialogType.unjoin:
|
|
451
|
+
return instance.renders.dialog.unjoin(); //renderDialogContentUnjoin()
|
|
452
|
+
case DialogType.tip:
|
|
453
|
+
return (h("div", { class: "Tip" }, instance.locale.Tip));
|
|
454
|
+
case DialogType.gift:
|
|
455
|
+
return instance.renders.dialog.gift();
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
const getWrapperBarData = () => {
|
|
459
|
+
const { page, locale } = instance;
|
|
460
|
+
switch (page) {
|
|
461
|
+
case LeaderboardPage.list:
|
|
462
|
+
return {
|
|
463
|
+
left: h("span", { onClick: () => instance.openDialog(DialogType.tip) }, iconQuestion),
|
|
464
|
+
middle: locale.Leaderboards
|
|
465
|
+
};
|
|
466
|
+
case LeaderboardPage.item:
|
|
467
|
+
return {
|
|
468
|
+
left: (h("span", { onClick: () => instance.setPage(LeaderboardPage.list) }, iconBack)),
|
|
469
|
+
middle: '',
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
const renderCloseBarInLayout = () => {
|
|
474
|
+
const { left, middle } = getWrapperBarData();
|
|
475
|
+
return renderCloseBar({ left, middle,
|
|
476
|
+
right: (h("span", { onClick: () => instance.close.emit() }, iconClose))
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
return (h("div", { class: `Wrapper ${instance.device}` },
|
|
480
|
+
h("div", { class: classnames("WrapperContent", { faded: isOpen }) },
|
|
481
|
+
renderCloseBarInLayout(),
|
|
482
|
+
h("div", { class: "Root" },
|
|
483
|
+
h("div", { class: "Main" }, render))),
|
|
484
|
+
h("div", { class: "WrapperUtil" },
|
|
485
|
+
h("dialog", { open: isOpen },
|
|
486
|
+
h("div", { class: "GradientRounded Hollow" },
|
|
487
|
+
renderBar,
|
|
488
|
+
isOpen && renderDialogContent())))));
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
const tab = {
|
|
492
|
+
info(instance) {
|
|
493
|
+
var _a, _b;
|
|
494
|
+
const { locale, tournamentItem: tournament, isShowInfo } = instance;
|
|
495
|
+
return (h("div", { class: "InfoContainer" },
|
|
496
|
+
renderTimeBar(instance, tournament),
|
|
497
|
+
(h("section", { class: "ShowInfo", onClick: () => instance.isShowInfo = !instance.isShowInfo },
|
|
498
|
+
h("p", null,
|
|
499
|
+
h("span", null, isShowInfo ? iconEyeClose : iconEyeOpen),
|
|
500
|
+
h("span", null, locale.LeaderboardDetails)))),
|
|
501
|
+
isShowInfo && (h("section", { class: "Info" },
|
|
502
|
+
h("div", null, tournament.description),
|
|
503
|
+
h("div", { class: "Criterias" },
|
|
504
|
+
h("div", null,
|
|
505
|
+
locale.ScoreCriteria,
|
|
506
|
+
": ",
|
|
507
|
+
h("span", null, tournament.scoreCriteria)),
|
|
508
|
+
h("div", null,
|
|
509
|
+
locale.MinimumBetCriteria,
|
|
510
|
+
": ",
|
|
511
|
+
h("span", null, tournament.minBetCount))),
|
|
512
|
+
h("div", { class: "TC" },
|
|
513
|
+
h("a", { href: tournament.termsUrl, target: '_blank' }, locale.TC)))),
|
|
514
|
+
isTournamentClosed(instance.tournamentItem) && ((_a = instance.leaderboards) === null || _a === void 0 ? void 0 : _a.find(l => l.isMe)) && (h("section", { class: "ResultPrize", innerHTML: localePostprocess(locale.TipPrize, getResultPrize((_b = instance.leaderboards) === null || _b === void 0 ? void 0 : _b.find(l => l.isMe))) })),
|
|
515
|
+
h("section", { class: "Prizes" },
|
|
516
|
+
h("div", { class: "PrizesHeader" },
|
|
517
|
+
iconReward,
|
|
518
|
+
h("span", { class: "PrizesText" }, locale.Prizes)),
|
|
519
|
+
tournament.prizes.map((prize, index) => (h("div", { class: "Prize" },
|
|
520
|
+
index + 1,
|
|
521
|
+
" ",
|
|
522
|
+
locale.Place,
|
|
523
|
+
": ",
|
|
524
|
+
h("span", { class: "PrizeText" }, prize.name)))))));
|
|
525
|
+
},
|
|
526
|
+
leaderboard(instance) {
|
|
527
|
+
if (!instance.leaderboards)
|
|
528
|
+
return h("general-animation-loading", null);
|
|
529
|
+
if (!instance.leaderboards.length)
|
|
530
|
+
return '';
|
|
531
|
+
return (h("table", { class: "Leaderboards" }, instance.leaderboards.map(leaderboard => (h("tr", { class: classnames({ isMe: leaderboard.isMe }) },
|
|
532
|
+
h("td", { class: "LeaderboardRank" },
|
|
533
|
+
h("span", null, leaderboard.rank)),
|
|
534
|
+
h("td", { class: "LeaderboardName" }, leaderboard.shortName),
|
|
535
|
+
h("td", { class: "LeaderboardScore" }, leaderboard.score),
|
|
536
|
+
h("td", { class: "LeaderboardPrize" }, leaderboard.prizeName))))));
|
|
537
|
+
},
|
|
538
|
+
games(instance) {
|
|
539
|
+
var _a;
|
|
540
|
+
return (h("div", { class: "Games" }, (_a = instance.tournamentItem.games) === null || _a === void 0 ? void 0 : _a.map(game => (h("div", null,
|
|
541
|
+
h("img", { src: game.defaultThumbnail, alt: "" }))))));
|
|
542
|
+
},
|
|
543
|
+
};
|
|
544
|
+
const getResultPrize = (leaderboard) => {
|
|
545
|
+
return {
|
|
546
|
+
prize: leaderboard.prizeName,
|
|
547
|
+
place: leaderboard.rank,
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
const renders = {
|
|
552
|
+
dialog,
|
|
553
|
+
page,
|
|
554
|
+
tab
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
var GeneralAnimationLoadingCczQRHih = {};
|
|
558
|
+
|
|
559
|
+
(function (exports) {
|
|
560
|
+
var V=Object.defineProperty,z=Object.defineProperties;var F=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var x=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t)=>{for(var n in t||(t={}))G.call(t,n)&&x(e,n,t[n]);if(N)for(var n of N(t))q.call(t,n)&&x(e,n,t[n]);return e},M=(e,t)=>z(e,F(t));var $=(e,t,n)=>x(e,typeof t!="symbol"?t+"":t,n);var T=(e,t,n)=>new Promise((s,l)=>{var i=o=>{try{u(n.next(o));}catch(r){l(r);}},c=o=>{try{u(n.throw(o));}catch(r){l(r);}},u=o=>o.done?s(o.value):Promise.resolve(o.value).then(i,c);u((n=n.apply(e,t)).next());});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function _(){}function H(e){return e()}function B(){return Object.create(null)}function b(e){e.forEach(H);}function I(e){return typeof e=="function"}function K(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Q(e){return Object.keys(e).length===0}function W(e,t){e.appendChild(t);}function X(e,t,n){const s=Y(e);if(!s.getElementById(t)){const l=L("style");l.id=t,l.textContent=n,Z(s,l);}}function Y(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function Z(e,t){return W(e.head||e,t),t.sheet}function U(e,t,n){e.insertBefore(t,n||null);}function C(e){e.parentNode&&e.parentNode.removeChild(e);}function L(e){return document.createElement(e)}function tt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n);}function et(e){return Array.from(e.childNodes)}function nt(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0;}),t}let j;function g(e){j=e;}const h=[],k=[];let p=[];const R=[],it=Promise.resolve();let v=!1;function st(){v||(v=!0,it.then(y));}function E(e){p.push(e);}const w=new Set;let a=0;function y(){if(a!==0)return;const e=j;do{try{for(;a<h.length;){const t=h[a];a++,g(t),rt(t.$$);}}catch(t){throw h.length=0,a=0,t}for(g(null),h.length=0,a=0;k.length;)k.pop()();for(let t=0;t<p.length;t+=1){const n=p[t];w.has(n)||(w.add(n),n());}p.length=0;}while(h.length);for(;R.length;)R.pop()();v=!1,w.clear(),g(e);}function rt(e){if(e.fragment!==null){e.update(),b(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(E);}}function lt(e){const t=[],n=[];p.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),p=t;}const ct=new Set;function ot(e,t){e&&e.i&&(ct.delete(e),e.i(t));}function ut(e,t,n){const{fragment:s,after_update:l}=e.$$;s&&s.m(t,n),E(()=>{const i=e.$$.on_mount.map(H).filter(I);e.$$.on_destroy?e.$$.on_destroy.push(...i):b(i),e.$$.on_mount=[];}),l.forEach(E);}function dt(e,t){const n=e.$$;n.fragment!==null&&(lt(n.after_update),b(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[]);}function $t(e,t){e.$$.dirty[0]===-1&&(h.push(e),st(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31;}function ft(e,t,n,s,l,i,c=null,u=[-1]){const o=j;g(e);const r=e.$$={fragment:null,ctx:[],props:i,update:_,not_equal:l,bound:B(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(o?o.$$.context:[])),callbacks:B(),dirty:u,skip_bound:!1,root:t.target||o.$$.root};c&&c(r.root);let f=!1;if(r.ctx=n?n(e,t.props||{},(d,O,...S)=>{const A=S.length?S[0]:O;return r.ctx&&l(r.ctx[d],r.ctx[d]=A)&&(!r.skip_bound&&r.bound[d]&&r.bound[d](A),f&&$t(e,d)),O}):[],r.update(),f=!0,b(r.before_update),r.fragment=s?s(r.ctx):!1,t.target){if(t.hydrate){const d=et(t.target);r.fragment&&r.fragment.l(d),d.forEach(C);}else r.fragment&&r.fragment.c();t.intro&&ot(e.$$.fragment),ut(e,t.target,t.anchor),y();}g(o);}let D;typeof HTMLElement=="function"&&(D=class extends HTMLElement{constructor(t,n,s){super();$(this,"$$ctor");$(this,"$$s");$(this,"$$c");$(this,"$$cn",!1);$(this,"$$d",{});$(this,"$$r",!1);$(this,"$$p_d",{});$(this,"$$l",{});$(this,"$$l_u",new Map);this.$$ctor=t,this.$$s=n,s&&this.attachShadow({mode:"open"});}addEventListener(t,n,s){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(n),this.$$c){const l=this.$$c.$on(t,n);this.$$l_u.set(n,l);}super.addEventListener(t,n,s);}removeEventListener(t,n,s){if(super.removeEventListener(t,n,s),this.$$c){const l=this.$$l_u.get(n);l&&(l(),this.$$l_u.delete(n));}}connectedCallback(){return T(this,null,function*(){if(this.$$cn=!0,!this.$$c){let t=function(i){return ()=>{let c;return {c:function(){c=L("slot"),i!=="default"&&tt(c,"name",i);},m:function(r,f){U(r,c,f);},d:function(r){r&&C(c);}}}};if(yield Promise.resolve(),!this.$$cn||this.$$c)return;const n={},s=nt(this);for(const i of this.$$s)i in s&&(n[i]=[t(i)]);for(const i of this.attributes){const c=this.$$g_p(i.name);c in this.$$d||(this.$$d[c]=m(c,i.value,this.$$p_d,"toProp"));}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:M(P({},this.$$d),{$$slots:n,$$scope:{ctx:[]}})});const l=()=>{this.$$r=!0;for(const i in this.$$p_d)if(this.$$d[i]=this.$$c.$$.ctx[this.$$c.$$.props[i]],this.$$p_d[i].reflect){const c=m(i,this.$$d[i],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,c);}this.$$r=!1;};this.$$c.$$.after_update.push(l),l();for(const i in this.$$l)for(const c of this.$$l[i]){const u=this.$$c.$on(i,c);this.$$l_u.set(c,u);}this.$$l={};}})}attributeChangedCallback(t,n,s){var l;this.$$r||(t=this.$$g_p(t),this.$$d[t]=m(t,s,this.$$p_d,"toProp"),(l=this.$$c)==null||l.$set({[t]:this.$$d[t]}));}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0);});}$$g_p(t){return Object.keys(this.$$p_d).find(n=>this.$$p_d[n].attribute===t||!this.$$p_d[n].attribute&&n.toLowerCase()===t)||t}});function m(e,t,n,s){var i;const l=(i=n[e])==null?void 0:i.type;if(t=l==="Boolean"&&typeof t!="boolean"?t!=null:t,!s||!n[e])return t;if(s==="toAttribute")switch(l){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t==null?null:t;default:return t}else switch(l){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function at(e,t,n,s,l,i){let c=class extends D{constructor(){super(e,n,l),this.$$p_d=t;}static get observedAttributes(){return Object.keys(t).map(u=>(t[u].attribute||u).toLowerCase())}};return Object.keys(t).forEach(u=>{Object.defineProperty(c.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(o){var r;o=m(u,o,t),this.$$d[u]=o,(r=this.$$c)==null||r.$set({[u]:o});}});}),s.forEach(u=>{Object.defineProperty(c.prototype,u,{get(){var o;return (o=this.$$c)==null?void 0:o[u]}});}),e.element=c,c}class ht{constructor(){$(this,"$$");$(this,"$$set");}$destroy(){dt(this,1),this.$destroy=_;}$on(t,n){if(!I(n))return _;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const l=s.indexOf(n);l!==-1&&s.splice(l,1);}}$set(t){this.$$set&&!Q(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1);}}const _t="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(_t);function pt(e){X(e,"svelte-gnt082",".LoaderContainer{display:flex;justify-content:center}.lds-ellipsis{display:inline-block;position:relative;width:80px;height:80px}.lds-ellipsis div{position:absolute;top:33px;width:13px;height:13px;border-radius:50%;background:#d1d1d1;animation-timing-function:cubic-bezier(0, 1, 1, 0)}.lds-ellipsis div:nth-child(1){left:8px;animation:lds-ellipsis1 0.6s infinite}.lds-ellipsis div:nth-child(2){left:8px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(3){left:32px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(4){left:56px;animation:lds-ellipsis3 0.6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}");}function gt(e){let t;return {c(){t=L("div"),t.innerHTML='<section class="LoaderContainer" part="LoaderContainer"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></section>';},m(n,s){U(n,t,s),e[3](t);},p:_,i:_,o:_,d(n){n&&C(t),e[3](null);}}}function mt(e,t,n){let{clientstyling:s=""}=t,{clientstylingurl:l=""}=t,i;const c=()=>{let r=document.createElement("style");r.innerHTML=s,i.appendChild(r);},u=()=>{let r=new URL(l),f=document.createElement("style");fetch(r.href).then(d=>d.text()).then(d=>{f.innerHTML=d,setTimeout(()=>{i.appendChild(f);},1),setTimeout(()=>{},500);});};function o(r){k[r?"unshift":"push"](()=>{i=r,n(0,i);});}return e.$$set=r=>{"clientstyling"in r&&n(1,s=r.clientstyling),"clientstylingurl"in r&&n(2,l=r.clientstylingurl);},e.$$.update=()=>{e.$$.dirty&3&&s&&i&&c(),e.$$.dirty&5&&l&&i&&u();},[i,s,l,o]}class J extends ht{constructor(t){super(),ft(this,t,mt,gt,K,{clientstyling:1,clientstylingurl:2},pt);}get clientstyling(){return this.$$.ctx[1]}set clientstyling(t){this.$$set({clientstyling:t}),y();}get clientstylingurl(){return this.$$.ctx[2]}set clientstylingurl(t){this.$$set({clientstylingurl:t}),y();}}at(J,{clientstyling:{},clientstylingurl:{}},[],[],!0);exports.default=J;
|
|
561
|
+
}(GeneralAnimationLoadingCczQRHih));
|
|
562
|
+
|
|
563
|
+
if(typeof window!="undefined"){let n=function(t){return function(...i){try{return t.apply(this,i)}catch(e){if(e instanceof DOMException&&e.message.includes("has already been used with this registry")||e.message.includes("Cannot define multiple custom elements with the same tag name"))return !1;throw e}}};customElements.define=n(customElements.define),Promise.resolve().then(()=>GeneralAnimationLoadingCczQRHih).then(({default:t})=>{!customElements.get("general-animation-loading")&&customElements.define("general-animation-loading",t.element);});}
|
|
564
|
+
|
|
565
|
+
const casinoEngagementSuiteTournamentCss = ".Wrapper{height:100%;position:relative;color:var(--emw--color-typography, #FFFFFF);display:flex;background-color:var(--emw--color-background, hsl(254, 44%, 15%));flex-direction:column;border-radius:24px;overflow-y:auto}.Wrapper.Mobile{border-radius:16px}.WrapperContent{padding-bottom:20px;transition:0.5s filter}.WrapperContent.faded{filter:brightness(53.3333333333%)}.Wrapper.Mobile .WrapperBar{padding:20px 8px 8px}.WrapperBar{display:flex;width:100%;padding:32px 20px 20px}.WrapperBarLeft,.WrapperBarRight{cursor:pointer;z-index:1}.WrapperBarMiddle{flex-grow:1;text-align:center;font-size:var(--emw--font-size-medium, 16px);line-height:16px;font-weight:500;color:var(--emw--color-secondary, rgb(187, 185, 195))}:host{display:block;font-size:var(--emw--font-size-x-small, 12px);font-family:Inter}.Row{margin:24px 0;padding:0 20px}.Row:first-child{margin:0}.LeaderboardsItem{position:relative;margin:10px 0;border:1px solid rgb(64, 57, 86);border-radius:16px}.LeaderboardsItem.Hollow{border-color:transparent}.LeaderboardsItem:first-child{margin-top:0}.LeaderboardsItemContainer{padding-top:16px}.Info{margin:24px 0;padding:0 20px}.TimeContainer{margin:24px 0;padding:0 20px}.TimeContainer .Time{display:flex;justify-content:space-between;font-size:var(--emw--font-size-x-small, 12px);align-items:center;color:var(--emw--color-secondary, rgb(187, 185, 195))}.TimeContainer .Time button{font-size:var(--emw--font-size-x-small, 12px);height:20px;padding:0}.TimeContainer .Time button::before{inset:inherit;border:0}.ShowInfo{margin:24px 0;padding:0 20px;cursor:pointer;color:rgb(102, 97, 120)}.ShowInfo p{display:flex;gap:4px}.TitleContainer{display:flex;justify-content:space-between;margin:24px 0;padding:0 20px;margin-top:0;gap:10px;font-family:Montserrat}.TitleContainer .GradientRoundedButton{width:120px}.TabsContainer{margin:24px 0;padding:0 20px;margin:0 20px;padding:0;border-bottom:1px solid #575757}.Tabs{display:flex;justify-content:space-between;justify-content:start;font-size:var(--emw--font-size-x-small, 12px);margin-bottom:-1px}.Tabs>div{padding:10px;color:rgb(102, 97, 120);cursor:pointer}.Tabs>div.active{color:var(--emw--color-typography, #FFF);border-bottom:2px solid var(--emw--color-typography, #FFF)}.Title{font-size:var(--emw--font-size-medium, 16px);font-weight:700;line-height:19.5px;text-align:left;word-break:break-word}.TC{margin-top:12px}.TC a{color:rgb(89, 209, 255)}.Criterias{margin:12px 0}.Criterias span{color:var(--emw--color-primary, rgb(255, 214, 47));font-weight:400}.ResultPrize{margin:24px 0;padding:0 20px}.ResultPrize span{color:var(--emw--color-primary, rgb(255, 214, 47));font-weight:400}.Prizes{margin:24px 0;padding:0 20px}.Prizes .PrizesText{margin-left:3px;font-weight:600}.Prizes .PrizesHeader{align-items:center;display:flex}.Prizes .PrizesHeader img{width:12px}.Prizes .Prize{margin:8px 0}.Prizes .Prize .PrizeText{color:var(--emw--color-primary, rgb(255, 214, 47));font-weight:400}*{box-sizing:border-box}.Leaderboards{width:100%;text-align:center;border-collapse:collapse}.Leaderboards td{opacity:0.6;padding:20px 5px}.Leaderboards td:first-child{padding-left:20px}.Leaderboards td:last-child{padding-right:20px}.Leaderboards .LeaderboardName{color:var(--emw--color-typography, #FFF);opacity:1}.Leaderboards tr.isMe{background:rgba(0, 0, 0, 0.2)}.Leaderboards tr.isMe .LeaderboardRank span{padding:0px 3px;opacity:1;border:1px solid var(--emw--color-primary, rgb(255, 214, 47));border-radius:11px}.Leaderboards tr.isMe td{color:var(--emw--color-primary, rgb(255, 214, 47))}.LeaderboardLabels{position:absolute;top:-6px;right:18px;display:flex;gap:4px}.LeaderboardLabel{width:30px;height:15px;background:var(--emw--engagement-suite-gradient-golden, linear-gradient(180deg, #FFB801 15.86%, #FEF746 31.36%, #FBFFE0 36.86%, #FFFA60 47.86%, #FF9400 87.36%));border-radius:var(--emw--border-radius-x-small, 2px);display:inline-flex;padding:0 2px;align-items:center;justify-content:center}.LeaderboardLabel span{display:inline-block;text-transform:uppercase;font-size:var(--emw--font-size-3x-small, 7px);line-height:7px;font-weight:var(--emw--font-weight-bold, 700);font-family:var(--emw--font-family-secondary, \"Montserrat\", sans-serif);color:var(--emw--color-background, #1E1638)}.Games{margin:24px 0;padding:0 20px;display:flex;flex-wrap:wrap;justify-content:space-evenly;gap:4px 7.25px}.Games img{width:60px}dialog{position:absolute;top:30px;width:100%;height:100%;background:transparent;border:0;padding:0;color:var(--emw--color-typography, #FFFFFF)}dialog>div{margin:32px;border-radius:8px;background:var(--emw--color-background, hsl(254, 44%, 15%));border:1px solid hsl(254, 20%, 28%);align-items:center}.DialogContentUnjoin{padding:32px;padding-top:10px;display:flex;gap:10px;flex-direction:column}.DialogContentUnjoinTitle{font-family:Montserrat;font-size:var(--emw--font-size-large, 20px);font-weight:600;line-height:24.38px;text-align:center}.DialogContentUnjoinDescription{color:var(--emw--color-secondary, rgb(187, 185, 195));margin-bottom:30px}.Tip{padding:32px;padding-top:10px;color:var(--emw--color-secondary, rgb(187, 185, 195));font-size:var(--emw--font-size-small, 14px)}.PageConfirmContainer{text-align:center;width:80%;margin:0 auto}.PageConfirm{padding:40px 32px;display:flex;flex-direction:column;gap:20px}.PageConfirm .Title{font-size:var(--emw--font-size-large, 20px);text-align:center}.PageConfirm .Description{color:var(--emw--color-secondary, rgb(187, 185, 195));font-weight:400}.PageConfirm .Description span{color:var(--emw--color-typography, #FFF);font-weight:600}.PageConfirmButtonsGroup{width:150px;margin:0 auto;display:flex;flex-direction:column;gap:10px}.GradientRounded{display:block;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:rgb(30, 22, 56);position:relative;border-radius:16px}.GradientRounded.Hollow{background:rgb(30, 22, 56);color:#FFFFFF}.GradientRounded.Hollow::before{content:\"\";position:absolute;inset:0;border-radius:15px;border:1px solid transparent;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%) border-box;-webkit-mask:linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);-webkit-mask-composite:destination-out;mask-composite:exclude}.GradientRoundedButton{border:none;padding:7px;height:32px;width:100%;font-size:var(--emw--font-size-small, 14px);font-weight:700;line-height:17.07px;text-align:center;transition:0.5s opacity;cursor:pointer}.GradientRoundedButton.Pending{cursor:not-allowed;opacity:0.3}.GradientRoundedButton.Hollow span{background:-webkit-linear-gradient(98.25deg, rgb(255, 148, 0) 22.48%, rgb(254, 247, 70) 131.02%, rgb(255, 226, 74) 131.9%);-webkit-background-clip:text;-webkit-text-fill-color:transparent}";
|
|
566
|
+
const CasinoEngagementSuiteTournamentStyle0 = casinoEngagementSuiteTournamentCss;
|
|
567
|
+
|
|
568
|
+
const CasinoEngagementSuiteTournament = class {
|
|
569
|
+
handleEvent(e) {
|
|
570
|
+
var _a, _b;
|
|
571
|
+
const _c = e.data, { type } = _c, rest = __rest(_c, ["type"]);
|
|
572
|
+
(_b = (_a = messageReceiver(this)) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b.call(null, rest);
|
|
573
|
+
}
|
|
574
|
+
checkNewIdList() {
|
|
575
|
+
if (this.newIdList.length > 0) {
|
|
576
|
+
this.addLabel('new');
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
this.removeLabel('new');
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
syncBarState(newTournamentList, oldTournamentList) {
|
|
583
|
+
if (!oldTournamentList) {
|
|
584
|
+
// init
|
|
585
|
+
this.checkNewIdList();
|
|
586
|
+
if (this.gifts.length) {
|
|
587
|
+
this.addLabel('win');
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
const items = getNewItems(newTournamentList, oldTournamentList, (newItem, oldItem) => newItem.id === oldItem.id);
|
|
592
|
+
this.newIdList = [...this.newIdList, ...items.map((item) => item.id)];
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
showPropWatcher(newValue, oldValue) {
|
|
596
|
+
if (oldValue == false && newValue == true) {
|
|
597
|
+
this.checkGift();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
addLabel(tag) {
|
|
601
|
+
if (!this.labels.includes(tag)) {
|
|
602
|
+
this.labels.push(tag);
|
|
603
|
+
}
|
|
604
|
+
messageSender.UpdateSuiteBarState(this.labels);
|
|
605
|
+
}
|
|
606
|
+
removeLabel(tag) {
|
|
607
|
+
this.labels = this.labels.filter((label) => label != tag);
|
|
608
|
+
messageSender.UpdateSuiteBarState(this.labels);
|
|
609
|
+
}
|
|
610
|
+
setTimeInterval() {
|
|
611
|
+
this.timeHolder = setInterval(() => {
|
|
612
|
+
this.time = (this.tournamentList || this.tournamentItem) ? this.time + 1 : 0;
|
|
613
|
+
}, 1000);
|
|
614
|
+
}
|
|
615
|
+
checkGift() {
|
|
616
|
+
//check gift
|
|
617
|
+
if (this.gifts.length) {
|
|
618
|
+
const onClose = () => {
|
|
619
|
+
if (this.dialog.type === DialogType.gift) {
|
|
620
|
+
this.gifts = this.gifts.slice(1);
|
|
621
|
+
setTimeout(() => {
|
|
622
|
+
this.checkGift();
|
|
623
|
+
}, 300);
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
this.openDialog(DialogType.gift, this.gifts[0], onClose);
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
this.removeLabel('win');
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
connectedCallback() {
|
|
633
|
+
this.setTimeInterval();
|
|
634
|
+
messageSender.UpdateLeaderboardsPlayerReq();
|
|
635
|
+
}
|
|
636
|
+
disconnectedCallback() {
|
|
637
|
+
clearInterval(this.timeHolder);
|
|
638
|
+
}
|
|
639
|
+
actionJoin(tournament) {
|
|
640
|
+
if (this.isActionJoinPending)
|
|
641
|
+
return;
|
|
642
|
+
this.isActionJoinPending = true;
|
|
643
|
+
try {
|
|
644
|
+
if (tournament.playerEnrolled) {
|
|
645
|
+
messageSender.UnjoinTournamentReq(tournament);
|
|
646
|
+
}
|
|
647
|
+
else {
|
|
648
|
+
messageSender.JoinTournamentReq(tournament);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
catch (e) {
|
|
652
|
+
console.log('error', e);
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
setPage(page, metaData) {
|
|
657
|
+
if (page == LeaderboardPage.item) {
|
|
658
|
+
this.tournamentItem = metaData.tournament;
|
|
659
|
+
if (!this.tournamentItem) {
|
|
660
|
+
messageSender.UpdateTournamentsItemReq(metaData.tournament);
|
|
661
|
+
}
|
|
662
|
+
if (isTournamentClosed(this.tournamentItem)) {
|
|
663
|
+
messageSender.UpdateLeaderboardsReq(this.tournamentItem);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
this.tab = Tab.info;
|
|
667
|
+
this.page = page;
|
|
668
|
+
}
|
|
669
|
+
render() {
|
|
670
|
+
return (h(Host, { key: 'f9e9ea96e0fddd20d3f12141c7cf66588ab94ccd' }, h("general-styling-wrapper", { key: 'aea948ea6c8f8cc5e4aaea5812873d3fe7045568', clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling,
|
|
671
|
+
// @ts-ignore
|
|
672
|
+
targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }), this.renders.page[this.page]()));
|
|
673
|
+
}
|
|
674
|
+
openDialog(type, data = undefined, onClose = undefined) {
|
|
675
|
+
this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: true, onClose,
|
|
676
|
+
type,
|
|
677
|
+
data });
|
|
678
|
+
}
|
|
679
|
+
closeDialog() {
|
|
680
|
+
var _a;
|
|
681
|
+
(_a = this.dialog.onClose) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
682
|
+
this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: false, onClose: undefined });
|
|
683
|
+
}
|
|
684
|
+
constructor(hostRef) {
|
|
685
|
+
registerInstance(this, hostRef);
|
|
686
|
+
this.close = createEvent(this, "close", 7);
|
|
687
|
+
this.gifts = [];
|
|
688
|
+
this.labels = [];
|
|
689
|
+
this.language = 'en';
|
|
690
|
+
this.show = false;
|
|
691
|
+
this.clientStyling = '';
|
|
692
|
+
this.clientStylingUrl = '';
|
|
693
|
+
this.translationUrl = '';
|
|
694
|
+
this.device = 'Mobile';
|
|
695
|
+
this.leaderboardsInit = undefined;
|
|
696
|
+
this.tab = Tab.info;
|
|
697
|
+
this.locale = TRANSLATIONS;
|
|
698
|
+
this.tournamentItem = undefined;
|
|
699
|
+
this.tournamentList = undefined;
|
|
700
|
+
this.leaderboards = [];
|
|
701
|
+
this.isActionJoinPending = false;
|
|
702
|
+
this.isDialogOpen = false;
|
|
703
|
+
this.isShowInfo = false;
|
|
704
|
+
this.page = LeaderboardPage.list;
|
|
705
|
+
this.tournamentInDialog = undefined;
|
|
706
|
+
this.dialog = {
|
|
707
|
+
isOpen: false,
|
|
708
|
+
type: undefined,
|
|
709
|
+
data: undefined,
|
|
710
|
+
onClose: undefined
|
|
711
|
+
};
|
|
712
|
+
this.time = 0;
|
|
713
|
+
this.newIdList = [];
|
|
714
|
+
// bind all renders
|
|
715
|
+
this.renders = {};
|
|
716
|
+
Object.keys(renders).forEach((key) => {
|
|
717
|
+
this.renders[key] = {};
|
|
718
|
+
Object.keys(renders[key]).forEach((subKey) => {
|
|
719
|
+
this.renders[key][subKey] = renders[key][subKey].bind(this, this);
|
|
720
|
+
});
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
static get watchers() { return {
|
|
724
|
+
"newIdList": ["checkNewIdList"],
|
|
725
|
+
"tournamentList": ["syncBarState"],
|
|
726
|
+
"show": ["showPropWatcher"]
|
|
727
|
+
}; }
|
|
728
|
+
};
|
|
729
|
+
CasinoEngagementSuiteTournament.style = CasinoEngagementSuiteTournamentStyle0;
|
|
730
|
+
|
|
731
|
+
export { CasinoEngagementSuiteTournament as C };
|