@everymatrix/casino-engagement-suite-jackpots-list 1.37.2 → 1.37.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{p as 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)));
1
+ import{p as t,b as e}from"./p-a34aa41f.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),t(n)})().then((t=>e([["p-ec4ed786",[[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
+ 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.JackpotId));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.JackpotId===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.JackpotId)));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.JackpotId]: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.JackpotId];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.JackpotId,"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.JackpotId],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.JackpotId,"data-id":t.JackpotId},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}
@@ -222,14 +222,14 @@ const CasinoEngagementSuiteJackpotsList = class {
222
222
  case 'UpdateJackpotBalance':
223
223
  const updatedJackpots = e.data.data;
224
224
  this.jackpots = this.jackpots.map(jackpot => {
225
- const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.Id);
225
+ const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.JackpotId);
226
226
  return updatedJackpot
227
227
  ? Object.assign(Object.assign({}, jackpot), { Balance: updatedJackpot.Balance, WinBalance: updatedJackpot.WinBalance }) : jackpot;
228
228
  });
229
229
  break;
230
230
  case 'UpdateJackpotStatus':
231
231
  const statusUpdate = data;
232
- const index = this.jackpots.findIndex((jackpot) => jackpot.Id === statusUpdate.JackpotId);
232
+ const index = this.jackpots.findIndex((jackpot) => jackpot.JackpotId === statusUpdate.JackpotId);
233
233
  if (index !== 1) {
234
234
  this.jackpots[index].IsClosed = statusUpdate.IsClosed;
235
235
  }
@@ -240,7 +240,7 @@ const CasinoEngagementSuiteJackpotsList = class {
240
240
  if (joinJackpotResult.Success) {
241
241
  if (jackpotIds.length > 0) {
242
242
  this.jackpots = this.jackpots.map(jackpot => {
243
- const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.Id));
243
+ const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.JackpotId));
244
244
  return matchedJackpotId
245
245
  ? Object.assign(Object.assign({}, jackpot), { Enabled: joinJackpotResult.JackpotIds[matchedJackpotId] }) : jackpot;
246
246
  });
@@ -272,7 +272,7 @@ const CasinoEngagementSuiteJackpotsList = class {
272
272
  days === '00'
273
273
  ? `${hours}h:${minutes}m:${seconds}s`
274
274
  : `${days}d:${hours}h:${minutes}m`;
275
- return Object.assign(Object.assign({}, acc), { [jackpot.Id]: countdown });
275
+ return Object.assign(Object.assign({}, acc), { [jackpot.JackpotId]: countdown });
276
276
  }, {});
277
277
  }
278
278
  componentDidRender() {
@@ -308,15 +308,15 @@ const CasinoEngagementSuiteJackpotsList = class {
308
308
  ? translate('unjoin', this.language)
309
309
  : translate('join', this.language);
310
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)))));
311
+ const actionButtonIsDisabled = !!this.buttonsLoadingStates[jackpot.JackpotId];
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.JackpotId, "data-joined": jackpot.Enabled, disabled: actionButtonIsDisabled }, buttonText)))));
313
313
  }
314
314
  getJackpotDescriptionTemplate(jackpot) {
315
315
  const operatorContributionPercent = jackpot.OperatorContributionPercent + '%';
316
316
  const winingProbabilityPercent = jackpot.Probability + '%';
317
317
  const countdownValue = isBefore(new Date(jackpot.JackpotEndTime), new Date())
318
318
  ? translate('outdatedJackpotCountdown', this.language)
319
- : this.timers[jackpot.Id];
319
+ : this.timers[jackpot.JackpotId];
320
320
  const operatorContibutionLabel = translate('operatorContribution', this.language);
321
321
  const typeLabel = translate('type', this.language);
322
322
  const winingProbabilityLabel = translate('winingProbability', this.language);
@@ -327,7 +327,7 @@ const CasinoEngagementSuiteJackpotsList = class {
327
327
  }
328
328
  getJackpotTemplate(jackpot) {
329
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)));
330
+ return (index.h("div", { class: this.getJackpotClasses(jackpot), onClick: this.handleJackpotClick, key: jackpot.JackpotId, "data-id": jackpot.JackpotId }, this.getJackpotHeaderTemplate(jackpot), jackpotHasNotWon && this.getJackpotDescriptionTemplate(jackpot)));
331
331
  }
