@everymatrix/lottery-banner 0.7.4 → 0.7.5

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 (28) hide show
  1. package/dist/cjs/helper-count-down_2.cjs.entry.js +172 -0
  2. package/dist/cjs/{index-7e1b19dd.js → index-21014502.js} +26 -5
  3. package/dist/cjs/index.cjs.js +2 -2
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/{lottery-banner-c3bceca9.js → lottery-banner-c5020b47.js} +25 -297
  6. package/dist/cjs/lottery-banner.cjs.js +2 -2
  7. package/dist/collection/collection-manifest.json +8 -1
  8. package/dist/collection/components/lottery-banner/lottery-banner.css +4 -0
  9. package/dist/collection/components/lottery-banner/lottery-banner.js +25 -26
  10. package/dist/esm/helper-count-down_2.entry.js +168 -0
  11. package/dist/esm/{index-472357af.js → index-fd1b34f8.js} +26 -5
  12. package/dist/esm/index.js +2 -2
  13. package/dist/esm/loader.js +3 -3
  14. package/dist/esm/{lottery-banner-8d9a42d1.js → lottery-banner-a9eb5657.js} +22 -298
  15. package/dist/esm/lottery-banner.js +3 -3
  16. package/dist/lottery-banner/helper-count-down_2.entry.js +1 -0
  17. package/dist/lottery-banner/index-fd1b34f8.js +2 -0
  18. package/dist/lottery-banner/index.esm.js +1 -1
  19. package/dist/lottery-banner/lottery-banner-a9eb5657.js +1 -0
  20. package/dist/lottery-banner/lottery-banner.esm.js +1 -1
  21. package/dist/types/components/lottery-banner/lottery-banner.d.ts +7 -9
  22. package/dist/types/components.d.ts +3 -3
  23. package/package.json +1 -1
  24. package/dist/cjs/lottery-banner.cjs.entry.js +0 -10
  25. package/dist/esm/lottery-banner.entry.js +0 -2
  26. package/dist/lottery-banner/index-472357af.js +0 -2
  27. package/dist/lottery-banner/lottery-banner-8d9a42d1.js +0 -1
  28. package/dist/lottery-banner/lottery-banner.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-7e1b19dd.js');
3
+ const index = require('./index-21014502.js');
4
4
 
5
5
  const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
6
6
 
@@ -298,31 +298,6 @@ function getTimezoneOffsetInMilliseconds(date) {
298
298
  return date.getTime() - utcDate.getTime();
299
299
  }
300
300
 
301
- /**
302
- * @name startOfDay
303
- * @category Day Helpers
304
- * @summary Return the start of a day for the given date.
305
- *
306
- * @description
307
- * Return the start of a day for the given date.
308
- * The result will be in the local timezone.
309
- *
310
- * @param {Date|Number} date - the original date
311
- * @returns {Date} the start of a day
312
- * @throws {TypeError} 1 argument required
313
- *
314
- * @example
315
- * // The start of a day for 2 September 2014 11:55:00:
316
- * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
317
- * //=> Tue Sep 02 2014 00:00:00
318
- */
319
- function startOfDay(dirtyDate) {
320
- requiredArgs(1, arguments);
321
- var date = toDate(dirtyDate);
322
- date.setHours(0, 0, 0, 0);
323
- return date;
324
- }
325
-
326
301
  /**
327
302
  * Days in 1 week.
328
303
  *
@@ -352,41 +327,6 @@ var millisecondsInMinute = 60000;
352
327
  */
353
328
  var millisecondsInHour = 3600000;
354
329
 
