@everymatrix/lottery-game-page 0.0.6 → 0.0.9

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 (78) hide show
  1. package/dist/cjs/helper-accordion_13.cjs.entry.js +23492 -0
  2. package/dist/cjs/helper-pagination.cjs.entry.js +188 -0
  3. package/dist/cjs/index-81cb3b3b.js +1277 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/cjs/lottery-game-page.cjs.js +19 -0
  7. package/dist/collection/collection-manifest.json +86 -0
  8. package/dist/collection/components/lottery-game-page/lottery-game-page.css +305 -0
  9. package/dist/collection/components/lottery-game-page/lottery-game-page.js +496 -0
  10. package/dist/collection/index.js +1 -0
  11. package/dist/collection/utils/locale.utils.js +50 -0
  12. package/dist/collection/utils/utils.js +12 -0
  13. package/dist/components/assets/chrono_desktop.png +0 -0
  14. package/dist/components/assets/chrono_lottery_mobile.png +0 -0
  15. package/dist/components/helper-accordion.js +6 -0
  16. package/dist/components/helper-accordion2.js +110 -0
  17. package/dist/components/helper-filters.js +6 -0
  18. package/dist/components/helper-filters2.js +22347 -0
  19. package/dist/components/helper-modal.js +6 -0
  20. package/dist/components/helper-modal2.js +58 -0
  21. package/dist/components/helper-pagination.js +215 -0
  22. package/dist/components/helper-tab.js +6 -0
  23. package/dist/components/helper-tab2.js +47 -0
  24. package/dist/components/helper-tabs.js +6 -0
  25. package/dist/components/helper-tabs2.js +62 -0
  26. package/dist/components/index.d.ts +22 -0
  27. package/dist/components/index.js +15 -0
  28. package/dist/components/lottery-bullet.js +6 -0
  29. package/dist/components/lottery-bullet2.js +56 -0
  30. package/dist/components/lottery-draw-results-history.js +6 -0
  31. package/dist/components/lottery-draw-results-history2.js +174 -0
  32. package/dist/components/lottery-draw-results.js +6 -0
  33. package/dist/components/lottery-draw-results2.js +217 -0
  34. package/dist/components/lottery-game-details.js +6 -0
  35. package/dist/components/lottery-game-details2.js +48 -0
  36. package/dist/components/lottery-game-page.d.ts +11 -0
  37. package/dist/components/lottery-game-page.js +407 -0
  38. package/dist/components/lottery-grid.js +6 -0
  39. package/dist/components/lottery-grid2.js +196 -0
  40. package/dist/components/lottery-ticket-controller.js +6 -0
  41. package/dist/components/lottery-ticket-controller2.js +117 -0
  42. package/dist/components/lottery-ticket.js +6 -0
  43. package/dist/components/lottery-ticket2.js +183 -0
  44. package/dist/esm/helper-accordion_13.entry.js +23476 -0
  45. package/dist/esm/helper-pagination.entry.js +184 -0
  46. package/dist/esm/index-be84da79.js +1250 -0
  47. package/dist/esm/index.js +1 -0
  48. package/dist/esm/loader.js +17 -0
  49. package/dist/esm/lottery-game-page.js +17 -0
  50. package/dist/esm/polyfills/core-js.js +11 -0
  51. package/dist/esm/polyfills/css-shim.js +1 -0
  52. package/dist/esm/polyfills/dom.js +79 -0
  53. package/dist/esm/polyfills/es5-html-element.js +1 -0
  54. package/dist/esm/polyfills/index.js +34 -0
  55. package/dist/esm/polyfills/system.js +6 -0
  56. package/dist/index.cjs.js +1 -0
  57. package/dist/index.js +1 -0
  58. package/dist/lottery-game-page/index.esm.js +0 -0
  59. package/dist/lottery-game-page/lottery-game-page.esm.js +1 -0
  60. package/dist/lottery-game-page/p-08581ede.entry.js +1 -0
  61. package/dist/lottery-game-page/p-49bd2864.entry.js +2849 -0
  62. package/dist/lottery-game-page/p-91420518.js +2 -0
  63. package/dist/stencil.config.js +29 -0
  64. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-game-page/.stencil/packages/lottery-game-page/stencil.config.d.ts +2 -0
  65. package/dist/types/components/lottery-game-page/lottery-game-page.d.ts +74 -0
  66. package/dist/types/components.d.ts +93 -0
  67. package/dist/types/index.d.ts +1 -0
  68. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  69. package/dist/types/utils/locale.utils.d.ts +1 -0
  70. package/dist/types/utils/utils.d.ts +7 -0
  71. package/loader/cdn.js +3 -0
  72. package/loader/index.cjs.js +3 -0
  73. package/loader/index.d.ts +12 -0
  74. package/loader/index.es2017.js +3 -0
  75. package/loader/index.js +4 -0
  76. package/loader/package.json +10 -0
  77. package/package.json +1 -1
  78. package/LICENSE +0 -21
