@everymatrix/casino-challenges-overlay-drawer 0.5.23 → 0.5.24

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.
@@ -2516,6 +2516,35 @@ var EPostMessageRequestType;
2516
2516
  EPostMessageRequestType["ChallengeInGameRedirect"] = "ChallengeInGameRedirect";
2517
2517
  })(EPostMessageRequestType || (EPostMessageRequestType = {}));
2518
2518
 
2519
+ function getTimeLeft$1(endTime) {
2520
+ const now = new Date();
2521
+ const end = new Date(endTime);
2522
+ let diff = end.getTime() - now.getTime();
2523
+ if (diff <= 0) {
2524
+ return;
2525
+ }
2526
+ const days = Math.floor(diff / (1000 * 60 * 60 * 24));
2527
+ diff -= days * (1000 * 60 * 60 * 24);
2528
+ const hours = Math.floor(diff / (1000 * 60 * 60));
2529
+ diff -= hours * (1000 * 60 * 60);
2530
+ const minutes = Math.floor(diff / (1000 * 60));
2531
+ diff -= minutes * (1000 * 60);
2532
+ const seconds = Math.floor(diff / 1000);
2533
+ const pad = (n) => n.toString().padStart(2, '0');
2534
+ return `${pad(days)} : ${pad(hours)} : ${pad(minutes)} : ${pad(seconds)}`;
2535
+ }
2536
+ function formatDate(dateToFormat) {
2537
+ const date = new Date(dateToFormat);
2538
+ return format(date, 'dd/MM/yyyy');
2539
+ }
2540
+ function formatNumber(num) {
2541
+ const rounded = Number(num).toFixed(2);
2542
+ return rounded.endsWith('.00') ? String(Math.round(num)) : rounded;
2543
+ }
2544
+ function formatProgress(progress) {
2545
+ return String(Math.floor(progress * 10 + 1e-9) / 10); // no trailing ".0" (50, 50.5); the epsilon absorbs float error
2546
+ }
2547
+
2519
2548
  const lockSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNCAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1yd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2MjggOC42MjUgNy4wMDA0OSA4LjYyNVoiIGZpbGw9IiM3Mjc2NzIiLz4KPC9zdmc+Cg==';
2520
2549
 
2521
2550
  const calculateTargetValue = (level, currencySymbol, language) => {
@@ -2548,10 +2577,10 @@ const calculateTargetValue = (level, currencySymbol, language) => {
2548
2577
  };
2549
2578
  const getLevelStatus = (status, level, activeChallenge, language, fullPageView) => {
2550
2579
  if (status === EChallengeProgressStatus$1.Paused) {
2551
- return (index.h("div", { class: "level__status" }, index.h("span", { class: "suspended" }, translate$1('suspended', language)), fullPageView && index.h("span", { class: "suspended" }, Math.floor(level.ProgressPercentage), "%")));
2580
+ return (index.h("div", { class: "level__status" }, index.h("span", { class: "suspended" }, translate$1('suspended', language)), fullPageView && index.h("span", { class: "suspended" }, formatProgress(level.ProgressPercentage), "%")));
2552
2581
  }
2553
2582
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.InProgress && !activeChallenge)
2554
- return (index.h("div", { class: "level__status" }, index.h("span", null, Math.floor(level.ProgressPercentage), "%"), index.h("img", { src: lockSvg, alt: "lock-icon", title: "lock-icon" })));
2583
+ return (index.h("div", { class: "level__status" }, index.h("span", null, formatProgress(level.ProgressPercentage), "%"), index.h("img", { src: lockSvg, alt: "lock-icon", title: "lock-icon" })));
2555
2584
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.Closed || !activeChallenge)
2556
2585
  return (index.h("div", { class: "level__status" }, index.h("img", { src: lockSvg, alt: "lock-icon", title: "lock-icon" })));
2557
2586
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.Fillup)
@@ -2559,7 +2588,7 @@ const getLevelStatus = (status, level, activeChallenge, language, fullPageView)
2559
2588
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.Completed)
2560
2589
  return index.h("span", { class: "completed" }, translate$1('completed', language));
2561
2590
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.InProgress)
2562
- return index.h("span", { class: "level__status in-progress" }, Math.floor(level.ProgressPercentage), "%");
2591
+ return index.h("span", { class: "level__status in-progress" }, formatProgress(level.ProgressPercentage), "%");
2563
2592
  else
