@everymatrix/casino-engagement-suite-challenges-details 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/casino-engagement-suite-challenges-details/casino-engagement-suite-challenges-details.esm.js +1 -0
  2. package/dist/casino-engagement-suite-challenges-details/index.esm.js +0 -0
  3. package/dist/casino-engagement-suite-challenges-details/p-11d8b487.js +2 -0
  4. package/dist/casino-engagement-suite-challenges-details/p-d908af25.entry.js +1 -0
  5. package/dist/casino-engagement-suite-challenges-details/p-e1255160.js +1 -0
  6. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  7. package/dist/cjs/casino-engagement-suite-challenges-details.cjs.js +25 -0
  8. package/dist/cjs/casino-engagement-suite-challenges-details_2.cjs.entry.js +334 -0
  9. package/dist/cjs/index-a758ba24.js +1249 -0
  10. package/dist/cjs/index.cjs.js +2 -0
  11. package/dist/cjs/loader.cjs.js +15 -0
  12. package/dist/collection/collection-manifest.json +19 -0
  13. package/dist/collection/components/casino-engagement-suite-challenges-details/casino-engagement-suite-challenges-details.css +302 -0
  14. package/dist/collection/components/casino-engagement-suite-challenges-details/casino-engagement-suite-challenges-details.js +451 -0
  15. package/dist/collection/components/casino-engagement-suite-challenges-details/index.js +1 -0
  16. package/dist/collection/index.js +1 -0
  17. package/dist/collection/models/casino-challenges-details.js +16 -0
  18. package/dist/collection/utils/index.js +10 -0
  19. package/dist/collection/utils/locale.utils.js +23 -0
  20. package/dist/collection/utils/utils.js +3 -0
  21. package/dist/esm/app-globals-0f993ce5.js +3 -0
  22. package/dist/esm/casino-engagement-suite-challenges-details.js +20 -0
  23. package/dist/esm/casino-engagement-suite-challenges-details_2.entry.js +329 -0
  24. package/dist/esm/index-c193b756.js +1221 -0
  25. package/dist/esm/index.js +1 -0
  26. package/dist/esm/loader.js +11 -0
  27. package/dist/index.cjs.js +1 -0
  28. package/dist/index.js +1 -0
  29. package/dist/stencil.config.dev.js +17 -0
  30. package/dist/stencil.config.js +17 -0
  31. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/casino-engagement-suite-challenges-details/.stencil/packages/stencil/casino-engagement-suite-challenges-details/stencil.config.d.ts +2 -0
  32. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/casino-engagement-suite-challenges-details/.stencil/packages/stencil/casino-engagement-suite-challenges-details/stencil.config.dev.d.ts +2 -0
  33. package/dist/types/components/casino-engagement-suite-challenges-details/casino-engagement-suite-challenges-details.d.ts +74 -0
  34. package/dist/types/components/casino-engagement-suite-challenges-details/index.d.ts +1 -0
  35. package/dist/types/components.d.ts +131 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/types/models/casino-challenges-details.d.ts +62 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  39. package/dist/types/utils/index.d.ts +2 -0
  40. package/dist/types/utils/locale.utils.d.ts +1 -0
  41. package/dist/types/utils/utils.d.ts +1 -0
  42. package/loader/cdn.js +1 -0
  43. package/loader/index.cjs.js +1 -0
  44. package/loader/index.d.ts +24 -0
  45. package/loader/index.es2017.js +1 -0
  46. package/loader/index.js +2 -0
  47. package/loader/package.json +11 -0
  48. package/package.json +29 -0
