@everymatrix/lottery-game-details 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 (24) hide show
  1. package/dist/cjs/helper-accordion_4.cjs.entry.js +220 -88
  2. package/dist/cjs/{index-e12a9319.js → index-099339a6.js} +208 -73
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/lottery-game-details.cjs.js +3 -3
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/components/lottery-game-details/lottery-game-details.js +29 -9
  7. package/dist/esm/helper-accordion_4.entry.js +220 -88
  8. package/dist/esm/{index-58f248b6.js → index-ec9ae966.js} +208 -73
  9. package/dist/esm/loader.js +3 -3
  10. package/dist/esm/lottery-game-details.js +4 -4
  11. package/dist/lottery-game-details/lottery-game-details.esm.js +1 -1
  12. package/dist/lottery-game-details/p-1cd44e8d.js +2 -0
  13. package/dist/lottery-game-details/p-65d99443.entry.js +1 -0
  14. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/lottery-game-details/.stencil/packages/stencil/lottery-game-details/stencil.config.d.ts +2 -0
  15. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/lottery-game-details/.stencil/packages/stencil/lottery-game-details/stencil.config.dev.d.ts +2 -0
  16. package/package.json +1 -1
  17. package/dist/lottery-game-details/p-06c7e531.entry.js +0 -1
  18. package/dist/lottery-game-details/p-eef0a9e5.js +0 -2
  19. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/lottery-game-details/.stencil/packages/stencil/lottery-game-details/stencil.config.d.ts +0 -2
  20. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/lottery-game-details/.stencil/packages/stencil/lottery-game-details/stencil.config.dev.d.ts +0 -2
  21. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/lottery-game-details/.stencil/tools/plugins/index.d.ts +0 -0
  22. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/lottery-game-details/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  23. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/lottery-game-details/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  24. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/lottery-game-details/.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-e12a9319.js');
5
+ const index = require('./index-099339a6.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE$1 = 'en';
8
8
  const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'hr'];
@@ -42,33 +42,67 @@ const HelperAccordion = class {
42
42
  constructor(hostRef) {
43
43
  index.registerInstance(this, hostRef);
44
44
  this.accordionEvent = index.createEvent(this, "helperAccordionAction", 7);
45
- this.setClientStyling = () => {
46
- let sheet = document.createElement('style');
47
- sheet.innerHTML = this.clientStyling;
48
- this.stylingContainer.prepend(sheet);
49
- };
50
- this.setClientStylingURL = () => {
51
- let cssFile = document.createElement('style');
52
- setTimeout(() => {
53
- cssFile.innerHTML = this.clientStylingUrlContent;
54
- this.stylingContainer.prepend(cssFile);
55
- }, 1);
56
- };
45
+ /**
46
+ * Flag for ticket history
47
+ */
57
48
  this.ticketHistoryFlag = false;
49
+ /**
50
+ * Title (top header)
51
+ */
58
52
  this.headerTitle = '';
53
+ /**
54
+ * SubTitle (top header)
55
+ */
59
56
  this.headerSubtitle = '';
57
+ /**
58
+ * Description
59
+ */
60
60
  this.description = '';
61
+ /**
62
+ * Enables footer content
63
+ */
61
64
  this.footer = false;
65
+ /**
66
+ * Enables footer button for tab deletion
67
+ */
62
68
  this.deleteTab = false;
69
+ /**
70
+ * Activates postMessages as events for actions from the widget
71
+ */
63
72
  this.postMessage = false;
73
+ /**
74
+ * Name of the event emitter by the action button
75
+ */
64
76
  this.eventName = 'helperAccordionAction';
77
+ /**
78
+ * Collapsed
79
+ */
65
80
  this.collapsed = true;
81
+ /**
82
+ * Language
83
+ */
66
84
  this.language = 'en';
85
+ /**
86
+ * Client custom styling via string
87
+ */
67
88
  this.clientStyling = '';
89
+ /**
90
+ * Client custom styling via url content
91
+ */
68
92
  this.clientStylingUrlContent = '';
69
- this.translationUrl = undefined;
70
- this.showContent = undefined;
71
93
  this.limitStylingAppends = false;
94
+ this.setClientStyling = () => {
95
+ let sheet = document.createElement('style');
96
+ sheet.innerHTML = this.clientStyling;
97
+ this.stylingContainer.prepend(sheet);
98
+ };
99
+ this.setClientStylingURL = () => {
100
+ let cssFile = document.createElement('style');
101
+ setTimeout(() => {
102
+ cssFile.innerHTML = this.clientStylingUrlContent;
103
+ this.stylingContainer.prepend(cssFile);
104
+ }, 1);
105
+ };
72
106
  }
73
107
  // @TODO fix the `any` type :)
74
108
  connectedCallback() {
@@ -181,53 +215,119 @@ const getTranslations = (data) => {
181
215
  });
182
216
  };
