@everymatrix/lottery-tipping-latest-result 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.
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/general-tooltip_6.cjs.entry.js +9968 -0
- package/dist/cjs/index-e5294eca.js +1376 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/lottery-tipping-latest-result-c9dbebc8.js +650 -0
- package/dist/cjs/lottery-tipping-latest-result.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +28 -0
- package/dist/collection/components/lottery-tipping-calendar/lottery-tipping-calendar.css +130 -0
- package/dist/collection/components/lottery-tipping-calendar/lottery-tipping-calendar.js +306 -0
- package/dist/collection/components/lottery-tipping-latest-result/index.js +1 -0
- package/dist/collection/components/lottery-tipping-latest-result/lottery-tipping-latest-result.css +133 -0
- package/dist/collection/components/lottery-tipping-latest-result/lottery-tipping-latest-result.js +432 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/models/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +67 -0
- package/dist/collection/utils/utils.js +159 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/general-tooltip_6.entry.js +9960 -0
- package/dist/esm/index-0975f224.js +1347 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/lottery-tipping-latest-result-2ee900c2.js +639 -0
- package/dist/esm/lottery-tipping-latest-result.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lottery-tipping-latest-result/app-globals-0f993ce5.js +1 -0
- package/dist/lottery-tipping-latest-result/general-tooltip_6.entry.js +6656 -0
- package/dist/lottery-tipping-latest-result/index-0975f224.js +2 -0
- package/dist/lottery-tipping-latest-result/index.esm.js +1 -0
- package/dist/lottery-tipping-latest-result/lottery-tipping-latest-result-2ee900c2.js +1 -0
- package/dist/lottery-tipping-latest-result/lottery-tipping-latest-result.esm.js +1 -0
- package/dist/static/add.svg +8 -0
- package/dist/static/delete.svg +37 -0
- package/dist/static/info.svg +6 -0
- package/dist/static/left-arrow.svg +15 -0
- package/dist/static/loading.svg +10 -0
- package/dist/static/right-arrow.svg +15 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/packages/stencil/lottery-tipping-latest-result/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/packages/stencil/lottery-tipping-latest-result/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/packages/stencil/lottery-tipping-latest-result/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/packages/stencil/lottery-tipping-latest-result/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/tools/plugins/index.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/lottery-tipping-calendar/lottery-tipping-calendar.d.ts +62 -0
- package/dist/types/components/lottery-tipping-latest-result/index.d.ts +1 -0
- package/dist/types/components/lottery-tipping-latest-result/lottery-tipping-latest-result.d.ts +74 -0
- package/dist/types/components.d.ts +148 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/index.d.ts +130 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +10 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
package/dist/collection/components/lottery-tipping-latest-result/lottery-tipping-latest-result.js
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
3
|
+
import { LeftOutlined, RightOutlined } from "@ant-design/icons-svg";
|
|
4
|
+
import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers";
|
|
5
|
+
import { fetchRequest, toQueryParams, parseEachLineNumber, thousandSeperator, fetchGameInfo } from "../../utils/utils";
|
|
6
|
+
import "../../../../../lottery-tipping-ticket-bet/dist/types/index";
|
|
7
|
+
import { differenceInMilliseconds } from "date-fns";
|
|
8
|
+
import { translate, getTranslations } from "../../utils/locale.utils";
|
|
9
|
+
const leftArrowIcon = renderIconDefinitionToSVGElement(LeftOutlined, {
|
|
10
|
+
extraSVGAttrs: { width: '16px', height: '16px', fill: '' }
|
|
11
|
+
});
|
|
12
|
+
const rightArrowIcon = renderIconDefinitionToSVGElement(RightOutlined, {
|
|
13
|
+
extraSVGAttrs: { width: '16px', height: '16px', fill: '' }
|
|
14
|
+
});
|
|
15
|
+
export class LotteryTippingLatestResult {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.mbSource = undefined;
|
|
18
|
+
this.clientStyling = undefined;
|
|
19
|
+
this.clientStylingUrl = undefined;
|
|
20
|
+
this.translationUrl = '';
|
|
21
|
+
this.language = 'en';
|
|
22
|
+
this.endpoint = undefined;
|
|
23
|
+
this.endpointTicket = undefined;
|
|
24
|
+
this.gameId = undefined;
|
|
25
|
+
this.playerId = undefined;
|
|
26
|
+
this.sessionId = undefined;
|
|
27
|
+
this.hasDrawDates = ['2025-05-28T02:00:00Z', '2025-05-16T02:00:00Z'];
|
|
28
|
+
this.lastestDate = '2025-05-28T02:00:00Z';
|
|
29
|
+
this.drawList = undefined;
|
|
30
|
+
this.curDrawItem = undefined;
|
|
31
|
+
this.curDrawItemIdx = 0;
|
|
32
|
+
this.curDrawSelection = [];
|
|
33
|
+
this.curDrawSelectionBettingType = undefined;
|
|
34
|
+
this.curDrawSelectionMap = {};
|
|
35
|
+
this.curPrizes = undefined;
|
|
36
|
+
this.curPrizeMap = {};
|
|
37
|
+
this.curTurnOver = 0;
|
|
38
|
+
this.isLoading = false;
|
|
39
|
+
this.playTypes = null;
|
|
40
|
+
this.bettingTypes = undefined;
|
|
41
|
+
this.vendorGameId = undefined;
|
|
42
|
+
}
|
|
43
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
44
|
+
if (newValue != oldValue) {
|
|
45
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
49
|
+
if (newValue != oldValue) {
|
|
50
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
54
|
+
if (newValue != oldValue) {
|
|
55
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
componentWillLoad() {
|
|
59
|
+
if (this.translationUrl) {
|
|
60
|
+
getTranslations(JSON.parse(this.translationUrl));
|
|
61
|
+
}
|
|
62
|
+
this.getGameById();
|
|
63
|
+
this.fetDrawList();
|
|
64
|
+
}
|
|
65
|
+
componentDidLoad() {
|
|
66
|
+
if (this.stylingContainer) {
|
|
67
|
+
if (this.mbSource)
|
|
68
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
69
|
+
if (this.clientStyling)
|
|
70
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
71
|
+
if (this.clientStylingUrl)
|
|
72
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
77
|
+
}
|
|
78
|
+
async getGameById() {
|
|
79
|
+
var _a, _b, _c, _d;
|
|
80
|
+
try {
|
|
81
|
+
this.isLoading = true;
|
|
82
|
+
const gameInfo = await fetchGameInfo(this.endpoint, this.gameId);
|
|
83
|
+
this.vendorGameId = gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.type;
|
|
84
|
+
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;
|
|
85
|
+
this.bettingTypes = (_d = (_c = gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.rules) === null || _c === void 0 ? void 0 : _c.poolGame) === null || _d === void 0 ? void 0 : _d.bettingTypes;
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
console.log(e);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
this.isLoading = false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
findLatestDateIdx(dateArr) {
|
|
95
|
+
const currentDate = new Date();
|
|
96
|
+
let closestIndex = 0;
|
|
97
|
+
let minDiff = Infinity;
|
|
98
|
+
dateArr.forEach((dateStr, index) => {
|
|
99
|
+
const date = new Date(dateStr);
|
|
100
|
+
const diff = Math.abs(differenceInMilliseconds(currentDate, date));
|
|
101
|
+
if (diff < minDiff) {
|
|
102
|
+
minDiff = diff;
|
|
103
|
+
closestIndex = index;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return closestIndex;
|
|
107
|
+
}
|
|
108
|
+
async fetDrawList() {
|
|
109
|
+
try {
|
|
110
|
+
this.isLoading = true;
|
|
111
|
+
const filterData = {
|
|
112
|
+
excludeStatus: 'INIT,OPEN,CANCELED'
|
|
113
|
+
};
|
|
114
|
+
const { items } = await fetchRequest(`${this.endpoint}/games/${this.gameId}/draws${toQueryParams(filterData)}`, 'GET');
|
|
115
|
+
if (!items || items.length === 0)
|
|
116
|
+
return;
|
|
117
|
+
const filteredItems = items.filter((item) => item.winningNumbers.length > 0);
|
|
118
|
+
filteredItems.sort((a, b) => a.date.localeCompare(b.date));
|
|
119
|
+
this.drawList = filteredItems;
|
|
120
|
+
this.hasDrawDates = filteredItems.map((item) => item.date);
|
|
121
|
+
this.curDrawItemIdx = this.findLatestDateIdx(this.hasDrawDates);
|
|
122
|
+
this.lastestDate = this.hasDrawDates[this.curDrawItemIdx];
|
|
123
|
+
//set the first draw as default value
|
|
124
|
+
this.curDrawItem = filteredItems[this.curDrawItemIdx];
|
|
125
|
+
this.curDrawSelectionBettingType = filteredItems[this.curDrawItemIdx].winningNumbers[0].winning_type;
|
|
126
|
+
this.curDrawItem.winningNumbers.forEach((item) => {
|
|
127
|
+
this.curDrawSelectionMap[item.winning_type] = [parseEachLineNumber(item.numbers)];
|
|
128
|
+
});
|
|
129
|
+
this.curDrawItem.prizes.forEach((prize) => {
|
|
130
|
+
const winningType = prize.winningType;
|
|
131
|
+
if (!this.curPrizeMap[winningType]) {
|
|
132
|
+
this.curPrizeMap[winningType] = [prize];
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.curPrizeMap[winningType].push(prize);
|
|
136
|
+
this.curPrizeMap[winningType].sort((a, b) => b.totalAmount.value - a.totalAmount.value);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
|
|
140
|
+
this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
|
|
141
|
+
this.curTurnOver = this.curPrizes.reduce((acc, cur) => acc + Number(cur.totalAmount.value), 0);
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
console.log(e);
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
this.isLoading = false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
changeCurDateItem(idx) {
|
|
151
|
+
this.lastestDate = this.hasDrawDates[idx];
|
|
152
|
+
this.curDrawItemIdx = idx;
|
|
153
|
+
this.curDrawItem = this.drawList[idx];
|
|
154
|
+
this.curDrawSelectionBettingType = this.curDrawItem.winningNumbers[0].winning_type;
|
|
155
|
+
this.curDrawItem.winningNumbers.forEach((item) => {
|
|
156
|
+
this.curDrawSelectionMap[item.winning_type] = [parseEachLineNumber(item.numbers)];
|
|
157
|
+
});
|
|
158
|
+
this.curPrizeMap = {};
|
|
159
|
+
this.curDrawItem.prizes.forEach((prize) => {
|
|
160
|
+
const winningType = prize.winningType;
|
|
161
|
+
if (!this.curPrizeMap[winningType]) {
|
|
162
|
+
this.curPrizeMap[winningType] = [prize];
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
this.curPrizeMap[winningType].push(prize);
|
|
166
|
+
this.curPrizeMap[winningType].sort((a, b) => b.totalAmount.value - a.totalAmount.value);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
|
|
170
|
+
this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
|
|
171
|
+
this.curTurnOver = this.curPrizes.reduce((acc, cur) => acc + Number(cur.totalAmount.value), 0);
|
|
172
|
+
}
|
|
173
|
+
handleChangeDate(e) {
|
|
174
|
+
const idx = e.detail;
|
|
175
|
+
this.changeCurDateItem(idx);
|
|
176
|
+
}
|
|
177
|
+
preDraw() {
|
|
178
|
+
if (this.curDrawItemIdx > 0) {
|
|
179
|
+
this.changeCurDateItem(--this.curDrawItemIdx);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
nextDraw() {
|
|
183
|
+
if (this.curDrawItemIdx < this.drawList.length - 1) {
|
|
184
|
+
this.changeCurDateItem(++this.curDrawItemIdx);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
handleDrawBettingTypeChange(bettingType) {
|
|
188
|
+
this.curDrawSelectionBettingType = bettingType;
|
|
189
|
+
this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
|
|
190
|
+
this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
|
|
191
|
+
this.curTurnOver = this.curPrizes.reduce((acc, cur) => acc + Number(cur.totalAmount.value), 0);
|
|
192
|
+
}
|
|
193
|
+
getBettingTypeName(bettingType) {
|
|
194
|
+
var _a, _b;
|
|
195
|
+
const name = (_b = (_a = this.bettingTypes) === null || _a === void 0 ? void 0 : _a.find((item) => item.code === bettingType)) === null || _b === void 0 ? void 0 : _b.name;
|
|
196
|
+
return name !== null && name !== void 0 ? name : bettingType;
|
|
197
|
+
}
|
|
198
|
+
render() {
|
|
199
|
+
return (h("div", { key: 'e745605e51cfb92c4503b5e96e0142c8c6b4a8d0', class: "lottery-tipping-latest-result", ref: (el) => (this.stylingContainer = el) }, this.curDrawSelection && this.curDrawSelection.length > 0 && (h("div", { key: 'ae825710096f1ec467379bd8c62ee57a7ed472e5', class: "result-wrapper" }, h("div", { key: '1bb57f7cce3985f991eecc95546d2716b7960b17', class: "date-selection" }, h("div", { key: '9798fd769521260bf8c8e264a6eda272fb4b2841', class: "date-selection-leftIcon", innerHTML: leftArrowIcon, onClick: this.preDraw.bind(this) }), h("div", { key: '8ba6a02c69cc4c3b943a8995deaa9d9ceeb2544a', class: "date-selection-calendar" }, h("lottery-tipping-calendar", { key: 'a8f1f1f44bc77cf5cfe65434c383b875d5594ed5', date: this.lastestDate, highLightDates: this.hasDrawDates, language: this.language, "translation-url": this.translationUrl })), h("div", { key: 'b525125953bba88d153b64ee3ff72112b1ccf80f', class: "date-selection-rightIcon", innerHTML: rightArrowIcon, onClick: this.nextDraw.bind(this) })), h("div", { key: 'fcfc5e6e072049f1279fb4388471d2b339849de0', class: "winning-result" }, h("div", { key: '00b4104f637649b1e2f31cb5087d3fa53c80f98d', class: "betting-type" }, h("div", { key: '1abcbb1189d30622dc9e8601cd57dcc2275e5524', class: "betting-type-title" }, translate('bettingType', this.language)), h("div", { key: '1a963bbb6558eb52e4b69bd17025435c6fc5f4f7', class: "betting-type-text" }, h("div", { key: '8eeffcdad2700e4ab82f10ad38715a3170812444', class: "LotteryTippingTicketController__segmented-control" }, Object.keys(this.curDrawSelectionMap).map((bettingType) => (h("button", { class: {
|
|
200
|
+
LotteryTippingTicketController__segment: true,
|
|
201
|
+
'LotteryTippingTicketController__segment--active': this.curDrawSelectionBettingType === bettingType
|
|
202
|
+
}, onClick: this.handleDrawBettingTypeChange.bind(this, bettingType) }, this.getBettingTypeName(bettingType))))))), h("lottery-tipping-ticket-bet", { key: '723bbd8deda3681467d3cc3d391cf80df47f274b', "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, "translation-url": this.translationUrl })), h("div", { key: '1fd49aa75429a82e71721ff7da75ecb6b88a460b', class: "prize-result" }, h("div", { key: 'a4534c61808ec601e983cce8adda6971e91600cd', class: "prize-result-title" }, translate('prizeAllocation', this.language, { turnover: thousandSeperator(this.curTurnOver) })), h("div", { key: '515e207fcf899cb68d11bddb69522f9f5bfc6362', class: "prize-result-table" }, h("div", { key: 'd9d4b212c9d4ef6b5c2cf7b4d1aba7d710a73d5a', class: "prize-result-table-header" }, h("div", { key: '2daa570ac8e6b26d67003b1bfdb5d8af24a820a5', class: "prize-result-table-row" }, h("div", { key: 'ad5a06f05ab88d75608feaad5ab2f51ef3f02ad7', class: "prize-result-table-column" }, translate('prizes', this.language)), h("div", { key: '48fc4148c21d5c8fa51de77eea636ba19f5b518f', class: "prize-result-table-column" }, translate('numberOfWinners', this.language)), h("div", { key: '3d8880732e6d883f7f2b9a741be5b9c3aed86be2', class: "prize-result-table-column" }, translate('prizeMoney', this.language)))), h("div", { key: '85f554ac8100a75f95f61eee7d6df801b9c00d9b', class: "prize-result-table-body" }, this.curPrizes.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.tickets), h("div", { class: "prize-result-table-column" }, thousandSeperator(prize.totalAmount.value)))))))))), this.curDrawSelection.length == 0 && !this.isLoading && (h("div", { key: 'a369e399406415a630a2bd33a1c5e495c57511f7' }, translate('noLatestResult', this.language))), this.isLoading && h("div", { key: 'd37433e1e86308b269612678b04d82440ce059a7', class: "loading-wrap" }, translate('loading', this.language))));
|
|
203
|
+
}
|
|
204
|
+
static get is() { return "lottery-tipping-latest-result"; }
|
|
205
|
+
static get encapsulation() { return "shadow"; }
|
|
206
|
+
static get originalStyleUrls() {
|
|
207
|
+
return {
|
|
208
|
+
"$": ["lottery-tipping-latest-result.scss"]
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
static get styleUrls() {
|
|
212
|
+
return {
|
|
213
|
+
"$": ["lottery-tipping-latest-result.css"]
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
static get properties() {
|
|
217
|
+
return {
|
|
218
|
+
"mbSource": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"mutable": false,
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "string",
|
|
223
|
+
"resolved": "string",
|
|
224
|
+
"references": {}
|
|
225
|
+
},
|
|
226
|
+
"required": false,
|
|
227
|
+
"optional": false,
|
|
228
|
+
"docs": {
|
|
229
|
+
"tags": [],
|
|
230
|
+
"text": "Client custom styling via message bus"
|
|
231
|
+
},
|
|
232
|
+
"attribute": "mb-source",
|
|
233
|
+
"reflect": true
|
|
234
|
+
},
|
|
235
|
+
"clientStyling": {
|
|
236
|
+
"type": "string",
|
|
237
|
+
"mutable": false,
|
|
238
|
+
"complexType": {
|
|
239
|
+
"original": "string",
|
|
240
|
+
"resolved": "string",
|
|
241
|
+
"references": {}
|
|
242
|
+
},
|
|
243
|
+
"required": false,
|
|
244
|
+
"optional": false,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": "Client custom styling via string"
|
|
248
|
+
},
|
|
249
|
+
"attribute": "client-styling",
|
|
250
|
+
"reflect": true
|
|
251
|
+
},
|
|
252
|
+
"clientStylingUrl": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"mutable": false,
|
|
255
|
+
"complexType": {
|
|
256
|
+
"original": "string",
|
|
257
|
+
"resolved": "string",
|
|
258
|
+
"references": {}
|
|
259
|
+
},
|
|
260
|
+
"required": false,
|
|
261
|
+
"optional": false,
|
|
262
|
+
"docs": {
|
|
263
|
+
"tags": [],
|
|
264
|
+
"text": "Client custom styling via css file url"
|
|
265
|
+
},
|
|
266
|
+
"attribute": "client-styling-url",
|
|
267
|
+
"reflect": true
|
|
268
|
+
},
|
|
269
|
+
"translationUrl": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"mutable": false,
|
|
272
|
+
"complexType": {
|
|
273
|
+
"original": "string",
|
|
274
|
+
"resolved": "string",
|
|
275
|
+
"references": {}
|
|
276
|
+
},
|
|
277
|
+
"required": false,
|
|
278
|
+
"optional": false,
|
|
279
|
+
"docs": {
|
|
280
|
+
"tags": [],
|
|
281
|
+
"text": "Client custom translation via json file url"
|
|
282
|
+
},
|
|
283
|
+
"attribute": "translation-url",
|
|
284
|
+
"reflect": true,
|
|
285
|
+
"defaultValue": "''"
|
|
286
|
+
},
|
|
287
|
+
"language": {
|
|
288
|
+
"type": "string",
|
|
289
|
+
"mutable": false,
|
|
290
|
+
"complexType": {
|
|
291
|
+
"original": "string",
|
|
292
|
+
"resolved": "string",
|
|
293
|
+
"references": {}
|
|
294
|
+
},
|
|
295
|
+
"required": false,
|
|
296
|
+
"optional": false,
|
|
297
|
+
"docs": {
|
|
298
|
+
"tags": [],
|
|
299
|
+
"text": "Client custom language for translation"
|
|
300
|
+
},
|
|
301
|
+
"attribute": "language",
|
|
302
|
+
"reflect": true,
|
|
303
|
+
"defaultValue": "'en'"
|
|
304
|
+
},
|
|
305
|
+
"endpoint": {
|
|
306
|
+
"type": "string",
|
|
307
|
+
"mutable": false,
|
|
308
|
+
"complexType": {
|
|
309
|
+
"original": "string",
|
|
310
|
+
"resolved": "string",
|
|
311
|
+
"references": {}
|
|
312
|
+
},
|
|
313
|
+
"required": false,
|
|
314
|
+
"optional": false,
|
|
315
|
+
"docs": {
|
|
316
|
+
"tags": [],
|
|
317
|
+
"text": ""
|
|
318
|
+
},
|
|
319
|
+
"attribute": "endpoint",
|
|
320
|
+
"reflect": true
|
|
321
|
+
},
|
|
322
|
+
"endpointTicket": {
|
|
323
|
+
"type": "string",
|
|
324
|
+
"mutable": false,
|
|
325
|
+
"complexType": {
|
|
326
|
+
"original": "string",
|
|
327
|
+
"resolved": "string",
|
|
328
|
+
"references": {}
|
|
329
|
+
},
|
|
330
|
+
"required": false,
|
|
331
|
+
"optional": false,
|
|
332
|
+
"docs": {
|
|
333
|
+
"tags": [],
|
|
334
|
+
"text": "EndpointTicket URL for the source of ticket data"
|
|
335
|
+
},
|
|
336
|
+
"attribute": "endpoint-ticket",
|
|
337
|
+
"reflect": true
|
|
338
|
+
},
|
|
339
|
+
"gameId": {
|
|
340
|
+
"type": "string",
|
|
341
|
+
"mutable": true,
|
|
342
|
+
"complexType": {
|
|
343
|
+
"original": "string",
|
|
344
|
+
"resolved": "string",
|
|
345
|
+
"references": {}
|
|
346
|
+
},
|
|
347
|
+
"required": false,
|
|
348
|
+
"optional": false,
|
|
349
|
+
"docs": {
|
|
350
|
+
"tags": [],
|
|
351
|
+
"text": "GameID of the lottery game"
|
|
352
|
+
},
|
|
353
|
+
"attribute": "game-id",
|
|
354
|
+
"reflect": true
|
|
355
|
+
},
|
|
356
|
+
"playerId": {
|
|
357
|
+
"type": "number",
|
|
358
|
+
"mutable": true,
|
|
359
|
+
"complexType": {
|
|
360
|
+
"original": "number",
|
|
361
|
+
"resolved": "number",
|
|
362
|
+
"references": {}
|
|
363
|
+
},
|
|
364
|
+
"required": false,
|
|
365
|
+
"optional": false,
|
|
366
|
+
"docs": {
|
|
367
|
+
"tags": [],
|
|
368
|
+
"text": "Player ID"
|
|
369
|
+
},
|
|
370
|
+
"attribute": "player-id",
|
|
371
|
+
"reflect": true
|
|
372
|
+
},
|
|
373
|
+
"sessionId": {
|
|
374
|
+
"type": "string",
|
|
375
|
+
"mutable": true,
|
|
376
|
+
"complexType": {
|
|
377
|
+
"original": "string",
|
|
378
|
+
"resolved": "string",
|
|
379
|
+
"references": {}
|
|
380
|
+
},
|
|
381
|
+
"required": false,
|
|
382
|
+
"optional": false,
|
|
383
|
+
"docs": {
|
|
384
|
+
"tags": [],
|
|
385
|
+
"text": "GIC Session"
|
|
386
|
+
},
|
|
387
|
+
"attribute": "session-id",
|
|
388
|
+
"reflect": true
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
static get states() {
|
|
393
|
+
return {
|
|
394
|
+
"hasDrawDates": {},
|
|
395
|
+
"lastestDate": {},
|
|
396
|
+
"drawList": {},
|
|
397
|
+
"curDrawItem": {},
|
|
398
|
+
"curDrawItemIdx": {},
|
|
399
|
+
"curDrawSelection": {},
|
|
400
|
+
"curDrawSelectionBettingType": {},
|
|
401
|
+
"curDrawSelectionMap": {},
|
|
402
|
+
"curPrizes": {},
|
|
403
|
+
"curPrizeMap": {},
|
|
404
|
+
"curTurnOver": {},
|
|
405
|
+
"isLoading": {},
|
|
406
|
+
"playTypes": {},
|
|
407
|
+
"bettingTypes": {},
|
|
408
|
+
"vendorGameId": {}
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
static get watchers() {
|
|
412
|
+
return [{
|
|
413
|
+
"propName": "clientStyling",
|
|
414
|
+
"methodName": "handleClientStylingChange"
|
|
415
|
+
}, {
|
|
416
|
+
"propName": "clientStylingUrl",
|
|
417
|
+
"methodName": "handleClientStylingUrlChange"
|
|
418
|
+
}, {
|
|
419
|
+
"propName": "mbSource",
|
|
420
|
+
"methodName": "handleMbSourceChange"
|
|
421
|
+
}];
|
|
422
|
+
}
|
|
423
|
+
static get listeners() {
|
|
424
|
+
return [{
|
|
425
|
+
"name": "changeDate",
|
|
426
|
+
"method": "handleChangeDate",
|
|
427
|
+
"target": undefined,
|
|
428
|
+
"capture": false,
|
|
429
|
+
"passive": false
|
|
430
|
+
}];
|
|
431
|
+
}
|
|
432
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/lottery-tipping-latest-result';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
6
|
+
bettingType: 'Betting Type:',
|
|
7
|
+
prizeAllocation: 'Prize Allocation (Turnover: € {turnover})',
|
|
8
|
+
prizes: 'Prizes',
|
|
9
|
+
numberOfWinners: 'Number of Winners',
|
|
10
|
+
prizeMoney: 'Prize Money',
|
|
11
|
+
noLatestResult: 'No latest result.',
|
|
12
|
+
loading: 'Loading....'
|
|
13
|
+
},
|
|
14
|
+
ro: {
|
|
15
|
+
bettingType: 'Tip de pariu:',
|
|
16
|
+
prizeAllocation: 'Alocarea premiilor (Cifră de afaceri: € {turnover})',
|
|
17
|
+
prizes: 'Premii',
|
|
18
|
+
numberOfWinners: 'Număr de câștigători',
|
|
19
|
+
prizeMoney: 'Bani de premiu',
|
|
20
|
+
noLatestResult: 'Niciun rezultat recent.',
|
|
21
|
+
loading: 'Se încarcă....'
|
|
22
|
+
},
|
|
23
|
+
fr: {
|
|
24
|
+
bettingType: 'Type de pari:',
|
|
25
|
+
prizeAllocation: "Répartition des prix (Chiffre d'affaires: € {turnover})",
|
|
26
|
+
prizes: 'Prix',
|
|
27
|
+
numberOfWinners: 'Nombre de gagnants',
|
|
28
|
+
prizeMoney: 'Prix en argent',
|
|
29
|
+
noLatestResult: 'Aucun résultat récent.',
|
|
30
|
+
loading: 'Chargement....'
|
|
31
|
+
},
|
|
32
|
+
ar: {
|
|
33
|
+
bettingType: 'نوع الرهان:',
|
|
34
|
+
prizeAllocation: 'تخصيص الجائزة (دوران: € {turnover})',
|
|
35
|
+
prizes: 'الجوائز',
|
|
36
|
+
numberOfWinners: 'عدد الفائزين',
|
|
37
|
+
prizeMoney: 'أموال الجائزة',
|
|
38
|
+
noLatestResult: 'لا يوجد أحدث نتيجة.',
|
|
39
|
+
loading: 'جار التحميل....'
|
|
40
|
+
},
|
|
41
|
+
hr: {
|
|
42
|
+
bettingType: 'Vrsta oklade:',
|
|
43
|
+
prizeAllocation: 'Raspodjela nagrada (Promet: € {turnover})',
|
|
44
|
+
prizes: 'Nagrade',
|
|
45
|
+
numberOfWinners: 'Broj pobjednika',
|
|
46
|
+
prizeMoney: 'Novčana nagrada',
|
|
47
|
+
noLatestResult: 'Nema najnovijih rezultata.',
|
|
48
|
+
loading: 'Učitavanje....'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export const translate = (key, customLang, replacements) => {
|
|
52
|
+
const lang = customLang;
|
|
53
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
54
|
+
if (replacements) {
|
|
55
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
56
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return translation;
|
|
60
|
+
};
|
|
61
|
+
export const getTranslations = (data) => {
|
|
62
|
+
Object.keys(data).forEach((item) => {
|
|
63
|
+
for (let key in data[item]) {
|
|
64
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export function format(first, middle, last) {
|
|
2
|
+
return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
|
|
3
|
+
}
|
|
4
|
+
export const generateUUID = () => {
|
|
5
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
6
|
+
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
7
|
+
return v.toString(16);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export function fetchRequest(url, method = 'GET', body = null, headers = {}) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const uuid = generateUUID();
|
|
13
|
+
const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
14
|
+
if (method !== 'GET' && method !== 'HEAD') {
|
|
15
|
+
headersOrigin['X-Idempotency-Key'] = uuid;
|
|
16
|
+
}
|
|
17
|
+
const options = {
|
|
18
|
+
method,
|
|
19
|
+
headers: headersOrigin,
|
|
20
|
+
body: null
|
|
21
|
+
};
|
|
22
|
+
if (body && method !== 'GET' && method !== 'HEAD') {
|
|
23
|
+
options.body = JSON.stringify(body);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
delete options.body;
|
|
27
|
+
}
|
|
28
|
+
fetch(url, options)
|
|
29
|
+
.then((response) => {
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
32
|
+
}
|
|
33
|
+
return response.json();
|
|
34
|
+
})
|
|
35
|
+
.then((data) => resolve(data))
|
|
36
|
+
.catch((error) => reject(error));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function isEmptyValueOfArray(arr) {
|
|
40
|
+
if (arr.length === 0) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
const len = arr.length;
|
|
44
|
+
let count = 0;
|
|
45
|
+
for (let i = 0; i < len; i++) {
|
|
46
|
+
if (isEmptyValue(arr[i])) {
|
|
47
|
+
count++;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (count === len) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
function isEmptyValueOfObject(obj) {
|
|
59
|
+
if (Object.keys(obj).length === 0) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
const len = Object.keys(obj).length;
|
|
63
|
+
let count = 0;
|
|
64
|
+
for (const val of Object.values(obj)) {
|
|
65
|
+
if (isEmptyValue(val)) {
|
|
66
|
+
count++;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (count === len) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
export function isEmptyValue(value, allowZero) {
|
|
78
|
+
if (value === null || value === undefined || value === '') {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
else if (value === 0 && allowZero) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
else if (Array.isArray(value)) {
|
|
85
|
+
return isEmptyValueOfArray(value);
|
|
86
|
+
}
|
|
87
|
+
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
88
|
+
return isEmptyValueOfObject(value);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return !value;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export function toQueryParams(params) {
|
|
95
|
+
const finalParams = {};
|
|
96
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
97
|
+
if (!isEmptyValue(value, true)) {
|
|
98
|
+
finalParams[key] = value;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const queryString = Object.entries(finalParams)
|
|
102
|
+
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
103
|
+
.join('&');
|
|
104
|
+
return queryString ? `?${queryString}` : '';
|
|
105
|
+
}
|
|
106
|
+
const bulletMap = {
|
|
107
|
+
'0': '1',
|
|
108
|
+
'1': 'X',
|
|
109
|
+
'2': '2'
|
|
110
|
+
};
|
|
111
|
+
export function parseBulletNumber(numberArr) {
|
|
112
|
+
const bulletArr = [];
|
|
113
|
+
Object.keys(bulletMap).forEach((key) => {
|
|
114
|
+
bulletArr.push({
|
|
115
|
+
isSelected: numberArr.includes(Number(key)),
|
|
116
|
+
value: bulletMap[key]
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
return bulletArr;
|
|
120
|
+
}
|
|
121
|
+
export function parseEachLineNumber(numbers) {
|
|
122
|
+
const result = [];
|
|
123
|
+
const matchRes = [];
|
|
124
|
+
for (let i = 0; i < numbers.length; i += 2) {
|
|
125
|
+
const [resultNumber, matchNumber] = [numbers[i], numbers[i + 1]];
|
|
126
|
+
if (!matchRes[matchNumber]) {
|
|
127
|
+
matchRes[matchNumber] = [resultNumber];
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
matchRes[matchNumber].push(resultNumber);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
matchRes.forEach((matchArr) => {
|
|
134
|
+
result.push(parseBulletNumber(matchArr));
|
|
135
|
+
});
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
export function thousandSeperator(value) {
|
|
139
|
+
if (value === 0) {
|
|
140
|
+
return '0';
|
|
141
|
+
}
|
|
142
|
+
if (!value) {
|
|
143
|
+
return '';
|
|
144
|
+
}
|
|
145
|
+
value = value.toString();
|
|
146
|
+
const parts = value.split('.');
|
|
147
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
148
|
+
return parts.join('.');
|
|
149
|
+
}
|
|
150
|
+
export async function fetchGameInfo(endpoint, gameId) {
|
|
151
|
+
try {
|
|
152
|
+
const response = await fetchRequest(`${endpoint}/games/${gameId}`, 'GET', {});
|
|
153
|
+
return response;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
console.error('Failed to fetch game info:', error);
|
|
157
|
+
throw new Error('The game is currently not available. Please try again later.');
|
|
158
|
+
}
|
|
159
|
+
}
|