@everymatrix/lottery-draw-results 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cjs/{index-33a98fae.js → index-62f030ff.js} +73 -1
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/lottery-bullet_3.cjs.entry.js +374 -0
  4. package/dist/cjs/lottery-draw-results.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +14 -1
  6. package/dist/collection/components/lottery-draw-results/lottery-draw-results.css +7 -18
  7. package/dist/collection/components/lottery-draw-results/lottery-draw-results.js +56 -169
  8. package/dist/collection/utils/locale.utils.js +2 -14
  9. package/dist/components/lottery-bullet.js +6 -0
  10. package/dist/components/lottery-bullet2.js +56 -0
  11. package/dist/components/lottery-draw-results.js +59 -62
  12. package/dist/components/lottery-grid.js +6 -0
  13. package/dist/components/lottery-grid2.js +196 -0
  14. package/dist/esm/{index-c6e6b7f8.js → index-98326ddd.js} +73 -2
  15. package/dist/esm/loader.js +2 -2
  16. package/dist/esm/lottery-bullet_3.entry.js +368 -0
  17. package/dist/esm/lottery-draw-results.js +2 -2
  18. package/dist/lottery-draw-results/lottery-draw-results.esm.js +1 -1
  19. package/dist/lottery-draw-results/p-2b8529f6.entry.js +1 -0
  20. package/dist/lottery-draw-results/p-bb429486.js +1 -0
  21. package/dist/types/components/lottery-draw-results/lottery-draw-results.d.ts +3 -28
  22. package/dist/types/components.d.ts +2 -56
  23. package/package.json +1 -1
  24. package/dist/cjs/lottery-draw-results.cjs.entry.js +0 -188
  25. package/dist/esm/lottery-draw-results.entry.js +0 -184
  26. package/dist/lottery-draw-results/p-31e0953f.js +0 -1
  27. package/dist/lottery-draw-results/p-d7361a7b.entry.js +0 -1
@@ -1,6 +1,20 @@
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
+ };
4
18
  export class LotteryDrawResults {
5
19
  constructor() {
6
20
  /**
@@ -11,39 +25,9 @@ export class LotteryDrawResults {
11
25
  * Shows only the last draw
12
26
  */
13
27
  this.drawMode = false;
14
- /**
15
- * The drawID (option)
16
- */
17
- this.drawId = '';
18
- /**
19
- * The game name
20
- */
21
28
  this.gameName = '';
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;
29
+ this.multiplier = 5.434;
30
+ this.ticketData = {};
47
31
  this.isLoading = true;
48
32
  this.drawResults = [];
49
33
  this.rules = {};
@@ -65,6 +49,9 @@ export class LotteryDrawResults {
65
49
  connectedCallback() {
66
50
  let promises = [];
67
51
  promises.push(this.getGameData());
52
+ if (this.playerId) {
53
+ promises.push(this.getTicketData());
54
+ }
68
55
  if (this.drawId) {
69
56
  promises.push(this.getDrawData());
70
57
  }
@@ -84,11 +71,9 @@ export class LotteryDrawResults {
84
71
  .then((data) => {
85
72
  this.drawData = data;
86
73
  resolve(true);
87
- this.isLoading = false;
88
74
  })
89
75
  .catch((err) => {
90
76
  reject(err);
91
- this.isLoading = false;
92
77
  });
93
78
  });
94
79
  }
@@ -105,8 +90,6 @@ export class LotteryDrawResults {
105
90
  totalNumbers: data.rules.boards[0].totalNumbers
106
91
  };
107
92
  resolve(true);
108
- this.isLoading = false;
109
- this.hasErrors = false;
110
93
  })
111
94
  .catch((err) => {
112
95
  this.isLoading = false;
@@ -116,7 +99,26 @@ export class LotteryDrawResults {
116
99
  });
117
100
  });
