@everymatrix/promoting-banners 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.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{promoting-banners-a0a2d6b3.js → promoting-banners-5f045228.js} +69 -10
- package/dist/cjs/promoting-banners.cjs.entry.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{promoting-banners-06f6cf10.js → promoting-banners-043c1e67.js} +69 -10
- package/dist/esm/promoting-banners.entry.js +1 -1
- package/dist/promoting-banners/index.esm.js +1 -1
- package/dist/promoting-banners/promoting-banners-043c1e67.js +1 -0
- package/dist/promoting-banners/promoting-banners.entry.js +1 -1
- package/package.json +1 -1
- package/dist/promoting-banners/promoting-banners-06f6cf10.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -79,6 +79,8 @@ const getTranslations = (url) => {
|
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
83
|
+
|
|
82
84
|
/**
|
|
83
85
|
* @name setClientStyling
|
|
84
86
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -124,18 +126,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
124
126
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
125
127
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
126
128
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
129
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
127
130
|
*/
|
|
128
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
129
|
-
if (window.emMessageBus)
|
|
130
|
-
const sheet = document.createElement('style');
|
|
131
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
132
|
+
if (!window.emMessageBus) return;
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
135
|
+
|
|
136
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
137
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
138
|
+
|
|
139
|
+
return subscription;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!window[StyleCacheKey]) {
|
|
143
|
+
window[StyleCacheKey] = {};
|
|
138
144
|
}
|
|
145
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
146
|
+
|
|
147
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
148
|
+
const wrappedUnsubscribe = () => {
|
|
149
|
+
if (window[StyleCacheKey][domain]) {
|
|
150
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
151
|
+
cachedObject.refCount > 1
|
|
152
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
153
|
+
: delete window[StyleCacheKey][domain];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
originalUnsubscribe();
|
|
157
|
+
};
|
|
158
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
159
|
+
|
|
160
|
+
return subscription;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
164
|
+
const sheet = document.createElement('style');
|
|
165
|
+
|
|
166
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
167
|
+
if (stylingContainer) {
|
|
168
|
+
sheet.innerHTML = data;
|
|
169
|
+
stylingContainer.appendChild(sheet);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
175
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
176
|
+
if (!stylingContainer) return;
|
|
177
|
+
|
|
178
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
179
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
180
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
181
|
+
|
|
182
|
+
if (!cachedStyle) {
|
|
183
|
+
cachedStyle = new CSSStyleSheet();
|
|
184
|
+
cachedStyle.replaceSync(data);
|
|
185
|
+
cacheStyleObject[domain] = {
|
|
186
|
+
sheet: cachedStyle,
|
|
187
|
+
refCount: 1
|
|
188
|
+
};
|
|
189
|
+
} else {
|
|
190
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
194
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
195
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
139
198
|
}
|
|
140
199
|
|
|
141
200
|
const promotingBannersCss = ".PromotingBannersIconContainer img{width:50px;height:50px;border-radius:var(--emw--border-radius-image, 50%);background-size:contain;margin:10px}.PromotingBannersSection{padding:10px;border-radius:var(--emw--border-radius-small, 5px);background-color:var(--emw--promo-color-background, var(--emw--color-background, #2f2f2f));background-repeat:no-repeat;background-position:center;color:var(--emw--promo-color-primary, var(--emw--color-primary, #fff));font-family:var(--emw--font-family-primary, \"Montserrat\", sans-serif);overflow:hidden;position:relative}.PromotingBannersGrid{display:grid;grid-gap:30px;background-size:contain;background-repeat:no-repeat;padding:10px;width:100%;grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));box-sizing:border-box}.PromotingBannersContent{color:var(--emw--promo-color-primary, var(--emw--color-primary, #fff))}.PromotingBannersContent p{display:block;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;word-break:break-all}.PromotingBannersHeader{display:flex;justify-content:center;flex-direction:column;align-items:center}.PromotingBannersHeader p{text-align:center}.PromotingBannersBox{min-width:200px;display:flex;justify-content:flex-start;overflow:hidden;flex-direction:row;gap:20px;text-decoration:none;color:inherit;background-size:cover;background-position:center;border-radius:var(--emw--border-radius-small, 5px)}.PromotingBannersSectionTitle,.PromotingBannersSectionSubtitle{margin:10px auto;background:transparent}.PromotingBannersTextContainer{margin:5px;overflow:hidden;position:relative;padding-bottom:30px}.PromotingBannersTitle{margin:5px auto}.PromotingBannersButton{cursor:pointer;color:inherit;text-decoration:none;position:absolute;bottom:5px;border:0;background:transparent}.ButtonDisabled{cursor:not-allowed}.PromotionalBannersTextContainer{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.AboutUsError .ErrorInfo{color:var(--emw--promo-color-error, var(--emw--color-error, #ed0909))}.SkeletonGrid{display:grid}.Skeleton{animation:skeleton-loading 0.6s linear infinite alternate}@keyframes skeleton-loading{0%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.2) 0%, rgba(0, 61, 93, 0.2) 100%)}12%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.225) 0%, rgba(0, 61, 93, 0.225) 100%)}25%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.25) 0%, rgba(0, 61, 93, 0.25) 100%)}33%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.275) 0%, rgba(0, 61, 93, 0.275) 100%)}50%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.3) 0%, rgba(0, 61, 93, 0.3) 100%)}63%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.325) 0%, rgba(0, 61, 93, 0.325) 100%)}75%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.35) 0%, rgba(0, 61, 93, 0.35) 100%)}88%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.375) 0%, rgba(0, 61, 93, 0.375) 100%)}100%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.4) 0%, rgba(0, 61, 93, 0.4) 100%)}}.SkeletonItem{opacity:0.5;margin:0 15px;width:125px;height:150px;border-radius:var(--emw--border-radius-medium, 15px);margin:20px}";
|
|
@@ -181,7 +240,7 @@ const PromotingBanners = class {
|
|
|
181
240
|
componentDidLoad() {
|
|
182
241
|
if (this.stylingContainer) {
|
|
183
242
|
if (window.emMessageBus != undefined) {
|
|
184
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
243
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
185
244
|
}
|
|
186
245
|
else {
|
|
187
246
|
if (this.clientStyling)
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as PromotingBanners } from './promoting-banners-
|
|
1
|
+
export { P as PromotingBanners } from './promoting-banners-043c1e67.js';
|
|
2
2
|
import './index-43b1379d.js';
|
|
@@ -77,6 +77,8 @@ const getTranslations = (url) => {
|
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
81
|
+
|
|
80
82
|
/**
|
|
81
83
|
* @name setClientStyling
|
|
82
84
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -122,18 +124,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
122
124
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
123
125
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
124
126
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
127
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
125
128
|
*/
|
|
126
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
127
|
-
if (window.emMessageBus)
|
|
128
|
-
const sheet = document.createElement('style');
|
|
129
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
130
|
+
if (!window.emMessageBus) return;
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
133
|
+
|
|
134
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
135
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
136
|
+
|
|
137
|
+
return subscription;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (!window[StyleCacheKey]) {
|
|
141
|
+
window[StyleCacheKey] = {};
|
|
136
142
|
}
|
|
143
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
144
|
+
|
|
145
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
146
|
+
const wrappedUnsubscribe = () => {
|
|
147
|
+
if (window[StyleCacheKey][domain]) {
|
|
148
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
149
|
+
cachedObject.refCount > 1
|
|
150
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
151
|
+
: delete window[StyleCacheKey][domain];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
originalUnsubscribe();
|
|
155
|
+
};
|
|
156
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
157
|
+
|
|
158
|
+
return subscription;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
162
|
+
const sheet = document.createElement('style');
|
|
163
|
+
|
|
164
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
165
|
+
if (stylingContainer) {
|
|
166
|
+
sheet.innerHTML = data;
|
|
167
|
+
stylingContainer.appendChild(sheet);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
173
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
174
|
+
if (!stylingContainer) return;
|
|
175
|
+
|
|
176
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
177
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
178
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
179
|
+
|
|
180
|
+
if (!cachedStyle) {
|
|
181
|
+
cachedStyle = new CSSStyleSheet();
|
|
182
|
+
cachedStyle.replaceSync(data);
|
|
183
|
+
cacheStyleObject[domain] = {
|
|
184
|
+
sheet: cachedStyle,
|
|
185
|
+
refCount: 1
|
|
186
|
+
};
|
|
187
|
+
} else {
|
|
188
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
192
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
193
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
137
196
|
}
|
|
138
197
|
|
|
139
198
|
const promotingBannersCss = ".PromotingBannersIconContainer img{width:50px;height:50px;border-radius:var(--emw--border-radius-image, 50%);background-size:contain;margin:10px}.PromotingBannersSection{padding:10px;border-radius:var(--emw--border-radius-small, 5px);background-color:var(--emw--promo-color-background, var(--emw--color-background, #2f2f2f));background-repeat:no-repeat;background-position:center;color:var(--emw--promo-color-primary, var(--emw--color-primary, #fff));font-family:var(--emw--font-family-primary, \"Montserrat\", sans-serif);overflow:hidden;position:relative}.PromotingBannersGrid{display:grid;grid-gap:30px;background-size:contain;background-repeat:no-repeat;padding:10px;width:100%;grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));box-sizing:border-box}.PromotingBannersContent{color:var(--emw--promo-color-primary, var(--emw--color-primary, #fff))}.PromotingBannersContent p{display:block;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;word-break:break-all}.PromotingBannersHeader{display:flex;justify-content:center;flex-direction:column;align-items:center}.PromotingBannersHeader p{text-align:center}.PromotingBannersBox{min-width:200px;display:flex;justify-content:flex-start;overflow:hidden;flex-direction:row;gap:20px;text-decoration:none;color:inherit;background-size:cover;background-position:center;border-radius:var(--emw--border-radius-small, 5px)}.PromotingBannersSectionTitle,.PromotingBannersSectionSubtitle{margin:10px auto;background:transparent}.PromotingBannersTextContainer{margin:5px;overflow:hidden;position:relative;padding-bottom:30px}.PromotingBannersTitle{margin:5px auto}.PromotingBannersButton{cursor:pointer;color:inherit;text-decoration:none;position:absolute;bottom:5px;border:0;background:transparent}.ButtonDisabled{cursor:not-allowed}.PromotionalBannersTextContainer{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.AboutUsError .ErrorInfo{color:var(--emw--promo-color-error, var(--emw--color-error, #ed0909))}.SkeletonGrid{display:grid}.Skeleton{animation:skeleton-loading 0.6s linear infinite alternate}@keyframes skeleton-loading{0%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.2) 0%, rgba(0, 61, 93, 0.2) 100%)}12%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.225) 0%, rgba(0, 61, 93, 0.225) 100%)}25%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.25) 0%, rgba(0, 61, 93, 0.25) 100%)}33%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.275) 0%, rgba(0, 61, 93, 0.275) 100%)}50%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.3) 0%, rgba(0, 61, 93, 0.3) 100%)}63%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.325) 0%, rgba(0, 61, 93, 0.325) 100%)}75%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.35) 0%, rgba(0, 61, 93, 0.35) 100%)}88%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.375) 0%, rgba(0, 61, 93, 0.375) 100%)}100%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.4) 0%, rgba(0, 61, 93, 0.4) 100%)}}.SkeletonItem{opacity:0.5;margin:0 15px;width:125px;height:150px;border-radius:var(--emw--border-radius-medium, 15px);margin:20px}";
|
|
@@ -179,7 +238,7 @@ const PromotingBanners = class {
|
|
|
179
238
|
componentDidLoad() {
|
|
180
239
|
if (this.stylingContainer) {
|
|
181
240
|
if (window.emMessageBus != undefined) {
|
|
182
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
241
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
183
242
|
}
|
|
184
243
|
else {
|
|
185
244
|
if (this.clientStyling)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as promoting_banners } from './promoting-banners-
|
|
1
|
+
export { P as promoting_banners } from './promoting-banners-043c1e67.js';
|
|
2
2
|
import './index-43b1379d.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{P as PromotingBanners}from"./promoting-banners-
|
|
1
|
+
export{P as PromotingBanners}from"./promoting-banners-043c1e67.js";import"./index-43b1379d.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as n}from"./index-43b1379d.js";const r=()=>{let e=window.navigator.userAgent;return e.toLowerCase().match(/android/i)?"Android":e.toLowerCase().match(/iphone/i)?"iPhone":e.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"},o={en:{error:"Error",noResults:"Loading, please wait ..."},hu:{error:"Error",noResults:"Loading, please wait ..."},ro:{error:"Eroare",noResults:"Loading, please wait ..."},fr:{error:"Error",noResults:"Loading, please wait ..."},ar:{error:"خطأ",noResults:"Loading, please wait ..."},hr:{error:"Greška",noResults:"Učitavanje, molimo pričekajte ..."}},i=e=>new Promise(((n,r)=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((n=>{for(let r in e[n])o[n][r]=e[n][r]})),n(o)})).catch((e=>{r(e)}))})),t="__WIDGET_GLOBAL_STYLE_CACHE__";function a(e,n){if(e){const r=document.createElement("style");r.innerHTML=n,e.appendChild(r)}}function s(e,n){if(!e||!n)return;const r=new URL(n);fetch(r.href).then((e=>e.text())).then((n=>{const r=document.createElement("style");r.innerHTML=n,e&&e.appendChild(r)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}const d=class{constructor(n){e(this,n),this.cmsEndpoint="",this.language="en",this.cmsEnv="",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.promotingBannersArray=[],this.hasErrors=!1,this.isLoading=!0,this.translationData=void 0}handleClientStylingChange(e,n){e!=n&&a(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(e,n){e!=n&&this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl)}handleNewTranslations(){this.isLoading=!0,i(this.translationUrl).then((()=>{this.isLoading=!1}))}connectedCallback(){this.cmsEndpoint&&this.language&&this.getPromotingBanners()}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBus?function(e,n,r,o=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!o)return function(e,n){const r=document.createElement("style");return window.emMessageBus.subscribe(n,(n=>{e&&(r.innerHTML=n,e.appendChild(r))}))}(e,n);window[t]||(window[t]={});const i=(r=function(e,n){return window.emMessageBus.subscribe(n,(r=>{if(!e)return;const o=e.getRootNode(),i=window[t];let a=i[n]?.sheet;a?i[n].refCount=i[n].refCount+1:(a=new CSSStyleSheet,a.replaceSync(r),i[n]={sheet:a,refCount:1});const s=o.adoptedStyleSheets||[];s.includes(a)||(o.adoptedStyleSheets=[...s,a])}))}(e,n)).unsubscribe.bind(r);r.unsubscribe=()=>{if(window[t][n]){const e=window[t][n];e.refCount>1?e.refCount=e.refCount-1:delete window[t][n]}i()}}(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&a(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}getPromotingBanners(){const e=new URL(`${this.cmsEndpoint}/${this.language}/homepage`),n=new URLSearchParams;n.append("language",this.language),n.append("env",this.cmsEnv),n.append("device",(()=>{const e=r();if(e)return"PC"===e?"dk":"mtWeb"})()),e.search=n.toString();let o={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"}};return new Promise(((n,r)=>{this.isLoading=!0,fetch(e.href,o).then((e=>e.json())).then((e=>{const{promotingBanners:r}=e;this.promotingBannersArray=r,n(r)})).catch((e=>{console.error("Error fetching data:",e),this.hasErrors=!0,r(e)})).finally((()=>{this.isLoading=!1}))}))}sendOpenLink(e,n,r){window.postMessage({type:"NavigateTo",path:e,target:r||null,externalLink:n||!1},window.location.href)}async componentWillLoad(){const e=[];if(this.translationUrl){const n=i(this.translationUrl).then((e=>{this.translationData=JSON.stringify(e)})).catch((e=>{console.log(e)}));e.push(n)}return Promise.all(e)}renderBannersGrid(e){var o,i,t;return n("a",{class:"PromotingBannersBox",href:null==e?void 0:e.url,target:e.targetType,style:{backgroundImage:`url(${null==e?void 0:e.backgroundImage})`}},n("div",{class:"PromotingBannersIconContainer"},n("img",{src:"Android"===r()||"iPhone"===r()?null===(o=e.icon)||void 0===o?void 0:o.mobile:"iPad"===r()?null===(i=e.image)||void 0===i?void 0:i.srcTablet:null===(t=e.icon)||void 0===t?void 0:t.desktop,alt:"Banner image"})),n("div",{class:"PromotingBannersTextContainer"},n("h3",{class:"PromotingBannersTitle"},null==e?void 0:e.title),n("div",{class:"PromotingBannersContent",innerHTML:null==e?void 0:e.description}),e.button&&n("button",{class:"PromotingBannersButton "+((null==e?void 0:e.button.text)?"":"ButtonDisabled"),innerHTML:null==e?void 0:e.button.text,onClick:this.sendOpenLink.bind(this,null==e?void 0:e.button.url,null==e?void 0:e.button.externalLink,null==e?void 0:e.button.target)})))}render(){var e,i,t,a,s;return n("div",{key:"3781ba5f4b63bbf1c9426c509e12c52a126b516a",class:"PromotingBannersSection",ref:e=>this.stylingContainer=e},this.hasErrors&&n("div",{key:"395769f146608f99dfd2b5f2547ffe0229bdf8b3",class:"AboutUsError"},n("div",{key:"01d2dccd1a1ba0f0cbfaf6ead8e98dabf1f94985",class:"ErrorInfo"},o[void 0!==(s=this.language)&&s in o?s:"en"].error)),this.isLoading&&n("div",{key:"6a832d41a9864e2d92f4025a897701bb4d6f922c",class:"SkeletonGrid"},new Array(4).fill(null).map((e=>n("div",{key:e,class:"Skeleton SkeletonItem"})))),!this.isLoading&&n("div",{key:"e0c315ec38923a7e0bc733afec2be84a1c8aa3e0",class:"PromotingBannersWrapper"},n("div",{key:"e7aadacb97a159e6ee44e5f56c6dd98f9e5dd39a",class:"PC"===r()?"PromotingBannersHeader":"PromotingBannersHeader PromotingBannersHeaderMobile"},(null===(e=this.promotingBannersArray)||void 0===e?void 0:e.title)&&n("h1",{key:"8f3d009d52498f2ee9c192a9981530728b878a8e",class:"PromotingBannersSectionTitle"},null===(i=this.promotingBannersArray)||void 0===i?void 0:i.title),(null===(t=this.promotingBannersArray)||void 0===t?void 0:t.description)&&n("h5",{key:"4baa09943e71f24ee66a90e85722eab17d37f54c",class:"PromotingBannersSectionSubtitle",style:{display:"PC"!==r()?"inline-block":"none"},innerHTML:null===(a=this.promotingBannersArray)||void 0===a?void 0:a.description})),n("div",{key:"fb10bb5f47c7f45f5f5ac7e3fcc7ddc11ded2516",class:"PromotingBannersGrid"},this.promotingBannersArray.map((e=>this.renderBannersGrid(e))))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"]}}};d.style='.PromotingBannersIconContainer img{width:50px;height:50px;border-radius:var(--emw--border-radius-image, 50%);background-size:contain;margin:10px}.PromotingBannersSection{padding:10px;border-radius:var(--emw--border-radius-small, 5px);background-color:var(--emw--promo-color-background, var(--emw--color-background, #2f2f2f));background-repeat:no-repeat;background-position:center;color:var(--emw--promo-color-primary, var(--emw--color-primary, #fff));font-family:var(--emw--font-family-primary, "Montserrat", sans-serif);overflow:hidden;position:relative}.PromotingBannersGrid{display:grid;grid-gap:30px;background-size:contain;background-repeat:no-repeat;padding:10px;width:100%;grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));box-sizing:border-box}.PromotingBannersContent{color:var(--emw--promo-color-primary, var(--emw--color-primary, #fff))}.PromotingBannersContent p{display:block;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;word-break:break-all}.PromotingBannersHeader{display:flex;justify-content:center;flex-direction:column;align-items:center}.PromotingBannersHeader p{text-align:center}.PromotingBannersBox{min-width:200px;display:flex;justify-content:flex-start;overflow:hidden;flex-direction:row;gap:20px;text-decoration:none;color:inherit;background-size:cover;background-position:center;border-radius:var(--emw--border-radius-small, 5px)}.PromotingBannersSectionTitle,.PromotingBannersSectionSubtitle{margin:10px auto;background:transparent}.PromotingBannersTextContainer{margin:5px;overflow:hidden;position:relative;padding-bottom:30px}.PromotingBannersTitle{margin:5px auto}.PromotingBannersButton{cursor:pointer;color:inherit;text-decoration:none;position:absolute;bottom:5px;border:0;background:transparent}.ButtonDisabled{cursor:not-allowed}.PromotionalBannersTextContainer{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.AboutUsError .ErrorInfo{color:var(--emw--promo-color-error, var(--emw--color-error, #ed0909))}.SkeletonGrid{display:grid}.Skeleton{animation:skeleton-loading 0.6s linear infinite alternate}@keyframes skeleton-loading{0%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.2) 0%, rgba(0, 61, 93, 0.2) 100%)}12%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.225) 0%, rgba(0, 61, 93, 0.225) 100%)}25%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.25) 0%, rgba(0, 61, 93, 0.25) 100%)}33%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.275) 0%, rgba(0, 61, 93, 0.275) 100%)}50%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.3) 0%, rgba(0, 61, 93, 0.3) 100%)}63%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.325) 0%, rgba(0, 61, 93, 0.325) 100%)}75%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.35) 0%, rgba(0, 61, 93, 0.35) 100%)}88%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.375) 0%, rgba(0, 61, 93, 0.375) 100%)}100%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.4) 0%, rgba(0, 61, 93, 0.4) 100%)}}.SkeletonItem{opacity:0.5;margin:0 15px;width:125px;height:150px;border-radius:var(--emw--border-radius-medium, 15px);margin:20px}';export{d as P}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{P as promoting_banners}from"./promoting-banners-
|
|
1
|
+
export{P as promoting_banners}from"./promoting-banners-043c1e67.js";import"./index-43b1379d.js";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as n}from"./index-43b1379d.js";const r=()=>{let e=window.navigator.userAgent;return e.toLowerCase().match(/android/i)?"Android":e.toLowerCase().match(/iphone/i)?"iPhone":e.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"},o={en:{error:"Error",noResults:"Loading, please wait ..."},hu:{error:"Error",noResults:"Loading, please wait ..."},ro:{error:"Eroare",noResults:"Loading, please wait ..."},fr:{error:"Error",noResults:"Loading, please wait ..."},ar:{error:"خطأ",noResults:"Loading, please wait ..."},hr:{error:"Greška",noResults:"Učitavanje, molimo pričekajte ..."}},i=e=>new Promise(((n,r)=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((n=>{for(let r in e[n])o[n][r]=e[n][r]})),n(o)})).catch((e=>{r(e)}))}));function t(e,n){if(e){const r=document.createElement("style");r.innerHTML=n,e.appendChild(r)}}function a(e,n){if(!e||!n)return;const r=new URL(n);fetch(r.href).then((e=>e.text())).then((n=>{const r=document.createElement("style");r.innerHTML=n,e&&e.appendChild(r)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}const s=class{constructor(n){e(this,n),this.cmsEndpoint="",this.language="en",this.cmsEnv="",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.promotingBannersArray=[],this.hasErrors=!1,this.isLoading=!0,this.translationData=void 0}handleClientStylingChange(e,n){e!=n&&t(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(e,n){e!=n&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}handleNewTranslations(){this.isLoading=!0,i(this.translationUrl).then((()=>{this.isLoading=!1}))}connectedCallback(){this.cmsEndpoint&&this.language&&this.getPromotingBanners()}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBus?function(e,n){if(window.emMessageBus){const r=document.createElement("style");window.emMessageBus.subscribe(n,(n=>{r.innerHTML=n,e&&e.appendChild(r)}))}}(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&t(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}getPromotingBanners(){const e=new URL(`${this.cmsEndpoint}/${this.language}/homepage`),n=new URLSearchParams;n.append("language",this.language),n.append("env",this.cmsEnv),n.append("device",(()=>{const e=r();if(e)return"PC"===e?"dk":"mtWeb"})()),e.search=n.toString();let o={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"}};return new Promise(((n,r)=>{this.isLoading=!0,fetch(e.href,o).then((e=>e.json())).then((e=>{const{promotingBanners:r}=e;this.promotingBannersArray=r,n(r)})).catch((e=>{console.error("Error fetching data:",e),this.hasErrors=!0,r(e)})).finally((()=>{this.isLoading=!1}))}))}sendOpenLink(e,n,r){window.postMessage({type:"NavigateTo",path:e,target:r||null,externalLink:n||!1},window.location.href)}async componentWillLoad(){const e=[];if(this.translationUrl){const n=i(this.translationUrl).then((e=>{this.translationData=JSON.stringify(e)})).catch((e=>{console.log(e)}));e.push(n)}return Promise.all(e)}renderBannersGrid(e){var o,i,t;return n("a",{class:"PromotingBannersBox",href:null==e?void 0:e.url,target:e.targetType,style:{backgroundImage:`url(${null==e?void 0:e.backgroundImage})`}},n("div",{class:"PromotingBannersIconContainer"},n("img",{src:"Android"===r()||"iPhone"===r()?null===(o=e.icon)||void 0===o?void 0:o.mobile:"iPad"===r()?null===(i=e.image)||void 0===i?void 0:i.srcTablet:null===(t=e.icon)||void 0===t?void 0:t.desktop,alt:"Banner image"})),n("div",{class:"PromotingBannersTextContainer"},n("h3",{class:"PromotingBannersTitle"},null==e?void 0:e.title),n("div",{class:"PromotingBannersContent",innerHTML:null==e?void 0:e.description}),e.button&&n("button",{class:"PromotingBannersButton "+((null==e?void 0:e.button.text)?"":"ButtonDisabled"),innerHTML:null==e?void 0:e.button.text,onClick:this.sendOpenLink.bind(this,null==e?void 0:e.button.url,null==e?void 0:e.button.externalLink,null==e?void 0:e.button.target)})))}render(){var e,i,t,a,s;return n("div",{key:"3781ba5f4b63bbf1c9426c509e12c52a126b516a",class:"PromotingBannersSection",ref:e=>this.stylingContainer=e},this.hasErrors&&n("div",{key:"395769f146608f99dfd2b5f2547ffe0229bdf8b3",class:"AboutUsError"},n("div",{key:"01d2dccd1a1ba0f0cbfaf6ead8e98dabf1f94985",class:"ErrorInfo"},o[void 0!==(s=this.language)&&s in o?s:"en"].error)),this.isLoading&&n("div",{key:"6a832d41a9864e2d92f4025a897701bb4d6f922c",class:"SkeletonGrid"},new Array(4).fill(null).map((e=>n("div",{key:e,class:"Skeleton SkeletonItem"})))),!this.isLoading&&n("div",{key:"e0c315ec38923a7e0bc733afec2be84a1c8aa3e0",class:"PromotingBannersWrapper"},n("div",{key:"e7aadacb97a159e6ee44e5f56c6dd98f9e5dd39a",class:"PC"===r()?"PromotingBannersHeader":"PromotingBannersHeader PromotingBannersHeaderMobile"},(null===(e=this.promotingBannersArray)||void 0===e?void 0:e.title)&&n("h1",{key:"8f3d009d52498f2ee9c192a9981530728b878a8e",class:"PromotingBannersSectionTitle"},null===(i=this.promotingBannersArray)||void 0===i?void 0:i.title),(null===(t=this.promotingBannersArray)||void 0===t?void 0:t.description)&&n("h5",{key:"4baa09943e71f24ee66a90e85722eab17d37f54c",class:"PromotingBannersSectionSubtitle",style:{display:"PC"!==r()?"inline-block":"none"},innerHTML:null===(a=this.promotingBannersArray)||void 0===a?void 0:a.description})),n("div",{key:"fb10bb5f47c7f45f5f5ac7e3fcc7ddc11ded2516",class:"PromotingBannersGrid"},this.promotingBannersArray.map((e=>this.renderBannersGrid(e))))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"]}}};s.style='.PromotingBannersIconContainer img{width:50px;height:50px;border-radius:var(--emw--border-radius-image, 50%);background-size:contain;margin:10px}.PromotingBannersSection{padding:10px;border-radius:var(--emw--border-radius-small, 5px);background-color:var(--emw--promo-color-background, var(--emw--color-background, #2f2f2f));background-repeat:no-repeat;background-position:center;color:var(--emw--promo-color-primary, var(--emw--color-primary, #fff));font-family:var(--emw--font-family-primary, "Montserrat", sans-serif);overflow:hidden;position:relative}.PromotingBannersGrid{display:grid;grid-gap:30px;background-size:contain;background-repeat:no-repeat;padding:10px;width:100%;grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));box-sizing:border-box}.PromotingBannersContent{color:var(--emw--promo-color-primary, var(--emw--color-primary, #fff))}.PromotingBannersContent p{display:block;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;word-break:break-all}.PromotingBannersHeader{display:flex;justify-content:center;flex-direction:column;align-items:center}.PromotingBannersHeader p{text-align:center}.PromotingBannersBox{min-width:200px;display:flex;justify-content:flex-start;overflow:hidden;flex-direction:row;gap:20px;text-decoration:none;color:inherit;background-size:cover;background-position:center;border-radius:var(--emw--border-radius-small, 5px)}.PromotingBannersSectionTitle,.PromotingBannersSectionSubtitle{margin:10px auto;background:transparent}.PromotingBannersTextContainer{margin:5px;overflow:hidden;position:relative;padding-bottom:30px}.PromotingBannersTitle{margin:5px auto}.PromotingBannersButton{cursor:pointer;color:inherit;text-decoration:none;position:absolute;bottom:5px;border:0;background:transparent}.ButtonDisabled{cursor:not-allowed}.PromotionalBannersTextContainer{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.AboutUsError .ErrorInfo{color:var(--emw--promo-color-error, var(--emw--color-error, #ed0909))}.SkeletonGrid{display:grid}.Skeleton{animation:skeleton-loading 0.6s linear infinite alternate}@keyframes skeleton-loading{0%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.2) 0%, rgba(0, 61, 93, 0.2) 100%)}12%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.225) 0%, rgba(0, 61, 93, 0.225) 100%)}25%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.25) 0%, rgba(0, 61, 93, 0.25) 100%)}33%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.275) 0%, rgba(0, 61, 93, 0.275) 100%)}50%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.3) 0%, rgba(0, 61, 93, 0.3) 100%)}63%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.325) 0%, rgba(0, 61, 93, 0.325) 100%)}75%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.35) 0%, rgba(0, 61, 93, 0.35) 100%)}88%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.375) 0%, rgba(0, 61, 93, 0.375) 100%)}100%{background:linear-gradient(90deg, rgba(35, 178, 78, 0.4) 0%, rgba(0, 61, 93, 0.4) 100%)}}.SkeletonItem{opacity:0.5;margin:0 15px;width:125px;height:150px;border-radius:var(--emw--border-radius-medium, 15px);margin:20px}';export{s as P}
|