@everymatrix/player-limit-notification-nd 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.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{player-limit-notification-nd-ed88437d.js → player-limit-notification-nd-f5b0cd03.js} +70 -11
- package/dist/cjs/player-limit-notification-nd.cjs.entry.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{player-limit-notification-nd-97616c18.js → player-limit-notification-nd-4efc7adb.js} +70 -11
- package/dist/esm/player-limit-notification-nd.entry.js +1 -1
- package/dist/player-limit-notification-nd/index.esm.js +1 -1
- package/dist/player-limit-notification-nd/{player-limit-notification-nd-97616c18.js → player-limit-notification-nd-4efc7adb.js} +239 -239
- package/dist/player-limit-notification-nd/player-limit-notification-nd.entry.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const playerLimitNotificationNd = require('./player-limit-notification-nd-
|
|
5
|
+
const playerLimitNotificationNd = require('./player-limit-notification-nd-f5b0cd03.js');
|
|
6
6
|
require('./index-075a342b.js');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -138,6 +138,8 @@ const translate = (key, customLang, values) => {
|
|
|
138
138
|
return translation;
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
142
|
+
|
|
141
143
|
/**
|
|
142
144
|
* @name setClientStyling
|
|
143
145
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -183,18 +185,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
183
185
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
184
186
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
185
187
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
188
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
186
189
|
*/
|
|
187
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
188
|
-
if (window.emMessageBus)
|
|
189
|
-
const sheet = document.createElement('style');
|
|
190
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
191
|
+
if (!window.emMessageBus) return;
|
|
190
192
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
194
|
+
|
|
195
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
196
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
197
|
+
|
|
198
|
+
return subscription;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (!window[StyleCacheKey]) {
|
|
202
|
+
window[StyleCacheKey] = {};
|
|
197
203
|
}
|
|
204
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
205
|
+
|
|
206
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
207
|
+
const wrappedUnsubscribe = () => {
|
|
208
|
+
if (window[StyleCacheKey][domain]) {
|
|
209
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
210
|
+
cachedObject.refCount > 1
|
|
211
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
212
|
+
: delete window[StyleCacheKey][domain];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
originalUnsubscribe();
|
|
216
|
+
};
|
|
217
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
218
|
+
|
|
219
|
+
return subscription;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
223
|
+
const sheet = document.createElement('style');
|
|
224
|
+
|
|
225
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
226
|
+
if (stylingContainer) {
|
|
227
|
+
sheet.innerHTML = data;
|
|
228
|
+
stylingContainer.appendChild(sheet);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
234
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
235
|
+
if (!stylingContainer) return;
|
|
236
|
+
|
|
237
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
238
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
239
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
240
|
+
|
|
241
|
+
if (!cachedStyle) {
|
|
242
|
+
cachedStyle = new CSSStyleSheet();
|
|
243
|
+
cachedStyle.replaceSync(data);
|
|
244
|
+
cacheStyleObject[domain] = {
|
|
245
|
+
sheet: cachedStyle,
|
|
246
|
+
refCount: 1
|
|
247
|
+
};
|
|
248
|
+
} else {
|
|
249
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
253
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
254
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
198
257
|
}
|
|
199
258
|
|
|
200
259
|
var LimitType;
|
|
@@ -7030,13 +7089,13 @@ const PlayerLimitNotificationNd = class {
|
|
|
7030
7089
|
}
|
|
7031
7090
|
handleMbSourceChange(newValue, oldValue) {
|
|
7032
7091
|
if (newValue != oldValue) {
|
|
7033
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
7092
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
7034
7093
|
}
|
|
7035
7094
|
}
|
|
7036
7095
|
componentDidLoad() {
|
|
7037
7096
|
if (this.stylingContainer) {
|
|
7038
7097
|
if (this.mbSource)
|
|
7039
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
7098
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
7040
7099
|
if (this.clientStyling)
|
|
7041
7100
|
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
7042
7101
|
if (this.clientStylingUrl)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const playerLimitNotificationNd = require('./player-limit-notification-nd-
|
|
5
|
+
const playerLimitNotificationNd = require('./player-limit-notification-nd-f5b0cd03.js');
|
|
6
6
|
require('./index-075a342b.js');
|
|
7
7
|
|
|
8
8
|
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as PlayerLimitNotificationNd } from './player-limit-notification-nd-
|
|
1
|
+
export { P as PlayerLimitNotificationNd } from './player-limit-notification-nd-4efc7adb.js';
|
|
2
2
|
import './index-862a608b.js';
|
|
@@ -136,6 +136,8 @@ const translate = (key, customLang, values) => {
|
|
|
136
136
|
return translation;
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
140
|
+
|
|
139
141
|
/**
|
|
140
142
|
* @name setClientStyling
|
|
141
143
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -181,18 +183,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
181
183
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
182
184
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
183
185
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
186
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
184
187
|
*/
|
|
185
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
186
|
-
if (window.emMessageBus)
|
|
187
|
-
const sheet = document.createElement('style');
|
|
188
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
189
|
+
if (!window.emMessageBus) return;
|
|
188
190
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
192
|
+
|
|
193
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
194
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
195
|
+
|
|
196
|
+
return subscription;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (!window[StyleCacheKey]) {
|
|
200
|
+
window[StyleCacheKey] = {};
|
|
195
201
|
}
|
|
202
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
203
|
+
|
|
204
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
205
|
+
const wrappedUnsubscribe = () => {
|
|
206
|
+
if (window[StyleCacheKey][domain]) {
|
|
207
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
208
|
+
cachedObject.refCount > 1
|
|
209
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
210
|
+
: delete window[StyleCacheKey][domain];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
originalUnsubscribe();
|
|
214
|
+
};
|
|
215
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
216
|
+
|
|
217
|
+
return subscription;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
221
|
+
const sheet = document.createElement('style');
|
|
222
|
+
|
|
223
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
224
|
+
if (stylingContainer) {
|
|
225
|
+
sheet.innerHTML = data;
|
|
226
|
+
stylingContainer.appendChild(sheet);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
232
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
233
|
+
if (!stylingContainer) return;
|
|
234
|
+
|
|
235
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
236
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
237
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
238
|
+
|
|
239
|
+
if (!cachedStyle) {
|
|
240
|
+
cachedStyle = new CSSStyleSheet();
|
|
241
|
+
cachedStyle.replaceSync(data);
|
|
242
|
+
cacheStyleObject[domain] = {
|
|
243
|
+
sheet: cachedStyle,
|
|
244
|
+
refCount: 1
|
|
245
|
+
};
|
|
246
|
+
} else {
|
|
247
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
251
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
252
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
253
|
+
}
|
|
254
|
+
});
|
|
196
255
|
}
|
|
197
256
|
|
|
198
257
|
var LimitType;
|
|
@@ -7028,13 +7087,13 @@ const PlayerLimitNotificationNd = class {
|
|
|
7028
7087
|
}
|
|
7029
7088
|
handleMbSourceChange(newValue, oldValue) {
|
|
7030
7089
|
if (newValue != oldValue) {
|
|
7031
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
7090
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
7032
7091
|
}
|
|
7033
7092
|
}
|
|
7034
7093
|
componentDidLoad() {
|
|
7035
7094
|
if (this.stylingContainer) {
|
|
7036
7095
|
if (this.mbSource)
|
|
7037
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
7096
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
7038
7097
|
if (this.clientStyling)
|
|
7039
7098
|
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
7040
7099
|
if (this.clientStylingUrl)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as player_limit_notification_nd } from './player-limit-notification-nd-
|
|
1
|
+
export { P as player_limit_notification_nd } from './player-limit-notification-nd-4efc7adb.js';
|
|
2
2
|
import './index-862a608b.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{P as PlayerLimitNotificationNd}from"./player-limit-notification-nd-
|
|
1
|
+
export{P as PlayerLimitNotificationNd}from"./player-limit-notification-nd-4efc7adb.js";import"./index-862a608b.js";
|