@everymatrix/lottery-game-page 0.1.26 → 1.0.69

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 (115) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/{helper-filters_2.cjs.entry.js → helper-accordion_13.cjs.entry.js} +13401 -9890
  3. package/dist/cjs/helper-pagination.cjs.entry.js +197 -189
  4. package/dist/cjs/index-f3851683.js +1345 -0
  5. package/dist/cjs/loader.cjs.js +7 -13
  6. package/dist/cjs/lottery-game-page.cjs.js +17 -11
  7. package/dist/collection/collection-manifest.json +4 -10
  8. package/dist/collection/components/lottery-game-page/index.js +1 -0
  9. package/dist/collection/components/lottery-game-page/lottery-game-page.css +11 -2
  10. package/dist/collection/components/lottery-game-page/lottery-game-page.js +579 -594
  11. package/dist/collection/utils/locale.utils.js +118 -95
  12. package/dist/collection/utils/utils.js +4 -4
  13. package/dist/esm/app-globals-0f993ce5.js +3 -0
  14. package/dist/esm/{helper-filters_2.entry.js → helper-accordion_13.entry.js} +13391 -9891
  15. package/dist/esm/helper-pagination.entry.js +197 -189
  16. package/dist/esm/index-8248702b.js +1316 -0
  17. package/dist/esm/loader.js +7 -13
  18. package/dist/esm/lottery-game-page.js +14 -11
  19. package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
  20. package/dist/lottery-game-page/p-46aaa562.entry.js +1 -0
  21. package/dist/lottery-game-page/p-8f2c63c7.js +2 -0
  22. package/dist/lottery-game-page/p-bd89bbf0.entry.js +3567 -0
  23. package/dist/lottery-game-page/p-e1255160.js +1 -0
  24. package/dist/stencil.config.dev.js +17 -0
  25. package/dist/stencil.config.js +12 -36
  26. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-game-page/.stencil/packages/stencil/lottery-game-page/stencil.config.d.ts +2 -0
  27. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-game-page/.stencil/packages/stencil/lottery-game-page/stencil.config.dev.d.ts +2 -0
  28. package/dist/types/components/lottery-game-page/index.d.ts +1 -0
  29. package/dist/types/components/lottery-game-page/lottery-game-page.d.ts +99 -90
  30. package/dist/types/components.d.ts +28 -2
  31. package/dist/types/stencil-public-runtime.d.ts +142 -33
  32. package/loader/cdn.js +1 -3
  33. package/loader/index.cjs.js +1 -3
  34. package/loader/index.d.ts +13 -1
  35. package/loader/index.es2017.js +1 -3
  36. package/loader/index.js +1 -3
  37. package/loader/package.json +1 -0
  38. package/package.json +13 -7
  39. package/dist/cjs/helper-accordion.cjs.entry.js +0 -124
  40. package/dist/cjs/helper-modal.cjs.entry.js +0 -76
  41. package/dist/cjs/helper-tab.cjs.entry.js +0 -68
  42. package/dist/cjs/helper-tabs.cjs.entry.js +0 -74
  43. package/dist/cjs/index-cd44e726.js +0 -1324
  44. package/dist/cjs/lottery-bullet_2.cjs.entry.js +0 -270
  45. package/dist/cjs/lottery-draw-results-history.cjs.entry.js +0 -198
  46. package/dist/cjs/lottery-game-details.cjs.entry.js +0 -51
  47. package/dist/cjs/lottery-game-page.cjs.entry.js +0 -427
  48. package/dist/cjs/lottery-ticket-controller.cjs.entry.js +0 -116
  49. package/dist/cjs/lottery-ticket.cjs.entry.js +0 -201
  50. package/dist/collection/components/lottery-game-page/static/chrono_desktop.png +0 -0
  51. package/dist/collection/components/lottery-game-page/static/chrono_lottery_mobile.png +0 -0
  52. package/dist/components/assets/chrono_desktop.png +0 -0
  53. package/dist/components/assets/chrono_lottery_mobile.png +0 -0
  54. package/dist/components/helper-accordion.js +0 -6
  55. package/dist/components/helper-accordion2.js +0 -151
  56. package/dist/components/helper-filters.js +0 -6
  57. package/dist/components/helper-filters2.js +0 -22394
  58. package/dist/components/helper-modal.js +0 -6
  59. package/dist/components/helper-modal2.js +0 -94
  60. package/dist/components/helper-pagination.js +0 -251
  61. package/dist/components/helper-tab.js +0 -6
  62. package/dist/components/helper-tab2.js +0 -87
  63. package/dist/components/helper-tabs.js +0 -6
  64. package/dist/components/helper-tabs2.js +0 -103
  65. package/dist/components/index.d.ts +0 -26
  66. package/dist/components/index.js +0 -1
  67. package/dist/components/lottery-bullet.js +0 -6
  68. package/dist/components/lottery-bullet2.js +0 -92
  69. package/dist/components/lottery-draw-results-history.js +0 -6
  70. package/dist/components/lottery-draw-results-history2.js +0 -256
  71. package/dist/components/lottery-draw-results.js +0 -6
  72. package/dist/components/lottery-draw-results2.js +0 -335
  73. package/dist/components/lottery-game-details.js +0 -6
  74. package/dist/components/lottery-game-details2.js +0 -85
  75. package/dist/components/lottery-game-page.d.ts +0 -11
  76. package/dist/components/lottery-game-page.js +0 -542
  77. package/dist/components/lottery-grid.js +0 -6
  78. package/dist/components/lottery-grid2.js +0 -237
  79. package/dist/components/lottery-ticket-controller.js +0 -6
  80. package/dist/components/lottery-ticket-controller2.js +0 -168
  81. package/dist/components/lottery-ticket.js +0 -6
  82. package/dist/components/lottery-ticket2.js +0 -244
  83. package/dist/esm/helper-accordion.entry.js +0 -120
  84. package/dist/esm/helper-modal.entry.js +0 -72
  85. package/dist/esm/helper-tab.entry.js +0 -64
  86. package/dist/esm/helper-tabs.entry.js +0 -70
  87. package/dist/esm/index-d1baacd4.js +0 -1296
  88. package/dist/esm/lottery-bullet_2.entry.js +0 -265
  89. package/dist/esm/lottery-draw-results-history.entry.js +0 -194
  90. package/dist/esm/lottery-game-details.entry.js +0 -47
  91. package/dist/esm/lottery-game-page.entry.js +0 -423
  92. package/dist/esm/lottery-ticket-controller.entry.js +0 -112
  93. package/dist/esm/lottery-ticket.entry.js +0 -197
  94. package/dist/esm/polyfills/core-js.js +0 -11
  95. package/dist/esm/polyfills/css-shim.js +0 -1
  96. package/dist/esm/polyfills/dom.js +0 -79
  97. package/dist/esm/polyfills/es5-html-element.js +0 -1
  98. package/dist/esm/polyfills/index.js +0 -34
  99. package/dist/esm/polyfills/system.js +0 -6
  100. package/dist/lottery-game-page/p-023325a2.entry.js +0 -1
  101. package/dist/lottery-game-page/p-04fbc8fd.entry.js +0 -1
  102. package/dist/lottery-game-page/p-256b151c.entry.js +0 -1
  103. package/dist/lottery-game-page/p-381b5507.entry.js +0 -1
  104. package/dist/lottery-game-page/p-3f8b6ad9.entry.js +0 -1
  105. package/dist/lottery-game-page/p-4274053c.entry.js +0 -1
  106. package/dist/lottery-game-page/p-4f81cd37.entry.js +0 -1
  107. package/dist/lottery-game-page/p-5c389034.entry.js +0 -1
  108. package/dist/lottery-game-page/p-7d06371e.entry.js +0 -1
  109. package/dist/lottery-game-page/p-ca8430a0.entry.js +0 -2849
  110. package/dist/lottery-game-page/p-d6f76e8d.entry.js +0 -1
  111. package/dist/lottery-game-page/p-e765c7d9.js +0 -1
  112. package/dist/lottery-game-page/p-f6fcc22c.entry.js +0 -1
  113. package/dist/lottery-game-page/static/chrono_desktop.png +0 -0
  114. package/dist/lottery-game-page/static/chrono_lottery_mobile.png +0 -0
  115. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-game-page/.stencil/packages/lottery-game-page/stencil.config.d.ts +0 -2