332
332
  getHeaderTemplate() {
333
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" }))));
@@ -92,14 +92,14 @@ export class CasinoEngagementSuiteJackpotsList {
92
92
  case 'UpdateJackpotBalance':
93
93
  const updatedJackpots = e.data.data;
94
94
  this.jackpots = this.jackpots.map(jackpot => {
95
- const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.Id);
95
+ const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.JackpotId);
96
96
  return updatedJackpot
97
97
  ? Object.assign(Object.assign({}, jackpot), { Balance: updatedJackpot.Balance, WinBalance: updatedJackpot.WinBalance }) : jackpot;
98
98
  });
99
99
  break;
100
100
  case 'UpdateJackpotStatus':
101
101
  const statusUpdate = data;
102
- const index = this.jackpots.findIndex((jackpot) => jackpot.Id === statusUpdate.JackpotId);
102
+ const index = this.jackpots.findIndex((jackpot) => jackpot.JackpotId === statusUpdate.JackpotId);
103
103
  if (index !== 1) {
104
104
  this.jackpots[index].IsClosed = statusUpdate.IsClosed;
105
105
  }
@@ -110,7 +110,7 @@ export class CasinoEngagementSuiteJackpotsList {
110
110
  if (joinJackpotResult.Success) {
111
111
  if (jackpotIds.length > 0) {
112
112
  this.jackpots = this.jackpots.map(jackpot => {
113
- const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.Id));
113
+ const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.JackpotId));
114
114
  return matchedJackpotId
115
115
  ? Object.assign(Object.assign({}, jackpot), { Enabled: joinJackpotResult.JackpotIds[matchedJackpotId] }) : jackpot;
116
116
  });
@@ -144,7 +144,7 @@ export class CasinoEngagementSuiteJackpotsList {
144
144
  days === '00'
145
145
  ? `${hours}h:${minutes}m:${seconds}s`
146
146
  : `${days}d:${hours}h:${minutes}m`;
147
- return Object.assign(Object.assign({}, acc), { [jackpot.Id]: countdown });
147
+ return Object.assign(Object.assign({}, acc), { [jackpot.JackpotId]: countdown });
148
148
  }, {});
149
149
  }
150
150
  componentDidRender() {
@@ -180,19 +180,19 @@ export class CasinoEngagementSuiteJackpotsList {
180
180
  ? translate('unjoin', this.language)
181
181
  : translate('join', this.language);
182
182
  const buttonIsVisible = !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.IsClosed) || isBefore(new Date(jackpot.JackpotEndTime), new Date());
183
- const actionButtonIsDisabled = !!this.buttonsLoadingStates[jackpot.Id];
183
+ const actionButtonIsDisabled = !!this.buttonsLoadingStates[jackpot.JackpotId];
184
184
  return (h("div", { class: "JackpotCardHeader" },
185
185
  h("div", { class: "JackpotTitle" },
186
186
  h("span", { class: "JackpotName" }, jackpotLabel),
187
187
  h("span", { class: jackpotClasses }, formatBalance(jackpotBalance, jackpot.Currency))),
188
- jackpotIsWon ? (h("span", { class: "JackpotWon" }, translate('jackpotIsWon', this.language))) : (buttonIsVisible && (h("button", { class: buttonClass, onClick: this.changeJackpotStatus, "data-id": jackpot.Id, "data-joined": jackpot.Enabled, disabled: actionButtonIsDisabled }, buttonText)))));
188
+ jackpotIsWon ? (h("span", { class: "JackpotWon" }, translate('jackpotIsWon', this.language))) : (buttonIsVisible && (h("button", { class: buttonClass, onClick: this.changeJackpotStatus, "data-id": jackpot.JackpotId, "data-joined": jackpot.Enabled, disabled: actionButtonIsDisabled }, buttonText)))));
189
189
  }
