@everymatrix/casino-engagement-suite-challenges-list 1.35.0 → 1.36.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 (24) 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-a9f41c83.entry.js +1 -0
  3. package/dist/casino-engagement-suite-challenges-list/p-fad4589e.js +1 -0
  4. package/dist/cjs/casino-engagement-suite-challenges-list.cjs.js +2 -2
  5. package/dist/cjs/casino-engagement-suite-challenges-list_2.cjs.entry.js +484 -0
  6. package/dist/cjs/{index-79c88755.js → index-0a011384.js} +38 -1
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/collection/collection-manifest.json +8 -1
  9. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.css +1 -0
  10. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.js +43 -16
  11. package/dist/components/casino-engagement-suite-challenges-list.js +51 -773
  12. package/dist/components/casino-engagement-suite-progress-bar.js +6 -0
  13. package/dist/components/casino-engagement-suite-progress-bar2.js +88 -0
  14. package/dist/esm/casino-engagement-suite-challenges-list.js +2 -2
  15. package/dist/esm/casino-engagement-suite-challenges-list_2.entry.js +479 -0
  16. package/dist/esm/{index-70e47fe0.js → index-ddf7e990.js} +38 -1
  17. package/dist/esm/loader.js +2 -2
  18. package/dist/types/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.d.ts +1 -0
  19. package/dist/types/models/challenge.d.ts +1 -0
  20. package/package.json +1 -1
  21. package/dist/casino-engagement-suite-challenges-list/p-7e171791.js +0 -1
  22. package/dist/casino-engagement-suite-challenges-list/p-eb36cbe7.entry.js +0 -1
  23. package/dist/cjs/casino-engagement-suite-challenges-list.cjs.entry.js +0 -1147
  24. package/dist/esm/casino-engagement-suite-challenges-list.entry.js +0 -1143
