@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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d8f4ee8c.js');
5
+ const index = require('./index-08bd9c7c.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
8
  const SUPPORTED_LANGUAGES = ['en'];
@@ -76,53 +76,119 @@ 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
 
82
139
  const HelperTab = class {
83
140
  constructor(hostRef) {
84
141
  index.registerInstance(this, hostRef);
85
- this.setClientStyling = () => {
86
- let sheet = document.createElement('style');
87
- sheet.innerHTML = this.clientStyling;
88
- this.stylingContainer.prepend(sheet);
89
- };
90
- this.setClientStylingURL = () => {
91
- let cssFile = document.createElement('style');
92
- setTimeout(() => {
93
- cssFile.innerHTML = this.clientStylingUrlContent;
94
- this.stylingContainer.prepend(cssFile);
95
- }, 1);
96
- };
142
+ /**
143
+ * Selected index
144
+ */
97
145
  this.selectedIndex = 0;
98
- this.cmsEndpoint = undefined;
146
+ /**
147
+ * Client custom styling via string
148
+ */
99
149
  this.clientStyling = '';
100
- this.clientStylingUrlContent = '';
101
- this.lowNumber = undefined;
102
- this.highNumber = undefined;
103
- this.minimumAllowed = undefined;
104
- this.maxinumAllowed = undefined;
150
+ /**
151
+ * Client custom styling via url content
152
+ */
153
+ this.clientStylingUrl = '';
154
+ /**
155
+ * Language of the widget
156
+ */
105
157
  this.language = 'en';
106
- this.translationUrl = undefined;
107
158
  this.tabContent = '';
108
- this.limitStylingAppends = false;
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();
109
186
  }
110
187
  componentWillLoad() {
111
188
  if (this.translationUrl) {
112
189
  getTranslations(JSON.parse(this.translationUrl));
113
190
  }
114
191
  }
115
- componentDidRender() {
116
- // start custom styling area
117
- if (!this.limitStylingAppends && this.stylingContainer) {
118
- if (this.clientStyling)
119
- this.setClientStyling();
120
- if (this.clientStylingUrlContent)
121
- this.setClientStylingURL();
122
- this.limitStylingAppends = true;
123
- }
124
- // end custom styling area
125
- }
126
192
  getHowToPlay() {
127
193
  if (this.lowNumber && this.highNumber && this.maxinumAllowed && this.minimumAllowed) {
128
194
  return translateWithParams('howToPlay', {
@@ -136,15 +202,19 @@ const HelperTab = class {
136
202
  return '';
137
203
  }
138
204
  render() {
139
- 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());
140
206
  if (this.selectedIndex + 1 == 2) {
141
- 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))));
142
208
  }
143
209
  else if (this.selectedIndex + 1 == 3) {
144
- 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))));
145
211
  }
146
212
  return (this.tabContent);
147
213
  }
214
+ static get watchers() { return {
215
+ "clientStyling": ["handleClientStylingChange"],
216
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
217
+ }; }
148
218
  };
149
219
  HelperTab.style = HelperTabStyle0;
150
220
 
@@ -154,52 +224,76 @@ const HelperTabsStyle0 = helperTabsCss;
154
224
  const HelperTabs = class {
155
225
  constructor(hostRef) {
156
226
  index.registerInstance(this, hostRef);
157
- this.setClientStyling = () => {
158
- let sheet = document.createElement('style');
159
- sheet.innerHTML = this.clientStyling;
160
- this.stylingContainer.prepend(sheet);
161
- };
162
- this.setClientStylingURL = () => {
163
- let cssFile = document.createElement('style');
164
- setTimeout(() => {
165
- cssFile.innerHTML = this.clientStylingUrlContent;
166
- this.stylingContainer.prepend(cssFile);
167
- }, 1);
168
- };
227
+ /**
228
+ * Tell me if it is disabled
229
+ */
169
230
  this.disabled = false;
170
- this.label = undefined;
231
+ /**
232
+ * Tell me what tab is selected
233
+ */
171
234
  this.selected = false;
172
- this.cmsEndpoint = undefined;
235
+ /**
236
+ * Default selected index
237
+ */
173
238
  this.selectedIndex = 0;
239
+ /**
240
+ * Tabs details
241
+ */
174
242
  this.tabs = [{ label: 'How to Play' }, { label: 'About' }, { label: 'FAQs' }];
243
+ /**
244
+ * Client custom styling via string
245
+ */
175
246
  this.clientStyling = '';
247
+ /**
248
+ * Client custom styling via url
249
+ */
176
250
  this.clientStylingurl = '';
177
- this.clientStylingUrlContent = '';
178
- this.lowNumber = undefined;
179
- this.highNumber = undefined;
180
- this.minimumAllowed = undefined;
181
- this.maxinumAllowed = undefined;
251
+ /**
252
+ * Client custom styling via url content
253
+ */
254
+ this.clientStylingUrl = '';
255
+ /**
256
+ * Language
257
+ */
182
258
  this.language = 'en';
183
- this.translationUrl = undefined;
184
- this.limitStylingAppends = false;
185
259
  }
186
260
  connectedCallback() {
187
261
  }
188
- componentDidRender() {
189
- // start custom styling area
190
- if (!this.limitStylingAppends && this.stylingContainer) {
191
- this.setClientStyling();
192
- if (this.clientStylingUrlContent) {
193
- 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);
194
283
  }
195
- this.limitStylingAppends = true;
196
284
  }
197
- // end custom styling area
285
+ }
286
+ disconnectedCallback() {
287
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
198
288
  }
199
289
  render() {
200
- 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 }))));
201
291
  }
202
292
  get host() { return index.getElement(this); }
293
+ static get watchers() { return {
294
+ "clientStyling": ["handleClientStylingChange"],
295
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
296
+ }; }
203
297
  };
204
298
  HelperTabs.style = HelperTabsStyle0;
205
299
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d8f4ee8c.js');
5
+ const index = require('./index-08bd9c7c.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
9
- Stencil Client Patch Browser v4.22.3 | MIT Licensed | https://stenciljs.com
9
+ Stencil Client Patch Browser v4.26.0 | MIT Licensed | https://stenciljs.com
10
10
  */
11
11
  var patchBrowser = () => {
12
12
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('helper-tabs.cjs.js', document.baseURI).href));
@@ -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;