@everymatrix/helper-tabs 1.55.0 → 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.
Files changed (28) hide show
  1. package/dist/cjs/helper-tab_2.cjs.entry.js +159 -65
  2. package/dist/cjs/helper-tabs.cjs.js +3 -3
  3. package/dist/cjs/{index-d8f4ee8c.js → index-08bd9c7c.js} +207 -75
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/components/helper-tab/helper-tab.js +95 -38
  7. package/dist/collection/components/helper-tabs/helper-tabs.js +111 -37
  8. package/dist/esm/helper-tab_2.entry.js +159 -65
  9. package/dist/esm/helper-tabs.js +4 -4
  10. package/dist/esm/{index-55376e55.js → index-c5727b52.js} +207 -75
  11. package/dist/esm/loader.js +3 -3
  12. package/dist/helper-tabs/helper-tabs.esm.js +1 -1
  13. package/dist/helper-tabs/p-c6fec16e.entry.js +1 -0
  14. package/dist/helper-tabs/p-d8d96e22.js +2 -0
  15. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/helper-tabs/.stencil/packages/stencil/helper-tabs/stencil.config.d.ts +2 -0
  16. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/helper-tabs/.stencil/packages/stencil/helper-tabs/stencil.config.dev.d.ts +2 -0
  17. package/dist/types/components/helper-tab/helper-tab.d.ts +10 -5
  18. package/dist/types/components/helper-tabs/helper-tabs.d.ts +10 -5
  19. package/dist/types/components.d.ts +20 -4
  20. package/package.json +1 -1
  21. package/dist/helper-tabs/p-47fcd693.js +0 -2
  22. package/dist/helper-tabs/p-7f43459b.entry.js +0 -1
  23. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/helper-tabs/.stencil/packages/stencil/helper-tabs/stencil.config.d.ts +0 -2
  24. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/helper-tabs/.stencil/packages/stencil/helper-tabs/stencil.config.dev.d.ts +0 -2
  25. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/helper-tabs/.stencil/tools/plugins/index.d.ts +0 -0
  26. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/helper-tabs/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  27. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/helper-tabs/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  28. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/helper-tabs/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, g as getElement } from './index-55376e55.js';
1
+ import { r as registerInstance, h, g as getElement } from './index-c5727b52.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
4
  const SUPPORTED_LANGUAGES = ['en'];
@@ -72,53 +72,119 @@ const getTranslations = (data) => {
72
72
  });
73
73
  };
74
74
 
75
+ /**
76
+ * @name setClientStyling
77
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
78
+ * @param {HTMLElement} stylingContainer The reference element of the widget
79
+ * @param {string} clientStyling The style content
80
+ */
81
+ function setClientStyling(stylingContainer, clientStyling) {
82
+ if (stylingContainer) {
83
+ const sheet = document.createElement('style');
84
+ sheet.innerHTML = clientStyling;
85
+ stylingContainer.appendChild(sheet);
86
+ }
87
+ }
88
+
89
+ /**
90
+ * @name setClientStylingURL
91
+ * @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
92
+ * @param {HTMLElement} stylingContainer The reference element of the widget
93
+ * @param {string} clientStylingUrl The URL of the style content
94
+ */
95
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
96
+ const url = new URL(clientStylingUrl);
97
+
98
+ fetch(url.href)
99
+ .then((res) => res.text())
100
+ .then((data) => {
101
+ const cssFile = document.createElement('style');
102
+ cssFile.innerHTML = data;
103
+ if (stylingContainer) {
104
+ stylingContainer.appendChild(cssFile);
105
+ }
106
+ })
107
+ .catch((err) => {
108
+ console.error('There was an error while trying to load client styling from URL', err);
109
+ });
110
+ }
111
+
112
+ /**
113
+ * @name setStreamLibrary
114
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
115
+ * @param {HTMLElement} stylingContainer The highest element of the widget
116
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
117
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
118
+ */
119
+ function setStreamStyling(stylingContainer, domain, subscription) {
120
+ if (window.emMessageBus) {
121
+ const sheet = document.createElement('style');
122
+
123
+ window.emMessageBus.subscribe(domain, (data) => {
124
+ sheet.innerHTML = data;
125
+ if (stylingContainer) {
126
+ stylingContainer.appendChild(sheet);
127
+ }
128
+ });
129
+ }
130
+ }
131
+
75
132
  const helperTabCss = ":host{display:block}.TabContent{font-size:14px;color:var(--emw--button-text-color, #000);font-weight:normal}";
76
133
  const HelperTabStyle0 = helperTabCss;
77
134
 