118
101
  }
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
+ }
119
120
  render() {
121
+ var _a, _b, _c, _d, _e, _f;
120
122
  if (this.isLoading) {
121
123
  return (h("p", null, "Loading, please wait ..."));
122
124
  }
@@ -132,24 +134,20 @@ export class LotteryDrawResults {
132
134
  ": ",
133
135
  h("span", null, this.gameName)),
134
136
  h("div", { class: "TicketDate" },
135
- translate('ticketPurchaseDate', this.language),
136
- ": ",
137
- h("span", null, this.ticketDate.slice(0, 10))),
137
+ "Ticket Purchase Date: ",
138
+ h("span", null, (_a = this.ticketData) === null || _a === void 0 ? void 0 : _a.createdAt.slice(0, 10))),
138
139
  h("div", { class: "TicketStatus" },
139
- translate('ticketStatus', this.language),
140
- ": ",
141
- h("span", null, this.ticketStatus))),
140
+ "Status: ",
141
+ h("span", null, (_b = this.ticketData) === null || _b === void 0 ? void 0 : _b.state))),
142
142
  h("div", { class: "DrawResultsBody" },
143
143
  h("div", { class: "TicketIdContainer" },
144
144
  h("p", null,
145
- translate('ticketId', this.language),
146
- ": ",
147
- h("span", null, this.ticketId))),
145
+ "Ticket id: ",
146
+ h("span", null, (_c = this.ticketData) === null || _c === void 0 ? void 0 : _c.id))),
148
147
  h("div", { class: "TicketAmountContainer" },
149
148
  h("p", null,
150
- translate('ticketAmount', this.language),
151
- " ",
152
- h("span", null, this.ticketAmount))),
149
+ "Ticket amount: ",
150
+ h("span", null, (_d = this.ticketData) === null || _d === void 0 ? void 0 : _d.amount))),
153
151
  h("div", { class: "DrawNumbersGrid" },
154
152
  h("p", null,
155
153
  translate('drawNumbersGridTicket', this.language),
@@ -158,14 +156,13 @@ export class LotteryDrawResults {
158
156
  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 }))),
159
157
  h("div", { class: "DrawMultipler" },
160
158
  h("label", { class: "Label" },
161
- translate('winUpTo', this.language),
162
- " ",
163
- h("span", null, JSON.stringify(this.ticketMultiplier)))),
159
+ "Multiplier: ",
160
+ h("span", null, JSON.stringify((_e = this.ticketData) === null || _e === void 0 ? void 0 : _e.multiplier)))),
164
161
  h("div", { class: "NumberOfDrawsContainer" },
165
162
  h("p", null,
166
163
  translate('numberOfDraws', this.language),
167
- ": ",
168
- this.ticketDrawCount),
164
+ ": ", (_f = this.ticketData) === null || _f === void 0 ? void 0 :
165
+ _f.drawCount),
169
166
  h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h("div", { class: "ExpandableBoxes" },
170
167
  h("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) },
171
168
  h("div", { class: "TicketResultContainer" },
@@ -196,8 +193,7 @@ export class LotteryDrawResults {
196
193
  h("div", { class: "DrawNumbersGrid" }),
197
194
  h("div", { class: "DrawMultipler" },
198
195
  h("label", { class: "Label" },
199
- translate('winUpTo', this.language),
200
- " ",
196
+ "Multiplier: ",
201
197
  item.multiplier)))))))))
202
198
  :
203
199
  h("div", { class: "DrawResultsArea" }, this.drawData &&
@@ -220,8 +216,7 @@ export class LotteryDrawResults {
220
216
  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 })),
221
217
  h("div", { class: "DrawMultipler" },
222
218
  h("label", { class: "Label" },
223
- translate('multiplier', this.language),
224
- " ",
219
+ "Multiplier: ",
225
220
  this.multiplier))))))));
226
221
  }
227
222
  }
@@ -333,11 +328,10 @@ export class LotteryDrawResults {
333
328
  "optional": false,
334
329
  "docs": {
335
330
  "tags": [],
336
- "text": "The drawID (option)"
331
+ "text": "Shows results for a specific drawID (option)"
337
332
  },
338
333
  "attribute": "draw-id",
339
- "reflect": false,
340
- "defaultValue": "''"
334
+ "reflect": false
341
335
  },
