@everymatrix/lottery-game-page 0.0.9 → 0.0.13

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 (55) hide show
  1. package/dist/cjs/helper-accordion.cjs.entry.js +88 -0
  2. package/dist/cjs/{helper-accordion_13.cjs.entry.js → helper-filters_2.cjs.entry.js} +21 -1023
  3. package/dist/cjs/helper-modal.cjs.entry.js +44 -0
  4. package/dist/cjs/helper-tab.cjs.entry.js +33 -0
  5. package/dist/cjs/helper-tabs.cjs.entry.js +38 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/lottery-bullet_2.cjs.entry.js +202 -0
  8. package/dist/cjs/lottery-draw-results-history.cjs.entry.js +124 -0
  9. package/dist/cjs/lottery-game-details.cjs.entry.js +19 -0
  10. package/dist/cjs/lottery-game-page.cjs.entry.js +299 -0
  11. package/dist/cjs/lottery-game-page.cjs.js +1 -1
  12. package/dist/cjs/lottery-ticket-controller.cjs.entry.js +69 -0
  13. package/dist/cjs/lottery-ticket.cjs.entry.js +146 -0
  14. package/dist/collection/collection-manifest.json +7 -1
  15. package/dist/components/helper-accordion2.js +1 -0
  16. package/dist/components/helper-filters2.js +1 -0
  17. package/dist/components/helper-modal2.js +1 -0
  18. package/dist/components/helper-pagination.js +1 -0
  19. package/dist/components/helper-tab2.js +1 -0
  20. package/dist/components/helper-tabs2.js +1 -0
  21. package/dist/components/lottery-bullet2.js +1 -0
  22. package/dist/components/lottery-draw-results-history2.js +1 -0
  23. package/dist/components/lottery-draw-results2.js +1 -0
  24. package/dist/components/lottery-game-details2.js +1 -0
  25. package/dist/components/lottery-game-page.js +1 -0
  26. package/dist/components/lottery-grid2.js +1 -0
  27. package/dist/components/lottery-ticket-controller2.js +1 -0
  28. package/dist/components/lottery-ticket2.js +1 -0
  29. package/dist/esm/helper-accordion.entry.js +84 -0
  30. package/dist/esm/{helper-accordion_13.entry.js → helper-filters_2.entry.js} +23 -1014
  31. package/dist/esm/helper-modal.entry.js +40 -0
  32. package/dist/esm/helper-tab.entry.js +29 -0
  33. package/dist/esm/helper-tabs.entry.js +34 -0
  34. package/dist/esm/loader.js +1 -1
  35. package/dist/esm/lottery-bullet_2.entry.js +197 -0
  36. package/dist/esm/lottery-draw-results-history.entry.js +120 -0
  37. package/dist/esm/lottery-game-details.entry.js +15 -0
  38. package/dist/esm/lottery-game-page.entry.js +295 -0
  39. package/dist/esm/lottery-game-page.js +1 -1
  40. package/dist/esm/lottery-ticket-controller.entry.js +65 -0
  41. package/dist/esm/lottery-ticket.entry.js +142 -0
  42. package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
  43. package/dist/lottery-game-page/p-010895a3.entry.js +1 -0
  44. package/dist/lottery-game-page/p-09f983c6.entry.js +1 -0
  45. package/dist/lottery-game-page/p-0c7ada78.entry.js +1 -0
  46. package/dist/lottery-game-page/p-2932d2a7.entry.js +1 -0
  47. package/dist/lottery-game-page/p-48831184.entry.js +1 -0
  48. package/dist/lottery-game-page/p-50298d2c.entry.js +1 -0
  49. package/dist/lottery-game-page/p-6736fa79.entry.js +1 -0
  50. package/dist/lottery-game-page/p-88f81126.entry.js +1 -0
  51. package/dist/lottery-game-page/{p-49bd2864.entry.js → p-95b37270.entry.js} +105 -105
  52. package/dist/lottery-game-page/p-a1dd3eb2.entry.js +1 -0
  53. package/dist/lottery-game-page/p-caf09eaf.entry.js +1 -0
  54. package/dist/stencil.config.js +9 -5
  55. package/package.json +1 -1
@@ -1,89 +1,8 @@
1
- import { r as registerInstance, c as createEvent, h as h$2, g as getElement } from './index-be84da79.js';
1
+ import { r as registerInstance, c as createEvent, h as h$2 } from './index-be84da79.js';
2
2
 
