@everymatrix/lottery-tipping-ticket-controller 1.85.14 → 1.85.16
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/general-tooltip_7.cjs.entry.js +1136 -0
- package/dist/cjs/index-3e1fe885.js +2 -2
- package/dist/cjs/index.cjs.js +1 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{general-tooltip_6.cjs.entry.js → lottery-tipping-ticket-controller-1e79780d.js} +7366 -5190
- package/dist/cjs/lottery-tipping-ticket-controller.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/lottery-tipping-ticket-controller/lottery-tipping-ticket-controller.js +41 -9
- package/dist/collection/utils/locale.utils.js +2 -1
- package/dist/collection/utils/utils.js +1 -0
- package/dist/esm/general-tooltip_7.entry.js +1127 -0
- package/dist/esm/index-e3ec645c.js +2 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{general-tooltip_6.entry.js → lottery-tipping-ticket-controller-e914932b.js} +7220 -5047
- package/dist/esm/lottery-tipping-ticket-controller.js +1 -1
- package/dist/lottery-tipping-ticket-controller/general-tooltip_7.entry.js +1 -0
- package/dist/lottery-tipping-ticket-controller/index.esm.js +1 -1
- package/dist/lottery-tipping-ticket-controller/{general-tooltip_6.entry.js → lottery-tipping-ticket-controller-e914932b.js} +242 -242
- package/dist/lottery-tipping-ticket-controller/lottery-tipping-ticket-controller.esm.js +1 -1
- package/dist/types/components/lottery-tipping-ticket-controller/lottery-tipping-ticket-controller.d.ts +8 -3
- package/dist/types/models/index.d.ts +5 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/lottery-tipping-ticket-controller-b89883ee.js +0 -3141
- package/dist/esm/lottery-tipping-ticket-controller-12ffe9b9.js +0 -3130
- package/dist/lottery-tipping-ticket-controller/lottery-tipping-ticket-controller-12ffe9b9.js +0 -1
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["general-
|
|
22
|
+
return index.bootstrapLazy([["general-tooltip_7.cjs",[[1,"lottery-tipping-ticket-controller",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"logoUrl":[513,"logo-url"],"endpoint":[513],"endpointLotteryBe":[513,"endpoint-lottery-be"],"endpointTicket":[513,"endpoint-ticket"],"sessionId":[513,"session-id"],"gameId":[513,"game-id"],"playerId":[513,"player-id"],"drawId":[513,"draw-id"],"isLoading":[32],"bettingTypeOptions":[32],"playingModeOptions":[32],"selectedBettingType":[32],"selectedPlayingMode":[32],"hasSelectBullet":[32],"hasSelectAllBullet":[32],"totalLineCombination":[32],"submitLoading":[32],"rawData":[32],"saleStatisticsInfo":[32],"currentStake":[32],"dialogConfig":[32]},[[0,"lotteryTippingBulletBetSelect","lotteryTippingBulletGroupSelectionHandler"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-tipping-ticket-bet",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"sessionId":[513,"session-id"],"endpoint":[513],"gameId":[513,"game-id"],"drawId":[513,"draw-id"],"totalPages":[1538,"total-pages"],"minTotalPages":[514,"min-total-pages"],"maxTotalPages":[514,"max-total-pages"],"mode":[513],"readPretty":[516,"read-pretty"],"defaultBulletConfigLineGroup":[513,"default-bullet-config-line-group"],"translationData":[32],"clientStylingUrlContent":[32],"bulletConfigLineGroup":[32],"currentPage":[32],"isLoading":[32],"hasErrors":[32],"dialogConfig":[32],"ticketDataSource":[32],"resetBulletConfig":[64],"getData":[64]},[[0,"lotteryTippingBulletGroupToggle","lotteryTippingBulletGroupSelectionHandler"]],{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"gameId":["fetchMatchData"],"sessionId":["fetchMatchData"],"drawId":["fetchMatchData"],"defaultBulletConfigLineGroup":["fetchMatchData"],"currentPage":["handleCurrentPageChange"]}],[1,"lottery-button",{"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-tipping-ticket-banner",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"translationUrl":[513,"translation-url"],"logoUrl":[513,"logo-url"],"stopTime":[1,"stop-time"],"period":[1],"formattedTurnover":[1,"formatted-turnover"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-tipping-bullet-group",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"positionIdx":[513,"position-idx"],"theme":[513],"mode":[513],"bulletConfigContent":[513,"bullet-config-content"]},[[0,"lotteryTippingBulletToggle","lotteryTippingBulletSelectionHandler"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"general-tooltip",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"position":[1],"delay":[2],"isVisible":[32],"_tooltipId":[32]},[[1,"mouseenter","handleMouseEnterOrFocus"],[0,"focusin","handleMouseEnterOrFocus"],[1,"mouseleave","handleMouseLeaveOrBlur"],[0,"focusout","handleMouseLeaveOrBlur"],[0,"keydown","handleKeyDown"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-tipping-bullet",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"positionIdx":[514,"position-idx"],"theme":[513],"value":[513],"disabled":[516],"isSelected":[516,"is-selected"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
3
|
-
import "
|
|
3
|
+
import "../../../../../../../libs/vaadin-facade/index";
|
|
4
|
+
import "../../../../../lottery-button/dist/types/index";
|
|
4
5
|
import "../../../../../lottery-tipping-ticket-bet/dist/types/index";
|
|
5
6
|
import { BettingTypeEnum, PlayModeEnum } from "../../models";
|
|
6
7
|
import { resolveTranslationUrl, translate } from "../../utils/locale.utils";
|
|
7
|
-
import { calculatePlayingModeOptions, fetchRequest, formatResultsToWinningNumbers, getCheckedCountForEachLineAndEachMatch, getDefaultType, getEnableOptions, getPlayTypeConfig, showNotification, thousandSeparator } from "../../utils/utils";
|
|
8
|
+
import { calculatePlayingModeOptions, fetchRequest, formatResultsToWinningNumbers, getCheckedCountForEachLineAndEachMatch, getDefaultType, getEnableOptions, getPlayTypeConfig, showNotification, thousandSeparator, getMinValue } from "../../utils/utils";
|
|
8
9
|
import { doSubmitTicket, fetchSaleStatistics, TICKET_INVALID_TOKEN } from "../../utils/api";
|
|
9
10
|
// value:
|
|
10
11
|
export class LotteryTippingTicketController {
|
|
11
12
|
constructor() {
|
|
12
13
|
this.bothBettingTypeMultiplier = 2;
|
|
14
|
+
this.onStakeChange = (e) => {
|
|
15
|
+
this.currentStake = this.getCurrentStakeByValue(e.detail.value);
|
|
16
|
+
};
|
|
13
17
|
this.mbSource = undefined;
|
|
14
18
|
this.clientStyling = undefined;
|
|
15
19
|
this.clientStylingUrl = undefined;
|
|
@@ -34,6 +38,7 @@ export class LotteryTippingTicketController {
|
|
|
34
38
|
this.submitLoading = undefined;
|
|
35
39
|
this.rawData = {};
|
|
36
40
|
this.saleStatisticsInfo = {};
|
|
41
|
+
this.currentStake = undefined;
|
|
37
42
|
this.dialogConfig = { visible: false };
|
|
38
43
|
}
|
|
39
44
|
async getLotteryTippingBulletResults() {
|
|
@@ -61,9 +66,28 @@ export class LotteryTippingTicketController {
|
|
|
61
66
|
get isBothBettingType() {
|
|
62
67
|
return this.selectedBettingType === BettingTypeEnum.Both;
|
|
63
68
|
}
|
|
64
|
-
get
|
|
69
|
+
get stakeOptions() {
|
|
65
70
|
var _a, _b, _c;
|
|
66
|
-
return (_c = (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.stakes) === null || _c === void 0 ? void 0 : _c
|
|
71
|
+
return (_c = (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.stakes) === null || _c === void 0 ? void 0 : _c.map((item) => {
|
|
72
|
+
var _a;
|
|
73
|
+
return { value: (_a = item.value) === null || _a === void 0 ? void 0 : _a.toString(), label: item.value, currency: item.currency };
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
getCurrentStakeByValue(value) {
|
|
77
|
+
var _a;
|
|
78
|
+
return (_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.find((item) => +item.value === +value);
|
|
79
|
+
}
|
|
80
|
+
initiateCurrentStake() {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
// if only one option, default to the first one
|
|
83
|
+
if (((_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
84
|
+
this.currentStake = this.stakeOptions[0];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// otherwise, default to the smallest stake option from the config
|
|
88
|
+
const minValue = getMinValue(((_b = this.stakeOptions) === null || _b === void 0 ? void 0 : _b.map((i) => i.value)) || []);
|
|
89
|
+
this.currentStake = this.getCurrentStakeByValue(minValue);
|
|
90
|
+
}
|
|
67
91
|
}
|
|
68
92
|
handleBettingTypeChange(type) {
|
|
69
93
|
var _a, _b, _c, _d;
|
|
@@ -131,7 +155,7 @@ export class LotteryTippingTicketController {
|
|
|
131
155
|
if (!stake) {
|
|
132
156
|
return 0;
|
|
133
157
|
}
|
|
134
|
-
let totalAmount = stake.value * this.totalLineCombination;
|
|
158
|
+
let totalAmount = +stake.value * this.totalLineCombination;
|
|
135
159
|
if (this.isBothBettingType)
|
|
136
160
|
totalAmount = this.bothBettingTypeMultiplier * totalAmount;
|
|
137
161
|
return totalAmount;
|
|
@@ -210,6 +234,7 @@ export class LotteryTippingTicketController {
|
|
|
210
234
|
this.rawData = res;
|
|
211
235
|
this.bettingTypeOptions = getEnableOptions(((_b = (_a = res === null || res === void 0 ? void 0 : res.rules) === null || _a === void 0 ? void 0 : _a.poolGame) === null || _b === void 0 ? void 0 : _b.bettingTypes) || []);
|
|
212
236
|
this.playingModeOptions = getEnableOptions(((_d = (_c = res === null || res === void 0 ? void 0 : res.rules) === null || _c === void 0 ? void 0 : _c.poolGame) === null || _d === void 0 ? void 0 : _d.playModes) || []);
|
|
237
|
+
this.initiateCurrentStake();
|
|
213
238
|
// default: select the first one
|
|
214
239
|
const { bettingType, playMode } = getDefaultType({
|
|
215
240
|
playTypeConfig: (_f = (_e = res === null || res === void 0 ? void 0 : res.rules) === null || _e === void 0 ? void 0 : _e.poolGame) === null || _f === void 0 ? void 0 : _f.playTypes,
|
|
@@ -254,7 +279,7 @@ export class LotteryTippingTicketController {
|
|
|
254
279
|
tickets: []
|
|
255
280
|
};
|
|
256
281
|
const selections = formatResultsToWinningNumbers(rawResults);
|
|
257
|
-
const stake = this.currentStake || {};
|
|
282
|
+
const stake = (this.currentStake || {});
|
|
258
283
|
body.tickets.push({
|
|
259
284
|
startingDrawId: (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw) === null || _b === void 0 ? void 0 : _b.id,
|
|
260
285
|
amount: this.calculateTotalAmount().toString(),
|
|
@@ -303,6 +328,7 @@ export class LotteryTippingTicketController {
|
|
|
303
328
|
return _ + ' ' + unit;
|
|
304
329
|
}
|
|
305
330
|
renderBettingControls() {
|
|
331
|
+
var _a;
|
|
306
332
|
const renderSkeleton = () => (h("div", { class: "skeleton-content" }, h("div", { class: "skeleton-item skeleton-animated" })));
|
|
307
333
|
const renderBettingTypeOptions = () => (h("div", { class: "LotteryTippingTicketController__segmented-control" }, this.bettingTypeOptions.map((item) => (h("button", { class: {
|
|
308
334
|
LotteryTippingTicketController__segment: true,
|
|
@@ -312,10 +338,15 @@ export class LotteryTippingTicketController {
|
|
|
312
338
|
LotteryTippingTicketController__segment: true,
|
|
313
339
|
'LotteryTippingTicketController__segment--active': this.selectedPlayingMode === item.code
|
|
314
340
|
}, onClick: this.handlePlayingModeChange.bind(this, item.code) }, item.name)))));
|
|
315
|
-
|
|
341
|
+
const renderingStakeOptions = () => {
|
|
342
|
+
var _a;
|
|
343
|
+
return (h("div", null, h("vaadin-select", { items: this.stakeOptions || [], value: ((_a = this.currentStake) === null || _a === void 0 ? void 0 : _a.value) || '', "on-value-changed": this.onStakeChange.bind(this), "no-vertical-overlap": true })));
|
|
344
|
+
};
|
|
345
|
+
return (h("div", { class: "LotteryTippingTicketController__top" }, h("div", { class: "LotteryTippingTicketController__row" }, h("div", { class: "LotteryTippingTicketController__section" }, h("span", { class: "LotteryTippingTicketController__label" }, translate('bettingType', this.language)), !!this.bettingTypeOptions.length ? renderBettingTypeOptions() : renderSkeleton()), h("div", { class: "LotteryTippingTicketController__section" }, h("span", { class: "LotteryTippingTicketController__label" }, translate('playingMode', this.language)), !!this.playingModeOptions.length ? renderPlayingModeOptions() : renderSkeleton()), ((_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.length) > 1 && (h("div", { class: "LotteryTippingTicketController__section" }, h("span", { class: "LotteryTippingTicketController__label" }, translate('stakePerLine', this.language)), renderingStakeOptions())))));
|
|
316
346
|
}
|
|
317
347
|
renderOrderSummary() {
|
|
318
|
-
|
|
348
|
+
var _a;
|
|
349
|
+
return (h("div", { class: "LotteryTippingTicketController__main--right order-summary" }, h("h3", { class: "order-summary__title" }, translate('orderSummaryTitle', this.language)), h("div", { class: "order-summary__ticket-info" }, h("div", { class: "order-summary__ticket" }, translate('orderSummaryTickets', this.language), ":"), h("div", { class: "order-summary__details" }, h("span", { class: "order-summary__line-count" }, this.lineCountRender), h("div", null, this.currentStake && h("span", { class: "order-summary__multiplier" }, "x"), h("span", { class: "order-summary__stake" }, this.currentStakeFormatted)), this.isBothBettingType && (h("div", null, h("span", { class: "order-summary__multiplier" }, "x"), h("span", { class: "order-summary__stake" }, this.bothBettingTypeMultiplier))))), h("hr", { class: "order-summary__divider" }), h("div", { class: "order-summary__ticket-info" }, h("div", { class: "order-summary__ticket" }, translate('orderSummaryTotal', this.language), ":"), h("span", { class: "order-summary__details" }, this.totalAmountFormatted)), h("div", { class: "order-summary__button-wrapper" }, h("lottery-button", { onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: !this.hasSelectAllBullet || this.submitLoading || ((_a = this.currentStake) === null || _a === void 0 ? void 0 : _a.value) === undefined, text: translate('orderSummarySubmit', this.language) }))));
|
|
319
350
|
}
|
|
320
351
|
get formattedTurnover() {
|
|
321
352
|
var _a, _b;
|
|
@@ -327,7 +358,7 @@ export class LotteryTippingTicketController {
|
|
|
327
358
|
}
|
|
328
359
|
render() {
|
|
329
360
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
330
|
-
return (h("div", { key: '
|
|
361
|
+
return (h("div", { key: 'bc9858c6923707b9d5e4fca7b57e272143f895aa', class: "lottery-tipping-ticket-controller__container", ref: (el) => (this.stylingContainer = el) }, h("lottery-tipping-ticket-banner", { key: '2a220d90a4ab73f220d9d47db47e10749cb33cdd', "client-styling": this.clientStyling, "client-styling-Url": this.clientStylingUrl, stopTime: (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw) === null || _b === void 0 ? void 0 : _b.wagerCloseTime, period: (_d = (_c = this.rawData) === null || _c === void 0 ? void 0 : _c.currentDraw) === null || _d === void 0 ? void 0 : _d.date, "formatted-turnover": this.formattedTurnover, language: this.language, "translation-url": this.translationUrl, "logo-url": this.logoUrl }), this.renderBettingControls(), h("div", { key: '9d548c6d3d01ee4ed2e68481a00f4667e50a418b', class: "flex flex-wrap LotteryTippingTicketController__main" }, h("div", { key: '647ff830980982139f270f12a5286eb80a2f7b9e', class: "LotteryTippingTicketController__main--left" }, h("lottery-tipping-ticket-bet", { key: '0151d3830fcec76574016a97a953a12817450280', ref: (el) => (this.childRef = el), endpoint: this.endpoint, "session-id": this.sessionId, "game-id": (_e = this.rawData) === null || _e === void 0 ? void 0 : _e.type, "draw-id": this.drawId, language: this.language, "translation-url": this.translationUrl, "max-total-pages": this.lineNumberRange.maxLineNumber, "min-total-pages": this.lineNumberRange.minLineNumber, "total-pages": this.lineNumberRange.defaultBoards, mode: this.selectedPlayingMode === PlayModeEnum.SingleBet ? 'single' : 'multi', "client-styling": this.clientStyling, "client-styling-Url": this.clientStylingUrl })), this.renderOrderSummary()), this.dialogConfig.visible && (h("vaadin-confirm-dialog", { key: '5153f04448556bca403aeadfca6b573e0dc9b832', rejectButtonVisible: true, rejectText: translate('cancel', this.language), confirmText: translate('confirm', this.language), opened: (_f = this.dialogConfig) === null || _f === void 0 ? void 0 : _f.visible, onConfirm: this.dialogConfig.onConfirm, onReject: this.dialogConfig.onCancel }, (_g = this.dialogConfig) === null || _g === void 0 ? void 0 : _g.content))));
|
|
331
362
|
}
|
|
332
363
|
static get is() { return "lottery-tipping-ticket-controller"; }
|
|
333
364
|
static get encapsulation() { return "shadow"; }
|
|
@@ -585,6 +616,7 @@ export class LotteryTippingTicketController {
|
|
|
585
616
|
"submitLoading": {},
|
|
586
617
|
"rawData": {},
|
|
587
618
|
"saleStatisticsInfo": {},
|
|
619
|
+
"currentStake": {},
|
|
588
620
|
"dialogConfig": {}
|
|
589
621
|
};
|
|
590
622
|
}
|
|
@@ -146,3 +146,4 @@ export const getPlayTypeConfig = ({ rawData, selectedBettingType, selectedPlayin
|
|
|
146
146
|
const betType = (_f = (_e = rawData === null || rawData === void 0 ? void 0 : rawData.rules) === null || _e === void 0 ? void 0 : _e.betTypes) === null || _f === void 0 ? void 0 : _f.find((i) => i.id === betTypeId);
|
|
147
147
|
return { betTypeId, betType };
|
|
148
148
|
};
|
|
149
|
+
export const getMinValue = (arr) => (arr.length ? Math.min.apply(null, arr) : undefined);
|