190
190
  getJackpotDescriptionTemplate(jackpot) {
191
191
  const operatorContributionPercent = jackpot.OperatorContributionPercent + '%';
192
192
  const winingProbabilityPercent = jackpot.Probability + '%';
193
193
  const countdownValue = isBefore(new Date(jackpot.JackpotEndTime), new Date())
194
194
  ? translate('outdatedJackpotCountdown', this.language)
195
- : this.timers[jackpot.Id];
195
+ : this.timers[jackpot.JackpotId];
196
196
  const operatorContibutionLabel = translate('operatorContribution', this.language);
197
197
  const typeLabel = translate('type', this.language);
198
198
  const winingProbabilityLabel = translate('winingProbability', this.language);
@@ -213,7 +213,7 @@ export class CasinoEngagementSuiteJackpotsList {
213
213
  }
214
214
  getJackpotTemplate(jackpot) {
215
215
  const jackpotHasNotWon = !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.WinBalance);
216
- return (h("div", { class: this.getJackpotClasses(jackpot), onClick: this.handleJackpotClick, key: jackpot.Id, "data-id": jackpot.Id },
216
+ return (h("div", { class: this.getJackpotClasses(jackpot), onClick: this.handleJackpotClick, key: jackpot.JackpotId, "data-id": jackpot.JackpotId },
217
217
  this.getJackpotHeaderTemplate(jackpot),
218
218
  jackpotHasNotWon && this.getJackpotDescriptionTemplate(jackpot)));
219
219
  }
@@ -220,14 +220,14 @@ const CasinoEngagementSuiteJackpotsList$1 = /*@__PURE__*/ proxyCustomElement(cla
220
220
  case 'UpdateJackpotBalance':
221
221
  const updatedJackpots = e.data.data;
222
222
  this.jackpots = this.jackpots.map(jackpot => {
223
- const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.Id);
223
+ const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.JackpotId);
224
224
  return updatedJackpot
225
225
  ? Object.assign(Object.assign({}, jackpot), { Balance: updatedJackpot.Balance, WinBalance: updatedJackpot.WinBalance }) : jackpot;
226
226
  });
227
227
  break;
228
228
  case 'UpdateJackpotStatus':
229
229
  const statusUpdate = data;
230
- const index = this.jackpots.findIndex((jackpot) => jackpot.Id === statusUpdate.JackpotId);
230
+ const index = this.jackpots.findIndex((jackpot) => jackpot.JackpotId === statusUpdate.JackpotId);
231
231
  if (index !== 1) {
232
232
  this.jackpots[index].IsClosed = statusUpdate.IsClosed;
233
233
  }
@@ -238,7 +238,7 @@ const CasinoEngagementSuiteJackpotsList$1 = /*@__PURE__*/ proxyCustomElement(cla
238
238
  if (joinJackpotResult.Success) {
239
239
  if (jackpotIds.length > 0) {
240
240
  this.jackpots = this.jackpots.map(jackpot => {
241
- const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.Id));
241
+ const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.JackpotId));
242
242
  return matchedJackpotId
243
243
  ? Object.assign(Object.assign({}, jackpot), { Enabled: joinJackpotResult.JackpotIds[matchedJackpotId] }) : jackpot;
244
244
  });
@@ -270,7 +270,7 @@ const CasinoEngagementSuiteJackpotsList$1 = /*@__PURE__*/ proxyCustomElement(cla
270
270
  days === '00'
271
271
  ? `${hours}h:${minutes}m:${seconds}s`
272
272
  : `${days}d:${hours}h:${minutes}m`;
273
- return Object.assign(Object.assign({}, acc), { [jackpot.Id]: countdown });
273
+ return Object.assign(Object.assign({}, acc), { [jackpot.JackpotId]: countdown });
274
274
  }, {});
275
275
  }
276
276
  componentDidRender() {
@@ -306,15 +306,15 @@ const CasinoEngagementSuiteJackpotsList$1 = /*@__PURE__*/ proxyCustomElement(cla
306
306
  ? translate('unjoin', this.language)
307
307
  : translate('join', this.language);
308
308
  const buttonIsVisible = !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.IsClosed) || isBefore(new Date(jackpot.JackpotEndTime), new Date());
309
- const actionButtonIsDisabled = !!this.buttonsLoadingStates[jackpot.Id];
310
- return (h("div", { class: "JackpotCardHeader" }, h("div", { class: "JackpotTitle" }, h("span", { class: "JackpotName" }, jackpotLabel), h("span", { class: jackpotClasses }, formatBalance(jackpotBalance, jackpot.Currency))), jackpotIsWon ? (h("span", { class: "JackpotWon" }, translate('jackpotIsWon', this.language))) : (buttonIsVisible && (h("button", { class: buttonClass, onClick: this.changeJackpotStatus, "data-id": jackpot.Id, "data-joined": jackpot.Enabled, disabled: actionButtonIsDisabled }, buttonText)))));
309
+ const actionButtonIsDisabled = !!this.buttonsLoadingStates[jackpot.JackpotId];
310
+ return (h("div", { class: "JackpotCardHeader" }, h("div", { class: "JackpotTitle" }, h("span", { class: "JackpotName" }, jackpotLabel), h("span", { class: jackpotClasses }, formatBalance(jackpotBalance, jackpot.Currency))), jackpotIsWon ? (h("span", { class: "JackpotWon" }, translate('jackpotIsWon', this.language))) : (buttonIsVisible && (h("button", { class: buttonClass, onClick: this.changeJackpotStatus, "data-id": jackpot.JackpotId, "data-joined": jackpot.Enabled, disabled: actionButtonIsDisabled }, buttonText)))));
311
311
  }
