@everymatrix/casino-engagement-suite-challenges-list 1.35.0 → 1.36.1

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 (26) 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-26d7de05.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 +513 -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 +34 -0
  10. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.js +128 -38
  11. package/dist/collection/utils/locale.utils.js +1 -0
  12. package/dist/components/casino-engagement-suite-challenges-list.js +97 -791
  13. package/dist/components/casino-engagement-suite-progress-bar.js +6 -0
  14. package/dist/components/casino-engagement-suite-progress-bar2.js +94 -0
  15. package/dist/esm/casino-engagement-suite-challenges-list.js +2 -2
  16. package/dist/esm/casino-engagement-suite-challenges-list_2.entry.js +508 -0
  17. package/dist/esm/{index-70e47fe0.js → index-ddf7e990.js} +38 -1
  18. package/dist/esm/loader.js +2 -2
  19. package/dist/types/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.d.ts +11 -0
  20. package/dist/types/components.d.ts +16 -0
  21. package/dist/types/models/challenge.d.ts +3 -0
  22. package/package.json +1 -1
  23. package/dist/casino-engagement-suite-challenges-list/p-7e171791.js +0 -1
  24. package/dist/casino-engagement-suite-challenges-list/p-eb36cbe7.entry.js +0 -1
  25. package/dist/cjs/casino-engagement-suite-challenges-list.cjs.entry.js +0 -1147
  26. package/dist/esm/casino-engagement-suite-challenges-list.entry.js +0 -1143
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import '@everymatrix/casino-engagement-suite-progress-bar';
2
+ import { d as defineCustomElement$2 } from './casino-engagement-suite-progress-bar2.js';
3
3
 
4
4
  var ChallengeLevelProgressStatus;
