@everymatrix/lottery-draw-results 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 (28) hide show
  1. package/dist/cjs/{index-62f030ff.js → index-33a98fae.js} +1 -73
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/lottery-draw-results.cjs.entry.js +188 -0
  4. package/dist/cjs/lottery-draw-results.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +5 -12
  6. package/dist/collection/components/lottery-draw-results/lottery-draw-results.css +18 -7
  7. package/dist/collection/components/lottery-draw-results/lottery-draw-results.js +169 -56
  8. package/dist/collection/utils/locale.utils.js +14 -2
  9. package/dist/components/lottery-draw-results.js +63 -59
  10. package/dist/esm/{index-98326ddd.js → index-c6e6b7f8.js} +2 -73
  11. package/dist/esm/loader.js +2 -2
  12. package/dist/esm/lottery-draw-results.entry.js +184 -0
  13. package/dist/esm/lottery-draw-results.js +2 -2
  14. package/dist/lottery-draw-results/lottery-draw-results.esm.js +1 -1
  15. package/dist/lottery-draw-results/p-31e0953f.js +1 -0
  16. package/dist/lottery-draw-results/p-d7361a7b.entry.js +1 -0
  17. package/dist/stencil.config.js +3 -0
  18. package/dist/types/components/lottery-draw-results/lottery-draw-results.d.ts +28 -3
  19. package/dist/types/components.d.ts +56 -2
  20. package/package.json +2 -2
  21. package/dist/cjs/lottery-bullet_3.cjs.entry.js +0 -374
  22. package/dist/components/lottery-bullet.js +0 -6
  23. package/dist/components/lottery-bullet2.js +0 -56
  24. package/dist/components/lottery-grid.js +0 -6
  25. package/dist/components/lottery-grid2.js +0 -196
  26. package/dist/esm/lottery-bullet_3.entry.js +0 -368
  27. package/dist/lottery-draw-results/p-2b8529f6.entry.js +0 -1
  28. package/dist/lottery-draw-results/p-bb429486.js +0 -1
@@ -1,20 +1,6 @@
1
1
  import { Component, Prop, h, State } from '@stencil/core';
2
2
  import { translate } from '../../utils/locale.utils';
3
3
  import '@everymatrix/lottery-grid';
4
- const DEFAULT_VALUES = {
5
- gamename: 'Chrono',
6
- gamedate: '24/09/2022',
7
- state: 'Processing',
8
- amount: 304444,
9
- ticketid: '6963444',
10
- selection: '[5, 6, 7, 8, 9]',
11
- multiplier: 4.5,
12
- resultstatus: 'Processing',
13
- drawstatus: 'Won',
14
- drawamount: 1022,
15
- drawid: '54545555',
16
- drawdate: '24/09/2032'
17
- };
18
4
  export class LotteryDrawResults {
19
5
  constructor() {
20
6
  /**
@@ -25,9 +11,39 @@ export class LotteryDrawResults {
25
11
  * Shows only the last draw
26
12
  */
27
13
  this.drawMode = false;
14
+ /**
15
+ * The drawID (option)
16
+ */
17
+ this.drawId = '';
18
+ /**
19
+ * The game name
20
+ */
28
21
  this.gameName = '';
29
- this.multiplier = 5.434;
30
- this.ticketData = {};
22
+ /**
23
+ * The ticket submission date
24
+ */
25
+ this.ticketDate = '';
26
+ /**
27
+ * The ticket status
28
+ */
29
+ this.ticketStatus = '';
30
+ /**
31
+ * The ticket id
32
+ */
33
+ this.ticketId = '';
34
+ /**
35
+ * The ticket amount
36
+ */
37
+ this.ticketAmount = '';
38
+ /**
39
+ * The ticket multiplier
40
+ */
41
+ this.ticketMultiplier = false;
42
+ /**
43
+ * The ticket draw count
44
+ */
45
+ this.ticketDrawCount = 0;
46
+ this.multiplier = 3;
31
47
  this.isLoading = true;
32
48
  this.drawResults = [];
33
49
  this.rules = {};
@@ -49,9 +65,6 @@ export class LotteryDrawResults {
49
65
  connectedCallback() {
50
66
  let promises = [];
51
67
  promises.push(this.getGameData());
52
- if (this.playerId) {
53
- promises.push(this.getTicketData());
54
- }
55
68
  if (this.drawId) {
56
69
  promises.push(this.getDrawData());
57
70
  }
@@ -71,9 +84,11 @@ export class LotteryDrawResults {
71
84
  .then((data) => {
72
85
  this.drawData = data;
73
86
  resolve(true);
87
+ this.isLoading = false;
74
88
  })
75
89
  .catch((err) => {
76
90
  reject(err);
91
+ this.isLoading = false;
77
92
  });
78
93
  });
79
94
  }
@@ -90,6 +105,8 @@ export class LotteryDrawResults {
90
105
  totalNumbers: data.rules.boards[0].totalNumbers
91
106
  };
92
107
  resolve(true);
108
+ this.isLoading = false;
109
+ this.hasErrors = false;
93
110
  })