342
336
  "gameName": {
343
337
  "type": "string",
@@ -351,123 +345,16 @@ export class LotteryDrawResults {
351
345
  "optional": false,
352
346
  "docs": {
353
347
  "tags": [],
354
- "text": "The game name"
348
+ "text": ""
355
349
  },
356
350
  "attribute": "game-name",
357
351
  "reflect": false,
358
352
  "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"
467
353
  }
468
354
  }; }
469
355
  static get states() { return {
470
356
  "multiplier": {},
357
+ "ticketData": {},
471
358
  "isLoading": {},
472
359
  "drawResults": {},
473
360
  "rules": {},
@@ -10,13 +10,7 @@ const TRANSLATIONS = {
10
10
  drawNumbersGridTicket: 'Draw numbers Grid B',
11
11
  ticketResult: 'Ticket result',
12
12
  amountWon: 'Amount won',
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',
13
+ numberOfDraws: 'Number of draws'
20
14
  },
21
15
  ro: {
22
16
  drawResultsHeader: 'Ultimele rezultate extragere',
@@ -27,13 +21,7 @@ const TRANSLATIONS = {
27
21
  drawNumbersGridTicket: 'Numerele extrase Grid B',
28
22
  ticketResult: 'Rezultatul biletului',
29
23
  amountWon: 'Suma castigata',
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'
24
+ numberOfDraws: 'Numarul de extrageri'
37
25
  },
38
26
  };
39
27
  export const translate = (key, customLang) => {
@@ -0,0 +1,6 @@
1
+ import { L as LotteryBullet$1, d as defineCustomElement$1 } from './lottery-bullet2.js';
2
+
3
+ const LotteryBullet = LotteryBullet$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { LotteryBullet, defineCustomElement };
@@ -0,0 +1,56 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
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}.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}";
4
+
5
+ const LotteryBullet = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
11
+ /**
12
+ * Value of the bullet
13
+ */
14
+ this.value = '0';
15
+ /**
16
+ * Marks if the bullet should be selectable
17
+ */
18
+ this.selectable = true;
19
+ /**
20
+ * Marks if the bullet should be selected
21
+ */
22
+ this.isSelected = false;
23
+ this.select = () => {
24
+ if (this.selectable) {
25
+ this.isSelected = !this.isSelected;
26
+ this.bulletEvent.emit({
27
+ value: this.value,
28
+ selected: this.isSelected
29
+ });
30
+ }
31
+ };
32
+ }
33
+ render() {
34
+ return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
35
+ }
36
+ static get style() { return lotteryBulletCss; }
37
+ }, [1, "lottery-bullet", {
38
+ "value": [1],
39
+ "selectable": [4],
40
+ "isSelected": [4, "is-selected"]
41
+ }]);
42
+ function defineCustomElement() {
43
+ if (typeof customElements === "undefined") {
44
+ return;
45
+ }
46
+ const components = ["lottery-bullet"];
47
+ components.forEach(tagName => { switch (tagName) {
48
+ case "lottery-bullet":
49
+ if (!customElements.get(tagName)) {
50
+ customElements.define(tagName, LotteryBullet);
51
+ }
52
+ break;
53
+ } });
54
+ }
55
+
56
+ export { LotteryBullet as L, defineCustomElement as d };
@@ -1,5 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import '@everymatrix/lottery-grid';
2
+ import { d as defineCustomElement$3 } from './lottery-bullet2.js';
3
+ import { d as defineCustomElement$2 } from './lottery-grid2.js';
3
4
 
4
5
  const DEFAULT_LANGUAGE = 'en';
5
6
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
@@ -13,13 +14,7 @@ const TRANSLATIONS = {
13
14
  drawNumbersGridTicket: 'Draw numbers Grid B',
14
15
  ticketResult: 'Ticket result',
15
16
  amountWon: 'Amount won',
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',
17
+ numberOfDraws: 'Number of draws'
23
18
  },
