@everymatrix/lottery-tipping-latest-result 1.86.26 → 1.86.28
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_6.cjs.entry.js → general-tooltip_7.cjs.entry.js} +428 -254
- package/dist/cjs/{index-2ca263e9.js → index-6a03d840.js} +3 -2
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{lottery-tipping-latest-result-3b809e79.js → lottery-tipping-latest-result-1763f6ca.js} +75 -46
- package/dist/cjs/lottery-tipping-latest-result.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/lottery-tipping-calendar/lottery-tipping-calendar.css +1 -1
- package/dist/collection/components/lottery-tipping-calendar/lottery-tipping-calendar.js +2 -2
- package/dist/collection/components/lottery-tipping-latest-result/lottery-tipping-latest-result.css +6 -0
- package/dist/collection/components/lottery-tipping-latest-result/lottery-tipping-latest-result.js +46 -38
- package/dist/collection/utils/api.js +10 -0
- package/dist/collection/utils/utils.js +22 -25
- package/dist/esm/{general-tooltip_6.entry.js → general-tooltip_7.entry.js} +429 -256
- package/dist/esm/{index-32d8a144.js → index-52961f92.js} +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{lottery-tipping-latest-result-c2b7bf41.js → lottery-tipping-latest-result-59297760.js} +75 -46
- package/dist/esm/lottery-tipping-latest-result.js +3 -3
- package/dist/lottery-tipping-latest-result/{general-tooltip_6.entry.js → general-tooltip_7.entry.js} +239 -239
- package/dist/lottery-tipping-latest-result/{index-32d8a144.js → index-52961f92.js} +2 -2
- package/dist/lottery-tipping-latest-result/index.esm.js +1 -1
- package/dist/lottery-tipping-latest-result/lottery-tipping-latest-result-59297760.js +1 -0
- package/dist/lottery-tipping-latest-result/lottery-tipping-latest-result.esm.js +1 -1
- package/dist/types/components/lottery-tipping-latest-result/lottery-tipping-latest-result.d.ts +4 -4
- package/dist/types/components.d.ts +0 -8
- package/dist/types/models/index.d.ts +17 -0
- package/dist/types/utils/api.d.ts +6 -0
- package/dist/types/utils/utils.d.ts +4 -2
- package/package.json +1 -1
- package/dist/lottery-tipping-latest-result/lottery-tipping-latest-result-c2b7bf41.js +0 -1
package/dist/collection/components/lottery-tipping-latest-result/lottery-tipping-latest-result.js
CHANGED
|
@@ -6,6 +6,8 @@ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../.
|
|
|
6
6
|
import { differenceInMilliseconds } from "date-fns";
|
|
7
7
|
import { getTranslations, translate } from "../../utils/locale.utils";
|
|
8
8
|
import { fetchGameInfo, fetchRequest, formattedTurnover, parseEachLineNumber, thousandSeperator, toQueryParams } from "../../utils/utils";
|
|
9
|
+
import { fetchSaleStatistics } from "../../utils/api";
|
|
10
|
+
import "../../../../../ui-skeleton/dist/types/index";
|
|
9
11
|
const leftArrowIcon = renderIconDefinitionToSVGElement(LeftOutlined, {
|
|
10
12
|
extraSVGAttrs: { width: '16px', height: '16px', fill: '' }
|
|
11
13
|
});
|
|
@@ -20,7 +22,6 @@ export class LotteryTippingLatestResult {
|
|
|
20
22
|
this.translationUrl = '';
|
|
21
23
|
this.language = 'en';
|
|
22
24
|
this.endpoint = undefined;
|
|
23
|
-
this.endpointTicket = undefined;
|
|
24
25
|
this.gameId = undefined;
|
|
25
26
|
this.playerId = undefined;
|
|
26
27
|
this.sessionId = undefined;
|
|
@@ -35,10 +36,11 @@ export class LotteryTippingLatestResult {
|
|
|
35
36
|
this.curPrizes = undefined;
|
|
36
37
|
this.curPrizeMap = {};
|
|
37
38
|
this.curTurnOver = 0;
|
|
38
|
-
this.isLoading =
|
|
39
|
+
this.isLoading = true;
|
|
39
40
|
this.playTypes = null;
|
|
40
41
|
this.bettingTypes = undefined;
|
|
41
42
|
this.vendorGameId = undefined;
|
|
43
|
+
this.isLoadingTurnover = false;
|
|
42
44
|
}
|
|
43
45
|
handleClientStylingChange(newValue, oldValue) {
|
|
44
46
|
if (newValue != oldValue) {
|
|
@@ -59,8 +61,20 @@ export class LotteryTippingLatestResult {
|
|
|
59
61
|
if (this.translationUrl) {
|
|
60
62
|
getTranslations(JSON.parse(this.translationUrl));
|
|
61
63
|
}
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
+
this.initData();
|
|
65
|
+
}
|
|
66
|
+
async initData() {
|
|
67
|
+
try {
|
|
68
|
+
this.isLoading = true;
|
|
69
|
+
await Promise.all([this.getGameById(), this.fetDrawList()]);
|
|
70
|
+
this.getTurnOver();
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
console.error(e);
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
this.isLoading = false;
|
|
77
|
+
}
|
|
64
78
|
}
|
|
65
79
|
componentDidLoad() {
|
|
66
80
|
if (this.stylingContainer) {
|
|
@@ -78,7 +92,6 @@ export class LotteryTippingLatestResult {
|
|
|
78
92
|
async getGameById() {
|
|
79
93
|
var _a, _b, _c, _d;
|
|
80
94
|
try {
|
|
81
|
-
this.isLoading = true;
|
|
82
95
|
const gameInfo = await fetchGameInfo(this.endpoint, this.gameId);
|
|
83
96
|
this.vendorGameId = gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.type;
|
|
84
97
|
this.playTypes = (_b = (_a = gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.rules) === null || _a === void 0 ? void 0 : _a.poolGame) === null || _b === void 0 ? void 0 : _b.playTypes;
|
|
@@ -87,9 +100,6 @@ export class LotteryTippingLatestResult {
|
|
|
87
100
|
catch (e) {
|
|
88
101
|
console.log(e);
|
|
89
102
|
}
|
|
90
|
-
finally {
|
|
91
|
-
this.isLoading = false;
|
|
92
|
-
}
|
|
93
103
|
}
|
|
94
104
|
findLatestDateIdx(dateArr) {
|
|
95
105
|
const currentDate = new Date();
|
|
@@ -107,7 +117,6 @@ export class LotteryTippingLatestResult {
|
|
|
107
117
|
}
|
|
108
118
|
async fetDrawList() {
|
|
109
119
|
try {
|
|
110
|
-
this.isLoading = true;
|
|
111
120
|
const GAME_DRAW_LIMIT = 9999;
|
|
112
121
|
const filterData = { status: 'PAYABLE', limit: GAME_DRAW_LIMIT };
|
|
113
122
|
const { items } = await fetchRequest(`${this.endpoint}/games/${this.gameId}/draws${toQueryParams(filterData)}`, 'GET');
|
|
@@ -123,7 +132,7 @@ export class LotteryTippingLatestResult {
|
|
|
123
132
|
this.curDrawItem = filteredItems[this.curDrawItemIdx];
|
|
124
133
|
this.curDrawSelectionBettingType = filteredItems[this.curDrawItemIdx].winningNumbers[0].winning_type;
|
|
125
134
|
this.curDrawItem.winningNumbers.forEach((item) => {
|
|
126
|
-
this.curDrawSelectionMap[item.winning_type] = [parseEachLineNumber(item.
|
|
135
|
+
this.curDrawSelectionMap[item.winning_type] = [parseEachLineNumber(item.poolGameOutcomes)];
|
|
127
136
|
});
|
|
128
137
|
this.curDrawItem.prizes.forEach((prize) => {
|
|
129
138
|
const winningType = prize.winningType;
|
|
@@ -137,14 +146,10 @@ export class LotteryTippingLatestResult {
|
|
|
137
146
|
});
|
|
138
147
|
this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
|
|
139
148
|
this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
|
|
140
|
-
this.curTurnOver = this.curPrizes.reduce((acc, cur) => acc + Number(cur.totalAmount.value), 0);
|
|
141
149
|
}
|
|
142
150
|
catch (e) {
|
|
143
151
|
console.log(e);
|
|
144
152
|
}
|
|
145
|
-
finally {
|
|
146
|
-
this.isLoading = false;
|
|
147
|
-
}
|
|
148
153
|
}
|
|
149
154
|
get displayedPrizes() {
|
|
150
155
|
const correctItems = this.curPrizes
|
|
@@ -163,7 +168,7 @@ export class LotteryTippingLatestResult {
|
|
|
163
168
|
this.curDrawItem = this.drawList[idx];
|
|
164
169
|
this.curDrawSelectionBettingType = this.curDrawItem.winningNumbers[0].winning_type;
|
|
165
170
|
this.curDrawItem.winningNumbers.forEach((item) => {
|
|
166
|
-
this.curDrawSelectionMap[item.winning_type] = [parseEachLineNumber(item.
|
|
171
|
+
this.curDrawSelectionMap[item.winning_type] = [parseEachLineNumber(item.poolGameOutcomes)];
|
|
167
172
|
});
|
|
168
173
|
this.curPrizeMap = {};
|
|
169
174
|
this.curDrawItem.prizes.forEach((prize) => {
|
|
@@ -178,7 +183,7 @@ export class LotteryTippingLatestResult {
|
|
|
178
183
|
});
|
|
179
184
|
this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
|
|
180
185
|
this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
|
|
181
|
-
this.
|
|
186
|
+
this.getTurnOver();
|
|
182
187
|
}
|
|
183
188
|
handleChangeDate(e) {
|
|
184
189
|
const idx = e.detail;
|
|
@@ -194,12 +199,31 @@ export class LotteryTippingLatestResult {
|
|
|
194
199
|
this.changeCurDateItem(++this.curDrawItemIdx);
|
|
195
200
|
}
|
|
196
201
|
}
|
|
202
|
+
async getTurnOver() {
|
|
203
|
+
var _a, _b, _c;
|
|
204
|
+
if (!((_a = this.curDrawItem) === null || _a === void 0 ? void 0 : _a.id))
|
|
205
|
+
return;
|
|
206
|
+
try {
|
|
207
|
+
this.isLoadingTurnover = true;
|
|
208
|
+
const res = await fetchSaleStatistics({
|
|
209
|
+
endpoint: this.endpoint,
|
|
210
|
+
gameId: this.vendorGameId,
|
|
211
|
+
drawId: this.curDrawItem.id
|
|
212
|
+
});
|
|
213
|
+
this.curTurnOver = (_c = (_b = res === null || res === void 0 ? void 0 : res.wagerSegment) === null || _b === void 0 ? void 0 : _b.totalSalesCrossDraw) !== null && _c !== void 0 ? _c : 0;
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
console.error(e);
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
this.isLoadingTurnover = false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
197
222
|
handleDrawBettingTypeChange(bettingType) {
|
|
198
223
|
this.curDrawSelectionBettingType = bettingType;
|
|
199
224
|
this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
|
|
200
225
|
this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
|
|
201
|
-
|
|
202
|
-
this.curTurnOver = this.curPrizes.reduce((acc, cur) => acc + Number(cur.totalAmount.value), 0);
|
|
226
|
+
this.getTurnOver();
|
|
203
227
|
}
|
|
204
228
|
getBettingTypeName(bettingType) {
|
|
205
229
|
var _a, _b;
|
|
@@ -207,10 +231,10 @@ export class LotteryTippingLatestResult {
|
|
|
207
231
|
return name !== null && name !== void 0 ? name : bettingType;
|
|
208
232
|
}
|
|
209
233
|
render() {
|
|
210
|
-
return (h("div", { key: '
|
|
234
|
+
return (h("div", { key: 'e104fc35ddcdaad1e461bcc867f779dc90254bc6', class: "lottery-tipping-latest-result", ref: (el) => (this.stylingContainer = el) }, this.curDrawSelection && this.curDrawSelection.length > 0 && (h("div", { key: '085e418338a52262e8866f300be8e67f4d3bbfc7', class: "result-wrapper" }, h("div", { key: '7cf61f06f845fb6aabe53896163fa402b1e52a26', class: "date-selection" }, h("div", { key: 'da4abd68318c454324a665f6e02257dda4f224be', class: "date-selection-leftIcon", innerHTML: leftArrowIcon, onClick: this.preDraw.bind(this) }), h("div", { key: '938f8f160c10eae2678dc7a98027a3421409f096', class: "date-selection-calendar" }, h("lottery-tipping-calendar", { key: 'c8048c6977b3740b8d2e0e7eff3292c329cdc4be', date: this.lastestDate, highLightDates: this.hasDrawDates, language: this.language, "mb-source": this.mbSource, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl })), h("div", { key: 'eb17af80ec1b1c38f9d51b878013477290c824d7', class: "date-selection-rightIcon", innerHTML: rightArrowIcon, onClick: this.nextDraw.bind(this) })), h("div", { key: 'ab7ad2efffe5f9437db6a77b0b0c60e3d9454c5e', class: "winning-result" }, h("div", { key: 'e6a7ae5ba4c6c967858bb6e4e9a7a75246ec86f2', class: "betting-type" }, h("div", { key: '341e5ee07c3e588b154d3a73373bed40a8e51a90', class: "betting-type-title" }, translate('bettingType', this.language)), h("div", { key: 'f824ded5140f92aee54748939fecb5aac692cd6f', class: "betting-type-text" }, h("div", { key: '85cb8c0a387b378b36f05af6703c023d9b0819f9', class: "LotteryTippingTicketController__segmented-control" }, Object.keys(this.curDrawSelectionMap).map((bettingType) => (h("button", { class: {
|
|
211
235
|
LotteryTippingTicketController__segment: true,
|
|
212
236
|
'LotteryTippingTicketController__segment--active': this.curDrawSelectionBettingType === bettingType
|
|
213
|
-
}, onClick: this.handleDrawBettingTypeChange.bind(this, bettingType) }, this.getBettingTypeName(bettingType))))))), h("lottery-tipping-ticket-bet", { key: '
|
|
237
|
+
}, onClick: this.handleDrawBettingTypeChange.bind(this, bettingType) }, this.getBettingTypeName(bettingType))))))), h("lottery-tipping-ticket-bet", { key: '06293a063a9ac5f0f59ab8ec9033df764eadd511', "session-id": this.sessionId, endpoint: this.endpoint, "game-id": this.vendorGameId, "draw-id": this.curDrawItem.id, "default-bullet-config-line-group": JSON.stringify(this.curDrawSelection), "read-pretty": true, "total-pages": this.curDrawSelection.length, language: this.language, "mb-source": this.mbSource, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl })), this.isLoadingTurnover ? (h("div", { class: "loading-wrap" }, h("ui-skeleton", { structure: "title", width: "140px", height: "30px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "30px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "30px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "30px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "30px" }))) : (h("div", { class: "prize-result" }, h("div", { class: "prize-result-title" }, translate('prizeAllocation', this.language, { turnover: formattedTurnover(this.curTurnOver) })), h("div", { class: "prize-result-table" }, h("div", { class: "prize-result-table-header" }, h("div", { class: "prize-result-table-row" }, h("div", { class: "prize-result-table-column" }, translate('prizes', this.language)), h("div", { class: "prize-result-table-column" }, translate('numberOfWinners', this.language)), h("div", { class: "prize-result-table-column" }, translate('prizeMoney', this.language)))), h("div", { class: "prize-result-table-body" }, this.displayedPrizes.map((prize) => (h("div", { class: "prize-result-table-row" }, h("div", { class: "prize-result-table-column" }, prize.divisionDisplayName), h("div", { class: "prize-result-table-column" }, prize.players), h("div", { class: "prize-result-table-column" }, thousandSeperator(prize.totalAmount.value))))))))))), this.curDrawSelection.length == 0 && !this.isLoading && (h("div", { key: '9aa470442a1f2b4600d0f7727210e71cebf934c8' }, translate('noLatestResult', this.language))), this.isLoading && h("div", { key: '4568a1cda8eca35552d84075fbc4507d397e3178', class: "loading-wrap" }, translate('loading', this.language))));
|
|
214
238
|
}
|
|
215
239
|
static get is() { return "lottery-tipping-latest-result"; }
|
|
216
240
|
static get encapsulation() { return "shadow"; }
|
|
@@ -330,23 +354,6 @@ export class LotteryTippingLatestResult {
|
|
|
330
354
|
"attribute": "endpoint",
|
|
331
355
|
"reflect": true
|
|
332
356
|
},
|
|
333
|
-
"endpointTicket": {
|
|
334
|
-
"type": "string",
|
|
335
|
-
"mutable": false,
|
|
336
|
-
"complexType": {
|
|
337
|
-
"original": "string",
|
|
338
|
-
"resolved": "string",
|
|
339
|
-
"references": {}
|
|
340
|
-
},
|
|
341
|
-
"required": false,
|
|
342
|
-
"optional": false,
|
|
343
|
-
"docs": {
|
|
344
|
-
"tags": [],
|
|
345
|
-
"text": "EndpointTicket URL for the source of ticket data"
|
|
346
|
-
},
|
|
347
|
-
"attribute": "endpoint-ticket",
|
|
348
|
-
"reflect": true
|
|
349
|
-
},
|
|
350
357
|
"gameId": {
|
|
351
358
|
"type": "string",
|
|
352
359
|
"mutable": true,
|
|
@@ -416,7 +423,8 @@ export class LotteryTippingLatestResult {
|
|
|
416
423
|
"isLoading": {},
|
|
417
424
|
"playTypes": {},
|
|
418
425
|
"bettingTypes": {},
|
|
419
|
-
"vendorGameId": {}
|
|
426
|
+
"vendorGameId": {},
|
|
427
|
+
"isLoadingTurnover": {}
|
|
420
428
|
};
|
|
421
429
|
}
|
|
422
430
|
static get watchers() {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { fetchRequest } from "./utils";
|
|
2
|
+
export async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
|
|
3
|
+
try {
|
|
4
|
+
const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/saleStatistics`);
|
|
5
|
+
return res;
|
|
6
|
+
}
|
|
7
|
+
catch (error) {
|
|
8
|
+
return Promise.reject(error);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -108,33 +108,30 @@ const bulletMap = {
|
|
|
108
108
|
'1': 'X',
|
|
109
109
|
'2': '2'
|
|
110
110
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
value: bulletMap[key]
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
return bulletArr;
|
|
111
|
+
function parseBulletNumber(numberArr) {
|
|
112
|
+
return numberArr.map((v, index) => ({
|
|
113
|
+
isSelected: v === 1,
|
|
114
|
+
value: bulletMap[index]
|
|
115
|
+
}));
|
|
120
116
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
117
|
+
const outcomeIndexMap = {
|
|
118
|
+
H: 0,
|
|
119
|
+
D: 1,
|
|
120
|
+
A: 2
|
|
121
|
+
};
|
|
122
|
+
export const parseEachLineNumber = (outcomes) => {
|
|
123
|
+
const res = outcomes.map((matchOutcomes) => {
|
|
124
|
+
const selected = matchOutcomes[0];
|
|
125
|
+
const result = [0, 0, 0];
|
|
126
|
+
selected.forEach((outcome) => {
|
|
127
|
+
const idx = outcomeIndexMap[outcome];
|
|
128
|
+
if (idx !== undefined)
|
|
129
|
+
result[idx] = 1;
|
|
130
|
+
});
|
|
131
|
+
return parseBulletNumber(result);
|
|
135
132
|
});
|
|
136
|
-
return
|
|
137
|
-
}
|
|
133
|
+
return res;
|
|
134
|
+
};
|
|
138
135
|
export function thousandSeperator(value) {
|
|
139
136
|
if (value === 0) {
|
|
140
137
|
return '0';
|