@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,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-40e6760b.js');
6
-
7
- /*
8
- Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
9
- */
10
- const patchEsm = () => {
11
- return index.promiseResolve();
12
- };
13
-
14
- const defineCustomElements = (win, options) => {
15
- if (typeof window === 'undefined') return Promise.resolve();
16
- return patchEsm().then(() => {
17
- return index.bootstrapLazy([["lottery-bullet_3.cjs",[[1,"lottery-draw-results",{"endpoint":[513],"gameId":[513,"game-id"],"language":[513],"playerId":[513,"player-id"],"drawMode":[516,"draw-mode"],"drawId":[513,"draw-id"],"gameName":[513,"game-name"],"ticketDate":[513,"ticket-date"],"ticketStatus":[513,"ticket-status"],"ticketId":[513,"ticket-id"],"ticketAmount":[513,"ticket-amount"],"ticketMultiplier":[516,"ticket-multiplier"],"ticketDrawCount":[514,"ticket-draw-count"],"ticketNumbers":[513,"ticket-numbers"],"sessionId":[513,"session-id"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"ticketDrawData":[513,"ticket-draw-data"],"multiplier":[32],"isLoading":[32],"hasErrors":[32],"errorText":[32],"ticketData":[32],"ticketDataLoaded":[32],"ticketDraws":[32],"toggleDrawer":[32],"limitStylingAppends":[32],"drawData":[32]}],[1,"lottery-grid",{"ticketId":[514,"ticket-id"],"totalNumbers":[514,"total-numbers"],"gameId":[513,"game-id"],"maximumAllowed":[514,"maximum-allowed"],"minimumAllowed":[514,"minimum-allowed"],"selectable":[516],"selectedNumbers":[513,"selected-numbers"],"displaySelected":[516,"display-selected"],"language":[513],"gridIndex":[514,"grid-index"],"gridType":[513,"grid-type"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[513],"selectable":[516],"isSelected":[516,"is-selected"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
18
- });
19
- };
20
-
21
- exports.defineCustomElements = defineCustomElements;
@@ -1,564 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-40e6760b.js');
6
-
7
- const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, white 0%, white 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, white 0%, #f1f1f1 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;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{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;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 #D4D4D4;cursor:default}";
8
-
9
- const LotteryBullet = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.bulletEvent = index.createEvent(this, "lotteryBulletSelection", 7);
13
- /**
14
- * Value of the bullet
15
- */
16
- this.value = '0';
17
- /**
18
- * Marks if the bullet should be selectable
19
- */
20
- this.selectable = true;
21
- /**
22
- * Marks if the bullet should be selected
23
- */
24
- this.isSelected = false;
25
- /**
26
- * Client custom styling via string
27
- */
28
- this.clientStyling = '';
29
- /**
30
- * Client custom styling via url content
31
- */
32
- this.clientStylingUrlContent = '';
33
- this.limitStylingAppends = false;
34
- this.select = () => {
35
- if (this.selectable) {
36
- this.isSelected = !this.isSelected;
37
- this.bulletEvent.emit({
38
- value: this.value,
39
- selected: this.isSelected
40
- });
41
- }
42
- };
43
- this.setClientStyling = () => {
44
- let sheet = document.createElement('style');
45
- sheet.innerHTML = this.clientStyling;
46
- this.stylingContainer.prepend(sheet);
47
- };
48
- this.setClientStylingURL = () => {
49
- let cssFile = document.createElement('style');
50
- setTimeout(() => {
51
- cssFile.innerHTML = this.clientStylingUrlContent;
52
- this.stylingContainer.prepend(cssFile);
53
- }, 1);
54
- };
55
- }
56
- componentDidRender() {
57
- // start custom styling area
58
- if (!this.limitStylingAppends && this.stylingContainer) {
59
- if (this.clientStyling)
60
- this.setClientStyling();
61
- if (this.clientStylingUrlContent)
62
- this.setClientStylingURL();
63
- this.limitStylingAppends = true;
64
- }
65
- // end custom styling area
66
- }
67
- render() {
68
- return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
69
- }
70
- };
71
- LotteryBullet.style = lotteryBulletCss;
72
-
73
- const DEFAULT_LANGUAGE = 'en';
74
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'hr'];
75
- const TRANSLATIONS = {
76
- en: {
77
- drawResultsHeader: 'Last draw results',
78
- drawId: 'Draw ID',
79
- drawName: 'Game name',
80
- drawDate: 'Draw Date',
81
- drawNumbersGridDraw: 'Draw numbers Grid ',
82
- drawNumbersGridTicket: 'Draw numbers Grid ',
83
- ticketResult: 'Ticket result',
84
- amountWon: 'Amount won',
85
- numberOfDraws: 'Number of draws',
86
- multiplier: 'Multiplier:',
87
- ticketPurchaseDate: 'Ticket Purchase Date',
88
- ticketStatus: 'Ticket Status',
89
- ticketId: 'Ticket ID',
90
- ticketAmount: 'Ticket Amount',
91
- winUpTo: 'Win up to',
92
- },
93
- ro: {
94
- drawResultsHeader: 'Ultimele rezultate extragere',
95
- drawId: 'Id extragere',
96
- drawName: 'Numele jocului',
97
- drawDate: 'Data extragerii',
98
- drawNumbersGridDraw: 'Numerele extrase Grid',
99
- drawNumbersGridTicket: 'Numerele extrase Grid',
100
- ticketResult: 'Rezultatul biletului',
101
- amountWon: 'Suma castigata',
102
- numberOfDraws: 'Numarul de extrageri',
103
- multiplier: 'Multiplicator:',
104
- ticketPurchaseDate: 'Data achizitionarii biletului',
105
- ticketStatus: 'Statusul biletului',
106
- ticketId: 'Id biletul',
107
- ticketAmount: 'Valoarea biletului',
108
- winUpTo: 'Poti castiga'
109
- },
110
- fr: {
111
- drawResultsHeader: 'Résultats du dernier tirage',
112
- drawId: 'ID de tirage',
113
- drawName: 'Nom du jeu',
114
- drawDate: 'Date du tirage',
115
- drawNumbersGridDraw: 'Tirage des numéros Grille',
116
- drawNumbersGridTicket: 'Tirage des numéros Grille',
117
- ticketResult: 'Résultat du ticket',
118
- amountWon: 'Montant gagné',
119
- numberOfDraws: 'Nombre de tirages',
120
- multiplier: 'Multiplicateur',
121
- ticketPurchaseDate: 'Date d\'achat du billet',
122
- ticketStatus: 'Statut du ticket',
123
- ticketId: 'ID de billets',
124
- ticketAmount: 'Montant du billet',
125
- winUpTo: 'Gagnez jusqu\'à'
126
- },
127
- ar: {
128
- drawResultsHeader: 'نتائج آخر سحب',
129
- drawId: 'معرّف السحب',
130
- drawName: 'اسم اللعبة',
131
- drawDate: 'تاريخ السحب',
132
- drawNumbersGridDraw: 'شبكة أرقام السحب',
133
- drawNumbersGridTicket: 'شبكة أرقام السحب',
134
- ticketResult: 'نتيجة التذكرة',
135
- amountWon: 'المبلغ الذي تم ربحه',
136
- numberOfDraws: 'عدد السحوبات',
137
- multiplier: 'مضاعف',
138
- ticketPurchaseDate: 'تاريخ شراء التذكرة',
139
- ticketStatus: 'حالة التذكرة',
140
- ticketId: 'معرّف التذكرة',
141
- ticketAmount: 'مبلغ التذكرة',
142
- winUpTo: 'ربح يصل إلى'
143
- },
144
- hr: {
145
- drawResultsHeader: 'Rezultati posljednjeg izvlačenja',
146
- drawId: 'ID izvlačenja',
147
- drawName: 'Naziv igre',
148
- drawDate: 'Datum izvlačenja',
149
- drawNumbersGridDraw: 'Tablica izvučenih brojeva',
150
- drawNumbersGridTicket: 'Tablica izvučenih brojeva',
151
- ticketResult: 'Rezultat listića',
152
- amountWon: 'Osvojeni iznos',
153
- numberOfDraws: 'Broj izvlačenja',
154
- multiplier: 'Multiplikator',
155
- ticketPurchaseDate: 'Datum uplate listića',
156
- ticketStatus: 'Status listića',
157
- ticketId: 'ID listića',
158
- ticketAmount: 'Iznos listića',
159
- winUpTo: 'Osvoji do'
160
- },
161
- };
162
- const translate = (key, customLang) => {
163
- const lang = customLang;
164
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
165
- };
166
-
167
- 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}.DrawResultsArea.TicketDraws .Content{padding:0;border:0}.DrawResultsArea.TicketDraws .DrawResultsBody{padding:0;margin-bottom:5px;border-radius:0;border:0}.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}.DrawResultsBody{padding:20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody>div{margin:10px 0}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.DrawNumbersGrid{display:flex;flex-direction:column;gap:5px}.DrawNumbersGrid label{display:block;margin-bottom:7px}.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{position:relative}.DrawTicketsContainer{display:flex;flex-direction:column;margin:20px auto 0}.DrawMultipler{margin-top:15px}.ExpandableBoxes{position:relative;display:flex;flex-direction:column;border:1px solid #ccc;border-radius:5px;background-color:white}.ExpandableBox{border-bottom:1px solid #ccc;transition:height 300ms ease-in-out;overflow:hidden;height:80px}.ExpandableBox:last-child{border-bottom:0}.ExpandableBoxHeader{position:relative;list-style:none;outline:0;cursor:pointer;text-transform:uppercase;transition:color 300ms ease-in-out;margin-bottom:24px;margin-left:5px}.ShowBox>.ExpandableBoxHeader{color:#009993}.ExpandableBoxHeader::-webkit-details-marker{display:none}.ExpandableBoxHeader:before,.ExpandableBoxHeader:after{content:\"\";position:absolute}.ExpandableBoxHeader:before{right:21px;top:50%;height:2px;margin-top:-1px;width:16px;background:#009993}.ExpandableBoxHeader:after{right:28px;top:50%;height:16px;margin-top:-8px;width:2px;margin-left:-1px;background:#009993;transition:all 300ms ease-in-out}.ShowBox .ExpandableBoxHeader:after{opacity:0;transform:translateY(25%)}.ExpandableBoxBody{padding-top:0;font-weight:lighter;margin-left:5px}.ExpandableBox.ShowBox{height:300px}";
168
-
169
- const LotteryDrawResults = class {
170
- constructor(hostRef) {
171
- index.registerInstance(this, hostRef);
172
- /**
173
- * Language of the widget
174
- */
175
- this.language = 'en';
176
- /**
177
- * Shows only the last draw
178
- */
179
- this.drawMode = false;
180
- /**
181
- * The drawID (option)
182
- */
183
- this.drawId = '';
184
- /**
185
- * The game name
186
- */
187
- this.gameName = '';
188
- /**
189
- * The ticket submission date
190
- */
191
- this.ticketDate = '';
192
- /**
193
- * The ticket status
194
- */
195
- this.ticketStatus = '';
196
- /**
197
- * The ticket id
198
- */
199
- this.ticketId = '';
200
- /**
201
- * The ticket amount
202
- */
203
- this.ticketAmount = '';
204
- /**
205
- * The ticket multiplier
206
- */
207
- this.ticketMultiplier = false;
208
- /**
209
- * The ticket draw count
210
- */
211
- this.ticketDrawCount = 0;
212
- /**
213
- * The ticket winning numbers
214
- */
215
- this.ticketNumbers = '';
216
- /**
217
- * The session id
218
- */
219
- this.sessionId = '';
220
- /**
221
- * Client custom styling via string
222
- */
223
- this.clientStyling = '';
224
- /**
225
- * Client custom styling via url content
226
- */
227
- this.clientStylingUrlContent = '';
228
- /**
229
- * Data showing the ticket's draw results details
230
- */
231
- this.ticketDrawData = '';
232
- this.multiplier = 3;
233
- this.isLoading = true;
234
- this.hasErrors = false;
235
- this.errorText = '';
236
- this.ticketData = [];
237
- this.ticketDataLoaded = false;
238
- this.ticketDraws = [];
239
- this.toggleDrawer = [false];
240
- this.limitStylingAppends = false;
241
- this.ticketDrawDetails = [];
242
- this.ticketDrawDetailsFlag = true;
243
- this.setClientStyling = () => {
244
- let sheet = document.createElement('style');
245
- sheet.innerHTML = this.clientStyling;
246
- this.stylingContainer.prepend(sheet);
247
- };
248
- this.setClientStylingURL = () => {
249
- let cssFile = document.createElement('style');
250
- setTimeout(() => {
251
- cssFile.innerHTML = this.clientStylingUrlContent;
252
- this.stylingContainer.prepend(cssFile);
253
- }, 1);
254
- };
255
- }
256
- connectedCallback() {
257
- let promises = [];
258
- // Split ticket numbers for each grid
259
- if (this.ticketNumbers) {
260
- this.gridNumbers = JSON.parse(this.ticketNumbers);
261
- }
262
- if (this.drawId) {
263
- promises.push(this.getDrawData());
264
- }
265
- Promise.all(promises)
266
- .then(() => {
267
- this.isLoading = false;
268
- }).catch((err) => {
269
- console.log('error ', err);
270
- this.isLoading = false;
271
- });
272
- }
273
- componentWillRender() {
274
- if (this.ticketDrawData && this.ticketDrawDetailsFlag) {
275
- this.ticketDrawDetails = JSON.parse(this.ticketDrawData);
276
- this.ticketDrawDetails.forEach((drawDetail) => {
277
- this.getDrawData(drawDetail.drawId).then((drawData) => drawDetail.drawData = drawData);
278
- });
279
- this.ticketDrawDetailsFlag = false;
280
- }
281
- }
282
- componentDidRender() {
283
- // start custom styling area
284
- if (!this.limitStylingAppends && this.stylingContainer) {
285
- if (this.clientStyling)
286
- this.setClientStyling();
287
- if (this.clientStylingUrlContent)
288
- this.setClientStylingURL();
289
- this.limitStylingAppends = true;
290
- }
291
- // end custom styling area
292
- }
293
- getDrawData(drawId) {
294
- this.isLoading = true;
295
- return new Promise((resolve, reject) => {
296
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${drawId ? drawId : this.drawId}`);
297
- fetch(url.href)
298
- .then((response) => {
299
- // @TODO EXCEPTIONS
300
- return response.json();
301
- })
302
- .then((data) => {
303
- if (drawId) {
304
- resolve(data);
305
- }
306
- else {
307
- this.drawData = data;
308
- resolve(true);
309
- }
310
- this.isLoading = false;
311
- })
312
- .catch((err) => {
313
- reject(err);
314
- this.isLoading = false;
315
- });
316
- });
317
- }
318
- drawerToggle(index) {
319
- this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
320
- if (itemIndex == index) {
321
- return !item;
322
- }
323
- return item;
324
- });
325
- if (index >= this.toggleDrawer.length) {
326
- this.toggleDrawer.push(true);
327
- }
328
- }
329
- render() {
330
- if (this.isLoading) {
331
- return (index.h("p", null, "Loading, please wait ..."));
332
- }
333
- else if (this.hasErrors) {
334
- index.h("p", null, this.errorText);
335
- }
336
- else {
337
- return (index.h("section", { class: "DrawResultsSection", ref: el => this.stylingContainer = el }, this.drawMode ?
338
- index.h("div", { class: "DrawResultsArea" }, this.drawData &&
339
- index.h("div", null, index.h("div", { class: "DrawResultsHeader" }, index.h("span", null, translate('drawId', this.language), ": ", this.drawData.id), index.h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "DrawNumbersGrid" }, index.h("p", null, translate('drawNumbersGridDraw', this.language), "0:"), index.h("div", { class: "BulletContainer" }, index.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 })), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))
340
- :
341
- index.h("div", { class: "DrawResultsArea TicketDraws" }, index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "TicketIdContainer" }, index.h("label", { class: "Label" }, translate('ticketId', this.language), ": ", index.h("span", null, this.ticketId))), index.h("div", { class: "TicketAmountContainer" }, index.h("label", { class: "Label" }, translate('ticketAmount', this.language), " ", index.h("span", null, this.ticketAmount))), index.h("div", { class: "DrawNumbersGrid" }, this.gridNumbers.map((grid, index$1) => index.h("div", null, index.h("label", { class: "Label" }, translate('drawNumbersGridTicket', this.language), " ", String.fromCharCode(index$1 + 65), ":"), index.h("div", { class: "BulletContainer" }, index.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 }))))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", JSON.stringify(this.ticketMultiplier))), index.h("div", { class: "NumberOfDrawsContainer" }, index.h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), index.h("div", { class: "DrawTicketsContainer" }, this.ticketDrawDetails && this.ticketDrawDetails.length > 0 &&
342
- index.h("div", { class: "ExpandableBoxes" }, this.ticketDrawDetails.map((drawDetail, index$1) => {
343
- var _a, _b, _c, _d, _e;
344
- return index.h("div", { class: { 'ExpandableBox': true, 'ShowBox': this.toggleDrawer[index$1] }, onClick: () => this.drawerToggle(index$1) }, index.h("div", { class: "ExpandableBoxHeader" }, index.h("div", { class: "TicketResultContainer" }, index.h("p", null, translate('ticketResult', this.language), ": ", drawDetail.state)), drawDetail.state == 'won' &&
345
- index.h("div", { class: "AmountWonContainer" }, index.h("p", null, translate('amountWon', this.language), ": ", Number(drawDetail.amount).toLocaleString('en'), " ", drawDetail.currency)), drawDetail.state == 'lost' &&
346
- index.h("div", { class: "DrawIdContainer" }, index.h("p", null, translate('drawId', this.language), ": ", drawDetail.drawId))), index.h("div", { class: "ExpandableBoxBody" }, index.h("div", { class: "DrawIdContainer" }, index.h("p", null, translate('drawId', this.language), ": ", drawDetail.drawId)), index.h("div", { class: "DrawDateContainer" }, index.h("p", null, translate('drawDate', this.language), ": ", (_a = drawDetail.drawData) === null || _a === void 0 ? void 0 :
347
- _a.date.slice(0, 10), " | ", (_b = drawDetail.drawData) === null || _b === void 0 ? void 0 :
348
- _b.date.slice(11, 19))), index.h("div", { class: "DrawNumbersGrid" }, drawDetail.drawData &&
349
- index.h("div", { class: 'BulletContainer' }, index.h("label", { class: "Label" }, translate('drawNumbersGridDraw', this.language), " ", String.fromCharCode(index$1 + 10), ":"), index.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 }))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", (_e = drawDetail.drawData) === null || _e === void 0 ? void 0 :
350
- _e.multiplier))));
351
- }))))))));
352
- }
353
- }
354
- };
355
- LotteryDrawResults.style = lotteryDrawResultsCss;
356
-
357
- const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.Grid.TicketGrid{gap:5px}";
358
-
359
- const LotteryGrid = class {
360
- constructor(hostRef) {
361
- index.registerInstance(this, hostRef);
362
- this.gridFilledEvent = index.createEvent(this, "gridFilled", 7);
363
- this.gridDirtyEvent = index.createEvent(this, "gridDirty", 7);
364
- /**
365
- * Number of bullets of grid
366
- */
367
- this.totalNumbers = 0;
368
- /**
369
- * Number of maximum bullets that can be selected
370
- */
371
- this.maximumAllowed = 0;
372
- /**
373
- * Minimum allowed of bullets
374
- */
375
- this.minimumAllowed = 1;
376
- /**
377
- * Allows the user to select numbers on the grid
378
- */
379
- this.selectable = true;
380
- /**
381
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
382
- */
383
- this.selectedNumbers = '';
384
- /**
385
- * Show only selected numbers
386
- */
387
- this.displaySelected = false;
388
- /**
389
- * Language
390
- */
391
- this.language = 'en';
392
- /**
393
- * Personalize grid for ticket
394
- */
395
- this.gridType = '';
396
- /**
397
- * Client custom styling via string
398
- */
399
- this.clientStyling = '';
400
- /**
401
- * Client custom styling via url content
402
- */
403
- this.clientStylingUrlContent = '';
404
- this.numbers = [];
405
- this.limitStylingAppends = false;
406
- this.selectedCounter = 0;
407
- this.setClientStyling = () => {
408
- let sheet = document.createElement('style');
409
- sheet.innerHTML = this.clientStyling;
410
- this.stylingContainer.prepend(sheet);
411
- };
412
- this.setClientStylingURL = () => {
413
- let cssFile = document.createElement('style');
414
- setTimeout(() => {
415
- cssFile.innerHTML = this.clientStylingUrlContent;
416
- this.stylingContainer.prepend(cssFile);
417
- }, 1);
418
- };
419
- }
420
- connectedCallback() {
421
- let selected = [];
422
- if (this.selectedNumbers.length > 0) {
423
- selected = this.selectedNumbers.split(',');
424
- this.selectedCounter = selected.length;
425
- }
426
- if (this.displaySelected) {
427
- selected.forEach((item) => {
428
- this.numbers.push({
429
- number: item,
430
- selected: true,
431
- selectable: this.selectable
432
- });
433
- });
434
- }
435
- else {
436
- [...Array(this.totalNumbers).keys()]
437
- .map(number => (number + 1).toString())
438
- .forEach((number) => {
439
- this.numbers.push({
440
- number,
441
- selected: selected.indexOf(number) >= 0 ? true : false,
442
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
443
- });
444
- });
445
- }
446
- }
447
- componentDidRender() {
448
- // start custom styling area
449
- if (!this.limitStylingAppends && this.stylingContainer) {
450
- if (this.clientStyling)
451
- this.setClientStyling();
452
- if (this.clientStylingUrlContent)
453
- this.setClientStylingURL();
454
- this.limitStylingAppends = true;
455
- }
456
- // end custom styling area
457
- }
458
- // wrote this because the classic .sort(() => 0.5 - Math.random()) method yielded low entropy shuffles for some reason on certain devices
459
- shuffleArray(array) {
460
- const result = [];
461
- while (array.length > 0) {
462
- const randomIndex = Math.floor(Math.random() * (array.length));
463
- result.push(array.splice(randomIndex, 1)[0]);
464
- }
465
- return result;
466
- }
467
- lotteryBulletSelectionHandler(event) {
468
- this.numbers = this.numbers.map((item) => {
469
- if (item.number == event.detail.value) {
470
- return {
471
- number: item.number,
472
- selected: event.detail.selected,
473
- selectable: item.selectable
474
- };
475
- }
476
- return {
477
- number: item.number,
478
- selected: item.selected,
479
- selectable: item.selectable
480
- };
481
- });
482
- if (event.detail.selected) {
483
- this.selectedCounter += 1;
484
- if (this.selectedCounter == this.maximumAllowed) {
485
- this.numbers = this.numbers.map((item) => {
486
- return {
487
- number: item.number,
488
- selected: item.selected,
489
- selectable: item.selected ? true : false
490
- };
491
- });
492
- this.gridFilledEvent.emit({
493
- id: this.ticketId,
494
- index: this.gridIndex,
495
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
496
- });
497
- }
498
- }
499
- else {
500
- if (this.selectedCounter == this.maximumAllowed) {
501
- this.numbers = this.numbers.map((item) => {
502
- return {
503
- number: item.number,
504
- selected: item.selected,
505
- selectable: true
506
- };
507
- });
508
- this.gridDirtyEvent.emit({
509
- id: this.ticketId,
510
- index: this.gridIndex,
511
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
512
- });
513
- }
514
- this.selectedCounter -= 1;
515
- }
516
- }
517
- async resetSelectionHandler(event) {
518
- if (event.detail && event.detail == this.ticketId) {
519
- this.selectedCounter = 0;
520
- this.numbers = this.numbers.map((item) => {
521
- return {
522
- number: item.number,
523
- selected: false,
524
- selectable: this.selectable
525
- };
526
- });
527
- this.gridDirtyEvent.emit({
528
- id: this.ticketId,
529
- index: this.gridIndex,
530
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
531
- });
532
- }
533
- }
534
- async autoSelectionHandler(event) {
535
- if (event.detail && event.detail == this.ticketId) {
536
- this.resetSelectionHandler(event);
537
- let array = [...Array(this.totalNumbers).keys()]
538
- .map(number => number + 1);
539
- array = this.shuffleArray(array);
540
- array = array.slice(0, this.minimumAllowed);
541
- this.numbers = this.numbers.map((item) => {
542
- return {
543
- number: item.number,
544
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
545
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
546
- };
547
- });
548
- this.gridFilledEvent.emit({
549
- id: this.ticketId,
550
- index: this.gridIndex,
551
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
552
- });
553
- this.selectedCounter = this.maximumAllowed;
554
- }
555
- }
556
- render() {
557
- return (index.h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, index.h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => index.h("div", null, index.h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
558
- }
559
- };
560
- LotteryGrid.style = lotteryGridCss;
561
-
562
- exports.lottery_bullet = LotteryBullet;
563
- exports.lottery_draw_results = LotteryDrawResults;
564
- exports.lottery_grid = LotteryGrid;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-40e6760b.js');
4
-
5
- /*
6
- Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
7
- */
8
- const patchBrowser = () => {
9
- const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('lottery-draw-results.cjs.js', document.baseURI).href));
10
- const opts = {};
11
- if (importMeta !== '') {
12
- opts.resourcesUrl = new URL('.', importMeta).href;
13
- }
14
- return index.promiseResolve(opts);
15
- };
16
-
17
- patchBrowser().then(options => {
18
- return index.bootstrapLazy([["lottery-bullet_3.cjs",[[1,"lottery-draw-results",{"endpoint":[513],"gameId":[513,"game-id"],"language":[513],"playerId":[513,"player-id"],"drawMode":[516,"draw-mode"],"drawId":[513,"draw-id"],"gameName":[513,"game-name"],"ticketDate":[513,"ticket-date"],"ticketStatus":[513,"ticket-status"],"ticketId":[513,"ticket-id"],"ticketAmount":[513,"ticket-amount"],"ticketMultiplier":[516,"ticket-multiplier"],"ticketDrawCount":[514,"ticket-draw-count"],"ticketNumbers":[513,"ticket-numbers"],"sessionId":[513,"session-id"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"ticketDrawData":[513,"ticket-draw-data"],"multiplier":[32],"isLoading":[32],"hasErrors":[32],"errorText":[32],"ticketData":[32],"ticketDataLoaded":[32],"ticketDraws":[32],"toggleDrawer":[32],"limitStylingAppends":[32],"drawData":[32]}],[1,"lottery-grid",{"ticketId":[514,"ticket-id"],"totalNumbers":[514,"total-numbers"],"gameId":[513,"game-id"],"maximumAllowed":[514,"maximum-allowed"],"minimumAllowed":[514,"minimum-allowed"],"selectable":[516],"selectedNumbers":[513,"selected-numbers"],"displaySelected":[516,"display-selected"],"language":[513],"gridIndex":[514,"grid-index"],"gridType":[513,"grid-type"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[513],"selectable":[516],"isSelected":[516,"is-selected"],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
19
- });
@@ -1,25 +0,0 @@
1
- {
2
- "entries": [
3
- "./components/lottery-draw-results/lottery-draw-results.js"
4
- ],
5
- "compiler": {
6
- "name": "@stencil/core",
7
- "version": "2.15.2",
8
- "typescriptVersion": "4.5.4"
9
- },
10
- "collections": [
11
- {
12
- "name": "@everymatrix/lottery-bullet",
13
- "tags": [
14
- "lottery-bullet"
15
- ]
16
- },
17
- {
18
- "name": "@everymatrix/lottery-grid",
19
- "tags": [
20
- "lottery-grid"
21
- ]
22
- }
23
- ],
24
- "bundles": []
25
- }