@everymatrix/casino-engagement-suite-jackpot-details 1.44.0 → 1.45.0

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 (58) hide show
  1. package/dist/casino-engagement-suite-jackpot-details/casino-engagement-suite-jackpot-details.esm.js +1 -1
  2. package/dist/casino-engagement-suite-jackpot-details/p-5a599b1a.entry.js +1 -0
  3. package/dist/casino-engagement-suite-jackpot-details/p-be66309f.entry.js +1 -0
  4. package/dist/casino-engagement-suite-jackpot-details/p-c7ee604a.js +2 -0
  5. package/dist/casino-engagement-suite-jackpot-details/p-e1255160.js +1 -0
  6. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  7. package/dist/cjs/casino-engagement-suite-jackpot-details.cjs.entry.js +274 -284
  8. package/dist/cjs/casino-engagement-suite-jackpot-details.cjs.js +17 -11
  9. package/dist/cjs/casino-engagement-suite-progress-bar.cjs.entry.js +58 -75
  10. package/dist/cjs/index-d83151b6.js +1331 -0
  11. package/dist/cjs/loader.cjs.js +7 -13
  12. package/dist/collection/collection-manifest.json +3 -3
  13. package/dist/collection/components/casino-engagement-suite-jackpot-details/casino-engagement-suite-jackpot-details.css +95 -104
  14. package/dist/collection/components/casino-engagement-suite-jackpot-details/casino-engagement-suite-jackpot-details.js +466 -526
  15. package/dist/collection/components/casino-engagement-suite-jackpot-details/index.js +1 -0
  16. package/dist/collection/utils/index.js +3 -3
  17. package/dist/collection/utils/locale.utils.js +22 -22
  18. package/dist/collection/utils/utils.js +3 -0
  19. package/dist/esm/app-globals-0f993ce5.js +3 -0
  20. package/dist/esm/casino-engagement-suite-jackpot-details.entry.js +274 -284
  21. package/dist/esm/casino-engagement-suite-jackpot-details.js +14 -11
  22. package/dist/esm/casino-engagement-suite-progress-bar.entry.js +58 -75
  23. package/dist/esm/index-0237d1e2.js +1303 -0
  24. package/dist/esm/loader.js +7 -13
  25. package/dist/stencil.config.dev.js +17 -0
  26. package/dist/stencil.config.js +14 -19
  27. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-jackpot-details/.stencil/packages/stencil/casino-engagement-suite-jackpot-details/stencil.config.d.ts +2 -0
  28. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-jackpot-details/.stencil/packages/stencil/casino-engagement-suite-jackpot-details/stencil.config.dev.d.ts +2 -0
  29. package/dist/types/components/casino-engagement-suite-jackpot-details/casino-engagement-suite-jackpot-details.d.ts +88 -88
  30. package/dist/types/components/casino-engagement-suite-jackpot-details/index.d.ts +1 -0
  31. package/dist/types/components.d.ts +19 -2
  32. package/dist/types/models/index.d.ts +37 -37
  33. package/dist/types/stencil-public-runtime.d.ts +142 -33
  34. package/dist/types/utils/utils.d.ts +1 -0
  35. package/loader/cdn.js +1 -3
  36. package/loader/index.cjs.js +1 -3
  37. package/loader/index.d.ts +13 -1
  38. package/loader/index.es2017.js +1 -3
  39. package/loader/index.js +1 -3
  40. package/loader/package.json +1 -0
  41. package/package.json +12 -2
  42. package/dist/casino-engagement-suite-jackpot-details/p-0135e830.js +0 -1
  43. package/dist/casino-engagement-suite-jackpot-details/p-8fee813c.entry.js +0 -1
  44. package/dist/casino-engagement-suite-jackpot-details/p-b361748c.entry.js +0 -1
  45. package/dist/cjs/index-84a14c86.js +0 -1349
  46. package/dist/components/casino-engagement-suite-jackpot-details.d.ts +0 -11
  47. package/dist/components/casino-engagement-suite-jackpot-details.js +0 -439
  48. package/dist/components/casino-engagement-suite-progress-bar.js +0 -110
  49. package/dist/components/index.d.ts +0 -26
  50. package/dist/components/index.js +0 -1
  51. package/dist/esm/index-5707e619.js +0 -1322
  52. package/dist/esm/polyfills/core-js.js +0 -11
  53. package/dist/esm/polyfills/css-shim.js +0 -1
  54. package/dist/esm/polyfills/dom.js +0 -79
  55. package/dist/esm/polyfills/es5-html-element.js +0 -1
  56. package/dist/esm/polyfills/index.js +0 -34
  57. package/dist/esm/polyfills/system.js +0 -6
  58. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-jackpot-details/.stencil/packages/casino-engagement-suite-jackpot-details/stencil.config.d.ts +0 -2
