@everymatrix/lottery-ticket 0.1.23 → 1.0.69

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 +402 -440
  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 +53 -43
  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 +402 -440
  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/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.d.ts +2 -0
  22. package/dist/types/Users/raul.vasile/workspace/everymatrix/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 +10 -3
  35. package/dist/cjs/index-6033a99f.js +0 -1272
  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 -236
  42. package/dist/components/lottery-ticket.d.ts +0 -11
  43. package/dist/components/lottery-ticket.js +0 -266
  44. package/dist/esm/index-7790b5a7.js +0 -1246
  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-4e7976c5.entry.js +0 -1
  52. package/dist/lottery-ticket/p-913d0cce.js +0 -1
  53. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/widgets-stencil/packages/lottery-ticket/.stencil/packages/lottery-ticket/stencil.config.d.ts +0 -2
@@ -1,494 +1,444 @@
1
- import { Component, h, Prop, State, Event, Listen, Watch } from '@stencil/core';
2
- import { translate } from '../../utils/locale.utils';
3
- import '@everymatrix/lottery-grid';
1
+ import { h } from "@stencil/core";
2
+ import { translate } from "../../utils/locale.utils";
3
+ import "../../../../../lottery-grid/dist/types/index";
4
4
  export class LotteryTicket {
5
- constructor() {
6
- /**
7
- * Number of grids of a ticket
8
- */
9
- this.numberOfGrids = 1;
10
- /**
11
- * Option to have the ticket registered for multiple draws
12
- */
13
- this.multipleDraws = true;
14
- /**
15
- * Shows the reset button
16
- */
17
- this.resetButton = false;
18
- /**
19
- * Shows the auto-pick button
20
- */
21
- this.autoPick = false;
22
- /**
23
- * Language
24
- */
25
- this.language = 'en';
26
- /**
27
- * Client custom styling via string
28
- */
29
- this.clientStyling = '';
5
+ constructor() {
6
+ this.setClientStyling = () => {
7
+ let sheet = document.createElement('style');
8
+ sheet.innerHTML = this.clientStyling;
9
+ this.stylingContainer.prepend(sheet);
10
+ };
11
+ this.setClientStylingURL = () => {
12
+ let cssFile = document.createElement('style');
13
+ setTimeout(() => {
14
+ cssFile.innerHTML = this.clientStylingUrlContent;
15
+ this.stylingContainer.prepend(cssFile);
16
+ }, 1);
17
+ };
18
+ this.endpoint = undefined;
19
+ this.gameId = undefined;
20
+ this.numberOfGrids = 1;
21
+ this.multipleDraws = true;
22
+ this.ticketId = undefined;
23
+ this.resetButton = false;
24
+ this.autoPick = false;
25
+ this.language = 'en';
26
+ this.clientStyling = '';
27
+ this.clientStylingUrlContent = '';
28
+ this.multiplier = false;
29
+ this.numberOfDraws = 1;
30
+ this.isLoading = true;
31
+ this.hasErrors = false;
32
+ this.ticketDone = false;
33
+ this.isCustomSelect = false;
34
+ this.amountInfo = {};
35
+ this.limitStylingAppends = false;
36
+ }
30
37
  /**
31
- * Client custom styling via url content
38
+ * @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
32
39
  */
33
- this.clientStylingUrlContent = '';
34
- this.multiplier = false;
35
- this.numberOfDraws = 1;
36
- this.isLoading = true;
37
- this.hasErrors = false;
38
- this.ticketDone = false;
39
- this.isCustomSelect = false;
40
- this.amountInfo = {};
41
- this.limitStylingAppends = false;
42
- this.setClientStyling = () => {
43
- let sheet = document.createElement('style');
44
- sheet.innerHTML = this.clientStyling;
45
- this.stylingContainer.prepend(sheet);
46
- };
47
- this.setClientStylingURL = () => {
48
- let cssFile = document.createElement('style');
49
- setTimeout(() => {
50
- cssFile.innerHTML = this.clientStylingUrlContent;
51
- this.stylingContainer.prepend(cssFile);
52
- }, 1);
53
- };
54
- }
55
- /**
56
- * @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
57
- */
58
- checkForClickOutside(ev) {
59
- if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
60
- this.isCustomSelect = false;
40
+ checkForClickOutside(ev) {
41
+ if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
42
+ this.isCustomSelect = false;
43
+ }
44
+ }
45
+ connectedCallback() {
46
+ let url = new URL(`${this.endpoint}/games/${this.gameId}`);
47
+ fetch(url.href)
48
+ .then((response) => {
49
+ if (response.ok) {
50
+ return response.json();
51
+ }
52
+ else {
53
+ // Throw error
54
+ this.hasErrors = true;
55
+ }
56
+ })
57
+ .then((data) => {
58
+ this.isLoading = false;
59
+ this.gameData = data;
60
+ this.grids = [...Array(this.gameData.type.boards.length).keys()];
61
+ this.amountInfo = this.gameData.type.stakes[0]; // initial value for select
62
+ })
63
+ .catch((err) => {
64
+ this.isLoading = false;
65
+ this.hasErrors = true;
66
+ console.error('Error!', err);
67
+ });
68
+ }
69
+ componentDidRender() {
70
+ // start custom styling area
71
+ if (!this.limitStylingAppends && this.stylingContainer) {
72
+ if (this.clientStyling)
73
+ this.setClientStyling();
74
+ if (this.clientStylingUrlContent)
75
+ this.setClientStylingURL();
76
+ this.limitStylingAppends = true;
77
+ }
78
+ // end custom styling area
79
+ }
80
+ multiplierChangeHandler(e) {
81
+ this.multiplier = e.target ? e.target.checked : false;
82
+ this.multiplierChange.emit(this.multiplier);
83
+ }
84
+ drawsChangeHandler(event) {
85
+ this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
86
+ this.ticketCompleted.emit(this.ticket);
87
+ }
88
+ gridFilledHandler(event) {
89
+ this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
90
+ this.ticketDone = true;
91
+ this.ticketCompleted.emit(this.ticket);
92
+ }
93
+ toggleAutoSelection() {
94
+ this.ticketDone = true;
95
+ this.autoSelection.emit(this.ticketId);
96
+ }
97
+ toggleResetSelection() {
98
+ this.ticketDone = false;
99
+ this.resetSelection.emit(this.ticketId);
100
+ }
101
+ changeStake(ticketid, amount) {
102
+ this.stakeChange.emit({
103
+ ticketId: ticketid,
104
+ stake: amount
105
+ });
106
+ }
107
+ toggleClass() {
108
+ this.isCustomSelect = !this.isCustomSelect;
109
+ }
110
+ setDropdownItem(item) {
111
+ this.amountInfo = {
112
+ value: item.value,
113
+ currency: item.currency
114
+ };
115
+ this.isCustomSelect = false;
116
+ this.changeStake(this.ticketId, item.amount);
117
+ }
118
+ render() {
119
+ if (this.isLoading) {
120
+ return (h("div", null, h("p", null, translate('loading', this.language))));
121
+ }
122
+ else {
123
+ if (this.hasErrors) {
124
+ return (h("div", null, h("p", null, translate('error', this.language))));
125
+ }
126
+ else {
127
+ const { type } = this.gameData;
128
+ return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
129
+ h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
130
+ 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 &&
131
+ 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 &&
132
+ 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 ?
133
+ (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)))))));
134
+ }
135
+ }
136
+ }
137
+ static get is() { return "lottery-ticket"; }
138
+ static get encapsulation() { return "shadow"; }
139
+ static get originalStyleUrls() {
140
+ return {
141
+ "$": ["lottery-ticket.scss"]
142
+ };
143
+ }
144
+ static get styleUrls() {
145
+ return {
146
+ "$": ["lottery-ticket.css"]
147
+ };
148
+ }
149
+ static get properties() {
150
+ return {
151
+ "endpoint": {
152
+ "type": "string",
153
+ "mutable": false,
154
+ "complexType": {
155
+ "original": "string",
156
+ "resolved": "string",
157
+ "references": {}
158
+ },
159
+ "required": false,
160
+ "optional": false,
161
+ "docs": {
162
+ "tags": [],
163
+ "text": "NorWAy endpoint"
164
+ },
165
+ "attribute": "endpoint",
166
+ "reflect": true
167
+ },
168
+ "gameId": {
169
+ "type": "string",
170
+ "mutable": false,
171
+ "complexType": {
172
+ "original": "string",
173
+ "resolved": "string",
174
+ "references": {}
175
+ },
176
+ "required": false,
177
+ "optional": false,
178
+ "docs": {
179
+ "tags": [],
180
+ "text": "Game ID"
181
+ },
182
+ "attribute": "game-id",
183
+ "reflect": true
184
+ },
185
+ "numberOfGrids": {
186
+ "type": "number",
187
+ "mutable": false,
188
+ "complexType": {
189
+ "original": "number",
190
+ "resolved": "number",
191
+ "references": {}
192
+ },
193
+ "required": false,
194
+ "optional": false,
195
+ "docs": {
196
+ "tags": [],
197
+ "text": "Number of grids of a ticket"
198
+ },
199
+ "attribute": "number-of-grids",
200
+ "reflect": true,
201
+ "defaultValue": "1"
202
+ },
203
+ "multipleDraws": {
204
+ "type": "boolean",
205
+ "mutable": false,
206
+ "complexType": {
207
+ "original": "boolean",
208
+ "resolved": "boolean",
209
+ "references": {}
210
+ },
211
+ "required": false,
212
+ "optional": false,
213
+ "docs": {
214
+ "tags": [],
215
+ "text": "Option to have the ticket registered for multiple draws"
216
+ },
217
+ "attribute": "multiple-draws",
218
+ "reflect": true,
219
+ "defaultValue": "true"
220
+ },
221
+ "ticketId": {
222
+ "type": "number",
223
+ "mutable": false,
224
+ "complexType": {
225
+ "original": "number",
226
+ "resolved": "number",
227
+ "references": {}
228
+ },
229
+ "required": false,
230
+ "optional": false,
231
+ "docs": {
232
+ "tags": [],
233
+ "text": "Ticket ID"
234
+ },
235
+ "attribute": "ticket-id",
236
+ "reflect": true
237
+ },
238
+ "resetButton": {
239
+ "type": "boolean",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "boolean",
243
+ "resolved": "boolean",
244
+ "references": {}
245
+ },
246
+ "required": false,
247
+ "optional": false,
248
+ "docs": {
249
+ "tags": [],
250
+ "text": "Shows the reset button"
251
+ },
252
+ "attribute": "reset-button",
253
+ "reflect": true,
254
+ "defaultValue": "false"
255
+ },
256
+ "autoPick": {
257
+ "type": "boolean",
258
+ "mutable": false,
259
+ "complexType": {
260
+ "original": "boolean",
261
+ "resolved": "boolean",
262
+ "references": {}
263
+ },
264
+ "required": false,
265
+ "optional": false,
266
+ "docs": {
267
+ "tags": [],
268
+ "text": "Shows the auto-pick button"
269
+ },
270
+ "attribute": "auto-pick",
271
+ "reflect": true,
272
+ "defaultValue": "false"
273
+ },
274
+ "language": {
275
+ "type": "string",
276
+ "mutable": false,
277
+ "complexType": {
278
+ "original": "string",
279
+ "resolved": "string",
280
+ "references": {}
281
+ },
282
+ "required": false,
283
+ "optional": false,
284
+ "docs": {
285
+ "tags": [],
286
+ "text": "Language"
287
+ },
288
+ "attribute": "language",
289
+ "reflect": true,
290
+ "defaultValue": "'en'"
291
+ },
292
+ "clientStyling": {
293
+ "type": "string",
294
+ "mutable": false,
295
+ "complexType": {
296
+ "original": "string",
297
+ "resolved": "string",
298
+ "references": {}
299
+ },
300
+ "required": false,
301
+ "optional": false,
302
+ "docs": {
303
+ "tags": [],
304
+ "text": "Client custom styling via string"
305
+ },
306
+ "attribute": "client-styling",
307
+ "reflect": true,
308
+ "defaultValue": "''"
309
+ },
310
+ "clientStylingUrlContent": {
311
+ "type": "string",
312
+ "mutable": false,
313
+ "complexType": {
314
+ "original": "string",
315
+ "resolved": "string",
316
+ "references": {}
317
+ },
318
+ "required": false,
319
+ "optional": false,
320
+ "docs": {
321
+ "tags": [],
322
+ "text": "Client custom styling via url content"
323
+ },
324
+ "attribute": "client-styling-url-content",
325
+ "reflect": true,
326
+ "defaultValue": "''"
327
+ }
328
+ };
61
329
  }