94
111
  .catch((err) => {
95
112
  this.isLoading = false;
@@ -99,26 +116,7 @@ export class LotteryDrawResults {
99
116
  });
100
117
  });
101
118
  }
102
- getTicketData() {
103
- return new Promise((resolve, reject) => {
104
- let url = new URL(`${this.endpoint}/tickets/player/${this.playerId}`);
105
- fetch(url.href)
106
- .then((response) => {
107
- return response.json();
108
- })
109
- .then((data) => {
110
- this.ticketData = data.length === 0 ? DEFAULT_VALUES : data[1];
111
- this.drawResults = this.ticketData.drawResults.map((item) => item);
112
- this.selection = this.ticketData.selection[0].join(',');
113
- resolve(true);
114
- })
115
- .catch((err) => {
116
- reject(err);
117
- });
118
- });
119
- }
120
119
  render() {
121
- var _a, _b, _c, _d, _e, _f;
122
120
  if (this.isLoading) {
123
121
  return (h("p", null, "Loading, please wait ..."));
124
122
  }
@@ -134,20 +132,24 @@ export class LotteryDrawResults {
134
132
  ": ",
135
133
  h("span", null, this.gameName)),
136
134
  h("div", { class: "TicketDate" },
137
- "Ticket Purchase Date: ",
138
- h("span", null, (_a = this.ticketData) === null || _a === void 0 ? void 0 : _a.createdAt.slice(0, 10))),
135
+ translate('ticketPurchaseDate', this.language),
136
+ ": ",
137
+ h("span", null, this.ticketDate.slice(0, 10))),
139
138
  h("div", { class: "TicketStatus" },
140
- "Status: ",
141
- h("span", null, (_b = this.ticketData) === null || _b === void 0 ? void 0 : _b.state))),
139
+ translate('ticketStatus', this.language),
140
+ ": ",
141
+ h("span", null, this.ticketStatus))),
142
142
  h("div", { class: "DrawResultsBody" },
143
143
  h("div", { class: "TicketIdContainer" },
144
144
  h("p", null,
145
- "Ticket id: ",
146
- h("span", null, (_c = this.ticketData) === null || _c === void 0 ? void 0 : _c.id))),
145
+ translate('ticketId', this.language),
146
+ ": ",
147
+ h("span", null, this.ticketId))),
147
148
  h("div", { class: "TicketAmountContainer" },
148
149
  h("p", null,
149
- "Ticket amount: ",
150
- h("span", null, (_d = this.ticketData) === null || _d === void 0 ? void 0 : _d.amount))),
150
+ translate('ticketAmount', this.language),
151
+ " ",
152
+ h("span", null, this.ticketAmount))),
151
153
  h("div", { class: "DrawNumbersGrid" },
152
154
  h("p", null,
153
155
  translate('drawNumbersGridTicket', this.language),
@@ -156,13 +158,14 @@ export class LotteryDrawResults {
156
158
  h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))),
