@everymatrix/lottery-ticket-controller 0.1.2 → 0.1.6

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 (35) hide show
  1. package/dist/cjs/helper-accordion.cjs.entry.js +92 -0
  2. package/dist/cjs/{index-c560cdc6.js → index-95915aab.js} +2 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/lottery-bullet.cjs.entry.js +41 -0
  5. package/dist/cjs/lottery-grid.cjs.entry.js +167 -0
  6. package/dist/cjs/lottery-ticket-controller.cjs.entry.js +69 -0
  7. package/dist/cjs/lottery-ticket-controller.cjs.js +2 -2
  8. package/dist/cjs/lottery-ticket.cjs.entry.js +169 -0
  9. package/dist/collection/collection-manifest.json +7 -1
  10. package/dist/components/helper-accordion2.js +8 -2
  11. package/dist/components/lottery-bullet2.js +2 -1
  12. package/dist/components/lottery-grid2.js +2 -1
  13. package/dist/components/lottery-ticket-controller.js +1 -0
  14. package/dist/components/lottery-ticket2.js +36 -10
  15. package/dist/esm/helper-accordion.entry.js +88 -0
  16. package/dist/esm/{index-0b72e6e4.js → index-e3877ca0.js} +2 -0
  17. package/dist/esm/loader.js +2 -2
  18. package/dist/esm/lottery-bullet.entry.js +37 -0
  19. package/dist/esm/lottery-grid.entry.js +163 -0
  20. package/dist/esm/lottery-ticket-controller.entry.js +65 -0
  21. package/dist/esm/lottery-ticket-controller.js +2 -2
  22. package/dist/esm/lottery-ticket.entry.js +165 -0
  23. package/dist/lottery-ticket-controller/lottery-ticket-controller.esm.js +1 -1
  24. package/dist/lottery-ticket-controller/p-25f1639a.entry.js +1 -0
  25. package/dist/lottery-ticket-controller/p-3971b8e6.js +1 -0
  26. package/dist/lottery-ticket-controller/p-40d1058f.entry.js +1 -0
  27. package/dist/lottery-ticket-controller/p-dc525e6c.entry.js +1 -0
  28. package/dist/lottery-ticket-controller/p-f08b1b06.entry.js +1 -0
  29. package/dist/lottery-ticket-controller/p-f886ec7e.entry.js +1 -0
  30. package/dist/stencil.config.js +3 -0
  31. package/package.json +2 -2
  32. package/dist/cjs/helper-accordion_5.cjs.entry.js +0 -487
  33. package/dist/esm/helper-accordion_5.entry.js +0 -479
  34. package/dist/lottery-ticket-controller/p-62871984.entry.js +0 -1
  35. package/dist/lottery-ticket-controller/p-e0a7e661.js +0 -1
