@everymatrix/casino-engagement-suite-tournament 1.63.3 → 1.64.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.
Files changed (47) hide show
  1. package/dist/casino-engagement-suite-tournament/casino-engagement-suite-tournament.esm.js +1 -1
  2. package/dist/casino-engagement-suite-tournament/index.esm.js +1 -1
  3. package/dist/casino-engagement-suite-tournament/p-edcd56d0.js +15 -0
  4. package/dist/casino-engagement-suite-tournament/{p-d24f1017.entry.js → p-fcfced34.entry.js} +1 -1
  5. package/dist/cjs/casino-engagement-suite-progress-bar_6.cjs.entry.js +11 -10
  6. package/dist/cjs/{casino-engagement-suite-tournament-785dd5cc.js → casino-engagement-suite-tournament-95aedc10.js} +244 -67
  7. package/dist/cjs/casino-engagement-suite-tournament.cjs.js +1 -1
  8. package/dist/cjs/index.cjs.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/assets/back.svg +3 -0
  11. package/dist/collection/assets/iconTrophy.svg +12 -0
  12. package/dist/collection/assets/iconWarn.svg +15 -0
  13. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.css +123 -26
  14. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.js +71 -14
  15. package/dist/collection/shared/TournamentDurationTimer.js +9 -9
  16. package/dist/collection/shared/TournamentItem.js +20 -2
  17. package/dist/collection/shared/TournamentItemTitle.js +3 -3
  18. package/dist/collection/shared/icons.js +6 -2
  19. package/dist/collection/shared/renders.dialog.js +10 -3
  20. package/dist/collection/shared/renders.page.js +3 -1
  21. package/dist/collection/shared/renders.tab.js +10 -3
  22. package/dist/collection/utils/api.apdater.js +14 -0
  23. package/dist/collection/utils/bussiness.js +28 -2
  24. package/dist/collection/utils/message.js +104 -27
  25. package/dist/collection/utils/translations.js +8 -5
  26. package/dist/collection/utils/types.js +8 -0
  27. package/dist/collection/utils/util.date.js +4 -3
  28. package/dist/collection/utils/utils.js +5 -2
  29. package/dist/esm/casino-engagement-suite-progress-bar_6.entry.js +12 -11
  30. package/dist/esm/{casino-engagement-suite-tournament-3be75bd2.js → casino-engagement-suite-tournament-61d378cd.js} +244 -67
  31. package/dist/esm/casino-engagement-suite-tournament.js +1 -1
  32. package/dist/esm/index.js +1 -1
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/types/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.d.ts +20 -3
  35. package/dist/types/components.d.ts +18 -0
  36. package/dist/types/shared/TournamentItem.d.ts +7 -1
  37. package/dist/types/shared/TournamentItemTitle.d.ts +6 -1
  38. package/dist/types/shared/icons.d.ts +1 -0
  39. package/dist/types/utils/api.apdater.d.ts +3 -0
  40. package/dist/types/utils/bussiness.d.ts +10 -1
  41. package/dist/types/utils/message.d.ts +3 -0
  42. package/dist/types/utils/translations.d.ts +6 -1
  43. package/dist/types/utils/types.d.ts +9 -0
  44. package/dist/types/utils/util.date.d.ts +2 -2
  45. package/dist/types/utils/utils.d.ts +1 -0
  46. package/package.json +1 -1
  47. package/dist/casino-engagement-suite-tournament/p-f478f260.js +0 -15
