@everymatrix/lottery-game-page 1.52.5 → 1.53.0

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 (26) hide show
  1. package/dist/cjs/{helper-accordion_13.cjs.entry.js → helper-accordion_14.cjs.entry.js} +3896 -439
  2. package/dist/cjs/index-3ecbfc1b.js +2 -6
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/lottery-game-page.cjs.js +1 -1
  5. package/dist/collection/collection-manifest.json +6 -6
  6. package/dist/collection/components/lottery-game-page/lottery-game-page.css +70 -53
  7. package/dist/collection/components/lottery-game-page/lottery-game-page.js +210 -154
  8. package/dist/collection/components/static/chrono_desktop.png +0 -0
  9. package/dist/collection/components/static/chrono_lottery_mobile.png +0 -0
  10. package/dist/collection/utils/locale.utils.js +16 -1
  11. package/dist/collection/utils/utils.js +6 -0
  12. package/dist/esm/{helper-accordion_13.entry.js → helper-accordion_14.entry.js} +3896 -440
  13. package/dist/esm/index-7ea78a23.js +2 -6
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm/lottery-game-page.js +1 -1
  16. package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
  17. package/dist/lottery-game-page/{p-41527e32.entry.js → p-dee70ec2.entry.js} +1061 -137
  18. package/dist/static/chrono_desktop.png +0 -0
  19. package/dist/static/chrono_lottery_mobile.png +0 -0
  20. package/dist/types/components/lottery-game-page/lottery-game-page.d.ts +17 -17
  21. package/dist/types/components.d.ts +8 -16
  22. package/dist/types/utils/utils.d.ts +1 -0
  23. package/package.json +1 -1
  24. package/dist/cjs/helper-pagination.cjs.entry.js +0 -227
  25. package/dist/esm/helper-pagination.entry.js +0 -223
  26. package/dist/lottery-game-page/p-dd23f58f.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { h, getAssetPath } from "@stencil/core";
2
2
  import { translate } from "../../utils/locale.utils";
3
- import { isMobile } from "../../utils/utils";
3
+ import { isMobile, generateUUID } from "../../utils/utils";
4
4
  import "../../../../../lottery-ticket-controller/dist/types/index";
5
5
  import "../../../../../helper-modal/dist/types/index";
6
6
  import "../../../../../lottery-game-details/dist/types/index";
@@ -10,9 +10,10 @@ export class LotteryGamePage {
10
10
  constructor() {
11
11
  // @TODO fix any type
12
12
  this.userAgent = window.navigator.userAgent;
13
- this.multiplier = false;
14
13
  this.quickPick = false;
14
+ this.gameData = {};
15
15
  this.isMobile = isMobile(this.userAgent);
16
+ this.secondarySelectionAllowed = false;
16
17
  this.setClientStyling = () => {
17
18
  let sheet = document.createElement('style');
18
19
  sheet.innerHTML = this.clientStyling;
@@ -33,38 +34,38 @@ export class LotteryGamePage {
33
34
  });
34
35
  };
35
36
  this.endpoint = undefined;
37
+ this.endpointTicket = undefined;
36
38
  this.gameId = undefined;
37
39
  this.playerId = undefined;
38
40
  this.sessionId = undefined;
39
41
  this.language = 'en';
40
42
  this.backgroundUrl = undefined;
41
- this.autoPick = false;
42
- this.resetButton = false;
43
43
  this.clientStyling = '';
44
44
  this.clientStylingurl = '';
45
45
  this.clientStylingUrlContent = '';
46
46
  this.tickets = [];
47
+ this.mainTickets = [];
48
+ this.secondaryTickets = [];
47
49
  this.tabIndex = 0;
48
50
  this.hasErrors = false;
49
51
  this.totalAmount = 0;
50
52
  this.successVisible = false;
51
- this.deleteVisible = false;
52
- this.deleteEventData = undefined;
53
53
  this.daysRemaining = undefined;
54
54
  this.hoursRemaining = undefined;
55
55
  this.minutesRemaining = undefined;
56
56
  this.secondsRemaining = undefined;
57
- this.latestDraw = {};
58
- this.totalWinningsAmount = 0;
59
57
  this.nextDate = undefined;
60
58
  this.isLoggedIn = false;
61
59
  this.loginModalVisible = false;
62
60
  this.limitStylingAppends = false;
61
+ this.isLoading = false;
62
+ this.showSubmitError = false;
63
+ this.submitError = '';
64
+ this.showApiError = false;
65
+ this.apiError = '';
63
66
  }
