@everymatrix/casino-engagement-suite-tournament 1.44.0 → 1.45.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 (71) hide show
  1. package/dist/casino-engagement-suite-tournament/casino-engagement-suite-tournament.esm.js +1 -1
  2. package/dist/casino-engagement-suite-tournament/index.esm.js +1 -0
  3. package/dist/casino-engagement-suite-tournament/p-0f4e94ab.entry.js +1 -0
  4. package/dist/casino-engagement-suite-tournament/p-1bf11325.js +2 -0
  5. package/dist/casino-engagement-suite-tournament/p-5df3ac81.js +1 -0
  6. package/dist/casino-engagement-suite-tournament/p-e1255160.js +1 -0
  7. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  8. package/dist/cjs/casino-engagement-suite-progress-bar_3.cjs.entry.js +119 -807
  9. package/dist/cjs/casino-engagement-suite-tournament-1b738bb2.js +560 -0
  10. package/dist/cjs/casino-engagement-suite-tournament.cjs.js +16 -10
  11. package/dist/cjs/index-16d5d7c3.js +1642 -0
  12. package/dist/cjs/index.cjs.js +8 -0
  13. package/dist/cjs/loader.cjs.js +6 -12
  14. package/dist/collection/collection-manifest.json +3 -3
  15. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.css +17 -17
  16. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.js +492 -582
  17. package/dist/collection/components/casino-engagement-suite-tournament/index.js +1 -0
  18. package/dist/collection/index.js +1 -1
  19. package/dist/collection/shared/GradientRoundedButton.js +6 -7
  20. package/dist/collection/shared/renderBar.js +11 -11
  21. package/dist/collection/utils/api.apdater.js +30 -30
  22. package/dist/collection/utils/translations.js +19 -19
  23. package/dist/collection/utils/types.js +9 -9
  24. package/dist/collection/utils/util.date.js +26 -26
  25. package/dist/collection/utils/utils.js +16 -16
  26. package/dist/esm/app-globals-0f993ce5.js +3 -0
  27. package/dist/esm/casino-engagement-suite-progress-bar_3.entry.js +119 -807
  28. package/dist/esm/casino-engagement-suite-tournament-d8471680.js +558 -0
  29. package/dist/esm/casino-engagement-suite-tournament.js +13 -10
  30. package/dist/esm/index-3962add4.js +1612 -0
  31. package/dist/esm/index.js +2 -1
  32. package/dist/esm/loader.js +6 -12
  33. package/dist/stencil.config.dev.js +14 -0
  34. package/dist/stencil.config.js +14 -19
  35. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.d.ts +2 -0
  36. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.d.ts +120 -123
  38. package/dist/types/components/casino-engagement-suite-tournament/index.d.ts +1 -0
  39. package/dist/types/components.d.ts +17 -1
  40. package/dist/types/index.d.ts +1 -1
  41. package/dist/types/shared/GradientRoundedButton.d.ts +3 -3
  42. package/dist/types/stencil-public-runtime.d.ts +142 -33
  43. package/dist/types/utils/api.apdater.d.ts +2 -30
  44. package/dist/types/utils/translations.d.ts +35 -35
  45. package/dist/types/utils/types.d.ts +77 -77
  46. package/loader/cdn.js +1 -3
  47. package/loader/index.cjs.js +1 -3
  48. package/loader/index.d.ts +13 -1
  49. package/loader/index.es2017.js +1 -3
  50. package/loader/index.js +1 -3
  51. package/loader/package.json +1 -0
  52. package/package.json +8 -8
  53. package/dist/casino-engagement-suite-tournament/p-023f3dc7.entry.js +0 -1
  54. package/dist/casino-engagement-suite-tournament/p-86ce7485.js +0 -1
  55. package/dist/cjs/index-e778ddd2.js +0 -1733
  56. package/dist/components/casino-engagement-suite-progress-bar.js +0 -6
  57. package/dist/components/casino-engagement-suite-progress-bar2.js +0 -107
  58. package/dist/components/casino-engagement-suite-tournament.d.ts +0 -11
  59. package/dist/components/casino-engagement-suite-tournament.js +0 -716
  60. package/dist/components/general-styling-wrapper.js +0 -6
  61. package/dist/components/general-styling-wrapper2.js +0 -103
  62. package/dist/components/index.d.ts +0 -26
  63. package/dist/components/index.js +0 -1
  64. package/dist/esm/index-4e611d33.js +0 -1704
  65. package/dist/esm/polyfills/core-js.js +0 -11
  66. package/dist/esm/polyfills/css-shim.js +0 -1
  67. package/dist/esm/polyfills/dom.js +0 -79
  68. package/dist/esm/polyfills/es5-html-element.js +0 -1
  69. package/dist/esm/polyfills/index.js +0 -34
  70. package/dist/esm/polyfills/system.js +0 -6
  71. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-tournament/.stencil/packages/casino-engagement-suite-tournament/stencil.config.d.ts +0 -2
@@ -2,835 +2,147 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e778ddd2.js');
5
+ const index = require('./index-16d5d7c3.js');
6
+ const casinoEngagementSuiteTournament = require('./casino-engagement-suite-tournament-1b738bb2.js');
6
7
 