24
19
  ro: {
25
20
  drawResultsHeader: 'Ultimele rezultate extragere',
@@ -30,13 +25,7 @@ const TRANSLATIONS = {
30
25
  drawNumbersGridTicket: 'Numerele extrase Grid B',
31
26
  ticketResult: 'Rezultatul biletului',
32
27
  amountWon: 'Suma castigata',
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'
28
+ numberOfDraws: 'Numarul de extrageri'
40
29
  },
41
30
  };
42
31
  const translate = (key, customLang) => {
@@ -44,8 +33,22 @@ const translate = (key, customLang) => {
44
33
  return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
45
34
  };
46
35
 
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}";
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}";
48
37
 
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
+ };
49
52
  const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
50
53
  constructor() {
51
54
  super();
@@ -59,39 +62,9 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
59
62
  * Shows only the last draw
60
63
  */
61
64
  this.drawMode = false;
62
- /**
63
- * The drawID (option)
64
- */
65
- this.drawId = '';
66
- /**
67
- * The game name
68
- */
69
65
  this.gameName = '';
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;
66
+ this.multiplier = 5.434;
67
+ this.ticketData = {};
95
68
  this.isLoading = true;
96
69
  this.drawResults = [];
97
70
  this.rules = {};
@@ -113,6 +86,9 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
113
86
  connectedCallback() {
114
87
  let promises = [];
115
88
  promises.push(this.getGameData());
89
+ if (this.playerId) {
90
+ promises.push(this.getTicketData());
91
+ }
116
92
  if (this.drawId) {
117
93
  promises.push(this.getDrawData());
118
94
  }
@@ -132,11 +108,9 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
132
108
  .then((data) => {
133
109
  this.drawData = data;
134
110
  resolve(true);
135
- this.isLoading = false;
136
111
  })
137
112
  .catch((err) => {
138
113
  reject(err);
139
- this.isLoading = false;
140
114
  });
141
115
  });
142
116
  }
@@ -153,8 +127,6 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
153
127
  totalNumbers: data.rules.boards[0].totalNumbers
154
128
  };
155
129
  resolve(true);
156
- this.isLoading = false;
157
- this.hasErrors = false;
158
130
  })
159
131
  .catch((err) => {
160
132
  this.isLoading = false;
@@ -164,7 +136,26 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
164
136
  });
165
137
  });
166
138
  }
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
+ }
167
157
  render() {
158
+ var _a, _b, _c, _d, _e, _f;
168
159
  if (this.isLoading) {
169
160
  return (h("p", null, "Loading, please wait ..."));
170
161
  }
@@ -173,11 +164,12 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
173
164
  }
174
165
  else {
175
166
  return (h("section", { class: "DrawResultsSection" }, !this.drawMode ?
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)))))))))
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)))))))))
178
170
  :
179
171
  h("div", { class: "DrawResultsArea" }, this.drawData &&
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))))))));
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))))))));
181
173
  }
182
174
  }
183
175
  static get style() { return lotteryDrawResultsCss; }
@@ -189,13 +181,8 @@ const LotteryDrawResults$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
189
181
  "drawMode": [4, "draw-mode"],
190
182
  "drawId": [1, "draw-id"],
191
183
  "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"],
198
184
  "multiplier": [32],
185
+ "ticketData": [32],
199
186
  "isLoading": [32],
200
187
  "drawResults": [32],
201
188
  "rules": [32],
@@ -207,13 +194,23 @@ function defineCustomElement$1() {
207
194
  if (typeof customElements === "undefined") {
208
195
  return;
209
196
  }
210
- const components = ["lottery-draw-results"];
197
+ const components = ["lottery-draw-results", "lottery-bullet", "lottery-grid"];
211
198
  components.forEach(tagName => { switch (tagName) {
212
199
  case "lottery-draw-results":
213
200
  if (!customElements.get(tagName)) {
214
201
  customElements.define(tagName, LotteryDrawResults$1);
215
202
  }
216
203
  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;
217
214
  } });
218
215
  }
219
216
 
@@ -0,0 +1,6 @@
1
+ import { L as LotteryGrid$1, d as defineCustomElement$1 } from './lottery-grid2.js';
2
+
3
+ const LotteryGrid = LotteryGrid$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { LotteryGrid, defineCustomElement };