@everymatrix/player-elevate-level 1.87.25 → 1.87.27

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.
@@ -397,6 +397,8 @@ const mergeTranslations = (url, target) => {
397
397
  });
398
398
  };
399
399
 
400
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
401
+
400
402
  /**
401
403
  * @name setClientStyling
402
404
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -442,18 +444,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
442
444
  * @param {HTMLElement} stylingContainer The highest element of the widget
443
445
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
444
446
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
447
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
445
448
  */
446
- function setStreamStyling(stylingContainer, domain, subscription) {
447
- if (window.emMessageBus) {
448
- const sheet = document.createElement('style');
449
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
450
+ if (!window.emMessageBus) return;
449
451
 
450
- window.emMessageBus.subscribe(domain, (data) => {
451
- sheet.innerHTML = data;
452
- if (stylingContainer) {
453
- stylingContainer.appendChild(sheet);
454
- }
455
- });
452
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
453
+
454
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
455
+ subscription = getStyleTagSubscription(stylingContainer, domain);
456
+
457
+ return subscription;
458
+ }
459
+
460
+ if (!window[StyleCacheKey]) {
461
+ window[StyleCacheKey] = {};
456
462
  }
463
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
464
+
465
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
466
+ const wrappedUnsubscribe = () => {
467
+ if (window[StyleCacheKey][domain]) {
468
+ const cachedObject = window[StyleCacheKey][domain];
469
+ cachedObject.refCount > 1
470
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
471
+ : delete window[StyleCacheKey][domain];
472
+ }
473
+
474
+ originalUnsubscribe();
475
+ };
476
+ subscription.unsubscribe = wrappedUnsubscribe;
477
+
478
+ return subscription;
479
+ }
480
+
481
+ function getStyleTagSubscription(stylingContainer, domain) {
482
+ const sheet = document.createElement('style');
483
+
484
+ return window.emMessageBus.subscribe(domain, (data) => {
485
+ if (stylingContainer) {
486
+ sheet.innerHTML = data;
487
+ stylingContainer.appendChild(sheet);
488
+ }
489
+ });
490
+ }
491
+
492
+ function getAdoptStyleSubscription(stylingContainer, domain) {
493
+ return window.emMessageBus.subscribe(domain, (data) => {
494
+ if (!stylingContainer) return;
495
+
496
+ const shadowRoot = stylingContainer.getRootNode();
497
+ const cacheStyleObject = window[StyleCacheKey];
498
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
499
+
500
+ if (!cachedStyle) {
501
+ cachedStyle = new CSSStyleSheet();
502
+ cachedStyle.replaceSync(data);
503
+ cacheStyleObject[domain] = {
504
+ sheet: cachedStyle,
505
+ refCount: 1
506
+ };
507
+ } else {
508
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
509
+ }
510
+
511
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
512
+ if (!currentSheets.includes(cachedStyle)) {
513
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
514
+ }
515
+ });
457
516
  }
458
517
 
459
518
  const generalStylingWrapperCss = ":host{display:block}";