183
217
 
218
+ /**
219
+ * @name setClientStyling
220
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
221
+ * @param {HTMLElement} stylingContainer The reference element of the widget
222
+ * @param {string} clientStyling The style content
223
+ */
224
+ function setClientStyling(stylingContainer, clientStyling) {
225
+ if (stylingContainer) {
226
+ const sheet = document.createElement('style');
227
+ sheet.innerHTML = clientStyling;
228
+ stylingContainer.appendChild(sheet);
229
+ }
230
+ }
231
+
232
+ /**
233
+ * @name setClientStylingURL
234
+ * @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
235
+ * @param {HTMLElement} stylingContainer The reference element of the widget
236
+ * @param {string} clientStylingUrl The URL of the style content
237
+ */
238
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
239
+ const url = new URL(clientStylingUrl);
240
+
241
+ fetch(url.href)
242
+ .then((res) => res.text())
243
+ .then((data) => {
244
+ const cssFile = document.createElement('style');
245
+ cssFile.innerHTML = data;
246
+ if (stylingContainer) {
247
+ stylingContainer.appendChild(cssFile);
248
+ }
249
+ })
250
+ .catch((err) => {
251
+ console.error('There was an error while trying to load client styling from URL', err);
252
+ });
253
+ }
254
+
255
+ /**
256
+ * @name setStreamLibrary
257
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
258
+ * @param {HTMLElement} stylingContainer The highest element of the widget
259
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
260
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
261
+ */
262
+ function setStreamStyling(stylingContainer, domain, subscription) {
263
+ if (window.emMessageBus) {
264
+ const sheet = document.createElement('style');
265
+
266
+ window.emMessageBus.subscribe(domain, (data) => {
267
+ sheet.innerHTML = data;
268
+ if (stylingContainer) {
269
+ stylingContainer.appendChild(sheet);
270
+ }
271
+ });
272
+ }
273
+ }
274
+
184
275
  const helperTabCss = ":host{display:block}.TabContent{font-size:14px;color:var(--emw--button-text-color, #000);font-weight:normal}";
185
276
  const HelperTabStyle0 = helperTabCss;
186
277
 