@@ -0,0 +1,6 @@
1
+ import { C as CasinoEngagementSuiteProgressBar$1, d as defineCustomElement$1 } from './casino-engagement-suite-progress-bar2.js';
2
+
3
+ const CasinoEngagementSuiteProgressBar = CasinoEngagementSuiteProgressBar$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { CasinoEngagementSuiteProgressBar, defineCustomElement };
@@ -0,0 +1,88 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+
3
+ const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
4
+
5
+ const CasinoEngagementSuiteProgressBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ /**
11
+ * Value for the widget
12
+ */
13
+ this.value = 0;
14
+ /**
15
+ * Shows disabled styles
16
+ */
17
+ this.disabled = false;
18
+ /**
19
+ * Client custom styling via string
20
+ */
21
+ this.clientStyling = '';
22
+ /**
23
+ * Client custom styling via url
24
+ */
25
+ this.clientStylingUrl = '';
26
+ this.limitStylingAppends = false;
27
+ this.setClientStyling = () => {
28
+ let sheet = document.createElement('style');
29
+ sheet.innerHTML = this.clientStyling;
30
+ this.host.prepend(sheet);
31
+ };
32
+ this.setClientStylingURL = () => {
33
+ let url = new URL(this.clientStylingUrl);
34
+ let cssFile = document.createElement('style');
35
+ fetch(url.href)
36
+ .then((res) => res.text())
37
+ .then((data) => {
38
+ cssFile.innerHTML = data;
39
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
40
+ })
41
+ .catch((err) => {
42
+ console.log('Error ', err);
43
+ });
44
+ };
45
+ }
46
+ componentDidRender() {
47
+ if (!this.limitStylingAppends && this.host) {
48
+ if (this.clientStyling)
49
+ this.setClientStyling();
50
+ if (this.clientStylingUrl)
51
+ this.setClientStylingURL();
52
+ this.limitStylingAppends = true;
53
+ }
54
+ }
55
+ getProgressBarClasses() {
56
+ return {
57
+ ProgressBar: true,
58
+ Completed: this.value === 100,
59
+ Disabled: this.disabled
60
+ };
61
+ }
62
+ render() {
63
+ return h("div", { class: this.getProgressBarClasses(), part: "ProgressBar" }, h("div", { class: "ProgressBarInfo", part: "ProgressBarInfo" }, h("slot", { name: "Title" }, h("div", null)), h("slot", { name: "Percent" }, h("div", { class: "ProgressBarPercent", part: "ProgressBarPercent" }, this.value, "%"))), h("div", { class: "ProgressBarBackground", part: "ProgressBarBackground" }, h("div", { class: "ProgressBarLine", part: "ProgressBarLine", style: { width: this.value + '%' } })));
64
+ }
65
+ get host() { return this; }
66
+ static get style() { return casinoEngagementSuiteProgressBarCss; }
67
+ }, [1, "casino-engagement-suite-progress-bar", {
68
+ "value": [2],
69
+ "disabled": [4],
70
+ "clientStyling": [513, "client-styling"],
71
+ "clientStylingUrl": [513, "client-styling-url"],
72
+ "limitStylingAppends": [32]
73
+ }]);
74
+ function defineCustomElement() {
75
+ if (typeof customElements === "undefined") {
76
+ return;
77
+ }
78
+ const components = ["casino-engagement-suite-progress-bar"];
79
+ components.forEach(tagName => { switch (tagName) {
80
+ case "casino-engagement-suite-progress-bar":
81
+ if (!customElements.get(tagName)) {
82
+ customElements.define(tagName, CasinoEngagementSuiteProgressBar);
83
+ }
84
+ break;
85
+ } });
86
+ }
87
+
88
+ export { CasinoEngagementSuiteProgressBar as C, defineCustomElement as d };
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-70e47fe0.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-ddf7e990.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["casino-engagement-suite-challenges-list",[[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);
16
+ return bootstrapLazy([["casino-engagement-suite-challenges-list_2",[[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"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
17
17
  });
@@ -0,0 +1,479 @@
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-ddf7e990.js';
2
+
3
+ var ChallengeLevelProgressStatus;
4
+ (function (ChallengeLevelProgressStatus) {
5
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Closed"] = 0] = "Closed";
6
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["InProgress"] = 1] = "InProgress";
7
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Fillup"] = 2] = "Fillup";
8
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Completed"] = 3] = "Completed";
9
+ })(ChallengeLevelProgressStatus || (ChallengeLevelProgressStatus = {}));
10
+ var ChallengeProgressStatus;
11
+ (function (ChallengeProgressStatus) {
12
+ ChallengeProgressStatus[ChallengeProgressStatus["Started"] = 0] = "Started";
13
+ ChallengeProgressStatus[ChallengeProgressStatus["InProgress"] = 1] = "InProgress";
14
+ ChallengeProgressStatus[ChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
15
+ ChallengeProgressStatus[ChallengeProgressStatus["Completed"] = 3] = "Completed";
16
+ ChallengeProgressStatus[ChallengeProgressStatus["Expired"] = 4] = "Expired";
17
+ })(ChallengeProgressStatus || (ChallengeProgressStatus = {}));
18
+
19
+ const DEFAULT_LANGUAGE = 'en';
20
+ const SUPPORTED_LANGUAGES = ['en'];
21
+ const TRANSLATIONS = {
22
+ en: {
23
+ challenges: 'Challenges',
24
+ join: 'Join',
25
+ unjoin: 'Unjoin',
26
+ noChallenges: 'No Challenges yet',
27
+ tryOtherGames: 'Try winning Challenges as rewards or launching other booster games',
28
+ tooltip: 'Competition where your real money bets contribute towards the level progress to achieve the level reward'
29
+ }
30
+ };
31
+ const translate = (key, customLang) => {
32
+ const lang = customLang;
33
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
34
+ };
35
+
36
+ function _typeof(o) {
37
+ "@babel/helpers - typeof";
38
+
39
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
40
+ return typeof o;
41
+ } : function (o) {
42
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
43
+ }, _typeof(o);
44
+ }
45
+
46
+ function requiredArgs(required, args) {
47
+ if (args.length < required) {
48
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
49
+ }
50
+ }
51
+
52
+ /**
53
+ * @name toDate
54
+ * @category Common Helpers
55
+ * @summary Convert the given argument to an instance of Date.
56
+ *
57
+ * @description
58
+ * Convert the given argument to an instance of Date.
59
+ *
60
+ * If the argument is an instance of Date, the function returns its clone.
61
+ *
62
+ * If the argument is a number, it is treated as a timestamp.
63
+ *
64
+ * If the argument is none of the above, the function returns Invalid Date.
65
+ *
66
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
67
+ *
68
+ * @param {Date|Number} argument - the value to convert
69
+ * @returns {Date} the parsed date in the local time zone
70
+ * @throws {TypeError} 1 argument required
71
+ *
72
+ * @example
73
+ * // Clone the date:
74
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
75
+ * //=> Tue Feb 11 2014 11:30:30
76
+ *
77
+ * @example
78
+ * // Convert the timestamp to date:
79
+ * const result = toDate(1392098430000)
80
+ * //=> Tue Feb 11 2014 11:30:30
81
+ */
82
+ function toDate(argument) {
83
+ requiredArgs(1, arguments);
84
+ var argStr = Object.prototype.toString.call(argument);
85
+
86
+ // Clone the date
87
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
88
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
89
+ return new Date(argument.getTime());
90
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
91
+ return new Date(argument);
92
+ } else {
93
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
94
+ // eslint-disable-next-line no-console
95
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
96
+ // eslint-disable-next-line no-console
97
+ console.warn(new Error().stack);
98
+ }
99
+ return new Date(NaN);
100
+ }
101
+ }
102
+
103
+ /**
104
+ * @name differenceInMilliseconds
105
+ * @category Millisecond Helpers
106
+ * @summary Get the number of milliseconds between the given dates.
107
+ *
108
+ * @description
109
+ * Get the number of milliseconds between the given dates.
110
+ *
111
+ * @param {Date|Number} dateLeft - the later date
112
+ * @param {Date|Number} dateRight - the earlier date
113
+ * @returns {Number} the number of milliseconds
114
+ * @throws {TypeError} 2 arguments required
115
+ *
116
+ * @example
117
+ * // How many milliseconds are between
118
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
119
+ * const result = differenceInMilliseconds(
120
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
121
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
122
+ * )
123
+ * //=> 1100
124
+ */
125
+ function differenceInMilliseconds(dateLeft, dateRight) {
126
+ requiredArgs(2, arguments);
127
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
128
+ }
129
+
130
+ var roundingMap = {
131
+ ceil: Math.ceil,
132
+ round: Math.round,
133
+ floor: Math.floor,
134
+ trunc: function trunc(value) {
135
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
136
+ } // Math.trunc is not supported by IE
137
+ };
138
+
139
+ var defaultRoundingMethod = 'trunc';
140
+ function getRoundingMethod(method) {
141
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
142
+ }
143
+
144
+ /**
145
+ * @name differenceInSeconds
146
+ * @category Second Helpers
147
+ * @summary Get the number of seconds between the given dates.
148
+ *
149
+ * @description
150
+ * Get the number of seconds between the given dates.
151
+ *
152
+ * @param {Date|Number} dateLeft - the later date
153
+ * @param {Date|Number} dateRight - the earlier date
154
+ * @param {Object} [options] - an object with options.
155
+ * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
156
+ * @returns {Number} the number of seconds
157
+ * @throws {TypeError} 2 arguments required
158
+ *
159
+ * @example
160
+ * // How many seconds are between
161
+ * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
162
+ * const result = differenceInSeconds(
163
+ * new Date(2014, 6, 2, 12, 30, 20, 0),
164
+ * new Date(2014, 6, 2, 12, 30, 7, 999)
165
+ * )
166
+ * //=> 12
167
+ */
168
+ function differenceInSeconds(dateLeft, dateRight, options) {
169
+ requiredArgs(2, arguments);
170
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;
171
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
172
+ }
173
+
174
+ const casinoEngagementSuiteChallengesListCss = "@import url(\"https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap\");:host{display:block;font-family:inherit}*{box-sizing:border-box;margin:0;padding:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.ChallengesListPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:8px;overflow:hidden;flex-direction:column;position:relative}.ChallengesListPopupHeader{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.ChallengesIconButton{width:16px;height:16px;cursor:pointer}.ChallengesListPopupHeaderName{color:var(--emw--color-gray-100, #BBB9C3);font-size:14px;font-weight:500;line-height:14px}.ChallengesListWrapper{overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.ChallengesListWrapper::-webkit-scrollbar{display:none}.ChallengesList{display:flex;flex-direction:column;row-gap:12px;padding:8px 19px 0}.ChallengeCard{padding:15px 15px 19px;border:1px solid var(--emw--button-border-color, #403956);border-radius:6px;position:relative;cursor:pointer}.ChallengeJoinButton.Joined::before,.ChallengeCard.InProgress::before{content:\"\";position:absolute;inset:0;border-radius:var(--emw--button-border-radius, 4px);padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeCardHeader{display:flex;justify-content:space-between;gap:24px;margin-bottom:12px}.ChallengeName{color:var(--emw--color-typography, #FFFFFF);font-family:\"Montserrat\", sans-serif;line-height:22px;font-weight:700;font-size:18px;word-break:break-word}.ChallengeJoinButton{transition:all 0.5s ease-out;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:var(--emw--color-typography, #1E1638);border-radius:99px;min-width:88px;height:32px;font-size:14px;font-weight:700;position:relative;font-family:\"Montserrat\", sans-serif}.ChallengeJoinButton.Joined{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ChallengeJoinButton.Joined::before{border-radius:99px}.ChallengesListEmpty{padding:20px 32px}.ChallengesListEmpty h2{margin:0 0 16px 0;text-align:center;font-weight:600;font-size:20px;line-height:24px;font-family:\"Montserrat\", sans-serif;color:var(--emw--color-typography, #FFFFFF)}.ChallengesListEmpty p{font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3)}.ChallengeCountdown{color:var(--emw--color-gray-100, #BBB9C3);font-size:12px;line-height:12px}.ChallengesTooltipBackdrop{padding:48px 30px 0;position:absolute;width:100%;height:100%;inset:0;background-color:rgba(0, 0, 0, 0.5)}.ChallengesTooltipBackdrop .ChallengesTooltip{border:1px solid var(--emw--button-border-color, #403956);background-color:var(--emw--color-background, #1E1638);border-radius:8px;padding:32px;font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3);position:relative}.ChallengesTooltipBackdrop .ChallengesTooltip .ChallengesIconButton{top:12px;right:6px;position:absolute}.ChallengesListPopup.Tablet .ChallengesListPopupHeader,.ChallengesListPopup.Desktop .ChallengesListPopupHeader{padding-top:16px}.ChallengesListPopup.Tablet .ChallengesListPopupHeaderName,.ChallengesListPopup.Desktop .ChallengesListPopupHeaderName{font-size:16px;line-height:16px}.ChallengesListPopup.Tablet .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesIconButton{width:24px;height:24px}.ChallengesListPopup.Tablet .ChallengesList,.ChallengesListPopup.Desktop .ChallengesList{padding:20px 24px 0;row-gap:20px}.ChallengesListPopup.Tablet .ChallengeCardHeader,.ChallengesListPopup.Desktop .ChallengeCardHeader{margin-bottom:16px}.ChallengesListPopup.Tablet .ChallengeName,.ChallengesListPopup.Desktop .ChallengeName{line-height:27px;font-size:22px}.ChallengesListPopup.Tablet .ChallengeJoinButton,.ChallengesListPopup.Desktop .ChallengeJoinButton{min-width:100px;height:36px;font-size:16px}.ChallengesListPopup.Tablet .ChallengeCountdown,.ChallengesListPopup.Desktop .ChallengeCountdown{font-size:14px;line-height:14px}.ChallengesListPopup.Tablet .ChallengesTooltip,.ChallengesListPopup.Desktop .ChallengesTooltip{padding:60px 65px;font-size:16px;line-height:20px}.ChallengesListPopup.Tablet .ChallengesTooltip .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesTooltip .ChallengesIconButton{top:24px;right:24px}";
175
+
176
+ const CasinoEngagementSuiteChallengesList = class {
177
+ constructor(hostRef) {
178
+ registerInstance(this, hostRef);
179
+ this.close = createEvent(this, "close", 7);
180
+ /**
181
+ * Client custom styling via string
182
+ */
183
+ this.clientStyling = '';
184
+ /**
185
+ * Client custom styling via url
186
+ */
187
+ this.clientStylingUrl = '';
188
+ /**
189
+ * Language of the widget
190
+ */
191
+ this.language = 'en';
192
+ /**
193
+ * User's device type
194
+ */
195
+ this.device = 'Mobile';
196
+ /**
197
+ * List of challenges
198
+ */
199
+ this.challenges = [];
200
+ this.tooltip = false;
201
+ this.timers = {};
202
+ this.limitStylingAppends = false;
203
+ this.setClientStyling = () => {
204
+ let sheet = document.createElement('style');
205
+ sheet.innerHTML = this.clientStyling;
206
+ this.host.prepend(sheet);
207
+ };
208
+ this.setClientStylingURL = () => {
209
+ let url = new URL(this.clientStylingUrl);
210
+ let cssFile = document.createElement('style');
211
+ fetch(url.href)
212
+ .then((res) => res.text())
213
+ .then((data) => {
214
+ cssFile.innerHTML = data;
215
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
216
+ })
217
+ .catch((err) => {
218
+ console.log('Error ', err);
219
+ });
220
+ };
221
+ this.handleCloseClick = () => {
222
+ this.close.emit();
223
+ this.tooltip = false;
224
+ };
225
+ this.handleChallengeClick = (ev) => {
226
+ const id = +ev.currentTarget.getAttribute('data-id');
227
+ window.postMessage({ type: 'ChallengeClick', id });
228
+ };
229
+ this.showTooltip = () => {
230
+ this.tooltip = true;
231
+ };
232
+ this.hideTooltip = () => {
233
+ this.tooltip = false;
234
+ };
235
+ this.changeChallengeStatus = (e) => {
236
+ e.stopPropagation();
237
+ const id = +e.currentTarget.getAttribute('data-id');
238
+ const inProgressChallenges = this.challenges.filter(c => c.Status === ChallengeProgressStatus.InProgress).map(c => c.Id);
239
+ if (inProgressChallenges.includes(id)) {
240
+ window.postMessage({
241
+ type: 'ShowConfirmationModal',
242
+ action: 'unjoin',
243
+ id,
244
+ });
245
+ return;
246
+ }
247
+ if ((inProgressChallenges === null || inProgressChallenges === void 0 ? void 0 : inProgressChallenges.length) > 0) {
248
+ window.postMessage({
249
+ type: 'ShowConfirmationModal',
250
+ action: 'join',
251
+ prevId: inProgressChallenges[0],
252
+ id,
253
+ });
254
+ return;
255
+ }
256
+ window.postMessage({
257
+ type: 'ChallengeAttendance',
258
+ confirmationData: {
259
+ action: 'join',
260
+ id,
261
+ },
262
+ });
263
+ };
264
+ }
265
+ challengesPropHandler(value) {
266
+ if (!this.interval && value.length) {
267
+ this.updateTimers();
268
+ this.startCountdown();
269
+ }
270
+ if (this.interval && !value.length) {
271
+ clearInterval(this.interval);
272
+ }
273
+ }
274
+ handleEvent(e) {
275
+ const newChallenge = e.data.data;
276
+ if (e.data.type === 'ChallengeGrant') {
277
+ const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
278
+ if (index > -1) {
279
+ this.challenges.splice(index, 0, newChallenge);
280
+ }
281
+ else {
282
+ this.challenges.unshift(newChallenge);
283
+ }
284
+ }
285
+ }
286
+ componentWillLoad() {
287
+ this.challengesPropHandler(this.challenges);
288
+ }
289
+ componentDidRender() {
290
+ if (!this.limitStylingAppends && this.host) {
291
+ if (this.clientStyling)
292
+ this.setClientStyling();
293
+ if (this.clientStylingUrl)
294
+ this.setClientStylingURL();
295
+ this.limitStylingAppends = true;
296
+ }
297
+ }
298
+ disconnectedCallback() {
299
+ this.interval && clearInterval(this.interval);
300
+ }
301
+ startCountdown() {
302
+ this.interval = setInterval(() => {
303
+ this.updateTimers();
304
+ }, 1000);
305
+ }
306
+ updateTimers() {
307
+ const now = new Date().getTime();
308
+ this.timers = this.challenges.filter(challenge => challenge.Status !== ChallengeProgressStatus.Expired).reduce((acc, challenge) => {
309
+ const expirationDate = new Date(challenge.ExpirationTime).getTime();
310
+ const diff = expirationDate - now;
311
+ let countdown = '00h:00m:00s';
312
+ if (diff < 1) {
313
+ this.removeChallenge(challenge.Id);
314
+ }
315
+ else {
316
+ const { days, hours, minutes, seconds } = {
317
+ days: String(Math.floor(diff / (1000 * 60 * 60 * 24))).padStart(2, '0'),
318
+ hours: String(Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
319
+ minutes: String(Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
320
+ seconds: String(Math.floor((diff % (1000 * 60)) / 1000)).padStart(2, '0')
321
+ };
322
+ countdown = days === '00'
323
+ ? `${hours}h:${minutes}m:${seconds}s`
324
+ : `${days}d:${hours}h:${minutes}m`;
325
+ }
326
+ return Object.assign(Object.assign({}, acc), { [challenge.Id]: countdown });
327
+ }, {});
328
+ }
329
+ removeChallenge(id) {
330
+ const index = this.challenges.findIndex(challenge => challenge.Id === id);
331
+ if (index > -1) {
332
+ this.challenges.splice(index, 1);
333
+ window.postMessage({ type: 'ChallengeHasExpired', id });
334
+ }
335
+ }
336
+ getChallengeClasses(challenge) {
337
+ return {
338
+ ChallengeCard: true,
339
+ InProgress: challenge.Status === ChallengeProgressStatus.InProgress,
340
+ Completed: this.isChallengeCompleted(challenge),
341
+ Paused: this.isChallengePaused(challenge)
342
+ };
343
+ }
344
+ isChallengePaused(challenge) {
345
+ return challenge.Status === ChallengeProgressStatus.Started
346
+ && challenge.LevelProgresses[0].ProgressPercentage > 0;
347
+ }
348
+ isChallengeCompleted(challenge) {
349
+ return challenge.Status === ChallengeProgressStatus.Completed
350
+ || (challenge.Status === ChallengeProgressStatus.PendingLevelReward
351
+ && challenge.LevelProgresses.every(progress => progress.ProgressPercentage === 100));
352
+ }
353
+ getChallengeProgress(challenge) {
354
+ if (challenge.Status === ChallengeProgressStatus.Completed) {
355
+ return 100;
356
+ }
357
+ if (this.isChallengePaused(challenge)
358
+ || challenge.Status === ChallengeProgressStatus.PendingLevelReward
359
+ || challenge.Status === ChallengeProgressStatus.InProgress) {
360
+ const activeLevel = challenge.LevelProgresses
361
+ .find(level => level.ProgressStatus === ChallengeLevelProgressStatus.InProgress);
362
+ /**
363
+ * It is possible that Paused/InProgress challenge
364
+ * doesn't have InProgress level
365
+ * because level becomes InProgress after user's bet.
366
+ * In this case should be displayed progress of the next level (0%)
367
+ */
368
+ return activeLevel ? activeLevel.ProgressPercentage : 0;
369
+ }
370
+ return -1;
371
+ }
372
+ getChallengeHeaderTemplate(challenge) {
373
+ const { Id } = challenge;
374
+ return h("div", { class: "ChallengeCardHeader" }, h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), h("button", { class: challenge.Status === ChallengeProgressStatus.InProgress ? 'ChallengeJoinButton Joined' : 'ChallengeJoinButton', onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
375
+ ? translate('unjoin', this.language)
376
+ : translate('join', this.language)));
377
+ }
378
+ getChallengeTemplate(challenge) {
379
+ const challengeProgress = this.getChallengeProgress(challenge);
380
+ const countdown = this.timers[challenge.Id];
381
+ const progressTemplate = challengeProgress > -1
382
+ ? h("casino-engagement-suite-progress-bar", { class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) }, h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
383
+ : h("span", { class: "ChallengeCountdown" }, countdown);
384
+ return (h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id }, this.getChallengeHeaderTemplate(challenge), progressTemplate));
385
+ }
386
+ getHeaderTemplate() {
387
+ return h("header", { class: "ChallengesListPopupHeader" }, h("button", { onClick: this.showTooltip, class: "ChallengesIconButton" }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg", alt: "Show tooltip" })), h("div", { class: "ChallengesListPopupHeaderName" }, translate('challenges', this.language)), h("button", { class: "ChallengesIconButton", onClick: this.handleCloseClick }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close challenges list" })));
388
+ }
389
+ getListTemplate() {
390
+ if (this.challenges.length) {
391
+ return h("div", { class: "ChallengesListWrapper" }, h("div", { class: "ChallengesList" }, this.challenges.map(challenge => this.getChallengeTemplate(challenge))));
392
+ }
393
+ else {
394
+ return h("div", { class: "ChallengesListEmpty" }, h("h2", null, translate('noChallenges', this.language)), h("p", null, translate('tryOtherGames', this.language)));
395
+ }
396
+ }
397
+ getTooltipTemplate() {
398
+ if (this.tooltip) {
399
+ return h("div", { class: "ChallengesTooltipBackdrop" }, h("div", { class: "ChallengesTooltip" }, h("button", { class: "ChallengesIconButton", onClick: this.hideTooltip }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })), translate('tooltip', this.language)));
400
+ }
401
+ else {
402
+ return '';
403
+ }
404
+ }
405
+ render() {
406
+ return h("div", { class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.getTooltipTemplate());
407
+ }
408
+ get host() { return getElement(this); }
409
+ static get watchers() { return {
410
+ "challenges": ["challengesPropHandler"]
411
+ }; }
412
+ };
413
+ CasinoEngagementSuiteChallengesList.style = casinoEngagementSuiteChallengesListCss;
414
+
415
+ const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
416
+
417
+ const CasinoEngagementSuiteProgressBar = class {
418
+ constructor(hostRef) {
419
+ registerInstance(this, hostRef);
420
+ /**
421
+ * Value for the widget
422
+ */
423
+ this.value = 0;
424
+ /**
425
+ * Shows disabled styles
426
+ */
427
+ this.disabled = false;
428
+ /**
429
+ * Client custom styling via string
430
+ */
431
+ this.clientStyling = '';
432
+ /**
433
+ * Client custom styling via url
434
+ */
435
+ this.clientStylingUrl = '';
436
+ this.limitStylingAppends = false;
437
+ this.setClientStyling = () => {
438
+ let sheet = document.createElement('style');
439
+ sheet.innerHTML = this.clientStyling;
440
+ this.host.prepend(sheet);
441
+ };
442
+ this.setClientStylingURL = () => {
443
+ let url = new URL(this.clientStylingUrl);
444
+ let cssFile = document.createElement('style');
445
+ fetch(url.href)
446
+ .then((res) => res.text())
447
+ .then((data) => {
448
+ cssFile.innerHTML = data;
449
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
450
+ })
451
+ .catch((err) => {
452
+ console.log('Error ', err);
453
+ });
454
+ };
455
+ }
456
+ componentDidRender() {
457
+ if (!this.limitStylingAppends && this.host) {
458
+ if (this.clientStyling)
459
+ this.setClientStyling();
460
+ if (this.clientStylingUrl)
461
+ this.setClientStylingURL();
462
+ this.limitStylingAppends = true;
463
+ }
464
+ }
465
+ getProgressBarClasses() {
466
+ return {
467
+ ProgressBar: true,
468
+ Completed: this.value === 100,
469
+ Disabled: this.disabled
470
+ };
471
+ }
472
+ render() {
473
+ return h("div", { class: this.getProgressBarClasses(), part: "ProgressBar" }, h("div", { class: "ProgressBarInfo", part: "ProgressBarInfo" }, h("slot", { name: "Title" }, h("div", null)), h("slot", { name: "Percent" }, h("div", { class: "ProgressBarPercent", part: "ProgressBarPercent" }, this.value, "%"))), h("div", { class: "ProgressBarBackground", part: "ProgressBarBackground" }, h("div", { class: "ProgressBarLine", part: "ProgressBarLine", style: { width: this.value + '%' } })));
474
+ }
475
+ get host() { return getElement(this); }
476
+ };
477
+ CasinoEngagementSuiteProgressBar.style = casinoEngagementSuiteProgressBarCss;
478
+
479
+ export { CasinoEngagementSuiteChallengesList as casino_engagement_suite_challenges_list, CasinoEngagementSuiteProgressBar as casino_engagement_suite_progress_bar };
@@ -257,6 +257,31 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
257
257
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
258
258
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
259
259
  }
