@everymatrix/lottery-subscription 1.87.26 → 1.87.28
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/{lottery-subscription-7bc87e6a.js → lottery-subscription-8266a193.js} +70 -11
- package/dist/cjs/lottery-subscription.cjs.entry.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{lottery-subscription-7f17b7c8.js → lottery-subscription-fa8f2df0.js} +70 -11
- package/dist/esm/lottery-subscription.entry.js +1 -1
- package/dist/lottery-subscription/index.esm.js +1 -1
- package/dist/lottery-subscription/{lottery-subscription-7f17b7c8.js → lottery-subscription-fa8f2df0.js} +241 -241
- package/dist/lottery-subscription/lottery-subscription.entry.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -67,6 +67,8 @@ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
71
|
+
|
|
70
72
|
/**
|
|
71
73
|
* @name setClientStyling
|
|
72
74
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -112,18 +114,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
112
114
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
113
115
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
114
116
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
117
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
115
118
|
*/
|
|
116
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
117
|
-
if (window.emMessageBus)
|
|
118
|
-
const sheet = document.createElement('style');
|
|
119
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
120
|
+
if (!window.emMessageBus) return;
|
|
119
121
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
123
|
+
|
|
124
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
125
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
126
|
+
|
|
127
|
+
return subscription;
|
|
126
128
|
}
|
|
129
|
+
|
|
130
|
+
if (!window[StyleCacheKey]) {
|
|
131
|
+
window[StyleCacheKey] = {};
|
|
132
|
+
}
|
|
133
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
134
|
+
|
|
135
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
136
|
+
const wrappedUnsubscribe = () => {
|
|
137
|
+
if (window[StyleCacheKey][domain]) {
|
|
138
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
139
|
+
cachedObject.refCount > 1
|
|
140
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
141
|
+
: delete window[StyleCacheKey][domain];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
originalUnsubscribe();
|
|
145
|
+
};
|
|
146
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
147
|
+
|
|
148
|
+
return subscription;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
152
|
+
const sheet = document.createElement('style');
|
|
153
|
+
|
|
154
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
155
|
+
if (stylingContainer) {
|
|
156
|
+
sheet.innerHTML = data;
|
|
157
|
+
stylingContainer.appendChild(sheet);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
163
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
164
|
+
if (!stylingContainer) return;
|
|
165
|
+
|
|
166
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
167
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
168
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
169
|
+
|
|
170
|
+
if (!cachedStyle) {
|
|
171
|
+
cachedStyle = new CSSStyleSheet();
|
|
172
|
+
cachedStyle.replaceSync(data);
|
|
173
|
+
cacheStyleObject[domain] = {
|
|
174
|
+
sheet: cachedStyle,
|
|
175
|
+
refCount: 1
|
|
176
|
+
};
|
|
177
|
+
} else {
|
|
178
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
182
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
183
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
127
186
|
}
|
|
128
187
|
|
|
129
188
|
var qr=Object.defineProperty,Yr=Object.defineProperties;var Kr=Object.getOwnPropertyDescriptors;var lo=Object.getOwnPropertySymbols;var Gr=Object.prototype.hasOwnProperty,Xr=Object.prototype.propertyIsEnumerable;var Mt=(s,t,e)=>t in s?qr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,we=(s,t)=>{for(var e in t||(t={}))Gr.call(t,e)&&Mt(s,e,t[e]);if(lo)for(var e of lo(t))Xr.call(t,e)&&Mt(s,e,t[e]);return s},Nt=(s,t)=>Yr(s,Kr(t));var k=(s,t,e)=>(Mt(s,typeof t!="symbol"?t+"":t,e),e);var Ce=(s,t,e)=>new Promise((i,o)=>{var r=l=>{try{a(e.next(l));}catch(d){o(d);}},n=l=>{try{a(e.throw(l));}catch(d){o(d);}},a=l=>l.done?i(l.value):Promise.resolve(l.value).then(r,n);a((e=e.apply(s,t)).next());});/**
|
|
@@ -9120,13 +9179,13 @@ const LotterySubscription = class {
|
|
|
9120
9179
|
}
|
|
9121
9180
|
handleMbSourceChange(newValue, oldValue) {
|
|
9122
9181
|
if (newValue != oldValue) {
|
|
9123
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
9182
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
9124
9183
|
}
|
|
9125
9184
|
}
|
|
9126
9185
|
componentDidLoad() {
|
|
9127
9186
|
if (this.stylingContainer) {
|
|
9128
9187
|
if (this.mbSource)
|
|
9129
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
9188
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
9130
9189
|
if (this.clientStyling)
|
|
9131
9190
|
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
9132
9191
|
if (this.clientStylingUrl)
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { L as LotterySubscription } from './lottery-subscription-
|
|
1
|
+
export { L as LotterySubscription } from './lottery-subscription-fa8f2df0.js';
|
|
2
2
|
import './index-f4067a90.js';
|
|
@@ -65,6 +65,8 @@ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
69
|
+
|
|
68
70
|
/**
|
|
69
71
|
* @name setClientStyling
|
|
70
72
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -110,18 +112,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
110
112
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
111
113
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
112
114
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
115
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
113
116
|
*/
|
|
114
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
115
|
-
if (window.emMessageBus)
|
|
116
|
-
const sheet = document.createElement('style');
|
|
117
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
118
|
+
if (!window.emMessageBus) return;
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
121
|
+
|
|
122
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
123
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
124
|
+
|
|
125
|
+
return subscription;
|
|
124
126
|
}
|
|
127
|
+
|
|
128
|
+
if (!window[StyleCacheKey]) {
|
|
129
|
+
window[StyleCacheKey] = {};
|
|
130
|
+
}
|
|
131
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
132
|
+
|
|
133
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
134
|
+
const wrappedUnsubscribe = () => {
|
|
135
|
+
if (window[StyleCacheKey][domain]) {
|
|
136
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
137
|
+
cachedObject.refCount > 1
|
|
138
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
139
|
+
: delete window[StyleCacheKey][domain];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
originalUnsubscribe();
|
|
143
|
+
};
|
|
144
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
145
|
+
|
|
146
|
+
return subscription;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
150
|
+
const sheet = document.createElement('style');
|
|
151
|
+
|
|
152
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
153
|
+
if (stylingContainer) {
|
|
154
|
+
sheet.innerHTML = data;
|
|
155
|
+
stylingContainer.appendChild(sheet);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
161
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
162
|
+
if (!stylingContainer) return;
|
|
163
|
+
|
|
164
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
165
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
166
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
167
|
+
|
|
168
|
+
if (!cachedStyle) {
|
|
169
|
+
cachedStyle = new CSSStyleSheet();
|
|
170
|
+
cachedStyle.replaceSync(data);
|
|
171
|
+
cacheStyleObject[domain] = {
|
|
172
|
+
sheet: cachedStyle,
|
|
173
|
+
refCount: 1
|
|
174
|
+
};
|
|
175
|
+
} else {
|
|
176
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
180
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
181
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
182
|
+
}
|
|
183
|
+
});
|
|
125
184
|
}
|
|
126
185
|
|
|
127
186
|
var qr=Object.defineProperty,Yr=Object.defineProperties;var Kr=Object.getOwnPropertyDescriptors;var lo=Object.getOwnPropertySymbols;var Gr=Object.prototype.hasOwnProperty,Xr=Object.prototype.propertyIsEnumerable;var Mt=(s,t,e)=>t in s?qr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,we=(s,t)=>{for(var e in t||(t={}))Gr.call(t,e)&&Mt(s,e,t[e]);if(lo)for(var e of lo(t))Xr.call(t,e)&&Mt(s,e,t[e]);return s},Nt=(s,t)=>Yr(s,Kr(t));var k=(s,t,e)=>(Mt(s,typeof t!="symbol"?t+"":t,e),e);var Ce=(s,t,e)=>new Promise((i,o)=>{var r=l=>{try{a(e.next(l));}catch(d){o(d);}},n=l=>{try{a(e.throw(l));}catch(d){o(d);}},a=l=>l.done?i(l.value):Promise.resolve(l.value).then(r,n);a((e=e.apply(s,t)).next());});/**
|
|
@@ -9118,13 +9177,13 @@ const LotterySubscription = class {
|
|
|
9118
9177
|
}
|
|
9119
9178
|
handleMbSourceChange(newValue, oldValue) {
|
|
9120
9179
|
if (newValue != oldValue) {
|
|
9121
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
9180
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
9122
9181
|
}
|
|
9123
9182
|
}
|
|
9124
9183
|
componentDidLoad() {
|
|
9125
9184
|
if (this.stylingContainer) {
|
|
9126
9185
|
if (this.mbSource)
|
|
9127
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
9186
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
9128
9187
|
if (this.clientStyling)
|
|
9129
9188
|
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
9130
9189
|
if (this.clientStylingUrl)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { L as lottery_subscription } from './lottery-subscription-
|
|
1
|
+
export { L as lottery_subscription } from './lottery-subscription-fa8f2df0.js';
|
|
2
2
|
import './index-f4067a90.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{L as LotterySubscription}from"./lottery-subscription-
|
|
1
|
+
export{L as LotterySubscription}from"./lottery-subscription-fa8f2df0.js";import"./index-f4067a90.js";
|