@everymatrix/casino-challenges-container 0.0.1 → 0.0.2

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 (31) hide show
  1. package/dist/casino-challenges-container/casino-challenge-card_4.entry.js +1 -0
  2. package/dist/casino-challenges-container/casino-challenges-container-b776a245.js +1 -0
  3. package/dist/casino-challenges-container/casino-challenges-container.esm.js +1 -1
  4. package/dist/casino-challenges-container/index-c7b24115.js +2 -0
  5. package/dist/casino-challenges-container/index.esm.js +1 -1
  6. package/dist/cjs/casino-challenge-card_4.cjs.entry.js +570 -0
  7. package/dist/cjs/{casino-challenges-container-54a20dee.js → casino-challenges-container-aa20cd29.js} +70 -5
  8. package/dist/cjs/casino-challenges-container.cjs.js +2 -2
  9. package/dist/cjs/{index-cf89b5da.js → index-2631ee03.js} +39 -5
  10. package/dist/cjs/index.cjs.js +2 -2
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/collection-manifest.json +20 -1
  13. package/dist/collection/components/casino-challenges-container/casino-challenges-container.css +15 -2
  14. package/dist/collection/components/casino-challenges-container/casino-challenges-container.js +144 -3
  15. package/dist/collection/utils/locale.utils.js +2 -1
  16. package/dist/collection/utils/types.js +40 -0
  17. package/dist/esm/casino-challenge-card_4.entry.js +564 -0
  18. package/dist/esm/{casino-challenges-container-affc90f5.js → casino-challenges-container-b776a245.js} +68 -6
  19. package/dist/esm/casino-challenges-container.js +3 -3
  20. package/dist/esm/{index-9c823353.js → index-c7b24115.js} +37 -6
  21. package/dist/esm/index.js +2 -2
  22. package/dist/esm/loader.js +3 -3
  23. package/dist/types/components/casino-challenges-container/casino-challenges-container.d.ts +30 -0
  24. package/dist/types/components.d.ts +32 -0
  25. package/dist/types/utils/types.d.ts +130 -0
  26. package/package.json +1 -1
  27. package/dist/casino-challenges-container/casino-challenges-container-affc90f5.js +0 -1
  28. package/dist/casino-challenges-container/casino-challenges-container.entry.js +0 -1
  29. package/dist/casino-challenges-container/index-9c823353.js +0 -2
  30. package/dist/cjs/casino-challenges-container.cjs.entry.js +0 -10
  31. package/dist/esm/casino-challenges-container.entry.js +0 -2
