@everymatrix/casino-challenge-card 1.80.12 → 1.80.14
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-challenge-card/casino-challenge-card-717c8962.js +1 -0
- package/dist/casino-challenge-card/casino-challenge-card.entry.js +1 -1
- package/dist/casino-challenge-card/casino-challenge-card.esm.js +1 -1
- package/dist/casino-challenge-card/index.esm.js +1 -1
- package/dist/cjs/{casino-challenge-card-fef3e7a5.js → casino-challenge-card-7eb0b03d.js} +81 -56
- package/dist/cjs/casino-challenge-card.cjs.entry.js +1 -1
- package/dist/cjs/casino-challenge-card.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-challenge-card/casino-challenge-card.js +58 -45
- package/dist/collection/utils/locale.utils.js +5 -0
- package/dist/collection/utils/types.js +21 -13
- package/dist/esm/{casino-challenge-card-e913c3f8.js → casino-challenge-card-717c8962.js} +81 -56
- package/dist/esm/casino-challenge-card.entry.js +1 -1
- package/dist/esm/casino-challenge-card.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/casino-challenge-card/casino-challenge-card.d.ts +2 -1
- package/dist/types/utils/types.d.ts +16 -8
- package/package.json +1 -1
- package/dist/casino-challenge-card/casino-challenge-card-e913c3f8.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { resolveTranslationUrl, translate } from "../../utils/locale.utils";
|
|
3
|
-
import { ChallengeStatusDictionary, EChallengeLevelTargetType, EChallengeProgressStatus, EChallengeStatus } from "../../utils/types";
|
|
3
|
+
import { ChallengeStatusDictionary, EChallengeLevelTargetType, EChallengeProgressLevelStatus, EChallengeProgressStatus, EChallengeStatus } from "../../utils/types";
|
|
4
4
|
import { getTimeLeft } from "../../utils/utils";
|
|
5
5
|
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
6
6
|
import finishIcon from "../../assets/finish.svg";
|
|
@@ -11,16 +11,21 @@ export class CasinoChallengeCard {
|
|
|
11
11
|
var _a;
|
|
12
12
|
if (!level)
|
|
13
13
|
return '';
|
|
14
|
-
const minbet = ((_a = level.BetRange) === null || _a === void 0 ? void 0 : _a.MinBet)
|
|
15
|
-
? `, ${translate('minBet', this.language)} ${currencySymbol + level.BetRange.MinBet}`
|
|
16
|
-
: '';
|
|
17
14
|
switch (level.LevelTargetType) {
|
|
18
|
-
case EChallengeLevelTargetType.Accumulative:
|
|
15
|
+
case EChallengeLevelTargetType.Accumulative: {
|
|
16
|
+
const minbet = ((_a = level.BetRange) === null || _a === void 0 ? void 0 : _a.MinBet)
|
|
17
|
+
? `, ${translate('minBet', this.language)} ${currencySymbol + level.BetRange.MinBet}`
|
|
18
|
+
: '';
|
|
19
19
|
return `${translate('placeBetsOf', this.language)} ${currencySymbol + level.DisplayCurrencyTargetTurnover + minbet}`;
|
|
20
|
+
}
|
|
20
21
|
case EChallengeLevelTargetType.SingleBet:
|
|
21
22
|
return `${translate('place', this.language)} ${currencySymbol + level.TargetTurnover} ${translate('bet', this.language)}`;
|
|
22
|
-
case EChallengeLevelTargetType.MultipleOneBetSize:
|
|
23
|
+
case EChallengeLevelTargetType.MultipleOneBetSize: {
|
|
24
|
+
const minbet = level.TargetTurnover
|
|
25
|
+
? `, ${translate('minBet', this.language)} ${currencySymbol + level.TargetTurnover}`
|
|
26
|
+
: '';
|
|
23
27
|
return `${translate('place', this.language)} ${level.TargetBetCount} ${translate('bets', this.language) + minbet}`;
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
};
|
|
26
31
|
this.onMouseEnterHandler = (index, el) => {
|
|
@@ -32,14 +37,17 @@ export class CasinoChallengeCard {
|
|
|
32
37
|
this.tooltipIndex = null;
|
|
33
38
|
};
|
|
34
39
|
this.getBadgeContent = () => {
|
|
40
|
+
if (this.isChallengePaused) {
|
|
41
|
+
return translate('unavailable', this.language);
|
|
42
|
+
}
|
|
35
43
|
switch (this.challenge.Status) {
|
|
36
|
-
case
|
|
44
|
+
case EChallengeProgressStatus.Expired:
|
|
37
45
|
return translate('expired', this.language);
|
|
38
|
-
case
|
|
46
|
+
case EChallengeProgressStatus.Forfeited:
|
|
39
47
|
return translate('forfeited', this.language);
|
|
40
|
-
case
|
|
48
|
+
case EChallengeProgressStatus.Completed:
|
|
41
49
|
return translate('finished', this.language);
|
|
42
|
-
case
|
|
50
|
+
case EChallengeProgressStatus.Paused:
|
|
43
51
|
return translate('suspended', this.language);
|
|
44
52
|
default:
|
|
45
53
|
return this.timeLeft
|
|
@@ -47,11 +55,11 @@ export class CasinoChallengeCard {
|
|
|
47
55
|
: translate('expired', this.language);
|
|
48
56
|
}
|
|
49
57
|
};
|
|
50
|
-
this.goToDetailsPage = (
|
|
58
|
+
this.goToDetailsPage = () => {
|
|
51
59
|
window.postMessage({
|
|
52
60
|
type: 'GoToDetailsPage',
|
|
53
61
|
info: {
|
|
54
|
-
challengeId:
|
|
62
|
+
challengeId: this.challenge.ChallengeId,
|
|
55
63
|
activeTabIndex: this.activeTabIndex
|
|
56
64
|
}
|
|
57
65
|
}, window.location.href);
|
|
@@ -81,28 +89,28 @@ export class CasinoChallengeCard {
|
|
|
81
89
|
this.error = '';
|
|
82
90
|
this.hasError = false;
|
|
83
91
|
this.actionLoading = false;
|
|
92
|
+
this.isChallengePaused = false;
|
|
84
93
|
}
|
|
85
94
|
get infoItems() {
|
|
86
|
-
var _a, _b, _c, _d, _e
|
|
95
|
+
var _a, _b, _c, _d, _e;
|
|
87
96
|
let level = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.OrderNumber === 0);
|
|
88
97
|
if (this.isUserAuthorized) {
|
|
89
98
|
level =
|
|
90
|
-
(_c = (_b = this.challenge) === null || _b === void 0 ? void 0 : _b.LevelProgresses.find((x) => x.ProgressStatus ===
|
|
99
|
+
(_c = (_b = this.challenge) === null || _b === void 0 ? void 0 : _b.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressLevelStatus.InProgress)) !== null && _c !== void 0 ? _c : level;
|
|
91
100
|
}
|
|
92
101
|
if (level) {
|
|
93
|
-
const rewardValue = (_d = level.Rewards) === null || _d === void 0 ? void 0 : _d.slice(0, 2).map((r) => r.RewardDescription).join(' + ');
|
|
94
102
|
return [
|
|
95
103
|
{
|
|
96
104
|
lable: translate('totalLevels', this.language),
|
|
97
|
-
value: ((
|
|
105
|
+
value: ((_d = this.challenge.LevelProgresses) === null || _d === void 0 ? void 0 : _d.length) || '-'
|
|
98
106
|
},
|
|
99
107
|
{
|
|
100
108
|
lable: translate('level1', this.language),
|
|
101
|
-
value: this.calculateTargetValue(level, (
|
|
109
|
+
value: this.calculateTargetValue(level, (_e = this.challenge) === null || _e === void 0 ? void 0 : _e.CurrencySymbol) || '-'
|
|
102
110
|
},
|
|
103
111
|
{
|
|
104
112
|
lable: translate('get', this.language),
|
|
105
|
-
value:
|
|
113
|
+
value: level.CustomRewardMessage || '-'
|
|
106
114
|
}
|
|
107
115
|
];
|
|
108
116
|
}
|
|
@@ -135,6 +143,7 @@ export class CasinoChallengeCard {
|
|
|
135
143
|
this.updateTime();
|
|
136
144
|
}
|
|
137
145
|
componentDidLoad() {
|
|
146
|
+
this.isChallengePaused = this.challenge.ChallengeStatus === EChallengeStatus.Paused;
|
|
138
147
|
if (this.stylingContainer) {
|
|
139
148
|
if (this.mbSource)
|
|
140
149
|
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
@@ -155,7 +164,7 @@ export class CasinoChallengeCard {
|
|
|
155
164
|
this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
|
|
156
165
|
if (!this.timeLeft && this.timerExpired) {
|
|
157
166
|
clearInterval(this.timerId);
|
|
158
|
-
this.challenge.Status =
|
|
167
|
+
this.challenge.Status = EChallengeProgressStatus.Expired;
|
|
159
168
|
this.timerExpired.emit(this.challenge.Id);
|
|
160
169
|
}
|
|
161
170
|
}
|
|
@@ -163,68 +172,71 @@ export class CasinoChallengeCard {
|
|
|
163
172
|
return (h("div", { class: `info-item ${this.isChallengeGrayed}`, onMouseEnter: (e) => this.onMouseEnterHandler(index, e.currentTarget), onMouseLeave: this.onMouseLeaveHandler }, h("span", { class: "info-item__label" }, item.lable), item.value, this.tooltipIndex === index && h("div", { class: "info-item__tooltip" }, item.value)));
|
|
164
173
|
}
|
|
165
174
|
get getCardBadge() {
|
|
166
|
-
return (h("div", { class: `card__badge ${
|
|
175
|
+
return (h("div", { class: `card__badge ${this.isChallengePaused
|
|
176
|
+
? ChallengeStatusDictionary[EChallengeProgressStatus.Expired]
|
|
177
|
+
: ChallengeStatusDictionary[this.challenge.Status]}` }, this.getBadgeContent()));
|
|
167
178
|
}
|
|
168
179
|
get isChallengeGrayed() {
|
|
169
|
-
return [
|
|
180
|
+
return [
|
|
181
|
+
EChallengeProgressStatus.Expired,
|
|
182
|
+
EChallengeProgressStatus.Forfeited,
|
|
183
|
+
EChallengeProgressStatus.Completed
|
|
184
|
+
].includes(this.challenge.Status) || this.isChallengePaused
|
|
170
185
|
? 'grayed'
|
|
171
186
|
: '';
|
|
172
187
|
}
|
|
173
188
|
get getChallengeProgress() {
|
|
174
189
|
var _a;
|
|
175
|
-
const currLevel = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus ===
|
|
176
|
-
if (!this.isUserAuthorized || !currLevel)
|
|
190
|
+
const currLevel = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressLevelStatus.InProgress);
|
|
191
|
+
if (this.isChallengePaused || !this.isUserAuthorized || !currLevel)
|
|
177
192
|
return null;
|
|
178
193
|
const { Status, LevelProgresses } = this.challenge;
|
|
179
|
-
if (Status ===
|
|
194
|
+
if (Status === EChallengeProgressStatus.Expired || Status === EChallengeProgressStatus.Started) {
|
|
180
195
|
return h("div", { class: "progress__placeholder" });
|
|
181
196
|
}
|
|
182
|
-
const barValue = Status ===
|
|
197
|
+
const barValue = Status === EChallengeProgressStatus.Paused
|
|
183
198
|
? translate('suspended', this.language)
|
|
184
|
-
: Status ===
|
|
199
|
+
: Status === EChallengeProgressStatus.Completed
|
|
185
200
|
? translate('finished', this.language)
|
|
186
201
|
: `${currLevel.ProgressPercentage}%`;
|
|
187
202
|
const isLastLevel = !LevelProgresses.some((x) => x.OrderNumber > currLevel.OrderNumber);
|
|
188
|
-
const secondImgSrc = Status ===
|
|
203
|
+
const secondImgSrc = Status === EChallengeProgressStatus.Completed ? trophyIcon : isLastLevel ? finishIcon : '';
|
|
189
204
|
return (h("div", { class: {
|
|
190
205
|
progress: true,
|
|
191
|
-
paused: Status ===
|
|
192
|
-
grayed: Status ===
|
|
206
|
+
paused: Status === EChallengeProgressStatus.Paused,
|
|
207
|
+
grayed: Status === EChallengeProgressStatus.Forfeited
|
|
193
208
|
} }, h("div", { class: {
|
|
194
209
|
progress__point: true,
|
|
195
210
|
start: true,
|
|
196
|
-
hidden: Status ===
|
|
211
|
+
hidden: Status === EChallengeProgressStatus.Completed
|
|
197
212
|
} }, currLevel.OrderNumber + 1), h("div", { class: {
|
|
198
213
|
progress__bar: true,
|
|
199
|
-
finished: Status ===
|
|
214
|
+
finished: Status === EChallengeProgressStatus.Completed
|
|
200
215
|
}, style: { width: `${currLevel.ProgressPercentage}%` } }, barValue), h("div", { class: {
|
|
201
216
|
progress__point: true,
|
|
202
217
|
end: true,
|
|
203
|
-
finished: Status ===
|
|
218
|
+
finished: Status === EChallengeProgressStatus.Completed
|
|
204
219
|
} }, secondImgSrc ? h("img", { class: "progress__icon", src: secondImgSrc }) : currLevel.OrderNumber + 2)));
|
|
205
220
|
}
|
|
206
221
|
get getCardButton() {
|
|
207
|
-
if (this.isUserAuthorized) {
|
|
208
|
-
if (this.challenge.Status ===
|
|
222
|
+
if (this.isUserAuthorized && !this.isChallengePaused) {
|
|
223
|
+
if (this.challenge.Status === EChallengeProgressStatus.Started) {
|
|
209
224
|
return (h("button", { class: "card__button filled", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(true) }, translate('start', this.language)));
|
|
210
225
|
}
|
|
211
|
-
if (this.challenge.Status ===
|
|
226
|
+
if (this.challenge.Status === EChallengeProgressStatus.Paused) {
|
|
212
227
|
return (h("button", { class: "card__button grayed", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(true) }, translate('resume', this.language)));
|
|
213
228
|
}
|
|
214
|
-
if (this.challenge.Status ===
|
|
215
|
-
this.challenge.Status ===
|
|
229
|
+
if (this.challenge.Status === EChallengeProgressStatus.InProgress ||
|
|
230
|
+
this.challenge.Status === EChallengeProgressStatus.PendingLevelReward) {
|
|
216
231
|
return (h("button", { class: "card__button grayed", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(false) }, translate('pause', this.language)));
|
|
217
232
|
}
|
|
218
233
|
}
|
|
219
|
-
|
|
220
|
-
return (h("button", { class: "card__button", onClick: this.goToDetailsPage(detailsId) }, translate('viewDetails', this.language)));
|
|
234
|
+
return h("button", { class: "card__button" }, translate('viewDetails', this.language));
|
|
221
235
|
}
|
|
222
236
|
async joinUnjoinProgress(join) {
|
|
223
|
-
|
|
224
|
-
const progress = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressStatus.InProgress);
|
|
225
|
-
if (!this.checkAttrs()) {
|
|
237
|
+
if (!this.checkAttrs() && this.challenge) {
|
|
226
238
|
const url = `${this.endpoint}/challenge/ChangeProgressStatus`;
|
|
227
|
-
const body = Object.assign(Object.assign(Object.assign({ DomainId: this.domain }, (this.session && { PlayerSessionId: this.session })), (this.userId && { InternalUserId: this.userId })), (join ? { ProgressToActivate:
|
|
239
|
+
const body = Object.assign(Object.assign(Object.assign({ DomainId: this.domain }, (this.session && { PlayerSessionId: this.session })), (this.userId && { InternalUserId: this.userId })), (join ? { ProgressToActivate: this.challenge.Id } : { ProgressToDeactivate: this.challenge.Id }));
|
|
228
240
|
this.actionLoading = true;
|
|
229
241
|
return fetch(url, {
|
|
230
242
|
method: 'POST',
|
|
@@ -242,7 +254,7 @@ export class CasinoChallengeCard {
|
|
|
242
254
|
}
|
|
243
255
|
render() {
|
|
244
256
|
var _a, _b, _c, _d;
|
|
245
|
-
return (h("div", { key: '
|
|
257
|
+
return (h("div", { key: '9e7fac60f8b832183578ec00e6e88e37ab4a4d41', ref: (el) => (this.stylingContainer = el) }, h("div", { key: 'a044740c3586e9151dfe38c50c51ada830622316', class: "card", onClick: this.goToDetailsPage }, h("img", { key: '25dd98c358074160ad4f32241deb5f99c30829ed', class: `card__image ${this.isChallengeGrayed}`, src: (_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ChallengePresentation) === null || _b === void 0 ? void 0 : _b.BannerUrl }), this.getCardBadge, this.challenge.IsNew && this.renderNewLabel(), h("div", { key: '9236700fe41744ccfd78d16364dfb49eff350926', class: "card__content" }, h("h1", { key: 'c4207cf505d6fa57ab61dd4142c7bcfccc981a02', class: "card__title" }, (_d = (_c = this.challenge) === null || _c === void 0 ? void 0 : _c.ChallengePresentation) === null || _d === void 0 ? void 0 : _d.PresentationName), this.getChallengeProgress, this.infoItems.map((x, index) => this.renderInfoItem(x, index)), this.getCardButton))));
|
|
246
258
|
}
|
|
247
259
|
static get is() { return "casino-challenge-card"; }
|
|
248
260
|
static get encapsulation() { return "shadow"; }
|
|
@@ -482,7 +494,8 @@ export class CasinoChallengeCard {
|
|
|
482
494
|
"timeLeft": {},
|
|
483
495
|
"error": {},
|
|
484
496
|
"hasError": {},
|
|
485
|
-
"actionLoading": {}
|
|
497
|
+
"actionLoading": {},
|
|
498
|
+
"isChallengePaused": {}
|
|
486
499
|
};
|
|
487
500
|
}
|
|
488
501
|
static get events() {
|
|
@@ -16,6 +16,7 @@ const TRANSLATIONS = {
|
|
|
16
16
|
forfeited: 'Forfeited',
|
|
17
17
|
finished: 'Finished',
|
|
18
18
|
suspended: 'Suspended',
|
|
19
|
+
unavailable: 'Unavailable',
|
|
19
20
|
start: 'Start',
|
|
20
21
|
resume: 'Resume',
|
|
21
22
|
pause: 'Pause',
|
|
@@ -36,6 +37,7 @@ const TRANSLATIONS = {
|
|
|
36
37
|
forfeited: 'Pierdut',
|
|
37
38
|
finished: 'Terminat',
|
|
38
39
|
suspended: 'Suspendat',
|
|
40
|
+
unavailable: 'Indisponibil',
|
|
39
41
|
start: 'Start',
|
|
40
42
|
resume: 'Reia',
|
|
41
43
|
pause: 'Pauză'
|
|
@@ -55,6 +57,7 @@ const TRANSLATIONS = {
|
|
|
55
57
|
forfeited: 'Forfait',
|
|
56
58
|
finished: 'Terminé',
|
|
57
59
|
suspended: 'Suspendu',
|
|
60
|
+
unavailable: 'Indisponible',
|
|
58
61
|
start: 'Démarrer',
|
|
59
62
|
resume: 'Reprendre',
|
|
60
63
|
pause: 'Pause'
|
|
@@ -74,6 +77,7 @@ const TRANSLATIONS = {
|
|
|
74
77
|
forfeited: 'خاسر',
|
|
75
78
|
finished: 'منتهي',
|
|
76
79
|
suspended: 'معلق',
|
|
80
|
+
unavailable: 'غير متاح',
|
|
77
81
|
start: 'ابدأ',
|
|
78
82
|
resume: 'استئناف',
|
|
79
83
|
pause: 'إيقاف مؤقت'
|
|
@@ -93,6 +97,7 @@ const TRANSLATIONS = {
|
|
|
93
97
|
forfeited: 'Oduzeto',
|
|
94
98
|
finished: 'Završeno',
|
|
95
99
|
suspended: 'Suspendirano',
|
|
100
|
+
unavailable: 'غير متاح',
|
|
96
101
|
start: 'Počni',
|
|
97
102
|
resume: 'Nastavi',
|
|
98
103
|
pause: 'Pauza'
|
|
@@ -19,24 +19,32 @@ export var EChallengeRewardType;
|
|
|
19
19
|
EChallengeRewardType[EChallengeRewardType["Challenge"] = 3] = "Challenge";
|
|
20
20
|
EChallengeRewardType[EChallengeRewardType["Custom"] = 4] = "Custom";
|
|
21
21
|
})(EChallengeRewardType || (EChallengeRewardType = {}));
|
|
22
|
+
export var EChallengeStatus;
|
|
23
|
+
(function (EChallengeStatus) {
|
|
24
|
+
EChallengeStatus[EChallengeStatus["Draft"] = 0] = "Draft";
|
|
25
|
+
EChallengeStatus[EChallengeStatus["Enabled"] = 1] = "Enabled";
|
|
26
|
+
EChallengeStatus[EChallengeStatus["Paused"] = 2] = "Paused";
|
|
27
|
+
EChallengeStatus[EChallengeStatus["Closed"] = 3] = "Closed";
|
|
28
|
+
EChallengeStatus[EChallengeStatus["Deleted"] = 4] = "Deleted";
|
|
29
|
+
})(EChallengeStatus || (EChallengeStatus = {}));
|
|
22
30
|
export var EChallengeProgressStatus;
|
|
23
31
|
(function (EChallengeProgressStatus) {
|
|
24
|
-
EChallengeProgressStatus[EChallengeProgressStatus["
|
|
32
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Started"] = 0] = "Started";
|
|
25
33
|
EChallengeProgressStatus[EChallengeProgressStatus["InProgress"] = 1] = "InProgress";
|
|
26
|
-
EChallengeProgressStatus[EChallengeProgressStatus["
|
|
34
|
+
EChallengeProgressStatus[EChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
|
|
27
35
|
EChallengeProgressStatus[EChallengeProgressStatus["Completed"] = 3] = "Completed";
|
|
36
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Expired"] = 4] = "Expired";
|
|
37
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Forfeited"] = 5] = "Forfeited";
|
|
38
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Awaiting"] = 6] = "Awaiting";
|
|
39
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Paused"] = 7] = "Paused";
|
|
28
40
|
})(EChallengeProgressStatus || (EChallengeProgressStatus = {}));
|
|
29
|
-
export var
|
|
30
|
-
(function (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
EChallengeStatus[EChallengeStatus["Forfeited"] = 5] = "Forfeited";
|
|
37
|
-
EChallengeStatus[EChallengeStatus["Awaiting"] = 6] = "Awaiting";
|
|
38
|
-
EChallengeStatus[EChallengeStatus["Paused"] = 7] = "Paused";
|
|
39
|
-
})(EChallengeStatus || (EChallengeStatus = {}));
|
|
41
|
+
export var EChallengeProgressLevelStatus;
|
|
42
|
+
(function (EChallengeProgressLevelStatus) {
|
|
43
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Closed"] = 0] = "Closed";
|
|
44
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["InProgress"] = 1] = "InProgress";
|
|
45
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Fillup"] = 2] = "Fillup";
|
|
46
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Completed"] = 3] = "Completed";
|
|
47
|
+
})(EChallengeProgressLevelStatus || (EChallengeProgressLevelStatus = {}));
|
|
40
48
|
export const ChallengeStatusDictionary = [
|
|
41
49
|
'started',
|
|
42
50
|
'inProgress',
|
|
@@ -18,6 +18,7 @@ const TRANSLATIONS = {
|
|
|
18
18
|
forfeited: 'Forfeited',
|
|
19
19
|
finished: 'Finished',
|
|
20
20
|
suspended: 'Suspended',
|
|
21
|
+
unavailable: 'Unavailable',
|
|
21
22
|
start: 'Start',
|
|
22
23
|
resume: 'Resume',
|
|
23
24
|
pause: 'Pause',
|
|
@@ -38,6 +39,7 @@ const TRANSLATIONS = {
|
|
|
38
39
|
forfeited: 'Pierdut',
|
|
39
40
|
finished: 'Terminat',
|
|
40
41
|
suspended: 'Suspendat',
|
|
42
|
+
unavailable: 'Indisponibil',
|
|
41
43
|
start: 'Start',
|
|
42
44
|
resume: 'Reia',
|
|
43
45
|
pause: 'Pauză'
|
|
@@ -57,6 +59,7 @@ const TRANSLATIONS = {
|
|
|
57
59
|
forfeited: 'Forfait',
|
|
58
60
|
finished: 'Terminé',
|
|
59
61
|
suspended: 'Suspendu',
|
|
62
|
+
unavailable: 'Indisponible',
|
|
60
63
|
start: 'Démarrer',
|
|
61
64
|
resume: 'Reprendre',
|
|
62
65
|
pause: 'Pause'
|
|
@@ -76,6 +79,7 @@ const TRANSLATIONS = {
|
|
|
76
79
|
forfeited: 'خاسر',
|
|
77
80
|
finished: 'منتهي',
|
|
78
81
|
suspended: 'معلق',
|
|
82
|
+
unavailable: 'غير متاح',
|
|
79
83
|
start: 'ابدأ',
|
|
80
84
|
resume: 'استئناف',
|
|
81
85
|
pause: 'إيقاف مؤقت'
|
|
@@ -95,6 +99,7 @@ const TRANSLATIONS = {
|
|
|
95
99
|
forfeited: 'Oduzeto',
|
|
96
100
|
finished: 'Završeno',
|
|
97
101
|
suspended: 'Suspendirano',
|
|
102
|
+
unavailable: 'غير متاح',
|
|
98
103
|
start: 'Počni',
|
|
99
104
|
resume: 'Nastavi',
|
|
100
105
|
pause: 'Pauza'
|
|
@@ -148,24 +153,32 @@ var EChallengeRewardType;
|
|
|
148
153
|
EChallengeRewardType[EChallengeRewardType["Challenge"] = 3] = "Challenge";
|
|
149
154
|
EChallengeRewardType[EChallengeRewardType["Custom"] = 4] = "Custom";
|
|
150
155
|
})(EChallengeRewardType || (EChallengeRewardType = {}));
|
|
156
|
+
var EChallengeStatus;
|
|
157
|
+
(function (EChallengeStatus) {
|
|
158
|
+
EChallengeStatus[EChallengeStatus["Draft"] = 0] = "Draft";
|
|
159
|
+
EChallengeStatus[EChallengeStatus["Enabled"] = 1] = "Enabled";
|
|
160
|
+
EChallengeStatus[EChallengeStatus["Paused"] = 2] = "Paused";
|
|
161
|
+
EChallengeStatus[EChallengeStatus["Closed"] = 3] = "Closed";
|
|
162
|
+
EChallengeStatus[EChallengeStatus["Deleted"] = 4] = "Deleted";
|
|
163
|
+
})(EChallengeStatus || (EChallengeStatus = {}));
|
|
151
164
|
var EChallengeProgressStatus;
|
|
152
165
|
(function (EChallengeProgressStatus) {
|
|
153
|
-
EChallengeProgressStatus[EChallengeProgressStatus["
|
|
166
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Started"] = 0] = "Started";
|
|
154
167
|
EChallengeProgressStatus[EChallengeProgressStatus["InProgress"] = 1] = "InProgress";
|
|
155
|
-
EChallengeProgressStatus[EChallengeProgressStatus["
|
|
168
|
+
EChallengeProgressStatus[EChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
|
|
156
169
|
EChallengeProgressStatus[EChallengeProgressStatus["Completed"] = 3] = "Completed";
|
|
170
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Expired"] = 4] = "Expired";
|
|
171
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Forfeited"] = 5] = "Forfeited";
|
|
172
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Awaiting"] = 6] = "Awaiting";
|
|
173
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Paused"] = 7] = "Paused";
|
|
157
174
|
})(EChallengeProgressStatus || (EChallengeProgressStatus = {}));
|
|
158
|
-
var
|
|
159
|
-
(function (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
EChallengeStatus[EChallengeStatus["Forfeited"] = 5] = "Forfeited";
|
|
166
|
-
EChallengeStatus[EChallengeStatus["Awaiting"] = 6] = "Awaiting";
|
|
167
|
-
EChallengeStatus[EChallengeStatus["Paused"] = 7] = "Paused";
|
|
168
|
-
})(EChallengeStatus || (EChallengeStatus = {}));
|
|
175
|
+
var EChallengeProgressLevelStatus;
|
|
176
|
+
(function (EChallengeProgressLevelStatus) {
|
|
177
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Closed"] = 0] = "Closed";
|
|
178
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["InProgress"] = 1] = "InProgress";
|
|
179
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Fillup"] = 2] = "Fillup";
|
|
180
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Completed"] = 3] = "Completed";
|
|
181
|
+
})(EChallengeProgressLevelStatus || (EChallengeProgressLevelStatus = {}));
|
|
169
182
|
const ChallengeStatusDictionary = [
|
|
170
183
|
'started',
|
|
171
184
|
'inProgress',
|
|
@@ -278,16 +291,21 @@ const CasinoChallengeCard = class {
|
|
|
278
291
|
var _a;
|
|
279
292
|
if (!level)
|
|
280
293
|
return '';
|
|
281
|
-
const minbet = ((_a = level.BetRange) === null || _a === void 0 ? void 0 : _a.MinBet)
|
|
282
|
-
? `, ${translate('minBet', this.language)} ${currencySymbol + level.BetRange.MinBet}`
|
|
283
|
-
: '';
|
|
284
294
|
switch (level.LevelTargetType) {
|
|
285
|
-
case EChallengeLevelTargetType.Accumulative:
|
|
295
|
+
case EChallengeLevelTargetType.Accumulative: {
|
|
296
|
+
const minbet = ((_a = level.BetRange) === null || _a === void 0 ? void 0 : _a.MinBet)
|
|
297
|
+
? `, ${translate('minBet', this.language)} ${currencySymbol + level.BetRange.MinBet}`
|
|
298
|
+
: '';
|
|
286
299
|
return `${translate('placeBetsOf', this.language)} ${currencySymbol + level.DisplayCurrencyTargetTurnover + minbet}`;
|
|
300
|
+
}
|
|
287
301
|
case EChallengeLevelTargetType.SingleBet:
|
|
288
302
|
return `${translate('place', this.language)} ${currencySymbol + level.TargetTurnover} ${translate('bet', this.language)}`;
|
|
289
|
-
case EChallengeLevelTargetType.MultipleOneBetSize:
|
|
303
|
+
case EChallengeLevelTargetType.MultipleOneBetSize: {
|
|
304
|
+
const minbet = level.TargetTurnover
|
|
305
|
+
? `, ${translate('minBet', this.language)} ${currencySymbol + level.TargetTurnover}`
|
|
306
|
+
: '';
|
|
290
307
|
return `${translate('place', this.language)} ${level.TargetBetCount} ${translate('bets', this.language) + minbet}`;
|
|
308
|
+
}
|
|
291
309
|
}
|
|
292
310
|
};
|
|
293
311
|
this.onMouseEnterHandler = (index, el) => {
|
|
@@ -299,14 +317,17 @@ const CasinoChallengeCard = class {
|
|
|
299
317
|
this.tooltipIndex = null;
|
|
300
318
|
};
|
|
301
319
|
this.getBadgeContent = () => {
|
|
320
|
+
if (this.isChallengePaused) {
|
|
321
|
+
return translate('unavailable', this.language);
|
|
322
|
+
}
|
|
302
323
|
switch (this.challenge.Status) {
|
|
303
|
-
case
|
|
324
|
+
case EChallengeProgressStatus.Expired:
|
|
304
325
|
return translate('expired', this.language);
|
|
305
|
-
case
|
|
326
|
+
case EChallengeProgressStatus.Forfeited:
|
|
306
327
|
return translate('forfeited', this.language);
|
|
307
|
-
case
|
|
328
|
+
case EChallengeProgressStatus.Completed:
|
|
308
329
|
return translate('finished', this.language);
|
|
309
|
-
case
|
|
330
|
+
case EChallengeProgressStatus.Paused:
|
|
310
331
|
return translate('suspended', this.language);
|
|
311
332
|
default:
|
|
312
333
|
return this.timeLeft
|
|
@@ -314,11 +335,11 @@ const CasinoChallengeCard = class {
|
|
|
314
335
|
: translate('expired', this.language);
|
|
315
336
|
}
|
|
316
337
|
};
|
|
317
|
-
this.goToDetailsPage = (
|
|
338
|
+
this.goToDetailsPage = () => {
|
|
318
339
|
window.postMessage({
|
|
319
340
|
type: 'GoToDetailsPage',
|
|
320
341
|
info: {
|
|
321
|
-
challengeId:
|
|
342
|
+
challengeId: this.challenge.ChallengeId,
|
|
322
343
|
activeTabIndex: this.activeTabIndex
|
|
323
344
|
}
|
|
324
345
|
}, window.location.href);
|
|
@@ -348,28 +369,28 @@ const CasinoChallengeCard = class {
|
|
|
348
369
|
this.error = '';
|
|
349
370
|
this.hasError = false;
|
|
350
371
|
this.actionLoading = false;
|
|
372
|
+
this.isChallengePaused = false;
|
|
351
373
|
}
|
|
352
374
|
get infoItems() {
|
|
353
|
-
var _a, _b, _c, _d, _e
|
|
375
|
+
var _a, _b, _c, _d, _e;
|
|
354
376
|
let level = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.OrderNumber === 0);
|
|
355
377
|
if (this.isUserAuthorized) {
|
|
356
378
|
level =
|
|
357
|
-
(_c = (_b = this.challenge) === null || _b === void 0 ? void 0 : _b.LevelProgresses.find((x) => x.ProgressStatus ===
|
|
379
|
+
(_c = (_b = this.challenge) === null || _b === void 0 ? void 0 : _b.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressLevelStatus.InProgress)) !== null && _c !== void 0 ? _c : level;
|
|
358
380
|
}
|
|
359
381
|
if (level) {
|
|
360
|
-
const rewardValue = (_d = level.Rewards) === null || _d === void 0 ? void 0 : _d.slice(0, 2).map((r) => r.RewardDescription).join(' + ');
|
|
361
382
|
return [
|
|
362
383
|
{
|
|
363
384
|
lable: translate('totalLevels', this.language),
|
|
364
|
-
value: ((
|
|
385
|
+
value: ((_d = this.challenge.LevelProgresses) === null || _d === void 0 ? void 0 : _d.length) || '-'
|
|
365
386
|
},
|
|
366
387
|
{
|
|
367
388
|
lable: translate('level1', this.language),
|
|
368
|
-
value: this.calculateTargetValue(level, (
|
|
389
|
+
value: this.calculateTargetValue(level, (_e = this.challenge) === null || _e === void 0 ? void 0 : _e.CurrencySymbol) || '-'
|
|
369
390
|
},
|
|
370
391
|
{
|
|
371
392
|
lable: translate('get', this.language),
|
|
372
|
-
value:
|
|
393
|
+
value: level.CustomRewardMessage || '-'
|
|
373
394
|
}
|
|
374
395
|
];
|
|
375
396
|
}
|
|
@@ -402,6 +423,7 @@ const CasinoChallengeCard = class {
|
|
|
402
423
|
this.updateTime();
|
|
403
424
|
}
|
|
404
425
|
componentDidLoad() {
|
|
426
|
+
this.isChallengePaused = this.challenge.ChallengeStatus === EChallengeStatus.Paused;
|
|
405
427
|
if (this.stylingContainer) {
|
|
406
428
|
if (this.mbSource)
|
|
407
429
|
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
@@ -422,7 +444,7 @@ const CasinoChallengeCard = class {
|
|
|
422
444
|
this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
|
|
423
445
|
if (!this.timeLeft && this.timerExpired) {
|
|
424
446
|
clearInterval(this.timerId);
|
|
425
|
-
this.challenge.Status =
|
|
447
|
+
this.challenge.Status = EChallengeProgressStatus.Expired;
|
|
426
448
|
this.timerExpired.emit(this.challenge.Id);
|
|
427
449
|
}
|
|
428
450
|
}
|
|
@@ -430,68 +452,71 @@ const CasinoChallengeCard = class {
|
|
|
430
452
|
return (h("div", { class: `info-item ${this.isChallengeGrayed}`, onMouseEnter: (e) => this.onMouseEnterHandler(index, e.currentTarget), onMouseLeave: this.onMouseLeaveHandler }, h("span", { class: "info-item__label" }, item.lable), item.value, this.tooltipIndex === index && h("div", { class: "info-item__tooltip" }, item.value)));
|
|
431
453
|
}
|
|
432
454
|
get getCardBadge() {
|
|
433
|
-
return (h("div", { class: `card__badge ${
|
|
455
|
+
return (h("div", { class: `card__badge ${this.isChallengePaused
|
|
456
|
+
? ChallengeStatusDictionary[EChallengeProgressStatus.Expired]
|
|
457
|
+
: ChallengeStatusDictionary[this.challenge.Status]}` }, this.getBadgeContent()));
|
|
434
458
|
}
|
|
435
459
|
get isChallengeGrayed() {
|
|
436
|
-
return [
|
|
460
|
+
return [
|
|
461
|
+
EChallengeProgressStatus.Expired,
|
|
462
|
+
EChallengeProgressStatus.Forfeited,
|
|
463
|
+
EChallengeProgressStatus.Completed
|
|
464
|
+
].includes(this.challenge.Status) || this.isChallengePaused
|
|
437
465
|
? 'grayed'
|
|
438
466
|
: '';
|
|
439
467
|
}
|
|
440
468
|
get getChallengeProgress() {
|
|
441
469
|
var _a;
|
|
442
|
-
const currLevel = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus ===
|
|
443
|
-
if (!this.isUserAuthorized || !currLevel)
|
|
470
|
+
const currLevel = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressLevelStatus.InProgress);
|
|
471
|
+
if (this.isChallengePaused || !this.isUserAuthorized || !currLevel)
|
|
444
472
|
return null;
|
|
445
473
|
const { Status, LevelProgresses } = this.challenge;
|
|
446
|
-
if (Status ===
|
|
474
|
+
if (Status === EChallengeProgressStatus.Expired || Status === EChallengeProgressStatus.Started) {
|
|
447
475
|
return h("div", { class: "progress__placeholder" });
|
|
448
476
|
}
|
|
449
|
-
const barValue = Status ===
|
|
477
|
+
const barValue = Status === EChallengeProgressStatus.Paused
|
|
450
478
|
? translate('suspended', this.language)
|
|
451
|
-
: Status ===
|
|
479
|
+
: Status === EChallengeProgressStatus.Completed
|
|
452
480
|
? translate('finished', this.language)
|
|
453
481
|
: `${currLevel.ProgressPercentage}%`;
|
|
454
482
|
const isLastLevel = !LevelProgresses.some((x) => x.OrderNumber > currLevel.OrderNumber);
|
|
455
|
-
const secondImgSrc = Status ===
|
|
483
|
+
const secondImgSrc = Status === EChallengeProgressStatus.Completed ? trophySvg : isLastLevel ? finishSvg : '';
|
|
456
484
|
return (h("div", { class: {
|
|
457
485
|
progress: true,
|
|
458
|
-
paused: Status ===
|
|
459
|
-
grayed: Status ===
|
|
486
|
+
paused: Status === EChallengeProgressStatus.Paused,
|
|
487
|
+
grayed: Status === EChallengeProgressStatus.Forfeited
|
|
460
488
|
} }, h("div", { class: {
|
|
461
489
|
progress__point: true,
|
|
462
490
|
start: true,
|
|
463
|
-
hidden: Status ===
|
|
491
|
+
hidden: Status === EChallengeProgressStatus.Completed
|
|
464
492
|
} }, currLevel.OrderNumber + 1), h("div", { class: {
|
|
465
493
|
progress__bar: true,
|
|
466
|
-
finished: Status ===
|
|
494
|
+
finished: Status === EChallengeProgressStatus.Completed
|
|
467
495
|
}, style: { width: `${currLevel.ProgressPercentage}%` } }, barValue), h("div", { class: {
|
|
468
496
|
progress__point: true,
|
|
469
497
|
end: true,
|
|
470
|
-
finished: Status ===
|
|
498
|
+
finished: Status === EChallengeProgressStatus.Completed
|
|
471
499
|
} }, secondImgSrc ? h("img", { class: "progress__icon", src: secondImgSrc }) : currLevel.OrderNumber + 2)));
|
|
472
500
|
}
|
|
473
501
|
get getCardButton() {
|
|
474
|
-
if (this.isUserAuthorized) {
|
|
475
|
-
if (this.challenge.Status ===
|
|
502
|
+
if (this.isUserAuthorized && !this.isChallengePaused) {
|
|
503
|
+
if (this.challenge.Status === EChallengeProgressStatus.Started) {
|
|
476
504
|
return (h("button", { class: "card__button filled", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(true) }, translate('start', this.language)));
|
|
477
505
|
}
|
|
478
|
-
if (this.challenge.Status ===
|
|
506
|
+
if (this.challenge.Status === EChallengeProgressStatus.Paused) {
|
|
479
507
|
return (h("button", { class: "card__button grayed", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(true) }, translate('resume', this.language)));
|
|
480
508
|
}
|
|
481
|
-
if (this.challenge.Status ===
|
|
482
|
-
this.challenge.Status ===
|
|
509
|
+
if (this.challenge.Status === EChallengeProgressStatus.InProgress ||
|
|
510
|
+
this.challenge.Status === EChallengeProgressStatus.PendingLevelReward) {
|
|
483
511
|
return (h("button", { class: "card__button grayed", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(false) }, translate('pause', this.language)));
|
|
484
512
|
}
|
|
485
513
|
}
|
|
486
|
-
|
|
487
|
-
return (h("button", { class: "card__button", onClick: this.goToDetailsPage(detailsId) }, translate('viewDetails', this.language)));
|
|
514
|
+
return h("button", { class: "card__button" }, translate('viewDetails', this.language));
|
|
488
515
|
}
|
|
489
516
|
async joinUnjoinProgress(join) {
|
|
490
|
-
|
|
491
|
-
const progress = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressStatus.InProgress);
|
|
492
|
-
if (!this.checkAttrs()) {
|
|
517
|
+
if (!this.checkAttrs() && this.challenge) {
|
|
493
518
|
const url = `${this.endpoint}/challenge/ChangeProgressStatus`;
|
|
494
|
-
const body = Object.assign(Object.assign(Object.assign({ DomainId: this.domain }, (this.session && { PlayerSessionId: this.session })), (this.userId && { InternalUserId: this.userId })), (join ? { ProgressToActivate:
|
|
519
|
+
const body = Object.assign(Object.assign(Object.assign({ DomainId: this.domain }, (this.session && { PlayerSessionId: this.session })), (this.userId && { InternalUserId: this.userId })), (join ? { ProgressToActivate: this.challenge.Id } : { ProgressToDeactivate: this.challenge.Id }));
|
|
495
520
|
this.actionLoading = true;
|
|
496
521
|
return fetch(url, {
|
|
497
522
|
method: 'POST',
|
|
@@ -509,7 +534,7 @@ const CasinoChallengeCard = class {
|
|
|
509
534
|
}
|
|
510
535
|
render() {
|
|
511
536
|
var _a, _b, _c, _d;
|
|
512
|
-
return (h("div", { key: '
|
|
537
|
+
return (h("div", { key: '9e7fac60f8b832183578ec00e6e88e37ab4a4d41', ref: (el) => (this.stylingContainer = el) }, h("div", { key: 'a044740c3586e9151dfe38c50c51ada830622316', class: "card", onClick: this.goToDetailsPage }, h("img", { key: '25dd98c358074160ad4f32241deb5f99c30829ed', class: `card__image ${this.isChallengeGrayed}`, src: (_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ChallengePresentation) === null || _b === void 0 ? void 0 : _b.BannerUrl }), this.getCardBadge, this.challenge.IsNew && this.renderNewLabel(), h("div", { key: '9236700fe41744ccfd78d16364dfb49eff350926', class: "card__content" }, h("h1", { key: 'c4207cf505d6fa57ab61dd4142c7bcfccc981a02', class: "card__title" }, (_d = (_c = this.challenge) === null || _c === void 0 ? void 0 : _c.ChallengePresentation) === null || _d === void 0 ? void 0 : _d.PresentationName), this.getChallengeProgress, this.infoItems.map((x, index) => this.renderInfoItem(x, index)), this.getCardButton))));
|
|
513
538
|
}
|
|
514
539
|
static get watchers() { return {
|
|
515
540
|
"clientStyling": ["handleClientStylingChange"],
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as casino_challenge_card } from './casino-challenge-card-
|
|
1
|
+
export { C as casino_challenge_card } from './casino-challenge-card-717c8962.js';
|
|
2
2
|
import './index-3c031981.js';
|