@everymatrix/helper-tabs 1.54.12 → 1.56.0

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-11d06848.js');
5
+ const index = require('./index-08bd9c7c.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
8
  const SUPPORTED_LANGUAGES = ['en'];
@@ -76,6 +76,63 @@ const getTranslations = (data) => {
76
76
  });
77
77
  };
78
78
 
79
+ /**
80
+ * @name setClientStyling
81
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
82
+ * @param {HTMLElement} stylingContainer The reference element of the widget
83
+ * @param {string} clientStyling The style content
84
+ */
85
+ function setClientStyling(stylingContainer, clientStyling) {
86
+ if (stylingContainer) {
87
+ const sheet = document.createElement('style');
88
+ sheet.innerHTML = clientStyling;
89
+ stylingContainer.appendChild(sheet);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * @name setClientStylingURL
95
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
96
+ * @param {HTMLElement} stylingContainer The reference element of the widget
97
+ * @param {string} clientStylingUrl The URL of the style content
98
+ */
99
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
100
+ const url = new URL(clientStylingUrl);
101
+
102
+ fetch(url.href)
103
+ .then((res) => res.text())
104
+ .then((data) => {
105
+ const cssFile = document.createElement('style');
106
+ cssFile.innerHTML = data;
107
+ if (stylingContainer) {
108
+ stylingContainer.appendChild(cssFile);
109
+ }
110
+ })
111
+ .catch((err) => {
112
+ console.error('There was an error while trying to load client styling from URL', err);
113
+ });
114
+ }
115
+
116
+ /**
117
+ * @name setStreamLibrary
118
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
119
+ * @param {HTMLElement} stylingContainer The highest element of the widget
120
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
121
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
122
+ */
123
+ function setStreamStyling(stylingContainer, domain, subscription) {
124
+ if (window.emMessageBus) {
125
+ const sheet = document.createElement('style');
126
+
127
+ window.emMessageBus.subscribe(domain, (data) => {
128
+ sheet.innerHTML = data;
129
+ if (stylingContainer) {
130
+ stylingContainer.appendChild(sheet);
131
+ }
132
+ });
133
+ }
134
+ }
135
+
79
136
  const helperTabCss = ":host{display:block}.TabContent{font-size:14px;color:var(--emw--button-text-color, #000);font-weight:normal}";
80
137
  const HelperTabStyle0 = helperTabCss;
81
138
 
@@ -93,42 +150,45 @@ const HelperTab = class {
93
150
  /**
94
151
  * Client custom styling via url content
95
152
  */
96
- this.clientStylingUrlContent = '';
153
+ this.clientStylingUrl = '';
97
154
  /**
98
155
  * Language of the widget
99
156
  */
100
157
  this.language = 'en';
101
158
  this.tabContent = '';
102
- this.limitStylingAppends = false;
103
- this.setClientStyling = () => {
104
- let sheet = document.createElement('style');
105
- sheet.innerHTML = this.clientStyling;
106
- this.stylingContainer.prepend(sheet);
107
- };
108
- this.setClientStylingURL = () => {
109
- let cssFile = document.createElement('style');
110
- setTimeout(() => {
111
- cssFile.innerHTML = this.clientStylingUrlContent;
112
- this.stylingContainer.prepend(cssFile);
113
- }, 1);
114
- };
159
+ }
160
+ handleClientStylingChange(newValue, oldValue) {
161
+ if (newValue != oldValue) {
162
+ setClientStyling(this.stylingContainer, this.clientStyling);
163
+ }
164
+ }
165
+ handleClientStylingChangeURL(newValue, oldValue) {
166
+ if (newValue != oldValue) {
167
+ if (this.clientStylingUrl)
168
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
169
+ }
170
+ }
171
+ componentDidLoad() {
172
+ if (this.stylingContainer) {
173
+ if (window.emMessageBus != undefined) {
174
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
175
+ }
176
+ else {
177
+ if (this.clientStyling)
178
+ setClientStyling(this.stylingContainer, this.clientStyling);
179
+ if (this.clientStylingUrl)
180
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
181
+ }
182
+ }
183
+ }
184
+ disconnectedCallback() {
185
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
115
186
  }
116
187
  componentWillLoad() {
117
188
  if (this.translationUrl) {
118
189
  getTranslations(JSON.parse(this.translationUrl));
119
190
  }
120
191
  }
121
- componentDidRender() {
122
- // start custom styling area
123
- if (!this.limitStylingAppends && this.stylingContainer) {
124
- if (this.clientStyling)
125
- this.setClientStyling();
126
- if (this.clientStylingUrlContent)
127
- this.setClientStylingURL();
128
- this.limitStylingAppends = true;
129
- }
130
- // end custom styling area
131
- }
132
192
  getHowToPlay() {
133
193
  if (this.lowNumber && this.highNumber && this.maxinumAllowed && this.minimumAllowed) {
134
194
  return translateWithParams('howToPlay', {
@@ -142,15 +202,19 @@ const HelperTab = class {
142
202
  return '';
143
203
  }
144
204
  render() {
145
- this.tabContent = index.h("div", { key: 'fc177f5bed7e46d51e953094b8cce0afa5f46a45', class: "TabContent", ref: el => this.stylingContainer = el }, this.getHowToPlay());
205
+ this.tabContent = index.h("div", { key: '92877a17361066f68fce6299cb8f65901f6abc60', class: "TabContent", ref: el => this.stylingContainer = el }, this.getHowToPlay());
146
206
  if (this.selectedIndex + 1 == 2) {
147
- this.tabContent = index.h("div", { key: '8de7f218079aedb48d3172a84139feaefbfd8a3e', class: "TabContent", ref: el => this.stylingContainer = el }, index.h("ol", { key: 'dc8131b1dae16dfd9ac39919ce1f53664a7438df' }, index.h("li", { key: '5c5e4a9213b5c645d5969b4ea7502b5ddfbcfd7e' }, translate('register', this.language)), index.h("li", { key: 'c72cd7fe80fd665a4567808e90352e2c82622a0e' }, translate('butTickets', this.language)), index.h("li", { key: 'b5340c61022856214cd6ff0a56013f2e3851ac10' }, translate('reviewPurchase', this.language))));
207
+ this.tabContent = index.h("div", { key: '9876b9250371034ef40dab0f5fc3fe1a5631a370', class: "TabContent", ref: el => this.stylingContainer = el }, index.h("ol", { key: 'ef2097eb54aeb640f06871277d8cafd2f4455109' }, index.h("li", { key: 'e9a0237e1fdead445abcd9240174276ffef81a67' }, translate('register', this.language)), index.h("li", { key: '2bdfaffdc9f1a7ae021913cb0ba346132140dcfd' }, translate('butTickets', this.language)), index.h("li", { key: 'bff38eaeabeaece83dc8ed1697e5b052802753f6' }, translate('reviewPurchase', this.language))));
148
208
  }
149
209
  else if (this.selectedIndex + 1 == 3) {
150
- this.tabContent = index.h("div", { key: 'f7e86830283d2dea60cdc96ca1ee7f0589658a3c', class: "TabContent", ref: el => this.stylingContainer = el }, index.h("ul", { key: 'c8d950bfd1cfc933260cbbf0f3d9ab7de7a564e1' }, index.h("li", { key: '754ddb1278ab4004a6f0fc68dc8bda0750c04a19' }, translate('odds', this.language)), index.h("li", { key: '78e60f1e02bfd2e04b6f9535b74f3a16892a9c49' }, translate('winGame', this.language)), index.h("li", { key: '04a097cf10b0b9b6c16feafd46107e8a3874aa07' }, translate('claimPrize', this.language))));
210
+ this.tabContent = index.h("div", { key: '49a7fb3435fb50b54572ec38d1e632e2eacf56fb', class: "TabContent", ref: el => this.stylingContainer = el }, index.h("ul", { key: '7f642625f35a1ed1eae7655144c0b8b1bfe25f55' }, index.h("li", { key: '037a5913be57dd1e2dcde5a061e9c64e70365e8d' }, translate('odds', this.language)), index.h("li", { key: '8775a1b2e8eda285e2c248b8d7235f06ac593fc6' }, translate('winGame', this.language)), index.h("li", { key: '5297fc5e757c29a1349049f1fe294e926255d518' }, translate('claimPrize', this.language))));
151
211
  }
152
212
  return (this.tabContent);
153
213
  }
214
+ static get watchers() { return {
215
+ "clientStyling": ["handleClientStylingChange"],
216
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
217
+ }; }
154
218
  };
155
219
  HelperTab.style = HelperTabStyle0;
156
220
 
@@ -187,42 +251,49 @@ const HelperTabs = class {
187
251
  /**
188
252
  * Client custom styling via url content
189
253
  */
190
- this.clientStylingUrlContent = '';
254
+ this.clientStylingUrl = '';
191
255
  /**
192
256
  * Language
193
257
  */
194
258
  this.language = 'en';
195
- this.limitStylingAppends = false;
196
- this.setClientStyling = () => {
197
- let sheet = document.createElement('style');
198
- sheet.innerHTML = this.clientStyling;
199
- this.stylingContainer.prepend(sheet);
200
- };
201
- this.setClientStylingURL = () => {
202
- let cssFile = document.createElement('style');
203
- setTimeout(() => {
204
- cssFile.innerHTML = this.clientStylingUrlContent;
205
- this.stylingContainer.prepend(cssFile);
206
- }, 1);
207
- };
208
259
  }
209
260
  connectedCallback() {
210
261
  }
211
- componentDidRender() {
212
- // start custom styling area
213
- if (!this.limitStylingAppends && this.stylingContainer) {
214
- this.setClientStyling();
215
- if (this.clientStylingUrlContent) {
216
- this.setClientStylingURL();
262
+ handleClientStylingChange(newValue, oldValue) {
263
+ if (newValue != oldValue) {
264
+ setClientStyling(this.stylingContainer, this.clientStyling);
265
+ }
266
+ }
267
+ handleClientStylingChangeURL(newValue, oldValue) {
268
+ if (newValue != oldValue) {
269
+ if (this.clientStylingUrl)
270
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
271
+ }
272
+ }
273
+ componentDidLoad() {
274
+ if (this.stylingContainer) {
275
+ if (window.emMessageBus != undefined) {
276
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
277
+ }
278
+ else {
279
+ if (this.clientStyling)
280
+ setClientStyling(this.stylingContainer, this.clientStyling);
281
+ if (this.clientStylingUrl)
282
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
217
283
  }
218
- this.limitStylingAppends = true;
219
284
  }
220
- // end custom styling area
285
+ }
286
+ disconnectedCallback() {
287
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
221
288
  }
222
289
  render() {
223
- return (index.h("div", { key: '4c75878234d57bf5e9a82ee926252bce3ba90b0f', ref: el => this.stylingContainer = el }, index.h("div", { key: '95faa7cc214b9dd96a1daacf36f1d637a8624e90', class: "Tabs" }, this.tabs.map((tab, index$1) => index.h("button", { class: 'TabButton' + (this.selectedIndex == index$1 ? ' Active' : ''), onClick: () => this.selectedIndex = index$1 }, tab.label))), index.h("div", { key: '787ecacb0c26b0712b9ebef99ff7be68d1eb4231' }, index.h("helper-tab", { key: 'df43a2347875f49446d2b85e63c257e527a6b3ab', "low-number": this.lowNumber, "high-number": this.highNumber, "minimum-allowed": this.minimumAllowed, "maxinum-allowed": this.maxinumAllowed, selectedIndex: this.selectedIndex, "client-styling": this.clientStyling, language: this.language, "translation-url": this.translationUrl, "client-stylingurl": this.clientStylingurl, "client-styling-url-content": this.clientStylingUrlContent }))));
290
+ return (index.h("div", { key: '173c4774748482dc56fcffb4bac4e1666fa9170f', ref: el => this.stylingContainer = el }, index.h("div", { key: '680b65218e4b00f134b354f593c0c20fb5882dca', class: "Tabs" }, this.tabs.map((tab, index$1) => index.h("button", { class: 'TabButton' + (this.selectedIndex == index$1 ? ' Active' : ''), onClick: () => this.selectedIndex = index$1 }, tab.label))), index.h("div", { key: '67aa26c92fb416c5d0934988fb071481f805685b' }, index.h("helper-tab", { key: '63c8dfc253d4fc12b0310a2585a44b90807e1a9f', "low-number": this.lowNumber, "high-number": this.highNumber, "minimum-allowed": this.minimumAllowed, "maxinum-allowed": this.maxinumAllowed, selectedIndex: this.selectedIndex, "client-styling": this.clientStyling, language: this.language, "translation-url": this.translationUrl, "client-stylingurl": this.clientStylingurl, "client-styling-url-content": this.clientStylingUrl, "mb-source": this.mbSource }))));
224
291
  }
225
292
  get host() { return index.getElement(this); }
293
+ static get watchers() { return {
294
+ "clientStyling": ["handleClientStylingChange"],
295
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
296
+ }; }
226
297
  };
227
298
  HelperTabs.style = HelperTabsStyle0;
228
299
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-11d06848.js');
5
+ const index = require('./index-08bd9c7c.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["helper-tab_2.cjs",[[1,"helper-tabs",{"disabled":[516],"label":[513],"selected":[516],"cmsEndpoint":[513,"cms-endpoint"],"selectedIndex":[1538,"selected-index"],"tabs":[16],"clientStyling":[513,"client-styling"],"clientStylingurl":[513,"client-stylingurl"],"clientStylingUrlContent":[513,"client-styling-url-content"],"lowNumber":[514,"low-number"],"highNumber":[514,"high-number"],"minimumAllowed":[514,"minimum-allowed"],"maxinumAllowed":[514,"maxinum-allowed"],"language":[513],"translationUrl":[520,"translation-url"],"limitStylingAppends":[32]}],[1,"helper-tab",{"selectedIndex":[514,"selected-index"],"cmsEndpoint":[513,"cms-endpoint"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"lowNumber":[514,"low-number"],"highNumber":[514,"high-number"],"minimumAllowed":[514,"minimum-allowed"],"maxinumAllowed":[514,"maxinum-allowed"],"language":[513],"translationUrl":[520,"translation-url"],"tabContent":[32],"limitStylingAppends":[32]}]]]], options);
22
+ return index.bootstrapLazy([["helper-tab_2.cjs",[[1,"helper-tabs",{"disabled":[516],"label":[513],"selected":[516],"cmsEndpoint":[513,"cms-endpoint"],"selectedIndex":[1538,"selected-index"],"tabs":[16],"clientStyling":[513,"client-styling"],"mbSource":[1,"mb-source"],"clientStylingurl":[513,"client-stylingurl"],"clientStylingUrl":[513,"client-styling-url"],"lowNumber":[514,"low-number"],"highNumber":[514,"high-number"],"minimumAllowed":[514,"minimum-allowed"],"maxinumAllowed":[514,"maxinum-allowed"],"language":[513],"translationUrl":[520,"translation-url"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}],[1,"helper-tab",{"selectedIndex":[514,"selected-index"],"cmsEndpoint":[513,"cms-endpoint"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"lowNumber":[514,"low-number"],"highNumber":[514,"high-number"],"minimumAllowed":[514,"minimum-allowed"],"maxinumAllowed":[514,"maxinum-allowed"],"language":[513],"translationUrl":[520,"translation-url"],"tabContent":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'helper-tabs';
24
- const BUILD = /* helper-tabs */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: true, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
24
+ const BUILD = /* helper-tabs */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: true, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: true };
25
25
 
26
26
  /*
27
27
  Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
@@ -856,14 +856,14 @@ var postUpdateComponent = (hostRef) => {
856
856
  const endPostUpdate = createTime("postUpdate", tagName);
857
857
  const instance = hostRef.$lazyInstance$ ;
858
858
  const ancestorComponent = hostRef.$ancestorComponent$;
859
- {
860
- safeCall(instance, "componentDidRender", void 0, elm);
861
- }
862
859
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
863
860
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
864
861
  {
865
862
  addHydratedFlag(elm);
866
863
  }
864
+ {
865
+ safeCall(instance, "componentDidLoad", void 0, elm);
866
+ }
867
867
  endPostUpdate();
868
868
  {
869
869
  hostRef.$onReadyResolve$(elm);
@@ -912,6 +912,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
912
912
  `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
913
913
  );
914
914
  }
915
+ const elm = hostRef.$hostElement$ ;
915
916
  const oldVal = hostRef.$instanceValues$.get(propName);
916
917
  const flags = hostRef.$flags$;
917
918
  const instance = hostRef.$lazyInstance$ ;
@@ -921,6 +922,18 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
921
922
  if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
922
923
  hostRef.$instanceValues$.set(propName, newVal);
923
924
  if (instance) {
925
+ if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
926
+ const watchMethods = cmpMeta.$watchers$[propName];
927
+ if (watchMethods) {
928
+ watchMethods.map((watchMethodName) => {
929
+ try {
930
+ instance[watchMethodName](newVal, oldVal, propName);
931
+ } catch (e) {
932
+ consoleError(e, elm);
933
+ }
934
+ });
935
+ }
936
+ }
924
937
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
925
938
  scheduleUpdate(hostRef, false);
926
939
  }
@@ -932,7 +945,10 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
932
945
  var proxyComponent = (Cstr, cmpMeta, flags) => {
933
946
  var _a, _b;
934
947
  const prototype = Cstr.prototype;
935
- if (cmpMeta.$members$ || BUILD.watchCallback ) {
948
+ if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
949
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
950
+ cmpMeta.$watchers$ = Cstr.watchers;
951
+ }
936
952
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
937
953
  members.map(([memberName, [memberFlags]]) => {
938
954
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
@@ -1072,6 +1088,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1072
1088
  throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1073
1089
  }
1074
1090
  if (!Cstr.isProxied) {
1091
+ {
1092
+ cmpMeta.$watchers$ = Cstr.watchers;
1093
+ }
1075
1094
  proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1076
1095
  Cstr.isProxied = true;
1077
1096
  }
@@ -1087,6 +1106,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1087
1106
  {
1088
1107
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1089
1108
  }
1109
+ {
1110
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1111
+ }
1090
1112
  endNewInstance();
1091
1113
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
1092
1114
  } else {
@@ -1161,12 +1183,17 @@ var connectedCallback = (elm) => {
1161
1183
  }
1162
1184
  };
1163
1185
  var disconnectInstance = (instance, elm) => {
1186
+ {
1187
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1188
+ }
1164
1189
  };
1165
1190
  var disconnectedCallback = async (elm) => {
1166
1191
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1167
1192
  const hostRef = getHostRef(elm);
1168
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1169
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1193
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1194
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1195
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1196
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1170
1197
  }
1171
1198
  }
1172
1199
  if (rootAppliedStyles.has(elm)) {
@@ -1195,6 +1222,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1195
1222
  let hasSlotRelocation = false;
1196
1223
  lazyBundles.map((lazyBundle) => {
1197
1224
  lazyBundle[1].map((compactMeta) => {
1225
+ var _a2;
1198
1226
  const cmpMeta = {
1199
1227
  $flags$: compactMeta[0],
1200
1228
  $tagName$: compactMeta[1],
@@ -1210,6 +1238,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1210
1238
  {
1211
1239
  cmpMeta.$attrsToReflect$ = [];
1212
1240
  }
1241
+ {
1242
+ cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
1243
+ }
1213
1244
  const tagName = cmpMeta.$tagName$;
1214
1245
  const HostElement = class extends HTMLElement {
1215
1246
  // StencilLazyHost
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-11d06848.js');
5
+ const index = require('./index-08bd9c7c.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["helper-tab_2.cjs",[[1,"helper-tabs",{"disabled":[516],"label":[513],"selected":[516],"cmsEndpoint":[513,"cms-endpoint"],"selectedIndex":[1538,"selected-index"],"tabs":[16],"clientStyling":[513,"client-styling"],"clientStylingurl":[513,"client-stylingurl"],"clientStylingUrlContent":[513,"client-styling-url-content"],"lowNumber":[514,"low-number"],"highNumber":[514,"high-number"],"minimumAllowed":[514,"minimum-allowed"],"maxinumAllowed":[514,"maxinum-allowed"],"language":[513],"translationUrl":[520,"translation-url"],"limitStylingAppends":[32]}],[1,"helper-tab",{"selectedIndex":[514,"selected-index"],"cmsEndpoint":[513,"cms-endpoint"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"lowNumber":[514,"low-number"],"highNumber":[514,"high-number"],"minimumAllowed":[514,"minimum-allowed"],"maxinumAllowed":[514,"maxinum-allowed"],"language":[513],"translationUrl":[520,"translation-url"],"tabContent":[32],"limitStylingAppends":[32]}]]]], options);
11
+ return index.bootstrapLazy([["helper-tab_2.cjs",[[1,"helper-tabs",{"disabled":[516],"label":[513],"selected":[516],"cmsEndpoint":[513,"cms-endpoint"],"selectedIndex":[1538,"selected-index"],"tabs":[16],"clientStyling":[513,"client-styling"],"mbSource":[1,"mb-source"],"clientStylingurl":[513,"client-stylingurl"],"clientStylingUrl":[513,"client-styling-url"],"lowNumber":[514,"low-number"],"highNumber":[514,"high-number"],"minimumAllowed":[514,"minimum-allowed"],"maxinumAllowed":[514,"maxinum-allowed"],"language":[513],"translationUrl":[520,"translation-url"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}],[1,"helper-tab",{"selectedIndex":[514,"selected-index"],"cmsEndpoint":[513,"cms-endpoint"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"lowNumber":[514,"low-number"],"highNumber":[514,"high-number"],"minimumAllowed":[514,"minimum-allowed"],"maxinumAllowed":[514,"maxinum-allowed"],"language":[513],"translationUrl":[520,"translation-url"],"tabContent":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -1,5 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { translate, translateWithParams, getTranslations } from "../../utils/locale.utils";
3
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
4
  export class HelperTab {
4
5
  constructor() {
5
6
  /**
@@ -13,42 +14,45 @@ export class HelperTab {
13
14
  /**
14
15
  * Client custom styling via url content
15
16
  */
16
- this.clientStylingUrlContent = '';
17
+ this.clientStylingUrl = '';
17
18
  /**
18
19
  * Language of the widget
19
20
  */
20
21
  this.language = 'en';
21
22
  this.tabContent = '';
22
- this.limitStylingAppends = false;
23
- this.setClientStyling = () => {
24
- let sheet = document.createElement('style');
25
- sheet.innerHTML = this.clientStyling;
26
- this.stylingContainer.prepend(sheet);
27
- };
28
- this.setClientStylingURL = () => {
29
- let cssFile = document.createElement('style');
30
- setTimeout(() => {
31
- cssFile.innerHTML = this.clientStylingUrlContent;
32
- this.stylingContainer.prepend(cssFile);
33
- }, 1);
34
- };
23
+ }
24
+ handleClientStylingChange(newValue, oldValue) {
25
+ if (newValue != oldValue) {
26
+ setClientStyling(this.stylingContainer, this.clientStyling);
27
+ }
28
+ }
29
+ handleClientStylingChangeURL(newValue, oldValue) {
30
+ if (newValue != oldValue) {
31
+ if (this.clientStylingUrl)
32
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
33
+ }
34
+ }
35
+ componentDidLoad() {
36
+ if (this.stylingContainer) {
37
+ if (window.emMessageBus != undefined) {
38
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
39
+ }
40
+ else {
41
+ if (this.clientStyling)
42
+ setClientStyling(this.stylingContainer, this.clientStyling);
43
+ if (this.clientStylingUrl)
44
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
45
+ }
46
+ }
47
+ }
48
+ disconnectedCallback() {
49
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
35
50
  }
36
51
  componentWillLoad() {
37
52
  if (this.translationUrl) {
38
53
  getTranslations(JSON.parse(this.translationUrl));
39
54
  }
40
55
  }
41
- componentDidRender() {
42
- // start custom styling area
43
- if (!this.limitStylingAppends && this.stylingContainer) {
44
- if (this.clientStyling)
45
- this.setClientStyling();
46
- if (this.clientStylingUrlContent)
47
- this.setClientStylingURL();
48
- this.limitStylingAppends = true;
49
- }
50
- // end custom styling area
51
- }
52
56
  getHowToPlay() {
53
57
  if (this.lowNumber && this.highNumber && this.maxinumAllowed && this.minimumAllowed) {
54
58
  return translateWithParams('howToPlay', {
@@ -62,12 +66,12 @@ export class HelperTab {
62
66
  return '';
63
67
  }
64
68
  render() {
65
- this.tabContent = h("div", { key: 'fc177f5bed7e46d51e953094b8cce0afa5f46a45', class: "TabContent", ref: el => this.stylingContainer = el }, this.getHowToPlay());
69
+ this.tabContent = h("div", { key: '92877a17361066f68fce6299cb8f65901f6abc60', class: "TabContent", ref: el => this.stylingContainer = el }, this.getHowToPlay());
66
70
  if (this.selectedIndex + 1 == 2) {
67
- this.tabContent = h("div", { key: '8de7f218079aedb48d3172a84139feaefbfd8a3e', class: "TabContent", ref: el => this.stylingContainer = el }, h("ol", { key: 'dc8131b1dae16dfd9ac39919ce1f53664a7438df' }, h("li", { key: '5c5e4a9213b5c645d5969b4ea7502b5ddfbcfd7e' }, translate('register', this.language)), h("li", { key: 'c72cd7fe80fd665a4567808e90352e2c82622a0e' }, translate('butTickets', this.language)), h("li", { key: 'b5340c61022856214cd6ff0a56013f2e3851ac10' }, translate('reviewPurchase', this.language))));
71
+ this.tabContent = h("div", { key: '9876b9250371034ef40dab0f5fc3fe1a5631a370', class: "TabContent", ref: el => this.stylingContainer = el }, h("ol", { key: 'ef2097eb54aeb640f06871277d8cafd2f4455109' }, h("li", { key: 'e9a0237e1fdead445abcd9240174276ffef81a67' }, translate('register', this.language)), h("li", { key: '2bdfaffdc9f1a7ae021913cb0ba346132140dcfd' }, translate('butTickets', this.language)), h("li", { key: 'bff38eaeabeaece83dc8ed1697e5b052802753f6' }, translate('reviewPurchase', this.language))));
68
72
  }
69
73
  else if (this.selectedIndex + 1 == 3) {
70
- this.tabContent = h("div", { key: 'f7e86830283d2dea60cdc96ca1ee7f0589658a3c', class: "TabContent", ref: el => this.stylingContainer = el }, h("ul", { key: 'c8d950bfd1cfc933260cbbf0f3d9ab7de7a564e1' }, h("li", { key: '754ddb1278ab4004a6f0fc68dc8bda0750c04a19' }, translate('odds', this.language)), h("li", { key: '78e60f1e02bfd2e04b6f9535b74f3a16892a9c49' }, translate('winGame', this.language)), h("li", { key: '04a097cf10b0b9b6c16feafd46107e8a3874aa07' }, translate('claimPrize', this.language))));
74
+ this.tabContent = h("div", { key: '49a7fb3435fb50b54572ec38d1e632e2eacf56fb', class: "TabContent", ref: el => this.stylingContainer = el }, h("ul", { key: '7f642625f35a1ed1eae7655144c0b8b1bfe25f55' }, h("li", { key: '037a5913be57dd1e2dcde5a061e9c64e70365e8d' }, translate('odds', this.language)), h("li", { key: '8775a1b2e8eda285e2c248b8d7235f06ac593fc6' }, translate('winGame', this.language)), h("li", { key: '5297fc5e757c29a1349049f1fe294e926255d518' }, translate('claimPrize', this.language))));
71
75
  }
72
76
  return (this.tabContent);
73
77
  }
@@ -124,6 +128,25 @@ export class HelperTab {
124
128
  "attribute": "cms-endpoint",
125
129
  "reflect": true
126
130
  },
131
+ "mbSource": {
132
+ "type": "string",
133
+ "mutable": false,
134
+ "complexType": {
135
+ "original": "string",
136
+ "resolved": "string",
137
+ "references": {}
138
+ },
139
+ "required": false,
140
+ "optional": false,
141
+ "docs": {
142
+ "tags": [],
143
+ "text": "Client custom styling via streamStyling"
144
+ },
145
+ "getter": false,
146
+ "setter": false,
147
+ "attribute": "mb-source",
148
+ "reflect": false
149
+ },
127
150
  "clientStyling": {
128
151
  "type": "string",
129
152
  "mutable": false,
@@ -144,7 +167,7 @@ export class HelperTab {
144
167
  "reflect": true,
145
168
  "defaultValue": "''"
146
169
  },
147
- "clientStylingUrlContent": {
170
+ "clientStylingUrl": {
148
171
  "type": "string",
149
172
  "mutable": false,
150
173
  "complexType": {
@@ -160,7 +183,7 @@ export class HelperTab {
160
183
  },
161
184
  "getter": false,
162
185
  "setter": false,
163
- "attribute": "client-styling-url-content",
186
+ "attribute": "client-styling-url",
164
187
  "reflect": true,
165
188
  "defaultValue": "''"
166
189
  },
@@ -283,8 +306,16 @@ export class HelperTab {
283
306
  }
284
307
  static get states() {
285
308
  return {
286
- "tabContent": {},
287
- "limitStylingAppends": {}
309
+ "tabContent": {}
288
310
  };
289
311
  }
312
+ static get watchers() {
313
+ return [{
314
+ "propName": "clientStyling",
315
+ "methodName": "handleClientStylingChange"
316
+ }, {
317
+ "propName": "clientStylingUrl",
318
+ "methodName": "handleClientStylingChangeURL"
319
+ }];
320
+ }
290
321
  }