@everymatrix/casino-engagement-suite-challenges-list 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 (56) hide show
  1. package/dist/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.esm.js +1 -1
  2. package/dist/casino-engagement-suite-challenges-list/p-7fd72b22.js +2 -0
  3. package/dist/casino-engagement-suite-challenges-list/p-dd67e263.entry.js +1 -0
  4. package/dist/casino-engagement-suite-challenges-list/p-e1255160.js +1 -0
  5. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  6. package/dist/cjs/casino-engagement-suite-challenges-list.cjs.js +17 -11
  7. package/dist/cjs/casino-engagement-suite-challenges-list_2.cjs.entry.js +444 -466
  8. package/dist/cjs/index-97488095.js +1316 -0
  9. package/dist/cjs/loader.cjs.js +7 -13
  10. package/dist/collection/collection-manifest.json +3 -3
  11. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.css +112 -111
  12. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.js +480 -524
  13. package/dist/collection/components/casino-engagement-suite-challenges-list/index.js +1 -0
  14. package/dist/collection/models/challenge.js +18 -18
  15. package/dist/collection/renders/ChallengesHistory.js +31 -47
  16. package/dist/collection/utils/locale.utils.js +26 -26
  17. package/dist/collection/utils/utils.js +3 -0
  18. package/dist/esm/app-globals-0f993ce5.js +3 -0
  19. package/dist/esm/casino-engagement-suite-challenges-list.js +14 -11
  20. package/dist/esm/casino-engagement-suite-challenges-list_2.entry.js +444 -466
  21. package/dist/esm/index-00eb432b.js +1288 -0
  22. package/dist/esm/loader.js +7 -13
  23. package/dist/stencil.config.dev.js +17 -0
  24. package/dist/stencil.config.js +14 -19
  25. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-challenges-list/.stencil/packages/stencil/casino-engagement-suite-challenges-list/stencil.config.d.ts +2 -0
  26. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-challenges-list/.stencil/packages/stencil/casino-engagement-suite-challenges-list/stencil.config.dev.d.ts +2 -0
  27. package/dist/types/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.d.ts +81 -81
  28. package/dist/types/components/casino-engagement-suite-challenges-list/index.d.ts +1 -0
  29. package/dist/types/components.d.ts +19 -2
  30. package/dist/types/models/challenge.d.ts +65 -65
  31. package/dist/types/stencil-public-runtime.d.ts +142 -33
  32. package/dist/types/utils/utils.d.ts +1 -0
  33. package/loader/cdn.js +1 -3
  34. package/loader/index.cjs.js +1 -3
  35. package/loader/index.d.ts +13 -1
  36. package/loader/index.es2017.js +1 -3
  37. package/loader/index.js +1 -3
  38. package/loader/package.json +1 -0
  39. package/package.json +12 -2
  40. package/dist/casino-engagement-suite-challenges-list/p-2061b71e.entry.js +0 -1
  41. package/dist/casino-engagement-suite-challenges-list/p-fad4589e.js +0 -1
  42. package/dist/cjs/index-0a011384.js +0 -1336
  43. package/dist/components/casino-engagement-suite-challenges-list.d.ts +0 -11
  44. package/dist/components/casino-engagement-suite-challenges-list.js +0 -2650
  45. package/dist/components/casino-engagement-suite-progress-bar.js +0 -6
  46. package/dist/components/casino-engagement-suite-progress-bar2.js +0 -107
  47. package/dist/components/index.d.ts +0 -26
  48. package/dist/components/index.js +0 -1
  49. package/dist/esm/index-ddf7e990.js +0 -1309
  50. package/dist/esm/polyfills/core-js.js +0 -11
  51. package/dist/esm/polyfills/css-shim.js +0 -1
  52. package/dist/esm/polyfills/dom.js +0 -79
  53. package/dist/esm/polyfills/es5-html-element.js +0 -1
  54. package/dist/esm/polyfills/index.js +0 -34
  55. package/dist/esm/polyfills/system.js +0 -6
  56. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-challenges-list/.stencil/packages/casino-engagement-suite-challenges-list/stencil.config.d.ts +0 -2
