@everymatrix/lottery-ticket 1.44.0 → 1.45.2

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 (53) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-f01e4770.js +1303 -0
  3. package/dist/cjs/loader.cjs.js +7 -13
  4. package/dist/cjs/lottery-bullet_3.cjs.entry.js +401 -458
  5. package/dist/cjs/lottery-ticket.cjs.js +17 -11
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/lottery-ticket/index.js +1 -0
  8. package/dist/collection/components/lottery-ticket/lottery-ticket.js +435 -485
  9. package/dist/collection/utils/locale.utils.js +52 -52
  10. package/dist/esm/app-globals-0f993ce5.js +3 -0
  11. package/dist/esm/index-cde6554c.js +1276 -0
  12. package/dist/esm/loader.js +7 -13
  13. package/dist/esm/lottery-bullet_3.entry.js +401 -458
  14. package/dist/esm/lottery-ticket.js +14 -11
  15. package/dist/lottery-ticket/lottery-ticket.esm.js +1 -1
  16. package/dist/lottery-ticket/p-174b5b05.entry.js +1 -0
  17. package/dist/lottery-ticket/p-73c1e1fd.js +2 -0
  18. package/dist/lottery-ticket/p-e1255160.js +1 -0
  19. package/dist/stencil.config.dev.js +17 -0
  20. package/dist/stencil.config.js +14 -19
  21. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.d.ts +2 -0
  22. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.dev.d.ts +2 -0
  23. package/dist/types/components/lottery-ticket/index.d.ts +1 -0
  24. package/dist/types/components/lottery-ticket/lottery-ticket.d.ts +78 -78
  25. package/dist/types/components/lottery-ticket/lottery-ticket.types.d.ts +31 -31
  26. package/dist/types/components.d.ts +24 -5
  27. package/dist/types/stencil-public-runtime.d.ts +142 -33
  28. package/loader/cdn.js +1 -3
  29. package/loader/index.cjs.js +1 -3
  30. package/loader/index.d.ts +13 -1
  31. package/loader/index.es2017.js +1 -3
  32. package/loader/index.js +1 -3
  33. package/loader/package.json +1 -0
  34. package/package.json +9 -2
  35. package/dist/cjs/index-e62c9a3f.js +0 -1283
  36. package/dist/components/index.d.ts +0 -26
  37. package/dist/components/index.js +0 -1
  38. package/dist/components/lottery-bullet.js +0 -6
  39. package/dist/components/lottery-bullet2.js +0 -91
  40. package/dist/components/lottery-grid.js +0 -6
  41. package/dist/components/lottery-grid2.js +0 -245
  42. package/dist/components/lottery-ticket.d.ts +0 -11
  43. package/dist/components/lottery-ticket.js +0 -276
  44. package/dist/esm/index-a0f57440.js +0 -1257
  45. package/dist/esm/polyfills/core-js.js +0 -11
  46. package/dist/esm/polyfills/css-shim.js +0 -1
  47. package/dist/esm/polyfills/dom.js +0 -79
  48. package/dist/esm/polyfills/es5-html-element.js +0 -1
  49. package/dist/esm/polyfills/index.js +0 -34
  50. package/dist/esm/polyfills/system.js +0 -6
  51. package/dist/lottery-ticket/p-5aa3d0a5.entry.js +0 -1
  52. package/dist/lottery-ticket/p-9cd1415d.js +0 -1
  53. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/lottery-ticket/.stencil/packages/lottery-ticket/stencil.config.d.ts +0 -2
@@ -1,498 +1,441 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-a0f57440.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-cde6554c.js';
2
2
 