157
159
  h("div", { class: "DrawMultipler" },
158
160
  h("label", { class: "Label" },
159
- "Multiplier: ",
160
- h("span", null, JSON.stringify((_e = this.ticketData) === null || _e === void 0 ? void 0 : _e.multiplier)))),
161
+ translate('winUpTo', this.language),
162
+ " ",
163
+ h("span", null, JSON.stringify(this.ticketMultiplier)))),
161
164
  h("div", { class: "NumberOfDrawsContainer" },
162
165
  h("p", null,
163
166
  translate('numberOfDraws', this.language),
164
- ": ", (_f = this.ticketData) === null || _f === void 0 ? void 0 :
165
- _f.drawCount),
167
+ ": ",
168
+ this.ticketDrawCount),
166
169
  h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h("div", { class: "ExpandableBoxes" },
167
170
  h("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) },
168
171
  h("div", { class: "TicketResultContainer" },
@@ -193,7 +196,8 @@ export class LotteryDrawResults {
193
196
  h("div", { class: "DrawNumbersGrid" }),
194
197
  h("div", { class: "DrawMultipler" },
195
198
  h("label", { class: "Label" },
196
- "Multiplier: ",
199
+ translate('winUpTo', this.language),
200
+ " ",
197
201
  item.multiplier)))))))))
198
202
  :
199
203
  h("div", { class: "DrawResultsArea" }, this.drawData &&
@@ -216,7 +220,8 @@ export class LotteryDrawResults {
216
220
  h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })),
217
221
  h("div", { class: "DrawMultipler" },
218
222
  h("label", { class: "Label" },
219
- "Multiplier: ",
223
+ translate('multiplier', this.language),
224
+ " ",
220
225
  this.multiplier))))))));
221
226
  }
222
227
  }
@@ -328,10 +333,11 @@ export class LotteryDrawResults {
328
333
  "optional": false,
329
334
  "docs": {
330
335
  "tags": [],
331
- "text": "Shows results for a specific drawID (option)"
336
+ "text": "The drawID (option)"
332
337
  },
333
338
  "attribute": "draw-id",
334
- "reflect": false
339
+ "reflect": false,
340
+ "defaultValue": "''"
335
341
  },
