@everymatrix/lottery-draw-results 1.31.2 → 1.32.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +4 -3
  3. package/dist/cjs/index-40e6760b.js +0 -1252
  4. package/dist/cjs/index.cjs.js +0 -2
  5. package/dist/cjs/loader.cjs.js +0 -21
  6. package/dist/cjs/lottery-bullet_3.cjs.entry.js +0 -564
  7. package/dist/cjs/lottery-draw-results.cjs.js +0 -19
  8. package/dist/collection/collection-manifest.json +0 -25
  9. package/dist/collection/components/lottery-draw-results/lottery-draw-results.css +0 -207
  10. package/dist/collection/components/lottery-draw-results/lottery-draw-results.js +0 -622
  11. package/dist/collection/index.js +0 -1
  12. package/dist/collection/utils/locale.utils.js +0 -93
  13. package/dist/collection/utils/utils.js +0 -3
  14. package/dist/components/index.d.ts +0 -26
  15. package/dist/components/index.js +0 -1
  16. package/dist/components/lottery-bullet.js +0 -6
  17. package/dist/components/lottery-bullet2.js +0 -91
  18. package/dist/components/lottery-draw-results.d.ts +0 -11
  19. package/dist/components/lottery-draw-results.js +0 -346
  20. package/dist/components/lottery-grid.js +0 -6
  21. package/dist/components/lottery-grid2.js +0 -245
  22. package/dist/esm/index-3c2823a2.js +0 -1226
  23. package/dist/esm/index.js +0 -1
  24. package/dist/esm/loader.js +0 -17
  25. package/dist/esm/lottery-bullet_3.entry.js +0 -558
  26. package/dist/esm/lottery-draw-results.js +0 -17
  27. package/dist/esm/polyfills/core-js.js +0 -11
  28. package/dist/esm/polyfills/css-shim.js +0 -1
  29. package/dist/esm/polyfills/dom.js +0 -79
  30. package/dist/esm/polyfills/es5-html-element.js +0 -1
  31. package/dist/esm/polyfills/index.js +0 -34
  32. package/dist/esm/polyfills/system.js +0 -6
  33. package/dist/index.cjs.js +0 -1
  34. package/dist/index.js +0 -1
  35. package/dist/lottery-draw-results/index.esm.js +0 -0
  36. package/dist/lottery-draw-results/lottery-draw-results.esm.js +0 -1
  37. package/dist/lottery-draw-results/p-0eb80b2e.js +0 -1
  38. package/dist/lottery-draw-results/p-ca18f246.entry.js +0 -1
  39. package/dist/stencil.config.js +0 -22
  40. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/lottery-draw-results/.stencil/packages/lottery-draw-results/stencil.config.d.ts +0 -2
  41. package/dist/types/components/lottery-draw-results/lottery-draw-results.d.ts +0 -97
  42. package/dist/types/components.d.ts +0 -181
  43. package/dist/types/index.d.ts +0 -1
  44. package/dist/types/stencil-public-runtime.d.ts +0 -1565
  45. package/dist/types/utils/locale.utils.d.ts +0 -1
  46. package/dist/types/utils/utils.d.ts +0 -1
  47. package/loader/cdn.js +0 -3
  48. package/loader/index.cjs.js +0 -3
  49. package/loader/index.d.ts +0 -12
  50. package/loader/index.es2017.js +0 -3
  51. package/loader/index.js +0 -4
  52. package/loader/package.json +0 -10