@@ -0,0 +1,496 @@
1
+ import { Component, h, Prop, State, Listen, Element, /*getAssetPath */ } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ // import { isMobile } from "../../utils/utils";
4
+ import '@everymatrix/lottery-ticket-controller';
5
+ import '@everymatrix/helper-modal';
6
+ import '@everymatrix/lottery-game-details';
7
+ import '@everymatrix/lottery-draw-results-history';
8
+ import '@everymatrix/lottery-draw-results';
9
+ export class LotteryGamePage {
10
+ constructor() {
11
+ /**
12
+ * Language of the widget
13
+ */
14
+ this.language = 'en';
15
+ /**
16
+ * Shows the auto-pick button
17
+ */
18
+ this.autoPick = false;
19
+ /**
20
+ * Shows the reset button
21
+ */
22
+ this.resetButton = false;
23
+ this.tickets = [];
24
+ this.tabIndex = 0;
25
+ this.hasErrors = false;
26
+ this.totalAmount = 0;
27
+ this.successVisible = false;
28
+ this.deleteVisible = false;
29
+ this.latestDraw = {};
30
+ this.totalWinningsAmount = 0;
31
+ this.multiplier = false;
32
+ this.quickPick = false;
33
+ }
34
+ // @TODO fix `any` type later, I'm lazy now
35
+ connectedCallback() {
36
+ this.getGameDetails();
37
+ this.getDraws();
38
+ }
39
+ countdownLogic(date) {
40
+ this.interval = setInterval(() => {
41
+ this.daysRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60 * 24));
42
+ this.hoursRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60) - this.daysRemaining * 24);
43
+ this.minutesRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60) - this.daysRemaining * 24 * 60 - this.hoursRemaining * 60);
44
+ this.secondsRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / 1000 - this.daysRemaining * 24 * 60 * 60 - this.hoursRemaining * 60 * 60 - this.minutesRemaining * 60);
45
+ }, 1000);
46
+ }
47
+ disconnectedCallback() {
48
+ clearInterval(this.interval);
49
+ }
50
+ getGameDetails() {
51
+ let url = new URL(`${this.endpoint}/games/${this.gameId}`);
52
+ fetch(url.href)
53
+ .then((res) => {
54
+ if (res.status >= 300) {
55
+ this.hasErrors = true;
56
+ throw new Error('There was an error while fetching the data');
57
+ }
58
+ return res.json();
59
+ })
60
+ .then((data) => {
61
+ this.gameData = data;
62
+ this.basicStake = this.gameData.rules.stakes[0].amount;
63
+ let draws = this.gameData.draws.filter((item) => !item.winningNumbers);
64
+ console.log('draws', draws);
65
+ this.nextDraw = draws[0].id;
66
+ this.createNewTicket();
67
+ })
68
+ .catch((err) => {
69
+ this.hasErrors = true;
70
+ console.log('Error', err);
71
+ });
72
+ }
73
+ calculateTotalAmount() {
74
+ const { currency } = this.gameData.rules.stakes[0];
75
+ this.totalAmount = 0;
76
+ this.tickets.forEach((item) => {
77
+ if (item.completed) {
78
+ this.totalAmount += item.amount * item.stake;
79
+ }
80
+ });
81
+ this.currency = currency;
82
+ }
83
+ // @TODO CustomEvent type
84
+ gridFilledHandler(event) {
85
+ // @TODO item ts
86
+ this.tickets = this.tickets.map((item) => {
87
+ if (item.ticketId == event.detail.id) {
88
+ let arr = item.selectedNumbers || [];
89
+ arr[event.detail.index] = event.detail.selectedNumbers.map((item) => parseInt(item, 10));
90
+ return {
91
+ gameId: item.gameId,
92
+ ticketId: item.ticketId,
93
+ completed: true,
94
+ amount: event.detail.draws,
95
+ stake: item.stake,
96
+ selectedNumbers: arr
97
+ };
98
+ }
99
+ return item;
100
+ });
101
+ this.calculateTotalAmount();
102
+ }
103
+ // @TODO fix any type
104
+ gridDirtyHandler(event) {
105
+ // @TODO item ts
106
+ this.tickets = this.tickets.map((item) => {
107
+ if (item.gameId == event.detail.id) {
108
+ return {
109
+ gameId: item.gameId,
110
+ ticketId: item.ticketId,
111
+ completed: false,
112
+ amount: item.amount,
113
+ stake: item.stake,
114
+ grids: []
115
+ };
116
+ }
117
+ return item;
118
+ });
119
+ }
120
+ // @TODO CustomEvent type
121
+ deleteTicketHandler(event) {
122
+ this.deleteVisible = true;
123
+ this.deleteEventData = event;
124
+ }
125
+ modalCloseEvent() {
126
+ this.deleteVisible = false;
127
+ }
128
+ stakeChangeHandler(event) {
129
+ const { ticketId, stake } = event.detail;
130
+ this.tickets[ticketId - 1].stake = stake;
131
+ this.calculateTotalAmount();
132
+ }
133
+ multiplierChangeHandler(event) {
134
+ this.multiplier = event.detail;
135
+ }
136
+ getDraws() {
137
+ // append from query param with the current date value in order to get the next draw
138
+ let url = new URL(`${this.endpoint}/games/${this.gameId}/draws`);
139
+ let drawOptions = {
140
+ method: "GET",
141
+ headers: {
142
+ 'Content-Type': "application/json",
143
+ 'Accept': 'application/json',
144
+ },
145
+ };
146
+ fetch(url.href, drawOptions)
147
+ .then((response) => {
148
+ return response.json();
149
+ })
150
+ .then((data) => {
151
+ var _a;
152
+ let upcoming = data.items.filter((item) => {
153
+ if (Date.parse(item.date) > new Date().getTime()) {
154
+ return !item.winningNumbers;
155
+ }
156
+ });
157
+ let past = data.items.filter((item) => item.winningNumbers);
158
+ this.latestDraw = upcoming[0];
159
+ this.nextDate = this.latestDraw.date;
160
+ this.countdownLogic(this.nextDate);
161
+ this.lastDrawId = past[past.length - 1].id;
162
+ // calculate total winnings
163
+ // @TODO fix any type
164
+ (_a = this.latestDraw) === null || _a === void 0 ? void 0 : _a.prizes.forEach((element) => {
165
+ this.totalWinningsAmount += JSON.parse(element.amount);
166
+ });
167
+ });
168
+ }
169
+ ;
170
+ // @TODO fix any type
171
+ confirmDeleteTicketHandler(event) {
172
+ // @TODO fix any type
173
+ this.tickets = this.tickets.filter((item) => {
174
+ if (item.ticketId == event.detail.ticketId) {
175
+ return false;
176
+ }
177
+ return true;
178
+ });
179
+ this.calculateTotalAmount();
180
+ this.deleteVisible = false;
181
+ }
182
+ createNewTicket() {
183
+ this.tickets = [
184
+ ...this.tickets,
185
+ { gameId: this.gameId, ticketId: this.tickets.length + 1, completed: false, amount: 1, stake: this.basicStake, grids: [] }
186
+ ];
187
+ }
188
+ submitTickets() {
189
+ let url = new URL(`${this.endpoint}/tickets`);
190
+ // @TODO Body TS type
191
+ let body = {
192
+ gameId: this.gameId,
193
+ tickets: []
194
+ };
195
+ console.log('body', body);
196
+ this.tickets.forEach((item) => {
197
+ body.tickets.push({
198
+ startingDrawId: this.nextDraw,
199
+ amount: item.stake,
200
+ gameId: this.gameId,
201
+ currency: this.currency,
202
+ selection: item.selectedNumbers,
203
+ multiplier: this.multiplier,
204
+ drawCount: item.amount,
205
+ quickPick: this.quickPick,
206
+ });
207
+ });
208
+ // @TODO Options TS type
209
+ let options = {
210
+ method: 'POST',
211
+ headers: {
212
+ 'Content-Type': 'application/json',
213
+ 'Accept': 'application/json',
214
+ 'Authorization': `Bearer ${this.sessionId}`
215
+ },
216
+ body: JSON.stringify(body)
217
+ };
218
+ fetch(url.href, options)
219
+ .then((res) => {
220
+ if (res.status > 300) {
221
+ throw new Error('err');
222
+ }
223
+ return res.json();
224
+ })
225
+ .then((data) => {
226
+ console.log('data', data);
227
+ });
228
+ this.successVisible = true;
229
+ }
230
+ render() {
231
+ // const backgroundSrc = getAssetPath('./static/chrono_lottery_mobile.png');
232
+ // const backgroundDesktopSrc = getAssetPath('./static/chrono_desktop.png');
233
+ if (this.hasErrors) {
234
+ return (h("div", { class: "GamePage" },
235
+ h("div", { class: "Title" }, translate('error', this.language))));
236
+ }
237
+ return (
238
+ /* Game details */
239
+ h("div", { class: "GamePage" },
240
+ h("div", { class: "GridBanner" },
241
+ h("div", { class: "BannerButtonsWrapper" },
242
+ h("button", { class: "BannerBackButton" },
243
+ h("span", { class: "BannerBackButtonArrow" }, "\u1438 "),
244
+ translate('backButton', this.language)),
245
+ h("button", { class: "BannerLobbyButton" }, translate('lobbyButton', this.language))),
246
+ h("div", { class: "Tabs" },
247
+ h("div", { class: 'TabButton' + (this.tabIndex == 0 ? ' Active' : ''), onClick: () => this.tabIndex = 0 }, translate('buy', this.language)),
248
+ h("div", { class: 'TabButton' + (this.tabIndex == 1 ? ' Active' : ''), onClick: () => this.tabIndex = 1 }, translate('viewLatest', this.language)))),
249
+ h("div", { class: "NextDrawWrapper" },
250
+ h("div", { class: "TotalWinnings" },
251
+ translate('winUpTo', this.language),
252
+ ": ",
253
+ h("span", null,
254
+ "$",
255
+ this.totalWinningsAmount.toLocaleString('en-US', { maximumFractionDigits: 2 }))),
256
+ h("div", { class: "NextDraw" },
257
+ h("p", { class: "BannerText" }, translate('nextDraw', this.language)),
258
+ h("div", { class: "BannerCountdown" },
259
+ h("span", { class: "CountdownDays" },
260
+ this.daysRemaining,
261
+ "D"),
262
+ h("span", { class: "CountdownHours" },
263
+ this.hoursRemaining,
264
+ "H"),
265
+ h("span", { class: "CountdownMinutes" },
266
+ this.minutesRemaining,
267
+ "M"),
268
+ h("span", { class: "CountdownSeconds" },
269
+ this.secondsRemaining,
270
+ "S")))),
271
+ this.tabIndex == 0 &&
272
+ h("div", { class: "GamePageContent" },
273
+ h("div", { class: "GameDetails" },
274
+ h("lottery-game-details", null)),
275
+ h("div", { class: "TicketsWrapper" },
276
+ this.tickets.map((item) => h("lottery-ticket-controller", { endpoint: this.endpoint, "ticket-id": item.ticketId, "game-id": item.gameId, collapsed: false, last: true, language: this.language, "auto-pick": this.autoPick, "reset-button": this.resetButton })),
277
+ h("div", { class: "CreateNewTicket" },
278
+ h("button", { onClick: () => this.createNewTicket() }, "+"),
279
+ h("span", null, translate('createTicket', this.language)))),
280
+ h("div", { class: "OrderSummary" },
281
+ h("h3", { class: "OrderSummaryTitle" }, translate('orderSummaryTitle', this.language)),
282
+ h("div", { class: "Ticket" },
283
+ translate('orderSummaryTickets', this.language),
284
+ ": ",
285
+ h("span", null, this.tickets.length)),
286
+ h("div", { class: "Total" },
287
+ translate('orderSummaryTotal', this.language),
288
+ ": ",
289
+ h("span", null,
290
+ this.totalAmount,
291
+ " ",
292
+ this.currency)),
293
+ h("div", { class: "ButtonWrapper" },
294
+ h("span", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language))))),
295
+ this.tabIndex == 1 &&
296
+ h("div", null,
297
+ h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "draw-id": this.lastDrawId, "draw-mode": true }),
298
+ h("lottery-draw-results-history", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language })),
299
+ h("helper-modal", { "title-modal": "Success", visible: this.successVisible },
300
+ h("p", { class: "SubmitModalSuccess" }, translate('modalSuccess', this.language))),
301
+ h("helper-modal", { "title-modal": "Delete Ticket", visible: this.deleteVisible },
302
+ h("div", { class: "DeleteTicketModalWrapper" },
303
+ h("h3", { class: "DeleteTicketModalTitle" }, translate('deleteTicketModalTitle', this.language)),
304
+ h("p", { class: "DeleteTicketModalText" }, translate('deleteTicketModalText', this.language)),
305
+ h("div", { class: "DeleteTicketModalButtons" },
306
+ h("button", { class: "DeleteTicketModalCancel", onClick: () => this.modalCloseEvent() }, translate('deleteTicketModalCancel', this.language)),
307
+ h("button", { class: "DeleteTicketModalConfirm", onClick: () => this.confirmDeleteTicketHandler(this.deleteEventData) }, translate('deleteTicketModalConfirm', this.language)))))));
308
+ }
309
+ static get is() { return "lottery-game-page"; }
310
+ static get encapsulation() { return "shadow"; }
311
+ static get originalStyleUrls() { return {
312
+ "$": ["lottery-game-page.scss"]
313
+ }; }
314
+ static get styleUrls() { return {
315
+ "$": ["lottery-game-page.css"]
316
+ }; }
317
+ static get assetsDirs() { return ["static"]; }
318
+ static get properties() { return {
319
+ "endpoint": {
320
+ "type": "string",
321
+ "mutable": false,
322
+ "complexType": {
323
+ "original": "string",
324
+ "resolved": "string",
325
+ "references": {}
326
+ },
327
+ "required": false,
328
+ "optional": false,
329
+ "docs": {
330
+ "tags": [],
331
+ "text": "Endpoint URL for the source of data"
332
+ },
333
+ "attribute": "endpoint",
334
+ "reflect": false
335
+ },
336
+ "gameId": {
337
+ "type": "string",
338
+ "mutable": false,
339
+ "complexType": {
340
+ "original": "string",
341
+ "resolved": "string",
342
+ "references": {}
343
+ },
344
+ "required": false,
345
+ "optional": false,
346
+ "docs": {
347
+ "tags": [],
348
+ "text": "GameID of the lottery game"
349
+ },
350
+ "attribute": "game-id",
351
+ "reflect": false
352
+ },
353
+ "playerId": {
354
+ "type": "number",
355
+ "mutable": false,
356
+ "complexType": {
357
+ "original": "number",
358
+ "resolved": "number",
359
+ "references": {}
360
+ },
361
+ "required": false,
362
+ "optional": false,
363
+ "docs": {
364
+ "tags": [],
365
+ "text": "Player ID"
366
+ },
367
+ "attribute": "player-id",
368
+ "reflect": false
369
+ },
370
+ "sessionId": {
371
+ "type": "string",
372
+ "mutable": false,
373
+ "complexType": {
374
+ "original": "string",
375
+ "resolved": "string",
376
+ "references": {}
377
+ },
378
+ "required": false,
379
+ "optional": false,
380
+ "docs": {
381
+ "tags": [],
382
+ "text": "GIC Session"
383
+ },
384
+ "attribute": "session-id",
385
+ "reflect": false
386
+ },
387
+ "language": {
388
+ "type": "string",
389
+ "mutable": false,
390
+ "complexType": {
391
+ "original": "string",
392
+ "resolved": "string",
393
+ "references": {}
394
+ },
395
+ "required": false,
396
+ "optional": false,
397
+ "docs": {
398
+ "tags": [],
399
+ "text": "Language of the widget"
400
+ },
401
+ "attribute": "language",
402
+ "reflect": false,
403
+ "defaultValue": "'en'"
404
+ },
405
+ "autoPick": {
406
+ "type": "boolean",
407
+ "mutable": false,
408
+ "complexType": {
409
+ "original": "boolean",
410
+ "resolved": "boolean",
411
+ "references": {}
412
+ },
413
+ "required": false,
414
+ "optional": false,
415
+ "docs": {
416
+ "tags": [],
417
+ "text": "Shows the auto-pick button"
418
+ },
419
+ "attribute": "auto-pick",
420
+ "reflect": false,
421
+ "defaultValue": "false"
422
+ },
423
+ "resetButton": {
424
+ "type": "boolean",
425
+ "mutable": false,
426
+ "complexType": {
427
+ "original": "boolean",
428
+ "resolved": "boolean",
429
+ "references": {}
430
+ },
431
+ "required": false,
432
+ "optional": false,
433
+ "docs": {
434
+ "tags": [],
435
+ "text": "Shows the reset button"
436
+ },
437
+ "attribute": "reset-button",
438
+ "reflect": false,
439
+ "defaultValue": "false"
440
+ }
441
+ }; }
442
+ static get states() { return {
443
+ "tickets": {},
444
+ "tabIndex": {},
445
+ "hasErrors": {},
446
+ "totalAmount": {},
447
+ "successVisible": {},
448
+ "deleteVisible": {},
449
+ "deleteEventData": {},
450
+ "daysRemaining": {},
451
+ "hoursRemaining": {},
452
+ "minutesRemaining": {},
453
+ "secondsRemaining": {},
454
+ "latestDraw": {},
455
+ "totalWinningsAmount": {},
456
+ "nextDate": {}
457
+ }; }
458
+ static get elementRef() { return "element"; }
459
+ static get listeners() { return [{
460
+ "name": "ticketCompleted",
461
+ "method": "gridFilledHandler",
462
+ "target": undefined,
463
+ "capture": false,
464
+ "passive": false
465
+ }, {
466
+ "name": "gridDirty",
467
+ "method": "gridDirtyHandler",
468
+ "target": undefined,
469
+ "capture": false,
470
+ "passive": false
471
+ }, {
472
+ "name": "deleteTicket",
473
+ "method": "deleteTicketHandler",
474
+ "target": undefined,
475
+ "capture": false,
476
+ "passive": false
477
+ }, {
478
+ "name": "modalCloseEvent",
479
+ "method": "modalCloseEvent",
480
+ "target": undefined,
481
+ "capture": false,
482
+ "passive": false
483
+ }, {
484
+ "name": "stakeChange",
485
+ "method": "stakeChangeHandler",
486
+ "target": undefined,
487
+ "capture": false,
488
+ "passive": false
489
+ }, {
490
+ "name": "multiplierChange",
491
+ "method": "multiplierChangeHandler",
492
+ "target": undefined,
493
+ "capture": false,
494
+ "passive": false
495
+ }]; }
496
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,50 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ error: 'Error',
6
+ title: 'Chrono',
7
+ backButton: 'Back',
8
+ lobbyButton: 'Lobby',
9
+ prize: 'Prize',
10
+ winUpTo: 'Win up to',
11
+ nextDraw: 'Next draw in: ',
12
+ buy: 'Buy tickets',
13
+ viewLatest: 'View latest results',
14
+ createTicket: 'Create Ticket',
15
+ modalSuccess: 'Purchase will be successfull soon!',
16
+ deleteTicketModalTitle: 'Delete Ticket',
17
+ deleteTicketModalText: 'Are you sure you want to delete this ticket?',
18
+ deleteTicketModalCancel: 'Cancel',
19
+ deleteTicketModalConfirm: 'Delete',
20
+ orderSummaryTitle: 'Order Summary',
21
+ orderSummaryTickets: 'Ticket',
22
+ orderSummaryTotal: 'Total',
23
+ orderSummarySubmit: 'Submit'
24
+ },
25
+ ro: {
26
+ error: 'Eroare',
27
+ title: 'Loto 6/49',
28
+ backButton: 'Inapoi',
29
+ lobbyButton: 'Lobby',
30
+ prize: 'MARELE JACKPOT OMG',
31
+ winUpTo: 'Castiga pana la',
32
+ nextDraw: 'In cat timp devii milionar daca cumperi acum!!!',
33
+ buy: 'Cumpara bilet',
34
+ viewLatest: 'Ultimile extrageri',
35
+ createTicket: 'Creeaza bilet',
36
+ modalSuccess: 'Achiziția va avea succes în curând!',
37
+ deleteTicketModalTitle: 'Sterge biletul',
38
+ deleteTicketModalText: 'Esti sigur ca vrei sa stergi acest bilet?',
39
+ deleteTicketModalCancel: 'Anuleaza',
40
+ deleteTicketModalConfirm: 'Sterge',
41
+ orderSummaryTitle: 'Rezumat comanda',
42
+ orderSummaryTickets: 'Bilet',
43
+ orderSummaryTotal: 'Total',
44
+ orderSummarySubmit: 'Trimite'
45
+ },
46
+ };
47
+ export const translate = (key, customLang) => {
48
+ const lang = customLang;
49
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
50
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @name isMobile
3
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
4
+ * @param {String} userAgent window.navigator.userAgent
5
+ * @returns {Boolean} true or false
6
+ */
7
+ export const isMobile = (userAgent) => {
8
+ return !!(userAgent.toLowerCase().match(/android/i) ||
9
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
10
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
11
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
12
+ };
@@ -0,0 +1,6 @@
1
+ import { A as Accordion, d as defineCustomElement$1 } from './helper-accordion2.js';
2
+
3
+ const HelperAccordion = Accordion;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { HelperAccordion, defineCustomElement };
@@ -0,0 +1,110 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+
3
+ const DEFAULT_LANGUAGE = 'en';
4
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
5
+ const TRANSLATIONS = {
6
+ en: {
7
+ deleteTicket: 'Delete ticket'
8
+ },
9
+ ro: {
10
+ deleteTicket: 'Sterge biletul'
11
+ },
12
+ };
13
+ const translate = (key, customLang) => {
14
+ const lang = customLang;
15
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
16
+ };
17
+
18
+ const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:4px;margin-bottom:1px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{border-radius:4px;margin-top:10px;cursor:pointer;text-transform:capitalize;display:block;font-size:12px;text-align:center;padding:8px 20px;width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
19
+
20
+ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
21
+ constructor() {
22
+ super();
23
+ this.__registerHost();
24
+ this.__attachShadow();
25
+ this.accordionEvent = createEvent(this, "helperAccordionAction", 7);
26
+ /**
27
+ * Title (top header)
28
+ */
29
+ this.headerTitle = '';
30
+ /**
31
+ * SubTitle (top header)
32
+ */
33
+ this.headerSubtitle = '';
34
+ /**
35
+ * Description
36
+ */
37
+ this.description = '';
38
+ /**
39
+ * Enables footer content
40
+ */
41
+ this.footer = false;
42
+ /**
43
+ * Enables footer button for tab deletion
44
+ */
45
+ this.deleteTab = false;
46
+ /**
47
+ * Activates postMessages as events for actions from the widget
48
+ */
49
+ this.postMessage = false;
50
+ /**
51
+ * Name of the event emitter by the action button
52
+ */
53
+ this.eventName = 'helperAccordionAction';
54
+ /**
55
+ * Collapsed
56
+ */
57
+ this.collapsed = true;
58
+ /**
59
+ * Language
60
+ */
61
+ this.language = 'en';
62
+ }
63
+ // @TODO fix the `any` type :)
64
+ connectedCallback() {
65
+ this.showContent = !this.collapsed;
66
+ }
67
+ toggleContent() {
68
+ this.showContent = !this.showContent;
69
+ }
70
+ deleteAction() {
71
+ if (this.postMessage) {
72
+ // @TODO maybe change the name type, this one sucks
73
+ window.postMessage({ type: this.eventName }, window.location.href);
74
+ }
75
+ this.accordionEvent.emit();
76
+ }
77
+ render() {
78
+ return (h("div", { class: "Wrapper" }, h("div", { class: "Header" }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
79
+ h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
80
+ h("div", null, this.deleteTab &&
81
+ h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
82
+ }
83
+ static get style() { return helperAccordionCss; }
84
+ }, [1, "helper-accordion", {
85
+ "headerTitle": [1, "header-title"],
86
+ "headerSubtitle": [1, "header-subtitle"],
87
+ "description": [1],
88
+ "footer": [4],
89
+ "deleteTab": [4, "delete-tab"],
90
+ "postMessage": [4, "post-message"],
91
+ "eventName": [1, "event-name"],
92
+ "collapsed": [4],
93
+ "language": [1],
94
+ "showContent": [32]
95
+ }]);
96
+ function defineCustomElement() {
97
+ if (typeof customElements === "undefined") {
98
+ return;
99
+ }
100
+ const components = ["helper-accordion"];
101
+ components.forEach(tagName => { switch (tagName) {
102
+ case "helper-accordion":
103
+ if (!customElements.get(tagName)) {
104
+ customElements.define(tagName, Accordion);
105
+ }
106
+ break;
107
+ } });
108
+ }
109
+
110
+ export { Accordion as A, defineCustomElement as d };
@@ -0,0 +1,6 @@
1
+ import { H as HelperFilters$1, d as defineCustomElement$1 } from './helper-filters2.js';
2
+
3
+ const HelperFilters = HelperFilters$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { HelperFilters, defineCustomElement };