@@ -1,541 +1,497 @@
1
- import { Component, Element, Event, h, Listen, Prop, State, Watch } from '@stencil/core';
2
- import { ChallengeLevelProgressStatus, ChallengeProgressStatus } from '../../models/challenge';
3
- import { translate } from '../../utils/locale.utils';
4
- import '@everymatrix/casino-engagement-suite-progress-bar';
5
- import { getChallengesHistoryTemplate, getHistoryLoaderTemplate } from '../../renders/ChallengesHistory';
1
+ import { h } from "@stencil/core";
2
+ import { ChallengeLevelProgressStatus, ChallengeProgressStatus } from "../../models/challenge";
3
+ import { translate } from "../../utils/locale.utils";
4
+ import "../../../../../casino-engagement-suite-progress-bar/dist/types/index";
5
+ import { getChallengesHistoryTemplate, getHistoryLoaderTemplate } from "../../renders/ChallengesHistory";
6
6
  export class CasinoEngagementSuiteChallengesList {
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
- * User's device type
22
- */
23
- this.device = 'Mobile';
24
- /**
25
- * List of challenges
26
- */
27
- this.challenges = [];
28
- /**
29
- *Paused Challenge Ids
30
- */
31
- this.pausedChallengeIds = [];
32
- this.tooltip = false;
33
- this.timers = {};
34
- this.limitStylingAppends = false;
35
- this.activeTab = 1;
36
- this.historyLoading = false;
37
- this.openedHistoryIds = [];
38
- this.setClientStyling = () => {
39
- let sheet = document.createElement('style');
40
- sheet.innerHTML = this.clientStyling;
41
- this.host.prepend(sheet);
42
- };
43
- this.setClientStylingURL = () => {
44
- let url = new URL(this.clientStylingUrl);
45
- let cssFile = document.createElement('style');
46
- fetch(url.href)
47
- .then((res) => res.text())
48
- .then((data) => {
49
- cssFile.innerHTML = data;
50
- setTimeout(() => { this.host.prepend(cssFile); }, 1);
51
- })
52
- .catch((err) => {
53
- console.log('Error ', err);
54
- });
55
- };
56
- this.handleTabChange = (e) => {
57
- this.activeTab = +(e.target.getAttribute('data-index'));
58
- if (this.activeTab === 2) {
59
- this.sendHistoryRequest();
60
- }
61
- };
62
- this.toggleChallengeHistory = (ev) => {
63
- const id = ev.currentTarget.getAttribute('data-id');
64
- const index = this.openedHistoryIds.findIndex(historyId => historyId === id);
65
- if (index > -1) {
66
- this.openedHistoryIds.splice(index, 1);
67
- }
68
- else {
69
- this.openedHistoryIds.push(id);
70
- }
71
- this.openedHistoryIds = [...this.openedHistoryIds];
72
- };
73
- this.handleCloseClick = () => {
74
- this.close.emit();
75
- this.tooltip = false;
76
- this.resetNewChallengeLabel.emit('list');
77
- };
78
- this.handleChallengeClick = (ev) => {
79
- const id = ev.currentTarget.getAttribute('data-id');
80
- window.postMessage({ type: 'ChallengeClick', id });
81
- };
82
- this.showTooltip = () => {
83
- this.tooltip = true;
84
- };
85
- this.hideTooltip = () => {
86
- this.tooltip = false;
87
- };
88
- this.changeChallengeStatus = (e) => {
89
- var _a, _b;
90
- e.stopPropagation();
91
- const id = e.currentTarget.getAttribute('data-id');
92
- if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
93
- window.postMessage({
94
- type: 'ShowConfirmationModal',
95
- ProgressToDeactivate: id,
96
- });
97
- return;
98
- }
99
- if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
7
+ constructor() {
8
+ this.setClientStyling = () => {
9
+ let sheet = document.createElement('style');
10
+ sheet.innerHTML = this.clientStyling;
11
+ this.host.prepend(sheet);
12
+ };
13
+ this.setClientStylingURL = () => {
14
+ let url = new URL(this.clientStylingUrl);
15
+ let cssFile = document.createElement('style');
16
+ fetch(url.href)
17
+ .then((res) => res.text())
18
+ .then((data) => {
19
+ cssFile.innerHTML = data;
20
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
21
+ })
22
+ .catch((err) => {
23
+ console.log('Error ', err);
24
+ });
25
+ };
26
+ this.handleTabChange = (e) => {
27
+ this.activeTab = +(e.target.getAttribute('data-index'));
28
+ if (this.activeTab === 2) {
29
+ this.sendHistoryRequest();
30
+ }
31
+ };
32
+ this.toggleChallengeHistory = (ev) => {
33
+ const id = ev.currentTarget.getAttribute('data-id');
34
+ const index = this.openedHistoryIds.findIndex(historyId => historyId === id);
35
+ if (index > -1) {
36
+ this.openedHistoryIds.splice(index, 1);
37
+ }
38
+ else {
39
+ this.openedHistoryIds.push(id);
40
+ }
41
+ this.openedHistoryIds = [...this.openedHistoryIds];
42
+ };
43
+ this.handleCloseClick = () => {
44
+ this.close.emit();
45
+ this.tooltip = false;
46
+ this.resetNewChallengeLabel.emit('list');
47
+ };
48
+ this.handleChallengeClick = (ev) => {
49
+ const id = ev.currentTarget.getAttribute('data-id');
50
+ window.postMessage({ type: 'ChallengeClick', id });
51
+ };
52
+ this.showTooltip = () => {
53
+ this.tooltip = true;
54
+ };
55
+ this.hideTooltip = () => {
56
+ this.tooltip = false;
57
+ };
58
+ this.changeChallengeStatus = (e) => {
59
+ var _a, _b;
60
+ e.stopPropagation();
61
+ const id = e.currentTarget.getAttribute('data-id');
62
+ if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
63
+ window.postMessage({
64
+ type: 'ShowConfirmationModal',
65
+ ProgressToDeactivate: id,
66
+ });
67
+ return;
68
+ }
69
+ if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
70
+ window.postMessage({
71
+ type: 'ShowConfirmationModal',
72
+ ProgressToActivate: id,
73
+ ProgressToDeactivate: this.inProgressChallenges[0],
74
+ });
75
+ return;
76
+ }
77
+ window.postMessage({
78
+ type: 'ChallengeJoinRequest',
79
+ data: {
80
+ ProgressToActivate: id,
81
+ },
82
+ });
83
+ };
84
+ this.clientStyling = '';
85
+ this.clientStylingUrl = '';
86
+ this.language = 'en';
87
+ this.device = 'Mobile';
88
+ this.challenges = [];
89
+ this.isJoiningToChallenge = undefined;
90
+ this.inProgressChallenges = undefined;
91
+ this.pausedChallengeIds = [];
92
+ this.tooltip = false;
93
+ this.timers = {};
94
+ this.limitStylingAppends = false;
95
+ this.activeTab = 1;
96
+ this.historyLoading = false;
97
+ this.challengesHistory = undefined;
98
+ this.openedHistoryIds = [];
99
+ }
100
+ handleEvent(e) {
101
+ const { type } = e === null || e === void 0 ? void 0 : e.data;
102
+ if (type === 'ChallengesHistoryResponse') {
103
+ this.openedHistoryIds = [];
104
+ this.challengesHistory = e.data.data || [];
105
+ this.historyLoading = false;
106
+ }
107
+ if (type === 'BarChallengesClick') {
108
+ this.activeTab = 1;
109
+ this.openedHistoryIds = [];
110
+ }
111
+ }
112
+ challengesPropHandler(value) {
113
+ if (!this.interval && value.length) {
114
+ this.updateTimers();
115
+ this.startCountdown();
116
+ }
117
+ if (this.interval && !value.length) {
118
+ clearInterval(this.interval);
119
+ }
120
+ }
121
+ componentWillLoad() {
122
+ this.challengesPropHandler(this.challenges);
123
+ }
124
+ componentDidRender() {
125
+ if (!this.limitStylingAppends && this.host) {
126
+ if (this.clientStyling)
127
+ this.setClientStyling();
128
+ if (this.clientStylingUrl)
129
+ this.setClientStylingURL();
130
+ this.limitStylingAppends = true;
131
+ }
132
+ }
133
+ disconnectedCallback() {
134
+ this.interval && clearInterval(this.interval);
135
+ }
136
+ sendHistoryRequest() {
137
+ this.historyLoading = true;
100
138
  window.postMessage({
101
- type: 'ShowConfirmationModal',
102
- ProgressToActivate: id,
103
- ProgressToDeactivate: this.inProgressChallenges[0],
139
+ type: 'ChallengesHistoryRequest'
104
140
  });
105
- return;
106
- }
107
- window.postMessage({
108
- type: 'ChallengeJoinRequest',
109
- data: {
110
- ProgressToActivate: id,
111
- },
112
- });
113
- };
114
- }
115
- handleEvent(e) {
116
- const { type } = e === null || e === void 0 ? void 0 : e.data;
117
- if (type === 'ChallengesHistoryResponse') {
118
- this.openedHistoryIds = [];
119
- this.challengesHistory = e.data.data || [];
120
- this.historyLoading = false;
121
- }
122
- if (type === 'BarChallengesClick') {
123
- this.activeTab = 1;
124
- this.openedHistoryIds = [];
125
141
  }
126
- }
127
- challengesPropHandler(value) {
128
- if (!this.interval && value.length) {
129
- this.updateTimers();
130
- this.startCountdown();
142
+ startCountdown() {
143
+ this.interval = setInterval(() => {
144
+ this.updateTimers();
145
+ }, 1000);
131
146
  }
132
- if (this.interval && !value.length) {
133
- clearInterval(this.interval);
147
+ updateTimers() {
148
+ const now = new Date().getTime();
149
+ this.timers = this.challenges.filter(challenge => challenge.Status !== ChallengeProgressStatus.Expired).reduce((acc, challenge) => {
150
+ const expirationDate = new Date(challenge.ExpirationTime).getTime();
151
+ const diff = expirationDate - now;
152
+ let countdown = '00h:00m:00s';
153
+ if (diff < 1) {
154
+ this.removeChallenge(challenge.Id);
155
+ }
156
+ else {
157
+ const { days, hours, minutes, seconds } = {
158
+ days: String(Math.floor(diff / (1000 * 60 * 60 * 24))).padStart(2, '0'),
159
+ hours: String(Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
160
+ minutes: String(Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
161
+ seconds: String(Math.floor((diff % (1000 * 60)) / 1000)).padStart(2, '0')
162
+ };
163
+ countdown = days === '00'
164
+ ? `${hours}h:${minutes}m:${seconds}s`
165
+ : `${days}d:${hours}h:${minutes}m`;
166
+ }
167
+ return Object.assign(Object.assign({}, acc), { [challenge.Id]: countdown });
168
+ }, {});
134
169
  }
135
- }
136
- componentWillLoad() {
137
- this.challengesPropHandler(this.challenges);
138
- }
139
- componentDidRender() {
140
- if (!this.limitStylingAppends && this.host) {
141
- if (this.clientStyling)
142
- this.setClientStyling();
143
- if (this.clientStylingUrl)
144
- this.setClientStylingURL();
145
- this.limitStylingAppends = true;
170
+ removeChallenge(id) {
171
+ const index = this.challenges.findIndex(challenge => challenge.Id === id);
172
+ if (index > -1) {
173
+ this.challenges.splice(index, 1);
174
+ window.postMessage({ type: 'ChallengeHasExpired', id });
175
+ }
146
176
  }
147
- }
148
- disconnectedCallback() {
149
- this.interval && clearInterval(this.interval);
150
- }
151
- sendHistoryRequest() {
152
- this.historyLoading = true;
153
- window.postMessage({
154
- type: 'ChallengesHistoryRequest'
155
- });
156
- }
157
- startCountdown() {
158
- this.interval = setInterval(() => {
159
- this.updateTimers();
160
- }, 1000);
161
- }
162
- updateTimers() {
163
- const now = new Date().getTime();
164
- this.timers = this.challenges.filter(challenge => challenge.Status !== ChallengeProgressStatus.Expired).reduce((acc, challenge) => {
165
- const expirationDate = new Date(challenge.ExpirationTime).getTime();
166
- const diff = expirationDate - now;
167
- let countdown = '00h:00m:00s';
168
- if (diff < 1) {
169
- this.removeChallenge(challenge.Id);
170
- }
171
- else {
172
- const { days, hours, minutes, seconds } = {
173
- days: String(Math.floor(diff / (1000 * 60 * 60 * 24))).padStart(2, '0'),
174
- hours: String(Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
175
- minutes: String(Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
176
- seconds: String(Math.floor((diff % (1000 * 60)) / 1000)).padStart(2, '0')
177
+ getChallengeClasses(challenge) {
178
+ return {
179
+ ChallengeCard: true,
180
+ InProgress: challenge.Status === ChallengeProgressStatus.InProgress
181
+ && !this.pausedChallengeIds.includes(challenge.ChallengeId),
182
+ Completed: this.isChallengeCompleted(challenge),
183
+ Paused: this.isChallengePaused(challenge)
177
184
  };
178
- countdown = days === '00'
179
- ? `${hours}h:${minutes}m:${seconds}s`
180
- : `${days}d:${hours}h:${minutes}m`;
181
- }
182
- return Object.assign(Object.assign({}, acc), { [challenge.Id]: countdown });
183
- }, {});
184
- }
185
- removeChallenge(id) {
186
- const index = this.challenges.findIndex(challenge => challenge.Id === id);
187
- if (index > -1) {
188
- this.challenges.splice(index, 1);
189
- window.postMessage({ type: 'ChallengeHasExpired', id });
190
185
  }
191
- }
192
- getChallengeClasses(challenge) {
193
- return {
194
- ChallengeCard: true,
195
- InProgress: challenge.Status === ChallengeProgressStatus.InProgress
196
- && !this.pausedChallengeIds.includes(challenge.ChallengeId),
197
- Completed: this.isChallengeCompleted(challenge),
198
- Paused: this.isChallengePaused(challenge)
199
- };
200
- }
201
- isChallengePaused(challenge) {
202
- return (challenge.Status === ChallengeProgressStatus.Started
203
- && challenge.LevelProgresses[0].ProgressPercentage > 0)
204
- || this.pausedChallengeIds.includes(challenge.ChallengeId);
205
- }
206
- isChallengeCompleted(challenge) {
207
- return challenge.Status === ChallengeProgressStatus.Completed
208
- || (challenge.Status === ChallengeProgressStatus.PendingLevelReward
209
- && challenge.LevelProgresses.every(progress => progress.ProgressPercentage === 100));
210
- }
211
- getChallengeProgress(challenge) {
212
- if (challenge.Status === ChallengeProgressStatus.Completed) {
213
- return 100;
186
+ isChallengePaused(challenge) {
187
+ return (challenge.Status === ChallengeProgressStatus.Started
188
+ && challenge.LevelProgresses[0].ProgressPercentage > 0)
189
+ || this.pausedChallengeIds.includes(challenge.ChallengeId);
190
+ }
191
+ isChallengeCompleted(challenge) {
192
+ return challenge.Status === ChallengeProgressStatus.Completed
193
+ || (challenge.Status === ChallengeProgressStatus.PendingLevelReward
194
+ && challenge.LevelProgresses.every(progress => progress.ProgressPercentage === 100));
195
+ }
196
+ getChallengeProgress(challenge) {
197
+ if (challenge.Status === ChallengeProgressStatus.Completed) {
198
+ return 100;
199
+ }
200
+ if (this.isChallengePaused(challenge)
201
+ || challenge.Status === ChallengeProgressStatus.PendingLevelReward
202
+ || challenge.Status === ChallengeProgressStatus.InProgress) {
203
+ const activeLevel = challenge.LevelProgresses
204
+ .find(level => level.ProgressStatus === ChallengeLevelProgressStatus.InProgress);
205
+ const completedLevel = challenge.LevelProgresses
206
+ .filter(level => level.ProgressStatus === ChallengeLevelProgressStatus.Fillup ||
207
+ level.ProgressStatus === ChallengeLevelProgressStatus.Completed).slice(-1)[0];
208
+ /**
209
+ * It is possible that Paused/InProgress challenge
210
+ * doesn't have InProgress, Fillup or Completed level
211
+ * because level becomes InProgress after user's bet.
212
+ * In this case should be displayed progress of the next level (0%)
213
+ */
214
+ return activeLevel ? activeLevel.ProgressPercentage
215
+ : (completedLevel ? completedLevel.ProgressPercentage : 0);
216
+ }
217
+ return -1;
214
218
  }
215
- if (this.isChallengePaused(challenge)
216
- || challenge.Status === ChallengeProgressStatus.PendingLevelReward
217
- || challenge.Status === ChallengeProgressStatus.InProgress) {
218
- const activeLevel = challenge.LevelProgresses
219
- .find(level => level.ProgressStatus === ChallengeLevelProgressStatus.InProgress);
220
- const completedLevel = challenge.LevelProgresses
221
- .filter(level => level.ProgressStatus === ChallengeLevelProgressStatus.Fillup ||
222
- level.ProgressStatus === ChallengeLevelProgressStatus.Completed).slice(-1)[0];
223
- /**
224
- * It is possible that Paused/InProgress challenge
225
- * doesn't have InProgress, Fillup or Completed level
226
- * because level becomes InProgress after user's bet.
227
- * In this case should be displayed progress of the next level (0%)
228
- */
229
- return activeLevel ? activeLevel.ProgressPercentage
230
- : (completedLevel ? completedLevel.ProgressPercentage : 0);
219
+ getChallengeHeaderTemplate(challenge) {
220
+ const { Id } = challenge;
221
+ const inProgressChallenge = challenge.Status === ChallengeProgressStatus.InProgress
222
+ || challenge.Status === ChallengeProgressStatus.PendingLevelReward;
223
+ return h("div", { class: "ChallengeCardHeader" }, h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), challenge.Status !== ChallengeProgressStatus.Completed ? (h("button", { class: `${inProgressChallenge ?
224
+ 'EngagementSuiteButton Active' : 'EngagementSuiteButton'} ${this.isJoiningToChallenge ||
225
+ this.pausedChallengeIds.includes(challenge.ChallengeId) ?
226
+ 'Disabled' : ''}`, onClick: this.changeChallengeStatus, "data-id": Id }, inProgressChallenge
227
+ ? translate('unjoin', this.language)
228
+ : translate('join', this.language))) : null);
231
229
  }
232
- return -1;
233
- }
234
- getChallengeHeaderTemplate(challenge) {
235
- const { Id } = challenge;
236
- const inProgressChallenge = challenge.Status === ChallengeProgressStatus.InProgress
237
- || challenge.Status === ChallengeProgressStatus.PendingLevelReward;
238
- return h("div", { class: "ChallengeCardHeader" },
239
- h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName),
240
- challenge.Status !== ChallengeProgressStatus.Completed ? (h("button", { class: `${inProgressChallenge ?
241
- 'ChallengeJoinButton Joined' : 'ChallengeJoinButton'} ${this.isJoiningToChallenge ||
242
- this.pausedChallengeIds.includes(challenge.ChallengeId) ?
243
- 'Disabled' : ''}`, onClick: this.changeChallengeStatus, "data-id": Id }, inProgressChallenge
244
- ? translate('unjoin', this.language)
245
- : translate('join', this.language))) : null);
246
- }
247
- getChallengeTemplate(challenge) {
248
- const isForfeitedChallenge = challenge.Status === ChallengeProgressStatus.Forfeited;
249
- const challengeProgress = this.getChallengeProgress(challenge);
250
- const countdown = this.timers[challenge.Id];
251
- const progressTemplate = challengeProgress > -1
252
- ? h("casino-engagement-suite-progress-bar", { class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) },
253
- h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
254
- : h("span", { class: "ChallengeCountdown" }, countdown);
255
- return isForfeitedChallenge ? (this.getForfeitedChallengeTemplate(challenge)) : (h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id },
256
- this.getChallengeHeaderTemplate(challenge),
257
- progressTemplate,
258
- h("div", { class: `ChallengeLabel ${challenge.IsNew ? 'ShowChallengeLabel' : ''}` },
259
- h("span", null, translate('new', this.language)))));
260
- }
261
- getForfeitedChallengeTemplate(challenge) {
262
- return h("div", { class: "ChallengeCard ForfeitedChallengeCard" },
263
- h("div", { class: "ForfeitedChallengeName" }, challenge.ChallengePresentation.PresentationName),
264
- h("div", { class: "ForfeitedChallengeInfo" },
265
- h("div", null,
266
- h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/alert-circle.svg", alt: "Forfeited" })),
267
- h("div", { class: "ForfeitedChallengeMessage" },
268
- h("div", null, translate('missionHasBeenForfeited', this.language)),
269
- h("div", null, translate('support', this.language)))));
270
- }
271
- getHeaderTemplate() {
272
- return h("header", { class: "ChallengesListPopupHeader" },
273
- h("button", { onClick: this.showTooltip, class: "ChallengesIconButton" },
274
- h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg", alt: "Show tooltip" })),
275
- h("div", { class: "ChallengesListPopupHeaderName" }, translate('missions', this.language)),
276
- h("button", { class: "ChallengesIconButton", onClick: this.handleCloseClick },
277
- h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close missions list" })));
278
- }
279
- getListTabTemplate() {
280
- if (this.challenges.length) {
281
- return h("div", { class: "ChallengesListWrapper" },
282
- h("div", { class: "ChallengesList" }, [...this.challenges]
283
- .sort(challenge => challenge.Status === ChallengeProgressStatus.InProgress ? -1 : 0)
284
- .map(challenge => this.getChallengeTemplate(challenge))));
230
+ getChallengeTemplate(challenge) {
231
+ const isForfeitedChallenge = challenge.Status === ChallengeProgressStatus.Forfeited;
232
+ const challengeProgress = this.getChallengeProgress(challenge);
233
+ const countdown = this.timers[challenge.Id];
234
+ const progressTemplate = challengeProgress > -1
235
+ ? h("casino-engagement-suite-progress-bar", { clientStylingUrl: this.clientStylingUrl, class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) }, h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
236
+ : h("span", { class: "ChallengeCountdown" }, countdown);
237
+ return isForfeitedChallenge ? (this.getForfeitedChallengeTemplate(challenge)) : (h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id }, this.getChallengeHeaderTemplate(challenge), progressTemplate, h("div", { class: `ChallengeLabel ${challenge.IsNew ? 'ShowChallengeLabel' : ''}` }, h("span", null, translate('new', this.language)))));
285
238
  }
286
- else {
287
- return h("div", { class: "ChallengesListEmpty" },
288
- h("h2", null, translate('noMissions', this.language)),
289
- h("p", null, translate('tryOtherGames', this.language)));
239
+ getForfeitedChallengeTemplate(challenge) {
240
+ return h("div", { class: "ChallengeCard ForfeitedChallengeCard" }, h("div", { class: "ForfeitedChallengeName" }, challenge.ChallengePresentation.PresentationName), h("div", { class: "ForfeitedChallengeInfo" }, h("div", null, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/alert-circle.svg", alt: "Forfeited" })), h("div", { class: "ForfeitedChallengeMessage" }, h("div", null, translate('missionHasBeenForfeited', this.language)), h("div", null, translate('support', this.language)))));
290
241
  }
291
- }
292
- getTooltipTemplate() {
293
- return h("div", { class: "ChallengesTooltipBackdrop" },
294
- h("div", { class: "ChallengesTooltip" },
295
- h("button", { class: "ChallengesIconButton", onClick: this.hideTooltip },
296
- h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })),
297
- translate('tooltip', this.language)));
298
- }
299
- getHistoryTabTemplate() {
300
- return h("div", { class: "HistoryWrapper" },
301
- h("div", { class: "HistoryCols" },
302
- h("div", { class: "HistoryColName Level" }, translate('level', this.language)),
303
- h("div", { class: "HistoryColName Status" }, translate('status', this.language)),
304
- h("div", { class: "HistoryColName Time" }, translate('time', this.language))),
305
- this.historyLoading
306
- ? getHistoryLoaderTemplate(this.language)
307
- : getChallengesHistoryTemplate(this.challengesHistory, this.openedHistoryIds, this.toggleChallengeHistory, this.language));
308
- }
309
- getTabsTemplate() {
310
- return h("div", { class: "TabsWrapper" },
311
- h("div", { class: "Tabs" },
312
- h("div", { "data-index": "1", onClick: this.handleTabChange, class: `Tab ${this.activeTab === 1 ? 'Active' : ''}` }, translate('missions', this.language)),
313
- h("div", { "data-index": "2", onClick: this.handleTabChange, class: `Tab ${this.activeTab === 2 ? 'Active' : ''}` }, translate('history', this.language))));
314
- }
315
- getTabsContentTemplate() {
316
- return this.activeTab === 1
317
- ? this.getListTabTemplate()
318
- : this.getHistoryTabTemplate();
319
- }
320
- render() {
321
- return h("div", { class: `ChallengesListPopup ${this.device}` },
322
- this.getHeaderTemplate(),
323
- this.getTabsTemplate(),
324
- this.getTabsContentTemplate(),
325
- this.tooltip && this.getTooltipTemplate());
326
- }
327
- static get is() { return "casino-engagement-suite-challenges-list"; }
328
- static get encapsulation() { return "shadow"; }
329
- static get originalStyleUrls() { return {
330
- "$": ["casino-engagement-suite-challenges-list.scss"]
331
- }; }
332
- static get styleUrls() { return {
333
- "$": ["casino-engagement-suite-challenges-list.css"]
334
- }; }
335
- static get properties() { return {
336
- "clientStyling": {
337
- "type": "string",
338
- "mutable": false,
339
- "complexType": {
340
- "original": "string",
341
- "resolved": "string",
342
- "references": {}
343
- },
344
- "required": false,
345
- "optional": false,
346
- "docs": {
347
- "tags": [],
348
- "text": "Client custom styling via string"
349
- },
350
- "attribute": "client-styling",
351
- "reflect": true,
352
- "defaultValue": "''"
353
- },
354
- "clientStylingUrl": {
355
- "type": "string",
356
- "mutable": false,
357
- "complexType": {
358
- "original": "string",
359
- "resolved": "string",
360
- "references": {}
361
- },
362
- "required": false,
363
- "optional": false,
364
- "docs": {
365
- "tags": [],
366
- "text": "Client custom styling via url"
367
- },
368
- "attribute": "client-styling-url",
369
- "reflect": true,
370
- "defaultValue": "''"
371
- },
372
- "language": {
373
- "type": "string",
374
- "mutable": false,
375
- "complexType": {
376
- "original": "string",
377
- "resolved": "string",
378
- "references": {}
379
- },
380
- "required": false,
381
- "optional": false,
382
- "docs": {
383
- "tags": [],
384
- "text": "Language of the widget"
385
- },
386
- "attribute": "language",
387
- "reflect": false,
388
- "defaultValue": "'en'"
389
- },
390
- "device": {
391
- "type": "string",
392
- "mutable": false,
393
- "complexType": {
394
- "original": "\"Mobile\" | \"Tablet\" | \"Desktop\"",
395
- "resolved": "\"Desktop\" | \"Mobile\" | \"Tablet\"",
396
- "references": {}
397
- },
398
- "required": false,
399
- "optional": false,
400
- "docs": {
401
- "tags": [],
402
- "text": "User's device type"
403
- },
404
- "attribute": "device",
405
- "reflect": false,
406
- "defaultValue": "'Mobile' as 'Mobile' | 'Tablet' | 'Desktop'"
407
- },
408
- "challenges": {
409
- "type": "unknown",
410
- "mutable": true,
411
- "complexType": {
412
- "original": "Challenge[]",
413
- "resolved": "Challenge[]",
414
- "references": {
415
- "Array": {
416
- "location": "global"
417
- },
418
- "Challenge": {
419
- "location": "import",
420
- "path": "../../models/challenge"
421
- }
422
- }
423
- },
424
- "required": false,
425
- "optional": false,
426
- "docs": {
427
- "tags": [],
428
- "text": "List of challenges"
429
- },
430
- "defaultValue": "[] as Array<Challenge>"
431
- },
432
- "isJoiningToChallenge": {
433
- "type": "boolean",
434
- "mutable": true,
435
- "complexType": {
436
- "original": "boolean",
437
- "resolved": "boolean",
438
- "references": {}
439
- },
440
- "required": false,
441
- "optional": false,
442
- "docs": {
443
- "tags": [],
444
- "text": "Is joining to challenge"
445
- },
446
- "attribute": "is-joining-to-challenge",
447
- "reflect": false
448
- },
449
- "inProgressChallenges": {
450
- "type": "unknown",
451
- "mutable": true,
452
- "complexType": {
453
- "original": "Array<string>",
454
- "resolved": "string[]",
455
- "references": {
456
- "Array": {
457
- "location": "global"
458
- }
242
+ getHeaderTemplate() {
243
+ return h("header", { class: "ChallengesListPopupHeader" }, h("button", { onClick: this.showTooltip, class: "EngagementSuiteIconButton Help" }), h("div", { class: "ChallengesListPopupHeaderName" }, translate('missions', this.language)), h("button", { class: "EngagementSuiteIconButton Close", onClick: this.handleCloseClick }));
244
+ }
245
+ getListTabTemplate() {
246
+ if (this.challenges.length) {
247
+ return h("div", { class: "ChallengesListWrapper" }, h("div", { class: "ChallengesList" }, [...this.challenges]
248
+ .sort(challenge => challenge.Status === ChallengeProgressStatus.InProgress ? -1 : 0)
249
+ .map(challenge => this.getChallengeTemplate(challenge))));
459
250
  }
460
- },
461
- "required": false,
462
- "optional": false,
463
- "docs": {
464
- "tags": [],
465
- "text": "Active challenges"
466
- }
467
- },
468
- "pausedChallengeIds": {
469
- "type": "unknown",
470
- "mutable": true,
471
- "complexType": {
472
- "original": "string[]",
473
- "resolved": "string[]",
474
- "references": {
475
- "Array": {
476
- "location": "global"
477
- }
251
+ else {
252
+ return h("div", { class: "ChallengesListEmpty" }, h("h2", null, translate('noMissions', this.language)), h("p", null, translate('tryOtherGames', this.language)));
478
253
  }
479
- },
480
- "required": false,
481
- "optional": false,
482
- "docs": {
483
- "tags": [],
484
- "text": "Paused Challenge Ids"
485
- },
486
- "defaultValue": "[] as Array<string>"
487
254
  }
488
- }; }
489
- static get states() { return {
490
- "tooltip": {},
491
- "timers": {},
492
- "limitStylingAppends": {},
493
- "activeTab": {},
494
- "historyLoading": {},
495
- "challengesHistory": {},
496
- "openedHistoryIds": {}
497
- }; }
498
- static get events() { return [{
499
- "method": "close",
500
- "name": "close",
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
- "method": "resetNewChallengeLabel",
515
- "name": "resetNewChallengeLabel",
516
- "bubbles": true,
517
- "cancelable": true,
518
- "composed": true,
519
- "docs": {
520
- "tags": [],
521
- "text": ""
522
- },
523
- "complexType": {
524
- "original": "string",
525
- "resolved": "string",
526
- "references": {}
527
- }
528
- }]; }
529
- static get elementRef() { return "host"; }
530
- static get watchers() { return [{
531
- "propName": "challenges",
532
- "methodName": "challengesPropHandler"
533
- }]; }
534
- static get listeners() { return [{
535
- "name": "message",
536
- "method": "handleEvent",
537
- "target": "window",
538
- "capture": false,
539
- "passive": false
540
- }]; }
255
+ getTooltipTemplate() {
256
+ return h("div", { class: "EngagementSuiteTooltipBackdrop" }, h("div", { class: "EngagementSuiteTooltip" }, h("button", { class: "EngagementSuiteIconButton Close", onClick: this.hideTooltip }), translate('tooltip', this.language)));
257
+ }
258
+ getHistoryTabTemplate() {
259
+ return h("div", { class: "HistoryWrapper" }, h("div", { class: "HistoryCols" }, h("div", { class: "HistoryColName Level" }, translate('level', this.language)), h("div", { class: "HistoryColName Status" }, translate('status', this.language)), h("div", { class: "HistoryColName Time" }, translate('time', this.language))), this.historyLoading
260
+ ? getHistoryLoaderTemplate(this.language)
261
+ : getChallengesHistoryTemplate(this.challengesHistory, this.openedHistoryIds, this.toggleChallengeHistory, this.language));
262
+ }
263
+ getTabsTemplate() {
264
+ return h("div", { class: "EngagementSuiteTabsWrapper" }, h("div", { class: "EngagementSuiteTabs" }, h("div", { "data-index": "1", onClick: this.handleTabChange, class: `EngagementSuiteTab ${this.activeTab === 1 ? 'Active' : ''}` }, translate('missions', this.language)), h("div", { "data-index": "2", onClick: this.handleTabChange, class: `EngagementSuiteTab ${this.activeTab === 2 ? 'Active' : ''}` }, translate('history', this.language))));
265
+ }
266
+ getTabsContentTemplate() {
267
+ return this.activeTab === 1
268
+ ? this.getListTabTemplate()
269
+ : this.getHistoryTabTemplate();
270
+ }
271
+ render() {
272
+ return h("div", { key: '50b676f6394d813aa946ed1fd85e9612ba04a7a1', class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getTabsTemplate(), this.getTabsContentTemplate(), this.tooltip && this.getTooltipTemplate());
273
+ }
274
+ static get is() { return "casino-engagement-suite-challenges-list"; }
275
+ static get encapsulation() { return "shadow"; }
276
+ static get originalStyleUrls() {
277
+ return {
278
+ "$": ["casino-engagement-suite-challenges-list.scss"]
279
+ };
280
+ }
281
+ static get styleUrls() {
282
+ return {
283
+ "$": ["casino-engagement-suite-challenges-list.css"]
284
+ };
285
+ }
286
+ static get properties() {
287
+ return {
288
+ "clientStyling": {
289
+ "type": "string",
290
+ "mutable": false,
291
+ "complexType": {
292
+ "original": "string",
293
+ "resolved": "string",
294
+ "references": {}
295
+ },
296
+ "required": false,
297
+ "optional": false,
298
+ "docs": {
299
+ "tags": [],
300
+ "text": "Client custom styling via string"
301
+ },
302
+ "attribute": "client-styling",
303
+ "reflect": true,
304
+ "defaultValue": "''"
305
+ },
306
+ "clientStylingUrl": {
307
+ "type": "string",
308
+ "mutable": false,
309
+ "complexType": {
310
+ "original": "string",
311
+ "resolved": "string",
312
+ "references": {}
313
+ },
314
+ "required": false,
315
+ "optional": false,
316
+ "docs": {
317
+ "tags": [],
318
+ "text": "Client custom styling via url"
319
+ },
320
+ "attribute": "client-styling-url",
321
+ "reflect": true,
322
+ "defaultValue": "''"
323
+ },
324
+ "language": {
325
+ "type": "string",
326
+ "mutable": false,
327
+ "complexType": {
328
+ "original": "string",
329
+ "resolved": "string",
330
+ "references": {}
331
+ },
332
+ "required": false,
333
+ "optional": false,
334
+ "docs": {
335
+ "tags": [],
336
+ "text": "Language of the widget"
337
+ },
338
+ "attribute": "language",
339
+ "reflect": false,
340
+ "defaultValue": "'en'"
341
+ },
342
+ "device": {
343
+ "type": "string",
344
+ "mutable": false,
345
+ "complexType": {
346
+ "original": "\"Mobile\" | \"Tablet\" | \"Desktop\"",
347
+ "resolved": "\"Desktop\" | \"Mobile\" | \"Tablet\"",
348
+ "references": {}
349
+ },
350
+ "required": false,
351
+ "optional": false,
352
+ "docs": {
353
+ "tags": [],
354
+ "text": "User's device type"
355
+ },
356
+ "attribute": "device",
357
+ "reflect": false,
358
+ "defaultValue": "'Mobile' as 'Mobile' | 'Tablet' | 'Desktop'"
359
+ },
360
+ "challenges": {
361
+ "type": "unknown",
362
+ "mutable": true,
363
+ "complexType": {
364
+ "original": "Challenge[]",
365
+ "resolved": "Challenge[]",
366
+ "references": {
367
+ "Challenge": {
368
+ "location": "import",
369
+ "path": "../../models/challenge",
370
+ "id": "../../../../packages/stencil/casino-engagement-suite-challenges-list/src/models/challenge.ts::Challenge"
371
+ }
372
+ }
373
+ },
374
+ "required": false,
375
+ "optional": false,
376
+ "docs": {
377
+ "tags": [],
378
+ "text": "List of challenges"
379
+ },
380
+ "defaultValue": "[] as Array<Challenge>"
381
+ },
382
+ "isJoiningToChallenge": {
383
+ "type": "boolean",
384
+ "mutable": true,
385
+ "complexType": {
386
+ "original": "boolean",
387
+ "resolved": "boolean",
388
+ "references": {}
389
+ },
390
+ "required": false,
391
+ "optional": false,
392
+ "docs": {
393
+ "tags": [],
394
+ "text": "Is joining to challenge"
395
+ },
396
+ "attribute": "is-joining-to-challenge",
397
+ "reflect": false
398
+ },
399
+ "inProgressChallenges": {
400
+ "type": "unknown",
401
+ "mutable": true,
402
+ "complexType": {
403
+ "original": "Array<string>",
404
+ "resolved": "string[]",
405
+ "references": {
406
+ "Array": {
407
+ "location": "global",
408
+ "id": "global::Array"
409
+ }
410
+ }
411
+ },
412
+ "required": false,
413
+ "optional": false,
414
+ "docs": {
415
+ "tags": [],
416
+ "text": "Active challenges"
417
+ }
418
+ },
419
+ "pausedChallengeIds": {
420
+ "type": "unknown",
421
+ "mutable": true,
422
+ "complexType": {
423
+ "original": "string[]",
424
+ "resolved": "string[]",
425
+ "references": {}
426
+ },
427
+ "required": false,
428
+ "optional": false,
429
+ "docs": {
430
+ "tags": [],
431
+ "text": "Paused Challenge Ids"
432
+ },
433
+ "defaultValue": "[] as Array<string>"
434
+ }
435
+ };
436
+ }
437
+ static get states() {
438
+ return {
439
+ "tooltip": {},
440
+ "timers": {},
441
+ "limitStylingAppends": {},
442
+ "activeTab": {},
443
+ "historyLoading": {},
444
+ "challengesHistory": {},
445
+ "openedHistoryIds": {}
446
+ };
447
+ }
448
+ static get events() {
449
+ return [{
450
+ "method": "close",
451
+ "name": "close",
452
+ "bubbles": true,
453
+ "cancelable": true,
454
+ "composed": true,
455
+ "docs": {
456
+ "tags": [],
457
+ "text": ""
458
+ },
459
+ "complexType": {
460
+ "original": "void",
461
+ "resolved": "void",
462
+ "references": {}
463
+ }
464
+ }, {
465
+ "method": "resetNewChallengeLabel",
466
+ "name": "resetNewChallengeLabel",
467
+ "bubbles": true,
468
+ "cancelable": true,
469
+ "composed": true,
470
+ "docs": {
471
+ "tags": [],
472
+ "text": ""
473
+ },
474
+ "complexType": {
475
+ "original": "string",
476
+ "resolved": "string",
477
+ "references": {}
478
+ }
479
+ }];
480
+ }
481
+ static get elementRef() { return "host"; }
482
+ static get watchers() {
483
+ return [{
484
+ "propName": "challenges",
485
+ "methodName": "challengesPropHandler"
486
+ }];
487
+ }
488
+ static get listeners() {
489
+ return [{
490
+ "name": "message",
491
+ "method": "handleEvent",
492
+ "target": "window",
493
+ "capture": false,
494
+ "passive": false
495
+ }];
496
+ }
541
497
  }