2564
2593
  return null;
2565
2594
  };
@@ -2676,7 +2705,7 @@ const CasinoChallengeDetailsProgressBar = class {
2676
2705
  ? translate$1('suspended', this.language)
2677
2706
  : Status === EChallengeProgressStatus$1.Completed
2678
2707
  ? translate$1('finished', this.language)
2679
- : `${Math.floor(currLevel.ProgressPercentage)}%`;
2708
+ : `${formatProgress(currLevel.ProgressPercentage)}%`;
2680
2709
  const isLastLevel = !(LevelProgresses === null || LevelProgresses === void 0 ? void 0 : LevelProgresses.some((x) => x.OrderNumber > currLevel.OrderNumber));
2681
2710
  const secondImgSrc = ((Status === EChallengeProgressStatus$1.Completed || isLastLevel) && rewardGiftSvg) || '';
2682
2711
  return (index.h("div", { class: {
@@ -2697,7 +2726,7 @@ const CasinoChallengeDetailsProgressBar = class {
2697
2726
  } }, secondImgSrc ? index.h("img", { class: "progress__icon", src: secondImgSrc }) : currLevel.OrderNumber + 2)));
2698
2727
  }
2699
2728
  render() {
2700
- return index.h(index.Host, { key: '8f3de4c26bad9f23b9873469d004ae7cff048302' }, this.challengeProgress);
2729
+ return index.h(index.Host, { key: 'b067181be842544ea79410b345cbe1d494d0f833' }, this.challengeProgress);
2701
2730
  }
2702
2731
  };
2703
2732
  CasinoChallengeDetailsProgressBar.style = CasinoChallengeDetailsProgressBarStyle0;
@@ -3271,7 +3300,7 @@ const resolveTranslationUrl = async (translationUrl) => {
3271
3300
  }
3272
3301
  };
3273
3302
 