5
5
  (function (ChallengeLevelProgressStatus) {
@@ -24,6 +24,7 @@ const TRANSLATIONS = {
24
24
  challenges: 'Challenges',
25
25
  join: 'Join',
26
26
  unjoin: 'Unjoin',
27
+ new: 'new',
27
28
  noChallenges: 'No Challenges yet',
28
29
  tryOtherGames: 'Try winning Challenges as rewards or launching other booster games',
29
30
  tooltip: 'Competition where your real money bets contribute towards the level progress to achieve the level reward'
@@ -101,417 +102,6 @@ function toDate(argument) {
101
102
  }
102
103
  }
103
104
 
104
- /**
105
- * @name compareAsc
106
- * @category Common Helpers
107
- * @summary Compare the two dates and return -1, 0 or 1.
108
- *
109
- * @description
110
- * Compare the two dates and return 1 if the first date is after the second,
111
- * -1 if the first date is before the second or 0 if dates are equal.
112
- *
113
- * @param {Date|Number} dateLeft - the first date to compare
114
- * @param {Date|Number} dateRight - the second date to compare
115
- * @returns {Number} the result of the comparison
116
- * @throws {TypeError} 2 arguments required
117
- *
118
- * @example
119
- * // Compare 11 February 1987 and 10 July 1989:
120
- * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
121
- * //=> -1
122
- *
123
- * @example
124
- * // Sort the array of dates:
125
- * const result = [
126
- * new Date(1995, 6, 2),
127
- * new Date(1987, 1, 11),
128
- * new Date(1989, 6, 10)
129
- * ].sort(compareAsc)
130
- * //=> [
131
- * // Wed Feb 11 1987 00:00:00,
132
- * // Mon Jul 10 1989 00:00:00,
133
- * // Sun Jul 02 1995 00:00:00
134
- * // ]
135
- */
136
- function compareAsc(dirtyDateLeft, dirtyDateRight) {
137
- requiredArgs(2, arguments);
138
- var dateLeft = toDate(dirtyDateLeft);
139
- var dateRight = toDate(dirtyDateRight);
140
- var diff = dateLeft.getTime() - dateRight.getTime();
141
- if (diff < 0) {
142
- return -1;
143
- } else if (diff > 0) {
144
- return 1;
145
- // Return 0 if diff is 0; return NaN if diff is NaN
146
- } else {
147
- return diff;
148
- }
149
- }
150
-
151
- function toInteger(dirtyNumber) {
152
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
153
- return NaN;
154
- }
155
- var number = Number(dirtyNumber);
156
- if (isNaN(number)) {
157
- return number;
158
- }
159
- return number < 0 ? Math.ceil(number) : Math.floor(number);
160
- }
161
-
162
- /**
163
- * @name addDays
164
- * @category Day Helpers
165
- * @summary Add the specified number of days to the given date.
166
- *
167
- * @description
168
- * Add the specified number of days to the given date.
169
- *
170
- * @param {Date|Number} date - the date to be changed
171
- * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
172
- * @returns {Date} - the new date with the days added
173
- * @throws {TypeError} - 2 arguments required
174
- *
175
- * @example
176
- * // Add 10 days to 1 September 2014:
177
- * const result = addDays(new Date(2014, 8, 1), 10)
178
- * //=> Thu Sep 11 2014 00:00:00
179
- */
180
- function addDays(dirtyDate, dirtyAmount) {
181
- requiredArgs(2, arguments);
182
- var date = toDate(dirtyDate);
183
- var amount = toInteger(dirtyAmount);
184
- if (isNaN(amount)) {
185
- return new Date(NaN);
186
- }
187
- if (!amount) {
188
- // If 0 days, no-op to avoid changing times in the hour before end of DST
189
- return date;
190
- }
191
- date.setDate(date.getDate() + amount);
192
- return date;
193
- }
194
-
195
- /**
196
- * @name addMonths
197
- * @category Month Helpers
198
- * @summary Add the specified number of months to the given date.
199
- *
200
- * @description
201
- * Add the specified number of months to the given date.
202
- *
203
- * @param {Date|Number} date - the date to be changed
204
- * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
205
- * @returns {Date} the new date with the months added
206
- * @throws {TypeError} 2 arguments required
207
- *
208
- * @example
209
- * // Add 5 months to 1 September 2014:
210
- * const result = addMonths(new Date(2014, 8, 1), 5)
211
- * //=> Sun Feb 01 2015 00:00:00
212
- */
213
- function addMonths(dirtyDate, dirtyAmount) {
214
- requiredArgs(2, arguments);
215
- var date = toDate(dirtyDate);
216
- var amount = toInteger(dirtyAmount);
217
- if (isNaN(amount)) {
218
- return new Date(NaN);
219
- }
220
- if (!amount) {
221
- // If 0 months, no-op to avoid changing times in the hour before end of DST
222
- return date;
223
- }
224
- var dayOfMonth = date.getDate();
225
-
226
- // The JS Date object supports date math by accepting out-of-bounds values for
227
- // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
228
- // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
229
- // want except that dates will wrap around the end of a month, meaning that
230
- // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
231
- // we'll default to the end of the desired month by adding 1 to the desired
232
- // month and using a date of 0 to back up one day to the end of the desired
233
- // month.
234
- var endOfDesiredMonth = new Date(date.getTime());
235
- endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
236
- var daysInMonth = endOfDesiredMonth.getDate();
237
- if (dayOfMonth >= daysInMonth) {
238
- // If we're already at the end of the month, then this is the correct date
239
- // and we're done.
240
- return endOfDesiredMonth;
241
- } else {
242
- // Otherwise, we now know that setting the original day-of-month value won't
243
- // cause an overflow, so set the desired day-of-month. Note that we can't
244
- // just set the date of `endOfDesiredMonth` because that object may have had
245
- // its time changed in the unusual case where where a DST transition was on
246
- // the last day of the month and its local time was in the hour skipped or
247
- // repeated next to a DST transition. So we use `date` instead which is
248
- // guaranteed to still have the original time.
249
- date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
250
- return date;
251
- }
252
- }
253
-
254
- /**
255
- * @name add
256
- * @category Common Helpers
257
- * @summary Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.
258
- *
259
- * @description
260
- * Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.
261
- *
262
- * @param {Date|Number} date - the date to be changed
263
- * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
264
- *
265
- * | Key | Description |
266
- * |----------------|------------------------------------|
267
- * | years | Amount of years to be added |
268
- * | months | Amount of months to be added |
269
- * | weeks | Amount of weeks to be added |
270
- * | days | Amount of days to be added |
271
- * | hours | Amount of hours to be added |
272
- * | minutes | Amount of minutes to be added |
273
- * | seconds | Amount of seconds to be added |
274
- *
275
- * All values default to 0
276
- *
277
- * @returns {Date} the new date with the seconds added
278
- * @throws {TypeError} 2 arguments required
279
- *
280
- * @example
281
- * // Add the following duration to 1 September 2014, 10:19:50
282
- * const result = add(new Date(2014, 8, 1, 10, 19, 50), {
283
- * years: 2,
284
- * months: 9,
285
- * weeks: 1,
286
- * days: 7,
287
- * hours: 5,
288
- * minutes: 9,
289
- * seconds: 30,
290
- * })
291
- * //=> Thu Jun 15 2017 15:29:20
292
- */
293
- function add(dirtyDate, duration) {
294
- requiredArgs(2, arguments);
295
- if (!duration || _typeof(duration) !== 'object') return new Date(NaN);
296
- var years = duration.years ? toInteger(duration.years) : 0;
297
- var months = duration.months ? toInteger(duration.months) : 0;
298
- var weeks = duration.weeks ? toInteger(duration.weeks) : 0;
299
- var days = duration.days ? toInteger(duration.days) : 0;
300
- var hours = duration.hours ? toInteger(duration.hours) : 0;
301
- var minutes = duration.minutes ? toInteger(duration.minutes) : 0;
302
- var seconds = duration.seconds ? toInteger(duration.seconds) : 0;
303
-
304
- // Add years and months
305
- var date = toDate(dirtyDate);
306
- var dateWithMonths = months || years ? addMonths(date, months + years * 12) : date;
307
-
308
- // Add weeks and days
309
- var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
310
-
311
- // Add days, hours, minutes and seconds
312
- var minutesToAdd = minutes + hours * 60;
313
- var secondsToAdd = seconds + minutesToAdd * 60;
314
- var msToAdd = secondsToAdd * 1000;
315
- var finalDate = new Date(dateWithDays.getTime() + msToAdd);
316
- return finalDate;
317
- }
318
-
319
- /**
320
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
321
- * They usually appear for dates that denote time before the timezones were introduced
322
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
323
- * and GMT+01:00:00 after that date)
324
- *
325
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
326
- * which would lead to incorrect calculations.
327
- *
328
- * This function returns the timezone offset in milliseconds that takes seconds in account.
329
- */
330
- function getTimezoneOffsetInMilliseconds(date) {
331
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
332
- utcDate.setUTCFullYear(date.getFullYear());
333
- return date.getTime() - utcDate.getTime();
334
- }
335
-
336
- /**
337
- * @name startOfDay
338
- * @category Day Helpers
339
- * @summary Return the start of a day for the given date.
340
- *
341
- * @description
342
- * Return the start of a day for the given date.
343
- * The result will be in the local timezone.
344
- *
345
- * @param {Date|Number} date - the original date
346
- * @returns {Date} the start of a day
347
- * @throws {TypeError} 1 argument required
348
- *
349
- * @example
350
- * // The start of a day for 2 September 2014 11:55:00:
351
- * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
352
- * //=> Tue Sep 02 2014 00:00:00
353
- */
354
- function startOfDay(dirtyDate) {
355
- requiredArgs(1, arguments);
356
- var date = toDate(dirtyDate);
357
- date.setHours(0, 0, 0, 0);
358
- return date;
359
- }
360
-
361
- var MILLISECONDS_IN_DAY = 86400000;
362
-
363
- /**
364
- * @name differenceInCalendarDays
365
- * @category Day Helpers
366
- * @summary Get the number of calendar days between the given dates.
367
- *
368
- * @description
369
- * Get the number of calendar days between the given dates. This means that the times are removed
370
- * from the dates and then the difference in days is calculated.
371
- *
372
- * @param {Date|Number} dateLeft - the later date
373
- * @param {Date|Number} dateRight - the earlier date
374
- * @returns {Number} the number of calendar days
375
- * @throws {TypeError} 2 arguments required
376
- *
377
- * @example
378
- * // How many calendar days are between
379
- * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
380
- * const result = differenceInCalendarDays(
381
- * new Date(2012, 6, 2, 0, 0),
382
- * new Date(2011, 6, 2, 23, 0)
383
- * )
384
- * //=> 366
385
- * // How many calendar days are between
386
- * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
387
- * const result = differenceInCalendarDays(
388
- * new Date(2011, 6, 3, 0, 1),
389
- * new Date(2011, 6, 2, 23, 59)
390
- * )
391
- * //=> 1
392
- */
393
- function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
394
- requiredArgs(2, arguments);
395
- var startOfDayLeft = startOfDay(dirtyDateLeft);
396
- var startOfDayRight = startOfDay(dirtyDateRight);
397
- var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);
398
- var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight);
399
-
400
- // Round the number of days to the nearest integer
401
- // because the number of milliseconds in a day is not constant
402
- // (e.g. it's different in the day of the daylight saving time clock shift)
403
- return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);
404
- }
405
-
406
- // for accurate equality comparisons of UTC timestamps that end up
407
- // having the same representation in local time, e.g. one hour before
408
- // DST ends vs. the instant that DST ends.
409
- function compareLocalAsc(dateLeft, dateRight) {
410
- var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();
411
- if (diff < 0) {
412
- return -1;
413
- } else if (diff > 0) {
414
- return 1;
415
- // Return 0 if diff is 0; return NaN if diff is NaN
416
- } else {
417
- return diff;
418
- }
419
- }
420
-
421
- /**
422
- * @name differenceInDays
423
- * @category Day Helpers
424
- * @summary Get the number of full days between the given dates.
425
- *
426
- * @description
427
- * Get the number of full day periods between two dates. Fractional days are
428
- * truncated towards zero.
429
- *
430
- * One "full day" is the distance between a local time in one day to the same
431
- * local time on the next or previous day. A full day can sometimes be less than
432
- * or more than 24 hours if a daylight savings change happens between two dates.
433
- *
434
- * To ignore DST and only measure exact 24-hour periods, use this instead:
435
- * `Math.floor(differenceInHours(dateLeft, dateRight)/24)|0`.
436
- *
437
- *
438
- * @param {Date|Number} dateLeft - the later date
439
- * @param {Date|Number} dateRight - the earlier date
440
- * @returns {Number} the number of full days according to the local timezone
441
- * @throws {TypeError} 2 arguments required
442
- *
443
- * @example
444
- * // How many full days are between
445
- * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
446
- * const result = differenceInDays(
447
- * new Date(2012, 6, 2, 0, 0),
448
- * new Date(2011, 6, 2, 23, 0)
449
- * )
450
- * //=> 365
451
- * // How many full days are between
452
- * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
453
- * const result = differenceInDays(
454
- * new Date(2011, 6, 3, 0, 1),
455
- * new Date(2011, 6, 2, 23, 59)
456
- * )
457
- * //=> 0
458
- * // How many full days are between
459
- * // 1 March 2020 0:00 and 1 June 2020 0:00 ?
460
- * // Note: because local time is used, the
461
- * // result will always be 92 days, even in
462
- * // time zones where DST starts and the
463
- * // period has only 92*24-1 hours.
464
- * const result = differenceInDays(
465
- * new Date(2020, 5, 1),
466
- * new Date(2020, 2, 1)
467
- * )
468
- //=> 92
469
- */
470
- function differenceInDays(dirtyDateLeft, dirtyDateRight) {
471
- requiredArgs(2, arguments);
472
- var dateLeft = toDate(dirtyDateLeft);
473
- var dateRight = toDate(dirtyDateRight);
474
- var sign = compareLocalAsc(dateLeft, dateRight);
475
- var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight));
476
- dateLeft.setDate(dateLeft.getDate() - sign * difference);
477
-
478
- // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full
479
- // If so, result must be decreased by 1 in absolute value
480
- var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);
481
- var result = sign * (difference - isLastDayNotFull);
482
- // Prevent negative zero
483
- return result === 0 ? 0 : result;
484
- }
485
-
486
- /**
487
- * Days in 1 week.
488
- *
489
- * @name daysInWeek
490
- * @constant
491
- * @type {number}
492
- * @default
493
- */
494
-
495
- /**
496
- * Milliseconds in 1 minute
497
- *
498
- * @name millisecondsInMinute
499
- * @constant
500
- * @type {number}
501
- * @default
502
- */
503
- var millisecondsInMinute = 60000;
504
-
505
- /**
506
- * Milliseconds in 1 hour
507
- *
508
- * @name millisecondsInHour
509
- * @constant
510
- * @type {number}
511
- * @default
512
- */
513
- var millisecondsInHour = 3600000;
514
-
515
105
  /**
516
106
  * @name differenceInMilliseconds
517
107
  * @category Millisecond Helpers
@@ -553,229 +143,6 @@ function getRoundingMethod(method) {
553
143
  return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
554
144
  }
555
145
 
556
- /**
557
- * @name differenceInHours
558
- * @category Hour Helpers
559
- * @summary Get the number of hours between the given dates.
560
- *
561
- * @description
562
- * Get the number of hours between the given dates.
563
- *
564
- * @param {Date|Number} dateLeft - the later date
565
- * @param {Date|Number} dateRight - the earlier date
566
- * @param {Object} [options] - an object with options.
567
- * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
568
- * @returns {Number} the number of hours
569
- * @throws {TypeError} 2 arguments required
570
- *
571
- * @example
572
- * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
573
- * const result = differenceInHours(
574
- * new Date(2014, 6, 2, 19, 0),
575
- * new Date(2014, 6, 2, 6, 50)
576
- * )
577
- * //=> 12
578
- */
579
- function differenceInHours(dateLeft, dateRight, options) {
580
- requiredArgs(2, arguments);
581
- var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
582
- return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
583
- }
584
-
585
- /**
586
- * @name differenceInMinutes
587
- * @category Minute Helpers
588
- * @summary Get the number of minutes between the given dates.
589
- *
590
- * @description
591
- * Get the signed number of full (rounded towards 0) minutes between the given dates.
592
- *
593
- * @param {Date|Number} dateLeft - the later date
594
- * @param {Date|Number} dateRight - the earlier date
595
- * @param {Object} [options] - an object with options.
596
- * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
597
- * @returns {Number} the number of minutes
598
- * @throws {TypeError} 2 arguments required
599
- *
600
- * @example
601
- * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?
602
- * const result = differenceInMinutes(
603
- * new Date(2014, 6, 2, 12, 20, 0),
604
- * new Date(2014, 6, 2, 12, 7, 59)
605
- * )
606
- * //=> 12
607
- *
608
- * @example
609
- * // How many minutes are between 10:01:59 and 10:00:00
610
- * const result = differenceInMinutes(
611
- * new Date(2000, 0, 1, 10, 0, 0),
612
- * new Date(2000, 0, 1, 10, 1, 59)
613
- * )
614
- * //=> -1
615
- */
616
- function differenceInMinutes(dateLeft, dateRight, options) {
617
- requiredArgs(2, arguments);
618
- var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
619
- return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
620
- }
621
-
622
- /**
623
- * @name differenceInCalendarMonths
624
- * @category Month Helpers
625
- * @summary Get the number of calendar months between the given dates.
626
- *
627
- * @description
628
- * Get the number of calendar months between the given dates.
629
- *
630
- * @param {Date|Number} dateLeft - the later date
631
- * @param {Date|Number} dateRight - the earlier date
632
- * @returns {Number} the number of calendar months
633
- * @throws {TypeError} 2 arguments required
634
- *
635
- * @example
636
- * // How many calendar months are between 31 January 2014 and 1 September 2014?
637
- * const result = differenceInCalendarMonths(
638
- * new Date(2014, 8, 1),
639
- * new Date(2014, 0, 31)
640
- * )
641
- * //=> 8
642
- */
643
- function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {
644
- requiredArgs(2, arguments);
645
- var dateLeft = toDate(dirtyDateLeft);
646
- var dateRight = toDate(dirtyDateRight);
647
- var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();
648
- var monthDiff = dateLeft.getMonth() - dateRight.getMonth();
649
- return yearDiff * 12 + monthDiff;
650
- }
651
-
652
- /**
653
- * @name endOfDay
654
- * @category Day Helpers
655
- * @summary Return the end of a day for the given date.
656
- *
657
- * @description
658
- * Return the end of a day for the given date.
659
- * The result will be in the local timezone.
660
- *
661
- * @param {Date|Number} date - the original date
662
- * @returns {Date} the end of a day
663
- * @throws {TypeError} 1 argument required
664
- *
665
- * @example
666
- * // The end of a day for 2 September 2014 11:55:00:
667
- * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
668
- * //=> Tue Sep 02 2014 23:59:59.999
669
- */
670
- function endOfDay(dirtyDate) {
671
- requiredArgs(1, arguments);
672
- var date = toDate(dirtyDate);
673
- date.setHours(23, 59, 59, 999);
674
- return date;
675
- }
676
-
677
- /**
678
- * @name endOfMonth
679
- * @category Month Helpers
680
- * @summary Return the end of a month for the given date.
681
- *
682
- * @description
683
- * Return the end of a month for the given date.
684
- * The result will be in the local timezone.
685
- *
686
- * @param {Date|Number} date - the original date
687
- * @returns {Date} the end of a month
688
- * @throws {TypeError} 1 argument required
689
- *
690
- * @example
691
- * // The end of a month for 2 September 2014 11:55:00:
692
- * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
693
- * //=> Tue Sep 30 2014 23:59:59.999
694
- */
695
- function endOfMonth(dirtyDate) {
696
- requiredArgs(1, arguments);
697
- var date = toDate(dirtyDate);
698
- var month = date.getMonth();
699
- date.setFullYear(date.getFullYear(), month + 1, 0);
700
- date.setHours(23, 59, 59, 999);
701
- return date;
702
- }
703
-
704
- /**
705
- * @name isLastDayOfMonth
706
- * @category Month Helpers
707
- * @summary Is the given date the last day of a month?
708
- *
709
- * @description
710
- * Is the given date the last day of a month?
711
- *
712
- * @param {Date|Number} date - the date to check
713
- * @returns {Boolean} the date is the last day of a month
714
- * @throws {TypeError} 1 argument required
715
- *
716
- * @example
717
- * // Is 28 February 2014 the last day of a month?
718
- * const result = isLastDayOfMonth(new Date(2014, 1, 28))
719
- * //=> true
720
- */
721
- function isLastDayOfMonth(dirtyDate) {
722
- requiredArgs(1, arguments);
723
- var date = toDate(dirtyDate);
724
- return endOfDay(date).getTime() === endOfMonth(date).getTime();
725
- }
726
-
727
- /**
728
- * @name differenceInMonths
729
- * @category Month Helpers
730
- * @summary Get the number of full months between the given dates.
731
- *
732
- * @description
733
- * Get the number of full months between the given dates using trunc as a default rounding method.
734
- *
735
- * @param {Date|Number} dateLeft - the later date
736
- * @param {Date|Number} dateRight - the earlier date
737
- * @returns {Number} the number of full months
738
- * @throws {TypeError} 2 arguments required
739
- *
740
- * @example
741
- * // How many full months are between 31 January 2014 and 1 September 2014?
742
- * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))
743
- * //=> 7
744
- */
745
- function differenceInMonths(dirtyDateLeft, dirtyDateRight) {
746
- requiredArgs(2, arguments);
747
- var dateLeft = toDate(dirtyDateLeft);
748
- var dateRight = toDate(dirtyDateRight);
749
- var sign = compareAsc(dateLeft, dateRight);
750
- var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));
751
- var result;
752
-
753
- // Check for the difference of less than month
754
- if (difference < 1) {
755
- result = 0;
756
- } else {
757
- if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {
758
- // This will check if the date is end of Feb and assign a higher end of month date
759
- // to compare it with Jan
760
- dateLeft.setDate(30);
761
- }
762
- dateLeft.setMonth(dateLeft.getMonth() - sign * difference);
763
-
764
- // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full
765
- // If so, result must be decreased by 1 in absolute value
766
- var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign;
767
-
768
- // Check for cases of one full calendar month
769
- if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {
770
- isLastMonthNotFull = false;
771
- }
772
- result = sign * (difference - Number(isLastMonthNotFull));
773
- }
774
-
775
- // Prevent negative zero
776
- return result === 0 ? 0 : result;
777
- }
778
-
779
146
  /**
780
147
  * @name differenceInSeconds
781
148
  * @category Second Helpers
@@ -806,128 +173,7 @@ function differenceInSeconds(dateLeft, dateRight, options) {
806
173
  return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
807
174
  }
808
175
 
809
- /**
810
- * @name differenceInCalendarYears
811
- * @category Year Helpers
812
- * @summary Get the number of calendar years between the given dates.
813
- *
814
- * @description
815
- * Get the number of calendar years between the given dates.
816
- *
817
- * @param {Date|Number} dateLeft - the later date
818
- * @param {Date|Number} dateRight - the earlier date
819
- * @returns {Number} the number of calendar years
820
- * @throws {TypeError} 2 arguments required
821
- *
822
- * @example
823
- * // How many calendar years are between 31 December 2013 and 11 February 2015?
824
- * const result = differenceInCalendarYears(
825
- * new Date(2015, 1, 11),
826
- * new Date(2013, 11, 31)
827
- * )
828
- * //=> 2
829
- */
830
- function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {
831
- requiredArgs(2, arguments);
832
- var dateLeft = toDate(dirtyDateLeft);
833
- var dateRight = toDate(dirtyDateRight);
834
- return dateLeft.getFullYear() - dateRight.getFullYear();
835
- }
836
-
837
- /**
838
- * @name differenceInYears
839
- * @category Year Helpers
840
- * @summary Get the number of full years between the given dates.
841
- *
842
- * @description
843
- * Get the number of full years between the given dates.
844
- *
845
- * @param {Date|Number} dateLeft - the later date
846
- * @param {Date|Number} dateRight - the earlier date
847
- * @returns {Number} the number of full years
848
- * @throws {TypeError} 2 arguments required
849
- *
850
- * @example
851
- * // How many full years are between 31 December 2013 and 11 February 2015?
852
- * const result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31))
853
- * //=> 1
854
- */
855
- function differenceInYears(dirtyDateLeft, dirtyDateRight) {
856
- requiredArgs(2, arguments);
857
- var dateLeft = toDate(dirtyDateLeft);
858
- var dateRight = toDate(dirtyDateRight);
859
- var sign = compareAsc(dateLeft, dateRight);
860
- var difference = Math.abs(differenceInCalendarYears(dateLeft, dateRight));
861
-
862
- // Set both dates to a valid leap year for accurate comparison when dealing
863
- // with leap days
864
- dateLeft.setFullYear(1584);
865
- dateRight.setFullYear(1584);
866
-
867
- // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full
868
- // If so, result must be decreased by 1 in absolute value
869
- var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;
870
- var result = sign * (difference - Number(isLastYearNotFull));
871
- // Prevent negative zero
872
- return result === 0 ? 0 : result;
873
- }
874
-
875
- /**
876
- * @name intervalToDuration
877
- * @category Common Helpers
878
- * @summary Convert interval to duration
879
- *
880
- * @description
881
- * Convert a interval object to a duration object.
882
- *
883
- * @param {Interval} interval - the interval to convert to duration
884
- *
885
- * @returns {Duration} The duration Object
886
- * @throws {TypeError} Requires 2 arguments
887
- * @throws {RangeError} `start` must not be Invalid Date
888
- * @throws {RangeError} `end` must not be Invalid Date
889
- *
890
- * @example
891
- * // Get the duration between January 15, 1929 and April 4, 1968.
892
- * intervalToDuration({
893
- * start: new Date(1929, 0, 15, 12, 0, 0),
894
- * end: new Date(1968, 3, 4, 19, 5, 0)
895
- * })
896
- * // => { years: 39, months: 2, days: 20, hours: 7, minutes: 5, seconds: 0 }
897
- */
898
- function intervalToDuration(interval) {
899
- requiredArgs(1, arguments);
900
- var start = toDate(interval.start);
901
- var end = toDate(interval.end);
902
- if (isNaN(start.getTime())) throw new RangeError('Start Date is invalid');
903
- if (isNaN(end.getTime())) throw new RangeError('End Date is invalid');
904
- var duration = {};
905
- duration.years = Math.abs(differenceInYears(end, start));
906
- var sign = compareAsc(end, start);
907
- var remainingMonths = add(start, {
908
- years: sign * duration.years
909
- });
910
- duration.months = Math.abs(differenceInMonths(end, remainingMonths));
911
- var remainingDays = add(remainingMonths, {
912
- months: sign * duration.months
913
- });
914
- duration.days = Math.abs(differenceInDays(end, remainingDays));
915
- var remainingHours = add(remainingDays, {
916
- days: sign * duration.days
917
- });
918
- duration.hours = Math.abs(differenceInHours(end, remainingHours));
919
- var remainingMinutes = add(remainingHours, {
920
- hours: sign * duration.hours
921
- });
922
- duration.minutes = Math.abs(differenceInMinutes(end, remainingMinutes));
923
- var remainingSeconds = add(remainingMinutes, {
924
- minutes: sign * duration.minutes
925
- });
926
- duration.seconds = Math.abs(differenceInSeconds(end, remainingSeconds));
927
- return duration;
928
- }
929
-
930
- 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}.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}";
176
+ 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}.Disabled{opacity:0.5;pointer-events:none;cursor:auto}.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}.ChallengeLabel{min-width:35px;height:18px;background:linear-gradient(180deg, #FFB801 15.86%, #FEF746 31.36%, #FBFFE0 36.86%, #FFFA60 47.86%, #FF9400 87.36%);border-radius:2px;display:none;position:absolute;top:-11px;right:11px;padding:0 2px;align-items:center;justify-content:center}.ChallengeLabel span{display:inline-block;text-transform:uppercase;font-size:10px;line-height:10px;font-weight:700;font-family:\"Montserrat\", sans-serif;color:var(--emw--color-typography, #1E1638)}.ShowChallengeLabel{display:inline-flex}.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}";
931
177
 
932
178
  const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
933
179
  constructor() {
@@ -958,6 +204,8 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
958
204
  this.tooltip = false;
959
205
  this.timers = {};
960
206
  this.limitStylingAppends = false;
207
+ this.newChallengeIds = [];
208
+ this.pausedChallengeIds = [];
961
209
  this.setClientStyling = () => {
962
210
  let sheet = document.createElement('style');
963
211
  sheet.innerHTML = this.clientStyling;
@@ -979,10 +227,12 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
979
227
  this.handleCloseClick = () => {
980
228
  this.close.emit();
981
229
  this.tooltip = false;
230
+ this.newChallengeIds = [];
982
231
  };
983
232
  this.handleChallengeClick = (ev) => {
984
233
  const id = +ev.currentTarget.getAttribute('data-id');
985
- window.postMessage({ type: `ChallengeClick`, id });
234
+ window.postMessage({ type: 'ChallengeClick', id });
235
+ this.newChallengeIds = this.newChallengeIds.filter(item => item !== id);
986
236
  };
987
237
  this.showTooltip = () => {
988
238
  this.tooltip = true;
@@ -990,6 +240,32 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
990
240
  this.hideTooltip = () => {
991
241
  this.tooltip = false;
992
242
  };
243
+ this.changeChallengeStatus = (e) => {
244
+ var _a, _b;
245
+ e.stopPropagation();
246
+ const id = +e.currentTarget.getAttribute('data-id');
247
+ if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
248
+ window.postMessage({
249
+ type: 'ShowConfirmationModal',
250
+ ProgressToDeactivate: id,
251
+ });
252
+ return;
253
+ }
254
+ if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
255
+ window.postMessage({
256
+ type: 'ShowConfirmationModal',
257
+ ProgressToActivate: id,
258
+ ProgressToDeactivate: this.inProgressChallenges[0],
259
+ });
260
+ return;
261
+ }
262
+ window.postMessage({
263
+ type: 'ChallengeJoinRequest',
264
+ data: {
265
+ ProgressToActivate: id,
266
+ },
267
+ });
268
+ };
993
269
  }
994
270
  challengesPropHandler(value) {
995
271
  if (!this.interval && value.length) {
@@ -1001,19 +277,42 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
1001
277
  }
1002
278
  }
1003
279
  handleEvent(e) {
1004
- const newChallenge = e.data.data;
1005
- if (e.data.type === 'ChallengeGrant') {
1006
- const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
1007
- if (index > -1) {
1008
- this.challenges.splice(index, 0, newChallenge);
280
+ const type = e.data.type;
281
+ switch (type) {
282
+ case 'ChallengeGrant': {
283
+ const newChallenge = e.data.data;
284
+ const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
285
+ if (index > -1) {
286
+ this.challenges.splice(index, 0, newChallenge);
287
+ }
288
+ else {
289
+ this.challenges.unshift(newChallenge);
290
+ }
291
+ this.challenges = [...this.challenges];
292
+ this.newChallengeIds.push(newChallenge.Id);
293
+ window.postMessage({ type: 'UpdateChallenges' });
294
+ break;
1009
295
  }
1010
- else {
1011
- this.challenges.unshift(newChallenge);
296
+ case 'ChallengeChangeStatusNotification': {
297
+ const isEnabled = e.data.data.IsEnabled;
298
+ const id = e.data.data.ChallengeId;
299
+ if (!isEnabled) {
300
+ this.pausedChallengeIds.push(id);
301
+ }
302
+ else {
303
+ this.pausedChallengeIds = this.pausedChallengeIds.filter(c => c !== id);
304
+ }
305
+ break;
1012
306
  }
1013
307
  }
1014
308
  }
1015
309
  componentWillLoad() {
310
+ var _a;
1016
311
  this.challengesPropHandler(this.challenges);
312
+ if ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.length) {
313
+ this.newChallengeIds = this.challenges.filter(challenge => challenge.IsNew)
314
+ .map(challenge => challenge.Id);
315
+ }
1017
316
  }
1018
317
  componentDidRender() {
1019
318
  if (!this.limitStylingAppends && this.host) {
@@ -1033,23 +332,21 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
1033
332
  }, 1000);
1034
333
  }
1035
334
  updateTimers() {
1036
- const now = new Date();
335
+ const now = new Date().getTime();
1037
336
  this.timers = this.challenges.filter(challenge => challenge.Status !== ChallengeProgressStatus.Expired).reduce((acc, challenge) => {
1038
- const expirationDate = new Date(challenge.ExpirationTime);
1039
- const diff = differenceInSeconds(expirationDate, now);
1040
- const duration = intervalToDuration({
1041
- start: now,
1042
- end: expirationDate
1043
- });
337
+ const expirationDate = new Date(challenge.ExpirationTime).getTime();
338
+ const diff = expirationDate - now;
1044
339
  let countdown = '00h:00m:00s';
1045
340
  if (diff < 1) {
1046
341
  this.removeChallenge(challenge.Id);
1047
342
  }
1048
343
  else {
1049
- const days = duration.days.toString().padStart(2, '0');
1050
- const hours = duration.hours.toString().padStart(2, '0');
1051
- const minutes = duration.minutes.toString().padStart(2, '0');
1052
- const seconds = duration.seconds.toString().padStart(2, '0');
344
+ const { days, hours, minutes, seconds } = {
345
+ days: String(Math.floor(diff / (1000 * 60 * 60 * 24))).padStart(2, '0'),
346
+ hours: String(Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
347
+ minutes: String(Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
348
+ seconds: String(Math.floor((diff % (1000 * 60)) / 1000)).padStart(2, '0')
349
+ };
1053
350
  countdown = days === '00'
1054
351
  ? `${hours}h:${minutes}m:${seconds}s`
1055
352
  : `${days}d:${hours}h:${minutes}m`;
@@ -1067,14 +364,16 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
1067
364
  getChallengeClasses(challenge) {
1068
365
  return {
1069
366
  ChallengeCard: true,
1070
- InProgress: challenge.Status === ChallengeProgressStatus.InProgress,
367
+ InProgress: challenge.Status === ChallengeProgressStatus.InProgress
368
+ && !this.pausedChallengeIds.includes(challenge.Id),
1071
369
  Completed: this.isChallengeCompleted(challenge),
1072
370
  Paused: this.isChallengePaused(challenge)
1073
371
  };
1074
372
  }
1075
373
  isChallengePaused(challenge) {
1076
- return challenge.Status === ChallengeProgressStatus.Started
1077
- && challenge.LevelProgresses[0].ProgressPercentage > 0;
374
+ return (challenge.Status === ChallengeProgressStatus.Started
375
+ && challenge.LevelProgresses[0].ProgressPercentage > 0)
376
+ || this.pausedChallengeIds.includes(challenge.Id);
1078
377
  }
1079
378
  isChallengeCompleted(challenge) {
1080
379
  return challenge.Status === ChallengeProgressStatus.Completed
@@ -1101,20 +400,23 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
1101
400
  return -1;
1102
401
  }
1103
402
  getChallengeHeaderTemplate(challenge) {
1104
- return h("div", { class: "ChallengeCardHeader" }, h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), h("button", { class: challenge.Status === ChallengeProgressStatus.InProgress ? 'ChallengeJoinButton Joined' : 'ChallengeJoinButton' }, challenge.Status === ChallengeProgressStatus.InProgress
403
+ const { Id } = challenge;
404
+ return h("div", { class: "ChallengeCardHeader" }, h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), h("button", { class: `${challenge.Status === ChallengeProgressStatus.InProgress ?
405
+ 'ChallengeJoinButton Joined' : 'ChallengeJoinButton'} ${this.isJoiningToChallenge ? 'Disabled' : ''}`, onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
1105
406
  ? translate('unjoin', this.language)
1106
407
  : translate('join', this.language)));
1107
408
  }
1108
409
  getChallengeTemplate(challenge) {
1109
410
  const challengeProgress = this.getChallengeProgress(challenge);
1110
411
  const countdown = this.timers[challenge.Id];
412
+ const isNewChallenge = this.newChallengeIds.includes(challenge.Id);
1111
413
  const progressTemplate = challengeProgress > -1
1112
414
  ? h("casino-engagement-suite-progress-bar", { class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) }, h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
1113
415
  : h("span", { class: "ChallengeCountdown" }, countdown);
1114
- return (h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id }, this.getChallengeHeaderTemplate(challenge), progressTemplate));
416
+ return (h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id }, this.getChallengeHeaderTemplate(challenge), progressTemplate, h("div", { class: `ChallengeLabel ${isNewChallenge ? 'ShowChallengeLabel' : ''}` }, h("span", null, translate('new', this.language)))));
1115
417
  }
1116
418
  getHeaderTemplate() {
1117
- 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: "\u0421lose challenges list" })));
419
+ 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" })));
1118
420
  }
1119
421
  getListTemplate() {
1120
422
  if (this.challenges.length) {
@@ -1125,15 +427,10 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
1125
427
  }
1126
428
  }
1127
429
  getTooltipTemplate() {
1128
- if (this.tooltip) {
1129
- 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: "\u0421lose tooltip" })), translate('tooltip', this.language)));
1130
- }
1131
- else {
1132
- return '';
1133
- }
430
+ 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)));
1134
431
  }
