@everymatrix/lottery-tipping-ticket-buy 0.0.1

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 (65) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/app-tooltip_11.cjs.entry.js +3998 -0
  3. package/dist/cjs/index-8a0b513b.js +1364 -0
  4. package/dist/cjs/index.cjs.js +10 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/lottery-tipping-ticket-buy-164a217a.js +7953 -0
  7. package/dist/cjs/lottery-tipping-ticket-buy.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +63 -0
  9. package/dist/collection/components/lottery-segmented/lottery-segmented.css +52 -0
  10. package/dist/collection/components/lottery-segmented/lottery-segmented.js +151 -0
  11. package/dist/collection/components/lottery-tipping-ticket-buy/index.js +1 -0
  12. package/dist/collection/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.css +122 -0
  13. package/dist/collection/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.js +806 -0
  14. package/dist/collection/index.js +1 -0
  15. package/dist/collection/model/type.js +6 -0
  16. package/dist/collection/utils/api.js +72 -0
  17. package/dist/collection/utils/locale.utils.js +118 -0
  18. package/dist/collection/utils/utils.js +114 -0
  19. package/dist/esm/app-globals-0f993ce5.js +3 -0
  20. package/dist/esm/app-tooltip_11.entry.js +3985 -0
  21. package/dist/esm/index-c24f96b9.js +1335 -0
  22. package/dist/esm/index.js +2 -0
  23. package/dist/esm/loader.js +11 -0
  24. package/dist/esm/lottery-tipping-ticket-buy-04819204.js +7941 -0
  25. package/dist/esm/lottery-tipping-ticket-buy.js +20 -0
  26. package/dist/index.cjs.js +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/lottery-tipping-ticket-buy/app-globals-0f993ce5.js +1 -0
  29. package/dist/lottery-tipping-ticket-buy/app-tooltip_11.entry.js +1 -0
  30. package/dist/lottery-tipping-ticket-buy/index-c24f96b9.js +2 -0
  31. package/dist/lottery-tipping-ticket-buy/index.esm.js +1 -0
  32. package/dist/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy-04819204.js +6657 -0
  33. package/dist/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.esm.js +1 -0
  34. package/dist/static/poolGameLogo.webp +0 -0
  35. package/dist/stencil.config.dev.js +19 -0
  36. package/dist/stencil.config.js +19 -0
  37. package/dist/storybook/main.js +43 -0
  38. package/dist/storybook/preview.js +9 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/stencil.config.d.ts +2 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/stencil.config.dev.d.ts +2 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/storybook/main.d.ts +3 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/storybook/preview.d.ts +70 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/index.d.ts +4 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  46. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  47. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  48. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  49. package/dist/types/components/lottery-segmented/lottery-segmented.d.ts +34 -0
  50. package/dist/types/components/lottery-tipping-ticket-buy/index.d.ts +1 -0
  51. package/dist/types/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.d.ts +165 -0
  52. package/dist/types/components.d.ts +228 -0
  53. package/dist/types/index.d.ts +1 -0
  54. package/dist/types/model/type.d.ts +203 -0
  55. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  56. package/dist/types/utils/api.d.ts +9 -0
  57. package/dist/types/utils/locale.utils.d.ts +3 -0
  58. package/dist/types/utils/utils.d.ts +13 -0
  59. package/loader/cdn.js +1 -0
  60. package/loader/index.cjs.js +1 -0
  61. package/loader/index.d.ts +24 -0
  62. package/loader/index.es2017.js +1 -0
  63. package/loader/index.js +2 -0
  64. package/loader/package.json +11 -0
  65. package/package.json +27 -0