3274
- function getTimeLeft$1(endTime) {
3303
+ function getTimeLeft(endTime) {
3275
3304
  const now = new Date();
3276
3305
  const end = new Date(endTime);
3277
3306
  let diff = end.getTime() - now.getTime();
@@ -3341,7 +3370,7 @@ const CasinoChallengesOverlaySlider$1 = class {
3341
3370
  }
3342
3371
  updateTime() {
3343
3372
  var _a;
3344
- this.timeLeft = getTimeLeft$1((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
3373
+ this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
3345
3374
  if (!this.timeLeft) {
3346
3375
  clearInterval(this.timerId);
3347
3376
  this.challengeExpired.emit(this.challenge.Id);
@@ -3376,32 +3405,6 @@ const CasinoChallengesOverlaySlider$1 = class {
3376
3405
  };
3377
3406
  CasinoChallengesOverlaySlider$1.style = CasinoChallengesOverlayCardStyle0;
3378
3407
 
3379
- function getTimeLeft(endTime) {
3380
- const now = new Date();
3381
- const end = new Date(endTime);
3382
- let diff = end.getTime() - now.getTime();
3383
- if (diff <= 0) {
3384
- return;
3385
- }
3386
- const days = Math.floor(diff / (1000 * 60 * 60 * 24));
3387
- diff -= days * (1000 * 60 * 60 * 24);
3388
- const hours = Math.floor(diff / (1000 * 60 * 60));
3389
- diff -= hours * (1000 * 60 * 60);
3390
- const minutes = Math.floor(diff / (1000 * 60));
3391
- diff -= minutes * (1000 * 60);
3392
- const seconds = Math.floor(diff / 1000);
3393
- const pad = (n) => n.toString().padStart(2, '0');
3394
- return `${pad(days)} : ${pad(hours)} : ${pad(minutes)} : ${pad(seconds)}`;
3395
- }
3396
- function formatDate(dateToFormat) {
3397
- const date = new Date(dateToFormat);
3398
- return format(date, 'dd/MM/yyyy');
3399
- }
3400
- function formatNumber(num) {
3401
- const rounded = Number(num).toFixed(2);
3402
- return rounded.endsWith('.00') ? String(Math.round(num)) : rounded;
3403
- }
3404
-
3405
3408
  const MIN_DEPOSIT_AMOUNT = '0';
3406
3409
 
3407
3410
  const getDepositDescription = (challenge, language) => {
@@ -3538,7 +3541,7 @@ const CasinoChallengesOverlayDrawerDetails = class {
3538
3541
  this.updateTime = () => {
3539
3542
  var _a;
3540
3543
  if (this.challenge) {
3541
- this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
3544
+ this.timeLeft = getTimeLeft$1((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
3542
3545
  if (!this.timeLeft) {
3543
3546
  clearInterval(this.timerId);
3544
3547
  }
@@ -3884,11 +3887,13 @@ const CasinoChallengesOverlayDrawerDetails = class {
3884
3887
  });
3885
3888
  }
3886
3889
  renderGames() {
3887
- var _a, _b, _c, _d, _e;
3888
- if (!!((_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Games) === null || _b === void 0 ? void 0 : _b.length) && ((_c = this.challenge) === null || _c === void 0 ? void 0 : _c.TotalGamesCount)) {
3889
- return (index.h("div", { class: { 'challenge-block': true, 'challenge-games': true } }, index.h("div", { class: "challenge-block-header" }, index.h("div", { class: "total-games" }, index.h("h3", null, translate$1('games', this.language)), index.h("span", null, "(", this.challenge.TotalGamesCount, ")")), index.h("button", { class: "row button", onClick: this.handleAllGamesClick }, index.h("p", null, translate$1('seeAll', this.language)), index.h("div", { class: "chevron-button" }, index.h("img", { src: chevronSvg })))), index.h("div", { class: "row games-row" }, (_e = (_d = this.challenge) === null || _d === void 0 ? void 0 : _d.Games) === null || _e === void 0 ? void 0 : _e.map((game) => (index.h("div", { class: "challenge-game", onClick: () => this.handleGameClick(game.GameSlug) }, index.h("img", { src: game.GameIcon })))))));
3890
+ if (!this.challenge)
3891
+ return null;
3892
+ const { ContributedFrom, Games, TotalGamesCount } = this.challenge;
3893
+ if (ContributedFrom === EContributedFrom.Sportsbook || !(Games === null || Games === void 0 ? void 0 : Games.length) || !TotalGamesCount) {
3894
+ return null;
3890
3895
  }
3891
- return null;
3896
+ return (index.h("div", { class: { 'challenge-block': true, 'challenge-games': true } }, index.h("div", { class: "challenge-block-header" }, index.h("div", { class: "total-games" }, index.h("h3", null, translate$1('games', this.language)), index.h("span", null, "(", TotalGamesCount, ")")), index.h("button", { class: "row button", onClick: this.handleAllGamesClick }, index.h("p", null, translate$1('seeAll', this.language)), index.h("div", { class: "chevron-button" }, index.h("img", { src: chevronSvg })))), index.h("div", { class: "row games-row" }, Games.map((game) => (index.h("div", { class: "challenge-game", onClick: () => this.handleGameClick(game.GameSlug) }, index.h("img", { src: game.GameIcon })))))));
3892
3897
  }
3893
3898
  renderRules() {
3894
3899
  var _a, _b, _c, _d;
@@ -3931,7 +3936,7 @@ const CasinoChallengesOverlayDrawerDetails = class {
3931
3936
  var _a, _b;
3932
3937
  const fullScreen = (this.swipping && this.progress > 0) || ((_a = this.detailsSubPageInfo) === null || _a === void 0 ? void 0 : _a.open);
3933
3938
  const footerIsVisible = !this.isMobile || (this.isMobile && fullScreen);
3934
- return (index.h("div", { key: 'a973e58403665544dbe1068760e63ff2e41b0c8a', class: {
3939
+ return (index.h("div", { key: '0beed74aabeaa6b3ac22919bcdf405fec48e20f7', class: {
3935
3940
  Mobile: this.isMobile,
3936
3941
  swipped: (this.isMobile && this.swipping && this.progress > 0) || !this.isMobile,
3937
3942
  moved: this.progress > 0,
@@ -1,5 +1,6 @@
1
1
  import { EChallengeLevelTargetType, EChallengeProgressLevelStatus, EChallengeProgressStatus } from "./types";
2
2
  import { translate } from "./locale.utils";
3
+ import { formatProgress } from "./utils";
3
4
  import { h } from "@stencil/core";
4
5
  import lockIcon from "../assets/lock.svg";
5
6
  export const calculateTargetValue = (level, currencySymbol, language) => {
@@ -35,7 +36,7 @@ export const getLevelStatus = (status, level, activeChallenge, language) => {
35
36
  return (h("div", { class: "level__status" }, h("span", { class: "suspended" }, translate('suspended', language))));
36
37
  }
37
38
  else if (level.ProgressStatus === EChallengeProgressLevelStatus.InProgress && !activeChallenge)
38
- return (h("div", { class: "level__status" }, h("span", null, Math.floor(level.ProgressPercentage), "%"), h("img", { src: lockIcon, alt: "lock-icon", title: "lock-icon" })));
39
+ return (h("div", { class: "level__status" }, h("span", null, formatProgress(level.ProgressPercentage), "%"), h("img", { src: lockIcon, alt: "lock-icon", title: "lock-icon" })));
39
40
  else if (level.ProgressStatus === EChallengeProgressLevelStatus.Closed || !activeChallenge)
40
41
  return (h("div", { class: "level__status" }, h("img", { src: lockIcon, alt: "lock-icon", title: "lock-icon" })));
41
42
  else if (level.ProgressStatus === EChallengeProgressLevelStatus.Fillup)
@@ -43,7 +44,7 @@ export const getLevelStatus = (status, level, activeChallenge, language) => {
43
44
  else if (level.ProgressStatus === EChallengeProgressLevelStatus.Completed)
44
45
  return h("span", { class: "completed" }, translate('completed', language));
45
46
  else if (level.ProgressStatus === EChallengeProgressLevelStatus.InProgress)
46
- return h("span", { class: "level__status in-progress" }, Math.floor(level.ProgressPercentage), "%");
47
+ return h("span", { class: "level__status in-progress" }, formatProgress(level.ProgressPercentage), "%");
47
48
  else
48
49
  return null;
49
50
  };
@@ -27,6 +27,9 @@ export function formatNumber(num) {
27
27
  const rounded = Number(num).toFixed(2);
28
28
  return rounded.endsWith('.00') ? String(Math.round(num)) : rounded;
29
29
  }
30
+ export function formatProgress(progress) {
31
+ return String(Math.floor(progress * 10 + 1e-9) / 10); // no trailing ".0" (50, 50.5); the epsilon absorbs float error
32
+ }
30
33
  export const isMobile = () => {
31
34
  let userAgent = window.navigator.userAgent;
32
35
  return !!(userAgent.toLowerCase().match(/android/i) ||
@@ -2513,6 +2513,35 @@ var EPostMessageRequestType;
2513
2513
  EPostMessageRequestType["ChallengeInGameRedirect"] = "ChallengeInGameRedirect";
2514
2514
  })(EPostMessageRequestType || (EPostMessageRequestType = {}));
2515
2515
 
2516
+ function getTimeLeft$1(endTime) {
2517
+ const now = new Date();
2518
+ const end = new Date(endTime);
2519
+ let diff = end.getTime() - now.getTime();
2520
+ if (diff <= 0) {
2521
+ return;
2522
+ }
2523
+ const days = Math.floor(diff / (1000 * 60 * 60 * 24));
2524
+ diff -= days * (1000 * 60 * 60 * 24);
2525
+ const hours = Math.floor(diff / (1000 * 60 * 60));
2526
+ diff -= hours * (1000 * 60 * 60);
2527
+ const minutes = Math.floor(diff / (1000 * 60));
2528
+ diff -= minutes * (1000 * 60);
2529
+ const seconds = Math.floor(diff / 1000);
2530
+ const pad = (n) => n.toString().padStart(2, '0');
2531
+ return `${pad(days)} : ${pad(hours)} : ${pad(minutes)} : ${pad(seconds)}`;
2532
+ }
2533
+ function formatDate(dateToFormat) {
2534
+ const date = new Date(dateToFormat);
2535
+ return format(date, 'dd/MM/yyyy');
2536
+ }
2537
+ function formatNumber(num) {
2538
+ const rounded = Number(num).toFixed(2);
2539
+ return rounded.endsWith('.00') ? String(Math.round(num)) : rounded;
2540
+ }
2541
+ function formatProgress(progress) {
2542
+ return String(Math.floor(progress * 10 + 1e-9) / 10); // no trailing ".0" (50, 50.5); the epsilon absorbs float error
2543
+ }
2544
+
2516
2545
  const lockSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNCAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yLjUwMDQ5IDQuNUMyLjUwMDQ5IDIuMDE0NzIgNC41MTUyMSAwIDcuMDAwNDkgMEM5LjQ4NTc3IDAgMTEuNTAwNSAyLjAxNDcyIDExLjUwMDUgNC41VjUuMzYyNzRDMTEuNzEyNCA1LjQwOTE5IDExLjkxNTkgNS40NzY4MiAxMi4xMTI1IDUuNTc2OThDMTIuNjc2OSA1Ljg2NDYgMTMuMTM1OSA2LjMyMzU0IDEzLjQyMzUgNi44ODgwM0MxMy42MDkgNy4yNTIwMyAxMy42ODI5IDcuNjM5NTYgMTMuNzE3MyA4LjA2MTEzQzEzLjc1MDUgOC40NjcwMiAxMy43NTA1IDguOTY1MjkgMTMuNzUwNSA5LjU2OTAxVjEwLjY4MUMxMy43NTA1IDExLjI4NDcgMTMuNzUwNSAxMS43ODMgMTMuNzE3MyAxMi4xODg5QzEzLjY4MjkgMTIuNjEwNCAxMy42MDkgMTIuOTk4IDEzLjQyMzUgMTMuMzYyQzEzLjEzNTkgMTMuOTI2NSAxMi42NzY5IDE0LjM4NTQgMTIuM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MS4zMTQyIDYuODUzNzIgMTEuMTQ2IDYuODA1MDMgMTAuODE3MiA2Ljc3ODE2QzEwLjQ3OTYgNi43NTA1OCAxMC4wNDI5IDYuNzUgOS40MDA0OSA2Ljc1SDQuNjAwNDlDMy45NTgwNSA2Ljc1IDMuNTIxMzMgNi43NTA1OCAzLjE4Mzc3IDYuNzc4MTZaTTcuMDAwNDkgOC42MjVDNy40MTQ3IDguNjI1IDcuNzUwNDkgOC45NjA3OSA3Ljc1MDQ5IDkuMzc1VjEwLjg3NUM3Ljc1MDQ5IDExLjI4OTIgNy40MTQ3IDExLjYyNSA3LjAwMDQ5IDExLjYyNUM2LjU4NjI4IDExLjYyNSA2LjI1MDQ5IDExLjI4OTIgNi4yNTA0OSAxMC44NzVWOS4zNzVDNi4yNTA0OSA4Ljk2MDc5IDYuNTg2MjggOC42MjUgNy4wMDA0OSA4LjYyNVoiIGZpbGw9IiM3Mjc2NzIiLz4KPC9zdmc+Cg==';
2517
2546
 
2518
2547
  const calculateTargetValue = (level, currencySymbol, language) => {
@@ -2545,10 +2574,10 @@ const calculateTargetValue = (level, currencySymbol, language) => {
2545
2574
  };
2546
2575
  const getLevelStatus = (status, level, activeChallenge, language, fullPageView) => {
2547
2576
  if (status === EChallengeProgressStatus$1.Paused) {
2548
- return (h("div", { class: "level__status" }, h("span", { class: "suspended" }, translate$1('suspended', language)), fullPageView && h("span", { class: "suspended" }, Math.floor(level.ProgressPercentage), "%")));
2577
+ return (h("div", { class: "level__status" }, h("span", { class: "suspended" }, translate$1('suspended', language)), fullPageView && h("span", { class: "suspended" }, formatProgress(level.ProgressPercentage), "%")));
2549
2578
  }
2550
2579
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.InProgress && !activeChallenge)
2551
- return (h("div", { class: "level__status" }, h("span", null, Math.floor(level.ProgressPercentage), "%"), h("img", { src: lockSvg, alt: "lock-icon", title: "lock-icon" })));
2580
+ return (h("div", { class: "level__status" }, h("span", null, formatProgress(level.ProgressPercentage), "%"), h("img", { src: lockSvg, alt: "lock-icon", title: "lock-icon" })));
2552
2581
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.Closed || !activeChallenge)
2553
2582
  return (h("div", { class: "level__status" }, h("img", { src: lockSvg, alt: "lock-icon", title: "lock-icon" })));
2554
2583
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.Fillup)
@@ -2556,7 +2585,7 @@ const getLevelStatus = (status, level, activeChallenge, language, fullPageView)
2556
2585
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.Completed)
2557
2586
  return h("span", { class: "completed" }, translate$1('completed', language));
2558
2587
  else if (level.ProgressStatus === EChallengeProgressLevelStatus$1.InProgress)
2559
- return h("span", { class: "level__status in-progress" }, Math.floor(level.ProgressPercentage), "%");
2588
+ return h("span", { class: "level__status in-progress" }, formatProgress(level.ProgressPercentage), "%");
2560
2589
  else
2561
2590
  return null;
2562
2591
  };
@@ -2673,7 +2702,7 @@ const CasinoChallengeDetailsProgressBar = class {
2673
2702
  ? translate$1('suspended', this.language)
2674
2703
  : Status === EChallengeProgressStatus$1.Completed
2675
2704
  ? translate$1('finished', this.language)
2676
- : `${Math.floor(currLevel.ProgressPercentage)}%`;
2705
+ : `${formatProgress(currLevel.ProgressPercentage)}%`;
2677
2706
  const isLastLevel = !(LevelProgresses === null || LevelProgresses === void 0 ? void 0 : LevelProgresses.some((x) => x.OrderNumber > currLevel.OrderNumber));
2678
2707
  const secondImgSrc = ((Status === EChallengeProgressStatus$1.Completed || isLastLevel) && rewardGiftSvg) || '';
2679
2708
  return (h("div", { class: {
@@ -2694,7 +2723,7 @@ const CasinoChallengeDetailsProgressBar = class {
2694
2723
  } }, secondImgSrc ? h("img", { class: "progress__icon", src: secondImgSrc }) : currLevel.OrderNumber + 2)));
2695
2724
  }
2696
2725
  render() {
2697
- return h(Host, { key: '8f3de4c26bad9f23b9873469d004ae7cff048302' }, this.challengeProgress);
2726
+ return h(Host, { key: 'b067181be842544ea79410b345cbe1d494d0f833' }, this.challengeProgress);
2698
2727
  }
2699
2728
  };
2700
2729
  CasinoChallengeDetailsProgressBar.style = CasinoChallengeDetailsProgressBarStyle0;
@@ -3268,7 +3297,7 @@ const resolveTranslationUrl = async (translationUrl) => {
3268
3297
  }
3269
3298
  };
3270
3299
 
3271
- function getTimeLeft$1(endTime) {
3300
+ function getTimeLeft(endTime) {
3272
3301
  const now = new Date();
3273
3302
  const end = new Date(endTime);
3274
3303
  let diff = end.getTime() - now.getTime();
@@ -3338,7 +3367,7 @@ const CasinoChallengesOverlaySlider$1 = class {
3338
3367
  }
3339
3368
  updateTime() {
3340
3369
  var _a;
3341
- this.timeLeft = getTimeLeft$1((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
3370
+ this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
3342
3371
  if (!this.timeLeft) {
3343
3372
  clearInterval(this.timerId);
3344
3373
  this.challengeExpired.emit(this.challenge.Id);
@@ -3373,32 +3402,6 @@ const CasinoChallengesOverlaySlider$1 = class {
3373
3402
  };
3374
3403
  CasinoChallengesOverlaySlider$1.style = CasinoChallengesOverlayCardStyle0;
3375
3404
 
3376
- function getTimeLeft(endTime) {
3377
- const now = new Date();
3378
- const end = new Date(endTime);
3379
- let diff = end.getTime() - now.getTime();
3380
- if (diff <= 0) {
3381
- return;
3382
- }
3383
- const days = Math.floor(diff / (1000 * 60 * 60 * 24));
3384
- diff -= days * (1000 * 60 * 60 * 24);
3385
- const hours = Math.floor(diff / (1000 * 60 * 60));
3386
- diff -= hours * (1000 * 60 * 60);
3387
- const minutes = Math.floor(diff / (1000 * 60));
3388
- diff -= minutes * (1000 * 60);
3389
- const seconds = Math.floor(diff / 1000);
3390
- const pad = (n) => n.toString().padStart(2, '0');
3391
- return `${pad(days)} : ${pad(hours)} : ${pad(minutes)} : ${pad(seconds)}`;
3392
- }
3393
- function formatDate(dateToFormat) {
3394
- const date = new Date(dateToFormat);
3395
- return format(date, 'dd/MM/yyyy');
3396
- }
3397
- function formatNumber(num) {
3398
- const rounded = Number(num).toFixed(2);
3399
- return rounded.endsWith('.00') ? String(Math.round(num)) : rounded;
3400
- }
3401
-
3402
3405
  const MIN_DEPOSIT_AMOUNT = '0';
3403
3406
 
3404
3407
  const getDepositDescription = (challenge, language) => {
@@ -3535,7 +3538,7 @@ const CasinoChallengesOverlayDrawerDetails = class {
3535
3538
  this.updateTime = () => {
3536
3539
  var _a;
3537
3540
  if (this.challenge) {
3538
- this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
3541
+ this.timeLeft = getTimeLeft$1((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
3539
3542
  if (!this.timeLeft) {
3540
3543
  clearInterval(this.timerId);
3541
3544
  }
@@ -3881,11 +3884,13 @@ const CasinoChallengesOverlayDrawerDetails = class {
3881
3884
  });
3882
3885
  }
3883
3886
  renderGames() {
3884
- var _a, _b, _c, _d, _e;
3885
- if (!!((_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.Games) === null || _b === void 0 ? void 0 : _b.length) && ((_c = this.challenge) === null || _c === void 0 ? void 0 : _c.TotalGamesCount)) {
3886
- return (h("div", { class: { 'challenge-block': true, 'challenge-games': true } }, h("div", { class: "challenge-block-header" }, h("div", { class: "total-games" }, h("h3", null, translate$1('games', this.language)), h("span", null, "(", this.challenge.TotalGamesCount, ")")), h("button", { class: "row button", onClick: this.handleAllGamesClick }, h("p", null, translate$1('seeAll', this.language)), h("div", { class: "chevron-button" }, h("img", { src: chevronSvg })))), h("div", { class: "row games-row" }, (_e = (_d = this.challenge) === null || _d === void 0 ? void 0 : _d.Games) === null || _e === void 0 ? void 0 : _e.map((game) => (h("div", { class: "challenge-game", onClick: () => this.handleGameClick(game.GameSlug) }, h("img", { src: game.GameIcon })))))));
3887
+ if (!this.challenge)
3888
+ return null;
3889
+ const { ContributedFrom, Games, TotalGamesCount } = this.challenge;
3890
+ if (ContributedFrom === EContributedFrom.Sportsbook || !(Games === null || Games === void 0 ? void 0 : Games.length) || !TotalGamesCount) {
3891
+ return null;
3887
3892
  }
3888
- return null;
3893
+ return (h("div", { class: { 'challenge-block': true, 'challenge-games': true } }, h("div", { class: "challenge-block-header" }, h("div", { class: "total-games" }, h("h3", null, translate$1('games', this.language)), h("span", null, "(", TotalGamesCount, ")")), h("button", { class: "row button", onClick: this.handleAllGamesClick }, h("p", null, translate$1('seeAll', this.language)), h("div", { class: "chevron-button" }, h("img", { src: chevronSvg })))), h("div", { class: "row games-row" }, Games.map((game) => (h("div", { class: "challenge-game", onClick: () => this.handleGameClick(game.GameSlug) }, h("img", { src: game.GameIcon })))))));
3889
3894
  }
3890
3895
  renderRules() {
3891
3896
  var _a, _b, _c, _d;
@@ -3928,7 +3933,7 @@ const CasinoChallengesOverlayDrawerDetails = class {
3928
3933
  var _a, _b;
3929
3934
  const fullScreen = (this.swipping && this.progress > 0) || ((_a = this.detailsSubPageInfo) === null || _a === void 0 ? void 0 : _a.open);
3930
3935
  const footerIsVisible = !this.isMobile || (this.isMobile && fullScreen);
3931
- return (h("div", { key: 'a973e58403665544dbe1068760e63ff2e41b0c8a', class: {
3936
+ return (h("div", { key: '0beed74aabeaa6b3ac22919bcdf405fec48e20f7', class: {
3932
3937
  Mobile: this.isMobile,
3933
3938
  swipped: (this.isMobile && this.swipping && this.progress > 0) || !this.isMobile,
3934
3939
  moved: this.progress > 0,
@@ -3,5 +3,6 @@ export declare function format(first: string, middle: string, last: string): str
3
3
  export declare function getTimeLeft(endTime: string): string;
4
4
  export declare function formatDate(dateToFormat: any): string;
5
5
  export declare function formatNumber(num: any): string;
6
+ export declare function formatProgress(progress: number): string;
6
7
  export declare const isMobile: () => boolean;
7
8
  export declare const hasUpdateDataChanged: (prev: IUpdateChallengeProgressData, next: IUpdateChallengeProgressData) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-challenges-overlay-drawer",
3
- "version": "0.5.23",
3
+ "version": "0.5.24",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",