187
278
  const HelperTab = class {
188
279
  constructor(hostRef) {
189
280
  index.registerInstance(this, hostRef);
190
- this.setClientStyling = () => {
191
- let sheet = document.createElement('style');
192
- sheet.innerHTML = this.clientStyling;
193
- this.stylingContainer.prepend(sheet);
194
- };
195
- this.setClientStylingURL = () => {
196
- let cssFile = document.createElement('style');
197
- setTimeout(() => {
198
- cssFile.innerHTML = this.clientStylingUrlContent;
199
- this.stylingContainer.prepend(cssFile);
200
- }, 1);
201
- };
281
+ /**
282
+ * Selected index
283
+ */
202
284
  this.selectedIndex = 0;
203
- this.cmsEndpoint = undefined;
285
+ /**
286
+ * Client custom styling via string
287
+ */
204
288
  this.clientStyling = '';
205
- this.clientStylingUrlContent = '';
206
- this.lowNumber = undefined;
207
- this.highNumber = undefined;
208
- this.minimumAllowed = undefined;
209
- this.maxinumAllowed = undefined;
289
+ /**
290
+ * Client custom styling via url content
291
+ */
292
+ this.clientStylingUrl = '';
293
+ /**
294
+ * Language of the widget
295
+ */
210
296
  this.language = 'en';
211
- this.translationUrl = undefined;
212
297
  this.tabContent = '';
213
- this.limitStylingAppends = false;
298
+ }
299
+ handleClientStylingChange(newValue, oldValue) {
300
+ if (newValue != oldValue) {
301
+ setClientStyling(this.stylingContainer, this.clientStyling);
302
+ }
303
+ }
304
+ handleClientStylingChangeURL(newValue, oldValue) {
305
+ if (newValue != oldValue) {
306
+ if (this.clientStylingUrl)
307
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
308
+ }
309
+ }
310
+ componentDidLoad() {
311
+ if (this.stylingContainer) {
312
+ if (window.emMessageBus != undefined) {
313
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
314
+ }
315
+ else {
316
+ if (this.clientStyling)
317
+ setClientStyling(this.stylingContainer, this.clientStyling);
318
+ if (this.clientStylingUrl)
319
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
320
+ }
321
+ }
322
+ }
323
+ disconnectedCallback() {
324
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
214
325
  }
215
326
  componentWillLoad() {
216
327
  if (this.translationUrl) {
217
328
  getTranslations(JSON.parse(this.translationUrl));
218
329
  }
219
330
  }
220
- componentDidRender() {
221
- // start custom styling area
222
- if (!this.limitStylingAppends && this.stylingContainer) {
223
- if (this.clientStyling)
224
- this.setClientStyling();
225
- if (this.clientStylingUrlContent)
226
- this.setClientStylingURL();
227
- this.limitStylingAppends = true;
228
- }
229
- // end custom styling area
230
- }
231
331
  getHowToPlay() {
232
332
  if (this.lowNumber && this.highNumber && this.maxinumAllowed && this.minimumAllowed) {
233
333
  return translateWithParams('howToPlay', {
@@ -241,15 +341,19 @@ const HelperTab = class {
241
341
  return '';
242
342
  }
243
343
  render() {
244
- this.tabContent = index.h("div", { key: 'fc177f5bed7e46d51e953094b8cce0afa5f46a45', class: "TabContent", ref: el => this.stylingContainer = el }, this.getHowToPlay());
344
+ this.tabContent = index.h("div", { key: '92877a17361066f68fce6299cb8f65901f6abc60', class: "TabContent", ref: el => this.stylingContainer = el }, this.getHowToPlay());
245
345
  if (this.selectedIndex + 1 == 2) {
246
- 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))));
346
+ 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))));
247
347
  }
248
348
  else if (this.selectedIndex + 1 == 3) {
249
- 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))));
349
+ 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))));
250
350
  }
251
351
  return (this.tabContent);
252
352
  }
353
+ static get watchers() { return {
354
+ "clientStyling": ["handleClientStylingChange"],
355
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
356
+ }; }
253
357
  };
254
358
  HelperTab.style = HelperTabStyle0;
255
359
 