@@ -1,542 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, getAssetPath, h } from '@stencil/core/internal/client';
2
- import { d as defineCustomElement$d } from './helper-accordion2.js';
3
- import { d as defineCustomElement$c } from './helper-filters2.js';
4
- import { d as defineCustomElement$b } from './helper-modal2.js';
5
- import { d as defineCustomElement$a } from './helper-tab2.js';
6
- import { d as defineCustomElement$9 } from './helper-tabs2.js';
7
- import { d as defineCustomElement$8 } from './lottery-bullet2.js';
8
- import { d as defineCustomElement$7 } from './lottery-draw-results2.js';
9
- import { d as defineCustomElement$6 } from './lottery-draw-results-history2.js';
10
- import { d as defineCustomElement$5 } from './lottery-game-details2.js';
11
- import { d as defineCustomElement$4 } from './lottery-grid2.js';
12
- import { d as defineCustomElement$3 } from './lottery-ticket2.js';
13
- import { d as defineCustomElement$2 } from './lottery-ticket-controller2.js';
14
-
15
- const DEFAULT_LANGUAGE = 'en';
16
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
17
- const TRANSLATIONS = {
18
- en: {
19
- error: 'Error',
20
- title: 'Chrono',
21
- backButton: 'Back',
22
- lobbyButton: 'Lobby',
23
- prize: 'Prize',
24
- winUpTo: 'Win up to',
25
- nextDraw: 'Next draw in: ',
26
- buy: 'Buy tickets',
27
- viewLatest: 'View latest results',
28
- createTicket: 'Create Ticket',
29
- modalSuccess: 'Purchase successfully completed!',
30
- deleteTicketModalTitle: 'Delete Ticket',
31
- deleteTicketModalText: 'Are you sure you want to delete this ticket?',
32
- deleteTicketModalCancel: 'Cancel',
33
- deleteTicketModalConfirm: 'Delete',
34
- orderSummaryTitle: 'Order Summary',
35
- orderSummaryTickets: 'Ticket',
36
- orderSummaryTotal: 'Total',
37
- orderSummarySubmit: 'Submit',
38
- lastDrawResultsTitle: 'Last Draw Results',
39
- modalLogin: 'Please login to submit a ticket',
40
- },
41
- ro: {
42
- error: 'Eroare',
43
- title: 'Loto 6/49',
44
- backButton: 'Inapoi',
45
- lobbyButton: 'Lobby',
46
- prize: 'MARELE JACKPOT OMG',
47
- winUpTo: 'Castiga pana la',
48
- nextDraw: 'Urmatoarea extragere:',
49
- buy: 'Cumpara bilet',
50
- viewLatest: 'Ultimile extrageri',
51
- createTicket: 'Creeaza bilet',
52
- modalSuccess: 'Achizitie efectuata cu succes',
53
- deleteTicketModalTitle: 'Sterge biletul',
54
- deleteTicketModalText: 'Esti sigur ca vrei sa stergi acest bilet?',
55
- deleteTicketModalCancel: 'Anuleaza',
56
- deleteTicketModalConfirm: 'Sterge',
57
- orderSummaryTitle: 'Rezumat comanda',
58
- orderSummaryTickets: 'Bilet',
59
- orderSummaryTotal: 'Total',
60
- orderSummarySubmit: 'Trimite',
61
- lastDrawResultsTitle: 'Cele mai recente extrageri',
62
- modalLogin: 'Please login to submit a ticket',
63
- },
64
- fr: {
65
- error: 'Error',
66
- title: 'Chrono',
67
- backButton: 'Back',
68
- lobbyButton: 'Lobby',
69
- prize: 'Prize',
70
- winUpTo: 'Win up to',
71
- nextDraw: 'Next draw in: ',
72
- buy: 'Buy tickets',
73
- viewLatest: 'View latest results',
74
- createTicket: 'Create Ticket',
75
- modalSuccess: 'Purchase successfully completed!',
76
- deleteTicketModalTitle: 'Delete Ticket',
77
- deleteTicketModalText: 'Are you sure you want to delete this ticket?',
78
- deleteTicketModalCancel: 'Cancel',
79
- deleteTicketModalConfirm: 'Delete',
80
- orderSummaryTitle: 'Order Summary',
81
- orderSummaryTickets: 'Ticket',
82
- orderSummaryTotal: 'Total',
83
- orderSummarySubmit: 'Submit',
84
- lastDrawResultsTitle: 'Résultats du dernier tirage',
85
- modalLogin: 'Please login to submit a ticket',
86
- },
87
- ar: {
88
- error: 'خطأ',
89
- title: 'كرونو',
90
- backButton: 'خلف',
91
- lobbyButton: 'ردهة',
92
- prize: 'جائزة',
93
- winUpTo: 'الفوز بما يصل الى',
94
- nextDraw: 'السحب التالي:',
95
- buy: 'اشتري تذاكر',
96
- viewLatest: 'عرض أحدث النتائج',
97
- createTicket: 'إنشاء تذكرة',
98
- modalSuccess: '!سيتم الشراء بنجاح قريبًا',
99
- deleteTicketModalTitle: 'حذف التذكرة',
100
- deleteTicketModalText: 'هل أنت متأكد أنك تريد حذف هذه التذكرة؟',
101
- deleteTicketModalCancel: 'يلغي',
102
- deleteTicketModalConfirm: 'حذف',
103
- orderSummaryTitle: 'ملخص الطلب',
104
- orderSummaryTickets: 'تذكرة',
105
- orderSummaryTotal: 'المجموع',
106
- orderSummarySubmit: 'يُقدِّم',
107
- lastDrawResultsTitle: 'نتائج آخر سحب',
108
- modalLogin: 'الرجاء تسجيل الدخول لتقديم تذكرة'
109
- }
110
- };
111
- const translate = (key, customLang) => {
112
- const lang = customLang;
113
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
114
- };
115
-
116
- /**
117
- * @name isMobile
118
- * @description A method that returns if the browser used to access the app is from a mobile device or not
119
- * @param {String} userAgent window.navigator.userAgent
120
- * @returns {Boolean} true or false
121
- */
122
- const isMobile = (userAgent) => {
123
- return !!(userAgent.toLowerCase().match(/android/i) ||
124
- userAgent.toLowerCase().match(/blackberry|bb/i) ||
125
- userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
126
- userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
127
- };
128
-
129
- const lotteryGamePageCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GamePage .GridBanner{background-color:#009993;background-repeat:no-repeat;background-position:center;color:#111;padding:0 20px 10px;height:220px;display:flex;flex-direction:column;justify-content:space-between}.GamePage .GridBanner .BannerButtonsWrapper{display:flex;justify-content:space-between;padding-top:16px}.GamePage .GridBanner .BannerButtonsWrapper .BannerBackButton,.GamePage .GridBanner .BannerButtonsWrapper .BannerLobbyButton{background:#fff;border:1px solid #D4D4D4;border-radius:4px;padding:7px 15px;font-size:12px;text-transform:uppercase;width:80px}.GamePage .GridBanner .GridBannerArea{padding-top:30px;display:flex;flex-direction:column;align-items:center}.GamePage .TotalWinnings{color:#000;font-size:18px;display:flex;flex-direction:row;justify-content:center;align-items:center;gap:10px;text-transform:uppercase}.GamePage .TotalWinnings span{font-size:18px;font-weight:700}.GamePage .NextDraw{color:#00958f;font-size:24px;font-weight:600;margin:0 auto;text-align:center;text-transform:uppercase;display:flex;justify-content:center;align-items:center;flex-direction:column}.GamePage .NextDraw .BannerText{font-weight:400;font-size:18px;text-transform:uppercase;padding:0;margin:15px 0 0 0}.GamePage .NextDraw .BannerCountdown{font-size:22px;color:#00958f;display:flex;gap:20px}.GamePage .Tabs{display:flex;justify-content:center;gap:10px}.GamePage .Tabs .TabButton{border-radius:4px;cursor:pointer;padding:8px 0;width:50%;max-width:200px;border:1px solid #00958f;background:#00958f;color:#fff;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.GamePage .Tabs .TabButton.Active{color:#00958f;background:#F1F1F1;border:1px solid #F1F1F1}.LastDrawResultsTitle{color:#009993;padding:25px 0 10px 0;text-align:center;border-radius:4px;text-transform:uppercase;font-size:16px;font-weight:600;margin:0}.NextDrawWrapper{padding:10px 15px;background:#F1F1F1;background:linear-gradient(0deg, #f1f1f1 0%, rgba(253, 187, 45, 0) 100%)}.NextDrawWrapper .BannerText{font-size:16px;font-weight:700;text-align:center}.NextDrawWrapper .BannerCountdown{font-size:22px;display:flex;gap:8px;color:#009993;font-weight:bolder;justify-content:center}.GamePageContent{padding:15px;max-width:1200px;margin:0 auto}.GameDetails{padding-bottom:10px;margin-bottom:20px}.CreateNewTicket{background:#004D4A;height:100px;width:100%;display:flex;margin-top:10px;flex-direction:column;justify-content:center;align-items:center}.CreateNewTicket button{cursor:pointer;display:inline-block;border-radius:50%;width:40px;height:40px;margin:5px;border:1px solid #FFF;background:#FFF;color:#004D4A;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.CreateNewTicket button:hover{background:#F1F1F1}.CreateNewTicket span{display:inline-block;font-size:12px;text-align:center;margin:0 auto;color:#FFF}.OrderSummary{min-width:200px;border-radius:4px;display:flex;flex-direction:column;justify-content:center;margin-top:20px;background:#fff}.OrderSummary .OrderSummaryTitle{font-size:16px;color:#009993;text-transform:uppercase;text-align:center}.OrderSummary .Ticket{display:inline-block;color:#000;font-size:14px;height:50px;border-bottom:solid 1px #D4D4D4;line-height:50px}.OrderSummary .Ticket span{text-align:right}.OrderSummary .Total{display:inline-block;color:#000;font-size:14px;height:50px;line-height:50px}.OrderSummary .Total span{text-align:right}.ButtonWrapper{display:flex;align-items:center;justify-content:center}.ButtonWrapper .Button{cursor:pointer;border-radius:4px;padding:8px 60px;width:max-content;margin:5px;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#009993;border:1px solid #009993;color:#FFF}.ButtonWrapper .Button:hover{background:#00ABA4}.ButtonWrapper .Button.ButtonDisabled{pointer-events:none;background:#ccc;border:1px solid #ccc}.SubmitModalSuccess{text-align:center;font-size:18px;padding:20px}.DeleteTicketModalWrapper{padding:20px;text-align:center}.DeleteTicketModalWrapper .DeleteTicketModalTitle{font-size:16px;color:#00958f;font-weight:400;text-transform:uppercase;margin:20px 0 40px}.DeleteTicketModalWrapper .DeleteTicketModalText{font-size:14px;color:#000;line-height:22px;margin-bottom:40px}.DeleteTicketModalWrapper .DeleteTicketModalButtons{display:flex;gap:10px;justify-content:center}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm{cursor:pointer;border-radius:4px;padding:8px 25px;width:max-content;margin:5px;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm:hover{background:#FF6536;border:1px solid #FF3D00}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel{cursor:pointer;width:max-content;border-radius:4px;padding:10px 25px;margin:5px;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel:hover{background:#F1F1F1}@media (min-width: 1200px){.GamePageContent .TicketsWrapper{float:left;width:49%}.GamePageContent .GameDetails{float:right;width:49%}.GamePageContent .OrderSummary{float:right;width:49%}}";
130
-
131
- const LotteryGamePage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
132
- constructor() {
133
- super();
134
- this.__registerHost();
135
- this.__attachShadow();
136
- /**
137
- * Language of the widget
138
- */
139
- this.language = 'en';
140
- /**
141
- * Shows the auto-pick button
142
- */
143
- this.autoPick = false;
144
- /**
145
- * Shows the reset button
146
- */
147
- this.resetButton = false;
148
- /**
149
- * Client custom styling via string
150
- */
151
- this.clientStyling = '';
152
- /**
153
- * Client custom styling via url
154
- */
155
- this.clientStylingurl = '';
156
- this.clientStylingUrlContent = '';
157
- this.tickets = [];
158
- this.tabIndex = 0;
159
- this.hasErrors = false;
160
- this.totalAmount = 0;
161
- this.successVisible = false;
162
- this.deleteVisible = false;
163
- this.latestDraw = {};
164
- this.totalWinningsAmount = 0;
165
- this.isLoggedIn = false;
166
- this.loginModalVisible = false;
167
- this.limitStylingAppends = false;
168
- // @TODO fix any type
169
- this.userAgent = window.navigator.userAgent;
170
- this.multiplier = false;
171
- this.quickPick = false;
172
- this.setClientStyling = () => {
173
- let sheet = document.createElement('style');
174
- sheet.innerHTML = this.clientStyling;
175
- this.stylingContainer.prepend(sheet);
176
- };
177
- this.setClientStylingURL = () => {
178
- let url = new URL(this.clientStylingurl);
179
- let cssFile = document.createElement('style');
180
- fetch(url.href)
181
- .then((res) => res.text())
182
- .then((data) => {
183
- this.clientStylingUrlContent = data;
184
- cssFile.innerHTML = data;
185
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
186
- })
187
- .catch((err) => {
188
- console.log('error ', err);
189
- });
190
- };
191
- }
192
- // @TODO fix `any` type later, I'm lazy now
193
- handleSessionIdValue() {
194
- this.isLoggedIn = true;
195
- }
196
- connectedCallback() {
197
- this.getGameDetails();
198
- this.getDraws();
199
- if (this.sessionId) {
200
- this.isLoggedIn = true;
201
- }
202
- }
203
- componentDidRender() {
204
- // start custom styling area
205
- if (!this.limitStylingAppends && this.stylingContainer) {
206
- if (this.clientStyling)
207
- this.setClientStyling();
208
- if (this.clientStylingurl)
209
- this.setClientStylingURL();
210
- this.limitStylingAppends = true;
211
- }
212
- // end custom styling area
213
- }
214
- countdownLogic(date) {
215
- if (date) {
216
- this.interval = setInterval(() => {
217
- this.daysRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60 * 24));
218
- this.hoursRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60) - this.daysRemaining * 24);
219
- this.minutesRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60) - this.daysRemaining * 24 * 60 - this.hoursRemaining * 60);
220
- this.secondsRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / 1000 - this.daysRemaining * 24 * 60 * 60 - this.hoursRemaining * 60 * 60 - this.minutesRemaining * 60);
221
- }, 1000);
222
- }
223
- }
224
- disconnectedCallback() {
225
- clearInterval(this.interval);
226
- }
227
- getGameDetails() {
228
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
229
- fetch(url.href)
230
- .then((res) => {
231
- if (res.status >= 300) {
232
- this.hasErrors = true;
233
- throw new Error('There was an error while fetching the data');
234
- }
235
- return res.json();
236
- })
237
- .then((data) => {
238
- this.gameData = data;
239
- this.basicStake = this.gameData.rules.stakes[0].amount;
240
- let draws = this.gameData.draws.filter((item) => !item.winningNumbers);
241
- this.nextDraw = draws[0].id;
242
- this.createNewTicket();
243
- })
244
- .catch((err) => {
245
- this.hasErrors = true;
246
- console.log('Error', err);
247
- });
248
- }
249
- calculateTotalAmount() {
250
- const { currency } = this.gameData.rules.stakes[0];
251
- this.totalAmount = 0;
252
- this.tickets.forEach((item) => {
253
- if (item.completed) {
254
- this.totalAmount += item.amount * item.stake;
255
- }
256
- });
257
- this.currency = currency;
258
- }
259
- // @TODO CustomEvent type
260
- gridFilledHandler(event) {
261
- // @TODO item ts
262
- this.tickets = this.tickets.map((item) => {
263
- if (item.ticketId == event.detail.id) {
264
- let arr = item.selectedNumbers || [];
265
- arr[event.detail.index] = event.detail.selectedNumbers.map((item) => parseInt(item, 10));
266
- return {
267
- gameId: item.gameId,
268
- ticketId: item.ticketId,
269
- completed: true,
270
- amount: event.detail.draws,
271
- stake: item.stake,
272
- selectedNumbers: arr
273
- };
274
- }
275
- return item;
276
- });
277
- this.calculateTotalAmount();
278
- }
279
- // @TODO fix any type
280
- gridDirtyHandler(event) {
281
- // @TODO item ts
282
- this.tickets = this.tickets.map((item) => {
283
- if (item.gameId == event.detail.id) {
284
- return {
285
- gameId: item.gameId,
286
- ticketId: item.ticketId,
287
- completed: false,
288
- amount: item.amount,
289
- stake: item.stake,
290
- grids: []
291
- };
292
- }
293
- return item;
294
- });
295
- }
296
- // @TODO CustomEvent type
297
- deleteTicketHandler(event) {
298
- this.deleteVisible = true;
299
- this.deleteEventData = event;
300
- }
301
- modalCloseEvent() {
302
- this.deleteVisible = false;
303
- this.loginModalVisible = false;
304
- }
305
- stakeChangeHandler(event) {
306
- const { ticketId, stake } = event.detail;
307
- this.tickets[ticketId - 1].stake = stake;
308
- this.calculateTotalAmount();
309
- }
310
- multiplierChangeHandler(event) {
311
- this.multiplier = event.detail;
312
- }
313
- getDraws() {
314
- // append from query param with the current date value in order to get the next draw
315
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws`);
316
- let drawOptions = {
317
- method: "GET",
318
- headers: {
319
- 'Content-Type': "application/json",
320
- 'Accept': 'application/json',
321
- },
322
- };
323
- fetch(url.href, drawOptions)
324
- .then((response) => {
325
- return response.json();
326
- })
327
- .then((data) => {
328
- var _a, _b;
329
- let upcoming = data.items.filter((item) => {
330
- if (Date.parse(item.date) > new Date().getTime()) {
331
- return !item.winningNumbers;
332
- }
333
- });
334
- let past = data.items.filter((item) => item.winningNumbers);
335
- this.latestDraw = upcoming[0] || {};
336
- this.nextDate = (_a = this.latestDraw) === null || _a === void 0 ? void 0 : _a.date;
337
- this.countdownLogic(this.nextDate || '');
338
- this.lastDrawId = past[past.length - 1].id;
339
- // calculate total winnings
340
- // @TODO fix any type
341
- (_b = this.latestDraw) === null || _b === void 0 ? void 0 : _b.prizes.forEach((element) => {
342
- this.totalWinningsAmount += JSON.parse(element.amount);
343
- });
344
- })
345
- .catch((err) => {
346
- console.log('error ', err);
347
- });
348
- }
349
- ;
350
- // @TODO fix any type
351
- confirmDeleteTicketHandler(event) {
352
- // @TODO fix any type
353
- this.tickets = this.tickets.filter((item) => {
354
- if (item.ticketId == event.detail.ticketId) {
355
- return false;
356
- }
357
- return true;
358
- });
359
- this.calculateTotalAmount();
360
- this.deleteVisible = false;
361
- }
362
- createNewTicket() {
363
- this.tickets = [
364
- ...this.tickets,
365
- { gameId: this.gameId, ticketId: this.tickets.length + 1, completed: false, amount: 1, stake: this.basicStake, grids: [] }
366
- ];
367
- }
368
- showLoginModal() {
369
- this.loginModalVisible = true;
370
- }
371
- submitTickets() {
372
- let url = new URL(`${this.endpoint}/tickets`);
373
- // @TODO Body TS type
374
- let body = {
375
- gameId: this.gameId,
376
- tickets: []
377
- };
378
- this.tickets.forEach((item) => {
379
- body.tickets.push({
380
- startingDrawId: this.nextDraw,
381
- amount: item.stake,
382
- gameId: this.gameId,
383
- currency: this.currency,
384
- selection: item.selectedNumbers,
385
- multiplier: this.multiplier,
386
- drawCount: item.amount,
387
- quickPick: this.quickPick,
388
- });
389
- });
390
- // @TODO Options TS type
391
- let options = {
392
- method: 'POST',
393
- headers: {
394
- 'Content-Type': 'application/json',
395
- 'Accept': 'application/json',
396
- 'Authorization': `Bearer ${this.sessionId}`
397
- },
398
- body: JSON.stringify(body)
399
- };
400
- fetch(url.href, options)
401
- .then((res) => {
402
- if (res.status > 300) {
403
- throw new Error('err');
404
- }
405
- return res.json();
406
- })
407
- .then((data) => {
408
- console.log('data', data);
409
- })
410
- .catch((err) => {
411
- console.log('error ', err);
412
- });
413
- this.successVisible = true;
414
- }
415
- render() {
416
- const backgroundSrc = getAssetPath('./static/chrono_lottery_mobile.png');
417
- const backgroundDesktopSrc = getAssetPath('./static/chrono_desktop.png');
418
- if (this.hasErrors) {
419
- return (h("div", { class: "GamePage" }, h("div", { class: "Title" }, translate('error', this.language))));
420
- }
421
- return (
422
- /* Game details */
423
- h("div", { class: "GamePage", dir: this.language == 'ar' ? 'rtl' : 'ltr', ref: el => this.stylingContainer = el }, h("div", { class: "GridBanner", style: { backgroundImage: isMobile(this.userAgent) ? `url(${backgroundSrc})` : `url(${backgroundDesktopSrc})` } }, h("div", { class: "BannerButtonsWrapper" }, h("button", { class: "BannerBackButton" }, h("span", { class: "BannerBackButtonArrow" }, "\u1438 "), translate('backButton', this.language)), h("button", { class: "BannerLobbyButton" }, translate('lobbyButton', this.language))), h("div", { class: "Tabs" }, h("div", { class: 'TabButton' + (this.tabIndex == 0 ? ' Active' : ''), onClick: () => this.tabIndex = 0 }, translate('buy', this.language)), h("div", { class: 'TabButton' + (this.tabIndex == 1 ? ' Active' : ''), onClick: () => this.tabIndex = 1 }, translate('viewLatest', this.language)))), h("div", { class: "NextDrawWrapper" }, h("div", { class: "TotalWinnings" }, translate('winUpTo', this.language), ": ", h("span", null, "$", this.totalWinningsAmount.toLocaleString('en-US', { maximumFractionDigits: 2 }))), h("div", { class: "NextDraw" }, h("p", { class: "BannerText" }, translate('nextDraw', this.language)), h("div", { class: "BannerCountdown" }, h("span", { class: "CountdownDays" }, this.daysRemaining, "D"), h("span", { class: "CountdownHours" }, this.hoursRemaining, "H"), h("span", { class: "CountdownMinutes" }, this.minutesRemaining, "M"), h("span", { class: "CountdownSeconds" }, this.secondsRemaining, "S")))), this.tabIndex == 0 &&
424
- h("div", { class: "GamePageContent" }, h("div", { class: "GameDetails" }, h("lottery-game-details", { "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("div", { class: "TicketsWrapper" }, 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, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("div", { class: "CreateNewTicket" }, h("button", { onClick: () => this.createNewTicket() }, "+"), h("span", null, translate('createTicket', this.language)))), h("div", { class: "OrderSummary" }, h("h3", { class: "OrderSummaryTitle" }, translate('orderSummaryTitle', this.language)), h("div", { class: "Ticket" }, translate('orderSummaryTickets', this.language), ": ", h("span", null, this.tickets.length)), h("div", { class: "Total" }, translate('orderSummaryTotal', this.language), ": ", h("span", null, this.totalAmount, " ", this.currency)), h("div", { class: "ButtonWrapper" }, this.isLoggedIn &&
425
- h("span", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language)), !this.isLoggedIn &&
426
- h("div", null, h("span", { class: "Button", onClick: () => this.showLoginModal() }, translate('orderSummarySubmit', this.language)), h("helper-modal", { "title-modal": "Success", visible: this.loginModalVisible, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("p", { class: "SubmitModalSuccess" }, translate('modalLogin', this.language))))))), this.tabIndex == 1 &&
427
- h("div", null, h("h4", { class: "LastDrawResultsTitle" }, translate('lastDrawResultsTitle', this.language)), h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "draw-id": this.lastDrawId, "draw-mode": true, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }), h("lottery-draw-results-history", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("helper-modal", { "title-modal": "Success", visible: this.successVisible, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("p", { class: "SubmitModalSuccess" }, translate('modalSuccess', this.language))), h("helper-modal", { "title-modal": "Delete Ticket", visible: this.deleteVisible, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("div", { class: "DeleteTicketModalWrapper" }, h("h3", { class: "DeleteTicketModalTitle" }, translate('deleteTicketModalTitle', this.language)), h("p", { class: "DeleteTicketModalText" }, translate('deleteTicketModalText', this.language)), h("div", { class: "DeleteTicketModalButtons" }, h("button", { class: "DeleteTicketModalCancel", onClick: () => this.modalCloseEvent() }, translate('deleteTicketModalCancel', this.language)), h("button", { class: "DeleteTicketModalConfirm", onClick: () => this.confirmDeleteTicketHandler(this.deleteEventData) }, translate('deleteTicketModalConfirm', this.language)))))));
428
- }
429
- static get assetsDirs() { return ["static"]; }
430
- get element() { return this; }
431
- static get watchers() { return {
432
- "sessionId": ["handleSessionIdValue"]
433
- }; }
434
- static get style() { return lotteryGamePageCss; }
435
- }, [1, "lottery-game-page", {
436
- "endpoint": [1],
437
- "gameId": [1, "game-id"],
438
- "playerId": [2, "player-id"],
439
- "sessionId": [1, "session-id"],
440
- "language": [1],
441
- "autoPick": [4, "auto-pick"],
442
- "resetButton": [4, "reset-button"],
443
- "clientStyling": [1, "client-styling"],
444
- "clientStylingurl": [1, "client-stylingurl"],
445
- "clientStylingUrlContent": [32],
446
- "tickets": [32],
447
- "tabIndex": [32],
448
- "hasErrors": [32],
449
- "totalAmount": [32],
450
- "successVisible": [32],
451
- "deleteVisible": [32],
452
- "deleteEventData": [32],
453
- "daysRemaining": [32],
454
- "hoursRemaining": [32],
455
- "minutesRemaining": [32],
456
- "secondsRemaining": [32],
457
- "latestDraw": [32],
458
- "totalWinningsAmount": [32],
459
- "nextDate": [32],
460
- "isLoggedIn": [32],
461
- "loginModalVisible": [32],
462
- "limitStylingAppends": [32]
463
- }, [[0, "ticketCompleted", "gridFilledHandler"], [0, "gridDirty", "gridDirtyHandler"], [0, "deleteTicket", "deleteTicketHandler"], [0, "modalCloseEvent", "modalCloseEvent"], [0, "stakeChange", "stakeChangeHandler"], [0, "multiplierChange", "multiplierChangeHandler"]]]);
464
- function defineCustomElement$1() {
465
- if (typeof customElements === "undefined") {
466
- return;
467
- }
468
- const components = ["lottery-game-page", "helper-accordion", "helper-filters", "helper-modal", "helper-tab", "helper-tabs", "lottery-bullet", "lottery-draw-results", "lottery-draw-results-history", "lottery-game-details", "lottery-grid", "lottery-ticket", "lottery-ticket-controller"];
469
- components.forEach(tagName => { switch (tagName) {
470
- case "lottery-game-page":
471
- if (!customElements.get(tagName)) {
472
- customElements.define(tagName, LotteryGamePage$1);
473
- }
474
- break;
475
- case "helper-accordion":
476
- if (!customElements.get(tagName)) {
477
- defineCustomElement$d();
478
- }
479
- break;
480
- case "helper-filters":
481
- if (!customElements.get(tagName)) {
482
- defineCustomElement$c();
483
- }
484
- break;
485
- case "helper-modal":
486
- if (!customElements.get(tagName)) {
487
- defineCustomElement$b();
488
- }
489
- break;
490
- case "helper-tab":
491
- if (!customElements.get(tagName)) {
492
- defineCustomElement$a();
493
- }
494
- break;
495
- case "helper-tabs":
496
- if (!customElements.get(tagName)) {
497
- defineCustomElement$9();
498
- }
499
- break;
500
- case "lottery-bullet":
501
- if (!customElements.get(tagName)) {
502
- defineCustomElement$8();
503
- }
504
- break;
505
- case "lottery-draw-results":
506
- if (!customElements.get(tagName)) {
507
- defineCustomElement$7();
508
- }
509
- break;
510
- case "lottery-draw-results-history":
511
- if (!customElements.get(tagName)) {
512
- defineCustomElement$6();
513
- }
514
- break;
515
- case "lottery-game-details":
516
- if (!customElements.get(tagName)) {
517
- defineCustomElement$5();
518
- }
519
- break;
520
- case "lottery-grid":
521
- if (!customElements.get(tagName)) {
522
- defineCustomElement$4();
523
- }
524
- break;
525
- case "lottery-ticket":
526
- if (!customElements.get(tagName)) {
527
- defineCustomElement$3();
528
- }
529
- break;
530
- case "lottery-ticket-controller":
531
- if (!customElements.get(tagName)) {
532
- defineCustomElement$2();
533
- }
534
- break;
535
- } });
536
- }
537
- defineCustomElement$1();
538
-
539
- const LotteryGamePage = LotteryGamePage$1;
540
- const defineCustomElement = defineCustomElement$1;
541
-
542
- export { LotteryGamePage, defineCustomElement };
@@ -1,6 +0,0 @@
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 };