@everymatrix/lottery-ticket 1.31.2 → 1.32.4

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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +4 -3
  3. package/dist/cjs/index-e62c9a3f.js +0 -1283
  4. package/dist/cjs/index.cjs.js +0 -2
  5. package/dist/cjs/loader.cjs.js +0 -21
  6. package/dist/cjs/lottery-bullet_3.cjs.entry.js +0 -504
  7. package/dist/cjs/lottery-ticket.cjs.js +0 -19
  8. package/dist/collection/collection-manifest.json +0 -25
  9. package/dist/collection/components/lottery-ticket/lottery-ticket.css +0 -307
  10. package/dist/collection/components/lottery-ticket/lottery-ticket.js +0 -494
  11. package/dist/collection/components/lottery-ticket/lottery-ticket.types.js +0 -1
  12. package/dist/collection/index.js +0 -1
  13. package/dist/collection/utils/locale.utils.js +0 -58
  14. package/dist/collection/utils/utils.js +0 -0
  15. package/dist/components/index.d.ts +0 -26
  16. package/dist/components/index.js +0 -1
  17. package/dist/components/lottery-bullet.js +0 -6
  18. package/dist/components/lottery-bullet2.js +0 -91
  19. package/dist/components/lottery-grid.js +0 -6
  20. package/dist/components/lottery-grid2.js +0 -245
  21. package/dist/components/lottery-ticket.d.ts +0 -11
  22. package/dist/components/lottery-ticket.js +0 -276
  23. package/dist/esm/index-a0f57440.js +0 -1257
  24. package/dist/esm/index.js +0 -1
  25. package/dist/esm/loader.js +0 -17
  26. package/dist/esm/lottery-bullet_3.entry.js +0 -498
  27. package/dist/esm/lottery-ticket.js +0 -17
  28. package/dist/esm/polyfills/core-js.js +0 -11
  29. package/dist/esm/polyfills/css-shim.js +0 -1
  30. package/dist/esm/polyfills/dom.js +0 -79
  31. package/dist/esm/polyfills/es5-html-element.js +0 -1
  32. package/dist/esm/polyfills/index.js +0 -34
  33. package/dist/esm/polyfills/system.js +0 -6
  34. package/dist/index.cjs.js +0 -1
  35. package/dist/index.js +0 -1
  36. package/dist/lottery-ticket/index.esm.js +0 -0
  37. package/dist/lottery-ticket/lottery-ticket.esm.js +0 -1
  38. package/dist/lottery-ticket/p-5aa3d0a5.entry.js +0 -1
  39. package/dist/lottery-ticket/p-9cd1415d.js +0 -1
  40. package/dist/stencil.config.js +0 -22
  41. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/lottery-ticket/.stencil/packages/lottery-ticket/stencil.config.d.ts +0 -2
  42. package/dist/types/components/lottery-ticket/lottery-ticket.d.ts +0 -82
  43. package/dist/types/components/lottery-ticket/lottery-ticket.types.d.ts +0 -49
  44. package/dist/types/components.d.ts +0 -125
  45. package/dist/types/index.d.ts +0 -1
  46. package/dist/types/stencil-public-runtime.d.ts +0 -1565
  47. package/dist/types/utils/locale.utils.d.ts +0 -1
  48. package/dist/types/utils/utils.d.ts +0 -0
  49. package/loader/cdn.js +0 -3
  50. package/loader/index.cjs.js +0 -3
  51. package/loader/index.d.ts +0 -12
  52. package/loader/index.es2017.js +0 -3
  53. package/loader/index.js +0 -4
  54. package/loader/package.json +0 -10