@@ -472,7 +531,7 @@ const GeneralStylingWrapper = class {
472
531
  componentDidLoad() {
473
532
  if (this.el) {
474
533
  if (window.emMessageBus != undefined) {
475
- setStreamStyling(this.el, `${this.mbSource}.Style`);
534
+ setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
476
535
  }
477
536
  else {
478
537
  if (this.clientStyling)
@@ -393,6 +393,8 @@ const mergeTranslations = (url, target) => {
393
393
  });
394
394
  };
395
395
 
396
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
397
+
396
398
  /**
397
399
  * @name setClientStyling
398
400
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -438,18 +440,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
438
440
  * @param {HTMLElement} stylingContainer The highest element of the widget
439
441
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
440
442
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
443
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
441
444
  */
442
- function setStreamStyling(stylingContainer, domain, subscription) {
443
- if (window.emMessageBus) {
444
- const sheet = document.createElement('style');
445
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
446
+ if (!window.emMessageBus) return;
445
447
 
446
- window.emMessageBus.subscribe(domain, (data) => {
447
- sheet.innerHTML = data;
448
- if (stylingContainer) {
449
- stylingContainer.appendChild(sheet);
450
- }
451
- });
448
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
449
+
450
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
451
+ subscription = getStyleTagSubscription(stylingContainer, domain);
452
+
453
+ return subscription;
454
+ }
455
+
456
+ if (!window[StyleCacheKey]) {
457
+ window[StyleCacheKey] = {};
452
458
  }
459
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
460
+
461
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
462
+ const wrappedUnsubscribe = () => {
463
+ if (window[StyleCacheKey][domain]) {
464
+ const cachedObject = window[StyleCacheKey][domain];
465
+ cachedObject.refCount > 1
466
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
467
+ : delete window[StyleCacheKey][domain];
468
+ }
469
+
470
+ originalUnsubscribe();
471
+ };
472
+ subscription.unsubscribe = wrappedUnsubscribe;
473
+
474
+ return subscription;
475
+ }
476
+
477
+ function getStyleTagSubscription(stylingContainer, domain) {
478
+ const sheet = document.createElement('style');
479
+
480
+ return window.emMessageBus.subscribe(domain, (data) => {
481
+ if (stylingContainer) {
482
+ sheet.innerHTML = data;
483
+ stylingContainer.appendChild(sheet);
484
+ }
485
+ });
486
+ }
487
+
488
+ function getAdoptStyleSubscription(stylingContainer, domain) {
489
+ return window.emMessageBus.subscribe(domain, (data) => {
490
+ if (!stylingContainer) return;
491
+
492
+ const shadowRoot = stylingContainer.getRootNode();
493
+ const cacheStyleObject = window[StyleCacheKey];
494
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
495
+
496
+ if (!cachedStyle) {
497
+ cachedStyle = new CSSStyleSheet();
498
+ cachedStyle.replaceSync(data);
499
+ cacheStyleObject[domain] = {
500
+ sheet: cachedStyle,
501
+ refCount: 1
502
+ };
503
+ } else {
504
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
505
+ }
506
+
507
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
508
+ if (!currentSheets.includes(cachedStyle)) {
509
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
510
+ }
511
+ });
453
512
  }
454
513
 
455
514
  const generalStylingWrapperCss = ":host{display:block}";
@@ -468,7 +527,7 @@ const GeneralStylingWrapper = class {
468
527
  componentDidLoad() {
469
528
  if (this.el) {
470
529
  if (window.emMessageBus != undefined) {
471
- setStreamStyling(this.el, `${this.mbSource}.Style`);
530
+ setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
472
531
  }
473
532
  else {
474
533
  if (this.clientStyling)
@@ -1 +1 @@
1
- import{r as e,h as t,c as n,H as i,g as l,a,F as s}from"./index-8b0eeaf7.js";import{t as o,T as r}from"./locale.utils-471ae737.js";import{r as d,t as h,g as c,P as v,a as f,b as p,L as g}from"./player-elevate-card-items-7be884d5.js";const b=["ro","en","fr","hr","tr"],u={en:{level:"level",seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set",points:"Points"},fr:{level:"level",seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set",points:"Points"},hr:{level:"Razina",seeAll:"Vidi sve",privilegesFor:"Privilegije za",termsAndConditions:"Uvjeti i odredbe",noLevelsSet:"There is no level set",points:"Points"},ro:{level:"level",seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set",points:"Points"},tr:{level:"level",seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set",points:"Points"}},y=(e,t)=>{const n=t;return u[void 0!==n&&(b.includes(n)||u[n])?n:"en"][e]},w=class{constructor(t){e(this,t),this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.endpoint=void 0,this.language="en",this.translationUrl="",this.selectedLevelId=void 0,this.showDefault=void 0,this.elevateLevelParamProxy=void 0,this.elevateLevels=[],this.currentLevel=void 0,this.errorMessage=void 0}selectedLevelChangedHandler(e){e.detail&&(this.currentLevel=Object.assign({},e.detail.level))}selectedLevelIdChangedHandler(){if(this.selectedLevelId&&this.elevateLevels){const e=this.elevateLevels.filter((e=>e.id==this.selectedLevelId))[0];this.currentLevel=Object.assign({},e)}}onSessionOrEndpointChange(){this.elevateLevelParamProxy=Object.assign(Object.assign({},this.elevateLevelParamProxy),{endpoint:this.endpoint,language:this.language})}elevateLevelsDataChangeHandler(e){e.detail&&(e.detail.currentLevel&&(this.currentLevel=Object.assign({},e.detail.currentLevel)),e.detail.elevateLevels&&(this.elevateLevels=[...e.detail.elevateLevels]),e.detail.clearError&&(this.errorMessage=null),e.detail.errorMessage&&e.detail.errorMessage.errorWhenLoadElevateLevels&&(this.errorMessage=y("loadElevateLevelErrorMessage",this.language)))}onTCClick(){window.postMessage({type:"termAndConditionClicked"},window.location.href)}componentWillLoad(){this.elevateLevelParamProxy={endpoint:this.endpoint,language:this.language,selectedLevelId:this.selectedLevelId,showDefault:this.showDefault}}render(){var e;return t("div",{key:"6bc46c87633a9a295108e50886096f67dd35d44a",class:"ElevateLevelContent"},t("elevate-levels-data",{key:"902d2796991a8acf293761255ab10f2cee54a92e",scopeParams:this.elevateLevelParamProxy}),t("div",{key:"7e47a25dce1d0fba40e3e432dd9c805aa5bbe308",class:"LevelContent"},(null===(e=this.elevateLevels)||void 0===e?void 0:e.length)?t("elevate-level-list",{language:this.language,selectedLevelId:this.selectedLevelId,levels:this.elevateLevels}):y("noLevelsSet",this.language),this.currentLevel&&t("elevate-level-presentation",{key:"dcfad9aa4422545fa74a7b8b957eb72001506046",elevateLevel:this.currentLevel})),this.errorMessage&&t("div",{key:"7e2741168e50a1ee2adebe39c2c3433b5c9bf7ca"},this.errorMessage),t("general-styling-wrapper",{key:"74cae021838f61964a519c2f200cfbb1f8470778",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,targetTranslations:u,translationUrl:this.translationUrl,mbSource:this.mbSource}))}static get watchers(){return{selectedLevelId:["selectedLevelIdChangedHandler"],elevateLevels:["selectedLevelIdChangedHandler"],endpoint:["onSessionOrEndpointChange"],language:["onSessionOrEndpointChange"]}}};var m;w.style=":host{display:block}.ElevateLevelContent{padding:20px;position:relative}.ElevateLevelContent .Privileges{padding-bottom:30px}.ElevateLevelContent .tc{position:absolute;right:10px;bottom:10px;text-align:right;display:none}",function(e){e[e.slideToRight=1]="slideToRight",e[e.slideToLeft=-1]="slideToLeft"}(m||(m={}));const x=class{constructor(t){var i;e(this,t),this.selectedLevelChanged=n(this,"selectedLevelChanged",7),this.minOffset=0,this.isMobile=!!((i=window.navigator.userAgent).toLowerCase().match(/android/i)||i.toLowerCase().match(/blackberry|bb/i)||i.toLowerCase().match(/iphone|ipad|ipod/i)||i.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),this.levels=void 0,this.language=void 0,this.selectedLevelId=void 0,this.showSliderButton=!1,this.touchPosStart=void 0,this.touchPosEnd=void 0,this.offset=0}onLevelClicked(e){this.selectedLevelChanged.emit({level:e}),this.selectedLevelId=e.id}levelsChangedHandler(){this.initOffsetOfLevelItems()}initOffsetOfLevelItems(){if(!this.levels||0==this.levels.length||!this.selectedLevelId)return;const e=this.levels.findIndex((e=>this.selectedLevelId==e.id));if(this.onLevelClicked(this.levels[-1==e?0:e]),this.levels.length<=this.moveCountForOneTouch)return;let t=Math.floor((-1==e?1:e+1)/this.moveCountForOneTouch)*this.moveCountForOneTouch*this.childElementWidth*-1;this.offset=t<=this.minOffset?this.minOffset:t>=0?0:t}onTouchStart(e){this.touchPosStart={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}onTouchMove(e){this.touchPosEnd={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY};const t=this.touchPosEnd.clientX-this.touchPosStart.clientX,n=this.touchPosEnd.clientY-this.touchPosStart.clientY;Math.abs(t)>Math.abs(n)&&this.slideTo(t>0?m.slideToRight:m.slideToLeft)}slideTo(e){let t=this.levelsElement.offsetLeft+this.childElementWidth*this.moveCountForOneTouch*e;if(t%this.childElementWidth!=0){const n=Math.floor(t/this.childElementWidth)*this.childElementWidth,i=Math.ceil(t/this.childElementWidth)*this.childElementWidth;t=e==m.slideToRight?n:i}this.offset=t<this.minOffset?this.minOffset:t>=0?0:t}initLevelSlider(){var e;if(!(null===(e=this.levelsElement)||void 0===e?void 0:e.firstElementChild))return void console.log("Widget[elevate-level-list] DOM is not ready.");this.showSliderButton=!this.isMobile&&this.levelsElement.clientWidth>this.levelsElement.parentElement.clientWidth,this.minOffset=this.levelsElement.parentElement.clientWidth-this.levelsElement.clientWidth,this.childElementWidth=this.levelsElement.firstElementChild.clientWidth,this.moveCountForOneTouch=Math.ceil(this.levelsElement.parentElement.clientWidth/this.childElementWidth)-1;const t=this.levelsElement.childElementCount;this.childElementWidth+=(this.levelsElement.clientWidth-this.childElementWidth*t)/(t-1)}debounce(e,t){{let n;return()=>{clearTimeout(n),n=setTimeout((()=>{e()}),t)}}}convertNumberToCompactForm(e){return e>=1e9?(e/1e9).toFixed(1).replace(/\.0$/,"")+"b":e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"m":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k":e.toString()}handleResize(){this.debounce(this.initLevelSlider.bind(this),200)()}componentDidRender(){this.host.componentOnReady().then((()=>{this.initLevelSlider()}))}render(){return t(i,{key:"c2eb983ff3df4868204eec8e527efa08c9e5afa0"},this.levels&&[t("div",{key:"9f6563c030a7725761b9a73cffb8e2d8d8f47c32",class:`SliderButton LeftButton ${0==this.offset?"Disabled":""} ${this.showSliderButton?"":"Hidden"}`,onClick:()=>this.slideTo(m.slideToRight)},t("svg",{key:"9e3d3422bd2171d26821c1f74e3ab7418b97643d",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"ac0002e40e037edd0c0893c9250f36e18e451f16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"}))),t("div",{key:"242903f38deb464844d722e0e7fe90665de99d6a",class:"LevelItemsWrapper"},t("div",{key:"739328ff99ecd777b9e2ff6914034a5bbc7eac90",style:{left:`${this.offset}px`},class:"LevelItems "+(this.isMobile?"Mobile":""),id:"levelItems",ref:e=>{this.levelsElement=e}},this.levels.map(((e,n)=>t("div",{class:"Item "+(this.selectedLevelId==e.id?"Active":""),onClick:this.onLevelClicked.bind(this,e)},t("img",{alt:`Presentation Icon for ${e.presentation.displayName}`,class:"LevelImg",src:e.presentation.asset}),t("span",{class:"LevelName",title:e.presentation.displayName},e.presentation.displayName),t("span",{class:"LevelPoints"},0==n?"":">",this.convertNumberToCompactForm(e.firstEntryPoints)," ",y("points",this.language))))))),t("div",{key:"2366c09b46bfec309bd4f8d5991d457f04dbf038",class:`SliderButton RightButton ${this.offset<=this.minOffset?"Disabled":""} ${this.showSliderButton?"":"Hidden"}`,onClick:()=>this.slideTo(m.slideToLeft)},t("svg",{key:"c52ef4f99444d1185e9b8ce4287f0f2886c622ae",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"acc266646133bb636b52f8776380e6aedc93f937","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})))])}get host(){return l(this)}static get watchers(){return{selectedLevelId:["levelsChangedHandler"]}}};x.style="elevate-level-list{display:flex;flex-direction:row}.LevelItemsWrapper{display:flex;flex:1;margin-top:10px;min-height:30px;transition-property:all;position:relative;height:138px;overflow-x:hidden}.Mobile.LevelItems{overflow-x:hidden}.LevelItems{overflow-x:auto;display:flex;flex-direction:row;gap:10px;left:0;position:absolute;transition:left 0.5s ease-in-out}.LevelItems .Item:hover,.LevelItems .Item.Active{background-color:var(--emw--color-gray-50, rgb(244, 244, 244));box-shadow:0px 4px 13px 0px rgba(0, 0, 0, 0.25)}.LevelItems .Item{width:86px;height:125px;border-radius:15px;text-align:center;display:flex;flex-direction:column;cursor:pointer}.LevelItems .Item .LevelName{font-size:13px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.LevelItems .Item .LevelPoints{color:var(--emw--color-gray-100, rgb(118, 113, 113));font-size:10px}.LevelItems .Item .LevelImg{width:65px;height:68px;margin:11px auto}.SliderButton{display:flex;width:29px;align-items:center;cursor:pointer}.SliderButton.Disabled svg{stroke:var(--emw--color-gray-50, #cbc5c5)}.SliderButton.Hidden{display:none}";const L=class{constructor(t){e(this,t),this.elevateLevel=void 0}render(){return t(i,{key:"16d128717e716f7ca7d3bb77fc3a2e67209318b6"},t("div",{key:"658657abdfc64844bd2af40562efe40385e1735a",class:"Row Desc"},t("h3",{key:"ec5871c2f810c8c120bf99510717381175bc1ef4"},this.elevateLevel.presentation.displayName),t("p",{key:"865915c6eea90295238fb47eaa91c8f968199ca5"},t("span",{key:"2b90c6c5d6957b73fc4a0f53d53da0ca023a4f0a",class:"TxtDesc",innerHTML:this.elevateLevel.presentation.description}))))}};L.style=":host{display:block}.PriviliegeList{padding-inline-start:5px}.PriviliegeList li{display:flex}.PriviliegeList li .Img{width:80px}.PriviliegeList li .Img img{width:60px;margin:10px}.PriviliegeList li .Content h4{text-transform:capitalize;margin-block-start:10px}";var I,k,C,E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},P={exports:{}};I=P,k=P.exports,C=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==E)return E;throw new Error("unable to locate global object")}(),I.exports=k=C.fetch,C.fetch&&(k.default=C.fetch.bind(C)),k.Headers=C.Headers,k.Request=C.Request,k.Response=C.Response;const S=P.exports,R=class{constructor(t){e(this,t),this.elevateLevelsDataChange=n(this,"elevateLevelsDataChange",7),this.scopeParams=void 0}async componentWillRender(){if(!this.scopeParams.endpoint)return;let e=new URL(`${this.scopeParams.endpoint}/v1/elevate/levels?language=${this.scopeParams.language}`);await S(e.href).then((e=>e.json())).then((e=>{const t=e.data.sort(((e,t)=>e.firstEntryPoints<t.firstEntryPoints?-1:1));let n=this.scopeParams.selectedLevelId;if(!n&&this.scopeParams.showDefault&&t.length>0&&(n=t[0].id),n){const e=t.filter((e=>e.id==n))[0];this.elevateLevelsDataChange.emit({currentLevel:e})}this.elevateLevelsDataChange.emit({clearError:!0}),this.elevateLevelsDataChange.emit({elevateLevels:t})})).catch((e=>{this.elevateLevelsDataChange.emit({errorMessage:{type:"errorWhenLoadElevateLevels",err:e}}),console.error(e)}))}};function T(e,t){if(e){const n=document.createElement("style");n.innerHTML=t,e.appendChild(n)}}function D(e,t){if(!e||!t)return;const n=new URL(t);fetch(n.href).then((e=>e.text())).then((t=>{const n=document.createElement("style");n.innerHTML=t,e&&e.appendChild(n)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}R.style=":host{display:block}";const M=class{constructor(t){e(this,t),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(null!=window.emMessageBus?function(e,t){if(window.emMessageBus){const n=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{n.innerHTML=t,e&&e.appendChild(n)}))}}(this.el,`${this.mbSource}.Style`):(this.clientStyling&&T(this.el,this.clientStyling),this.clientStylingUrl&&D(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(e,t){e!=t&&T(this.el,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&this.clientStylingUrl&&D(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&T(this.el,this.clientStyling),this.clientStylingUrl&&D(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const e=[];if(this.translationUrl){const i=(t=this.translationUrl,n=this.targetTranslations,new Promise((e=>{fetch(t).then((e=>e.json())).then((t=>{Object.keys(t).forEach((e=>{n[e]=n[e]||{},Object.keys(t[e]).forEach((i=>{if(!n.en[i])return;const l=n.en[i];"object"==typeof t[e][i]?(n[e][i]=n[e][i]||Object.assign({},l),Object.keys(t[e][i]).forEach((l=>{n[e][i][l]=t[e][i][l]}))):n[e][i]=t[e][i]||Object.assign({},l)}))})),e(!0)})).catch((t=>{console.error("Failed to load translations:",t),e(!1)}))})));e.push(i)}var t,n;return await Promise.all(e)}render(){return t("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},t("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return l(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};function _(e){d(1,arguments);var t=h(e);return t.setHours(0,0,0,0),t}function $(e,t){return d(2,arguments),h(e).getTime()-h(t).getTime()}M.style=":host{display:block}";var B={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function O(e){return e?B[e]:B.trunc}const A=class{constructor(t){e(this,t),this.playerElevateLeveLoaded=n(this,"playerElevateLeveLoaded",7),this.params=void 0,this.playerElevateLevel=void 0,this.pointExpireString=void 0}handleWindowResizs(){this.initLevelProgressbar()}onParamsChanged(){this.loadElevateInfo()}redeemGiftButtonHandler(){this.loadElevateInfo()}onRedeemClick(){window.postMessage({type:"BEERedeemClicked"},window.location.href)}loadLevels(){let e=new URL(`${this.params.endpoint}/v1/elevate/levels?language=${this.params.language}`);return new Promise(((t,n)=>fetch(e.href,{method:"GET"}).then((e=>e.json())).then((e=>{this.levels=e.data,t(!0)})).catch((e=>{n(e)}))))}calcuatePointsToBeExpired(e,t){let n="";if(!e||!e.aboutToExpire||0==e.aboutToExpire.length||e.aboutToExpire[0].points<=0)return n;e.aboutToExpire.sort(((e,t)=>function(e,t){d(2,arguments);var n=h(e),i=h(t);return n.getTime()<i.getTime()}(new Date(e.expireTime),new Date(t.expireTime))?-1:1));const i=e.aboutToExpire[0],l=function(e,t){d(2,arguments);var n=_(e),i=_(t),l=n.getTime()-c(n),a=i.getTime()-c(i);return Math.round((l-a)/864e5)}(new Date(i.expireTime),new Date);let a=0,s=0,r=0===l?`${t}Day`:t;return l<=0&&(a=function(e,t,n){d(2,arguments);var i=$(e,t)/36e5;return O(null==n?void 0:n.roundingMethod)(i)}(new Date(i.expireTime),new Date,{roundingMethod:"floor"}),r=a>1?`${t}Hours`:`${t}Hour`,a<=0&&(s=function(e,t,n){d(2,arguments);var i=$(e,t)/6e4;return O(null==n?void 0:n.roundingMethod)(i)}(new Date(i.expireTime),new Date,{roundingMethod:"floor"}),r=s>1?`${t}Minutes`:`${t}Minute`)),n=o(r,{expirationPoints:i.points,expireDay:Math.max(l,a,s),lang:this.params.language}),n}loadPlayerLevelInfo(){let e=new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);return new Promise(((t,n)=>fetch(e.href,{method:"GET",headers:{"X-Sessionid":this.params.session,"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>{var i,l,a,s,o;if(!e.success)return console.error("Exception when fetch user elevateinfo, ",e.errorCode,e.errorMessage),void n(!0);window.postMessage({type:"UpdateGamificationXp",points:null===(l=null===(i=e.data)||void 0===i?void 0:i.level)||void 0===l?void 0:l.loyaltyPoints},window.location.href);let r=e.data;this.playerElevateLevel=r.level,this.playerElevateLevel.name=this.playerElevateLevel.presentation.displayName||this.playerElevateLevel.name,this.playerElevateLevel.spendablePoints=(null===(a=r.spendableWallet)||void 0===a?void 0:a.total.points)||0,this.playerElevateLeveLoaded.emit({elevateLevel:this.playerElevateLevel});const d=null===(s=e.data.spendableWallet)||void 0===s?void 0:s.total,h=null===(o=e.data.loyaltyWallet)||void 0===o?void 0:o.total;this.playerElevateLeveLoaded.emit({elevateLevelWalletTotal:d,loyaltyWalletTotal:h});let c=this.calcuatePointsToBeExpired(d,"coinsToBeExpired"),v=this.calcuatePointsToBeExpired(h,"pointsToBeExpired");(c||v)&&this.playerElevateLeveLoaded.emit({pointExpireString:c,xpExpireString:v}),t(this.playerElevateLevel)})).catch((e=>{console.log("error ",e),n(!0)}))))}setLoyaltyProgress(e){!function(e,t){const n=e.querySelector("#total_level"),i=n.getBBox().width,l=t>1?1:t,a=l*i-17<0?0:l*i-17,s=e.querySelector("#current_level"),o=e.querySelector("#filter_current_level"),r=e.querySelector("#circle_current_level");n.setAttribute("viewbox",`0 0 ${a} 28`),s.setAttribute("width",`${a}`),r.setAttribute("cx",`${a<6.5?6.5:a}`),o.setAttribute("x",""+(a-8));const d=e.querySelector("#lock"),h=e.querySelector("#filter_heart_ball"),c=e.querySelector("#filter_ball"),v=e.querySelector("#filter_heart"),f=e.querySelector("#filter_lock"),p=e.querySelector("#paint0_linear_ball"),g=e.querySelector("#paint1_linear_lock"),b=e.querySelector("#lock_box"),u=e.querySelector("#heart_box"),y=i-10;d.setAttribute("cx",`${y}`),g.setAttribute("x1",`${y}`),g.setAttribute("x2",`${y}`),p.setAttribute("x1",""+(y-6)),p.setAttribute("x2",""+(y-6+11.2)),f.setAttribute("x",""+(y-6)),v.setAttribute("x",""+(y-6-2)),c.setAttribute("x",""+(y-6-2-2)),h.setAttribute("x",""+(y-6-2-2-4)),b.setAttribute("x",""+(y-6)),u.setAttribute("x",""+(y-6)),n.parentElement.style.opacity="1"}(this.loyaltyProgressEle,e)}initLevelProgressbar(){setTimeout((()=>{this.loyaltyProgressEle=this.elevateCardRef.parentElement.querySelector("#LevelProgress"),this.loyaltyProgressEle&&(this.setLoyaltyProgress(this.playerElevateLevel.nextLevel?this.playerElevateLevel.loyaltyPoints/this.playerElevateLevel.nextLevel.entryPoints:1),this.params.playerElevateLevel=this.playerElevateLevel)}),80)}componentDidRender(){this.initLevelProgressbar()}loadElevateInfo(){if(!this.params.endpoint||!this.params.session)return;const e=[];e.push(this.loadPlayerLevelInfo()),this.params.calculateLevelFlag&&e.push(this.loadLevels()),Promise.all(e).then((e=>{if(console.log("elevate-init",e),this.initLevelProgressbar(),!this.levels)return;this.levels.sort(((e,t)=>e.firstEntryPoints>t.firstEntryPoints?1:-1));const t=this.playerElevateLevel.loyaltyPoints;let n=0;this.levels.forEach(((e,i)=>{t>e.firstEntryPoints&&(n=i)})),this.playerElevateLeveLoaded.emit({calculatedLevelFlag:n})}))}componentWillLoad(){this.loadElevateInfo()}get elevateCardRef(){return l(this)}static get watchers(){return{params:["onParamsChanged"]}}};A.style=':host {\n display: block;\n width: 360px;\n height: 230px;\n}\n\n.ElevateCardWrapper {\n contain: layout inline-size;\n width: 100%;\n height: fit-content;\n min-height: 218px;\n}\n\n.Outer {\n container-type: inline-size;\n font-size: 12px;\n background-size: cover;\n background-repeat: no-repeat;\n line-height: initial;\n width: 100%;\n height: 100%;\n}\n\n.Dark {\n color: var(--emw--color-gray150, #efefef);\n}\n\n.Light {\n color: var(--emw--color-black, #0e0e0e);\n}\n\n@container (min-width: 381px) {\n .Outer {\n background-size: cover;\n }\n .Outer .OuterCover {\n min-height: 190px;\n }\n}\n@container (min-width: 260px) {\n .Outer {\n background-size: contain;\n }\n}\n.OuterCover {\n width: 100%;\n height: 100%;\n content: "";\n background-repeat: no-repeat;\n background-size: cover;\n border-radius: 15px;\n}\n\n.Inner {\n display: flex;\n flex-direction: column;\n min-height: 158px;\n}\n.Inner .Content {\n padding: 15px;\n flex-wrap: wrap;\n gap: 8px;\n}\n.Inner .Row {\n display: flex;\n flex-direction: row;\n}\n.Inner .CardCell {\n display: flex;\n}\n.Inner .LevelProgress svg {\n transition: opacity 0.4s;\n}\n.Inner .LevelInfo {\n display: flex;\n flex-direction: column;\n}\n.Inner .LevelInfo .ElevateLevel .LevelName {\n height: 28px;\n border-radius: 5px;\n line-height: 28px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.Inner .LevelInfo.Level0 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level0button-shadow, rgba(191, 84, 6, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level0-bg0, #E2792C) 0%, var(--emw--elevate-color-level0-bg1, rgba(242, 151, 99, 0)) 100%);\n}\n.Inner .LevelInfo.Level1 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level1button-shadow, rgba(151, 151, 151, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level1-bg0, #BEBFED) 0%, var(--emw--elevate-color-level1-bg1, rgba(216, 217, 233, 0)) 100%);\n}\n.Inner .LevelInfo.Level2 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level2button-shadow, rgba(191, 120, 6, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level2-bg0, #FCC410) 0%, var(--emw--elevate-color-level2-bg1, rgba(255, 189, 43, 0)) 100%);\n}\n.Inner .LevelInfo.Level3 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level3button-shadow, rgba(65, 6, 191, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level3-bg0, #B1A2DB) 0%, var(--emw--elevate-color-level3-bg1, rgba(203, 202, 245, 0)) 100%);\n}\n.Inner .LevelInfo.Level4 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level4button-shadow, rgba(65, 6, 191, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level4-bg0, #B1A2DB) 0%, var(--emw--elevate-color-level4-bg1, rgba(203, 202, 245, 0)) 100%);\n}\n.Inner .LevelInfo .ElevateLevel {\n display: flex;\n}\n.Inner .LevelInfo {\n flex: 1;\n flex-grow: 1;\n min-width: 150px;\n}\n.Inner .PlayerImg {\n width: 29%;\n margin: auto;\n max-width: 100px;\n min-width: 30px;\n order: 0;\n}\n.Inner .PlayerAvatar {\n max-width: 100px;\n flex-basis: 100px;\n height: auto;\n margin: auto;\n padding-top: 10px;\n}\n.Inner .PlayerAvatar .Avatar, .Inner .PlayerAvatar .Badge {\n width: 100%;\n height: 100%;\n}\n.Inner .PlayerAvatar .Avatar {\n border-radius: 50%;\n background-size: contain;\n background-repeat: no-repeat;\n}\n.Inner .ElevateLevel .ExpirationDate {\n max-width: 138px;\n min-width: 118px;\n}\n.Inner .PlayerName, .Inner .RedeemButton, .Inner .ElevateLevel {\n text-transform: capitalize;\n width: 100%;\n}\n.Inner .PlayerName {\n font-size: 16px;\n}\n.Inner .Row .PointsInfo {\n display: table;\n font-weight: 600;\n}\n.Inner .Row .Redeem {\n justify-content: flex-end;\n margin-left: auto;\n}\n.Inner .Row .Redeem:hover {\n color: var(--emw--elevate-color-redeem-hover, #00ABA4);\n cursor: pointer;\n}\n.Inner .Row .RedeemButton:hover span {\n color: var(emfe-w-elevate-color-redeem-text-hover, #f1f1f1);\n font-weight: bold;\n}\n.Inner .Row .RedeemButton {\n width: 95px;\n height: 35px;\n display: flex;\n align-items: center;\n border-radius: var(--emw--border-radius-medium, 10px);\n background: var(--emw--elevate-color-redeem-bg, linear-gradient(0deg, #26CC37, #26CC37)), linear-gradient(117.99deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.89%), linear-gradient(283.85deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.47%), linear-gradient(268.18deg, rgba(255, 255, 255, 0.6) -17.36%, rgba(239, 239, 239, 0) 15.78%);\n box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.2509803922);\n}\n.Inner .Row .RedeemButton span {\n color: var(--emw--color-white, #fff);\n line-height: 18px;\n font-size: 15px;\n text-align: center;\n width: 100%;\n}\n.Inner .Row .Points {\n font-size: large;\n vertical-align: middle;\n}\n.Inner .Row .Points .XP {\n font-size: x-small;\n}\n.Inner .Row .ExpirationPoints {\n font-size: small;\n text-align: right;\n font-weight: bold;\n color: var(--emw--color-red, #9e595f);\n}';const z=class{constructor(t){e(this,t),this.endpoint=void 0,this.session=void 0,this.playerAvatarUrl=void 0,this.language=void 0,this.playerName=void 0,this.dateFormat="yyyy-MM-dd",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.userLevelId=void 0}setPlayerElevateLevelInfo(e){"playerElevateLeveLoaded"===e.type&&e.detail.elevateLevel&&(this.userLevelId=e.detail.elevateLevel.id)}render(){return t(i,{key:"6fe9245d801450135e6bcbde98e695274c96843d"},t("div",{key:"4f54bdcab376982cabe42bbbc5789e1d00381617",class:"PlayerElevateCard"},t("player-elevate-loyaltycard",{key:"fcae0187fc7df6760124288049e785c7bcbd4c7a",playerName:this.playerName,dateFormat:this.dateFormat,clientStylingUrl:this.clientStylingUrl,translationUrl:this.translationUrl,mbSource:this.mbSource,clientStyling:`${this.clientStyling} .Outer{height: 185px}`,endpoint:this.endpoint,language:this.language,session:this.session})),t("div",{key:"4056a7ee6d4069466f92bd089979cef530af2f41",class:"ElevateLevelsInfo"},t("bonus-elevate-levels",{key:"b7ec448dd2c24afb967afcef9f7f975e5d86576c",selectedLevelId:this.userLevelId,clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,translationUrl:this.translationUrl,mbSource:this.mbSource,language:this.language,endpoint:this.endpoint})),t("general-styling-wrapper",{key:"b8371fd6be5555f9dc0cc5314ab64798f5e7f364",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,mbSource:this.mbSource}))}};z.style=":host{display:block}.PlayerElevateCard{height:160px;width:100%;overflow:hidden}.ElevateLevelsInfo{background-color:var(--emw--color-background, #e6e8ea)}";const j=class{constructor(t){e(this,t),this.endpoint=void 0,this.theme="Dark",this.session=void 0,this.playerAvatarUrl=void 0,this.language="en",this.playerName=void 0,this.dateFormat="yyyy-MM-dd",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.pointExpireString=void 0,this.playerElevateLevel=void 0,this.elevateWalletTotal=void 0}onSessionOrEndpointChange(){this.paramProxy=Object.assign(Object.assign({},this.paramProxy),{session:this.session,endpoint:this.endpoint,language:this.language})}playerElevateLeveLoadedHandler(e){e.detail&&(e.detail.elevateLevelWalletTotal&&(this.elevateWalletTotal=e.detail.elevateLevelWalletTotal),e.detail.elevateLevel&&(this.playerElevateLevel=e.detail.elevateLevel),e.detail.xpExpireString&&(this.pointExpireString=e.detail.xpExpireString))}onRedeemClick(){window.postMessage({type:"BEERedeemClicked"},window.location.href)}componentWillLoad(){this.paramProxy={endpoint:this.endpoint,session:this.session,language:this.language}}getNextLevelPoints(){var e,t;return(null===(e=this.playerElevateLevel)||void 0===e?void 0:e.nextLevel)?null===(t=this.playerElevateLevel)||void 0===t?void 0:t.nextLevel.entryPoints:-1}getNextLevelTips(){var e;let t=null===(e=this.playerElevateLevel)||void 0===e?void 0:e.nextLevel;if(this.playerElevateLevel&&t){const e=(t.entryPoints-this.playerElevateLevel.loyaltyPoints).toFixed(2);return o("tipsForNextLevel",{pointsToReach:e,levelName:t.name,lang:this.language})}return""}render(){const e=a("../static/card-ground.svg"),n=a("../static/card-ground-over.svg");return t("div",{key:"9f673b8dccc848d11f0836c15f1f5da5e242e3b3",class:`ElevateCardWrapper ${this.theme}`},t("div",{key:"419c71a612c3cdfebaece1e90345c6324c68348e",class:"LoyaltyCard Outer",style:{backgroundImage:`url(${e}`}},t("general-styling-wrapper",{key:"04c1098bf16e683f30d211dfb9ebc0b319076258",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,targetTranslations:r,translationUrl:this.translationUrl,mbSource:this.mbSource}),t("player-elevate-card-data",{key:"a9c57ef6c5c3381c7e9bf2f041a190f3de3a0423",params:this.paramProxy}),t("div",{key:"402ceddce75abb2ee6b59db730418efc006e5c60",class:"OuterCover Inner",style:{backgroundImage:`url(${n}`}},t("div",{key:"844cba8ae40b9dd55129f7b0d52a208ea72e72cf",class:"Content Row"},this.playerElevateLevel&&t(s,{key:"d365971e66cbdc81d4b1758c045a76ad50a68729"},t("div",{key:"2e017a95d80098565d17807c6f8dae51a6b89090",class:"PlayerImg"},t(v,{key:"5aaf4b8e2b8ea67fa0fed1a07dde9caf2551a3bd",onlyBadge:!0,loyaltyIconUrl:this.playerElevateLevel.presentation.asset})),t("div",{key:"6e332314f4c4a233dd353130266a4d0368b0de45",class:`LevelInfo ${this.playerElevateLevel.name}`},t("div",{key:"06311b5920ac4126536760049bf3664d92cc247f",class:"CardCell ElevateLevel"},t("span",{key:"4538afdef55cd520e2d213e6a97d209234deabe5",class:"LevelName",title:this.playerElevateLevel.name},this.playerElevateLevel.name)),t("div",{key:"cb2764c587a2fe1719b2ff6e045866ee032d5a66",class:"PointsRange"},t(f,{key:"aa4336101e41f6d1dd281858711a56275526a33a",loyaltyPoints:this.playerElevateLevel.loyaltyPoints,language:this.language}),t(f,{key:"c377b14c0aec0c17e9fa818d105780f6c3089723",loyaltyPoints:this.getNextLevelPoints(),language:this.language})),t(p,{key:"1e987ae286c44ff2a9a53012ad3ad901e4207f28"}),t("div",{key:"a09ecaa84862baa4f732f8ce5c2d90e61128fa16",class:"NextLevelTip"},this.getNextLevelTips()),this.pointExpireString&&t("div",{key:"fd62be9b41dc07b200e7d26cc33f917f0b955ba0",class:"PointsInfo ExpirationPoints"},this.pointExpireString," "),this.playerElevateLevel.expireTime&&t(g,{key:"aca096829b93012ee76f9839ada2b2e96b58d3db",expireTime:this.playerElevateLevel.expireTime,dateFormat:this.dateFormat,language:this.language})))))))}static get watchers(){return{session:["onSessionOrEndpointChange"],endpoint:["onSessionOrEndpointChange"],language:["onSessionOrEndpointChange"]}}};j.style=":host{display:block}@media screen and (min-width: 501px){.LoyaltyCard .Inner .LevelInfo .ElevateLevel{flex-wrap:nowrap}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{padding-top:6px;margin-left:0px}}@media screen and (max-width: 500px){.LoyaltyCard .Inner .LevelInfo .ElevateLevel{flex-wrap:wrap}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{padding-top:0px;margin-left:0px}}.LoyaltyCard .Inner .LevelProgress{margin-left:0px}.LoyaltyCard .Inner .Row .PointsInfo.ExpirationPoints{text-align:left;color:var(--emw--color-red-50, red)}.LoyaltyCard .Inner .PlayerAvatar .Avatar{display:none}.LoyaltyCard .Inner .PlayerAvatar .Badge{border-radius:50%;background-size:contain;width:100%;height:100%}.LoyaltyCard .Inner .LevelInfo .ElevateLevel{display:flex;flex:1;align-items:center}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{position:relative;padding-left:0px}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate .ExpireTime{margin-left:5px}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .LevelName{padding-left:0;font-size:var(--emw--elevate-fontsize-2xlarge, 21px);position:relative;width:auto;color:var(--emw--elevate-color-levelname, #FFBD2B);font-weight:bold}.LoyaltyCard .PointsRange{display:flex;justify-content:space-between}.LoyaltyCard .PointsRange .PointsInfo{width:auto}.LoyaltyCard .NextLevelTip{text-align:right;font-size:11px;color:var(--emw--color-black, #000);opacity:0.8;font-weight:bold}";export{w as bonus_elevate_levels,x as elevate_level_list,L as elevate_level_presentation,R as elevate_levels_data,M as general_styling_wrapper,A as player_elevate_card_data,z as player_elevate_level,j as player_elevate_loyaltycard}
1
+ import{r as e,h as t,c as n,H as i,g as l,a,F as s}from"./index-8b0eeaf7.js";import{t as o,T as r}from"./locale.utils-471ae737.js";import{r as d,t as h,g as c,P as v,a as f,b as p,L as g}from"./player-elevate-card-items-7be884d5.js";const b=["ro","en","fr","hr","tr"],u={en:{level:"level",seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set",points:"Points"},fr:{level:"level",seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set",points:"Points"},hr:{level:"Razina",seeAll:"Vidi sve",privilegesFor:"Privilegije za",termsAndConditions:"Uvjeti i odredbe",noLevelsSet:"There is no level set",points:"Points"},ro:{level:"level",seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set",points:"Points"},tr:{level:"level",seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set",points:"Points"}},w=(e,t)=>{const n=t;return u[void 0!==n&&(b.includes(n)||u[n])?n:"en"][e]},y=class{constructor(t){e(this,t),this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.endpoint=void 0,this.language="en",this.translationUrl="",this.selectedLevelId=void 0,this.showDefault=void 0,this.elevateLevelParamProxy=void 0,this.elevateLevels=[],this.currentLevel=void 0,this.errorMessage=void 0}selectedLevelChangedHandler(e){e.detail&&(this.currentLevel=Object.assign({},e.detail.level))}selectedLevelIdChangedHandler(){if(this.selectedLevelId&&this.elevateLevels){const e=this.elevateLevels.filter((e=>e.id==this.selectedLevelId))[0];this.currentLevel=Object.assign({},e)}}onSessionOrEndpointChange(){this.elevateLevelParamProxy=Object.assign(Object.assign({},this.elevateLevelParamProxy),{endpoint:this.endpoint,language:this.language})}elevateLevelsDataChangeHandler(e){e.detail&&(e.detail.currentLevel&&(this.currentLevel=Object.assign({},e.detail.currentLevel)),e.detail.elevateLevels&&(this.elevateLevels=[...e.detail.elevateLevels]),e.detail.clearError&&(this.errorMessage=null),e.detail.errorMessage&&e.detail.errorMessage.errorWhenLoadElevateLevels&&(this.errorMessage=w("loadElevateLevelErrorMessage",this.language)))}onTCClick(){window.postMessage({type:"termAndConditionClicked"},window.location.href)}componentWillLoad(){this.elevateLevelParamProxy={endpoint:this.endpoint,language:this.language,selectedLevelId:this.selectedLevelId,showDefault:this.showDefault}}render(){var e;return t("div",{key:"6bc46c87633a9a295108e50886096f67dd35d44a",class:"ElevateLevelContent"},t("elevate-levels-data",{key:"902d2796991a8acf293761255ab10f2cee54a92e",scopeParams:this.elevateLevelParamProxy}),t("div",{key:"7e47a25dce1d0fba40e3e432dd9c805aa5bbe308",class:"LevelContent"},(null===(e=this.elevateLevels)||void 0===e?void 0:e.length)?t("elevate-level-list",{language:this.language,selectedLevelId:this.selectedLevelId,levels:this.elevateLevels}):w("noLevelsSet",this.language),this.currentLevel&&t("elevate-level-presentation",{key:"dcfad9aa4422545fa74a7b8b957eb72001506046",elevateLevel:this.currentLevel})),this.errorMessage&&t("div",{key:"7e2741168e50a1ee2adebe39c2c3433b5c9bf7ca"},this.errorMessage),t("general-styling-wrapper",{key:"74cae021838f61964a519c2f200cfbb1f8470778",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,targetTranslations:u,translationUrl:this.translationUrl,mbSource:this.mbSource}))}static get watchers(){return{selectedLevelId:["selectedLevelIdChangedHandler"],elevateLevels:["selectedLevelIdChangedHandler"],endpoint:["onSessionOrEndpointChange"],language:["onSessionOrEndpointChange"]}}};var m;y.style=":host{display:block}.ElevateLevelContent{padding:20px;position:relative}.ElevateLevelContent .Privileges{padding-bottom:30px}.ElevateLevelContent .tc{position:absolute;right:10px;bottom:10px;text-align:right;display:none}",function(e){e[e.slideToRight=1]="slideToRight",e[e.slideToLeft=-1]="slideToLeft"}(m||(m={}));const x=class{constructor(t){var i;e(this,t),this.selectedLevelChanged=n(this,"selectedLevelChanged",7),this.minOffset=0,this.isMobile=!!((i=window.navigator.userAgent).toLowerCase().match(/android/i)||i.toLowerCase().match(/blackberry|bb/i)||i.toLowerCase().match(/iphone|ipad|ipod/i)||i.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),this.levels=void 0,this.language=void 0,this.selectedLevelId=void 0,this.showSliderButton=!1,this.touchPosStart=void 0,this.touchPosEnd=void 0,this.offset=0}onLevelClicked(e){this.selectedLevelChanged.emit({level:e}),this.selectedLevelId=e.id}levelsChangedHandler(){this.initOffsetOfLevelItems()}initOffsetOfLevelItems(){if(!this.levels||0==this.levels.length||!this.selectedLevelId)return;const e=this.levels.findIndex((e=>this.selectedLevelId==e.id));if(this.onLevelClicked(this.levels[-1==e?0:e]),this.levels.length<=this.moveCountForOneTouch)return;let t=Math.floor((-1==e?1:e+1)/this.moveCountForOneTouch)*this.moveCountForOneTouch*this.childElementWidth*-1;this.offset=t<=this.minOffset?this.minOffset:t>=0?0:t}onTouchStart(e){this.touchPosStart={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}onTouchMove(e){this.touchPosEnd={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY};const t=this.touchPosEnd.clientX-this.touchPosStart.clientX,n=this.touchPosEnd.clientY-this.touchPosStart.clientY;Math.abs(t)>Math.abs(n)&&this.slideTo(t>0?m.slideToRight:m.slideToLeft)}slideTo(e){let t=this.levelsElement.offsetLeft+this.childElementWidth*this.moveCountForOneTouch*e;if(t%this.childElementWidth!=0){const n=Math.floor(t/this.childElementWidth)*this.childElementWidth,i=Math.ceil(t/this.childElementWidth)*this.childElementWidth;t=e==m.slideToRight?n:i}this.offset=t<this.minOffset?this.minOffset:t>=0?0:t}initLevelSlider(){var e;if(!(null===(e=this.levelsElement)||void 0===e?void 0:e.firstElementChild))return void console.log("Widget[elevate-level-list] DOM is not ready.");this.showSliderButton=!this.isMobile&&this.levelsElement.clientWidth>this.levelsElement.parentElement.clientWidth,this.minOffset=this.levelsElement.parentElement.clientWidth-this.levelsElement.clientWidth,this.childElementWidth=this.levelsElement.firstElementChild.clientWidth,this.moveCountForOneTouch=Math.ceil(this.levelsElement.parentElement.clientWidth/this.childElementWidth)-1;const t=this.levelsElement.childElementCount;this.childElementWidth+=(this.levelsElement.clientWidth-this.childElementWidth*t)/(t-1)}debounce(e,t){{let n;return()=>{clearTimeout(n),n=setTimeout((()=>{e()}),t)}}}convertNumberToCompactForm(e){return e>=1e9?(e/1e9).toFixed(1).replace(/\.0$/,"")+"b":e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"m":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k":e.toString()}handleResize(){this.debounce(this.initLevelSlider.bind(this),200)()}componentDidRender(){this.host.componentOnReady().then((()=>{this.initLevelSlider()}))}render(){return t(i,{key:"c2eb983ff3df4868204eec8e527efa08c9e5afa0"},this.levels&&[t("div",{key:"9f6563c030a7725761b9a73cffb8e2d8d8f47c32",class:`SliderButton LeftButton ${0==this.offset?"Disabled":""} ${this.showSliderButton?"":"Hidden"}`,onClick:()=>this.slideTo(m.slideToRight)},t("svg",{key:"9e3d3422bd2171d26821c1f74e3ab7418b97643d",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"ac0002e40e037edd0c0893c9250f36e18e451f16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"}))),t("div",{key:"242903f38deb464844d722e0e7fe90665de99d6a",class:"LevelItemsWrapper"},t("div",{key:"739328ff99ecd777b9e2ff6914034a5bbc7eac90",style:{left:`${this.offset}px`},class:"LevelItems "+(this.isMobile?"Mobile":""),id:"levelItems",ref:e=>{this.levelsElement=e}},this.levels.map(((e,n)=>t("div",{class:"Item "+(this.selectedLevelId==e.id?"Active":""),onClick:this.onLevelClicked.bind(this,e)},t("img",{alt:`Presentation Icon for ${e.presentation.displayName}`,class:"LevelImg",src:e.presentation.asset}),t("span",{class:"LevelName",title:e.presentation.displayName},e.presentation.displayName),t("span",{class:"LevelPoints"},0==n?"":">",this.convertNumberToCompactForm(e.firstEntryPoints)," ",w("points",this.language))))))),t("div",{key:"2366c09b46bfec309bd4f8d5991d457f04dbf038",class:`SliderButton RightButton ${this.offset<=this.minOffset?"Disabled":""} ${this.showSliderButton?"":"Hidden"}`,onClick:()=>this.slideTo(m.slideToLeft)},t("svg",{key:"c52ef4f99444d1185e9b8ce4287f0f2886c622ae",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"acc266646133bb636b52f8776380e6aedc93f937","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})))])}get host(){return l(this)}static get watchers(){return{selectedLevelId:["levelsChangedHandler"]}}};x.style="elevate-level-list{display:flex;flex-direction:row}.LevelItemsWrapper{display:flex;flex:1;margin-top:10px;min-height:30px;transition-property:all;position:relative;height:138px;overflow-x:hidden}.Mobile.LevelItems{overflow-x:hidden}.LevelItems{overflow-x:auto;display:flex;flex-direction:row;gap:10px;left:0;position:absolute;transition:left 0.5s ease-in-out}.LevelItems .Item:hover,.LevelItems .Item.Active{background-color:var(--emw--color-gray-50, rgb(244, 244, 244));box-shadow:0px 4px 13px 0px rgba(0, 0, 0, 0.25)}.LevelItems .Item{width:86px;height:125px;border-radius:15px;text-align:center;display:flex;flex-direction:column;cursor:pointer}.LevelItems .Item .LevelName{font-size:13px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.LevelItems .Item .LevelPoints{color:var(--emw--color-gray-100, rgb(118, 113, 113));font-size:10px}.LevelItems .Item .LevelImg{width:65px;height:68px;margin:11px auto}.SliderButton{display:flex;width:29px;align-items:center;cursor:pointer}.SliderButton.Disabled svg{stroke:var(--emw--color-gray-50, #cbc5c5)}.SliderButton.Hidden{display:none}";const L=class{constructor(t){e(this,t),this.elevateLevel=void 0}render(){return t(i,{key:"16d128717e716f7ca7d3bb77fc3a2e67209318b6"},t("div",{key:"658657abdfc64844bd2af40562efe40385e1735a",class:"Row Desc"},t("h3",{key:"ec5871c2f810c8c120bf99510717381175bc1ef4"},this.elevateLevel.presentation.displayName),t("p",{key:"865915c6eea90295238fb47eaa91c8f968199ca5"},t("span",{key:"2b90c6c5d6957b73fc4a0f53d53da0ca023a4f0a",class:"TxtDesc",innerHTML:this.elevateLevel.presentation.description}))))}};L.style=":host{display:block}.PriviliegeList{padding-inline-start:5px}.PriviliegeList li{display:flex}.PriviliegeList li .Img{width:80px}.PriviliegeList li .Img img{width:60px;margin:10px}.PriviliegeList li .Content h4{text-transform:capitalize;margin-block-start:10px}";var I,k,C,E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},P={exports:{}};I=P,k=P.exports,C=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==E)return E;throw new Error("unable to locate global object")}(),I.exports=k=C.fetch,C.fetch&&(k.default=C.fetch.bind(C)),k.Headers=C.Headers,k.Request=C.Request,k.Response=C.Response;const S=P.exports,T=class{constructor(t){e(this,t),this.elevateLevelsDataChange=n(this,"elevateLevelsDataChange",7),this.scopeParams=void 0}async componentWillRender(){if(!this.scopeParams.endpoint)return;let e=new URL(`${this.scopeParams.endpoint}/v1/elevate/levels?language=${this.scopeParams.language}`);await S(e.href).then((e=>e.json())).then((e=>{const t=e.data.sort(((e,t)=>e.firstEntryPoints<t.firstEntryPoints?-1:1));let n=this.scopeParams.selectedLevelId;if(!n&&this.scopeParams.showDefault&&t.length>0&&(n=t[0].id),n){const e=t.filter((e=>e.id==n))[0];this.elevateLevelsDataChange.emit({currentLevel:e})}this.elevateLevelsDataChange.emit({clearError:!0}),this.elevateLevelsDataChange.emit({elevateLevels:t})})).catch((e=>{this.elevateLevelsDataChange.emit({errorMessage:{type:"errorWhenLoadElevateLevels",err:e}}),console.error(e)}))}};T.style=":host{display:block}";const R="__WIDGET_GLOBAL_STYLE_CACHE__";function _(e,t){if(e){const n=document.createElement("style");n.innerHTML=t,e.appendChild(n)}}function D(e,t){if(!e||!t)return;const n=new URL(t);fetch(n.href).then((e=>e.text())).then((t=>{const n=document.createElement("style");n.innerHTML=t,e&&e.appendChild(n)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}const M=class{constructor(t){e(this,t),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(null!=window.emMessageBus?function(e,t,n,i=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!i)return function(e,t){const n=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{e&&(n.innerHTML=t,e.appendChild(n))}))}(e,t);window[R]||(window[R]={});const l=(n=function(e,t){return window.emMessageBus.subscribe(t,(n=>{if(!e)return;const i=e.getRootNode(),l=window[R];let a=l[t]?.sheet;a?l[t].refCount=l[t].refCount+1:(a=new CSSStyleSheet,a.replaceSync(n),l[t]={sheet:a,refCount:1});const s=i.adoptedStyleSheets||[];s.includes(a)||(i.adoptedStyleSheets=[...s,a])}))}(e,t)).unsubscribe.bind(n);n.unsubscribe=()=>{if(window[R][t]){const e=window[R][t];e.refCount>1?e.refCount=e.refCount-1:delete window[R][t]}l()}}(this.el,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&_(this.el,this.clientStyling),this.clientStylingUrl&&D(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(e,t){e!=t&&_(this.el,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&this.clientStylingUrl&&D(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&_(this.el,this.clientStyling),this.clientStylingUrl&&D(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const e=[];if(this.translationUrl){const i=(t=this.translationUrl,n=this.targetTranslations,new Promise((e=>{fetch(t).then((e=>e.json())).then((t=>{Object.keys(t).forEach((e=>{n[e]=n[e]||{},Object.keys(t[e]).forEach((i=>{if(!n.en[i])return;const l=n.en[i];"object"==typeof t[e][i]?(n[e][i]=n[e][i]||Object.assign({},l),Object.keys(t[e][i]).forEach((l=>{n[e][i][l]=t[e][i][l]}))):n[e][i]=t[e][i]||Object.assign({},l)}))})),e(!0)})).catch((t=>{console.error("Failed to load translations:",t),e(!1)}))})));e.push(i)}var t,n;return await Promise.all(e)}render(){return t("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},t("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return l(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};function A(e){d(1,arguments);var t=h(e);return t.setHours(0,0,0,0),t}function B(e,t){return d(2,arguments),h(e).getTime()-h(t).getTime()}M.style=":host{display:block}";var O={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function $(e){return e?O[e]:O.trunc}const z=class{constructor(t){e(this,t),this.playerElevateLeveLoaded=n(this,"playerElevateLeveLoaded",7),this.params=void 0,this.playerElevateLevel=void 0,this.pointExpireString=void 0}handleWindowResizs(){this.initLevelProgressbar()}onParamsChanged(){this.loadElevateInfo()}redeemGiftButtonHandler(){this.loadElevateInfo()}onRedeemClick(){window.postMessage({type:"BEERedeemClicked"},window.location.href)}loadLevels(){let e=new URL(`${this.params.endpoint}/v1/elevate/levels?language=${this.params.language}`);return new Promise(((t,n)=>fetch(e.href,{method:"GET"}).then((e=>e.json())).then((e=>{this.levels=e.data,t(!0)})).catch((e=>{n(e)}))))}calcuatePointsToBeExpired(e,t){let n="";if(!e||!e.aboutToExpire||0==e.aboutToExpire.length||e.aboutToExpire[0].points<=0)return n;e.aboutToExpire.sort(((e,t)=>function(e,t){d(2,arguments);var n=h(e),i=h(t);return n.getTime()<i.getTime()}(new Date(e.expireTime),new Date(t.expireTime))?-1:1));const i=e.aboutToExpire[0],l=function(e,t){d(2,arguments);var n=A(e),i=A(t),l=n.getTime()-c(n),a=i.getTime()-c(i);return Math.round((l-a)/864e5)}(new Date(i.expireTime),new Date);let a=0,s=0,r=0===l?`${t}Day`:t;return l<=0&&(a=function(e,t,n){d(2,arguments);var i=B(e,t)/36e5;return $(null==n?void 0:n.roundingMethod)(i)}(new Date(i.expireTime),new Date,{roundingMethod:"floor"}),r=a>1?`${t}Hours`:`${t}Hour`,a<=0&&(s=function(e,t,n){d(2,arguments);var i=B(e,t)/6e4;return $(null==n?void 0:n.roundingMethod)(i)}(new Date(i.expireTime),new Date,{roundingMethod:"floor"}),r=s>1?`${t}Minutes`:`${t}Minute`)),n=o(r,{expirationPoints:i.points,expireDay:Math.max(l,a,s),lang:this.params.language}),n}loadPlayerLevelInfo(){let e=new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);return new Promise(((t,n)=>fetch(e.href,{method:"GET",headers:{"X-Sessionid":this.params.session,"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>{var i,l,a,s,o;if(!e.success)return console.error("Exception when fetch user elevateinfo, ",e.errorCode,e.errorMessage),void n(!0);window.postMessage({type:"UpdateGamificationXp",points:null===(l=null===(i=e.data)||void 0===i?void 0:i.level)||void 0===l?void 0:l.loyaltyPoints},window.location.href);let r=e.data;this.playerElevateLevel=r.level,this.playerElevateLevel.name=this.playerElevateLevel.presentation.displayName||this.playerElevateLevel.name,this.playerElevateLevel.spendablePoints=(null===(a=r.spendableWallet)||void 0===a?void 0:a.total.points)||0,this.playerElevateLeveLoaded.emit({elevateLevel:this.playerElevateLevel});const d=null===(s=e.data.spendableWallet)||void 0===s?void 0:s.total,h=null===(o=e.data.loyaltyWallet)||void 0===o?void 0:o.total;this.playerElevateLeveLoaded.emit({elevateLevelWalletTotal:d,loyaltyWalletTotal:h});let c=this.calcuatePointsToBeExpired(d,"coinsToBeExpired"),v=this.calcuatePointsToBeExpired(h,"pointsToBeExpired");(c||v)&&this.playerElevateLeveLoaded.emit({pointExpireString:c,xpExpireString:v}),t(this.playerElevateLevel)})).catch((e=>{console.log("error ",e),n(!0)}))))}setLoyaltyProgress(e){!function(e,t){const n=e.querySelector("#total_level"),i=n.getBBox().width,l=t>1?1:t,a=l*i-17<0?0:l*i-17,s=e.querySelector("#current_level"),o=e.querySelector("#filter_current_level"),r=e.querySelector("#circle_current_level");n.setAttribute("viewbox",`0 0 ${a} 28`),s.setAttribute("width",`${a}`),r.setAttribute("cx",`${a<6.5?6.5:a}`),o.setAttribute("x",""+(a-8));const d=e.querySelector("#lock"),h=e.querySelector("#filter_heart_ball"),c=e.querySelector("#filter_ball"),v=e.querySelector("#filter_heart"),f=e.querySelector("#filter_lock"),p=e.querySelector("#paint0_linear_ball"),g=e.querySelector("#paint1_linear_lock"),b=e.querySelector("#lock_box"),u=e.querySelector("#heart_box"),w=i-10;d.setAttribute("cx",`${w}`),g.setAttribute("x1",`${w}`),g.setAttribute("x2",`${w}`),p.setAttribute("x1",""+(w-6)),p.setAttribute("x2",""+(w-6+11.2)),f.setAttribute("x",""+(w-6)),v.setAttribute("x",""+(w-6-2)),c.setAttribute("x",""+(w-6-2-2)),h.setAttribute("x",""+(w-6-2-2-4)),b.setAttribute("x",""+(w-6)),u.setAttribute("x",""+(w-6)),n.parentElement.style.opacity="1"}(this.loyaltyProgressEle,e)}initLevelProgressbar(){setTimeout((()=>{this.loyaltyProgressEle=this.elevateCardRef.parentElement.querySelector("#LevelProgress"),this.loyaltyProgressEle&&(this.setLoyaltyProgress(this.playerElevateLevel.nextLevel?this.playerElevateLevel.loyaltyPoints/this.playerElevateLevel.nextLevel.entryPoints:1),this.params.playerElevateLevel=this.playerElevateLevel)}),80)}componentDidRender(){this.initLevelProgressbar()}loadElevateInfo(){if(!this.params.endpoint||!this.params.session)return;const e=[];e.push(this.loadPlayerLevelInfo()),this.params.calculateLevelFlag&&e.push(this.loadLevels()),Promise.all(e).then((e=>{if(console.log("elevate-init",e),this.initLevelProgressbar(),!this.levels)return;this.levels.sort(((e,t)=>e.firstEntryPoints>t.firstEntryPoints?1:-1));const t=this.playerElevateLevel.loyaltyPoints;let n=0;this.levels.forEach(((e,i)=>{t>e.firstEntryPoints&&(n=i)})),this.playerElevateLeveLoaded.emit({calculatedLevelFlag:n})}))}componentWillLoad(){this.loadElevateInfo()}get elevateCardRef(){return l(this)}static get watchers(){return{params:["onParamsChanged"]}}};z.style=':host {\n display: block;\n width: 360px;\n height: 230px;\n}\n\n.ElevateCardWrapper {\n contain: layout inline-size;\n width: 100%;\n height: fit-content;\n min-height: 218px;\n}\n\n.Outer {\n container-type: inline-size;\n font-size: 12px;\n background-size: cover;\n background-repeat: no-repeat;\n line-height: initial;\n width: 100%;\n height: 100%;\n}\n\n.Dark {\n color: var(--emw--color-gray150, #efefef);\n}\n\n.Light {\n color: var(--emw--color-black, #0e0e0e);\n}\n\n@container (min-width: 381px) {\n .Outer {\n background-size: cover;\n }\n .Outer .OuterCover {\n min-height: 190px;\n }\n}\n@container (min-width: 260px) {\n .Outer {\n background-size: contain;\n }\n}\n.OuterCover {\n width: 100%;\n height: 100%;\n content: "";\n background-repeat: no-repeat;\n background-size: cover;\n border-radius: 15px;\n}\n\n.Inner {\n display: flex;\n flex-direction: column;\n min-height: 158px;\n}\n.Inner .Content {\n padding: 15px;\n flex-wrap: wrap;\n gap: 8px;\n}\n.Inner .Row {\n display: flex;\n flex-direction: row;\n}\n.Inner .CardCell {\n display: flex;\n}\n.Inner .LevelProgress svg {\n transition: opacity 0.4s;\n}\n.Inner .LevelInfo {\n display: flex;\n flex-direction: column;\n}\n.Inner .LevelInfo .ElevateLevel .LevelName {\n height: 28px;\n border-radius: 5px;\n line-height: 28px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.Inner .LevelInfo.Level0 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level0button-shadow, rgba(191, 84, 6, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level0-bg0, #E2792C) 0%, var(--emw--elevate-color-level0-bg1, rgba(242, 151, 99, 0)) 100%);\n}\n.Inner .LevelInfo.Level1 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level1button-shadow, rgba(151, 151, 151, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level1-bg0, #BEBFED) 0%, var(--emw--elevate-color-level1-bg1, rgba(216, 217, 233, 0)) 100%);\n}\n.Inner .LevelInfo.Level2 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level2button-shadow, rgba(191, 120, 6, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level2-bg0, #FCC410) 0%, var(--emw--elevate-color-level2-bg1, rgba(255, 189, 43, 0)) 100%);\n}\n.Inner .LevelInfo.Level3 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level3button-shadow, rgba(65, 6, 191, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level3-bg0, #B1A2DB) 0%, var(--emw--elevate-color-level3-bg1, rgba(203, 202, 245, 0)) 100%);\n}\n.Inner .LevelInfo.Level4 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level4button-shadow, rgba(65, 6, 191, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level4-bg0, #B1A2DB) 0%, var(--emw--elevate-color-level4-bg1, rgba(203, 202, 245, 0)) 100%);\n}\n.Inner .LevelInfo .ElevateLevel {\n display: flex;\n}\n.Inner .LevelInfo {\n flex: 1;\n flex-grow: 1;\n min-width: 150px;\n}\n.Inner .PlayerImg {\n width: 29%;\n margin: auto;\n max-width: 100px;\n min-width: 30px;\n order: 0;\n}\n.Inner .PlayerAvatar {\n max-width: 100px;\n flex-basis: 100px;\n height: auto;\n margin: auto;\n padding-top: 10px;\n}\n.Inner .PlayerAvatar .Avatar, .Inner .PlayerAvatar .Badge {\n width: 100%;\n height: 100%;\n}\n.Inner .PlayerAvatar .Avatar {\n border-radius: 50%;\n background-size: contain;\n background-repeat: no-repeat;\n}\n.Inner .ElevateLevel .ExpirationDate {\n max-width: 138px;\n min-width: 118px;\n}\n.Inner .PlayerName, .Inner .RedeemButton, .Inner .ElevateLevel {\n text-transform: capitalize;\n width: 100%;\n}\n.Inner .PlayerName {\n font-size: 16px;\n}\n.Inner .Row .PointsInfo {\n display: table;\n font-weight: 600;\n}\n.Inner .Row .Redeem {\n justify-content: flex-end;\n margin-left: auto;\n}\n.Inner .Row .Redeem:hover {\n color: var(--emw--elevate-color-redeem-hover, #00ABA4);\n cursor: pointer;\n}\n.Inner .Row .RedeemButton:hover span {\n color: var(emfe-w-elevate-color-redeem-text-hover, #f1f1f1);\n font-weight: bold;\n}\n.Inner .Row .RedeemButton {\n width: 95px;\n height: 35px;\n display: flex;\n align-items: center;\n border-radius: var(--emw--border-radius-medium, 10px);\n background: var(--emw--elevate-color-redeem-bg, linear-gradient(0deg, #26CC37, #26CC37)), linear-gradient(117.99deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.89%), linear-gradient(283.85deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.47%), linear-gradient(268.18deg, rgba(255, 255, 255, 0.6) -17.36%, rgba(239, 239, 239, 0) 15.78%);\n box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.2509803922);\n}\n.Inner .Row .RedeemButton span {\n color: var(--emw--color-white, #fff);\n line-height: 18px;\n font-size: 15px;\n text-align: center;\n width: 100%;\n}\n.Inner .Row .Points {\n font-size: large;\n vertical-align: middle;\n}\n.Inner .Row .Points .XP {\n font-size: x-small;\n}\n.Inner .Row .ExpirationPoints {\n font-size: small;\n text-align: right;\n font-weight: bold;\n color: var(--emw--color-red, #9e595f);\n}';const j=class{constructor(t){e(this,t),this.endpoint=void 0,this.session=void 0,this.playerAvatarUrl=void 0,this.language=void 0,this.playerName=void 0,this.dateFormat="yyyy-MM-dd",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.userLevelId=void 0}setPlayerElevateLevelInfo(e){"playerElevateLeveLoaded"===e.type&&e.detail.elevateLevel&&(this.userLevelId=e.detail.elevateLevel.id)}render(){return t(i,{key:"6fe9245d801450135e6bcbde98e695274c96843d"},t("div",{key:"4f54bdcab376982cabe42bbbc5789e1d00381617",class:"PlayerElevateCard"},t("player-elevate-loyaltycard",{key:"fcae0187fc7df6760124288049e785c7bcbd4c7a",playerName:this.playerName,dateFormat:this.dateFormat,clientStylingUrl:this.clientStylingUrl,translationUrl:this.translationUrl,mbSource:this.mbSource,clientStyling:`${this.clientStyling} .Outer{height: 185px}`,endpoint:this.endpoint,language:this.language,session:this.session})),t("div",{key:"4056a7ee6d4069466f92bd089979cef530af2f41",class:"ElevateLevelsInfo"},t("bonus-elevate-levels",{key:"b7ec448dd2c24afb967afcef9f7f975e5d86576c",selectedLevelId:this.userLevelId,clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,translationUrl:this.translationUrl,mbSource:this.mbSource,language:this.language,endpoint:this.endpoint})),t("general-styling-wrapper",{key:"b8371fd6be5555f9dc0cc5314ab64798f5e7f364",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,mbSource:this.mbSource}))}};j.style=":host{display:block}.PlayerElevateCard{height:160px;width:100%;overflow:hidden}.ElevateLevelsInfo{background-color:var(--emw--color-background, #e6e8ea)}";const N=class{constructor(t){e(this,t),this.endpoint=void 0,this.theme="Dark",this.session=void 0,this.playerAvatarUrl=void 0,this.language="en",this.playerName=void 0,this.dateFormat="yyyy-MM-dd",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.pointExpireString=void 0,this.playerElevateLevel=void 0,this.elevateWalletTotal=void 0}onSessionOrEndpointChange(){this.paramProxy=Object.assign(Object.assign({},this.paramProxy),{session:this.session,endpoint:this.endpoint,language:this.language})}playerElevateLeveLoadedHandler(e){e.detail&&(e.detail.elevateLevelWalletTotal&&(this.elevateWalletTotal=e.detail.elevateLevelWalletTotal),e.detail.elevateLevel&&(this.playerElevateLevel=e.detail.elevateLevel),e.detail.xpExpireString&&(this.pointExpireString=e.detail.xpExpireString))}onRedeemClick(){window.postMessage({type:"BEERedeemClicked"},window.location.href)}componentWillLoad(){this.paramProxy={endpoint:this.endpoint,session:this.session,language:this.language}}getNextLevelPoints(){var e,t;return(null===(e=this.playerElevateLevel)||void 0===e?void 0:e.nextLevel)?null===(t=this.playerElevateLevel)||void 0===t?void 0:t.nextLevel.entryPoints:-1}getNextLevelTips(){var e;let t=null===(e=this.playerElevateLevel)||void 0===e?void 0:e.nextLevel;if(this.playerElevateLevel&&t){const e=(t.entryPoints-this.playerElevateLevel.loyaltyPoints).toFixed(2);return o("tipsForNextLevel",{pointsToReach:e,levelName:t.name,lang:this.language})}return""}render(){const e=a("../static/card-ground.svg"),n=a("../static/card-ground-over.svg");return t("div",{key:"9f673b8dccc848d11f0836c15f1f5da5e242e3b3",class:`ElevateCardWrapper ${this.theme}`},t("div",{key:"419c71a612c3cdfebaece1e90345c6324c68348e",class:"LoyaltyCard Outer",style:{backgroundImage:`url(${e}`}},t("general-styling-wrapper",{key:"04c1098bf16e683f30d211dfb9ebc0b319076258",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,targetTranslations:r,translationUrl:this.translationUrl,mbSource:this.mbSource}),t("player-elevate-card-data",{key:"a9c57ef6c5c3381c7e9bf2f041a190f3de3a0423",params:this.paramProxy}),t("div",{key:"402ceddce75abb2ee6b59db730418efc006e5c60",class:"OuterCover Inner",style:{backgroundImage:`url(${n}`}},t("div",{key:"844cba8ae40b9dd55129f7b0d52a208ea72e72cf",class:"Content Row"},this.playerElevateLevel&&t(s,{key:"d365971e66cbdc81d4b1758c045a76ad50a68729"},t("div",{key:"2e017a95d80098565d17807c6f8dae51a6b89090",class:"PlayerImg"},t(v,{key:"5aaf4b8e2b8ea67fa0fed1a07dde9caf2551a3bd",onlyBadge:!0,loyaltyIconUrl:this.playerElevateLevel.presentation.asset})),t("div",{key:"6e332314f4c4a233dd353130266a4d0368b0de45",class:`LevelInfo ${this.playerElevateLevel.name}`},t("div",{key:"06311b5920ac4126536760049bf3664d92cc247f",class:"CardCell ElevateLevel"},t("span",{key:"4538afdef55cd520e2d213e6a97d209234deabe5",class:"LevelName",title:this.playerElevateLevel.name},this.playerElevateLevel.name)),t("div",{key:"cb2764c587a2fe1719b2ff6e045866ee032d5a66",class:"PointsRange"},t(f,{key:"aa4336101e41f6d1dd281858711a56275526a33a",loyaltyPoints:this.playerElevateLevel.loyaltyPoints,language:this.language}),t(f,{key:"c377b14c0aec0c17e9fa818d105780f6c3089723",loyaltyPoints:this.getNextLevelPoints(),language:this.language})),t(p,{key:"1e987ae286c44ff2a9a53012ad3ad901e4207f28"}),t("div",{key:"a09ecaa84862baa4f732f8ce5c2d90e61128fa16",class:"NextLevelTip"},this.getNextLevelTips()),this.pointExpireString&&t("div",{key:"fd62be9b41dc07b200e7d26cc33f917f0b955ba0",class:"PointsInfo ExpirationPoints"},this.pointExpireString," "),this.playerElevateLevel.expireTime&&t(g,{key:"aca096829b93012ee76f9839ada2b2e96b58d3db",expireTime:this.playerElevateLevel.expireTime,dateFormat:this.dateFormat,language:this.language})))))))}static get watchers(){return{session:["onSessionOrEndpointChange"],endpoint:["onSessionOrEndpointChange"],language:["onSessionOrEndpointChange"]}}};N.style=":host{display:block}@media screen and (min-width: 501px){.LoyaltyCard .Inner .LevelInfo .ElevateLevel{flex-wrap:nowrap}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{padding-top:6px;margin-left:0px}}@media screen and (max-width: 500px){.LoyaltyCard .Inner .LevelInfo .ElevateLevel{flex-wrap:wrap}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{padding-top:0px;margin-left:0px}}.LoyaltyCard .Inner .LevelProgress{margin-left:0px}.LoyaltyCard .Inner .Row .PointsInfo.ExpirationPoints{text-align:left;color:var(--emw--color-red-50, red)}.LoyaltyCard .Inner .PlayerAvatar .Avatar{display:none}.LoyaltyCard .Inner .PlayerAvatar .Badge{border-radius:50%;background-size:contain;width:100%;height:100%}.LoyaltyCard .Inner .LevelInfo .ElevateLevel{display:flex;flex:1;align-items:center}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{position:relative;padding-left:0px}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate .ExpireTime{margin-left:5px}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .LevelName{padding-left:0;font-size:var(--emw--elevate-fontsize-2xlarge, 21px);position:relative;width:auto;color:var(--emw--elevate-color-levelname, #FFBD2B);font-weight:bold}.LoyaltyCard .PointsRange{display:flex;justify-content:space-between}.LoyaltyCard .PointsRange .PointsInfo{width:auto}.LoyaltyCard .NextLevelTip{text-align:right;font-size:11px;color:var(--emw--color-black, #000);opacity:0.8;font-weight:bold}";export{y as bonus_elevate_levels,x as elevate_level_list,L as elevate_level_presentation,T as elevate_levels_data,M as general_styling_wrapper,z as player_elevate_card_data,j as player_elevate_level,N as player_elevate_loyaltycard}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-elevate-level",
3
- "version": "1.87.25",
3
+ "version": "1.87.27",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",