@everymatrix/lottery-game-page 0.1.0 → 0.1.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/loader.cjs.js +1 -1
- package/dist/cjs/lottery-draw-results.cjs.entry.js +188 -0
- package/dist/cjs/lottery-game-page.cjs.entry.js +1 -1
- package/dist/cjs/lottery-game-page.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -15
- package/dist/components/lottery-draw-results.js +6 -0
- package/dist/components/lottery-draw-results2.js +221 -0
- package/dist/components/lottery-game-page.js +5 -23
- package/dist/esm/loader.js +1 -1
- package/dist/esm/lottery-draw-results.entry.js +184 -0
- package/dist/esm/lottery-game-page.entry.js +1 -1
- package/dist/esm/lottery-game-page.js +1 -1
- package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
- package/dist/lottery-game-page/p-9ca649d9.entry.js +1 -0
- package/dist/lottery-game-page/{p-74eea5ec.entry.js → p-e98ee83a.entry.js} +1 -1
- package/package.json +1 -1
- package/dist/cjs/helper-accordion_2.cjs.entry.js +0 -124
- package/dist/cjs/helper-tab.cjs.entry.js +0 -36
- package/dist/cjs/lottery-game-details.cjs.entry.js +0 -19
- package/dist/components/helper-accordion.js +0 -6
- package/dist/components/helper-accordion2.js +0 -116
- package/dist/components/helper-tab.js +0 -6
- package/dist/components/helper-tab2.js +0 -52
- package/dist/components/helper-tabs.js +0 -6
- package/dist/components/helper-tabs2.js +0 -63
- package/dist/components/lottery-game-details.js +0 -6
- package/dist/components/lottery-game-details2.js +0 -49
- package/dist/esm/helper-accordion_2.entry.js +0 -119
- package/dist/esm/helper-tab.entry.js +0 -32
- package/dist/esm/lottery-game-details.entry.js +0 -15
- package/dist/lottery-game-page/p-75f13007.entry.js +0 -1
- package/dist/lottery-game-page/p-97d1602e.entry.js +0 -1
- package/dist/lottery-game-page/p-d04141f7.entry.js +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["helper-
|
|
17
|
+
return index.bootstrapLazy([["helper-modal.cjs",[[1,"helper-modal",{"titleModal":[1,"title-modal"],"visible":[1540]}]]],["lottery-draw-results.cjs",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"ticketDate":[1,"ticket-date"],"ticketStatus":[1,"ticket-status"],"ticketId":[1,"ticket-id"],"ticketAmount":[1,"ticket-amount"],"ticketMultiplier":[4,"ticket-multiplier"],"ticketDrawCount":[2,"ticket-draw-count"],"multiplier":[32],"isLoading":[32],"drawResults":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32]}]]],["lottery-game-page.cjs",[[1,"lottery-game-page",{"endpoint":[1],"gameId":[1,"game-id"],"playerId":[2,"player-id"],"sessionId":[1,"session-id"],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"],"tickets":[32],"tabIndex":[32],"hasErrors":[32],"totalAmount":[32],"successVisible":[32],"deleteVisible":[32],"deleteEventData":[32],"daysRemaining":[32],"hoursRemaining":[32],"minutesRemaining":[32],"secondsRemaining":[32],"latestDraw":[32],"totalWinningsAmount":[32],"nextDate":[32],"isLoggedIn":[32],"loginModalVisible":[32]},[[0,"ticketCompleted","gridFilledHandler"],[0,"gridDirty","gridDirtyHandler"],[0,"deleteTicket","deleteTicketHandler"],[0,"modalCloseEvent","modalCloseEvent"],[0,"stakeChange","stakeChangeHandler"],[0,"multiplierChange","multiplierChangeHandler"]]]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-614098f4.js');
|
|
6
|
+
require('@everymatrix/lottery-grid');
|
|
7
|
+
|
|
8
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
9
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
10
|
+
const TRANSLATIONS = {
|
|
11
|
+
en: {
|
|
12
|
+
drawResultsHeader: 'Last draw results',
|
|
13
|
+
drawId: 'Draw ID',
|
|
14
|
+
drawName: 'Game name',
|
|
15
|
+
drawDate: 'Draw Date',
|
|
16
|
+
drawNumbersGridDraw: 'Draw numbers Grid A',
|
|
17
|
+
drawNumbersGridTicket: 'Draw numbers Grid B',
|
|
18
|
+
ticketResult: 'Ticket result',
|
|
19
|
+
amountWon: 'Amount won',
|
|
20
|
+
numberOfDraws: 'Number of draws',
|
|
21
|
+
multiplier: 'Multiplier:',
|
|
22
|
+
ticketPurchaseDate: 'Ticket Purchase Date',
|
|
23
|
+
ticketStatus: 'Ticket Status',
|
|
24
|
+
ticketId: 'Ticket ID',
|
|
25
|
+
ticketAmount: 'Ticket Amount',
|
|
26
|
+
winUpTo: 'Win up to',
|
|
27
|
+
},
|
|
28
|
+
ro: {
|
|
29
|
+
drawResultsHeader: 'Ultimele rezultate extragere',
|
|
30
|
+
drawId: 'Id extragere',
|
|
31
|
+
drawName: 'Numele jocului',
|
|
32
|
+
drawDate: 'Data extragerii',
|
|
33
|
+
drawNumbersGridDraw: 'Numerele extrase Grid A',
|
|
34
|
+
drawNumbersGridTicket: 'Numerele extrase Grid B',
|
|
35
|
+
ticketResult: 'Rezultatul biletului',
|
|
36
|
+
amountWon: 'Suma castigata',
|
|
37
|
+
numberOfDraws: 'Numarul de extrageri',
|
|
38
|
+
multiplier: 'Multiplicator:',
|
|
39
|
+
ticketPurchaseDate: 'Data achizitionarii biletului',
|
|
40
|
+
ticketStatus: 'Statusul biletului',
|
|
41
|
+
ticketId: 'Id biletul',
|
|
42
|
+
ticketAmount: 'Valoarea biletului',
|
|
43
|
+
winUpTo: 'Poti castiga'
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
const translate = (key, customLang) => {
|
|
47
|
+
const lang = customLang;
|
|
48
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0px 20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:70px;float:left;margin:0 0 20px 0;border:1px solid #f1f1f1;background:#fff;border-radius:4px;padding:10px;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden;box-shadow:rgba(99, 99, 99, 0.2) 0px 2px 8px 0px}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
|
|
52
|
+
|
|
53
|
+
const LotteryDrawResults = class {
|
|
54
|
+
constructor(hostRef) {
|
|
55
|
+
index.registerInstance(this, hostRef);
|
|
56
|
+
/**
|
|
57
|
+
* Language of the widget
|
|
58
|
+
*/
|
|
59
|
+
this.language = 'en';
|
|
60
|
+
/**
|
|
61
|
+
* Shows only the last draw
|
|
62
|
+
*/
|
|
63
|
+
this.drawMode = false;
|
|
64
|
+
/**
|
|
65
|
+
* The drawID (option)
|
|
66
|
+
*/
|
|
67
|
+
this.drawId = '';
|
|
68
|
+
/**
|
|
69
|
+
* The game name
|
|
70
|
+
*/
|
|
71
|
+
this.gameName = '';
|
|
72
|
+
/**
|
|
73
|
+
* The ticket submission date
|
|
74
|
+
*/
|
|
75
|
+
this.ticketDate = '';
|
|
76
|
+
/**
|
|
77
|
+
* The ticket status
|
|
78
|
+
*/
|
|
79
|
+
this.ticketStatus = '';
|
|
80
|
+
/**
|
|
81
|
+
* The ticket id
|
|
82
|
+
*/
|
|
83
|
+
this.ticketId = '';
|
|
84
|
+
/**
|
|
85
|
+
* The ticket amount
|
|
86
|
+
*/
|
|
87
|
+
this.ticketAmount = '';
|
|
88
|
+
/**
|
|
89
|
+
* The ticket multiplier
|
|
90
|
+
*/
|
|
91
|
+
this.ticketMultiplier = false;
|
|
92
|
+
/**
|
|
93
|
+
* The ticket draw count
|
|
94
|
+
*/
|
|
95
|
+
this.ticketDrawCount = 0;
|
|
96
|
+
this.multiplier = 3;
|
|
97
|
+
this.isLoading = true;
|
|
98
|
+
this.drawResults = [];
|
|
99
|
+
this.rules = {};
|
|
100
|
+
this.toggleDrawer = [false];
|
|
101
|
+
this.hasErrors = false;
|
|
102
|
+
this.errorText = '';
|
|
103
|
+
this.changeBox = (index) => {
|
|
104
|
+
this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
|
|
105
|
+
if (itemIndex == index) {
|
|
106
|
+
return !item;
|
|
107
|
+
}
|
|
108
|
+
return item;
|
|
109
|
+
});
|
|
110
|
+
if (index >= this.toggleDrawer.length) {
|
|
111
|
+
this.toggleDrawer.push(true);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
connectedCallback() {
|
|
116
|
+
let promises = [];
|
|
117
|
+
promises.push(this.getGameData());
|
|
118
|
+
if (this.drawId) {
|
|
119
|
+
promises.push(this.getDrawData());
|
|
120
|
+
}
|
|
121
|
+
Promise.all(promises)
|
|
122
|
+
.then(() => {
|
|
123
|
+
this.isLoading = false;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
getDrawData() {
|
|
127
|
+
return new Promise((resolve, reject) => {
|
|
128
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
|
|
129
|
+
fetch(url.href)
|
|
130
|
+
.then((response) => {
|
|
131
|
+
// @TODO EXCEPTIONS
|
|
132
|
+
return response.json();
|
|
133
|
+
})
|
|
134
|
+
.then((data) => {
|
|
135
|
+
this.drawData = data;
|
|
136
|
+
resolve(true);
|
|
137
|
+
this.isLoading = false;
|
|
138
|
+
})
|
|
139
|
+
.catch((err) => {
|
|
140
|
+
reject(err);
|
|
141
|
+
this.isLoading = false;
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
getGameData() {
|
|
146
|
+
return new Promise((resolve, reject) => {
|
|
147
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
148
|
+
fetch(url.href)
|
|
149
|
+
.then((response) => {
|
|
150
|
+
return response.json();
|
|
151
|
+
})
|
|
152
|
+
.then((data) => {
|
|
153
|
+
this.rules = {
|
|
154
|
+
maximumAllowed: data.rules.boards[0].maximumAllowed,
|
|
155
|
+
totalNumbers: data.rules.boards[0].totalNumbers
|
|
156
|
+
};
|
|
157
|
+
resolve(true);
|
|
158
|
+
this.isLoading = false;
|
|
159
|
+
this.hasErrors = false;
|
|
160
|
+
})
|
|
161
|
+
.catch((err) => {
|
|
162
|
+
this.isLoading = false;
|
|
163
|
+
this.hasErrors = true;
|
|
164
|
+
this.errorText = err;
|
|
165
|
+
reject(err);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
render() {
|
|
170
|
+
if (this.isLoading) {
|
|
171
|
+
return (index.h("p", null, "Loading, please wait ..."));
|
|
172
|
+
}
|
|
173
|
+
else if (this.hasErrors) {
|
|
174
|
+
index.h("p", null, this.errorText);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
return (index.h("section", { class: "DrawResultsSection" }, !this.drawMode ?
|
|
178
|
+
index.h("div", { class: "DrawResultsArea" }, index.h("div", { class: "TicketInfo" }, index.h("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", index.h("span", null, this.gameName)), index.h("div", { class: "TicketDate" }, translate('ticketPurchaseDate', this.language), ": ", index.h("span", null, this.ticketDate.slice(0, 10))), index.h("div", { class: "TicketStatus" }, translate('ticketStatus', this.language), ": ", index.h("span", null, this.ticketStatus))), index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "TicketIdContainer" }, index.h("p", null, translate('ticketId', this.language), ": ", index.h("span", null, this.ticketId))), index.h("div", { class: "TicketAmountContainer" }, index.h("p", null, translate('ticketAmount', this.language), " ", index.h("span", null, this.ticketAmount))), index.h("div", { class: "DrawNumbersGrid" }, index.h("p", null, translate('drawNumbersGridTicket', this.language), ":"), index.h("div", { class: "BulletContainer" }, index.h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('winUpTo', this.language), " ", index.h("span", null, JSON.stringify(this.ticketMultiplier)))), index.h("div", { class: "NumberOfDrawsContainer" }, index.h("p", null, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), index.h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index$1) => index.h("div", { class: "ExpandableBoxes" }, index.h("div", { class: this.toggleDrawer[index$1] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index$1) }, index.h("div", { class: "TicketResultContainer" }, index.h("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
|
|
179
|
+
index.h("div", { class: "AmountWonContainer" }, index.h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), index.h("div", { class: "DrawIdContainer" }, index.h("p", null, translate('drawId', this.language), ": ", item.drawId)), index.h("div", { class: "DrawDateContainer" }, index.h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), index.h("div", { class: "DrawNumbersGrid" }), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('winUpTo', this.language), " ", item.multiplier)))))))))
|
|
180
|
+
:
|
|
181
|
+
index.h("div", { class: "DrawResultsArea" }, this.drawData &&
|
|
182
|
+
index.h("div", null, index.h("div", { class: "DrawResultsHeader" }, index.h("span", null, translate('drawId', this.language), ": ", this.drawData.id), index.h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "DrawNumbersGrid" }, index.h("p", null, translate('drawNumbersGridDraw', this.language), ":"), index.h("div", { class: "BulletContainer" }, index.h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
LotteryDrawResults.style = lotteryDrawResultsCss;
|
|
187
|
+
|
|
188
|
+
exports.lottery_draw_results = LotteryDrawResults;
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-614098f4.js');
|
|
6
6
|
require('@everymatrix/lottery-ticket-controller');
|
|
7
|
+
require('@everymatrix/lottery-game-details');
|
|
7
8
|
require('@everymatrix/lottery-draw-results-history');
|
|
8
|
-
require('@everymatrix/lottery-draw-results');
|
|
9
9
|
|
|
10
10
|
const DEFAULT_LANGUAGE = 'en';
|
|
11
11
|
const SUPPORTED_LANGUAGES = ['ro', 'en', 'ar'];
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["helper-
|
|
18
|
+
return index.bootstrapLazy([["helper-modal.cjs",[[1,"helper-modal",{"titleModal":[1,"title-modal"],"visible":[1540]}]]],["lottery-draw-results.cjs",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"ticketDate":[1,"ticket-date"],"ticketStatus":[1,"ticket-status"],"ticketId":[1,"ticket-id"],"ticketAmount":[1,"ticket-amount"],"ticketMultiplier":[4,"ticket-multiplier"],"ticketDrawCount":[2,"ticket-draw-count"],"multiplier":[32],"isLoading":[32],"drawResults":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32]}]]],["lottery-game-page.cjs",[[1,"lottery-game-page",{"endpoint":[1],"gameId":[1,"game-id"],"playerId":[2,"player-id"],"sessionId":[1,"session-id"],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"],"tickets":[32],"tabIndex":[32],"hasErrors":[32],"totalAmount":[32],"successVisible":[32],"deleteVisible":[32],"deleteEventData":[32],"daysRemaining":[32],"hoursRemaining":[32],"minutesRemaining":[32],"secondsRemaining":[32],"latestDraw":[32],"totalWinningsAmount":[32],"nextDate":[32],"isLoggedIn":[32],"loginModalVisible":[32]},[[0,"ticketCompleted","gridFilledHandler"],[0,"gridDirty","gridDirtyHandler"],[0,"deleteTicket","deleteTicketHandler"],[0,"modalCloseEvent","modalCloseEvent"],[0,"stakeChange","stakeChangeHandler"],[0,"multiplierChange","multiplierChangeHandler"]]]]]], options);
|
|
19
19
|
});
|
|
@@ -8,12 +8,6 @@
|
|
|
8
8
|
"typescriptVersion": "4.5.4"
|
|
9
9
|
},
|
|
10
10
|
"collections": [
|
|
11
|
-
{
|
|
12
|
-
"name": "@everymatrix/helper-accordion",
|
|
13
|
-
"tags": [
|
|
14
|
-
"helper-accordion"
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
11
|
{
|
|
18
12
|
"name": "@everymatrix/helper-modal",
|
|
19
13
|
"tags": [
|
|
@@ -21,16 +15,9 @@
|
|
|
21
15
|
]
|
|
22
16
|
},
|
|
23
17
|
{
|
|
24
|
-
"name": "@everymatrix/
|
|
25
|
-
"tags": [
|
|
26
|
-
"helper-tab",
|
|
27
|
-
"helper-tabs"
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"name": "@everymatrix/lottery-game-details",
|
|
18
|
+
"name": "@everymatrix/lottery-draw-results",
|
|
32
19
|
"tags": [
|
|
33
|
-
"lottery-
|
|
20
|
+
"lottery-draw-results"
|
|
34
21
|
]
|
|
35
22
|
}
|
|
36
23
|
],
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import '@everymatrix/lottery-grid';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
5
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
6
|
+
const TRANSLATIONS = {
|
|
7
|
+
en: {
|
|
8
|
+
drawResultsHeader: 'Last draw results',
|
|
9
|
+
drawId: 'Draw ID',
|
|
10
|
+
drawName: 'Game name',
|
|
11
|
+
drawDate: 'Draw Date',
|
|
12
|
+
drawNumbersGridDraw: 'Draw numbers Grid A',
|
|
13
|
+
drawNumbersGridTicket: 'Draw numbers Grid B',
|
|
14
|
+
ticketResult: 'Ticket result',
|
|
15
|
+
amountWon: 'Amount won',
|
|
16
|
+
numberOfDraws: 'Number of draws',
|
|
17
|
+
multiplier: 'Multiplier:',
|
|
18
|
+
ticketPurchaseDate: 'Ticket Purchase Date',
|
|
19
|
+
ticketStatus: 'Ticket Status',
|
|
20
|
+
ticketId: 'Ticket ID',
|
|
21
|
+
ticketAmount: 'Ticket Amount',
|
|
22
|
+
winUpTo: 'Win up to',
|
|
23
|
+
},
|
|
24
|
+
ro: {
|
|
25
|
+
drawResultsHeader: 'Ultimele rezultate extragere',
|
|
26
|
+
drawId: 'Id extragere',
|
|
27
|
+
drawName: 'Numele jocului',
|
|
28
|
+
drawDate: 'Data extragerii',
|
|
29
|
+
drawNumbersGridDraw: 'Numerele extrase Grid A',
|
|
30
|
+
drawNumbersGridTicket: 'Numerele extrase Grid B',
|
|
31
|
+
ticketResult: 'Rezultatul biletului',
|
|
32
|
+
amountWon: 'Suma castigata',
|
|
33
|
+
numberOfDraws: 'Numarul de extrageri',
|
|
34
|
+
multiplier: 'Multiplicator:',
|
|
35
|
+
ticketPurchaseDate: 'Data achizitionarii biletului',
|
|
36
|
+
ticketStatus: 'Statusul biletului',
|
|
37
|
+
ticketId: 'Id biletul',
|
|
38
|
+
ticketAmount: 'Valoarea biletului',
|
|
39
|
+
winUpTo: 'Poti castiga'
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const translate = (key, customLang) => {
|
|
43
|
+
const lang = customLang;
|
|
44
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0px 20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:70px;float:left;margin:0 0 20px 0;border:1px solid #f1f1f1;background:#fff;border-radius:4px;padding:10px;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden;box-shadow:rgba(99, 99, 99, 0.2) 0px 2px 8px 0px}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
|
|
48
|
+
|
|
49
|
+
const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
50
|
+
constructor() {
|
|
51
|
+
super();
|
|
52
|
+
this.__registerHost();
|
|
53
|
+
this.__attachShadow();
|
|
54
|
+
/**
|
|
55
|
+
* Language of the widget
|
|
56
|
+
*/
|
|
57
|
+
this.language = 'en';
|
|
58
|
+
/**
|
|
59
|
+
* Shows only the last draw
|
|
60
|
+
*/
|
|
61
|
+
this.drawMode = false;
|
|
62
|
+
/**
|
|
63
|
+
* The drawID (option)
|
|
64
|
+
*/
|
|
65
|
+
this.drawId = '';
|
|
66
|
+
/**
|
|
67
|
+
* The game name
|
|
68
|
+
*/
|
|
69
|
+
this.gameName = '';
|
|
70
|
+
/**
|
|
71
|
+
* The ticket submission date
|
|
72
|
+
*/
|
|
73
|
+
this.ticketDate = '';
|
|
74
|
+
/**
|
|
75
|
+
* The ticket status
|
|
76
|
+
*/
|
|
77
|
+
this.ticketStatus = '';
|
|
78
|
+
/**
|
|
79
|
+
* The ticket id
|
|
80
|
+
*/
|
|
81
|
+
this.ticketId = '';
|
|
82
|
+
/**
|
|
83
|
+
* The ticket amount
|
|
84
|
+
*/
|
|
85
|
+
this.ticketAmount = '';
|
|
86
|
+
/**
|
|
87
|
+
* The ticket multiplier
|
|
88
|
+
*/
|
|
89
|
+
this.ticketMultiplier = false;
|
|
90
|
+
/**
|
|
91
|
+
* The ticket draw count
|
|
92
|
+
*/
|
|
93
|
+
this.ticketDrawCount = 0;
|
|
94
|
+
this.multiplier = 3;
|
|
95
|
+
this.isLoading = true;
|
|
96
|
+
this.drawResults = [];
|
|
97
|
+
this.rules = {};
|
|
98
|
+
this.toggleDrawer = [false];
|
|
99
|
+
this.hasErrors = false;
|
|
100
|
+
this.errorText = '';
|
|
101
|
+
this.changeBox = (index) => {
|
|
102
|
+
this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
|
|
103
|
+
if (itemIndex == index) {
|
|
104
|
+
return !item;
|
|
105
|
+
}
|
|
106
|
+
return item;
|
|
107
|
+
});
|
|
108
|
+
if (index >= this.toggleDrawer.length) {
|
|
109
|
+
this.toggleDrawer.push(true);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
connectedCallback() {
|
|
114
|
+
let promises = [];
|
|
115
|
+
promises.push(this.getGameData());
|
|
116
|
+
if (this.drawId) {
|
|
117
|
+
promises.push(this.getDrawData());
|
|
118
|
+
}
|
|
119
|
+
Promise.all(promises)
|
|
120
|
+
.then(() => {
|
|
121
|
+
this.isLoading = false;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
getDrawData() {
|
|
125
|
+
return new Promise((resolve, reject) => {
|
|
126
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
|
|
127
|
+
fetch(url.href)
|
|
128
|
+
.then((response) => {
|
|
129
|
+
// @TODO EXCEPTIONS
|
|
130
|
+
return response.json();
|
|
131
|
+
})
|
|
132
|
+
.then((data) => {
|
|
133
|
+
this.drawData = data;
|
|
134
|
+
resolve(true);
|
|
135
|
+
this.isLoading = false;
|
|
136
|
+
})
|
|
137
|
+
.catch((err) => {
|
|
138
|
+
reject(err);
|
|
139
|
+
this.isLoading = false;
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
getGameData() {
|
|
144
|
+
return new Promise((resolve, reject) => {
|
|
145
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
146
|
+
fetch(url.href)
|
|
147
|
+
.then((response) => {
|
|
148
|
+
return response.json();
|
|
149
|
+
})
|
|
150
|
+
.then((data) => {
|
|
151
|
+
this.rules = {
|
|
152
|
+
maximumAllowed: data.rules.boards[0].maximumAllowed,
|
|
153
|
+
totalNumbers: data.rules.boards[0].totalNumbers
|
|
154
|
+
};
|
|
155
|
+
resolve(true);
|
|
156
|
+
this.isLoading = false;
|
|
157
|
+
this.hasErrors = false;
|
|
158
|
+
})
|
|
159
|
+
.catch((err) => {
|
|
160
|
+
this.isLoading = false;
|
|
161
|
+
this.hasErrors = true;
|
|
162
|
+
this.errorText = err;
|
|
163
|
+
reject(err);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
render() {
|
|
168
|
+
if (this.isLoading) {
|
|
169
|
+
return (h("p", null, "Loading, please wait ..."));
|
|
170
|
+
}
|
|
171
|
+
else if (this.hasErrors) {
|
|
172
|
+
h("p", null, this.errorText);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
return (h("section", { class: "DrawResultsSection" }, !this.drawMode ?
|
|
176
|
+
h("div", { class: "DrawResultsArea" }, h("div", { class: "TicketInfo" }, h("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", h("span", null, this.gameName)), h("div", { class: "TicketDate" }, translate('ticketPurchaseDate', this.language), ": ", h("span", null, this.ticketDate.slice(0, 10))), h("div", { class: "TicketStatus" }, translate('ticketStatus', this.language), ": ", h("span", null, this.ticketStatus))), h("div", { class: "DrawResultsBody" }, h("div", { class: "TicketIdContainer" }, h("p", null, translate('ticketId', this.language), ": ", h("span", null, this.ticketId))), h("div", { class: "TicketAmountContainer" }, h("p", null, translate('ticketAmount', this.language), " ", h("span", null, this.ticketAmount))), h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridTicket', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('winUpTo', this.language), " ", h("span", null, JSON.stringify(this.ticketMultiplier)))), h("div", { class: "NumberOfDrawsContainer" }, h("p", null, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h("div", { class: "ExpandableBoxes" }, h("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) }, h("div", { class: "TicketResultContainer" }, h("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
|
|
177
|
+
h("div", { class: "AmountWonContainer" }, h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), h("div", { class: "DrawIdContainer" }, h("p", null, translate('drawId', this.language), ": ", item.drawId)), h("div", { class: "DrawDateContainer" }, h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), h("div", { class: "DrawNumbersGrid" }), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('winUpTo', this.language), " ", item.multiplier)))))))))
|
|
178
|
+
:
|
|
179
|
+
h("div", { class: "DrawResultsArea" }, this.drawData &&
|
|
180
|
+
h("div", null, h("div", { class: "DrawResultsHeader" }, h("span", null, translate('drawId', this.language), ": ", this.drawData.id), h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), h("div", { class: "DrawResultsBody" }, h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridDraw', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
static get style() { return lotteryDrawResultsCss; }
|
|
184
|
+
}, [1, "lottery-draw-results", {
|
|
185
|
+
"endpoint": [1],
|
|
186
|
+
"gameId": [1, "game-id"],
|
|
187
|
+
"language": [1],
|
|
188
|
+
"playerId": [1, "player-id"],
|
|
189
|
+
"drawMode": [4, "draw-mode"],
|
|
190
|
+
"drawId": [1, "draw-id"],
|
|
191
|
+
"gameName": [1, "game-name"],
|
|
192
|
+
"ticketDate": [1, "ticket-date"],
|
|
193
|
+
"ticketStatus": [1, "ticket-status"],
|
|
194
|
+
"ticketId": [1, "ticket-id"],
|
|
195
|
+
"ticketAmount": [1, "ticket-amount"],
|
|
196
|
+
"ticketMultiplier": [4, "ticket-multiplier"],
|
|
197
|
+
"ticketDrawCount": [2, "ticket-draw-count"],
|
|
198
|
+
"multiplier": [32],
|
|
199
|
+
"isLoading": [32],
|
|
200
|
+
"drawResults": [32],
|
|
201
|
+
"rules": [32],
|
|
202
|
+
"toggleDrawer": [32],
|
|
203
|
+
"hasErrors": [32],
|
|
204
|
+
"errorText": [32]
|
|
205
|
+
}]);
|
|
206
|
+
function defineCustomElement() {
|
|
207
|
+
if (typeof customElements === "undefined") {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const components = ["lottery-draw-results"];
|
|
211
|
+
components.forEach(tagName => { switch (tagName) {
|
|
212
|
+
case "lottery-draw-results":
|
|
213
|
+
if (!customElements.get(tagName)) {
|
|
214
|
+
customElements.define(tagName, LotteryDrawResults);
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
} });
|
|
218
|
+
}
|
|
219
|
+
defineCustomElement();
|
|
220
|
+
|
|
221
|
+
export { LotteryDrawResults as L, defineCustomElement as d };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
2
|
import '@everymatrix/lottery-ticket-controller';
|
|
3
|
+
import '@everymatrix/lottery-game-details';
|
|
3
4
|
import '@everymatrix/lottery-draw-results-history';
|
|
4
|
-
import '
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$5 } from './helper-modal2.js';
|
|
7
|
-
import { d as defineCustomElement$4 } from './helper-tab2.js';
|
|
8
|
-
import { d as defineCustomElement$3 } from './helper-tabs2.js';
|
|
9
|
-
import { d as defineCustomElement$2 } from './lottery-game-details2.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './helper-modal2.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './lottery-draw-results2.js';
|
|
10
7
|
|
|
11
8
|
const DEFAULT_LANGUAGE = 'en';
|
|
12
9
|
const SUPPORTED_LANGUAGES = ['ro', 'en', 'ar'];
|
|
@@ -366,34 +363,19 @@ function defineCustomElement$1() {
|
|
|
366
363
|
if (typeof customElements === "undefined") {
|
|
367
364
|
return;
|
|
368
365
|
}
|
|
369
|
-
const components = ["lottery-game-page", "helper-
|
|
366
|
+
const components = ["lottery-game-page", "helper-modal", "lottery-draw-results"];
|
|
370
367
|
components.forEach(tagName => { switch (tagName) {
|
|
371
368
|
case "lottery-game-page":
|
|
372
369
|
if (!customElements.get(tagName)) {
|
|
373
370
|
customElements.define(tagName, LotteryGamePage$1);
|
|
374
371
|
}
|
|
375
372
|
break;
|
|
376
|
-
case "helper-accordion":
|
|
377
|
-
if (!customElements.get(tagName)) {
|
|
378
|
-
defineCustomElement$6();
|
|
379
|
-
}
|
|
380
|
-
break;
|
|
381
373
|
case "helper-modal":
|
|
382
|
-
if (!customElements.get(tagName)) {
|
|
383
|
-
defineCustomElement$5();
|
|
384
|
-
}
|
|
385
|
-
break;
|
|
386
|
-
case "helper-tab":
|
|
387
|
-
if (!customElements.get(tagName)) {
|
|
388
|
-
defineCustomElement$4();
|
|
389
|
-
}
|
|
390
|
-
break;
|
|
391
|
-
case "helper-tabs":
|
|
392
374
|
if (!customElements.get(tagName)) {
|
|
393
375
|
defineCustomElement$3();
|
|
394
376
|
}
|
|
395
377
|
break;
|
|
396
|
-
case "lottery-
|
|
378
|
+
case "lottery-draw-results":
|
|
397
379
|
if (!customElements.get(tagName)) {
|
|
398
380
|
defineCustomElement$2();
|
|
399
381
|
}
|
package/dist/esm/loader.js
CHANGED
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["helper-
|
|
13
|
+
return bootstrapLazy([["helper-modal",[[1,"helper-modal",{"titleModal":[1,"title-modal"],"visible":[1540]}]]],["lottery-draw-results",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"ticketDate":[1,"ticket-date"],"ticketStatus":[1,"ticket-status"],"ticketId":[1,"ticket-id"],"ticketAmount":[1,"ticket-amount"],"ticketMultiplier":[4,"ticket-multiplier"],"ticketDrawCount":[2,"ticket-draw-count"],"multiplier":[32],"isLoading":[32],"drawResults":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32]}]]],["lottery-game-page",[[1,"lottery-game-page",{"endpoint":[1],"gameId":[1,"game-id"],"playerId":[2,"player-id"],"sessionId":[1,"session-id"],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"],"tickets":[32],"tabIndex":[32],"hasErrors":[32],"totalAmount":[32],"successVisible":[32],"deleteVisible":[32],"deleteEventData":[32],"daysRemaining":[32],"hoursRemaining":[32],"minutesRemaining":[32],"secondsRemaining":[32],"latestDraw":[32],"totalWinningsAmount":[32],"nextDate":[32],"isLoggedIn":[32],"loginModalVisible":[32]},[[0,"ticketCompleted","gridFilledHandler"],[0,"gridDirty","gridDirtyHandler"],[0,"deleteTicket","deleteTicketHandler"],[0,"modalCloseEvent","modalCloseEvent"],[0,"stakeChange","stakeChangeHandler"],[0,"multiplierChange","multiplierChangeHandler"]]]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|