355
- /**
356
- * @name isSameDay
357
- * @category Day Helpers
358
- * @summary Are the given dates in the same day (and year and month)?
359
- *
360
- * @description
361
- * Are the given dates in the same day (and year and month)?
362
- *
363
- * @param {Date|Number} dateLeft - the first date to check
364
- * @param {Date|Number} dateRight - the second date to check
365
- * @returns {Boolean} the dates are in the same day (and year and month)
366
- * @throws {TypeError} 2 arguments required
367
- *
368
- * @example
369
- * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
370
- * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
371
- * //=> true
372
- *
373
- * @example
374
- * // Are 4 September and 4 October in the same day?
375
- * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
376
- * //=> false
377
- *
378
- * @example
379
- * // Are 4 September, 2014 and 4 September, 2015 in the same day?
380
- * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
381
- * //=> false
382
- */
383
- function isSameDay(dirtyDateLeft, dirtyDateRight) {
384
- requiredArgs(2, arguments);
385
- var dateLeftStartOfDay = startOfDay(dirtyDateLeft);
386
- var dateRightStartOfDay = startOfDay(dirtyDateRight);
387
- return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
388
- }
389
-
390
330
  /**
391
331
  * @name isDate
392
332
  * @category Common Helpers
@@ -464,77 +404,6 @@ function isValid(dirtyDate) {
464
404
  return !isNaN(Number(date));
465
405
  }
466
406
 
467
- /**
468
- * @name differenceInMilliseconds
469
- * @category Millisecond Helpers
470
- * @summary Get the number of milliseconds between the given dates.
471
- *
472
- * @description
473
- * Get the number of milliseconds between the given dates.
474
- *
475
- * @param {Date|Number} dateLeft - the later date
476
- * @param {Date|Number} dateRight - the earlier date
477
- * @returns {Number} the number of milliseconds
478
- * @throws {TypeError} 2 arguments required
479
- *
480
- * @example
481
- * // How many milliseconds are between
482
- * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
483
- * const result = differenceInMilliseconds(
484
- * new Date(2014, 6, 2, 12, 30, 21, 700),
485
- * new Date(2014, 6, 2, 12, 30, 20, 600)
486
- * )
487
- * //=> 1100
488
- */
489
- function differenceInMilliseconds(dateLeft, dateRight) {
490
- requiredArgs(2, arguments);
491
- return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
492
- }
493
-
494
- var roundingMap = {
495
- ceil: Math.ceil,
496
- round: Math.round,
497
- floor: Math.floor,
498
- trunc: function trunc(value) {
499
- return value < 0 ? Math.ceil(value) : Math.floor(value);
500
- } // Math.trunc is not supported by IE
501
- };
502
-
503
- var defaultRoundingMethod = 'trunc';
504
- function getRoundingMethod(method) {
505
- return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
506
- }
507
-
508
- /**
509
- * @name differenceInSeconds
510
- * @category Second Helpers
511
- * @summary Get the number of seconds between the given dates.
512
- *
513
- * @description
514
- * Get the number of seconds between the given dates.
515
- *
516
- * @param {Date|Number} dateLeft - the later date
517
- * @param {Date|Number} dateRight - the earlier date
518
- * @param {Object} [options] - an object with options.
519
- * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
520
- * @returns {Number} the number of seconds
521
- * @throws {TypeError} 2 arguments required
522
- *
523
- * @example
524
- * // How many seconds are between
525
- * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
526
- * const result = differenceInSeconds(
527
- * new Date(2014, 6, 2, 12, 30, 20, 0),
528
- * new Date(2014, 6, 2, 12, 30, 7, 999)
529
- * )
530
- * //=> 12
531
- */
532
- function differenceInSeconds(dateLeft, dateRight, options) {
533
- requiredArgs(2, arguments);
534
- var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;
535
- return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
536
- }
537
-
538
407
  /**
539
408
  * @name subMilliseconds
540
409
  * @category Millisecond Helpers
@@ -2554,84 +2423,6 @@ function isBefore(dirtyDate, dirtyDateToCompare) {
2554
2423
  return date.getTime() < dateToCompare.getTime();
2555
2424
  }
2556
2425
 
2557
- /**
2558
- * @name isToday
2559
- * @category Day Helpers
2560
- * @summary Is the given date today?
2561
- * @pure false
2562
- *
2563
- * @description
2564
- * Is the given date today?
2565
- *
2566
- * > ⚠️ Please note that this function is not present in the FP submodule as
2567
- * > it uses `Date.now()` internally hence impure and can't be safely curried.
2568
- *
2569
- * @param {Date|Number} date - the date to check
2570
- * @returns {Boolean} the date is today
2571
- * @throws {TypeError} 1 argument required
2572
- *
2573
- * @example
2574
- * // If today is 6 October 2014, is 6 October 14:00:00 today?
2575
- * const result = isToday(new Date(2014, 9, 6, 14, 0))
2576
- * //=> true
2577
- */
2578
- function isToday(dirtyDate) {
2579
- requiredArgs(1, arguments);
2580
- return isSameDay(dirtyDate, Date.now());
2581
- }
2582
-
2583
- /**
2584
- * @name isWithinInterval
2585
- * @category Interval Helpers
2586
- * @summary Is the given date within the interval?
2587
- *
2588
- * @description
2589
- * Is the given date within the interval? (Including start and end.)
2590
- *
2591
- * @param {Date|Number} date - the date to check
2592
- * @param {Interval} interval - the interval to check
2593
- * @returns {Boolean} the date is within the interval
2594
- * @throws {TypeError} 2 arguments required
2595
- * @throws {RangeError} The start of an interval cannot be after its end
2596
- * @throws {RangeError} Date in interval cannot be `Invalid Date`
2597
- *
2598
- * @example
2599
- * // For the date within the interval:
2600
- * isWithinInterval(new Date(2014, 0, 3), {
2601
- * start: new Date(2014, 0, 1),
2602
- * end: new Date(2014, 0, 7)
2603
- * })
2604
- * //=> true
2605
- *
2606
- * @example
2607
- * // For the date outside of the interval:
2608
- * isWithinInterval(new Date(2014, 0, 10), {
2609
- * start: new Date(2014, 0, 1),
2610
- * end: new Date(2014, 0, 7)
2611
- * })
2612
- * //=> false
2613
- *
2614
- * @example
2615
- * // For date equal to interval start:
2616
- * isWithinInterval(date, { start, end: date }) // => true
2617
- *
2618
- * @example
2619
- * // For date equal to interval end:
2620
- * isWithinInterval(date, { start: date, end }) // => true
2621
- */
2622
- function isWithinInterval(dirtyDate, interval) {
2623
- requiredArgs(2, arguments);
2624
- var time = toDate(dirtyDate).getTime();
2625
- var startTime = toDate(interval.start).getTime();
2626
- var endTime = toDate(interval.end).getTime();
2627
-
2628
- // Throw an exception if start date is after end date or if any date is `Invalid Date`
2629
- if (!(startTime <= endTime)) {
2630
- throw new RangeError('Invalid interval');
2631
- }
2632
- return time >= startTime && time <= endTime;
2633
- }
2634
-
2635
2426
  /**
2636
2427
  * @name parseISO
2637
2428
  * @category Common Helpers
@@ -2858,77 +2649,17 @@ function validateTimezone(_hours, minutes) {
2858
2649
  return minutes >= 0 && minutes <= 59;
2859
2650
  }
2860
2651
 
2861
- const formatDate = ({ date, type = 'date', format: format$1 }) => {
2862
- try {
2863
- const parsedDate = parseISO(date);
2864
- if (isNaN(parsedDate.getTime())) {
2865
- throw new Error(`Invalid date: ${date}`);
2866
- }
2867
- if (format$1)
2868
- return format(parsedDate, format$1);
2869
- let formatStr = 'dd/MM/yyyy';
2870
- if (type === 'time') {
2871
- formatStr = 'dd/MM/yyyy HH:mm:ss';
2872
- }
2873
- else if (type === 'week') {
2874
- formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
2875
- }
2876
- return format(parsedDate, formatStr);
2877
- }
2878
- catch (error) {
2879
- console.error('Error formatting date:', error.message);
2880
- return '';
2881
- }
2882
- };
2883
- function formatTime(time) {
2884
- if (!time)
2885
- return;
2886
- if (isToday(new Date(time))) {
2887
- return formatDate({ date: time, format: 'HH:mm' });
2888
- }
2889
- return formatDate({ date: time, format: 'dd/MM/yyyy HH:mm' });
2890
- }
2891
- function formatCountdown(stopTime, _now) {
2892
- if (!stopTime)
2893
- return;
2894
- const endTime = typeof stopTime === 'string' ? parseISO(stopTime) : stopTime;
2895
- const now = _now && new Date();
2896
- let totalSeconds = differenceInSeconds(endTime, now);
2897
- if (totalSeconds < 0)
2898
- return '0D 00H 00M 00S';
2899
- const days = Math.floor(totalSeconds / 86400);
2900
- totalSeconds %= 86400;
2901
- const hours = Math.floor(totalSeconds / 3600);
2902
- totalSeconds %= 3600;
2903
- const minutes = Math.floor(totalSeconds / 60);
2904
- const seconds = totalSeconds % 60;
2905
- return `${days}D ${hours.toString().padStart(2, '0')}H ${minutes.toString().padStart(2, '0')}M ${seconds
2906
- .toString()
2907
- .padStart(2, '0')}S`;
2908
- }
2909
- function getWagerTime(startTime, stopTime) {
2910
- const now = new Date();
2911
- if (startTime && isBefore(now, parseISO(startTime))) {
2912
- return { start: formatCountdown(startTime, now) };
2913
- }
2914
- if (startTime &&
2915
- stopTime &&
2916
- isWithinInterval(now, {
2917
- start: parseISO(startTime),
2918
- end: parseISO(stopTime)
2919
- })) {
2920
- return { end: formatTime(stopTime) };
2921
- }
2922
- return {};
2923
- }
2924
-
2925
- const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-value__strong {\n font-weight: 700;\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 1rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n}";
2652
+ const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-value__strong {\n font-weight: 700;\n}\n\nhelper-count-down::part(values) {\n gap: 8px;\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 1rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n}";
2926
2653
  const LotteryBannerStyle0 = lotteryBannerCss;
2927
2654
 
2928
2655
  const LotteryBanner = class {
2929
2656
  constructor(hostRef) {
2930
2657
  index.registerInstance(this, hostRef);
2931
- this.lotteryBannerTimerStop = index.createEvent(this, "lotteryBannerTimerStop", 7);
2658
+ this.lotteryBannerWagerStarted = index.createEvent(this, "lotteryBannerWagerStarted", 7);
2659
+ this.handleCountdownFinish = () => {
2660
+ this.isWagerStarted = true;
2661
+ this.lotteryBannerWagerStarted.emit();
2662
+ };
2932
2663
  this.mbSource = undefined;
2933
2664
  this.clientStyling = undefined;
2934
2665
  this.clientStylingUrl = undefined;
@@ -2940,7 +2671,8 @@ const LotteryBanner = class {
2940
2671
  this.bannerTitle = undefined;
2941
2672
  this.turnover = undefined;
2942
2673
  this.layout = 'logo,title,info';
2943
- this.formattedTime = undefined;
2674
+ this.isWagerStarted = false;
2675
+ this.formattedStopTime = undefined;
2944
2676
  }
2945
2677
  handleClientStylingChange(newValue, oldValue) {
2946
2678
  if (newValue !== oldValue) {
@@ -2958,29 +2690,23 @@ const LotteryBanner = class {
2958
2690
  }
2959
2691
  }
2960
2692
  handleTimeChange() {
2961
- this.startTimer();
2693
+ this.checkWagerStatus();
2962
2694
  }
2963
2695
  async componentWillLoad() {
2964
2696
  if (this.translationUrl) {
2965
2697
  resolveTranslationUrl(this.translationUrl);
2966
2698
  }
2967
- this.startTimer();
2699
+ this.checkWagerStatus();
2968
2700
  }
2969
- startTimer() {
2970
- if (this.timer) {
2971
- clearInterval(this.timer);
2701
+ checkWagerStatus() {
2702
+ if (this.startTime && isBefore(new Date(), parseISO(this.startTime))) {
2703
+ this.isWagerStarted = false;
2704
+ }
2705
+ else {
2706
+ this.isWagerStarted = true;
2972
2707
  }
2973
- this.updateTime();
2974
- this.timer = setInterval(() => {
2975
- this.updateTime();
2976
- }, 1000);
2977
- }
2978
- updateTime() {
2979
- var _a;
2980
- this.formattedTime = getWagerTime(this.startTime, this.stopTime);
2981
- if ((_a = this.formattedTime) === null || _a === void 0 ? void 0 : _a.end) {
2982
- this.timer && clearInterval(this.timer);
2983
- this.lotteryBannerTimerStop.emit();
2708
+ if (this.stopTime) {
2709
+ this.formattedStopTime = format(parseISO(this.stopTime), 'dd/MM/yyyy HH:mm');
2984
2710
  }
2985
2711
  }
2986
2712
  componentDidLoad() {
@@ -2995,10 +2721,8 @@ const LotteryBanner = class {
2995
2721
  }
2996
2722
  disconnectedCallback() {
2997
2723
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
2998
- this.timer && clearInterval(this.timer);
2999
2724
  }
3000
2725
  renderElement(item, className = '') {
3001
- var _a, _b, _c;
3002
2726
  const poolGameLogo = index.getAssetPath('../static/poolGameLogo.webp');
3003
2727
  switch (item) {
3004
2728
  case 'logo':
@@ -3006,14 +2730,14 @@ const LotteryBanner = class {
3006
2730
  case 'title':
3007
2731
  return this.bannerTitle && index.h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
3008
2732
  case 'info':
3009
- return (index.h("div", { class: `lottery-banner__info ${className}` }, ((_a = this.formattedTime) === null || _a === void 0 ? void 0 : _a.start) && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate('startIn', this.language)), "\u00A0"), index.h("span", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong" }, this.formattedTime.start))), ((_b = this.formattedTime) === null || _b === void 0 ? void 0 : _b.end) && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate('stop', this.language)), "\u00A0", translate('at', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.formattedTime.end))), ((_c = this.formattedTime) === null || _c === void 0 ? void 0 : _c.end) && this.turnover !== null && this.turnover !== undefined && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, translate('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
2733
+ return (index.h("div", { class: `lottery-banner__info ${className}` }, !this.isWagerStarted ? (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate('startIn', this.language)), "\u00A0"), index.h("helper-count-down", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong", value: this.startTime, format: "DDD HHH mmM ssS", onCountDownFinish: this.handleCountdownFinish }))) : (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate('stop', this.language)), "\u00A0", translate('at', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.formattedStopTime))), this.isWagerStarted && this.turnover !== null && this.turnover !== undefined && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, translate('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
3010
2734
  default:
3011
2735
  return null;
3012
2736
  }
3013
2737
  }
3014
2738
  render() {
3015
2739
  const layoutItems = this.layout.split(',').map((item) => item.trim());
3016
- return (index.h("section", { key: 'fe2c807504069e45cf9b9f04b754710b49930caf', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
2740
+ return (index.h("section", { key: '3f14279ebff86c47ec5d5d7c4e1054c5899e8580', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
3017
2741
  const isMiddle = layoutItems.length === 3 && index === 1;
3018
2742
  const className = isMiddle ? 'lottery-banner__item--center' : '';
3019
2743
  return this.renderElement(item, className);
@@ -3030,3 +2754,7 @@ const LotteryBanner = class {
3030
2754
  LotteryBanner.style = LotteryBannerStyle0;
3031
2755
 
3032
2756
  exports.LotteryBanner = LotteryBanner;
2757
+ exports.parseISO = parseISO;
2758
+ exports.setClientStyling = setClientStyling;
2759
+ exports.setClientStylingURL = setClientStylingURL;
2760
+ exports.setStreamStyling = setStreamStyling;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-7e1b19dd.js');
5
+ const index = require('./index-21014502.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["lottery-banner.cjs",[[1,"lottery-banner",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"logoUrl":[513,"logo-url"],"stopTime":[1,"stop-time"],"startTime":[1,"start-time"],"bannerTitle":[1,"banner-title"],"turnover":[1],"layout":[1],"formattedTime":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"startTime":["handleTimeChange"],"stopTime":["handleTimeChange"]}]]]], options);
22
+ return index.bootstrapLazy([["helper-count-down_2.cjs",[[1,"lottery-banner",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"logoUrl":[513,"logo-url"],"stopTime":[1,"stop-time"],"startTime":[1,"start-time"],"bannerTitle":[1,"banner-title"],"turnover":[1],"layout":[1],"isWagerStarted":[32],"formattedStopTime":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"startTime":["handleTimeChange"],"stopTime":["handleTimeChange"]}],[1,"helper-count-down",{"value":[520],"format":[513],"prefix":[513],"suffix":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endTime":[32],"timeObj":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"value":["handleValueChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -7,6 +7,13 @@
7
7
  "version": "4.19.2",
8
8
  "typescriptVersion": "5.4.5"
9
9
  },
10
- "collections": [],
10
+ "collections": [
11
+ {
12
+ "name": "@everymatrix/helper-count-down",
13
+ "tags": [
14
+ "helper-count-down"
15
+ ]
16
+ }
17
+ ],
11
18
  "bundles": []
12
19
  }
@@ -77,6 +77,10 @@
77
77
  font-weight: 700;
78
78
  }
79
79
 
80
+ helper-count-down::part(values) {
81
+ gap: 8px;
82
+ }
83
+
80
84
  @container (max-width: 700px) {
81
85
  .lottery-banner {
82
86
  height: auto;
@@ -1,9 +1,14 @@
1
1
  import { h, getAssetPath } from "@stencil/core";
2
2
  import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
3
  import { resolveTranslationUrl, translate } from "../../utils/locale.utils";
4
- import { getWagerTime } from "../../utils/utils";
4
+ import { format, isBefore, parseISO } from "date-fns";
5
+ import "../../../../../helper-count-down/dist/types/index";
5
6
  export class LotteryBanner {
6
7
  constructor() {
8
+ this.handleCountdownFinish = () => {
9
+ this.isWagerStarted = true;
10
+ this.lotteryBannerWagerStarted.emit();
11
+ };
7
12
  this.mbSource = undefined;
8
13
  this.clientStyling = undefined;
9
14
  this.clientStylingUrl = undefined;
@@ -15,7 +20,8 @@ export class LotteryBanner {
15
20
  this.bannerTitle = undefined;
16
21
  this.turnover = undefined;
17
22
  this.layout = 'logo,title,info';
18
- this.formattedTime = undefined;
23
+ this.isWagerStarted = false;
24
+ this.formattedStopTime = undefined;
19
25
  }
20
26
  handleClientStylingChange(newValue, oldValue) {
21
27
  if (newValue !== oldValue) {
@@ -33,29 +39,23 @@ export class LotteryBanner {
33
39
  }
34
40
  }
35
41
  handleTimeChange() {
36
- this.startTimer();
42
+ this.checkWagerStatus();
37
43
  }
38
44
  async componentWillLoad() {
39
45
  if (this.translationUrl) {
40
46
  resolveTranslationUrl(this.translationUrl);
41
47
  }
42
- this.startTimer();
48
+ this.checkWagerStatus();
43
49
  }
44
- startTimer() {
45
- if (this.timer) {
46
- clearInterval(this.timer);
50
+ checkWagerStatus() {
51
+ if (this.startTime && isBefore(new Date(), parseISO(this.startTime))) {
52
+ this.isWagerStarted = false;
47
53
  }
48
- this.updateTime();
49
- this.timer = setInterval(() => {
50
- this.updateTime();
51
- }, 1000);
52
- }
53
- updateTime() {
54
- var _a;
55
- this.formattedTime = getWagerTime(this.startTime, this.stopTime);
56
- if ((_a = this.formattedTime) === null || _a === void 0 ? void 0 : _a.end) {
57
- this.timer && clearInterval(this.timer);
58
- this.lotteryBannerTimerStop.emit();
54
+ else {
55
+ this.isWagerStarted = true;
56
+ }
57
+ if (this.stopTime) {
58
+ this.formattedStopTime = format(parseISO(this.stopTime), 'dd/MM/yyyy HH:mm');
59
59
  }
60
60
  }
61
61
  componentDidLoad() {
@@ -70,10 +70,8 @@ export class LotteryBanner {
70
70
  }
71
71
  disconnectedCallback() {
72
72
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
73
- this.timer && clearInterval(this.timer);
74
73
  }
75
74
  renderElement(item, className = '') {
76
- var _a, _b, _c;
77
75
  const poolGameLogo = getAssetPath('../static/poolGameLogo.webp');
78
76
  switch (item) {
79
77
  case 'logo':
@@ -81,14 +79,14 @@ export class LotteryBanner {
81
79
  case 'title':
82
80
  return this.bannerTitle && h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
83
81
  case 'info':
84
- return (h("div", { class: `lottery-banner__info ${className}` }, ((_a = this.formattedTime) === null || _a === void 0 ? void 0 : _a.start) && (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, h("span", { class: "lottery-banner__info-item-label__strong" }, translate('startIn', this.language)), "\u00A0"), h("span", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong" }, this.formattedTime.start))), ((_b = this.formattedTime) === null || _b === void 0 ? void 0 : _b.end) && (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, h("span", { class: "lottery-banner__info-item-label__strong" }, translate('stop', this.language)), "\u00A0", translate('at', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.formattedTime.end))), ((_c = this.formattedTime) === null || _c === void 0 ? void 0 : _c.end) && this.turnover !== null && this.turnover !== undefined && (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, translate('turnover', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
82
+ return (h("div", { class: `lottery-banner__info ${className}` }, !this.isWagerStarted ? (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, h("span", { class: "lottery-banner__info-item-label__strong" }, translate('startIn', this.language)), "\u00A0"), h("helper-count-down", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong", value: this.startTime, format: "DDD HHH mmM ssS", onCountDownFinish: this.handleCountdownFinish }))) : (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, h("span", { class: "lottery-banner__info-item-label__strong" }, translate('stop', this.language)), "\u00A0", translate('at', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.formattedStopTime))), this.isWagerStarted && this.turnover !== null && this.turnover !== undefined && (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, translate('turnover', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
85
83
  default:
86
84
  return null;
87
85
  }
88
86
  }
89
87
  render() {
90
88
  const layoutItems = this.layout.split(',').map((item) => item.trim());
91
- return (h("section", { key: 'fe2c807504069e45cf9b9f04b754710b49930caf', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
89
+ return (h("section", { key: '3f14279ebff86c47ec5d5d7c4e1054c5899e8580', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
92
90
  const isMiddle = layoutItems.length === 3 && index === 1;
93
91
  const className = isMiddle ? 'lottery-banner__item--center' : '';
94
92
  return this.renderElement(item, className);
@@ -304,19 +302,20 @@ export class LotteryBanner {
304
302
  }
305
303
  static get states() {
306
304
  return {
307
- "formattedTime": {}
305
+ "isWagerStarted": {},
306
+ "formattedStopTime": {}
308
307
  };
309
308
  }
310
309
  static get events() {
311
310
  return [{
312
- "method": "lotteryBannerTimerStop",
313
- "name": "lotteryBannerTimerStop",
311
+ "method": "lotteryBannerWagerStarted",
312
+ "name": "lotteryBannerWagerStarted",
314
313
  "bubbles": true,
315
314
  "cancelable": true,
316
315
  "composed": true,
317
316
  "docs": {
318
317
  "tags": [],
319
- "text": "Event emitted when the timer stops"
318
+ "text": "Event emitted when the wager starts (countdown finishes)"
320
319
  },
321
320
  "complexType": {
322
321
  "original": "void",