@everymatrix/lottery-game-page 0.1.19 → 0.1.21
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/helper-accordion.cjs.entry.js +41 -3
- package/dist/cjs/helper-filters_2.cjs.entry.js +208 -21
- package/dist/cjs/helper-modal.cjs.entry.js +34 -2
- package/dist/cjs/helper-pagination.cjs.entry.js +45 -1
- package/dist/cjs/helper-tab.cjs.entry.js +36 -4
- package/dist/cjs/helper-tabs.cjs.entry.js +38 -2
- package/dist/cjs/{index-5701a895.js → index-7b63209d.js} +13 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/lottery-bullet_2.cjs.entry.js +72 -4
- package/dist/cjs/lottery-draw-results-history.cjs.entry.js +76 -13
- package/dist/cjs/lottery-game-details.cjs.entry.js +34 -2
- package/dist/cjs/lottery-game-page.cjs.entry.js +69 -9
- package/dist/cjs/lottery-game-page.cjs.js +2 -2
- package/dist/cjs/lottery-ticket-controller.cjs.entry.js +55 -2
- package/dist/cjs/lottery-ticket.cjs.entry.js +55 -3
- package/dist/collection/components/lottery-game-page/lottery-game-page.css +6 -4
- package/dist/collection/components/lottery-game-page/lottery-game-page.js +84 -9
- package/dist/collection/utils/locale.utils.js +26 -3
- package/dist/components/helper-accordion2.js +44 -3
- package/dist/components/helper-filters2.js +70 -8
- package/dist/components/helper-modal2.js +37 -2
- package/dist/components/helper-pagination.js +48 -1
- package/dist/components/helper-tab2.js +39 -4
- package/dist/components/helper-tabs2.js +42 -2
- package/dist/components/lottery-bullet2.js +37 -2
- package/dist/components/lottery-draw-results-history2.js +80 -14
- package/dist/components/lottery-draw-results2.js +152 -15
- package/dist/components/lottery-game-details2.js +38 -2
- package/dist/components/lottery-game-page.js +73 -9
- package/dist/components/lottery-grid2.js +43 -3
- package/dist/components/lottery-ticket-controller2.js +58 -2
- package/dist/components/lottery-ticket2.js +58 -3
- package/dist/esm/helper-accordion.entry.js +41 -3
- package/dist/esm/helper-filters_2.entry.js +208 -21
- package/dist/esm/helper-modal.entry.js +34 -2
- package/dist/esm/helper-pagination.entry.js +45 -1
- package/dist/esm/helper-tab.entry.js +36 -4
- package/dist/esm/helper-tabs.entry.js +38 -2
- package/dist/esm/{index-ade3d0ab.js → index-0f8edfd2.js} +13 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/lottery-bullet_2.entry.js +72 -4
- package/dist/esm/lottery-draw-results-history.entry.js +76 -13
- package/dist/esm/lottery-game-details.entry.js +34 -2
- package/dist/esm/lottery-game-page.entry.js +69 -9
- package/dist/esm/lottery-game-page.js +2 -2
- package/dist/esm/lottery-ticket-controller.entry.js +55 -2
- package/dist/esm/lottery-ticket.entry.js +55 -3
- package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
- package/dist/lottery-game-page/p-01132729.entry.js +1 -0
- package/dist/lottery-game-page/p-07f98587.entry.js +1 -0
- package/dist/lottery-game-page/p-4098d6d4.entry.js +1 -0
- package/dist/lottery-game-page/p-75703176.entry.js +1 -0
- package/dist/lottery-game-page/p-800590f3.entry.js +1 -0
- package/dist/lottery-game-page/p-807dda48.entry.js +1 -0
- package/dist/lottery-game-page/p-97048566.entry.js +1 -0
- package/dist/lottery-game-page/p-a21ecd5f.entry.js +1 -0
- package/dist/lottery-game-page/p-b44e49d7.entry.js +1 -0
- package/dist/lottery-game-page/p-b4e2988a.js +1 -0
- package/dist/lottery-game-page/{p-042b777b.entry.js → p-d1d09322.entry.js} +39 -39
- package/dist/lottery-game-page/p-d91fc066.entry.js +1 -0
- package/dist/lottery-game-page/p-e816baee.entry.js +1 -0
- package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/widgets-stencil/packages/lottery-game-page/.stencil/packages/lottery-game-page/stencil.config.d.ts +2 -0
- package/dist/types/components/lottery-game-page/lottery-game-page.d.ts +14 -0
- package/dist/types/components.d.ts +16 -0
- package/package.json +1 -1
- package/dist/lottery-game-page/p-07cca45e.entry.js +0 -1
- package/dist/lottery-game-page/p-1196396b.entry.js +0 -1
- package/dist/lottery-game-page/p-2197c8ae.entry.js +0 -1
- package/dist/lottery-game-page/p-2a4e9984.entry.js +0 -1
- package/dist/lottery-game-page/p-4bfd0112.entry.js +0 -1
- package/dist/lottery-game-page/p-5e12dbf9.entry.js +0 -1
- package/dist/lottery-game-page/p-a10368b2.entry.js +0 -1
- package/dist/lottery-game-page/p-a26ebf45.entry.js +0 -1
- package/dist/lottery-game-page/p-b301a9d4.js +0 -1
- package/dist/lottery-game-page/p-d4b6a11a.entry.js +0 -1
- package/dist/lottery-game-page/p-dd63fcc6.entry.js +0 -1
- package/dist/lottery-game-page/p-f59dc9e1.entry.js +0 -1
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-game-page/.stencil/packages/lottery-game-page/stencil.config.d.ts +0 -2
|
@@ -6,7 +6,7 @@ import { d as defineCustomElement$2 } from './lottery-draw-results2.js';
|
|
|
6
6
|
import { d as defineCustomElement$1 } from './lottery-grid2.js';
|
|
7
7
|
|
|
8
8
|
const DEFAULT_LANGUAGE = 'en';
|
|
9
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
9
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
|
|
10
10
|
const TRANSLATIONS = {
|
|
11
11
|
en: {
|
|
12
12
|
drawResultsHeader: 'Draw results history',
|
|
@@ -34,6 +34,32 @@ const TRANSLATIONS = {
|
|
|
34
34
|
noResults: 'Niciun rezultat',
|
|
35
35
|
fetchingResults: 'Se obtin rezultatele'
|
|
36
36
|
},
|
|
37
|
+
fr: {
|
|
38
|
+
drawResultsHeader: 'Dessiner l\'historique des résultats',
|
|
39
|
+
drawId: 'ID de tirage',
|
|
40
|
+
drawDate: 'Date du tirage',
|
|
41
|
+
drawNumbersGridA: 'Tirage des numéros Grille',
|
|
42
|
+
viewAllResults: 'Voir tout',
|
|
43
|
+
lastFiveDraws: '5 derniers tirages',
|
|
44
|
+
lastTenDraws: '10 derniers tirages',
|
|
45
|
+
lastFifteenDraws: '15 derniers tirages',
|
|
46
|
+
allDrawResultsHistory: 'Historique des résultats de tous les tirages',
|
|
47
|
+
noResults: 'Aucun résultat',
|
|
48
|
+
fetchingResults: 'Récupération des résultats'
|
|
49
|
+
},
|
|
50
|
+
ar: {
|
|
51
|
+
drawResultsHeader: 'سجل نتائج السحب',
|
|
52
|
+
drawId: 'معرّف السحب',
|
|
53
|
+
drawDate: 'تاريخ السحب',
|
|
54
|
+
drawNumbersGridA: 'شبكة أرقام السحب',
|
|
55
|
+
viewAllResults: 'عرض الكل',
|
|
56
|
+
lastFiveDraws: 'آخر 5 سحوبات',
|
|
57
|
+
lastTenDraws: 'آخر 10 سحوبات',
|
|
58
|
+
lastFifteenDraws: 'آخر 15 سحبًا',
|
|
59
|
+
allDrawResultsHistory: 'سجل نتائج كل السحوبات',
|
|
60
|
+
noResults: 'لا توجد نتائج',
|
|
61
|
+
fetchingResults: 'جلب النتائج'
|
|
62
|
+
}
|
|
37
63
|
};
|
|
38
64
|
const translate = (key, customLang) => {
|
|
39
65
|
const lang = customLang;
|
|
@@ -55,6 +81,14 @@ const LotteryDrawResultsHistory = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
55
81
|
*Language
|
|
56
82
|
*/
|
|
57
83
|
this.language = 'en';
|
|
84
|
+
/**
|
|
85
|
+
* Client custom styling via string
|
|
86
|
+
*/
|
|
87
|
+
this.clientStyling = '';
|
|
88
|
+
/**
|
|
89
|
+
* Client custom styling via url content
|
|
90
|
+
*/
|
|
91
|
+
this.clientStylingUrlContent = '';
|
|
58
92
|
this.drawData = [];
|
|
59
93
|
this.displayAllDrawsResults = true;
|
|
60
94
|
this.showQuickFilters = true;
|
|
@@ -63,6 +97,7 @@ const LotteryDrawResultsHistory = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
63
97
|
this.dateFiltersTo = '';
|
|
64
98
|
this.isLoading = false;
|
|
65
99
|
this.noResults = false;
|
|
100
|
+
this.limitStylingAppends = false;
|
|
66
101
|
this.getDrawsData = (filterbydate = false) => {
|
|
67
102
|
let url = filterbydate ? new URL(`${this.endpoint}/games/${this.gameId}/draws`) : new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
68
103
|
if (this.dateFiltersFrom)
|
|
@@ -121,19 +156,36 @@ const LotteryDrawResultsHistory = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
121
156
|
this.displayAllDrawsResults = false;
|
|
122
157
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
123
158
|
};
|
|
159
|
+
this.setClientStyling = () => {
|
|
160
|
+
let sheet = document.createElement('style');
|
|
161
|
+
sheet.innerHTML = this.clientStyling;
|
|
162
|
+
this.stylingContainer.prepend(sheet);
|
|
163
|
+
};
|
|
164
|
+
this.setClientStylingURL = () => {
|
|
165
|
+
let cssFile = document.createElement('style');
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
168
|
+
this.stylingContainer.prepend(cssFile);
|
|
169
|
+
}, 1);
|
|
170
|
+
};
|
|
124
171
|
}
|
|
125
172
|
// Filters events
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
173
|
+
// @Listen('filterDraw')
|
|
174
|
+
// filtersDrawHandler(event: CustomEvent<any>):void {
|
|
175
|
+
// this.isLoading = true;
|
|
176
|
+
// this.showQuickFilters = false;
|
|
177
|
+
// }
|
|
131
178
|
filtersHandler(event) {
|
|
132
179
|
this.showQuickFilters = false;
|
|
133
|
-
this.dateFiltersFrom = event.detail.filterFromCalendar;
|
|
134
|
-
this.dateFiltersTo = event.detail.filterToCalendar;
|
|
135
180
|
this.isLoading = true;
|
|
136
|
-
|
|
181
|
+
if (event.detail.ticketDrawId) {
|
|
182
|
+
this.getDrawResults(event.detail.ticketDrawId);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
this.dateFiltersFrom = event.detail.filterFromCalendar;
|
|
186
|
+
this.dateFiltersTo = event.detail.filterToCalendar;
|
|
187
|
+
this.getDrawsData(true);
|
|
188
|
+
}
|
|
137
189
|
}
|
|
138
190
|
clearFiltersHandler() {
|
|
139
191
|
this.drawData = this.winningDataSetsData;
|
|
@@ -150,13 +202,24 @@ const LotteryDrawResultsHistory = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
150
202
|
disconnectedCallback() {
|
|
151
203
|
clearInterval(this.interval);
|
|
152
204
|
}
|
|
205
|
+
componentDidRender() {
|
|
206
|
+
// start custom styling area
|
|
207
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
208
|
+
if (this.clientStyling)
|
|
209
|
+
this.setClientStyling();
|
|
210
|
+
if (this.clientStylingUrlContent)
|
|
211
|
+
this.setClientStylingURL();
|
|
212
|
+
this.limitStylingAppends = true;
|
|
213
|
+
}
|
|
214
|
+
// end custom styling area
|
|
215
|
+
}
|
|
153
216
|
render() {
|
|
154
217
|
let gridHeader = h("div", { class: "DrawResultsHeader" }, this.displayAllDrawsResults ? h("h4", null, translate('drawResultsHeader', this.language)) :
|
|
155
218
|
[h("div", { class: "DrawResultsHeaderContent" }, h("h4", null, translate('allDrawResultsHistory', this.language)), h("div", { class: "FilterSection" }, this.showQuickFilters &&
|
|
156
|
-
h("div", { class: "FilterResultsContainer" }, h("button", { class: "QuickFilterButton", onClick: () => this.filterResults(5) }, translate('lastFiveDraws', this.language)), h("button", { class: "QuickFilterButton", onClick: () => this.filterResults(10) }, translate('lastTenDraws', this.language)), h("button", { class: "QuickFilterButton", onClick: () => this.filterResults(15) }, translate('lastFifteenDraws', this.language))), h("helper-filters", { "show-filter-id": "true", "activate-ticket-search": "false", "game-id": this.gameId }))),
|
|
219
|
+
h("div", { class: "FilterResultsContainer" }, h("button", { class: "QuickFilterButton", onClick: () => this.filterResults(5) }, translate('lastFiveDraws', this.language)), h("button", { class: "QuickFilterButton", onClick: () => this.filterResults(10) }, translate('lastTenDraws', this.language)), h("button", { class: "QuickFilterButton", onClick: () => this.filterResults(15) }, translate('lastFifteenDraws', this.language))), h("helper-filters", { "show-filter-id": "true", "activate-ticket-search": "false", "game-id": this.gameId, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))),
|
|
157
220
|
]);
|
|
158
|
-
return h("section", { class: "GridWrapper" }, h("div", { class: "DrawResultsSection" }, h("div", { class: "DrawResultsAreaHistory" }, gridHeader, h("div", { class: "HistoryGridWrapper" }, h("div", { class: "HistoryGrid" }, this.isLoading &&
|
|
159
|
-
h("p", null, translate('fetchingResults', this.language)), !this.isLoading && !this.noResults && this.drawData.map((item) => h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, "draw-id": item.id, "draw-mode": true })).reverse().slice(0, this.numberOfResults), !this.isLoading && this.noResults && (h("p", null, translate('noResults', this.language))))), this.displayAllDrawsResults && h("button", { class: "ViewAllResults", onClick: this.viewAllResults }, translate('viewAllResults', this.language)))));
|
|
221
|
+
return h("section", { class: "GridWrapper", ref: el => this.stylingContainer = el }, h("div", { class: "DrawResultsSection" }, h("div", { class: "DrawResultsAreaHistory" }, gridHeader, h("div", { class: "HistoryGridWrapper" }, h("div", { class: "HistoryGrid" }, this.isLoading &&
|
|
222
|
+
h("p", null, translate('fetchingResults', this.language)), !this.isLoading && !this.noResults && this.drawData.map((item) => h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, "draw-id": item.id, "draw-mode": true, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })).reverse().slice(0, this.numberOfResults), !this.isLoading && this.noResults && (h("p", null, translate('noResults', this.language))))), this.displayAllDrawsResults && h("button", { class: "ViewAllResults", onClick: this.viewAllResults }, translate('viewAllResults', this.language)))));
|
|
160
223
|
}
|
|
161
224
|
static get style() { return lotteryDrawResultsHistoryCss; }
|
|
162
225
|
}, [1, "lottery-draw-results-history", {
|
|
@@ -164,6 +227,8 @@ const LotteryDrawResultsHistory = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
164
227
|
"gameId": [1, "game-id"],
|
|
165
228
|
"numberOfResults": [2, "number-of-results"],
|
|
166
229
|
"language": [1],
|
|
230
|
+
"clientStyling": [1, "client-styling"],
|
|
231
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
167
232
|
"drawData": [32],
|
|
168
233
|
"displayAllDrawsResults": [32],
|
|
169
234
|
"showQuickFilters": [32],
|
|
@@ -171,8 +236,9 @@ const LotteryDrawResultsHistory = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
171
236
|
"dateFiltersFrom": [32],
|
|
172
237
|
"dateFiltersTo": [32],
|
|
173
238
|
"isLoading": [32],
|
|
174
|
-
"noResults": [32]
|
|
175
|
-
|
|
239
|
+
"noResults": [32],
|
|
240
|
+
"limitStylingAppends": [32]
|
|
241
|
+
}, [[0, "filterSelection", "filtersHandler"], [0, "filterSelectionReset", "clearFiltersHandler"]]]);
|
|
176
242
|
function defineCustomElement() {
|
|
177
243
|
if (typeof customElements === "undefined") {
|
|
178
244
|
return;
|
|
@@ -10,8 +10,8 @@ const TRANSLATIONS = {
|
|
|
10
10
|
drawId: 'Draw ID',
|
|
11
11
|
drawName: 'Game name',
|
|
12
12
|
drawDate: 'Draw Date',
|
|
13
|
-
drawNumbersGridDraw: 'Draw numbers Grid
|
|
14
|
-
drawNumbersGridTicket: 'Draw numbers Grid
|
|
13
|
+
drawNumbersGridDraw: 'Draw numbers Grid ',
|
|
14
|
+
drawNumbersGridTicket: 'Draw numbers Grid ',
|
|
15
15
|
ticketResult: 'Ticket result',
|
|
16
16
|
amountWon: 'Amount won',
|
|
17
17
|
numberOfDraws: 'Number of draws',
|
|
@@ -27,8 +27,8 @@ const TRANSLATIONS = {
|
|
|
27
27
|
drawId: 'Id extragere',
|
|
28
28
|
drawName: 'Numele jocului',
|
|
29
29
|
drawDate: 'Data extragerii',
|
|
30
|
-
drawNumbersGridDraw: 'Numerele extrase Grid
|
|
31
|
-
drawNumbersGridTicket: 'Numerele extrase Grid
|
|
30
|
+
drawNumbersGridDraw: 'Numerele extrase Grid',
|
|
31
|
+
drawNumbersGridTicket: 'Numerele extrase Grid',
|
|
32
32
|
ticketResult: 'Rezultatul biletului',
|
|
33
33
|
amountWon: 'Suma castigata',
|
|
34
34
|
numberOfDraws: 'Numarul de extrageri',
|
|
@@ -39,13 +39,47 @@ const TRANSLATIONS = {
|
|
|
39
39
|
ticketAmount: 'Valoarea biletului',
|
|
40
40
|
winUpTo: 'Poti castiga'
|
|
41
41
|
},
|
|
42
|
+
fr: {
|
|
43
|
+
drawResultsHeader: 'Résultats du dernier tirage',
|
|
44
|
+
drawId: 'ID de tirage',
|
|
45
|
+
drawName: 'Nom du jeu',
|
|
46
|
+
drawDate: 'Date du tirage',
|
|
47
|
+
drawNumbersGridDraw: 'Tirage des numéros Grille',
|
|
48
|
+
drawNumbersGridTicket: 'Tirage des numéros Grille',
|
|
49
|
+
ticketResult: 'Résultat du ticket',
|
|
50
|
+
amountWon: 'Montant gagné',
|
|
51
|
+
numberOfDraws: 'Nombre de tirages',
|
|
52
|
+
multiplier: 'Multiplicateur',
|
|
53
|
+
ticketPurchaseDate: 'Date d\'achat du billet',
|
|
54
|
+
ticketStatus: 'Statut du ticket',
|
|
55
|
+
ticketId: 'ID de billets',
|
|
56
|
+
ticketAmount: 'Montant du billet',
|
|
57
|
+
winUpTo: 'Gagnez jusqu\'à'
|
|
58
|
+
},
|
|
59
|
+
ar: {
|
|
60
|
+
drawResultsHeader: 'نتائج آخر سحب',
|
|
61
|
+
drawId: 'معرّف السحب',
|
|
62
|
+
drawName: 'اسم اللعبة',
|
|
63
|
+
drawDate: 'تاريخ السحب',
|
|
64
|
+
drawNumbersGridDraw: 'شبكة أرقام السحب',
|
|
65
|
+
drawNumbersGridTicket: 'شبكة أرقام السحب',
|
|
66
|
+
ticketResult: 'نتيجة التذكرة',
|
|
67
|
+
amountWon: 'المبلغ الذي تم ربحه',
|
|
68
|
+
numberOfDraws: 'عدد السحوبات',
|
|
69
|
+
multiplier: 'مضاعف',
|
|
70
|
+
ticketPurchaseDate: 'تاريخ شراء التذكرة',
|
|
71
|
+
ticketStatus: 'حالة التذكرة',
|
|
72
|
+
ticketId: 'معرّف التذكرة',
|
|
73
|
+
ticketAmount: 'مبلغ التذكرة',
|
|
74
|
+
winUpTo: 'ربح يصل إلى'
|
|
75
|
+
}
|
|
42
76
|
};
|
|
43
77
|
const translate = (key, customLang) => {
|
|
44
78
|
const lang = customLang;
|
|
45
79
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
46
80
|
};
|
|
47
81
|
|
|
48
|
-
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}.
|
|
82
|
+
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}.DrawResultsArea.TicketDraws .Content{padding:0;border:0}.DrawResultsArea.TicketDraws .DrawResultsBody{padding:0;margin-bottom:5px;border-radius:0;border:0}.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}.DrawResultsBody{padding:20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody>div{margin:10px 0}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.DrawNumbersGrid{margin-bottom:15px}.DrawNumbersGrid label{display:block;margin-bottom:10px}.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{position:relative}.DrawTicketsContainer{display:flex;flex-direction:column;margin:20px auto 0}.DrawMultipler{margin-top:15px}.ExpandableBoxes{position:relative;display:flex;flex-direction:column}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:80px;float:left;margin:0 0 20px 0;border:1px solid #009993;background:#fff;border-radius:4px;padding:10px;box-sizing:border-box;-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:last-of-type{margin-bottom:0}.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}";
|
|
49
83
|
|
|
50
84
|
const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
51
85
|
constructor() {
|
|
@@ -92,13 +126,75 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
92
126
|
* The ticket draw count
|
|
93
127
|
*/
|
|
94
128
|
this.ticketDrawCount = 0;
|
|
129
|
+
/**
|
|
130
|
+
* The ticket winning numbers
|
|
131
|
+
*/
|
|
132
|
+
this.ticketNumbers = '';
|
|
133
|
+
/**
|
|
134
|
+
* The session id
|
|
135
|
+
*/
|
|
136
|
+
this.sessionId = '';
|
|
137
|
+
/**
|
|
138
|
+
* Client custom styling via string
|
|
139
|
+
*/
|
|
140
|
+
this.clientStyling = '';
|
|
141
|
+
/**
|
|
142
|
+
* Client custom styling via url content
|
|
143
|
+
*/
|
|
144
|
+
this.clientStylingUrlContent = '';
|
|
95
145
|
this.multiplier = 3;
|
|
96
146
|
this.isLoading = true;
|
|
97
|
-
this.drawResults = [];
|
|
98
147
|
this.rules = {};
|
|
99
148
|
this.toggleDrawer = [false];
|
|
100
149
|
this.hasErrors = false;
|
|
101
150
|
this.errorText = '';
|
|
151
|
+
this.ticketData = [];
|
|
152
|
+
this.ticketDataLoaded = false;
|
|
153
|
+
this.ticketDraws = [];
|
|
154
|
+
this.hasDrawNumbers = false;
|
|
155
|
+
this.limitStylingAppends = false;
|
|
156
|
+
this.getTicketsData = () => {
|
|
157
|
+
let url = new URL(`${this.endpoint}/tickets`);
|
|
158
|
+
let drawOptions = {
|
|
159
|
+
method: "GET",
|
|
160
|
+
headers: {
|
|
161
|
+
'Content-Type': "application/json",
|
|
162
|
+
'Accept': 'application/json',
|
|
163
|
+
'Authorization': `Bearer ${this.sessionId}`
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
fetch(url.href, drawOptions)
|
|
167
|
+
.then((response) => {
|
|
168
|
+
return response.json();
|
|
169
|
+
})
|
|
170
|
+
.then((data) => {
|
|
171
|
+
if (data) {
|
|
172
|
+
this.ticketData = data;
|
|
173
|
+
this.ticketDataLoaded = true;
|
|
174
|
+
}
|
|
175
|
+
return this.ticketData;
|
|
176
|
+
}).then((response) => {
|
|
177
|
+
response.forEach(ticket => {
|
|
178
|
+
if (ticket.drawResults.length) {
|
|
179
|
+
ticket.drawResults.forEach(draw => {
|
|
180
|
+
fetch(`${this.endpoint}/games/${this.gameId}/draws/${draw.drawId}`)
|
|
181
|
+
.then((response) => {
|
|
182
|
+
return response.json();
|
|
183
|
+
})
|
|
184
|
+
.then((data) => {
|
|
185
|
+
// check if draw id is unique
|
|
186
|
+
if (!this.ticketDraws.some(el => el.drawId === draw.drawId)) {
|
|
187
|
+
this.ticketDraws.push({ drawId: draw.drawId, drawNumbers: data.winningNumbers });
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return this.ticketDraws;
|
|
193
|
+
});
|
|
194
|
+
}).then(() => {
|
|
195
|
+
this.hasDrawNumbers = true;
|
|
196
|
+
});
|
|
197
|
+
};
|
|
102
198
|
this.changeBox = (index) => {
|
|
103
199
|
this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
|
|
104
200
|
if (itemIndex == index) {
|
|
@@ -110,6 +206,18 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
110
206
|
this.toggleDrawer.push(true);
|
|
111
207
|
}
|
|
112
208
|
};
|
|
209
|
+
this.setClientStyling = () => {
|
|
210
|
+
let sheet = document.createElement('style');
|
|
211
|
+
sheet.innerHTML = this.clientStyling;
|
|
212
|
+
this.stylingContainer.prepend(sheet);
|
|
213
|
+
};
|
|
214
|
+
this.setClientStylingURL = () => {
|
|
215
|
+
let cssFile = document.createElement('style');
|
|
216
|
+
setTimeout(() => {
|
|
217
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
218
|
+
this.stylingContainer.prepend(cssFile);
|
|
219
|
+
}, 1);
|
|
220
|
+
};
|
|
113
221
|
}
|
|
114
222
|
connectedCallback() {
|
|
115
223
|
let promises = [];
|
|
@@ -117,14 +225,28 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
117
225
|
if (this.drawId) {
|
|
118
226
|
promises.push(this.getDrawData());
|
|
119
227
|
}
|
|
228
|
+
if (!this.drawMode) {
|
|
229
|
+
this.getTicketsData();
|
|
230
|
+
}
|
|
120
231
|
Promise.all(promises)
|
|
121
232
|
.then(() => {
|
|
122
233
|
this.isLoading = false;
|
|
123
234
|
});
|
|
124
235
|
}
|
|
125
|
-
|
|
236
|
+
componentDidRender() {
|
|
237
|
+
// start custom styling area
|
|
238
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
239
|
+
if (this.clientStyling)
|
|
240
|
+
this.setClientStyling();
|
|
241
|
+
if (this.clientStylingUrlContent)
|
|
242
|
+
this.setClientStylingURL();
|
|
243
|
+
this.limitStylingAppends = true;
|
|
244
|
+
}
|
|
245
|
+
// end custom styling area
|
|
246
|
+
}
|
|
247
|
+
getDrawData(drawID) {
|
|
126
248
|
return new Promise((resolve, reject) => {
|
|
127
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
|
|
249
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${drawID ? drawID : this.drawId}`);
|
|
128
250
|
fetch(url.href)
|
|
129
251
|
.then((response) => {
|
|
130
252
|
// @TODO EXCEPTIONS
|
|
@@ -134,6 +256,9 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
134
256
|
this.drawData = data;
|
|
135
257
|
resolve(true);
|
|
136
258
|
this.isLoading = false;
|
|
259
|
+
if (drawID) {
|
|
260
|
+
return this.drawData.winningNumbers;
|
|
261
|
+
}
|
|
137
262
|
})
|
|
138
263
|
.catch((err) => {
|
|
139
264
|
reject(err);
|
|
@@ -173,12 +298,16 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
173
298
|
h("p", null, this.errorText);
|
|
174
299
|
}
|
|
175
300
|
else {
|
|
176
|
-
return (h("section", { class: "DrawResultsSection" },
|
|
177
|
-
h("div", { class: "DrawResultsArea" },
|
|
178
|
-
h("div", { class: "
|
|
301
|
+
return (h("section", { class: "DrawResultsSection", ref: el => this.stylingContainer = el }, this.drawMode ?
|
|
302
|
+
h("div", { class: "DrawResultsArea" }, this.drawData &&
|
|
303
|
+
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), "0:"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))
|
|
179
304
|
:
|
|
180
|
-
h("div", { class: "DrawResultsArea" }, this.
|
|
181
|
-
h("div", null,
|
|
305
|
+
h("div", { class: "DrawResultsArea TicketDraws" }, h("div", { class: "DrawResultsBody" }, h("div", { class: "TicketIdContainer" }, h("label", { class: "Label" }, translate('ticketId', this.language), ": ", h("span", null, this.ticketId))), h("div", { class: "TicketAmountContainer" }, h("label", { class: "Label" }, translate('ticketAmount', this.language), " ", h("span", null, this.ticketAmount))), h("div", { class: "DrawNumbersGrid" }, h("label", { class: "Label" }, translate('drawNumbersGridTicket', this.language), "0:"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": JSON.parse(this.ticketNumbers).join(','), selectable: false, "display-selected": true, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", JSON.stringify(this.ticketMultiplier))), h("div", { class: "NumberOfDrawsContainer" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), h("div", { class: "DrawTicketsContainer" }, this.ticketData.map((ticket) => h("div", { class: "ExpandableBoxes" }, ticket.drawResults.length ?
|
|
306
|
+
h("div", null, ticket.id == this.ticketId && ticket.drawResults.map((item, index) => 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.state)), item.state == 'won' &&
|
|
307
|
+
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" }, this.hasDrawNumbers && this.ticketDraws.map((ticketDraw) => item.drawId && item.drawId === ticketDraw.drawId &&
|
|
308
|
+
h("div", null, h("label", { class: "Label" }, translate('drawNumbersGridDraw', this.language), "A:"), h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": ticketDraw.drawNumbers.join(','), selectable: false, "display-selected": true, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", item.multiplier)))))
|
|
309
|
+
:
|
|
310
|
+
h("span", null)))))))));
|
|
182
311
|
}
|
|
183
312
|
}
|
|
184
313
|
static get style() { return lotteryDrawResultsCss; }
|
|
@@ -196,13 +325,21 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
196
325
|
"ticketAmount": [1, "ticket-amount"],
|
|
197
326
|
"ticketMultiplier": [4, "ticket-multiplier"],
|
|
198
327
|
"ticketDrawCount": [2, "ticket-draw-count"],
|
|
328
|
+
"ticketNumbers": [1, "ticket-numbers"],
|
|
329
|
+
"sessionId": [1, "session-id"],
|
|
330
|
+
"clientStyling": [1, "client-styling"],
|
|
331
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
199
332
|
"multiplier": [32],
|
|
200
333
|
"isLoading": [32],
|
|
201
|
-
"drawResults": [32],
|
|
202
334
|
"rules": [32],
|
|
203
335
|
"toggleDrawer": [32],
|
|
204
336
|
"hasErrors": [32],
|
|
205
|
-
"errorText": [32]
|
|
337
|
+
"errorText": [32],
|
|
338
|
+
"ticketData": [32],
|
|
339
|
+
"ticketDataLoaded": [32],
|
|
340
|
+
"ticketDraws": [32],
|
|
341
|
+
"hasDrawNumbers": [32],
|
|
342
|
+
"limitStylingAppends": [32]
|
|
206
343
|
}]);
|
|
207
344
|
function defineCustomElement() {
|
|
208
345
|
if (typeof customElements === "undefined") {
|
|
@@ -10,12 +10,48 @@ const LotteryGameDetails = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
10
10
|
super();
|
|
11
11
|
this.__registerHost();
|
|
12
12
|
this.__attachShadow();
|
|
13
|
+
/**
|
|
14
|
+
* Client custom styling via string
|
|
15
|
+
*/
|
|
16
|
+
this.clientStyling = '';
|
|
17
|
+
/**
|
|
18
|
+
* Client custom styling via url content
|
|
19
|
+
*/
|
|
20
|
+
this.clientStylingUrlContent = '';
|
|
21
|
+
this.limitStylingAppends = false;
|
|
22
|
+
this.setClientStyling = () => {
|
|
23
|
+
let sheet = document.createElement('style');
|
|
24
|
+
sheet.innerHTML = this.clientStyling;
|
|
25
|
+
this.stylingContainer.prepend(sheet);
|
|
26
|
+
};
|
|
27
|
+
this.setClientStylingURL = () => {
|
|
28
|
+
let cssFile = document.createElement('style');
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
31
|
+
this.stylingContainer.prepend(cssFile);
|
|
32
|
+
}, 1);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
componentDidRender() {
|
|
36
|
+
// start custom styling area
|
|
37
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
38
|
+
if (this.clientStyling)
|
|
39
|
+
this.setClientStyling();
|
|
40
|
+
if (this.clientStylingUrlContent)
|
|
41
|
+
this.setClientStylingURL();
|
|
42
|
+
this.limitStylingAppends = true;
|
|
43
|
+
}
|
|
44
|
+
// end custom styling area
|
|
13
45
|
}
|
|
14
46
|
render() {
|
|
15
|
-
return (h("div",
|
|
47
|
+
return (h("div", { class: "GamePageDetailsContainer", ref: el => this.stylingContainer = el }, h("helper-accordion", { "header-title": "Game Details", collapsed: false, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("div", { class: "AccordionContainer", slot: "accordionContent" }, h("helper-tabs", { "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })))));
|
|
16
48
|
}
|
|
17
49
|
static get style() { return lotteryGameDetailsCss; }
|
|
18
|
-
}, [1, "lottery-game-details"
|
|
50
|
+
}, [1, "lottery-game-details", {
|
|
51
|
+
"clientStyling": [1, "client-styling"],
|
|
52
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
53
|
+
"limitStylingAppends": [32]
|
|
54
|
+
}]);
|
|
19
55
|
function defineCustomElement() {
|
|
20
56
|
if (typeof customElements === "undefined") {
|
|
21
57
|
return;
|