@@ -0,0 +1,329 @@
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-c193b756.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
+ minBet: 'Min Bet',
18
+ maxBet: 'Max Bet',
19
+ contribution: 'Contribution'
20
+ }
21
+ };
22
+ const translate = (key, customLang) => {
23
+ const lang = customLang;
24
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
25
+ };
26
+
27
+ var ChallengeLevelProgressStatus;
28
+ (function (ChallengeLevelProgressStatus) {
29
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Closed"] = 0] = "Closed";
30
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["InProgress"] = 1] = "InProgress";
31
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Fillup"] = 2] = "Fillup";
32
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Completed"] = 3] = "Completed";
33
+ })(ChallengeLevelProgressStatus || (ChallengeLevelProgressStatus = {}));
34
+ var ChallengeProgressStatus;
35
+ (function (ChallengeProgressStatus) {
36
+ ChallengeProgressStatus[ChallengeProgressStatus["Started"] = 0] = "Started";
37
+ ChallengeProgressStatus[ChallengeProgressStatus["InProgress"] = 1] = "InProgress";
38
+ ChallengeProgressStatus[ChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
39
+ ChallengeProgressStatus[ChallengeProgressStatus["Completed"] = 3] = "Completed";
40
+ ChallengeProgressStatus[ChallengeProgressStatus["Expired"] = 4] = "Expired";
41
+ ChallengeProgressStatus[ChallengeProgressStatus["Forfeited"] = 5] = "Forfeited";
42
+ })(ChallengeProgressStatus || (ChallengeProgressStatus = {}));
43
+
44
+ function formatBalance(amount, currency) {
45
+ return `${currency}${new Intl.NumberFormat('en', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
46
+ .format(amount)}`;
47
+ }
48
+
49
+ 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-word}.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:12px 0}.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 .ChallengeLevelBetDetails{margin-top:25px;display:flex;flex-wrap:wrap;gap:8px}.ChallengeLevels .ChallengeLevelCard .ChallengeLevelBetDetail:not(:last-of-type){margin-right:8px}.ChallengeLevels .ChallengeLevelCard .ChallengeLevelBetRange,.ChallengeLevels .ChallengeLevelCard .ChallengeLevelBetContribution{font-weight:var(--emw--font-weight-semibold, 600)}.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-word}.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 .CollapseDetails .ChallengeDescription,.ChallengeDetailsPopup.Desktop .CollapseDetails .ChallengeDescription{font-size:var(--emw--font-size-medium, 16px);line-height:19px}.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}";
50
+ const CasinoEngagementSuiteChallengesDetailsStyle0 = casinoEngagementSuiteChallengesDetailsCss;
51
+
52
+ const CasinoEngagementSuiteChallengesDetails = class {
53
+ constructor(hostRef) {
54
+ registerInstance(this, hostRef);
55
+ this.close = createEvent(this, "close", 7);
56
+ this.back = createEvent(this, "back", 7);
57
+ this.resetNewChallengeLabel = createEvent(this, "resetNewChallengeLabel", 7);
58
+ this.setClientStyling = () => {
59
+ let sheet = document.createElement('style');
60
+ sheet.innerHTML = this.clientStyling;
61
+ this.host.prepend(sheet);
62
+ };
63
+ this.setClientStylingURL = () => {
64
+ let url = new URL(this.clientStylingUrl);
65
+ let cssFile = document.createElement('style');
66
+ fetch(url.href)
67
+ .then((res) => res.text())
68
+ .then((data) => {
69
+ cssFile.innerHTML = data;
70
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
71
+ })
72
+ .catch((err) => {
73
+ console.log('Error ', err);
74
+ });
75
+ };
76
+ this.handleCloseClick = () => {
77
+ this.resetNewLabel();
78
+ this.close.emit();
79
+ };
80
+ this.handleBackClick = () => {
81
+ this.resetNewLabel();
82
+ this.back.emit();
83
+ };
84
+ this.onGameClick = (ev) => {
85
+ const slug = ev.currentTarget.getAttribute('data-slug');
86
+ if (slug) {
87
+ window.postMessage({
88
+ type: 'EngagementSuiteGameRedirect',
89
+ data: {
90
+ Slug: slug
91
+ }
92
+ });
93
+ }
94
+ };
95
+ this.changeChallengeStatus = (e) => {
96
+ var _a, _b;
97
+ const id = e.currentTarget.getAttribute('data-id');
98
+ if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
99
+ window.postMessage({
100
+ type: 'ShowConfirmationModal',
101
+ ProgressToDeactivate: id,
102
+ });
103
+ return;
104
+ }
105
+ if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
106
+ window.postMessage({
107
+ type: 'ShowConfirmationModal',
108
+ ProgressToActivate: id,
109
+ ProgressToDeactivate: this.inProgressChallenges[0],
110
+ });
111
+ return;
112
+ }
113
+ window.postMessage({
114
+ type: 'ChallengeJoinRequest',
115
+ data: {
116
+ ProgressToActivate: id,
117
+ },
118
+ });
119
+ };
120
+ this.toggle = () => {
121
+ this.showDetails = !this.showDetails;
122
+ };
123
+ this.clientStyling = '';
124
+ this.clientStylingUrl = '';
125
+ this.challenge = undefined;
126
+ this.inProgressChallenges = undefined;
127
+ this.language = 'en';
128
+ this.gameSlug = '';
129
+ this.device = 'Mobile';
130
+ this.isJoiningToChallenge = undefined;
131
+ this.pausedChallengeIds = [];
132
+ this.limitStylingAppends = false;
133
+ this.timer = '';
134
+ this.showDetails = false;
135
+ this.isExpiredChallenge = false;
136
+ }
137
+ challengePropHandler(value) {
138
+ if (!this.interval && value) {
139
+ this.updateTimer();
140
+ this.startCountdown();
141
+ }
142
+ if (this.interval && !value) {
143
+ clearInterval(this.interval);
144
+ }
145
+ }
146
+ componentWillLoad() {
147
+ this.challengePropHandler(this.challenge);
148
+ }
149
+ componentDidRender() {
150
+ if (!this.limitStylingAppends && this.host) {
151
+ if (this.clientStyling)
152
+ this.setClientStyling();
153
+ if (this.clientStylingUrl)
154
+ this.setClientStylingURL();
155
+ this.limitStylingAppends = true;
156
+ }
157
+ }
158
+ disconnectedCallback() {
159
+ this.interval && clearInterval(this.interval);
160
+ }
161
+ getActionsTemplate() {
162
+ 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" })), h("button", { class: "ChallengeIconButton", onClick: this.handleCloseClick }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "close" }))));
163
+ }
164
+ getChallengeHeader() {
165
+ const presentationName = this.challenge.ChallengePresentation.PresentationName;
166
+ const inProgressChallenge = this.challenge.Status === ChallengeProgressStatus.InProgress
167
+ || this.challenge.Status === ChallengeProgressStatus.PendingLevelReward;
168
+ const isDisabledButton = this.isExpiredChallenge || this.isJoiningToChallenge ||
169
+ this.pausedChallengeIds.includes(this.challenge.ChallengeId);
170
+ const showJoinButton = ![ChallengeProgressStatus.Completed, ChallengeProgressStatus.Forfeited]
171
+ .includes(this.challenge.Status);
172
+ return (h("div", { class: "ChallengeDetailsHeader" }, h("span", { class: "ChallengeName" }, presentationName), showJoinButton ? (h("button", { onClick: this.changeChallengeStatus, class: `ChallengeJoinButton ${inProgressChallenge ? 'Joined' : ''}
173
+ ${isDisabledButton ? 'Disabled' : ''}`, "data-id": this.challenge.Id }, inProgressChallenge
174
+ ? translate('unjoin', this.language)
175
+ : translate('join', this.language))) : null, h("div", { class: `ChallengeLabel ${this.challenge.IsNew ? 'ShowChallengeLabel' : ''}` }, h("span", null, translate('new', this.language)))));
176
+ }
177
+ getChallengeCountdown() {
178
+ const timerMessage = this.isExpiredChallenge ? 'Expired' : this.timer;
179
+ const showChallengeCountdown = this.challenge.Status !== ChallengeProgressStatus.Forfeited;
180
+ return (showChallengeCountdown ? (h("div", { class: `ChallengeCountdown ${this.isExpiredChallenge ? 'Expired' : ''}` }, timerMessage)) : null);
181
+ }
182
+ getChallengeDetails() {
183
+ const description = this.challenge.ChallengePresentation.Description;
184
+ const url = this.challenge.ChallengePresentation.Url;
185
+ const games = this.challenge.Games;
186
+ return (h("div", { class: `CollapseDetails ${this.showDetails ? 'ShowDetails' : ''}` }, description && h("div", { 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 }))))))));
187
+ }
188
+ resetNewLabel() {
189
+ this.resetNewChallengeLabel.emit(this.challenge.Id);
190
+ }
191
+ startCountdown() {
192
+ this.interval = setInterval(() => {
193
+ this.updateTimer();
194
+ }, 1000);
195
+ }
196
+ updateTimer() {
197
+ const expirationTime = new Date(this.challenge.ExpirationTime).getTime();
198
+ const now = new Date().getTime();
199
+ const distance = expirationTime - now;
200
+ if (distance < 1) {
201
+ clearInterval(this.interval);
202
+ this.timer = '';
203
+ this.isExpiredChallenge = true;
204
+ return;
205
+ }
206
+ const { days, hours, minutes, seconds } = {
207
+ days: String(Math.floor(distance / (1000 * 60 * 60 * 24))).padStart(2, '0'),
208
+ hours: String(Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
209
+ minutes: String(Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
210
+ seconds: String(Math.floor((distance % (1000 * 60)) / 1000)).padStart(2, '0')
211
+ };
212
+ this.timer = days === '00'
213
+ ? `${hours}h:${minutes}m:${seconds}s`
214
+ : `${days}d:${hours}h:${minutes}m`;
215
+ }
216
+ getLevelTarget(level) {
217
+ const targetTurnover = formatBalance(level.DisplayCurrencyTargetTurnover, this.challenge.CurrencySymbol);
218
+ let levelTarget = `${translate('place', this.language)} ${targetTurnover}`;
219
+ if (level.LevelTargetType === 1) {
220
+ levelTarget += ` ${translate('bet', this.language)}`;
221
+ }
222
+ else if (level.LevelTargetType === 2) {
223
+ levelTarget += ` ${translate('bets', this.language)} X ${level.TargetBetCount}`;
224
+ }
225
+ return (h("span", { class: "ChallengeLevelTarget" }, levelTarget));
226
+ }
227
+ getLevelBetRangesDetails(level) {
228
+ var _a, _b, _c, _d;
229
+ const isAccumulativeLevelType = level.LevelTargetType === 0;
230
+ if (isAccumulativeLevelType) {
231
+ const formattedMinBet = formatBalance((_a = level.BetRange) === null || _a === void 0 ? void 0 : _a.MinBet, this.challenge.CurrencySymbol);
232
+ const formattedMaxBet = formatBalance((_b = level.BetRange) === null || _b === void 0 ? void 0 : _b.MaxBet, this.challenge.CurrencySymbol);
233
+ const formattedContributionPercentage = level.LevelContributionPercent + '%';
234
+ const showMinBet = !!((_c = level.BetRange) === null || _c === void 0 ? void 0 : _c.MinBet);
235
+ const showMaxBet = !!((_d = level.BetRange) === null || _d === void 0 ? void 0 : _d.MaxBet);
236
+ const showContributionPercentage = level.LevelContributionPercent !== 100;
237
+ if (showMinBet || showMaxBet || showContributionPercentage) {
238
+ return (h("div", { class: 'ChallengeLevelBetDetails' }, showMinBet &&
239
+ h("div", { class: 'ChallengeLevelBetDetail' }, h("span", null, translate('minBet', this.language), ": "), h("span", { class: 'ChallengeLevelBetRange' }, formattedMinBet)), showMaxBet &&
240
+ h("div", { class: 'ChallengeLevelBetDetail' }, h("span", null, translate('maxBet', this.language), ": "), h("span", { class: 'ChallengeLevelBetRange' }, formattedMaxBet)), showContributionPercentage &&
241
+ h("div", { class: 'ChallengeLevelBetDetail' }, h("span", null, translate('contribution', this.language), ": "), h("span", { class: 'ChallengeLevelBetContribution' }, formattedContributionPercentage))));
242
+ }
243
+ }
244
+ }
245
+ getChallengeLevels() {
246
+ const isChallengePaused = this.pausedChallengeIds.includes(this.challenge.ChallengeId);
247
+ const InProgressLevel = (level) => {
248
+ return level.ProgressStatus === 1 && !this.isExpiredChallenge && !isChallengePaused;
249
+ };
250
+ return (h("div", { class: "ChallengeLevels" }, this.challenge.LevelProgresses.map((level, index) => (h("div", { class: `ChallengeLevelCard ${InProgressLevel(level) ? 'InProgress' : ''}` }, h("casino-engagement-suite-progress-bar", { class: this.device, value: level.ProgressPercentage, "hide-percent": (level.ProgressPercentage === 0 && !InProgressLevel(level)) || 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)), this.getLevelBetRangesDetails(level))))));
251
+ }
252
+ getToggleButton() {
253
+ return (h("div", { class: "ChallengeCollapseButton", onClick: this.toggle }, h("span", { class: `Toggle ${this.showDetails ? 'Closed' : 'Open'}` }), h("span", null, translate('details', this.language))));
254
+ }
255
+ render() {
256
+ return h("div", { key: '413a8354c03545a336b044a26f33275423548ee2', class: `ChallengeDetailsPopup ${this.device}` }, this.getActionsTemplate(), h("div", { key: 'e58aac0709effc8ed9df011c07b52ee6a0c4fa66', class: `ChallengeDetails ${this.challenge.IsNew ? 'IsNewChallenge' : ''}` }, this.getChallengeHeader(), this.getChallengeCountdown(), this.getToggleButton(), this.getChallengeDetails(), this.getChallengeLevels()));
257
+ }
258
+ get host() { return getElement(this); }
259
+ static get watchers() { return {
260
+ "challenge": ["challengePropHandler"]
261
+ }; }
262
+ };
263
+ CasinoEngagementSuiteChallengesDetails.style = CasinoEngagementSuiteChallengesDetailsStyle0;
264
+
265
+ 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)}";
266
+ const CasinoEngagementSuiteProgressBarStyle0 = casinoEngagementSuiteProgressBarCss;
267
+
268
+ const CasinoEngagementSuiteProgressBar = class {
269
+ constructor(hostRef) {
270
+ registerInstance(this, hostRef);
271
+ this.setClientStyling = () => {
272
+ let sheet = document.createElement('style');
273
+ sheet.innerHTML = this.clientStyling;
274
+ this.host.prepend(sheet);
275
+ };
276
+ this.setClientStylingURL = () => {
277
+ let url = new URL(this.clientStylingUrl);
278
+ let cssFile = document.createElement('style');
279
+ fetch(url.href)
280
+ .then((res) => res.text())
281
+ .then((data) => {
282
+ cssFile.innerHTML = data;
283
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
284
+ })
285
+ .catch((err) => {
286
+ console.log('Error ', err);
287
+ });
288
+ };
289
+ this.value = 0;
290
+ this.disabled = false;
291
+ this.hidePercent = false;
292
+ this.indeterminate = false;
293
+ this.clientStyling = '';
294
+ this.clientStylingUrl = '';
295
+ this.limitStylingAppends = false;
296
+ }
297
+ componentDidRender() {
298
+ if (!this.limitStylingAppends && this.host) {
299
+ if (this.clientStyling)
300
+ this.setClientStyling();
301
+ if (this.clientStylingUrl)
302
+ this.setClientStylingURL();
303
+ this.limitStylingAppends = true;
304
+ }
305
+ }
306
+ getProgressBarClasses() {
307
+ return {
308
+ ProgressBar: true,
309
+ Completed: this.value === 100,
310
+ Disabled: this.disabled,
311
+ HidePercent: this.hidePercent || this.indeterminate
312
+ };
313
+ }
314
+ getProgressBarLineTemplate() {
315
+ if (this.indeterminate) {
316
+ return h("div", { class: "ProgressBarLine Indeterminate", part: "ProgressBarLine Indeterminate" });
317
+ }
318
+ else {
319
+ return h("div", { class: "ProgressBarLine", part: "ProgressBarLine", style: { width: this.value + '%' } });
320
+ }
321
+ }
322
+ render() {
323
+ return h("div", { key: 'ecce3a26a92d2e090c1db84bdc1bdbeb505080ed', class: this.getProgressBarClasses(), part: "ProgressBar" }, h("div", { key: '649fe1103d222200f2a1ad3b5967e37da1f1ab3d', class: "ProgressBarInfo", part: "ProgressBarInfo" }, h("slot", { key: '49dc180eedd823f0027f75099813fb9d91bcd938', name: "Title" }, h("div", { key: 'e6e59da3fe7bbcb37e118e7fd23a8ff35587aca5' })), h("slot", { key: '3dc8e5fd1dbc8c268b9c76e393b751cb53605e7e', name: "Percent" }, h("div", { key: '6a9e880f3ee3c4f26e8577c69be5db5f8e2d10ad', class: "ProgressBarPercent", part: "ProgressBarPercent" }, this.value, "%"))), h("div", { key: '141106e77caad7b04bb199f911e87c0c6f0adc2d', class: "ProgressBarBackground", part: "ProgressBarBackground" }, this.getProgressBarLineTemplate()));
324
+ }
325
+ get host() { return getElement(this); }
326
+ };
327
+ CasinoEngagementSuiteProgressBar.style = CasinoEngagementSuiteProgressBarStyle0;
328
+
329
+ export { CasinoEngagementSuiteChallengesDetails as casino_engagement_suite_challenges_details, CasinoEngagementSuiteProgressBar as casino_engagement_suite_progress_bar };