312
312
  getJackpotDescriptionTemplate(jackpot) {
313
313
  const operatorContributionPercent = jackpot.OperatorContributionPercent + '%';
314
314
  const winingProbabilityPercent = jackpot.Probability + '%';
315
315
  const countdownValue = isBefore(new Date(jackpot.JackpotEndTime), new Date())
316
316
  ? translate('outdatedJackpotCountdown', this.language)
317
- : this.timers[jackpot.Id];
317
+ : this.timers[jackpot.JackpotId];
318
318
  const operatorContibutionLabel = translate('operatorContribution', this.language);
319
319
  const typeLabel = translate('type', this.language);
320
320
  const winingProbabilityLabel = translate('winingProbability', this.language);
@@ -325,7 +325,7 @@ const CasinoEngagementSuiteJackpotsList$1 = /*@__PURE__*/ proxyCustomElement(cla
325
325
  }
326
326
  getJackpotTemplate(jackpot) {
327
327
  const jackpotHasNotWon = !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.WinBalance);
328
- return (h("div", { class: this.getJackpotClasses(jackpot), onClick: this.handleJackpotClick, key: jackpot.Id, "data-id": jackpot.Id }, this.getJackpotHeaderTemplate(jackpot), jackpotHasNotWon && this.getJackpotDescriptionTemplate(jackpot)));
328
+ return (h("div", { class: this.getJackpotClasses(jackpot), onClick: this.handleJackpotClick, key: jackpot.JackpotId, "data-id": jackpot.JackpotId }, this.getJackpotHeaderTemplate(jackpot), jackpotHasNotWon && this.getJackpotDescriptionTemplate(jackpot)));
329
329
  }
330
330
  getHeaderTemplate() {
331
331
  return (h("header", { class: "JackpotsListPopupHeader" }, h("button", { onClick: this.showTooltip, class: "JackpotsIconButton" }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg", alt: "Show tooltip" })), h("div", { class: "JackpotsListPopupHeaderName" }, translate('jackpots', this.language)), h("button", { class: "JackpotsIconButton", onClick: this.handleCloseClick }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close jackpots list" }))));
@@ -218,14 +218,14 @@ const CasinoEngagementSuiteJackpotsList = class {
218
218
  case 'UpdateJackpotBalance':
219
219
  const updatedJackpots = e.data.data;
220
220
  this.jackpots = this.jackpots.map(jackpot => {
221
- const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.Id);
221
+ const updatedJackpot = updatedJackpots.find(updatedJackpot => updatedJackpot.JackpotId === jackpot.JackpotId);
222
222
  return updatedJackpot
223
223
  ? Object.assign(Object.assign({}, jackpot), { Balance: updatedJackpot.Balance, WinBalance: updatedJackpot.WinBalance }) : jackpot;
224
224
  });
225
225
  break;
226
226
  case 'UpdateJackpotStatus':
227
227
  const statusUpdate = data;
228
- const index = this.jackpots.findIndex((jackpot) => jackpot.Id === statusUpdate.JackpotId);
228
+ const index = this.jackpots.findIndex((jackpot) => jackpot.JackpotId === statusUpdate.JackpotId);
229
229
  if (index !== 1) {
230
230
  this.jackpots[index].IsClosed = statusUpdate.IsClosed;
231
231
  }
@@ -236,7 +236,7 @@ const CasinoEngagementSuiteJackpotsList = class {
236
236
  if (joinJackpotResult.Success) {
237
237
  if (jackpotIds.length > 0) {
238
238
  this.jackpots = this.jackpots.map(jackpot => {
239
- const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.Id));
239
+ const matchedJackpotId = jackpotIds.find(jackpotId => String(jackpotId) === String(jackpot.JackpotId));
240
240
  return matchedJackpotId
241
241
  ? Object.assign(Object.assign({}, jackpot), { Enabled: joinJackpotResult.JackpotIds[matchedJackpotId] }) : jackpot;
242
242
  });
@@ -268,7 +268,7 @@ const CasinoEngagementSuiteJackpotsList = class {
268
268
  days === '00'
269
269
  ? `${hours}h:${minutes}m:${seconds}s`
270
270
  : `${days}d:${hours}h:${minutes}m`;
271
- return Object.assign(Object.assign({}, acc), { [jackpot.Id]: countdown });
271
+ return Object.assign(Object.assign({}, acc), { [jackpot.JackpotId]: countdown });
272
272
  }, {});