62
- }
63
- connectedCallback() {
64
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
65
- fetch(url.href)
66
- .then((response) => {
67
- if (response.ok) {
68
- return response.json();
69
- }
70
- else {
71
- // Throw error
72
- this.hasErrors = true;
73
- }
74
- })
75
- .then((data) => {
76
- this.isLoading = false;
77
- this.gameData = data;
78
- this.grids = [...Array(data.rules.boards.length).keys()];
79
- this.amountInfo = this.gameData.rules.stakes[0]; // initial value for select
80
- })
81
- .catch((err) => {
82
- this.isLoading = false;
83
- this.hasErrors = true;
84
- console.error('Error!', err);
85
- });
86
- }
87
- componentDidRender() {
88
- // start custom styling area
89
- if (!this.limitStylingAppends && this.stylingContainer) {
90
- if (this.clientStyling)
91
- this.setClientStyling();
92
- if (this.clientStylingUrlContent)
93
- this.setClientStylingURL();
94
- this.limitStylingAppends = true;
330
+ static get states() {
331
+ return {
332
+ "multiplier": {},
333
+ "numberOfDraws": {},
334
+ "isLoading": {},
335
+ "hasErrors": {},
336
+ "ticketDone": {},
337
+ "isCustomSelect": {},
338
+ "amountInfo": {},
339
+ "limitStylingAppends": {}
340
+ };
95
341
  }
96
- // end custom styling area
97
- }
98
- multiplierChangeHandler(e) {
99
- this.multiplier = e.target ? e.target.checked : false;
100
- this.multiplierChange.emit(this.multiplier);
101
- }
102
- drawsChangeHandler(event) {
103
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
104
- this.ticketCompleted.emit(this.ticket);
105
- }
106
- gridFilledHandler(event) {
107
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
108
- this.ticketDone = true;
109
- this.ticketCompleted.emit(this.ticket);
110
- }
111
- toggleAutoSelection() {
112
- this.ticketDone = true;
113
- this.autoSelection.emit(this.ticketId);
114
- }
115
- toggleResetSelection() {
116
- this.ticketDone = false;
117
- this.resetSelection.emit(this.ticketId);
118
- }
119
- changeStake(ticketid, amount) {
120
- this.stakeChange.emit({
121
- ticketId: ticketid,
122
- stake: amount
123
- });
124
- }
125
- toggleClass() {
126
- this.isCustomSelect = !this.isCustomSelect;
127
- }
128
- setDropdownItem(item) {
129
- this.amountInfo = {
130
- amount: item.amount,
131
- currency: item.currency
132
- };
133
- this.isCustomSelect = false;
134
- this.changeStake(this.ticketId, item.amount);
135
- }
136
- render() {
137
- if (this.isLoading) {
138
- return (h("div", null,
139
- h("p", null, translate('loading', this.language))));
342
+ static get events() {
343
+ return [{
344
+ "method": "ticketCompleted",
345
+ "name": "ticketCompleted",
346
+ "bubbles": true,
347
+ "cancelable": true,
348
+ "composed": true,
349
+ "docs": {
350
+ "tags": [{
351
+ "name": "TODO",
352
+ "text": "including ts type"
353
+ }],
354
+ "text": ""
355
+ },
356
+ "complexType": {
357
+ "original": "any",
358
+ "resolved": "any",
359
+ "references": {}
360
+ }
361
+ }, {
362
+ "method": "autoSelection",
363
+ "name": "autoSelection",
364
+ "bubbles": true,
365
+ "cancelable": true,
366
+ "composed": true,
367
+ "docs": {
368
+ "tags": [],
369
+ "text": ""
370
+ },
371
+ "complexType": {
372
+ "original": "any",
373
+ "resolved": "any",
374
+ "references": {}
375
+ }
376
+ }, {
377
+ "method": "resetSelection",
378
+ "name": "resetSelection",
379
+ "bubbles": true,
380
+ "cancelable": true,
381
+ "composed": true,
382
+ "docs": {
383
+ "tags": [],
384
+ "text": ""
385
+ },
386
+ "complexType": {
387
+ "original": "any",
388
+ "resolved": "any",
389
+ "references": {}
390
+ }
391
+ }, {
392
+ "method": "stakeChange",
393
+ "name": "stakeChange",
394
+ "bubbles": true,
395
+ "cancelable": true,
396
+ "composed": true,
397
+ "docs": {
398
+ "tags": [],
399
+ "text": ""
400
+ },
401
+ "complexType": {
402
+ "original": "any",
403
+ "resolved": "any",
404
+ "references": {}
405
+ }
406
+ }, {
407
+ "method": "multiplierChange",
408
+ "name": "multiplierChange",
409
+ "bubbles": true,
410
+ "cancelable": true,
411
+ "composed": true,
412
+ "docs": {
413
+ "tags": [],
414
+ "text": ""
415
+ },
416
+ "complexType": {
417
+ "original": "any",
418
+ "resolved": "any",
419
+ "references": {}
420
+ }
421
+ }];
140
422
  }
141
- else {
142
- if (this.hasErrors) {
143
- return (h("div", null,
144
- h("p", null, translate('error', this.language))));
145
- }
146
- else {
147
- const { rules } = this.gameData;
148
- return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el },
149
- h("p", { class: "TicketTitle" }, this.gameData.name),
150
- this.resetButton && this.ticketDone &&
151
- h("div", { class: "ButtonContainer" },
152
- h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))),
153
- this.autoPick && !this.ticketDone &&
154
- h("div", { class: "ButtonContainer" },
155
- h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))),
156
- this.grids.map((item, index) => h("div", { class: "TicketGridBullets" },
157
- h("p", { class: "TicketGridTitle" },
158
- translate('grid', this.language),
159
- " ",
160
- item),
161
- h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))),
162
- rules.multiplier &&
163
- h("div", null,
164
- h("label", { class: "Toggle" },
165
- h("label", { class: "Label" },
166
- translate('multiplier', this.language),
167
- ": "),
168
- h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }),
169
- h("div", { class: "ToggleSwitch" }))),
170
- this.multipleDraws &&
171
- h("div", { class: "TicketDraws" },
172
- h("label", { class: "Label" },
173
- translate('numberOfDraws', this.language),
174
- ": "),
175
- h("div", { class: "NumberInput" },
176
- h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"),
177
- h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }),
178
- h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))),
179
- h("div", null,
180
- h("label", { class: "Label" },
181
- translate('wagerPerDraw', this.language),
182
- ": "),
183
- h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
184
- (h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" },
185
- h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() },
186
- h("span", { "data-cluster": "SelectComponent" },
187
- this.amountInfo.amount,
188
- " ",
189
- this.amountInfo.currency),
190
- h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")),
191
- h("div", { "data-cluster": "SelectComponent", class: "SelectContent" },
192
- h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, rules.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.amount == item.amount ? 'SelectedValue' : '', value: item.amount, onClick: () => this.setDropdownItem(item) },
193
- item.amount,
194
- " ",
195
- item.currency)))))) : (h("div", null,
196
- h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }),
197
- h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))))));
198
- }
423
+ static get watchers() {
424
+ return [{
425
+ "propName": "numberOfDraws",
426
+ "methodName": "drawsChangeHandler"
427
+ }];
199
428
  }