@@ -1,487 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-c560cdc6.js');
6
-
7
- const DEFAULT_LANGUAGE$1 = 'en';
8
- const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
9
- const TRANSLATIONS$1 = {
10
- en: {
11
- deleteTicket: 'Delete ticket'
12
- },
13
- ro: {
14
- deleteTicket: 'Sterge biletul'
15
- },
16
- };
17
- const translate$1 = (key, customLang) => {
18
- const lang = customLang;
19
- return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
20
- };
21
-
22
- 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}";
23
-
24
- const Accordion = class {
25
- constructor(hostRef) {
26
- index.registerInstance(this, hostRef);
27
- this.accordionEvent = index.createEvent(this, "helperAccordionAction", 7);
28
- /**
29
- * Title (top header)
30
- */
31
- this.headerTitle = '';
32
- /**
33
- * SubTitle (top header)
34
- */
35
- this.headerSubtitle = '';
36
- /**
37
- * Description
38
- */
39
- this.description = '';
40
- /**
41
- * Enables footer content
42
- */
43
- this.footer = false;
44
- /**
45
- * Enables footer button for tab deletion
46
- */
47
- this.deleteTab = false;
48
- /**
49
- * Activates postMessages as events for actions from the widget
50
- */
51
- this.postMessage = false;
52
- /**
53
- * Name of the event emitter by the action button
54
- */
55
- this.eventName = 'helperAccordionAction';
56
- /**
57
- * Collapsed
58
- */
59
- this.collapsed = true;
60
- /**
61
- * Language
62
- */
63
- this.language = 'en';
64
- }
65
- // @TODO fix the `any` type :)
66
- connectedCallback() {
67
- this.showContent = !this.collapsed;
68
- }
69
- toggleContent() {
70
- this.showContent = !this.showContent;
71
- }
72
- deleteAction() {
73
- if (this.postMessage) {
74
- // @TODO maybe change the name type, this one sucks
75
- window.postMessage({ type: this.eventName }, window.location.href);
76
- }
77
- this.accordionEvent.emit();
78
- }
79
- render() {
80
- return (index.h("div", { class: "Wrapper" }, index.h("div", { class: "Header" }, index.h("p", { class: "Title" }, this.headerTitle), index.h("p", { class: "Subtitle" }, this.headerSubtitle), index.h("p", { class: "Subtitle" }, this.description), index.h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
81
- index.h("div", null, index.h("div", { class: "Content" }, index.h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
82
- index.h("div", null, this.deleteTab &&
83
- index.h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate$1('deleteTicket', this.language)))))));
84
- }
85
- };
86
- Accordion.style = helperAccordionCss;
87
-
88
- 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}";
89
-
90
- const LotteryBullet = class {
91
- constructor(hostRef) {
92
- index.registerInstance(this, hostRef);
93
- this.bulletEvent = index.createEvent(this, "lotteryBulletSelection", 7);
94
- /**
95
- * Value of the bullet
96
- */
97
- this.value = '0';
98
- /**
99
- * Marks if the bullet should be selectable
100
- */
101
- this.selectable = true;
102
- /**
103
- * Marks if the bullet should be selected
104
- */
105
- this.isSelected = false;
106
- this.select = () => {
107
- if (this.selectable) {
108
- this.isSelected = !this.isSelected;
109
- this.bulletEvent.emit({
110
- value: this.value,
111
- selected: this.isSelected
112
- });
113
- }
114
- };
115
- }
116
- render() {
117
- return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
118
- }
119
- };
120
- LotteryBullet.style = lotteryBulletCss;
121
-
122
- 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}";
123
-
124
- const LotteryGrid = class {
125
- constructor(hostRef) {
126
- index.registerInstance(this, hostRef);
127
- this.gridFilledEvent = index.createEvent(this, "gridFilled", 7);
128
- this.gridDirtyEvent = index.createEvent(this, "gridDirty", 7);
129
- /**
130
- * Number of bullets of grid
131
- */
132
- this.totalNumbers = 0;
133
- /**
134
- * Number of maximum bullets that can be selected
135
- */
136
- this.maximumAllowed = 0;
137
- /**
138
- * Minimum allowed of bullets
139
- */
140
- this.minimumAllowed = 1;
141
- /**
142
- * Allows the user to select numbers on the grid
143
- */
144
- this.selectable = true;
145
- /**
146
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
147
- */
148
- this.selectedNumbers = '';
149
- /**
150
- * Show only selected numbers
151
- */
152
- this.displaySelected = false;
153
- /**
154
- * Language
155
- */
156
- this.language = 'en';
157
- this.numbers = [];
158
- this.selectedCounter = 0;
159
- }
160
- connectedCallback() {
161
- let selected = [];
162
- if (this.selectedNumbers.length > 0) {
163
- selected = this.selectedNumbers.split(',');
164
- this.selectedCounter = selected.length;
165
- }
166
- if (this.displaySelected) {
167
- selected.forEach((item) => {
168
- this.numbers.push({
169
- number: item,
170
- selected: true,
171
- selectable: this.selectable
172
- });
173
- });
174
- }
175
- else {
176
- [...Array(this.totalNumbers).keys()]
177
- .map(number => (number + 1).toString())
178
- .forEach((number) => {
179
- this.numbers.push({
180
- number,
181
- selected: selected.indexOf(number) >= 0 ? true : false,
182
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
183
- });
184
- });
185
- }
186
- }
187
- lotteryBulletSelectionHandler(event) {
188
- this.numbers = this.numbers.map((item) => {
189
- if (item.number == event.detail.value) {
190
- return {
191
- number: item.number,
192
- selected: event.detail.selected,
193
- selectable: item.selectable
194
- };
195
- }
196
- return {
197
- number: item.number,
198
- selected: item.selected,
199
- selectable: item.selectable
200
- };
201
- });
202
- if (event.detail.selected) {
203
- this.selectedCounter += 1;
204
- if (this.selectedCounter == this.maximumAllowed) {
205
- this.numbers = this.numbers.map((item) => {
206
- return {
207
- number: item.number,
208
- selected: item.selected,
209
- selectable: item.selected ? true : false
210
- };
211
- });
212
- this.gridFilledEvent.emit({
213
- id: this.ticketId,
214
- index: this.gridIndex,
215
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
216
- });
217
- }
218
- }
219
- else {
220
- if (this.selectedCounter == this.maximumAllowed) {
221
- this.numbers = this.numbers.map((item) => {
222
- return {
223
- number: item.number,
224
- selected: item.selected,
225
- selectable: true
226
- };
227
- });
228
- this.gridDirtyEvent.emit({
229
- id: this.ticketId,
230
- index: this.gridIndex,
231
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
232
- });
233
- }
234
- this.selectedCounter -= 1;
235
- }
236
- }
237
- async resetSelectionHandler(event) {
238
- if (event.detail && event.detail == this.ticketId) {
239
- this.selectedCounter = 0;
240
- this.numbers = this.numbers.map((item) => {
241
- return {
242
- number: item.number,
243
- selected: false,
244
- selectable: this.selectable
245
- };
246
- });
247
- this.gridDirtyEvent.emit({
248
- id: this.ticketId,
249
- index: this.gridIndex,
250
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
251
- });
252
- }
253
- }
254
- async autoSelectionHandler(event) {
255
- if (event.detail && event.detail == this.ticketId) {
256
- this.resetSelectionHandler(event);
257
- let array = [...Array(this.totalNumbers).keys()]
258
- .map(number => number + 1)
259
- .sort(() => 0.5 - Math.random());
260
- array = array.slice(0, this.minimumAllowed);
261
- this.numbers = this.numbers.map((item) => {
262
- return {
263
- number: item.number,
264
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
265
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
266
- };
267
- });
268
- this.gridFilledEvent.emit({
269
- id: this.ticketId,
270
- index: this.gridIndex,
271
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
272
- });
273
- this.selectedCounter = this.maximumAllowed;
274
- }
275
- }
276
- render() {
277
- return (index.h("div", { class: "GridContainer" }, index.h("div", { class: "Grid" }, this.numbers.map((item) => index.h("div", null, index.h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected }))))));
278
- }
279
- };
280
- LotteryGrid.style = lotteryGridCss;
281
-
282
- const DEFAULT_LANGUAGE = 'en';
283
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
284
- const TRANSLATIONS = {
285
- en: {
286
- loading: 'Loading, please wait ...',
287
- error: 'It was an error while trying to fetch the data',
288
- grid: 'Grid',
289
- multiplier: 'Multiplier',
290
- numberOfDraws: 'Number of draws',
291
- wagerPerDraw: 'Wager per draw',
292
- resetButton: 'Reset',
293
- autoButton: 'I feel lucky'
294
- },
295
- ro: {
296
- loading: 'Se incarca, va rugam asteptati ...',
297
- error: 'A fost o eroare in timp ce asteptam datele',
298
- grid: 'Grid',
299
- multiplier: 'Multiplicator',
300
- numberOfDraws: 'Numarul de extrageri',
301
- wagerPerDraw: 'Pariul per extragere',
302
- resetButton: 'Reseteaza',
303
- autoButton: 'Ma simt norocos'
304
- },
305
- };
306
- const translate = (key, customLang) => {
307
- const lang = customLang;
308
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
309
- };
310
-
311
- 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}";
312
-
313
- const LotteryTicket = class {
314
- constructor(hostRef) {
315
- index.registerInstance(this, hostRef);
316
- this.ticketCompleted = index.createEvent(this, "ticketCompleted", 7);
317
- this.autoSelection = index.createEvent(this, "autoSelection", 7);
318
- this.resetSelection = index.createEvent(this, "resetSelection", 7);
319
- this.stakeChange = index.createEvent(this, "stakeChange", 7);
320
- this.multiplierChange = index.createEvent(this, "multiplierChange", 7);
321
- /**
322
- * Number of grids of a ticket
323
- */
324
- this.numberOfGrids = 1;
325
- /**
326
- * Option to have the ticket registered for multiple draws
327
- */
328
- this.multipleDraws = true;
329
- /**
330
- * Shows the reset button
331
- */
332
- this.resetButton = false;
333
- /**
334
- * Shows the auto-pick button
335
- */
336
- this.autoPick = false;
337
- /**
338
- * Language
339
- */
340
- this.language = 'en';
341
- this.multiplier = false;
342
- this.numberOfDraws = 1;
343
- this.isLoading = true;
344
- this.hasErrors = false;
345
- this.ticketDone = false;
346
- }
347
- connectedCallback() {
348
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
349
- fetch(url.href)
350
- .then((response) => {
351
- if (response.ok) {
352
- return response.json();
353
- }
354
- else {
355
- // Throw error
356
- this.hasErrors = true;
357
- }
358
- })
359
- .then((data) => {
360
- this.isLoading = false;
361
- this.gameData = data;
362
- this.grids = [...Array(data.rules.boards.length).keys()];
363
- })
364
- .catch((err) => {
365
- this.isLoading = false;
366
- this.hasErrors = true;
367
- console.error('Error!', err);
368
- });
369
- }
370
- multiplierChangeHandler(e) {
371
- this.multiplier = e.target ? e.target.checked : false;
372
- this.multiplierChange.emit(this.multiplier);
373
- }
374
- drawsChangeHandler(event) {
375
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
376
- this.ticketCompleted.emit(this.ticket);
377
- }
378
- gridFilledHandler(event) {
379
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
380
- this.ticketDone = true;
381
- this.ticketCompleted.emit(this.ticket);
382
- }
383
- toggleAutoSelection() {
384
- this.ticketDone = true;
385
- this.autoSelection.emit(this.ticketId);
386
- }
387
- toggleResetSelection() {
388
- this.ticketDone = false;
389
- this.resetSelection.emit(this.ticketId);
390
- }
391
- changeStake(event) {
392
- this.stakeChange.emit({
393
- ticketId: this.ticketId,
394
- stake: event.target.value
395
- });
396
- }
397
- render() {
398
- if (this.isLoading) {
399
- return (index.h("div", null, index.h("p", null, translate('loading', this.language))));
400
- }
401
- else {
402
- if (this.hasErrors) {
403
- return (index.h("div", null, index.h("p", null, translate('error', this.language))));
404
- }
405
- else {
406
- const { rules } = this.gameData;
407
- return (index.h("div", { class: "TicketContainer" }, index.h("p", null, this.gameData.name), this.resetButton && this.ticketDone &&
408
- index.h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language)), this.autoPick && !this.ticketDone &&
409
- index.h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language)), this.grids.map((item, index$1) => index.h("div", { class: "TicketGridBullets" }, index.h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), index.h("lottery-grid", { "grid-index": index$1, "maximum-allowed": rules.boards[index$1].maximumAllowed, "minimum-allowed": rules.boards[index$1].minimumAllowed, "total-numbers": rules.boards[index$1].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))), rules.multiplier &&
410
- index.h("div", null, index.h("label", { class: "Toggle" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), ": "), index.h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), index.h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
411
- index.h("div", { class: "TicketDraws" }, index.h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), index.h("div", { class: "NumberInput" }, index.h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), index.h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), index.h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), index.h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), index.h("div", { class: "WagerInput" }, rules.stakes.length > 1 ? index.h("div", null, index.h("select", { class: "InputDefault", onChange: (event) => this.changeStake(event) }, rules.stakes.map((item) => index.h("option", { value: item.amount }, item.amount, " ", item.currency)))) : index.h("div", null, index.h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), index.h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))));
412
- }
413
- }
414
- }
415
- static get watchers() { return {
416
- "numberOfDraws": ["drawsChangeHandler"]
417
- }; }
418
- };
419
- LotteryTicket.style = lotteryTicketCss;
420
-
421
- const lotteryTicketControllerCss = ":host{display:block}";
422
-
423
- const LotteryTicketController = class {
424
- constructor(hostRef) {
425
- index.registerInstance(this, hostRef);
426
- this.deleteTicketEvent = index.createEvent(this, "deleteTicket", 7);
427
- /**
428
- * Endpoint URL for the source of data (NorWAy standard)
429
- */
430
- this.endpoint = '';
431
- /**
432
- * Ticket number
433
- */
434
- this.ticketId = 1;
435
- /**
436
- * Activates postMessages as events for actions from the widget
437
- */
438
- this.postMessage = false;
439
- /**
440
- * Name of the event emitter by the action button
441
- */
442
- this.eventName = 'deleteTicketAction';
443
- /**
444
- * Collapsed
445
- */
446
- this.collapsed = true;
447
- /**
448
- * Number of grids?
449
- */
450
- this.numberOfGrids = 1;
451
- /**
452
- * This toggles if the last ticket added should be expanded or not
453
- */
454
- this.last = false;
455
- /**
456
- * Language
457
- */
458
- this.language = 'en';
459
- /**
460
- * Shows the auto-pick button
461
- */
462
- this.autoPick = false;
463
- /**
464
- * Shows the reset button
465
- */
466
- this.resetButton = false;
467
- }
468
- // @TODO fix the `any` type
469
- helperAccordionActionHandler() {
470
- if (this.postMessage) {
471
- window.postMessage({ type: this.eventName }, window.location.href);
472
- }
473
- this.deleteTicketEvent.emit({
474
- ticketId: this.ticketId
475
- });
476
- }
477
- render() {
478
- return (index.h("div", null, index.h("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language }, index.h("div", { slot: "accordionContent" }, index.h("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 })))));
479
- }
480
- };
481
- LotteryTicketController.style = lotteryTicketControllerCss;
482
-
483
- exports.helper_accordion = Accordion;
484
- exports.lottery_bullet = LotteryBullet;
485
- exports.lottery_grid = LotteryGrid;
486
- exports.lottery_ticket = LotteryTicket;
487
- exports.lottery_ticket_controller = LotteryTicketController;