@@ -1,622 +0,0 @@
1
- import { Component, Prop, h, State } from '@stencil/core';
2
- import { translate } from '../../utils/locale.utils';
3
- import '@everymatrix/lottery-grid';
4
- export class LotteryDrawResults {
5
- constructor() {
6
- /**
7
- * Language of the widget
8
- */
9
- this.language = 'en';
10
- /**
11
- * Shows only the last draw
12
- */
13
- this.drawMode = false;
14
- /**
15
- * The drawID (option)
16
- */
17
- this.drawId = '';
18
- /**
19
- * The game name
20
- */
21
- 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
- /**
47
- * The ticket winning numbers
48
- */
49
- this.ticketNumbers = '';
50
- /**
51
- * The session id
52
- */
53
- this.sessionId = '';
54
- /**
55
- * Client custom styling via string
56
- */
57
- this.clientStyling = '';
58
- /**
59
- * Client custom styling via url content
60
- */
61
- this.clientStylingUrlContent = '';
62
- /**
63
- * Data showing the ticket's draw results details
64
- */
65
- this.ticketDrawData = '';
66
- this.multiplier = 3;
67
- this.isLoading = true;
68
- this.hasErrors = false;
69
- this.errorText = '';
70
- this.ticketData = [];
71
- this.ticketDataLoaded = false;
72
- this.ticketDraws = [];
73
- this.toggleDrawer = [false];
74
- this.limitStylingAppends = false;
75
- this.ticketDrawDetails = [];
76
- this.ticketDrawDetailsFlag = true;
77
- this.setClientStyling = () => {
78
- let sheet = document.createElement('style');
79
- sheet.innerHTML = this.clientStyling;
80
- this.stylingContainer.prepend(sheet);
81
- };
82
- this.setClientStylingURL = () => {
83
- let cssFile = document.createElement('style');
84
- setTimeout(() => {
85
- cssFile.innerHTML = this.clientStylingUrlContent;
86
- this.stylingContainer.prepend(cssFile);
87
- }, 1);
88
- };
89
- }
90
- connectedCallback() {
91
- let promises = [];
92
- // Split ticket numbers for each grid
93
- if (this.ticketNumbers) {
94
- this.gridNumbers = JSON.parse(this.ticketNumbers);
95
- }
96
- if (this.drawId) {
97
- promises.push(this.getDrawData());
98
- }
99
- Promise.all(promises)
100
- .then(() => {
101
- this.isLoading = false;
102
- }).catch((err) => {
103
- console.log('error ', err);
104
- this.isLoading = false;
105
- });
106
- }
107
- componentWillRender() {
108
- if (this.ticketDrawData && this.ticketDrawDetailsFlag) {
109
- this.ticketDrawDetails = JSON.parse(this.ticketDrawData);
110
- this.ticketDrawDetails.forEach((drawDetail) => {
111
- this.getDrawData(drawDetail.drawId).then((drawData) => drawDetail.drawData = drawData);
112
- });
113
- this.ticketDrawDetailsFlag = false;
114
- }
115
- }
116
- componentDidRender() {
117
- // start custom styling area
118
- if (!this.limitStylingAppends && this.stylingContainer) {
119
- if (this.clientStyling)
120
- this.setClientStyling();
121
- if (this.clientStylingUrlContent)
122
- this.setClientStylingURL();
123
- this.limitStylingAppends = true;
124
- }
125
- // end custom styling area
126
- }
127
- getDrawData(drawId) {
128
- this.isLoading = true;
129
- return new Promise((resolve, reject) => {
130
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${drawId ? drawId : this.drawId}`);
131
- fetch(url.href)
132
- .then((response) => {
133
- // @TODO EXCEPTIONS
134
- return response.json();
135
- })
136
- .then((data) => {
137
- if (drawId) {
138
- resolve(data);
139
- }
140
- else {
141
- this.drawData = data;
142
- resolve(true);
143
- }
144
- this.isLoading = false;
145
- })
146
- .catch((err) => {
147
- reject(err);
148
- this.isLoading = false;
149
- });
150
- });
151
- }
152
- drawerToggle(index) {
153
- this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
154
- if (itemIndex == index) {
155
- return !item;
156
- }
157
- return item;
158
- });
159
- if (index >= this.toggleDrawer.length) {
160
- this.toggleDrawer.push(true);
161
- }
162
- }
163
- render() {
164
- if (this.isLoading) {
165
- return (h("p", null, "Loading, please wait ..."));
166
- }
167
- else if (this.hasErrors) {
168
- h("p", null, this.errorText);
169
- }
170
- else {
171
- return (h("section", { class: "DrawResultsSection", ref: el => this.stylingContainer = el }, this.drawMode ?
172
- h("div", { class: "DrawResultsArea" }, this.drawData &&
173
- h("div", null,
174
- h("div", { class: "DrawResultsHeader" },
175
- h("span", null,
176
- translate('drawId', this.language),
177
- ": ",
178
- this.drawData.id),
179
- h("span", null,
180
- translate('drawDate', this.language),
181
- ": ",
182
- this.drawData.date.slice(0, 10))),
183
- h("div", { class: "DrawResultsBody" },
184
- h("div", { class: "DrawNumbersGrid" },
185
- h("p", null,
186
- translate('drawNumbersGridDraw', this.language),
187
- "0:"),
188
- h("div", { class: "BulletContainer" },
189
- h("lottery-grid", { "selected-numbers": this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })),
190
- h("div", { class: "DrawMultipler" },
191
- h("label", { class: "Label" },
192
- translate('multiplier', this.language),
193
- " ",
194
- this.multiplier))))))
195
- :
196
- h("div", { class: "DrawResultsArea TicketDraws" },
197
- h("div", { class: "DrawResultsBody" },
198
- h("div", { class: "TicketIdContainer" },
199
- h("label", { class: "Label" },
200
- translate('ticketId', this.language),
201
- ": ",
202
- h("span", null, this.ticketId))),
203
- h("div", { class: "TicketAmountContainer" },
204
- h("label", { class: "Label" },
205
- translate('ticketAmount', this.language),
206
- " ",
207
- h("span", null, this.ticketAmount))),
208
- h("div", { class: "DrawNumbersGrid" }, this.gridNumbers.map((grid, index) => h("div", null,
209
- h("label", { class: "Label" },
210
- translate('drawNumbersGridTicket', this.language),
211
- " ",
212
- String.fromCharCode(index + 65),
213
- ":"),
214
- h("div", { class: "BulletContainer" },
215
- h("lottery-grid", { "selected-numbers": grid.join(','), selectable: false, "display-selected": true, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))),
216
- h("div", { class: "DrawMultipler" },
217
- h("label", { class: "Label" },
218
- translate('multiplier', this.language),
219
- " ",
220
- JSON.stringify(this.ticketMultiplier))),
221
- h("div", { class: "NumberOfDrawsContainer" },
222
- h("label", { class: "Label" },
223
- translate('numberOfDraws', this.language),
224
- ": ",
225
- this.ticketDrawCount),
226
- h("div", { class: "DrawTicketsContainer" }, this.ticketDrawDetails && this.ticketDrawDetails.length > 0 &&
227
- h("div", { class: "ExpandableBoxes" }, this.ticketDrawDetails.map((drawDetail, index) => {
228
- var _a, _b, _c, _d, _e;
229
- return h("div", { class: { 'ExpandableBox': true, 'ShowBox': this.toggleDrawer[index] }, onClick: () => this.drawerToggle(index) },
230
- h("div", { class: "ExpandableBoxHeader" },
231
- h("div", { class: "TicketResultContainer" },
232
- h("p", null,
233
- translate('ticketResult', this.language),
234
- ": ",
235
- drawDetail.state)),
236
- drawDetail.state == 'won' &&
237
- h("div", { class: "AmountWonContainer" },
238
- h("p", null,
239
- translate('amountWon', this.language),
240
- ": ",
241
- Number(drawDetail.amount).toLocaleString('en'),
242
- " ",
243
- drawDetail.currency)),
244
- drawDetail.state == 'lost' &&
245
- h("div", { class: "DrawIdContainer" },
246
- h("p", null,
247
- translate('drawId', this.language),
248
- ": ",
249
- drawDetail.drawId))),
250
- h("div", { class: "ExpandableBoxBody" },
251
- h("div", { class: "DrawIdContainer" },
252
- h("p", null,
253
- translate('drawId', this.language),
254
- ": ",
255
- drawDetail.drawId)),
256
- h("div", { class: "DrawDateContainer" },
257
- h("p", null,
258
- translate('drawDate', this.language),
259
- ": ", (_a = drawDetail.drawData) === null || _a === void 0 ? void 0 :
260
- _a.date.slice(0, 10),
261
- " | ", (_b = drawDetail.drawData) === null || _b === void 0 ? void 0 :
262
- _b.date.slice(11, 19))),
263
- h("div", { class: "DrawNumbersGrid" }, drawDetail.drawData &&
264
- h("div", { class: 'BulletContainer' },
265
- h("label", { class: "Label" },
266
- translate('drawNumbersGridDraw', this.language),
267
- " ",
268
- String.fromCharCode(index + 10),
269
- ":"),
270
- h("lottery-grid", { "selected-numbers": (_d = (_c = drawDetail.drawData) === null || _c === void 0 ? void 0 : _c.winningNumbers) === null || _d === void 0 ? void 0 : _d.join(','), selectable: false, "display-selected": true, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))),
271
- h("div", { class: "DrawMultipler" },
272
- h("label", { class: "Label" },
273
- translate('multiplier', this.language),
274
- " ", (_e = drawDetail.drawData) === null || _e === void 0 ? void 0 :
275
- _e.multiplier))));
276
- }))))))));
277
- }
278
- }
279
- static get is() { return "lottery-draw-results"; }
280
- static get encapsulation() { return "shadow"; }
281
- static get originalStyleUrls() { return {
282
- "$": ["lottery-draw-results.scss"]
283
- }; }
284
- static get styleUrls() { return {
285
- "$": ["lottery-draw-results.css"]
286
- }; }
287
- static get properties() { return {
288
- "endpoint": {
289
- "type": "string",
290
- "mutable": false,
291
- "complexType": {
292
- "original": "string",
293
- "resolved": "string",
294
- "references": {}
295
- },
296
- "required": false,
297
- "optional": false,
298
- "docs": {
299
- "tags": [],
300
- "text": "Endpoint URL for the source of data"
301
- },
302
- "attribute": "endpoint",
303
- "reflect": true
304
- },
305
- "gameId": {
306
- "type": "string",
307
- "mutable": false,
308
- "complexType": {
309
- "original": "string",
310
- "resolved": "string",
311
- "references": {}
312
- },
313
- "required": false,
314
- "optional": false,
315
- "docs": {
316
- "tags": [],
317
- "text": "GameID of the lottery game"
318
- },
319
- "attribute": "game-id",
320
- "reflect": true
321
- },
322
- "language": {
323
- "type": "string",
324
- "mutable": false,
325
- "complexType": {
326
- "original": "string",
327
- "resolved": "string",
328
- "references": {}
329
- },
330
- "required": false,
331
- "optional": false,
332
- "docs": {
333
- "tags": [],
334
- "text": "Language of the widget"
335
- },
336
- "attribute": "language",
337
- "reflect": true,
338
- "defaultValue": "'en'"
339
- },
340
- "playerId": {
341
- "type": "string",
342
- "mutable": false,
343
- "complexType": {
344
- "original": "string",
345
- "resolved": "string",
346
- "references": {}
347
- },
348
- "required": false,
349
- "optional": false,
350
- "docs": {
351
- "tags": [],
352
- "text": "Player ID"
353
- },
354
- "attribute": "player-id",
355
- "reflect": true
356
- },
357
- "drawMode": {
358
- "type": "boolean",
359
- "mutable": false,
360
- "complexType": {
361
- "original": "boolean",
362
- "resolved": "boolean",
363
- "references": {}
364
- },
365
- "required": false,
366
- "optional": false,
367
- "docs": {
368
- "tags": [],
369
- "text": "Shows only the last draw"
370
- },
371
- "attribute": "draw-mode",
372
- "reflect": true,
373
- "defaultValue": "false"
374
- },
375
- "drawId": {
376
- "type": "string",
377
- "mutable": false,
378
- "complexType": {
379
- "original": "string",
380
- "resolved": "string",
381
- "references": {}
382
- },
383
- "required": false,
384
- "optional": false,
385
- "docs": {
386
- "tags": [],
387
- "text": "The drawID (option)"
388
- },
389
- "attribute": "draw-id",
390
- "reflect": true,
391
- "defaultValue": "''"
392
- },
393
- "gameName": {
394
- "type": "string",
395
- "mutable": false,
396
- "complexType": {
397
- "original": "string",
398
- "resolved": "string",
399
- "references": {}
400
- },
401
- "required": false,
402
- "optional": false,
403
- "docs": {
404
- "tags": [],
405
- "text": "The game name"
406
- },
407
- "attribute": "game-name",
408
- "reflect": true,
409
- "defaultValue": "''"
410
- },
411
- "ticketDate": {
412
- "type": "string",
413
- "mutable": false,
414
- "complexType": {
415
- "original": "string",
416
- "resolved": "string",
417
- "references": {}
418
- },
419
- "required": false,
420
- "optional": false,
421
- "docs": {
422
- "tags": [],
423
- "text": "The ticket submission date"
424
- },
425
- "attribute": "ticket-date",
426
- "reflect": true,
427
- "defaultValue": "''"
428
- },
429
- "ticketStatus": {
430
- "type": "string",
431
- "mutable": false,
432
- "complexType": {
433
- "original": "string",
434
- "resolved": "string",
435
- "references": {}
436
- },
437
- "required": false,
438
- "optional": false,
439
- "docs": {
440
- "tags": [],
441
- "text": "The ticket status"
442
- },
443
- "attribute": "ticket-status",
444
- "reflect": true,
445
- "defaultValue": "''"
446
- },
447
- "ticketId": {
448
- "type": "string",
449
- "mutable": false,
450
- "complexType": {
451
- "original": "string",
452
- "resolved": "string",
453
- "references": {}
454
- },
455
- "required": false,
456
- "optional": false,
457
- "docs": {
458
- "tags": [],
459
- "text": "The ticket id"
460
- },
461
- "attribute": "ticket-id",
462
- "reflect": true,
463
- "defaultValue": "''"
464
- },
465
- "ticketAmount": {
466
- "type": "string",
467
- "mutable": false,
468
- "complexType": {
469
- "original": "string",
470
- "resolved": "string",
471
- "references": {}
472
- },
473
- "required": false,
474
- "optional": false,
475
- "docs": {
476
- "tags": [],
477
- "text": "The ticket amount"
478
- },
479
- "attribute": "ticket-amount",
480
- "reflect": true,
481
- "defaultValue": "''"
482
- },
483
- "ticketMultiplier": {
484
- "type": "boolean",
485
- "mutable": false,
486
- "complexType": {
487
- "original": "boolean",
488
- "resolved": "boolean",
489
- "references": {}
490
- },
491
- "required": false,
492
- "optional": false,
493
- "docs": {
494
- "tags": [],
495
- "text": "The ticket multiplier"
496
- },
497
- "attribute": "ticket-multiplier",
498
- "reflect": true,
499
- "defaultValue": "false"
500
- },
501
- "ticketDrawCount": {
502
- "type": "number",
503
- "mutable": false,
504
- "complexType": {
505
- "original": "number",
506
- "resolved": "number",
507
- "references": {}
508
- },
509
- "required": false,
510
- "optional": false,
511
- "docs": {
512
- "tags": [],
513
- "text": "The ticket draw count"
514
- },
515
- "attribute": "ticket-draw-count",
516
- "reflect": true,
517
- "defaultValue": "0"
518
- },
519
- "ticketNumbers": {
520
- "type": "string",
521
- "mutable": false,
522
- "complexType": {
523
- "original": "string",
524
- "resolved": "string",
525
- "references": {}
526
- },
527
- "required": false,
528
- "optional": false,
529
- "docs": {
530
- "tags": [],
531
- "text": "The ticket winning numbers"
532
- },
533
- "attribute": "ticket-numbers",
534
- "reflect": true,
535
- "defaultValue": "''"
536
- },
537
- "sessionId": {
538
- "type": "string",
539
- "mutable": false,
540
- "complexType": {
541
- "original": "string",
542
- "resolved": "string",
543
- "references": {}
544
- },
545
- "required": false,
546
- "optional": false,
547
- "docs": {
548
- "tags": [],
549
- "text": "The session id"
550
- },
551
- "attribute": "session-id",
552
- "reflect": true,
553
- "defaultValue": "''"
554
- },
555
- "clientStyling": {
556
- "type": "string",
557
- "mutable": false,
558
- "complexType": {
559
- "original": "string",
560
- "resolved": "string",
561
- "references": {}
562
- },
563
- "required": false,
564
- "optional": false,
565
- "docs": {
566
- "tags": [],
567
- "text": "Client custom styling via string"
568
- },
569
- "attribute": "client-styling",
570
- "reflect": true,
571
- "defaultValue": "''"
572
- },
573
- "clientStylingUrlContent": {
574
- "type": "string",
575
- "mutable": false,
576
- "complexType": {
577
- "original": "string",
578
- "resolved": "string",
579
- "references": {}
580
- },
581
- "required": false,
582
- "optional": false,
583
- "docs": {
584
- "tags": [],
585
- "text": "Client custom styling via url content"
586
- },
587
- "attribute": "client-styling-url-content",
588
- "reflect": true,
589
- "defaultValue": "''"
590
- },
591
- "ticketDrawData": {
592
- "type": "string",
593
- "mutable": false,
594
- "complexType": {
595
- "original": "string",
596
- "resolved": "string",
597
- "references": {}
598
- },
599
- "required": false,
600
- "optional": false,
601
- "docs": {
602
- "tags": [],
603
- "text": "Data showing the ticket's draw results details"
604
- },
605
- "attribute": "ticket-draw-data",
606
- "reflect": true,
607
- "defaultValue": "''"
608
- }
609
- }; }
610
- static get states() { return {
611
- "multiplier": {},
612
- "isLoading": {},
613
- "hasErrors": {},
614
- "errorText": {},
615
- "ticketData": {},
616
- "ticketDataLoaded": {},
617
- "ticketDraws": {},
618
- "toggleDrawer": {},
619
- "limitStylingAppends": {},
620
- "drawData": {}
621
- }; }
622
- }
@@ -1 +0,0 @@
1
- export * from './components';