3
- const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, white 0%, white 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, white 0%, #f1f1f1 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;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{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;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 #D4D4D4;cursor:default}";
3
+ const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, rgb(255, 255, 255) 0%, rgb(241, 241, 241) 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;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{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;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 #D4D4D4;cursor:default}";
4
+ const LotteryBulletStyle0 = lotteryBulletCss;
4
5
 
5
6
  const LotteryBullet = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
9
- /**
10
- * Value of the bullet
11
- */
12
- this.value = '0';
13
- /**
14
- * Marks if the bullet should be selectable
15
- */
16
- this.selectable = true;
17
- /**
18
- * Marks if the bullet should be selected
19
- */
20
- this.isSelected = false;
21
- /**
22
- * Client custom styling via string
23
- */
24
- this.clientStyling = '';
25
- /**
26
- * Client custom styling via url content
27
- */
28
- this.clientStylingUrlContent = '';
29
- this.limitStylingAppends = false;
30
- this.select = () => {
31
- if (this.selectable) {
32
- this.isSelected = !this.isSelected;
33
- this.bulletEvent.emit({
34
- value: this.value,
35
- selected: this.isSelected
36
- });
37
- }
38
- };
39
- this.setClientStyling = () => {
40
- let sheet = document.createElement('style');
41
- sheet.innerHTML = this.clientStyling;
42
- this.stylingContainer.prepend(sheet);
43
- };
44
- this.setClientStylingURL = () => {
45
- let cssFile = document.createElement('style');
46
- setTimeout(() => {
47
- cssFile.innerHTML = this.clientStylingUrlContent;
48
- this.stylingContainer.prepend(cssFile);
49
- }, 1);
50
- };
51
- }
52
- componentDidRender() {
53
- // start custom styling area
54
- if (!this.limitStylingAppends && this.stylingContainer) {
55
- if (this.clientStyling)
56
- this.setClientStyling();
57
- if (this.clientStylingUrlContent)
58
- this.setClientStylingURL();
59
- this.limitStylingAppends = true;
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
10
+ this.select = () => {
11
+ if (this.selectable) {
12
+ this.isSelected = !this.isSelected;
13
+ this.bulletEvent.emit({
14
+ value: this.value,
15
+ selected: this.isSelected
16
+ });
17
+ }
18
+ };
19
+ this.setClientStyling = () => {
20
+ let sheet = document.createElement('style');
21
+ sheet.innerHTML = this.clientStyling;
22
+ this.stylingContainer.prepend(sheet);
23
+ };
24
+ this.setClientStylingURL = () => {
25
+ let cssFile = document.createElement('style');
26
+ setTimeout(() => {
27
+ cssFile.innerHTML = this.clientStylingUrlContent;
28
+ this.stylingContainer.prepend(cssFile);
29
+ }, 1);
30
+ };
31
+ this.value = '0';
32
+ this.selectable = true;
33
+ this.isSelected = false;
34
+ this.clientStyling = '';
35
+ this.clientStylingUrlContent = '';
36
+ this.limitStylingAppends = false;
37
+ }
38
+ componentDidRender() {
39
+ // start custom styling area
40
+ if (!this.limitStylingAppends && this.stylingContainer) {
41
+ if (this.clientStyling)
42
+ this.setClientStyling();
43
+ if (this.clientStylingUrlContent)
44
+ this.setClientStylingURL();
45
+ this.limitStylingAppends = true;
46
+ }
47
+ // end custom styling area
48
+ }
49
+ render() {
50
+ return (h("div", { key: 'af3601684ecf1f39d65fc9461430cba96b9e4b8c', class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
60
51
  }
61
- // end custom styling area
62
- }
63
- render() {
64
- return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
65
- }
66
52
  };
67
- LotteryBullet.style = lotteryBulletCss;
53
+ LotteryBullet.style = LotteryBulletStyle0;
68
54
 
69
55
  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:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.Grid.TicketGrid{gap:5px}";
56
+ const LotteryGridStyle0 = lotteryGridCss;
70
57
 
71
58
  const LotteryGrid = class {
72
- constructor(hostRef) {
73
- registerInstance(this, hostRef);
74
- this.gridFilledEvent = createEvent(this, "gridFilled", 7);
75
- this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
76
- /**
77
- * Number of bullets of grid
78
- */
79
- this.totalNumbers = 0;
80
- /**
81
- * Number of maximum bullets that can be selected
82
- */
83
- this.maximumAllowed = 0;
84
- /**
85
- * Minimum allowed of bullets
86
- */
87
- this.minimumAllowed = 1;
88
- /**
89
- * Allows the user to select numbers on the grid
90
- */
91
- this.selectable = true;
92
- /**
93
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
94
- */
95
- this.selectedNumbers = '';
96
- /**
97
- * Show only selected numbers
98
- */
99
- this.displaySelected = false;
100
- /**
101
- * Language
102
- */
103
- this.language = 'en';
104
- /**
105
- * Personalize grid for ticket
106
- */
107
- this.gridType = '';
108
- /**
109
- * Client custom styling via string
110
- */
111
- this.clientStyling = '';
112
- /**
113
- * Client custom styling via url content
114
- */
115
- this.clientStylingUrlContent = '';
116
- this.numbers = [];
117
- this.limitStylingAppends = false;
118
- this.selectedCounter = 0;
119
- this.setClientStyling = () => {
120
- let sheet = document.createElement('style');
121
- sheet.innerHTML = this.clientStyling;
122
- this.stylingContainer.prepend(sheet);
123
- };
124
- this.setClientStylingURL = () => {
125
- let cssFile = document.createElement('style');
126
- setTimeout(() => {
127
- cssFile.innerHTML = this.clientStylingUrlContent;
128
- this.stylingContainer.prepend(cssFile);
129
- }, 1);
130
- };
131
- }
132
- connectedCallback() {
133
- let selected = [];
134
- if (this.selectedNumbers.length > 0) {
135
- selected = this.selectedNumbers.split(',');
136
- this.selectedCounter = selected.length;
137
- }
138
- if (this.displaySelected) {
139
- selected.forEach((item) => {
140
- this.numbers.push({
141
- number: item,
142
- selected: true,
143
- selectable: this.selectable
144
- });
145
- });
59
+ constructor(hostRef) {
60
+ registerInstance(this, hostRef);
61
+ this.gridFilledEvent = createEvent(this, "gridFilled", 7);
62
+ this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
63
+ this.selectedCounter = 0;
64
+ this.setClientStyling = () => {
65
+ let sheet = document.createElement('style');
66
+ sheet.innerHTML = this.clientStyling;
67
+ this.stylingContainer.prepend(sheet);
68
+ };
69
+ this.setClientStylingURL = () => {
70
+ let cssFile = document.createElement('style');
71
+ setTimeout(() => {
72
+ cssFile.innerHTML = this.clientStylingUrlContent;
73
+ this.stylingContainer.prepend(cssFile);
74
+ }, 1);
75
+ };
76
+ this.ticketId = undefined;
77
+ this.totalNumbers = 0;
78
+ this.gameId = undefined;
79
+ this.maximumAllowed = 0;
80
+ this.minimumAllowed = 1;
81
+ this.selectable = true;
82
+ this.selectedNumbers = '';
83
+ this.displaySelected = false;
84
+ this.language = 'en';
85
+ this.gridIndex = undefined;
86
+ this.gridType = '';
87
+ this.clientStyling = '';
88
+ this.clientStylingUrlContent = '';
89
+ this.numbers = [];
90
+ this.limitStylingAppends = false;
146
91
  }
147
- else {
148
- [...Array(this.totalNumbers).keys()]
149
- .map(number => (number + 1).toString())
150
- .forEach((number) => {
151
- this.numbers.push({
152
- number,
153
- selected: selected.indexOf(number) >= 0 ? true : false,
154
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
155
- });
156
- });
92
+ connectedCallback() {
93
+ let selected = [];
94
+ if (this.selectedNumbers.length > 0) {
95
+ selected = this.selectedNumbers.split(',');
96
+ this.selectedCounter = selected.length;
97
+ }
98
+ if (this.displaySelected) {
99
+ selected.forEach((item) => {
100
+ this.numbers.push({
101
+ number: item,
102
+ selected: true,
103
+ selectable: this.selectable
104
+ });
105
+ });
106
+ }
107
+ else {
108
+ [...Array(this.totalNumbers).keys()]
109
+ .map(number => (number + 1).toString())
110
+ .forEach((number) => {
111
+ this.numbers.push({
112
+ number,
113
+ selected: selected.indexOf(number) >= 0 ? true : false,
114
+ selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
115
+ });
116
+ });
117
+ }
157
118
  }
158
- }
159
- componentDidRender() {
160
- // start custom styling area
161
- if (!this.limitStylingAppends && this.stylingContainer) {
162
- if (this.clientStyling)
163
- this.setClientStyling();
164
- if (this.clientStylingUrlContent)
165
- this.setClientStylingURL();
166
- this.limitStylingAppends = true;
119
+ componentDidRender() {
120
+ // start custom styling area
121
+ if (!this.limitStylingAppends && this.stylingContainer) {
122
+ if (this.clientStyling)
123
+ this.setClientStyling();
124
+ if (this.clientStylingUrlContent)
125
+ this.setClientStylingURL();
126
+ this.limitStylingAppends = true;
127
+ }
128
+ // end custom styling area
167
129
  }
168
- // end custom styling area
169
- }
170
- // wrote this because the classic .sort(() => 0.5 - Math.random()) method yielded low entropy shuffles for some reason on certain devices
171
- shuffleArray(array) {
172
- const result = [];
173
- while (array.length > 0) {
174
- const randomIndex = Math.floor(Math.random() * (array.length));
175
- result.push(array.splice(randomIndex, 1)[0]);
130
+ // wrote this because the classic .sort(() => 0.5 - Math.random()) method yielded low entropy shuffles for some reason on certain devices
131
+ shuffleArray(array) {
132
+ const result = [];
133
+ while (array.length > 0) {
134
+ const randomIndex = Math.floor(Math.random() * (array.length));
135
+ result.push(array.splice(randomIndex, 1)[0]);
136
+ }
137
+ return result;
176
138
  }
177
- return result;
178
- }
179
- lotteryBulletSelectionHandler(event) {
180
- this.numbers = this.numbers.map((item) => {
181
- if (item.number == event.detail.value) {
182
- return {
183
- number: item.number,
184
- selected: event.detail.selected,
185
- selectable: item.selectable
186
- };
187
- }
188
- return {
189
- number: item.number,
190
- selected: item.selected,
191
- selectable: item.selectable
192
- };
193
- });
194
- if (event.detail.selected) {
195
- this.selectedCounter += 1;
196
- if (this.selectedCounter == this.maximumAllowed) {
139
+ lotteryBulletSelectionHandler(event) {
197
140
  this.numbers = this.numbers.map((item) => {
198
- return {
199
- number: item.number,
200
- selected: item.selected,
201
- selectable: item.selected ? true : false
202
- };
203
- });
204
- this.gridFilledEvent.emit({
205
- id: this.ticketId,
206
- index: this.gridIndex,
207
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
141
+ if (item.number == event.detail.value) {
142
+ return {
143
+ number: item.number,
144
+ selected: event.detail.selected,
145
+ selectable: item.selectable
146
+ };
147
+ }
148
+ return {
149
+ number: item.number,
150
+ selected: item.selected,
151
+ selectable: item.selectable
152
+ };
208
153
  });
209
- }
154
+ if (event.detail.selected) {
155
+ this.selectedCounter += 1;
156
+ if (this.selectedCounter == this.maximumAllowed) {
157
+ this.numbers = this.numbers.map((item) => {
158
+ return {
159
+ number: item.number,
160
+ selected: item.selected,
161
+ selectable: item.selected ? true : false
162
+ };
163
+ });
164
+ this.gridFilledEvent.emit({
165
+ id: this.ticketId,
166
+ index: this.gridIndex,
167
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
168
+ });
169
+ }
170
+ }
171
+ else {
172
+ if (this.selectedCounter == this.maximumAllowed) {
173
+ this.numbers = this.numbers.map((item) => {
174
+ return {
175
+ number: item.number,
176
+ selected: item.selected,
177
+ selectable: true
178
+ };
179
+ });
180
+ this.gridDirtyEvent.emit({
181
+ id: this.ticketId,
182
+ index: this.gridIndex,
183
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
184
+ });
185
+ }
186
+ this.selectedCounter -= 1;
187
+ }
210
188
  }
211
- else {
212
- if (this.selectedCounter == this.maximumAllowed) {
213
- this.numbers = this.numbers.map((item) => {
214
- return {
215
- number: item.number,
216
- selected: item.selected,
217
- selectable: true
218
- };
219
- });
220
- this.gridDirtyEvent.emit({
221
- id: this.ticketId,
222
- index: this.gridIndex,
223
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
224
- });
225
- }
226
- this.selectedCounter -= 1;
189
+ async resetSelectionHandler(event) {
190
+ if (event.detail && event.detail == this.ticketId) {
191
+ this.selectedCounter = 0;
192
+ this.numbers = this.numbers.map((item) => {
193
+ return {
194
+ number: item.number,
195
+ selected: false,
196
+ selectable: this.selectable
197
+ };
198
+ });
199
+ this.gridDirtyEvent.emit({
200
+ id: this.ticketId,
201
+ index: this.gridIndex,
202
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
203
+ });
204
+ }
227
205
  }
228
- }
229
- async resetSelectionHandler(event) {
230
- if (event.detail && event.detail == this.ticketId) {
231
- this.selectedCounter = 0;
232
- this.numbers = this.numbers.map((item) => {
233
- return {
234
- number: item.number,
235
- selected: false,
236
- selectable: this.selectable
237
- };
238
- });
239
- this.gridDirtyEvent.emit({
240
- id: this.ticketId,
241
- index: this.gridIndex,
242
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
243
- });
206
+ async autoSelectionHandler(event) {
207
+ if (event.detail && event.detail == this.ticketId) {
208
+ this.resetSelectionHandler(event);
209
+ let array = [...Array(this.totalNumbers).keys()]
210
+ .map(number => number + 1);
211
+ array = this.shuffleArray(array);
212
+ array = array.slice(0, this.minimumAllowed);
213
+ this.numbers = this.numbers.map((item) => {
214
+ return {
215
+ number: item.number,
216
+ selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
217
+ selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
218
+ };
219
+ });
220
+ this.gridFilledEvent.emit({
221
+ id: this.ticketId,
222
+ index: this.gridIndex,
223
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
224
+ });
225
+ this.selectedCounter = this.maximumAllowed;
226
+ }
244
227
  }
245
- }
246
- async autoSelectionHandler(event) {
247
- if (event.detail && event.detail == this.ticketId) {
248
- this.resetSelectionHandler(event);
249
- let array = [...Array(this.totalNumbers).keys()]
250
- .map(number => number + 1);
251
- array = this.shuffleArray(array);
252
- array = array.slice(0, this.minimumAllowed);
253
- this.numbers = this.numbers.map((item) => {
254
- return {
255
- number: item.number,
256
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
257
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
258
- };
259
- });
260
- this.gridFilledEvent.emit({
261
- id: this.ticketId,
262
- index: this.gridIndex,
263
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
264
- });
265
- this.selectedCounter = this.maximumAllowed;
228
+ render() {
229
+ return (h("div", { key: '54b9187146b5d2625fd5ce7f53f38abf091cd943', class: "GridContainer", ref: el => this.stylingContainer = el }, h("div", { key: 'e7e8570557ebaa78edf881cdbc1ed720028cdf6e', class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
266
230
  }
267
- }
268
- render() {
269
- return (h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
270
- }
271
231
  };
272
- LotteryGrid.style = lotteryGridCss;
232
+ LotteryGrid.style = LotteryGridStyle0;
273
233
 
274
234
  const DEFAULT_LANGUAGE = 'en';
275
235
  const SUPPORTED_LANGUAGES = ['ro', 'en', 'hr'];
276
236
  const TRANSLATIONS = {
277
- en: {
278
- loading: 'Loading, please wait ...',
279
- error: 'It was an error while trying to fetch the data',
280
- grid: 'Grid',
281
- multiplier: 'Multiplier',
282
- numberOfDraws: 'Number of draws',
283
- wagerPerDraw: 'Wager per draw',
284
- resetButton: 'Reset',
285
- autoButton: 'I feel lucky'
286
- },
287
- ro: {
288
- loading: 'Se incarca, va rugam asteptati ...',
289
- error: 'A fost o eroare in timp ce asteptam datele',
290
- grid: 'Grid',
291
- multiplier: 'Multiplicator',
292
- numberOfDraws: 'Numarul de extrageri',
293
- wagerPerDraw: 'Pariul per extragere',
294
- resetButton: 'Reseteaza',
295
- autoButton: 'Ma simt norocos'
296
- },
297
- fr: {
298
- loading: 'Loading, please wait ...',
299
- error: 'It was an error while trying to fetch the data',
300
- grid: 'Grid',
301
- multiplier: 'Multiplier',
302
- numberOfDraws: 'Number of draws',
303
- wagerPerDraw: 'Wager per draw',
304
- resetButton: 'Reset',
305
- autoButton: 'I feel lucky'
306
- },
307
- ar: {
308
- loading: 'Loading, please wait ...',
309
- error: 'It was an error while trying to fetch the data',
310
- grid: 'Grid',
311
- multiplier: 'Multiplier',
312
- numberOfDraws: 'Number of draws',
313
- wagerPerDraw: 'Wager per draw',
314
- resetButton: 'Reset',
315
- autoButton: 'I feel lucky'
316
- },
317
- hr: {
318
- loading: 'Učitavanje, molimo pričekajte ...',
319
- error: 'Došlo je do pogreške prilikom pokušaja dohvaćanja podataka',
320
- grid: 'Tablica',
321
- multiplier: 'Multiplikator',
322
- numberOfDraws: 'Broj izvlačenja',
323
- wagerPerDraw: 'Ulog po izvlačenju',
324
- resetButton: 'Resetiraj',
325
- autoButton: 'Osjećam se sretno'
326
- }
237
+ en: {
238
+ loading: 'Loading, please wait ...',
239
+ error: 'It was an error while trying to fetch the data',
240
+ grid: 'Grid',
241
+ multiplier: 'Multiplier',
242
+ numberOfDraws: 'Number of draws',
243
+ wagerPerDraw: 'Wager per draw',
244
+ resetButton: 'Reset',
245
+ autoButton: 'I feel lucky'
246
+ },
247
+ ro: {
248
+ loading: 'Se incarca, va rugam asteptati ...',
249
+ error: 'A fost o eroare in timp ce asteptam datele',
250
+ grid: 'Grid',
251
+ multiplier: 'Multiplicator',
252
+ numberOfDraws: 'Numarul de extrageri',
253
+ wagerPerDraw: 'Pariul per extragere',
254
+ resetButton: 'Reseteaza',
255
+ autoButton: 'Ma simt norocos'
256
+ },
257
+ fr: {
258
+ loading: 'Loading, please wait ...',
259
+ error: 'It was an error while trying to fetch the data',
260
+ grid: 'Grid',
261
+ multiplier: 'Multiplier',
262
+ numberOfDraws: 'Number of draws',
263
+ wagerPerDraw: 'Wager per draw',
264
+ resetButton: 'Reset',
265
+ autoButton: 'I feel lucky'
266
+ },
267
+ ar: {
268
+ loading: 'Loading, please wait ...',
269
+ error: 'It was an error while trying to fetch the data',
270
+ grid: 'Grid',
271
+ multiplier: 'Multiplier',
272
+ numberOfDraws: 'Number of draws',
273
+ wagerPerDraw: 'Wager per draw',
274
+ resetButton: 'Reset',
275
+ autoButton: 'I feel lucky'
276
+ },
277
+ hr: {
278
+ loading: 'Učitavanje, molimo pričekajte ...',
279
+ error: 'Došlo je do pogreške prilikom pokušaja dohvaćanja podataka',
280
+ grid: 'Tablica',
281
+ multiplier: 'Multiplikator',
282
+ numberOfDraws: 'Broj izvlačenja',
283
+ wagerPerDraw: 'Ulog po izvlačenju',
284
+ resetButton: 'Resetiraj',
285
+ autoButton: 'Osjećam se sretno'
286
+ }
327
287
  };
328
288
  const translate = (key, customLang) => {
329
- const lang = customLang;
330
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
289
+ const lang = customLang;
290
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
331
291
  };
332
292
 
333
293
  const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketTitle{font-size:16px;font-weight:bold}.ButtonContainer{display:flex;justify-content:flex-end}.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;border:none;align-items:center;justify-content:center;height:20px;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);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:inline-block;border-radius:4px;padding:8px 20px;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:inline-block;border-radius:4px;padding:8px 20px;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}.Minus{border-radius:4px;width:30px;height:24px !important;margin-right:10px;color:#FFF;background:#009993}.Plus{border-radius:4px;width:30px;height:24px !important;margin-left:10px;color:#FFF;background:#009993}.SelectWrapper{width:auto;padding:5px;margin:0 auto;border:1px solid #ccc;border-radius:5px;position:relative}.SelectButton,.SelectOptions li{display:flex;align-items:center;cursor:pointer}.SelectButton{display:flex;padding:0 5px;border-radius:7px;align-items:center;justify-content:space-between;font-size:14px}.SelectButton span:first-child{padding-right:10px}.SelectExpand{transition:transform 0.3s linear;font-size:12px}.SelectActive .SelectExpand{transform:rotate(180deg)}.SelectContent{display:none;padding:5px;border-radius:7px}.SelectWrapper.SelectActive .SelectContent{width:100%;display:block;position:absolute;left:0;top:32px;padding:0;border:1px solid #ccc;overflow:hidden;background:#fff}.SelectContent .SelectOptions{max-height:100px;margin:0;overflow-y:auto;padding:0}.SelectContent .SelectOptions .SelectedValue{background-color:#009993;color:#fff}.SelectOptions::-webkit-scrollbar{width:7px}.SelectOptions::-webkit-scrollbar-track{background:#f1f1f1;border-radius:25px}.SelectOptions::-webkit-scrollbar-thumb{background:#ccc;border-radius:25px}.SelectOptions li{height:20px;padding:0 13px;font-size:14px}.SelectOptions li:hover{background:#f2f2f2}";
294
+ const LotteryTicketStyle0 = lotteryTicketCss;
334
295
 
335
296
  const LotteryTicket = class {
336
- constructor(hostRef) {
337
- registerInstance(this, hostRef);
338
- this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
339
- this.autoSelection = createEvent(this, "autoSelection", 7);
340
- this.resetSelection = createEvent(this, "resetSelection", 7);
341
- this.stakeChange = createEvent(this, "stakeChange", 7);
342
- this.multiplierChange = createEvent(this, "multiplierChange", 7);
343
- /**
344
- * Number of grids of a ticket
345
- */
346
- this.numberOfGrids = 1;
347
- /**
348
- * Option to have the ticket registered for multiple draws
349
- */
350
- this.multipleDraws = true;
351
- /**
352
- * Shows the reset button
353
- */
354
- this.resetButton = false;
355
- /**
356
- * Shows the auto-pick button
357
- */
358
- this.autoPick = false;
359
- /**
360
- * Language
361
- */
362
- this.language = 'en';
363
- /**
364
- * Client custom styling via string
365
- */
366
- this.clientStyling = '';
297
+ constructor(hostRef) {
298
+ registerInstance(this, hostRef);
299
+ this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
300
+ this.autoSelection = createEvent(this, "autoSelection", 7);
301
+ this.resetSelection = createEvent(this, "resetSelection", 7);
302
+ this.stakeChange = createEvent(this, "stakeChange", 7);
303
+ this.multiplierChange = createEvent(this, "multiplierChange", 7);
304
+ this.setClientStyling = () => {
305
+ let sheet = document.createElement('style');
306
+ sheet.innerHTML = this.clientStyling;
307
+ this.stylingContainer.prepend(sheet);
308
+ };
309
+ this.setClientStylingURL = () => {
310
+ let cssFile = document.createElement('style');
311
+ setTimeout(() => {
312
+ cssFile.innerHTML = this.clientStylingUrlContent;
313
+ this.stylingContainer.prepend(cssFile);
314
+ }, 1);
315
+ };
316
+ this.endpoint = undefined;
317
+ this.gameId = undefined;
318
+ this.numberOfGrids = 1;
319
+ this.multipleDraws = true;
320
+ this.ticketId = undefined;
321
+ this.resetButton = false;
322
+ this.autoPick = false;
323
+ this.language = 'en';
324
+ this.clientStyling = '';
325
+ this.clientStylingUrlContent = '';
326
+ this.multiplier = false;
327
+ this.numberOfDraws = 1;
328
+ this.isLoading = true;
329
+ this.hasErrors = false;
330
+ this.ticketDone = false;
331
+ this.isCustomSelect = false;
332
+ this.amountInfo = {};
333
+ this.limitStylingAppends = false;
334
+ }
367
335
  /**
368
- * Client custom styling via url content
336
+ * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
369
337
  */
370
- this.clientStylingUrlContent = '';
371
- this.multiplier = false;
372
- this.numberOfDraws = 1;
373
- this.isLoading = true;
374
- this.hasErrors = false;
375
- this.ticketDone = false;
376
- this.isCustomSelect = false;
377
- this.amountInfo = {};
378
- this.limitStylingAppends = false;
379
- this.setClientStyling = () => {
380
- let sheet = document.createElement('style');
381
- sheet.innerHTML = this.clientStyling;
382
- this.stylingContainer.prepend(sheet);
383
- };
384
- this.setClientStylingURL = () => {
385
- let cssFile = document.createElement('style');
386
- setTimeout(() => {
387
- cssFile.innerHTML = this.clientStylingUrlContent;
388
- this.stylingContainer.prepend(cssFile);
389
- }, 1);
390
- };
391
- }
392
- /**
393
- * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
394
- */
395
- checkForClickOutside(ev) {
396
- if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
397
- this.isCustomSelect = false;
338
+ checkForClickOutside(ev) {
339
+ if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
340
+ this.isCustomSelect = false;
341
+ }
342
+ }
343
+ connectedCallback() {
344
+ let url = new URL(`${this.endpoint}/games/${this.gameId}`);
345
+ fetch(url.href)
346
+ .then((response) => {
347
+ if (response.ok) {
348
+ return response.json();
349
+ }
350
+ else {
351
+ // Throw error
352
+ this.hasErrors = true;
353
+ }
354
+ })
355
+ .then((data) => {
356
+ this.isLoading = false;
357
+ this.gameData = data;
358
+ this.grids = [...Array(this.gameData.type.boards.length).keys()];
359
+ this.amountInfo = this.gameData.type.stakes[0]; // initial value for select
360
+ })
361
+ .catch((err) => {
362
+ this.isLoading = false;
363
+ this.hasErrors = true;
364
+ console.error('Error!', err);
365
+ });
398
366
  }
399
- }
400
- connectedCallback() {
401
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
402
- fetch(url.href)
403
- .then((response) => {
404
- if (response.ok) {
405
- return response.json();
406
- }
407
- else {
408
- // Throw error
409
- this.hasErrors = true;
410
- }
411
- })
412
- .then((data) => {
413
- this.isLoading = false;
414
- this.gameData = data;
415
- this.grids = [...Array(this.gameData.type.boards.length).keys()];
416
- this.amountInfo = this.gameData.type.stakes[0]; // initial value for select
417
- })
418
- .catch((err) => {
419
- this.isLoading = false;
420
- this.hasErrors = true;
421
- console.error('Error!', err);
422
- });
423
- }
424
- componentDidRender() {
425
- // start custom styling area
426
- if (!this.limitStylingAppends && this.stylingContainer) {
427
- if (this.clientStyling)
428
- this.setClientStyling();
429
- if (this.clientStylingUrlContent)
430
- this.setClientStylingURL();
431
- this.limitStylingAppends = true;
367
+ componentDidRender() {
368
+ // start custom styling area
369
+ if (!this.limitStylingAppends && this.stylingContainer) {
370
+ if (this.clientStyling)
371
+ this.setClientStyling();
372
+ if (this.clientStylingUrlContent)
373
+ this.setClientStylingURL();
374
+ this.limitStylingAppends = true;
375
+ }
376
+ // end custom styling area
432
377
  }
433
- // end custom styling area
434
- }
435
- multiplierChangeHandler(e) {
436
- this.multiplier = e.target ? e.target.checked : false;
437
- this.multiplierChange.emit(this.multiplier);
438
- }
439
- drawsChangeHandler(event) {
440
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
441
- this.ticketCompleted.emit(this.ticket);
442
- }
443
- gridFilledHandler(event) {
444
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
445
- this.ticketDone = true;
446
- this.ticketCompleted.emit(this.ticket);
447
- }
448
- toggleAutoSelection() {
449
- this.ticketDone = true;
450
- this.autoSelection.emit(this.ticketId);
451
- }
452
- toggleResetSelection() {
453
- this.ticketDone = false;
454
- this.resetSelection.emit(this.ticketId);
455
- }
456
- changeStake(ticketid, amount) {
457
- this.stakeChange.emit({
458
- ticketId: ticketid,
459
- stake: amount
460
- });
461
- }
462
- toggleClass() {
463
- this.isCustomSelect = !this.isCustomSelect;
464
- }
465
- setDropdownItem(item) {
466
- this.amountInfo = {
467
- value: item.value,
468
- currency: item.currency
469
- };
470
- this.isCustomSelect = false;
471
- this.changeStake(this.ticketId, item.amount);
472
- }
473
- render() {
474
- if (this.isLoading) {
475
- return (h("div", null, h("p", null, translate('loading', this.language))));
378
+ multiplierChangeHandler(e) {
379
+ this.multiplier = e.target ? e.target.checked : false;
380
+ this.multiplierChange.emit(this.multiplier);
381
+ }
382
+ drawsChangeHandler(event) {
383
+ this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
384
+ this.ticketCompleted.emit(this.ticket);
385
+ }
386
+ gridFilledHandler(event) {
387
+ this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
388
+ this.ticketDone = true;
389
+ this.ticketCompleted.emit(this.ticket);
390
+ }
391
+ toggleAutoSelection() {
392
+ this.ticketDone = true;
393
+ this.autoSelection.emit(this.ticketId);
394
+ }
395
+ toggleResetSelection() {
396
+ this.ticketDone = false;
397
+ this.resetSelection.emit(this.ticketId);
398
+ }
399
+ changeStake(ticketid, amount) {
400
+ this.stakeChange.emit({
401
+ ticketId: ticketid,
402
+ stake: amount
403
+ });
404
+ }
405
+ toggleClass() {
406
+ this.isCustomSelect = !this.isCustomSelect;
407
+ }
408
+ setDropdownItem(item) {
409
+ this.amountInfo = {
410
+ value: item.value,
411
+ currency: item.currency
412
+ };
413
+ this.isCustomSelect = false;
414
+ this.changeStake(this.ticketId, item.amount);
476
415
  }
477
- else {
478
- if (this.hasErrors) {
479
- return (h("div", null, h("p", null, translate('error', this.language))));
480
- }
481
- else {
482
- const { type } = this.gameData;
483
- return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
484
- h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
485
- h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((_, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", index + 1), h("lottery-grid", { "grid-index": index, "maximum-allowed": type.boards[index].maximumAllowed, "minimum-allowed": type.boards[index].minimumAllowed, "total-numbers": type.boards[index].highNumber - type.boards[index].lowNumber + 1, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), type.multiplier &&
486
- h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
487
- h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h("div", { class: "NumberInput" }, h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h("div", null, h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, type.stakes.length > 1 ?
488
- (h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.value, " ", this.amountInfo.currency), h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, type.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.value == item.value ? 'SelectedValue' : '', value: item.value, onClick: () => this.setDropdownItem(item) }, item.value, " ", item.currency)))))) : (h("div", null, h("input", { min: "1", value: type.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, type.stakes[0].currency)))))));
489
- }
416
+ render() {
417
+ if (this.isLoading) {
418
+ return (h("div", null, h("p", null, translate('loading', this.language))));
419
+ }
420
+ else {
421
+ if (this.hasErrors) {
422
+ return (h("div", null, h("p", null, translate('error', this.language))));
423
+ }
424
+ else {
425
+ const { type } = this.gameData;
426
+ return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
427
+ h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
428
+ h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((_, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", index + 1), h("lottery-grid", { "grid-index": index, "maximum-allowed": type.boards[index].maximumAllowed, "minimum-allowed": type.boards[index].minimumAllowed, "total-numbers": type.boards[index].highNumber - type.boards[index].lowNumber + 1, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), type.multiplier &&
429
+ h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
430
+ h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h("div", { class: "NumberInput" }, h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h("div", null, h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, type.stakes.length > 1 ?
431
+ (h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.value, " ", this.amountInfo.currency), h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, type.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.value == item.value ? 'SelectedValue' : '', value: item.value, onClick: () => this.setDropdownItem(item) }, item.value, " ", item.currency)))))) : (h("div", null, h("input", { min: "1", value: type.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, type.stakes[0].currency)))))));
432
+ }
433
+ }
490
434
  }
491
- }
492
- static get watchers() { return {
493
- "numberOfDraws": ["drawsChangeHandler"]
494
- }; }
435
+ static get watchers() { return {
436
+ "numberOfDraws": ["drawsChangeHandler"]
437
+ }; }
495
438
  };
496
- LotteryTicket.style = lotteryTicketCss;
439
+ LotteryTicket.style = LotteryTicketStyle0;
497
440
 
498
441
  export { LotteryBullet as lottery_bullet, LotteryGrid as lottery_grid, LotteryTicket as lottery_ticket };