@@ -259,52 +363,76 @@ const HelperTabsStyle0 = helperTabsCss;
259
363
  const HelperTabs = class {
260
364
  constructor(hostRef) {
261
365
  index.registerInstance(this, hostRef);
262
- this.setClientStyling = () => {
263
- let sheet = document.createElement('style');
264
- sheet.innerHTML = this.clientStyling;
265
- this.stylingContainer.prepend(sheet);
266
- };
267
- this.setClientStylingURL = () => {
268
- let cssFile = document.createElement('style');
269
- setTimeout(() => {
270
- cssFile.innerHTML = this.clientStylingUrlContent;
271
- this.stylingContainer.prepend(cssFile);
272
- }, 1);
273
- };
366
+ /**
367
+ * Tell me if it is disabled
368
+ */
274
369
  this.disabled = false;
275
- this.label = undefined;
370
+ /**
371
+ * Tell me what tab is selected
372
+ */
276
373
  this.selected = false;
277
- this.cmsEndpoint = undefined;
374
+ /**
375
+ * Default selected index
376
+ */
278
377
  this.selectedIndex = 0;
378
+ /**
379
+ * Tabs details
380
+ */
279
381
  this.tabs = [{ label: 'How to Play' }, { label: 'About' }, { label: 'FAQs' }];
382
+ /**
383
+ * Client custom styling via string
384
+ */
280
385
  this.clientStyling = '';
386
+ /**
387
+ * Client custom styling via url
388
+ */
281
389
  this.clientStylingurl = '';
282
- this.clientStylingUrlContent = '';
283
- this.lowNumber = undefined;
284
- this.highNumber = undefined;
285
- this.minimumAllowed = undefined;
286
- this.maxinumAllowed = undefined;
390
+ /**
391
+ * Client custom styling via url content
392
+ */
393
+ this.clientStylingUrl = '';
394
+ /**
395
+ * Language
396
+ */
287
397
  this.language = 'en';
288
- this.translationUrl = undefined;
289
- this.limitStylingAppends = false;
290
398
  }
291
399
  connectedCallback() {
292
400
  }
293
- componentDidRender() {
294
- // start custom styling area
295
- if (!this.limitStylingAppends && this.stylingContainer) {
296
- this.setClientStyling();
297
- if (this.clientStylingUrlContent) {
298
- this.setClientStylingURL();
401
+ handleClientStylingChange(newValue, oldValue) {
402
+ if (newValue != oldValue) {
403
+ setClientStyling(this.stylingContainer, this.clientStyling);
404
+ }
405
+ }
406
+ handleClientStylingChangeURL(newValue, oldValue) {
407
+ if (newValue != oldValue) {
408
+ if (this.clientStylingUrl)
409
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
410
+ }
411
+ }
412
+ componentDidLoad() {
413
+ if (this.stylingContainer) {
414
+ if (window.emMessageBus != undefined) {
415
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
416
+ }
417
+ else {
418
+ if (this.clientStyling)
419
+ setClientStyling(this.stylingContainer, this.clientStyling);
420
+ if (this.clientStylingUrl)
421
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
299
422
  }
300
- this.limitStylingAppends = true;
301
423
  }
302
- // end custom styling area
424
+ }
425
+ disconnectedCallback() {
426
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
303
427
  }
304
428
  render() {
305
- 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 }))));
429
+ 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 }))));
306
430
  }
307
431
  get host() { return index.getElement(this); }
432
+ static get watchers() { return {
433
+ "clientStyling": ["handleClientStylingChange"],
434
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
435
+ }; }
308
436
  };
309
437
  HelperTabs.style = HelperTabsStyle0;
310
438
 
@@ -314,6 +442,19 @@ const LotteryGameDetailsStyle0 = lotteryGameDetailsCss;
314
442
  const LotteryGameDetails = class {
315
443
  constructor(hostRef) {
316
444
  index.registerInstance(this, hostRef);
445
+ /**
446
+ * Client custom styling via string
447
+ */
448
+ this.clientStyling = '';
449
+ /**
450
+ * Client custom styling via url content
451
+ */
452
+ this.clientStylingUrlContent = '';
453
+ /**
454
+ * Language
455
+ */
456
+ this.language = 'en';
457
+ this.limitStylingAppends = false;
317
458
  this.setClientStyling = () => {
318
459
  let sheet = document.createElement('style');
319
460
  sheet.innerHTML = this.clientStyling;
@@ -326,15 +467,6 @@ const LotteryGameDetails = class {
326
467
  this.stylingContainer.prepend(cssFile);
327
468
  }, 1);
328
469
  };
329
- this.clientStyling = '';
330
- this.clientStylingUrlContent = '';
331
- this.lowNumber = undefined;
332
- this.highNumber = undefined;
333
- this.minimumAllowed = undefined;
334
- this.maxinumAllowed = undefined;
335
- this.language = 'en';
336
- this.translationUrl = undefined;
337
- this.limitStylingAppends = false;
338
470
  }
339
471
  componentDidRender() {
340
472
  // start custom styling area