78
135
  const HelperTab = class {
79
136
  constructor(hostRef) {
80
137
  registerInstance(this, hostRef);
81
- this.setClientStyling = () => {
82
- let sheet = document.createElement('style');
83
- sheet.innerHTML = this.clientStyling;
84
- this.stylingContainer.prepend(sheet);
85
- };
86
- this.setClientStylingURL = () => {
87
- let cssFile = document.createElement('style');
88
- setTimeout(() => {
89
- cssFile.innerHTML = this.clientStylingUrlContent;
90
- this.stylingContainer.prepend(cssFile);
91
- }, 1);
92
- };
138
+ /**
139
+ * Selected index
140
+ */
93
141
  this.selectedIndex = 0;
94
- this.cmsEndpoint = undefined;
142
+ /**
143
+ * Client custom styling via string
144
+ */
95
145
  this.clientStyling = '';
96
- this.clientStylingUrlContent = '';
97
- this.lowNumber = undefined;
98
- this.highNumber = undefined;
99
- this.minimumAllowed = undefined;
100
- this.maxinumAllowed = undefined;
146
+ /**
147
+ * Client custom styling via url content
148
+ */
149
+ this.clientStylingUrl = '';
150
+ /**
151
+ * Language of the widget
152
+ */
101
153
  this.language = 'en';
102
- this.translationUrl = undefined;
103
154
  this.tabContent = '';
104
- this.limitStylingAppends = false;
155
+ }
156
+ handleClientStylingChange(newValue, oldValue) {
157
+ if (newValue != oldValue) {
158
+ setClientStyling(this.stylingContainer, this.clientStyling);
159
+ }
160
+ }
161
+ handleClientStylingChangeURL(newValue, oldValue) {
162
+ if (newValue != oldValue) {
163
+ if (this.clientStylingUrl)
164
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
165
+ }
166
+ }
167
+ componentDidLoad() {
168
+ if (this.stylingContainer) {
169
+ if (window.emMessageBus != undefined) {
170
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
171
+ }
172
+ else {
173
+ if (this.clientStyling)
174
+ setClientStyling(this.stylingContainer, this.clientStyling);
175
+ if (this.clientStylingUrl)
176
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
177
+ }
178
+ }
179
+ }
180
+ disconnectedCallback() {
181
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
105
182
  }
106
183
  componentWillLoad() {
107
184
  if (this.translationUrl) {
108
185
  getTranslations(JSON.parse(this.translationUrl));
109
186
  }
110
187
  }
111
- componentDidRender() {
112
- // start custom styling area
113
- if (!this.limitStylingAppends && this.stylingContainer) {
114
- if (this.clientStyling)
115
- this.setClientStyling();
116
- if (this.clientStylingUrlContent)
117
- this.setClientStylingURL();
118
- this.limitStylingAppends = true;
119
- }
120
- // end custom styling area
121
- }
122
188
  getHowToPlay() {
123
189
  if (this.lowNumber && this.highNumber && this.maxinumAllowed && this.minimumAllowed) {
124
190
  return translateWithParams('howToPlay', {
@@ -132,15 +198,19 @@ const HelperTab = class {
132
198
  return '';
133
199
  }
134
200
  render() {
135
- this.tabContent = h("div", { key: 'fc177f5bed7e46d51e953094b8cce0afa5f46a45', class: "TabContent", ref: el => this.stylingContainer = el }, this.getHowToPlay());
201
+ this.tabContent = h("div", { key: '92877a17361066f68fce6299cb8f65901f6abc60', class: "TabContent", ref: el => this.stylingContainer = el }, this.getHowToPlay());
136
202
  if (this.selectedIndex + 1 == 2) {
137
- 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))));
203
+ 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))));
138
204
  }
139
205
  else if (this.selectedIndex + 1 == 3) {
140
- 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))));
206
+ 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))));
141
207
  }
142
208
  return (this.tabContent);
143
209
  }
210
+ static get watchers() { return {
211
+ "clientStyling": ["handleClientStylingChange"],
212
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
213
+ }; }
144
214
  };
145
215
  HelperTab.style = HelperTabStyle0;
146
216
 
