@everymatrix/casino-engagement-suite-challenges-details 1.35.0 → 1.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/casino-engagement-suite-challenges-details/casino-engagement-suite-challenges-details.esm.js +1 -1
- package/dist/casino-engagement-suite-challenges-details/p-808a7dc5.js +1 -0
- package/dist/casino-engagement-suite-challenges-details/p-b3146c91.entry.js +1 -0
- package/dist/cjs/casino-engagement-suite-challenges-details.cjs.js +2 -2
- package/dist/cjs/casino-engagement-suite-challenges-details_2.cjs.entry.js +303 -0
- package/dist/cjs/{index-ec28d374.js → index-a0eb9215.js} +84 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +8 -1
- package/dist/collection/components/casino-engagement-suite-challenges-details/casino-engagement-suite-challenges-details.css +18 -3
- package/dist/collection/components/casino-engagement-suite-challenges-details/casino-engagement-suite-challenges-details.js +119 -24
- package/dist/components/casino-engagement-suite-challenges-details.js +70 -19
- package/dist/components/casino-engagement-suite-progress-bar.js +6 -0
- package/dist/components/casino-engagement-suite-progress-bar2.js +94 -0
- package/dist/esm/casino-engagement-suite-challenges-details.js +2 -2
- package/dist/esm/casino-engagement-suite-challenges-details_2.entry.js +298 -0
- package/dist/esm/{index-13f457d0.js → index-c5abae48.js} +84 -3
- package/dist/esm/loader.js +2 -2
- package/dist/types/components/casino-engagement-suite-challenges-details/casino-engagement-suite-challenges-details.d.ts +18 -4
- package/dist/types/components.d.ts +17 -0
- package/dist/types/models/casino-challenges-details.d.ts +2 -0
- package/package.json +1 -1
- package/dist/casino-engagement-suite-challenges-details/p-27926b27.entry.js +0 -1
- package/dist/casino-engagement-suite-challenges-details/p-764c820d.js +0 -1
- package/dist/cjs/casino-engagement-suite-challenges-details.cjs.entry.js +0 -190
- package/dist/esm/casino-engagement-suite-challenges-details.entry.js +0 -186
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-c5abae48.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
+
const SUPPORTED_LANGUAGES = ['en'];
|
|
5
|
+
const TRANSLATIONS = {
|
|
6
|
+
en: {
|
|
7
|
+
challenges: 'Challenges',
|
|
8
|
+
join: 'Join',
|
|
9
|
+
unjoin: 'Unjoin',
|
|
10
|
+
details: 'Challenge Details',
|
|
11
|
+
tc: 'Terms & Conditions',
|
|
12
|
+
level: 'Level',
|
|
13
|
+
place: 'Place',
|
|
14
|
+
bet: 'bet',
|
|
15
|
+
bets: 'bets',
|
|
16
|
+
win: 'Win'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const translate = (key, customLang) => {
|
|
20
|
+
const lang = customLang;
|
|
21
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var ChallengeLevelProgressStatus;
|
|
25
|
+
(function (ChallengeLevelProgressStatus) {
|
|
26
|
+
ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Closed"] = 0] = "Closed";
|
|
27
|
+
ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["InProgress"] = 1] = "InProgress";
|
|
28
|
+
ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Fillup"] = 2] = "Fillup";
|
|
29
|
+
ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Completed"] = 3] = "Completed";
|
|
30
|
+
})(ChallengeLevelProgressStatus || (ChallengeLevelProgressStatus = {}));
|
|
31
|
+
var ChallengeProgressStatus;
|
|
32
|
+
(function (ChallengeProgressStatus) {
|
|
33
|
+
ChallengeProgressStatus[ChallengeProgressStatus["Started"] = 0] = "Started";
|
|
34
|
+
ChallengeProgressStatus[ChallengeProgressStatus["InProgress"] = 1] = "InProgress";
|
|
35
|
+
ChallengeProgressStatus[ChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
|
|
36
|
+
ChallengeProgressStatus[ChallengeProgressStatus["Completed"] = 3] = "Completed";
|
|
37
|
+
ChallengeProgressStatus[ChallengeProgressStatus["Expired"] = 4] = "Expired";
|
|
38
|
+
})(ChallengeProgressStatus || (ChallengeProgressStatus = {}));
|
|
39
|
+
|
|
40
|
+
const casinoEngagementSuiteChallengesDetailsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;900&display=swap\"); :host{display:block;font-family:inherit}*{box-sizing:border-box;margin:0;padding:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.ChallengeDetailsPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:8px;overflow:hidden;flex-direction:column;position:relative}.ChallengeActions{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.ChallengeActions .ChallengeIconButton{width:16px;height:16px;cursor:pointer}.ChallengeActions .ChallengePopupName{color:var(--emw--color-gray-100, #BBB9C3);font-size:16px;font-weight:500;line-height:16px}.ChallengeDetails{padding:0px 19px 10px;overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.ChallengeDetails::-webkit-scrollbar{display:none}.ChallengeDetailsHeader{display:flex;justify-content:space-between;gap:12px}.ChallengeDetailsHeader .ChallengeName{font-family:\"Montserrat\", sans-serif;font-size:var(--emw--font-size-medium, 18px);font-weight:var(--emw--font-weight-bold, 700);line-height:22px;color:var(--emfe-w-color-white, #FFF);word-break:break-all}.ChallengeJoinButton.Joined::before{content:\"\";position:absolute;inset:0;border-radius:var(--emw--button-border-radius, 4px);padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeJoinButton{transition:all 0.5s ease-out;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:var(--emw--color-typography, #1E1638);border-radius:99px;min-width:88px;height:32px;font-size:14px;font-weight:700;position:relative;font-family:\"Montserrat\", sans-serif}.ChallengeJoinButton.Joined{background: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}.ChallengeJoinButton.Joined::before{border-radius:99px}.Disabled{opacity:0.5;pointer-events:none;cursor:auto}.ChallengeCountdown{font-weight:var(--emw--font-weight-normal, 400);font-size:var(--emw--font-size-x-small, 12px);line-height:12px;margin:12px 0 24px;color:var(--emw--color-gray-150, #BBB9C3)}.ChallengeCountdown.Expired{font-weight:var(--emw--font-weight-normal, 700);color:var(--emfe-w-color-white, #FFF)}.ChallengeCollapseButton{margin-bottom:14px;display:flex;flex-direction:row;align-items:center;font-size:var(--emw--font-size-x-small, 12px);line-height:12px;color:var(--emw--color-primary-variant, #666178);cursor:pointer}.ChallengeCollapseButton .Toggle{width:16px;height:16px;display:block;margin-right:4px}.ChallengeCollapseButton .Closed{background:url(\"https://static.everymatrix.com/gic/img/engagement-suite/eye-closed.svg\") no-repeat center/contain}.ChallengeCollapseButton .Open{background:url(\"https://static.everymatrix.com/gic/img/engagement-suite/eye-open.svg\") no-repeat center/contain}.CollapseDetails{display:none;font-size:var(--emw--font-size-small, 14px);line-height:17px;font-weight:var(--emw--font-weight-normal, 400)}.CollapseDetails .ChallengeDescription{color:var(--emfe-w-color-white, #FFF);margin-bottom:12px}.CollapseDetails .TC{margin:12px 0 16px}.CollapseDetails .TC a{color:var(--emw--color-secondary, #59D1FF);text-underline-offset:3px}.CollapseDetails .ChallengeGames{width:100%;overflow-y:auto;display:flex;gap:4px}.CollapseDetails .ChallengeGames::-webkit-scrollbar{height:2px;background:none}.CollapseDetails .ChallengeGames::-webkit-scrollbar-thumb{border-radius:4px;background-color:var(--emw--color-background, #666178)}.CollapseDetails .ChallengeGames .Game img{width:96px;height:50px;border-radius:2px;cursor:pointer}.ShowDetails{display:block}.ChallengeLevels{display:flex;flex-direction:column;gap:16px;margin-top:24px;color:var(--emw--color-primary, #8F8B9C);font-size:var(--emw--font-size-small, 12px);font-weight:var(--emw--font-weight-normal, 400);line-height:12px}.ChallengeLevels .ChallengeLevelCard{border:1px solid var(--emw--button-border-color, #403956);padding:16px;border-radius:8px}.ChallengeLevels .ChallengeLevelCard .ChallengeLevelTitle{margin-bottom:2px}.ChallengeLevels .ChallengeLevelCard .ChallengeRewardMessage{margin-top:10px;line-height:15px;display:flex;flex-direction:row;align-items:center;gap:4px}.ChallengeLevels .ChallengeLevelCard .ChallengeRewardMessage .CustomRewardMessage{font-weight:var(--emw--font-weight-semibold, 600);word-break:break-all}.ChallengeLevels .InProgress{position:relative;border:none}.ChallengeLevels .InProgress .ChallengeLevelTarget,.ChallengeLevels .InProgress .CustomRewardMessage{color:var(--emfe-w-color-white, #FFF)}.ChallengeLevels .InProgress::before{content:\"\";position:absolute;inset:0;border-radius:8px;padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeDetailsPopup.Tablet .ChallengeActions,.ChallengeDetailsPopup.Desktop .ChallengeActions{padding-top:16px}.ChallengeDetailsPopup.Tablet .ChallengeIconButton,.ChallengeDetailsPopup.Desktop .ChallengeIconButton{width:24px;height:24px}.ChallengeDetailsPopup.Tablet .ChallengeDetails,.ChallengeDetailsPopup.Desktop .ChallengeDetails{padding:20px 24px}.ChallengeDetailsPopup.Tablet .ChallengeName,.ChallengeDetailsPopup.Desktop .ChallengeName{line-height:27px;font-size:22px}.ChallengeDetailsPopup.Tablet .ChallengeJoinButton,.ChallengeDetailsPopup.Desktop .ChallengeJoinButton{min-width:100px;height:36px;font-size:16px}.ChallengeDetailsPopup.Tablet .ChallengeCountdown,.ChallengeDetailsPopup.Tablet .ChallengeLevels,.ChallengeDetailsPopup.Desktop .ChallengeCountdown,.ChallengeDetailsPopup.Desktop .ChallengeLevels{font-size:var(--emw--font-size-small, 14px);line-height:14px}.ChallengeDetailsPopup.Tablet .ChallengeCollapseButton,.ChallengeDetailsPopup.Desktop .ChallengeCollapseButton{margin-bottom:12px}.ChallengeDetailsPopup.Tablet .ChallengeLevels .ChallengeLevelTitle,.ChallengeDetailsPopup.Desktop .ChallengeLevels .ChallengeLevelTitle{margin-bottom:4px}.ChallengeDetailsPopup.Tablet .ChallengeLevels .ChallengeRewardMessage,.ChallengeDetailsPopup.Desktop .ChallengeLevels .ChallengeRewardMessage{margin-top:12px;line-height:17px}";
|
|
41
|
+
|
|
42
|
+
const CasinoEngagementSuiteChallengesDetails = class {
|
|
43
|
+
constructor(hostRef) {
|
|
44
|
+
registerInstance(this, hostRef);
|
|
45
|
+
this.close = createEvent(this, "close", 7);
|
|
46
|
+
this.back = createEvent(this, "back", 7);
|
|
47
|
+
/**
|
|
48
|
+
* Client custom styling via string
|
|
49
|
+
*/
|
|
50
|
+
this.clientStyling = '';
|
|
51
|
+
/**
|
|
52
|
+
* Client custom styling via url
|
|
53
|
+
*/
|
|
54
|
+
this.clientStylingUrl = '';
|
|
55
|
+
/**
|
|
56
|
+
* Language of the widget
|
|
57
|
+
*/
|
|
58
|
+
this.language = 'en';
|
|
59
|
+
/**
|
|
60
|
+
* Current game slug
|
|
61
|
+
*/
|
|
62
|
+
this.gameSlug = '';
|
|
63
|
+
/**
|
|
64
|
+
* User's device type
|
|
65
|
+
*/
|
|
66
|
+
this.device = 'Mobile';
|
|
67
|
+
this.limitStylingAppends = false;
|
|
68
|
+
this.timer = '';
|
|
69
|
+
this.showDetails = false;
|
|
70
|
+
this.isExpiredChallenge = false;
|
|
71
|
+
this.setClientStyling = () => {
|
|
72
|
+
let sheet = document.createElement('style');
|
|
73
|
+
sheet.innerHTML = this.clientStyling;
|
|
74
|
+
this.host.prepend(sheet);
|
|
75
|
+
};
|
|
76
|
+
this.setClientStylingURL = () => {
|
|
77
|
+
let url = new URL(this.clientStylingUrl);
|
|
78
|
+
let cssFile = document.createElement('style');
|
|
79
|
+
fetch(url.href)
|
|
80
|
+
.then((res) => res.text())
|
|
81
|
+
.then((data) => {
|
|
82
|
+
cssFile.innerHTML = data;
|
|
83
|
+
setTimeout(() => { this.host.prepend(cssFile); }, 1);
|
|
84
|
+
})
|
|
85
|
+
.catch((err) => {
|
|
86
|
+
console.log('Error ', err);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
this.handleCloseClick = () => {
|
|
90
|
+
this.close.emit();
|
|
91
|
+
};
|
|
92
|
+
this.handleBackClick = () => {
|
|
93
|
+
this.back.emit();
|
|
94
|
+
};
|
|
95
|
+
this.onGameClick = (ev) => {
|
|
96
|
+
const gameSlug = ev.currentTarget.getAttribute('data-slug');
|
|
97
|
+
window.postMessage({ type: 'EngagementSuiteGameRedirect', Slug: gameSlug });
|
|
98
|
+
};
|
|
99
|
+
this.changeChallengeStatus = (e) => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
const id = +e.currentTarget.getAttribute('data-id');
|
|
102
|
+
if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
|
|
103
|
+
window.postMessage({
|
|
104
|
+
type: 'ShowConfirmationModal',
|
|
105
|
+
ProgressToDeactivate: id,
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
110
|
+
window.postMessage({
|
|
111
|
+
type: 'ShowConfirmationModal',
|
|
112
|
+
ProgressToActivate: id,
|
|
113
|
+
ProgressToDeactivate: this.inProgressChallenges[0],
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
window.postMessage({
|
|
118
|
+
type: 'ChallengeJoinRequest',
|
|
119
|
+
data: {
|
|
120
|
+
ProgressToActivate: id,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
this.toggle = () => {
|
|
125
|
+
this.showDetails = !this.showDetails;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
challengePropHandler(value) {
|
|
129
|
+
if (!this.interval && value) {
|
|
130
|
+
this.updateTimer();
|
|
131
|
+
this.startCountdown();
|
|
132
|
+
}
|
|
133
|
+
if (this.interval && !value) {
|
|
134
|
+
clearInterval(this.interval);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
componentWillLoad() {
|
|
138
|
+
this.challengePropHandler(this.challenge);
|
|
139
|
+
}
|
|
140
|
+
componentDidRender() {
|
|
141
|
+
if (!this.limitStylingAppends && this.host) {
|
|
142
|
+
if (this.clientStyling)
|
|
143
|
+
this.setClientStyling();
|
|
144
|
+
if (this.clientStylingUrl)
|
|
145
|
+
this.setClientStylingURL();
|
|
146
|
+
this.limitStylingAppends = true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
disconnectedCallback() {
|
|
150
|
+
this.interval && clearInterval(this.interval);
|
|
151
|
+
}
|
|
152
|
+
getActionsTemplate() {
|
|
153
|
+
return (h("header", { class: "ChallengeActions" }, h("button", { class: "ChallengeIconButton", onClick: this.handleBackClick }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/back.svg", alt: "back" })), this.device !== 'Mobile' && h("div", { class: "ChallengePopupName" }, translate('challenges', this.language)), h("button", { class: "ChallengeIconButton", onClick: this.handleCloseClick }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "close" }))));
|
|
154
|
+
}
|
|
155
|
+
getChallengeHeader() {
|
|
156
|
+
const presentationName = this.challenge.ChallengePresentation.PresentationName;
|
|
157
|
+
const inProgressChallenge = this.challenge.Status === ChallengeProgressStatus.InProgress;
|
|
158
|
+
return (h("div", { class: "ChallengeDetailsHeader" }, h("span", { class: "ChallengeName" }, presentationName), h("button", { onClick: this.changeChallengeStatus, class: `ChallengeJoinButton ${inProgressChallenge ? 'Joined' : ''}
|
|
159
|
+
${this.isExpiredChallenge || this.isJoiningToChallenge ? 'Disabled' : ''}`, "data-id": this.challenge.Id }, inProgressChallenge
|
|
160
|
+
? translate('unjoin', this.language)
|
|
161
|
+
: translate('join', this.language))));
|
|
162
|
+
}
|
|
163
|
+
getChallengeCountdown() {
|
|
164
|
+
const timerMessage = this.isExpiredChallenge ? 'Expired' : this.timer;
|
|
165
|
+
return (h("div", { class: `ChallengeCountdown ${this.isExpiredChallenge ? 'Expired' : ''}` }, timerMessage));
|
|
166
|
+
}
|
|
167
|
+
getChallengeDetails() {
|
|
168
|
+
const description = this.challenge.ChallengePresentation.Description;
|
|
169
|
+
const url = this.challenge.ChallengePresentation.Url;
|
|
170
|
+
const games = this.challenge.Games;
|
|
171
|
+
return (h("div", { class: `CollapseDetails ${this.showDetails ? 'ShowDetails' : ''}` }, description && h("span", { class: "ChallengeDescription" }, description), url && (h("div", { class: "TC" }, h("a", { href: url, target: "_blank" }, translate('tc', this.language)))), (games === null || games === void 0 ? void 0 : games.length) && (h("div", { class: "ChallengeGames" }, games.map((game) => (h("div", { class: "Game", key: game.CasinoGameId }, h("img", { src: game.GameIcon, alt: game.GameName, onClick: this.onGameClick, class: `${game.GameSlug === this.gameSlug ? 'Disabled' : ''}`, "data-slug": game.GameSlug }))))))));
|
|
172
|
+
}
|
|
173
|
+
startCountdown() {
|
|
174
|
+
this.interval = setInterval(() => {
|
|
175
|
+
this.updateTimer();
|
|
176
|
+
}, 1000);
|
|
177
|
+
}
|
|
178
|
+
updateTimer() {
|
|
179
|
+
const expirationTime = new Date(this.challenge.ExpirationTime).getTime();
|
|
180
|
+
const now = new Date().getTime();
|
|
181
|
+
const distance = expirationTime - now;
|
|
182
|
+
if (distance < 1) {
|
|
183
|
+
clearInterval(this.interval);
|
|
184
|
+
this.timer = '';
|
|
185
|
+
this.isExpiredChallenge = true;
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const { days, hours, minutes, seconds } = {
|
|
189
|
+
days: String(Math.floor(distance / (1000 * 60 * 60 * 24))).padStart(2, '0'),
|
|
190
|
+
hours: String(Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
|
|
191
|
+
minutes: String(Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
|
|
192
|
+
seconds: String(Math.floor((distance % (1000 * 60)) / 1000)).padStart(2, '0')
|
|
193
|
+
};
|
|
194
|
+
this.timer = days === '00'
|
|
195
|
+
? `${hours}h:${minutes}m:${seconds}s`
|
|
196
|
+
: `${days}d:${hours}h:${minutes}m`;
|
|
197
|
+
}
|
|
198
|
+
getLevelTarget(level) {
|
|
199
|
+
let levelTarget = `${translate('place', this.language)} ${level.DisplayCurrencyTargetTurnover}`;
|
|
200
|
+
if (level.LevelTargetType === 1) {
|
|
201
|
+
levelTarget += ` ${translate('bet', this.language)}`;
|
|
202
|
+
}
|
|
203
|
+
else if (level.LevelTargetType === 2) {
|
|
204
|
+
levelTarget += ` ${translate('bets', this.language)} X ${level.TargetBetCount}`;
|
|
205
|
+
}
|
|
206
|
+
return (h("span", { class: "ChallengeLevelTarget" }, levelTarget));
|
|
207
|
+
}
|
|
208
|
+
getChallengeLevels() {
|
|
209
|
+
const isChallengePaused = this.challenge.Status === ChallengeProgressStatus.Started
|
|
210
|
+
&& this.challenge.LevelProgresses[0].ProgressPercentage > 0;
|
|
211
|
+
const getClass = (level) => {
|
|
212
|
+
return `ChallengeLevelCard ${(level.ProgressStatus === 1 && !this.isExpiredChallenge && !isChallengePaused) ? 'InProgress' : ''}`;
|
|
213
|
+
};
|
|
214
|
+
return (h("div", { class: "ChallengeLevels" }, this.challenge.LevelProgresses.map((level, index) => (h("div", { class: getClass(level) }, h("casino-engagement-suite-progress-bar", { class: this.device, value: level.ProgressPercentage, "hide-percent": level.ProgressPercentage === 0 || level.ProgressPercentage === 100, disabled: this.isExpiredChallenge || isChallengePaused }, h("span", { slot: "Title", class: "ChallengeLevelTitle" }, h("span", null, "Level ", index + 1, ": "), this.getLevelTarget(level))), h("div", { class: "ChallengeRewardMessage" }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/reward.svg", alt: "win" }), h("span", null, translate('win', this.language), ": "), h("span", { class: "CustomRewardMessage" }, level.CustomRewardMessage)))))));
|
|
215
|
+
}
|
|
216
|
+
getToggleButton() {
|
|
217
|
+
return (h("div", { class: "ChallengeCollapseButton", onClick: this.toggle }, h("span", { class: `Toggle ${this.showDetails ? 'Closed' : 'Open'}` }), h("span", null, translate('details', this.language))));
|
|
218
|
+
}
|
|
219
|
+
render() {
|
|
220
|
+
return h("div", { class: `ChallengeDetailsPopup ${this.device}` }, this.getActionsTemplate(), h("div", { class: "ChallengeDetails" }, this.getChallengeHeader(), this.getChallengeCountdown(), this.getToggleButton(), this.getChallengeDetails(), this.getChallengeLevels()));
|
|
221
|
+
}
|
|
222
|
+
get host() { return getElement(this); }
|
|
223
|
+
static get watchers() { return {
|
|
224
|
+
"challenge": ["challengePropHandler"]
|
|
225
|
+
}; }
|
|
226
|
+
};
|
|
227
|
+
CasinoEngagementSuiteChallengesDetails.style = casinoEngagementSuiteChallengesDetailsCss;
|
|
228
|
+
|
|
229
|
+
const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background: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-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
|
|
230
|
+
|
|
231
|
+
const CasinoEngagementSuiteProgressBar = class {
|
|
232
|
+
constructor(hostRef) {
|
|
233
|
+
registerInstance(this, hostRef);
|
|
234
|
+
/**
|
|
235
|
+
* Value for the widget
|
|
236
|
+
*/
|
|
237
|
+
this.value = 0;
|
|
238
|
+
/**
|
|
239
|
+
* Shows disabled styles
|
|
240
|
+
*/
|
|
241
|
+
this.disabled = false;
|
|
242
|
+
/**
|
|
243
|
+
* Hide percent value
|
|
244
|
+
*/
|
|
245
|
+
this.hidePercent = false;
|
|
246
|
+
/**
|
|
247
|
+
* Client custom styling via string
|
|
248
|
+
*/
|
|
249
|
+
this.clientStyling = '';
|
|
250
|
+
/**
|
|
251
|
+
* Client custom styling via url
|
|
252
|
+
*/
|
|
253
|
+
this.clientStylingUrl = '';
|
|
254
|
+
this.limitStylingAppends = false;
|
|
255
|
+
this.setClientStyling = () => {
|
|
256
|
+
let sheet = document.createElement('style');
|
|
257
|
+
sheet.innerHTML = this.clientStyling;
|
|
258
|
+
this.host.prepend(sheet);
|
|
259
|
+
};
|
|
260
|
+
this.setClientStylingURL = () => {
|
|
261
|
+
let url = new URL(this.clientStylingUrl);
|
|
262
|
+
let cssFile = document.createElement('style');
|
|
263
|
+
fetch(url.href)
|
|
264
|
+
.then((res) => res.text())
|
|
265
|
+
.then((data) => {
|
|
266
|
+
cssFile.innerHTML = data;
|
|
267
|
+
setTimeout(() => { this.host.prepend(cssFile); }, 1);
|
|
268
|
+
})
|
|
269
|
+
.catch((err) => {
|
|
270
|
+
console.log('Error ', err);
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
componentDidRender() {
|
|
275
|
+
if (!this.limitStylingAppends && this.host) {
|
|
276
|
+
if (this.clientStyling)
|
|
277
|
+
this.setClientStyling();
|
|
278
|
+
if (this.clientStylingUrl)
|
|
279
|
+
this.setClientStylingURL();
|
|
280
|
+
this.limitStylingAppends = true;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
getProgressBarClasses() {
|
|
284
|
+
return {
|
|
285
|
+
ProgressBar: true,
|
|
286
|
+
Completed: this.value === 100,
|
|
287
|
+
Disabled: this.disabled,
|
|
288
|
+
HidePercent: this.hidePercent
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
render() {
|
|
292
|
+
return h("div", { class: this.getProgressBarClasses(), part: "ProgressBar" }, h("div", { class: "ProgressBarInfo", part: "ProgressBarInfo" }, h("slot", { name: "Title" }, h("div", null)), h("slot", { name: "Percent" }, h("div", { class: "ProgressBarPercent", part: "ProgressBarPercent" }, this.value, "%"))), h("div", { class: "ProgressBarBackground", part: "ProgressBarBackground" }, h("div", { class: "ProgressBarLine", part: "ProgressBarLine", style: { width: this.value + '%' } })));
|
|
293
|
+
}
|
|
294
|
+
get host() { return getElement(this); }
|
|
295
|
+
};
|
|
296
|
+
CasinoEngagementSuiteProgressBar.style = casinoEngagementSuiteProgressBarCss;
|
|
297
|
+
|
|
298
|
+
export { CasinoEngagementSuiteChallengesDetails as casino_engagement_suite_challenges_details, CasinoEngagementSuiteProgressBar as casino_engagement_suite_progress_bar };
|
|
@@ -132,6 +132,7 @@ const isComplexType = (o) => {
|
|
|
132
132
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
133
133
|
const h = (nodeName, vnodeData, ...children) => {
|
|
134
134
|
let child = null;
|
|
135
|
+
let key = null;
|
|
135
136
|
let simple = false;
|
|
136
137
|
let lastSimple = false;
|
|
137
138
|
let vNodeChildren = [];
|
|
@@ -159,6 +160,10 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
159
160
|
};
|
|
160
161
|
walk(children);
|
|
161
162
|
if (vnodeData) {
|
|
163
|
+
// normalize class / classname attributes
|
|
164
|
+
if (vnodeData.key) {
|
|
165
|
+
key = vnodeData.key;
|
|
166
|
+
}
|
|
162
167
|
{
|
|
163
168
|
const classData = vnodeData.className || vnodeData.class;
|
|
164
169
|
if (classData) {
|
|
@@ -176,6 +181,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
176
181
|
if (vNodeChildren.length > 0) {
|
|
177
182
|
vnode.$children$ = vNodeChildren;
|
|
178
183
|
}
|
|
184
|
+
{
|
|
185
|
+
vnode.$key$ = key;
|
|
186
|
+
}
|
|
179
187
|
return vnode;
|
|
180
188
|
};
|
|
181
189
|
const newVNode = (tag, text) => {
|
|
@@ -189,6 +197,9 @@ const newVNode = (tag, text) => {
|
|
|
189
197
|
{
|
|
190
198
|
vnode.$attrs$ = null;
|
|
191
199
|
}
|
|
200
|
+
{
|
|
201
|
+
vnode.$key$ = null;
|
|
202
|
+
}
|
|
192
203
|
return vnode;
|
|
193
204
|
};
|
|
194
205
|
const Host = {};
|
|
@@ -212,6 +223,33 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
212
223
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
213
224
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
214
225
|
}
|
|
226
|
+
else if (memberName === 'style') {
|
|
227
|
+
// update style attribute, css properties and values
|
|
228
|
+
{
|
|
229
|
+
for (const prop in oldValue) {
|
|
230
|
+
if (!newValue || newValue[prop] == null) {
|
|
231
|
+
if (prop.includes('-')) {
|
|
232
|
+
elm.style.removeProperty(prop);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
elm.style[prop] = '';
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
for (const prop in newValue) {
|
|
241
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
242
|
+
if (prop.includes('-')) {
|
|
243
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
elm.style[prop] = newValue[prop];
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
else if (memberName === 'key')
|
|
252
|
+
;
|
|
215
253
|
else if ((!isProp ) &&
|
|
216
254
|
memberName[0] === 'o' &&
|
|
217
255
|
memberName[1] === 'n') {
|
|
@@ -376,6 +414,8 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
376
414
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
377
415
|
let oldStartIdx = 0;
|
|
378
416
|
let newStartIdx = 0;
|
|
417
|
+
let idxInOld = 0;
|
|
418
|
+
let i = 0;
|
|
379
419
|
let oldEndIdx = oldCh.length - 1;
|
|
380
420
|
let oldStartVnode = oldCh[0];
|
|
381
421
|
let oldEndVnode = oldCh[oldEndIdx];
|
|
@@ -383,6 +423,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
383
423
|
let newStartVnode = newCh[0];
|
|
384
424
|
let newEndVnode = newCh[newEndIdx];
|
|
385
425
|
let node;
|
|
426
|
+
let elmToMove;
|
|
386
427
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
387
428
|
if (oldStartVnode == null) {
|
|
388
429
|
// Vnode might have been moved left
|
|
@@ -420,7 +461,29 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
420
461
|
newStartVnode = newCh[++newStartIdx];
|
|
421
462
|
}
|
|
422
463
|
else {
|
|
464
|
+
// createKeyToOldIdx
|
|
465
|
+
idxInOld = -1;
|
|
423
466
|
{
|
|
467
|
+
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
468
|
+
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
469
|
+
idxInOld = i;
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (idxInOld >= 0) {
|
|
475
|
+
elmToMove = oldCh[idxInOld];
|
|
476
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
477
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
patch(elmToMove, newStartVnode);
|
|
481
|
+
oldCh[idxInOld] = undefined;
|
|
482
|
+
node = elmToMove.$elm$;
|
|
483
|
+
}
|
|
484
|
+
newStartVnode = newCh[++newStartIdx];
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
424
487
|
// new element
|
|
425
488
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
426
489
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -443,7 +506,9 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
443
506
|
// compare if two vnode to see if they're "technically" the same
|
|
444
507
|
// need to have the same element tag, and same key to be the same
|
|
445
508
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
446
|
-
|
|
509
|
+
{
|
|
510
|
+
return vnode1.$key$ === vnode2.$key$;
|
|
511
|
+
}
|
|
447
512
|
}
|
|
448
513
|
return false;
|
|
449
514
|
};
|
|
@@ -451,11 +516,14 @@ const patch = (oldVNode, newVNode) => {
|
|
|
451
516
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
452
517
|
const oldChildren = oldVNode.$children$;
|
|
453
518
|
const newChildren = newVNode.$children$;
|
|
519
|
+
const tag = newVNode.$tag$;
|
|
454
520
|
const text = newVNode.$text$;
|
|
455
521
|
if (text === null) {
|
|
456
522
|
// element node
|
|
457
523
|
{
|
|
458
|
-
|
|
524
|
+
if (tag === 'slot')
|
|
525
|
+
;
|
|
526
|
+
else {
|
|
459
527
|
// either this is the first render of an element OR it's an update
|
|
460
528
|
// AND we already know it's possible it could have changed
|
|
461
529
|
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
@@ -716,6 +784,15 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
|
716
784
|
const parsePropertyValue = (propValue, propType) => {
|
|
717
785
|
// ensure this value is of the correct prop type
|
|
718
786
|
if (propValue != null && !isComplexType(propValue)) {
|
|
787
|
+
if (propType & 4 /* Boolean */) {
|
|
788
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
789
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
790
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
791
|
+
}
|
|
792
|
+
if (propType & 2 /* Number */) {
|
|
793
|
+
// force it to be a number
|
|
794
|
+
return parseFloat(propValue);
|
|
795
|
+
}
|
|
719
796
|
if (propType & 1 /* String */) {
|
|
720
797
|
// could have been passed as a number or boolean
|
|
721
798
|
// but we still want it as a string
|
|
@@ -987,7 +1064,11 @@ const connectedCallback = (elm) => {
|
|
|
987
1064
|
};
|
|
988
1065
|
const disconnectedCallback = (elm) => {
|
|
989
1066
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
990
|
-
getHostRef(elm);
|
|
1067
|
+
const hostRef = getHostRef(elm);
|
|
1068
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1069
|
+
{
|
|
1070
|
+
safeCall(instance, 'disconnectedCallback');
|
|
1071
|
+
}
|
|
991
1072
|
}
|
|
992
1073
|
};
|
|
993
1074
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-c5abae48.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["casino-engagement-suite-challenges-
|
|
13
|
+
return bootstrapLazy([["casino-engagement-suite-challenges-details_2",[[1,"casino-engagement-suite-challenges-details",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"challenge":[16],"inProgressChallenges":[16],"language":[1],"gameSlug":[1,"game-slug"],"device":[1],"isJoiningToChallenge":[1028,"is-joining-to-challenge"],"limitStylingAppends":[32],"timer":[32],"showDetails":[32],"isExpiredChallenge":[32]}],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"hidePercent":[4,"hide-percent"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { Challenge, LevelProgress } from '../../models/casino-challenges-details';
|
|
3
|
+
import '@everymatrix/casino-engagement-suite-progress-bar';
|
|
3
4
|
export declare class CasinoEngagementSuiteChallengesDetails {
|
|
4
5
|
/**
|
|
5
6
|
* Client custom styling via string
|
|
@@ -10,9 +11,13 @@ export declare class CasinoEngagementSuiteChallengesDetails {
|
|
|
10
11
|
*/
|
|
11
12
|
clientStylingUrl: string;
|
|
12
13
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
* Selected challenge
|
|
15
|
+
*/
|
|
15
16
|
challenge: Challenge;
|
|
17
|
+
/**
|
|
18
|
+
*Active challenges
|
|
19
|
+
*/
|
|
20
|
+
inProgressChallenges: Array<number>;
|
|
16
21
|
/**
|
|
17
22
|
* Language of the widget
|
|
18
23
|
*/
|
|
@@ -25,17 +30,23 @@ export declare class CasinoEngagementSuiteChallengesDetails {
|
|
|
25
30
|
* User's device type
|
|
26
31
|
*/
|
|
27
32
|
device: "Mobile" | "Tablet" | "Desktop";
|
|
33
|
+
/**
|
|
34
|
+
*Is joining to challenge
|
|
35
|
+
*/
|
|
36
|
+
isJoiningToChallenge: boolean;
|
|
28
37
|
close: EventEmitter<void>;
|
|
38
|
+
back: EventEmitter<void>;
|
|
29
39
|
private limitStylingAppends;
|
|
30
40
|
timer: string;
|
|
31
41
|
showDetails: boolean;
|
|
32
42
|
isExpiredChallenge: boolean;
|
|
33
43
|
host: HTMLElement;
|
|
34
44
|
challengeDetails: HTMLElement;
|
|
45
|
+
challengePropHandler(value: Challenge): void;
|
|
35
46
|
interval: any;
|
|
36
|
-
challengePropHandler(): void;
|
|
37
47
|
componentWillLoad(): void;
|
|
38
48
|
componentDidRender(): void;
|
|
49
|
+
disconnectedCallback(): void;
|
|
39
50
|
setClientStyling: () => void;
|
|
40
51
|
setClientStylingURL: () => void;
|
|
41
52
|
getActionsTemplate(): any;
|
|
@@ -43,11 +54,14 @@ export declare class CasinoEngagementSuiteChallengesDetails {
|
|
|
43
54
|
getChallengeCountdown(): any;
|
|
44
55
|
getChallengeDetails(): any;
|
|
45
56
|
handleCloseClick: () => void;
|
|
46
|
-
|
|
57
|
+
handleBackClick: () => void;
|
|
58
|
+
onGameClick: (ev: MouseEvent) => void;
|
|
59
|
+
changeChallengeStatus: (e: MouseEvent) => void;
|
|
47
60
|
startCountdown(): void;
|
|
48
61
|
updateTimer(): void;
|
|
49
62
|
getLevelTarget(level: LevelProgress): any;
|
|
50
63
|
getChallengeLevels(): any;
|
|
51
64
|
getToggleButton(): any;
|
|
65
|
+
toggle: () => void;
|
|
52
66
|
render(): any;
|
|
53
67
|
}
|
|
@@ -28,6 +28,14 @@ export namespace Components {
|
|
|
28
28
|
* Current game slug
|
|
29
29
|
*/
|
|
30
30
|
"gameSlug": string;
|
|
31
|
+
/**
|
|
32
|
+
* Active challenges
|
|
33
|
+
*/
|
|
34
|
+
"inProgressChallenges": Array<number>;
|
|
35
|
+
/**
|
|
36
|
+
* Is joining to challenge
|
|
37
|
+
*/
|
|
38
|
+
"isJoiningToChallenge": boolean;
|
|
31
39
|
/**
|
|
32
40
|
* Language of the widget
|
|
33
41
|
*/
|
|
@@ -67,10 +75,19 @@ declare namespace LocalJSX {
|
|
|
67
75
|
* Current game slug
|
|
68
76
|
*/
|
|
69
77
|
"gameSlug"?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Active challenges
|
|
80
|
+
*/
|
|
81
|
+
"inProgressChallenges"?: Array<number>;
|
|
82
|
+
/**
|
|
83
|
+
* Is joining to challenge
|
|
84
|
+
*/
|
|
85
|
+
"isJoiningToChallenge"?: boolean;
|
|
70
86
|
/**
|
|
71
87
|
* Language of the widget
|
|
72
88
|
*/
|
|
73
89
|
"language"?: string;
|
|
90
|
+
"onBack"?: (event: CustomEvent<void>) => void;
|
|
74
91
|
"onClose"?: (event: CustomEvent<void>) => void;
|
|
75
92
|
}
|
|
76
93
|
interface IntrinsicElements {
|
|
@@ -37,6 +37,7 @@ export interface LevelProgress {
|
|
|
37
37
|
Rewards: Array<Reward>;
|
|
38
38
|
TargetBetCount: number;
|
|
39
39
|
TargetTurnover: number;
|
|
40
|
+
DisplayCurrencyTargetTurnover: number;
|
|
40
41
|
CustomRewardMessage: string;
|
|
41
42
|
}
|
|
42
43
|
export declare enum ChallengeProgressStatus {
|
|
@@ -55,4 +56,5 @@ export interface Challenge {
|
|
|
55
56
|
Id: number;
|
|
56
57
|
LevelProgresses: Array<LevelProgress>;
|
|
57
58
|
Status: ChallengeProgressStatus;
|
|
59
|
+
IsNew: boolean;
|
|
58
60
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as l,h as t,g as a}from"./p-764c820d.js";const n=["en"],s={en:{challenges:"Challenges",join:"Join",unjoin:"Unjoin",details:"Challenge Details",tc:"Terms & Conditions",level:"Level",place:"Place",bet:"bet",bets:"bets",win:"Win"}},i=(e,l)=>{const t=l;return s[void 0!==t&&n.includes(t)?t:"en"][e]};var o,r;!function(e){e[e.Closed=0]="Closed",e[e.InProgress=1]="InProgress",e[e.Fillup=2]="Fillup",e[e.Completed=3]="Completed"}(o||(o={})),function(e){e[e.Started=0]="Started",e[e.InProgress=1]="InProgress",e[e.PendingLevelReward=2]="PendingLevelReward",e[e.Completed=3]="Completed",e[e.Expired=4]="Expired"}(r||(r={}));const h=class{constructor(t){e(this,t),this.close=l(this,"close",7),this.clientStyling="",this.clientStylingUrl="",this.language="en",this.gameSlug="",this.device="Mobile",this.limitStylingAppends=!1,this.timer="",this.showDetails=!1,this.isExpiredChallenge=!1,this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.host.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),l=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{l.innerHTML=e,setTimeout((()=>{this.host.prepend(l)}),1)})).catch((e=>{console.log("Error ",e)}))},this.handleCloseClick=()=>{this.close.emit(),clearInterval(this.interval),this.isExpiredChallenge=!1,this.showDetails=!1}}challengePropHandler(){this.updateTimer(),this.startCountdown()}componentWillLoad(){this.challengePropHandler()}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}getActionsTemplate(){return t("header",{class:"ChallengeActions"},t("button",{class:"ChallengeIconButton"},t("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/back.svg",alt:"back"})),"Mobile"!==this.device&&t("div",{class:"ChallengePopupName"},i("challenges",this.language)),t("button",{class:"ChallengeIconButton",onClick:this.handleCloseClick},t("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/close.svg",alt:"close"})))}getChallengeHeader(){const e=this.challenge.Status===r.InProgress;return t("div",{class:"ChallengeDetailsHeader"},t("span",{class:"ChallengeName"},this.challenge.ChallengePresentation.PresentationName),t("button",{class:`ChallengeJoinButton ${e?"Joined":""}\n ${this.isExpiredChallenge?"Disabled":""}`},i(e?"unjoin":"join",this.language)))}getChallengeCountdown(){return t("div",{class:"ChallengeCountdown "+(this.isExpiredChallenge?"Expired":"")},this.isExpiredChallenge?"Expired":this.timer)}getChallengeDetails(){const e=this.challenge.ChallengePresentation.Description,l=this.challenge.ChallengePresentation.Url,a=this.challenge.Games;return t("div",{class:"CollapseDetails "+(this.showDetails?"ShowDetails":"")},e&&t("span",{class:"ChallengeDescription"},e),l&&t("div",{class:"TC"},t("a",{href:l,target:"_blank"},i("tc",this.language))),(null==a?void 0:a.length)&&t("div",{class:"ChallengeGames"},a.map((e=>t("div",{class:"Game"},t("img",{src:e.GameIcon,alt:e.GameName,onClick:()=>this.onGameClick(e.GameSlug),class:e.GameSlug===this.gameSlug?"Disabled":""}))))))}onGameClick(e){window.postMessage({type:"GameClick",slug:e})}startCountdown(){this.interval=setInterval((()=>{this.updateTimer()}),1e3)}updateTimer(){const e=new Date(this.challenge.ExpirationTime).getTime()-(new Date).getTime();if(e<1)return clearInterval(this.interval),this.timer="",void(this.isExpiredChallenge=!0);const{days:l,hours:t,minutes:a,seconds:n}={days:String(Math.floor(e/864e5)).padStart(2,"0"),hours:String(Math.floor(e%864e5/36e5)).padStart(2,"0"),minutes:String(Math.floor(e%36e5/6e4)).padStart(2,"0"),seconds:String(Math.floor(e%6e4/1e3)).padStart(2,"0")};this.timer="00"===l?`${t}h:${a}m:${n}s`:`${l}d:${t}h:${a}m`}getLevelTarget(e){let l=`${i("place",this.language)} ${e.TargetTurnover}`;return 1===e.LevelTargetType?l+=` ${i("bet",this.language)}`:2===e.LevelTargetType&&(l+=` ${i("bets",this.language)} X ${e.TargetBetCount}`),t("span",{class:"ChallengeLevelTarget"},l)}getChallengeLevels(){return t("div",{class:"ChallengeLevels"},this.challenge.LevelProgresses.map(((e,l)=>t("div",{class:"ChallengeLevelCard "+(1===e.ProgressStatus?"InProgress":"")},t("div",{class:"ChallengeLevelHeader"},t("span",null,"Level ",l+1,": "),this.getLevelTarget(e)),t("div",{class:"ChallengeRewardMessage"},t("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/reward.svg",alt:"win"}),t("span",null,i("win",this.language),": "),t("span",{class:"CustomRewardMessage"},e.CustomRewardMessage))))))}getToggleButton(){return t("div",{class:"ChallengeCollapseButton",onClick:()=>this.showDetails=!this.showDetails},t("span",{class:"Toggle "+(this.showDetails?"Closed":"Open")}),t("span",null,i("details",this.language)))}render(){return t("div",{class:`ChallengeDetailsPopup ${this.device}`},this.getActionsTemplate(),t("div",{class:"ChallengeDetails"},this.getChallengeHeader(),this.getChallengeCountdown(),this.getToggleButton(),this.getChallengeDetails(),this.getChallengeLevels()))}get host(){return a(this)}static get watchers(){return{challenge:["challengePropHandler"]}}};h.style='@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;900&display=swap"); :host{display:block;font-family:inherit}*{box-sizing:border-box;margin:0;padding:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.ChallengeDetailsPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:8px;overflow:hidden;flex-direction:column;position:relative}.ChallengeActions{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.ChallengeActions .ChallengeIconButton{width:16px;height:16px;cursor:pointer}.ChallengeActions .ChallengePopupName{color:var(--emw--color-gray-100, #BBB9C3);font-size:16px;font-weight:500;line-height:16px}.ChallengeDetails{padding:0px 19px 10px;overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.ChallengeDetails::-webkit-scrollbar{display:none}.ChallengeDetailsHeader{display:flex;justify-content:space-between;gap:12px}.ChallengeDetailsHeader .ChallengeName{font-family:"Montserrat", sans-serif;font-size:var(--emw--font-size-medium, 18px);font-weight:var(--emw--font-weight-bold, 700);line-height:22px;color:var(--emfe-w-color-white, #FFF);word-break:break-all}.ChallengeJoinButton.Joined::before{content:"";position:absolute;inset:0;border-radius:var(--emw--button-border-radius, 4px);padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeJoinButton{transition:all 0.5s ease-out;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:var(--emw--color-typography, #1E1638);border-radius:99px;min-width:88px;height:32px;font-size:14px;font-weight:700;position:relative;font-family:"Montserrat", sans-serif}.ChallengeJoinButton.Joined{background: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}.ChallengeJoinButton.Joined::before{border-radius:99px}.Disabled{opacity:0.5;pointer-events:none;cursor:auto}.ChallengeCountdown{font-weight:var(--emw--font-weight-normal, 400);font-size:var(--emw--font-size-x-small, 12px);line-height:12px;margin:12px 0 24px;color:var(--emw--color-gray-150, #BBB9C3)}.ChallengeCountdown.Expired{font-weight:var(--emw--font-weight-normal, 700);color:var(--emfe-w-color-white, #FFF)}.ChallengeCollapseButton{margin-bottom:14px;display:flex;flex-direction:row;align-items:center;color:var(--emw--color-primary-variant, #666178);cursor:pointer}.ChallengeCollapseButton .Toggle{width:16px;height:16px;display:block;margin-right:4px}.ChallengeCollapseButton .Closed{background:url("https://static.everymatrix.com/gic/img/engagement-suite/eye-closed.svg") no-repeat center/contain}.ChallengeCollapseButton .Open{background:url("https://static.everymatrix.com/gic/img/engagement-suite/eye-open.svg") no-repeat center/contain}.CollapseDetails{display:none;font-size:var(--emw--font-size-small, 14px);line-height:17px;font-weight:var(--emw--font-weight-normal, 400)}.CollapseDetails .ChallengeDescription{color:var(--emfe-w-color-white, #FFF);margin-bottom:12px}.CollapseDetails .TC{margin:12px 0 16px}.CollapseDetails .TC a{color:var(--emw--color-secondary, #59D1FF)}.CollapseDetails .ChallengeGames{width:100%;overflow-y:auto;display:flex;gap:4px}.CollapseDetails .ChallengeGames::-webkit-scrollbar{height:2px;background:none}.CollapseDetails .ChallengeGames::-webkit-scrollbar-thumb{border-radius:4px;background-color:var(--emw--color-background, #666178)}.CollapseDetails .ChallengeGames .Game img{width:96px;height:50px;border-radius:2px;cursor:pointer}.ShowDetails{display:block}.ChallengeLevels{display:flex;flex-direction:column;gap:16px;margin-top:24px;color:var(--emw--color-primary, #8F8B9C);font-size:var(--emw--font-size-small, 12px);font-weight:var(--emw--font-weight-normal, 400);line-height:12px}.ChallengeLevels .ChallengeLevelCard{border:1px solid var(--emw--button-border-color, #403956);padding:16px;border-radius:8px}.ChallengeLevels .ChallengeLevelCard .ChallengeRewardMessage{margin-top:10px;display:flex;flex-direction:row;align-items:center;gap:4px}.ChallengeLevels .ChallengeLevelCard .ChallengeRewardMessage .CustomRewardMessage{font-weight:var(--emw--font-weight-semibold, 600);line-height:15px;word-break:break-all}.ChallengeLevels .InProgress{position:relative;border:none}.ChallengeLevels .InProgress .ChallengeLevelTarget,.ChallengeLevels .InProgress .CustomRewardMessage{color:var(--emfe-w-color-white, #FFF)}.ChallengeLevels .InProgress::before{content:"";position:absolute;inset:0;border-radius:8px;padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeDetailsPopup.Tablet .ChallengeIconButton,.ChallengeDetailsPopup.Desktop .ChallengeIconButton{width:24px;height:24px}.ChallengeDetailsPopup.Tablet .ChallengeDetails,.ChallengeDetailsPopup.Desktop .ChallengeDetails{padding:20px 24px}.ChallengeDetailsPopup.Tablet .ChallengeName,.ChallengeDetailsPopup.Desktop .ChallengeName{line-height:27px;font-size:22px}.ChallengeDetailsPopup.Tablet .ChallengeJoinButton,.ChallengeDetailsPopup.Desktop .ChallengeJoinButton{min-width:100px;height:36px;font-size:16px}.ChallengeDetailsPopup.Tablet .ChallengeCountdown,.ChallengeDetailsPopup.Tablet .ChallengeLevels,.ChallengeDetailsPopup.Desktop .ChallengeCountdown,.ChallengeDetailsPopup.Desktop .ChallengeLevels{font-size:var(--emw--font-size-small, 14px);line-height:14px}.ChallengeDetailsPopup.Tablet .ChallengeCollapseButton,.ChallengeDetailsPopup.Desktop .ChallengeCollapseButton{margin-bottom:12px}.ChallengeDetailsPopup.Tablet .ChallengeLevels .CustomRewardMessage,.ChallengeDetailsPopup.Desktop .ChallengeLevels .CustomRewardMessage{line-height:17px}';export{h as casino_engagement_suite_challenges_details}
|