200
- }
201
- static get is() { return "lottery-ticket"; }
202
- static get encapsulation() { return "shadow"; }
203
- static get originalStyleUrls() { return {
204
- "$": ["lottery-ticket.scss"]
205
- }; }
206
- static get styleUrls() { return {
207
- "$": ["lottery-ticket.css"]
208
- }; }
209
- static get properties() { return {
210
- "endpoint": {
211
- "type": "string",
212
- "mutable": false,
213
- "complexType": {
214
- "original": "string",
215
- "resolved": "string",
216
- "references": {}
217
- },
218
- "required": false,
219
- "optional": false,
220
- "docs": {
221
- "tags": [],
222
- "text": "NorWAy endpoint"
223
- },
224
- "attribute": "endpoint",
225
- "reflect": false
226
- },
227
- "gameId": {
228
- "type": "string",
229
- "mutable": false,
230
- "complexType": {
231
- "original": "string",
232
- "resolved": "string",
233
- "references": {}
234
- },
235
- "required": false,
236
- "optional": false,
237
- "docs": {
238
- "tags": [],
239
- "text": "Game ID"
240
- },
241
- "attribute": "game-id",
242
- "reflect": false
243
- },
244
- "numberOfGrids": {
245
- "type": "number",
246
- "mutable": false,
247
- "complexType": {
248
- "original": "number",
249
- "resolved": "number",
250
- "references": {}
251
- },
252
- "required": false,
253
- "optional": false,
254
- "docs": {
255
- "tags": [],
256
- "text": "Number of grids of a ticket"
257
- },
258
- "attribute": "number-of-grids",
259
- "reflect": false,
260
- "defaultValue": "1"
261
- },
262
- "multipleDraws": {
263
- "type": "boolean",
264
- "mutable": false,
265
- "complexType": {
266
- "original": "boolean",
267
- "resolved": "boolean",
268
- "references": {}
269
- },
270
- "required": false,
271
- "optional": false,
272
- "docs": {
273
- "tags": [],
274
- "text": "Option to have the ticket registered for multiple draws"
275
- },
276
- "attribute": "multiple-draws",
277
- "reflect": false,
278
- "defaultValue": "true"
279
- },
280
- "ticketId": {
281
- "type": "number",
282
- "mutable": false,
283
- "complexType": {
284
- "original": "number",
285
- "resolved": "number",
286
- "references": {}
287
- },
288
- "required": false,
289
- "optional": false,
290
- "docs": {
291
- "tags": [],
292
- "text": "Ticket ID"
293
- },
294
- "attribute": "ticket-id",
295
- "reflect": false
296
- },
297
- "resetButton": {
298
- "type": "boolean",
299
- "mutable": false,
300
- "complexType": {
301
- "original": "boolean",
302
- "resolved": "boolean",
303
- "references": {}
304
- },
305
- "required": false,
306
- "optional": false,
307
- "docs": {
308
- "tags": [],
309
- "text": "Shows the reset button"
310
- },
311
- "attribute": "reset-button",
312
- "reflect": false,
313
- "defaultValue": "false"
314
- },
315
- "autoPick": {
316
- "type": "boolean",
317
- "mutable": false,
318
- "complexType": {
319
- "original": "boolean",
320
- "resolved": "boolean",
321
- "references": {}
322
- },
323
- "required": false,
324
- "optional": false,
325
- "docs": {
326
- "tags": [],
327
- "text": "Shows the auto-pick button"
328
- },
329
- "attribute": "auto-pick",
330
- "reflect": false,
331
- "defaultValue": "false"
332
- },
333
- "language": {
334
- "type": "string",
335
- "mutable": false,
336
- "complexType": {
337
- "original": "string",
338
- "resolved": "string",
339
- "references": {}
340
- },
341
- "required": false,
342
- "optional": false,
343
- "docs": {
344
- "tags": [],
345
- "text": "Language"
346
- },
347
- "attribute": "language",
348
- "reflect": false,
349
- "defaultValue": "'en'"
350
- },
351
- "clientStyling": {
352
- "type": "string",
353
- "mutable": false,
354
- "complexType": {
355
- "original": "string",
356
- "resolved": "string",
357
- "references": {}
358
- },
359
- "required": false,
360
- "optional": false,
361
- "docs": {
362
- "tags": [],
363
- "text": "Client custom styling via string"
364
- },
365
- "attribute": "client-styling",
366
- "reflect": false,
367
- "defaultValue": "''"
368
- },
369
- "clientStylingUrlContent": {
370
- "type": "string",
371
- "mutable": false,
372
- "complexType": {
373
- "original": "string",
374
- "resolved": "string",
375
- "references": {}
376
- },
377
- "required": false,
378
- "optional": false,
379
- "docs": {
380
- "tags": [],
381
- "text": "Client custom styling via url content"
382
- },
383
- "attribute": "client-styling-url-content",
384
- "reflect": false,
385
- "defaultValue": "''"
429
+ static get listeners() {
430
+ return [{
431
+ "name": "click",
432
+ "method": "checkForClickOutside",
433
+ "target": "window",
434
+ "capture": false,
435
+ "passive": false
436
+ }, {
437
+ "name": "gridFilled",
438
+ "method": "gridFilledHandler",
439
+ "target": undefined,
440
+ "capture": false,
441
+ "passive": false
442
+ }];
386
443
  }
387
- }; }
388
- static get states() { return {
389
- "multiplier": {},
390
- "numberOfDraws": {},
391
- "isLoading": {},
392
- "hasErrors": {},
393
- "ticketDone": {},
394
- "isCustomSelect": {},
395
- "amountInfo": {},
396
- "limitStylingAppends": {}
397
- }; }
398
- static get events() { return [{
399
- "method": "ticketCompleted",
400
- "name": "ticketCompleted",
401
- "bubbles": true,
402
- "cancelable": true,
403
- "composed": true,
404
- "docs": {
405
- "tags": [{
406
- "name": "TODO",
407
- "text": "including ts type"
408
- }],
409
- "text": ""
410
- },
411
- "complexType": {
412
- "original": "any",
413
- "resolved": "any",
414
- "references": {}
415
- }
416
- }, {
417
- "method": "autoSelection",
418
- "name": "autoSelection",
419
- "bubbles": true,
420
- "cancelable": true,
421
- "composed": true,
422
- "docs": {
423
- "tags": [],
424
- "text": ""
425
- },
426
- "complexType": {
427
- "original": "any",
428
- "resolved": "any",
429
- "references": {}
430
- }
431
- }, {
432
- "method": "resetSelection",
433
- "name": "resetSelection",
434
- "bubbles": true,
435
- "cancelable": true,
436
- "composed": true,
437
- "docs": {
438
- "tags": [],
439
- "text": ""
440
- },
441
- "complexType": {
442
- "original": "any",
443
- "resolved": "any",
444
- "references": {}
445
- }
446
- }, {
447
- "method": "stakeChange",
448
- "name": "stakeChange",
449
- "bubbles": true,
450
- "cancelable": true,
451
- "composed": true,
452
- "docs": {
453
- "tags": [],
454
- "text": ""
455
- },
456
- "complexType": {
457
- "original": "any",
458
- "resolved": "any",
459
- "references": {}
460
- }
461
- }, {
462
- "method": "multiplierChange",
463
- "name": "multiplierChange",
464
- "bubbles": true,
465
- "cancelable": true,
466
- "composed": true,
467
- "docs": {
468
- "tags": [],
469
- "text": ""
470
- },
471
- "complexType": {
472
- "original": "any",
473
- "resolved": "any",
474
- "references": {}
475
- }
476
- }]; }
477
- static get watchers() { return [{
478
- "propName": "numberOfDraws",
479
- "methodName": "drawsChangeHandler"
480
- }]; }
481
- static get listeners() { return [{
482
- "name": "click",
483
- "method": "checkForClickOutside",
484
- "target": "window",
485
- "capture": false,
486
- "passive": false
487
- }, {
488
- "name": "gridFilled",
489
- "method": "gridFilledHandler",
490
- "target": undefined,
491
- "capture": false,
492
- "passive": false
493
- }]; }
494
444
  }