64
- // @TODO fix `any` type later, I'm lazy now
65
67
  connectedCallback() {
66
68
  this.getGameDetails();
67
- this.getDraws();
68
69
  if (this.sessionId) {
69
70
  this.isLoggedIn = true;
70
71
  }
@@ -102,9 +103,16 @@ export class LotteryGamePage {
102
103
  return res.json();
103
104
  })
104
105
  .then((data) => {
106
+ var _a, _b;
105
107
  this.gameData = data;
106
- this.basicStake = this.gameData.type.stakes[0].amount;
107
- let draws = this.gameData.draws.filter((item) => !item.winningNumbers);
108
+ this.basicStake = this.gameData.rules.stakes.length ? Number(this.gameData.rules.stakes[0].value) : 0;
109
+ this.basicLine = ((_a = this.gameData.rules.betTypes) === null || _a === void 0 ? void 0 : _a.length) ? this.gameData.rules.betTypes[0].boardsAllowed[0] : 1;
110
+ this.basicBetType = this.gameData.rules.betTypes[0];
111
+ this.nextDate = (_b = this.gameData.currentDraw) === null || _b === void 0 ? void 0 : _b.date;
112
+ this.nextDate && this.countdownLogic(this.nextDate);
113
+ this.secondarySelectionAllowed = this.gameData.rules.secondarySelectionAllowed === "INPUT" ? true : false;
114
+ this.quickPick = this.gameData.rules.quickPickAvailable;
115
+ let draws = this.gameData.draws ? this.gameData.draws.filter((item) => !item.winningNumbers) : [];
108
116
  draws.length > 0 && (this.nextDraw = draws[0].id);
109
117
  this.createNewTicket();
110
118
  })
@@ -114,11 +122,12 @@ export class LotteryGamePage {
114
122
  });
115
123
  }