@@ -1,532 +1,472 @@
1
- import { Component, Element, Event, h, Listen, Prop, State, Watch } from '@stencil/core';
2
- import { isBefore } from 'date-fns';
3
- import { translate } from '../../utils/locale.utils';
4
- import '@everymatrix/casino-engagement-suite-progress-bar';
5
- import { formatBalance } from '../../utils';
1
+ import { h } from "@stencil/core";
2
+ import { isBefore } from "date-fns";
3
+ import { translate } from "../../utils/locale.utils";
4
+ import "../../../../../casino-engagement-suite-progress-bar/dist/types/index";
5
+ import { formatBalance } from "../../utils";
6
6
  export class CasinoEngagementSuiteJackpotDetails {
7
- constructor() {
8
- /**
9
- * Client custom styling via string
10
- */
11
- this.clientStyling = '';
12
- /**
13
- * Client custom styling via url
14
- */
15
- this.clientStylingUrl = '';
16
- /**
17
- * Language of the widget
18
- */
19
- this.language = 'en';
20
- /**
21
- * Current game slug
22
- */
23
- this.gameSlug = '';
24
- /**
25
- * User's device type
26
- */
27
- this.device = 'Mobile';
28
- this.limitStylingAppends = false;
29
- this.timer = '';
30
- this.disabledStatus = '';
31
- this.activeTab = 1;
32
- this.visibleGames = [];
33
- this.enabled = false;
34
- this.showDetails = false;
35
- this.jackpotEndTime = '';
36
- this.showTooltip = false;
37
- this.maxVisibleGames = 0;
38
- this.handleTabChange = (e) => {
39
- this.activeTab = +(e.target.getAttribute('data-index'));
40
- this.visibleGames = [];
41
- this.maxVisibleGames = 0;
42
- };
43
- this.handleLoadMore = () => {
44
- this.visibleGames = this.jackpot.GamesInfo.slice(0, this.visibleGames.length + this.maxVisibleGames);
45
- };
46
- this.toggleShowDetails = () => {
47
- this.showDetails = !this.showDetails;
48
- };
49
- this.toggleTooltip = () => {
50
- this.showTooltip = !this.showTooltip;
51
- };
52
- this.setClientStyling = () => {
53
- let sheet = document.createElement('style');
54
- sheet.innerHTML = this.clientStyling;
55
- this.host.prepend(sheet);
56
- };
57
- this.setClientStylingURL = () => {
58
- let url = new URL(this.clientStylingUrl);
59
- let cssFile = document.createElement('style');
60
- fetch(url.href)
61
- .then((res) => res.text())
62
- .then((data) => {
63
- cssFile.innerHTML = data;
64
- setTimeout(() => { this.host.prepend(cssFile); }, 1);
65
- })
66
- .catch((err) => {
67
- console.log('Error ', err);
68
- });
69
- };
70
- this.handleCloseClick = () => {
71
- this.close.emit();
72
- };
73
- this.handleBackClick = () => {
74
- this.back.emit();
75
- };
76
- this.onGameClick = (ev) => {
77
- const slug = ev.currentTarget.getAttribute('data-slug');
78
- if (slug) {
79
- window.postMessage({
80
- type: 'EngagementSuiteGameRedirect',
81
- data: {
82
- Slug: slug
83
- }
84
- });
85
- }
86
- };
87
- }
88
- handleEvent(e) {
89
- const { type, data } = e === null || e === void 0 ? void 0 : e.data;
90
- switch (type) {
91
- case 'UpdateJackpotStatus': {
92
- const data = e.data.data;
93
- if (this.jackpot.JackpotId === data.JackpotId) {
94
- this.updateJackpotStatus(e.data.data);
7
+ constructor() {
8
+ this.maxVisibleGames = 0;
9
+ this.handleTabChange = (e) => {
10
+ this.activeTab = +(e.target.getAttribute('data-index'));
11
+ this.visibleGames = [];
12
+ this.maxVisibleGames = 0;
13
+ };
14
+ this.handleLoadMore = () => {
15
+ this.visibleGames = this.jackpot.GamesInfo.slice(0, this.visibleGames.length + this.maxVisibleGames);
16
+ };
17
+ this.toggleShowDetails = () => {
18
+ this.showDetails = !this.showDetails;
19
+ };
20
+ this.toggleTooltip = () => {
21
+ this.showTooltip = !this.showTooltip;
22
+ };
23
+ this.setClientStyling = () => {
24
+ let sheet = document.createElement('style');
25
+ sheet.innerHTML = this.clientStyling;
26
+ this.host.prepend(sheet);
27
+ };
28
+ this.setClientStylingURL = () => {
29
+ let url = new URL(this.clientStylingUrl);
30
+ let cssFile = document.createElement('style');
31
+ fetch(url.href)
32
+ .then((res) => res.text())
33
+ .then((data) => {
34
+ cssFile.innerHTML = data;
35
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
36
+ })
37
+ .catch((err) => {
38
+ console.log('Error ', err);
39
+ });
40
+ };
41
+ this.handleCloseClick = () => {
42
+ this.close.emit();
43
+ };
44
+ this.handleBackClick = () => {
45
+ this.back.emit();
46
+ };
47
+ this.onGameClick = (ev) => {
48
+ const slug = ev.currentTarget.getAttribute('data-slug');
49
+ if (slug) {
50
+ window.postMessage({
51
+ type: 'EngagementSuiteGameRedirect',
52
+ data: {
53
+ Slug: slug
54
+ }
55
+ });
56
+ }
57
+ };
58
+ this.clientStyling = '';
59
+ this.clientStylingUrl = '';
60
+ this.jackpot = undefined;
61
+ this.jackpotChangeStatusRequest = undefined;
62
+ this.language = 'en';
63
+ this.gameSlug = '';
64
+ this.device = 'Mobile';
65
+ this.limitStylingAppends = false;
66
+ this.timer = '';
67
+ this.disabledStatus = '';
68
+ this.activeTab = 1;
69
+ this.visibleGames = [];
70
+ this.enabled = false;
71
+ this.balance = undefined;
72
+ this.winBalance = undefined;
73
+ this.showDetails = false;
74
+ this.jackpotEndTime = '';
75
+ this.showTooltip = false;
76
+ }
77
+ handleEvent(e) {
78
+ const { type, data } = e === null || e === void 0 ? void 0 : e.data;
79
+ switch (type) {
80
+ case 'UpdateJackpotStatus': {
81
+ const data = e.data.data;
82
+ if (this.jackpot.JackpotId === data.JackpotId) {
83
+ this.updateJackpotStatus(e.data.data);
84
+ }
85
+ break;
86
+ }
87
+ case 'JoinJackpotResult': {
88
+ const res = data;
89
+ if (res.Success && this.jackpot.JackpotId in res.JackpotIds) {
90
+ this.enabled = this.jackpot.Enabled = res.JackpotIds[this.jackpot.JackpotId];
91
+ }
92
+ break;
93
+ }
94
+ }
95
+ }
96
+ handleJackpotUpdate() {
97
+ this.balance = this.jackpot.Balance;
98
+ this.winBalance = this.jackpot.WinBalance;
99
+ }
100
+ handleResize() {
101
+ this.activeTab === 2 && this.setVisibleGames();
102
+ this.showTooltip = false;
103
+ }
104
+ componentWillLoad() {
105
+ this.enabled = this.jackpot.Enabled;
106
+ this.balance = this.jackpot.Balance;
107
+ this.winBalance = this.jackpot.WinBalance;
108
+ this.jackpotEndTime = this.jackpot.JackpotEndTime;
109
+ this.disabledStatus = this.jackpot.Reason || '';
110
+ this.startCountdown();
111
+ }
112
+ componentDidRender() {
113
+ if (!this.limitStylingAppends && this.host) {
114
+ if (this.clientStyling)
115
+ this.setClientStyling();
116
+ if (this.clientStylingUrl)
117
+ this.setClientStylingURL();
118
+ this.limitStylingAppends = true;
119
+ }
120
+ if (this.activeTab === 2 && !this.maxVisibleGames) {
121
+ this.setVisibleGames();
95
122
  }
96
- break;
97
- }
98
- case 'JoinJackpotResult': {
99
- const res = data;
100
- if (res.Success && this.jackpot.JackpotId in res.JackpotIds) {
101
- this.enabled = this.jackpot.Enabled = res.JackpotIds[this.jackpot.JackpotId];
123
+ }
124
+ disconnectedCallback() {
125
+ this.clearInterval();
126
+ }
127
+ clearInterval() {
128
+ if (this.interval) {
129
+ clearInterval(this.interval);
130
+ this.interval = null;
102
131
  }
103
- break;
104
- }
105
- }
106
- }
107
- handleJackpotUpdate() {
108
- this.balance = this.jackpot.Balance;
109
- this.winBalance = this.jackpot.WinBalance;
110
- }
111
- handleResize() {
112
- this.activeTab === 2 && this.setVisibleGames();
113
- this.showTooltip = false;
114
- }
115
- componentWillLoad() {
116
- this.enabled = this.jackpot.Enabled;
117
- this.balance = this.jackpot.Balance;
118
- this.winBalance = this.jackpot.WinBalance;
119
- this.jackpotEndTime = this.jackpot.JackpotEndTime;
120
- this.disabledStatus = this.jackpot.Reason || '';
121
- this.startCountdown();
122
- }
123
- componentDidRender() {
124
- if (!this.limitStylingAppends && this.host) {
125
- if (this.clientStyling)
126
- this.setClientStyling();
127
- if (this.clientStylingUrl)
128
- this.setClientStylingURL();
129
- this.limitStylingAppends = true;
130
- }
131
- if (this.activeTab === 2 && !this.maxVisibleGames) {
132
- this.setVisibleGames();
133
- }
134
- }
135
- disconnectedCallback() {
136
- this.clearInterval();
137
- }
138
- clearInterval() {
139
- if (this.interval) {
140
- clearInterval(this.interval);
141
- this.interval = null;
142
- }
143
- }
144
- setVisibleGames() {
145
- const gap = this.device === 'Mobile' ? 10 : 12;
146
- const gamesPerRow = this.device === 'Mobile' ? 4 : 5;
147
- const availableWidth = this.gamesListWrapperEl.offsetWidth - (gap * (gamesPerRow - 1));
148
- const gameElWidth = availableWidth / gamesPerRow;
149
- const gameElHeight = (gameElWidth / 74 * 40) + gap;
150
- this.maxVisibleGames = Math.max(Math.floor(this.gamesListWrapperEl.offsetHeight / gameElHeight) * gamesPerRow, gamesPerRow);
151
- this.visibleGames = this.jackpot.GamesInfo.slice(0, this.maxVisibleGames);
152
- }
153
- updateJackpotStatus(event) {
154
- if (event.IsClosed) {
155
- this.clearInterval();
156
- this.disabledStatus = event.Reason;
157
- this.activeTab = 1;
158
- }
159
- else {
160
- this.disabledStatus = '';
161
- this.jackpotEndTime = event.JackpotEndTime;
162
- this.startCountdown();
163
- }
164
- }
165
- getTopNavigationTemplate() {
166
- return (h("div", { class: "JackpotDetailsNavigation" },
167
- h("button", { class: "JackpotIconButton", onClick: this.handleBackClick },
168
- h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/back.svg", alt: "back" })),
169
- h("div", { class: "JackpotPopupName" }, translate('jackpots', this.language)),
170
- h("button", { class: "JackpotIconButton", onClick: this.handleCloseClick },
171
- h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "close" }))));
172
- }
173
- getJackpotBalance() {
174
- return formatBalance(this.balance, this.jackpot.Currency);
175
- }
176
- getJoinButtonClasses() {
177
- return {
178
- PopupButton: true,
179
- Active: this.enabled,
180
- Loading: this.jackpot.Pending
181
- };
182
- }
183
- getJackpotDetailsHeaderTemplate() {
184
- const joinButtonDisabled = isBefore(new Date(this.jackpot.JackpotEndTime), new Date()) || !!this.disabledStatus;
185
- return (h("div", { class: "JackpotDetailsHeader" },
186
- h("div", null,
187
- h("div", { class: "JackpotType" }, this.jackpot.Type),
188
- h("div", { class: "JackpotBalance" }, this.getJackpotBalance())),
189
- h("div", { class: "JackpotDetailsHeaderSecondCol" },
190
- h("button", { disabled: joinButtonDisabled, onClick: this.jackpotChangeStatusRequest, class: this.getJoinButtonClasses(), "data-id": this.jackpot.JackpotId }, this.enabled
191
- ? translate('unjoin', this.language)
192
- : translate('join', this.language)),
193
- !!this.winBalance && h("div", { class: "JackpotIsWon" }, translate('jackpotIsWon', this.language)))));
194
- }
195
- getTabsTemplate() {
196
- return h("div", { class: "JackpotDetailsTabs" },
197
- h("div", { "data-index": "1", onClick: this.handleTabChange, class: `JackpotDetailsTab ${this.activeTab === 1 ? 'Active' : ''}` }, translate('info', this.language)),
198
- h("div", { "data-index": "2", onClick: this.handleTabChange, class: `JackpotDetailsTab ${this.activeTab === 2 ? 'Active' : ''}` }, translate('games', this.language)));
199
- }
200
- getTabsContentTemplate() {
201
- return this.activeTab === 1
202
- ? this.getJackpotInfoTemplate()
203
- : this.getGamesTemplate();
204
- }
205
- getJackpotDetailsTemplate() {
206
- return h("div", null,
207
- h("div", { class: "JackpotDetailsButton", onClick: this.toggleShowDetails },
208
- h("div", { class: `Toggle ${this.showDetails ? 'Closed' : 'Open'}` }),
209
- h("span", null, translate('jackpotDetails', this.language))),
210
- this.showDetails && h("div", { class: "JackpotDetailsContent" },
211
- this.jackpot.Description && h("p", { class: "JackpotDescription" }, this.jackpot.Description),
212
- this.jackpot.JackpotRulesUrl && h("a", { class: "TermsAndConditions", href: this.jackpot.JackpotRulesUrl, target: "_blank" }, translate('tc', this.jackpot.JackpotRulesUrl))));
213
- }
214
- getBetLimitsRange() {
215
- var _a, _b, _c, _d;
216
- if (this.jackpot.BetLimits) {
217
- const playerCurrency = this.jackpot.Currency;
218
- const betCurrencies = Object.keys(this.jackpot.BetLimits);
219
- const matchedCurrency = betCurrencies.find(currency => currency === playerCurrency);
220
- const betCurrency = matchedCurrency ? matchedCurrency : betCurrencies[0];
221
- const showMinBet = this.jackpot.BetLimits && !!((_a = this.jackpot.BetLimits[betCurrency]) === null || _a === void 0 ? void 0 : _a.MinBet);
222
- const showMaxBet = this.jackpot.BetLimits && !!((_b = this.jackpot.BetLimits[betCurrency]) === null || _b === void 0 ? void 0 : _b.MaxBet);
223
- const formattedMinBet = formatBalance((_c = this.jackpot.BetLimits[betCurrency]) === null || _c === void 0 ? void 0 : _c.MinBet, betCurrency);
224
- const formattedMaxBet = formatBalance((_d = this.jackpot.BetLimits[betCurrency]) === null || _d === void 0 ? void 0 : _d.MaxBet, betCurrency);
225
- return h("div", null,
226
- showMinBet && h("div", { class: "JackpotInfoItem" },
227
- translate('minBet', this.language),
228
- ":\u00A0",
229
- h("span", null, formattedMinBet)),
230
- showMaxBet && h("div", { class: "JackpotInfoItem" },
231
- translate('maxBet', this.language),
232
- ":\u00A0",
233
- h("span", null, formattedMaxBet)));
234
- }
235
- }
236
- getJackpotInfoTemplate() {
237
- const showDetails = !!(this.jackpot.Description || this.jackpot.JackpotRulesUrl);
238
- return h("div", { class: "JackpotInfoTabContent" },
239
- showDetails && this.getJackpotDetailsTemplate(),
240
- h("div", { class: "JackpotInfo" },
241
- h("div", { class: "JackpotInfoItem" },
242
- translate('betContribution', this.language),
243
- ":\u00A0",
244
- h("span", null,
245
- +this.jackpot.ContributionPercent,
246
- "%")),
247
- h("div", { class: "JackpotInfoItem" },
248
- translate('type', this.language),
249
- ":\u00A0",
250
- h("span", null, this.jackpot.JackpotTypePresentation)),
251
- h("div", { class: "JackpotInfoItem" },
252
- translate('winningProbability', this.language),
253
- ":\u00A0",
254
- h("span", null,
255
- "1:",
256
- this.jackpot.Probability)),
257
- h("div", { class: "JackpotInfoItem" },
258
- translate('operatorContribution', this.language),
259
- ":\u00A0",
260
- h("span", null,
261
- +this.jackpot.OperatorContributionPercent,
262
- "%"),
263
- h("button", { class: "JackpotContributionTooltipButton", onClick: this.toggleTooltip })),
264
- this.getBetLimitsRange()));
265
- }
266
- getGamesTemplate() {
267
- const list = this.visibleGames.map((game) => {
268
- return h("div", { onClick: this.onGameClick, class: `JackpotGamesListItem ${game.GameSlug === this.gameSlug ? 'Disabled' : ''}`, key: game.CasinoGameId, "data-slug": game.GameSlug, style: { background: `center / cover url(${game.GameIcon}) no-repeat` }, title: game.GameName });
269
- });
270
- return [
271
- h("div", { class: "JackpotGamesListWrapper", ref: el => this.gamesListWrapperEl = el },
272
- h("div", { class: "JackpotGamesList" }, list)),
273
- this.visibleGames.length < this.jackpot.GamesInfo.length
274
- ? h("button", { class: "PopupButton Active JackpotGamesButton", onClick: this.handleLoadMore }, translate('loadMore', this.language))
275
- : ''
276
- ];
277
- }
278
- getJackpotCountdown() {
279
- const timerMessage = translate(this.disabledStatus, this.language) || this.timer;
280
- return (h("div", { class: `JackpotCountdown ${this.disabledStatus ? 'Suspended' : ''}` }, timerMessage));
281
- }
282
- startCountdown() {
283
- this.updateTimer();
284
- this.interval = setInterval(() => {
285
- this.updateTimer();
286
- }, 1000);
287
- }
288
- updateTimer() {
289
- const expirationTime = new Date(this.jackpotEndTime).getTime();
290
- const now = new Date().getTime();
291
- const distance = expirationTime - now;
292
- if (distance < 1) {
293
- this.clearInterval();
294
- return;
295
- }
296
- const { days, hours, minutes, seconds } = {
297
- days: String(Math.floor(distance / (1000 * 60 * 60 * 24))).padStart(2, '0'),
298
- hours: String(Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
299
- minutes: String(Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
300
- seconds: String(Math.floor((distance % (1000 * 60)) / 1000)).padStart(2, '0')
301
- };
302
- this.timer = days === '00'
303
- ? `${hours}h:${minutes}m:${seconds}s`
304
- : `${days}d:${hours}h:${minutes}m`;
305
- }
306
- getPopupClasses() {
307
- return {
308
- JackpotDetailsPopup: true,
309
- Disabled: !!this.disabledStatus || isBefore(new Date(this.jackpot.JackpotEndTime), new Date()),
310
- [this.device]: true,
311
- [this.jackpot.Type.charAt(0).toUpperCase() + this.jackpot.Type.slice(1)]: true
312
- };
313
- }
314
- getTooltipTemplate() {
315
- return (h("div", { class: "JackpotsTooltipBackdrop" },
316
- h("div", { class: "JackpotsTooltip" },
317
- h("button", { class: "JackpotsIconButton", onClick: this.toggleTooltip },
318
- h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })),
319
- translate('contributionTooltip', this.language))));
320
- }
321
- render() {
322
- return h("div", { class: this.getPopupClasses() },
323
- this.getTopNavigationTemplate(),
324
- h("div", { class: "JackpotDetailsPopupContent" },
325
- this.getJackpotDetailsHeaderTemplate(),
326
- this.getJackpotCountdown(),
327
- this.getTabsTemplate(),
328
- this.getTabsContentTemplate(),
329
- this.showTooltip && this.getTooltipTemplate()));
330
- }
331
- static get is() { return "casino-engagement-suite-jackpot-details"; }
332
- static get encapsulation() { return "shadow"; }
333
- static get originalStyleUrls() { return {
334
- "$": ["casino-engagement-suite-jackpot-details.scss"]
335
- }; }
336
- static get styleUrls() { return {
337
- "$": ["casino-engagement-suite-jackpot-details.css"]
338
- }; }
339
- static get properties() { return {
340
- "clientStyling": {
341
- "type": "string",
342
- "mutable": false,
343
- "complexType": {
344
- "original": "string",
345
- "resolved": "string",
346
- "references": {}
347
- },
348
- "required": false,
349
- "optional": false,
350
- "docs": {
351
- "tags": [],
352
- "text": "Client custom styling via string"
353
- },
354
- "attribute": "client-styling",
355
- "reflect": true,
356
- "defaultValue": "''"
357
- },
358
- "clientStylingUrl": {
359
- "type": "string",
360
- "mutable": false,
361
- "complexType": {
362
- "original": "string",
363
- "resolved": "string",
364
- "references": {}
365
- },
366
- "required": false,
367
- "optional": false,
368
- "docs": {
369
- "tags": [],
370
- "text": "Client custom styling via url"
371
- },
372
- "attribute": "client-styling-url",
373
- "reflect": true,
374
- "defaultValue": "''"
375
- },
376
- "jackpot": {
377
- "type": "unknown",
378
- "mutable": false,
379
- "complexType": {
380
- "original": "Jackpot",
381
- "resolved": "Jackpot",
382
- "references": {
383
- "Jackpot": {
384
- "location": "import",
385
- "path": "../../models"
386
- }
132
+ }
133
+ setVisibleGames() {
134
+ const gap = this.device === 'Mobile' ? 10 : 12;
135
+ const gamesPerRow = this.device === 'Mobile' ? 4 : 5;
136
+ const availableWidth = this.gamesListWrapperEl.offsetWidth - (gap * (gamesPerRow - 1));
137
+ const gameElWidth = availableWidth / gamesPerRow;
138
+ const gameElHeight = (gameElWidth / 74 * 40) + gap;
139
+ this.maxVisibleGames = Math.max(Math.floor(this.gamesListWrapperEl.offsetHeight / gameElHeight) * gamesPerRow, gamesPerRow);
140
+ this.visibleGames = this.jackpot.GamesInfo.slice(0, this.maxVisibleGames);
141
+ }
142
+ updateJackpotStatus(event) {
143
+ if (event.IsClosed) {
144
+ this.clearInterval();
145
+ this.disabledStatus = event.Reason;
146
+ this.activeTab = 1;
387
147
  }
388
- },
389
- "required": false,
390
- "optional": false,
391
- "docs": {
392
- "tags": [],
393
- "text": "Selected jackpot"
394
- }
395
- },
396
- "jackpotChangeStatusRequest": {
397
- "type": "unknown",
398
- "mutable": true,
399
- "complexType": {
400
- "original": "(event: MouseEvent) => void",
401
- "resolved": "(event: MouseEvent) => void",
402
- "references": {
403
- "MouseEvent": {
404
- "location": "global"
405
- }
148
+ else {
149
+ this.disabledStatus = '';
150
+ this.jackpotEndTime = event.JackpotEndTime;
151
+ this.startCountdown();
406
152
  }
407
- },
408
- "required": false,
409
- "optional": false,
410
- "docs": {
411
- "tags": [],
412
- "text": "Change jackpot status"
413
- }
414
- },
415
- "language": {
416
- "type": "string",
417
- "mutable": false,
418
- "complexType": {
419
- "original": "string",
420
- "resolved": "string",
421
- "references": {}
422
- },
423
- "required": false,
424
- "optional": false,
425
- "docs": {
426
- "tags": [],
427
- "text": "Language of the widget"
428
- },
429
- "attribute": "language",
430
- "reflect": false,
431
- "defaultValue": "'en'"
432
- },
433
- "gameSlug": {
434
- "type": "string",
435
- "mutable": false,
436
- "complexType": {
437
- "original": "string",
438
- "resolved": "string",
439
- "references": {}
440
- },
441
- "required": false,
442
- "optional": false,
443
- "docs": {
444
- "tags": [],
445
- "text": "Current game slug"
446
- },
447
- "attribute": "game-slug",
448
- "reflect": false,
449
- "defaultValue": "''"
450
- },
451
- "device": {
452
- "type": "string",
453
- "mutable": false,
454
- "complexType": {
455
- "original": "\"Mobile\" | \"Tablet\" | \"Desktop\"",
456
- "resolved": "\"Desktop\" | \"Mobile\" | \"Tablet\"",
457
- "references": {}
458
- },
459
- "required": false,
460
- "optional": false,
461
- "docs": {
462
- "tags": [],
463
- "text": "User's device type"
464
- },
465
- "attribute": "device",
466
- "reflect": false,
467
- "defaultValue": "'Mobile' as 'Mobile' | 'Tablet' | 'Desktop'"
468
- }
469
- }; }
470
- static get states() { return {
471
- "limitStylingAppends": {},
472
- "timer": {},
473
- "disabledStatus": {},
474
- "activeTab": {},
475
- "visibleGames": {},
476
- "enabled": {},
477
- "balance": {},
478
- "winBalance": {},
479
- "showDetails": {},
480
- "jackpotEndTime": {},
481
- "showTooltip": {}
482
- }; }
483
- static get events() { return [{
484
- "method": "close",
485
- "name": "close",
486
- "bubbles": true,
487
- "cancelable": true,
488
- "composed": true,
489
- "docs": {
490
- "tags": [],
491
- "text": ""
492
- },
493
- "complexType": {
494
- "original": "void",
495
- "resolved": "void",
496
- "references": {}
497
- }
498
- }, {
499
- "method": "back",
500
- "name": "back",
501
- "bubbles": true,
502
- "cancelable": true,
503
- "composed": true,
504
- "docs": {
505
- "tags": [],
506
- "text": ""
507
- },
508
- "complexType": {
509
- "original": "void",
510
- "resolved": "void",
511
- "references": {}
512
- }
513
- }]; }
514
- static get elementRef() { return "host"; }
515
- static get watchers() { return [{
516
- "propName": "jackpot",
517
- "methodName": "handleJackpotUpdate"
518
- }]; }
519
- static get listeners() { return [{
520
- "name": "message",
521
- "method": "handleEvent",
522
- "target": "window",
523
- "capture": false,
524
- "passive": false
525
- }, {
526
- "name": "resize",
527
- "method": "handleResize",
528
- "target": "window",
529
- "capture": false,
530
- "passive": true
531
- }]; }
153
+ }
154
+ getTopNavigationTemplate() {
155
+ return (h("div", { class: "JackpotDetailsNavigation" }, h("button", { class: "EngagementSuiteIconButton Back", onClick: this.handleBackClick }), h("div", { class: "JackpotPopupName" }, translate('jackpots', this.language)), h("button", { class: "EngagementSuiteIconButton Close", onClick: this.handleCloseClick })));
156
+ }
157
+ getJackpotBalance() {
158
+ return formatBalance(this.balance, this.jackpot.Currency);
159
+ }
160
+ getJoinButtonClasses() {
161
+ return {
162
+ EngagementSuiteButton: true,
163
+ Active: this.enabled,
164
+ Loading: this.jackpot.Pending
165
+ };
166
+ }
167
+ getJackpotDetailsHeaderTemplate() {
168
+ const joinButtonDisabled = isBefore(new Date(this.jackpot.JackpotEndTime), new Date()) || !!this.disabledStatus;
169
+ return (h("div", { class: "JackpotDetailsHeader" }, h("div", null, h("div", { class: "JackpotType" }, this.jackpot.Type), h("div", { class: "JackpotBalance" }, this.getJackpotBalance())), h("div", { class: "JackpotDetailsHeaderSecondCol" }, h("button", { disabled: joinButtonDisabled, onClick: this.jackpotChangeStatusRequest, class: this.getJoinButtonClasses(), "data-id": this.jackpot.JackpotId }, this.enabled
170
+ ? translate('unjoin', this.language)
171
+ : translate('join', this.language)), !!this.winBalance && h("div", { class: "JackpotIsWon" }, translate('jackpotIsWon', this.language)))));
172
+ }
173
+ getTabsTemplate() {
174
+ return h("div", { class: "EngagementSuiteTabs" }, h("div", { "data-index": "1", onClick: this.handleTabChange, class: `EngagementSuiteTab ${this.activeTab === 1 ? 'Active' : ''}` }, translate('info', this.language)), h("div", { "data-index": "2", onClick: this.handleTabChange, class: `EngagementSuiteTab ${this.activeTab === 2 ? 'Active' : ''}` }, translate('games', this.language)));
175
+ }
176
+ getTabsContentTemplate() {
177
+ return this.activeTab === 1
178
+ ? this.getJackpotInfoTemplate()
179
+ : this.getGamesTemplate();
180
+ }
181
+ getJackpotDetailsTemplate() {
182
+ return h("div", null, h("div", { class: "JackpotDetailsButton", onClick: this.toggleShowDetails }, h("div", { class: `Toggle ${this.showDetails ? 'Closed' : 'Open'}` }), h("span", null, translate('jackpotDetails', this.language))), this.showDetails && h("div", { class: "JackpotDetailsContent" }, this.jackpot.Description && h("p", { class: "JackpotDescription" }, this.jackpot.Description), this.jackpot.JackpotRulesUrl && h("a", { class: "TermsAndConditions", href: this.jackpot.JackpotRulesUrl, target: "_blank" }, translate('tc', this.jackpot.JackpotRulesUrl))));
183
+ }
184
+ getBetLimitsRange() {
185
+ var _a, _b, _c, _d;
186
+ if (this.jackpot.BetLimits) {
187
+ const playerCurrency = this.jackpot.Currency;
188
+ const betCurrencies = Object.keys(this.jackpot.BetLimits);
189
+ const matchedCurrency = betCurrencies.find(currency => currency === playerCurrency);
190
+ const betCurrency = matchedCurrency ? matchedCurrency : betCurrencies[0];
191
+ const showMinBet = this.jackpot.BetLimits && !!((_a = this.jackpot.BetLimits[betCurrency]) === null || _a === void 0 ? void 0 : _a.MinBet);
192
+ const showMaxBet = this.jackpot.BetLimits && !!((_b = this.jackpot.BetLimits[betCurrency]) === null || _b === void 0 ? void 0 : _b.MaxBet);
193
+ const formattedMinBet = formatBalance((_c = this.jackpot.BetLimits[betCurrency]) === null || _c === void 0 ? void 0 : _c.MinBet, betCurrency);
194
+ const formattedMaxBet = formatBalance((_d = this.jackpot.BetLimits[betCurrency]) === null || _d === void 0 ? void 0 : _d.MaxBet, betCurrency);
195
+ return h("div", null, showMinBet && h("div", { class: "JackpotInfoItem" }, translate('minBet', this.language), ":\u00A0", h("span", null, formattedMinBet)), showMaxBet && h("div", { class: "JackpotInfoItem" }, translate('maxBet', this.language), ":\u00A0", h("span", null, formattedMaxBet)));
196
+ }
197
+ }
198
+ getJackpotInfoTemplate() {
199
+ const showDetails = !!(this.jackpot.Description || this.jackpot.JackpotRulesUrl);
200
+ return h("div", { class: "JackpotInfoTabContent" }, showDetails && this.getJackpotDetailsTemplate(), h("div", { class: "JackpotInfo" }, h("div", { class: "JackpotInfoItem" }, translate('betContribution', this.language), ":\u00A0", h("span", null, +this.jackpot.ContributionPercent, "%")), h("div", { class: "JackpotInfoItem" }, translate('type', this.language), ":\u00A0", h("span", null, this.jackpot.JackpotTypePresentation)), h("div", { class: "JackpotInfoItem" }, translate('winningProbability', this.language), ":\u00A0", h("span", null, "1:", this.jackpot.Probability)), h("div", { class: "JackpotInfoItem" }, translate('operatorContribution', this.language), ":\u00A0", h("span", null, +this.jackpot.OperatorContributionPercent, "%"), h("button", { class: "EngagementSuiteIconButton Help", onClick: this.toggleTooltip })), this.getBetLimitsRange()));
201
+ }
202
+ getGamesTemplate() {
203
+ const list = this.visibleGames.map((game) => {
204
+ return h("div", { onClick: this.onGameClick, class: `JackpotGamesListItem ${game.GameSlug === this.gameSlug ? 'Disabled' : ''}`, key: game.CasinoGameId, "data-slug": game.GameSlug, style: { background: `center / cover url(${game.GameIcon}) no-repeat` }, title: game.GameName });
205
+ });
206
+ return [
207
+ h("div", { class: "JackpotGamesListWrapper", ref: el => this.gamesListWrapperEl = el }, h("div", { class: "JackpotGamesList" }, list)),
208
+ this.visibleGames.length < this.jackpot.GamesInfo.length
209
+ ? h("button", { class: "EngagementSuiteButton Active JackpotGamesButton", onClick: this.handleLoadMore }, translate('loadMore', this.language))
210
+ : ''
211
+ ];
212
+ }
213
+ getJackpotCountdown() {
214
+ const timerMessage = translate(this.disabledStatus, this.language) || this.timer;
215
+ return (h("div", { class: `JackpotCountdown ${this.disabledStatus ? 'Suspended' : ''}` }, timerMessage));
216
+ }
217
+ startCountdown() {
218
+ this.updateTimer();
219
+ this.interval = setInterval(() => {
220
+ this.updateTimer();
221
+ }, 1000);
222
+ }
223
+ updateTimer() {
224
+ const expirationTime = new Date(this.jackpotEndTime).getTime();
225
+ const now = new Date().getTime();
226
+ const distance = expirationTime - now;
227
+ if (distance < 1) {
228
+ this.clearInterval();
229
+ return;
230
+ }
231
+ const { days, hours, minutes, seconds } = {
232
+ days: String(Math.floor(distance / (1000 * 60 * 60 * 24))).padStart(2, '0'),
233
+ hours: String(Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
234
+ minutes: String(Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
235
+ seconds: String(Math.floor((distance % (1000 * 60)) / 1000)).padStart(2, '0')
236
+ };
237
+ this.timer = days === '00'
238
+ ? `${hours}h:${minutes}m:${seconds}s`
239
+ : `${days}d:${hours}h:${minutes}m`;
240
+ }
241
+ getPopupClasses() {
242
+ return {
243
+ JackpotDetailsPopup: true,
244
+ Disabled: !!this.disabledStatus || isBefore(new Date(this.jackpot.JackpotEndTime), new Date()),
245
+ [this.device]: true,
246
+ [this.jackpot.Type.charAt(0).toUpperCase() + this.jackpot.Type.slice(1)]: true
247
+ };
248
+ }
249
+ getTooltipTemplate() {
250
+ return (h("div", { class: "EngagementSuiteTooltipBackdrop" }, h("div", { class: "EngagementSuiteTooltip" }, h("button", { class: "EngagementSuiteIconButton Close", onClick: this.toggleTooltip }), translate('contributionTooltip', this.language))));
251
+ }
252
+ render() {
253
+ return h("div", { key: '96e68ef1594d185301719b8c8f4c6cb0c32307e9', class: this.getPopupClasses() }, this.getTopNavigationTemplate(), h("div", { key: '8eb282874b1efc99a05dfcf479b8b1be51402caa', class: "JackpotDetailsPopupContent" }, this.getJackpotDetailsHeaderTemplate(), this.getJackpotCountdown(), this.getTabsTemplate(), this.getTabsContentTemplate(), this.showTooltip && this.getTooltipTemplate()));
254
+ }
255
+ static get is() { return "casino-engagement-suite-jackpot-details"; }
256
+ static get encapsulation() { return "shadow"; }
257
+ static get originalStyleUrls() {
258
+ return {
259
+ "$": ["casino-engagement-suite-jackpot-details.scss"]
260
+ };
261
+ }
262
+ static get styleUrls() {
263
+ return {
264
+ "$": ["casino-engagement-suite-jackpot-details.css"]
265
+ };
266
+ }
267
+ static get properties() {
268
+ return {
269
+ "clientStyling": {
270
+ "type": "string",
271
+ "mutable": false,
272
+ "complexType": {
273
+ "original": "string",
274
+ "resolved": "string",
275
+ "references": {}
276
+ },
277
+ "required": false,
278
+ "optional": false,
279
+ "docs": {
280
+ "tags": [],
281
+ "text": "Client custom styling via string"
282
+ },
283
+ "attribute": "client-styling",
284
+ "reflect": true,
285
+ "defaultValue": "''"
286
+ },
287
+ "clientStylingUrl": {
288
+ "type": "string",
289
+ "mutable": false,
290
+ "complexType": {
291
+ "original": "string",
292
+ "resolved": "string",
293
+ "references": {}
294
+ },
295
+ "required": false,
296
+ "optional": false,
297
+ "docs": {
298
+ "tags": [],
299
+ "text": "Client custom styling via url"
300
+ },
301
+ "attribute": "client-styling-url",
302
+ "reflect": true,
303
+ "defaultValue": "''"
304
+ },
305
+ "jackpot": {
306
+ "type": "unknown",
307
+ "mutable": false,
308
+ "complexType": {
309
+ "original": "Jackpot",
310
+ "resolved": "Jackpot",
311
+ "references": {
312
+ "Jackpot": {
313
+ "location": "import",
314
+ "path": "../../models",
315
+ "id": "../../../../packages/stencil/casino-engagement-suite-jackpot-details/src/models/index.ts::Jackpot"
316
+ }
317
+ }
318
+ },
319
+ "required": false,
320
+ "optional": false,
321
+ "docs": {
322
+ "tags": [],
323
+ "text": "Selected jackpot"
324
+ }
325
+ },
326
+ "jackpotChangeStatusRequest": {
327
+ "type": "unknown",
328
+ "mutable": true,
329
+ "complexType": {
330
+ "original": "(event: MouseEvent) => void",
331
+ "resolved": "(event: MouseEvent) => void",
332
+ "references": {
333
+ "MouseEvent": {
334
+ "location": "global",
335
+ "id": "global::MouseEvent"
336
+ }
337
+ }
338
+ },
339
+ "required": false,
340
+ "optional": false,
341
+ "docs": {
342
+ "tags": [],
343
+ "text": "Change jackpot status"
344
+ }
345
+ },
346
+ "language": {
347
+ "type": "string",
348
+ "mutable": false,
349
+ "complexType": {
350
+ "original": "string",
351
+ "resolved": "string",
352
+ "references": {}
353
+ },
354
+ "required": false,
355
+ "optional": false,
356
+ "docs": {
357
+ "tags": [],
358
+ "text": "Language of the widget"
359
+ },
360
+ "attribute": "language",
361
+ "reflect": false,
362
+ "defaultValue": "'en'"
363
+ },
364
+ "gameSlug": {
365
+ "type": "string",
366
+ "mutable": false,
367
+ "complexType": {
368
+ "original": "string",
369
+ "resolved": "string",
370
+ "references": {}
371
+ },
372
+ "required": false,
373
+ "optional": false,
374
+ "docs": {
375
+ "tags": [],
376
+ "text": "Current game slug"
377
+ },
378
+ "attribute": "game-slug",
379
+ "reflect": false,
380
+ "defaultValue": "''"
381
+ },
382
+ "device": {
383
+ "type": "string",
384
+ "mutable": false,
385
+ "complexType": {
386
+ "original": "\"Mobile\" | \"Tablet\" | \"Desktop\"",
387
+ "resolved": "\"Desktop\" | \"Mobile\" | \"Tablet\"",
388
+ "references": {}
389
+ },
390
+ "required": false,
391
+ "optional": false,
392
+ "docs": {
393
+ "tags": [],
394
+ "text": "User's device type"
395
+ },
396
+ "attribute": "device",
397
+ "reflect": false,
398
+ "defaultValue": "'Mobile' as 'Mobile' | 'Tablet' | 'Desktop'"
399
+ }
400
+ };
401
+ }
402
+ static get states() {
403
+ return {
404
+ "limitStylingAppends": {},
405
+ "timer": {},
406
+ "disabledStatus": {},
407
+ "activeTab": {},
408
+ "visibleGames": {},
409
+ "enabled": {},
410
+ "balance": {},
411
+ "winBalance": {},
412
+ "showDetails": {},
413
+ "jackpotEndTime": {},
414
+ "showTooltip": {}
415
+ };
416
+ }
417
+ static get events() {
418
+ return [{
419
+ "method": "close",
420
+ "name": "close",
421
+ "bubbles": true,
422
+ "cancelable": true,
423
+ "composed": true,
424
+ "docs": {
425
+ "tags": [],
426
+ "text": ""
427
+ },
428
+ "complexType": {
429
+ "original": "void",
430
+ "resolved": "void",
431
+ "references": {}
432
+ }
433
+ }, {
434
+ "method": "back",
435
+ "name": "back",
436
+ "bubbles": true,
437
+ "cancelable": true,
438
+ "composed": true,
439
+ "docs": {
440
+ "tags": [],
441
+ "text": ""
442
+ },
443
+ "complexType": {
444
+ "original": "void",
445
+ "resolved": "void",
446
+ "references": {}
447
+ }
448
+ }];
449
+ }
450
+ static get elementRef() { return "host"; }
451
+ static get watchers() {
452
+ return [{
453
+ "propName": "jackpot",
454
+ "methodName": "handleJackpotUpdate"
455
+ }];
456
+ }
457
+ static get listeners() {
458
+ return [{
459
+ "name": "message",
460
+ "method": "handleEvent",
461
+ "target": "window",
462
+ "capture": false,
463
+ "passive": false
464
+ }, {
465
+ "name": "resize",
466
+ "method": "handleResize",
467
+ "target": "window",
468
+ "capture": false,
469
+ "passive": true
470
+ }];
471
+ }
532
472
  }