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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.esm.js +1 -1
  2. package/dist/casino-engagement-suite-challenges-list/p-26d7de05.entry.js +1 -0
  3. package/dist/casino-engagement-suite-challenges-list/p-fad4589e.js +1 -0
  4. package/dist/cjs/casino-engagement-suite-challenges-list.cjs.js +2 -2
  5. package/dist/cjs/casino-engagement-suite-challenges-list_2.cjs.entry.js +513 -0
  6. package/dist/cjs/{index-79c88755.js → index-0a011384.js} +38 -1
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/collection/collection-manifest.json +8 -1
  9. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.css +34 -0
  10. package/dist/collection/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.js +128 -38
  11. package/dist/collection/utils/locale.utils.js +1 -0
  12. package/dist/components/casino-engagement-suite-challenges-list.js +97 -791
  13. package/dist/components/casino-engagement-suite-progress-bar.js +6 -0
  14. package/dist/components/casino-engagement-suite-progress-bar2.js +94 -0
  15. package/dist/esm/casino-engagement-suite-challenges-list.js +2 -2
  16. package/dist/esm/casino-engagement-suite-challenges-list_2.entry.js +508 -0
  17. package/dist/esm/{index-70e47fe0.js → index-ddf7e990.js} +38 -1
  18. package/dist/esm/loader.js +2 -2
  19. package/dist/types/components/casino-engagement-suite-challenges-list/casino-engagement-suite-challenges-list.d.ts +11 -0
  20. package/dist/types/components.d.ts +16 -0
  21. package/dist/types/models/challenge.d.ts +3 -0
  22. package/package.json +1 -1
  23. package/dist/casino-engagement-suite-challenges-list/p-7e171791.js +0 -1
  24. package/dist/casino-engagement-suite-challenges-list/p-eb36cbe7.entry.js +0 -1
  25. package/dist/cjs/casino-engagement-suite-challenges-list.cjs.entry.js +0 -1147
  26. package/dist/esm/casino-engagement-suite-challenges-list.entry.js +0 -1143