260
+ else if (memberName === 'style') {
261
+ // update style attribute, css properties and values
262
+ {
263
+ for (const prop in oldValue) {
264
+ if (!newValue || newValue[prop] == null) {
265
+ if (prop.includes('-')) {
266
+ elm.style.removeProperty(prop);
267
+ }
268
+ else {
269
+ elm.style[prop] = '';
270
+ }
271
+ }
272
+ }
273
+ }
274
+ for (const prop in newValue) {
275
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
276
+ if (prop.includes('-')) {
277
+ elm.style.setProperty(prop, newValue[prop]);
278
+ }
279
+ else {
280
+ elm.style[prop] = newValue[prop];
281
+ }
282
+ }
283
+ }
284
+ }
260
285
  else if (memberName === 'key')
261
286
  ;
262
287
  else if ((!isProp ) &&
@@ -525,11 +550,14 @@ const patch = (oldVNode, newVNode) => {
525
550
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
526
551
  const oldChildren = oldVNode.$children$;
527
552
  const newChildren = newVNode.$children$;
553
+ const tag = newVNode.$tag$;
528
554
  const text = newVNode.$text$;
529
555
  if (text === null) {
530
556
  // element node
531
557
  {
532
- {
558
+ if (tag === 'slot')
559
+ ;
560
+ else {
533
561
  // either this is the first render of an element OR it's an update
534
562
  // AND we already know it's possible it could have changed
535
563
  // this updates the element's css classes, attrs, props, listeners, etc.
@@ -797,6 +825,15 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
797
825
  const parsePropertyValue = (propValue, propType) => {
798
826
  // ensure this value is of the correct prop type
799
827
  if (propValue != null && !isComplexType(propValue)) {
828
+ if (propType & 4 /* Boolean */) {
829
+ // per the HTML spec, any string value means it is a boolean true value
830
+ // but we'll cheat here and say that the string "false" is the boolean false
831
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
832
+ }
833
+ if (propType & 2 /* Number */) {
834
+ // force it to be a number
835
+ return parseFloat(propValue);
836
+ }
800
837
  if (propType & 1 /* String */) {
801
838
  // could have been passed as a number or boolean
802
839
  // but we still want it as a string
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-70e47fe0.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-ddf7e990.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["casino-engagement-suite-challenges-list",[[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);
13
+ return bootstrapLazy([["casino-engagement-suite-challenges-list_2",[[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"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
14
14
  });
15
15
  };
16
16