@everymatrix/casino-engagement-suite-challenges-list 1.36.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.
@@ -1 +1 @@
1
- import{p as e,b as l}from"./p-fad4589e.js";(()=>{const l=import.meta.url,n={};return""!==l&&(n.resourcesUrl=new URL(".",l).href),e(n)})().then((e=>l([["p-a9f41c83",[[1,"casino-engagement-suite-challenges-list",{clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],language:[1],device:[1],challenges:[1040],tooltip:[32],timers:[32],limitStylingAppends:[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{value:[2],disabled:[4],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],limitStylingAppends:[32]}]]]],e)));
1
+ import{p as e,b as n}from"./p-fad4589e.js";(()=>{const n=import.meta.url,l={};return""!==n&&(l.resourcesUrl=new URL(".",n).href),e(l)})().then((e=>n([["p-26d7de05",[[1,"casino-engagement-suite-challenges-list",{clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],language:[1],device:[1],challenges:[1040],isJoiningToChallenge:[1028,"is-joining-to-challenge"],inProgressChallenges:[1040],tooltip:[32],timers:[32],limitStylingAppends:[32],newChallengeIds:[32],pausedChallengeIds:[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{value:[2],disabled:[4],hidePercent:[4,"hide-percent"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],limitStylingAppends:[32]}]]]],e)));
@@ -0,0 +1 @@
1
+ import{r as e,c as t,h as s,g as o}from"./p-fad4589e.js";var n,i;!function(e){e[e.Closed=0]="Closed",e[e.InProgress=1]="InProgress",e[e.Fillup=2]="Fillup",e[e.Completed=3]="Completed"}(n||(n={})),function(e){e[e.Started=0]="Started",e[e.InProgress=1]="InProgress",e[e.PendingLevelReward=2]="PendingLevelReward",e[e.Completed=3]="Completed",e[e.Expired=4]="Expired"}(i||(i={}));const a=["en"],l={en:{challenges:"Challenges",join:"Join",unjoin:"Unjoin",new:"new",noChallenges:"No Challenges yet",tryOtherGames:"Try winning Challenges as rewards or launching other booster games",tooltip:"Competition where your real money bets contribute towards the level progress to achieve the level reward"}},r=(e,t)=>{const s=t;return l[void 0!==s&&a.includes(s)?s:"en"][e]};function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function g(e){p(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===h(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function d(e,t){return p(2,arguments),g(e).getTime()-g(t).getTime()}var c={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function u(e){return e?c[e]:c.trunc}const C=class{constructor(s){e(this,s),this.close=t(this,"close",7),this.clientStyling="",this.clientStylingUrl="",this.language="en",this.device="Mobile",this.challenges=[],this.tooltip=!1,this.timers={},this.limitStylingAppends=!1,this.newChallengeIds=[],this.pausedChallengeIds=[],this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.host.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.host.prepend(t)}),1)})).catch((e=>{console.log("Error ",e)}))},this.handleCloseClick=()=>{this.close.emit(),this.tooltip=!1,this.newChallengeIds=[]},this.handleChallengeClick=e=>{const t=+e.currentTarget.getAttribute("data-id");window.postMessage({type:"ChallengeClick",id:t}),this.newChallengeIds=this.newChallengeIds.filter((e=>e!==t))},this.showTooltip=()=>{this.tooltip=!0},this.hideTooltip=()=>{this.tooltip=!1},this.changeChallengeStatus=e=>{var t,s;e.stopPropagation();const o=+e.currentTarget.getAttribute("data-id");(null===(t=this.inProgressChallenges)||void 0===t?void 0:t.includes(o))?window.postMessage({type:"ShowConfirmationModal",ProgressToDeactivate:o}):(null===(s=this.inProgressChallenges)||void 0===s?void 0:s.length)>0?window.postMessage({type:"ShowConfirmationModal",ProgressToActivate:o,ProgressToDeactivate:this.inProgressChallenges[0]}):window.postMessage({type:"ChallengeJoinRequest",data:{ProgressToActivate:o}})}}challengesPropHandler(e){!this.interval&&e.length&&(this.updateTimers(),this.startCountdown()),this.interval&&!e.length&&clearInterval(this.interval)}handleEvent(e){switch(e.data.type){case"ChallengeGrant":{const t=e.data.data,s=this.challenges.findIndex((e=>function(e,t,s){p(2,arguments);var o=d(e,t)/1e3;return u(null==s?void 0:s.roundingMethod)(o)}(new Date(e.ExpirationTime),new Date(t.ExpirationTime))>0));s>-1?this.challenges.splice(s,0,t):this.challenges.unshift(t),this.challenges=[...this.challenges],this.newChallengeIds.push(t.Id),window.postMessage({type:"UpdateChallenges"});break}case"ChallengeChangeStatusNotification":{const t=e.data.data.ChallengeId;e.data.data.IsEnabled?this.pausedChallengeIds=this.pausedChallengeIds.filter((e=>e!==t)):this.pausedChallengeIds.push(t);break}}}componentWillLoad(){var e;this.challengesPropHandler(this.challenges),(null===(e=this.challenges)||void 0===e?void 0:e.length)&&(this.newChallengeIds=this.challenges.filter((e=>e.IsNew)).map((e=>e.Id)))}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}disconnectedCallback(){this.interval&&clearInterval(this.interval)}startCountdown(){this.interval=setInterval((()=>{this.updateTimers()}),1e3)}updateTimers(){const e=(new Date).getTime();this.timers=this.challenges.filter((e=>e.Status!==i.Expired)).reduce(((t,s)=>{const o=new Date(s.ExpirationTime).getTime()-e;let n="00h:00m:00s";if(o<1)this.removeChallenge(s.Id);else{const{days:e,hours:t,minutes:s,seconds:i}={days:String(Math.floor(o/864e5)).padStart(2,"0"),hours:String(Math.floor(o%864e5/36e5)).padStart(2,"0"),minutes:String(Math.floor(o%36e5/6e4)).padStart(2,"0"),seconds:String(Math.floor(o%6e4/1e3)).padStart(2,"0")};n="00"===e?`${t}h:${s}m:${i}s`:`${e}d:${t}h:${s}m`}return Object.assign(Object.assign({},t),{[s.Id]:n})}),{})}removeChallenge(e){const t=this.challenges.findIndex((t=>t.Id===e));t>-1&&(this.challenges.splice(t,1),window.postMessage({type:"ChallengeHasExpired",id:e}))}getChallengeClasses(e){return{ChallengeCard:!0,InProgress:e.Status===i.InProgress&&!this.pausedChallengeIds.includes(e.Id),Completed:this.isChallengeCompleted(e),Paused:this.isChallengePaused(e)}}isChallengePaused(e){return e.Status===i.Started&&e.LevelProgresses[0].ProgressPercentage>0||this.pausedChallengeIds.includes(e.Id)}isChallengeCompleted(e){return e.Status===i.Completed||e.Status===i.PendingLevelReward&&e.LevelProgresses.every((e=>100===e.ProgressPercentage))}getChallengeProgress(e){if(e.Status===i.Completed)return 100;if(this.isChallengePaused(e)||e.Status===i.PendingLevelReward||e.Status===i.InProgress){const t=e.LevelProgresses.find((e=>e.ProgressStatus===n.InProgress));return t?t.ProgressPercentage:0}return-1}getChallengeHeaderTemplate(e){const{Id:t}=e;return s("div",{class:"ChallengeCardHeader"},s("div",{class:"ChallengeName"},e.ChallengePresentation.PresentationName),s("button",{class:`${e.Status===i.InProgress?"ChallengeJoinButton Joined":"ChallengeJoinButton"} ${this.isJoiningToChallenge?"Disabled":""}`,onClick:this.changeChallengeStatus,"data-id":t},r(e.Status===i.InProgress?"unjoin":"join",this.language)))}getChallengeTemplate(e){const t=this.getChallengeProgress(e),o=this.timers[e.Id],n=this.newChallengeIds.includes(e.Id),i=t>-1?s("casino-engagement-suite-progress-bar",{class:this.device,value:t,disabled:this.isChallengePaused(e)},s("span",{slot:"Title",class:"ChallengeCountdown"},o)):s("span",{class:"ChallengeCountdown"},o);return s("div",{class:this.getChallengeClasses(e),onClick:this.handleChallengeClick,key:e.Id,"data-id":e.Id},this.getChallengeHeaderTemplate(e),i,s("div",{class:"ChallengeLabel "+(n?"ShowChallengeLabel":"")},s("span",null,r("new",this.language))))}getHeaderTemplate(){return s("header",{class:"ChallengesListPopupHeader"},s("button",{onClick:this.showTooltip,class:"ChallengesIconButton"},s("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/help.svg",alt:"Show tooltip"})),s("div",{class:"ChallengesListPopupHeaderName"},r("challenges",this.language)),s("button",{class:"ChallengesIconButton",onClick:this.handleCloseClick},s("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/close.svg",alt:"Close challenges list"})))}getListTemplate(){return this.challenges.length?s("div",{class:"ChallengesListWrapper"},s("div",{class:"ChallengesList"},this.challenges.map((e=>this.getChallengeTemplate(e))))):s("div",{class:"ChallengesListEmpty"},s("h2",null,r("noChallenges",this.language)),s("p",null,r("tryOtherGames",this.language)))}getTooltipTemplate(){return s("div",{class:"ChallengesTooltipBackdrop"},s("div",{class:"ChallengesTooltip"},s("button",{class:"ChallengesIconButton",onClick:this.hideTooltip},s("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/close.svg",alt:"Close tooltip"})),r("tooltip",this.language)))}render(){return s("div",{class:`ChallengesListPopup ${this.device}`},this.getHeaderTemplate(),this.getListTemplate(),this.tooltip&&this.getTooltipTemplate())}get host(){return o(this)}static get watchers(){return{challenges:["challengesPropHandler"]}}};C.style='@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}';const b=class{constructor(t){e(this,t),this.value=0,this.disabled=!1,this.hidePercent=!1,this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1,this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.host.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.host.prepend(t)}),1)})).catch((e=>{console.log("Error ",e)}))}}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}getProgressBarClasses(){return{ProgressBar:!0,Completed:100===this.value,Disabled:this.disabled,HidePercent:this.hidePercent}}render(){return s("div",{class:this.getProgressBarClasses(),part:"ProgressBar"},s("div",{class:"ProgressBarInfo",part:"ProgressBarInfo"},s("slot",{name:"Title"},s("div",null)),s("slot",{name:"Percent"},s("div",{class:"ProgressBarPercent",part:"ProgressBarPercent"},this.value,"%"))),s("div",{class:"ProgressBarBackground",part:"ProgressBarBackground"},s("div",{class:"ProgressBarLine",part:"ProgressBarLine",style:{width:this.value+"%"}})))}get host(){return o(this)}};b.style=":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";export{C as casino_engagement_suite_challenges_list,b as casino_engagement_suite_progress_bar}
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["casino-engagement-suite-challenges-list_2.cjs",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
18
+ return index.bootstrapLazy([["casino-engagement-suite-challenges-list_2.cjs",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"isJoiningToChallenge":[1028,"is-joining-to-challenge"],"inProgressChallenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32],"newChallengeIds":[32],"pausedChallengeIds":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"hidePercent":[4,"hide-percent"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
19
19
  });
@@ -27,6 +27,7 @@ const TRANSLATIONS = {
27
27
  challenges: 'Challenges',
28
28
  join: 'Join',
29
29
  unjoin: 'Unjoin',
30
+ new: 'new',
30
31
  noChallenges: 'No Challenges yet',
31
32
  tryOtherGames: 'Try winning Challenges as rewards or launching other booster games',
32
33
  tooltip: 'Competition where your real money bets contribute towards the level progress to achieve the level reward'
@@ -175,7 +176,7 @@ function differenceInSeconds(dateLeft, dateRight, options) {
175
176
  return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
176
177
  }
177
178
 
178
- const casinoEngagementSuiteChallengesListCss = "@import url(\"https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap\");:host{display:block;font-family:inherit}*{box-sizing:border-box;margin:0;padding:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.ChallengesListPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:8px;overflow:hidden;flex-direction:column;position:relative}.ChallengesListPopupHeader{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.ChallengesIconButton{width:16px;height:16px;cursor:pointer}.ChallengesListPopupHeaderName{color:var(--emw--color-gray-100, #BBB9C3);font-size:14px;font-weight:500;line-height:14px}.ChallengesListWrapper{overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.ChallengesListWrapper::-webkit-scrollbar{display:none}.ChallengesList{display:flex;flex-direction:column;row-gap:12px;padding:8px 19px 0}.ChallengeCard{padding:15px 15px 19px;border:1px solid var(--emw--button-border-color, #403956);border-radius:6px;position:relative;cursor:pointer}.ChallengeJoinButton.Joined::before,.ChallengeCard.InProgress::before{content:\"\";position:absolute;inset:0;border-radius:var(--emw--button-border-radius, 4px);padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeCardHeader{display:flex;justify-content:space-between;gap:24px;margin-bottom:12px}.ChallengeName{color:var(--emw--color-typography, #FFFFFF);font-family:\"Montserrat\", sans-serif;line-height:22px;font-weight:700;font-size:18px;word-break:break-word}.ChallengeJoinButton{transition:all 0.5s ease-out;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:var(--emw--color-typography, #1E1638);border-radius:99px;min-width:88px;height:32px;font-size:14px;font-weight:700;position:relative;font-family:\"Montserrat\", sans-serif}.ChallengeJoinButton.Joined{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ChallengeJoinButton.Joined::before{border-radius:99px}.ChallengesListEmpty{padding:20px 32px}.ChallengesListEmpty h2{margin:0 0 16px 0;text-align:center;font-weight:600;font-size:20px;line-height:24px;font-family:\"Montserrat\", sans-serif;color:var(--emw--color-typography, #FFFFFF)}.ChallengesListEmpty p{font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3)}.ChallengeCountdown{color:var(--emw--color-gray-100, #BBB9C3);font-size:12px;line-height:12px}.ChallengesTooltipBackdrop{padding:48px 30px 0;position:absolute;width:100%;height:100%;inset:0;background-color:rgba(0, 0, 0, 0.5)}.ChallengesTooltipBackdrop .ChallengesTooltip{border:1px solid var(--emw--button-border-color, #403956);background-color:var(--emw--color-background, #1E1638);border-radius:8px;padding:32px;font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3);position:relative}.ChallengesTooltipBackdrop .ChallengesTooltip .ChallengesIconButton{top:12px;right:6px;position:absolute}.ChallengesListPopup.Tablet .ChallengesListPopupHeader,.ChallengesListPopup.Desktop .ChallengesListPopupHeader{padding-top:16px}.ChallengesListPopup.Tablet .ChallengesListPopupHeaderName,.ChallengesListPopup.Desktop .ChallengesListPopupHeaderName{font-size:16px;line-height:16px}.ChallengesListPopup.Tablet .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesIconButton{width:24px;height:24px}.ChallengesListPopup.Tablet .ChallengesList,.ChallengesListPopup.Desktop .ChallengesList{padding:20px 24px 0;row-gap:20px}.ChallengesListPopup.Tablet .ChallengeCardHeader,.ChallengesListPopup.Desktop .ChallengeCardHeader{margin-bottom:16px}.ChallengesListPopup.Tablet .ChallengeName,.ChallengesListPopup.Desktop .ChallengeName{line-height:27px;font-size:22px}.ChallengesListPopup.Tablet .ChallengeJoinButton,.ChallengesListPopup.Desktop .ChallengeJoinButton{min-width:100px;height:36px;font-size:16px}.ChallengesListPopup.Tablet .ChallengeCountdown,.ChallengesListPopup.Desktop .ChallengeCountdown{font-size:14px;line-height:14px}.ChallengesListPopup.Tablet .ChallengesTooltip,.ChallengesListPopup.Desktop .ChallengesTooltip{padding:60px 65px;font-size:16px;line-height:20px}.ChallengesListPopup.Tablet .ChallengesTooltip .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesTooltip .ChallengesIconButton{top:24px;right:24px}";
179
+ 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}";
179
180
 
180
181
  const CasinoEngagementSuiteChallengesList = class {
181
182
  constructor(hostRef) {
@@ -204,6 +205,8 @@ const CasinoEngagementSuiteChallengesList = class {
204
205
  this.tooltip = false;
205
206
  this.timers = {};
206
207
  this.limitStylingAppends = false;
208
+ this.newChallengeIds = [];
209
+ this.pausedChallengeIds = [];
207
210
  this.setClientStyling = () => {
208
211
  let sheet = document.createElement('style');
209
212
  sheet.innerHTML = this.clientStyling;
@@ -225,10 +228,12 @@ const CasinoEngagementSuiteChallengesList = class {
225
228
  this.handleCloseClick = () => {
226
229
  this.close.emit();
227
230
  this.tooltip = false;
231
+ this.newChallengeIds = [];
228
232
  };
229
233
  this.handleChallengeClick = (ev) => {
230
234
  const id = +ev.currentTarget.getAttribute('data-id');
231
235
  window.postMessage({ type: 'ChallengeClick', id });
236
+ this.newChallengeIds = this.newChallengeIds.filter(item => item !== id);
232
237
  };
233
238
  this.showTooltip = () => {
234
239
  this.tooltip = true;
@@ -237,31 +242,28 @@ const CasinoEngagementSuiteChallengesList = class {
237
242
  this.tooltip = false;
238
243
  };
239
244
  this.changeChallengeStatus = (e) => {
245
+ var _a, _b;
240
246
  e.stopPropagation();
241
247
  const id = +e.currentTarget.getAttribute('data-id');
242
- const inProgressChallenges = this.challenges.filter(c => c.Status === ChallengeProgressStatus.InProgress).map(c => c.Id);
243
- if (inProgressChallenges.includes(id)) {
248
+ if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
244
249
  window.postMessage({
245
250
  type: 'ShowConfirmationModal',
246
- action: 'unjoin',
247
- id,
251
+ ProgressToDeactivate: id,
248
252
  });
249
253
  return;
250
254
  }
251
- if ((inProgressChallenges === null || inProgressChallenges === void 0 ? void 0 : inProgressChallenges.length) > 0) {
255
+ if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
252
256
  window.postMessage({
253
257
  type: 'ShowConfirmationModal',
254
- action: 'join',
255
- prevId: inProgressChallenges[0],
256
- id,
258
+ ProgressToActivate: id,
259
+ ProgressToDeactivate: this.inProgressChallenges[0],
257
260
  });
258
261
  return;
259
262
  }
260
263
  window.postMessage({
261
- type: 'ChallengeAttendance',
262
- confirmationData: {
263
- action: 'join',
264
- id,
264
+ type: 'ChallengeJoinRequest',
265
+ data: {
266
+ ProgressToActivate: id,
265
267
  },
266
268
  });
267
269
  };
@@ -276,19 +278,42 @@ const CasinoEngagementSuiteChallengesList = class {
276
278
  }
277
279
  }
278
280
  handleEvent(e) {
279
- const newChallenge = e.data.data;
280
- if (e.data.type === 'ChallengeGrant') {
281
- const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
282
- if (index > -1) {
283
- this.challenges.splice(index, 0, newChallenge);
281
+ const type = e.data.type;
282
+ switch (type) {
283
+ case 'ChallengeGrant': {
284
+ const newChallenge = e.data.data;
285
+ const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
286
+ if (index > -1) {
287
+ this.challenges.splice(index, 0, newChallenge);
288
+ }
289
+ else {
290
+ this.challenges.unshift(newChallenge);
291
+ }
292
+ this.challenges = [...this.challenges];
293
+ this.newChallengeIds.push(newChallenge.Id);
294
+ window.postMessage({ type: 'UpdateChallenges' });
295
+ break;
284
296
  }
285
- else {
286
- this.challenges.unshift(newChallenge);
297
+ case 'ChallengeChangeStatusNotification': {
298
+ const isEnabled = e.data.data.IsEnabled;
299
+ const id = e.data.data.ChallengeId;
300
+ if (!isEnabled) {
301
+ this.pausedChallengeIds.push(id);
302
+ }
303
+ else {
304
+ this.pausedChallengeIds = this.pausedChallengeIds.filter(c => c !== id);
305
+ }
306
+ break;
287
307
  }
288
308
  }
289
309
  }
290
310
  componentWillLoad() {
311
+ var _a;
291
312
  this.challengesPropHandler(this.challenges);
313
+ if ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.length) {
314
+ this.newChallengeIds = this.challenges.filter(challenge => challenge.IsNew)
315
+ .map(challenge => challenge.Id);
316
+ }
292
317
  }
293
318
  componentDidRender() {
294
319
  if (!this.limitStylingAppends && this.host) {
@@ -340,14 +365,16 @@ const CasinoEngagementSuiteChallengesList = class {
340
365
  getChallengeClasses(challenge) {
341
366
  return {
342
367
  ChallengeCard: true,
343
- InProgress: challenge.Status === ChallengeProgressStatus.InProgress,
368
+ InProgress: challenge.Status === ChallengeProgressStatus.InProgress
369
+ && !this.pausedChallengeIds.includes(challenge.Id),
344
370
  Completed: this.isChallengeCompleted(challenge),
345
371
  Paused: this.isChallengePaused(challenge)
346
372
  };
347
373
  }
348
374
  isChallengePaused(challenge) {
349
- return challenge.Status === ChallengeProgressStatus.Started
350
- && challenge.LevelProgresses[0].ProgressPercentage > 0;
375
+ return (challenge.Status === ChallengeProgressStatus.Started
376
+ && challenge.LevelProgresses[0].ProgressPercentage > 0)
377
+ || this.pausedChallengeIds.includes(challenge.Id);
351
378
  }
352
379
  isChallengeCompleted(challenge) {
353
380
  return challenge.Status === ChallengeProgressStatus.Completed
@@ -375,17 +402,19 @@ const CasinoEngagementSuiteChallengesList = class {
375
402
  }
376
403
  getChallengeHeaderTemplate(challenge) {
377
404
  const { Id } = challenge;
378
- return index.h("div", { class: "ChallengeCardHeader" }, index.h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), index.h("button", { class: challenge.Status === ChallengeProgressStatus.InProgress ? 'ChallengeJoinButton Joined' : 'ChallengeJoinButton', onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
405
+ return index.h("div", { class: "ChallengeCardHeader" }, index.h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), index.h("button", { class: `${challenge.Status === ChallengeProgressStatus.InProgress ?
406
+ 'ChallengeJoinButton Joined' : 'ChallengeJoinButton'} ${this.isJoiningToChallenge ? 'Disabled' : ''}`, onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
379
407
  ? translate('unjoin', this.language)
380
408
  : translate('join', this.language)));
381
409
  }
382
410
  getChallengeTemplate(challenge) {
383
411
  const challengeProgress = this.getChallengeProgress(challenge);
384
412
  const countdown = this.timers[challenge.Id];
413
+ const isNewChallenge = this.newChallengeIds.includes(challenge.Id);
385
414
  const progressTemplate = challengeProgress > -1
386
415
  ? index.h("casino-engagement-suite-progress-bar", { class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) }, index.h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
387
416
  : index.h("span", { class: "ChallengeCountdown" }, countdown);
388
- return (index.h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id }, this.getChallengeHeaderTemplate(challenge), progressTemplate));
417
+ return (index.h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id }, this.getChallengeHeaderTemplate(challenge), progressTemplate, index.h("div", { class: `ChallengeLabel ${isNewChallenge ? 'ShowChallengeLabel' : ''}` }, index.h("span", null, translate('new', this.language)))));
389
418
  }
390
419
  getHeaderTemplate() {
391
420
  return index.h("header", { class: "ChallengesListPopupHeader" }, index.h("button", { onClick: this.showTooltip, class: "ChallengesIconButton" }, index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg", alt: "Show tooltip" })), index.h("div", { class: "ChallengesListPopupHeaderName" }, translate('challenges', this.language)), index.h("button", { class: "ChallengesIconButton", onClick: this.handleCloseClick }, index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close challenges list" })));
@@ -399,15 +428,10 @@ const CasinoEngagementSuiteChallengesList = class {
399
428
  }
400
429
  }
401
430
  getTooltipTemplate() {
402
- if (this.tooltip) {
403
- return index.h("div", { class: "ChallengesTooltipBackdrop" }, index.h("div", { class: "ChallengesTooltip" }, index.h("button", { class: "ChallengesIconButton", onClick: this.hideTooltip }, index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })), translate('tooltip', this.language)));
404
- }
405
- else {
406
- return '';
407
- }
431
+ return index.h("div", { class: "ChallengesTooltipBackdrop" }, index.h("div", { class: "ChallengesTooltip" }, index.h("button", { class: "ChallengesIconButton", onClick: this.hideTooltip }, index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })), translate('tooltip', this.language)));
408
432
  }
409
433
  render() {
410
- return index.h("div", { class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.getTooltipTemplate());
434
+ return index.h("div", { class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.tooltip && this.getTooltipTemplate());
411
435
  }
412
436
  get host() { return index.getElement(this); }
413
437
  static get watchers() { return {
@@ -416,7 +440,7 @@ const CasinoEngagementSuiteChallengesList = class {
416
440
  };
417
441
  CasinoEngagementSuiteChallengesList.style = casinoEngagementSuiteChallengesListCss;
418
442
 
419
- const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
443
+ const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
420
444
 
421
445
  const CasinoEngagementSuiteProgressBar = class {
422
446
  constructor(hostRef) {
@@ -429,6 +453,10 @@ const CasinoEngagementSuiteProgressBar = class {
429
453
  * Shows disabled styles
430
454
  */
431
455
  this.disabled = false;
456
+ /**
457
+ * Hide percent value
458
+ */
459
+ this.hidePercent = false;
432
460
  /**
433
461
  * Client custom styling via string
434
462
  */
@@ -470,7 +498,8 @@ const CasinoEngagementSuiteProgressBar = class {
470
498
  return {
471
499
  ProgressBar: true,
472
500
  Completed: this.value === 100,
473
- Disabled: this.disabled
501
+ Disabled: this.disabled,
502
+ HidePercent: this.hidePercent
474
503
  };
475
504
  }
476
505
  render() {
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["casino-engagement-suite-challenges-list_2.cjs",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
17
+ return index.bootstrapLazy([["casino-engagement-suite-challenges-list_2.cjs",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"isJoiningToChallenge":[1028,"is-joining-to-challenge"],"inProgressChallenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32],"newChallengeIds":[32],"pausedChallengeIds":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"hidePercent":[4,"hide-percent"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -124,6 +124,12 @@ button:focus {
124
124
  border-radius: 99px;
125
125
  }
126
126
 
127
+ .Disabled {
128
+ opacity: 0.5;
129
+ pointer-events: none;
130
+ cursor: auto;
131
+ }
132
+
127
133
  .ChallengesListEmpty {
128
134
  padding: 20px 32px;
129
135
  }
@@ -150,6 +156,33 @@ button:focus {
150
156
  line-height: 12px;
151
157
  }
152
158
 
159
+ .ChallengeLabel {
160
+ min-width: 35px;
161
+ height: 18px;
162
+ background: linear-gradient(180deg, #FFB801 15.86%, #FEF746 31.36%, #FBFFE0 36.86%, #FFFA60 47.86%, #FF9400 87.36%);
163
+ border-radius: 2px;
164
+ display: none;
165
+ position: absolute;
166
+ top: -11px;
167
+ right: 11px;
168
+ padding: 0 2px;
169
+ align-items: center;
170
+ justify-content: center;
171
+ }
172
+ .ChallengeLabel span {
173
+ display: inline-block;
174
+ text-transform: uppercase;
175
+ font-size: 10px;
176
+ line-height: 10px;
177
+ font-weight: 700;
178
+ font-family: "Montserrat", sans-serif;
179
+ color: var(--emw--color-typography, #1E1638);
180
+ }
181
+
182
+ .ShowChallengeLabel {
183
+ display: inline-flex;
184
+ }
185
+
153
186
  .ChallengesTooltipBackdrop {
154
187
  padding: 48px 30px 0;
155
188
  position: absolute;
@@ -28,6 +28,8 @@ export class CasinoEngagementSuiteChallengesList {
28
28
  this.tooltip = false;
29
29
  this.timers = {};
30
30
  this.limitStylingAppends = false;
31
+ this.newChallengeIds = [];
32
+ this.pausedChallengeIds = [];
31
33
  this.setClientStyling = () => {
32
34
  let sheet = document.createElement('style');
33
35
  sheet.innerHTML = this.clientStyling;
@@ -49,10 +51,12 @@ export class CasinoEngagementSuiteChallengesList {
49
51
  this.handleCloseClick = () => {
50
52
  this.close.emit();
51
53
  this.tooltip = false;
54
+ this.newChallengeIds = [];
52
55
  };
53
56
  this.handleChallengeClick = (ev) => {
54
57
  const id = +ev.currentTarget.getAttribute('data-id');
55
58
  window.postMessage({ type: 'ChallengeClick', id });
59
+ this.newChallengeIds = this.newChallengeIds.filter(item => item !== id);
56
60
  };
57
61
  this.showTooltip = () => {
58
62
  this.tooltip = true;
@@ -61,31 +65,28 @@ export class CasinoEngagementSuiteChallengesList {
61
65
  this.tooltip = false;
62
66
  };
63
67
  this.changeChallengeStatus = (e) => {
68
+ var _a, _b;
64
69
  e.stopPropagation();
65
70
  const id = +e.currentTarget.getAttribute('data-id');
66
- const inProgressChallenges = this.challenges.filter(c => c.Status === ChallengeProgressStatus.InProgress).map(c => c.Id);
67
- if (inProgressChallenges.includes(id)) {
71
+ if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
68
72
  window.postMessage({
69
73
  type: 'ShowConfirmationModal',
70
- action: 'unjoin',
71
- id,
74
+ ProgressToDeactivate: id,
72
75
  });
73
76
  return;
74
77
  }
75
- if ((inProgressChallenges === null || inProgressChallenges === void 0 ? void 0 : inProgressChallenges.length) > 0) {
78
+ if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
76
79
  window.postMessage({
77
80
  type: 'ShowConfirmationModal',
78
- action: 'join',
79
- prevId: inProgressChallenges[0],
80
- id,
81
+ ProgressToActivate: id,
82
+ ProgressToDeactivate: this.inProgressChallenges[0],
81
83
  });
82
84
  return;
83
85
  }
84
86
  window.postMessage({
85
- type: 'ChallengeAttendance',
86
- confirmationData: {
87
- action: 'join',
88
- id,
87
+ type: 'ChallengeJoinRequest',
88
+ data: {
89
+ ProgressToActivate: id,
89
90
  },
90
91
  });
91
92
  };
@@ -100,19 +101,42 @@ export class CasinoEngagementSuiteChallengesList {
100
101
  }
101
102
  }
102
103
  handleEvent(e) {
103
- const newChallenge = e.data.data;
104
- if (e.data.type === 'ChallengeGrant') {
105
- const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
106
- if (index > -1) {
107
- this.challenges.splice(index, 0, newChallenge);
104
+ const type = e.data.type;
105
+ switch (type) {
106
+ case 'ChallengeGrant': {
107
+ const newChallenge = e.data.data;
108
+ const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
109
+ if (index > -1) {
110
+ this.challenges.splice(index, 0, newChallenge);
111
+ }
112
+ else {
113
+ this.challenges.unshift(newChallenge);
114
+ }
115
+ this.challenges = [...this.challenges];
116
+ this.newChallengeIds.push(newChallenge.Id);
117
+ window.postMessage({ type: 'UpdateChallenges' });
118
+ break;
108
119
  }
109
- else {
110
- this.challenges.unshift(newChallenge);
120
+ case 'ChallengeChangeStatusNotification': {
121
+ const isEnabled = e.data.data.IsEnabled;
122
+ const id = e.data.data.ChallengeId;
123
+ if (!isEnabled) {
124
+ this.pausedChallengeIds.push(id);
125
+ }
126
+ else {
127
+ this.pausedChallengeIds = this.pausedChallengeIds.filter(c => c !== id);
128
+ }
129
+ break;
111
130
  }
112
131
  }
113
132
  }
114
133
  componentWillLoad() {
134
+ var _a;
115
135
  this.challengesPropHandler(this.challenges);
136
+ if ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.length) {
137
+ this.newChallengeIds = this.challenges.filter(challenge => challenge.IsNew)
138
+ .map(challenge => challenge.Id);
139
+ }
116
140
  }
117
141
  componentDidRender() {
118
142
  if (!this.limitStylingAppends && this.host) {
@@ -164,14 +188,16 @@ export class CasinoEngagementSuiteChallengesList {
164
188
  getChallengeClasses(challenge) {
165
189
  return {
166
190
  ChallengeCard: true,
167
- InProgress: challenge.Status === ChallengeProgressStatus.InProgress,
191
+ InProgress: challenge.Status === ChallengeProgressStatus.InProgress
192
+ && !this.pausedChallengeIds.includes(challenge.Id),
168
193
  Completed: this.isChallengeCompleted(challenge),
169
194
  Paused: this.isChallengePaused(challenge)
170
195
  };
171
196
  }
172
197
  isChallengePaused(challenge) {
173
- return challenge.Status === ChallengeProgressStatus.Started
174
- && challenge.LevelProgresses[0].ProgressPercentage > 0;
198
+ return (challenge.Status === ChallengeProgressStatus.Started
199
+ && challenge.LevelProgresses[0].ProgressPercentage > 0)
200
+ || this.pausedChallengeIds.includes(challenge.Id);
175
201
  }
176
202
  isChallengeCompleted(challenge) {
177
203
  return challenge.Status === ChallengeProgressStatus.Completed
@@ -201,20 +227,24 @@ export class CasinoEngagementSuiteChallengesList {
201
227
  const { Id } = challenge;
202
228
  return h("div", { class: "ChallengeCardHeader" },
203
229
  h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName),
204
- h("button", { class: challenge.Status === ChallengeProgressStatus.InProgress ? 'ChallengeJoinButton Joined' : 'ChallengeJoinButton', onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
230
+ h("button", { class: `${challenge.Status === ChallengeProgressStatus.InProgress ?
231
+ 'ChallengeJoinButton Joined' : 'ChallengeJoinButton'} ${this.isJoiningToChallenge ? 'Disabled' : ''}`, onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
205
232
  ? translate('unjoin', this.language)
206
233
  : translate('join', this.language)));
207
234
  }
208
235
  getChallengeTemplate(challenge) {
209
236
  const challengeProgress = this.getChallengeProgress(challenge);
210
237
  const countdown = this.timers[challenge.Id];
238
+ const isNewChallenge = this.newChallengeIds.includes(challenge.Id);
211
239
  const progressTemplate = challengeProgress > -1
212
240
  ? h("casino-engagement-suite-progress-bar", { class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) },
213
241
  h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
214
242
  : h("span", { class: "ChallengeCountdown" }, countdown);
215
243
  return (h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id },
216
244
  this.getChallengeHeaderTemplate(challenge),
217
- progressTemplate));
245
+ progressTemplate,
246
+ h("div", { class: `ChallengeLabel ${isNewChallenge ? 'ShowChallengeLabel' : ''}` },
247
+ h("span", null, translate('new', this.language)))));
218
248
  }
219
249
  getHeaderTemplate() {
220
250
  return h("header", { class: "ChallengesListPopupHeader" },
@@ -236,22 +266,17 @@ export class CasinoEngagementSuiteChallengesList {
236
266
  }
237
267
  }
238
268
  getTooltipTemplate() {
239
- if (this.tooltip) {
240
- return h("div", { class: "ChallengesTooltipBackdrop" },
241
- h("div", { class: "ChallengesTooltip" },
242
- h("button", { class: "ChallengesIconButton", onClick: this.hideTooltip },
243
- h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })),
244
- translate('tooltip', this.language)));
245
- }
246
- else {
247
- return '';
248
- }
269
+ return h("div", { class: "ChallengesTooltipBackdrop" },
270
+ h("div", { class: "ChallengesTooltip" },
271
+ h("button", { class: "ChallengesIconButton", onClick: this.hideTooltip },
272
+ h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })),
273
+ translate('tooltip', this.language)));
249
274
  }
250
275
  render() {
251
276
  return h("div", { class: `ChallengesListPopup ${this.device}` },
252
277
  this.getHeaderTemplate(),
253
278
  this.getListTemplate(),
254
- this.getTooltipTemplate());
279
+ this.tooltip && this.getTooltipTemplate());
255
280
  }
256
281
  static get is() { return "casino-engagement-suite-challenges-list"; }
257
282
  static get encapsulation() { return "shadow"; }
@@ -357,12 +382,50 @@ export class CasinoEngagementSuiteChallengesList {
357
382
  "text": "List of challenges"
358
383
  },
359
384
  "defaultValue": "[] as Array<Challenge>"
385
+ },
386
+ "isJoiningToChallenge": {
387
+ "type": "boolean",
388
+ "mutable": true,
389
+ "complexType": {
390
+ "original": "boolean",
391
+ "resolved": "boolean",
392
+ "references": {}
393
+ },
394
+ "required": false,
395
+ "optional": false,
396
+ "docs": {
397
+ "tags": [],
398
+ "text": "Is joining to challenge"
399
+ },
400
+ "attribute": "is-joining-to-challenge",
401
+ "reflect": false
402
+ },
403
+ "inProgressChallenges": {
404
+ "type": "unknown",
405
+ "mutable": true,
406
+ "complexType": {
407
+ "original": "Array<number>",
408
+ "resolved": "number[]",
409
+ "references": {
410
+ "Array": {
411
+ "location": "global"
412
+ }
413
+ }
414
+ },
415
+ "required": false,
416
+ "optional": false,
417
+ "docs": {
418
+ "tags": [],
419
+ "text": "Active challenges"
420
+ }
360
421
  }
361
422
  }; }
362
423
  static get states() { return {
363
424
  "tooltip": {},
364
425
  "timers": {},
365
- "limitStylingAppends": {}
426
+ "limitStylingAppends": {},
427
+ "newChallengeIds": {},
428
+ "pausedChallengeIds": {}
366
429
  }; }
367
430
  static get events() { return [{
368
431
  "method": "close",
@@ -5,6 +5,7 @@ const TRANSLATIONS = {
5
5
  challenges: 'Challenges',
6
6
  join: 'Join',
7
7
  unjoin: 'Unjoin',
8
+ new: 'new',
8
9
  noChallenges: 'No Challenges yet',
9
10
  tryOtherGames: 'Try winning Challenges as rewards or launching other booster games',
10
11
  tooltip: 'Competition where your real money bets contribute towards the level progress to achieve the level reward'
@@ -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'
@@ -172,7 +173,7 @@ function differenceInSeconds(dateLeft, dateRight, options) {
172
173
  return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
173
174
  }
174
175
 
175
- const casinoEngagementSuiteChallengesListCss = "@import url(\"https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap\");:host{display:block;font-family:inherit}*{box-sizing:border-box;margin:0;padding:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.ChallengesListPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:8px;overflow:hidden;flex-direction:column;position:relative}.ChallengesListPopupHeader{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.ChallengesIconButton{width:16px;height:16px;cursor:pointer}.ChallengesListPopupHeaderName{color:var(--emw--color-gray-100, #BBB9C3);font-size:14px;font-weight:500;line-height:14px}.ChallengesListWrapper{overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.ChallengesListWrapper::-webkit-scrollbar{display:none}.ChallengesList{display:flex;flex-direction:column;row-gap:12px;padding:8px 19px 0}.ChallengeCard{padding:15px 15px 19px;border:1px solid var(--emw--button-border-color, #403956);border-radius:6px;position:relative;cursor:pointer}.ChallengeJoinButton.Joined::before,.ChallengeCard.InProgress::before{content:\"\";position:absolute;inset:0;border-radius:var(--emw--button-border-radius, 4px);padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeCardHeader{display:flex;justify-content:space-between;gap:24px;margin-bottom:12px}.ChallengeName{color:var(--emw--color-typography, #FFFFFF);font-family:\"Montserrat\", sans-serif;line-height:22px;font-weight:700;font-size:18px;word-break:break-word}.ChallengeJoinButton{transition:all 0.5s ease-out;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:var(--emw--color-typography, #1E1638);border-radius:99px;min-width:88px;height:32px;font-size:14px;font-weight:700;position:relative;font-family:\"Montserrat\", sans-serif}.ChallengeJoinButton.Joined{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ChallengeJoinButton.Joined::before{border-radius:99px}.ChallengesListEmpty{padding:20px 32px}.ChallengesListEmpty h2{margin:0 0 16px 0;text-align:center;font-weight:600;font-size:20px;line-height:24px;font-family:\"Montserrat\", sans-serif;color:var(--emw--color-typography, #FFFFFF)}.ChallengesListEmpty p{font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3)}.ChallengeCountdown{color:var(--emw--color-gray-100, #BBB9C3);font-size:12px;line-height:12px}.ChallengesTooltipBackdrop{padding:48px 30px 0;position:absolute;width:100%;height:100%;inset:0;background-color:rgba(0, 0, 0, 0.5)}.ChallengesTooltipBackdrop .ChallengesTooltip{border:1px solid var(--emw--button-border-color, #403956);background-color:var(--emw--color-background, #1E1638);border-radius:8px;padding:32px;font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3);position:relative}.ChallengesTooltipBackdrop .ChallengesTooltip .ChallengesIconButton{top:12px;right:6px;position:absolute}.ChallengesListPopup.Tablet .ChallengesListPopupHeader,.ChallengesListPopup.Desktop .ChallengesListPopupHeader{padding-top:16px}.ChallengesListPopup.Tablet .ChallengesListPopupHeaderName,.ChallengesListPopup.Desktop .ChallengesListPopupHeaderName{font-size:16px;line-height:16px}.ChallengesListPopup.Tablet .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesIconButton{width:24px;height:24px}.ChallengesListPopup.Tablet .ChallengesList,.ChallengesListPopup.Desktop .ChallengesList{padding:20px 24px 0;row-gap:20px}.ChallengesListPopup.Tablet .ChallengeCardHeader,.ChallengesListPopup.Desktop .ChallengeCardHeader{margin-bottom:16px}.ChallengesListPopup.Tablet .ChallengeName,.ChallengesListPopup.Desktop .ChallengeName{line-height:27px;font-size:22px}.ChallengesListPopup.Tablet .ChallengeJoinButton,.ChallengesListPopup.Desktop .ChallengeJoinButton{min-width:100px;height:36px;font-size:16px}.ChallengesListPopup.Tablet .ChallengeCountdown,.ChallengesListPopup.Desktop .ChallengeCountdown{font-size:14px;line-height:14px}.ChallengesListPopup.Tablet .ChallengesTooltip,.ChallengesListPopup.Desktop .ChallengesTooltip{padding:60px 65px;font-size:16px;line-height:20px}.ChallengesListPopup.Tablet .ChallengesTooltip .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesTooltip .ChallengesIconButton{top:24px;right:24px}";
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}";
176
177
 
177
178
  const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
178
179
  constructor() {
@@ -203,6 +204,8 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
203
204
  this.tooltip = false;
204
205
  this.timers = {};
205
206
  this.limitStylingAppends = false;
207
+ this.newChallengeIds = [];
208
+ this.pausedChallengeIds = [];
206
209
  this.setClientStyling = () => {
207
210
  let sheet = document.createElement('style');
208
211
  sheet.innerHTML = this.clientStyling;
@@ -224,10 +227,12 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
224
227
  this.handleCloseClick = () => {
225
228
  this.close.emit();
226
229
  this.tooltip = false;
230
+ this.newChallengeIds = [];
227
231
  };
228
232
  this.handleChallengeClick = (ev) => {
229
233
  const id = +ev.currentTarget.getAttribute('data-id');
230
234
  window.postMessage({ type: 'ChallengeClick', id });
235
+ this.newChallengeIds = this.newChallengeIds.filter(item => item !== id);
231
236
  };
232
237
  this.showTooltip = () => {
233
238
  this.tooltip = true;
@@ -236,31 +241,28 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
236
241
  this.tooltip = false;
237
242
  };
238
243
  this.changeChallengeStatus = (e) => {
244
+ var _a, _b;
239
245
  e.stopPropagation();
240
246
  const id = +e.currentTarget.getAttribute('data-id');
241
- const inProgressChallenges = this.challenges.filter(c => c.Status === ChallengeProgressStatus.InProgress).map(c => c.Id);
242
- if (inProgressChallenges.includes(id)) {
247
+ if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
243
248
  window.postMessage({
244
249
  type: 'ShowConfirmationModal',
245
- action: 'unjoin',
246
- id,
250
+ ProgressToDeactivate: id,
247
251
  });
248
252
  return;
249
253
  }
250
- if ((inProgressChallenges === null || inProgressChallenges === void 0 ? void 0 : inProgressChallenges.length) > 0) {
254
+ if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
251
255
  window.postMessage({
252
256
  type: 'ShowConfirmationModal',
253
- action: 'join',
254
- prevId: inProgressChallenges[0],
255
- id,
257
+ ProgressToActivate: id,
258
+ ProgressToDeactivate: this.inProgressChallenges[0],
256
259
  });
257
260
  return;
258
261
  }
259
262
  window.postMessage({
260
- type: 'ChallengeAttendance',
261
- confirmationData: {
262
- action: 'join',
263
- id,
263
+ type: 'ChallengeJoinRequest',
264
+ data: {
265
+ ProgressToActivate: id,
264
266
  },
265
267
  });
266
268
  };
@@ -275,19 +277,42 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
275
277
  }
276
278
  }
277
279
  handleEvent(e) {
278
- const newChallenge = e.data.data;
279
- if (e.data.type === 'ChallengeGrant') {
280
- const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
281
- if (index > -1) {
282
- 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;
283
295
  }
284
- else {
285
- 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;
286
306
  }
287
307
  }
288
308
  }
289
309
  componentWillLoad() {
310
+ var _a;
290
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
+ }
291
316
  }
292
317
  componentDidRender() {
293
318
  if (!this.limitStylingAppends && this.host) {
@@ -339,14 +364,16 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
339
364
  getChallengeClasses(challenge) {
340
365
  return {
341
366
  ChallengeCard: true,
342
- InProgress: challenge.Status === ChallengeProgressStatus.InProgress,
367
+ InProgress: challenge.Status === ChallengeProgressStatus.InProgress
368
+ && !this.pausedChallengeIds.includes(challenge.Id),
343
369
  Completed: this.isChallengeCompleted(challenge),
344
370
  Paused: this.isChallengePaused(challenge)
345
371
  };
346
372
  }
347
373
  isChallengePaused(challenge) {
348
- return challenge.Status === ChallengeProgressStatus.Started
349
- && challenge.LevelProgresses[0].ProgressPercentage > 0;
374
+ return (challenge.Status === ChallengeProgressStatus.Started
375
+ && challenge.LevelProgresses[0].ProgressPercentage > 0)
376
+ || this.pausedChallengeIds.includes(challenge.Id);
350
377
  }
351
378
  isChallengeCompleted(challenge) {
352
379
  return challenge.Status === ChallengeProgressStatus.Completed
@@ -374,17 +401,19 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
374
401
  }
375
402
  getChallengeHeaderTemplate(challenge) {
376
403
  const { Id } = challenge;
377
- return h("div", { class: "ChallengeCardHeader" }, h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), h("button", { class: challenge.Status === ChallengeProgressStatus.InProgress ? 'ChallengeJoinButton Joined' : 'ChallengeJoinButton', onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
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
378
406
  ? translate('unjoin', this.language)
379
407
  : translate('join', this.language)));
380
408
  }
381
409
  getChallengeTemplate(challenge) {
382
410
  const challengeProgress = this.getChallengeProgress(challenge);
383
411
  const countdown = this.timers[challenge.Id];
412
+ const isNewChallenge = this.newChallengeIds.includes(challenge.Id);
384
413
  const progressTemplate = challengeProgress > -1
385
414
  ? h("casino-engagement-suite-progress-bar", { class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) }, h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
386
415
  : h("span", { class: "ChallengeCountdown" }, countdown);
387
- 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)))));
388
417
  }
389
418
  getHeaderTemplate() {
390
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" })));
@@ -398,15 +427,10 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
398
427
  }
399
428
  }
400
429
  getTooltipTemplate() {
401
- if (this.tooltip) {
402
- 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)));
403
- }
404
- else {
405
- return '';
406
- }
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)));
407
431
  }
408
432
  render() {
409
- 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());
410
434
  }
411
435
  get host() { return this; }
412
436
  static get watchers() { return {
@@ -419,9 +443,13 @@ const CasinoEngagementSuiteChallengesList$1 = /*@__PURE__*/ proxyCustomElement(c
419
443
  "language": [1],
420
444
  "device": [1],
421
445
  "challenges": [1040],
446
+ "isJoiningToChallenge": [1028, "is-joining-to-challenge"],
447
+ "inProgressChallenges": [1040],
422
448
  "tooltip": [32],
423
449
  "timers": [32],
424
- "limitStylingAppends": [32]
450
+ "limitStylingAppends": [32],
451
+ "newChallengeIds": [32],
452
+ "pausedChallengeIds": [32]
425
453
  }, [[8, "message", "handleEvent"]]]);
426
454
  function defineCustomElement$1() {
427
455
  if (typeof customElements === "undefined") {
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
 
3
- const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
3
+ const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
4
4
 
5
5
  const CasinoEngagementSuiteProgressBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
6
  constructor() {
@@ -15,6 +15,10 @@ const CasinoEngagementSuiteProgressBar = /*@__PURE__*/ proxyCustomElement(class
15
15
  * Shows disabled styles
16
16
  */
17
17
  this.disabled = false;
18
+ /**
19
+ * Hide percent value
20
+ */
21
+ this.hidePercent = false;
18
22
  /**
19
23
  * Client custom styling via string
20
24
  */
@@ -56,7 +60,8 @@ const CasinoEngagementSuiteProgressBar = /*@__PURE__*/ proxyCustomElement(class
56
60
  return {
57
61
  ProgressBar: true,
58
62
  Completed: this.value === 100,
59
- Disabled: this.disabled
63
+ Disabled: this.disabled,
64
+ HidePercent: this.hidePercent
60
65
  };
61
66
  }
62
67
  render() {
@@ -67,6 +72,7 @@ const CasinoEngagementSuiteProgressBar = /*@__PURE__*/ proxyCustomElement(class
67
72
  }, [1, "casino-engagement-suite-progress-bar", {
68
73
  "value": [2],
69
74
  "disabled": [4],
75
+ "hidePercent": [4, "hide-percent"],
70
76
  "clientStyling": [513, "client-styling"],
71
77
  "clientStylingUrl": [513, "client-styling-url"],
72
78
  "limitStylingAppends": [32]
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["casino-engagement-suite-challenges-list_2",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
16
+ return bootstrapLazy([["casino-engagement-suite-challenges-list_2",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"isJoiningToChallenge":[1028,"is-joining-to-challenge"],"inProgressChallenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32],"newChallengeIds":[32],"pausedChallengeIds":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"hidePercent":[4,"hide-percent"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
17
17
  });
@@ -23,6 +23,7 @@ const TRANSLATIONS = {
23
23
  challenges: 'Challenges',
24
24
  join: 'Join',
25
25
  unjoin: 'Unjoin',
26
+ new: 'new',
26
27
  noChallenges: 'No Challenges yet',
27
28
  tryOtherGames: 'Try winning Challenges as rewards or launching other booster games',
28
29
  tooltip: 'Competition where your real money bets contribute towards the level progress to achieve the level reward'
@@ -171,7 +172,7 @@ function differenceInSeconds(dateLeft, dateRight, options) {
171
172
  return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
172
173
  }
173
174
 
174
- const casinoEngagementSuiteChallengesListCss = "@import url(\"https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap\");:host{display:block;font-family:inherit}*{box-sizing:border-box;margin:0;padding:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.ChallengesListPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:8px;overflow:hidden;flex-direction:column;position:relative}.ChallengesListPopupHeader{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.ChallengesIconButton{width:16px;height:16px;cursor:pointer}.ChallengesListPopupHeaderName{color:var(--emw--color-gray-100, #BBB9C3);font-size:14px;font-weight:500;line-height:14px}.ChallengesListWrapper{overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.ChallengesListWrapper::-webkit-scrollbar{display:none}.ChallengesList{display:flex;flex-direction:column;row-gap:12px;padding:8px 19px 0}.ChallengeCard{padding:15px 15px 19px;border:1px solid var(--emw--button-border-color, #403956);border-radius:6px;position:relative;cursor:pointer}.ChallengeJoinButton.Joined::before,.ChallengeCard.InProgress::before{content:\"\";position:absolute;inset:0;border-radius:var(--emw--button-border-radius, 4px);padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeCardHeader{display:flex;justify-content:space-between;gap:24px;margin-bottom:12px}.ChallengeName{color:var(--emw--color-typography, #FFFFFF);font-family:\"Montserrat\", sans-serif;line-height:22px;font-weight:700;font-size:18px;word-break:break-word}.ChallengeJoinButton{transition:all 0.5s ease-out;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:var(--emw--color-typography, #1E1638);border-radius:99px;min-width:88px;height:32px;font-size:14px;font-weight:700;position:relative;font-family:\"Montserrat\", sans-serif}.ChallengeJoinButton.Joined{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ChallengeJoinButton.Joined::before{border-radius:99px}.ChallengesListEmpty{padding:20px 32px}.ChallengesListEmpty h2{margin:0 0 16px 0;text-align:center;font-weight:600;font-size:20px;line-height:24px;font-family:\"Montserrat\", sans-serif;color:var(--emw--color-typography, #FFFFFF)}.ChallengesListEmpty p{font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3)}.ChallengeCountdown{color:var(--emw--color-gray-100, #BBB9C3);font-size:12px;line-height:12px}.ChallengesTooltipBackdrop{padding:48px 30px 0;position:absolute;width:100%;height:100%;inset:0;background-color:rgba(0, 0, 0, 0.5)}.ChallengesTooltipBackdrop .ChallengesTooltip{border:1px solid var(--emw--button-border-color, #403956);background-color:var(--emw--color-background, #1E1638);border-radius:8px;padding:32px;font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3);position:relative}.ChallengesTooltipBackdrop .ChallengesTooltip .ChallengesIconButton{top:12px;right:6px;position:absolute}.ChallengesListPopup.Tablet .ChallengesListPopupHeader,.ChallengesListPopup.Desktop .ChallengesListPopupHeader{padding-top:16px}.ChallengesListPopup.Tablet .ChallengesListPopupHeaderName,.ChallengesListPopup.Desktop .ChallengesListPopupHeaderName{font-size:16px;line-height:16px}.ChallengesListPopup.Tablet .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesIconButton{width:24px;height:24px}.ChallengesListPopup.Tablet .ChallengesList,.ChallengesListPopup.Desktop .ChallengesList{padding:20px 24px 0;row-gap:20px}.ChallengesListPopup.Tablet .ChallengeCardHeader,.ChallengesListPopup.Desktop .ChallengeCardHeader{margin-bottom:16px}.ChallengesListPopup.Tablet .ChallengeName,.ChallengesListPopup.Desktop .ChallengeName{line-height:27px;font-size:22px}.ChallengesListPopup.Tablet .ChallengeJoinButton,.ChallengesListPopup.Desktop .ChallengeJoinButton{min-width:100px;height:36px;font-size:16px}.ChallengesListPopup.Tablet .ChallengeCountdown,.ChallengesListPopup.Desktop .ChallengeCountdown{font-size:14px;line-height:14px}.ChallengesListPopup.Tablet .ChallengesTooltip,.ChallengesListPopup.Desktop .ChallengesTooltip{padding:60px 65px;font-size:16px;line-height:20px}.ChallengesListPopup.Tablet .ChallengesTooltip .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesTooltip .ChallengesIconButton{top:24px;right:24px}";
175
+ 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}";
175
176
 
176
177
  const CasinoEngagementSuiteChallengesList = class {
177
178
  constructor(hostRef) {
@@ -200,6 +201,8 @@ const CasinoEngagementSuiteChallengesList = class {
200
201
  this.tooltip = false;
201
202
  this.timers = {};
202
203
  this.limitStylingAppends = false;
204
+ this.newChallengeIds = [];
205
+ this.pausedChallengeIds = [];
203
206
  this.setClientStyling = () => {
204
207
  let sheet = document.createElement('style');
205
208
  sheet.innerHTML = this.clientStyling;
@@ -221,10 +224,12 @@ const CasinoEngagementSuiteChallengesList = class {
221
224
  this.handleCloseClick = () => {
222
225
  this.close.emit();
223
226
  this.tooltip = false;
227
+ this.newChallengeIds = [];
224
228
  };
225
229
  this.handleChallengeClick = (ev) => {
226
230
  const id = +ev.currentTarget.getAttribute('data-id');
227
231
  window.postMessage({ type: 'ChallengeClick', id });
232
+ this.newChallengeIds = this.newChallengeIds.filter(item => item !== id);
228
233
  };
229
234
  this.showTooltip = () => {
230
235
  this.tooltip = true;
@@ -233,31 +238,28 @@ const CasinoEngagementSuiteChallengesList = class {
233
238
  this.tooltip = false;
234
239
  };
235
240
  this.changeChallengeStatus = (e) => {
241
+ var _a, _b;
236
242
  e.stopPropagation();
237
243
  const id = +e.currentTarget.getAttribute('data-id');
238
- const inProgressChallenges = this.challenges.filter(c => c.Status === ChallengeProgressStatus.InProgress).map(c => c.Id);
239
- if (inProgressChallenges.includes(id)) {
244
+ if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
240
245
  window.postMessage({
241
246
  type: 'ShowConfirmationModal',
242
- action: 'unjoin',
243
- id,
247
+ ProgressToDeactivate: id,
244
248
  });
245
249
  return;
246
250
  }
247
- if ((inProgressChallenges === null || inProgressChallenges === void 0 ? void 0 : inProgressChallenges.length) > 0) {
251
+ if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
248
252
  window.postMessage({
249
253
  type: 'ShowConfirmationModal',
250
- action: 'join',
251
- prevId: inProgressChallenges[0],
252
- id,
254
+ ProgressToActivate: id,
255
+ ProgressToDeactivate: this.inProgressChallenges[0],
253
256
  });
254
257
  return;
255
258
  }
256
259
  window.postMessage({
257
- type: 'ChallengeAttendance',
258
- confirmationData: {
259
- action: 'join',
260
- id,
260
+ type: 'ChallengeJoinRequest',
261
+ data: {
262
+ ProgressToActivate: id,
261
263
  },
262
264
  });
263
265
  };
@@ -272,19 +274,42 @@ const CasinoEngagementSuiteChallengesList = class {
272
274
  }
273
275
  }
274
276
  handleEvent(e) {
275
- const newChallenge = e.data.data;
276
- if (e.data.type === 'ChallengeGrant') {
277
- const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
278
- if (index > -1) {
279
- this.challenges.splice(index, 0, newChallenge);
277
+ const type = e.data.type;
278
+ switch (type) {
279
+ case 'ChallengeGrant': {
280
+ const newChallenge = e.data.data;
281
+ const index = this.challenges.findIndex(challenge => differenceInSeconds(new Date(challenge.ExpirationTime), new Date(newChallenge.ExpirationTime)) > 0);
282
+ if (index > -1) {
283
+ this.challenges.splice(index, 0, newChallenge);
284
+ }
285
+ else {
286
+ this.challenges.unshift(newChallenge);
287
+ }
288
+ this.challenges = [...this.challenges];
289
+ this.newChallengeIds.push(newChallenge.Id);
290
+ window.postMessage({ type: 'UpdateChallenges' });
291
+ break;
280
292
  }
281
- else {
282
- this.challenges.unshift(newChallenge);
293
+ case 'ChallengeChangeStatusNotification': {
294
+ const isEnabled = e.data.data.IsEnabled;
295
+ const id = e.data.data.ChallengeId;
296
+ if (!isEnabled) {
297
+ this.pausedChallengeIds.push(id);
298
+ }
299
+ else {
300
+ this.pausedChallengeIds = this.pausedChallengeIds.filter(c => c !== id);
301
+ }
302
+ break;
283
303
  }
284
304
  }
285
305
  }
286
306
  componentWillLoad() {
307
+ var _a;
287
308
  this.challengesPropHandler(this.challenges);
309
+ if ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.length) {
310
+ this.newChallengeIds = this.challenges.filter(challenge => challenge.IsNew)
311
+ .map(challenge => challenge.Id);
312
+ }
288
313
  }
289
314
  componentDidRender() {
290
315
  if (!this.limitStylingAppends && this.host) {
@@ -336,14 +361,16 @@ const CasinoEngagementSuiteChallengesList = class {
336
361
  getChallengeClasses(challenge) {
337
362
  return {
338
363
  ChallengeCard: true,
339
- InProgress: challenge.Status === ChallengeProgressStatus.InProgress,
364
+ InProgress: challenge.Status === ChallengeProgressStatus.InProgress
365
+ && !this.pausedChallengeIds.includes(challenge.Id),
340
366
  Completed: this.isChallengeCompleted(challenge),
341
367
  Paused: this.isChallengePaused(challenge)
342
368
  };
343
369
  }
344
370
  isChallengePaused(challenge) {
345
- return challenge.Status === ChallengeProgressStatus.Started
346
- && challenge.LevelProgresses[0].ProgressPercentage > 0;
371
+ return (challenge.Status === ChallengeProgressStatus.Started
372
+ && challenge.LevelProgresses[0].ProgressPercentage > 0)
373
+ || this.pausedChallengeIds.includes(challenge.Id);
347
374
  }
348
375
  isChallengeCompleted(challenge) {
349
376
  return challenge.Status === ChallengeProgressStatus.Completed
@@ -371,17 +398,19 @@ const CasinoEngagementSuiteChallengesList = class {
371
398
  }
372
399
  getChallengeHeaderTemplate(challenge) {
373
400
  const { Id } = challenge;
374
- return h("div", { class: "ChallengeCardHeader" }, h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), h("button", { class: challenge.Status === ChallengeProgressStatus.InProgress ? 'ChallengeJoinButton Joined' : 'ChallengeJoinButton', onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
401
+ return h("div", { class: "ChallengeCardHeader" }, h("div", { class: "ChallengeName" }, challenge.ChallengePresentation.PresentationName), h("button", { class: `${challenge.Status === ChallengeProgressStatus.InProgress ?
402
+ 'ChallengeJoinButton Joined' : 'ChallengeJoinButton'} ${this.isJoiningToChallenge ? 'Disabled' : ''}`, onClick: this.changeChallengeStatus, "data-id": Id }, challenge.Status === ChallengeProgressStatus.InProgress
375
403
  ? translate('unjoin', this.language)
376
404
  : translate('join', this.language)));
377
405
  }
378
406
  getChallengeTemplate(challenge) {
379
407
  const challengeProgress = this.getChallengeProgress(challenge);
380
408
  const countdown = this.timers[challenge.Id];
409
+ const isNewChallenge = this.newChallengeIds.includes(challenge.Id);
381
410
  const progressTemplate = challengeProgress > -1
382
411
  ? h("casino-engagement-suite-progress-bar", { class: this.device, value: challengeProgress, disabled: this.isChallengePaused(challenge) }, h("span", { slot: "Title", class: "ChallengeCountdown" }, countdown))
383
412
  : h("span", { class: "ChallengeCountdown" }, countdown);
384
- return (h("div", { class: this.getChallengeClasses(challenge), onClick: this.handleChallengeClick, key: challenge.Id, "data-id": challenge.Id }, this.getChallengeHeaderTemplate(challenge), progressTemplate));
413
+ 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)))));
385
414
  }
386
415
  getHeaderTemplate() {
387
416
  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" })));
@@ -395,15 +424,10 @@ const CasinoEngagementSuiteChallengesList = class {
395
424
  }
396
425
  }
397
426
  getTooltipTemplate() {
398
- if (this.tooltip) {
399
- return h("div", { class: "ChallengesTooltipBackdrop" }, h("div", { class: "ChallengesTooltip" }, h("button", { class: "ChallengesIconButton", onClick: this.hideTooltip }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })), translate('tooltip', this.language)));
400
- }
401
- else {
402
- return '';
403
- }
427
+ 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)));
404
428
  }
405
429
  render() {
406
- return h("div", { class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.getTooltipTemplate());
430
+ return h("div", { class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.tooltip && this.getTooltipTemplate());
407
431
  }
408
432
  get host() { return getElement(this); }
409
433
  static get watchers() { return {
@@ -412,7 +436,7 @@ const CasinoEngagementSuiteChallengesList = class {
412
436
  };
413
437
  CasinoEngagementSuiteChallengesList.style = casinoEngagementSuiteChallengesListCss;
414
438
 
415
- const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
439
+ const casinoEngagementSuiteProgressBarCss = ":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";
416
440
 
417
441
  const CasinoEngagementSuiteProgressBar = class {
418
442
  constructor(hostRef) {
@@ -425,6 +449,10 @@ const CasinoEngagementSuiteProgressBar = class {
425
449
  * Shows disabled styles
426
450
  */
427
451
  this.disabled = false;
452
+ /**
453
+ * Hide percent value
454
+ */
455
+ this.hidePercent = false;
428
456
  /**
429
457
  * Client custom styling via string
430
458
  */
@@ -466,7 +494,8 @@ const CasinoEngagementSuiteProgressBar = class {
466
494
  return {
467
495
  ProgressBar: true,
468
496
  Completed: this.value === 100,
469
- Disabled: this.disabled
497
+ Disabled: this.disabled,
498
+ HidePercent: this.hidePercent
470
499
  };
471
500
  }
472
501
  render() {
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["casino-engagement-suite-challenges-list_2",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
13
+ return bootstrapLazy([["casino-engagement-suite-challenges-list_2",[[1,"casino-engagement-suite-challenges-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"challenges":[1040],"isJoiningToChallenge":[1028,"is-joining-to-challenge"],"inProgressChallenges":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32],"newChallengeIds":[32],"pausedChallengeIds":[32]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-progress-bar",{"value":[2],"disabled":[4],"hidePercent":[4,"hide-percent"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"limitStylingAppends":[32]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -22,10 +22,20 @@ export declare class CasinoEngagementSuiteChallengesList {
22
22
  * List of challenges
23
23
  */
24
24
  challenges: Challenge[];
25
+ /**
26
+ *Is joining to challenge
27
+ */
28
+ isJoiningToChallenge: boolean;
29
+ /**
30
+ *Active challenges
31
+ */
32
+ inProgressChallenges: Array<number>;
25
33
  close: EventEmitter<void>;
26
34
  tooltip: boolean;
27
35
  timers: Record<string, string>;
28
36
  private limitStylingAppends;
37
+ newChallengeIds: number[];
38
+ pausedChallengeIds: number[];
29
39
  host: HTMLElement;
30
40
  challengesPropHandler(value: Array<Challenge>): void;
31
41
  handleEvent(e: any): void;
@@ -24,6 +24,14 @@ export namespace Components {
24
24
  * User's device type
25
25
  */
26
26
  "device": "Mobile" | "Tablet" | "Desktop";
27
+ /**
28
+ * Active challenges
29
+ */
30
+ "inProgressChallenges": Array<number>;
31
+ /**
32
+ * Is joining to challenge
33
+ */
34
+ "isJoiningToChallenge": boolean;
27
35
  /**
28
36
  * Language of the widget
29
37
  */
@@ -59,6 +67,14 @@ declare namespace LocalJSX {
59
67
  * User's device type
60
68
  */
61
69
  "device"?: "Mobile" | "Tablet" | "Desktop";
70
+ /**
71
+ * Active challenges
72
+ */
73
+ "inProgressChallenges"?: Array<number>;
74
+ /**
75
+ * Is joining to challenge
76
+ */
77
+ "isJoiningToChallenge"?: boolean;
62
78
  /**
63
79
  * Language of the widget
64
80
  */
@@ -37,6 +37,7 @@ export interface LevelProgress {
37
37
  Rewards: Array<Reward>;
38
38
  TargetBetCount: number;
39
39
  TargetTurnover: number;
40
+ DisplayCurrencyTargetTurnover: number;
40
41
  CustomRewardMessage: string;
41
42
  }
42
43
  export declare enum ChallengeProgressStatus {
@@ -55,4 +56,5 @@ export interface Challenge {
55
56
  Id: number;
56
57
  LevelProgresses: Array<LevelProgress>;
57
58
  Status: ChallengeProgressStatus;
59
+ IsNew: boolean;
58
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-engagement-suite-challenges-list",
3
- "version": "1.36.0",
3
+ "version": "1.36.1",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as s,g as o}from"./p-fad4589e.js";var n,i;!function(e){e[e.Closed=0]="Closed",e[e.InProgress=1]="InProgress",e[e.Fillup=2]="Fillup",e[e.Completed=3]="Completed"}(n||(n={})),function(e){e[e.Started=0]="Started",e[e.InProgress=1]="InProgress",e[e.PendingLevelReward=2]="PendingLevelReward",e[e.Completed=3]="Completed",e[e.Expired=4]="Expired"}(i||(i={}));const a=["en"],l={en:{challenges:"Challenges",join:"Join",unjoin:"Unjoin",noChallenges:"No Challenges yet",tryOtherGames:"Try winning Challenges as rewards or launching other booster games",tooltip:"Competition where your real money bets contribute towards the level progress to achieve the level reward"}},r=(e,t)=>{const s=t;return l[void 0!==s&&a.includes(s)?s:"en"][e]};function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function g(e){p(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===h(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function d(e,t){return p(2,arguments),g(e).getTime()-g(t).getTime()}var c={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function u(e){return e?c[e]:c.trunc}const C=class{constructor(s){e(this,s),this.close=t(this,"close",7),this.clientStyling="",this.clientStylingUrl="",this.language="en",this.device="Mobile",this.challenges=[],this.tooltip=!1,this.timers={},this.limitStylingAppends=!1,this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.host.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.host.prepend(t)}),1)})).catch((e=>{console.log("Error ",e)}))},this.handleCloseClick=()=>{this.close.emit(),this.tooltip=!1},this.handleChallengeClick=e=>{const t=+e.currentTarget.getAttribute("data-id");window.postMessage({type:"ChallengeClick",id:t})},this.showTooltip=()=>{this.tooltip=!0},this.hideTooltip=()=>{this.tooltip=!1},this.changeChallengeStatus=e=>{e.stopPropagation();const t=+e.currentTarget.getAttribute("data-id"),s=this.challenges.filter((e=>e.Status===i.InProgress)).map((e=>e.Id));s.includes(t)?window.postMessage({type:"ShowConfirmationModal",action:"unjoin",id:t}):(null==s?void 0:s.length)>0?window.postMessage({type:"ShowConfirmationModal",action:"join",prevId:s[0],id:t}):window.postMessage({type:"ChallengeAttendance",confirmationData:{action:"join",id:t}})}}challengesPropHandler(e){!this.interval&&e.length&&(this.updateTimers(),this.startCountdown()),this.interval&&!e.length&&clearInterval(this.interval)}handleEvent(e){const t=e.data.data;if("ChallengeGrant"===e.data.type){const e=this.challenges.findIndex((e=>function(e,t,s){p(2,arguments);var o=d(e,t)/1e3;return u(null==s?void 0:s.roundingMethod)(o)}(new Date(e.ExpirationTime),new Date(t.ExpirationTime))>0));e>-1?this.challenges.splice(e,0,t):this.challenges.unshift(t)}}componentWillLoad(){this.challengesPropHandler(this.challenges)}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}disconnectedCallback(){this.interval&&clearInterval(this.interval)}startCountdown(){this.interval=setInterval((()=>{this.updateTimers()}),1e3)}updateTimers(){const e=(new Date).getTime();this.timers=this.challenges.filter((e=>e.Status!==i.Expired)).reduce(((t,s)=>{const o=new Date(s.ExpirationTime).getTime()-e;let n="00h:00m:00s";if(o<1)this.removeChallenge(s.Id);else{const{days:e,hours:t,minutes:s,seconds:i}={days:String(Math.floor(o/864e5)).padStart(2,"0"),hours:String(Math.floor(o%864e5/36e5)).padStart(2,"0"),minutes:String(Math.floor(o%36e5/6e4)).padStart(2,"0"),seconds:String(Math.floor(o%6e4/1e3)).padStart(2,"0")};n="00"===e?`${t}h:${s}m:${i}s`:`${e}d:${t}h:${s}m`}return Object.assign(Object.assign({},t),{[s.Id]:n})}),{})}removeChallenge(e){const t=this.challenges.findIndex((t=>t.Id===e));t>-1&&(this.challenges.splice(t,1),window.postMessage({type:"ChallengeHasExpired",id:e}))}getChallengeClasses(e){return{ChallengeCard:!0,InProgress:e.Status===i.InProgress,Completed:this.isChallengeCompleted(e),Paused:this.isChallengePaused(e)}}isChallengePaused(e){return e.Status===i.Started&&e.LevelProgresses[0].ProgressPercentage>0}isChallengeCompleted(e){return e.Status===i.Completed||e.Status===i.PendingLevelReward&&e.LevelProgresses.every((e=>100===e.ProgressPercentage))}getChallengeProgress(e){if(e.Status===i.Completed)return 100;if(this.isChallengePaused(e)||e.Status===i.PendingLevelReward||e.Status===i.InProgress){const t=e.LevelProgresses.find((e=>e.ProgressStatus===n.InProgress));return t?t.ProgressPercentage:0}return-1}getChallengeHeaderTemplate(e){const{Id:t}=e;return s("div",{class:"ChallengeCardHeader"},s("div",{class:"ChallengeName"},e.ChallengePresentation.PresentationName),s("button",{class:e.Status===i.InProgress?"ChallengeJoinButton Joined":"ChallengeJoinButton",onClick:this.changeChallengeStatus,"data-id":t},r(e.Status===i.InProgress?"unjoin":"join",this.language)))}getChallengeTemplate(e){const t=this.getChallengeProgress(e),o=this.timers[e.Id],n=t>-1?s("casino-engagement-suite-progress-bar",{class:this.device,value:t,disabled:this.isChallengePaused(e)},s("span",{slot:"Title",class:"ChallengeCountdown"},o)):s("span",{class:"ChallengeCountdown"},o);return s("div",{class:this.getChallengeClasses(e),onClick:this.handleChallengeClick,key:e.Id,"data-id":e.Id},this.getChallengeHeaderTemplate(e),n)}getHeaderTemplate(){return s("header",{class:"ChallengesListPopupHeader"},s("button",{onClick:this.showTooltip,class:"ChallengesIconButton"},s("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/help.svg",alt:"Show tooltip"})),s("div",{class:"ChallengesListPopupHeaderName"},r("challenges",this.language)),s("button",{class:"ChallengesIconButton",onClick:this.handleCloseClick},s("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/close.svg",alt:"Close challenges list"})))}getListTemplate(){return this.challenges.length?s("div",{class:"ChallengesListWrapper"},s("div",{class:"ChallengesList"},this.challenges.map((e=>this.getChallengeTemplate(e))))):s("div",{class:"ChallengesListEmpty"},s("h2",null,r("noChallenges",this.language)),s("p",null,r("tryOtherGames",this.language)))}getTooltipTemplate(){return this.tooltip?s("div",{class:"ChallengesTooltipBackdrop"},s("div",{class:"ChallengesTooltip"},s("button",{class:"ChallengesIconButton",onClick:this.hideTooltip},s("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/close.svg",alt:"Close tooltip"})),r("tooltip",this.language))):""}render(){return s("div",{class:`ChallengesListPopup ${this.device}`},this.getHeaderTemplate(),this.getListTemplate(),this.getTooltipTemplate())}get host(){return o(this)}static get watchers(){return{challenges:["challengesPropHandler"]}}};C.style='@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap");:host{display:block;font-family:inherit}*{box-sizing:border-box;margin:0;padding:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.ChallengesListPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:8px;overflow:hidden;flex-direction:column;position:relative}.ChallengesListPopupHeader{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.ChallengesIconButton{width:16px;height:16px;cursor:pointer}.ChallengesListPopupHeaderName{color:var(--emw--color-gray-100, #BBB9C3);font-size:14px;font-weight:500;line-height:14px}.ChallengesListWrapper{overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.ChallengesListWrapper::-webkit-scrollbar{display:none}.ChallengesList{display:flex;flex-direction:column;row-gap:12px;padding:8px 19px 0}.ChallengeCard{padding:15px 15px 19px;border:1px solid var(--emw--button-border-color, #403956);border-radius:6px;position:relative;cursor:pointer}.ChallengeJoinButton.Joined::before,.ChallengeCard.InProgress::before{content:"";position:absolute;inset:0;border-radius:var(--emw--button-border-radius, 4px);padding:1px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-mask:linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.ChallengeCardHeader{display:flex;justify-content:space-between;gap:24px;margin-bottom:12px}.ChallengeName{color:var(--emw--color-typography, #FFFFFF);font-family:"Montserrat", sans-serif;line-height:22px;font-weight:700;font-size:18px;word-break:break-word}.ChallengeJoinButton{transition:all 0.5s ease-out;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:var(--emw--color-typography, #1E1638);border-radius:99px;min-width:88px;height:32px;font-size:14px;font-weight:700;position:relative;font-family:"Montserrat", sans-serif}.ChallengeJoinButton.Joined{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ChallengeJoinButton.Joined::before{border-radius:99px}.ChallengesListEmpty{padding:20px 32px}.ChallengesListEmpty h2{margin:0 0 16px 0;text-align:center;font-weight:600;font-size:20px;line-height:24px;font-family:"Montserrat", sans-serif;color:var(--emw--color-typography, #FFFFFF)}.ChallengesListEmpty p{font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3)}.ChallengeCountdown{color:var(--emw--color-gray-100, #BBB9C3);font-size:12px;line-height:12px}.ChallengesTooltipBackdrop{padding:48px 30px 0;position:absolute;width:100%;height:100%;inset:0;background-color:rgba(0, 0, 0, 0.5)}.ChallengesTooltipBackdrop .ChallengesTooltip{border:1px solid var(--emw--button-border-color, #403956);background-color:var(--emw--color-background, #1E1638);border-radius:8px;padding:32px;font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3);position:relative}.ChallengesTooltipBackdrop .ChallengesTooltip .ChallengesIconButton{top:12px;right:6px;position:absolute}.ChallengesListPopup.Tablet .ChallengesListPopupHeader,.ChallengesListPopup.Desktop .ChallengesListPopupHeader{padding-top:16px}.ChallengesListPopup.Tablet .ChallengesListPopupHeaderName,.ChallengesListPopup.Desktop .ChallengesListPopupHeaderName{font-size:16px;line-height:16px}.ChallengesListPopup.Tablet .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesIconButton{width:24px;height:24px}.ChallengesListPopup.Tablet .ChallengesList,.ChallengesListPopup.Desktop .ChallengesList{padding:20px 24px 0;row-gap:20px}.ChallengesListPopup.Tablet .ChallengeCardHeader,.ChallengesListPopup.Desktop .ChallengeCardHeader{margin-bottom:16px}.ChallengesListPopup.Tablet .ChallengeName,.ChallengesListPopup.Desktop .ChallengeName{line-height:27px;font-size:22px}.ChallengesListPopup.Tablet .ChallengeJoinButton,.ChallengesListPopup.Desktop .ChallengeJoinButton{min-width:100px;height:36px;font-size:16px}.ChallengesListPopup.Tablet .ChallengeCountdown,.ChallengesListPopup.Desktop .ChallengeCountdown{font-size:14px;line-height:14px}.ChallengesListPopup.Tablet .ChallengesTooltip,.ChallengesListPopup.Desktop .ChallengesTooltip{padding:60px 65px;font-size:16px;line-height:20px}.ChallengesListPopup.Tablet .ChallengesTooltip .ChallengesIconButton,.ChallengesListPopup.Desktop .ChallengesTooltip .ChallengesIconButton{top:24px;right:24px}';const m=class{constructor(t){e(this,t),this.value=0,this.disabled=!1,this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1,this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.host.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.host.prepend(t)}),1)})).catch((e=>{console.log("Error ",e)}))}}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}getProgressBarClasses(){return{ProgressBar:!0,Completed:100===this.value,Disabled:this.disabled}}render(){return s("div",{class:this.getProgressBarClasses(),part:"ProgressBar"},s("div",{class:"ProgressBarInfo",part:"ProgressBarInfo"},s("slot",{name:"Title"},s("div",null)),s("slot",{name:"Percent"},s("div",{class:"ProgressBarPercent",part:"ProgressBarPercent"},this.value,"%"))),s("div",{class:"ProgressBarBackground",part:"ProgressBarBackground"},s("div",{class:"ProgressBarLine",part:"ProgressBarLine",style:{width:this.value+"%"}})))}get host(){return o(this)}};m.style=":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:14px;line-height:14px}.ProgressBarBackground{height:8px;background-color:var(--emw--color-background, #666178);border-radius:4px;position:relative}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:4px;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);transition:width ease-out 0.3s}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:700;font-size:12px;line-height:12px}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-background, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";export{C as casino_engagement_suite_challenges_list,m as casino_engagement_suite_progress_bar}