@everymatrix/bonus-elevate-levels-jojogroup 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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as t,H as i,c as s,g as n}from"./index-88ecbb5b.js";import{t as
|
|
1
|
+
import{r as e,h as t,H as i,c as s,g as n}from"./index-88ecbb5b.js";import{t as o,T as l}from"./locale.utils-3a9c8e78.js";const a=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.errorMessage=void 0}elevateLevelsDataChangeHandler(e){e.detail&&(e.detail.elevateLevels&&(this.elevateLevels=[...e.detail.elevateLevels]),e.detail.clearError&&(this.errorMessage=null),e.detail.errorMessage&&e.detail.errorMessage.errorWhenLoadElevateLevels&&(this.errorMessage=o("loadElevateLevelErrorMessage",this.language)))}onSessionOrEndpointChange(){this.elevateLevelParamProxy=Object.assign(Object.assign({},this.elevateLevelParamProxy),{endpoint:this.endpoint,language: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:"3cdca540038915c73a99cca214d1d8091a928cb8",class:"ElevateLevelContent"},t("elevate-levels-data",{key:"1e1a73074ceb36ce5554b7796ca07c2efb4f73ce",scopeParams:this.elevateLevelParamProxy}),t("div",{key:"a1c66508053cac8549d23fabb291ff273079786c",class:"LevelContent"},(null===(e=this.elevateLevels)||void 0===e?void 0:e.length)?this.elevateLevels.map((e=>t("elevate-level-presentation",{elevateLevel:e}))):t("div",null,o("noLevelsSet",this.language))),this.errorMessage&&t("div",{key:"ed47949b39a95528d1a7f5acb9fe5ea1b596d6aa",class:"ErrorMessage"},this.errorMessage),t("general-styling-wrapper",{key:"c033776c424e2bc697f23a5a7abe34746fd6af7f",clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,targetTranslations:l,translationUrl:this.translationUrl,mbSource:this.mbSource}))}static get watchers(){return{endpoint:["onSessionOrEndpointChange"],language:["onSessionOrEndpointChange"]}}};a.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}";const r=class{constructor(t){e(this,t),this.elevateLevel=void 0}render(){return t(i,{key:"c02f0c4ca19226058b810f279273affa7b3398cc"},t("div",{key:"da5e3ce17167447ee462b1318f7d407f48781062",class:"Row Desc"},t("h3",{key:"6f811514d8f72b7484795e8a181c8e18446a52fe"},this.elevateLevel.presentation.displayName),t("p",{key:"fd0f78d172f027c79d542d630467e0f24099328f"},t("span",{key:"5eec8c85f146739d7e01b7112e1b1cf886c83310",class:"TxtDesc",innerHTML:this.elevateLevel.presentation.description}))))}};r.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 c,h,d,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},v={exports:{}};c=v,h=v.exports,d=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==f)return f;throw new Error("unable to locate global object")}(),c.exports=h=d.fetch,d.fetch&&(h.default=d.fetch.bind(d)),h.Headers=d.Headers,h.Request=d.Request,h.Response=d.Response;const g=v.exports,p=class{constructor(t){e(this,t),this.elevateLevelsDataChange=s(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 g(e.href).then((e=>e.json())).then((e=>{const t=e.data.sort(((e,t)=>e.firstEntryPoints<t.firstEntryPoints?-1:1));let i=this.scopeParams.selectedLevelId;if(!i&&this.scopeParams.showDefault&&t.length>0&&(i=t[0].id),i){const e=t.filter((e=>e.id==i))[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)}))}};p.style=":host{display:block}";const u="__WIDGET_GLOBAL_STYLE_CACHE__";function b(e,t){if(e){const i=document.createElement("style");i.innerHTML=t,e.appendChild(i)}}function w(e,t){if(!e||!t)return;const i=new URL(t);fetch(i.href).then((e=>e.text())).then((t=>{const i=document.createElement("style");i.innerHTML=t,e&&e.appendChild(i)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}const y=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,i,s=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!s)return function(e,t){const i=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{e&&(i.innerHTML=t,e.appendChild(i))}))}(e,t);window[u]||(window[u]={});const n=(i=function(e,t){return window.emMessageBus.subscribe(t,(i=>{if(!e)return;const s=e.getRootNode(),n=window[u];let o=n[t]?.sheet;o?n[t].refCount=n[t].refCount+1:(o=new CSSStyleSheet,o.replaceSync(i),n[t]={sheet:o,refCount:1});const l=s.adoptedStyleSheets||[];l.includes(o)||(s.adoptedStyleSheets=[...l,o])}))}(e,t)).unsubscribe.bind(i);i.unsubscribe=()=>{if(window[u][t]){const e=window[u][t];e.refCount>1?e.refCount=e.refCount-1:delete window[u][t]}n()}}(this.el,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&b(this.el,this.clientStyling),this.clientStylingUrl&&w(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(e,t){e!=t&&b(this.el,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&this.clientStylingUrl&&w(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&b(this.el,this.clientStyling),this.clientStylingUrl&&w(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const e=[];if(this.translationUrl){const s=(t=this.translationUrl,i=this.targetTranslations,new Promise((e=>{fetch(t).then((e=>e.json())).then((t=>{Object.keys(t).forEach((e=>{i[e]=i[e]||{},Object.keys(t[e]).forEach((s=>{if(!i.en[s])return;const n=i.en[s];"object"==typeof t[e][s]?(i[e][s]=i[e][s]||Object.assign({},n),Object.keys(t[e][s]).forEach((n=>{i[e][s][n]=t[e][s][n]}))):i[e][s]=t[e][s]||Object.assign({},n)}))})),e(!0)})).catch((t=>{console.error("Failed to load translations:",t),e(!1)}))})));e.push(s)}var t,i;return await Promise.all(e)}render(){return t("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},t("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return n(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};y.style=":host{display:block}";export{a as bonus_elevate_levels_jojogroup,r as elevate_level_presentation,p as elevate_levels_data,y as general_styling_wrapper}
|
|
@@ -188,6 +188,8 @@ const mergeTranslations = (url, target) => {
|
|
|
188
188
|
});
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
192
|
+
|
|
191
193
|
/**
|
|
192
194
|
* @name setClientStyling
|
|
193
195
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -233,18 +235,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
233
235
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
234
236
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
235
237
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
238
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
236
239
|
*/
|
|
237
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
238
|
-
if (window.emMessageBus)
|
|
239
|
-
const sheet = document.createElement('style');
|
|
240
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
241
|
+
if (!window.emMessageBus) return;
|
|
240
242
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
243
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
244
|
+
|
|
245
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
246
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
247
|
+
|
|
248
|
+
return subscription;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!window[StyleCacheKey]) {
|
|
252
|
+
window[StyleCacheKey] = {};
|
|
247
253
|
}
|
|
254
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
255
|
+
|
|
256
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
257
|
+
const wrappedUnsubscribe = () => {
|
|
258
|
+
if (window[StyleCacheKey][domain]) {
|
|
259
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
260
|
+
cachedObject.refCount > 1
|
|
261
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
262
|
+
: delete window[StyleCacheKey][domain];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
originalUnsubscribe();
|
|
266
|
+
};
|
|
267
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
268
|
+
|
|
269
|
+
return subscription;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
273
|
+
const sheet = document.createElement('style');
|
|
274
|
+
|
|
275
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
276
|
+
if (stylingContainer) {
|
|
277
|
+
sheet.innerHTML = data;
|
|
278
|
+
stylingContainer.appendChild(sheet);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
284
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
285
|
+
if (!stylingContainer) return;
|
|
286
|
+
|
|
287
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
288
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
289
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
290
|
+
|
|
291
|
+
if (!cachedStyle) {
|
|
292
|
+
cachedStyle = new CSSStyleSheet();
|
|
293
|
+
cachedStyle.replaceSync(data);
|
|
294
|
+
cacheStyleObject[domain] = {
|
|
295
|
+
sheet: cachedStyle,
|
|
296
|
+
refCount: 1
|
|
297
|
+
};
|
|
298
|
+
} else {
|
|
299
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
303
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
304
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
305
|
+
}
|
|
306
|
+
});
|
|
248
307
|
}
|
|
249
308
|
|
|
250
309
|
const generalStylingWrapperCss = ":host{display:block}";
|
|
@@ -263,7 +322,7 @@ const GeneralStylingWrapper = class {
|
|
|
263
322
|
componentDidLoad() {
|
|
264
323
|
if (this.el) {
|
|
265
324
|
if (window.emMessageBus != undefined) {
|
|
266
|
-
setStreamStyling(this.el, `${this.mbSource}.Style
|
|
325
|
+
setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
267
326
|
}
|
|
268
327
|
else {
|
|
269
328
|
if (this.clientStyling)
|
|
@@ -184,6 +184,8 @@ const mergeTranslations = (url, target) => {
|
|
|
184
184
|
});
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
188
|
+
|
|
187
189
|
/**
|
|
188
190
|
* @name setClientStyling
|
|
189
191
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -229,18 +231,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
229
231
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
230
232
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
231
233
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
234
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
232
235
|
*/
|
|
233
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
234
|
-
if (window.emMessageBus)
|
|
235
|
-
const sheet = document.createElement('style');
|
|
236
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
237
|
+
if (!window.emMessageBus) return;
|
|
236
238
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
240
|
+
|
|
241
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
242
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
243
|
+
|
|
244
|
+
return subscription;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!window[StyleCacheKey]) {
|
|
248
|
+
window[StyleCacheKey] = {};
|
|
243
249
|
}
|
|
250
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
251
|
+
|
|
252
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
253
|
+
const wrappedUnsubscribe = () => {
|
|
254
|
+
if (window[StyleCacheKey][domain]) {
|
|
255
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
256
|
+
cachedObject.refCount > 1
|
|
257
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
258
|
+
: delete window[StyleCacheKey][domain];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
originalUnsubscribe();
|
|
262
|
+
};
|
|
263
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
264
|
+
|
|
265
|
+
return subscription;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
269
|
+
const sheet = document.createElement('style');
|
|
270
|
+
|
|
271
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
272
|
+
if (stylingContainer) {
|
|
273
|
+
sheet.innerHTML = data;
|
|
274
|
+
stylingContainer.appendChild(sheet);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
280
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
281
|
+
if (!stylingContainer) return;
|
|
282
|
+
|
|
283
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
284
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
285
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
286
|
+
|
|
287
|
+
if (!cachedStyle) {
|
|
288
|
+
cachedStyle = new CSSStyleSheet();
|
|
289
|
+
cachedStyle.replaceSync(data);
|
|
290
|
+
cacheStyleObject[domain] = {
|
|
291
|
+
sheet: cachedStyle,
|
|
292
|
+
refCount: 1
|
|
293
|
+
};
|
|
294
|
+
} else {
|
|
295
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
299
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
300
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
301
|
+
}
|
|
302
|
+
});
|
|
244
303
|
}
|
|
245
304
|
|
|
246
305
|
const generalStylingWrapperCss = ":host{display:block}";
|
|
@@ -259,7 +318,7 @@ const GeneralStylingWrapper = class {
|
|
|
259
318
|
componentDidLoad() {
|
|
260
319
|
if (this.el) {
|
|
261
320
|
if (window.emMessageBus != undefined) {
|
|
262
|
-
setStreamStyling(this.el, `${this.mbSource}.Style
|
|
321
|
+
setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
263
322
|
}
|
|
264
323
|
else {
|
|
265
324
|
if (this.clientStyling)
|