3
- const DEFAULT_LANGUAGE$5 = 'en';
4
- const SUPPORTED_LANGUAGES$5 = ['ro', 'en'];
5
- const TRANSLATIONS$5 = {
6
- en: {
7
- deleteTicket: 'Delete ticket'
8
- },
9
- ro: {
10
- deleteTicket: 'Sterge biletul'
11
- },
12
- };
13
- const translate$6 = (key, customLang) => {
14
- const lang = customLang;
15
- return TRANSLATIONS$5[lang !== undefined && SUPPORTED_LANGUAGES$5.includes(lang) ? lang : DEFAULT_LANGUAGE$5][key];
16
- };
17
-
18
- const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:4px;margin-bottom:1px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{border-radius:4px;margin-top:10px;cursor:pointer;text-transform:capitalize;display:block;font-size:12px;text-align:center;padding:8px 20px;width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
19
-
20
- const Accordion = class {
21
- constructor(hostRef) {
22
- registerInstance(this, hostRef);
23
- this.accordionEvent = createEvent(this, "helperAccordionAction", 7);
24
- /**
25
- * Title (top header)
26
- */
27
- this.headerTitle = '';
28
- /**
29
- * SubTitle (top header)
30
- */
31
- this.headerSubtitle = '';
32
- /**
33
- * Description
34
- */
35
- this.description = '';
36
- /**
37
- * Enables footer content
38
- */
39
- this.footer = false;
40
- /**
41
- * Enables footer button for tab deletion
42
- */
43
- this.deleteTab = false;
44
- /**
45
- * Activates postMessages as events for actions from the widget
46
- */
47
- this.postMessage = false;
48
- /**
49
- * Name of the event emitter by the action button
50
- */
51
- this.eventName = 'helperAccordionAction';
52
- /**
53
- * Collapsed
54
- */
55
- this.collapsed = true;
56
- /**
57
- * Language
58
- */
59
- this.language = 'en';
60
- }
61
- // @TODO fix the `any` type :)
62
- connectedCallback() {
63
- this.showContent = !this.collapsed;
64
- }
65
- toggleContent() {
66
- this.showContent = !this.showContent;
67
- }
68
- deleteAction() {
69
- if (this.postMessage) {
70
- // @TODO maybe change the name type, this one sucks
71
- window.postMessage({ type: this.eventName }, window.location.href);
72
- }
73
- this.accordionEvent.emit();
74
- }
75
- render() {
76
- return (h$2("div", { class: "Wrapper" }, h$2("div", { class: "Header" }, h$2("p", { class: "Title" }, this.headerTitle), h$2("p", { class: "Subtitle" }, this.headerSubtitle), h$2("p", { class: "Subtitle" }, this.description), h$2("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
77
- h$2("div", null, h$2("div", { class: "Content" }, h$2("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
78
- h$2("div", null, this.deleteTab &&
79
- h$2("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate$6('deleteTicket', this.language)))))));
80
- }
81
- };
82
- Accordion.style = helperAccordionCss;
83
-
84
- const DEFAULT_LANGUAGE$4 = 'en';
85
- const SUPPORTED_LANGUAGES$4 = ['ro', 'en'];
86
- const TRANSLATIONS$4 = {
3
+ const DEFAULT_LANGUAGE$1 = 'en';
4
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
5
+ const TRANSLATIONS$1 = {
87
6
  en: {
88
7
  filterOpen: 'Filter',
89
8
  filterClear: 'Clear',
@@ -107,9 +26,9 @@ const TRANSLATIONS$4 = {
107
26
  filterModalButton: 'Cauta'
108
27
  },
109
28
  };
110
- const translate$5 = (key, customLang) => {
29
+ const translate$2 = (key, customLang) => {
111
30
  const lang = customLang;
112
- return TRANSLATIONS$4[lang !== undefined && SUPPORTED_LANGUAGES$4.includes(lang) ? lang : DEFAULT_LANGUAGE$4][key];
31
+ return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
113
32
  };
114
33
 
115
34
  /**
@@ -1798,7 +1717,7 @@ function isDescendant(base, path) {
1798
1717
  * @param {string} path Path to translate
1799
1718
  * @return {string} Translated string
1800
1719
  */
1801
- function translate$4(base, newBase, path) {
1720
+ function translate$1(base, newBase, path) {
1802
1721
  return newBase + path.slice(base.length);
1803
1722
  }
1804
1723
 
@@ -3999,7 +3918,7 @@ function handleNotification(event, inst, fromProp, toPath, negate) {
3999
3918
  let detail = /** @type {Object} */(event.detail);
4000
3919
  let fromPath = detail && detail.path;
4001
3920
  if (fromPath) {
4002
- toPath = translate$4(fromProp, toPath, fromPath);
3921
+ toPath = translate$1(fromProp, toPath, fromPath);
4003
3922
  value = detail && detail.value;
4004
3923
  } else {
4005
3924
  value = event.currentTarget[fromProp];
@@ -4285,10 +4204,10 @@ function computeLinkedPaths(inst, path, value) {
4285
4204
  for (let a in links) {
4286
4205
  let b = links[a];
4287
4206
  if (isDescendant(a, path)) {
4288
- link = translate$4(a, b, path);
4207
+ link = translate$1(a, b, path);
4289
4208
  inst._setPendingPropertyOrPath(link, value, true, true);
4290
4209
  } else if (isDescendant(b, path)) {
4291
- link = translate$4(b, a, path);
4210
+ link = translate$1(b, a, path);
4292
4211
  inst._setPendingPropertyOrPath(link, value, true, true);
4293
4212
  }
4294
4213
  }
@@ -4400,7 +4319,7 @@ function runBindingEffect(inst, path, props, oldProps, info, hasPaths, nodeList)
4400
4319
  node.__isPropertyEffectsClient &&
4401
4320
  node.__dataHasAccessor && node.__dataHasAccessor[binding.target]) {
4402
4321
  let value = props[path];
4403
- path = translate$4(part.source, binding.target, path);
4322
+ path = translate$1(part.source, binding.target, path);
4404
4323
  if (node._setPendingPropertyOrPath(path, value, false, true)) {
4405
4324
  inst._enqueueClient(node);
4406
4325
  }
@@ -16428,7 +16347,7 @@ class DomRepeat extends domRepeatBase {
16428
16347
  if (prop == this.as) {
16429
16348
  this.items[idx] = value;
16430
16349
  }
16431
- let path = translate$4(this.as, `${JSCompiler_renameProperty('items', this)}.${idx}`, prop);
16350
+ let path = translate$1(this.as, `${JSCompiler_renameProperty('items', this)}.${idx}`, prop);
16432
16351
  this.notifyPath(path, value);
16433
16352
  }
16434
16353
  }
@@ -22387,142 +22306,14 @@ const HelperFilters = class {
22387
22306
  this.filterData.filterToCalendar = new Date(event.target.value).toISOString();
22388
22307
  }
22389
22308
  render() {
22390
- return (h$2("div", { class: "HelperFilters" }, h$2("div", { class: "FilterButtonsWrapper" }, h$2("button", { class: "FilterOpen", onClick: () => this.toggleFilterModal() }, translate$5('filterOpen', this.language)), this.showClearButton ? h$2("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate$5('filterClear', this.language)) : null), h$2("helper-modal", { "title-modal": "Filter Modal", visible: this.showFilterModal }, h$2("div", { class: "FilterModalHeader" }, h$2("h3", { class: "FilterModalTitle" }, this.activateTicketSearch ? translate$5('filterModalTicketTitle', this.language) : translate$5('filterModalDrawTitle', this.language))), h$2("div", { class: "FilterModalBody" }, h$2("input", { type: "text", value: this.filterData.drawTicketId, onInput: (event) => this.handleDrawTicketId(event), class: "FilterModalSearch", placeholder: this.activateTicketSearch ? translate$5('filterTicketPlaceholder', this.language) : translate$5('filterDrawPlaceholder', this.language) }), h$2("div", { class: "FilterCalendarWrapper" }, h$2("vaadin-date-picker", { value: this.filterData.filterFromCalendar, onChange: (event) => this.handleFilterFrom(event), placeholder: translate$5('filterFromCalendar', this.language), class: "VaadinDatePicker" }), h$2("vaadin-date-picker", { value: this.filterData.filterToCalendar, onChange: (event) => this.handleFilterTo(event), placeholder: translate$5('filterToCalendar', this.language), class: "VaadinDatePicker" }))), h$2("div", { class: "FilterModalFooter" }, h$2("button", { class: "FilterModalButton", onClick: () => this.filterSearch() }, translate$5('filterModalButton', this.language))))));
22309
+ return (h$2("div", { class: "HelperFilters" }, h$2("div", { class: "FilterButtonsWrapper" }, h$2("button", { class: "FilterOpen", onClick: () => this.toggleFilterModal() }, translate$2('filterOpen', this.language)), this.showClearButton ? h$2("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate$2('filterClear', this.language)) : null), h$2("helper-modal", { "title-modal": "Filter Modal", visible: this.showFilterModal }, h$2("div", { class: "FilterModalHeader" }, h$2("h3", { class: "FilterModalTitle" }, this.activateTicketSearch ? translate$2('filterModalTicketTitle', this.language) : translate$2('filterModalDrawTitle', this.language))), h$2("div", { class: "FilterModalBody" }, h$2("input", { type: "text", value: this.filterData.drawTicketId, onInput: (event) => this.handleDrawTicketId(event), class: "FilterModalSearch", placeholder: this.activateTicketSearch ? translate$2('filterTicketPlaceholder', this.language) : translate$2('filterDrawPlaceholder', this.language) }), h$2("div", { class: "FilterCalendarWrapper" }, h$2("vaadin-date-picker", { value: this.filterData.filterFromCalendar, onChange: (event) => this.handleFilterFrom(event), placeholder: translate$2('filterFromCalendar', this.language), class: "VaadinDatePicker" }), h$2("vaadin-date-picker", { value: this.filterData.filterToCalendar, onChange: (event) => this.handleFilterTo(event), placeholder: translate$2('filterToCalendar', this.language), class: "VaadinDatePicker" }))), h$2("div", { class: "FilterModalFooter" }, h$2("button", { class: "FilterModalButton", onClick: () => this.filterSearch() }, translate$2('filterModalButton', this.language))))));
22391
22310
  }
22392
22311
  };
22393
22312
  HelperFilters.style = helperFiltersCss;
22394
22313
 
22395
- /**
22396
- * @name isMobile
22397
- * @description A method that returns if the browser used to access the app is from a mobile device or not
22398
- * @param {String} userAgent window.navigator.userAgent
22399
- * @returns {Boolean} true or false
22400
- */
22401
- const isMobile = (userAgent) => {
22402
- return !!(userAgent.toLowerCase().match(/android/i) ||
22403
- userAgent.toLowerCase().match(/blackberry|bb/i) ||
22404
- userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
22405
- userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
22406
- };
22407
-
22408
- const helperModalCss = ":host{display:block}.HelperModalWrapper{position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.7);opacity:0;visibility:hidden;transform:scale(1.1);transition:visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;z-index:1}.HelperModalVisible{opacity:1;visibility:visible;transform:scale(1);transition:visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s}.HelperModalContent{position:relative;border:solid 1px #848e97;box-shadow:2px 2px 2px rgba(0, 0, 0, 0.007);font-size:14px;padding:10px 10px 5px 10px;background-color:#fff;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);border-radius:4px;width:600px;max-height:600px;overflow-y:scroll}.HelperModalMobileContent{background:#FFF;top:50%;left:50%;transform:translate(-50%, -50%);border-radius:4px;width:80%;max-height:350px}.HelperModalClose{cursor:pointer;position:absolute;top:15px;right:15px;font-size:20px;color:#000}.HelperModalMobileClose{position:absolute;top:15px;right:15px;font-size:20px;color:#000}";
22409
-
22410
- const HelperModal = class {
22411
- constructor(hostRef) {
22412
- registerInstance(this, hostRef);
22413
- this.cancel = createEvent(this, "modalCloseEvent", 7);
22414
- /**
22415
- * Toggles if the helper is visible or not
22416
- */
22417
- this.visible = true;
22418
- this.userAgent = window.navigator.userAgent;
22419
- }
22420
- handleHelperModalClose() {
22421
- this.visible = false;
22422
- this.cancel.emit();
22423
- }
22424
- ;
22425
- render() {
22426
- return ((this.visible &&
22427
- h$2("div", { class: this.visible ? "HelperModalWrapper HelperModalVisible" : "HelperModalWrapper" }, h$2("div", { class: "HelperModalWrapper HelperModalVisible" }, h$2("div", { class: "HelperModalContent" + (isMobile(this.userAgent) ? ' HelperModalMobileContent' : '') }, h$2("span", { class: "HelperModalClose" + (isMobile(this.userAgent) ? ' HelperModalMobileClose' : ''), onClick: this.handleHelperModalClose.bind(this) }, "X"), h$2("slot", null))))));
22428
- }
22429
- };
22430
- HelperModal.style = helperModalCss;
22431
-
22432
- const helperTabCss = ":host{display:block}";
22433
-
22434
- const HelperTab = class {
22435
- constructor(hostRef) {
22436
- registerInstance(this, hostRef);
22437
- /**
22438
- * Selected index
22439
- */
22440
- this.selectedIndex = 0;
22441
- }
22442
- /**
22443
- * Endpoing for CMS
22444
- */
22445
- connectedCallback() {
22446
- /**
22447
- * fetch(cmsEndpoint + / + / + selectedIndex)
22448
- */
22449
- }
22450
- render() {
22451
- return [
22452
- h$2("div", null, "Reference site about Lorem Ipsum, giving information on its origins, as well as a random Lipsum generator.", this.selectedIndex + 1)
22453
- ];
22454
- }
22455
- };
22456
- HelperTab.style = helperTabCss;
22457
-
22458
- const helperTabsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Tabs{display:flex;gap:10px;overflow-x:auto}.TabButton{cursor:pointer;width:auto;border-radius:4px;padding:8px 15px;margin:5px 0 10px;border:1px solid #009993;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-align:center;letter-spacing:0;white-space:nowrap}.TabButton:hover{background:#F1F1F1}.TabButton.Active{background:#009993;color:#FFF}";
22459
-
22460
- const HelperTabs = class {
22461
- constructor(hostRef) {
22462
- registerInstance(this, hostRef);
22463
- /**
22464
- * Tell me if it is disabled
22465
- */
22466
- this.disabled = false;
22467
- /**
22468
- * Tell me what tab is selected
22469
- */
22470
- this.selected = false;
22471
- /**
22472
- * Default selected index
22473
- */
22474
- this.selectedIndex = 0;
22475
- /**
22476
- * Tabs details
22477
- */
22478
- this.tabs = [{ label: 'Draw Details' }, { label: 'Winnings' }, { label: 'How to Play' }, { label: 'Game Odds' }, { label: 'FAQs' }];
22479
- }
22480
- connectedCallback() {
22481
- }
22482
- render() {
22483
- return (h$2("div", null, h$2("div", { class: "Tabs" }, this.tabs.map((tab, index) => h$2("button", { class: 'TabButton' + (this.selectedIndex == index ? ' Active' : ''), onClick: () => this.selectedIndex = index }, tab.label))), h$2("div", null, h$2("helper-tab", { selectedIndex: this.selectedIndex }))));
22484
- }
22485
- get host() { return getElement(this); }
22486
- };
22487
- HelperTabs.style = helperTabsCss;
22488
-
22489
- const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Circle{cursor:pointer;color:#000000;display:block;background:#FFF;border:solid 2px #00958f;height:20px;width:20px;border-radius:50%;margin:0;display:flex;align-items:center;justify-content:center;user-select:none;font-size:12px;font-weight:600;position:relative}.Circle:hover{background:#aee4e2}.Circle.Selected{color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #00958f}.Circle.Disabled{color:#707070;background:#D4D4D4;border:solid 2px #707070;cursor:default}.Circle.DisabledSelected{color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #707070;cursor:default}";
22490
-
22491
- const LotteryBullet = class {
22492
- constructor(hostRef) {
22493
- registerInstance(this, hostRef);
22494
- this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
22495
- /**
22496
- * Value of the bullet
22497
- */
22498
- this.value = '0';
22499
- /**
22500
- * Marks if the bullet should be selectable
22501
- */
22502
- this.selectable = true;
22503
- /**
22504
- * Marks if the bullet should be selected
22505
- */
22506
- this.isSelected = false;
22507
- this.select = () => {
22508
- if (this.selectable) {
22509
- this.isSelected = !this.isSelected;
22510
- this.bulletEvent.emit({
22511
- value: this.value,
22512
- selected: this.isSelected
22513
- });
22514
- }
22515
- };
22516
- }
22517
- render() {
22518
- return (h$2("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
22519
- }
22520
- };
22521
- LotteryBullet.style = lotteryBulletCss;
22522
-
22523
- const DEFAULT_LANGUAGE$3 = 'en';
22524
- const SUPPORTED_LANGUAGES$3 = ['ro', 'en'];
22525
- const TRANSLATIONS$3 = {
22314
+ const DEFAULT_LANGUAGE = 'en';
22315
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
22316
+ const TRANSLATIONS = {
22526
22317
  en: {
22527
22318
  drawResultsHeader: 'Last draw results',
22528
22319
  drawId: 'Draw ID',
@@ -22546,9 +22337,9 @@ const TRANSLATIONS$3 = {
22546
22337
  numberOfDraws: 'Numarul de extrageri'
22547
22338
  },
22548
22339
  };
22549
- const translate$3 = (key, customLang) => {
22340
+ const translate = (key, customLang) => {
22550
22341
  const lang = customLang;
22551
- return TRANSLATIONS$3[lang !== undefined && SUPPORTED_LANGUAGES$3.includes(lang) ? lang : DEFAULT_LANGUAGE$3][key];
22342
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
22552
22343
  };
22553
22344
 
22554
22345
  const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsSection{max-width:500px;margin:0 auto;margin:0px auto 10px;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0 20px}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{width:100%;height:100%;max-height:100px;float:left;margin:0 0 20px 0;border:1px solid #009993;border-radius:4px;padding:10px;box-sizing:border-box;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
@@ -22680,797 +22471,15 @@ const LotteryDrawResults = class {
22680
22471
  }
22681
22472
  else {
22682
22473
  return (h$2("section", { class: "DrawResultsSection" }, !this.drawMode ?
22683
- h$2("div", { class: "DrawResultsArea" }, h$2("div", { class: "TicketInfo" }, h$2("div", { class: "TicketGameName" }, translate$3('drawName', this.language), ": ", h$2("span", null, this.gameName)), h$2("div", { class: "TicketDate" }, "Ticket Purchase Date: ", h$2("span", null, (_a = this.ticketData) === null || _a === void 0 ? void 0 : _a.createdAt.slice(0, 10))), h$2("div", { class: "TicketStatus" }, "Status: ", h$2("span", null, (_b = this.ticketData) === null || _b === void 0 ? void 0 : _b.state))), h$2("div", { class: "DrawResultsBody" }, h$2("div", { class: "TicketIdContainer" }, h$2("p", null, "Ticket id: ", h$2("span", null, (_c = this.ticketData) === null || _c === void 0 ? void 0 : _c.id))), h$2("div", { class: "TicketAmountContainer" }, h$2("p", null, "Ticket amount: ", h$2("span", null, (_d = this.ticketData) === null || _d === void 0 ? void 0 : _d.amount))), h$2("div", { class: "DrawNumbersGrid" }, h$2("p", null, translate$3('drawNumbersGridTicket', this.language), ":"), h$2("div", { class: "BulletContainer" }, h$2("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), h$2("div", { class: "DrawMultipler" }, h$2("label", { class: "Label" }, "Multiplier: ", h$2("span", null, JSON.stringify((_e = this.ticketData) === null || _e === void 0 ? void 0 : _e.multiplier)))), h$2("div", { class: "NumberOfDrawsContainer" }, h$2("p", null, translate$3('numberOfDraws', this.language), ": ", (_f = this.ticketData) === null || _f === void 0 ? void 0 :
22684
- _f.drawCount), h$2("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h$2("div", { class: "ExpandableBoxes" }, h$2("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) }, h$2("div", { class: "TicketResultContainer" }, h$2("p", null, translate$3('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
22685
- h$2("div", { class: "AmountWonContainer" }, h$2("p", null, translate$3('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), h$2("div", { class: "DrawIdContainer" }, h$2("p", null, translate$3('drawId', this.language), ": ", item.drawId)), h$2("div", { class: "DrawDateContainer" }, h$2("p", null, translate$3('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), h$2("div", { class: "DrawNumbersGrid" }), h$2("div", { class: "DrawMultipler" }, h$2("label", { class: "Label" }, "Multiplier: ", item.multiplier)))))))))
22474
+ h$2("div", { class: "DrawResultsArea" }, h$2("div", { class: "TicketInfo" }, h$2("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", h$2("span", null, this.gameName)), h$2("div", { class: "TicketDate" }, "Ticket Purchase Date: ", h$2("span", null, (_a = this.ticketData) === null || _a === void 0 ? void 0 : _a.createdAt.slice(0, 10))), h$2("div", { class: "TicketStatus" }, "Status: ", h$2("span", null, (_b = this.ticketData) === null || _b === void 0 ? void 0 : _b.state))), h$2("div", { class: "DrawResultsBody" }, h$2("div", { class: "TicketIdContainer" }, h$2("p", null, "Ticket id: ", h$2("span", null, (_c = this.ticketData) === null || _c === void 0 ? void 0 : _c.id))), h$2("div", { class: "TicketAmountContainer" }, h$2("p", null, "Ticket amount: ", h$2("span", null, (_d = this.ticketData) === null || _d === void 0 ? void 0 : _d.amount))), h$2("div", { class: "DrawNumbersGrid" }, h$2("p", null, translate('drawNumbersGridTicket', this.language), ":"), h$2("div", { class: "BulletContainer" }, h$2("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), h$2("div", { class: "DrawMultipler" }, h$2("label", { class: "Label" }, "Multiplier: ", h$2("span", null, JSON.stringify((_e = this.ticketData) === null || _e === void 0 ? void 0 : _e.multiplier)))), h$2("div", { class: "NumberOfDrawsContainer" }, h$2("p", null, translate('numberOfDraws', this.language), ": ", (_f = this.ticketData) === null || _f === void 0 ? void 0 :
22475
+ _f.drawCount), h$2("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h$2("div", { class: "ExpandableBoxes" }, h$2("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) }, h$2("div", { class: "TicketResultContainer" }, h$2("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
22476
+ h$2("div", { class: "AmountWonContainer" }, h$2("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), h$2("div", { class: "DrawIdContainer" }, h$2("p", null, translate('drawId', this.language), ": ", item.drawId)), h$2("div", { class: "DrawDateContainer" }, h$2("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), h$2("div", { class: "DrawNumbersGrid" }), h$2("div", { class: "DrawMultipler" }, h$2("label", { class: "Label" }, "Multiplier: ", item.multiplier)))))))))
22686
22477
  :
22687
22478
  h$2("div", { class: "DrawResultsArea" }, this.drawData &&
22688
- h$2("div", null, h$2("div", { class: "DrawResultsHeader" }, h$2("span", null, translate$3('drawId', this.language), ": ", this.drawData.id), h$2("span", null, translate$3('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), h$2("div", { class: "DrawResultsBody" }, h$2("div", { class: "DrawNumbersGrid" }, h$2("p", null, translate$3('drawNumbersGridDraw', this.language), ":"), h$2("div", { class: "BulletContainer" }, h$2("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), h$2("div", { class: "DrawMultipler" }, h$2("label", { class: "Label" }, "Multiplier: ", this.multiplier))))))));
22479
+ h$2("div", null, h$2("div", { class: "DrawResultsHeader" }, h$2("span", null, translate('drawId', this.language), ": ", this.drawData.id), h$2("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), h$2("div", { class: "DrawResultsBody" }, h$2("div", { class: "DrawNumbersGrid" }, h$2("p", null, translate('drawNumbersGridDraw', this.language), ":"), h$2("div", { class: "BulletContainer" }, h$2("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), h$2("div", { class: "DrawMultipler" }, h$2("label", { class: "Label" }, "Multiplier: ", this.multiplier))))))));
22689
22480
  }
22690
22481
  }
22691
22482
  };
22692
22483
  LotteryDrawResults.style = lotteryDrawResultsCss;
22693
22484
 
22694
- const DEFAULT_LANGUAGE$2 = 'en';
22695
- const SUPPORTED_LANGUAGES$2 = ['ro', 'en'];
22696
- const TRANSLATIONS$2 = {
22697
- en: {
22698
- drawResultsHeader: 'Draw results history',
22699
- drawId: 'Draw ID',
22700
- drawDate: 'Draw Date',
22701
- drawNumbersGridA: 'Draw numbers Grid A',
22702
- viewAllResults: 'View All',
22703
- lastFiveDraws: 'Last 5 Draws',
22704
- lastTenDraws: 'Last 10 Draws',
22705
- lastFifteenDraws: 'Last 15 Draws'
22706
- },
22707
- ro: {
22708
- drawResultsHeader: 'Draw results history',
22709
- drawId: 'Draw ID',
22710
- drawDate: 'Draw Date',
22711
- drawNumbersGridA: 'Draw numbers Grid A',
22712
- viewAllResults: 'View All',
22713
- lastFiveDraws: 'Last 5 Draws',
22714
- lastTenDraws: 'Last 10 Draws',
22715
- lastFifteenDraws: 'Last 15 Draws'
22716
- },
22717
- };
22718
- const translate$2 = (key, customLang) => {
22719
- const lang = customLang;
22720
- return TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
22721
- };
22722
-
22723
- const lotteryDrawResultsHistoryCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridBanner{background-color:#009993;background-repeat:no-repeat;background-position:center;color:#111;padding:0 20px 30px}.GridBanner .BannerButtonsWrapper{display:flex;justify-content:space-between;padding-top:16px}.GridBanner .BannerButtonsWrapper .BannerBackButton,.GridBanner .BannerButtonsWrapper .BannerLobbyButton{background:#fff;border:1px solid #009993;border-radius:4px;padding:7px 15px;font-size:12px;text-transform:uppercase;width:80px}.GridBanner .HistoryGridBannerArea{padding-top:30px}.HistoryGridBannerArea{display:flex;flex-direction:column;align-items:center}.BannerText{font-size:14px;font-weight:300}.BannerCountdown{font-size:22px;display:flex;gap:20px}.DrawResultsSection{max-width:500px;margin:0 auto}.HistoryGridWrapper{padding:0 15px}.HistoryGrid{border:1px solid #009993;border-radius:5px}.DrawResultsHeader{color:#009993;padding:15px;text-align:center}.DrawResultsHeader h4{text-transform:uppercase;font-size:16px;font-weight:600;margin:0}.DrawNumbersGrid{padding:10px 50px}.DrawNumbersGrid p{margin:0 0 10px 0;font-size:14px}.BulletContainer{margin-bottom:20px}.DrawResultTop{background-color:#009993;padding:10px;text-align:center;color:#fff;padding:0 50px;display:flex;justify-content:center;gap:40px}.ViewAllResults{display:block;padding:10px 40px;margin:40px auto;border:0;border-radius:5px;background-color:#009993;color:#fff;outline:none}.FilterSection{display:flex;justify-content:space-between;padding:10px 0 25px}.FilterSection .FilterResultsContainer{display:flex;gap:5px}.FilterSection .QuickFilterButton{cursor:pointer;width:max-content;border-radius:4px;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-align:center;letter-spacing:0}.FilterSection .QuickFilterButton:hover{background:#F1F1F1}.FilterSection helper-filters{margin-left:auto}";
22724
-
22725
- const LotteryDrawResultsHistory = class {
22726
- constructor(hostRef) {
22727
- registerInstance(this, hostRef);
22728
- /**
22729
- * The number of results to be displayed
22730
- */
22731
- this.numberOfResults = 3;
22732
- /**
22733
- *Language
22734
- */
22735
- this.language = 'en';
22736
- this.drawData = [];
22737
- this.displayAllDrawsResults = true;
22738
- this.showQuickFilters = true;
22739
- this.winningDataSetsData = [''];
22740
- this.getDrawsData = () => {
22741
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
22742
- fetch(url.href)
22743
- .then((res) => {
22744
- if (res.status >= 300) {
22745
- throw new Error('There was an error while fetching the data');
22746
- }
22747
- return res.json();
22748
- })
22749
- .then((data) => {
22750
- console.log("getDrawsData ", data);
22751
- // filter out incomplete data sets for draws
22752
- this.winningDataSetsData = data.draws.filter(draw => draw.winningNumbers);
22753
- this.drawData = this.winningDataSetsData;
22754
- console.log('this.drawData', this.drawData);
22755
- });
22756
- };
22757
- this.filterResults = (resultsNumber) => {
22758
- this.numberOfResults = resultsNumber;
22759
- this.displayAllDrawsResults = true;
22760
- };
22761
- this.getDrawResults = (drawID) => {
22762
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${drawID}`);
22763
- let drawOptions = {
22764
- method: "GET",
22765
- headers: {
22766
- 'Content-Type': "application/json",
22767
- 'Accept': 'application/json',
22768
- },
22769
- };
22770
- fetch(url.href, drawOptions)
22771
- .then((response) => {
22772
- return response.json();
22773
- })
22774
- .then((data) => {
22775
- console.log("getDrawResults ", data);
22776
- this.drawData = [data];
22777
- });
22778
- };
22779
- this.viewAllResults = () => {
22780
- this.numberOfResults = this.drawData.length;
22781
- this.displayAllDrawsResults = false;
22782
- window.scrollTo({ top: 0, behavior: 'smooth' });
22783
- };
22784
- }
22785
- // Filters events
22786
- filtersHandler(event) {
22787
- var _a;
22788
- this.getDrawResults((_a = event.detail) === null || _a === void 0 ? void 0 : _a.drawTicketId);
22789
- this.showQuickFilters = false;
22790
- }
22791
- clearFiltersHandler() {
22792
- this.drawData = this.winningDataSetsData;
22793
- this.showQuickFilters = true;
22794
- }
22795
- connectedCallback() {
22796
- this.getDrawsData();
22797
- }
22798
- disconnectedCallback() {
22799
- clearInterval(this.interval);
22800
- }
22801
- render() {
22802
- let gridHeader = h$2("div", { class: "DrawResultsHeader" }, this.displayAllDrawsResults ? h$2("h4", null, translate$2('drawResultsHeader', this.language)) :
22803
- h$2("div", { class: "DrawResultsHeaderContent" }, h$2("div", { class: "FilterSection" }, this.showQuickFilters &&
22804
- h$2("div", { class: "FilterResultsContainer" }, h$2("button", { class: "QuickFilterButton", onClick: () => this.filterResults(5) }, translate$2('lastFiveDraws', this.language)), h$2("button", { class: "QuickFilterButton", onClick: () => this.filterResults(10) }, translate$2('lastTenDraws', this.language)), h$2("button", { class: "QuickFilterButton", onClick: () => this.filterResults(15) }, translate$2('lastFifteenDraws', this.language))), h$2("helper-filters", { "show-filter-id": "true", "activate-ticket-search": "false", "game-id": "3797", "player-id": "2323" })), h$2("h4", null, "All draws results history")));
22805
- let gridContent = h$2("div", { class: "HistoryGridWrapper" }, h$2("div", { class: "HistoryGrid" }, this.drawData.map((item) => h$2("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, "draw-id": item.id, "draw-mode": true })).reverse().slice(0, this.numberOfResults)));
22806
- return h$2("section", { class: "GridWrapper" }, h$2("div", { class: "DrawResultsSection" }, h$2("div", { class: "DrawResultsArea" }, gridHeader, gridContent, this.displayAllDrawsResults && h$2("button", { class: "ViewAllResults", onClick: this.viewAllResults }, "View All"))));
22807
- }
22808
- };
22809
- LotteryDrawResultsHistory.style = lotteryDrawResultsHistoryCss;
22810
-
22811
- const lotteryGameDetailsCss = ":host{display:block}";
22812
-
22813
- const LotteryGameDetails = class {
22814
- constructor(hostRef) {
22815
- registerInstance(this, hostRef);
22816
- }
22817
- render() {
22818
- return (h$2("div", null, h$2("helper-accordion", { "header-title": "Game Details", collapsed: false }, h$2("div", { slot: "accordionContent" }, h$2("helper-tabs", null)))));
22819
- }
22820
- };
22821
- LotteryGameDetails.style = lotteryGameDetailsCss;
22822
-
22823
- const DEFAULT_LANGUAGE$1 = 'en';
22824
- const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
22825
- const TRANSLATIONS$1 = {
22826
- en: {
22827
- error: 'Error',
22828
- title: 'Chrono',
22829
- backButton: 'Back',
22830
- lobbyButton: 'Lobby',
22831
- prize: 'Prize',
22832
- winUpTo: 'Win up to',
22833
- nextDraw: 'Next draw in: ',
22834
- buy: 'Buy tickets',
22835
- viewLatest: 'View latest results',
22836
- createTicket: 'Create Ticket',
22837
- modalSuccess: 'Purchase will be successfull soon!',
22838
- deleteTicketModalTitle: 'Delete Ticket',
22839
- deleteTicketModalText: 'Are you sure you want to delete this ticket?',
22840
- deleteTicketModalCancel: 'Cancel',
22841
- deleteTicketModalConfirm: 'Delete',
22842
- orderSummaryTitle: 'Order Summary',
22843
- orderSummaryTickets: 'Ticket',
22844
- orderSummaryTotal: 'Total',
22845
- orderSummarySubmit: 'Submit'
22846
- },
22847
- ro: {
22848
- error: 'Eroare',
22849
- title: 'Loto 6/49',
22850
- backButton: 'Inapoi',
22851
- lobbyButton: 'Lobby',
22852
- prize: 'MARELE JACKPOT OMG',
22853
- winUpTo: 'Castiga pana la',
22854
- nextDraw: 'In cat timp devii milionar daca cumperi acum!!!',
22855
- buy: 'Cumpara bilet',
22856
- viewLatest: 'Ultimile extrageri',
22857
- createTicket: 'Creeaza bilet',
22858
- modalSuccess: 'Achiziția va avea succes în curând!',
22859
- deleteTicketModalTitle: 'Sterge biletul',
22860
- deleteTicketModalText: 'Esti sigur ca vrei sa stergi acest bilet?',
22861
- deleteTicketModalCancel: 'Anuleaza',
22862
- deleteTicketModalConfirm: 'Sterge',
22863
- orderSummaryTitle: 'Rezumat comanda',
22864
- orderSummaryTickets: 'Bilet',
22865
- orderSummaryTotal: 'Total',
22866
- orderSummarySubmit: 'Trimite'
22867
- },
22868
- };
22869
- const translate$1 = (key, customLang) => {
22870
- const lang = customLang;
22871
- return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
22872
- };
22873
-
22874
- const lotteryGamePageCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GamePage .GridBanner{background-color:#009993;background-repeat:no-repeat;background-position:center;color:#111;padding:0 20px 10px;height:220px;display:flex;flex-direction:column;justify-content:space-between}.GamePage .GridBanner .BannerButtonsWrapper{display:flex;justify-content:space-between;padding-top:16px}.GamePage .GridBanner .BannerButtonsWrapper .BannerBackButton,.GamePage .GridBanner .BannerButtonsWrapper .BannerLobbyButton{background:#fff;border:1px solid #D4D4D4;border-radius:4px;padding:7px 15px;font-size:12px;text-transform:uppercase;width:80px}.GamePage .GridBanner .GridBannerArea{padding-top:30px;display:flex;flex-direction:column;align-items:center}.GamePage .TotalWinnings{color:#00958f;font-size:18px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px}.GamePage .TotalWinnings span{font-size:22px;font-weight:700}.GamePage .NextDraw{color:#00958f;font-size:24px;font-weight:600;margin:0 auto;text-align:center;text-transform:capitalize;display:flex;justify-content:center;align-items:center;flex-direction:column}.GamePage .NextDraw .BannerText{font-weight:400;font-size:18px}.GamePage .NextDraw .BannerCountdown{font-size:22px;color:#00958f;display:flex;gap:20px}.GamePage .Tabs{display:flex;justify-content:center;gap:10px}.GamePage .Tabs .TabButton{border-radius:4px;cursor:pointer;padding:8px 0;width:50%;max-width:200px;border:1px solid #00958f;background:#F1F1F1;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.GamePage .Tabs .TabButton.Active{background:#00958f;color:#FFF}.NextDrawWrapper{padding:10px 15px;background:#fff}.NextDrawWrapper .BannerText{font-size:16px;font-weight:700;text-align:center}.NextDrawWrapper .BannerCountdown{font-size:22px;display:flex;gap:8px;color:#009993;font-weight:bolder;justify-content:center}.GamePageContent{padding:10px 15px;max-width:1200px;margin:0 auto}.GameDetails{padding-bottom:10px;margin-bottom:20px;border-bottom:1px solid #e9e9e9}.CreateNewTicket{background:#004D4A;height:100px;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.CreateNewTicket button{cursor:pointer;display:inline-block;border-radius:50%;width:40px;height:40px;margin:5px;border:1px solid #FFF;background:#FFF;color:#004D4A;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.CreateNewTicket button:hover{background:#F1F1F1}.CreateNewTicket span{display:inline-block;font-size:12px;text-align:center;margin:0 auto;color:#FFF}.OrderSummary{min-width:200px;border-radius:4px;display:flex;flex-direction:column;justify-content:center;margin-top:20px;background:#fff}.OrderSummary .OrderSummaryTitle{font-size:16px;color:#009993;text-transform:uppercase;text-align:center}.OrderSummary .Ticket{display:inline-block;color:#000;font-size:14px;height:50px;border-bottom:solid 1px #D4D4D4;line-height:50px}.OrderSummary .Ticket span{text-align:right}.OrderSummary .Total{display:inline-block;color:#000;font-size:14px;height:50px;line-height:50px}.OrderSummary .Total span{text-align:right}.ButtonWrapper{display:flex;align-items:center;justify-content:center}.ButtonWrapper .Button{cursor:pointer;border-radius:4px;padding:8px 60px;width:max-content;margin:5px;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#009993;border:1px solid #009993;color:#FFF}.ButtonWrapper .Button:hover{background:#00ABA4}.SubmitModalSuccess{text-align:center;font-size:18px;padding:20px}.DeleteTicketModalWrapper{padding:20px;text-align:center}.DeleteTicketModalWrapper .DeleteTicketModalTitle{font-size:16px;color:#00958f;font-weight:400;text-transform:uppercase;margin:20px 0 40px}.DeleteTicketModalWrapper .DeleteTicketModalText{font-size:14px;color:#000;line-height:22px;margin-bottom:40px}.DeleteTicketModalWrapper .DeleteTicketModalButtons{display:flex;gap:10px;justify-content:center}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm{cursor:pointer;border-radius:4px;padding:8px 25px;width:max-content;margin:5px;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm:hover{background:#FF6536;border:1px solid #FF3D00}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel{cursor:pointer;width:max-content;border-radius:4px;padding:10px 25px;margin:5px;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel:hover{background:#F1F1F1}@media (min-width: 1200px){.GamePageContent .TicketsWrapper{float:left;width:49%}.GamePageContent .GameDetails{float:right;width:49%}.GamePageContent .OrderSummary{float:right;width:49%}}";
22875
-
22876
- const LotteryGamePage = class {
22877
- constructor(hostRef) {
22878
- registerInstance(this, hostRef);
22879
- /**
22880
- * Language of the widget
22881
- */
22882
- this.language = 'en';
22883
- /**
22884
- * Shows the auto-pick button
22885
- */
22886
- this.autoPick = false;
22887
- /**
22888
- * Shows the reset button
22889
- */
22890
- this.resetButton = false;
22891
- this.tickets = [];
22892
- this.tabIndex = 0;
22893
- this.hasErrors = false;
22894
- this.totalAmount = 0;
22895
- this.successVisible = false;
22896
- this.deleteVisible = false;
22897
- this.latestDraw = {};
22898
- this.totalWinningsAmount = 0;
22899
- this.multiplier = false;
22900
- this.quickPick = false;
22901
- }
22902
- // @TODO fix `any` type later, I'm lazy now
22903
- connectedCallback() {
22904
- this.getGameDetails();
22905
- this.getDraws();
22906
- }
22907
- countdownLogic(date) {
22908
- this.interval = setInterval(() => {
22909
- this.daysRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60 * 24));
22910
- this.hoursRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60) - this.daysRemaining * 24);
22911
- this.minutesRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60) - this.daysRemaining * 24 * 60 - this.hoursRemaining * 60);
22912
- this.secondsRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / 1000 - this.daysRemaining * 24 * 60 * 60 - this.hoursRemaining * 60 * 60 - this.minutesRemaining * 60);
22913
- }, 1000);
22914
- }
22915
- disconnectedCallback() {
22916
- clearInterval(this.interval);
22917
- }
22918
- getGameDetails() {
22919
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
22920
- fetch(url.href)
22921
- .then((res) => {
22922
- if (res.status >= 300) {
22923
- this.hasErrors = true;
22924
- throw new Error('There was an error while fetching the data');
22925
- }
22926
- return res.json();
22927
- })
22928
- .then((data) => {
22929
- this.gameData = data;
22930
- this.basicStake = this.gameData.rules.stakes[0].amount;
22931
- let draws = this.gameData.draws.filter((item) => !item.winningNumbers);
22932
- console.log('draws', draws);
22933
- this.nextDraw = draws[0].id;
22934
- this.createNewTicket();
22935
- })
22936
- .catch((err) => {
22937
- this.hasErrors = true;
22938
- console.log('Error', err);
22939
- });
22940
- }
22941
- calculateTotalAmount() {
22942
- const { currency } = this.gameData.rules.stakes[0];
22943
- this.totalAmount = 0;
22944
- this.tickets.forEach((item) => {
22945
- if (item.completed) {
22946
- this.totalAmount += item.amount * item.stake;
22947
- }
22948
- });
22949
- this.currency = currency;
22950
- }
22951
- // @TODO CustomEvent type
22952
- gridFilledHandler(event) {
22953
- // @TODO item ts
22954
- this.tickets = this.tickets.map((item) => {
22955
- if (item.ticketId == event.detail.id) {
22956
- let arr = item.selectedNumbers || [];
22957
- arr[event.detail.index] = event.detail.selectedNumbers.map((item) => parseInt(item, 10));
22958
- return {
22959
- gameId: item.gameId,
22960
- ticketId: item.ticketId,
22961
- completed: true,
22962
- amount: event.detail.draws,
22963
- stake: item.stake,
22964
- selectedNumbers: arr
22965
- };
22966
- }
22967
- return item;
22968
- });
22969
- this.calculateTotalAmount();
22970
- }
22971
- // @TODO fix any type
22972
- gridDirtyHandler(event) {
22973
- // @TODO item ts
22974
- this.tickets = this.tickets.map((item) => {
22975
- if (item.gameId == event.detail.id) {
22976
- return {
22977
- gameId: item.gameId,
22978
- ticketId: item.ticketId,
22979
- completed: false,
22980
- amount: item.amount,
22981
- stake: item.stake,
22982
- grids: []
22983
- };
22984
- }
22985
- return item;
22986
- });
22987
- }
22988
- // @TODO CustomEvent type
22989
- deleteTicketHandler(event) {
22990
- this.deleteVisible = true;
22991
- this.deleteEventData = event;
22992
- }
22993
- modalCloseEvent() {
22994
- this.deleteVisible = false;
22995
- }
22996
- stakeChangeHandler(event) {
22997
- const { ticketId, stake } = event.detail;
22998
- this.tickets[ticketId - 1].stake = stake;
22999
- this.calculateTotalAmount();
23000
- }
23001
- multiplierChangeHandler(event) {
23002
- this.multiplier = event.detail;
23003
- }
23004
- getDraws() {
23005
- // append from query param with the current date value in order to get the next draw
23006
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws`);
23007
- let drawOptions = {
23008
- method: "GET",
23009
- headers: {
23010
- 'Content-Type': "application/json",
23011
- 'Accept': 'application/json',
23012
- },
23013
- };
23014
- fetch(url.href, drawOptions)
23015
- .then((response) => {
23016
- return response.json();
23017
- })
23018
- .then((data) => {
23019
- var _a;
23020
- let upcoming = data.items.filter((item) => {
23021
- if (Date.parse(item.date) > new Date().getTime()) {
23022
- return !item.winningNumbers;
23023
- }
23024
- });
23025
- let past = data.items.filter((item) => item.winningNumbers);
23026
- this.latestDraw = upcoming[0];
23027
- this.nextDate = this.latestDraw.date;
23028
- this.countdownLogic(this.nextDate);
23029
- this.lastDrawId = past[past.length - 1].id;
23030
- // calculate total winnings
23031
- // @TODO fix any type
23032
- (_a = this.latestDraw) === null || _a === void 0 ? void 0 : _a.prizes.forEach((element) => {
23033
- this.totalWinningsAmount += JSON.parse(element.amount);
23034
- });
23035
- });
23036
- }
23037
- ;
23038
- // @TODO fix any type
23039
- confirmDeleteTicketHandler(event) {
23040
- // @TODO fix any type
23041
- this.tickets = this.tickets.filter((item) => {
23042
- if (item.ticketId == event.detail.ticketId) {
23043
- return false;
23044
- }
23045
- return true;
23046
- });
23047
- this.calculateTotalAmount();
23048
- this.deleteVisible = false;
23049
- }
23050
- createNewTicket() {
23051
- this.tickets = [
23052
- ...this.tickets,
23053
- { gameId: this.gameId, ticketId: this.tickets.length + 1, completed: false, amount: 1, stake: this.basicStake, grids: [] }
23054
- ];
23055
- }
23056
- submitTickets() {
23057
- let url = new URL(`${this.endpoint}/tickets`);
23058
- // @TODO Body TS type
23059
- let body = {
23060
- gameId: this.gameId,
23061
- tickets: []
23062
- };
23063
- console.log('body', body);
23064
- this.tickets.forEach((item) => {
23065
- body.tickets.push({
23066
- startingDrawId: this.nextDraw,
23067
- amount: item.stake,
23068
- gameId: this.gameId,
23069
- currency: this.currency,
23070
- selection: item.selectedNumbers,
23071
- multiplier: this.multiplier,
23072
- drawCount: item.amount,
23073
- quickPick: this.quickPick,
23074
- });
23075
- });
23076
- // @TODO Options TS type
23077
- let options = {
23078
- method: 'POST',
23079
- headers: {
23080
- 'Content-Type': 'application/json',
23081
- 'Accept': 'application/json',
23082
- 'Authorization': `Bearer ${this.sessionId}`
23083
- },
23084
- body: JSON.stringify(body)
23085
- };
23086
- fetch(url.href, options)
23087
- .then((res) => {
23088
- if (res.status > 300) {
23089
- throw new Error('err');
23090
- }
23091
- return res.json();
23092
- })
23093
- .then((data) => {
23094
- console.log('data', data);
23095
- });
23096
- this.successVisible = true;
23097
- }
23098
- render() {
23099
- // const backgroundSrc = getAssetPath('./static/chrono_lottery_mobile.png');
23100
- // const backgroundDesktopSrc = getAssetPath('./static/chrono_desktop.png');
23101
- if (this.hasErrors) {
23102
- return (h$2("div", { class: "GamePage" }, h$2("div", { class: "Title" }, translate$1('error', this.language))));
23103
- }
23104
- return (
23105
- /* Game details */
23106
- h$2("div", { class: "GamePage" }, h$2("div", { class: "GridBanner" }, h$2("div", { class: "BannerButtonsWrapper" }, h$2("button", { class: "BannerBackButton" }, h$2("span", { class: "BannerBackButtonArrow" }, "\u1438 "), translate$1('backButton', this.language)), h$2("button", { class: "BannerLobbyButton" }, translate$1('lobbyButton', this.language))), h$2("div", { class: "Tabs" }, h$2("div", { class: 'TabButton' + (this.tabIndex == 0 ? ' Active' : ''), onClick: () => this.tabIndex = 0 }, translate$1('buy', this.language)), h$2("div", { class: 'TabButton' + (this.tabIndex == 1 ? ' Active' : ''), onClick: () => this.tabIndex = 1 }, translate$1('viewLatest', this.language)))), h$2("div", { class: "NextDrawWrapper" }, h$2("div", { class: "TotalWinnings" }, translate$1('winUpTo', this.language), ": ", h$2("span", null, "$", this.totalWinningsAmount.toLocaleString('en-US', { maximumFractionDigits: 2 }))), h$2("div", { class: "NextDraw" }, h$2("p", { class: "BannerText" }, translate$1('nextDraw', this.language)), h$2("div", { class: "BannerCountdown" }, h$2("span", { class: "CountdownDays" }, this.daysRemaining, "D"), h$2("span", { class: "CountdownHours" }, this.hoursRemaining, "H"), h$2("span", { class: "CountdownMinutes" }, this.minutesRemaining, "M"), h$2("span", { class: "CountdownSeconds" }, this.secondsRemaining, "S")))), this.tabIndex == 0 &&
23107
- h$2("div", { class: "GamePageContent" }, h$2("div", { class: "GameDetails" }, h$2("lottery-game-details", null)), h$2("div", { class: "TicketsWrapper" }, this.tickets.map((item) => h$2("lottery-ticket-controller", { endpoint: this.endpoint, "ticket-id": item.ticketId, "game-id": item.gameId, collapsed: false, last: true, language: this.language, "auto-pick": this.autoPick, "reset-button": this.resetButton })), h$2("div", { class: "CreateNewTicket" }, h$2("button", { onClick: () => this.createNewTicket() }, "+"), h$2("span", null, translate$1('createTicket', this.language)))), h$2("div", { class: "OrderSummary" }, h$2("h3", { class: "OrderSummaryTitle" }, translate$1('orderSummaryTitle', this.language)), h$2("div", { class: "Ticket" }, translate$1('orderSummaryTickets', this.language), ": ", h$2("span", null, this.tickets.length)), h$2("div", { class: "Total" }, translate$1('orderSummaryTotal', this.language), ": ", h$2("span", null, this.totalAmount, " ", this.currency)), h$2("div", { class: "ButtonWrapper" }, h$2("span", { class: "Button", onClick: () => this.submitTickets() }, translate$1('orderSummarySubmit', this.language))))), this.tabIndex == 1 &&
23108
- h$2("div", null, h$2("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "draw-id": this.lastDrawId, "draw-mode": true }), h$2("lottery-draw-results-history", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language })), h$2("helper-modal", { "title-modal": "Success", visible: this.successVisible }, h$2("p", { class: "SubmitModalSuccess" }, translate$1('modalSuccess', this.language))), h$2("helper-modal", { "title-modal": "Delete Ticket", visible: this.deleteVisible }, h$2("div", { class: "DeleteTicketModalWrapper" }, h$2("h3", { class: "DeleteTicketModalTitle" }, translate$1('deleteTicketModalTitle', this.language)), h$2("p", { class: "DeleteTicketModalText" }, translate$1('deleteTicketModalText', this.language)), h$2("div", { class: "DeleteTicketModalButtons" }, h$2("button", { class: "DeleteTicketModalCancel", onClick: () => this.modalCloseEvent() }, translate$1('deleteTicketModalCancel', this.language)), h$2("button", { class: "DeleteTicketModalConfirm", onClick: () => this.confirmDeleteTicketHandler(this.deleteEventData) }, translate$1('deleteTicketModalConfirm', this.language)))))));
23109
- }
23110
- static get assetsDirs() { return ["static"]; }
23111
- get element() { return getElement(this); }
23112
- };
23113
- LotteryGamePage.style = lotteryGamePageCss;
23114
-
23115
- const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:350px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:10px}";
23116
-
23117
- const LotteryGrid = class {
23118
- constructor(hostRef) {
23119
- registerInstance(this, hostRef);
23120
- this.gridFilledEvent = createEvent(this, "gridFilled", 7);
23121
- this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
23122
- /**
23123
- * Number of bullets of grid
23124
- */
23125
- this.totalNumbers = 0;
23126
- /**
23127
- * Number of maximum bullets that can be selected
23128
- */
23129
- this.maximumAllowed = 0;
23130
- /**
23131
- * Minimum allowed of bullets
23132
- */
23133
- this.minimumAllowed = 1;
23134
- /**
23135
- * Allows the user to select numbers on the grid
23136
- */
23137
- this.selectable = true;
23138
- /**
23139
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
23140
- */
23141
- this.selectedNumbers = '';
23142
- /**
23143
- * Show only selected numbers
23144
- */
23145
- this.displaySelected = false;
23146
- /**
23147
- * Language
23148
- */
23149
- this.language = 'en';
23150
- this.numbers = [];
23151
- this.selectedCounter = 0;
23152
- }
23153
- connectedCallback() {
23154
- let selected = [];
23155
- if (this.selectedNumbers.length > 0) {
23156
- selected = this.selectedNumbers.split(',');
23157
- this.selectedCounter = selected.length;
23158
- }
23159
- if (this.displaySelected) {
23160
- selected.forEach((item) => {
23161
- this.numbers.push({
23162
- number: item,
23163
- selected: true,
23164
- selectable: this.selectable
23165
- });
23166
- });
23167
- }
23168
- else {
23169
- [...Array(this.totalNumbers).keys()]
23170
- .map(number => (number + 1).toString())
23171
- .forEach((number) => {
23172
- this.numbers.push({
23173
- number,
23174
- selected: selected.indexOf(number) >= 0 ? true : false,
23175
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
23176
- });
23177
- });
23178
- }
23179
- }
23180
- lotteryBulletSelectionHandler(event) {
23181
- this.numbers = this.numbers.map((item) => {
23182
- if (item.number == event.detail.value) {
23183
- return {
23184
- number: item.number,
23185
- selected: event.detail.selected,
23186
- selectable: item.selectable
23187
- };
23188
- }
23189
- return {
23190
- number: item.number,
23191
- selected: item.selected,
23192
- selectable: item.selectable
23193
- };
23194
- });
23195
- if (event.detail.selected) {
23196
- this.selectedCounter += 1;
23197
- if (this.selectedCounter == this.maximumAllowed) {
23198
- this.numbers = this.numbers.map((item) => {
23199
- return {
23200
- number: item.number,
23201
- selected: item.selected,
23202
- selectable: item.selected ? true : false
23203
- };
23204
- });
23205
- this.gridFilledEvent.emit({
23206
- id: this.ticketId,
23207
- index: this.gridIndex,
23208
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
23209
- });
23210
- }
23211
- }
23212
- else {
23213
- if (this.selectedCounter == this.maximumAllowed) {
23214
- this.numbers = this.numbers.map((item) => {
23215
- return {
23216
- number: item.number,
23217
- selected: item.selected,
23218
- selectable: true
23219
- };
23220
- });
23221
- this.gridDirtyEvent.emit({
23222
- id: this.ticketId,
23223
- index: this.gridIndex,
23224
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
23225
- });
23226
- }
23227
- this.selectedCounter -= 1;
23228
- }
23229
- }
23230
- async resetSelectionHandler(event) {
23231
- if (event.detail && event.detail == this.ticketId) {
23232
- this.selectedCounter = 0;
23233
- this.numbers = this.numbers.map((item) => {
23234
- return {
23235
- number: item.number,
23236
- selected: false,
23237
- selectable: this.selectable
23238
- };
23239
- });
23240
- this.gridDirtyEvent.emit({
23241
- id: this.ticketId,
23242
- index: this.gridIndex,
23243
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
23244
- });
23245
- }
23246
- }
23247
- async autoSelectionHandler(event) {
23248
- if (event.detail && event.detail == this.ticketId) {
23249
- this.resetSelectionHandler(event);
23250
- let array = [...Array(this.totalNumbers).keys()]
23251
- .map(number => number + 1)
23252
- .sort(() => 0.5 - Math.random());
23253
- array = array.slice(0, this.minimumAllowed);
23254
- this.numbers = this.numbers.map((item) => {
23255
- return {
23256
- number: item.number,
23257
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
23258
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
23259
- };
23260
- });
23261
- this.gridFilledEvent.emit({
23262
- id: this.ticketId,
23263
- index: this.gridIndex,
23264
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
23265
- });
23266
- this.selectedCounter = this.maximumAllowed;
23267
- }
23268
- }
23269
- render() {
23270
- return (h$2("div", { class: "GridContainer" }, h$2("div", { class: "Grid" }, this.numbers.map((item) => h$2("div", null, h$2("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected }))))));
23271
- }
23272
- };
23273
- LotteryGrid.style = lotteryGridCss;
23274
-
23275
- const DEFAULT_LANGUAGE = 'en';
23276
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
23277
- const TRANSLATIONS = {
23278
- en: {
23279
- loading: 'Loading, please wait ...',
23280
- error: 'It was an error while trying to fetch the data',
23281
- grid: 'Grid',
23282
- multiplier: 'Multiplier',
23283
- numberOfDraws: 'Number of draws',
23284
- wagerPerDraw: 'Wager per draw',
23285
- resetButton: 'Reset',
23286
- autoButton: 'I feel lucky'
23287
- },
23288
- ro: {
23289
- loading: 'Se incarca, va rugam asteptati ...',
23290
- error: 'A fost o eroare in timp ce asteptam datele',
23291
- grid: 'Grid',
23292
- multiplier: 'Multiplicator',
23293
- numberOfDraws: 'Numarul de extrageri',
23294
- wagerPerDraw: 'Pariul per extragere',
23295
- resetButton: 'Reseteaza',
23296
- autoButton: 'Ma simt norocos'
23297
- },
23298
- };
23299
- const translate = (key, customLang) => {
23300
- const lang = customLang;
23301
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
23302
- };
23303
-
23304
- const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Toggle{cursor:pointer;margin-top:20px;display:inline-block}.ToggleSwitch{display:inline-block;background:#707070;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #F1F1F1 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#00ABA4}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px;font-size:14px;font-weight:lighter;color:#000}input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.NumberInput,.WagerInput{margin-top:10px;display:inline-flex;align-items:center}.NumberInput,.NumberInput *{box-sizing:border-box}.NumberInput button{cursor:pointer;outline:none;-webkit-appearance:none;background-color:transparent;border:none;align-items:center;justify-content:center;height:20px;margin:0;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);width:30px;align-items:center;text-align:center}.NumberInput button.Plus:after{transform:translate(-50%, -50%) rotate(0deg);width:30px;display:inline-flex;align-items:center;text-align:center}.NumberInput input[type=number],.WagerInput input[type=number]{max-width:50px;display:inline-flex;align-items:center;padding:4px 10px;text-align:center}.NumberInput input[type=number] .WagerInputTitle,.WagerInput input[type=number] .WagerInputTitle{font-size:14px;color:#000;padding:10px}.InputDefault{background-color:#F1F1F1;border-radius:4px;padding:5px;border:solid 1px #D4D4D4;color:#707070}.AutoButton{cursor:pointer;display:block;border-radius:4px;padding:8px 25px;width:max-content;margin:5px 0;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.AutoButton:active{background:#00958f;color:#FFF}.ResetButton{cursor:pointer;display:block;border-radius:4px;padding:8px 25px;width:max-content;margin:5px 0;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ResetButton:hover{background:#FF6536;border:1px solid #FF3D00}.TicketGridBullets{background:#f1f1f1;border-radius:4px;padding:20px;margin-top:5px}.TicketGridBullets .TicketGridTitle{margin-top:0px}";
23305
-
23306
- const LotteryTicket = class {
23307
- constructor(hostRef) {
23308
- registerInstance(this, hostRef);
23309
- this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
23310
- this.autoSelection = createEvent(this, "autoSelection", 7);
23311
- this.resetSelection = createEvent(this, "resetSelection", 7);
23312
- this.stakeChange = createEvent(this, "stakeChange", 7);
23313
- this.multiplierChange = createEvent(this, "multiplierChange", 7);
23314
- /**
23315
- * Number of grids of a ticket
23316
- */
23317
- this.numberOfGrids = 1;
23318
- /**
23319
- * Option to have the ticket registered for multiple draws
23320
- */
23321
- this.multipleDraws = true;
23322
- /**
23323
- * Shows the reset button
23324
- */
23325
- this.resetButton = false;
23326
- /**
23327
- * Shows the auto-pick button
23328
- */
23329
- this.autoPick = false;
23330
- /**
23331
- * Language
23332
- */
23333
- this.language = 'en';
23334
- this.multiplier = false;
23335
- this.numberOfDraws = 1;
23336
- this.isLoading = true;
23337
- this.hasErrors = false;
23338
- this.ticketDone = false;
23339
- }
23340
- connectedCallback() {
23341
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
23342
- fetch(url.href)
23343
- .then((response) => {
23344
- if (response.ok) {
23345
- return response.json();
23346
- }
23347
- else {
23348
- // Throw error
23349
- this.hasErrors = true;
23350
- }
23351
- })
23352
- .then((data) => {
23353
- this.isLoading = false;
23354
- this.gameData = data;
23355
- this.grids = [...Array(data.rules.boards.length).keys()];
23356
- })
23357
- .catch((err) => {
23358
- this.isLoading = false;
23359
- this.hasErrors = true;
23360
- console.error('Error!', err);
23361
- });
23362
- }
23363
- multiplierChangeHandler(e) {
23364
- this.multiplier = e.target ? e.target.checked : false;
23365
- this.multiplierChange.emit(this.multiplier);
23366
- }
23367
- drawsChangeHandler(event) {
23368
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
23369
- this.ticketCompleted.emit(this.ticket);
23370
- }
23371
- gridFilledHandler(event) {
23372
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
23373
- this.ticketDone = true;
23374
- this.ticketCompleted.emit(this.ticket);
23375
- }
23376
- toggleAutoSelection() {
23377
- this.ticketDone = true;
23378
- this.autoSelection.emit(this.ticketId);
23379
- }
23380
- toggleResetSelection() {
23381
- this.ticketDone = false;
23382
- this.resetSelection.emit(this.ticketId);
23383
- }
23384
- changeStake(event) {
23385
- this.stakeChange.emit({
23386
- ticketId: this.ticketId,
23387
- stake: event.target.value
23388
- });
23389
- }
23390
- render() {
23391
- if (this.isLoading) {
23392
- return (h$2("div", null, h$2("p", null, translate('loading', this.language))));
23393
- }
23394
- else {
23395
- if (this.hasErrors) {
23396
- return (h$2("div", null, h$2("p", null, translate('error', this.language))));
23397
- }
23398
- else {
23399
- const { rules } = this.gameData;
23400
- return (h$2("div", { class: "TicketContainer" }, h$2("p", null, this.gameData.name), this.resetButton && this.ticketDone &&
23401
- h$2("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language)), this.autoPick && !this.ticketDone &&
23402
- h$2("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language)), this.grids.map((item, index) => h$2("div", { class: "TicketGridBullets" }, h$2("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), h$2("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))), rules.multiplier &&
23403
- h$2("div", null, h$2("label", { class: "Toggle" }, h$2("label", { class: "Label" }, translate('multiplier', this.language), ": "), h$2("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h$2("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
23404
- h$2("div", { class: "TicketDraws" }, h$2("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h$2("div", { class: "NumberInput" }, h$2("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h$2("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h$2("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h$2("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h$2("div", { class: "WagerInput" }, rules.stakes.length > 1 ? h$2("div", null, h$2("select", { class: "InputDefault", onChange: (event) => this.changeStake(event) }, rules.stakes.map((item) => h$2("option", { value: item.amount }, item.amount, " ", item.currency)))) : h$2("div", null, h$2("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), h$2("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))));
23405
- }
23406
- }
23407
- }
23408
- static get watchers() { return {
23409
- "numberOfDraws": ["drawsChangeHandler"]
23410
- }; }
23411
- };
23412
- LotteryTicket.style = lotteryTicketCss;
23413
-
23414
- const lotteryTicketControllerCss = ":host{display:block}";
23415
-
23416
- const LotteryTicketController = class {
23417
- constructor(hostRef) {
23418
- registerInstance(this, hostRef);
23419
- this.deleteTicketEvent = createEvent(this, "deleteTicket", 7);
23420
- /**
23421
- * Endpoint URL for the source of data (NorWAy standard)
23422
- */
23423
- this.endpoint = '';
23424
- /**
23425
- * Ticket number
23426
- */
23427
- this.ticketId = 1;
23428
- /**
23429
- * Activates postMessages as events for actions from the widget
23430
- */
23431
- this.postMessage = false;
23432
- /**
23433
- * Name of the event emitter by the action button
23434
- */
23435
- this.eventName = 'deleteTicketAction';
23436
- /**
23437
- * Collapsed
23438
- */
23439
- this.collapsed = true;
23440
- /**
23441
- * Number of grids?
23442
- */
23443
- this.numberOfGrids = 1;
23444
- /**
23445
- * This toggles if the last ticket added should be expanded or not
23446
- */
23447
- this.last = false;
23448
- /**
23449
- * Language
23450
- */
23451
- this.language = 'en';
23452
- /**
23453
- * Shows the auto-pick button
23454
- */
23455
- this.autoPick = false;
23456
- /**
23457
- * Shows the reset button
23458
- */
23459
- this.resetButton = false;
23460
- }
23461
- // @TODO fix the `any` type
23462
- helperAccordionActionHandler() {
23463
- if (this.postMessage) {
23464
- window.postMessage({ type: this.eventName }, window.location.href);
23465
- }
23466
- this.deleteTicketEvent.emit({
23467
- ticketId: this.ticketId
23468
- });
23469
- }
23470
- render() {
23471
- return (h$2("div", null, h$2("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language }, h$2("div", { slot: "accordionContent" }, h$2("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick })))));
23472
- }
23473
- };
23474
- LotteryTicketController.style = lotteryTicketControllerCss;
23475
-
23476
- export { Accordion as helper_accordion, HelperFilters as helper_filters, HelperModal as helper_modal, HelperTab as helper_tab, HelperTabs as helper_tabs, LotteryBullet as lottery_bullet, LotteryDrawResults as lottery_draw_results, LotteryDrawResultsHistory as lottery_draw_results_history, LotteryGameDetails as lottery_game_details, LotteryGamePage as lottery_game_page, LotteryGrid as lottery_grid, LotteryTicket as lottery_ticket, LotteryTicketController as lottery_ticket_controller };
22485
+ export { HelperFilters as helper_filters, LotteryDrawResults as lottery_draw_results };