@everymatrix/casino-engagement-suite-challenges-list 1.35.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.
- package/dist/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.esm.js +1 -0
- package/dist/casino-engagement-suite-challenges-list/index.esm.js +0 -0
- package/dist/casino-engagement-suite-challenges-list/p-7e171791.js +1 -0
- package/dist/casino-engagement-suite-challenges-list/p-eb36cbe7.entry.js +1 -0
- package/dist/cjs/casino-engagement-suite-challenges-list.cjs.entry.js +1147 -0
- package/dist/cjs/casino-engagement-suite-challenges-list.cjs.js +19 -0
- package/dist/cjs/index-79c88755.js +1299 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.css +225 -0
- package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.js +368 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/models/challenge.js +15 -0
- package/dist/collection/utils/locale.utils.js +16 -0
- package/dist/components/casino-engagement-suite-challenges-list.d.ts +11 -0
- package/dist/components/casino-engagement-suite-challenges-list.js +1170 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/casino-engagement-suite-challenges-list.entry.js +1143 -0
- package/dist/esm/casino-engagement-suite-challenges-list.js +17 -0
- package/dist/esm/index-70e47fe0.js +1272 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- 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 +2 -0
- package/dist/types/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.d.ts +60 -0
- package/dist/types/components.d.ts +79 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/challenge.d.ts +57 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +19 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-79c88755.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchEsm = () => {
|
|
11
|
+
return index.promiseResolve();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defineCustomElements = (win, options) => {
|
|
15
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
|
+
return patchEsm().then(() => {
|
|
17
|
+
return index.bootstrapLazy([["casino-engagement-suite-challenges-list.cjs",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32]},[[8,"message","handleEvent"]]]]]], options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"./components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.js"
|
|
4
|
+
],
|
|
5
|
+
"compiler": {
|
|
6
|
+
"name": "@stencil/core",
|
|
7
|
+
"version": "2.15.2",
|
|
8
|
+
"typescriptVersion": "4.5.4"
|
|
9
|
+
},
|
|
10
|
+
"collections": [],
|
|
11
|
+
"bundles": []
|
|
12
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap");
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
font-family: inherit;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
* {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
button {
|
|
14
|
+
border: none;
|
|
15
|
+
background: none;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
button:focus {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ChallengesListPopup {
|
|
23
|
+
display: flex;
|
|
24
|
+
height: 100%;
|
|
25
|
+
background-color: var(--emw--color-background, #1E1638);
|
|
26
|
+
border-radius: 8px;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ChallengesListPopupHeader {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
align-items: center;
|
|
36
|
+
padding: 12px 8px 8px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ChallengesIconButton {
|
|
40
|
+
width: 16px;
|
|
41
|
+
height: 16px;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ChallengesListPopupHeaderName {
|
|
46
|
+
color: var(--emw--color-gray-100, #BBB9C3);
|
|
47
|
+
font-size: 14px;
|
|
48
|
+
font-weight: 500;
|
|
49
|
+
line-height: 14px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ChallengesListWrapper {
|
|
53
|
+
overflow-y: auto;
|
|
54
|
+
-ms-overflow-style: none;
|
|
55
|
+
scrollbar-width: none;
|
|
56
|
+
}
|
|
57
|
+
.ChallengesListWrapper::-webkit-scrollbar {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ChallengesList {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
row-gap: 12px;
|
|
65
|
+
padding: 8px 19px 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ChallengeCard {
|
|
69
|
+
padding: 15px 15px 19px;
|
|
70
|
+
border: 1px solid var(--emw--button-border-color, #403956);
|
|
71
|
+
border-radius: 6px;
|
|
72
|
+
position: relative;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ChallengeJoinButton.Joined::before,
|
|
76
|
+
.ChallengeCard.InProgress::before {
|
|
77
|
+
content: "";
|
|
78
|
+
position: absolute;
|
|
79
|
+
inset: 0;
|
|
80
|
+
border-radius: var(--emw--button-border-radius, 4px);
|
|
81
|
+
padding: 1px;
|
|
82
|
+
background: linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);
|
|
83
|
+
-webkit-mask: linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);
|
|
84
|
+
-webkit-mask-composite: xor;
|
|
85
|
+
mask-composite: exclude;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.ChallengeCardHeader {
|
|
89
|
+
display: flex;
|
|
90
|
+
justify-content: space-between;
|
|
91
|
+
gap: 24px;
|
|
92
|
+
margin-bottom: 12px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ChallengeName {
|
|
96
|
+
color: var(--emw--color-typography, #FFFFFF);
|
|
97
|
+
font-family: "Montserrat", sans-serif;
|
|
98
|
+
line-height: 22px;
|
|
99
|
+
font-weight: 700;
|
|
100
|
+
font-size: 18px;
|
|
101
|
+
word-break: break-word;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.ChallengeJoinButton {
|
|
105
|
+
transition: all 0.5s ease-out;
|
|
106
|
+
background: linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);
|
|
107
|
+
color: var(--emw--color-typography, #1E1638);
|
|
108
|
+
border-radius: 99px;
|
|
109
|
+
min-width: 88px;
|
|
110
|
+
height: 32px;
|
|
111
|
+
font-size: 14px;
|
|
112
|
+
font-weight: 700;
|
|
113
|
+
position: relative;
|
|
114
|
+
font-family: "Montserrat", sans-serif;
|
|
115
|
+
}
|
|
116
|
+
.ChallengeJoinButton.Joined {
|
|
117
|
+
background: linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);
|
|
118
|
+
-webkit-background-clip: text;
|
|
119
|
+
background-clip: text;
|
|
120
|
+
-webkit-text-fill-color: transparent;
|
|
121
|
+
}
|
|
122
|
+
.ChallengeJoinButton.Joined::before {
|
|
123
|
+
border-radius: 99px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ChallengesListEmpty {
|
|
127
|
+
padding: 20px 32px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ChallengesListEmpty h2 {
|
|
131
|
+
margin: 0 0 16px 0;
|
|
132
|
+
text-align: center;
|
|
133
|
+
font-weight: 600;
|
|
134
|
+
font-size: 20px;
|
|
135
|
+
line-height: 24px;
|
|
136
|
+
font-family: "Montserrat", sans-serif;
|
|
137
|
+
color: var(--emw--color-typography, #FFFFFF);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ChallengesListEmpty p {
|
|
141
|
+
font-size: 14px;
|
|
142
|
+
line-height: 17px;
|
|
143
|
+
color: var(--emw--color-gray-100, #BBB9C3);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.ChallengeCountdown {
|
|
147
|
+
color: var(--emw--color-gray-100, #BBB9C3);
|
|
148
|
+
font-size: 12px;
|
|
149
|
+
line-height: 12px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.ChallengesTooltipBackdrop {
|
|
153
|
+
padding: 48px 30px 0;
|
|
154
|
+
position: absolute;
|
|
155
|
+
width: 100%;
|
|
156
|
+
height: 100%;
|
|
157
|
+
inset: 0;
|
|
158
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
159
|
+
}
|
|
160
|
+
.ChallengesTooltipBackdrop .ChallengesTooltip {
|
|
161
|
+
border: 1px solid var(--emw--button-border-color, #403956);
|
|
162
|
+
background-color: var(--emw--color-background, #1E1638);
|
|
163
|
+
border-radius: 8px;
|
|
164
|
+
padding: 32px;
|
|
165
|
+
font-size: 14px;
|
|
166
|
+
line-height: 17px;
|
|
167
|
+
color: var(--emw--color-gray-100, #BBB9C3);
|
|
168
|
+
position: relative;
|
|
169
|
+
}
|
|
170
|
+
.ChallengesTooltipBackdrop .ChallengesTooltip .ChallengesIconButton {
|
|
171
|
+
top: 12px;
|
|
172
|
+
right: 6px;
|
|
173
|
+
position: absolute;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.ChallengesListPopup.Tablet .ChallengesListPopupHeader,
|
|
177
|
+
.ChallengesListPopup.Desktop .ChallengesListPopupHeader {
|
|
178
|
+
padding-top: 16px;
|
|
179
|
+
}
|
|
180
|
+
.ChallengesListPopup.Tablet .ChallengesListPopupHeaderName,
|
|
181
|
+
.ChallengesListPopup.Desktop .ChallengesListPopupHeaderName {
|
|
182
|
+
font-size: 16px;
|
|
183
|
+
line-height: 16px;
|
|
184
|
+
}
|
|
185
|
+
.ChallengesListPopup.Tablet .ChallengesIconButton,
|
|
186
|
+
.ChallengesListPopup.Desktop .ChallengesIconButton {
|
|
187
|
+
width: 24px;
|
|
188
|
+
height: 24px;
|
|
189
|
+
}
|
|
190
|
+
.ChallengesListPopup.Tablet .ChallengesList,
|
|
191
|
+
.ChallengesListPopup.Desktop .ChallengesList {
|
|
192
|
+
padding: 20px 24px 0;
|
|
193
|
+
row-gap: 20px;
|
|
194
|
+
}
|
|
195
|
+
.ChallengesListPopup.Tablet .ChallengeCardHeader,
|
|
196
|
+
.ChallengesListPopup.Desktop .ChallengeCardHeader {
|
|
197
|
+
margin-bottom: 16px;
|
|
198
|
+
}
|
|
199
|
+
.ChallengesListPopup.Tablet .ChallengeName,
|
|
200
|
+
.ChallengesListPopup.Desktop .ChallengeName {
|
|
201
|
+
line-height: 27px;
|
|
202
|
+
font-size: 22px;
|
|
203
|
+
}
|
|
204
|
+
.ChallengesListPopup.Tablet .ChallengeJoinButton,
|
|
205
|
+
.ChallengesListPopup.Desktop .ChallengeJoinButton {
|
|
206
|
+
min-width: 100px;
|
|
207
|
+
height: 36px;
|
|
208
|
+
font-size: 16px;
|
|
209
|
+
}
|
|
210
|
+
.ChallengesListPopup.Tablet .ChallengeCountdown,
|
|
211
|
+
.ChallengesListPopup.Desktop .ChallengeCountdown {
|
|
212
|
+
font-size: 14px;
|
|
213
|
+
line-height: 14px;
|
|
214
|
+
}
|
|
215
|
+
.ChallengesListPopup.Tablet .ChallengesTooltip,
|
|
216
|
+
.ChallengesListPopup.Desktop .ChallengesTooltip {
|
|
217
|
+
padding: 60px 65px;
|
|
218
|
+
font-size: 16px;
|
|
219
|
+
line-height: 20px;
|
|
220
|
+
}
|
|
221
|
+
.ChallengesListPopup.Tablet .ChallengesTooltip .ChallengesIconButton,
|
|
222
|
+
.ChallengesListPopup.Desktop .ChallengesTooltip .ChallengesIconButton {
|
|
223
|
+
top: 24px;
|
|
224
|
+
right: 24px;
|
|
225
|
+
}
|
|
@@ -0,0 +1,368 @@
|
|
|
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 intervalToDuration from 'date-fns/intervalToDuration';
|
|
6
|
+
import differenceInSeconds from 'date-fns/differenceInSeconds';
|
|
7
|
+
export class CasinoEngagementSuiteChallengesList {
|
|
8
|
+
constructor() {
|
|
9
|
+
/**
|
|
10
|
+
* Client custom styling via string
|
|
11
|
+
*/
|
|
12
|
+
this.clientStyling = '';
|
|
13
|
+
/**
|
|
14
|
+
* Client custom styling via url
|
|
15
|
+
*/
|
|
16
|
+
this.clientStylingUrl = '';
|
|
17
|
+
/**
|
|
18
|
+
* Language of the widget
|
|
19
|
+
*/
|
|
20
|
+
this.language = 'en';
|
|
21
|
+
/**
|
|
22
|
+
* User's device type
|
|
23
|
+
*/
|
|
24
|
+
this.device = 'Mobile';
|
|
25
|
+
/**
|
|
26
|
+
* List of challenges
|
|
27
|
+
*/
|
|
28
|
+
this.challenges = [];
|
|
29
|
+
this.tooltip = false;
|
|
30
|
+
this.timers = {};
|
|
31
|
+
this.limitStylingAppends = false;
|
|
32
|
+
this.setClientStyling = () => {
|
|
33
|
+
let sheet = document.createElement('style');
|
|
34
|
+
sheet.innerHTML = this.clientStyling;
|
|
35
|
+
this.host.prepend(sheet);
|
|
36
|
+
};
|
|
37
|
+
this.setClientStylingURL = () => {
|
|
38
|
+
let url = new URL(this.clientStylingUrl);
|
|
39
|
+
let cssFile = document.createElement('style');
|
|
40
|
+
fetch(url.href)
|
|
41
|
+
.then((res) => res.text())
|
|
42
|
+
.then((data) => {
|
|
43
|
+
cssFile.innerHTML = data;
|
|
44
|
+
setTimeout(() => { this.host.prepend(cssFile); }, 1);
|
|
45
|
+
})
|
|
46
|
+
.catch((err) => {
|
|
47
|
+
console.log('Error ', err);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
this.handleCloseClick = () => {
|
|
51
|
+
this.close.emit();
|
|
52
|
+
this.tooltip = false;
|
|
53
|
+
};
|
|
54
|
+
this.handleChallengeClick = (ev) => {
|
|
55
|
+
const id = +ev.currentTarget.getAttribute('data-id');
|
|
56
|
+
window.postMessage({ type: `ChallengeClick`, id });
|
|
57
|
+
};
|
|
58
|
+
this.showTooltip = () => {
|
|
59
|
+
this.tooltip = true;
|
|
60
|
+
};
|
|
61
|
+
this.hideTooltip = () => {
|
|
62
|
+
this.tooltip = false;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
challengesPropHandler(value) {
|
|
66
|
+
if (!this.interval && value.length) {
|
|
67
|
+
this.updateTimers();
|
|
68
|
+
this.startCountdown();
|
|
69
|
+
}
|
|
70
|
+
if (this.interval && !value.length) {
|
|
71
|
+
clearInterval(this.interval);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
handleEvent(e) {
|
|
75
|
+
const newChallenge = e.data.data;
|
|
76
|
+
if (e.data.type === 'ChallengeGrant') {
|
|
77
|
+
const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
|
|
78
|
+
if (index > -1) {
|
|
79
|
+
this.challenges.splice(index, 0, newChallenge);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.challenges.unshift(newChallenge);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
componentWillLoad() {
|
|
87
|
+
this.challengesPropHandler(this.challenges);
|
|
88
|
+
}
|
|
89
|
+
componentDidRender() {
|
|
90
|
+
if (!this.limitStylingAppends && this.host) {
|
|
91
|
+
if (this.clientStyling)
|
|
92
|
+
this.setClientStyling();
|
|
93
|
+
if (this.clientStylingUrl)
|
|
94
|
+
this.setClientStylingURL();
|
|
95
|
+
this.limitStylingAppends = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
disconnectedCallback() {
|
|
99
|
+
this.interval && clearInterval(this.interval);
|
|
100
|
+
}
|
|
101
|
+
startCountdown() {
|
|
102
|
+
this.interval = setInterval(() => {
|
|
103
|
+
this.updateTimers();
|
|
104
|
+
}, 1000);
|
|
105
|
+
}
|
|
106
|
+
updateTimers() {
|
|
107
|
+
const now = new Date();
|
|
108
|
+
this.timers = this.challenges.filter(challenge => challenge.Status !== ChallengeProgressStatus.Expired).reduce((acc, challenge) => {
|
|
109
|
+
const expirationDate = new Date(challenge.ExpirationTime);
|
|
110
|
+
const diff = differenceInSeconds(expirationDate, now);
|
|
111
|
+
const duration = intervalToDuration({
|
|
112
|
+
start: now,
|
|
113
|
+
end: expirationDate
|
|
114
|
+
});
|
|
115
|
+
let countdown = '00h:00m:00s';
|
|
116
|
+
if (diff < 1) {
|
|
117
|
+
this.removeChallenge(challenge.Id);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const days = duration.days.toString().padStart(2, '0');
|
|
121
|
+
const hours = duration.hours.toString().padStart(2, '0');
|
|
122
|
+
const minutes = duration.minutes.toString().padStart(2, '0');
|
|
123
|
+
const seconds = duration.seconds.toString().padStart(2, '0');
|
|
124
|
+
countdown = days === '00'
|
|
125
|
+
? `${hours}h:${minutes}m:${seconds}s`
|
|
126
|
+
: `${days}d:${hours}h:${minutes}m`;
|
|
127
|
+
}
|
|
128
|
+
return Object.assign(Object.assign({}, acc), { [challenge.Id]: countdown });
|
|
129
|
+
}, {});
|
|
130
|
+
}
|
|
131
|
+
removeChallenge(id) {
|
|
132
|
+
const index = this.challenges.findIndex(challenge => challenge.Id === id);
|
|
133
|
+
if (index > -1) {
|
|
134
|
+
this.challenges.splice(index, 1);
|
|
135
|
+
window.postMessage({ type: 'ChallengeHasExpired', id });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
getChallengeClasses(challenge) {
|
|
139
|
+
return {
|
|
140
|
+
ChallengeCard: true,
|
|
141
|
+
InProgress: challenge.Status === ChallengeProgressStatus.InProgress,
|
|
142
|
+
Completed: this.isChallengeCompleted(challenge),
|
|
143
|
+
Paused: this.isChallengePaused(challenge)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
isChallengePaused(challenge) {
|
|
147
|
+
return challenge.Status === ChallengeProgressStatus.Started
|
|
148
|
+
&& challenge.LevelProgresses[0].ProgressPercentage > 0;
|
|
149
|
+
}
|
|
150
|
+
isChallengeCompleted(challenge) {
|
|
151
|
+
return challenge.Status === ChallengeProgressStatus.Completed
|
|
152
|
+
|| (challenge.Status === ChallengeProgressStatus.PendingLevelReward
|
|
153
|
+
&& challenge.LevelProgresses.every(progress => progress.ProgressPercentage === 100));
|
|
154
|
+
}
|
|
155
|
+
getChallengeProgress(challenge) {
|
|
156
|
+
if (challenge.Status === ChallengeProgressStatus.Completed) {
|
|
157
|
+
return 100;
|
|
158
|
+
}
|
|
159
|
+
if (this.isChallengePaused(challenge)
|
|
160
|
+
|| challenge.Status === ChallengeProgressStatus.PendingLevelReward
|
|
161
|
+
|| challenge.Status === ChallengeProgressStatus.InProgress) {
|
|
162
|
+
const activeLevel = challenge.LevelProgresses
|
|
163
|
+
.find(level => level.ProgressStatus === ChallengeLevelProgressStatus.InProgress);
|
|
164
|
+
/**
|
|
165
|
+
* It is possible that Paused/InProgress challenge
|
|
166
|
+
* doesn't have InProgress level
|
|
167
|
+
* because level becomes InProgress after user's bet.
|
|
168
|
+
* In this case should be displayed progress of the next level (0%)
|
|
169
|
+
*/
|
|
170
|
+
return activeLevel ? activeLevel.ProgressPercentage : 0;
|
|
171
|
+
}
|
|
172
|
+
return -1;
|
|
173
|
+
}
|
|
174
|
+
getChallengeHeaderTemplate(challenge) {
|
|
175
|
+
return h("div", { class: "ChallengeCardHeader" },
|
|
176
|
+
h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName),
|
|
177
|
+
h("button", { class: challenge.Status === ChallengeProgressStatus.InProgress ? 'ChallengeJoinButton Joined' : 'ChallengeJoinButton' }, challenge.Status === ChallengeProgressStatus.InProgress
|
|
178
|
+
? translate('unjoin', this.language)
|
|
179
|
+
: translate('join', this.language)));
|
|
180
|
+
}
|
|
181
|
+
getChallengeTemplate(challenge) {
|
|
182
|
+
const challengeProgress = this.getChallengeProgress(challenge);
|
|
183
|
+
const countdown = this.timers[challenge.Id];
|
|
184
|
+
const progressTemplate = challengeProgress > -1
|
|
185
|
+
? h("casino-engagement-suite-progress-bar", { class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) },
|
|
186
|
+
h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
|
|
187
|
+
: h("span", { class: "ChallengeCountdown" }, countdown);
|
|
188
|
+
return (h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id },
|
|
189
|
+
this.getChallengeHeaderTemplate(challenge),
|
|
190
|
+
progressTemplate));
|
|
191
|
+
}
|
|
192
|
+
getHeaderTemplate() {
|
|
193
|
+
return h("header", { class: "ChallengesListPopupHeader" },
|
|
194
|
+
h("button", { onClick: this.showTooltip, class: "ChallengesIconButton" },
|
|
195
|
+
h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg", alt: "Show tooltip" })),
|
|
196
|
+
h("div", { class: "ChallengesListPopupHeaderName" }, translate('challenges', this.language)),
|
|
197
|
+
h("button", { class: "ChallengesIconButton", onClick: this.handleCloseClick },
|
|
198
|
+
h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "\u0421lose challenges list" })));
|
|
199
|
+
}
|
|
200
|
+
getListTemplate() {
|
|
201
|
+
if (this.challenges.length) {
|
|
202
|
+
return h("div", { class: "ChallengesListWrapper" },
|
|
203
|
+
h("div", { class: "ChallengesList" }, this.challenges.map(challenge => this.getChallengeTemplate(challenge))));
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
return h("div", { class: "ChallengesListEmpty" },
|
|
207
|
+
h("h2", null, translate('noChallenges', this.language)),
|
|
208
|
+
h("p", null, translate('tryOtherGames', this.language)));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
getTooltipTemplate() {
|
|
212
|
+
if (this.tooltip) {
|
|
213
|
+
return h("div", { class: "ChallengesTooltipBackdrop" },
|
|
214
|
+
h("div", { class: "ChallengesTooltip" },
|
|
215
|
+
h("button", { class: "ChallengesIconButton", onClick: this.hideTooltip },
|
|
216
|
+
h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "\u0421lose tooltip" })),
|
|
217
|
+
translate('tooltip', this.language)));
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
return '';
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
render() {
|
|
224
|
+
return h("div", { class: `ChallengesListPopup ${this.device}` },
|
|
225
|
+
this.getHeaderTemplate(),
|
|
226
|
+
this.getListTemplate(),
|
|
227
|
+
this.getTooltipTemplate());
|
|
228
|
+
}
|
|
229
|
+
static get is() { return "casino-engagement-suite-challenges-list"; }
|
|
230
|
+
static get encapsulation() { return "shadow"; }
|
|
231
|
+
static get originalStyleUrls() { return {
|
|
232
|
+
"$": ["casino-engagement-suite-challenges-list.scss"]
|
|
233
|
+
}; }
|
|
234
|
+
static get styleUrls() { return {
|
|
235
|
+
"$": ["casino-engagement-suite-challenges-list.css"]
|
|
236
|
+
}; }
|
|
237
|
+
static get properties() { return {
|
|
238
|
+
"clientStyling": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "string",
|
|
243
|
+
"resolved": "string",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "Client custom styling via string"
|
|
251
|
+
},
|
|
252
|
+
"attribute": "client-styling",
|
|
253
|
+
"reflect": true,
|
|
254
|
+
"defaultValue": "''"
|
|
255
|
+
},
|
|
256
|
+
"clientStylingUrl": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "string",
|
|
261
|
+
"resolved": "string",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": false,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": "Client custom styling via url"
|
|
269
|
+
},
|
|
270
|
+
"attribute": "client-styling-url",
|
|
271
|
+
"reflect": true,
|
|
272
|
+
"defaultValue": "''"
|
|
273
|
+
},
|
|
274
|
+
"language": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"mutable": false,
|
|
277
|
+
"complexType": {
|
|
278
|
+
"original": "string",
|
|
279
|
+
"resolved": "string",
|
|
280
|
+
"references": {}
|
|
281
|
+
},
|
|
282
|
+
"required": false,
|
|
283
|
+
"optional": false,
|
|
284
|
+
"docs": {
|
|
285
|
+
"tags": [],
|
|
286
|
+
"text": "Language of the widget"
|
|
287
|
+
},
|
|
288
|
+
"attribute": "language",
|
|
289
|
+
"reflect": false,
|
|
290
|
+
"defaultValue": "'en'"
|
|
291
|
+
},
|
|
292
|
+
"device": {
|
|
293
|
+
"type": "string",
|
|
294
|
+
"mutable": false,
|
|
295
|
+
"complexType": {
|
|
296
|
+
"original": "\"Mobile\" | \"Tablet\" | \"Desktop\"",
|
|
297
|
+
"resolved": "\"Desktop\" | \"Mobile\" | \"Tablet\"",
|
|
298
|
+
"references": {}
|
|
299
|
+
},
|
|
300
|
+
"required": false,
|
|
301
|
+
"optional": false,
|
|
302
|
+
"docs": {
|
|
303
|
+
"tags": [],
|
|
304
|
+
"text": "User's device type"
|
|
305
|
+
},
|
|
306
|
+
"attribute": "device",
|
|
307
|
+
"reflect": false,
|
|
308
|
+
"defaultValue": "'Mobile' as 'Mobile' | 'Tablet' | 'Desktop'"
|
|
309
|
+
},
|
|
310
|
+
"challenges": {
|
|
311
|
+
"type": "unknown",
|
|
312
|
+
"mutable": true,
|
|
313
|
+
"complexType": {
|
|
314
|
+
"original": "Challenge[]",
|
|
315
|
+
"resolved": "Challenge[]",
|
|
316
|
+
"references": {
|
|
317
|
+
"Array": {
|
|
318
|
+
"location": "global"
|
|
319
|
+
},
|
|
320
|
+
"Challenge": {
|
|
321
|
+
"location": "import",
|
|
322
|
+
"path": "../../models/challenge"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"required": false,
|
|
327
|
+
"optional": false,
|
|
328
|
+
"docs": {
|
|
329
|
+
"tags": [],
|
|
330
|
+
"text": "List of challenges"
|
|
331
|
+
},
|
|
332
|
+
"defaultValue": "[] as Array<Challenge>"
|
|
333
|
+
}
|
|
334
|
+
}; }
|
|
335
|
+
static get states() { return {
|
|
336
|
+
"tooltip": {},
|
|
337
|
+
"timers": {},
|
|
338
|
+
"limitStylingAppends": {}
|
|
339
|
+
}; }
|
|
340
|
+
static get events() { return [{
|
|
341
|
+
"method": "close",
|
|
342
|
+
"name": "close",
|
|
343
|
+
"bubbles": true,
|
|
344
|
+
"cancelable": true,
|
|
345
|
+
"composed": true,
|
|
346
|
+
"docs": {
|
|
347
|
+
"tags": [],
|
|
348
|
+
"text": ""
|
|
349
|
+
},
|
|
350
|
+
"complexType": {
|
|
351
|
+
"original": "void",
|
|
352
|
+
"resolved": "void",
|
|
353
|
+
"references": {}
|
|
354
|
+
}
|
|
355
|
+
}]; }
|
|
356
|
+
static get elementRef() { return "host"; }
|
|
357
|
+
static get watchers() { return [{
|
|
358
|
+
"propName": "challenges",
|
|
359
|
+
"methodName": "challengesPropHandler"
|
|
360
|
+
}]; }
|
|
361
|
+
static get listeners() { return [{
|
|
362
|
+
"name": "message",
|
|
363
|
+
"method": "handleEvent",
|
|
364
|
+
"target": "window",
|
|
365
|
+
"capture": false,
|
|
366
|
+
"passive": false
|
|
367
|
+
}]; }
|
|
368
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var ChallengeLevelProgressStatus;
|
|
2
|
+
(function (ChallengeLevelProgressStatus) {
|
|
3
|
+
ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Closed"] = 0] = "Closed";
|
|
4
|
+
ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["InProgress"] = 1] = "InProgress";
|
|
5
|
+
ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Fillup"] = 2] = "Fillup";
|
|
6
|
+
ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Completed"] = 3] = "Completed";
|
|
7
|
+
})(ChallengeLevelProgressStatus || (ChallengeLevelProgressStatus = {}));
|
|
8
|
+
export var ChallengeProgressStatus;
|
|
9
|
+
(function (ChallengeProgressStatus) {
|
|
10
|
+
ChallengeProgressStatus[ChallengeProgressStatus["Started"] = 0] = "Started";
|
|
11
|
+
ChallengeProgressStatus[ChallengeProgressStatus["InProgress"] = 1] = "InProgress";
|
|
12
|
+
ChallengeProgressStatus[ChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
|
|
13
|
+
ChallengeProgressStatus[ChallengeProgressStatus["Completed"] = 3] = "Completed";
|
|
14
|
+
ChallengeProgressStatus[ChallengeProgressStatus["Expired"] = 4] = "Expired";
|
|
15
|
+
})(ChallengeProgressStatus || (ChallengeProgressStatus = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['en'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
challenges: 'Challenges',
|
|
6
|
+
join: 'Join',
|
|
7
|
+
unjoin: 'Unjoin',
|
|
8
|
+
noChallenges: 'No Challenges yet',
|
|
9
|
+
tryOtherGames: 'Try winning Challenges as rewards or launching other booster games',
|
|
10
|
+
tooltip: 'Competition where your real money bets contribute towards the level progress to achieve the level reward'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const translate = (key, customLang) => {
|
|
14
|
+
const lang = customLang;
|
|
15
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface CasinoEngagementSuiteChallengesList extends Components.CasinoEngagementSuiteChallengesList, HTMLElement {}
|
|
4
|
+
export const CasinoEngagementSuiteChallengesList: {
|
|
5
|
+
prototype: CasinoEngagementSuiteChallengesList;
|
|
6
|
+
new (): CasinoEngagementSuiteChallengesList;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|