@@ -1 +1 @@
1
- import{p as e,b as n}from"./p-7e171791.js";(()=>{const n=import.meta.url,t={};return""!==n&&(t.resourcesUrl=new URL(".",n).href),e(t)})().then((e=>n([["p-eb36cbe7",[[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"]]]]]],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}
@@ -0,0 +1 @@
1
+ let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},i=e=>Promise.resolve(e),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),r=(e,t,n)=>{n&&n.map((([n,l,s])=>{const i=u(e,n),c=a(t,s),r=f(n);o.ael(i,l,c,r),(t.o=t.o||[]).push((()=>o.rel(i,l,c,r)))}))},a=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},u=(e,t)=>8&t?l:e,f=e=>0!=(2&e),d=new WeakMap,h=e=>"sc-"+e.h,y={},$=e=>"object"==(e=typeof e)||"function"===e,m=(e,t,...n)=>{let l=null,s=null,o=!1,i=!1,c=[];const r=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof e&&!$(l))&&(l+=""),o&&i?c[c.length-1].$+=l:c.push(o?p(null,l):l),i=o)};if(r(n),t){t.key&&(s=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const a=p(e,null);return a.m=t,c.length>0&&(a.p=c),a.g=s,a},p=(e,t)=>({t:0,S:e,$:t,k:null,p:null,m:null,g:null}),b={},w=(e,t,n,s,i,c)=>{if(n!==s){let r=I(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,l=S(n),o=S(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if("style"===t){for(const t in n)s&&null!=s[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in s)n&&s[t]===n[t]||(t.includes("-")?e.style.setProperty(t,s[t]):e.style[t]=s[t])}else if("key"===t);else if(r||"o"!==t[0]||"n"!==t[1]){const l=$(s);if((r||l&&null!==s)&&!i)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?r=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&c||i)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):I(l,a)?a.slice(2):a[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},g=/\s/,S=e=>e?e.split(g):[],k=(e,t,n,l)=>{const s=11===t.k.nodeType&&t.k.host?t.k.host:t.k,o=e&&e.m||y,i=t.m||y;for(l in o)l in i||w(s,l,o[l],void 0,n,t.t);for(l in i)w(s,l,o[l],i[l],n,t.t)},j=(t,n,l)=>{let o,i,c=n.p[l],r=0;if(null!==c.$)o=c.k=s.createTextNode(c.$);else if(o=c.k=s.createElement(c.S),k(null,c,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),c.p)for(r=0;r<c.p.length;++r)i=j(t,c,r),i&&o.appendChild(i);return o},v=(e,n,l,s,o,i)=>{let c,r=e;for(r.shadowRoot&&r.tagName===t&&(r=r.shadowRoot);o<=i;++o)s[o]&&(c=j(null,l,o),c&&(s[o].k=c,r.insertBefore(c,n)))},M=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.k.remove()},C=(e,t)=>e.S===t.S&&e.g===t.g,O=(e,t)=>{const n=t.k=e.k,l=e.p,s=t.p,o=t.$;null===o?("slot"===t.S||k(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o,i=0,c=0,r=0,a=0,u=t.length-1,f=t[0],d=t[u],h=l.length-1,y=l[0],$=l[h];for(;i<=u&&c<=h;)if(null==f)f=t[++i];else if(null==d)d=t[--u];else if(null==y)y=l[++c];else if(null==$)$=l[--h];else if(C(f,y))O(f,y),f=t[++i],y=l[++c];else if(C(d,$))O(d,$),d=t[--u],$=l[--h];else if(C(f,$))O(f,$),e.insertBefore(f.k,d.k.nextSibling),f=t[++i],$=l[--h];else if(C(d,y))O(d,y),e.insertBefore(d.k,f.k),d=t[--u],y=l[++c];else{for(r=-1,a=i;a<=u;++a)if(t[a]&&null!==t[a].g&&t[a].g===y.g){r=a;break}r>=0?(o=t[r],o.S!==y.S?s=j(t&&t[c],n,r):(O(o,y),t[r]=void 0,s=o.k),y=l[++c]):(s=j(t&&t[c],n,c),y=l[++c]),s&&f.k.parentNode.insertBefore(s,f.k)}i>u?v(e,null==l[h+1]?null:l[h+1].k,n,l,c,h):c>h&&M(t,i,u)})(n,l,t,s):null!==s?(null!==e.$&&(n.textContent=""),v(n,null,t,s,0,s.length-1)):null!==l&&M(l,0,l.length-1)):e.$!==o&&(n.data=o)},P=e=>z(e).j,x=(e,t,n)=>{const l=P(e);return{emit:e=>E(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},E=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},L=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},N=(e,t)=>{if(e.t|=16,!(4&e.t))return L(e,e.M),se((()=>R(e,t)));e.t|=512},R=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>U(n,e,t))),e.u=null),l=U(n,"componentWillLoad")),q(l,(()=>T(e,n,t)))},T=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.C,n=e.j,l=t.t,o=((e,t)=>{let n=h(t),l=X.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=d.get(e=e.head||e);o||d.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);W(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>A(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},W=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.C,i=n.O||p(null,null),c=(e=>e&&e.S===b)(l)?l:m(null,null,l);t=s.tagName,o.P&&(c.m=c.m||{},o.P.map((([e,t])=>c.m[t]=s[e]))),c.S=null,c.t|=4,n.O=c,c.k=i.k=s.shadowRoot||s,e=s["s-sc"],O(i,c)})(n,l)}catch(e){J(e,n.j)}return null},A=e=>{const t=e.j,n=e.M;U(e.i,"componentDidRender"),64&e.t||(e.t|=64,D(t),e.L(t),n||F()),e.v&&(e.v(),e.v=void 0),512&e.t&&le((()=>N(e,!1))),e.t&=-517},F=()=>{D(s.documentElement),le((()=>E(l,"appload",{detail:{namespace:"casino-engagement-suite-challenges-list"}})))},U=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},q=(e,t)=>e&&e.then?e.then(t):t(),D=e=>e.classList.add("hydrated"),H=(e,t,n)=>{if(t.N){e.watchers&&(t.R=e.watchers);const l=Object.entries(t.N),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>z(this).T.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=z(e),o=s.j,i=s.T.get(t),c=s.t,r=s.i;if(n=((e,t)=>null==e||$(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.N[t][0]),(!(8&c)||void 0===i)&&n!==i&&(!Number.isNaN(i)||!Number.isNaN(n))&&(s.T.set(t,n),r)){if(l.R&&128&c){const e=l.R[t];e&&e.map((e=>{try{r[e](n,i,t)}catch(e){J(e,o)}}))}2==(18&c)&&N(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){o.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(s.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.P.push([e,s]),s}))}}return e},V=(e,t={})=>{const n=[],i=t.exclude||[],a=l.customElements,u=s.head,f=u.querySelector("meta[charset]"),d=s.createElement("style"),y=[];let $,m=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],h:t[1],N:t[2],W:t[3]};l.N=t[2],l.W=t[3],l.P=[],l.R={};const s=l.h,u=class extends HTMLElement{constructor(e){super(e),G(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){$&&(clearTimeout($),$=null),m?y.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=z(e),n=t.C,l=()=>{};if(1&t.t)r(e,t,n.W);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){L(t,t.M=n);break}}n.N&&Object.entries(n.N).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Q(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.R=s.watchers,H(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){J(e)}t.t&=-9,t.t|=128,e()}if(s.style){let e=s.style;const t=h(n);if(!X.has(t)){const l=()=>{};((e,t,n)=>{let l=X.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,X.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.M,i=()=>N(t,!0);o&&o["s-rc"]?o["s-rc"].push(i):i()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=z(this),t=e.i;e.o&&(e.o.map((e=>e())),e.o=void 0),U(t,"disconnectedCallback")}})()))}componentOnReady(){return z(this).A}};l.F=e[0],i.includes(s)||a.get(s)||(n.push(s),a.define(s,H(u,l,1)))}))})),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),u.insertBefore(d,f?f.nextSibling:u.firstChild),m=!1,y.length?y.map((e=>e.connectedCallback())):o.jmp((()=>$=setTimeout(F,30)))},_=new WeakMap,z=e=>_.get(e),B=(e,t)=>_.set(t.i=e,t),G=(e,t)=>{const n={t:0,j:e,C:t,T:new Map};return n.A=new Promise((e=>n.L=e)),e["s-p"]=[],e["s-rc"]=[],r(e,n,t.W),_.set(e,n)},I=(e,t)=>t in e,J=(e,t)=>(0,console.error)(e,t),K=new Map,Q=e=>{const t=e.h.replace(/-/g,"_"),n=e.F,l=K.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(K.set(n,e),e[t])),J)},X=new Map,Y=[],Z=[],ee=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?le(ne):o.raf(ne))},te=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){J(e)}e.length=0},ne=()=>{te(Y),te(Z),(n=Y.length>0)&&o.raf(ne)},le=e=>i().then(e),se=ee(Z,!0);export{V as b,x as c,P as g,m as h,i as p,B as r}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-79c88755.js');
3
+ const index = require('./index-0a011384.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["casino-engagement-suite-challenges-list.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"]]]]]], 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
  });
