@everymatrix/casino-challenge-details 0.3.12 → 0.3.13
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-details/casino-challenge-details-00cd9c3e.js +1 -0
- package/dist/casino-challenge-details/casino-challenge-details.esm.js +1 -1
- package/dist/casino-challenge-details/casino-challenge-details_4.entry.js +1 -1
- package/dist/casino-challenge-details/index.esm.js +1 -1
- package/dist/cjs/{casino-challenge-details-53cea171.js → casino-challenge-details-7465690c.js} +123 -61
- package/dist/cjs/casino-challenge-details.cjs.js +1 -1
- package/dist/cjs/casino-challenge-details_4.cjs.entry.js +16 -13
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/casino-challenge-details/casino-challenge-details.css +1 -0
- package/dist/collection/components/casino-challenge-details/casino-challenge-details.js +108 -52
- package/dist/collection/components/components/casino-challenge-progress-bar.js +16 -13
- package/dist/collection/utils/locale.utils.js +5 -0
- package/dist/collection/utils/types.js +18 -10
- package/dist/esm/{casino-challenge-details-d1763400.js → casino-challenge-details-00cd9c3e.js} +124 -62
- package/dist/esm/casino-challenge-details.js +1 -1
- package/dist/esm/casino-challenge-details_4.entry.js +17 -14
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/casino-challenge-details/casino-challenge-details.d.ts +5 -0
- package/dist/types/utils/types.d.ts +15 -6
- package/package.json +1 -1
- package/dist/casino-challenge-details/casino-challenge-details-d1763400.js +0 -1
|
@@ -11,7 +11,7 @@ import checkIcon from "../../assets/check.svg";
|
|
|
11
11
|
import infoIcon from "../../assets/info-circle.svg";
|
|
12
12
|
import titleIcon from "../../assets/title-icon.svg";
|
|
13
13
|
import notificationIcon from "../../assets/notification.svg";
|
|
14
|
-
import { ChallengeStatusDictionary, EChallengeLevelTargetType, EChallengeProgressStatus, EChallengeStatus } from "../../utils/types";
|
|
14
|
+
import { ChallengeStatusDictionary, EChallengeLevelTargetType, EChallengeProgressLevelStatus, EChallengeProgressStatus, EChallengeStatus } from "../../utils/types";
|
|
15
15
|
export class CasinoChallengeDetails {
|
|
16
16
|
constructor() {
|
|
17
17
|
this.activeEntityRef = null;
|
|
@@ -19,6 +19,7 @@ export class CasinoChallengeDetails {
|
|
|
19
19
|
this.challengesTabs = ['Active', 'Pending', 'Finished', 'Code'];
|
|
20
20
|
this.tabs = ['LEVELS', 'GAMES', 'RULES'];
|
|
21
21
|
this.showNotification = 10;
|
|
22
|
+
this.abortController = new AbortController();
|
|
22
23
|
this.checkIsMobile = () => {
|
|
23
24
|
this.isMobile = window.innerWidth <= 768;
|
|
24
25
|
};
|
|
@@ -43,14 +44,17 @@ export class CasinoChallengeDetails {
|
|
|
43
44
|
this.getBadgeContent = () => {
|
|
44
45
|
var _a;
|
|
45
46
|
if (this.challenge) {
|
|
47
|
+
if (this.isChallengePaused) {
|
|
48
|
+
return translate('unavailable', this.language);
|
|
49
|
+
}
|
|
46
50
|
switch ((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Status) {
|
|
47
|
-
case
|
|
51
|
+
case EChallengeProgressStatus.Expired:
|
|
48
52
|
return translate('expired', this.language);
|
|
49
|
-
case
|
|
53
|
+
case EChallengeProgressStatus.Forfeited:
|
|
50
54
|
return translate('forfeited', this.language);
|
|
51
|
-
case
|
|
55
|
+
case EChallengeProgressStatus.Completed:
|
|
52
56
|
return translate('finished', this.language);
|
|
53
|
-
case
|
|
57
|
+
case EChallengeProgressStatus.Paused:
|
|
54
58
|
return translate('suspended', this.language);
|
|
55
59
|
default:
|
|
56
60
|
return [translate('endsIn', this.language), ' - ', h("span", null, this.timeLeft || null)];
|
|
@@ -68,15 +72,15 @@ export class CasinoChallengeDetails {
|
|
|
68
72
|
return this.hasError;
|
|
69
73
|
};
|
|
70
74
|
this.joinUnjoinProgress = async () => {
|
|
71
|
-
var _a, _b
|
|
75
|
+
var _a, _b;
|
|
72
76
|
if (!this.isUserAuthorized) {
|
|
73
77
|
this.openLoginRegisterModal();
|
|
74
78
|
}
|
|
75
|
-
const join = ((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Status) ===
|
|
76
|
-
|
|
77
|
-
if (!this.checkAttrs() &&
|
|
79
|
+
const join = ((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Status) === EChallengeProgressStatus.Started ||
|
|
80
|
+
((_b = this.challenge) === null || _b === void 0 ? void 0 : _b.Status) === EChallengeProgressStatus.Paused;
|
|
81
|
+
if (!this.checkAttrs() && this.challengeId) {
|
|
78
82
|
const url = `${this.endpoint}/challenge/ChangeProgressStatus`;
|
|
79
|
-
const body = Object.assign(Object.assign({ DomainId: this.domain }, (this.userId && { InternalUserId: this.userId })), (join ? { ProgressToActivate:
|
|
83
|
+
const body = Object.assign(Object.assign({ DomainId: this.domain }, (this.userId && { InternalUserId: this.userId })), (join ? { ProgressToActivate: this.challenge.Id } : { ProgressToDeactivate: this.challenge.Id }));
|
|
80
84
|
this.actionLoading = true;
|
|
81
85
|
return fetch(url, {
|
|
82
86
|
method: 'POST',
|
|
@@ -106,6 +110,9 @@ export class CasinoChallengeDetails {
|
|
|
106
110
|
this.getBackButtonText = () => {
|
|
107
111
|
return (h("span", { class: "back-button__text" }, this.isMobile ? translate('all', this.language) : translate('back', this.language)));
|
|
108
112
|
};
|
|
113
|
+
this.goBack = () => {
|
|
114
|
+
window.history.back();
|
|
115
|
+
};
|
|
109
116
|
this.mbSource = undefined;
|
|
110
117
|
this.clientStyling = undefined;
|
|
111
118
|
this.endpoint = '';
|
|
@@ -128,6 +135,7 @@ export class CasinoChallengeDetails {
|
|
|
128
135
|
this.gamesAreLoading = false;
|
|
129
136
|
this.challenge = undefined;
|
|
130
137
|
this.loading = false;
|
|
138
|
+
this.isChallengePaused = false;
|
|
131
139
|
}
|
|
132
140
|
handleClientStylingChange(newValue, oldValue) {
|
|
133
141
|
if (newValue != oldValue) {
|
|
@@ -144,10 +152,21 @@ export class CasinoChallengeDetails {
|
|
|
144
152
|
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
145
153
|
}
|
|
146
154
|
}
|
|
155
|
+
handleCombinedChange() {
|
|
156
|
+
clearTimeout(this.debounceTimer);
|
|
157
|
+
this.debounceTimer = setTimeout(() => {
|
|
158
|
+
if (this.isUserAuthorized && this.session && this.challengeId) {
|
|
159
|
+
if (this.activeTabIndex === 0)
|
|
160
|
+
this.getChallenge();
|
|
161
|
+
else if (this.activeTabIndex === 1)
|
|
162
|
+
this.fetchGames();
|
|
163
|
+
}
|
|
164
|
+
}, 50);
|
|
165
|
+
}
|
|
147
166
|
onEntityChange(newChallenge, previousChallenge) {
|
|
148
167
|
var _a, _b, _c, _d;
|
|
149
|
-
const newActiveProgressId = (_b = (_a = newChallenge === null || newChallenge === void 0 ? void 0 : newChallenge.LevelProgresses) === null || _a === void 0 ? void 0 : _a.find((level) => level.ProgressStatus ===
|
|
150
|
-
const prevActiveProgressId = (_d = (_c = previousChallenge === null || previousChallenge === void 0 ? void 0 : previousChallenge.LevelProgresses) === null || _c === void 0 ? void 0 : _c.find((level) => level.ProgressStatus ===
|
|
168
|
+
const newActiveProgressId = (_b = (_a = newChallenge === null || newChallenge === void 0 ? void 0 : newChallenge.LevelProgresses) === null || _a === void 0 ? void 0 : _a.find((level) => level.ProgressStatus === EChallengeProgressLevelStatus.InProgress)) === null || _b === void 0 ? void 0 : _b.LevelId;
|
|
169
|
+
const prevActiveProgressId = (_d = (_c = previousChallenge === null || previousChallenge === void 0 ? void 0 : previousChallenge.LevelProgresses) === null || _c === void 0 ? void 0 : _c.find((level) => level.ProgressStatus === EChallengeProgressLevelStatus.InProgress)) === null || _d === void 0 ? void 0 : _d.LevelId;
|
|
151
170
|
if (newActiveProgressId == prevActiveProgressId) {
|
|
152
171
|
setTimeout(() => {
|
|
153
172
|
this.scrollToActiveLevel();
|
|
@@ -174,19 +193,32 @@ export class CasinoChallengeDetails {
|
|
|
174
193
|
}
|
|
175
194
|
async getChallenge() {
|
|
176
195
|
if (!this.checkAttrs()) {
|
|
196
|
+
if (this.abortController) {
|
|
197
|
+
this.abortController.abort();
|
|
198
|
+
}
|
|
199
|
+
this.abortController = new AbortController();
|
|
200
|
+
const signal = this.abortController.signal;
|
|
177
201
|
const url = `${this.endpoint}/challenge/GetChallengesInfo`;
|
|
178
|
-
const body = Object.assign(
|
|
202
|
+
const body = Object.assign({ DomainId: this.domain, PlayerLanguage: this.language, PageNumber: 0, PageSize: 20 }, (this.session && { PlayerSession: this.session }));
|
|
179
203
|
this.loading = true;
|
|
180
204
|
return fetch(url, {
|
|
181
205
|
method: 'POST',
|
|
182
206
|
headers: {
|
|
183
207
|
'Content-Type': 'application/json'
|
|
184
208
|
},
|
|
209
|
+
signal,
|
|
185
210
|
body: JSON.stringify(body)
|
|
186
211
|
})
|
|
187
212
|
.then((res) => res.json())
|
|
188
213
|
.then((res) => {
|
|
189
|
-
|
|
214
|
+
var _a;
|
|
215
|
+
if (res.Success) {
|
|
216
|
+
const challenge = (_a = res === null || res === void 0 ? void 0 : res.Data) === null || _a === void 0 ? void 0 : _a.find((challenge) => (challenge === null || challenge === void 0 ? void 0 : challenge.ChallengeId) === this.challengeId);
|
|
217
|
+
if (challenge) {
|
|
218
|
+
this.challenge = challenge;
|
|
219
|
+
this.isChallengePaused = this.challenge.ChallengeStatus === EChallengeStatus.Paused;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
190
222
|
})
|
|
191
223
|
.finally(() => (this.loading = false));
|
|
192
224
|
}
|
|
@@ -249,16 +281,14 @@ export class CasinoChallengeDetails {
|
|
|
249
281
|
if (this.isUserAuthorized) {
|
|
250
282
|
let buttonText;
|
|
251
283
|
switch ((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Status) {
|
|
252
|
-
case
|
|
284
|
+
case EChallengeProgressStatus.Started:
|
|
253
285
|
buttonText = 'start';
|
|
254
286
|
break;
|
|
255
|
-
case
|
|
256
|
-
buttonText = 'resume';
|
|
257
|
-
break;
|
|
258
|
-
case EChallengeStatus.InProgress:
|
|
287
|
+
case EChallengeProgressStatus.Paused:
|
|
259
288
|
buttonText = 'resume';
|
|
260
289
|
break;
|
|
261
|
-
case
|
|
290
|
+
case EChallengeProgressStatus.InProgress:
|
|
291
|
+
case EChallengeProgressStatus.PendingLevelReward:
|
|
262
292
|
buttonText = 'pause';
|
|
263
293
|
break;
|
|
264
294
|
default:
|
|
@@ -276,15 +306,18 @@ export class CasinoChallengeDetails {
|
|
|
276
306
|
});
|
|
277
307
|
}
|
|
278
308
|
async fetchGames() {
|
|
279
|
-
var _a;
|
|
280
309
|
if (!this.checkAttrs()) {
|
|
310
|
+
if (this.abortController) {
|
|
311
|
+
this.abortController.abort();
|
|
312
|
+
}
|
|
313
|
+
this.abortController = new AbortController();
|
|
314
|
+
const signal = this.abortController.signal;
|
|
281
315
|
const url = `${this.endpoint}/challenge/GetChallengeGames`;
|
|
282
|
-
const body = {
|
|
283
|
-
ChallengeId: (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ChallengeId
|
|
284
|
-
};
|
|
316
|
+
const body = Object.assign({ ChallengeId: this.challengeId }, (this.session && { PlayerSession: this.session }));
|
|
285
317
|
this.gamesAreLoading = true;
|
|
286
318
|
return fetch(url, {
|
|
287
319
|
method: 'POST',
|
|
320
|
+
signal,
|
|
288
321
|
headers: {
|
|
289
322
|
'Content-Type': 'application/json'
|
|
290
323
|
},
|
|
@@ -292,22 +325,30 @@ export class CasinoChallengeDetails {
|
|
|
292
325
|
})
|
|
293
326
|
.then((res) => res.json())
|
|
294
327
|
.then((res) => {
|
|
295
|
-
|
|
328
|
+
if (res.ChallengeGames)
|
|
329
|
+
this.games = res.ChallengeGames;
|
|
330
|
+
else
|
|
331
|
+
this.games = [];
|
|
296
332
|
})
|
|
297
|
-
.
|
|
333
|
+
.catch(() => {
|
|
334
|
+
this.games = [];
|
|
335
|
+
})
|
|
336
|
+
.finally(() => {
|
|
337
|
+
this.gamesAreLoading = false;
|
|
338
|
+
});
|
|
298
339
|
}
|
|
299
340
|
}
|
|
300
341
|
getLevelStatus(level, active) {
|
|
301
342
|
if (this.isUserAuthorized) {
|
|
302
|
-
if (level.ProgressStatus ===
|
|
343
|
+
if (level.ProgressStatus === EChallengeProgressLevelStatus.InProgress && !active)
|
|
303
344
|
return (h("div", { class: "level__status" }, h("span", null, level.ProgressPercentage, "%"), h("img", { src: lockIcon, alt: "lock-icon", title: "lock-icon" })));
|
|
304
|
-
else if (level.ProgressStatus ===
|
|
345
|
+
else if (level.ProgressStatus === EChallengeProgressLevelStatus.Closed || !active)
|
|
305
346
|
return (h("div", { class: "level__status" }, h("img", { src: lockIcon, alt: "lock-icon", title: "lock-icon" })));
|
|
306
|
-
else if (level.ProgressStatus ===
|
|
347
|
+
else if (level.ProgressStatus === EChallengeProgressLevelStatus.Fillup)
|
|
307
348
|
return (h("div", { class: "level__status" }, h("img", { src: lockIcon, alt: "lock-icon", title: "lock-icon" })));
|
|
308
|
-
else if (level.ProgressStatus ===
|
|
349
|
+
else if (level.ProgressStatus === EChallengeProgressLevelStatus.Completed)
|
|
309
350
|
return h("span", { class: "completed" }, translate('completed', this.language));
|
|
310
|
-
else if (level.ProgressStatus ===
|
|
351
|
+
else if (level.ProgressStatus === EChallengeProgressLevelStatus.InProgress)
|
|
311
352
|
return h("span", { class: "level__status in-progress" }, level.ProgressPercentage, "%");
|
|
312
353
|
}
|
|
313
354
|
return null;
|
|
@@ -319,13 +360,17 @@ export class CasinoChallengeDetails {
|
|
|
319
360
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
320
361
|
return (h("div", { class: "details__general-info" }, h("div", { class: "details__general-info-image-container" }, h("img", { class: {
|
|
321
362
|
'details__general-info-image': true,
|
|
322
|
-
grayed: [
|
|
363
|
+
grayed: [
|
|
364
|
+
EChallengeProgressStatus.Expired,
|
|
365
|
+
EChallengeProgressStatus.Forfeited,
|
|
366
|
+
EChallengeProgressStatus.Completed
|
|
367
|
+
].includes((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Status)
|
|
323
368
|
}, src: (_c = (_b = this.challenge) === null || _b === void 0 ? void 0 : _b.ChallengePresentation) === null || _c === void 0 ? void 0 : _c.BannerUrl, alt: "banner-image", title: "banner-image" }), this.getCardBadge), h("div", { class: "details__general-info-content" }, h("h1", { class: "details__general-info-title" }, (_e = (_d = this.challenge) === null || _d === void 0 ? void 0 : _d.ChallengePresentation) === null || _e === void 0 ? void 0 : _e.PresentationName), h("h3", { class: "details__general-info-end-date_label" }, translate('endDate', this.language), " -", ' ', h("span", { class: "details__general-info-end-date_value" }, this.challenge ? formatDate((_f = this.challenge) === null || _f === void 0 ? void 0 : _f.ExpirationTime) : '-')), h("casino-challenge-progress-bar", { challenge: this.challenge, isUserAuthorized: this.isUserAuthorized, language: this.language }), h("button", { class: {
|
|
324
369
|
'details__general-info-action-button': true,
|
|
325
|
-
filled: ((_g = this.challenge) === null || _g === void 0 ? void 0 : _g.Status) ===
|
|
326
|
-
grayed: ((_h = this.challenge) === null || _h === void 0 ? void 0 : _h.Status) ===
|
|
327
|
-
((_j = this.challenge) === null || _j === void 0 ? void 0 : _j.Status) ===
|
|
328
|
-
((_k = this.challenge) === null || _k === void 0 ? void 0 : _k.Status) ===
|
|
370
|
+
filled: ((_g = this.challenge) === null || _g === void 0 ? void 0 : _g.Status) === EChallengeProgressStatus.Started,
|
|
371
|
+
grayed: ((_h = this.challenge) === null || _h === void 0 ? void 0 : _h.Status) === EChallengeProgressStatus.Paused ||
|
|
372
|
+
((_j = this.challenge) === null || _j === void 0 ? void 0 : _j.Status) === EChallengeProgressStatus.InProgress ||
|
|
373
|
+
((_k = this.challenge) === null || _k === void 0 ? void 0 : _k.Status) === EChallengeProgressStatus.PendingLevelReward
|
|
329
374
|
}, disabled: this.actionLoading, onClick: this.joinUnjoinProgress }, translate(this.actionButtonText, this.language)))));
|
|
330
375
|
}
|
|
331
376
|
get challengeTabs() {
|
|
@@ -339,23 +384,24 @@ export class CasinoChallengeDetails {
|
|
|
339
384
|
return (h("div", { class: "levels__tab", ref: (el) => (this.scrollContainerRef = el) }, (_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses) === null || _b === void 0 ? void 0 : _b.map((level, index) => {
|
|
340
385
|
var _a;
|
|
341
386
|
const activeChallenge = [0, 1, 2, 3].includes((_a = this === null || this === void 0 ? void 0 : this.challenge) === null || _a === void 0 ? void 0 : _a.Status);
|
|
342
|
-
const isGrayed = (this.isUserAuthorized && level.ProgressStatus !==
|
|
343
|
-
|
|
387
|
+
const isGrayed = (this.isUserAuthorized && level.ProgressStatus !== EChallengeProgressLevelStatus.InProgress) ||
|
|
388
|
+
!activeChallenge;
|
|
389
|
+
const isActiveMatch = level.ProgressStatus === EChallengeProgressLevelStatus.InProgress;
|
|
344
390
|
return (h("div", { class: {
|
|
345
391
|
level: true,
|
|
346
392
|
active: this.isUserAuthorized &&
|
|
347
393
|
activeChallenge &&
|
|
348
|
-
level.ProgressStatus ===
|
|
394
|
+
level.ProgressStatus === EChallengeProgressLevelStatus.InProgress,
|
|
349
395
|
completed: this.isUserAuthorized &&
|
|
350
396
|
activeChallenge &&
|
|
351
|
-
level.ProgressStatus ===
|
|
397
|
+
level.ProgressStatus === EChallengeProgressLevelStatus.Completed,
|
|
352
398
|
grayed: this.isUserAuthorized &&
|
|
353
|
-
(level.ProgressStatus ===
|
|
354
|
-
level.ProgressStatus ===
|
|
399
|
+
(level.ProgressStatus === EChallengeProgressLevelStatus.Closed ||
|
|
400
|
+
level.ProgressStatus === EChallengeProgressLevelStatus.Fillup)
|
|
355
401
|
}, ref: isActiveMatch ? (el) => (this.activeEntityRef = el) : undefined, key: level.LevelId }, h("div", { class: {
|
|
356
402
|
level__title: true,
|
|
357
403
|
grayed: isGrayed
|
|
358
|
-
} }, h("span", null, "Level ", index + 1), this.isUserAuthorized && this.getLevelStatus(level, activeChallenge)), this.isUserAuthorized && level.ProgressStatus ===
|
|
404
|
+
} }, h("span", null, "Level ", index + 1), this.isUserAuthorized && this.getLevelStatus(level, activeChallenge)), this.isUserAuthorized && level.ProgressStatus === EChallengeProgressLevelStatus.InProgress && (h("div", { class: "level__progress" }, h("casino-challenge-level-progress-bar", { height: "8px", value: level.ProgressPercentage, active: activeChallenge }))), h("casino-challenge-expandable-paragraph", { "max-height": "56", active: level.ProgressStatus === EChallengeProgressLevelStatus.InProgress && activeChallenge }, h("div", { class: {
|
|
359
405
|
level__bonus: true,
|
|
360
406
|
grayed: isGrayed
|
|
361
407
|
} }, h("span", { class: "level__icon" }, h("img", { class: {
|
|
@@ -393,22 +439,22 @@ export class CasinoChallengeDetails {
|
|
|
393
439
|
}
|
|
394
440
|
get gamesTab() {
|
|
395
441
|
return (h("div", { class: "games__tab" }, this.gamesAreLoading ? (h("div", { class: "lds-dual-ring" })) : (this.games.map((game) => {
|
|
396
|
-
return (h("div", { class: "game", onClick: () => this.handleGameClick(game) }, h("img", { src: game.
|
|
442
|
+
return (h("div", { class: "game", onClick: () => this.handleGameClick(game) }, h("img", { src: game.Thumbnail, alt: "game-icon", title: "game-icon" }), h("span", { class: "contribution" }, translate('contribution', this.language), " ", game.Contribution, "%")));
|
|
397
443
|
}))));
|
|
398
444
|
}
|
|
399
445
|
get rulesTab() {
|
|
400
|
-
var _a, _b, _c, _d;
|
|
401
|
-
return (h("div", { class: "rules__tab" }, h("div", { class: "rule" }, (
|
|
446
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
447
|
+
return (h("div", { class: "rules__tab" }, ((_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ChallengePresentation) === null || _b === void 0 ? void 0 : _b.Description) && (h("div", { class: "rule" }, (_d = (_c = this.challenge) === null || _c === void 0 ? void 0 : _c.ChallengePresentation) === null || _d === void 0 ? void 0 : _d.Description)), ((_f = (_e = this.challenge) === null || _e === void 0 ? void 0 : _e.ChallengePresentation) === null || _f === void 0 ? void 0 : _f.Url) && (h("a", { class: "link", href: (_h = (_g = this.challenge) === null || _g === void 0 ? void 0 : _g.ChallengePresentation) === null || _h === void 0 ? void 0 : _h.Url, target: "_blank" }, translate('terms', this.language)))));
|
|
402
448
|
}
|
|
403
449
|
get footer() {
|
|
404
450
|
var _a, _b, _c, _d;
|
|
405
451
|
return (h("div", { class: "button__container" }, h("button", { class: {
|
|
406
452
|
'footer-action-button': true,
|
|
407
|
-
filled: ((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Status) ===
|
|
453
|
+
filled: ((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Status) === EChallengeProgressStatus.Started || !this.isUserAuthorized,
|
|
408
454
|
grayed: this.isUserAuthorized &&
|
|
409
|
-
(((_b = this.challenge) === null || _b === void 0 ? void 0 : _b.Status) ===
|
|
410
|
-
((_c = this.challenge) === null || _c === void 0 ? void 0 : _c.Status) ===
|
|
411
|
-
((_d = this.challenge) === null || _d === void 0 ? void 0 : _d.Status) ===
|
|
455
|
+
(((_b = this.challenge) === null || _b === void 0 ? void 0 : _b.Status) === EChallengeProgressStatus.Paused ||
|
|
456
|
+
((_c = this.challenge) === null || _c === void 0 ? void 0 : _c.Status) === EChallengeProgressStatus.InProgress ||
|
|
457
|
+
((_d = this.challenge) === null || _d === void 0 ? void 0 : _d.Status) === EChallengeProgressStatus.PendingLevelReward)
|
|
412
458
|
}, onClick: this.joinUnjoinProgress, disabled: this.actionLoading }, translate(this.actionButtonText, this.language))));
|
|
413
459
|
}
|
|
414
460
|
get forfeitedNofitication() {
|
|
@@ -424,7 +470,7 @@ export class CasinoChallengeDetails {
|
|
|
424
470
|
return (((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Status) === 4 && (h("div", { class: "notification" }, h("img", { class: "notification__icon", src: infoIcon }), h("span", { class: "notification__message" }, translate('expiredNotification', this.language)))));
|
|
425
471
|
}
|
|
426
472
|
render() {
|
|
427
|
-
return (h("div", { key: '
|
|
473
|
+
return (h("div", { key: 'db59c429bf40a1ad703f3f26763549ece9fe8723', ref: (el) => (this.stylingContainer = el), class: "container" }, this.pageHeader, this.loading ? (h("div", { class: "lds-dual-ring" })) : (h("div", null, h("button", { class: "back-button", onClick: this.goBack }, h("img", { class: "back-button__icon", src: backIcon }), this.getBackButtonText()), this.forfeitedNofitication, this.completedNotification, this.expiredNotification, h("div", { class: "details" }, this.cardGeneralInfo, h("div", { class: "details__tabs-container" }, this.challengeTabs, this.activeTabIndex === 0 && this.levelsTab, this.activeTabIndex === 1 && this.gamesTab, this.activeTabIndex === 2 && this.rulesTab), this.footer)))));
|
|
428
474
|
}
|
|
429
475
|
static get is() { return "casino-challenge-details"; }
|
|
430
476
|
static get encapsulation() { return "shadow"; }
|
|
@@ -666,7 +712,8 @@ export class CasinoChallengeDetails {
|
|
|
666
712
|
"games": {},
|
|
667
713
|
"gamesAreLoading": {},
|
|
668
714
|
"challenge": {},
|
|
669
|
-
"loading": {}
|
|
715
|
+
"loading": {},
|
|
716
|
+
"isChallengePaused": {}
|
|
670
717
|
};
|
|
671
718
|
}
|
|
672
719
|
static get events() {
|
|
@@ -697,6 +744,15 @@ export class CasinoChallengeDetails {
|
|
|
697
744
|
}, {
|
|
698
745
|
"propName": "mbSource",
|
|
699
746
|
"methodName": "handleMbSourceChange"
|
|
747
|
+
}, {
|
|
748
|
+
"propName": "challengeId",
|
|
749
|
+
"methodName": "handleCombinedChange"
|
|
750
|
+
}, {
|
|
751
|
+
"propName": "isUserAuthorized",
|
|
752
|
+
"methodName": "handleCombinedChange"
|
|
753
|
+
}, {
|
|
754
|
+
"propName": "session",
|
|
755
|
+
"methodName": "handleCombinedChange"
|
|
700
756
|
}, {
|
|
701
757
|
"propName": "challenge",
|
|
702
758
|
"methodName": "onEntityChange"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { EChallengeProgressStatus, EChallengeStatus } from "../../utils/types";
|
|
2
|
+
import { EChallengeProgressLevelStatus, EChallengeProgressStatus, EChallengeStatus } from "../../utils/types";
|
|
3
3
|
import { translate } from "../../utils/locale.utils";
|
|
4
4
|
import trophyIcon from "../../assets/trophy.svg";
|
|
5
5
|
import finishIcon from "../../assets/finish.svg";
|
|
@@ -11,39 +11,42 @@ export class CasinoChallengeProgressBar {
|
|
|
11
11
|
}
|
|
12
12
|
get challengeProgress() {
|
|
13
13
|
var _a;
|
|
14
|
-
const currLevel = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus ===
|
|
14
|
+
const currLevel = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressLevelStatus.InProgress);
|
|
15
15
|
if (!this.isUserAuthorized || !currLevel)
|
|
16
16
|
return null;
|
|
17
|
-
const { Status, LevelProgresses } = this.challenge;
|
|
18
|
-
if (
|
|
17
|
+
const { Status, LevelProgresses, ChallengeStatus } = this.challenge;
|
|
18
|
+
if (ChallengeStatus === EChallengeStatus.Closed ||
|
|
19
|
+
ChallengeStatus === EChallengeStatus.Deleted ||
|
|
20
|
+
Status === EChallengeProgressStatus.Expired ||
|
|
21
|
+
Status === EChallengeProgressStatus.Started) {
|
|
19
22
|
return null;
|
|
20
23
|
}
|
|
21
|
-
const barValue = Status ===
|
|
24
|
+
const barValue = Status === EChallengeProgressStatus.Paused
|
|
22
25
|
? translate('suspended', this.language)
|
|
23
|
-
: Status ===
|
|
26
|
+
: Status === EChallengeProgressStatus.Completed
|
|
24
27
|
? translate('finished', this.language)
|
|
25
28
|
: `${currLevel.ProgressPercentage}%`;
|
|
26
29
|
const isLastLevel = !LevelProgresses.some((x) => x.OrderNumber > currLevel.OrderNumber);
|
|
27
|
-
const secondImgSrc = Status ===
|
|
30
|
+
const secondImgSrc = Status === EChallengeProgressStatus.Completed ? trophyIcon : isLastLevel ? finishIcon : '';
|
|
28
31
|
return (h("div", { class: {
|
|
29
32
|
progress: true,
|
|
30
|
-
paused: Status ===
|
|
31
|
-
grayed: Status ===
|
|
33
|
+
paused: Status === EChallengeProgressStatus.Paused,
|
|
34
|
+
grayed: Status === EChallengeProgressStatus.Forfeited
|
|
32
35
|
} }, h("div", { class: {
|
|
33
36
|
progress__point: true,
|
|
34
37
|
start: true,
|
|
35
|
-
hidden: Status ===
|
|
38
|
+
hidden: Status === EChallengeProgressStatus.Completed
|
|
36
39
|
} }, currLevel.OrderNumber + 1), h("div", { class: {
|
|
37
40
|
progress__bar: true,
|
|
38
|
-
finished: Status ===
|
|
41
|
+
finished: Status === EChallengeProgressStatus.Completed
|
|
39
42
|
}, style: { width: `${currLevel.ProgressPercentage}%` } }, barValue), h("div", { class: {
|
|
40
43
|
progress__point: true,
|
|
41
44
|
end: true,
|
|
42
|
-
finished: Status ===
|
|
45
|
+
finished: Status === EChallengeProgressStatus.Completed
|
|
43
46
|
} }, secondImgSrc ? h("img", { class: "progress__icon", src: secondImgSrc }) : currLevel.OrderNumber + 2)));
|
|
44
47
|
}
|
|
45
48
|
render() {
|
|
46
|
-
return h(Host, { key: '
|
|
49
|
+
return h(Host, { key: '026daa3db1fe4e19e74dc4cc994e2fbb6f833356' }, this.challengeProgress);
|
|
47
50
|
}
|
|
48
51
|
static get is() { return "casino-challenge-progress-bar"; }
|
|
49
52
|
static get encapsulation() { return "shadow"; }
|
|
@@ -15,6 +15,7 @@ const TRANSLATIONS = {
|
|
|
15
15
|
finished: 'Finished',
|
|
16
16
|
suspended: 'Suspended',
|
|
17
17
|
completed: 'Completed',
|
|
18
|
+
unavailable: 'Unavailable',
|
|
18
19
|
start: 'Start',
|
|
19
20
|
resume: 'Resume',
|
|
20
21
|
pause: 'Pause',
|
|
@@ -43,6 +44,7 @@ const TRANSLATIONS = {
|
|
|
43
44
|
finished: 'Terminat',
|
|
44
45
|
suspended: 'Suspendat',
|
|
45
46
|
start: 'Start',
|
|
47
|
+
unavailable: 'Indisponibil',
|
|
46
48
|
resume: 'Reia',
|
|
47
49
|
pause: 'Pauză',
|
|
48
50
|
join: 'Alătură-te pentru a începe',
|
|
@@ -70,6 +72,7 @@ const TRANSLATIONS = {
|
|
|
70
72
|
finished: 'Terminé',
|
|
71
73
|
suspended: 'Suspendu',
|
|
72
74
|
start: 'Démarrer',
|
|
75
|
+
unavailable: 'Indisponible',
|
|
73
76
|
resume: 'Reprendre',
|
|
74
77
|
pause: 'Pause',
|
|
75
78
|
join: 'Rejoindre pour commencer',
|
|
@@ -97,6 +100,7 @@ const TRANSLATIONS = {
|
|
|
97
100
|
finished: 'منتهي',
|
|
98
101
|
suspended: 'معلق',
|
|
99
102
|
start: 'ابدأ',
|
|
103
|
+
unavailable: 'غير متاح',
|
|
100
104
|
resume: 'استئناف',
|
|
101
105
|
pause: 'إيقاف مؤقت',
|
|
102
106
|
join: 'انضم للبدء',
|
|
@@ -124,6 +128,7 @@ const TRANSLATIONS = {
|
|
|
124
128
|
finished: 'Završeno',
|
|
125
129
|
suspended: 'Suspendirano',
|
|
126
130
|
start: 'Počni',
|
|
131
|
+
unavailable: 'nedostupan',
|
|
127
132
|
resume: 'Nastavi',
|
|
128
133
|
pause: 'Pauza',
|
|
129
134
|
join: 'Pridruži se za početak',
|
|
@@ -19,23 +19,31 @@ export var EChallengeRewardType;
|
|
|
19
19
|
EChallengeRewardType[EChallengeRewardType["Challenge"] = 3] = "Challenge";
|
|
20
20
|
EChallengeRewardType[EChallengeRewardType["Custom"] = 4] = "Custom";
|
|
21
21
|
})(EChallengeRewardType || (EChallengeRewardType = {}));
|
|
22
|
+
export var EChallengeProgressLevelStatus;
|
|
23
|
+
(function (EChallengeProgressLevelStatus) {
|
|
24
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Closed"] = 0] = "Closed";
|
|
25
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["InProgress"] = 1] = "InProgress";
|
|
26
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Fillup"] = 2] = "Fillup";
|
|
27
|
+
EChallengeProgressLevelStatus[EChallengeProgressLevelStatus["Completed"] = 3] = "Completed";
|
|
28
|
+
})(EChallengeProgressLevelStatus || (EChallengeProgressLevelStatus = {}));
|
|
22
29
|
export var EChallengeProgressStatus;
|
|
23
30
|
(function (EChallengeProgressStatus) {
|
|
24
|
-
EChallengeProgressStatus[EChallengeProgressStatus["
|
|
31
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Started"] = 0] = "Started";
|
|
25
32
|
EChallengeProgressStatus[EChallengeProgressStatus["InProgress"] = 1] = "InProgress";
|
|
26
|
-
EChallengeProgressStatus[EChallengeProgressStatus["
|
|
33
|
+
EChallengeProgressStatus[EChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
|
|
27
34
|
EChallengeProgressStatus[EChallengeProgressStatus["Completed"] = 3] = "Completed";
|
|
35
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Expired"] = 4] = "Expired";
|
|
36
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Forfeited"] = 5] = "Forfeited";
|
|
37
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Awaiting"] = 6] = "Awaiting";
|
|
38
|
+
EChallengeProgressStatus[EChallengeProgressStatus["Paused"] = 7] = "Paused";
|
|
28
39
|
})(EChallengeProgressStatus || (EChallengeProgressStatus = {}));
|
|
29
40
|
export var EChallengeStatus;
|
|
30
41
|
(function (EChallengeStatus) {
|
|
31
|
-
EChallengeStatus[EChallengeStatus["
|
|
32
|
-
EChallengeStatus[EChallengeStatus["
|
|
33
|
-
EChallengeStatus[EChallengeStatus["
|
|
34
|
-
EChallengeStatus[EChallengeStatus["
|
|
35
|
-
EChallengeStatus[EChallengeStatus["
|
|
36
|
-
EChallengeStatus[EChallengeStatus["Forfeited"] = 5] = "Forfeited";
|
|
37
|
-
EChallengeStatus[EChallengeStatus["Awaiting"] = 6] = "Awaiting";
|
|
38
|
-
EChallengeStatus[EChallengeStatus["Paused"] = 7] = "Paused";
|
|
42
|
+
EChallengeStatus[EChallengeStatus["Draft"] = 0] = "Draft";
|
|
43
|
+
EChallengeStatus[EChallengeStatus["Enabled"] = 1] = "Enabled";
|
|
44
|
+
EChallengeStatus[EChallengeStatus["Paused"] = 2] = "Paused";
|
|
45
|
+
EChallengeStatus[EChallengeStatus["Closed"] = 3] = "Closed";
|
|
46
|
+
EChallengeStatus[EChallengeStatus["Deleted"] = 4] = "Deleted";
|
|
39
47
|
})(EChallengeStatus || (EChallengeStatus = {}));
|
|
40
48
|
export const ChallengeStatusDictionary = [
|
|
41
49
|
'started',
|