@@ -150,52 +220,76 @@ const HelperTabsStyle0 = helperTabsCss;
150
220
  const HelperTabs = class {
151
221
  constructor(hostRef) {
152
222
  registerInstance(this, hostRef);
153
- this.setClientStyling = () => {
154
- let sheet = document.createElement('style');
155
- sheet.innerHTML = this.clientStyling;
156
- this.stylingContainer.prepend(sheet);
157
- };
158
- this.setClientStylingURL = () => {
159
- let cssFile = document.createElement('style');
160
- setTimeout(() => {
161
- cssFile.innerHTML = this.clientStylingUrlContent;
162
- this.stylingContainer.prepend(cssFile);
163
- }, 1);
164
- };
223
+ /**
224
+ * Tell me if it is disabled
225
+ */
165
226
  this.disabled = false;
166
- this.label = undefined;
227
+ /**
228
+ * Tell me what tab is selected
229
+ */
167
230
  this.selected = false;
168
- this.cmsEndpoint = undefined;
231
+ /**
232
+ * Default selected index
233
+ */
169
234
  this.selectedIndex = 0;
235
+ /**
236
+ * Tabs details
237
+ */
170
238
  this.tabs = [{ label: 'How to Play' }, { label: 'About' }, { label: 'FAQs' }];
239
+ /**
240
+ * Client custom styling via string
241
+ */
171
242
  this.clientStyling = '';
243
+ /**
244
+ * Client custom styling via url
245
+ */
172
246
  this.clientStylingurl = '';
173
- this.clientStylingUrlContent = '';
174
- this.lowNumber = undefined;
175
- this.highNumber = undefined;
176
- this.minimumAllowed = undefined;
177
- this.maxinumAllowed = undefined;
247
+ /**
248
+ * Client custom styling via url content
249
+ */
250
+ this.clientStylingUrl = '';
251
+ /**
252
+ * Language
253
+ */
178
254
  this.language = 'en';
179
- this.translationUrl = undefined;
180
- this.limitStylingAppends = false;
181
255
  }
182
256
  connectedCallback() {
183
257
  }
184
- componentDidRender() {
185
- // start custom styling area
186
- if (!this.limitStylingAppends && this.stylingContainer) {
187
- this.setClientStyling();
188
- if (this.clientStylingUrlContent) {
189
- this.setClientStylingURL();
258
+ handleClientStylingChange(newValue, oldValue) {
259
+ if (newValue != oldValue) {
260
+ setClientStyling(this.stylingContainer, this.clientStyling);
261
+ }
262
+ }
263
+ handleClientStylingChangeURL(newValue, oldValue) {
264
+ if (newValue != oldValue) {
265
+ if (this.clientStylingUrl)
266
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
267
+ }
268
+ }
269
+ componentDidLoad() {
270
+ if (this.stylingContainer) {
271
+ if (window.emMessageBus != undefined) {
272
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
273
+ }
274
+ else {
275
+ if (this.clientStyling)
276
+ setClientStyling(this.stylingContainer, this.clientStyling);
277
+ if (this.clientStylingUrl)
278
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
190
279
  }
191
- this.limitStylingAppends = true;
192
280
  }
193
- // end custom styling area
281
+ }
282
+ disconnectedCallback() {
283
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
194
284
  }
195
285
  render() {
196
- return (h("div", { key: '4c75878234d57bf5e9a82ee926252bce3ba90b0f', ref: el => this.stylingContainer = el }, h("div", { key: '95faa7cc214b9dd96a1daacf36f1d637a8624e90', class: "Tabs" }, this.tabs.map((tab, index) => h("button", { class: 'TabButton' + (this.selectedIndex == index ? ' Active' : ''), onClick: () => this.selectedIndex = index }, tab.label))), h("div", { key: '787ecacb0c26b0712b9ebef99ff7be68d1eb4231' }, 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 }))));
286
+ return (h("div", { key: '173c4774748482dc56fcffb4bac4e1666fa9170f', ref: el => this.stylingContainer = el }, h("div", { key: '680b65218e4b00f134b354f593c0c20fb5882dca', class: "Tabs" }, this.tabs.map((tab, index) => h("button", { class: 'TabButton' + (this.selectedIndex == index ? ' Active' : ''), onClick: () => this.selectedIndex = index }, tab.label))), h("div", { key: '67aa26c92fb416c5d0934988fb071481f805685b' }, 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 }))));
197
287
  }
198
288
  get host() { return getElement(this); }
289
+ static get watchers() { return {
290
+ "clientStyling": ["handleClientStylingChange"],
291
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
292
+ }; }
199
293
  };
200
294
  HelperTabs.style = HelperTabsStyle0;
201
295
 
@@ -1,9 +1,9 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-55376e55.js';
2
- export { s as setNonce } from './index-55376e55.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-c5727b52.js';
2
+ export { s as setNonce } from './index-c5727b52.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v4.22.3 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v4.26.0 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
  var patchBrowser = () => {
9
9
  const importMeta = import.meta.url;
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["helper-tab_2",[[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);
19
+ return bootstrapLazy([["helper-tab_2",[[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);
20
20
  });