@everymatrix/lottery-game-page 0.0.6 → 0.0.7
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.
- package/dist/cjs/index-af6d701d.js +1209 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/lottery-game-page.cjs.entry.js +304 -0
- package/dist/cjs/lottery-game-page.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/lottery-game-page/lottery-game-page.css +305 -0
- package/dist/collection/components/lottery-game-page/lottery-game-page.js +496 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +50 -0
- package/dist/collection/utils/utils.js +12 -0
- package/dist/components/assets/chrono_desktop.png +0 -0
- package/dist/components/assets/chrono_lottery_mobile.png +0 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +2 -0
- package/dist/components/lottery-game-page.d.ts +11 -0
- package/dist/components/lottery-game-page.js +340 -0
- package/dist/esm/index-8c700c5e.js +1183 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/lottery-game-page.entry.js +300 -0
- package/dist/esm/lottery-game-page.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lottery-game-page/index.esm.js +0 -0
- package/dist/lottery-game-page/lottery-game-page.esm.js +1 -0
- package/dist/lottery-game-page/p-453db7fa.entry.js +1 -0
- package/dist/lottery-game-page/p-b5969eab.js +2 -0
- package/dist/stencil.config.js +29 -0
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-game-page/.stencil/packages/lottery-game-page/stencil.config.d.ts +2 -0
- package/dist/types/components/lottery-game-page/lottery-game-page.d.ts +74 -0
- package/dist/types/components.d.ts +93 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +7 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +1 -1
- 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
|
+
};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* LotteryGamePage custom elements */
|
|
2
|
+
export { LotteryGamePage as LotteryGamePage } from '../types/components/lottery-game-page/lottery-game-page';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Used to manually set the base path where assets can be found.
|
|
6
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
7
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
8
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
9
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
10
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
11
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
12
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
13
|
+
*/
|
|
14
|
+
export declare const setAssetPath: (path: string) => void;
|
|
15
|
+
|
|
16
|
+
export interface SetPlatformOptions {
|
|
17
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
18
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
19
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
22
|
+
export * from '../types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface LotteryGamePage extends Components.LotteryGamePage, HTMLElement {}
|
|
4
|
+
export const LotteryGamePage: {
|
|
5
|
+
prototype: LotteryGamePage;
|
|
6
|
+
new (): LotteryGamePage;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|