@everymatrix/gamification-dropdown 1.87.26 → 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.
@@ -45,6 +45,8 @@ const translate = (key, customLang) => {
45
45
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
46
46
  };
47
47
 
48
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
49
+
48
50
  /**
49
51
  * @name setClientStyling
50
52
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -90,18 +92,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
90
92
  * @param {HTMLElement} stylingContainer The highest element of the widget
91
93
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
92
94
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
95
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
93
96
  */
94
- function setStreamStyling(stylingContainer, domain, subscription) {
95
- if (window.emMessageBus) {
96
- const sheet = document.createElement('style');
97
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
98
+ if (!window.emMessageBus) return;
97
99
 
98
- window.emMessageBus.subscribe(domain, (data) => {
99
- sheet.innerHTML = data;
100
- if (stylingContainer) {
101
- stylingContainer.appendChild(sheet);
102
- }
103
- });
100
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
101
+
102
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
103
+ subscription = getStyleTagSubscription(stylingContainer, domain);
104
+
105
+ return subscription;
106
+ }
107
+
108
+ if (!window[StyleCacheKey]) {
109
+ window[StyleCacheKey] = {};
104
110
  }
111
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
112
+
113
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
114
+ const wrappedUnsubscribe = () => {
115
+ if (window[StyleCacheKey][domain]) {
116
+ const cachedObject = window[StyleCacheKey][domain];
117
+ cachedObject.refCount > 1
118
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
119
+ : delete window[StyleCacheKey][domain];
120
+ }
121
+
122
+ originalUnsubscribe();
123
+ };
124
+ subscription.unsubscribe = wrappedUnsubscribe;
125
+
126
+ return subscription;
127
+ }
128
+
129
+ function getStyleTagSubscription(stylingContainer, domain) {
130
+ const sheet = document.createElement('style');
131
+
132
+ return window.emMessageBus.subscribe(domain, (data) => {
133
+ if (stylingContainer) {
134
+ sheet.innerHTML = data;
135
+ stylingContainer.appendChild(sheet);
136
+ }
137
+ });
138
+ }
139
+
140
+ function getAdoptStyleSubscription(stylingContainer, domain) {
141
+ return window.emMessageBus.subscribe(domain, (data) => {
142
+ if (!stylingContainer) return;
143
+
144
+ const shadowRoot = stylingContainer.getRootNode();
145
+ const cacheStyleObject = window[StyleCacheKey];
146
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
147
+
148
+ if (!cachedStyle) {
149
+ cachedStyle = new CSSStyleSheet();
150
+ cachedStyle.replaceSync(data);
151
+ cacheStyleObject[domain] = {
152
+ sheet: cachedStyle,
153
+ refCount: 1
154
+ };
155
+ } else {
156
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
157
+ }
158
+
159
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
160
+ if (!currentSheets.includes(cachedStyle)) {
161
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
162
+ }
163
+ });
105
164
  }
106
165
 
107
166
  const gamificationDropdownCss = ":host{display:block}.GamificationDropdownContainer{position:relative}.GamificationDropdownContainer .GamificationDropdown{position:absolute;left:0;z-index:200;overflow:hidden;cursor:pointer}.GamificationDropdownButton{cursor:pointer;font-size:14px;height:20px;background-color:unset;color:var(--emw--color-typography, #FFFFFF);padding:0;border:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:flex;align-items:center;justify-content:center;line-height:0}.GamificationDropdownButton:hover{color:var(--emw--color-primary, #52d004)}.GamificationDropdownButton:hover svg{fill:var(--emw--color-primary, #52d004)}.GamificationDropdownButton.IsOpen{color:var(--emw--color-primary, #52d004)}.GamificationDropdownButton.IsOpen svg{fill:var(--emw--color-primary, #52d004)}.GamificationDropdownButton .TriangleActive,.GamificationDropdownButton .TriangleInactive{display:block;transition:all 0.2s}.GamificationDropdownButton .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px);fill:var(--emw--color-primary, #52d004);margin-top:4px}.GamificationDropdownButton svg{fill:var(--emw--color-typography, #FFFFFF);margin-left:8px;width:16px}";