273
273
  }
274
274
  componentDidRender() {
@@ -304,15 +304,15 @@ const CasinoEngagementSuiteJackpotsList = class {
304
304
  ? translate('unjoin', this.language)
305
305
  : translate('join', this.language);
306
306
  const buttonIsVisible = !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.IsClosed) || isBefore(new Date(jackpot.JackpotEndTime), new Date());
307
- const actionButtonIsDisabled = !!this.buttonsLoadingStates[jackpot.Id];
308
- return (h("div", { class: "JackpotCardHeader" }, h("div", { class: "JackpotTitle" }, h("span", { class: "JackpotName" }, jackpotLabel), h("span", { class: jackpotClasses }, formatBalance(jackpotBalance, jackpot.Currency))), jackpotIsWon ? (h("span", { class: "JackpotWon" }, translate('jackpotIsWon', this.language))) : (buttonIsVisible && (h("button", { class: buttonClass, onClick: this.changeJackpotStatus, "data-id": jackpot.Id, "data-joined": jackpot.Enabled, disabled: actionButtonIsDisabled }, buttonText)))));
307
+ const actionButtonIsDisabled = !!this.buttonsLoadingStates[jackpot.JackpotId];
308
+ return (h("div", { class: "JackpotCardHeader" }, h("div", { class: "JackpotTitle" }, h("span", { class: "JackpotName" }, jackpotLabel), h("span", { class: jackpotClasses }, formatBalance(jackpotBalance, jackpot.Currency))), jackpotIsWon ? (h("span", { class: "JackpotWon" }, translate('jackpotIsWon', this.language))) : (buttonIsVisible && (h("button", { class: buttonClass, onClick: this.changeJackpotStatus, "data-id": jackpot.JackpotId, "data-joined": jackpot.Enabled, disabled: actionButtonIsDisabled }, buttonText)))));
309
309
  }
310
310
  getJackpotDescriptionTemplate(jackpot) {
311
311
  const operatorContributionPercent = jackpot.OperatorContributionPercent + '%';
312
312
  const winingProbabilityPercent = jackpot.Probability + '%';
313
313
  const countdownValue = isBefore(new Date(jackpot.JackpotEndTime), new Date())
314
314
  ? translate('outdatedJackpotCountdown', this.language)
315
- : this.timers[jackpot.Id];
315
+ : this.timers[jackpot.JackpotId];
316
316
  const operatorContibutionLabel = translate('operatorContribution', this.language);
317
317
  const typeLabel = translate('type', this.language);
318
318
  const winingProbabilityLabel = translate('winingProbability', this.language);
@@ -323,7 +323,7 @@ const CasinoEngagementSuiteJackpotsList = class {
323
323
  }
324
324
  getJackpotTemplate(jackpot) {
325
325
  const jackpotHasNotWon = !(jackpot === null || jackpot === void 0 ? void 0 : jackpot.WinBalance);
326
- return (h("div", { class: this.getJackpotClasses(jackpot), onClick: this.handleJackpotClick, key: jackpot.Id, "data-id": jackpot.Id }, this.getJackpotHeaderTemplate(jackpot), jackpotHasNotWon && this.getJackpotDescriptionTemplate(jackpot)));
326
+ return (h("div", { class: this.getJackpotClasses(jackpot), onClick: this.handleJackpotClick, key: jackpot.JackpotId, "data-id": jackpot.JackpotId }, this.getJackpotHeaderTemplate(jackpot), jackpotHasNotWon && this.getJackpotDescriptionTemplate(jackpot)));
327
327
  }
328
328
  getHeaderTemplate() {
329
329
  return (h("header", { class: "JackpotsListPopupHeader" }, h("button", { onClick: this.showTooltip, class: "JackpotsIconButton" }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg", alt: "Show tooltip" })), h("div", { class: "JackpotsListPopupHeaderName" }, translate('jackpots', this.language)), h("button", { class: "JackpotsIconButton", onClick: this.handleCloseClick }, h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg", alt: "Close jackpots list" }))));
@@ -13,7 +13,7 @@ interface BetLimits {
13
13
  MaxContributionAmount: number;
14
14
  }
15
15
  export interface Jackpot {
16
- Id: number;
16
+ JackpotId: number;
17
17
  Type: JackpotType;
18
18
  Balance: number;
19
19
  WinBalance?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-engagement-suite-jackpots-list",
3
- "version": "1.37.2",
3
+ "version": "1.37.3",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as 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}