@@ -0,0 +1,513 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-0a011384.js');
6
+
7
+ var ChallengeLevelProgressStatus;
8
+ (function (ChallengeLevelProgressStatus) {
9
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Closed"] = 0] = "Closed";
10
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["InProgress"] = 1] = "InProgress";
11
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Fillup"] = 2] = "Fillup";
12
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Completed"] = 3] = "Completed";
13
+ })(ChallengeLevelProgressStatus || (ChallengeLevelProgressStatus = {}));
14
+ var ChallengeProgressStatus;
15
+ (function (ChallengeProgressStatus) {
16
+ ChallengeProgressStatus[ChallengeProgressStatus["Started"] = 0] = "Started";
17
+ ChallengeProgressStatus[ChallengeProgressStatus["InProgress"] = 1] = "InProgress";
18
+ ChallengeProgressStatus[ChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
19
+ ChallengeProgressStatus[ChallengeProgressStatus["Completed"] = 3] = "Completed";
20
+ ChallengeProgressStatus[ChallengeProgressStatus["Expired"] = 4] = "Expired";
21
+ })(ChallengeProgressStatus || (ChallengeProgressStatus = {}));
22
+
23
+ const DEFAULT_LANGUAGE = 'en';
24
+ const SUPPORTED_LANGUAGES = ['en'];
25
+ const TRANSLATIONS = {
26
+ en: {
27
+ challenges: 'Challenges',
28
+ join: 'Join',
29
+ unjoin: 'Unjoin',
30
+ new: 'new',
31
+ noChallenges: 'No Challenges yet',
32
+ tryOtherGames: 'Try winning Challenges as rewards or launching other booster games',
33
+ tooltip: 'Competition where your real money bets contribute towards the level progress to achieve the level reward'
34
+ }
35
+ };
36
+ const translate = (key, customLang) => {
37
+ const lang = customLang;
38
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
39
+ };
40
+
41
+ function _typeof(o) {
42
+ "@babel/helpers - typeof";
43
+
44
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
45
+ return typeof o;
46
+ } : function (o) {
47
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
48
+ }, _typeof(o);
49
+ }
50
+
51
+ function requiredArgs(required, args) {
52
+ if (args.length < required) {
53
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @name toDate
59
+ * @category Common Helpers
60
+ * @summary Convert the given argument to an instance of Date.
61
+ *
62
+ * @description
63
+ * Convert the given argument to an instance of Date.
64
+ *
65
+ * If the argument is an instance of Date, the function returns its clone.
66
+ *
67
+ * If the argument is a number, it is treated as a timestamp.
68
+ *
69
+ * If the argument is none of the above, the function returns Invalid Date.
70
+ *
71
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
72
+ *
73
+ * @param {Date|Number} argument - the value to convert
74
+ * @returns {Date} the parsed date in the local time zone
75
+ * @throws {TypeError} 1 argument required
76
+ *
77
+ * @example
78
+ * // Clone the date:
79
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
80
+ * //=> Tue Feb 11 2014 11:30:30
81
+ *
82
+ * @example
83
+ * // Convert the timestamp to date:
84
+ * const result = toDate(1392098430000)
85
+ * //=> Tue Feb 11 2014 11:30:30
86
+ */
87
+ function toDate(argument) {
88
+ requiredArgs(1, arguments);
89
+ var argStr = Object.prototype.toString.call(argument);
90
+
91
+ // Clone the date
92
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
93
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
94
+ return new Date(argument.getTime());
95
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
96
+ return new Date(argument);
97
+ } else {
98
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
99
+ // eslint-disable-next-line no-console
100
+ 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");
101
+ // eslint-disable-next-line no-console
102
+ console.warn(new Error().stack);
103
+ }
104
+ return new Date(NaN);
105
+ }
106
+ }
107
+
108
+ /**
109
+ * @name differenceInMilliseconds
110
+ * @category Millisecond Helpers
111
+ * @summary Get the number of milliseconds between the given dates.
112
+ *
113
+ * @description
114
+ * Get the number of milliseconds between the given dates.
115
+ *
116
+ * @param {Date|Number} dateLeft - the later date
117
+ * @param {Date|Number} dateRight - the earlier date
118
+ * @returns {Number} the number of milliseconds
119
+ * @throws {TypeError} 2 arguments required
120
+ *
121
+ * @example
122
+ * // How many milliseconds are between
123
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
124
+ * const result = differenceInMilliseconds(
125
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
126
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
127
+ * )
128
+ * //=> 1100
129
+ */
130
+ function differenceInMilliseconds(dateLeft, dateRight) {
131
+ requiredArgs(2, arguments);
132
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
133
+ }
134
+
135
+ var roundingMap = {
136
+ ceil: Math.ceil,
137
+ round: Math.round,
138
+ floor: Math.floor,
139
+ trunc: function trunc(value) {
140
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
141
+ } // Math.trunc is not supported by IE
142
+ };
143
+
144
+ var defaultRoundingMethod = 'trunc';
145
+ function getRoundingMethod(method) {
146
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
147
+ }
148
+
149
+ /**
150
+ * @name differenceInSeconds
151
+ * @category Second Helpers
152
+ * @summary Get the number of seconds between the given dates.
153
+ *
154
+ * @description
155
+ * Get the number of seconds between the given dates.
156
+ *
157
+ * @param {Date|Number} dateLeft - the later date
158
+ * @param {Date|Number} dateRight - the earlier date
159
+ * @param {Object} [options] - an object with options.
160
+ * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
161
+ * @returns {Number} the number of seconds
162
+ * @throws {TypeError} 2 arguments required
163
+ *
164
+ * @example
165
+ * // How many seconds are between
166
+ * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
167
+ * const result = differenceInSeconds(
168
+ * new Date(2014, 6, 2, 12, 30, 20, 0),
169
+ * new Date(2014, 6, 2, 12, 30, 7, 999)
170
+ * )
171
+ * //=> 12
172
+ */
173
+ function differenceInSeconds(dateLeft, dateRight, options) {
174
+ requiredArgs(2, arguments);
175
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;
176
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
177
+ }
178
+
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}";
180
+
181
+ const CasinoEngagementSuiteChallengesList = class {
182
+ constructor(hostRef) {
183
+ index.registerInstance(this, hostRef);
184
+ this.close = index.createEvent(this, "close", 7);
185
+ /**
186
+ * Client custom styling via string
187
+ */
188
+ this.clientStyling = '';
189
+ /**
190
+ * Client custom styling via url
191
+ */
192
+ this.clientStylingUrl = '';
193
+ /**
194
+ * Language of the widget
195
+ */
196
+ this.language = 'en';
197
+ /**
198
+ * User's device type
199
+ */
200
+ this.device = 'Mobile';
201
+ /**
202
+ * List of challenges
203
+ */
204
+ this.challenges = [];
205
+ this.tooltip = false;
206
+ this.timers = {};
207
+ this.limitStylingAppends = false;
208
+ this.newChallengeIds = [];
209
+ this.pausedChallengeIds = [];
210
+ this.setClientStyling = () => {
211
+ let sheet = document.createElement('style');
212
+ sheet.innerHTML = this.clientStyling;
213
+ this.host.prepend(sheet);
214
+ };
215
+ this.setClientStylingURL = () => {
216
+ let url = new URL(this.clientStylingUrl);
217
+ let cssFile = document.createElement('style');
218
+ fetch(url.href)
219
+ .then((res) => res.text())
220
+ .then((data) => {
221
+ cssFile.innerHTML = data;
222
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
223
+ })
224
+ .catch((err) => {
225
+ console.log('Error ', err);
226
+ });
227
+ };
228
+ this.handleCloseClick = () => {
229
+ this.close.emit();
230
+ this.tooltip = false;
231
+ this.newChallengeIds = [];
232
+ };
233
+ this.handleChallengeClick = (ev) => {
234
+ const id = +ev.currentTarget.getAttribute('data-id');
235
+ window.postMessage({ type: 'ChallengeClick', id });
236
+ this.newChallengeIds = this.newChallengeIds.filter(item => item !== id);
237
+ };
238
+ this.showTooltip = () => {
239
+ this.tooltip = true;
240
+ };
241
+ this.hideTooltip = () => {
242
+ this.tooltip = false;
243
+ };
244
+ this.changeChallengeStatus = (e) => {
245
+ var _a, _b;
246
+ e.stopPropagation();
247
+ const id = +e.currentTarget.getAttribute('data-id');
248
+ if ((_a = this.inProgressChallenges) === null || _a === void 0 ? void 0 : _a.includes(id)) {
249
+ window.postMessage({
250
+ type: 'ShowConfirmationModal',
251
+ ProgressToDeactivate: id,
252
+ });
253
+ return;
254
+ }
255
+ if (((_b = this.inProgressChallenges) === null || _b === void 0 ? void 0 : _b.length) > 0) {
256
+ window.postMessage({
257
+ type: 'ShowConfirmationModal',
258
+ ProgressToActivate: id,
259
+ ProgressToDeactivate: this.inProgressChallenges[0],
260
+ });
261
+ return;
262
+ }
263
+ window.postMessage({
264
+ type: 'ChallengeJoinRequest',
265
+ data: {
266
+ ProgressToActivate: id,
267
+ },
268
+ });
269
+ };
270
+ }
271
+ challengesPropHandler(value) {
272
+ if (!this.interval && value.length) {
273
+ this.updateTimers();
274
+ this.startCountdown();
275
+ }
276
+ if (this.interval && !value.length) {
277
+ clearInterval(this.interval);
278
+ }
279
+ }
280
+ handleEvent(e) {
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;
296
+ }
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;
307
+ }
308
+ }
309
+ }
310
+ componentWillLoad() {
311
+ var _a;
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
+ }
317
+ }
318
+ componentDidRender() {
319
+ if (!this.limitStylingAppends && this.host) {
320
+ if (this.clientStyling)
321
+ this.setClientStyling();
322
+ if (this.clientStylingUrl)
323
+ this.setClientStylingURL();
324
+ this.limitStylingAppends = true;
325
+ }
326
+ }
327
+ disconnectedCallback() {
328
+ this.interval && clearInterval(this.interval);
329
+ }
330
+ startCountdown() {
331
+ this.interval = setInterval(() => {
332
+ this.updateTimers();
333
+ }, 1000);
334
+ }
335
+ updateTimers() {
336
+ const now = new Date().getTime();
337
+ this.timers = this.challenges.filter(challenge => challenge.Status !== ChallengeProgressStatus.Expired).reduce((acc, challenge) => {
338
+ const expirationDate = new Date(challenge.ExpirationTime).getTime();
339
+ const diff = expirationDate - now;
340
+ let countdown = '00h:00m:00s';
341
+ if (diff < 1) {
342
+ this.removeChallenge(challenge.Id);
343
+ }
344
+ else {
345
+ const { days, hours, minutes, seconds } = {
346
+ days: String(Math.floor(diff / (1000 * 60 * 60 * 24))).padStart(2, '0'),
347
+ hours: String(Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
348
+ minutes: String(Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
349
+ seconds: String(Math.floor((diff % (1000 * 60)) / 1000)).padStart(2, '0')
350
+ };
351
+ countdown = days === '00'
352
+ ? `${hours}h:${minutes}m:${seconds}s`
353
+ : `${days}d:${hours}h:${minutes}m`;
354
+ }
355
+ return Object.assign(Object.assign({}, acc), { [challenge.Id]: countdown });
356
+ }, {});
357
+ }
358
+ removeChallenge(id) {
359
+ const index = this.challenges.findIndex(challenge => challenge.Id === id);
360
+ if (index > -1) {
361
+ this.challenges.splice(index, 1);
362
+ window.postMessage({ type: 'ChallengeHasExpired', id });
363
+ }
364
+ }
365
+ getChallengeClasses(challenge) {
366
+ return {
367
+ ChallengeCard: true,
368
+ InProgress: challenge.Status === ChallengeProgressStatus.InProgress
369
+ && !this.pausedChallengeIds.includes(challenge.Id),
370
+ Completed: this.isChallengeCompleted(challenge),
371
+ Paused: this.isChallengePaused(challenge)
372
+ };
373
+ }
374
+ isChallengePaused(challenge) {
375
+ return (challenge.Status === ChallengeProgressStatus.Started
376
+ && challenge.LevelProgresses[0].ProgressPercentage > 0)
377
+ || this.pausedChallengeIds.includes(challenge.Id);
378
+ }
379
+ isChallengeCompleted(challenge) {
380
+ return challenge.Status === ChallengeProgressStatus.Completed
381
+ || (challenge.Status === ChallengeProgressStatus.PendingLevelReward
382
+ && challenge.LevelProgresses.every(progress => progress.ProgressPercentage === 100));
383
+ }
384
+ getChallengeProgress(challenge) {
385
+ if (challenge.Status === ChallengeProgressStatus.Completed) {
386
+ return 100;
387
+ }
388
+ if (this.isChallengePaused(challenge)
389
+ || challenge.Status === ChallengeProgressStatus.PendingLevelReward
390
+ || challenge.Status === ChallengeProgressStatus.InProgress) {
391
+ const activeLevel = challenge.LevelProgresses
392
+ .find(level => level.ProgressStatus === ChallengeLevelProgressStatus.InProgress);
393
+ /**
394
+ * It is possible that Paused/InProgress challenge
395
+ * doesn't have InProgress level
396
+ * because level becomes InProgress after user's bet.
397
+ * In this case should be displayed progress of the next level (0%)
398
+ */
399
+ return activeLevel ? activeLevel.ProgressPercentage : 0;
400
+ }
401
+ return -1;
402
+ }
403
+ getChallengeHeaderTemplate(challenge) {
404
+ const { Id } = challenge;
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
407
+ ? translate('unjoin', this.language)
408
+ : translate('join', this.language)));
409
+ }
410
+ getChallengeTemplate(challenge) {
411
+ const challengeProgress = this.getChallengeProgress(challenge);
412
+ const countdown = this.timers[challenge.Id];
413
+ const isNewChallenge = this.newChallengeIds.includes(challenge.Id);
414
+ const progressTemplate = challengeProgress > -1
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))
416
+ : index.h("span", { class: "ChallengeCountdown" }, countdown);
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)))));
418
+ }
419
+ getHeaderTemplate() {
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" })));
421
+ }
422
+ getListTemplate() {
423
+ if (this.challenges.length) {
424
+ return index.h("div", { class: "ChallengesListWrapper" }, index.h("div", { class: "ChallengesList" }, this.challenges.map(challenge => this.getChallengeTemplate(challenge))));
425
+ }
426
+ else {
427
+ return index.h("div", { class: "ChallengesListEmpty" }, index.h("h2", null, translate('noChallenges', this.language)), index.h("p", null, translate('tryOtherGames', this.language)));
428
+ }
429
+ }
430
+ getTooltipTemplate() {
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)));
432
+ }
433
+ render() {
434
+ return index.h("div", { class: `ChallengesListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.tooltip && this.getTooltipTemplate());
435
+ }
436
+ get host() { return index.getElement(this); }
437
+ static get watchers() { return {
438
+ "challenges": ["challengesPropHandler"]
439
+ }; }
440
+ };
441
+ CasinoEngagementSuiteChallengesList.style = casinoEngagementSuiteChallengesListCss;
442
+
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)}";
444
+
445
+ const CasinoEngagementSuiteProgressBar = class {
446
+ constructor(hostRef) {
447
+ index.registerInstance(this, hostRef);
448
+ /**
449
+ * Value for the widget
450
+ */
451
+ this.value = 0;
452
+ /**
453
+ * Shows disabled styles
454
+ */
455
+ this.disabled = false;
456
+ /**
457
+ * Hide percent value
458
+ */
459
+ this.hidePercent = false;
460
+ /**
461
+ * Client custom styling via string
462
+ */
463
+ this.clientStyling = '';
464
+ /**
465
+ * Client custom styling via url
466
+ */
467
+ this.clientStylingUrl = '';
468
+ this.limitStylingAppends = false;
469
+ this.setClientStyling = () => {
470
+ let sheet = document.createElement('style');
471
+ sheet.innerHTML = this.clientStyling;
472
+ this.host.prepend(sheet);
473
+ };
474
+ this.setClientStylingURL = () => {
475
+ let url = new URL(this.clientStylingUrl);
476
+ let cssFile = document.createElement('style');
477
+ fetch(url.href)
478
+ .then((res) => res.text())
479
+ .then((data) => {
480
+ cssFile.innerHTML = data;
481
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
482
+ })
483
+ .catch((err) => {
484
+ console.log('Error ', err);
485
+ });
486
+ };
487
+ }
488
+ componentDidRender() {
489
+ if (!this.limitStylingAppends && this.host) {
490
+ if (this.clientStyling)
491
+ this.setClientStyling();
492
+ if (this.clientStylingUrl)
493
+ this.setClientStylingURL();
494
+ this.limitStylingAppends = true;
495
+ }
496
+ }
497
+ getProgressBarClasses() {
498
+ return {
499
+ ProgressBar: true,
500
+ Completed: this.value === 100,
501
+ Disabled: this.disabled,
502
+ HidePercent: this.hidePercent
503
+ };
504
+ }
505
+ render() {
506
+ return index.h("div", { class: this.getProgressBarClasses(), part: "ProgressBar" }, index.h("div", { class: "ProgressBarInfo", part: "ProgressBarInfo" }, index.h("slot", { name: "Title" }, index.h("div", null)), index.h("slot", { name: "Percent" }, index.h("div", { class: "ProgressBarPercent", part: "ProgressBarPercent" }, this.value, "%"))), index.h("div", { class: "ProgressBarBackground", part: "ProgressBarBackground" }, index.h("div", { class: "ProgressBarLine", part: "ProgressBarLine", style: { width: this.value + '%' } })));
507
+ }
508
+ get host() { return index.getElement(this); }
509
+ };
510
+ CasinoEngagementSuiteProgressBar.style = casinoEngagementSuiteProgressBarCss;
511
+
512
+ exports.casino_engagement_suite_challenges_list = CasinoEngagementSuiteChallengesList;
513
+ exports.casino_engagement_suite_progress_bar = CasinoEngagementSuiteProgressBar;