336
342
  "gameName": {
337
343
  "type": "string",
@@ -345,16 +351,123 @@ export class LotteryDrawResults {
345
351
  "optional": false,
346
352
  "docs": {
347
353
  "tags": [],
348
- "text": ""
354
+ "text": "The game name"
349
355
  },
350
356
  "attribute": "game-name",
351
357
  "reflect": false,
352
358
  "defaultValue": "''"
359
+ },
360
+ "ticketDate": {
361
+ "type": "string",
362
+ "mutable": false,
363
+ "complexType": {
364
+ "original": "string",
365
+ "resolved": "string",
366
+ "references": {}
367
+ },
368
+ "required": false,
369
+ "optional": false,
370
+ "docs": {
371
+ "tags": [],
372
+ "text": "The ticket submission date"
373
+ },
374
+ "attribute": "ticket-date",
375
+ "reflect": false,
376
+ "defaultValue": "''"
377
+ },
378
+ "ticketStatus": {
379
+ "type": "string",
380
+ "mutable": false,
381
+ "complexType": {
382
+ "original": "string",
383
+ "resolved": "string",
384
+ "references": {}
385
+ },
386
+ "required": false,
387
+ "optional": false,
388
+ "docs": {
389
+ "tags": [],
390
+ "text": "The ticket status"
391
+ },
392
+ "attribute": "ticket-status",
393
+ "reflect": false,
394
+ "defaultValue": "''"
395
+ },
396
+ "ticketId": {
397
+ "type": "string",
398
+ "mutable": false,
399
+ "complexType": {
400
+ "original": "string",
401
+ "resolved": "string",
402
+ "references": {}
403
+ },
404
+ "required": false,
405
+ "optional": false,
406
+ "docs": {
407
+ "tags": [],
408
+ "text": "The ticket id"
409
+ },
410
+ "attribute": "ticket-id",
411
+ "reflect": false,
412
+ "defaultValue": "''"
413
+ },
414
+ "ticketAmount": {
415
+ "type": "string",
416
+ "mutable": false,
417
+ "complexType": {
418
+ "original": "string",
419
+ "resolved": "string",
420
+ "references": {}
421
+ },
422
+ "required": false,
423
+ "optional": false,
424
+ "docs": {
425
+ "tags": [],
426
+ "text": "The ticket amount"
427
+ },
428
+ "attribute": "ticket-amount",
429
+ "reflect": false,
430
+ "defaultValue": "''"
431
+ },
432
+ "ticketMultiplier": {
433
+ "type": "boolean",
434
+ "mutable": false,
435
+ "complexType": {
436
+ "original": "boolean",
437
+ "resolved": "boolean",
438
+ "references": {}
439
+ },
440
+ "required": false,
441
+ "optional": false,
442
+ "docs": {
443
+ "tags": [],
444
+ "text": "The ticket multiplier"
445
+ },
446
+ "attribute": "ticket-multiplier",
447
+ "reflect": false,
448
+ "defaultValue": "false"
449
+ },
450
+ "ticketDrawCount": {
451
+ "type": "number",
452
+ "mutable": false,
453
+ "complexType": {
454
+ "original": "number",
455
+ "resolved": "number",
456
+ "references": {}
457
+ },
458
+ "required": false,
459
+ "optional": false,
460
+ "docs": {
461
+ "tags": [],
462
+ "text": "The ticket draw count"
463
+ },
464
+ "attribute": "ticket-draw-count",
465
+ "reflect": false,
466
+ "defaultValue": "0"
353
467
  }
354
468
  }; }