@@ -176,7 +235,7 @@ const GamificationDropdown = class {
176
235
  window.addEventListener('message', this.messageHandler);
177
236
  if (this.stylingContainer) {
178
237
  if (window.emMessageBus != undefined) {
179
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
238
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
180
239
  }
181
240
  else {
182
241
  if (this.clientStyling)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const gamificationDropdown = require('./gamification-dropdown-bd2a8974.js');
5
+ const gamificationDropdown = require('./gamification-dropdown-cc9af6c0.js');
6
6
  const index = require('./index-43105bc3.js');
7
7
  const locale_utils = require('./locale.utils-457021be.js');
8
8
  const playerElevateCardItems = require('./player-elevate-card-items-1c252d88.js');
@@ -57,7 +57,7 @@ const GeneralStylingWrapper = class {
57
57
  componentDidLoad() {
58
58
  if (this.el) {
59
59
  if (window.emMessageBus != undefined) {
60
- gamificationDropdown.setStreamStyling(this.el, `${this.mbSource}.Style`);
60
+ gamificationDropdown.setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
61
61
  }
62
62
  else {
63
63
  if (this.clientStyling)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const gamificationDropdown = require('./gamification-dropdown-bd2a8974.js');
5
+ const gamificationDropdown = require('./gamification-dropdown-cc9af6c0.js');
6
6
  require('./index-43105bc3.js');
7
7
 
8
8
 
@@ -43,6 +43,8 @@ const translate = (key, customLang) => {
43
43
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
44
44
  };
45
45
 
46
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
47
+
46
48
  /**
47
49
  * @name setClientStyling
48
50
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -88,18 +90,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
88
90
  * @param {HTMLElement} stylingContainer The highest element of the widget
89
91
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
90
92
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
93
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
91
94
  */
92
- function setStreamStyling(stylingContainer, domain, subscription) {
93
- if (window.emMessageBus) {
94
- const sheet = document.createElement('style');
95
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
96
+ if (!window.emMessageBus) return;
95
97
 
96
- window.emMessageBus.subscribe(domain, (data) => {
97
- sheet.innerHTML = data;
98
- if (stylingContainer) {
99
- stylingContainer.appendChild(sheet);
100
- }
101
- });
98
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
99
+
100
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
101
+ subscription = getStyleTagSubscription(stylingContainer, domain);
102
+
103
+ return subscription;
104
+ }
105
+
106
+ if (!window[StyleCacheKey]) {
107
+ window[StyleCacheKey] = {};
102
108
  }
109
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
110
+
111
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
112
+ const wrappedUnsubscribe = () => {
113
+ if (window[StyleCacheKey][domain]) {
114
+ const cachedObject = window[StyleCacheKey][domain];
115
+ cachedObject.refCount > 1
116
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
117
+ : delete window[StyleCacheKey][domain];
118
+ }
119
+
120
+ originalUnsubscribe();
121
+ };
122
+ subscription.unsubscribe = wrappedUnsubscribe;
123
+
124
+ return subscription;
125
+ }
126
+
127
+ function getStyleTagSubscription(stylingContainer, domain) {
128
+ const sheet = document.createElement('style');
129
+
130
+ return window.emMessageBus.subscribe(domain, (data) => {
131
+ if (stylingContainer) {
132
+ sheet.innerHTML = data;
133
+ stylingContainer.appendChild(sheet);
134
+ }
135
+ });
136
+ }
137
+
138
+ function getAdoptStyleSubscription(stylingContainer, domain) {
139
+ return window.emMessageBus.subscribe(domain, (data) => {
140
+ if (!stylingContainer) return;
141
+
142
+ const shadowRoot = stylingContainer.getRootNode();
143
+ const cacheStyleObject = window[StyleCacheKey];
144
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
145
+
146
+ if (!cachedStyle) {
147
+ cachedStyle = new CSSStyleSheet();
148
+ cachedStyle.replaceSync(data);
149
+ cacheStyleObject[domain] = {
150
+ sheet: cachedStyle,
151
+ refCount: 1
152
+ };
153
+ } else {
154
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
155
+ }
156
+
157
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
158
+ if (!currentSheets.includes(cachedStyle)) {
159
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
160
+ }
161
+ });
103
162
  }
104
163
 
105
164
  const gamificationDropdownCss = ":host{display:block}.GamificationDropdownContainer{position:relative}.GamificationDropdownContainer .GamificationDropdown{position:absolute;left:0;z-index:200;overflow:hidden;cursor:pointer}.GamificationDropdownButton{cursor:pointer;font-size:14px;height:20px;background-color:unset;color:var(--emw--color-typography, #FFFFFF);padding:0;border:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:flex;align-items:center;justify-content:center;line-height:0}.GamificationDropdownButton:hover{color:var(--emw--color-primary, #52d004)}.GamificationDropdownButton:hover svg{fill:var(--emw--color-primary, #52d004)}.GamificationDropdownButton.IsOpen{color:var(--emw--color-primary, #52d004)}.GamificationDropdownButton.IsOpen svg{fill:var(--emw--color-primary, #52d004)}.GamificationDropdownButton .TriangleActive,.GamificationDropdownButton .TriangleInactive{display:block;transition:all 0.2s}.GamificationDropdownButton .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px);fill:var(--emw--color-primary, #52d004);margin-top:4px}.GamificationDropdownButton svg{fill:var(--emw--color-typography, #FFFFFF);margin-left:8px;width:16px}";
@@ -174,7 +233,7 @@ const GamificationDropdown = class {
174
233
  window.addEventListener('message', this.messageHandler);
175
234
  if (this.stylingContainer) {
176
235
  if (window.emMessageBus != undefined) {
177
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
236
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
178
237
  }
179
238
  else {
180
239
  if (this.clientStyling)
@@ -1,5 +1,5 @@
1
- import { s as setStreamStyling, a as setClientStyling, b as setClientStylingURL } from './gamification-dropdown-92e6c856.js';
2
- export { G as gamification_dropdown } from './gamification-dropdown-92e6c856.js';
1
+ import { s as setStreamStyling, a as setClientStyling, b as setClientStylingURL } from './gamification-dropdown-f2984ee4.js';
2
+ export { G as gamification_dropdown } from './gamification-dropdown-f2984ee4.js';
3
3
  import { r as registerInstance, h, g as getElement, c as createEvent, a as getAssetPath, F as Fragment } from './index-71b1bdfa.js';
4
4
  import { t as translateWithParams, T as TRANSLATIONS } from './locale.utils-471ae737.js';
5
5
  import { r as requiredArgs, t as toDate, g as getTimezoneOffsetInMilliseconds, P as PlayerAvatar, a as PlayerPoints, b as PlayerLoyaltyProcess, L as LoyaltyLevelExpireDay } from './player-elevate-card-items-b4571def.js';
@@ -54,7 +54,7 @@ const GeneralStylingWrapper = class {
54
54
  componentDidLoad() {
55
55
  if (this.el) {
56
56
  if (window.emMessageBus != undefined) {
57
- setStreamStyling(this.el, `${this.mbSource}.Style`);
57
+ setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
58
58
  }
59
59
  else {
60
60
  if (this.clientStyling)
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { G as GamificationDropdown } from './gamification-dropdown-92e6c856.js';
1
+ export { G as GamificationDropdown } from './gamification-dropdown-f2984ee4.js';
2
2
  import './index-71b1bdfa.js';
@@ -0,0 +1 @@
1
+ import{r as i,h as t,g as n}from"./index-71b1bdfa.js";let o={en:{gamificationNoPoints:"No points"},de:{gamificationNoPoints:"No points"},ro:{gamificationNoPoints:"No points"},fr:{gamificationNoPoints:"No points"},ar:{gamificationNoPoints:"No points"},hr:{gamificationNoPoints:"No points"}};const e=i=>new Promise((t=>{fetch(i).then((i=>i.json())).then((i=>{Object.keys(i).forEach((t=>{o[t]||(o[t]={});for(let n in i[t])o[t][n]=i[t][n]})),t(!0)}))})),s="__WIDGET_GLOBAL_STYLE_CACHE__";function a(i,t){if(i){const n=document.createElement("style");n.innerHTML=t,i.appendChild(n)}}function r(i,t){if(!i||!t)return;const n=new URL(t);fetch(n.href).then((i=>i.text())).then((t=>{const n=document.createElement("style");n.innerHTML=t,i&&i.appendChild(n)})).catch((i=>{console.error("There was an error while trying to load client styling from URL",i)}))}function l(i,t,n,o=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!o)return n=function(i,t){const n=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{i&&(n.innerHTML=t,i.appendChild(n))}))}(i,t),n;window[s]||(window[s]={}),n=function(i,t){return window.emMessageBus.subscribe(t,(n=>{if(!i)return;const o=i.getRootNode(),e=window[s];let a=e[t]?.sheet;a?e[t].refCount=e[t].refCount+1:(a=new CSSStyleSheet,a.replaceSync(n),e[t]={sheet:a,refCount:1});const r=o.adoptedStyleSheets||[];r.includes(a)||(o.adoptedStyleSheets=[...r,a])}))}(i,t);const e=n.unsubscribe.bind(n);return n.unsubscribe=()=>{if(window[s][t]){const i=window[s][t];i.refCount>1?i.refCount=i.refCount-1:delete window[s][t]}e()},n}const h=class{constructor(t){i(this,t),this.messageHandler=i=>{i.data&&"UpdateGamificationXp"===i.data.type&&(this.loyaltyPoints=i.data.points)},this.navigateToGamification=()=>{window.postMessage({type:"NavigateToGamification"},window.location.href),this.isOpen=!1},this.handleOutsideClick=i=>{i.composedPath().includes(this.el)||(this.isOpen=!1,document.removeEventListener("click",this.handleOutsideClick))},this.handleDropdownClick=i=>{i.stopPropagation(),this.isOpen=!this.isOpen,this.isOpen?document.addEventListener("click",this.handleOutsideClick):document.removeEventListener("click",this.handleOutsideClick)},this.endpoint=void 0,this.language="en",this.session="",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.isOpen=!1,this.isLoading=!1,this.loyaltyPoints=void 0}handleNewTranslations(){this.isLoading=!0,e(this.translationUrl).then((()=>{this.isLoading=!1}))}handleClientStylingChange(i,t){i!=t&&a(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(i,t){i!=t&&this.clientStylingUrl&&r(this.stylingContainer,this.clientStylingUrl)}async componentWillLoad(){if(this.translationUrl.length>2&&await e(this.translationUrl),this.endpoint&&this.language)return this.fetchPointsData()}componentDidLoad(){window.addEventListener("message",this.messageHandler),this.stylingContainer&&(null!=window.emMessageBus?l(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&a(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&r(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe(),window.removeEventListener("message",this.messageHandler)}fetchPointsData(){let i=new URL(`${this.endpoint}/v1/elevate/playerInfo`);i.searchParams.append("language",this.language);const t=new Headers;t.append("X-SessionId",this.session);const n={method:"GET",headers:t};return new Promise(((t,o)=>{this.isLoading=!0,fetch(i.href,n).then((i=>i.json())).then((i=>{var n,o;this.loyaltyPoints=null===(o=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.level)||void 0===o?void 0:o.loyaltyPoints,t(!0)})).catch((i=>{console.error(i),o(i)})).finally((()=>{this.isLoading=!1}))}))}render(){return this.isLoading?null:t("div",{ref:i=>this.stylingContainer=i,class:"GamificationDropdownContainer"},t("button",{class:"GamificationDropdownButton "+(this.isOpen?"IsOpen":""),type:"button",onClick:i=>this.handleDropdownClick(i),title:"number"==typeof this.loyaltyPoints?String(this.loyaltyPoints):(i=this.language,o[void 0!==i&&i in o?i:"en"].gamificationNoPoints)},"number"==typeof this.loyaltyPoints?`${this.loyaltyPoints} XP`:"...",t("span",{class:this.isOpen?"TriangleActive":"TriangleInactive"},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"6.835",viewBox:"0 0 14 6.835"},t("path",{id:"arrow",d:"M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z",transform:"translate(-274.511 -441.088)"})))),this.isOpen&&t("div",{class:"GamificationDropdown",onClick:this.navigateToGamification},t("player-elevate-loyaltycard",{endpoint:this.endpoint,session:this.session,language:this.language,"client-styling-url":this.clientStylingUrl,"client-styling":this.clientStyling,"mb-source":this.mbSource})));var i}get el(){return n(this)}static get watchers(){return{translationUrl:["handleNewTranslations"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};h.style=":host{display:block}.GamificationDropdownContainer{position:relative}.GamificationDropdownContainer .GamificationDropdown{position:absolute;left:0;z-index:200;overflow:hidden;cursor:pointer}.GamificationDropdownButton{cursor:pointer;font-size:14px;height:20px;background-color:unset;color:var(--emw--color-typography, #FFFFFF);padding:0;border:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:flex;align-items:center;justify-content:center;line-height:0}.GamificationDropdownButton:hover{color:var(--emw--color-primary, #52d004)}.GamificationDropdownButton:hover svg{fill:var(--emw--color-primary, #52d004)}.GamificationDropdownButton.IsOpen{color:var(--emw--color-primary, #52d004)}.GamificationDropdownButton.IsOpen svg{fill:var(--emw--color-primary, #52d004)}.GamificationDropdownButton .TriangleActive,.GamificationDropdownButton .TriangleInactive{display:block;transition:all 0.2s}.GamificationDropdownButton .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px);fill:var(--emw--color-primary, #52d004);margin-top:4px}.GamificationDropdownButton svg{fill:var(--emw--color-typography, #FFFFFF);margin-left:8px;width:16px}";export{h as G,a,r as b,l as s}
@@ -1 +1 @@
1
- import{s as e,a as n,b as t}from"./gamification-dropdown-92e6c856.js";export{G as gamification_dropdown}from"./gamification-dropdown-92e6c856.js";import{r as a,h as i,g as r,c as o,a as l,F as s}from"./index-71b1bdfa.js";import{t as d,T as h}from"./locale.utils-471ae737.js";import{r as c,t as v,g,P as p,a as f,b as x,L as b}from"./player-elevate-card-items-b4571def.js";const u=class{constructor(e){a(this,e),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(null!=window.emMessageBus?e(this.el,`${this.mbSource}.Style`):(this.clientStyling&&n(this.el,this.clientStyling),this.clientStylingUrl&&t(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(e,t){e!=t&&n(this.el,this.clientStyling)}handleClientStylingUrlChange(e,n){e!=n&&this.clientStylingUrl&&t(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&n(this.el,this.clientStyling),this.clientStylingUrl&&t(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const e=[];if(this.translationUrl){const a=(n=this.translationUrl,t=this.targetTranslations,new Promise((e=>{fetch(n).then((e=>e.json())).then((n=>{Object.keys(n).forEach((e=>{t[e]=t[e]||{},Object.keys(n[e]).forEach((a=>{if(!t.en[a])return;const i=t.en[a];"object"==typeof n[e][a]?(t[e][a]=t[e][a]||Object.assign({},i),Object.keys(n[e][a]).forEach((i=>{t[e][a][i]=n[e][a][i]}))):t[e][a]=n[e][a]||Object.assign({},i)}))})),e(!0)})).catch((n=>{console.error("Failed to load translations:",n),e(!1)}))})));e.push(a)}var n,t;return await Promise.all(e)}render(){return i("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},i("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return r(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};function w(e){c(1,arguments);var n=v(e);return n.setHours(0,0,0,0),n}function y(e,n){return c(2,arguments),v(e).getTime()-v(n).getTime()}u.style=":host{display:block}";var m={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function L(e){return e?m[e]:m.trunc}const I=class{constructor(e){a(this,e),this.playerElevateLeveLoaded=o(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(((n,t)=>fetch(e.href,{method:"GET"}).then((e=>e.json())).then((e=>{this.levels=e.data,n(!0)})).catch((e=>{t(e)}))))}calcuatePointsToBeExpired(e,n){let t="";if(!e||!e.aboutToExpire||0==e.aboutToExpire.length||e.aboutToExpire[0].points<=0)return t;e.aboutToExpire.sort(((e,n)=>function(e,n){c(2,arguments);var t=v(e),a=v(n);return t.getTime()<a.getTime()}(new Date(e.expireTime),new Date(n.expireTime))?-1:1));const a=e.aboutToExpire[0],i=function(e,n){c(2,arguments);var t=w(e),a=w(n),i=t.getTime()-g(t),r=a.getTime()-g(a);return Math.round((i-r)/864e5)}(new Date(a.expireTime),new Date);let r=0,o=0,l=0===i?`${n}Day`:n;return i<=0&&(r=function(e,n,t){c(2,arguments);var a=y(e,n)/36e5;return L(null==t?void 0:t.roundingMethod)(a)}(new Date(a.expireTime),new Date,{roundingMethod:"floor"}),l=r>1?`${n}Hours`:`${n}Hour`,r<=0&&(o=function(e,n,t){c(2,arguments);var a=y(e,n)/6e4;return L(null==t?void 0:t.roundingMethod)(a)}(new Date(a.expireTime),new Date,{roundingMethod:"floor"}),l=o>1?`${n}Minutes`:`${n}Minute`)),t=d(l,{expirationPoints:a.points,expireDay:Math.max(i,r,o),lang:this.params.language}),t}loadPlayerLevelInfo(){let e=new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);return new Promise(((n,t)=>fetch(e.href,{method:"GET",headers:{"X-Sessionid":this.params.session,"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>{var a,i,r,o,l;if(!e.success)return console.error("Exception when fetch user elevateinfo, ",e.errorCode,e.errorMessage),void t(!0);window.postMessage({type:"UpdateGamificationXp",points:null===(i=null===(a=e.data)||void 0===a?void 0:a.level)||void 0===i?void 0:i.loyaltyPoints},window.location.href);let s=e.data;this.playerElevateLevel=s.level,this.playerElevateLevel.name=this.playerElevateLevel.presentation.displayName||this.playerElevateLevel.name,this.playerElevateLevel.spendablePoints=(null===(r=s.spendableWallet)||void 0===r?void 0:r.total.points)||0,this.playerElevateLeveLoaded.emit({elevateLevel:this.playerElevateLevel});const d=null===(o=e.data.spendableWallet)||void 0===o?void 0:o.total,h=null===(l=e.data.loyaltyWallet)||void 0===l?void 0:l.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}),n(this.playerElevateLevel)})).catch((e=>{console.log("error ",e),t(!0)}))))}setLoyaltyProgress(e){!function(e,n){const t=e.querySelector("#total_level"),a=t.getBBox().width,i=n>1?1:n,r=i*a-17<0?0:i*a-17,o=e.querySelector("#current_level"),l=e.querySelector("#filter_current_level"),s=e.querySelector("#circle_current_level");t.setAttribute("viewbox",`0 0 ${r} 28`),o.setAttribute("width",`${r}`),s.setAttribute("cx",`${r<6.5?6.5:r}`),l.setAttribute("x",""+(r-8));const d=e.querySelector("#lock"),h=e.querySelector("#filter_heart_ball"),c=e.querySelector("#filter_ball"),v=e.querySelector("#filter_heart"),g=e.querySelector("#filter_lock"),p=e.querySelector("#paint0_linear_ball"),f=e.querySelector("#paint1_linear_lock"),x=e.querySelector("#lock_box"),b=e.querySelector("#heart_box"),u=a-10;d.setAttribute("cx",`${u}`),f.setAttribute("x1",`${u}`),f.setAttribute("x2",`${u}`),p.setAttribute("x1",""+(u-6)),p.setAttribute("x2",""+(u-6+11.2)),g.setAttribute("x",""+(u-6)),v.setAttribute("x",""+(u-6-2)),c.setAttribute("x",""+(u-6-2-2)),h.setAttribute("x",""+(u-6-2-2-4)),x.setAttribute("x",""+(u-6)),b.setAttribute("x",""+(u-6)),t.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,n)=>e.firstEntryPoints>n.firstEntryPoints?1:-1));const n=this.playerElevateLevel.loyaltyPoints;let t=0;this.levels.forEach(((e,a)=>{n>e.firstEntryPoints&&(t=a)})),this.playerElevateLeveLoaded.emit({calculatedLevelFlag:t})}))}componentWillLoad(){this.loadElevateInfo()}get elevateCardRef(){return r(this)}static get watchers(){return{params:["onParamsChanged"]}}};I.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 C=class{constructor(e){a(this,e),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,n;return(null===(e=this.playerElevateLevel)||void 0===e?void 0:e.nextLevel)?null===(n=this.playerElevateLevel)||void 0===n?void 0:n.nextLevel.entryPoints:-1}getNextLevelTips(){var e;let n=null===(e=this.playerElevateLevel)||void 0===e?void 0:e.nextLevel;if(this.playerElevateLevel&&n){const e=(n.entryPoints-this.playerElevateLevel.loyaltyPoints).toFixed(2);return d("tipsForNextLevel",{pointsToReach:e,levelName:n.name,lang:this.language})}return""}render(){const e=l("../static/card-ground.svg"),n=l("../static/card-ground-over.svg");return i("div",{key:"9f673b8dccc848d11f0836c15f1f5da5e242e3b3",class:`ElevateCardWrapper ${this.theme}`},i("div",{key:"419c71a612c3cdfebaece1e90345c6324c68348e",class:"LoyaltyCard Outer",style:{backgroundImage:`url(${e}`}},i("general-styling-wrapper",{key:"04c1098bf16e683f30d211dfb9ebc0b319076258",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,targetTranslations:h,translationUrl:this.translationUrl,mbSource:this.mbSource}),i("player-elevate-card-data",{key:"a9c57ef6c5c3381c7e9bf2f041a190f3de3a0423",params:this.paramProxy}),i("div",{key:"402ceddce75abb2ee6b59db730418efc006e5c60",class:"OuterCover Inner",style:{backgroundImage:`url(${n}`}},i("div",{key:"844cba8ae40b9dd55129f7b0d52a208ea72e72cf",class:"Content Row"},this.playerElevateLevel&&i(s,{key:"d365971e66cbdc81d4b1758c045a76ad50a68729"},i("div",{key:"2e017a95d80098565d17807c6f8dae51a6b89090",class:"PlayerImg"},i(p,{key:"5aaf4b8e2b8ea67fa0fed1a07dde9caf2551a3bd",onlyBadge:!0,loyaltyIconUrl:this.playerElevateLevel.presentation.asset})),i("div",{key:"6e332314f4c4a233dd353130266a4d0368b0de45",class:`LevelInfo ${this.playerElevateLevel.name}`},i("div",{key:"06311b5920ac4126536760049bf3664d92cc247f",class:"CardCell ElevateLevel"},i("span",{key:"4538afdef55cd520e2d213e6a97d209234deabe5",class:"LevelName",title:this.playerElevateLevel.name},this.playerElevateLevel.name)),i("div",{key:"cb2764c587a2fe1719b2ff6e045866ee032d5a66",class:"PointsRange"},i(f,{key:"aa4336101e41f6d1dd281858711a56275526a33a",loyaltyPoints:this.playerElevateLevel.loyaltyPoints,language:this.language}),i(f,{key:"c377b14c0aec0c17e9fa818d105780f6c3089723",loyaltyPoints:this.getNextLevelPoints(),language:this.language})),i(x,{key:"1e987ae286c44ff2a9a53012ad3ad901e4207f28"}),i("div",{key:"a09ecaa84862baa4f732f8ce5c2d90e61128fa16",class:"NextLevelTip"},this.getNextLevelTips()),this.pointExpireString&&i("div",{key:"fd62be9b41dc07b200e7d26cc33f917f0b955ba0",class:"PointsInfo ExpirationPoints"},this.pointExpireString," "),this.playerElevateLevel.expireTime&&i(b,{key:"aca096829b93012ee76f9839ada2b2e96b58d3db",expireTime:this.playerElevateLevel.expireTime,dateFormat:this.dateFormat,language:this.language})))))))}static get watchers(){return{session:["onSessionOrEndpointChange"],endpoint:["onSessionOrEndpointChange"],language:["onSessionOrEndpointChange"]}}};C.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{u as general_styling_wrapper,I as player_elevate_card_data,C as player_elevate_loyaltycard}
1
+ import{s as e,a as n,b as t}from"./gamification-dropdown-f2984ee4.js";export{G as gamification_dropdown}from"./gamification-dropdown-f2984ee4.js";import{r as a,h as i,g as r,c as o,a as l,F as s}from"./index-71b1bdfa.js";import{t as d,T as h}from"./locale.utils-471ae737.js";import{r as c,t as v,g,P as p,a as f,b as x,L as b}from"./player-elevate-card-items-b4571def.js";const u=class{constructor(e){a(this,e),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(null!=window.emMessageBus?e(this.el,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&n(this.el,this.clientStyling),this.clientStylingUrl&&t(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(e,t){e!=t&&n(this.el,this.clientStyling)}handleClientStylingUrlChange(e,n){e!=n&&this.clientStylingUrl&&t(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&n(this.el,this.clientStyling),this.clientStylingUrl&&t(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const e=[];if(this.translationUrl){const a=(n=this.translationUrl,t=this.targetTranslations,new Promise((e=>{fetch(n).then((e=>e.json())).then((n=>{Object.keys(n).forEach((e=>{t[e]=t[e]||{},Object.keys(n[e]).forEach((a=>{if(!t.en[a])return;const i=t.en[a];"object"==typeof n[e][a]?(t[e][a]=t[e][a]||Object.assign({},i),Object.keys(n[e][a]).forEach((i=>{t[e][a][i]=n[e][a][i]}))):t[e][a]=n[e][a]||Object.assign({},i)}))})),e(!0)})).catch((n=>{console.error("Failed to load translations:",n),e(!1)}))})));e.push(a)}var n,t;return await Promise.all(e)}render(){return i("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},i("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return r(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};function w(e){c(1,arguments);var n=v(e);return n.setHours(0,0,0,0),n}function y(e,n){return c(2,arguments),v(e).getTime()-v(n).getTime()}u.style=":host{display:block}";var m={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function L(e){return e?m[e]:m.trunc}const I=class{constructor(e){a(this,e),this.playerElevateLeveLoaded=o(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(((n,t)=>fetch(e.href,{method:"GET"}).then((e=>e.json())).then((e=>{this.levels=e.data,n(!0)})).catch((e=>{t(e)}))))}calcuatePointsToBeExpired(e,n){let t="";if(!e||!e.aboutToExpire||0==e.aboutToExpire.length||e.aboutToExpire[0].points<=0)return t;e.aboutToExpire.sort(((e,n)=>function(e,n){c(2,arguments);var t=v(e),a=v(n);return t.getTime()<a.getTime()}(new Date(e.expireTime),new Date(n.expireTime))?-1:1));const a=e.aboutToExpire[0],i=function(e,n){c(2,arguments);var t=w(e),a=w(n),i=t.getTime()-g(t),r=a.getTime()-g(a);return Math.round((i-r)/864e5)}(new Date(a.expireTime),new Date);let r=0,o=0,l=0===i?`${n}Day`:n;return i<=0&&(r=function(e,n,t){c(2,arguments);var a=y(e,n)/36e5;return L(null==t?void 0:t.roundingMethod)(a)}(new Date(a.expireTime),new Date,{roundingMethod:"floor"}),l=r>1?`${n}Hours`:`${n}Hour`,r<=0&&(o=function(e,n,t){c(2,arguments);var a=y(e,n)/6e4;return L(null==t?void 0:t.roundingMethod)(a)}(new Date(a.expireTime),new Date,{roundingMethod:"floor"}),l=o>1?`${n}Minutes`:`${n}Minute`)),t=d(l,{expirationPoints:a.points,expireDay:Math.max(i,r,o),lang:this.params.language}),t}loadPlayerLevelInfo(){let e=new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);return new Promise(((n,t)=>fetch(e.href,{method:"GET",headers:{"X-Sessionid":this.params.session,"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>{var a,i,r,o,l;if(!e.success)return console.error("Exception when fetch user elevateinfo, ",e.errorCode,e.errorMessage),void t(!0);window.postMessage({type:"UpdateGamificationXp",points:null===(i=null===(a=e.data)||void 0===a?void 0:a.level)||void 0===i?void 0:i.loyaltyPoints},window.location.href);let s=e.data;this.playerElevateLevel=s.level,this.playerElevateLevel.name=this.playerElevateLevel.presentation.displayName||this.playerElevateLevel.name,this.playerElevateLevel.spendablePoints=(null===(r=s.spendableWallet)||void 0===r?void 0:r.total.points)||0,this.playerElevateLeveLoaded.emit({elevateLevel:this.playerElevateLevel});const d=null===(o=e.data.spendableWallet)||void 0===o?void 0:o.total,h=null===(l=e.data.loyaltyWallet)||void 0===l?void 0:l.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}),n(this.playerElevateLevel)})).catch((e=>{console.log("error ",e),t(!0)}))))}setLoyaltyProgress(e){!function(e,n){const t=e.querySelector("#total_level"),a=t.getBBox().width,i=n>1?1:n,r=i*a-17<0?0:i*a-17,o=e.querySelector("#current_level"),l=e.querySelector("#filter_current_level"),s=e.querySelector("#circle_current_level");t.setAttribute("viewbox",`0 0 ${r} 28`),o.setAttribute("width",`${r}`),s.setAttribute("cx",`${r<6.5?6.5:r}`),l.setAttribute("x",""+(r-8));const d=e.querySelector("#lock"),h=e.querySelector("#filter_heart_ball"),c=e.querySelector("#filter_ball"),v=e.querySelector("#filter_heart"),g=e.querySelector("#filter_lock"),p=e.querySelector("#paint0_linear_ball"),f=e.querySelector("#paint1_linear_lock"),x=e.querySelector("#lock_box"),b=e.querySelector("#heart_box"),u=a-10;d.setAttribute("cx",`${u}`),f.setAttribute("x1",`${u}`),f.setAttribute("x2",`${u}`),p.setAttribute("x1",""+(u-6)),p.setAttribute("x2",""+(u-6+11.2)),g.setAttribute("x",""+(u-6)),v.setAttribute("x",""+(u-6-2)),c.setAttribute("x",""+(u-6-2-2)),h.setAttribute("x",""+(u-6-2-2-4)),x.setAttribute("x",""+(u-6)),b.setAttribute("x",""+(u-6)),t.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,n)=>e.firstEntryPoints>n.firstEntryPoints?1:-1));const n=this.playerElevateLevel.loyaltyPoints;let t=0;this.levels.forEach(((e,a)=>{n>e.firstEntryPoints&&(t=a)})),this.playerElevateLeveLoaded.emit({calculatedLevelFlag:t})}))}componentWillLoad(){this.loadElevateInfo()}get elevateCardRef(){return r(this)}static get watchers(){return{params:["onParamsChanged"]}}};I.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 C=class{constructor(e){a(this,e),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,n;return(null===(e=this.playerElevateLevel)||void 0===e?void 0:e.nextLevel)?null===(n=this.playerElevateLevel)||void 0===n?void 0:n.nextLevel.entryPoints:-1}getNextLevelTips(){var e;let n=null===(e=this.playerElevateLevel)||void 0===e?void 0:e.nextLevel;if(this.playerElevateLevel&&n){const e=(n.entryPoints-this.playerElevateLevel.loyaltyPoints).toFixed(2);return d("tipsForNextLevel",{pointsToReach:e,levelName:n.name,lang:this.language})}return""}render(){const e=l("../static/card-ground.svg"),n=l("../static/card-ground-over.svg");return i("div",{key:"9f673b8dccc848d11f0836c15f1f5da5e242e3b3",class:`ElevateCardWrapper ${this.theme}`},i("div",{key:"419c71a612c3cdfebaece1e90345c6324c68348e",class:"LoyaltyCard Outer",style:{backgroundImage:`url(${e}`}},i("general-styling-wrapper",{key:"04c1098bf16e683f30d211dfb9ebc0b319076258",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,targetTranslations:h,translationUrl:this.translationUrl,mbSource:this.mbSource}),i("player-elevate-card-data",{key:"a9c57ef6c5c3381c7e9bf2f041a190f3de3a0423",params:this.paramProxy}),i("div",{key:"402ceddce75abb2ee6b59db730418efc006e5c60",class:"OuterCover Inner",style:{backgroundImage:`url(${n}`}},i("div",{key:"844cba8ae40b9dd55129f7b0d52a208ea72e72cf",class:"Content Row"},this.playerElevateLevel&&i(s,{key:"d365971e66cbdc81d4b1758c045a76ad50a68729"},i("div",{key:"2e017a95d80098565d17807c6f8dae51a6b89090",class:"PlayerImg"},i(p,{key:"5aaf4b8e2b8ea67fa0fed1a07dde9caf2551a3bd",onlyBadge:!0,loyaltyIconUrl:this.playerElevateLevel.presentation.asset})),i("div",{key:"6e332314f4c4a233dd353130266a4d0368b0de45",class:`LevelInfo ${this.playerElevateLevel.name}`},i("div",{key:"06311b5920ac4126536760049bf3664d92cc247f",class:"CardCell ElevateLevel"},i("span",{key:"4538afdef55cd520e2d213e6a97d209234deabe5",class:"LevelName",title:this.playerElevateLevel.name},this.playerElevateLevel.name)),i("div",{key:"cb2764c587a2fe1719b2ff6e045866ee032d5a66",class:"PointsRange"},i(f,{key:"aa4336101e41f6d1dd281858711a56275526a33a",loyaltyPoints:this.playerElevateLevel.loyaltyPoints,language:this.language}),i(f,{key:"c377b14c0aec0c17e9fa818d105780f6c3089723",loyaltyPoints:this.getNextLevelPoints(),language:this.language})),i(x,{key:"1e987ae286c44ff2a9a53012ad3ad901e4207f28"}),i("div",{key:"a09ecaa84862baa4f732f8ce5c2d90e61128fa16",class:"NextLevelTip"},this.getNextLevelTips()),this.pointExpireString&&i("div",{key:"fd62be9b41dc07b200e7d26cc33f917f0b955ba0",class:"PointsInfo ExpirationPoints"},this.pointExpireString," "),this.playerElevateLevel.expireTime&&i(b,{key:"aca096829b93012ee76f9839ada2b2e96b58d3db",expireTime:this.playerElevateLevel.expireTime,dateFormat:this.dateFormat,language:this.language})))))))}static get watchers(){return{session:["onSessionOrEndpointChange"],endpoint:["onSessionOrEndpointChange"],language:["onSessionOrEndpointChange"]}}};C.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{u as general_styling_wrapper,I as player_elevate_card_data,C as player_elevate_loyaltycard}
@@ -1 +1 @@
1
- export{G as GamificationDropdown}from"./gamification-dropdown-92e6c856.js";import"./index-71b1bdfa.js";
1
+ export{G as GamificationDropdown}from"./gamification-dropdown-f2984ee4.js";import"./index-71b1bdfa.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/gamification-dropdown",
3
- "version": "1.87.26",
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",
@@ -1 +0,0 @@
1
- import{r as i,h as t,g as o}from"./index-71b1bdfa.js";let n={en:{gamificationNoPoints:"No points"},de:{gamificationNoPoints:"No points"},ro:{gamificationNoPoints:"No points"},fr:{gamificationNoPoints:"No points"},ar:{gamificationNoPoints:"No points"},hr:{gamificationNoPoints:"No points"}};const s=i=>new Promise((t=>{fetch(i).then((i=>i.json())).then((i=>{Object.keys(i).forEach((t=>{n[t]||(n[t]={});for(let o in i[t])n[t][o]=i[t][o]})),t(!0)}))}));function e(i,t){if(i){const o=document.createElement("style");o.innerHTML=t,i.appendChild(o)}}function a(i,t){if(!i||!t)return;const o=new URL(t);fetch(o.href).then((i=>i.text())).then((t=>{const o=document.createElement("style");o.innerHTML=t,i&&i.appendChild(o)})).catch((i=>{console.error("There was an error while trying to load client styling from URL",i)}))}function r(i,t){if(window.emMessageBus){const o=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{o.innerHTML=t,i&&i.appendChild(o)}))}}const l=class{constructor(t){i(this,t),this.messageHandler=i=>{i.data&&"UpdateGamificationXp"===i.data.type&&(this.loyaltyPoints=i.data.points)},this.navigateToGamification=()=>{window.postMessage({type:"NavigateToGamification"},window.location.href),this.isOpen=!1},this.handleOutsideClick=i=>{i.composedPath().includes(this.el)||(this.isOpen=!1,document.removeEventListener("click",this.handleOutsideClick))},this.handleDropdownClick=i=>{i.stopPropagation(),this.isOpen=!this.isOpen,this.isOpen?document.addEventListener("click",this.handleOutsideClick):document.removeEventListener("click",this.handleOutsideClick)},this.endpoint=void 0,this.language="en",this.session="",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.isOpen=!1,this.isLoading=!1,this.loyaltyPoints=void 0}handleNewTranslations(){this.isLoading=!0,s(this.translationUrl).then((()=>{this.isLoading=!1}))}handleClientStylingChange(i,t){i!=t&&e(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(i,t){i!=t&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}async componentWillLoad(){if(this.translationUrl.length>2&&await s(this.translationUrl),this.endpoint&&this.language)return this.fetchPointsData()}componentDidLoad(){window.addEventListener("message",this.messageHandler),this.stylingContainer&&(null!=window.emMessageBus?r(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&e(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe(),window.removeEventListener("message",this.messageHandler)}fetchPointsData(){let i=new URL(`${this.endpoint}/v1/elevate/playerInfo`);i.searchParams.append("language",this.language);const t=new Headers;t.append("X-SessionId",this.session);const o={method:"GET",headers:t};return new Promise(((t,n)=>{this.isLoading=!0,fetch(i.href,o).then((i=>i.json())).then((i=>{var o,n;this.loyaltyPoints=null===(n=null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.level)||void 0===n?void 0:n.loyaltyPoints,t(!0)})).catch((i=>{console.error(i),n(i)})).finally((()=>{this.isLoading=!1}))}))}render(){return this.isLoading?null:t("div",{ref:i=>this.stylingContainer=i,class:"GamificationDropdownContainer"},t("button",{class:"GamificationDropdownButton "+(this.isOpen?"IsOpen":""),type:"button",onClick:i=>this.handleDropdownClick(i),title:"number"==typeof this.loyaltyPoints?String(this.loyaltyPoints):(i=this.language,n[void 0!==i&&i in n?i:"en"].gamificationNoPoints)},"number"==typeof this.loyaltyPoints?`${this.loyaltyPoints} XP`:"...",t("span",{class:this.isOpen?"TriangleActive":"TriangleInactive"},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"6.835",viewBox:"0 0 14 6.835"},t("path",{id:"arrow",d:"M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z",transform:"translate(-274.511 -441.088)"})))),this.isOpen&&t("div",{class:"GamificationDropdown",onClick:this.navigateToGamification},t("player-elevate-loyaltycard",{endpoint:this.endpoint,session:this.session,language:this.language,"client-styling-url":this.clientStylingUrl,"client-styling":this.clientStyling,"mb-source":this.mbSource})));var i}get el(){return o(this)}static get watchers(){return{translationUrl:["handleNewTranslations"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};l.style=":host{display:block}.GamificationDropdownContainer{position:relative}.GamificationDropdownContainer .GamificationDropdown{position:absolute;left:0;z-index:200;overflow:hidden;cursor:pointer}.GamificationDropdownButton{cursor:pointer;font-size:14px;height:20px;background-color:unset;color:var(--emw--color-typography, #FFFFFF);padding:0;border:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:flex;align-items:center;justify-content:center;line-height:0}.GamificationDropdownButton:hover{color:var(--emw--color-primary, #52d004)}.GamificationDropdownButton:hover svg{fill:var(--emw--color-primary, #52d004)}.GamificationDropdownButton.IsOpen{color:var(--emw--color-primary, #52d004)}.GamificationDropdownButton.IsOpen svg{fill:var(--emw--color-primary, #52d004)}.GamificationDropdownButton .TriangleActive,.GamificationDropdownButton .TriangleInactive{display:block;transition:all 0.2s}.GamificationDropdownButton .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px);fill:var(--emw--color-primary, #52d004);margin-top:4px}.GamificationDropdownButton svg{fill:var(--emw--color-typography, #FFFFFF);margin-left:8px;width:16px}";export{l as G,e as a,a as b,r as s}