package/dist/esm/index.js DELETED
@@ -1 +0,0 @@
1
-
@@ -1,17 +0,0 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-a0f57440.js';
2
-
3
- /*
4
- Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
5
- */
6
- const patchEsm = () => {
7
- return promiseResolve();
8
- };
9
-
10
- const defineCustomElements = (win, options) => {
11
- if (typeof window === 'undefined') return Promise.resolve();
12
- return patchEsm().then(() => {
13
- return bootstrapLazy([["lottery-bullet_3",[[1,"lottery-ticket",{"endpoint":[513],"gameId":[513,"game-id"],"numberOfGrids":[514,"number-of-grids"],"multipleDraws":[516,"multiple-draws"],"ticketId":[514,"ticket-id"],"resetButton":[516,"reset-button"],"autoPick":[516,"auto-pick"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32],"limitStylingAppends":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[1,"lottery-grid",{"ticketId":[514,"ticket-id"],"totalNumbers":[514,"total-numbers"],"gameId":[513,"game-id"],"maximumAllowed":[514,"maximum-allowed"],"minimumAllowed":[514,"minimum-allowed"],"selectable":[516],"selectedNumbers":[513,"selected-numbers"],"displaySelected":[516,"display-selected"],"language":[513],"gridIndex":[514,"grid-index"],"gridType":[513,"grid-type"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[513],"selectable":[516],"isSelected":[516,"is-selected"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
14
- });
15
- };
16
-
17
- export { defineCustomElements };
@@ -1,498 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-a0f57440.js';
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}";
4
-
5
- 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;
60
- }
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
- };
67
- LotteryBullet.style = lotteryBulletCss;
68
-
69
- 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}";
70
-
71
- 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
- });
146
- }
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
- });
157
- }
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;
167
- }
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]);
176
- }
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) {
197
- 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)
208
- });
209
- }
210
- }
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;
227
- }
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
- });
244
- }
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;
266
- }
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
- };
272
- LotteryGrid.style = lotteryGridCss;
273
-
274
- const DEFAULT_LANGUAGE = 'en';
275
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'hr'];
276
- 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
- }
327
- };
328
- const translate = (key, customLang) => {
329
- const lang = customLang;
330
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
331
- };
332
-
333
- 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}";
334
-
335
- 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 = '';
367
- /**
368
- * Client custom styling via url content
369
- */
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;
398
- }
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;
432
- }
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))));
476
- }
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
- }
490
- }
491
- }
492
- static get watchers() { return {
493
- "numberOfDraws": ["drawsChangeHandler"]
494
- }; }
495
- };
496
- LotteryTicket.style = lotteryTicketCss;
497
-
498
- export { LotteryBullet as lottery_bullet, LotteryGrid as lottery_grid, LotteryTicket as lottery_ticket };
@@ -1,17 +0,0 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-a0f57440.js';
2
-
3
- /*
4
- Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
5
- */
6
- const patchBrowser = () => {
7
- const importMeta = import.meta.url;
8
- const opts = {};
9
- if (importMeta !== '') {
10
- opts.resourcesUrl = new URL('.', importMeta).href;
11
- }
12
- return promiseResolve(opts);
13
- };
14
-
15
- patchBrowser().then(options => {
16
- return bootstrapLazy([["lottery-bullet_3",[[1,"lottery-ticket",{"endpoint":[513],"gameId":[513,"game-id"],"numberOfGrids":[514,"number-of-grids"],"multipleDraws":[516,"multiple-draws"],"ticketId":[514,"ticket-id"],"resetButton":[516,"reset-button"],"autoPick":[516,"auto-pick"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32],"limitStylingAppends":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[1,"lottery-grid",{"ticketId":[514,"ticket-id"],"totalNumbers":[514,"total-numbers"],"gameId":[513,"game-id"],"maximumAllowed":[514,"maximum-allowed"],"minimumAllowed":[514,"minimum-allowed"],"selectable":[516],"selectedNumbers":[513,"selected-numbers"],"displaySelected":[516,"display-selected"],"language":[513],"gridIndex":[514,"grid-index"],"gridType":[513,"grid-type"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[513],"selectable":[516],"isSelected":[516,"is-selected"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
17
- });