355
469
  static get states() { return {
356
470
  "multiplier": {},
357
- "ticketData": {},
358
471
  "isLoading": {},
359
472
  "drawResults": {},
360
473
  "rules": {},
@@ -10,7 +10,13 @@ const TRANSLATIONS = {
10
10
  drawNumbersGridTicket: 'Draw numbers Grid B',
11
11
  ticketResult: 'Ticket result',
12
12
  amountWon: 'Amount won',
13
- numberOfDraws: 'Number of draws'
13
+ numberOfDraws: 'Number of draws',
14
+ multiplier: 'Multiplier:',
15
+ ticketPurchaseDate: 'Ticket Purchase Date',
16
+ ticketStatus: 'Ticket Status',
17
+ ticketId: 'Ticket ID',
18
+ ticketAmount: 'Ticket Amount',
19
+ winUpTo: 'Win up to',
14
20
  },
15
21
  ro: {
16
22
  drawResultsHeader: 'Ultimele rezultate extragere',
@@ -21,7 +27,13 @@ const TRANSLATIONS = {
21
27
  drawNumbersGridTicket: 'Numerele extrase Grid B',
22
28
  ticketResult: 'Rezultatul biletului',
23
29
  amountWon: 'Suma castigata',
24
- numberOfDraws: 'Numarul de extrageri'
30
+ numberOfDraws: 'Numarul de extrageri',
31
+ multiplier: 'Multiplicator:',
32
+ ticketPurchaseDate: 'Data achizitionarii biletului',
33
+ ticketStatus: 'Statusul biletului',
34
+ ticketId: 'Id biletul',
35
+ ticketAmount: 'Valoarea biletului',
36
+ winUpTo: 'Poti castiga'
25
37
  },
26
38
  };
27
39
  export const translate = (key, customLang) => {
@@ -1,6 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { d as defineCustomElement$3 } from './lottery-bullet2.js';
3
- import { d as defineCustomElement$2 } from './lottery-grid2.js';
2
+ import '@everymatrix/lottery-grid';
4
3
 
5
4
  const DEFAULT_LANGUAGE = 'en';
6
5
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
@@ -14,7 +13,13 @@ const TRANSLATIONS = {
14
13
  drawNumbersGridTicket: 'Draw numbers Grid B',
15
14
  ticketResult: 'Ticket result',
16
15
  amountWon: 'Amount won',
17
- numberOfDraws: 'Number of draws'
16
+ numberOfDraws: 'Number of draws',
17
+ multiplier: 'Multiplier:',
18
+ ticketPurchaseDate: 'Ticket Purchase Date',
19
+ ticketStatus: 'Ticket Status',
20
+ ticketId: 'Ticket ID',
21
+ ticketAmount: 'Ticket Amount',
22
+ winUpTo: 'Win up to',
18
23
  },
19
24
  ro: {
20
25
  drawResultsHeader: 'Ultimele rezultate extragere',
@@ -25,7 +30,13 @@ const TRANSLATIONS = {
25
30
  drawNumbersGridTicket: 'Numerele extrase Grid B',
26
31
  ticketResult: 'Rezultatul biletului',
27
32
  amountWon: 'Suma castigata',
28
- numberOfDraws: 'Numarul de extrageri'
33
+ numberOfDraws: 'Numarul de extrageri',
34
+ multiplier: 'Multiplicator:',
35
+ ticketPurchaseDate: 'Data achizitionarii biletului',
36
+ ticketStatus: 'Statusul biletului',
37
+ ticketId: 'Id biletul',
38
+ ticketAmount: 'Valoarea biletului',
39
+ winUpTo: 'Poti castiga'
29
40
  },
30
41
  };
31
42
  const translate = (key, customLang) => {
@@ -33,22 +44,8 @@ const translate = (key, customLang) => {
33
44
  return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
34
45
  };
35
46
 
36
- const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsSection{max-width:500px;margin:0 auto;margin:0px auto 10px;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0 20px}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{width:100%;height:100%;max-height:100px;float:left;margin:0 0 20px 0;border:1px solid #009993;border-radius:4px;padding:10px;box-sizing:border-box;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
47
+ const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0px 20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:70px;float:left;margin:0 0 20px 0;border:1px solid #f1f1f1;background:#fff;border-radius:4px;padding:10px;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden;box-shadow:rgba(99, 99, 99, 0.2) 0px 2px 8px 0px}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
37
48
 
38
- const DEFAULT_VALUES = {
39
- gamename: 'Chrono',
40
- gamedate: '24/09/2022',
41
- state: 'Processing',
42
- amount: 304444,
43
- ticketid: '6963444',
44
- selection: '[5, 6, 7, 8, 9]',
45
- multiplier: 4.5,
46
- resultstatus: 'Processing',
47
- drawstatus: 'Won',
48
- drawamount: 1022,
49
- drawid: '54545555',
50
- drawdate: '24/09/2032'
51
- };
52
49
  const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
53
50
  constructor() {
54
51
  super();
@@ -62,9 +59,39 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
62
59
  * Shows only the last draw
63
60
  */
64
61
  this.drawMode = false;
62
+ /**
63
+ * The drawID (option)
64
+ */
65
+ this.drawId = '';
66
+ /**
67
+ * The game name
68
+ */
65
69
  this.gameName = '';
66
- this.multiplier = 5.434;
67
- this.ticketData = {};
70
+ /**
71
+ * The ticket submission date
72
+ */
73
+ this.ticketDate = '';
74
+ /**
75
+ * The ticket status
76
+ */
77
+ this.ticketStatus = '';
78
+ /**
79
+ * The ticket id
80
+ */
81
+ this.ticketId = '';
82
+ /**
83
+ * The ticket amount
84
+ */
85
+ this.ticketAmount = '';
86
+ /**
87
+ * The ticket multiplier
88
+ */
89
+ this.ticketMultiplier = false;
90
+ /**
91
+ * The ticket draw count
92
+ */
93
+ this.ticketDrawCount = 0;
94
+ this.multiplier = 3;
68
95
  this.isLoading = true;
69
96
  this.drawResults = [];
70
97
  this.rules = {};
@@ -86,9 +113,6 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
86
113
  connectedCallback() {
87
114
  let promises = [];
88
115
  promises.push(this.getGameData());
89
- if (this.playerId) {
90
- promises.push(this.getTicketData());
91
- }
92
116
  if (this.drawId) {
93
117
  promises.push(this.getDrawData());
94
118
  }
@@ -108,9 +132,11 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
108
132
  .then((data) => {
109
133
  this.drawData = data;
110
134
  resolve(true);
135
+ this.isLoading = false;
111
136
  })
112
137
  .catch((err) => {
113
138
  reject(err);
139
+ this.isLoading = false;
114
140
  });
115
141
  });
116
142
  }
@@ -127,6 +153,8 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
127
153
  totalNumbers: data.rules.boards[0].totalNumbers
128
154
  };
129
155
  resolve(true);
156
+ this.isLoading = false;
157
+ this.hasErrors = false;
130
158
  })
131
159
  .catch((err) => {
132
160
  this.isLoading = false;
@@ -136,26 +164,7 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
136
164
  });
137
165
  });