1135
432
  render() {
1136
- return h("div", { class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.getTooltipTemplate());
433
+ return h("div", { class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.tooltip && this.getTooltipTemplate());
1137
434
  }
1138
435
  get host() { return this; }
1139
436
  static get watchers() { return {
@@ -1146,21 +443,30 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
1146
443
  "language": [1],
1147
444
  "device": [1],
1148
445
  "challenges": [1040],
446
+ "isJoiningToChallenge": [1028, "is-joining-to-challenge"],
447
+ "inProgressChallenges": [1040],
1149
448
  "tooltip": [32],
1150
449
  "timers": [32],
1151
- "limitStylingAppends": [32]
450
+ "limitStylingAppends": [32],
451
+ "newChallengeIds": [32],
452
+ "pausedChallengeIds": [32]
1152
453
  }, [[8, "message", "handleEvent"]]]);
1153
454
  function defineCustomElement$1() {
1154
455
  if (typeof customElements === "undefined") {
1155
456
  return;
1156
457
  }
1157
- const components = ["casino-engagement-suite-challenges-list"];
458
+ const components = ["casino-engagement-suite-challenges-list", "casino-engagement-suite-progress-bar"];
1158
459
  components.forEach(tagName => { switch (tagName) {
1159
460
  case "casino-engagement-suite-challenges-list":
1160
461
  if (!customElements.get(tagName)) {
1161
462
  customElements.define(tagName, CasinoEngagementSuiteChallengesList$1);
1162
463
  }
1163
464
  break;
465
+ case "casino-engagement-suite-progress-bar":
466
+ if (!customElements.get(tagName)) {
467
+ defineCustomElement$2();
468
+ }
469
+ break;
1164
470
  } });
1165
471
  }
1166
472