@@ -0,0 +1,806 @@
1
+ import { h } from "@stencil/core";
2
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
+ import { fetchRequest, fetchSaleStatistics, toQueryParams } from "../../utils/api";
4
+ import { formattedTurnover, getTotalLinesAndCheckIfNotComplete } from "../../utils/utils";
5
+ import { resolveTranslationUrl, translate } from "../../utils/locale.utils";
6
+ import { isAfter, isBefore, parseISO } from "date-fns";
7
+ import "../../../../../lottery-banner/dist/types/index";
8
+ import "../../../../../lottery-order-summary/dist/types/index";
9
+ import "../../../../../lottery-tipping-bet-slip/dist/types/index";
10
+ import "../lottery-segmented/lottery-segmented";
11
+ import "../../../../../../../libs/vaadin-facade/index";
12
+ export class LotteryTippingTicketBuy {
13
+ constructor() {
14
+ this.SPLIT_TOKEN = ',';
15
+ this.EVENT_PART_MAP = {
16
+ '3': 'Full Time',
17
+ '5': 'Half Time'
18
+ };
19
+ this.endpoint = '';
20
+ this.sessionId = undefined;
21
+ this.playerId = '';
22
+ this.gameId = '';
23
+ this.drawId = '';
24
+ this.currency = 'EUR';
25
+ this.tippingBetOptions = '1,X,2';
26
+ this.tippingBetOptionNames = 'Home,Draw,Away';
27
+ this.groupBy = 'BettingType,EventPart,Event';
28
+ this.mbSource = undefined;
29
+ this.clientStyling = undefined;
30
+ this.clientStylingUrl = undefined;
31
+ this.translationUrl = '';
32
+ this.language = 'en';
33
+ this.bulletSelectionsLineGroup = [[[]]];
34
+ this.draw = undefined;
35
+ this.isLoading = false;
36
+ this.betCurrentPage = 1;
37
+ this.betTotalPages = undefined;
38
+ this.dialogConfig = { visible: false };
39
+ this.submitLoading = undefined;
40
+ this.betHasErrors = false;
41
+ this.gameUnavailable = false;
42
+ this.isSalesActive = false;
43
+ this.currentStake = undefined;
44
+ this.gameConfig = undefined;
45
+ this.turnover = undefined;
46
+ this.betTypes = undefined;
47
+ this.curBetType = undefined;
48
+ this.eventPartIds = undefined;
49
+ this.curEventPartId = undefined;
50
+ this.boardRange = {
51
+ min: 1,
52
+ max: 3
53
+ };
54
+ this.eventMap = undefined;
55
+ this.eventPart2EventOutcomeMap = undefined;
56
+ this.betTypeOptions = [];
57
+ this.eventPartOptions = [];
58
+ this.stakeOptions = [];
59
+ }
60
+ handleClientStylingChange(newValue, oldValue) {
61
+ if (newValue != oldValue) {
62
+ setClientStyling(this.stylingContainer, this.clientStyling);
63
+ }
64
+ }
65
+ handleClientStylingUrlChange(newValue, oldValue) {
66
+ if (newValue != oldValue) {
67
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
68
+ }
69
+ }
70
+ handleMbSourceChange(newValue, oldValue) {
71
+ if (newValue != oldValue) {
72
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
73
+ }
74
+ }
75
+ componentWillLoad() {
76
+ if (this.translationUrl) {
77
+ resolveTranslationUrl(this.translationUrl);
78
+ }
79
+ }
80
+ connectedCallback() {
81
+ if (this.endpoint && this.gameId && this.drawId) {
82
+ this.getTippingInfo();
83
+ }
84
+ else {
85
+ console.log('no fetch');
86
+ }
87
+ }
88
+ componentDidLoad() {
89
+ if (this.stylingContainer) {
90
+ if (this.mbSource)
91
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
92
+ if (this.clientStyling)
93
+ setClientStyling(this.stylingContainer, this.clientStyling);
94
+ if (this.clientStylingUrl)
95
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
96
+ }
97
+ }
98
+ disconnectedCallback() {
99
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
100
+ }
101
+ parsedOutcome(tippingInfo) {
102
+ const { outcomes } = tippingInfo;
103
+ const eventPartIdList = [];
104
+ for (const bettingTypeId in outcomes) {
105
+ const eventParts = outcomes[bettingTypeId];
106
+ this.eventPart2EventOutcomeMap = eventParts;
107
+ for (const eventPartId in eventParts) {
108
+ eventPartIdList.push(eventPartId);
109
+ }
110
+ }
111
+ if (eventPartIdList.length > 0) {
112
+ this.eventPartIds = eventPartIdList;
113
+ this.curEventPartId = eventPartIdList[0];
114
+ }
115
+ }
116
+ updateDrawSalesStatus() {
117
+ const currentDraw = this.draw;
118
+ if (!currentDraw) {
119
+ this.gameUnavailable = true;
120
+ this.isSalesActive = false;
121
+ return;
122
+ }
123
+ const now = new Date();
124
+ const wagerStartTime = currentDraw.wagerStartTime ? parseISO(currentDraw.wagerStartTime) : null;
125
+ const wagerCloseTime = currentDraw.wagerCloseTime ? parseISO(currentDraw.wagerCloseTime) : null;
126
+ // Rule 1: If the current time < the opening - sale time → display "Start in" countDown and disable the button.
127
+ if (wagerStartTime && isBefore(now, wagerStartTime)) {
128
+ this.isSalesActive = false;
129
+ this.gameUnavailable = false;
130
+ }
131
+ // Rule 2: If the opening-sale time < the current time < the closing time → display "Stop at xx time" to remind the player.
132
+ else if (wagerStartTime && wagerCloseTime && isAfter(now, wagerStartTime) && isBefore(now, wagerCloseTime)) {
133
+ this.isSalesActive = true;
134
+ this.gameUnavailable = false;
135
+ }
136
+ // Rule 3: If the current time > the closing time → the game is unavailable.
137
+ else {
138
+ this.gameUnavailable = true;
139
+ this.isSalesActive = false;
140
+ }
141
+ }
142
+ async getTippingInfo() {
143
+ try {
144
+ this.isLoading = true;
145
+ const { gameId, drawId, endpoint, groupBy } = this;
146
+ const res = await fetchRequest(`${endpoint}/poolgames/${gameId}/draws/${drawId}/bettingSelections${toQueryParams({
147
+ groupBy
148
+ })}`, 'GET');
149
+ const { game, eventMap } = res;
150
+ this.gameConfig = res;
151
+ this.draw = game.currentDraw;
152
+ this.betTypes = game.rules.betTypes;
153
+ this._setBetType(this.betTypes[0]);
154
+ this.currentStake = String(game.rules.stakes[0].value);
155
+ this.eventMap = eventMap;
156
+ this.parsedOutcome(res);
157
+ const betTypeOptions = this.betTypes.map((bt) => ({ label: bt.name, value: bt.name }));
158
+ this.betTypeOptions = betTypeOptions;
159
+ const eventPartOptions = this.eventPartIds.map((id) => ({ label: this.EVENT_PART_MAP[id], value: id }));
160
+ this.eventPartOptions = eventPartOptions;
161
+ const stakeOptions = game.rules.stakes.map((stake) => ({ label: stake.value, value: stake.value }));
162
+ this.stakeOptions = stakeOptions;
163
+ this.updateDrawSalesStatus();
164
+ this.updateSaleStatistics();
165
+ }
166
+ catch (err) {
167
+ this.betHasErrors = true;
168
+ console.error('Failed to get tipping info:', err);
169
+ }
170
+ finally {
171
+ this.isLoading = false;
172
+ }
173
+ }
174
+ updateSaleStatistics() {
175
+ var _a, _b, _c;
176
+ return fetchSaleStatistics({
177
+ endpoint: this.endpoint,
178
+ gameId: (_b = (_a = this.gameConfig) === null || _a === void 0 ? void 0 : _a.game) === null || _b === void 0 ? void 0 : _b.type,
179
+ drawId: (_c = this.draw) === null || _c === void 0 ? void 0 : _c.id
180
+ }).then((res) => {
181
+ var _a;
182
+ this.turnover = (_a = res === null || res === void 0 ? void 0 : res.wagerSegment) === null || _a === void 0 ? void 0 : _a.totalSalesCrossDraw;
183
+ });
184
+ }
185
+ handleSelectionChange(event) {
186
+ const { newSelections, matchId, boardId } = event.detail;
187
+ const boardIndex = parseInt(boardId, 10);
188
+ const matchIndex = parseInt(matchId, 10);
189
+ const newBulletSelectionsLineGroup = this.bulletSelectionsLineGroup.map((board, index) => {
190
+ if (index !== boardIndex)
191
+ return board;
192
+ const newBoard = [...board];
193
+ newBoard[matchIndex] = newSelections;
194
+ return newBoard;
195
+ });
196
+ // console.log('newBulletSelectionsLineGroup', newBulletSelectionsLineGroup);
197
+ this.bulletSelectionsLineGroup = newBulletSelectionsLineGroup;
198
+ }
199
+ handleClearAll() {
200
+ this._resetBulletConfig();
201
+ this.onClearAll.emit();
202
+ }
203
+ handlePageChange(event) {
204
+ const { newPage } = event.detail;
205
+ if (newPage >= 1 && newPage <= this.betTotalPages) {
206
+ this.betCurrentPage = newPage;
207
+ }
208
+ }
209
+ handleAddLine() {
210
+ if (this.betTotalPages < this.boardRange.max) {
211
+ this.bulletSelectionsLineGroup = [...this.bulletSelectionsLineGroup, this.initLineForBulletConfig()];
212
+ this.betTotalPages++;
213
+ this.betCurrentPage = this.betTotalPages;
214
+ }
215
+ }
216
+ handleRemoveLine(event) {
217
+ const { boardId, close } = event.detail;
218
+ if (this.betTotalPages > this.boardRange.min) {
219
+ const closeDialog = () => {
220
+ this.dialogConfig = { visible: false };
221
+ };
222
+ const doRemove = () => {
223
+ this.bulletSelectionsLineGroup = this.bulletSelectionsLineGroup.filter((_, index) => index !== boardId);
224
+ this.betTotalPages--;
225
+ const removedPage = boardId + 1;
226
+ if (this.betCurrentPage > removedPage) {
227
+ this.betCurrentPage--;
228
+ }
229
+ if (this.betCurrentPage > this.betTotalPages) {
230
+ this.betCurrentPage = this.betTotalPages;
231
+ }
232
+ close(closeDialog);
233
+ };
234
+ this.dialogConfig = {
235
+ visible: true,
236
+ content: translate('selectionOnLineCleared', this.language),
237
+ onConfirm: doRemove,
238
+ onCancel: closeDialog
239
+ };
240
+ }
241
+ }
242
+ handleSubmitTickets() {
243
+ const params = this.buildTicketParam();
244
+ this.lotteryTicketParamsReady.emit(params);
245
+ }
246
+ handleTicketSubmitSuccess() {
247
+ this._resetBulletConfig();
248
+ this.updateSaleStatistics();
249
+ }
250
+ buildTicketParam() {
251
+ let body = {
252
+ tickets: []
253
+ };
254
+ body.tickets.push({
255
+ gameName: this.gameConfig.game.name,
256
+ startingDrawId: this.draw.id,
257
+ amount: this.calculateTotalAmount(),
258
+ currency: this.currency,
259
+ selection: this.bulletSelectionsLineGroup.map((boardInfo) => {
260
+ const matchList = boardInfo.map((matchSelection, matchIdx) => {
261
+ const curBettingTypeMatches = matchSelection.map((bet) => {
262
+ return {
263
+ betOn: bet,
264
+ id: this.parsedEvent[matchIdx].outcomes.find((outcome) => outcome.betOn === bet).id
265
+ };
266
+ });
267
+ return [curBettingTypeMatches];
268
+ });
269
+ return {
270
+ betType: this.curBetType.id,
271
+ prizePool: this.parsedEvent[0].outcomes[0].prizePools[0],
272
+ stake: this.currentStake,
273
+ poolGameSelections: matchList
274
+ };
275
+ })
276
+ });
277
+ return body;
278
+ }
279
+ initLineForBulletConfig() {
280
+ return [[]];
281
+ }
282
+ _resetBulletConfig() {
283
+ this.bulletSelectionsLineGroup = Array.from({ length: this.betTotalPages }).map(this.initLineForBulletConfig.bind(this));
284
+ this.betCurrentPage = 1;
285
+ }
286
+ calculateTotalAmount() {
287
+ const stake = this.currentStake;
288
+ if (!stake) {
289
+ return '0';
290
+ }
291
+ let totalAmount = +stake * this.totalLineCombination;
292
+ return totalAmount.toString();
293
+ }
294
+ get hasSelection() {
295
+ return this.bulletSelectionsLineGroup.some((board) => board.some((match) => match && match.length > 0));
296
+ }
297
+ get parsedEvent() {
298
+ if (!this.eventPart2EventOutcomeMap || !this.curEventPartId || !this.eventMap) {
299
+ return [];
300
+ }
301
+ const curEventObj = this.eventPart2EventOutcomeMap[this.curEventPartId];
302
+ const flatEvents = [];
303
+ for (const eventId in curEventObj) {
304
+ const curEventOutcomeArr = curEventObj[eventId];
305
+ const eventDetail = this.eventMap[eventId];
306
+ const { eventName, startTime, order } = eventDetail;
307
+ flatEvents.push({
308
+ eventName,
309
+ startTime,
310
+ order,
311
+ outcomes: curEventOutcomeArr.map((outcome) => {
312
+ const { betOn, outcomeId, prizePools } = outcome;
313
+ return {
314
+ betOn,
315
+ id: outcomeId,
316
+ prizePools
317
+ };
318
+ })
319
+ });
320
+ }
321
+ flatEvents.sort((a, b) => a.order - b.order);
322
+ // console.log('flatEvents', flatEvents);
323
+ return flatEvents;
324
+ }
325
+ get _selectionStats() {
326
+ const { combinations: minCombinations = 1, maxCombinations = 1 } = this.curBetType || {};
327
+ return getTotalLinesAndCheckIfNotComplete(this.bulletSelectionsLineGroup, this.parsedEvent.length, minCombinations, maxCombinations);
328
+ }
329
+ get totalLineCombination() {
330
+ return this._selectionStats.totalLines;
331
+ }
332
+ get hasSelectAllBullet() {
333
+ return !this._selectionStats.notComplete;
334
+ }
335
+ _setBetType(betType) {
336
+ if (!betType)
337
+ return;
338
+ this.curBetType = betType;
339
+ this.boardRange.min = Math.min(...betType.boardsAllowed);
340
+ this.boardRange.max = Math.max(...betType.boardsAllowed);
341
+ this.betTotalPages = betType.defaultBoards;
342
+ this._resetBulletConfig();
343
+ }
344
+ handleBetTypeChange(event) {
345
+ const newBetTypeName = event.detail;
346
+ if (newBetTypeName === this.curBetType.name) {
347
+ return;
348
+ }
349
+ const switchBetType = () => {
350
+ const newBetType = this.betTypes.find((bt) => bt.name === newBetTypeName);
351
+ this._setBetType(newBetType);
352
+ this.dialogConfig = { visible: false };
353
+ };
354
+ this.handleSwitchWithConfirmation(switchBetType);
355
+ }
356
+ handleEventPartChange(event) {
357
+ const newEventPartId = event.detail;
358
+ if (newEventPartId === this.curEventPartId) {
359
+ return;
360
+ }
361
+ const switchEventPart = () => {
362
+ this.curEventPartId = newEventPartId;
363
+ this._resetBulletConfig();
364
+ this.dialogConfig = { visible: false };
365
+ };
366
+ this.handleSwitchWithConfirmation(switchEventPart);
367
+ }
368
+ onStakeChange(event) {
369
+ this.currentStake = event.detail.value;
370
+ }
371
+ handleSwitchWithConfirmation(switchAction) {
372
+ const closeDialog = () => {
373
+ this.dialogConfig = { visible: false };
374
+ };
375
+ const doConfirm = () => {
376
+ switchAction();
377
+ closeDialog();
378
+ };
379
+ if (this.hasSelection) {
380
+ this.dialogConfig = {
381
+ visible: true,
382
+ content: translate('selectionCleared', this.language),
383
+ onConfirm: doConfirm,
384
+ onCancel: closeDialog
385
+ };
386
+ }
387
+ else {
388
+ switchAction();
389
+ }
390
+ }
391
+ _renderSkeletonBlock(style) {
392
+ return h("div", { class: "skeleton-block", style: style });
393
+ }
394
+ renderSkeletons() {
395
+ return (h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, this._renderSkeletonBlock({ height: '60px', marginBottom: '16px' }), this._renderSkeletonBlock({ width: '60%', margin: '0 auto', height: '80px', marginBottom: '16px' }), h("div", { class: "bet-board", style: { display: 'flex', gap: '16px' } }, this._renderSkeletonBlock({ flex: '2', height: '400px' }), this._renderSkeletonBlock({ flex: '1', height: '400px' }))));
396
+ }
397
+ renderErrorContent() {
398
+ return h("p", null, translate('error', this.language));
399
+ }
400
+ renderNoActiveDraw() {
401
+ return (h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, h("div", { class: "no-active-draw" }, translate('gameNotAvailable', this.language))));
402
+ }
403
+ get ticketDataSourceForBetSlip() {
404
+ return this.parsedEvent.map(({ eventName, startTime, outcomes }) => ({
405
+ eventName,
406
+ startTime,
407
+ outcomes: outcomes.map(({ betOn }) => ({ betOn }))
408
+ }));
409
+ }
410
+ render() {
411
+ var _a, _b, _c, _d, _e, _f, _g, _h;
412
+ if (this.isLoading) {
413
+ return this.renderSkeletons();
414
+ }
415
+ else if (this.betHasErrors) {
416
+ return this.renderErrorContent();
417
+ }
418
+ else if (this.gameUnavailable) {
419
+ return this.renderNoActiveDraw();
420
+ }
421
+ else {
422
+ return (h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, h("lottery-banner", { clientStylingUrl: this.clientStylingUrl, stopTime: (_a = this.draw) === null || _a === void 0 ? void 0 : _a.wagerCloseTime, startTime: (_b = this.draw) === null || _b === void 0 ? void 0 : _b.wagerStartTime, "banner-title": (_d = (_c = this.gameConfig) === null || _c === void 0 ? void 0 : _c.game) === null || _d === void 0 ? void 0 : _d.name, turnover: formattedTurnover(this.turnover), language: this.language, "translation-url": this.translationUrl, onLotteryBannerWagerStarted: () => this.updateDrawSalesStatus() }), h("div", { class: "bet-selector" }, h("div", { class: "bet-selector-line" }, h("div", { class: "bet-selector-line-segments" }, h("lottery-segmented", { class: "event-part-selector", label: "Event Part", options: this.eventPartOptions, value: this.curEventPartId.toString(), onValueChange: this.handleEventPartChange.bind(this) }), h("lottery-segmented", { label: "Bet Type", options: this.betTypeOptions, value: ((_e = this.curBetType) === null || _e === void 0 ? void 0 : _e.name) || '', onValueChange: this.handleBetTypeChange.bind(this) }))), h("div", { class: "bet-selector-line" }, h("div", { class: "bet-selector-line-label" }, translate('stakePerLine', this.language)), h("div", { class: "bet-selector-line-input" }, this.stakeOptions.length > 1 ? (h("vaadin-select", { items: this.stakeOptions, value: this.currentStake, "on-value-changed": this.onStakeChange.bind(this), "no-vertical-overlap": true })) : (this.currentStake)))), h("div", { class: "bet-board" }, h("div", { class: "bet-board-slip" }, h("lottery-tipping-bet-slip", { language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl, "current-page": this.betCurrentPage, "total-pages": this.betTotalPages, "max-total-pages": this.boardRange.max, "min-total-pages": this.boardRange.min, mode: ((_f = this.curBetType) === null || _f === void 0 ? void 0 : _f.combinations) > 1 ? 'multi' : 'single', readPretty: false, bulletTexts: this.tippingBetOptions, bulletNames: this.tippingBetOptionNames, bulletTextsSplitToken: this.SPLIT_TOKEN, "ticket-data-source-str": JSON.stringify(this.ticketDataSourceForBetSlip), "bullet-selections-line-group-str": JSON.stringify(this.bulletSelectionsLineGroup), showClearButton: true })), h("div", { class: "bet-board-order" }, h("lottery-order-summary", { "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, language: this.language, "translation-url": this.translationUrl, endpoint: this.endpoint, sessionId: this.sessionId, orderSummaryTitle: translate('orderSummaryTitle', this.language), ticketsLabel: translate('orderSummaryTickets', this.language), totalLabel: translate('orderSummaryTotal', this.language), "show-divider": true, submitLoading: this.submitLoading, submitDisabled: !this.hasSelectAllBullet || this.submitLoading || !this.isSalesActive, submitButtonText: translate('orderSummarySubmit', this.language) }, h("div", { class: "order-summary__details", slot: "orderSummaryTicketDetail" }, h("span", { class: "order-summary__line-count" }, `${this.totalLineCombination} ${this.totalLineCombination > 1 ? translate('lines', this.language) : translate('line', this.language)}`), h("div", null, h("span", { class: "order-summary__multiplier" }, "x"), h("span", { class: "order-summary__stake" }, `${this.currentStake} ${this.currency}`))), h("span", { class: "order-summary__details", slot: "orderSummaryTotalDetail" }, `${this.calculateTotalAmount()} ${this.currency}`)))), this.dialogConfig.visible && (h("vaadin-confirm-dialog", { rejectButtonVisible: true, rejectText: translate('cancel', this.language), confirmText: translate('confirm', this.language), opened: (_g = this.dialogConfig) === null || _g === void 0 ? void 0 : _g.visible, onConfirm: this.dialogConfig.onConfirm, onReject: this.dialogConfig.onCancel }, (_h = this.dialogConfig) === null || _h === void 0 ? void 0 : _h.content))));
423
+ }
424
+ }
425
+ static get is() { return "lottery-tipping-ticket-buy"; }
426
+ static get encapsulation() { return "shadow"; }
427
+ static get originalStyleUrls() {
428
+ return {
429
+ "$": ["lottery-tipping-ticket-buy.scss"]
430
+ };
431
+ }
432
+ static get styleUrls() {
433
+ return {
434
+ "$": ["lottery-tipping-ticket-buy.css"]
435
+ };
436
+ }
437
+ static get properties() {
438
+ return {
439
+ "endpoint": {
440
+ "type": "string",
441
+ "mutable": false,
442
+ "complexType": {
443
+ "original": "string",
444
+ "resolved": "string",
445
+ "references": {}
446
+ },
447
+ "required": false,
448
+ "optional": false,
449
+ "docs": {
450
+ "tags": [],
451
+ "text": "API endpoint for data fetching."
452
+ },
453
+ "attribute": "endpoint",
454
+ "reflect": true,
455
+ "defaultValue": "''"
456
+ },
457
+ "sessionId": {
458
+ "type": "string",
459
+ "mutable": false,
460
+ "complexType": {
461
+ "original": "string",
462
+ "resolved": "string",
463
+ "references": {}
464
+ },
465
+ "required": false,
466
+ "optional": false,
467
+ "docs": {
468
+ "tags": [],
469
+ "text": "User's session ID for authenticated requests."
470
+ },
471
+ "attribute": "session-id",
472
+ "reflect": true
473
+ },
474
+ "playerId": {
475
+ "type": "string",
476
+ "mutable": false,
477
+ "complexType": {
478
+ "original": "string",
479
+ "resolved": "string",
480
+ "references": {}
481
+ },
482
+ "required": false,
483
+ "optional": false,
484
+ "docs": {
485
+ "tags": [],
486
+ "text": "The ID of the player."
487
+ },
488
+ "attribute": "player-id",
489
+ "reflect": true,
490
+ "defaultValue": "''"
491
+ },
492
+ "gameId": {
493
+ "type": "string",
494
+ "mutable": false,
495
+ "complexType": {
496
+ "original": "string",
497
+ "resolved": "string",
498
+ "references": {}
499
+ },
500
+ "required": false,
501
+ "optional": false,
502
+ "docs": {
503
+ "tags": [],
504
+ "text": "The ID of the pool game."
505
+ },
506
+ "attribute": "game-id",
507
+ "reflect": true,
508
+ "defaultValue": "''"
509
+ },
510
+ "drawId": {
511
+ "type": "string",
512
+ "mutable": false,
513
+ "complexType": {
514
+ "original": "string",
515
+ "resolved": "string",
516
+ "references": {}
517
+ },
518
+ "required": false,
519
+ "optional": false,
520
+ "docs": {
521
+ "tags": [],
522
+ "text": "The ID of the specific draw."
523
+ },
524
+ "attribute": "draw-id",
525
+ "reflect": true,
526
+ "defaultValue": "''"
527
+ },
528
+ "currency": {
529
+ "type": "string",
530
+ "mutable": false,
531
+ "complexType": {
532
+ "original": "string",
533
+ "resolved": "string",
534
+ "references": {}
535
+ },
536
+ "required": false,
537
+ "optional": false,
538
+ "docs": {
539
+ "tags": [],
540
+ "text": "The currency to be used for stakes and display."
541
+ },
542
+ "attribute": "currency",
543
+ "reflect": true,
544
+ "defaultValue": "'EUR'"
545
+ },
546
+ "tippingBetOptions": {
547
+ "type": "string",
548
+ "mutable": false,
549
+ "complexType": {
550
+ "original": "string",
551
+ "resolved": "string",
552
+ "references": {}
553
+ },
554
+ "required": false,
555
+ "optional": false,
556
+ "docs": {
557
+ "tags": [],
558
+ "text": "Comma-separated string of bet options (e.g., '1,X,2')."
559
+ },
560
+ "attribute": "tipping-bet-options",
561
+ "reflect": true,
562
+ "defaultValue": "'1,X,2'"
563
+ },
564
+ "tippingBetOptionNames": {
565
+ "type": "string",
566
+ "mutable": false,
567
+ "complexType": {
568
+ "original": "string",
569
+ "resolved": "string",
570
+ "references": {}
571
+ },
572
+ "required": false,
573
+ "optional": false,
574
+ "docs": {
575
+ "tags": [],
576
+ "text": "Comma-separated string of display names for bet options (e.g., 'Home,Draw,Away')."
577
+ },
578
+ "attribute": "tipping-bet-option-names",
579
+ "reflect": true,
580
+ "defaultValue": "'Home,Draw,Away'"
581
+ },
582
+ "groupBy": {
583
+ "type": "string",
584
+ "mutable": false,
585
+ "complexType": {
586
+ "original": "string",
587
+ "resolved": "string",
588
+ "references": {}
589
+ },
590
+ "required": false,
591
+ "optional": false,
592
+ "docs": {
593
+ "tags": [],
594
+ "text": "Comma-separated string to group betting selections by."
595
+ },
596
+ "attribute": "group-by",
597
+ "reflect": true,
598
+ "defaultValue": "'BettingType,EventPart,Event'"
599
+ },
600
+ "mbSource": {
601
+ "type": "string",
602
+ "mutable": false,
603
+ "complexType": {
604
+ "original": "string",
605
+ "resolved": "string",
606
+ "references": {}
607
+ },
608
+ "required": false,
609
+ "optional": false,
610
+ "docs": {
611
+ "tags": [],
612
+ "text": "Source for message bus styling."
613
+ },
614
+ "attribute": "mb-source",
615
+ "reflect": true
616
+ },
617
+ "clientStyling": {
618
+ "type": "string",
619
+ "mutable": false,
620
+ "complexType": {
621
+ "original": "string",
622
+ "resolved": "string",
623
+ "references": {}
624
+ },
625
+ "required": false,
626
+ "optional": false,
627
+ "docs": {
628
+ "tags": [],
629
+ "text": "Custom styling passed as a string."
630
+ },
631
+ "attribute": "client-styling",
632
+ "reflect": true
633
+ },
634
+ "clientStylingUrl": {
635
+ "type": "string",
636
+ "mutable": false,
637
+ "complexType": {
638
+ "original": "string",
639
+ "resolved": "string",
640
+ "references": {}
641
+ },
642
+ "required": false,
643
+ "optional": false,
644
+ "docs": {
645
+ "tags": [],
646
+ "text": "URL to a CSS file for custom styling."
647
+ },
648
+ "attribute": "client-styling-url",
649
+ "reflect": true
650
+ },
651
+ "translationUrl": {
652
+ "type": "string",
653
+ "mutable": false,
654
+ "complexType": {
655
+ "original": "string",
656
+ "resolved": "string",
657
+ "references": {}
658
+ },
659
+ "required": false,
660
+ "optional": false,
661
+ "docs": {
662
+ "tags": [],
663
+ "text": "URL to a JSON file for custom translations."
664
+ },
665
+ "attribute": "translation-url",
666
+ "reflect": true,
667
+ "defaultValue": "''"
668
+ },
669
+ "language": {
670
+ "type": "string",
671
+ "mutable": false,
672
+ "complexType": {
673
+ "original": "string",
674
+ "resolved": "string",
675
+ "references": {}
676
+ },
677
+ "required": false,
678
+ "optional": false,
679
+ "docs": {
680
+ "tags": [],
681
+ "text": "The language for translations."
682
+ },
683
+ "attribute": "language",
684
+ "reflect": true,
685
+ "defaultValue": "'en'"
686
+ }
687
+ };
688
+ }
689
+ static get states() {
690
+ return {
691
+ "bulletSelectionsLineGroup": {},
692
+ "draw": {},
693
+ "isLoading": {},
694
+ "betCurrentPage": {},
695
+ "betTotalPages": {},
696
+ "dialogConfig": {},
697
+ "submitLoading": {},
698
+ "betHasErrors": {},
699
+ "gameUnavailable": {},
700
+ "isSalesActive": {},
701
+ "currentStake": {},
702
+ "gameConfig": {},
703
+ "turnover": {},
704
+ "betTypes": {},
705
+ "curBetType": {},
706
+ "eventPartIds": {},
707
+ "curEventPartId": {},
708
+ "boardRange": {},
709
+ "eventMap": {},
710
+ "eventPart2EventOutcomeMap": {},
711
+ "betTypeOptions": {},
712
+ "eventPartOptions": {},
713
+ "stakeOptions": {}
714
+ };
715
+ }
716
+ static get events() {
717
+ return [{
718
+ "method": "onClearAll",
719
+ "name": "lotteryTippingSelectionClear",
720
+ "bubbles": true,
721
+ "cancelable": true,
722
+ "composed": true,
723
+ "docs": {
724
+ "tags": [],
725
+ "text": "Emitted when the \"Clear All\" action is triggered"
726
+ },
727
+ "complexType": {
728
+ "original": "void",
729
+ "resolved": "void",
730
+ "references": {}
731
+ }
732
+ }, {
733
+ "method": "lotteryTicketParamsReady",
734
+ "name": "lotteryTicketParamsReady",
735
+ "bubbles": true,
736
+ "cancelable": true,
737
+ "composed": true,
738
+ "docs": {
739
+ "tags": [],
740
+ "text": ""
741
+ },
742
+ "complexType": {
743
+ "original": "any",
744
+ "resolved": "any",
745
+ "references": {}
746
+ }
747
+ }];
748
+ }
749
+ static get watchers() {
750
+ return [{
751
+ "propName": "clientStyling",
752
+ "methodName": "handleClientStylingChange"
753
+ }, {
754
+ "propName": "clientStylingUrl",
755
+ "methodName": "handleClientStylingUrlChange"
756
+ }, {
757
+ "propName": "mbSource",
758
+ "methodName": "handleMbSourceChange"
759
+ }];
760
+ }
761
+ static get listeners() {
762
+ return [{
763
+ "name": "lotteryTippingBetSelectionChange",
764
+ "method": "handleSelectionChange",
765
+ "target": undefined,
766
+ "capture": false,
767
+ "passive": false
768
+ }, {
769
+ "name": "lotteryTippingBetClearAll",
770
+ "method": "handleClearAll",
771
+ "target": undefined,
772
+ "capture": false,
773
+ "passive": false
774
+ }, {
775
+ "name": "lotteryTippingBetPageChange",
776
+ "method": "handlePageChange",
777
+ "target": undefined,
778
+ "capture": false,
779
+ "passive": false
780
+ }, {
781
+ "name": "lotteryTippingBetAddLine",
782
+ "method": "handleAddLine",
783
+ "target": undefined,
784
+ "capture": false,
785
+ "passive": false
786
+ }, {
787
+ "name": "lotteryTippingBetRemoveLine",
788
+ "method": "handleRemoveLine",
789
+ "target": undefined,
790
+ "capture": false,
791
+ "passive": false
792
+ }, {
793
+ "name": "orderSummarySubmit",
794
+ "method": "handleSubmitTickets",
795
+ "target": undefined,
796
+ "capture": false,
797
+ "passive": false
798
+ }, {
799
+ "name": "lotteryTicketSubmitSuccess",
800
+ "method": "handleTicketSubmitSuccess",
801
+ "target": undefined,
802
+ "capture": false,
803
+ "passive": false
804
+ }];
805
+ }
806
+ }