@everymatrix/casino-engagement-suite-tournament 1.63.0 → 1.63.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-d24f1017.entry.js +1 -0
- package/dist/casino-engagement-suite-tournament/p-f478f260.js +15 -0
- package/dist/cjs/casino-engagement-suite-progress-bar_6.cjs.entry.js +110 -112
- package/dist/cjs/{casino-engagement-suite-tournament-1f1275c4.js → casino-engagement-suite-tournament-785dd5cc.js} +31 -56
- package/dist/cjs/casino-engagement-suite-tournament.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.css +6 -1
- package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.js +26 -6
- package/dist/collection/shared/TournamentDurationTimer.js +45 -24
- package/dist/collection/shared/TournamentItem.js +10 -20
- package/dist/collection/shared/TournamentItemTitle.js +9 -7
- package/dist/collection/shared/renders.page.js +2 -2
- package/dist/collection/shared/renders.tab.js +1 -2
- package/dist/collection/utils/bussiness.js +6 -18
- package/dist/collection/utils/message.js +11 -7
- package/dist/esm/casino-engagement-suite-progress-bar_6.entry.js +109 -111
- package/dist/esm/{casino-engagement-suite-tournament-54c513f1.js → casino-engagement-suite-tournament-3be75bd2.js} +28 -54
- package/dist/esm/casino-engagement-suite-tournament.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.d.ts +1 -0
- package/dist/types/components.d.ts +45 -41
- package/dist/types/shared/TournamentDurationTimer.d.ts +3 -2
- package/dist/types/shared/TournamentItem.d.ts +1 -2
- package/dist/types/shared/TournamentItemTitle.d.ts +1 -1
- package/dist/types/utils/bussiness.d.ts +1 -1
- package/dist/types/utils/message.d.ts +1 -1
- package/package.json +1 -1
- package/dist/casino-engagement-suite-tournament/p-14ab3c1a.entry.js +0 -1
- package/dist/casino-engagement-suite-tournament/p-5f051654.js +0 -15
- package/dist/collection/shared/renders.util.js +0 -16
- package/dist/types/shared/renders.util.d.ts +0 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { DialogType
|
|
2
|
+
import { DialogType } from "../utils/types";
|
|
3
3
|
import { renderGradientRoundedButton } from "./GradientRoundedButton";
|
|
4
4
|
import { TRANSLATIONS } from "../utils/translations";
|
|
5
|
+
import { isTournamentClosed } from "../utils/bussiness";
|
|
5
6
|
export class CasinoEngagementSuiteTournamentItemTitle {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.tournament = undefined;
|
|
@@ -15,9 +16,10 @@ export class CasinoEngagementSuiteTournamentItemTitle {
|
|
|
15
16
|
if (this.isButtonDisabed) {
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
//only disable the button when click on the Join button which is not acknowledged by player
|
|
20
|
+
this.isButtonDisabed = this.tournament.isPlayerAcknowledged ? false : true;
|
|
19
21
|
if (this.tournament.isPlayerAcknowledged) {
|
|
20
|
-
this.
|
|
22
|
+
this.unjoinTournamentConfirmEvent.emit({ type: DialogType.unjoin, tournament: this.tournament });
|
|
21
23
|
}
|
|
22
24
|
else {
|
|
23
25
|
this.joinTournamentEvent.emit(this.tournament);
|
|
@@ -27,7 +29,7 @@ export class CasinoEngagementSuiteTournamentItemTitle {
|
|
|
27
29
|
this.isButtonDisabed = this.tournament.isActionJoinPending === true;
|
|
28
30
|
}
|
|
29
31
|
render() {
|
|
30
|
-
return (h("div", { key: '
|
|
32
|
+
return (h("div", { key: '0226e00da9805f16624a2d60edb020d047ea28ee', class: "TitleContainer" }, h("div", { key: 'e6d55949a27f2b90ca36af51dbe1c52ddd1d9cf9', class: "Title" }, this.tournament.nameOrTitle), !isTournamentClosed(this.tournament) && (h("div", { key: 'f3b030e17ad4f03e20485cb163952b6b1fb05881' }, renderGradientRoundedButton({
|
|
31
33
|
statedClasses: {
|
|
32
34
|
isHollow: this.tournament.isPlayerAcknowledged,
|
|
33
35
|
isPending: this.isButtonDisabed
|
|
@@ -39,7 +41,7 @@ export class CasinoEngagementSuiteTournamentItemTitle {
|
|
|
39
41
|
innerHTML: this.tournament.isPlayerAcknowledged ? this.locale.Unjoin : this.locale.Join
|
|
40
42
|
})))));
|
|
41
43
|
}
|
|
42
|
-
static get is() { return "
|
|
44
|
+
static get is() { return "tournament-item-title"; }
|
|
43
45
|
static get properties() {
|
|
44
46
|
return {
|
|
45
47
|
"tournament": {
|
|
@@ -74,8 +76,8 @@ export class CasinoEngagementSuiteTournamentItemTitle {
|
|
|
74
76
|
}
|
|
75
77
|
static get events() {
|
|
76
78
|
return [{
|
|
77
|
-
"method": "
|
|
78
|
-
"name": "
|
|
79
|
+
"method": "unjoinTournamentConfirmEvent",
|
|
80
|
+
"name": "unjoinTournamentConfirmEvent",
|
|
79
81
|
"bubbles": true,
|
|
80
82
|
"cancelable": true,
|
|
81
83
|
"composed": true,
|
|
@@ -12,7 +12,7 @@ export const page = {
|
|
|
12
12
|
}
|
|
13
13
|
const { locale } = instance;
|
|
14
14
|
if (instance.tournamentList.length) {
|
|
15
|
-
return renderWrapperByPageType(h("div", { class: "Leaderboards ScrollBar Row" }, instance.tournamentList.map((_tournament) => (h("
|
|
15
|
+
return renderWrapperByPageType(h("div", { class: "Leaderboards ScrollBar Row" }, instance.tournamentList.map((_tournament) => (h("tournament-item", { tournament: _tournament, isNew: instance.newIdList.includes(_tournament.id) })))));
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
18
|
return renderWrapperByPageType(h("div", { class: "NoLeaderboards ScrollBar Row" }, h("h3", { class: "Title" }, locale.NoLeaderboards), h("div", { class: "message" }, locale.NoLeaderboardsTip)));
|
|
@@ -39,7 +39,7 @@ export const page = {
|
|
|
39
39
|
onClick: () => onClickTab(_tab) }, locale[_tab]))))));
|
|
40
40
|
};
|
|
41
41
|
return renderWrapperByPageType([
|
|
42
|
-
h("
|
|
42
|
+
h("tournament-item-title", { tournament: instance.tournamentItem }),
|
|
43
43
|
renderTabs(),
|
|
44
44
|
h("div", { class: `TableContentWrapper ${instance.tab}` }, instance.renders.tab[instance.tab]())
|
|
45
45
|
]);
|
|
@@ -2,14 +2,13 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { localePostprocess } from "../utils/translations";
|
|
3
3
|
import { iconEyeClose, iconEyeOpen, iconReward } from "./icons";
|
|
4
4
|
import { classnames, truncateNumber } from "../utils/utils";
|
|
5
|
-
import { renderTimeBar } from "./renders.util";
|
|
6
5
|
import { isTournamentClosed } from "../utils/bussiness";
|
|
7
6
|
import { getTimeDifference } from "../utils/util.date";
|
|
8
7
|
export const tab = {
|
|
9
8
|
info(instance) {
|
|
10
9
|
var _a, _b;
|
|
11
10
|
const { locale, tournamentItem: tournament, isShowInfo } = instance;
|
|
12
|
-
return (h("div", { class: "InfoContainer" },
|
|
11
|
+
return (h("div", { class: "InfoContainer" }, h("tournament-timer", { "is-detail": true, tournament: tournament }), h("section", { class: "ShowInfo", onClick: () => (instance.isShowInfo = !instance.isShowInfo) }, h("div", { class: "DetailHeader" }, h("span", null, isShowInfo ? iconEyeOpen : iconEyeClose), h("span", null, locale.LeaderboardDetails))), h("div", { class: `ContentScrollContainer ${isShowInfo ? 'expanded' : ''}` }, isShowInfo && (h("section", { class: "Info" }, h("div", { class: "Description" }, tournament.description), h("div", { class: "Criterias" }, h("div", null, locale.ScoreCriteria, ": ", h("span", null, tournament.scoreCriteria)), h("div", null, locale.MinimumBetCriteria, ": ", h("span", null, tournament.minBetCount))), !!tournament.termsUrl && (h("div", { class: "TC" }, h("a", { href: tournament.termsUrl, target: "_blank" }, locale.TC))))), 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))) })), h("section", { class: "PrizesContainer" }, h("div", { class: "PrizesHeader" }, iconReward, h("span", { class: "PrizesText" }, locale.Prizes)), h("div", { class: "Prizes" }, tournament.prizes.map((prize, index) => (h("div", { class: "Prize" }, index + 1, " ", locale.Place, ": ", h("span", { class: "PrizeText" }, prize.name)))))))));
|
|
13
12
|
},
|
|
14
13
|
leaderboard(instance) {
|
|
15
14
|
const { locale, tournamentItem } = instance;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { TournamentState } from "./types";
|
|
2
|
-
export const getMaxRankStr = (
|
|
3
|
-
let
|
|
4
|
-
|
|
2
|
+
export const getMaxRankStr = (playerLeaderboards) => {
|
|
3
|
+
let bestRank = null;
|
|
4
|
+
(playerLeaderboards || []).map((playerLeaderboard) => {
|
|
5
5
|
var _a;
|
|
6
|
-
const
|
|
6
|
+
const { leaderBoard: { rank } } = playerLeaderboard;
|
|
7
7
|
if (!rank) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
itemHaveMaxRank = item;
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
if (rank < itemHaveMaxRank.leaderBoard.rank) {
|
|
16
|
-
itemHaveMaxRank = item;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
10
|
+
bestRank = !bestRank || ((_a = bestRank.leaderBoard) === null || _a === void 0 ? void 0 : _a.rank) > rank ? playerLeaderboard : bestRank;
|
|
19
11
|
});
|
|
20
|
-
|
|
21
|
-
return '-';
|
|
22
|
-
}
|
|
23
|
-
const maxRankStr = `${itemHaveMaxRank.leaderBoard.rank} / ${itemHaveMaxRank.endRank}`;
|
|
24
|
-
return maxRankStr;
|
|
12
|
+
return bestRank ? `${bestRank.leaderBoard.rank} / ${bestRank.endRank}` : '-';
|
|
25
13
|
};
|
|
26
14
|
export const isTournamentClosed = (tournament) => {
|
|
27
15
|
return [TournamentState.Closed, TournamentState.Closing].includes(tournament.state);
|
|
@@ -3,10 +3,11 @@ import { getMaxRankStr } from "./bussiness";
|
|
|
3
3
|
import { DialogType, LeaderboardPage } from "./types";
|
|
4
4
|
export const messageSender = {
|
|
5
5
|
UpdateSuiteBarState: (labels) => window.postMessage({ type: 'UpdateLeaderboardState', labels }),
|
|
6
|
-
JoinTournamentReq: (tournament) =>
|
|
7
|
-
|
|
8
|
-
id: tournament.id,
|
|
9
|
-
|
|
6
|
+
JoinTournamentReq: (tournament) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
return window.postMessage({ type: 'JoinTournamentReq', id: tournament.id,
|
|
9
|
+
bonusCode: tournament.id || ((_b = (_a = tournament.wallets) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.code) });
|
|
10
|
+
},
|
|
10
11
|
UnjoinTournamentReq: (tournament) => window.postMessage({ type: 'UnjoinTournamentReq', id: tournament.id }),
|
|
11
12
|
UpdateTournamentsItemReq: (tournament) => window.postMessage({ type: 'UpdateTournamentsItemReq', id: tournament.id }),
|
|
12
13
|
UpdateLeaderboardsReq: (tournament, query) => window.postMessage({ type: 'UpdateLeaderboardsReq', id: tournament.id, query }),
|
|
@@ -17,8 +18,7 @@ export const messageSender = {
|
|
|
17
18
|
export const messageReceiver = (instance) => {
|
|
18
19
|
const receiver = {
|
|
19
20
|
UpdateLeaderboardsPlayerRes: (rest) => {
|
|
20
|
-
|
|
21
|
-
window.postMessage({ type: 'UpdateLeaderboardState', rank: rankStr });
|
|
21
|
+
window.postMessage({ type: 'UpdateLeaderboardState', rank: getMaxRankStr(rest.data.items) });
|
|
22
22
|
},
|
|
23
23
|
UpdateLeaderboardStateReq: () => {
|
|
24
24
|
window.postMessage({ type: 'UpdateLeaderboardState', labels: ['win', 'new'] });
|
|
@@ -31,7 +31,7 @@ export const messageReceiver = (instance) => {
|
|
|
31
31
|
UpdateLeaderboardsRes: (rest) => processLeaderboardTableData(instance, rest),
|
|
32
32
|
JoinTournamentRes: (rest) => commonJoinRes(instance, rest),
|
|
33
33
|
UnjoinTournamentRes: (rest) => commonJoinRes(instance, rest),
|
|
34
|
-
TournamentsPageIsReadyRes: (rest) => instance.currentGameId = rest.data.GameId,
|
|
34
|
+
TournamentsPageIsReadyRes: (rest) => instance.currentGameId = '' + rest.data.GameId,
|
|
35
35
|
// listen to LeaderboardLiveEvent event, handle update
|
|
36
36
|
LeaderboardLiveEvent: (rest) => {
|
|
37
37
|
handleLeaderboardLiveEvent(instance, rest);
|
|
@@ -123,6 +123,7 @@ const commonJoinRes = (instance, rest) => {
|
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
current = Object.assign(Object.assign({}, current), { isActionJoinPending: false });
|
|
126
|
+
instance.pendingChangeEvent.emit(current);
|
|
126
127
|
if (!success) {
|
|
127
128
|
instance.tournamentList[tournamentIdx] = current;
|
|
128
129
|
instance.tournamentList = [...instance.tournamentList];
|
|
@@ -150,6 +151,9 @@ const processLeaderboardTableData = (instance, rest) => {
|
|
|
150
151
|
instance.leaderboards = leaderboardsAdapter(rest.data);
|
|
151
152
|
instance.currentPlyerRank = rest.data.item ? rest.data.item.rank : -1;
|
|
152
153
|
};
|
|
154
|
+
/*
|
|
155
|
+
* update tournament info, include status, name or duration change
|
|
156
|
+
*/
|
|
153
157
|
const updateTournamentListByItem = (instance, tournament) => {
|
|
154
158
|
instance.tournamentList = instance.tournamentList.map((_tournament) => {
|
|
155
159
|
if (_tournament.id === tournament.id) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, g as getElement, c as createEvent } from './index-8b5c4b95.js';
|
|
2
|
-
import { T as TRANSLATIONS, c as classnames, D as DialogType,
|
|
3
|
-
export { C as casino_engagement_suite_tournament } from './casino-engagement-suite-tournament-
|
|
2
|
+
import { T as TRANSLATIONS, c as classnames, D as DialogType, i as isTournamentClosed, r as renderGradientRoundedButton, L as LeaderboardPage, g as getTimeDifference, a as getProgress, f as formatDate } from './casino-engagement-suite-tournament-3be75bd2.js';
|
|
3
|
+
export { C as casino_engagement_suite_tournament } from './casino-engagement-suite-tournament-3be75bd2.js';
|
|
4
4
|
|
|
5
5
|
const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:var(--emw--font-size-small, 14px);line-height:14px}@keyframes indeterminate{0%{left:-200%;right:100%}60%{left:110%;right:-10%}to{left:110%;right:-10%}}.ProgressBarBackground{height:8px;background-color:var(--emw--color-gray-300, #666178);border-radius:var(--emw--border-radius-small, 4px);position:relative;overflow:hidden}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:var(--emw--border-radius-small, 4px);background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));transition:width ease-out 0.3s}.ProgressBarLine.Indeterminate{animation:indeterminate 1s linear infinite}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:var(--emw--font-weight-bold, 700);font-size:var(--emw--font-size-x-small, 12px);line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-gray-300, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
|
|
6
6
|
const CasinoEngagementSuiteProgressBarStyle0 = casinoEngagementSuiteProgressBarCss;
|
|
@@ -66,6 +66,80 @@ const CasinoEngagementSuiteProgressBar = class {
|
|
|
66
66
|
};
|
|
67
67
|
CasinoEngagementSuiteProgressBar.style = CasinoEngagementSuiteProgressBarStyle0;
|
|
68
68
|
|
|
69
|
+
const mergeTranslations = (url, target) => {
|
|
70
|
+
return new Promise((resolve) => {
|
|
71
|
+
fetch(url)
|
|
72
|
+
.then((res) => res.json())
|
|
73
|
+
.then((data) => {
|
|
74
|
+
Object.keys(data).forEach((item) => {
|
|
75
|
+
target[item] = target[item] ? target[item] : {};
|
|
76
|
+
for (let key in data[item]) {
|
|
77
|
+
target[item][key] = data[item][key];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
resolve(true);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const generalStylingWrapperCss = ":host{display:block}";
|
|
86
|
+
const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
|
|
87
|
+
|
|
88
|
+
const GeneralStylingWrapper = class {
|
|
89
|
+
constructor(hostRef) {
|
|
90
|
+
registerInstance(this, hostRef);
|
|
91
|
+
this.stylingAppends = false;
|
|
92
|
+
this.setClientStyling = () => {
|
|
93
|
+
let sheet = document.createElement('style');
|
|
94
|
+
sheet.innerHTML = this.clientStyling;
|
|
95
|
+
this.el.prepend(sheet);
|
|
96
|
+
};
|
|
97
|
+
this.setClientStylingURL = () => {
|
|
98
|
+
let url = new URL(this.clientStylingUrl);
|
|
99
|
+
let cssFile = document.createElement('style');
|
|
100
|
+
fetch(url.href)
|
|
101
|
+
.then((res) => res.text())
|
|
102
|
+
.then((data) => {
|
|
103
|
+
cssFile.innerHTML = data;
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
this.el.prepend(cssFile);
|
|
106
|
+
}, 1);
|
|
107
|
+
})
|
|
108
|
+
.catch((err) => {
|
|
109
|
+
console.log('error ', err);
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
this.clientStyling = '';
|
|
113
|
+
this.clientStylingUrl = '';
|
|
114
|
+
this.translationUrl = '';
|
|
115
|
+
this.targetTranslations = undefined;
|
|
116
|
+
}
|
|
117
|
+
componentDidRender() {
|
|
118
|
+
// start custom styling area
|
|
119
|
+
if (!this.stylingAppends) {
|
|
120
|
+
if (this.clientStyling)
|
|
121
|
+
this.setClientStyling();
|
|
122
|
+
if (this.clientStylingUrl)
|
|
123
|
+
this.setClientStylingURL();
|
|
124
|
+
this.stylingAppends = true;
|
|
125
|
+
}
|
|
126
|
+
// end custom styling area
|
|
127
|
+
}
|
|
128
|
+
async componentWillLoad() {
|
|
129
|
+
const promises = [];
|
|
130
|
+
if (this.translationUrl) {
|
|
131
|
+
const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
|
|
132
|
+
promises.push(translationPromise);
|
|
133
|
+
}
|
|
134
|
+
return await Promise.all(promises);
|
|
135
|
+
}
|
|
136
|
+
render() {
|
|
137
|
+
return (h("div", { key: '4d3414408c7662f88331dbe655966237f74d6958', class: "StyleShell" }, h("slot", { key: '1d004644d84602c4314bdf5dfc26b55b160f57df', name: "mainContent" })));
|
|
138
|
+
}
|
|
139
|
+
get el() { return getElement(this); }
|
|
140
|
+
};
|
|
141
|
+
GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
|
|
142
|
+
|
|
69
143
|
const CasinoEngagementSuiteTournamentItem = class {
|
|
70
144
|
constructor(hostRef) {
|
|
71
145
|
registerInstance(this, hostRef);
|
|
@@ -74,29 +148,25 @@ const CasinoEngagementSuiteTournamentItem = class {
|
|
|
74
148
|
this.isNew = undefined;
|
|
75
149
|
this.locale = TRANSLATIONS;
|
|
76
150
|
}
|
|
77
|
-
handleJoinTournamentEvent(e) {
|
|
78
|
-
if (this.tournament.id === e.detail.id) {
|
|
79
|
-
this.tournament = Object.assign(Object.assign({}, this.tournament), { isActionJoinPending: true });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
handleUnjoinTournamentEvent(e) {
|
|
83
|
-
if (this.tournament.id === e.detail.id) {
|
|
84
|
-
this.tournament = Object.assign(Object.assign({}, this.tournament), { isActionJoinPending: true });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
151
|
goToDetail() {
|
|
88
152
|
this.clickToTournamentDetail.emit(this.tournament);
|
|
89
153
|
}
|
|
154
|
+
onTournamentUpdateEvent(event) {
|
|
155
|
+
const { detail } = event;
|
|
156
|
+
if (detail.id === this.tournament.id) {
|
|
157
|
+
this.tournament = Object.assign({}, detail);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
90
160
|
render() {
|
|
91
161
|
const tournament = this.tournament;
|
|
92
|
-
return (h("div", { key: '
|
|
162
|
+
return (h("div", { key: '42aee3b22ede6ac1da748308979258bfcda33d3b', class: classnames('LeaderboardsItem', tournament.isPlayerAcknowledged ? ' GradientRounded Hollow' : '', tournament.isUnjoined ? 'Unjoined' : ''), onClick: this.goToDetail.bind(this) }, h("div", { key: '25078f839d00c4b749bff3036c279afbf9133b96', class: "LeaderboardsItemContainer" }, h("tournament-item-title", { key: 'd34d2101e73044448d909a8f36a842a5081d9265', tournament: tournament }), h("tournament-timer", { key: '3958d497cdc9856660b998d616da68689505b18e', tournament: tournament })), h("div", { key: '940f08d14c35872562eccbb022e3f256bba259ec', class: "LeaderboardLabels" }, this.isNew && (h("div", { key: '3c84b998444eb4e16a13a65db4fb909356f78668', class: "LeaderboardLabel" }, h("span", { key: '5c095eeafbfba21e68cd6afa7699f4e2c9ce4bcd' }, "new"))))));
|
|
93
163
|
}
|
|
94
164
|
};
|
|
95
165
|
|
|
96
166
|
const CasinoEngagementSuiteTournamentItemTitle = class {
|
|
97
167
|
constructor(hostRef) {
|
|
98
168
|
registerInstance(this, hostRef);
|
|
99
|
-
this.
|
|
169
|
+
this.unjoinTournamentConfirmEvent = createEvent(this, "unjoinTournamentConfirmEvent", 7);
|
|
100
170
|
this.joinTournamentEvent = createEvent(this, "joinTournamentEvent", 7);
|
|
101
171
|
this.tournament = undefined;
|
|
102
172
|
this.locale = TRANSLATIONS;
|
|
@@ -109,9 +179,10 @@ const CasinoEngagementSuiteTournamentItemTitle = class {
|
|
|
109
179
|
if (this.isButtonDisabed) {
|
|
110
180
|
return;
|
|
111
181
|
}
|
|
112
|
-
|
|
182
|
+
//only disable the button when click on the Join button which is not acknowledged by player
|
|
183
|
+
this.isButtonDisabed = this.tournament.isPlayerAcknowledged ? false : true;
|
|
113
184
|
if (this.tournament.isPlayerAcknowledged) {
|
|
114
|
-
this.
|
|
185
|
+
this.unjoinTournamentConfirmEvent.emit({ type: DialogType.unjoin, tournament: this.tournament });
|
|
115
186
|
}
|
|
116
187
|
else {
|
|
117
188
|
this.joinTournamentEvent.emit(this.tournament);
|
|
@@ -121,7 +192,7 @@ const CasinoEngagementSuiteTournamentItemTitle = class {
|
|
|
121
192
|
this.isButtonDisabed = this.tournament.isActionJoinPending === true;
|
|
122
193
|
}
|
|
123
194
|
render() {
|
|
124
|
-
return (h("div", { key: '
|
|
195
|
+
return (h("div", { key: '0226e00da9805f16624a2d60edb020d047ea28ee', class: "TitleContainer" }, h("div", { key: 'e6d55949a27f2b90ca36af51dbe1c52ddd1d9cf9', class: "Title" }, this.tournament.nameOrTitle), !isTournamentClosed(this.tournament) && (h("div", { key: 'f3b030e17ad4f03e20485cb163952b6b1fb05881' }, renderGradientRoundedButton({
|
|
125
196
|
statedClasses: {
|
|
126
197
|
isHollow: this.tournament.isPlayerAcknowledged,
|
|
127
198
|
isPending: this.isButtonDisabed
|
|
@@ -142,23 +213,26 @@ const CasinoEngagementSuiteTournamentTimer = class {
|
|
|
142
213
|
constructor(hostRef) {
|
|
143
214
|
registerInstance(this, hostRef);
|
|
144
215
|
this.tournament = undefined;
|
|
145
|
-
this.
|
|
216
|
+
this.isDetail = false;
|
|
146
217
|
this.timeHolder = undefined;
|
|
147
|
-
this.
|
|
218
|
+
this.timeClock = true;
|
|
219
|
+
this.lastTimeDiff = undefined;
|
|
220
|
+
this.lastProgress = undefined;
|
|
148
221
|
}
|
|
149
222
|
containerPageChangeHandler(event) {
|
|
150
|
-
this.
|
|
151
|
-
event.detail.page === LeaderboardPage.item && this.
|
|
223
|
+
this.timeClock = (event.detail.page === LeaderboardPage.list && !this.isDetail) ||
|
|
224
|
+
(event.detail.page === LeaderboardPage.item && this.isDetail);
|
|
225
|
+
}
|
|
226
|
+
componentWillLoad() {
|
|
227
|
+
this.lastTimeDiff = getTimeDifference(new Date(), this.tournament.endTime);
|
|
228
|
+
this.lastProgress = getProgress(this.tournament.startTime, this.tournament.endTime);
|
|
152
229
|
}
|
|
153
230
|
setTimeInterval() {
|
|
154
231
|
this.timeHolder = setInterval(() => {
|
|
155
|
-
var _a;
|
|
156
232
|
const timeDifference = getTimeDifference(new Date(), this.tournament.endTime);
|
|
157
233
|
const progress = getProgress(this.tournament.startTime, this.tournament.endTime);
|
|
158
|
-
if (this.
|
|
159
|
-
![TournamentState.Closed, TournamentState.Closing].includes((_a = this.tournament) === null || _a === void 0 ? void 0 : _a.state) &&
|
|
234
|
+
if (this.timeClock && !isTournamentClosed(this.tournament) &&
|
|
160
235
|
(timeDifference != this.lastTimeDiff || progress != this.lastProgress)) {
|
|
161
|
-
this.time++;
|
|
162
236
|
this.lastProgress = progress;
|
|
163
237
|
this.lastTimeDiff = timeDifference;
|
|
164
238
|
}
|
|
@@ -171,92 +245,16 @@ const CasinoEngagementSuiteTournamentTimer = class {
|
|
|
171
245
|
clearInterval(this.timeHolder);
|
|
172
246
|
}
|
|
173
247
|
render() {
|
|
174
|
-
return h("section", { key: '
|
|
175
|
-
?
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
]
|
|
184
|
-
: [h("div", { class: "NotRunning" }, formatDate(this.tournament.startTime)), h("div", null, formatDate(this.tournament.endTime))]), h("casino-engagement-suite-progress-bar", { key: 'b841cc70a1307f1175f0748644aaaeee9e1094ff', value: Number(this.lastProgress >= 100 ? 100 : this.lastProgress), "hide-percent": true }));
|
|
248
|
+
return h("section", { key: '8fafe729af2bd66b5ac0e980564051069f677531', class: "TimeContainer" }, h("div", { key: '8279572700e24d3f1094809dae6e3b5d1b02c37b', class: "Time" }, this.tournament.state === 'Running'
|
|
249
|
+
? h("div", { class: "Running" }, h("div", null, this.lastTimeDiff), h("div", null, renderGradientRoundedButton({
|
|
250
|
+
statedClasses: {
|
|
251
|
+
isHollow: true,
|
|
252
|
+
isPendding: false
|
|
253
|
+
},
|
|
254
|
+
innerHTML: `${getProgress(this.tournament.startTime, this.tournament.endTime)}%`
|
|
255
|
+
})))
|
|
256
|
+
: [h("div", { class: "NotRunning" }, formatDate(this.tournament.startTime)), h("div", null, formatDate(this.tournament.endTime))]), h("casino-engagement-suite-progress-bar", { key: 'e475e55b206c802f8df27cb95ac8fe6331578358', indeterminate: false, value: Number(this.lastProgress >= 100 ? 100 : this.lastProgress), "hide-percent": true }));
|
|
185
257
|
}
|
|
186
258
|
};
|
|
187
259
|
|
|
188
|
-
|
|
189
|
-
return new Promise((resolve) => {
|
|
190
|
-
fetch(url)
|
|
191
|
-
.then((res) => res.json())
|
|
192
|
-
.then((data) => {
|
|
193
|
-
Object.keys(data).forEach((item) => {
|
|
194
|
-
target[item] = target[item] ? target[item] : {};
|
|
195
|
-
for (let key in data[item]) {
|
|
196
|
-
target[item][key] = data[item][key];
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
resolve(true);
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
const generalStylingWrapperCss = ":host{display:block}";
|
|
205
|
-
const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
|
|
206
|
-
|
|
207
|
-
const GeneralStylingWrapper = class {
|
|
208
|
-
constructor(hostRef) {
|
|
209
|
-
registerInstance(this, hostRef);
|
|
210
|
-
this.stylingAppends = false;
|
|
211
|
-
this.setClientStyling = () => {
|
|
212
|
-
let sheet = document.createElement('style');
|
|
213
|
-
sheet.innerHTML = this.clientStyling;
|
|
214
|
-
this.el.prepend(sheet);
|
|
215
|
-
};
|
|
216
|
-
this.setClientStylingURL = () => {
|
|
217
|
-
let url = new URL(this.clientStylingUrl);
|
|
218
|
-
let cssFile = document.createElement('style');
|
|
219
|
-
fetch(url.href)
|
|
220
|
-
.then((res) => res.text())
|
|
221
|
-
.then((data) => {
|
|
222
|
-
cssFile.innerHTML = data;
|
|
223
|
-
setTimeout(() => {
|
|
224
|
-
this.el.prepend(cssFile);
|
|
225
|
-
}, 1);
|
|
226
|
-
})
|
|
227
|
-
.catch((err) => {
|
|
228
|
-
console.log('error ', err);
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
this.clientStyling = '';
|
|
232
|
-
this.clientStylingUrl = '';
|
|
233
|
-
this.translationUrl = '';
|
|
234
|
-
this.targetTranslations = undefined;
|
|
235
|
-
}
|
|
236
|
-
componentDidRender() {
|
|
237
|
-
// start custom styling area
|
|
238
|
-
if (!this.stylingAppends) {
|
|
239
|
-
if (this.clientStyling)
|
|
240
|
-
this.setClientStyling();
|
|
241
|
-
if (this.clientStylingUrl)
|
|
242
|
-
this.setClientStylingURL();
|
|
243
|
-
this.stylingAppends = true;
|
|
244
|
-
}
|
|
245
|
-
// end custom styling area
|
|
246
|
-
}
|
|
247
|
-
async componentWillLoad() {
|
|
248
|
-
const promises = [];
|
|
249
|
-
if (this.translationUrl) {
|
|
250
|
-
const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
|
|
251
|
-
promises.push(translationPromise);
|
|
252
|
-
}
|
|
253
|
-
return await Promise.all(promises);
|
|
254
|
-
}
|
|
255
|
-
render() {
|
|
256
|
-
return (h("div", { key: '4d3414408c7662f88331dbe655966237f74d6958', class: "StyleShell" }, h("slot", { key: '1d004644d84602c4314bdf5dfc26b55b160f57df', name: "mainContent" })));
|
|
257
|
-
}
|
|
258
|
-
get el() { return getElement(this); }
|
|
259
|
-
};
|
|
260
|
-
GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
|
|
261
|
-
|
|
262
|
-
export { CasinoEngagementSuiteProgressBar as casino_engagement_suite_progress_bar, CasinoEngagementSuiteTournamentItem as casino_engagement_suite_tournament_item, CasinoEngagementSuiteTournamentItemTitle as casino_engagement_suite_tournament_item_title, CasinoEngagementSuiteTournamentTimer as casino_engagement_suite_tournament_timer, GeneralStylingWrapper as general_styling_wrapper };
|
|
260
|
+
export { CasinoEngagementSuiteProgressBar as casino_engagement_suite_progress_bar, GeneralStylingWrapper as general_styling_wrapper, CasinoEngagementSuiteTournamentItem as tournament_item, CasinoEngagementSuiteTournamentItemTitle as tournament_item_title, CasinoEngagementSuiteTournamentTimer as tournament_timer };
|