@@ -0,0 +1,570 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-2631ee03.js');
6
+ const casinoChallengesContainer = require('./casino-challenges-container-aa20cd29.js');
7
+
8
+ const DEFAULT_LANGUAGE = 'en';
9
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
10
+ const TRANSLATIONS = {
11
+ en: {
12
+ totalLevels: 'Total levels:',
13
+ level1: 'Level 1:',
14
+ get: 'Get:',
15
+ endsIn: 'Ends In',
16
+ expired: 'Expired',
17
+ viewDetails: 'View details',
18
+ placeBetsOf: 'Place bets of',
19
+ place: 'Place',
20
+ bet: 'bet',
21
+ bets: 'bets',
22
+ minBet: 'min bet'
23
+ },
24
+ ro: {
25
+ totalLevels: 'Niveluri totale:',
26
+ level1: 'Nivel 1:',
27
+ get: 'Obține:',
28
+ endsIn: 'Se termină în',
29
+ expired: 'Expirat',
30
+ viewDetails: 'Vezi detalii',
31
+ placeBetsOf: 'Plasează pariuri de',
32
+ place: 'Plasare',
33
+ bet: 'pariu',
34
+ bets: 'pariuri',
35
+ minBet: 'pariu minim'
36
+ },
37
+ fr: {
38
+ totalLevels: 'Niveaux totaux :',
39
+ level1: 'Niveau 1 :',
40
+ get: 'Obtenir :',
41
+ endsIn: 'Se termine dans',
42
+ expired: 'Expiré',
43
+ viewDetails: 'Voir les détails',
44
+ placeBetsOf: 'Placez des paris de',
45
+ place: 'Placer',
46
+ bet: 'pari',
47
+ bets: 'paris',
48
+ minBet: 'mise minimale'
49
+ },
50
+ ar: {
51
+ totalLevels: 'إجمالي المستويات:',
52
+ level1: 'المستوى 1:',
53
+ get: 'احصل على:',
54
+ endsIn: 'ينتهي في',
55
+ expired: 'منتهي الصلاحية',
56
+ viewDetails: 'عرض التفاصيل',
57
+ placeBetsOf: 'قم بوضع رهانات بقيمة',
58
+ place: 'ضع',
59
+ bet: 'رهان',
60
+ bets: 'رهانات',
61
+ minBet: 'الحد الأدنى للرهان'
62
+ },
63
+ hr: {
64
+ totalLevels: 'Ukupno razina:',
65
+ level1: 'Razina 1:',
66
+ get: 'Dobiti:',
67
+ endsIn: 'Završava za',
68
+ expired: 'Isteklo',
69
+ viewDetails: 'Pogledaj detalje',
70
+ placeBetsOf: 'Postavite oklade od',
71
+ place: 'Postavi',
72
+ bet: 'kladnja',
73
+ bets: 'kladnje',
74
+ minBet: 'minimalna oklada'
75
+ }
76
+ };
77
+ const translate = (key, customLang) => {
78
+ const lang = customLang;
79
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
80
+ };
81
+ const getTranslations = (data) => {
82
+ Object.keys(data).forEach((item) => {
83
+ for (let key in data[item]) {
84
+ TRANSLATIONS[item][key] = data[item][key];
85
+ }
86
+ });
87
+ };
88
+ const resolveTranslationUrl = async (translationUrl) => {
89
+ if (translationUrl) {
90
+ try {
91
+ const response = await fetch(translationUrl);
92
+ if (!response.ok) {
93
+ throw new Error(`HTTP error! status: ${response.status}`);
94
+ }
95
+ const translations = await response.json();
96
+ getTranslations(translations);
97
+ }
98
+ catch (error) {
99
+ console.error('Failed to fetch or parse translations from URL:', error);
100
+ }
101
+ }
102
+ };
103
+
104
+ var EChallengeLevelTargetType;
105
+ (function (EChallengeLevelTargetType) {
106
+ EChallengeLevelTargetType[EChallengeLevelTargetType["Accumulative"] = 0] = "Accumulative";
107
+ EChallengeLevelTargetType[EChallengeLevelTargetType["SingleBet"] = 1] = "SingleBet";
108
+ EChallengeLevelTargetType[EChallengeLevelTargetType["MultipleOneBetSize"] = 2] = "MultipleOneBetSize";
109
+ })(EChallengeLevelTargetType || (EChallengeLevelTargetType = {}));
110
+ var EChallengeRecurrenceType;
111
+ (function (EChallengeRecurrenceType) {
112
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Single"] = 0] = "Single";
113
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Daily"] = 1] = "Daily";
114
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Weekly"] = 2] = "Weekly";
115
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Monthly"] = 3] = "Monthly";
116
+ })(EChallengeRecurrenceType || (EChallengeRecurrenceType = {}));
117
+ var EChallengeRewardType;
118
+ (function (EChallengeRewardType) {
119
+ EChallengeRewardType[EChallengeRewardType["FreeSpins"] = 0] = "FreeSpins";
120
+ EChallengeRewardType[EChallengeRewardType["LuckyWheel"] = 1] = "LuckyWheel";
121
+ EChallengeRewardType[EChallengeRewardType["Leaderboard"] = 2] = "Leaderboard";
122
+ EChallengeRewardType[EChallengeRewardType["Challenge"] = 3] = "Challenge";
123
+ EChallengeRewardType[EChallengeRewardType["Custom"] = 4] = "Custom";
124
+ })(EChallengeRewardType || (EChallengeRewardType = {}));
125
+ var EChallengeStatus;
126
+ (function (EChallengeStatus) {
127
+ EChallengeStatus[EChallengeStatus["Setup"] = 0] = "Setup";
128
+ EChallengeStatus[EChallengeStatus["Active"] = 1] = "Active";
129
+ EChallengeStatus[EChallengeStatus["Paused"] = 2] = "Paused";
130
+ EChallengeStatus[EChallengeStatus["Closed"] = 3] = "Closed";
131
+ EChallengeStatus[EChallengeStatus["Deleted"] = 4] = "Deleted";
132
+ })(EChallengeStatus || (EChallengeStatus = {}));
133
+ var EChallengeTriggerType;
134
+ (function (EChallengeTriggerType) {
135
+ EChallengeTriggerType[EChallengeTriggerType["GameLaunch"] = 0] = "GameLaunch";
136
+ EChallengeTriggerType[EChallengeTriggerType["Reward"] = 1] = "Reward";
137
+ EChallengeTriggerType[EChallengeTriggerType["Manual"] = 2] = "Manual";
138
+ })(EChallengeTriggerType || (EChallengeTriggerType = {}));
139
+ var EChallengeValidityType;
140
+ (function (EChallengeValidityType) {
141
+ EChallengeValidityType[EChallengeValidityType["Period"] = 0] = "Period";
142
+ EChallengeValidityType[EChallengeValidityType["Date"] = 1] = "Date";
143
+ })(EChallengeValidityType || (EChallengeValidityType = {}));
144
+
145
+ function getTimeLeft(endTime) {
146
+ const now = new Date();
147
+ const end = new Date(endTime);
148
+ let diff = end.getTime() - now.getTime();
149
+ if (diff <= 0) {
150
+ return;
151
+ }
152
+ const days = Math.floor(diff / (1000 * 60 * 60 * 24));
153
+ diff -= days * (1000 * 60 * 60 * 24);
154
+ const hours = Math.floor(diff / (1000 * 60 * 60));
155
+ diff -= hours * (1000 * 60 * 60);
156
+ const minutes = Math.floor(diff / (1000 * 60));
157
+ diff -= minutes * (1000 * 60);
158
+ const seconds = Math.floor(diff / 1000);
159
+ const pad = (n) => n.toString().padStart(2, '0');
160
+ return `${pad(days)} : ${pad(hours)} : ${pad(minutes)} : ${pad(seconds)}`;
161
+ }
162
+
163
+ const casinoChallengeCardCss = ".card {\n width: 308px;\n border-radius: 16px;\n border: 2px solid var(--emw--button-border-color, rgba(221, 255, 207, 0.1019607843));\n background-color: var(--emw--color-background, #141515);\n box-sizing: border-box;\n position: relative;\n}\n@container challenge-list (max-width: 576px) {\n .card {\n width: 100%;\n }\n}\n.card:hover {\n background: linear-gradient(90deg, rgb(0, 62, 92) 0%, rgb(17, 59, 33) 100%);\n cursor: pointer;\n}\n.card__image {\n width: 100%;\n height: 200px;\n border-radius: 16px 16px 0 0;\n}\n@container challenge-list (max-width: 576px) {\n .card__image {\n height: 224px;\n }\n}\n.card__title {\n color: var(--emw--color-white, #FFFFFF);\n font-size: var(--emw--font-size-medium, 16px);\n margin: 0 0 10px;\n}\n.card__content {\n padding: 20px;\n}\n.card__button {\n margin-top: 20px;\n width: 100%;\n height: 34px;\n background: transparent;\n text-transform: uppercase;\n border-radius: var(--emw--button-border-radius, 99px);\n border: 2px solid var(--emw--button-border-color, #727672);\n font-size: var(--emw--font-size-x-small, 12px);\n font-weight: var(--emw--font-weight-bold, 700);\n color: var(--emw--color-secondary, #e9931e);\n}\n.card__button:hover {\n border-color: var(--emw--color-secondary, #e9931e);\n cursor: pointer;\n}\n.card__badge {\n position: absolute;\n background: white;\n top: 6px;\n right: 6px;\n border-radius: 30px;\n padding: 2px 12px;\n line-height: 22px;\n font-weight: var(--emw--font-weight-medium, 500);\n font-size: var(--emw--font-size-x-small, 12px);\n box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);\n backdrop-filter: blur(20px);\n}\n.card__badge span {\n font-weight: var(--emw--font-weight-bold, 700);\n}\n\n.info-item {\n line-height: 24px;\n font-size: var(--emw--font-size-small, 14px);\n font-weight: var(--emw--font-weight-bold, 700);\n color: var(--emw--color-primary, #1dbf51);\n}\n@container challenge-list (min-width: 576px) {\n .info-item {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n vertical-align: bottom;\n }\n}\n.info-item__label {\n font-weight: var(--emw--font-weight-medium, 500);\n margin-right: 3px;\n color: var(--emw--color-gray-150, #C8D6CE);\n}\n.info-item__tooltip {\n position: absolute;\n line-height: 22px;\n padding: 8px 12px;\n border-radius: 8px;\n opacity: 1;\n z-index: 200;\n white-space: nowrap;\n font-size: var(--emw--font-size-x-small, 12px);\n font-weight: var(--emw--font-weight-medium, 500);\n color: var(--emw--color-white, #FFFFFF);\n background-color: var(--emw--color-background-secondary, #1B1C2B);\n}\n.info-item__tooltip::before {\n content: \"\";\n position: absolute;\n top: -5px;\n left: 50%;\n transform: translateX(-50%);\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid var(--emw--color-background-secondary, #1B1C2B);\n width: 0;\n height: 0;\n z-index: 201;\n}";
164
+ const CasinoChallengeCardStyle0 = casinoChallengeCardCss;
165
+
166
+ const CasinoChallengeCard = class {
167
+ constructor(hostRef) {
168
+ index.registerInstance(this, hostRef);
169
+ this.timerExpired = index.createEvent(this, "timerExpired", 7);
170
+ this.calculateTargetValue = (level, currencySymbol) => {
171
+ var _a;
172
+ if (!level)
173
+ return '';
174
+ const minbet = ((_a = level.BetRange) === null || _a === void 0 ? void 0 : _a.MinBet)
175
+ ? `, ${translate('minBet', this.language)} ${currencySymbol + level.BetRange.MinBet}`
176
+ : '';
177
+ switch (level.LevelTargetType) {
178
+ case EChallengeLevelTargetType.Accumulative:
179
+ return `${translate('placeBetsOf', this.language)} ${currencySymbol + level.DisplayCurrencyTargetTurnover + minbet}`;
180
+ case EChallengeLevelTargetType.SingleBet:
181
+ return `${translate('place', this.language)} ${currencySymbol + level.TargetTurnover} ${translate('bet', this.language)}`;
182
+ case EChallengeLevelTargetType.MultipleOneBetSize:
183
+ return `${translate('place', this.language)} ${level.TargetBetCount} ${translate('bets', this.language) + minbet}`;
184
+ }
185
+ };
186
+ this.onMouseEnterHandler = (index, el) => {
187
+ if (el.scrollWidth > el.clientWidth) {
188
+ this.tooltipIndex = index;
189
+ }
190
+ };
191
+ this.onMouseLeaveHandler = () => {
192
+ this.tooltipIndex = null;
193
+ };
194
+ this.mbSource = undefined;
195
+ this.clientStyling = undefined;
196
+ this.clientStylingUrl = undefined;
197
+ this.translationUrl = '';
198
+ this.language = 'en';
199
+ this.challenge = undefined;
200
+ this.tooltipIndex = null;
201
+ this.timeLeft = undefined;
202
+ }
203
+ get infoItems() {
204
+ var _a, _b, _c, _d;
205
+ const level1 = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.OrderNumber === 0);
206
+ if (level1) {
207
+ const rewardValue = (_b = level1.Rewards) === null || _b === void 0 ? void 0 : _b.slice(0, 2).map((r) => r.RewardDescription).join(' + ');
208
+ return [
209
+ {
210
+ lable: translate('totalLevels', this.language),
211
+ value: (_c = this.challenge.LevelProgresses) === null || _c === void 0 ? void 0 : _c.length
212
+ },
213
+ {
214
+ lable: translate('level1', this.language),
215
+ value: this.calculateTargetValue(level1, (_d = this.challenge) === null || _d === void 0 ? void 0 : _d.CurrencySymbol)
216
+ },
217
+ {
218
+ lable: translate('get', this.language),
219
+ value: rewardValue
220
+ }
221
+ ];
222
+ }
223
+ return [];
224
+ }
225
+ handleClientStylingChange(newValue, oldValue) {
226
+ if (newValue != oldValue) {
227
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
228
+ }
229
+ }
230
+ handleClientStylingUrlChange(newValue, oldValue) {
231
+ if (newValue != oldValue) {
232
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
233
+ }
234
+ }
235
+ handleMbSourceChange(newValue, oldValue) {
236
+ if (newValue != oldValue) {
237
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
238
+ }
239
+ }
240
+ connectedCallback() {
241
+ this.timerId = setInterval(() => {
242
+ this.updateTime();
243
+ }, 1000);
244
+ }
245
+ componentWillLoad() {
246
+ if (this.translationUrl) {
247
+ resolveTranslationUrl(this.translationUrl);
248
+ }
249
+ this.updateTime();
250
+ }
251
+ componentDidLoad() {
252
+ if (this.stylingContainer) {
253
+ if (this.mbSource)
254
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
255
+ if (this.clientStyling)
256
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
257
+ if (this.clientStylingUrl)
258
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
259
+ }
260
+ }
261
+ disconnectedCallback() {
262
+ if (this.stylingSubscription) {
263
+ this.stylingSubscription.unsubscribe();
264
+ }
265
+ clearInterval(this.timerId);
266
+ }
267
+ updateTime() {
268
+ var _a;
269
+ this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
270
+ if (!this.timeLeft && this.timerExpired) {
271
+ clearInterval(this.timerId);
272
+ this.timerExpired.emit(this.challenge.Id);
273
+ }
274
+ }
275
+ renderInfoItem(item, index$1) {
276
+ return (index.h("div", { class: "info-item", onMouseEnter: (e) => this.onMouseEnterHandler(index$1, e.currentTarget), onMouseLeave: this.onMouseLeaveHandler }, index.h("span", { class: "info-item__label" }, item.lable), item.value, this.tooltipIndex === index$1 && index.h("div", { class: "info-item__tooltip" }, item.value)));
277
+ }
278
+ renderCardBadge() {
279
+ return (index.h("div", { class: "card__badge" }, this.timeLeft
280
+ ? [translate('endsIn', this.language), ' - ', index.h("span", null, this.timeLeft)]
281
+ : translate('expired', this.language)));
282
+ }
283
+ render() {
284
+ var _a, _b, _c, _d;
285
+ return (index.h("div", { key: '5df3a2d368e6057d1b47cf5d4766126406c4afc8', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: 'de708f82c0fbe5324419fafcb395f115c020d021', class: "card" }, index.h("img", { key: '209c1f05bb70c3182b4ff6211e7c9398999b30fc', class: "card__image", src: (_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ChallengePresentation) === null || _b === void 0 ? void 0 : _b.Url }), this.renderCardBadge(), index.h("div", { key: 'aa3a5f3eee8bdb7c2606bc8a232c441ff4a22006', class: "card__content" }, index.h("h1", { key: '524933e67d8eac476d678aee9f2643b6ac1449ff', class: "card__title" }, (_d = (_c = this.challenge) === null || _c === void 0 ? void 0 : _c.ChallengePresentation) === null || _d === void 0 ? void 0 : _d.PresentationName), this.infoItems.map((x, index) => this.renderInfoItem(x, index)), index.h("button", { key: '52fec7d22602a2757c1a36238fb0b797f6bb4306', class: "card__button" }, translate('viewDetails', this.language))))));
286
+ }
287
+ static get watchers() { return {
288
+ "clientStyling": ["handleClientStylingChange"],
289
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
290
+ "mbSource": ["handleMbSourceChange"]
291
+ }; }
292
+ };
293
+ CasinoChallengeCard.style = CasinoChallengeCardStyle0;
294
+
295
+ const casinoChallengesListCss = ".challenges-list {\n display: flex;\n flex-wrap: wrap;\n gap: 30px;\n width: 100%;\n}\n\n.loader {\n width: 308px;\n border-radius: 16px;\n border: 2px solid var(--emw--button-border-color, rgba(221, 255, 207, 0.1019607843));\n background-color: var(--emw--color-background, #141515);\n box-sizing: border-box;\n position: relative;\n}\n@container challenge-list (max-width: 576px) {\n .loader {\n width: 100%;\n }\n}\n.loader:hover {\n background: linear-gradient(90deg, rgb(0, 62, 92) 0%, rgb(17, 59, 33) 100%);\n cursor: pointer;\n}\n.loader .SkeletonRows .SkeletonContainer {\n padding: 0 20px 0 20px;\n}\n.loader .SkeletonButton .Skeleton.Text {\n margin: 0;\n height: 28px;\n margin: 0 20px 20px 20px;\n border-radius: var(--emw--button-border-radius, 99px);\n width: auto;\n}\n.loader .Skeleton.Image {\n border-radius: 16px 16px 0 0;\n}\n.loader .Skeleton.Text {\n margin: 20px 0;\n}";
296
+ const CasinoChallengesListStyle0 = casinoChallengesListCss;
297
+
298
+ const skeletons = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
299
+ const CasinoChallengeList = class {
300
+ constructor(hostRef) {
301
+ index.registerInstance(this, hostRef);
302
+ this.loadMore = index.createEvent(this, "loadMore", 7);
303
+ this.timerExpired = index.createEvent(this, "timerExpired", 7);
304
+ this.setLastItemRef = (el) => {
305
+ if (this.lastItemRef && this.observer) {
306
+ this.observer.unobserve(this.lastItemRef);
307
+ }
308
+ this.lastItemRef = el;
309
+ if (el && this.observer && !this.loading) {
310
+ this.observer.observe(el);
311
+ }
312
+ };
313
+ this.mbSource = undefined;
314
+ this.clientStyling = undefined;
315
+ this.clientStylingUrl = undefined;
316
+ this.language = 'en';
317
+ this.translationUrl = undefined;
318
+ this.challenges = [];
319
+ this.loading = false;
320
+ this.hasMore = false;
321
+ }
322
+ handleClientStylingChange(newValue, oldValue) {
323
+ if (newValue != oldValue) {
324
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
325
+ }
326
+ }
327
+ handleClientStylingUrlChange(newValue, oldValue) {
328
+ if (newValue != oldValue) {
329
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
330
+ }
331
+ }
332
+ handleMbSourceChange(newValue, oldValue) {
333
+ if (newValue != oldValue) {
334
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
335
+ }
336
+ }
337
+ setupObserver() {
338
+ if (!this.lastItemRef || this.loading || !this.hasMore)
339
+ return;
340
+ if (!this.observer) {
341
+ this.observer = new IntersectionObserver(([entry]) => {
342
+ if (entry.isIntersecting && !this.loading && this.hasMore) {
343
+ this.observer.unobserve(entry.target);
344
+ this.loadMore.emit();
345
+ }
346
+ }, {
347
+ root: null,
348
+ rootMargin: '0px',
349
+ threshold: 0.1
350
+ });
351
+ }
352
+ this.observer.disconnect();
353
+ this.observer.observe(this.lastItemRef);
354
+ }
355
+ componentDidRender() {
356
+ this.setupObserver();
357
+ }
358
+ disconnectedCallback() {
359
+ var _a;
360
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
361
+ this.observer = undefined;
362
+ }
363
+ componentDidLoad() {
364
+ if (this.stylingContainer) {
365
+ if (this.mbSource)
366
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
367
+ if (this.clientStyling)
368
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
369
+ if (this.clientStylingUrl)
370
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
371
+ }
372
+ }
373
+ renderSkeletons() {
374
+ return skeletons.map((skeleton) => (index.h("div", { class: "loader", key: skeleton }, index.h("ui-skeleton", { structure: "image", height: "200px", "border-radius": "16px 16px 0 0" }), index.h("ui-skeleton", { class: "SkeletonRows", structure: "text", width: "220px", height: "16px", rows: "3" }), index.h("ui-skeleton", { class: "SkeletonButton", structure: "text", width: "100%" }))));
375
+ }
376
+ onTimerExpired(e) {
377
+ if (this.timerExpired) {
378
+ this.timerExpired.emit(e.detail);
379
+ }
380
+ }
381
+ render() {
382
+ return (index.h("div", { key: 'c2dc103d0aa9777b8b79bd8e787985a69f2e2457', ref: (el) => (this.stylingContainer = el), class: "challenges-list" }, this.challenges.map((challenge, index$1) => (index.h("div", { key: challenge.Id, ref: index$1 === this.challenges.length - 1 ? this.setLastItemRef : null }, index.h("casino-challenge-card", { challenge: challenge, language: this.language, mbSource: this.mbSource, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, translationUrl: this.translationUrl, onTimerExpired: this.onTimerExpired })))), this.loading && this.renderSkeletons()));
383
+ }
384
+ get el() { return index.getElement(this); }
385
+ static get watchers() { return {
386
+ "clientStyling": ["handleClientStylingChange"],
387
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
388
+ "mbSource": ["handleMbSourceChange"]
389
+ }; }
390
+ };
391
+ CasinoChallengeList.style = CasinoChallengesListStyle0;
392
+
393
+ const uiSkeletonCss = ":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.Rectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 10px)}.Circle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.Text{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.Title{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.Logo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";
394
+ const UiSkeletonStyle0 = uiSkeletonCss;
395
+
396
+ const UiSkeleton = class {
397
+ constructor(hostRef) {
398
+ index.registerInstance(this, hostRef);
399
+ this.stylingValue = {
400
+ width: this.handleStylingProps(this.width),
401
+ height: this.handleStylingProps(this.height),
402
+ borderRadius: this.handleStylingProps(this.borderRadius),
403
+ marginBottom: this.handleStylingProps(this.marginBottom),
404
+ marginTop: this.handleStylingProps(this.marginTop),
405
+ marginLeft: this.handleStylingProps(this.marginLeft),
406
+ marginRight: this.handleStylingProps(this.marginRight),
407
+ size: this.handleStylingProps(this.size)
408
+ };
409
+ this.structure = undefined;
410
+ this.width = 'unset';
411
+ this.height = 'unset';
412
+ this.borderRadius = 'unset';
413
+ this.marginBottom = 'unset';
414
+ this.marginTop = 'unset';
415
+ this.marginLeft = 'unset';
416
+ this.marginRight = 'unset';
417
+ this.animation = true;
418
+ this.rows = 0;
419
+ this.size = '100%';
420
+ }
421
+ handleStructureChange(newValue, oldValue) {
422
+ if (oldValue !== newValue) {
423
+ this.handleStructure(newValue);
424
+ }
425
+ }
426
+ handleStylingProps(value) {
427
+ switch (typeof value) {
428
+ case 'number':
429
+ return value === 0 ? 0 : `${value}px`;
430
+ case 'undefined':
431
+ return 'unset';
432
+ case 'string':
433
+ if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
434
+ value.endsWith('px') ||
435
+ value.endsWith('%')) {
436
+ return value;
437
+ }
438
+ else {
439
+ return 'unset';
440
+ }
441
+ default:
442
+ return 'unset';
443
+ }
444
+ }
445
+ handleStructure(structure) {
446
+ switch (structure) {
447
+ case 'logo':
448
+ return this.renderLogo();
449
+ case 'image':
450
+ return this.renderImage();
451
+ case 'title':
452
+ return this.renderTitle();
453
+ case 'text':
454
+ return this.renderText();
455
+ case 'rectangle':
456
+ return this.renderRectangle();
457
+ case 'circle':
458
+ return this.renderCircle();
459
+ default:
460
+ return null;
461
+ }
462
+ }
463
+ renderLogo() {
464
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Logo ' + (this.animation ? 'Skeleton' : '') })));
465
+ }
466
+ renderImage() {
467
+ return index.h("div", { class: 'Image ' + (this.animation ? 'Skeleton' : '') });
468
+ }
469
+ renderTitle() {
470
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Title ' + (this.animation ? 'Skeleton' : '') })));
471
+ }
472
+ renderText() {
473
+ return (index.h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index$1) => (index.h("div", { key: index$1, class: 'Text ' + (this.animation ? 'Skeleton' : '') })))));
474
+ }
475
+ renderRectangle() {
476
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Rectangle ' + (this.animation ? 'Skeleton' : '') })));
477
+ }
478
+ renderCircle() {
479
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Circle ' + (this.animation ? 'Skeleton' : '') })));
480
+ }
481
+ render() {
482
+ let styleBlock = '';
483
+ switch (this.structure) {
484
+ case 'logo':
485
+ styleBlock = `
486
+ :host {
487
+ --emw-skeleton-logo-width: ${this.stylingValue.width};
488
+ --emw-skeleton-logo-height: ${this.stylingValue.height};
489
+ --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
490
+ --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
491
+ --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
492
+ --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
493
+ --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
494
+ }
495
+ `;
496
+ break;
497
+ case 'image':
498
+ styleBlock = `
499
+ :host {
500
+ --emw-skeleton-image-width: ${this.stylingValue.width};
501
+ --emw-skeleton-image-height: ${this.stylingValue.height};
502
+ --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
503
+ --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
504
+ --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
505
+ --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
506
+ --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
507
+ }
508
+ `;
509
+ break;
510
+ case 'title':
511
+ styleBlock = `
512
+ :host {
513
+ --emw-skeleton-title-width: ${this.stylingValue.width};
514
+ --emw-skeleton-title-height: ${this.stylingValue.height};
515
+ --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
516
+ --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
517
+ --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
518
+ --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
519
+ --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
520
+ }
521
+ `;
522
+ break;
523
+ case 'text':
524
+ styleBlock = `
525
+ :host {
526
+ --emw-skeleton-text-width: ${this.stylingValue.width};
527
+ --emw-skeleton-text-height: ${this.stylingValue.height};
528
+ --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
529
+ --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
530
+ --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
531
+ --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
532
+ --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
533
+ }
534
+ `;
535
+ break;
536
+ case 'rectangle':
537
+ styleBlock = `
538
+ :host {
539
+ --emw-skeleton-rectangle-width: ${this.stylingValue.width};
540
+ --emw-skeleton-rectangle-height: ${this.stylingValue.height};
541
+ --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
542
+ --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
543
+ --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
544
+ --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
545
+ --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
546
+ }
547
+ `;
548
+ break;
549
+ case 'circle':
550
+ styleBlock = `
551
+ :host {
552
+ --emw-skeleton-circle-size: ${this.stylingValue.size};
553
+ }
554
+ `;
555
+ break;
556
+ default:
557
+ styleBlock = '';
558
+ }
559
+ return (index.h(index.Host, { key: 'e6b885bfd985ce7663d990756fe9101e25eb97f0' }, index.h("style", { key: '06ae24c7bb74f4dacfc12ae58085333f9dc89da5' }, styleBlock), this.handleStructure(this.structure)));
560
+ }
561
+ static get watchers() { return {
562
+ "structure": ["handleStructureChange"]
563
+ }; }
564
+ };
565
+ UiSkeleton.style = UiSkeletonStyle0;
566
+
567
+ exports.casino_challenges_container = casinoChallengesContainer.CasinoChallengesContainer;
568
+ exports.casino_challenge_card = CasinoChallengeCard;
569
+ exports.casino_challenges_list = CasinoChallengeList;
570
+ exports.ui_skeleton = UiSkeleton;