@@ -5,6 +5,7 @@ export class CasinoEngagementSuiteTournamentItem {
5
5
  constructor() {
6
6
  this.tournament = undefined;
7
7
  this.isNew = undefined;
8
+ this.tid = undefined;
8
9
  this.locale = TRANSLATIONS;
9
10
  }
10
11
  goToDetail() {
@@ -18,7 +19,7 @@ export class CasinoEngagementSuiteTournamentItem {
18
19
  }
19
20
  render() {
20
21
  const tournament = this.tournament;
21
- 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"))))));
22
+ return (h("div", { key: 'e4c39f94b5574dc67c1f76d16f21b680db8dbf6c', class: classnames('LeaderboardsItem', tournament.isPlayerAcknowledged ? ' GradientRounded Hollow' : '', tournament.isUnjoined ? 'Unjoined' : ''), onClick: this.goToDetail.bind(this) }, h("div", { key: 'ed40bbbadbe4a216981f0cc0891476c3788c456f', class: "LeaderboardsItemContainer" }, h("tournament-item-title", { key: '655d965507d60b5a90a66b5cf1b20ff744ab7115', tournament: tournament }), h("tournament-timer", { key: 'b6b597921994640725dd57e7991b38604702ba0d', tournament: tournament })), h("div", { key: '1cc278a8ab8faa750427f4dce15140117732d5a1', class: "LeaderboardLabels" }, this.isNew && (h("div", { key: 'b14172c01cc9b930a439113357e630edd0713eae', class: "LeaderboardLabel" }, h("span", { key: 'ab763183adf551c34a749ae39c1719160387a816' }, "new"))))));
22
23
  }
23
24
  static get is() { return "tournament-item"; }
24
25
  static get properties() {
@@ -28,7 +29,7 @@ export class CasinoEngagementSuiteTournamentItem {
28
29
  "mutable": false,
29
30
  "complexType": {
30
31
  "original": "Tournament",
31
- "resolved": "{ href: string; id: string; nameOrTitle: string; description: string; termsUrl: string; thumbnail: string; thumbnails: []; startTime: Date; endTime: Date; closeTime: Date; exhibitionStartTime: Date; exhibitionEndTime: Date; state: TournamentState; tags: string; minBetCount: number; dataSource: string; scoreCriteria: string; wallets: { code: string; }; prizes: { rank: number; count: number; name: string; }[]; games?: TournamentGame[]; playerEnrolled?: boolean; isPlayerAcknowledged?: boolean; isActionJoinPending?: boolean; isUnjoined?: boolean; }",
32
+ "resolved": "{ href: string; id: string; nameOrTitle: string; description: string; termsUrl: string; thumbnail: string; thumbnails: []; startTime: Date; endTime: Date; closeTime: Date; exhibitionStartTime: Date; exhibitionEndTime: Date; state: TournamentState; tags: string; minBetCount: number; dataSource: string; scoreCriteria: string; wallets: { code: string; }; prizes: { rank: number; count: number; name: string; }[]; games?: TournamentGame[]; playerEnrolled?: boolean; isPlayerAcknowledged?: boolean; isActionJoinPending?: boolean; isUnjoined?: boolean; isTriggered?: boolean; order?: number; }",
32
33
  "references": {
33
34
  "Tournament": {
34
35
  "location": "import",
@@ -61,6 +62,23 @@ export class CasinoEngagementSuiteTournamentItem {
61
62
  },
62
63
  "attribute": "is-new",
63
64
  "reflect": false
65
+ },
66
+ "tid": {
67
+ "type": "string",
68
+ "mutable": false,
69
+ "complexType": {
70
+ "original": "string",
71
+ "resolved": "string",
72
+ "references": {}
73
+ },
74
+ "required": false,
75
+ "optional": false,
76
+ "docs": {
77
+ "tags": [],
78
+ "text": ""
79
+ },
80
+ "attribute": "tid",
81
+ "reflect": false
64
82
  }
65
83
  };
66
84
  }
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
2
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
+ import { isTournamentEnded } from "../utils/bussiness";
6
6
  export class CasinoEngagementSuiteTournamentItemTitle {
7
7
  constructor() {
8
8
  this.tournament = undefined;
@@ -29,7 +29,7 @@ export class CasinoEngagementSuiteTournamentItemTitle {
29
29
  this.isButtonDisabed = this.tournament.isActionJoinPending === true;
30
30
  }
31
31
  render() {
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({
32
+ return (h("div", { key: 'cf8c4dc0cba0ebd8e1da43a32af618d79972f669', class: "TitleContainer" }, h("div", { key: '1707346e5ef14b1379d8a0691f11a425a16f1c13', class: "Title" }, this.tournament.nameOrTitle), !isTournamentEnded(this.tournament) && (h("div", { key: '78a0c86a56fa2b145bb5e7106df441fe6deb116e' }, renderGradientRoundedButton({
33
33
  statedClasses: {
34
34
  isHollow: this.tournament.isPlayerAcknowledged,
35
35
  isPending: this.isButtonDisabed
@@ -49,7 +49,7 @@ export class CasinoEngagementSuiteTournamentItemTitle {
49
49
  "mutable": false,
50
50
  "complexType": {
51
51
  "original": "Tournament",
52
- "resolved": "{ href: string; id: string; nameOrTitle: string; description: string; termsUrl: string; thumbnail: string; thumbnails: []; startTime: Date; endTime: Date; closeTime: Date; exhibitionStartTime: Date; exhibitionEndTime: Date; state: TournamentState; tags: string; minBetCount: number; dataSource: string; scoreCriteria: string; wallets: { code: string; }; prizes: { rank: number; count: number; name: string; }[]; games?: TournamentGame[]; playerEnrolled?: boolean; isPlayerAcknowledged?: boolean; isActionJoinPending?: boolean; isUnjoined?: boolean; }",
52
+ "resolved": "{ href: string; id: string; nameOrTitle: string; description: string; termsUrl: string; thumbnail: string; thumbnails: []; startTime: Date; endTime: Date; closeTime: Date; exhibitionStartTime: Date; exhibitionEndTime: Date; state: TournamentState; tags: string; minBetCount: number; dataSource: string; scoreCriteria: string; wallets: { code: string; }; prizes: { rank: number; count: number; name: string; }[]; games?: TournamentGame[]; playerEnrolled?: boolean; isPlayerAcknowledged?: boolean; isActionJoinPending?: boolean; isUnjoined?: boolean; isTriggered?: boolean; order?: number; }",
53
53
  "references": {
54
54
  "Tournament": {
55
55
  "location": "import",
@@ -1,10 +1,14 @@
1
1
  import { h } from "@stencil/core";
2
2
  import reward from "../assets/reward.svg";
3
+ import trophy from "../assets/iconTrophy.svg";
4
+ import iWarn from "../assets/iconWarn.svg";
3
5
  import help from "../assets/help.svg";
6
+ import back from "../assets/back.svg";
4
7
  export const iconClose = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg" });
5
8
  export const iconQuestion = h("img", { src: help, alt: "question", class: "Question" });
6
9
  export const iconEyeOpen = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-open.svg" });
7
10
  export const iconEyeClose = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-closed.svg" });
8
- export const iconBack = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/back.svg" });
11
+ export const iconBack = h("img", { src: back, alt: "Back", class: "Back" });
9
12
  export const iconReward = h("img", { src: reward, alt: "reward", class: "Reward" });
10
- export const iconTrophy = h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/cup-congras.svg" });
13
+ export const iconTrophy = h("img", { src: trophy, alt: "iconTrophy", class: "Trophy" });
14
+ export const iconWarn = h("img", { src: iWarn, alt: "Reward Assign Failed", class: "Warn" });
@@ -1,10 +1,11 @@
1
1
  import { h } from "@stencil/core";
2
- import { iconTrophy } from "./icons";
2
+ import { iconTrophy, iconWarn } from "./icons";
3
3
  import { localePostprocess } from "../utils/translations";
4
4
  import { renderGradientRoundedButton } from "./GradientRoundedButton";
5
5
  var GradientButton;
6
6
  (function (GradientButton) {
7
7
  GradientButton["normal"] = "normal";
8
+ GradientButton["okContinue"] = "okContinue";
8
9
  GradientButton["unjoinYes"] = "unjoinYes";
9
10
  GradientButton["unjoinNo"] = "unjoinNo";
10
11
  })(GradientButton || (GradientButton = {}));
@@ -14,6 +15,9 @@ const renderButton = (instance, buttonType, isActionJoinPending = false) => {
14
15
  normal: {
15
16
  innerHTML: locale.WinDialog.ButtonContinue
16
17
  },
18
+ okContinue: {
19
+ innerHTML: locale.WinDialog.FailedButtonContinue
20
+ },
17
21
  unjoinYes: {
18
22
  onClick: () => instance.actionJoin(instance.dialog.data),
19
23
  innerHTML: locale.UnjoinDialog.ButtonYes
@@ -38,9 +42,12 @@ const renderButton = (instance, buttonType, isActionJoinPending = false) => {
38
42
  };
39
43
  export const dialog = {
40
44
  gift(instance) {
41
- const { name: tournamentName } = instance.gifts[0];
45
+ const { name: rewards, failedRewards } = instance.gifts[0];
42
46
  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)))));
47
+ return (h("div", { class: "PageConfirmContainer" }, !!rewards ?
48
+ h("div", { class: "PageConfirm Gift" }, h("div", null, iconTrophy), h("div", { class: "Title" }, locale.WinDialog.Title), h("div", { class: "Description", innerHTML: localePostprocess(locale.WinDialog.Description, { rewards }) }), h("div", { class: "PageConfirmButtonsGroup" }, renderButton(instance, GradientButton.normal)))
49
+ :
50
+ h("div", { class: "PageConfirm Gift" }, h("div", null, iconWarn), h("div", { class: "Title", innerHTML: localePostprocess(locale.WinDialog.FailedTitle, { failedRewards }) }), h("div", { class: "Description" }, locale.WinDialog.FailedDescription), h("div", { class: "PageConfirmButtonsGroup" }, renderButton(instance, GradientButton.okContinue)))));
44
51
  },
45
52
  unjoin(instance) {
46
53
  const { locale } = instance;
@@ -12,7 +12,9 @@ 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("tournament-item", { tournament: _tournament, isNew: instance.newIdList.includes(_tournament.id) })))));
15
+ return renderWrapperByPageType(h("div", { class: "Leaderboards ScrollBar Row" }, instance.tournamentList.map((_tournament, idx) => (
16
+ // @ts-ignore
17
+ h("tournament-item", { tid: _tournament.id, key: _tournament.id, tournament: _tournament, style: { 'order': `${_tournament.order || idx}` }, isNew: instance.newIdList.includes(_tournament.id) })))));
16
18
  }
17
19
  else {
18
20
  return renderWrapperByPageType(h("div", { class: "NoLeaderboards ScrollBar Row" }, h("h3", { class: "Title" }, locale.NoLeaderboards), h("div", { class: "message" }, locale.NoLeaderboardsTip)));
@@ -8,7 +8,11 @@ export const tab = {
8
8
  info(instance) {
9
9
  var _a, _b;
10
10
  const { locale, tournamentItem: tournament, isShowInfo } = instance;
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)))))))));
11
+ const playerRank = getResultPrize((_a = instance.leaderboards) === null || _a === void 0 ? void 0 : _a.find((l) => l.isMe));
12
+ const rewardInfo = !(playerRank === null || playerRank === void 0 ? void 0 : playerRank.place) || (playerRank === null || playerRank === void 0 ? void 0 : playerRank.unqualified)
13
+ ? ''
14
+ : localePostprocess(((playerRank === null || playerRank === void 0 ? void 0 : playerRank.prize) ? locale.TipPrize : locale.TipPrizeWithoutReward), playerRank);
15
+ 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) && ((_b = instance.leaderboards) === null || _b === void 0 ? void 0 : _b.find((l) => l.isMe)) && (h("section", { class: "ResultPrize", innerHTML: rewardInfo })), h("section", { class: "PrizesContainer" }, h("div", { class: "PrizesHeader" }, iconReward, h("span", { class: "PrizesText" }, locale.Prizes)), h("div", { class: "Prizes" }, tournament.prizes.map((prize) => (h("div", { class: "Prize" }, h("span", { class: 'Rank' }, prize.rank, " ", prize.count === 1 ? '' : ` - ${(prize.rank + prize.count - 1)}`), prize.count === 1 ? locale.Place : locale.Places, ": ", h("span", { class: "PrizeText" }, prize.name)))))))));
12
16
  },
13
17
  leaderboard(instance) {
14
18
  const { locale, tournamentItem } = instance;
@@ -25,6 +29,8 @@ export const tab = {
25
29
  },
26
30
  games(instance) {
27
31
  var _a;
32
+ if (!instance.tournamentItem.games || !instance.tournamentItem.games.length)
33
+ return h("general-animation-loading", null);
28
34
  return (h("div", { class: "Games" }, (_a = instance.tournamentItem.games) === null || _a === void 0 ? void 0 : _a.map((game) => (h("div", { class: `Game ${instance.currentGameId == game.id ? 'Current' : ''}`, onClick: () => {
29
35
  instance.onGameClick(game);
30
36
  } }, h("img", { src: game.defaultThumbnail, alt: "" }))))));
@@ -32,7 +38,8 @@ export const tab = {
32
38
  };
33
39
  const getResultPrize = (leaderboard) => {
34
40
  return {
35
- prize: leaderboard.prizeName,
36
- place: leaderboard.rank
41
+ prize: leaderboard === null || leaderboard === void 0 ? void 0 : leaderboard.prizeName,
42
+ place: leaderboard === null || leaderboard === void 0 ? void 0 : leaderboard.rank,
43
+ unqualified: leaderboard === null || leaderboard === void 0 ? void 0 : leaderboard.unqualified,
37
44
  };
38
45
  };
@@ -19,6 +19,20 @@ export const tournamentAdapter = (tournamentApi) => {
19
19
  });
20
20
  return tournament;
21
21
  };
22
+ export const updateTournament = (target, source) => {
23
+ const keysTime = [
24
+ 'startTime',
25
+ 'endTime',
26
+ 'closeTime',
27
+ 'exhibitionStartTime',
28
+ 'exhibitionEndTime', 'state',
29
+ 'prizes', 'minBetCount', 'scoreCriteria', 'termsUrl'
30
+ ];
31
+ keysTime.forEach((key) => {
32
+ target[key] = source[key];
33
+ });
34
+ return Object.assign({}, target);
35
+ };
22
36
  export const leaderboardsAdapter = (leaderboardRes) => {
23
37
  let { item, items: leaderboards } = leaderboardRes;
24
38
  if (!item) {
@@ -1,4 +1,5 @@
1
- import { TournamentState } from "./types";
1
+ import { RewardType, TournamentState } from "./types";
2
+ export const DEFAULT_PAGE_SIZE = 12;
2
3
  export const getMaxRankStr = (playerLeaderboards) => {
3
4
  let bestRank = null;
4
5
  (playerLeaderboards || []).map((playerLeaderboard) => {
@@ -9,8 +10,33 @@ export const getMaxRankStr = (playerLeaderboards) => {
9
10
  }
10
11
  bestRank = !bestRank || ((_a = bestRank.leaderBoard) === null || _a === void 0 ? void 0 : _a.rank) > rank ? playerLeaderboard : bestRank;
11
12
  });
12
- return bestRank ? `${bestRank.leaderBoard.rank} / ${bestRank.endRank}` : '-';
13
+ return {
14
+ rank: bestRank ? `${bestRank.leaderBoard.rank} / ${bestRank.endRank}` : '-',
15
+ detail: bestRank ? {
16
+ playerRank: bestRank.leaderBoard.rank,
17
+ total: bestRank.endRank
18
+ } : null
19
+ };
13
20
  };
14
21
  export const isTournamentClosed = (tournament) => {
22
+ return [TournamentState.Closed].includes(tournament.state);
23
+ };
24
+ export const isTournamentEnded = (tournament) => {
15
25
  return [TournamentState.Closed, TournamentState.Closing].includes(tournament.state);
16
26
  };
27
+ export const getRewardNameByType = (reward) => {
28
+ switch (reward.type) {
29
+ case RewardType.FreeSpin:
30
+ return reward.campaignName;
31
+ case RewardType.Mission:
32
+ return reward.challengeName;
33
+ case RewardType.Leaderboard:
34
+ return reward.ticketProgramName;
35
+ case RewardType.LuckyWheel:
36
+ return reward.prizeEngineProgramName;
37
+ case RewardType.Custom:
38
+ return reward.value;
39
+ default:
40
+ return reward.name;
41
+ }
42
+ };
@@ -1,5 +1,5 @@
1
- import { leaderboardsAdapter, tournamentAdapter } from "./api.apdater";
2
- import { getMaxRankStr } from "./bussiness";
1
+ import { leaderboardsAdapter, tournamentAdapter, updateTournament } from "./api.apdater";
2
+ import { getMaxRankStr, getRewardNameByType } from "./bussiness";
3
3
  import { DialogType, LeaderboardPage } from "./types";
4
4
  export const messageSender = {
5
5
  UpdateSuiteBarState: (labels) => window.postMessage({ type: 'UpdateLeaderboardState', labels }),
@@ -16,28 +16,35 @@ export const messageSender = {
16
16
  GameClickReq: (game) => window.postMessage({ type: 'EngagementSuiteGameRedirect', data: { Slug: game.slug } }),
17
17
  };
18
18
  export const messageReceiver = (instance) => {
19
- const receiver = {
19
+ return {
20
20
  UpdateLeaderboardsPlayerRes: (rest) => {
21
- window.postMessage({ type: 'UpdateLeaderboardState', rank: getMaxRankStr(rest.data.items) });
21
+ const { rank, detail } = (getMaxRankStr(rest.data.items));
22
+ window.postMessage({ type: 'UpdateLeaderboardState', rank, detail });
22
23
  },
23
24
  UpdateLeaderboardStateReq: () => {
24
25
  window.postMessage({ type: 'UpdateLeaderboardState', labels: ['win', 'new'] });
25
26
  },
27
+ /*
28
+ * Update tournament games list when switch to game tab in detail page
29
+ */
26
30
  UpdateTournamentsItemRes: (rest) => {
27
31
  const tournamentNew = tournamentAdapter(rest.data.item);
28
32
  instance.tournamentItem = tournamentNew;
29
33
  updateTournamentListByItem(instance, tournamentNew);
30
34
  },
31
- UpdateLeaderboardsRes: (rest) => processLeaderboardTableData(instance, rest),
32
- JoinTournamentRes: (rest) => commonJoinRes(instance, rest),
33
- UnjoinTournamentRes: (rest) => commonJoinRes(instance, rest),
35
+ UpdateLeaderboardsRes: (rest) => initPlayerLeaderboard(instance, rest),
36
+ //Parse the join tournament response
37
+ JoinTournamentRes: (rest) => commonJoinRes(instance, rest, true),
38
+ //Parse the unjoin tournament response
39
+ UnjoinTournamentRes: (rest) => commonJoinRes(instance, rest, false),
40
+ //Parse recieved init message when widget is loaded
34
41
  TournamentsPageIsReadyRes: (rest) => instance.currentGameId = '' + rest.data.GameId,
35
42
  // listen to LeaderboardLiveEvent event, handle update
36
- LeaderboardLiveEvent: (rest) => {
37
- handleLeaderboardLiveEvent(instance, rest);
38
- },
43
+ LeaderboardLiveEvent: (rest) => handleLeaderboardLiveEvent(instance, rest),
44
+ LiveLeaderboardUpdate: (rest) => updateLeaderboardInfo(instance, Object.assign(Object.assign({}, rest), { messageType: 'LeaderboardUpdate' })),
45
+ LiveTournamentUpdate: (rest) => updateTournamentInfo(instance, Object.assign(Object.assign({}, rest), { messageType: 'TournamentUpdate' })),
46
+ LiveLeaderboardFinalizeUpdate: (rest) => updatePlayerRewardInfo(instance, Object.assign(Object.assign({}, rest), { messageType: 'PlayerFinalizeUpdate' })),
39
47
  };
40
- return receiver;
41
48
  };
42
49
  /**
43
50
  * Handle LeaderboardLiveEvent update event
@@ -113,33 +120,45 @@ const handleLeaderboardLiveEvent = (instance, rest) => {
113
120
  }
114
121
  }
115
122
  };
116
- const showErrorMessage = (instance, type) => {
117
- instance.dialog = Object.assign(Object.assign({}, instance.dialog), { isOpen: true, type });
123
+ const clearUnjoinedTournament = (instance, unjoinedTournamentId) => {
124
+ const clearId = setTimeout(() => {
125
+ instance.tournamentList = instance.tournamentList.filter((tournament) => {
126
+ return tournament.id !== unjoinedTournamentId;
127
+ });
128
+ clearTimeout(clearId);
129
+ }, 100);
118
130
  };
119
- const commonJoinRes = (instance, rest) => {
131
+ const commonJoinRes = (instance, rest, isJoinRes) => {
120
132
  const { success, data } = rest;
121
133
  let tournamentIdx = instance.tournamentList.findIndex((tournament) => tournament.id === (data.tournamentId || data.id || data.bonusCode)), current = instance.tournamentList[tournamentIdx];
122
134
  if (tournamentIdx == -1) {
123
135
  return;
124
136
  }
125
- current = Object.assign(Object.assign({}, current), { isActionJoinPending: false });
137
+ current.isActionJoinPending = false;
126
138
  instance.pendingChangeEvent.emit(current);
127
139
  if (!success) {
128
140
  instance.tournamentList[tournamentIdx] = current;
129
141
  instance.tournamentList = [...instance.tournamentList];
130
- showErrorMessage(instance, DialogType.error);
142
+ instance.openDialog(DialogType.error);
131
143
  return;
132
144
  }
133
- current = Object.assign(Object.assign({}, current), { isUnjoined: current.isPlayerAcknowledged ? true : false, isPlayerAcknowledged: !!!current.isPlayerAcknowledged });
134
- instance.tournamentList[tournamentIdx] = current;
145
+ if (isJoinRes) {
146
+ current.isPlayerAcknowledged = true;
147
+ current.order = instance.minOrder--;
148
+ }
149
+ else {
150
+ current.isUnjoined = true;
151
+ clearUnjoinedTournament(instance, data.tournamentId);
152
+ }
153
+ instance.tournamentList[tournamentIdx] = Object.assign({}, current);
135
154
  instance.tournamentList = [...instance.tournamentList];
136
155
  if (instance.page === LeaderboardPage.item) {
137
- if (current.isUnjoined) {
138
- instance.setPage(LeaderboardPage.list);
139
- return;
156
+ if (isJoinRes) {
157
+ instance.tournamentItem = Object.assign({}, current);
140
158
  }
141
159
  else {
142
- instance.tournamentItem = Object.assign({}, current);
160
+ instance.setPage(LeaderboardPage.list);
161
+ return;
143
162
  }
144
163
  }
145
164
  if (instance.nextPage) {
@@ -147,17 +166,21 @@ const commonJoinRes = (instance, rest) => {
147
166
  instance.nextPage = undefined;
148
167
  }
149
168
  };
150
- const processLeaderboardTableData = (instance, rest) => {
169
+ const initPlayerLeaderboard = (instance, rest) => {
151
170
  instance.leaderboards = leaderboardsAdapter(rest.data);
152
- instance.currentPlyerRank = rest.data.item ? rest.data.item.rank : -1;
171
+ instance.currentPlayerRank = rest.data.item ? rest.data.item.rank : -1;
153
172
  };
154
173
  /*
155
174
  * update tournament info, include status, name or duration change
156
175
  */
157
176
  const updateTournamentListByItem = (instance, tournament) => {
177
+ const newTournament = tournamentAdapter(tournament);
178
+ if (instance.tournamentItem.id === tournament.id) {
179
+ instance.tournamentItem = Object.assign({}, updateTournament(instance.tournamentItem, newTournament));
180
+ }
158
181
  instance.tournamentList = instance.tournamentList.map((_tournament) => {
159
182
  if (_tournament.id === tournament.id) {
160
- return tournamentAdapter(tournament);
183
+ return Object.assign({}, updateTournament(_tournament, newTournament));
161
184
  }
162
185
  else {
163
186
  return _tournament;
@@ -168,8 +191,8 @@ const removeTournament = (instance, tournament) => {
168
191
  instance.tournamentList = instance.tournamentList.filter((_tournament) => _tournament.id !== tournament.id);
169
192
  };
170
193
  const updateOrAddTournamentToList = (instance, tournament) => {
171
- const index = instance.tournamentList.findIndex((_tournament) => _tournament.id === tournament.id);
172
- if (index === -1) {
194
+ const index = instance.tournamentList.findIndex(_tournament => _tournament.id === tournament.id);
195
+ if (index === -1) { //not found in list, handle it as new tournament
173
196
  instance.tournamentList = [
174
197
  tournamentAdapter(tournament),
175
198
  ...instance.tournamentList
@@ -180,3 +203,57 @@ const updateOrAddTournamentToList = (instance, tournament) => {
180
203
  instance.tournamentList = [...instance.tournamentList];
181
204
  }
182
205
  };
206
+ const updateTournamentInfo = (instance, rest) => {
207
+ try {
208
+ const updateMessageObj = JSON.parse(rest.data.Message);
209
+ updateTournamentListByItem(instance, updateMessageObj);
210
+ }
211
+ catch (e) {
212
+ console.error('Exception when parse Player Tournament Info', e);
213
+ }
214
+ };
215
+ const updatePlayerRewardInfo = (instance, rest) => {
216
+ try {
217
+ const updateMessageObj = JSON.parse(rest.data.Message);
218
+ const assignFailedRewards = updateMessageObj.rewards.filter(item => item.status && item.status !== 'success')
219
+ .map(reward => getRewardNameByType(reward)).join(',');
220
+ const assignedRewards = updateMessageObj.rewards.filter(item => !!item.assigned && item.status === 'success')
221
+ .map(reward => getRewardNameByType(reward)).join(',');
222
+ if (assignFailedRewards.length) {
223
+ instance.gifts = [{ name: null, failedRewards: assignFailedRewards }, ...instance.gifts];
224
+ }
225
+ if (assignedRewards.length) {
226
+ instance.gifts = [{ name: assignedRewards }, ...instance.gifts];
227
+ }
228
+ instance.checkGift();
229
+ }
230
+ catch (e) {
231
+ console.error('Exception when parse Player LeaderboardFinalize info', e);
232
+ }
233
+ };
234
+ const updateLeaderboardInfo = (instance, rest) => {
235
+ var _a;
236
+ try {
237
+ const updateMessageObj = JSON.parse(rest.data.Message);
238
+ const { PlayerLeaderBoard, TournamentId, TournamentLeaderBoardDto } = updateMessageObj;
239
+ //update user rank in UI-bar by parsing PlayerLeaderboard
240
+ if (PlayerLeaderBoard) {
241
+ window.postMessage({ type: 'UpdateLeaderboardState',
242
+ rank: `${PlayerLeaderBoard.rank} / ${TournamentLeaderBoardDto.totalRecords}`,
243
+ detail: {
244
+ playerRank: PlayerLeaderBoard.rank,
245
+ total: TournamentLeaderBoardDto.totalRecords
246
+ }
247
+ });
248
+ }
249
+ if (((_a = instance.tournamentItem) === null || _a === void 0 ? void 0 : _a.id) == TournamentId) {
250
+ initPlayerLeaderboard(instance, { data: {
251
+ item: Object.assign({}, PlayerLeaderBoard),
252
+ items: [...TournamentLeaderBoardDto.players]
253
+ } });
254
+ }
255
+ }
256
+ catch (err) {
257
+ console.error('Exception when parse live update info, ', err);
258
+ }
259
+ };
@@ -15,13 +15,16 @@ export const localePostprocess = (translationText, props) => {
15
15
  });
16
16
  return translationText;
17
17
  };
18
- export 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: {
18
+ export 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', Places: 'places', Prizes: 'Rewards', LeaderboardDetails: 'Leaderboard Details', UnjoinDialog: {
19
19
  Title: 'Quit Leaderboard?',
20
20
  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?',
21
21
  ButtonYes: 'Yes, I want to quit leaderboard',
22
22
  ButtonNo: 'No, Stay on the leaderboard'
23
23
  }, WinDialog: {
24
- Tile: 'Congratulations!',
25
- Description: 'You won <span>{tournamentName}</span>!',
26
- ButtonContinue: 'Continue'
27
- }, 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.', TournamentNotStarted: 'The leaderboard is not started yet. <br> It will start in {startTime}.', BeOne: 'No winners for the time being. Be one of them!', FailedToJoin: 'Oops! some unexpected error happened, please try it again.', FailedToUnjoin: 'Oops! some unexpected error happened, please try it again.' });
24
+ Title: 'Congratulations!',
25
+ Description: 'You won <span>{rewards}</span>!',
26
+ ButtonContinue: 'Continue',
27
+ FailedTitle: 'Reward cannot be issued',
28
+ FailedDescription: 'Please contact support.',
29
+ FailedButtonContinue: 'Ok, continue',
30
+ }, 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>', TipPrizeWithoutReward: 'You took <span>{place}</span> place</span>', Tip: 'Competition where your real money bets contribute towards the leaderboard score calculation to win the leaderboard reward.', TournamentNotStarted: 'The leaderboard is not started yet. <br> It will start in {startTime}.', BeOne: 'No winners for the time being. Be one of them!', FailedToJoin: 'Oops! some unexpected error happened, please try it again.', FailedToUnjoin: 'Oops! some unexpected error happened, please try it again.' });
@@ -10,6 +10,14 @@ export var TournamentState;
10
10
  TournamentState["Closed"] = "Closed";
11
11
  TournamentState["Closing"] = "Closing";
12
12
  })(TournamentState || (TournamentState = {}));
13
+ export var RewardType;
14
+ (function (RewardType) {
15
+ RewardType["FreeSpin"] = "FreeSpin";
16
+ RewardType["Mission"] = "Challenge";
17
+ RewardType["Leaderboard"] = "TournamentTicket";
18
+ RewardType["Custom"] = "Custom";
19
+ RewardType["LuckyWheel"] = "PrizeEngine";
20
+ })(RewardType || (RewardType = {}));
13
21
  export var DialogType;
14
22
  (function (DialogType) {
15
23
  DialogType["unjoin"] = "unjoin";
@@ -37,12 +37,13 @@ export function getProgress(startDate, endDate) {
37
37
  if (new Date().getTime() >= endDate.getTime()) {
38
38
  return 100;
39
39
  }
40
- return ((100 * (new Date().getTime() - startDate.getTime())) / (endDate.getTime() - startDate.getTime())).toFixed(0);
40
+ return Math.floor((100 * (new Date().getTime() - startDate.getTime())) / (endDate.getTime() - startDate.getTime()));
41
41
  }
42
- export function getTimeDifference(startDate, endDate) {
42
+ export function getTimeDifference(startDate, endDate, progress = 0) {
43
43
  const diffMs = Math.abs(endDate.getTime() - startDate.getTime()); // Difference in milliseconds
44
44
  const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); // Difference in days
45
45
  const diffHours = Math.floor((diffMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); // Remaining hours
46
46
  const diffMinutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60)); // Remaining minutes
47
- return `${String(diffDays).padStart(2, '0')}d:${String(diffHours).padStart(2, '0')}h:${String(diffMinutes).padStart(2, '0')}m`;
47
+ const min = progress === 100 ? 0 : diffMinutes === 0 ? 1 : diffMinutes;
48
+ return `${String(diffDays).padStart(2, '0')}d:${String(diffHours).padStart(2, '0')}h:${String(min).padStart(2, '0')}m`;
48
49
  }
@@ -17,8 +17,7 @@ export const classnames = (...args) => {
17
17
  return classnameArray.join(' ');
18
18
  };
19
19
  export const getNewItems = (newList, oldList, getCondition) => {
20
- const newItems = newList.filter((newItem) => !oldList.some((oldItem) => getCondition(newItem, oldItem)));
21
- return newItems;
20
+ return newList.filter(newItem => !oldList.some(oldItem => getCondition(newItem, oldItem)));
22
21
  };
23
22
  /**
24
23
  * Truncate number to specified decimal places (without rounding)
@@ -85,3 +84,7 @@ export const getDevicePlatform = () => {
85
84
  }
86
85
  }
87
86
  };
87
+ export function getScreenOrientation() {
88
+ const orientation = window.screen.orientation.type;
89
+ return orientation.includes('portrait') ? 'Portrait' : 'Landscape';
90
+ }
@@ -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, 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';
2
+ import { T as TRANSLATIONS, c as classnames, D as DialogType, i as isTournamentEnded, r as renderGradientRoundedButton, L as LeaderboardPage, g as getProgress, a as getTimeDifference, f as formatDate } from './casino-engagement-suite-tournament-61d378cd.js';
3
+ export { C as casino_engagement_suite_tournament } from './casino-engagement-suite-tournament-61d378cd.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;
@@ -146,6 +146,7 @@ const CasinoEngagementSuiteTournamentItem = class {
146
146
  this.clickToTournamentDetail = createEvent(this, "clickToTournamentDetail", 7);
147
147
  this.tournament = undefined;
148
148
  this.isNew = undefined;
149
+ this.tid = undefined;
149
150
  this.locale = TRANSLATIONS;
150
151
  }
151
152
  goToDetail() {
@@ -159,7 +160,7 @@ const CasinoEngagementSuiteTournamentItem = class {
159
160
  }
160
161
  render() {
161
162
  const tournament = this.tournament;
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"))))));
163
+ return (h("div", { key: 'e4c39f94b5574dc67c1f76d16f21b680db8dbf6c', class: classnames('LeaderboardsItem', tournament.isPlayerAcknowledged ? ' GradientRounded Hollow' : '', tournament.isUnjoined ? 'Unjoined' : ''), onClick: this.goToDetail.bind(this) }, h("div", { key: 'ed40bbbadbe4a216981f0cc0891476c3788c456f', class: "LeaderboardsItemContainer" }, h("tournament-item-title", { key: '655d965507d60b5a90a66b5cf1b20ff744ab7115', tournament: tournament }), h("tournament-timer", { key: 'b6b597921994640725dd57e7991b38604702ba0d', tournament: tournament })), h("div", { key: '1cc278a8ab8faa750427f4dce15140117732d5a1', class: "LeaderboardLabels" }, this.isNew && (h("div", { key: 'b14172c01cc9b930a439113357e630edd0713eae', class: "LeaderboardLabel" }, h("span", { key: 'ab763183adf551c34a749ae39c1719160387a816' }, "new"))))));
163
164
  }
164
165
  };
165
166
 
@@ -192,7 +193,7 @@ const CasinoEngagementSuiteTournamentItemTitle = class {
192
193
  this.isButtonDisabed = this.tournament.isActionJoinPending === true;
193
194
  }
194
195
  render() {
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({
196
+ return (h("div", { key: 'cf8c4dc0cba0ebd8e1da43a32af618d79972f669', class: "TitleContainer" }, h("div", { key: '1707346e5ef14b1379d8a0691f11a425a16f1c13', class: "Title" }, this.tournament.nameOrTitle), !isTournamentEnded(this.tournament) && (h("div", { key: '78a0c86a56fa2b145bb5e7106df441fe6deb116e' }, renderGradientRoundedButton({
196
197
  statedClasses: {
197
198
  isHollow: this.tournament.isPlayerAcknowledged,
198
199
  isPending: this.isButtonDisabed
@@ -224,14 +225,14 @@ const CasinoEngagementSuiteTournamentTimer = class {
224
225
  (event.detail.page === LeaderboardPage.item && this.isDetail);
225
226
  }
226
227
  componentWillLoad() {
227
- this.lastTimeDiff = getTimeDifference(new Date(), this.tournament.endTime);
228
228
  this.lastProgress = getProgress(this.tournament.startTime, this.tournament.endTime);
229
+ this.lastTimeDiff = getTimeDifference(new Date(), this.tournament.endTime, this.lastProgress);
229
230
  }
230
231
  setTimeInterval() {
231
232
  this.timeHolder = setInterval(() => {
232
- const timeDifference = getTimeDifference(new Date(), this.tournament.endTime);
233
233
  const progress = getProgress(this.tournament.startTime, this.tournament.endTime);
234
- if (this.timeClock && !isTournamentClosed(this.tournament) &&
234
+ const timeDifference = getTimeDifference(new Date(), this.tournament.endTime, progress);
235
+ if (this.timeClock && !isTournamentEnded(this.tournament) &&
235
236
  (timeDifference != this.lastTimeDiff || progress != this.lastProgress)) {
236
237
  this.lastProgress = progress;
237
238
  this.lastTimeDiff = timeDifference;
@@ -245,15 +246,15 @@ const CasinoEngagementSuiteTournamentTimer = class {
245
246
  clearInterval(this.timeHolder);
246
247
  }
247
248
  render() {
248
- return h("section", { key: '8fafe729af2bd66b5ac0e980564051069f677531', class: "TimeContainer" }, h("div", { key: '8279572700e24d3f1094809dae6e3b5d1b02c37b', class: "Time" }, this.tournament.state === 'Running'
249
+ return h("section", { key: '11426165a8f384d97f2b0158f7435f80ac0965a2', class: "TimeContainer" }, h("div", { key: 'b86c8a42a73b358fcc855a853cb322d1d314471a', class: "Time" }, this.tournament.state === 'Running'
249
250
  ? h("div", { class: "Running" }, h("div", null, this.lastTimeDiff), h("div", null, renderGradientRoundedButton({
250
251
  statedClasses: {
251
252
  isHollow: true,
252
- isPendding: false
253
+ isPending: !!this.tournament.isActionJoinPending
253
254
  },
254
- innerHTML: `${getProgress(this.tournament.startTime, this.tournament.endTime)}%`
255
+ innerHTML: `${this.lastProgress}%`
255
256
  })))
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 }));
257
+ : [h("div", { class: "NotRunning" }, formatDate(this.tournament.startTime)), h("div", null, formatDate(this.tournament.endTime))]), h("casino-engagement-suite-progress-bar", { key: '7f98e88679f30d0a0737d94ee806b1d92800b6a3', indeterminate: false, value: Number(this.lastProgress >= 100 ? 100 : this.lastProgress), "hide-percent": true }));
257
258
  }
258
259
  };
259
260