@everymatrix/casino-engagement-suite-jackpots-list 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 (49) hide show
  1. package/dist/casino-engagement-suite-jackpots-list/casino-engagement-suite-jackpots-list.esm.js +1 -0
  2. package/dist/casino-engagement-suite-jackpots-list/index.esm.js +0 -0
  3. package/dist/casino-engagement-suite-jackpots-list/p-a34aa41f.js +1 -0
  4. package/dist/casino-engagement-suite-jackpots-list/p-f5813d14.entry.js +1 -0
  5. package/dist/cjs/casino-engagement-suite-jackpots-list.cjs.entry.js +362 -0
  6. package/dist/cjs/casino-engagement-suite-jackpots-list.cjs.js +19 -0
  7. package/dist/cjs/index-9e718c74.js +1296 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/casino-engagement-suite-jackpots-list/casino-engagement-suite-jackpots-list.css +294 -0
  12. package/dist/collection/components/casino-engagement-suite-jackpots-list/casino-engagement-suite-jackpots-list.js +414 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/models/jackpot.js +1 -0
  15. package/dist/collection/utils/locale.utils.js +25 -0
  16. package/dist/collection/utils/utils.js +5 -0
  17. package/dist/components/casino-engagement-suite-jackpots-list.d.ts +11 -0
  18. package/dist/components/casino-engagement-suite-jackpots-list.js +386 -0
  19. package/dist/components/index.d.ts +26 -0
  20. package/dist/components/index.js +1 -0
  21. package/dist/esm/casino-engagement-suite-jackpots-list.entry.js +358 -0
  22. package/dist/esm/casino-engagement-suite-jackpots-list.js +17 -0
  23. package/dist/esm/index-f2db217f.js +1269 -0
  24. package/dist/esm/index.js +1 -0
  25. package/dist/esm/loader.js +17 -0
  26. package/dist/esm/polyfills/core-js.js +11 -0
  27. package/dist/esm/polyfills/css-shim.js +1 -0
  28. package/dist/esm/polyfills/dom.js +79 -0
  29. package/dist/esm/polyfills/es5-html-element.js +1 -0
  30. package/dist/esm/polyfills/index.js +34 -0
  31. package/dist/esm/polyfills/system.js +6 -0
  32. package/dist/index.cjs.js +1 -0
  33. package/dist/index.js +1 -0
  34. package/dist/stencil.config.js +22 -0
  35. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-jackpots-list/.stencil/packages/casino-engagement-suite-jackpots-list/stencil.config.d.ts +2 -0
  36. package/dist/types/components/casino-engagement-suite-jackpots-list/casino-engagement-suite-jackpots-list.d.ts +62 -0
  37. package/dist/types/components.d.ts +87 -0
  38. package/dist/types/index.d.ts +1 -0
  39. package/dist/types/models/jackpot.d.ts +52 -0
  40. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  41. package/dist/types/utils/locale.utils.d.ts +1 -0
  42. package/dist/types/utils/utils.d.ts +1 -0
  43. package/loader/cdn.js +3 -0
  44. package/loader/index.cjs.js +3 -0
  45. package/loader/index.d.ts +12 -0
  46. package/loader/index.es2017.js +3 -0
  47. package/loader/index.js +4 -0
  48. package/loader/package.json +10 -0
  49. package/package.json +19 -0