138
166
  }
139
- getTicketData() {
140
- return new Promise((resolve, reject) => {
141
- let url = new URL(`${this.endpoint}/tickets/player/${this.playerId}`);
142
- fetch(url.href)
143
- .then((response) => {
144
- return response.json();
145
- })
146
- .then((data) => {
147
- this.ticketData = data.length === 0 ? DEFAULT_VALUES : data[1];
148
- this.drawResults = this.ticketData.drawResults.map((item) => item);
149
- this.selection = this.ticketData.selection[0].join(',');
150
- resolve(true);
151
- })
152
- .catch((err) => {
153
- reject(err);
154
- });
155
- });
156
- }
157
167
  render() {
158
- var _a, _b, _c, _d, _e, _f;
159
168
  if (this.isLoading) {
160
169
  return (h("p", null, "Loading, please wait ..."));
161
170
  }
@@ -164,12 +173,11 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
164
173
  }
165
174
  else {
166
175
  return (h("section", { class: "DrawResultsSection" }, !this.drawMode ?
167
- h("div", { class: "DrawResultsArea" }, h("div", { class: "TicketInfo" }, h("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", h("span", null, this.gameName)), h("div", { class: "TicketDate" }, "Ticket Purchase Date: ", h("span", null, (_a = this.ticketData) === null || _a === void 0 ? void 0 : _a.createdAt.slice(0, 10))), h("div", { class: "TicketStatus" }, "Status: ", h("span", null, (_b = this.ticketData) === null || _b === void 0 ? void 0 : _b.state))), h("div", { class: "DrawResultsBody" }, h("div", { class: "TicketIdContainer" }, h("p", null, "Ticket id: ", h("span", null, (_c = this.ticketData) === null || _c === void 0 ? void 0 : _c.id))), h("div", { class: "TicketAmountContainer" }, h("p", null, "Ticket amount: ", h("span", null, (_d = this.ticketData) === null || _d === void 0 ? void 0 : _d.amount))), h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridTicket', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, "Multiplier: ", h("span", null, JSON.stringify((_e = this.ticketData) === null || _e === void 0 ? void 0 : _e.multiplier)))), h("div", { class: "NumberOfDrawsContainer" }, h("p", null, translate('numberOfDraws', this.language), ": ", (_f = this.ticketData) === null || _f === void 0 ? void 0 :
168
- _f.drawCount), h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h("div", { class: "ExpandableBoxes" }, h("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) }, h("div", { class: "TicketResultContainer" }, h("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
169
- h("div", { class: "AmountWonContainer" }, h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), h("div", { class: "DrawIdContainer" }, h("p", null, translate('drawId', this.language), ": ", item.drawId)), h("div", { class: "DrawDateContainer" }, h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), h("div", { class: "DrawNumbersGrid" }), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, "Multiplier: ", item.multiplier)))))))))
176
+ h("div", { class: "DrawResultsArea" }, h("div", { class: "TicketInfo" }, h("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", h("span", null, this.gameName)), h("div", { class: "TicketDate" }, translate('ticketPurchaseDate', this.language), ": ", h("span", null, this.ticketDate.slice(0, 10))), h("div", { class: "TicketStatus" }, translate('ticketStatus', this.language), ": ", h("span", null, this.ticketStatus))), h("div", { class: "DrawResultsBody" }, h("div", { class: "TicketIdContainer" }, h("p", null, translate('ticketId', this.language), ": ", h("span", null, this.ticketId))), h("div", { class: "TicketAmountContainer" }, h("p", null, translate('ticketAmount', this.language), " ", h("span", null, this.ticketAmount))), h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridTicket', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('winUpTo', this.language), " ", h("span", null, JSON.stringify(this.ticketMultiplier)))), h("div", { class: "NumberOfDrawsContainer" }, h("p", null, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h("div", { class: "ExpandableBoxes" }, h("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) }, h("div", { class: "TicketResultContainer" }, h("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
177
+ h("div", { class: "AmountWonContainer" }, h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), h("div", { class: "DrawIdContainer" }, h("p", null, translate('drawId', this.language), ": ", item.drawId)), h("div", { class: "DrawDateContainer" }, h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), h("div", { class: "DrawNumbersGrid" }), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('winUpTo', this.language), " ", item.multiplier)))))))))
170
178
  :