116
124
  calculateTotalAmount() {
117
- const { currency } = this.gameData.type.stakes[0];
125
+ const { currency } = this.gameData.rules.stakes[0];
118
126
  this.totalAmount = 0;
119
- this.tickets.forEach((item) => {
120
- if (item.completed) {
121
- this.totalAmount += item.amount * item.stake;
127
+ this.mainTickets.forEach((item) => {
128
+ var _a;
129
+ if (item.completed.every((v) => v)) {
130
+ this.totalAmount += (item.drawCount) * (item.stake || this.basicStake) * (item.multiplierNum) * (item.lineNum) * ((_a = item.betType) === null || _a === void 0 ? void 0 : _a.combinations);
122
131
  }
123
132
  });
124
133
  this.currency = currency;
@@ -126,161 +135,205 @@ export class LotteryGamePage {
126
135
  // @TODO CustomEvent type
127
136
  gridFilledHandler(event) {
128
137
  // @TODO item ts
129
- this.tickets = this.tickets.map((item) => {
138
+ let tickets = event.detail.selectionType === 'secondarySelection' ? this.secondaryTickets : this.mainTickets;
139
+ tickets = tickets.map((item) => {
130
140
  if (item.ticketId == event.detail.id) {
131
141
  let arr = item.selectedNumbers || [];
132
142
  arr[event.detail.index] = event.detail.selectedNumbers.map((item) => parseInt(item, 10));
143
+ let completed = item.completed || [];
144
+ completed[event.detail.index] = true;
133
145
  return {
134
146
  gameId: item.gameId,
135
147
  ticketId: item.ticketId,
136
- completed: true,
137
- amount: event.detail.draws,
138
- stake: item.stake,
139
- selectedNumbers: arr
148
+ completed: completed,
149
+ drawCount: event.detail.drawCount,
150
+ stake: item.stake || this.basicStake,
151
+ selectedNumbers: arr,
152
+ multiplierNum: event.detail.multiplierNum,
153
+ multiplier: event.detail.multiplier,
154
+ lineNum: item.lineNum,
155
+ betType: item.betType,
140
156
  };
141
157
  }
142
158
  return item;
143
159
  });
160
+ if (event.detail.selectionType === 'secondarySelection') {
161
+ this.secondaryTickets = tickets;
162
+ }
163
+ else {
164
+ this.mainTickets = tickets;
165
+ }
144
166
  this.calculateTotalAmount();
145
167
  }
146
168
  // @TODO fix any type
147
169
  gridDirtyHandler(event) {
148
170
  // @TODO item ts
149
- this.tickets = this.tickets.map((item) => {
150
- if (item.gameId == event.detail.id) {
171
+ let tickets = event.detail.selectionType === 'secondarySelection' ? this.secondaryTickets : this.mainTickets;
172
+ tickets = tickets.map((item) => {
173
+ if (item.ticketId == event.detail.id) {
174
+ let arr = item.selectedNumbers || [];
175
+ arr[event.detail.index] = event.detail.selectedNumbers.map((item) => parseInt(item, 10));
176
+ let completed = item.completed || [];
177
+ completed[event.detail.index] = false;
151
178
  return {
152
179
  gameId: item.gameId,
153
180
  ticketId: item.ticketId,
154
- completed: false,
155
- amount: item.amount,
181
+ completed: completed,
182
+ drawCount: item.drawCount,
156
183
  stake: item.stake,
157
- grids: []
184
+ selectedNumbers: arr,
185
+ multiplierNum: item.multiplierNum,
186
+ multiplier: item.multiplier,
187
+ lineNum: item.lineNum,
188
+ betType: item.betType,
158
189
  };
159
190
  }
160
- return item;
191
+ else {
192
+ return item;
193
+ }
161
194
  });
162
- }
163
- // @TODO CustomEvent type
164
- deleteTicketHandler(event) {
165
- this.deleteVisible = true;
166
- this.deleteEventData = event;
195
+ if (event.detail.selectionType === 'secondarySelection') {
196
+ this.secondaryTickets = tickets;
197
+ }
198
+ else {
199
+ this.mainTickets = tickets;
200
+ }
201
+ this.calculateTotalAmount();
167
202
  }
168
203
  modalCloseEvent() {
169
- this.deleteVisible = false;
170
204
  this.loginModalVisible = false;
205
+ this.successVisible = false;
171
206
  }
172
207
  stakeChangeHandler(event) {
173
208
  const { ticketId, stake } = event.detail;
174
- this.tickets[ticketId - 1].stake = stake;
209
+ this.mainTickets[ticketId - 1].stake = stake;
175
210
  this.calculateTotalAmount();
176
211
  }
177
212
  multiplierChangeHandler(event) {
178
- this.multiplier = event.detail;
179
- }
180
- getDraws() {
181
- // append from query param with the current date value in order to get the next draw
182
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws`);
183
- let drawOptions = {
184
- method: "GET",
185
- headers: {
186
- 'Content-Type': "application/json",
187
- 'Accept': 'application/json',
188
- },
189
- };
190
- fetch(url.href, drawOptions)
191
- .then((response) => {
192
- return response.json();
193
- })
194
- .then((data) => {
195
- var _a;
196
- let upcoming = data.items.filter((item) => {
197
- if (Date.parse(item.date) > new Date().getTime()) {
198
- return !item.winningNumbers;
199
- }
200
- });
201
- let past = data.items.filter((item) => item.winningNumbers);
202
- if (!upcoming[0])
203
- return;
204
- this.latestDraw = upcoming[0];
205
- this.nextDate = this.latestDraw.date;
206
- this.countdownLogic(this.nextDate);
207
- this.lastDrawId = past[past.length - 1].id;
208
- // calculate total winnings
209
- // @TODO fix any type
210
- (_a = this.latestDraw) === null || _a === void 0 ? void 0 : _a.prizes.forEach((element) => {
211
- this.totalWinningsAmount += JSON.parse(element.amount);
212
- });
213
- })
214
- .catch((err) => {
215
- console.log('error ', err);
216
- });
213
+ const { ticketId, multiplierNum, multiplier } = event.detail;
214
+ this.mainTickets[ticketId - 1].multiplierNum = multiplierNum;
215
+ this.mainTickets[ticketId - 1].multiplier = multiplier;
216
+ this.calculateTotalAmount();
217
217
  }
218
- ;
219
- // @TODO fix any type
220
- confirmDeleteTicketHandler(event) {
221
- // @TODO fix any type
222
- this.tickets = this.tickets.filter((item) => {
223
- if (item.ticketId == event.detail.ticketId) {
224
- return false;
225
- }
226
- return true;
227
- });
218
+ drawMultiplierChangeHandler(event) {
219
+ const { ticketId, drawCount } = event.detail;
220
+ this.mainTickets[ticketId - 1].drawCount = drawCount;
228
221
  this.calculateTotalAmount();
229
- this.deleteVisible = false;
222
+ }
223
+ lineMultiplierChangeHandler(event) {
224
+ const { ticketId, lineNum } = event.detail;
225
+ this.mainTickets[ticketId - 1].lineNum = lineNum;
226
+ this.mainTickets[ticketId - 1].completed = Array.from({ length: lineNum }, (_) => false);
227
+ this.mainTickets[ticketId - 1].selectedNumbers = [];
228
+ }
229
+ betTypeChangeHandler(event) {
230
+ const { ticketId, betType } = event.detail;
231
+ this.mainTickets[ticketId - 1].betType = betType;
230
232
  }
231
233
  createNewTicket() {
232
- this.tickets = [
233
- ...this.tickets,
234
- { gameId: this.gameId, ticketId: this.tickets.length + 1, completed: false, amount: 1, stake: this.basicStake, grids: [] }
234
+ this.mainTickets = [
235
+ ...this.mainTickets,
236
+ { gameId: this.gameId, ticketId: this.mainTickets.length + 1, drawCount: 1, multiplierNum: 1, completed: [false], stake: this.basicStake, betType: this.basicBetType, lineNum: this.basicLine }
237
+ ];
238
+ this.secondaryTickets = [
239
+ ...this.secondaryTickets,
240
+ { gameId: this.gameId, ticketId: this.secondaryTickets.length + 1, drawCount: 1, multiplierNum: 1, completed: [false], stake: this.basicStake, betType: this.basicBetType, lineNum: this.basicLine }
235
241
  ];
236
242
  }
237
243
  showLoginModal() {
238
244
  this.loginModalVisible = true;
239
245
  }
240
246
  submitTickets() {
241
- let url = new URL(`${this.endpoint}/tickets`);
247
+ let url = new URL(`${this.endpointTicket}/tickets`);
242
248
  // @TODO Body TS type
243
249
  let body = {
244
- gameId: this.gameId,
250
+ playerId: this.playerId.toString(),
245
251
  tickets: []
246
252
  };
247
- this.tickets.forEach((item) => {
253
+ let secondaryDirtyTicketLines = [];
254
+ if (this.secondarySelectionAllowed) {
255
+ // Only one ticket on the page,but there are multiple ticket lines. So we need to get the indices of the dirty lines
256
+ secondaryDirtyTicketLines = this.secondaryTickets[0].completed.reduce((indices, element, index) => {
257
+ if (!element) {
258
+ indices.push(index);
259
+ }
260
+ return indices;
261
+ }, []);
262
+ }
263
+ let dirtyTicketLines = this.mainTickets[0].completed.reduce((indices, element, index) => {
264
+ if (!element) {
265
+ indices.push(index);
266
+ }
267
+ return indices;
268
+ }, []);
269
+ let mergedUniqueArray = [...new Set([...secondaryDirtyTicketLines, ...dirtyTicketLines])].sort((a, b) => a - b);
270
+ ;
271
+ if (mergedUniqueArray.length) {
272
+ this.showSubmitError = true;
273
+ let lines = mergedUniqueArray.map(item => `Line${item + 1}`).join();
274
+ this.submitError = `The number of the selected number(s) on ${lines} is invalid.`;
275
+ setTimeout(() => {
276
+ this.showSubmitError = false;
277
+ }, 3000);
278
+ return;
279
+ }
280
+ this.mainTickets.forEach((item, index) => {
281
+ var _a;
248
282
  body.tickets.push({
249
283
  startingDrawId: this.nextDraw,
250
- amount: item.stake,
284
+ amount: (item.stake * item.drawCount * item.multiplierNum * (item.lineNum || 1) * ((_a = item.betType) === null || _a === void 0 ? void 0 : _a.combinations)).toString(),
251
285
  gameId: this.gameId,
286
+ gameName: this.gameData.name,
252
287
  currency: this.currency,
253
- selection: item.selectedNumbers,
254
- multiplier: this.multiplier,
255
- drawCount: item.amount,
288
+ selection: item.selectedNumbers.map((v, i) => {
289
+ var _a;
290
+ return {
291
+ betType: ((_a = item.betType) === null || _a === void 0 ? void 0 : _a.id) || this.gameData.rules.defaultBetType,
292
+ stake: item.stake,
293
+ selections: v,
294
+ secondarySelections: this.secondarySelectionAllowed ? this.secondaryTickets[index].selectedNumbers[i] : []
295
+ };
296
+ }),
297
+ multiplier: item.multiplier,
298
+ multiplierNum: item.multiplierNum,
299
+ drawCount: item.drawCount,
256
300
  quickPick: this.quickPick,
257
301
  });
258
302
  });
303
+ const uuid = generateUUID();
259
304
  // @TODO Options TS type
260
305
  let options = {
261
306
  method: 'POST',
262
307
  headers: {
263
308
  'Content-Type': 'application/json',
264
309
  'Accept': 'application/json',
265
- 'Authorization': `Bearer ${this.sessionId}`
310
+ 'Authorization': `Bearer ${this.sessionId}`,
311
+ 'X-Idempotency-Key': uuid
266
312
  },
267
313
  body: JSON.stringify(body)
268
314
  };
315
+ this.isLoading = true;
269
316
  fetch(url.href, options)
270
317
  .then((res) => {
271
318
  if (res.status > 300) {
272
- throw new Error('err');
319
+ this.apiError = res.statusText + '.';
320
+ this.showApiError = true;
321
+ setTimeout(() => {
322
+ this.showApiError = false;
323
+ }, 3000);
324
+ throw new Error(res.statusText);
273
325
  }
274
326
  return res.json();
275
327
  })
276
- .then((data) => {
277
- // should we treat this res?
278
- console.log('data', data);
328
+ .then(() => {
329
+ this.successVisible = true;
279
330
  })
280
331
  .catch((err) => {
281
- console.log('error ', err);
332
+ console.log('Error ', err);
333
+ })
334
+ .finally(() => {
335
+ this.isLoading = false;
282
336
  });
283
- this.successVisible = true;
284
337
  }
285
338
  goBack() {
286
339
  this.goBackEvent.emit();
@@ -289,18 +342,25 @@ export class LotteryGamePage {
289
342
  this.goToLobbyEvent.emit();
290
343
  }
291
344
  render() {
345
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
292
346
  //Get path for background image
293
- const backgroundImagePath = getAssetPath(this.isMobile ? '/assets/chrono_lottery_mobile.png' : '/assets/chrono_desktop.png');
347
+ const backgroundImagePath = getAssetPath(this.isMobile ? '../static/chrono_lottery_mobile.png' : '../static/chrono_desktop.png');
294
348
  if (this.hasErrors) {
295
349
  return (h("div", { class: "GamePage" }, h("div", { class: "Title" }, translate('error', this.language))));
296
350
  }
297
351
  return (
298
352
  /* Game details */
299
- h("div", { class: "GamePage", dir: this.language == 'ar' ? 'rtl' : 'ltr', ref: el => this.stylingContainer = el }, h("div", { class: "GridBanner", style: { 'background': `url(${this.backgroundUrl ? this.backgroundUrl : backgroundImagePath})`, 'background-size': 'contain', 'background-repeat': 'no-repeat', 'background-position': 'center' } }, h("div", { class: "BannerButtonsWrapper" }, h("button", { class: "BannerBackButton", onClick: this.goBack.bind(this) }, h("span", { class: "BannerBackButtonArrow" }, "\u1438 "), translate('backButton', this.language)), h("button", { class: "BannerLobbyButton", onClick: this.goToLobby.bind(this) }, 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 &&
300
- 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, "total-controllers": this.tickets.length, "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("hr", null), h("div", { class: "Total" }, translate('orderSummaryTotal', this.language), ": ", h("span", null, this.totalAmount, " ", this.currency)), h("div", { class: "ButtonWrapper" }, this.isLoggedIn &&
301
- h("span", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language)), !this.isLoggedIn &&
353
+ h("div", { class: "GamePage", dir: this.language == 'ar' ? 'rtl' : 'ltr', ref: el => this.stylingContainer = el }, h("div", { class: "GridBanner", style: { 'background': `url(${this.backgroundUrl ? this.backgroundUrl : backgroundImagePath})`, 'background-size': 'contain', 'background-repeat': 'no-repeat', 'background-position': 'center' } }, h("div", { class: "BannerButtonsWrapper" }), 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" }, this.nextDate && 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 &&
354
+ h("div", { class: "GamePageContent" }, h("div", { class: "GameDetails" }, h("lottery-game-details", { "low-number": (_b = (_a = this.gameData.rules) === null || _a === void 0 ? void 0 : _a.boards[0]) === null || _b === void 0 ? void 0 : _b.lowNumber, "high-number": (_d = (_c = this.gameData.rules) === null || _c === void 0 ? void 0 : _c.boards[0]) === null || _d === void 0 ? void 0 : _d.highNumber, "minimum-allowed": (_f = (_e = this.gameData.rules) === null || _e === void 0 ? void 0 : _e.boards[0]) === null || _f === void 0 ? void 0 : _f.minimumAllowed, "maxinum-allowed": (_h = (_g = this.gameData.rules) === null || _g === void 0 ? void 0 : _g.boards[0]) === null || _h === void 0 ? void 0 : _h.maxinumAllowed, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("div", { class: "TicketsWrapper" }, this.mainTickets.map((item) => {
355
+ var _a, _b;
356
+ return h("lottery-ticket-controller", { endpoint: this.endpoint, "ticket-id": item.ticketId, "game-id": item.gameId, collapsed: false, last: true, language: this.language, "auto-pick": (_a = this.gameData.rules) === null || _a === void 0 ? void 0 : _a.quickPickAvailable, "reset-button": (_b = this.gameData.rules) === null || _b === void 0 ? void 0 : _b.quickPickAvailable, "total-controllers": this.mainTickets.length, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent });
357
+ })), h("div", { class: "OrderSummary" }, h("h3", { class: "OrderSummaryTitle" }, translate('orderSummaryTitle', this.language)), h("div", { class: "OrderTicketInfo" }, h("div", { class: "Ticket" }, translate('orderSummaryTickets', this.language), ": ", h("span", null, this.mainTickets.length)), h("div", null, h("span", null, ((_k = (_j = this.mainTickets[0]) === null || _j === void 0 ? void 0 : _j.betType) === null || _k === void 0 ? void 0 : _k.combinations) * ((_l = this.mainTickets[0]) === null || _l === void 0 ? void 0 : _l.lineNum)), h("span", { class: "Multiplier" }, "x"), ((_m = this.gameData.rules) === null || _m === void 0 ? void 0 : _m.stakeMultiplierAvailable) &&
358
+ h("span", null, h("span", null, ((_o = this.mainTickets[0]) === null || _o === void 0 ? void 0 : _o.multiplierNum) === 1 ? `${(_p = this.mainTickets[0]) === null || _p === void 0 ? void 0 : _p.multiplierNum} Multiplier` : `${(_q = this.mainTickets[0]) === null || _q === void 0 ? void 0 : _q.multiplierNum} Multipliers`), h("span", { class: "Multiplier" }, "x")), h("span", null, `${(_r = this.mainTickets[0]) === null || _r === void 0 ? void 0 : _r.stake} EUR`), ((_s = this.gameData.rules) === null || _s === void 0 ? void 0 : _s.drawMultiplierAvailable) &&
359
+ h("span", null, h("span", { class: "Multiplier" }, "x"), h("span", null, ((_t = this.mainTickets[0]) === null || _t === void 0 ? void 0 : _t.drawCount) === 1 ? `${(_u = this.mainTickets[0]) === null || _u === void 0 ? void 0 : _u.drawCount} Draw` : `${(_v = this.mainTickets[0]) === null || _v === void 0 ? void 0 : _v.drawCount} Draws`)))), h("hr", null), h("div", { class: "Total" }, translate('orderSummaryTotal', this.language), ": ", h("span", null, this.totalAmount, " ", this.currency)), h("div", { class: "ButtonWrapper" }, this.isLoggedIn &&
360
+ h("div", null, !this.isLoading &&
361
+ h("div", { class: "submitWrap" }, h("div", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language)), this.showSubmitError && h("div", { class: 'submitError' }, this.submitError), this.showApiError && h("div", { class: 'submitError' }, this.apiError)), this.isLoading && h("span", { class: "Button", style: { "cursor": "default" } }, translate('loading', this.language))), !this.isLoggedIn &&
302
362
  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 &&
303
- 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)))))));
363
+ h("div", null, 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('submitSuccess', this.language)))));
304
364
  }
305
365
  static get is() { return "lottery-game-page"; }
306
366
  static get encapsulation() { return "shadow"; }
@@ -314,7 +374,7 @@ export class LotteryGamePage {
314
374
  "$": ["lottery-game-page.css"]
315
375
  };
316
376
  }
317
- static get assetsDirs() { return ["static"]; }
377
+ static get assetsDirs() { return ["../static"]; }
318
378
  static get properties() {
319
379
  return {
320
380
  "endpoint": {
@@ -334,6 +394,23 @@ export class LotteryGamePage {
334
394
  "attribute": "endpoint",
335
395
  "reflect": true
336
396
  },
397
+ "endpointTicket": {
398
+ "type": "string",
399
+ "mutable": false,
400
+ "complexType": {
401
+ "original": "string",
402
+ "resolved": "string",
403
+ "references": {}
404
+ },
405
+ "required": false,
406
+ "optional": false,
407
+ "docs": {
408
+ "tags": [],
409
+ "text": "EndpointTicket URL for the source of ticket data"
410
+ },
411
+ "attribute": "endpoint-ticket",
412
+ "reflect": true
413
+ },
337
414
  "gameId": {
338
415
  "type": "string",
339
416
  "mutable": false,
@@ -420,42 +497,6 @@ export class LotteryGamePage {
420
497
  "attribute": "background-url",
421
498
  "reflect": true
422
499
  },
423
- "autoPick": {
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 auto-pick button"
436
- },
437
- "attribute": "auto-pick",
438
- "reflect": true,
439
- "defaultValue": "false"
440
- },
441
- "resetButton": {
442
- "type": "boolean",
443
- "mutable": false,
444
- "complexType": {
445
- "original": "boolean",
446
- "resolved": "boolean",
447
- "references": {}
448
- },
449
- "required": false,
450
- "optional": false,
451
- "docs": {
452
- "tags": [],
453
- "text": "Shows the reset button"
454
- },
455
- "attribute": "reset-button",
456
- "reflect": true,
457
- "defaultValue": "false"
458
- },
459
500
  "clientStyling": {
460
501
  "type": "string",
461
502
  "mutable": false,
@@ -498,22 +539,25 @@ export class LotteryGamePage {
498
539
  return {
499
540
  "clientStylingUrlContent": {},
500
541
  "tickets": {},
542
+ "mainTickets": {},
543
+ "secondaryTickets": {},
501
544
  "tabIndex": {},
502
545
  "hasErrors": {},
503
546
  "totalAmount": {},
504
547
  "successVisible": {},
505
- "deleteVisible": {},
506
- "deleteEventData": {},
507
548
  "daysRemaining": {},
508
549
  "hoursRemaining": {},
509
550
  "minutesRemaining": {},
510
551
  "secondsRemaining": {},
511
- "latestDraw": {},
512
- "totalWinningsAmount": {},
513
552
  "nextDate": {},
514
553
  "isLoggedIn": {},
515
554
  "loginModalVisible": {},
516
- "limitStylingAppends": {}
555
+ "limitStylingAppends": {},
556
+ "isLoading": {},
557
+ "showSubmitError": {},
558
+ "submitError": {},
559
+ "showApiError": {},
560
+ "apiError": {}
517
561
  };
518
562
  }
519
563
  static get events() {
@@ -563,12 +607,6 @@ export class LotteryGamePage {
563
607
  "target": undefined,
564
608
  "capture": false,
565
609
  "passive": false
566
- }, {
567
- "name": "deleteTicket",
568
- "method": "deleteTicketHandler",
569
- "target": undefined,
570
- "capture": false,
571
- "passive": false
572
610
  }, {
573
611
  "name": "modalCloseEvent",
574
612
  "method": "modalCloseEvent",
@@ -587,6 +625,24 @@ export class LotteryGamePage {
587
625
  "target": undefined,
588
626
  "capture": false,
589
627
  "passive": false
628
+ }, {
629
+ "name": "drawMultiplierChange",
630
+ "method": "drawMultiplierChangeHandler",
631
+ "target": undefined,
632
+ "capture": false,
633
+ "passive": false
634
+ }, {
635
+ "name": "lineMultiplierChange",
636
+ "method": "lineMultiplierChangeHandler",
637
+ "target": undefined,
638
+ "capture": false,
639
+ "passive": false
640
+ }, {
641
+ "name": "betTypeChange",
642
+ "method": "betTypeChangeHandler",
643
+ "target": undefined,
644
+ "capture": false,
645
+ "passive": false
590
646
  }];
591
647
  }
592
648
  }