@@ -0,0 +1 @@
1
+ import{p as t,b as n}from"./p-a34aa41f.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((t=>n([["p-f5813d14",[[1,"casino-engagement-suite-jackpots-list",{clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],language:[1],device:[1],jackpots:[1040],buttonsLoadingStates:[1040],tooltip:[32],timers:[32],limitStylingAppends:[32]},[[8,"message","handleEvent"]]]]]],t)));
@@ -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=a(e,n),c=u(t,s),r=f(n);o.ael(i,l,c,r),(t.o=t.o||[]).push((()=>o.rel(i,l,c,r)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},a=(e,t)=>8&t?l:e,f=e=>0!=(2&e),d=new WeakMap,$=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&&!y(l))&&(l+=""),o&&i?c[c.length-1].h+=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 u=p(e,null);return u.m=t,c.length>0&&(u.p=c),u.g=s,u},p=(e,t)=>({t:0,S:e,h: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),u=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("key"===t);else if(r||"o"!==t[0]||"n"!==t[1]){const l=y(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,u)?u.slice(2):u[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||h,i=t.m||h;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.h)o=c.k=s.createTextNode(c.h);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.h;null===o?(k(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o,i=0,c=0,r=0,u=0,a=t.length-1,f=t[0],d=t[a],$=l.length-1,h=l[0],y=l[$];for(;i<=a&&c<=$;)if(null==f)f=t[++i];else if(null==d)d=t[--a];else if(null==h)h=l[++c];else if(null==y)y=l[--$];else if(C(f,h))O(f,h),f=t[++i],h=l[++c];else if(C(d,y))O(d,y),d=t[--a],y=l[--$];else if(C(f,y))O(f,y),e.insertBefore(f.k,d.k.nextSibling),f=t[++i],y=l[--$];else if(C(d,h))O(d,h),e.insertBefore(d.k,f.k),d=t[--a],h=l[++c];else{for(r=-1,u=i;u<=a;++u)if(t[u]&&null!==t[u].g&&t[u].g===h.g){r=u;break}r>=0?(o=t[r],o.S!==h.S?s=j(t&&t[c],n,r):(O(o,h),t[r]=void 0,s=o.k),h=l[++c]):(s=j(t&&t[c],n,c),h=l[++c]),s&&f.k.parentNode.insertBefore(s,f.k)}i>a?v(e,null==l[$+1]?null:l[$+1].k,n,l,c,$):c>$&&M(t,i,a)})(n,l,t,s):null!==s?(null!==e.h&&(n.textContent=""),v(n,null,t,s,0,s.length-1)):null!==l&&M(l,0,l.length-1)):e.h!==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},N=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},R=(e,t)=>{if(e.t|=16,!(4&e.t))return N(e,e.M),se((()=>T(e,t)));e.t|=512},T=(e,t)=>{const n=e.i;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>q(n,e,t))),e.u=null)),D(void 0,(()=>A(e,n,t)))},A=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=$(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);L(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>U(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},L=(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},U=e=>{const t=e.j,n=e.M;q(e.i,"componentDidRender"),64&e.t||(e.t|=64,F(t),e.N(t),n||W()),e.v&&(e.v(),e.v=void 0),512&e.t&&le((()=>R(e,!1))),e.t&=-517},W=()=>{F(s.documentElement),le((()=>E(l,"appload",{detail:{namespace:"casino-engagement-suite-jackpots-list"}})))},q=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},D=(e,t)=>e&&e.then?e.then(t):t(),F=e=>e.classList.add("hydrated"),H=(e,t,n)=>{if(t.R){e.watchers&&(t.T=e.watchers);const l=Object.entries(t.R),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>z(this).A.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=z(e),o=s.j,i=s.A.get(t),c=s.t,r=s.i;if(n=((e,t)=>null==e||y(e)?e:1&t?e+"":e)(n,l.R[t][0]),(!(8&c)||void 0===i)&&n!==i&&(!Number.isNaN(i)||!Number.isNaN(n))&&(s.A.set(t,n),r)){if(l.T&&128&c){const e=l.T[t];e&&e.map((e=>{try{r[e](n,i,t)}catch(e){J(e,o)}}))}2==(18&c)&&R(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||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),d=s.createElement("style"),h=[];let y,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],$:t[1],R:t[2],L:t[3]};l.R=t[2],l.L=t[3],l.P=[],l.T={};const s=l.$,a=class extends HTMLElement{constructor(e){super(e),G(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){y&&(clearTimeout(y),y=null),m?h.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.L);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){N(t,t.M=n);break}}n.R&&Object.entries(n.R).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.T=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=$(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=()=>R(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),q(t,"disconnectedCallback")}})()))}componentOnReady(){return z(this).U}};l.W=e[0],i.includes(s)||u.get(s)||(n.push(s),u.define(s,H(a,l,1)))}))})),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),a.insertBefore(d,f?f.nextSibling:a.firstChild),m=!1,h.length?h.map((e=>e.connectedCallback())):o.jmp((()=>y=setTimeout(W,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,A:new Map};return n.U=new Promise((e=>n.N=e)),e["s-p"]=[],e["s-rc"]=[],r(e,n,t.L),_.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.$.replace(/-/g,"_"),n=e.W,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}
@@ -0,0 +1 @@
1
+ import{r as t,c as o,h as e,g as a}from"./p-a34aa41f.js";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,o){if(o.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+o.length+" present")}function n(t){s(1,arguments);var o=Object.prototype.toString.call(t);return t instanceof Date||"object"===i(t)&&"[object Date]"===o?new Date(t.getTime()):"number"==typeof t||"[object Number]"===o?new Date(t):("string"!=typeof t&&"[object String]"!==o||"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 p(t,o){s(2,arguments);var e=n(t),a=n(o);return e.getTime()<a.getTime()}const r=["en"],c={en:{jackpots:"Jackpots",join:"Join",unjoin:"Unjoin",tooltip:"A payout that increases each time the game is played but the jackpot is not won",mega:"Mega",major:"Major",minor:"Minor",suspended:"Suspended Jackpot",allJackpotsSuspended:"Unfortunately, there are no available jackpots to join. Please, try again later.",jackpotIsWon:"Jackpot is Won",termsAndConditions:"Terms and Conditions",winingProbability:"Winning Probability",type:"Type",operatorContribution:"Operator Contribution",outdatedJackpotCountdown:"We are going to remove this Jackpot in 30 days"}},l=(t,o)=>{const e=o;return c[void 0!==e&&r.includes(e)?e:"en"][t]},d=class{constructor(e){t(this,e),this.close=o(this,"close",7),this.clientStyling="",this.clientStylingUrl="",this.language="en",this.device="Mobile",this.jackpots=[],this.buttonsLoadingStates={},this.tooltip=!1,this.timers={},this.limitStylingAppends=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.host.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),o=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{o.innerHTML=t,setTimeout((()=>{this.host.prepend(o)}),1)})).catch((t=>{console.log("Error ",t)}))},this.handleCloseClick=()=>{this.close.emit(),this.tooltip=!1},this.showTooltip=()=>{this.tooltip=!0},this.hideTooltip=()=>{this.tooltip=!1},this.changeJackpotStatus=t=>{t.stopPropagation();const o=+t.currentTarget.getAttribute("data-id"),e=t.currentTarget.hasAttribute("data-joined");window.postMessage({type:"JackpotChangeStatusRequest",data:{[o]:!e}}),this.buttonsLoadingStates=Object.assign(Object.assign({},this.buttonsLoadingStates),{[o]:!0})},this.handleJackpotClick=t=>{const o=+t.currentTarget.getAttribute("data-id");window.postMessage({type:"JackpotClick",id:o})}}jackpotsPropHandler(t){!this.interval&&t.length&&this.startCountdown(),this.interval&&!t.length&&clearInterval(this.interval)}handleEvent(t){const{type:o,data:e}=t.data;switch(o){case"UpdateJackpotBalance":const o=t.data.data;this.jackpots=this.jackpots.map((t=>{const e=o.find((o=>o.JackpotId===t.Id));return e?Object.assign(Object.assign({},t),{Balance:e.Balance,WinBalance:e.WinBalance}):t}));break;case"UpdateJackpotStatus":const a=e,i=this.jackpots.findIndex((t=>t.Id===a.JackpotId));1!==i&&(this.jackpots[i].IsClosed=a.IsClosed);break;case"JoinJackpotResult":const s=e,n=Object.keys(s.JackpotIds);s.Success&&n.length>0&&(this.jackpots=this.jackpots.map((t=>{const o=n.find((o=>String(o)===String(t.Id)));return o?Object.assign(Object.assign({},t),{Enabled:s.JackpotIds[o]}):t}))),this.buttonsLoadingStates=Object.fromEntries(Object.entries(this.buttonsLoadingStates).filter((([t])=>!n.includes(t))))}}startCountdown(){this.updateTimers(),this.interval=setInterval((()=>{this.updateTimers()}),1e3)}updateTimers(){const t=(new Date).getTime();this.timers=this.jackpots.reduce(((o,e)=>{const a=new Date(e.JackpotEndTime).getTime()-t;let i="00h:00m:00s";const{days:s,hours:n,minutes:p,seconds:r}={days:String(Math.floor(a/864e5)).padStart(2,"0"),hours:String(Math.floor(a%864e5/36e5)).padStart(2,"0"),minutes:String(Math.floor(a%36e5/6e4)).padStart(2,"0"),seconds:String(Math.floor(a%6e4/1e3)).padStart(2,"0")};return i="00"===s?`${n}h:${p}m:${r}s`:`${s}d:${n}h:${p}m`,Object.assign(Object.assign({},o),{[e.Id]:i})}),{})}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}disconnectedCallback(){this.interval&&clearInterval(this.interval)}getJackpotClasses(t){return{JackpotCard:!0,JackpotCardSuspended:t.IsClosed,InProgress:t.Enabled&&!t.IsClosed}}getJackpotHeaderTemplate(t){const o=!!t.WinBalance,a=o?t.WinBalance:t.Balance,i=l(t.Type,this.language),s=l("suspended",this.language),n=(null==t?void 0:t.IsClosed)?s:i,r=`JackpotBalance Jackpot${l(t.Type,this.language)}`,c=t.Enabled&&!(null==t?void 0:t.IsClosed)?"JackpotJoinButton Joined":"JackpotJoinButton",d=l(t.Enabled&&!(null==t?void 0:t.IsClosed)?"unjoin":"join",this.language),u=!(null==t?void 0:t.IsClosed)||p(new Date(t.JackpotEndTime),new Date),k=!!this.buttonsLoadingStates[t.Id];return e("div",{class:"JackpotCardHeader"},e("div",{class:"JackpotTitle"},e("span",{class:"JackpotName"},n),e("span",{class:r},function(t,o,e=99999999){return t=Math.min(t,e),`${o} ${new Intl.NumberFormat("en",{minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}`}(a,t.Currency))),o?e("span",{class:"JackpotWon"},l("jackpotIsWon",this.language)):u&&e("button",{class:c,onClick:this.changeJackpotStatus,"data-id":t.Id,"data-joined":t.Enabled,disabled:k},d))}getJackpotDescriptionTemplate(t){const o=t.OperatorContributionPercent+"%",a=t.Probability+"%",i=p(new Date(t.JackpotEndTime),new Date)?l("outdatedJackpotCountdown",this.language):this.timers[t.Id],s=l("operatorContribution",this.language),n=l("type",this.language),r=l("winingProbability",this.language);return e("div",{class:"JackpotCardDescription"},e("span",{class:"JackpotCountdown"},i),e("div",{class:"JackpotCardDescriptionBlock"},e("div",{class:"JackpotCardDescriptionColumn"},this.renderDesciptionRowInfo(`${s}:`,o),this.renderDesciptionRowInfo(`${n}:`,t.JackpotTypePresentation)),e("div",{class:"JackpotCardDescriptionColumn"},this.renderDesciptionRowInfo(`${r}:`,a),e("a",{href:t.JackpotRulesUrl,target:"_blank"},l("termsAndConditions",this.language)))))}renderDesciptionRowInfo(t,o){return e("div",{class:"JackpotCardDescriptionRow"},e("span",null,t),e("span",{class:"JackpotDescriptionValue"},o))}getJackpotTemplate(t){const o=!(null==t?void 0:t.WinBalance);return e("div",{class:this.getJackpotClasses(t),onClick:this.handleJackpotClick,key:t.Id,"data-id":t.Id},this.getJackpotHeaderTemplate(t),o&&this.getJackpotDescriptionTemplate(t))}getHeaderTemplate(){return e("header",{class:"JackpotsListPopupHeader"},e("button",{onClick:this.showTooltip,class:"JackpotsIconButton"},e("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/help.svg",alt:"Show tooltip"})),e("div",{class:"JackpotsListPopupHeaderName"},l("jackpots",this.language)),e("button",{class:"JackpotsIconButton",onClick:this.handleCloseClick},e("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/close.svg",alt:"Close jackpots list"})))}getListTemplate(){const t=this.jackpots.every((t=>t.IsClosed));return this.jackpots.length?e("div",{class:"JackpotsListWrapper"},t&&e("div",{class:"JackpotsListSuspended"},e("h2",null,l("allJackpotsSuspended",this.language))),e("div",{class:"JackpotsList"},this.jackpots.map((t=>this.getJackpotTemplate(t))))):e("div",{class:"JackpotsListSuspended"},e("h2",null,l("allJackpotsSuspended",this.language)))}getTooltipTemplate(){return this.tooltip?e("div",{class:"JackpotsTooltipBackdrop"},e("div",{class:"JackpotsTooltip"},e("button",{class:"JackpotsIconButton",onClick:this.hideTooltip},e("img",{src:"https://static.everymatrix.com/gic/img/engagement-suite/close.svg",alt:"Close tooltip"})),l("tooltip",this.language))):""}render(){return e("div",{class:`JackpotsListPopup ${this.device}`},this.getHeaderTemplate(),this.getListTemplate(),this.getTooltipTemplate())}get host(){return a(this)}static get watchers(){return{jackpots:["jackpotsPropHandler"]}}};d.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}body{margin:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.JackpotsListPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:var(--emw--border-radius-medium, 8px);overflow:hidden;flex-direction:column;position:relative}.JackpotsListPopupHeader{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.JackpotsIconButton{width:16px;height:16px;cursor:pointer}.JackpotsListPopupHeaderName{color:var(--emw--color-gray-100, #BBB9C3);font-size:14px;font-weight:500;line-height:14px}.JackpotsListWrapper{overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.JackpotsListWrapper::-webkit-scrollbar{display:none}.JackpotsList{display:flex;flex-direction:column;row-gap:12px;padding:8px 19px 0}.JackpotCard{padding:15px 15px 19px;border:1px solid var(--emw--button-border-color, #403956);border-radius:var(--emw--border-radius-small, 6px);position:relative;cursor:pointer}.JackpotJoinButton:not([disabled]).Joined::before,.JackpotCard.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}.JackpotCard.JackpotCardSuspended *{color:var(--emw--color-primary, #8F8B9C)}.JackpotCard.JackpotCardSuspended .JackpotBalance,.JackpotCard.JackpotCardSuspended .JackpotWon{-webkit-text-fill-color:var(--emw--color-primary, #8F8B9C)}.JackpotCardHeader{display:flex;justify-content:space-between;gap:24px}.JackpotTitle{display:flex;flex-direction:column;justify-content:space-between}.JackpotName{color:var(--emw--color-typography, #FFFFFF);font-family:"Montserrat", sans-serif;line-height:22px;font-weight:700;font-size:18px;word-break:break-word;margin-bottom:4px}.JackpotMega,.JackpotWon{background:linear-gradient(180deg, #FFB801 15.86%, #FEF746 31.36%, #FBFFE0 36.86%, #FFFA60 47.86%, #FF9400 87.36%)}.JackpotMajor{background:linear-gradient(180deg, #A19FA0 5.36%, #E1DBDB 28.86%, #FEFFFF 36.86%, #E1DBDB 44.36%, #5E5B5F 91.86%)}.JackpotMinor{background:linear-gradient(180deg, #A0522C 5.36%, #FFAB8C 28.86%, #FFEEDF 36.86%, #FFAB8C 44.36%, #6A3A21 91.86%)}.JackpotBalance,.JackpotWon{font-weight:bold;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}.JackpotCardDescription{display:flex;flex-direction:column;margin-top:12px}.JackpotCardDescriptionRow{display:flex;align-items:center;color:var(--emw--color-primary, #8F8B9C);font-size:12px;line-height:12px}.JackpotCardDescriptionRow .JackpotDescriptionValue{font-weight:600;margin-left:2px}.JackpotCardDescriptionColumn{display:flex;flex-direction:column;row-gap:4px}.JackpotCardDescriptionBlock{display:flex;justify-content:space-between;column-gap:14px}.JackpotCardDescriptionBlock a{color:var(--emw--color-secondary, #59D1FF);text-underline-offset:3px;font-size:11px}.JackpotJoinButton{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}.JackpotJoinButton.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}.JackpotJoinButton.Joined:not([disabled])::before{border-radius:99px}.JackpotJoinButton[disabled]{opacity:0.5;pointer-events:none;cursor:auto}.JackpotsListSuspended{padding:20px 19px}.JackpotsListSuspended h2{font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3);font-weight:400}.JackpotCountdown{color:var(--emw--color-gray-100, #BBB9C3);font-size:12px;line-height:12px;margin-bottom:12px}.JackpotsTooltipBackdrop{padding:48px 30px 0;position:absolute;width:100%;height:100%;inset:0;background-color:rgba(0, 0, 0, 0.5)}.JackpotsTooltipBackdrop .JackpotsTooltip{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}.JackpotsTooltipBackdrop .JackpotsTooltip .JackpotsIconButton{top:12px;right:6px;position:absolute}.JackpotsListPopup.Tablet .JackpotsListPopupHeader,.JackpotsListPopup.Desktop .JackpotsListPopupHeader{padding-top:16px}.JackpotsListPopup.Tablet .JackpotsListPopupHeaderName,.JackpotsListPopup.Desktop .JackpotsListPopupHeaderName{font-size:16px;line-height:16px}.JackpotsListPopup.Tablet .JackpotsIconButton,.JackpotsListPopup.Desktop .JackpotsIconButton{width:24px;height:24px}.JackpotsListPopup.Tablet .JackpotsList,.JackpotsListPopup.Desktop .JackpotsList{padding:20px 24px 0;row-gap:20px}.JackpotsListPopup.Tablet .JackpotCardHeader,.JackpotsListPopup.Desktop .JackpotCardHeader{margin-bottom:16px}.JackpotsListPopup.Tablet .JackpotName,.JackpotsListPopup.Desktop .JackpotName{line-height:27px;font-size:22px}.JackpotsListPopup.Tablet .JackpotJoinButton,.JackpotsListPopup.Desktop .JackpotJoinButton{min-width:100px;height:36px;font-size:16px}.JackpotsListPopup.Tablet .JackpotCountdown,.JackpotsListPopup.Desktop .JackpotCountdown{font-size:14px;line-height:14px}.JackpotsListPopup.Tablet .JackpotTooltip,.JackpotsListPopup.Desktop .JackpotTooltip{padding:60px 65px;font-size:16px;line-height:20px}.JackpotsListPopup.Tablet .JackpotTooltip .JackpotsIconButton,.JackpotsListPopup.Desktop .JackpotTooltip .JackpotsIconButton{top:24px;right:24px}';export{d as casino_engagement_suite_jackpots_list}
@@ -0,0 +1,362 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-9e718c74.js');
6
+
7
+ function _typeof(o) {
8
+ "@babel/helpers - typeof";
9
+
10
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
11
+ return typeof o;
12
+ } : function (o) {
13
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
14
+ }, _typeof(o);
15
+ }
16
+
17
+ function requiredArgs(required, args) {
18
+ if (args.length < required) {
19
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
20
+ }
21
+ }
22
+
23
+ /**
24
+ * @name toDate
25
+ * @category Common Helpers
26
+ * @summary Convert the given argument to an instance of Date.
27
+ *
28
+ * @description
29
+ * Convert the given argument to an instance of Date.
30
+ *
31
+ * If the argument is an instance of Date, the function returns its clone.
32
+ *
33
+ * If the argument is a number, it is treated as a timestamp.
34
+ *
35
+ * If the argument is none of the above, the function returns Invalid Date.
36
+ *
37
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
38
+ *
39
+ * @param {Date|Number} argument - the value to convert
40
+ * @returns {Date} the parsed date in the local time zone
41
+ * @throws {TypeError} 1 argument required
42
+ *
43
+ * @example
44
+ * // Clone the date:
45
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
46
+ * //=> Tue Feb 11 2014 11:30:30
47
+ *
48
+ * @example
49
+ * // Convert the timestamp to date:
50
+ * const result = toDate(1392098430000)
51
+ * //=> Tue Feb 11 2014 11:30:30
52
+ */
53
+ function toDate(argument) {
54
+ requiredArgs(1, arguments);
55
+ var argStr = Object.prototype.toString.call(argument);
56
+
57
+ // Clone the date
58
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
59
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
60
+ return new Date(argument.getTime());
61
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
62
+ return new Date(argument);
63
+ } else {
64
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
65
+ // eslint-disable-next-line no-console
66
+ 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");
67
+ // eslint-disable-next-line no-console
68
+ console.warn(new Error().stack);
69
+ }
70
+ return new Date(NaN);
71
+ }
72
+ }
73
+
74
+ /**
75
+ * @name isBefore
76
+ * @category Common Helpers
77
+ * @summary Is the first date before the second one?
78
+ *
79
+ * @description
80
+ * Is the first date before the second one?
81
+ *
82
+ * @param {Date|Number} date - the date that should be before the other one to return true
83
+ * @param {Date|Number} dateToCompare - the date to compare with
84
+ * @returns {Boolean} the first date is before the second date
85
+ * @throws {TypeError} 2 arguments required
86
+ *
87
+ * @example
88
+ * // Is 10 July 1989 before 11 February 1987?
89
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
90
+ * //=> false
91
+ */
92
+ function isBefore(dirtyDate, dirtyDateToCompare) {
93
+ requiredArgs(2, arguments);
94
+ var date = toDate(dirtyDate);
95
+ var dateToCompare = toDate(dirtyDateToCompare);
96
+ return date.getTime() < dateToCompare.getTime();
97
+ }
98
+
99
+ const DEFAULT_LANGUAGE = 'en';
100
+ const SUPPORTED_LANGUAGES = ['en'];
101
+ const TRANSLATIONS = {
102
+ en: {
103
+ jackpots: 'Jackpots',
104
+ join: 'Join',
105
+ unjoin: 'Unjoin',
106
+ tooltip: 'A payout that increases each time the game is played but the jackpot is not won',
107
+ mega: 'Mega',
108
+ major: 'Major',
109
+ minor: 'Minor',
110
+ suspended: 'Suspended Jackpot',
111
+ allJackpotsSuspended: 'Unfortunately, there are no available jackpots to join. Please, try again later.',
112
+ jackpotIsWon: 'Jackpot is Won',
113
+ termsAndConditions: 'Terms and Conditions',
114
+ winingProbability: 'Winning Probability',
115
+ type: 'Type',
116
+ operatorContribution: 'Operator Contribution',
117
+ outdatedJackpotCountdown: 'We are going to remove this Jackpot in 30 days'
118
+ }
119
+ };
120
+ const translate = (key, customLang) => {
121
+ const lang = customLang;
122
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
123
+ };
124
+
125
+ function formatBalance(amount, currency, maxAmount = 99999999) {
126
+ amount = Math.min(amount, maxAmount);
127
+ return `${currency} ${new Intl.NumberFormat('en', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
128
+ .format(amount)}`;
129
+ }
130
+
131
+ const casinoEngagementSuiteJackpotsListCss = "@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}body{margin:0}button{border:none;background:none;cursor:pointer}button:focus{outline:none}.JackpotsListPopup{display:flex;height:100%;background-color:var(--emw--color-background, #1E1638);border-radius:var(--emw--border-radius-medium, 8px);overflow:hidden;flex-direction:column;position:relative}.JackpotsListPopupHeader{display:flex;justify-content:space-between;align-items:center;padding:12px 8px 8px}.JackpotsIconButton{width:16px;height:16px;cursor:pointer}.JackpotsListPopupHeaderName{color:var(--emw--color-gray-100, #BBB9C3);font-size:14px;font-weight:500;line-height:14px}.JackpotsListWrapper{overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.JackpotsListWrapper::-webkit-scrollbar{display:none}.JackpotsList{display:flex;flex-direction:column;row-gap:12px;padding:8px 19px 0}.JackpotCard{padding:15px 15px 19px;border:1px solid var(--emw--button-border-color, #403956);border-radius:var(--emw--border-radius-small, 6px);position:relative;cursor:pointer}.JackpotJoinButton:not([disabled]).Joined::before,.JackpotCard.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}.JackpotCard.JackpotCardSuspended *{color:var(--emw--color-primary, #8F8B9C)}.JackpotCard.JackpotCardSuspended .JackpotBalance,.JackpotCard.JackpotCardSuspended .JackpotWon{-webkit-text-fill-color:var(--emw--color-primary, #8F8B9C)}.JackpotCardHeader{display:flex;justify-content:space-between;gap:24px}.JackpotTitle{display:flex;flex-direction:column;justify-content:space-between}.JackpotName{color:var(--emw--color-typography, #FFFFFF);font-family:\"Montserrat\", sans-serif;line-height:22px;font-weight:700;font-size:18px;word-break:break-word;margin-bottom:4px}.JackpotMega,.JackpotWon{background:linear-gradient(180deg, #FFB801 15.86%, #FEF746 31.36%, #FBFFE0 36.86%, #FFFA60 47.86%, #FF9400 87.36%)}.JackpotMajor{background:linear-gradient(180deg, #A19FA0 5.36%, #E1DBDB 28.86%, #FEFFFF 36.86%, #E1DBDB 44.36%, #5E5B5F 91.86%)}.JackpotMinor{background:linear-gradient(180deg, #A0522C 5.36%, #FFAB8C 28.86%, #FFEEDF 36.86%, #FFAB8C 44.36%, #6A3A21 91.86%)}.JackpotBalance,.JackpotWon{font-weight:bold;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}.JackpotCardDescription{display:flex;flex-direction:column;margin-top:12px}.JackpotCardDescriptionRow{display:flex;align-items:center;color:var(--emw--color-primary, #8F8B9C);font-size:12px;line-height:12px}.JackpotCardDescriptionRow .JackpotDescriptionValue{font-weight:600;margin-left:2px}.JackpotCardDescriptionColumn{display:flex;flex-direction:column;row-gap:4px}.JackpotCardDescriptionBlock{display:flex;justify-content:space-between;column-gap:14px}.JackpotCardDescriptionBlock a{color:var(--emw--color-secondary, #59D1FF);text-underline-offset:3px;font-size:11px}.JackpotJoinButton{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}.JackpotJoinButton.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}.JackpotJoinButton.Joined:not([disabled])::before{border-radius:99px}.JackpotJoinButton[disabled]{opacity:0.5;pointer-events:none;cursor:auto}.JackpotsListSuspended{padding:20px 19px}.JackpotsListSuspended h2{font-size:14px;line-height:17px;color:var(--emw--color-gray-100, #BBB9C3);font-weight:400}.JackpotCountdown{color:var(--emw--color-gray-100, #BBB9C3);font-size:12px;line-height:12px;margin-bottom:12px}.JackpotsTooltipBackdrop{padding:48px 30px 0;position:absolute;width:100%;height:100%;inset:0;background-color:rgba(0, 0, 0, 0.5)}.JackpotsTooltipBackdrop .JackpotsTooltip{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}.JackpotsTooltipBackdrop .JackpotsTooltip .JackpotsIconButton{top:12px;right:6px;position:absolute}.JackpotsListPopup.Tablet .JackpotsListPopupHeader,.JackpotsListPopup.Desktop .JackpotsListPopupHeader{padding-top:16px}.JackpotsListPopup.Tablet .JackpotsListPopupHeaderName,.JackpotsListPopup.Desktop .JackpotsListPopupHeaderName{font-size:16px;line-height:16px}.JackpotsListPopup.Tablet .JackpotsIconButton,.JackpotsListPopup.Desktop .JackpotsIconButton{width:24px;height:24px}.JackpotsListPopup.Tablet .JackpotsList,.JackpotsListPopup.Desktop .JackpotsList{padding:20px 24px 0;row-gap:20px}.JackpotsListPopup.Tablet .JackpotCardHeader,.JackpotsListPopup.Desktop .JackpotCardHeader{margin-bottom:16px}.JackpotsListPopup.Tablet .JackpotName,.JackpotsListPopup.Desktop .JackpotName{line-height:27px;font-size:22px}.JackpotsListPopup.Tablet .JackpotJoinButton,.JackpotsListPopup.Desktop .JackpotJoinButton{min-width:100px;height:36px;font-size:16px}.JackpotsListPopup.Tablet .JackpotCountdown,.JackpotsListPopup.Desktop .JackpotCountdown{font-size:14px;line-height:14px}.JackpotsListPopup.Tablet .JackpotTooltip,.JackpotsListPopup.Desktop .JackpotTooltip{padding:60px 65px;font-size:16px;line-height:20px}.JackpotsListPopup.Tablet .JackpotTooltip .JackpotsIconButton,.JackpotsListPopup.Desktop .JackpotTooltip .JackpotsIconButton{top:24px;right:24px}";
132
+
133
+ const CasinoEngagementSuiteJackpotsList = class {
134
+ constructor(hostRef) {
135
+ index.registerInstance(this, hostRef);
136
+ this.close = index.createEvent(this, "close", 7);
137
+ /**
138
+ * Client custom styling via string
139
+ */
140
+ this.clientStyling = '';
141
+ /**
142
+ * Client custom styling via url
143
+ */
144
+ this.clientStylingUrl = '';
145
+ /**
146
+ * Language of the widget
147
+ */
148
+ this.language = 'en';
149
+ /**
150
+ * User's device type
151
+ */
152
+ this.device = 'Mobile';
153
+ /**
154
+ * List of jackpots
155
+ */
156
+ this.jackpots = [];
157
+ /**
158
+ * Join/Unjoin buttons state
159
+ */
160
+ this.buttonsLoadingStates = {};
161
+ this.tooltip = false;
162
+ this.timers = {};
163
+ this.limitStylingAppends = false;
164
+ this.setClientStyling = () => {
165
+ let sheet = document.createElement('style');
166
+ sheet.innerHTML = this.clientStyling;
167
+ this.host.prepend(sheet);
168
+ };
169
+ this.setClientStylingURL = () => {
170
+ let url = new URL(this.clientStylingUrl);
171
+ let cssFile = document.createElement('style');
172
+ fetch(url.href)
173
+ .then((res) => res.text())
174
+ .then((data) => {
175
+ cssFile.innerHTML = data;
176
+ setTimeout(() => {
177
+ this.host.prepend(cssFile);
178
+ }, 1);
179
+ })
180
+ .catch((err) => {
181
+ console.log('Error ', err);
182
+ });
183
+ };
184
+ this.handleCloseClick = () => {
185
+ this.close.emit();
186
+ this.tooltip = false;
187
+ };
188
+ this.showTooltip = () => {
189
+ this.tooltip = true;
190
+ };
191
+ this.hideTooltip = () => {
192
+ this.tooltip = false;
193
+ };
194
+ this.changeJackpotStatus = (ev) => {
195
+ ev.stopPropagation();
196
+ const id = +ev.currentTarget.getAttribute('data-id');
197
+ const joinedStatus = ev.currentTarget.hasAttribute('data-joined');
198
+ window.postMessage({
199
+ type: 'JackpotChangeStatusRequest',
200
+ data: {
201
+ [id]: !joinedStatus,
202
+ },
203
+ });
204
+ this.buttonsLoadingStates = Object.assign(Object.assign({}, this.buttonsLoadingStates), { [id]: true });
205
+ };
206
+ this.handleJackpotClick = (ev) => {
207
+ const id = +ev.currentTarget.getAttribute('data-id');
208
+ window.postMessage({ type: 'JackpotClick', id });
209
+ };
210
+ }
211
+ jackpotsPropHandler(value) {
212
+ if (!this.interval && value.length) {
213
+ this.startCountdown();
214
+ }
215
+ if (this.interval && !value.length) {
216
+ clearInterval(this.interval);
217
+ }
218
+ }
219
+ handleEvent(e) {
220
+ const { type, data } = e.data;
221
+ switch (type) {
222
+ case 'UpdateJackpotBalance':
223
+ const updatedJackpots = e.data.data;
224
+ this.jackpots = this.jackpots.map(jackpot => {
225
+ const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.Id);
226
+ return updatedJackpot
227
+ ? Object.assign(Object.assign({}, jackpot), { Balance: updatedJackpot.Balance, WinBalance: updatedJackpot.WinBalance }) : jackpot;
228
+ });
229
+ break;
230
+ case 'UpdateJackpotStatus':
231
+ const statusUpdate = data;
232
+ const index = this.jackpots.findIndex((jackpot) => jackpot.Id === statusUpdate.JackpotId);
233
+ if (index !== 1) {
234
+ this.jackpots[index].IsClosed = statusUpdate.IsClosed;
235
+ }
236
+ break;
237
+ case 'JoinJackpotResult':
238
+ const joinJackpotResult = data;
239
+ const jackpotIds = Object.keys(joinJackpotResult.JackpotIds);
240
+ if (joinJackpotResult.Success) {
241
+ if (jackpotIds.length > 0) {
242
+ this.jackpots = this.jackpots.map(jackpot => {
243
+ const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.Id));
244
+ return matchedJackpotId
245
+ ? Object.assign(Object.assign({}, jackpot), { Enabled: joinJackpotResult.JackpotIds[matchedJackpotId] }) : jackpot;
246
+ });
247
+ }
248
+ }
249
+ this.buttonsLoadingStates = Object.fromEntries(Object.entries(this.buttonsLoadingStates).filter(([key]) => !jackpotIds.includes((key))));
250
+ break;
251
+ }
252
+ }
253
+ startCountdown() {
254
+ this.updateTimers();
255
+ this.interval = setInterval(() => {
256
+ this.updateTimers();
257
+ }, 1000);
258
+ }
259
+ updateTimers() {
260
+ const now = new Date().getTime();
261
+ this.timers = this.jackpots.reduce((acc, jackpot) => {
262
+ const expirationDate = new Date(jackpot.JackpotEndTime).getTime();
263
+ const diff = expirationDate - now;
264
+ let countdown = '00h:00m:00s';
265
+ const { days, hours, minutes, seconds } = {
266
+ days: String(Math.floor(diff / (1000 * 60 * 60 * 24))).padStart(2, '0'),
267
+ hours: String(Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0'),
268
+ minutes: String(Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0'),
269
+ seconds: String(Math.floor((diff % (1000 * 60)) / 1000)).padStart(2, '0'),
270
+ };
271
+ countdown =
272
+ days === '00'
273
+ ? `${hours}h:${minutes}m:${seconds}s`
274
+ : `${days}d:${hours}h:${minutes}m`;
275
+ return Object.assign(Object.assign({}, acc), { [jackpot.Id]: countdown });
276
+ }, {});
277
+ }
278
+ componentDidRender() {
279
+ if (!this.limitStylingAppends && this.host) {
280
+ if (this.clientStyling)
281
+ this.setClientStyling();
282
+ if (this.clientStylingUrl)
283
+ this.setClientStylingURL();
284
+ this.limitStylingAppends = true;
285
+ }
286
+ }
287
+ disconnectedCallback() {
288
+ this.interval && clearInterval(this.interval);
289
+ }
290
+ getJackpotClasses(jackpot) {
291
+ return {
292
+ JackpotCard: true,
293
+ JackpotCardSuspended: jackpot.IsClosed,
294
+ InProgress: jackpot.Enabled && !jackpot.IsClosed,
295
+ };
296
+ }
297
+ getJackpotHeaderTemplate(jackpot) {
298
+ const jackpotIsWon = !!jackpot.WinBalance;
299
+ const jackpotBalance = jackpotIsWon ? jackpot.WinBalance : jackpot.Balance;
300
+ const jackpotTypeLabel = translate(jackpot.Type, this.language);
301
+ const jackpotSuspendedLabel = translate('suspended', this.language);
302
+ const jackpotLabel = (jackpot === null || jackpot === void 0 ? void 0 : jackpot.IsClosed) ? jackpotSuspendedLabel : jackpotTypeLabel;
303
+ const jackpotClasses = `JackpotBalance Jackpot${translate(jackpot.Type, this.language)}`;
304
+ const buttonClass = jackpot.Enabled && !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.IsClosed)
305
+ ? 'JackpotJoinButton Joined'
306
+ : 'JackpotJoinButton';
307
+ const buttonText = jackpot.Enabled && !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.IsClosed)
308
+ ? translate('unjoin', this.language)
309
+ : translate('join', this.language);
310
+ const buttonIsVisible = !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.IsClosed) || isBefore(new Date(jackpot.JackpotEndTime), new Date());
311
+ const actionButtonIsDisabled = !!this.buttonsLoadingStates[jackpot.Id];
312
+ return (index.h("div", { class: "JackpotCardHeader" }, index.h("div", { class: "JackpotTitle" }, index.h("span", { class: "JackpotName" }, jackpotLabel), index.h("span", { class: jackpotClasses }, formatBalance(jackpotBalance, jackpot.Currency))), jackpotIsWon ? (index.h("span", { class: "JackpotWon" }, translate('jackpotIsWon', this.language))) : (buttonIsVisible && (index.h("button", { class: buttonClass, onClick: this.changeJackpotStatus, "data-id": jackpot.Id, "data-joined": jackpot.Enabled, disabled: actionButtonIsDisabled }, buttonText)))));
313
+ }
314
+ getJackpotDescriptionTemplate(jackpot) {
315
+ const operatorContributionPercent = jackpot.OperatorContributionPercent + '%';
316
+ const winingProbabilityPercent = jackpot.Probability + '%';
317
+ const countdownValue = isBefore(new Date(jackpot.JackpotEndTime), new Date())
318
+ ? translate('outdatedJackpotCountdown', this.language)
319
+ : this.timers[jackpot.Id];
320
+ const operatorContibutionLabel = translate('operatorContribution', this.language);
321
+ const typeLabel = translate('type', this.language);
322
+ const winingProbabilityLabel = translate('winingProbability', this.language);
323
+ return (index.h("div", { class: "JackpotCardDescription" }, index.h("span", { class: "JackpotCountdown" }, countdownValue), index.h("div", { class: "JackpotCardDescriptionBlock" }, index.h("div", { class: "JackpotCardDescriptionColumn" }, this.renderDesciptionRowInfo(`${operatorContibutionLabel}:`, operatorContributionPercent), this.renderDesciptionRowInfo(`${typeLabel}:`, jackpot.JackpotTypePresentation)), index.h("div", { class: "JackpotCardDescriptionColumn" }, this.renderDesciptionRowInfo(`${winingProbabilityLabel}:`, winingProbabilityPercent), index.h("a", { href: jackpot.JackpotRulesUrl, target: "_blank" }, translate('termsAndConditions', this.language))))));
324
+ }
325
+ renderDesciptionRowInfo(title, value) {
326
+ return (index.h("div", { class: "JackpotCardDescriptionRow" }, index.h("span", null, title), index.h("span", { class: "JackpotDescriptionValue" }, value)));
327
+ }
328
+ getJackpotTemplate(jackpot) {
329
+ const jackpotHasNotWon = !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.WinBalance);
330
+ return (index.h("div", { class: this.getJackpotClasses(jackpot), onClick: this.handleJackpotClick, key: jackpot.Id, "data-id": jackpot.Id }, this.getJackpotHeaderTemplate(jackpot), jackpotHasNotWon && this.getJackpotDescriptionTemplate(jackpot)));
331
+ }
332
+ getHeaderTemplate() {
333
+ return (index.h("header", { class: "JackpotsListPopupHeader" }, index.h("button", { onClick: this.showTooltip, class: "JackpotsIconButton" }, index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg", alt: "Show tooltip" })), index.h("div", { class: "JackpotsListPopupHeaderName" }, translate('jackpots', this.language)), index.h("button", { class: "JackpotsIconButton", onClick: this.handleCloseClick }, index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close jackpots list" }))));
334
+ }
335
+ getListTemplate() {
336
+ const areAllJackpotsSuspended = this.jackpots.every((item) => item.IsClosed);
337
+ if (this.jackpots.length) {
338
+ return (index.h("div", { class: "JackpotsListWrapper" }, areAllJackpotsSuspended && (index.h("div", { class: "JackpotsListSuspended" }, index.h("h2", null, translate('allJackpotsSuspended', this.language)))), index.h("div", { class: "JackpotsList" }, this.jackpots.map((jackpot) => this.getJackpotTemplate(jackpot)))));
339
+ }
340
+ else {
341
+ return (index.h("div", { class: "JackpotsListSuspended" }, index.h("h2", null, translate('allJackpotsSuspended', this.language))));
342
+ }
343
+ }
344
+ getTooltipTemplate() {
345
+ if (this.tooltip) {
346
+ return (index.h("div", { class: "JackpotsTooltipBackdrop" }, index.h("div", { class: "JackpotsTooltip" }, index.h("button", { class: "JackpotsIconButton", onClick: this.hideTooltip }, index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close tooltip" })), translate('tooltip', this.language))));
347
+ }
348
+ else {
349
+ return '';
350
+ }
351
+ }
352
+ render() {
353
+ return (index.h("div", { class: `JackpotsListPopup ${this.device}` }, this.getHeaderTemplate(), this.getListTemplate(), this.getTooltipTemplate()));
354
+ }
355
+ get host() { return index.getElement(this); }
356
+ static get watchers() { return {
357
+ "jackpots": ["jackpotsPropHandler"]
358
+ }; }
359
+ };
360
+ CasinoEngagementSuiteJackpotsList.style = casinoEngagementSuiteJackpotsListCss;
361
+
362
+ exports.casino_engagement_suite_jackpots_list = CasinoEngagementSuiteJackpotsList;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-9e718c74.js');
4
+
5
+ /*
6
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ const patchBrowser = () => {
9
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('casino-engagement-suite-jackpots-list.cjs.js', document.baseURI).href));
10
+ const opts = {};
11
+ if (importMeta !== '') {
12
+ opts.resourcesUrl = new URL('.', importMeta).href;
13
+ }
14
+ return index.promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(options => {
18
+ return index.bootstrapLazy([["casino-engagement-suite-jackpots-list.cjs",[[1,"casino-engagement-suite-jackpots-list",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[1],"device":[1],"jackpots":[1040],"buttonsLoadingStates":[1040],"tooltip":[32],"timers":[32],"limitStylingAppends":[32]},[[8,"message","handleEvent"]]]]]], options);
19
+ });