171
179
  h("div", { class: "DrawResultsArea" }, this.drawData &&
172
- h("div", null, h("div", { class: "DrawResultsHeader" }, h("span", null, translate('drawId', this.language), ": ", this.drawData.id), h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), h("div", { class: "DrawResultsBody" }, h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridDraw', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, "Multiplier: ", this.multiplier))))))));
180
+ h("div", null, h("div", { class: "DrawResultsHeader" }, h("span", null, translate('drawId', this.language), ": ", this.drawData.id), h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), h("div", { class: "DrawResultsBody" }, h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridDraw', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))));
173
181
  }
174
182
  }
175
183
  static get style() { return lotteryDrawResultsCss; }
@@ -181,8 +189,13 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
181
189
  "drawMode": [4, "draw-mode"],
182
190
  "drawId": [1, "draw-id"],
183
191
  "gameName": [1, "game-name"],
192
+ "ticketDate": [1, "ticket-date"],
193
+ "ticketStatus": [1, "ticket-status"],
194
+ "ticketId": [1, "ticket-id"],
195
+ "ticketAmount": [1, "ticket-amount"],
196
+ "ticketMultiplier": [4, "ticket-multiplier"],
197
+ "ticketDrawCount": [2, "ticket-draw-count"],
184
198
  "multiplier": [32],
185
- "ticketData": [32],
186
199
  "isLoading": [32],
187
200
  "drawResults": [32],
188
201
  "rules": [32],
@@ -194,25 +207,16 @@ function defineCustomElement$1() {
194
207
  if (typeof customElements === "undefined") {
195
208
  return;
196
209
  }
197
- const components = ["lottery-draw-results", "lottery-bullet", "lottery-grid"];
210
+ const components = ["lottery-draw-results"];
198
211
  components.forEach(tagName => { switch (tagName) {
199
212
  case "lottery-draw-results":
200
213
  if (!customElements.get(tagName)) {
201
214
  customElements.define(tagName, LotteryDrawResults$1);
202
215
  }
203
216
  break;
204
- case "lottery-bullet":
205
- if (!customElements.get(tagName)) {
206
- defineCustomElement$3();
207
- }
208
- break;
209
- case "lottery-grid":
210
- if (!customElements.get(tagName)) {
211
- defineCustomElement$2();
212
- }
213
- break;
214
217
  } });
215
218
  }
219
+ defineCustomElement$1();
216
220
 
217
221
  const LotteryDrawResults = LotteryDrawResults$1;
218
222
  const defineCustomElement = defineCustomElement$1;