7
- const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}@keyframes indeterminate{0%{left:-200%;right:100%}60%{left:110%;right:-10%}to{left:110%;right:-10%}}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative;overflow:hidden}.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}.ProgressBarLine.Indeterminate{animation:indeterminate 1s linear infinite}.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)}";
8
+ const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:var(--emw--font-size-small, 14px);line-height:14px}@keyframes indeterminate{0%{left:-200%;right:100%}60%{left:110%;right:-10%}to{left:110%;right:-10%}}.ProgressBarBackground{height:8px;background-color:var(--emw--color-gray-300, #666178);border-radius:var(--emw--border-radius-small, 4px);position:relative;overflow:hidden}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:var(--emw--border-radius-small, 4px);background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));transition:width ease-out 0.3s}.ProgressBarLine.Indeterminate{animation:indeterminate 1s linear infinite}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:var(--emw--font-weight-bold, 700);font-size:var(--emw--font-size-x-small, 12px);line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:var(--emw--engagement-suite-gradient-button, 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-gray-300, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
9
+ const CasinoEngagementSuiteProgressBarStyle0 = casinoEngagementSuiteProgressBarCss;
8
10
 
9
11
  const CasinoEngagementSuiteProgressBar = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- /**
13
- * Value for the widget
14
- */
15
- this.value = 0;
16
- /**
17
- * Shows disabled styles
18
- */
19
- this.disabled = false;
20
- /**
21
- * Hide percent value
22
- */
23
- this.hidePercent = false;
24
- /**
25
- * Constantly animates
26
- */
27
- this.indeterminate = false;
28
- /**
29
- * Client custom styling via string
30
- */
31
- this.clientStyling = '';
32
- /**
33
- * Client custom styling via url
34
- */
35
- this.clientStylingUrl = '';
36
- this.limitStylingAppends = false;
37
- this.setClientStyling = () => {
38
- let sheet = document.createElement('style');
39
- sheet.innerHTML = this.clientStyling;
40
- this.host.prepend(sheet);
41
- };
42
- this.setClientStylingURL = () => {
43
- let url = new URL(this.clientStylingUrl);
44
- let cssFile = document.createElement('style');
45
- fetch(url.href)
46
- .then((res) => res.text())
47
- .then((data) => {
48
- cssFile.innerHTML = data;
49
- setTimeout(() => { this.host.prepend(cssFile); }, 1);
50
- })
51
- .catch((err) => {
52
- console.log('Error ', err);
53
- });
54
- };
55
- }
56
- componentDidRender() {
57
- if (!this.limitStylingAppends && this.host) {
58
- if (this.clientStyling)
59
- this.setClientStyling();
60
- if (this.clientStylingUrl)
61
- this.setClientStylingURL();
62
- this.limitStylingAppends = true;
63
- }
64
- }
65
- getProgressBarClasses() {
66
- return {
67
- ProgressBar: true,
68
- Completed: this.value === 100,
69
- Disabled: this.disabled,
70
- HidePercent: this.hidePercent || this.indeterminate
71
- };
72
- }
73
- getProgressBarLineTemplate() {
74
- if (this.indeterminate) {
75
- return index.h("div", { class: "ProgressBarLine Indeterminate", part: "ProgressBarLine Indeterminate" });
76
- }
77
- else {
78
- return index.h("div", { class: "ProgressBarLine", part: "ProgressBarLine", style: { width: this.value + '%' } });
79
- }
80
- }
81
- render() {
82
- return index.h("div", { class: this.getProgressBarClasses(), part: "ProgressBar" }, index.h("div", { class: "ProgressBarInfo", part: "ProgressBarInfo" }, index.h("slot", { name: "Title" }, index.h("div", null)), index.h("slot", { name: "Percent" }, index.h("div", { class: "ProgressBarPercent", part: "ProgressBarPercent" }, this.value, "%"))), index.h("div", { class: "ProgressBarBackground", part: "ProgressBarBackground" }, this.getProgressBarLineTemplate()));
83
- }
84
- get host() { return index.getElement(this); }
85
- };
86
- CasinoEngagementSuiteProgressBar.style = casinoEngagementSuiteProgressBarCss;
87
-
88
- /******************************************************************************
89
- Copyright (c) Microsoft Corporation.
90
-
91
- Permission to use, copy, modify, and/or distribute this software for any
92
- purpose with or without fee is hereby granted.
93
-
94
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
95
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
96
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
97
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
98
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
99
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
100
- PERFORMANCE OF THIS SOFTWARE.
101
- ***************************************************************************** */
102
-
103
- function __rest(s, e) {
104
- var t = {};
105
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
106
- t[p] = s[p];
107
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
108
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
109
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
110
- t[p[i]] = s[p[i]];
111
- }
112
- return t;
113
- }
114
-
115
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
116
- var e = new Error(message);
117
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
118
- };
119
-
120
- var Tab;
121
- (function (Tab) {
122
- Tab["Info"] = "Info";
123
- Tab["Leaderboard"] = "Leaderboard";
124
- Tab["Games"] = "Games";
125
- })(Tab || (Tab = {}));
126
- var Time;
127
- (function (Time) {
128
- Time["Starts"] = "Starts";
129
- Time["Ends"] = "Ends";
130
- })(Time || (Time = {}));
131
- const localePostprocess = (translationText, props) => {
132
- Object.keys(props).map(key => {
133
- translationText = translationText.replace(`{${key}}`, props[key]);
134
- });
135
- return translationText;
136
- };
137
- const TRANSLATIONS = Object.assign(Object.assign(Object.assign({ Join: 'Join', Unjoin: 'Unjoin' }, Tab), Time), { TC: 'Terms & Conditions', ScoreCriteria: 'Score Criteria', MinimumBetCriteria: 'Minimum bet criteria', Place: 'place', Prizes: 'Rewards', LeaderboardDetails: 'Leaderboard Details', UnjoinDialog: {
138
- Title: 'Quit Leaderboard?',
139
- Description: 'Any progress on the current Leaderboard won’t be kept and you can not rejoin the Leaderboard any more. <br /><br />Would you still like to quit?',
140
- ButtonYes: 'Yes, I want to quit leaderboard',
141
- ButtonNo: 'No, Stay on the leaderboard',
142
- }, JoinDialog: {
143
- Tile: 'Congratulations!',
144
- Description: 'You have unlocked <span>{tournamentName}</span>! <br />Would you like to join?',
145
- ButtonYes: 'Join',
146
- ButtonNo: 'Not interested',
147
- }, NoLeaderboards: 'No Leaderboards yet', NoLeaderboardsTip: 'Try winning tickets to Leaderboards as rewards or launching other booster games', Leaderboards: 'Leaderboards', TipPrize: 'You took <span>{place}</span> place and win <span>{prize}</span>', Tip: 'Competition where your real money bets contribute towards the leaderboard score calculation to win the leaderboard reward.' });
148
-
149
- const classnames = (...args) => {
150
- let classnameArray = [];
151
- args.map(arg => {
152
- switch (typeof arg) {
153
- case 'string':
154
- classnameArray.push(arg);
155
- break;
156
- case 'object':
157
- Object.keys(arg).map(k => {
158
- if (arg[k]) {
159
- classnameArray.push(k);
160
- }
161
- });
162
- break;
163
- }
164
- });
165
- return classnameArray.join(' ');
166
- };
167
-
168
- var LeaderboardPage;
169
- (function (LeaderboardPage) {
170
- LeaderboardPage["Confirm"] = "Confirm";
171
- LeaderboardPage["List"] = "List";
172
- LeaderboardPage["Item"] = "Item";
173
- })(LeaderboardPage || (LeaderboardPage = {}));
174
- var TournamentState;
175
- (function (TournamentState) {
176
- TournamentState["Running"] = "Running";
177
- TournamentState["Unstarted"] = "Unstarted";
178
- TournamentState["Closed"] = "Closed";
179
- TournamentState["Closing"] = "Closing";
180
- })(TournamentState || (TournamentState = {}));
181
- var DialogType;
182
- (function (DialogType) {
183
- DialogType["Unjoin"] = "Unjoin";
184
- DialogType["Tip"] = "Tip";
185
- })(DialogType || (DialogType = {}));
186
-
187
- const GradientRoundedButton = (_a) => {
188
- var { statedClasses, innerHTML } = _a, props = __rest(_a, ["statedClasses", "innerHTML"]);
189
- const { isHollow, isPending } = statedClasses;
190
- return (index.h("button", Object.assign({}, Object.assign({ class: classnames('GradientRoundedButton', 'GradientRounded', {
191
- Hollow: isHollow || false,
192
- Pending: isPending || false,
193
- }) }, props)),
194
- index.h("span", null, innerHTML)));
195
- };
196
-
197
- const iconClose = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg" });
198
- const iconQuestion = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg" });
199
- const iconEyeOpen = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-open.svg" });
200
- const iconEyeClose = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-closed.svg" });
201
- const iconBack = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/back.svg" });
202
- const iconReward = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/reward.svg" });
203
- const iconTrophy = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/cup-congras.svg" });
204
-
205
- const CloseBar = (props) => {
206
- const { left, middle, right } = props;
207
- const slots = {
208
- left,
209
- middle,
210
- right,
211
- };
212
- const getFirstLetterUppercase = (str) => str
213
- .split('')
214
- .map((letter, index) => index === 0 ? letter.toUpperCase() : letter)
215
- .join('');
216
- return (index.h("div", { class: "WrapperBar" }, Object.keys(slots).map(slotKey => (index.h("div", { class: "WrapperBar" + getFirstLetterUppercase(slotKey) }, slots[slotKey] || '')))));
217
- };
218
-
219
- function formatDate(date) {
220
- const options = {
221
- year: 'numeric',
222
- month: 'long',
223
- day: 'numeric',
224
- hour: '2-digit',
225
- minute: '2-digit',
226
- hour12: false
227
- };
228
- return date.toLocaleDateString('en-US', options).replace(' at', ',');
229
- }
230
- function addSeconds(date, seconds) {
231
- const result = new Date(date);
232
- result.setSeconds(result.getSeconds() + seconds);
233
- return result;
234
- }
235
- function getDifference(startDate, endDate) {
236
- const diffMs = Math.abs(endDate.getTime() - startDate.getTime()); // Difference in milliseconds
237
- const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); // Difference in days
238
- const diffHours = Math.floor((diffMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); // Remaining hours
239
- const diffMinutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60)); // Remaining minutes
240
- // Format the output
241
- const formattedDiff = `${String(diffDays).padStart(2, '0')}d:${String(diffHours).padStart(2, '0')}h:${String(diffMinutes).padStart(2, '0')}m`;
242
- return formattedDiff;
243
- }
244
- function getProgress(startDate, endDate) {
245
- return (100 * (new Date().getTime() - startDate.getTime()) / (endDate.getTime() - startDate.getTime())).toFixed(0);
246
- }
247
-
248
- const tournamentAdapter = (tournamentApi) => {
249
- const keysTime = [
250
- 'startTime',
251
- 'endTime',
252
- 'closeTime',
253
- 'exhibitionStartTime',
254
- 'exhibitionEndTime',
255
- ];
256
- const tournament = {};
257
- Object.keys(tournamentApi).map((key) => {
258
- const value = tournamentApi[key];
259
- switch (key) {
260
- case 'games':
261
- tournament[key] = value.items;
262
- break;
263
- default:
264
- tournament[key] = keysTime.includes(key) ? new Date(value) : value;
265
- }
266
- });
267
- return tournament;
268
- };
269
- const leaderboardsAdapter = (leaderboardRes) => {
270
- let { item, items: leaderboards } = leaderboardRes;
271
- if (!item) {
272
- return leaderboards;
273
- }
274
- return leaderboards.map(leaderboard => {
275
- if (item && item.userID === leaderboard.userID) {
276
- return Object.assign(Object.assign({}, leaderboard), { isMe: true });
277
- }
278
- else {
279
- return leaderboard;
280
- }
281
- });
282
- };
283
-
284
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
285
-
286
- function createCommonjsModule(fn, basedir, module) {
287
- return module = {
288
- path: basedir,
289
- exports: {},
290
- require: function (path, base) {
291
- return commonjsRequire();
292
- }
293
- }, fn(module, module.exports), module.exports;
294
- }
295
-
296
- function commonjsRequire () {
297
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
298
- }
299
-
300
- createCommonjsModule(function (module, exports) {
301
- !function(t,e){module.exports=e();}(commonjsGlobal,(function(){function t(){}function e(t){return t()}function n(){return Object.create(null)}function i(t){t.forEach(e);}function s(t){return "function"==typeof t}function o(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function l(t,e,n){t.insertBefore(e,n||null);}function r(t){t.parentNode&&t.parentNode.removeChild(t);}function c(t){const e={};for(const n of t)e[n.name]=n.value;return e}let a;function d(t){a=t;}const u=[],f=[];let p=[];const h=[],$=Promise.resolve();let m=!1;function g(t){p.push(t);}
302
- // flush() calls callbacks in this order:
303
- // 1. All beforeUpdate callbacks, in order: parents before children
304
- // 2. All bind:this callbacks, in reverse order: children before parents.
305
- // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
306
- // for afterUpdates called during the initial onMount, which are called in
307
- // reverse order: children before parents.
308
- // Since callbacks might update component values, which could trigger another
309
- // call to flush(), the following steps guard against this:
310
- // 1. During beforeUpdate, any updated components will be added to the
311
- // dirty_components array and will cause a reentrant call to flush(). Because
312
- // the flush index is kept outside the function, the reentrant call will pick
313
- // up where the earlier call left off and go through all dirty components. The
314
- // current_component value is saved and restored so that the reentrant call will
315
- // not interfere with the "parent" flush() call.
316
- // 2. bind:this callbacks cannot trigger new flush() calls.
317
- // 3. During afterUpdate, any updated components will NOT have their afterUpdate
318
- // callback called a second time; the seen_callbacks set, outside the flush()
319
- // function, guarantees this behavior.
320
- const y=new Set;let b=0;// Do *not* move this inside the flush() function
321
- function x(){
322
- // Do not reenter flush while dirty components are updated, as this can
323
- // result in an infinite loop. Instead, let the inner flush handle it.
324
- // Reentrancy is ok afterwards for bindings etc.
325
- if(0!==b)return;const t=a;do{
326
- // first, call beforeUpdate functions
327
- // and update components
328
- try{for(;b<u.length;){const t=u[b];b++,d(t),v(t.$$);}}catch(t){
329
- // reset dirty state to not end up in a deadlocked state and then rethrow
330
- throw u.length=0,b=0,t}for(d(null),u.length=0,b=0;f.length;)f.pop()();
331
- // then, once components are updated, call
332
- // afterUpdate functions. This may cause
333
- // subsequent updates...
334
- for(let t=0;t<p.length;t+=1){const e=p[t];y.has(e)||(
335
- // ...so guard against infinite loops
336
- y.add(e),e());}p.length=0;}while(u.length);for(;h.length;)h.pop()();m=!1,y.clear(),d(t);}function v(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(g);}}
337
- /**
338
- * Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
339
- */const _=new Set;function k(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];p.forEach((i=>-1===t.indexOf(i)?e.push(i):n.push(i))),n.forEach((t=>t())),p=e;}(n.after_update),i(n.on_destroy),n.fragment&&n.fragment.d(e),
340
- // TODO null out other refs, including component.$$ (but need to
341
- // preserve final state?)
342
- n.on_destroy=n.fragment=null,n.ctx=[]);}function E(t,e){-1===t.$$.dirty[0]&&(u.push(t),m||(m=!0,$.then(x)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31;}function C(o,l,c,u,f,p,h,$=[-1]){const m=a;d(o);const y=o.$$={fragment:null,ctx:[],
343
- // state
344
- props:p,update:t,not_equal:f,bound:n(),
345
- // lifecycle
346
- on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(l.context||(m?m.$$.context:[])),
347
- // everything else
348
- callbacks:n(),dirty:$,skip_bound:!1,root:l.target||m.$$.root};h&&h(y.root);let b=!1;if(y.ctx=c?c(o,l.props||{},((t,e,...n)=>{const i=n.length?n[0]:e;return y.ctx&&f(y.ctx[t],y.ctx[t]=i)&&(!y.skip_bound&&y.bound[t]&&y.bound[t](i),b&&E(o,t)),e})):[],y.update(),b=!0,i(y.before_update),
349
- // `false` as a special case of no DOM component
350
- y.fragment=!!u&&u(y.ctx),l.target){if(l.hydrate){const t=function(t){return Array.from(t.childNodes)}(l.target);
351
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
352
- y.fragment&&y.fragment.l(t),t.forEach(r);}else
353
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
354
- y.fragment&&y.fragment.c();l.intro&&((v=o.$$.fragment)&&v.i&&(_.delete(v),v.i(k))),function(t,n,o,l){const{fragment:r,after_update:c}=t.$$;r&&r.m(n,o),l||
355
- // onMount happens before the initial afterUpdate
356
- g((()=>{const n=t.$$.on_mount.map(e).filter(s);
357
- // if the component was destroyed immediately
358
- // it will update the `$$.on_destroy` reference to `null`.
359
- // the destructured on_destroy may still reference to the old array
360
- t.$$.on_destroy?t.$$.on_destroy.push(...n):
361
- // Edge case - component was destroyed immediately,
362
- // most likely as a result of a binding initialising
363
- i(n),t.$$.on_mount=[];})),c.forEach(g);}(o,l.target,l.anchor,l.customElement),x();}var v,k;d(m);}let w;
364
- /* src/GeneralAnimationLoading.svelte generated by Svelte v3.59.2 */
365
- function L(e){let n;return {c(){var e;e="div",n=document.createElement(e),n.innerHTML='<section class="LoaderContainer" part="LoaderContainer"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></section>',this.c=t;},m(t,i){l(t,n,i),
366
- /*div5_binding*/e[3](n);},p:t,i:t,o:t,d(t){t&&r(n)
367
- /*div5_binding*/,e[3](null);}}}function T(t,e,n){let i,{clientstyling:s=""}=e,{clientstylingurl:o=""}=e;return t.$$set=t=>{"clientstyling"in t&&n(1,s=t.clientstyling),"clientstylingurl"in t&&n(2,o=t.clientstylingurl);},t.$$.update=()=>{/*clientstyling, customStylingContainer*/3&t.$$.dirty&&s&&i&&(()=>{let t=document.createElement("style");t.innerHTML=s,i.appendChild(t);})(),/*clientstylingurl, customStylingContainer*/5&t.$$.dirty&&o&&i&&(()=>{let t=new URL(o),e=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{e.innerHTML=t,setTimeout((()=>{i.appendChild(e);}),1),setTimeout((()=>{}),500);}));})();},[i,s,o,function(t){f[t?"unshift":"push"]((()=>{i=t,n(0,i);}));}]}"function"==typeof HTMLElement&&(w=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(s);
368
- // @ts-ignore todo: improve typings
369
- for(const t in this.$$.slotted)
370
- // @ts-ignore todo: improve typings
371
- this.appendChild(this.$$.slotted[t]);}attributeChangedCallback(t,e,n){this[t]=n;}disconnectedCallback(){i(this.$$.on_disconnect);}$destroy(){k(this,1),this.$destroy=t;}$on(e,n){
372
- // TODO should this delegate to addEventListener?
373
- if(!s(n))return t;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const t=i.indexOf(n);-1!==t&&i.splice(t,1);}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1);}});class M extends w{constructor(t){super();const e=document.createElement("style");e.textContent=".LoaderContainer{display:flex;justify-content:center}.lds-ellipsis{display:inline-block;position:relative;width:80px;height:80px}.lds-ellipsis div{position:absolute;top:33px;width:13px;height:13px;border-radius:50%;background:#d1d1d1;animation-timing-function:cubic-bezier(0, 1, 1, 0)}.lds-ellipsis div:nth-child(1){left:8px;animation:lds-ellipsis1 0.6s infinite}.lds-ellipsis div:nth-child(2){left:8px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(3){left:32px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(4){left:56px;animation:lds-ellipsis3 0.6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}",this.shadowRoot.appendChild(e),C(this,{target:this.shadowRoot,props:c(this.attributes),customElement:!0},T,L,o,{clientstyling:1,clientstylingurl:2},null),t&&(t.target&&l(t.target,this,t.anchor),t.props&&(this.$set(t.props),x()));}static get observedAttributes(){return ["clientstyling","clientstylingurl"]}get clientstyling(){return this.$$.ctx[1]}set clientstyling(t){this.$$set({clientstyling:t}),x();}get clientstylingurl(){return this.$$.ctx[2]}set clientstylingurl(t){this.$$set({clientstylingurl:t}),x();}}return !customElements.get("general-animation-loading")&&customElements.define("general-animation-loading",M),M}));
374
- //# sourceMappingURL=general-animation-loading.js.map
375
- });
376
-
377
- const casinoEngagementSuiteTournamentCss = ".GradientRounded {\n display: block;\n background: linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);\n color: rgba(30, 22, 56, 1);\n \n position: relative;\n border-radius: 16px;\n\n &.Hollow {\n background: rgba(30, 22, 56, 1);\n color: #FFFFFF;\n &::before {\n content: \"\";\n position: absolute;\n inset: 0;\n border-radius: 15px;\n border: 1px solid transparent;\n background: linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%) border-box;\n -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n -webkit-mask-composite: destination-out;\n mask-composite: exclude;\n }\n\n }\n}\n\n.GradientRoundedButton {\n border: none;\n padding: 7px;\n \n height: 32px;\n width: 100%;\n \n font-size: 14px;\n font-weight: 700;\n line-height: 17.07px;\n text-align: center;\n \n transition: .5s opacity;\n\n cursor: pointer;\n &.Pending {\n cursor: not-allowed;\n opacity: .3;\n }\n\n &.Hollow {\n \n span {\n background: -webkit-linear-gradient(98.25deg, rgb(255, 148, 0) 22.48%, rgb(254, 247, 70) 131.02%, rgb(255, 226, 74) 131.9%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n }\n }\n}\n.Wrapper {\n height: 100%;\n position: relative;\n color: var(--emw--color-typography, #FFFFFF);\n display: flex;\n background-color: var(--emw--color-background, #1d1537);\n flex-direction: column;\n border-radius: 8px;\n overflow: hidden;\n}\n\n.WrapperContent {\n padding-bottom: 20px;\n transition: 0.5s filter;\n}\n.WrapperContent.faded {\n filter: brightness(53.3333333333%);\n}\n\n.WrapperBar {\n display: flex;\n width: 100%;\n padding: 12px 8px 8px;\n}\n\n.WrapperBarLeft, .WrapperBarRight {\n cursor: pointer;\n}\n\n.WrapperBarMiddle {\n flex-grow: 1;\n text-align: center;\n font-size: 16px;\n line-height: 16px;\n font-weight: 500;\n color: var(--emw--color-secondary, #bbb9c3);\n}\n\n:host {\n display: block;\n font-size: 12px;\n font-family: Inter;\n}\n\n.Row {\n margin: 24px 0;\n padding: 0 20px;\n}\n\n.LeaderboardsItem {\n margin: 10px 0;\n border: 1px solid #403956;\n border-radius: 16px;\n}\n.LeaderboardsItem.Hollow {\n border-color: transparent;\n}\n\n.LeaderboardsItemContainer {\n padding-top: 16px;\n}\n\n.Info {\n margin: 24px 0;\n padding: 0 20px;\n}\n\n.TimeContainer {\n margin: 24px 0;\n padding: 0 20px;\n}\n.TimeContainer .Time {\n display: flex;\n justify-content: space-between;\n font-size: 11px;\n align-items: center;\n color: var(--emw--color-secondary, #bbb9c3);\n}\n.TimeContainer .Time button {\n font-size: 12px;\n height: 20px;\n padding: 0;\n}\n.TimeContainer .Time button::before {\n inset: inherit;\n border: 0;\n}\n\n.ShowInfo {\n margin: 24px 0;\n padding: 0 20px;\n cursor: pointer;\n color: #666178;\n}\n.ShowInfo p {\n display: flex;\n gap: 4px;\n}\n\n.TitleContainer {\n display: flex;\n justify-content: space-between;\n margin: 24px 0;\n padding: 0 20px;\n margin-top: 0;\n gap: 10px;\n font-family: Montserrat;\n}\n.TitleContainer .GradientRoundedButton {\n width: 120px;\n}\n\n.TabsContainer {\n margin: 24px 0;\n padding: 0 20px;\n margin: 0 20px;\n padding: 0;\n border-bottom: 1px solid #575757;\n}\n\n.Tabs {\n display: flex;\n justify-content: space-between;\n justify-content: start;\n font-size: 12px;\n margin-bottom: -1px;\n}\n.Tabs > div {\n padding: 10px;\n color: #666178;\n cursor: pointer;\n}\n.Tabs > div.active {\n color: var(--emw--color-typography, #FFF);\n border-bottom: 2px solid var(--emw--color-typography, #FFF);\n}\n\n.Title {\n font-size: 16px;\n font-weight: 700;\n line-height: 19.5px;\n text-align: left;\n word-break: break-word;\n}\n\n.TC {\n margin-top: 12px;\n}\n.TC a {\n color: #59d1ff;\n}\n\n.Criterias {\n margin: 12px 0;\n}\n.Criterias span {\n color: var(--emw--color-primary, #ffd62f);\n font-weight: 400;\n}\n\n.ResultPrize {\n margin: 24px 0;\n padding: 0 20px;\n}\n.ResultPrize span {\n color: var(--emw--color-primary, #ffd62f);\n font-weight: 400;\n}\n\n.Prizes {\n margin: 24px 0;\n padding: 0 20px;\n}\n.Prizes .PrizesText {\n margin-left: 3px;\n font-weight: 600;\n}\n.Prizes .PrizesHeader {\n align-items: center;\n display: flex;\n}\n.Prizes .PrizesHeader img {\n width: 12px;\n}\n.Prizes .Prize {\n margin: 8px 0;\n}\n.Prizes .Prize .PrizeText {\n color: var(--emw--color-primary, #ffd62f);\n font-weight: 400;\n}\n\n* {\n box-sizing: border-box;\n}\n\n.Leaderboards {\n width: 100%;\n text-align: center;\n border-collapse: collapse;\n}\n.Leaderboards td {\n opacity: 0.6;\n padding: 20px 5px;\n}\n.Leaderboards td:first-child {\n padding-left: 20px;\n}\n.Leaderboards td:last-child {\n padding-right: 20px;\n}\n.Leaderboards .LeaderboardName {\n color: var(--emw--color-typography, #FFF);\n opacity: 1;\n}\n.Leaderboards tr.isMe {\n background: rgba(0, 0, 0, 0.2);\n}\n.Leaderboards tr.isMe .LeaderboardRank span {\n padding: 0px 3px;\n opacity: 1;\n border: 1px solid var(--emw--color-primary, #ffd62f);\n border-radius: 11px;\n}\n.Leaderboards tr.isMe td {\n color: var(--emw--color-primary, #ffd62f);\n}\n\n.Games {\n margin: 24px 0;\n padding: 0 20px;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-evenly;\n gap: 4px 7.25px;\n}\n.Games img {\n width: 60px;\n}\n\ndialog {\n position: absolute;\n top: 30px;\n width: 100%;\n height: 100%;\n background: transparent;\n border: 0;\n padding: 0;\n color: var(--emw--color-typography, #FFFFFF);\n}\ndialog > div {\n margin: 32px;\n border-radius: 8px;\n background: var(--emw--color-background, #1d1537);\n border: 1px solid #403956;\n align-items: center;\n}\n\n.DialogContentUnjoin {\n padding: 32px;\n padding-top: 10px;\n display: flex;\n gap: 10px;\n flex-direction: column;\n}\n\n.DialogContentUnjoinTitle {\n font-family: Montserrat;\n font-size: 20px;\n font-weight: 600;\n line-height: 24.38px;\n text-align: center;\n}\n\n.DialogContentUnjoinDescription {\n color: var(--emw--color-secondary, #bbb9c3);\n margin-bottom: 30px;\n}\n\n.Tip {\n padding: 32px;\n padding-top: 10px;\n color: var(--emw--color-secondary, #bbb9c3);\n font-size: 14px;\n}\n\n.PageConfirmContainer {\n text-align: center;\n width: 80%;\n margin: 0 auto;\n}\n\n.PageConfirm {\n padding: 40px 32px;\n display: flex;\n flex-direction: column;\n gap: 20px;\n}\n.PageConfirm .Title {\n font-size: 20px;\n text-align: center;\n}\n.PageConfirm .Description {\n color: var(--emw--color-secondary, #bbb9c3);\n font-weight: 400;\n}\n.PageConfirm .Description span {\n color: var(--emw--color-typography, #FFF);\n font-weight: 600;\n}\n\n.PageConfirmButtonsGroup {\n width: 150px;\n margin: 0 auto;\n display: flex;\n flex-direction: column;\n gap: 10px;\n}";
378
-
379
- const CasinoEngagementSuiteTournament = class {
380
- constructor(hostRef) {
381
- index.registerInstance(this, hostRef);
382
- this.close = index.createEvent(this, "close", 7);
383
- /**
384
- * Language
385
- */
386
- this.language = 'en';
387
- /**
388
- * Client custom styling via string
389
- */
390
- this.clientStyling = '';
391
- /**
392
- * Client custom styling via url
393
- */
394
- this.clientStylingUrl = '';
395
- /**
396
- * Translation via url
397
- */
398
- this.translationUrl = '';
399
- this.tab = Tab.Info;
400
- this.locale = TRANSLATIONS;
401
- this.tournamentItem = undefined;
402
- this.tournamentList = undefined;
403
- this.leaderboards = [];
404
- this.isActionJoinPending = false;
405
- this.isDialogOpen = false;
406
- this.isShowInfo = false;
407
- this.page = LeaderboardPage.List;
408
- this.tournamentInDialog = undefined;
409
- this.dialog = {
410
- isOpen: false,
411
- type: undefined,
412
- data: undefined,
413
- };
414
- this.time = 0;
415
- this.onClickConfirmJoin = () => {
416
- this.actionJoin(this.tournamentItem);
417
- this.nextPage = LeaderboardPage.List;
418
- };
419
- this.onClickConfirmUnjoin = () => {
420
- this.close.emit();
421
- };
422
- this.onClickDialogUnjoin = () => {
423
- this.actionJoin(this.dialog.data);
424
- this.closeDialog();
425
- };
426
- this.onClickDialogJoin = () => {
427
- this.closeDialog();
428
- };
429
- this.onClickBarInLayout = () => {
430
- this.close.emit();
431
- };
432
- this.onClickBarInLayoutDialog = () => {
433
- this.closeDialog();
434
- };
435
- this.onClickShowInfo = () => {
436
- this.isShowInfo = !this.isShowInfo;
437
- };
438
- this.onClickBarTip = () => {
439
- this.openDialog(DialogType.Tip);
440
- };
441
- this.onClickBarBack = () => {
442
- this.setPage(LeaderboardPage.List);
443
- };
444
- }
445
- setTimeInterval() {
446
- this.timeHolder = setInterval(() => {
447
- if (this.tournamentList || this.tournamentItem) {
448
- this.time += 1;
449
- }
450
- else {
451
- this.time = 0;
452
- }
453
- }, 1000);
454
- }
455
- updateTournamentListByItem(tournament) {
456
- this.tournamentList = this.tournamentList.map((_tournament) => {
457
- if (_tournament.id === tournament.id) {
458
- return tournamentAdapter(tournament);
459
- }
460
- else {
461
- return _tournament;
462
- }
463
- });
464
- }
465
- handleEvent(e) {
466
- const _a = e.data, { type } = _a, rest = __rest(_a, ["type"]);
467
- switch (type) {
468
- case 'ShowLeaderboardRewardModal': {
469
- const { tournament } = rest;
470
- this.setPage(LeaderboardPage.Confirm, { tournament: tournamentAdapter(tournament) });
471
- postMessage({ type: 'BarLeaderboardsClick' });
472
- break;
473
- }
474
- case 'UpdateTournamentsItemRes': {
475
- const tournamentNew = tournamentAdapter(rest.data.item);
476
- this.tournamentItem = tournamentNew;
477
- this.updateTournamentListByItem(tournamentNew);
478
- break;
479
- }
480
- case 'UpdateLeaderboardsRes': {
481
- this.leaderboards = leaderboardsAdapter(rest.data);
482
- break;
483
- }
484
- case 'JoinTournamentRes':
485
- case 'UnjoinTournamentRes':
486
- const { success } = rest;
487
- if (success) {
488
- this.tournamentItem = Object.assign(Object.assign({}, this.tournamentItem), { playerEnrolled: !!!this.tournamentItem.playerEnrolled });
489
- switch (this.page) {
490
- case LeaderboardPage.Item: {
491
- break;
492
- }
493
- case LeaderboardPage.List: {
494
- this.updateTournamentListByItem(this.tournamentItem);
495
- break;
496
- }
497
- }
498
- }
499
- if (this.nextPage) {
500
- this.setPage(this.nextPage);
501
- this.nextPage = undefined;
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.setClientStyling = () => {
15
+ let sheet = document.createElement('style');
16
+ sheet.innerHTML = this.clientStyling;
17
+ this.host.prepend(sheet);
18
+ };
19
+ this.setClientStylingURL = () => {
20
+ let url = new URL(this.clientStylingUrl);
21
+ let cssFile = document.createElement('style');
22
+ fetch(url.href)
23
+ .then((res) => res.text())
24
+ .then((data) => {
25
+ cssFile.innerHTML = data;
26
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
27
+ })
28
+ .catch((err) => {
29
+ console.log('Error ', err);
30
+ });
31
+ };
32
+ this.value = 0;
33
+ this.disabled = false;
34
+ this.hidePercent = false;
35
+ this.indeterminate = false;
36
+ this.clientStyling = '';
37
+ this.clientStylingUrl = '';
38
+ this.limitStylingAppends = false;
39
+ }
40
+ componentDidRender() {
41
+ if (!this.limitStylingAppends && this.host) {
42
+ if (this.clientStyling)
43
+ this.setClientStyling();
44
+ if (this.clientStylingUrl)
45
+ this.setClientStylingURL();
46
+ this.limitStylingAppends = true;
502
47
  }
503
- this.isActionJoinPending = false;
504
- break;
505
48
  }
506
- }
507
- get messageSender() {
508
- return {
509
- JoinTournamentReq: (tournament) => { var _a; return window.postMessage({ type: 'JoinTournamentReq', bonusCode: (_a = tournament.wallets[0]) === null || _a === void 0 ? void 0 : _a.code }); },
510
- UnjoinTournamentReq: (tournament) => window.postMessage({ type: 'UnjoinTournamentReq', id: tournament.id }),
511
- UpdateTournamentsItemReq: (tournament) => window.postMessage({ type: 'UpdateTournamentsItemReq', id: tournament.id }),
512
- UpdateLeaderboardsReq: (tournament) => window.postMessage({ type: 'UpdateLeaderboardsReq', id: tournament.id }),
513
- };
514
- }
515
- connectedCallback() {
516
- this.setTimeInterval();
517
- }
518
- disconnectedCallback() {
519
- clearInterval(this.timeHolder);
520
- }
521
- actionJoin(tournament) {
522
- if (this.isActionJoinPending)
523
- return;
524
- this.isActionJoinPending = true;
525
- try {
526
- if (tournament.playerEnrolled) {
527
- this.messageSender.UnjoinTournamentReq(tournament);
528
- }
529
- else {
530
- this.messageSender.JoinTournamentReq(tournament);
531
- }
532
- }
533
- catch (e) {
534
- console.log('error', e);
535
- return;
49
+ getProgressBarClasses() {
50
+ return {
51
+ ProgressBar: true,
52
+ Completed: this.value === 100,
53
+ Disabled: this.disabled,
54
+ HidePercent: this.hidePercent || this.indeterminate
55
+ };
536
56
  }
537
- }
538
- isTournamentClosed(tournament) {
539
- return [
540
- TournamentState.Closed,
541
- TournamentState.Closing
542
- ].includes(tournament.state);
543
- }
544
- setPage(page, metaData) {
545
- switch (page) {
546
- case LeaderboardPage.Confirm:
547
- case LeaderboardPage.Item:
548
- this.tournamentItem = metaData.tournament;
549
- if (!this.tournamentItem) {
550
- this.messageSender.UpdateTournamentsItemReq(metaData.tournament);
57
+ getProgressBarLineTemplate() {
58
+ if (this.indeterminate) {
59
+ return index.h("div", { class: "ProgressBarLine Indeterminate", part: "ProgressBarLine Indeterminate" });
551
60
  }
552
- if (this.isTournamentClosed(this.tournamentItem)) {
553
- this.messageSender.UpdateLeaderboardsReq(this.tournamentItem);
61
+ else {
62
+ return index.h("div", { class: "ProgressBarLine", part: "ProgressBarLine", style: { width: this.value + '%' } });
554
63
  }
555
- break;
556
- }
557
- this.tab = Tab.Info;
558
- this.page = page;
559
- }
560
- renderPage() {
561
- switch (this.page) {
562
- case LeaderboardPage.Confirm: return this.renderPageConfirm();
563
- case LeaderboardPage.Item: return this.renderPageLeaderboardItem();
564
- case LeaderboardPage.List: return this.renderPageLeaderboardList();
565
- }
566
- }
567
- render() {
568
- return (index.h(index.Host, null, index.h("general-styling-wrapper", { clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling,
569
- // @ts-ignore
570
- targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }), this.renderPage()));
571
- }
572
- onClickListItemChangePage(tournament) {
573
- this.setPage(LeaderboardPage.Item, { tournament });
574
- }
575
- onClickItemJoin(tournament, e) {
576
- e.stopPropagation();
577
- if (tournament.playerEnrolled) {
578
- this.openDialog(DialogType.Unjoin, tournament);
579
- }
580
- else {
581
- this.actionJoin(tournament);
582
- this.tournamentItem = tournament;
583
- }
584
- }
585
- onClickTab(tab) {
586
- this.tab = tab;
587
- switch (tab) {
588
- case Tab.Leaderboard:
589
- this.leaderboards = undefined;
590
- this.messageSender.UpdateLeaderboardsReq(this.tournamentItem);
591
- break;
592
- case Tab.Games:
593
- this.messageSender.UpdateTournamentsItemReq(this.tournamentItem);
594
- break;
595
- }
596
- }
597
- renderPageLeaderboardList() {
598
- var _a;
599
- if (!this.tournamentList) {
600
- this.tournamentList = (_a = this.leaderboardsInit) === null || _a === void 0 ? void 0 : _a.map(item => tournamentAdapter(item));
601
- return index.h("general-animation-loading", null);
602
- }
603
- const { locale } = this;
604
- if (this.tournamentList.length) {
605
- return this.renderLeaderboardContainer(index.h(index.Fragment, null, index.h("div", { class: "Leaderboards Row" }, this.tournamentList.map(_tournament => (index.h("div", { class: classnames("LeaderboardsItem", _tournament.playerEnrolled ? ' GradientRounded Hollow' : ''), onClick: this.onClickListItemChangePage.bind(this, _tournament) }, index.h("div", { class: "LeaderboardsItemContainer" }, this.renderTitleContainer(_tournament), this.renderTimeBar(_tournament))))))));
606
64
  }
607
- else {
608
- return (index.h("div", { class: "NoLeaderboards Row" }, index.h("div", null, locale.NoLeaderboards), index.h("div", null, locale.NoLeaderboardsTip)));
65
+ render() {
66
+ return index.h("div", { key: 'ecce3a26a92d2e090c1db84bdc1bdbeb505080ed', class: this.getProgressBarClasses(), part: "ProgressBar" }, index.h("div", { key: '649fe1103d222200f2a1ad3b5967e37da1f1ab3d', class: "ProgressBarInfo", part: "ProgressBarInfo" }, index.h("slot", { key: '49dc180eedd823f0027f75099813fb9d91bcd938', name: "Title" }, index.h("div", { key: 'e6e59da3fe7bbcb37e118e7fd23a8ff35587aca5' })), index.h("slot", { key: '3dc8e5fd1dbc8c268b9c76e393b751cb53605e7e', name: "Percent" }, index.h("div", { key: '6a9e880f3ee3c4f26e8577c69be5db5f8e2d10ad', class: "ProgressBarPercent", part: "ProgressBarPercent" }, this.value, "%"))), index.h("div", { key: '141106e77caad7b04bb199f911e87c0c6f0adc2d', class: "ProgressBarBackground", part: "ProgressBarBackground" }, this.getProgressBarLineTemplate()));
609
67
  }
610
- }
611
- renderPageConfirm() {
612
- if (!this.tournamentItem)
613
- return index.h("general-animation-loading", null);
614
- const tournamentName = this.tournamentItem.nameOrTitle;
615
- const { locale } = this;
616
- return (index.h("div", { class: "PageConfirmContainer" }, index.h("div", { class: "GradientRounded Hollow PageConfirm" }, index.h("div", null, iconTrophy), index.h("div", { class: "Title" }, locale.JoinDialog.Tile), index.h("div", { class: "Description", innerHTML: localePostprocess(locale.JoinDialog.Description, { tournamentName }) }), index.h("div", { class: "PageConfirmButtonsGroup" }, index.h(GradientRoundedButton, Object.assign({}, {
617
- statedClasses: {
618
- isPending: this.isActionJoinPending,
619
- },
620
- onClick: this.onClickConfirmJoin,
621
- innerHTML: locale.JoinDialog.ButtonYes,
622
- })), index.h(GradientRoundedButton, Object.assign({}, {
623
- statedClasses: {
624
- isPending: this.isActionJoinPending,
625
- isHollow: true,
626
- },
627
- onClick: this.onClickConfirmUnjoin,
628
- innerHTML: locale.JoinDialog.ButtonNo,
629
- }))))));
630
- }
631
- renderPageLeaderboardItem() {
632
- if (!this.tournamentItem)
633
- return index.h("general-animation-loading", null);
634
- return this.renderLeaderboardContainer(index.h(index.Fragment, null, this.renderTitleContainer(this.tournamentItem), this.renderTabs(), this.renderTabbedContent()));
635
- }
636
- renderDialogContent() {
637
- switch (this.dialog.type) {
638
- case DialogType.Unjoin:
639
- return this.renderDialogContentUnjoin();
640
- case DialogType.Tip:
641
- return (index.h("div", { class: "Tip" }, this.locale.Tip));
642
- }
643
- }
644
- renderDialogContentUnjoin() {
645
- const { locale } = this;
646
- return (index.h("div", { class: "DialogContentUnjoin" }, index.h("div", { class: "DialogContentUnjoinTitle" }, locale.UnjoinDialog.Title), index.h("div", { class: "DialogContentUnjoinDescription", innerHTML: locale.UnjoinDialog.Description }), index.h(GradientRoundedButton, Object.assign({}, {
647
- statedClasses: {
648
- isPending: this.isActionJoinPending,
649
- },
650
- onClick: this.onClickDialogUnjoin,
651
- innerHTML: locale.UnjoinDialog.ButtonYes,
652
- })), index.h(GradientRoundedButton, Object.assign({}, {
653
- statedClasses: {
654
- isHollow: true,
655
- isPending: this.isActionJoinPending,
656
- },
657
- onClick: this.onClickDialogJoin,
658
- innerHTML: locale.UnjoinDialog.ButtonNo,
659
- }))));
660
- }
661
- renderTitleContainer(tournament) {
662
- const { locale } = this;
663
- return (index.h("div", { class: "TitleContainer" }, index.h("div", { class: "Title" }, tournament.nameOrTitle), tournament.state !== TournamentState.Closed && (index.h("div", null, index.h(GradientRoundedButton, Object.assign({}, {
664
- statedClasses: {
665
- isHollow: tournament.playerEnrolled,
666
- isPending: this.isActionJoinPending,
667
- },
668
- onClick: this.onClickItemJoin.bind(this, tournament),
669
- innerHTML: tournament.playerEnrolled ? locale.Unjoin : locale.Join,
670
- }))))));
671
- }
672
- renderTabbedContent() {
673
- switch (this.tab) {
674
- case Tab.Info: return this.renderInfo();
675
- case Tab.Leaderboard: return this.renderLeaderboard();
676
- case Tab.Games: return this.renderGames();
677
- }
678
- }
679
- renderGames() {
680
- var _a;
681
- return (index.h("div", { class: "Games" }, (_a = this.tournamentItem.games) === null || _a === void 0 ? void 0 : _a.map(game => (index.h("div", null, index.h("img", { src: game.defaultThumbnail, alt: "" }))))));
682
- }
683
- renderLeaderboard() {
684
- if (!this.leaderboards)
685
- return index.h("general-animation-loading", null);
686
- if (!this.leaderboards.length)
687
- return '';
688
- return (index.h("table", { class: "Leaderboards" }, this.leaderboards.map(leaderboard => (index.h("tr", { class: classnames({ isMe: leaderboard.isMe }) }, index.h("td", { class: "LeaderboardRank" }, index.h("span", null, leaderboard.rank)), index.h("td", { class: "LeaderboardName" }, leaderboard.shortName), index.h("td", { class: "LeaderboardScore" }, leaderboard.score), index.h("td", { class: "LeaderboardPrize" }, leaderboard.prizeName))))));
689
- }
690
- renderTabs() {
691
- const { locale, tab } = this;
692
- return (index.h("div", { class: "TabsContainer" }, index.h("div", { class: "Tabs" }, Object.keys(Tab).map((_tab) => (index.h("div", Object.assign({}, {
693
- class: classnames({ active: tab === _tab }),
694
- onClick: this.onClickTab.bind(this, _tab)
695
- }), locale[_tab]))))));
696
- }
697
- renderTimeBar(tournament) {
698
- return (index.h("section", { class: "TimeContainer" }, index.h("div", { class: 'Time' }, tournament.playerEnrolled ? (index.h(index.Fragment, null, index.h("div", null, getDifference(addSeconds(tournament.startTime, this.time), tournament.endTime)), index.h("div", null, index.h(GradientRoundedButton, { statedClasses: {
699
- isHollow: true,
700
- isPendding: false,
701
- }, innerHTML: `${getProgress(tournament.startTime, tournament.endTime)}%` })))) : (index.h(index.Fragment, null, index.h("div", null, formatDate(tournament.startTime)), index.h("div", null, formatDate(tournament.endTime))))), index.h("casino-engagement-suite-progress-bar", { value: Number(getProgress(tournament.startTime, tournament.endTime)), "hide-percent": true })));
702
- }
703
- renderInfo() {
704
- var _a, _b;
705
- const { locale, tournamentItem: tournament, isShowInfo } = this;
706
- return (index.h("div", { class: "InfoContainer" }, this.renderTimeBar(tournament), (index.h("section", { class: "ShowInfo", onClick: this.onClickShowInfo }, index.h("p", null, index.h("span", null, isShowInfo ? iconEyeClose : iconEyeOpen), index.h("span", null, locale.LeaderboardDetails)))), isShowInfo && (index.h("section", { class: "Info" }, index.h("div", null, tournament.description), index.h("div", { class: "Criterias" }, index.h("div", null, locale.ScoreCriteria, ": ", index.h("span", null, tournament.scoreCriteria)), index.h("div", null, locale.MinimumBetCriteria, ": ", index.h("span", null, tournament.minBetCount))), index.h("div", { class: "TC" }, index.h("a", { href: tournament.termsUrl, target: '_blank' }, locale.TC)))), this.isTournamentClosed(this.tournamentItem) && ((_a = this.leaderboards) === null || _a === void 0 ? void 0 : _a.find(l => l.isMe)) && (index.h("section", { class: "ResultPrize", innerHTML: localePostprocess(locale.TipPrize, this.getResultPrize((_b = this.leaderboards) === null || _b === void 0 ? void 0 : _b.find(l => l.isMe))) })), index.h("section", { class: "Prizes" }, index.h("div", { class: "PrizesHeader" }, iconReward, index.h("span", { class: "PrizesText" }, locale.Prizes)), tournament.prizes.map((prize, index$1) => (index.h("div", { class: "Prize" }, index$1 + 1, " ", locale.Place, ": ", index.h("span", { class: "PrizeText" }, prize.name)))))));
707
- }
708
- getResultPrize(leaderboard) {
709
- return {
710
- prize: leaderboard.prizeName,
711
- place: leaderboard.rank,
712
- };
713
- }
714
- renderCloseBarInLayout() {
715
- const { left, middle } = this.getWrapperBarData();
716
- return (index.h(CloseBar, Object.assign({}, { left, middle,
717
- right: (index.h("span", Object.assign({}, { onClick: this.onClickBarInLayout }), iconClose))
718
- })));
719
- }
720
- renderCloseBarInLayoutDialog() {
721
- return (index.h(CloseBar, Object.assign({}, {
722
- right: (index.h("span", Object.assign({}, { onClick: this.onClickBarInLayoutDialog }), iconClose))
723
- })));
724
- }
725
- renderLeaderboardContainer(render) {
726
- const { dialog: { isOpen } } = this;
727
- return (index.h("div", { class: "Wrapper" }, index.h("div", { class: classnames("WrapperContent", { faded: isOpen }) }, this.renderCloseBarInLayout(), index.h("div", { class: "Root" }, index.h("div", { class: "Main" }, render))), index.h("div", { class: "WrapperUtil" }, index.h("dialog", { open: isOpen }, index.h("div", null, this.renderCloseBarInLayoutDialog(), isOpen && this.renderDialogContent())))));
728
- }
729
- getWrapperBarData() {
730
- const { page, locale } = this;
731
- switch (page) {
732
- case LeaderboardPage.List:
733
- return {
734
- left: index.h("span", { onClick: this.onClickBarTip }, iconQuestion),
735
- middle: locale.Leaderboards
736
- };
737
- case LeaderboardPage.Item:
738
- return {
739
- left: (index.h("span", { onClick: this.onClickBarBack }, iconBack)),
740
- middle: '',
741
- };
742
- }
743
- }
744
- openDialog(type, data = undefined) {
745
- this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: true, type, data });
746
- }
747
- closeDialog() {
748
- this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: false });
749
- }
68
+ get host() { return index.getElement(this); }
750
69
  };
751
- CasinoEngagementSuiteTournament.style = casinoEngagementSuiteTournamentCss;
70
+ CasinoEngagementSuiteProgressBar.style = CasinoEngagementSuiteProgressBarStyle0;
752
71
 
753
72
  const mergeTranslations = (url, target) => {
754
- return new Promise((resolve) => {
755
- fetch(url)
756
- .then((res) => res.json())
757
- .then((data) => {
758
- Object.keys(data).forEach((item) => {
759
- target[item] = target[item] ? target[item] : {};
760
- for (let key in data[item]) {
761
- target[item][key] = data[item][key];
762
- }
763
- });
764
- resolve(true);
73
+ return new Promise((resolve) => {
74
+ fetch(url)
75
+ .then((res) => res.json())
76
+ .then((data) => {
77
+ Object.keys(data).forEach((item) => {
78
+ target[item] = target[item] ? target[item] : {};
79
+ for (let key in data[item]) {
80
+ target[item][key] = data[item][key];
81
+ }
82
+ });
83
+ resolve(true);
84
+ });
765
85
  });
766
- });
767
86
  };
768
87
 
769
88
  const generalStylingWrapperCss = ":host{display:block}";
89
+ const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
770
90
 
771
91
  const GeneralStylingWrapper = class {
772
- constructor(hostRef) {
773
- index.registerInstance(this, hostRef);
774
- /**
775
- * Client custom styling via inline styles
776
- */
777
- this.clientStyling = '';
778
- /**
779
- * Client custom styling via url
780
- */
781
- this.clientStylingUrl = '';
782
- /**
783
- * Translation via url
784
- */
785
- this.translationUrl = '';
786
- this.stylingAppends = false;
787
- this.setClientStyling = () => {
788
- let sheet = document.createElement('style');
789
- sheet.innerHTML = this.clientStyling;
790
- this.el.prepend(sheet);
791
- };
792
- this.setClientStylingURL = () => {
793
- let url = new URL(this.clientStylingUrl);
794
- let cssFile = document.createElement('style');
795
- fetch(url.href)
796
- .then((res) => res.text())
797
- .then((data) => {
798
- cssFile.innerHTML = data;
799
- setTimeout(() => {
800
- this.el.prepend(cssFile);
801
- }, 1);
802
- })
803
- .catch((err) => {
804
- console.log('error ', err);
805
- });
806
- };
807
- }
808
- componentDidRender() {
809
- // start custom styling area
810
- if (!this.stylingAppends) {
811
- if (this.clientStyling)
812
- this.setClientStyling();
813
- if (this.clientStylingUrl)
814
- this.setClientStylingURL();
815
- this.stylingAppends = true;
92
+ constructor(hostRef) {
93
+ index.registerInstance(this, hostRef);
94
+ this.stylingAppends = false;
95
+ this.setClientStyling = () => {
96
+ let sheet = document.createElement('style');
97
+ sheet.innerHTML = this.clientStyling;
98
+ this.el.prepend(sheet);
99
+ };
100
+ this.setClientStylingURL = () => {
101
+ let url = new URL(this.clientStylingUrl);
102
+ let cssFile = document.createElement('style');
103
+ fetch(url.href)
104
+ .then((res) => res.text())
105
+ .then((data) => {
106
+ cssFile.innerHTML = data;
107
+ setTimeout(() => {
108
+ this.el.prepend(cssFile);
109
+ }, 1);
110
+ })
111
+ .catch((err) => {
112
+ console.log('error ', err);
113
+ });
114
+ };
115
+ this.clientStyling = '';
116
+ this.clientStylingUrl = '';
117
+ this.translationUrl = '';
118
+ this.targetTranslations = undefined;
119
+ }
120
+ componentDidRender() {
121
+ // start custom styling area
122
+ if (!this.stylingAppends) {
123
+ if (this.clientStyling)
124
+ this.setClientStyling();
125
+ if (this.clientStylingUrl)
126
+ this.setClientStylingURL();
127
+ this.stylingAppends = true;
128
+ }
129
+ // end custom styling area
130
+ }
131
+ async componentWillLoad() {
132
+ const promises = [];
133
+ if (this.translationUrl) {
134
+ const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
135
+ promises.push(translationPromise);
136
+ }
137
+ return await Promise.all(promises);
816
138
  }
817
- // end custom styling area
818
- }
819
- async componentWillLoad() {
820
- const promises = [];
821
- if (this.translationUrl) {
822
- const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
823
- promises.push(translationPromise);
139
+ render() {
140
+ return (index.h("div", { key: '4d3414408c7662f88331dbe655966237f74d6958', class: "StyleShell" }, index.h("slot", { key: '1d004644d84602c4314bdf5dfc26b55b160f57df', name: "mainContent" })));
824
141
  }
825
- return await Promise.all(promises);
826
- }
827
- render() {
828
- return (index.h("div", { class: "StyleShell" }, index.h("slot", { name: "mainContent" })));
829
- }
830
- get el() { return index.getElement(this); }
142
+ get el() { return index.getElement(this); }
831
143
  };
832
- GeneralStylingWrapper.style = generalStylingWrapperCss;
144
+ GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
833
145
 
146
+ exports.casino_engagement_suite_tournament = casinoEngagementSuiteTournament.CasinoEngagementSuiteTournament;
834
147
  exports.casino_engagement_suite_progress_bar = CasinoEngagementSuiteProgressBar;
835
- exports.casino_engagement_suite_tournament = CasinoEngagementSuiteTournament;
836
148
  exports.general_styling_wrapper = GeneralStylingWrapper;