@everymatrix/lottery-game-page 0.1.18 → 0.1.20
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 +35 -3
- package/dist/cjs/helper-filters_2.cjs.entry.js +148 -21
- package/dist/cjs/helper-modal.cjs.entry.js +34 -2
- package/dist/cjs/helper-pagination.cjs.entry.js +33 -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 +35 -3
- package/dist/cjs/lottery-draw-results-history.cjs.entry.js +1 -1
- package/dist/cjs/lottery-game-details.cjs.entry.js +1 -1
- package/dist/cjs/lottery-game-page.cjs.entry.js +43 -6
- package/dist/cjs/lottery-game-page.cjs.js +2 -2
- package/dist/cjs/lottery-ticket-controller.cjs.entry.js +1 -1
- package/dist/cjs/lottery-ticket.cjs.entry.js +1 -1
- 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/components/helper-accordion2.js +38 -3
- package/dist/components/helper-filters2.js +44 -8
- package/dist/components/helper-modal2.js +37 -2
- package/dist/components/helper-pagination.js +36 -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-results2.js +118 -15
- package/dist/components/lottery-game-page.js +47 -6
- package/dist/components/lottery-grid2.js +1 -1
- package/dist/esm/helper-accordion.entry.js +35 -3
- package/dist/esm/helper-filters_2.entry.js +148 -21
- package/dist/esm/helper-modal.entry.js +34 -2
- package/dist/esm/helper-pagination.entry.js +33 -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 +35 -3
- package/dist/esm/lottery-draw-results-history.entry.js +1 -1
- package/dist/esm/lottery-game-details.entry.js +1 -1
- package/dist/esm/lottery-game-page.entry.js +43 -6
- package/dist/esm/lottery-game-page.js +2 -2
- package/dist/esm/lottery-ticket-controller.entry.js +1 -1
- package/dist/esm/lottery-ticket.entry.js +1 -1
- package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
- package/dist/lottery-game-page/p-07f98587.entry.js +1 -0
- package/dist/lottery-game-page/{p-5e12dbf9.entry.js → p-13d0f256.entry.js} +1 -1
- package/dist/lottery-game-page/{p-a26ebf45.entry.js → p-63781a10.entry.js} +1 -1
- package/dist/lottery-game-page/p-800590f3.entry.js +1 -0
- package/dist/lottery-game-page/p-87298564.entry.js +1 -0
- package/dist/lottery-game-page/{p-042b777b.entry.js → p-90003eb8.entry.js} +34 -34
- package/dist/lottery-game-page/p-b49e741d.entry.js +1 -0
- package/dist/lottery-game-page/p-b4e2988a.js +1 -0
- package/dist/lottery-game-page/p-bb028d40.entry.js +1 -0
- package/dist/lottery-game-page/{p-2197c8ae.entry.js → p-c0e7c864.entry.js} +1 -1
- package/dist/lottery-game-page/p-d241f927.entry.js +1 -0
- package/dist/lottery-game-page/p-e816baee.entry.js +1 -0
- package/dist/lottery-game-page/{p-a10368b2.entry.js → p-f9740035.entry.js} +1 -1
- 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 -2
- 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-2a4e9984.entry.js +0 -1
- package/dist/lottery-game-page/p-4bfd0112.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
|
@@ -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',
|
|
@@ -45,7 +45,7 @@ const translate = (key, customLang) => {
|
|
|
45
45
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
46
46
|
};
|
|
47
47
|
|
|
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}.
|
|
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}.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
49
|
|
|
50
50
|
const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
51
51
|
constructor() {
|
|
@@ -92,13 +92,75 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
92
92
|
* The ticket draw count
|
|
93
93
|
*/
|
|
94
94
|
this.ticketDrawCount = 0;
|
|
95
|
+
/**
|
|
96
|
+
* The ticket winning numbers
|
|
97
|
+
*/
|
|
98
|
+
this.ticketNumbers = '';
|
|
99
|
+
/**
|
|
100
|
+
* The session id
|
|
101
|
+
*/
|
|
102
|
+
this.sessionId = '';
|
|
103
|
+
/**
|
|
104
|
+
* Client custom styling via string
|
|
105
|
+
*/
|
|
106
|
+
this.clientStyling = '';
|
|
107
|
+
/**
|
|
108
|
+
* Client custom styling via url content
|
|
109
|
+
*/
|
|
110
|
+
this.clientStylingUrlContent = '';
|
|
95
111
|
this.multiplier = 3;
|
|
96
112
|
this.isLoading = true;
|
|
97
|
-
this.drawResults = [];
|
|
98
113
|
this.rules = {};
|
|
99
114
|
this.toggleDrawer = [false];
|
|
100
115
|
this.hasErrors = false;
|
|
101
116
|
this.errorText = '';
|
|
117
|
+
this.ticketData = [];
|
|
118
|
+
this.ticketDataLoaded = false;
|
|
119
|
+
this.ticketDraws = [];
|
|
120
|
+
this.hasDrawNumbers = false;
|
|
121
|
+
this.limitStylingAppends = false;
|
|
122
|
+
this.getTicketsData = () => {
|
|
123
|
+
let url = new URL(`${this.endpoint}/tickets`);
|
|
124
|
+
let drawOptions = {
|
|
125
|
+
method: "GET",
|
|
126
|
+
headers: {
|
|
127
|
+
'Content-Type': "application/json",
|
|
128
|
+
'Accept': 'application/json',
|
|
129
|
+
'Authorization': `Bearer ${this.sessionId}`
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
fetch(url.href, drawOptions)
|
|
133
|
+
.then((response) => {
|
|
134
|
+
return response.json();
|
|
135
|
+
})
|
|
136
|
+
.then((data) => {
|
|
137
|
+
if (data) {
|
|
138
|
+
this.ticketData = data;
|
|
139
|
+
this.ticketDataLoaded = true;
|
|
140
|
+
}
|
|
141
|
+
return this.ticketData;
|
|
142
|
+
}).then((response) => {
|
|
143
|
+
response.forEach(ticket => {
|
|
144
|
+
if (ticket.drawResults.length) {
|
|
145
|
+
ticket.drawResults.forEach(draw => {
|
|
146
|
+
fetch(`${this.endpoint}/games/${this.gameId}/draws/${draw.drawId}`)
|
|
147
|
+
.then((response) => {
|
|
148
|
+
return response.json();
|
|
149
|
+
})
|
|
150
|
+
.then((data) => {
|
|
151
|
+
// check if draw id is unique
|
|
152
|
+
if (!this.ticketDraws.some(el => el.drawId === draw.drawId)) {
|
|
153
|
+
this.ticketDraws.push({ drawId: draw.drawId, drawNumbers: data.winningNumbers });
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return this.ticketDraws;
|
|
159
|
+
});
|
|
160
|
+
}).then(() => {
|
|
161
|
+
this.hasDrawNumbers = true;
|
|
162
|
+
});
|
|
163
|
+
};
|
|
102
164
|
this.changeBox = (index) => {
|
|
103
165
|
this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
|
|
104
166
|
if (itemIndex == index) {
|
|
@@ -110,6 +172,18 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
110
172
|
this.toggleDrawer.push(true);
|
|
111
173
|
}
|
|
112
174
|
};
|
|
175
|
+
this.setClientStyling = () => {
|
|
176
|
+
let sheet = document.createElement('style');
|
|
177
|
+
sheet.innerHTML = this.clientStyling;
|
|
178
|
+
this.stylingContainer.prepend(sheet);
|
|
179
|
+
};
|
|
180
|
+
this.setClientStylingURL = () => {
|
|
181
|
+
let cssFile = document.createElement('style');
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
184
|
+
this.stylingContainer.prepend(cssFile);
|
|
185
|
+
}, 1);
|
|
186
|
+
};
|
|
113
187
|
}
|
|
114
188
|
connectedCallback() {
|
|
115
189
|
let promises = [];
|
|
@@ -117,14 +191,28 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
117
191
|
if (this.drawId) {
|
|
118
192
|
promises.push(this.getDrawData());
|
|
119
193
|
}
|
|
194
|
+
if (!this.drawMode) {
|
|
195
|
+
this.getTicketsData();
|
|
196
|
+
}
|
|
120
197
|
Promise.all(promises)
|
|
121
198
|
.then(() => {
|
|
122
199
|
this.isLoading = false;
|
|
123
200
|
});
|
|
124
201
|
}
|
|
125
|
-
|
|
202
|
+
componentDidRender() {
|
|
203
|
+
// start custom styling area
|
|
204
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
205
|
+
if (this.clientStyling)
|
|
206
|
+
this.setClientStyling();
|
|
207
|
+
if (this.clientStylingUrlContent)
|
|
208
|
+
this.setClientStylingURL();
|
|
209
|
+
this.limitStylingAppends = true;
|
|
210
|
+
}
|
|
211
|
+
// end custom styling area
|
|
212
|
+
}
|
|
213
|
+
getDrawData(drawID) {
|
|
126
214
|
return new Promise((resolve, reject) => {
|
|
127
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
|
|
215
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${drawID ? drawID : this.drawId}`);
|
|
128
216
|
fetch(url.href)
|
|
129
217
|
.then((response) => {
|
|
130
218
|
// @TODO EXCEPTIONS
|
|
@@ -134,6 +222,9 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
134
222
|
this.drawData = data;
|
|
135
223
|
resolve(true);
|
|
136
224
|
this.isLoading = false;
|
|
225
|
+
if (drawID) {
|
|
226
|
+
return this.drawData.winningNumbers;
|
|
227
|
+
}
|
|
137
228
|
})
|
|
138
229
|
.catch((err) => {
|
|
139
230
|
reject(err);
|
|
@@ -173,12 +264,16 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
173
264
|
h("p", null, this.errorText);
|
|
174
265
|
}
|
|
175
266
|
else {
|
|
176
|
-
return (h("section", { class: "DrawResultsSection" },
|
|
177
|
-
h("div", { class: "DrawResultsArea" },
|
|
178
|
-
h("div", { class: "
|
|
267
|
+
return (h("section", { class: "DrawResultsSection", ref: el => this.stylingContainer = el }, this.drawMode ?
|
|
268
|
+
h("div", { class: "DrawResultsArea" }, this.drawData &&
|
|
269
|
+
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
270
|
:
|
|
180
|
-
h("div", { class: "DrawResultsArea" }, this.
|
|
181
|
-
h("div", null,
|
|
271
|
+
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 ?
|
|
272
|
+
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' &&
|
|
273
|
+
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 &&
|
|
274
|
+
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)))))
|
|
275
|
+
:
|
|
276
|
+
h("span", null)))))))));
|
|
182
277
|
}
|
|
183
278
|
}
|
|
184
279
|
static get style() { return lotteryDrawResultsCss; }
|
|
@@ -196,13 +291,21 @@ const LotteryDrawResults = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
196
291
|
"ticketAmount": [1, "ticket-amount"],
|
|
197
292
|
"ticketMultiplier": [4, "ticket-multiplier"],
|
|
198
293
|
"ticketDrawCount": [2, "ticket-draw-count"],
|
|
294
|
+
"ticketNumbers": [1, "ticket-numbers"],
|
|
295
|
+
"sessionId": [1, "session-id"],
|
|
296
|
+
"clientStyling": [1, "client-styling"],
|
|
297
|
+
"clientStylingUrlContent": [1, "client-styling-url-content"],
|
|
199
298
|
"multiplier": [32],
|
|
200
299
|
"isLoading": [32],
|
|
201
|
-
"drawResults": [32],
|
|
202
300
|
"rules": [32],
|
|
203
301
|
"toggleDrawer": [32],
|
|
204
302
|
"hasErrors": [32],
|
|
205
|
-
"errorText": [32]
|
|
303
|
+
"errorText": [32],
|
|
304
|
+
"ticketData": [32],
|
|
305
|
+
"ticketDataLoaded": [32],
|
|
306
|
+
"ticketDraws": [32],
|
|
307
|
+
"hasDrawNumbers": [32],
|
|
308
|
+
"limitStylingAppends": [32]
|
|
206
309
|
}]);
|
|
207
310
|
function defineCustomElement() {
|
|
208
311
|
if (typeof customElements === "undefined") {
|
|
@@ -90,7 +90,7 @@ const translate = (key, customLang) => {
|
|
|
90
90
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
const lotteryGamePageCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GamePage .GridBanner{background-color:#009993;background-repeat:no-repeat;background-position:center;color:#111;padding:0 20px 10px;height:220px;display:flex;flex-direction:column;justify-content:space-between}.GamePage .GridBanner .BannerButtonsWrapper{display:flex;justify-content:space-between;padding-top:16px}.GamePage .GridBanner .BannerButtonsWrapper .BannerBackButton,.GamePage .GridBanner .BannerButtonsWrapper .BannerLobbyButton{background:#fff;border:1px solid #D4D4D4;border-radius:4px;padding:7px 15px;font-size:12px;text-transform:uppercase;width:80px}.GamePage .GridBanner .GridBannerArea{padding-top:30px;display:flex;flex-direction:column;align-items:center}.GamePage .TotalWinnings{color:#000;font-size:18px;display:flex;flex-direction:row;justify-content:center;align-items:center;gap:10px;text-transform:uppercase}.GamePage .TotalWinnings span{font-size:18px;font-weight:700}.GamePage .NextDraw{color:#00958f;font-size:24px;font-weight:600;margin:0 auto;text-align:center;text-transform:uppercase;display:flex;justify-content:center;align-items:center;flex-direction:column}.GamePage .NextDraw .BannerText{font-weight:400;font-size:18px;text-transform:uppercase;padding:0;margin:15px 0 0 0}.GamePage .NextDraw .BannerCountdown{font-size:22px;color:#00958f;display:flex;gap:20px}.GamePage .Tabs{display:flex;justify-content:center;gap:10px}.GamePage .Tabs .TabButton{border-radius:4px;cursor:pointer;padding:8px 0;width:50%;max-width:200px;border:1px solid #00958f;background:#
|
|
93
|
+
const lotteryGamePageCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GamePage .GridBanner{background-color:#009993;background-repeat:no-repeat;background-position:center;color:#111;padding:0 20px 10px;height:220px;display:flex;flex-direction:column;justify-content:space-between}.GamePage .GridBanner .BannerButtonsWrapper{display:flex;justify-content:space-between;padding-top:16px}.GamePage .GridBanner .BannerButtonsWrapper .BannerBackButton,.GamePage .GridBanner .BannerButtonsWrapper .BannerLobbyButton{background:#fff;border:1px solid #D4D4D4;border-radius:4px;padding:7px 15px;font-size:12px;text-transform:uppercase;width:80px}.GamePage .GridBanner .GridBannerArea{padding-top:30px;display:flex;flex-direction:column;align-items:center}.GamePage .TotalWinnings{color:#000;font-size:18px;display:flex;flex-direction:row;justify-content:center;align-items:center;gap:10px;text-transform:uppercase}.GamePage .TotalWinnings span{font-size:18px;font-weight:700}.GamePage .NextDraw{color:#00958f;font-size:24px;font-weight:600;margin:0 auto;text-align:center;text-transform:uppercase;display:flex;justify-content:center;align-items:center;flex-direction:column}.GamePage .NextDraw .BannerText{font-weight:400;font-size:18px;text-transform:uppercase;padding:0;margin:15px 0 0 0}.GamePage .NextDraw .BannerCountdown{font-size:22px;color:#00958f;display:flex;gap:20px}.GamePage .Tabs{display:flex;justify-content:center;gap:10px}.GamePage .Tabs .TabButton{border-radius:4px;cursor:pointer;padding:8px 0;width:50%;max-width:200px;border:1px solid #00958f;background:#00958f;color:#fff;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.GamePage .Tabs .TabButton.Active{color:#00958f;background:#F1F1F1;border:1px solid #F1F1F1}.LastDrawResultsTitle{color:#009993;padding:25px 0 10px 0;text-align:center;border-radius:4px;text-transform:uppercase;font-size:16px;font-weight:600;margin:0}.NextDrawWrapper{padding:10px 15px;background:#F1F1F1;background:linear-gradient(0deg, #f1f1f1 0%, rgba(253, 187, 45, 0) 100%)}.NextDrawWrapper .BannerText{font-size:16px;font-weight:700;text-align:center}.NextDrawWrapper .BannerCountdown{font-size:22px;display:flex;gap:8px;color:#009993;font-weight:bolder;justify-content:center}.GamePageContent{padding:15px;max-width:1200px;margin:0 auto}.GameDetails{padding-bottom:10px;margin-bottom:20px}.CreateNewTicket{background:#004D4A;height:100px;width:100%;display:flex;margin-top:10px;flex-direction:column;justify-content:center;align-items:center}.CreateNewTicket button{cursor:pointer;display:inline-block;border-radius:50%;width:40px;height:40px;margin:5px;border:1px solid #FFF;background:#FFF;color:#004D4A;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.CreateNewTicket button:hover{background:#F1F1F1}.CreateNewTicket span{display:inline-block;font-size:12px;text-align:center;margin:0 auto;color:#FFF}.OrderSummary{min-width:200px;border-radius:4px;display:flex;flex-direction:column;justify-content:center;margin-top:20px;background:#fff}.OrderSummary .OrderSummaryTitle{font-size:16px;color:#009993;text-transform:uppercase;text-align:center}.OrderSummary .Ticket{display:inline-block;color:#000;font-size:14px;height:50px;border-bottom:solid 1px #D4D4D4;line-height:50px}.OrderSummary .Ticket span{text-align:right}.OrderSummary .Total{display:inline-block;color:#000;font-size:14px;height:50px;line-height:50px}.OrderSummary .Total span{text-align:right}.ButtonWrapper{display:flex;align-items:center;justify-content:center}.ButtonWrapper .Button{cursor:pointer;border-radius:4px;padding:8px 60px;width:max-content;margin:5px;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#009993;border:1px solid #009993;color:#FFF}.ButtonWrapper .Button:hover{background:#00ABA4}.ButtonWrapper .Button.ButtonDisabled{pointer-events:none;background:#ccc;border:1px solid #ccc}.SubmitModalSuccess{text-align:center;font-size:18px;padding:20px}.DeleteTicketModalWrapper{padding:20px;text-align:center}.DeleteTicketModalWrapper .DeleteTicketModalTitle{font-size:16px;color:#00958f;font-weight:400;text-transform:uppercase;margin:20px 0 40px}.DeleteTicketModalWrapper .DeleteTicketModalText{font-size:14px;color:#000;line-height:22px;margin-bottom:40px}.DeleteTicketModalWrapper .DeleteTicketModalButtons{display:flex;gap:10px;justify-content:center}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm{cursor:pointer;border-radius:4px;padding:8px 25px;width:max-content;margin:5px;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm:hover{background:#FF6536;border:1px solid #FF3D00}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel{cursor:pointer;width:max-content;border-radius:4px;padding:10px 25px;margin:5px;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel:hover{background:#F1F1F1}@media (min-width: 1200px){.GamePageContent .TicketsWrapper{float:left;width:49%}.GamePageContent .GameDetails{float:right;width:49%}.GamePageContent .OrderSummary{float:right;width:49%}}";
|
|
94
94
|
|
|
95
95
|
const LotteryGamePage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
96
96
|
constructor() {
|
|
@@ -109,6 +109,15 @@ const LotteryGamePage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
109
109
|
* Shows the reset button
|
|
110
110
|
*/
|
|
111
111
|
this.resetButton = false;
|
|
112
|
+
/**
|
|
113
|
+
* Client custom styling via string
|
|
114
|
+
*/
|
|
115
|
+
this.clientStyling = '';
|
|
116
|
+
/**
|
|
117
|
+
* Client custom styling via url
|
|
118
|
+
*/
|
|
119
|
+
this.clientStylingurl = '';
|
|
120
|
+
this.clientStylingUrlContent = '';
|
|
112
121
|
this.tickets = [];
|
|
113
122
|
this.tabIndex = 0;
|
|
114
123
|
this.hasErrors = false;
|
|
@@ -119,8 +128,25 @@ const LotteryGamePage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
119
128
|
this.totalWinningsAmount = 0;
|
|
120
129
|
this.isLoggedIn = false;
|
|
121
130
|
this.loginModalVisible = false;
|
|
131
|
+
this.limitStylingAppends = false;
|
|
122
132
|
this.multiplier = false;
|
|
123
133
|
this.quickPick = false;
|
|
134
|
+
this.setClientStyling = () => {
|
|
135
|
+
let sheet = document.createElement('style');
|
|
136
|
+
sheet.innerHTML = this.clientStyling;
|
|
137
|
+
this.stylingContainer.prepend(sheet);
|
|
138
|
+
};
|
|
139
|
+
this.setClientStylingURL = () => {
|
|
140
|
+
let url = new URL(this.clientStylingurl);
|
|
141
|
+
let cssFile = document.createElement('style');
|
|
142
|
+
fetch(url.href)
|
|
143
|
+
.then((res) => res.text())
|
|
144
|
+
.then((data) => {
|
|
145
|
+
this.clientStylingUrlContent = data;
|
|
146
|
+
cssFile.innerHTML = data;
|
|
147
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
148
|
+
});
|
|
149
|
+
};
|
|
124
150
|
}
|
|
125
151
|
// @TODO fix `any` type later, I'm lazy now
|
|
126
152
|
connectedCallback() {
|
|
@@ -131,6 +157,17 @@ const LotteryGamePage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
131
157
|
this.isLoggedIn = true;
|
|
132
158
|
}
|
|
133
159
|
}
|
|
160
|
+
componentDidRender() {
|
|
161
|
+
// start custom styling area
|
|
162
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
163
|
+
if (this.clientStyling)
|
|
164
|
+
this.setClientStyling();
|
|
165
|
+
if (this.clientStylingurl)
|
|
166
|
+
this.setClientStylingURL();
|
|
167
|
+
this.limitStylingAppends = true;
|
|
168
|
+
}
|
|
169
|
+
// end custom styling area
|
|
170
|
+
}
|
|
134
171
|
countdownLogic(date) {
|
|
135
172
|
this.interval = setInterval(() => {
|
|
136
173
|
this.daysRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60 * 24));
|
|
@@ -332,11 +369,11 @@ const LotteryGamePage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
332
369
|
}
|
|
333
370
|
return (
|
|
334
371
|
/* Game details */
|
|
335
|
-
h("div", { class: "GamePage", dir: this.language == 'ar' ? 'rtl' : 'ltr' }, h("div", { class: "GridBanner" }, h("div", { class: "BannerButtonsWrapper" }, h("button", { class: "BannerBackButton" }, h("span", { class: "BannerBackButtonArrow" }, "\u1438 "), translate('backButton', this.language)), h("button", { class: "BannerLobbyButton" }, translate('lobbyButton', this.language))), h("div", { class: "Tabs" }, h("div", { class: 'TabButton' + (this.tabIndex == 0 ? ' Active' : ''), onClick: () => this.tabIndex = 0 }, translate('buy', this.language)), h("div", { class: 'TabButton' + (this.tabIndex == 1 ? ' Active' : ''), onClick: () => this.tabIndex = 1 }, translate('viewLatest', this.language)))), h("div", { class: "NextDrawWrapper" }, h("div", { class: "TotalWinnings" }, translate('winUpTo', this.language), ": ", h("span", null, "$", this.totalWinningsAmount.toLocaleString('en-US', { maximumFractionDigits: 2 }))), h("div", { class: "NextDraw" }, h("p", { class: "BannerText" }, translate('nextDraw', this.language)), h("div", { class: "BannerCountdown" }, h("span", { class: "CountdownDays" }, this.daysRemaining, "D"), h("span", { class: "CountdownHours" }, this.hoursRemaining, "H"), h("span", { class: "CountdownMinutes" }, this.minutesRemaining, "M"), h("span", { class: "CountdownSeconds" }, this.secondsRemaining, "S")))), this.tabIndex == 0 &&
|
|
336
|
-
h("div", { class: "GamePageContent" }, h("div", { class: "GameDetails" }, h("lottery-game-details",
|
|
372
|
+
h("div", { class: "GamePage", dir: this.language == 'ar' ? 'rtl' : 'ltr', ref: el => this.stylingContainer = el }, h("div", { class: "GridBanner" }, h("div", { class: "BannerButtonsWrapper" }, h("button", { class: "BannerBackButton" }, h("span", { class: "BannerBackButtonArrow" }, "\u1438 "), translate('backButton', this.language)), h("button", { class: "BannerLobbyButton" }, translate('lobbyButton', this.language))), h("div", { class: "Tabs" }, h("div", { class: 'TabButton' + (this.tabIndex == 0 ? ' Active' : ''), onClick: () => this.tabIndex = 0 }, translate('buy', this.language)), h("div", { class: 'TabButton' + (this.tabIndex == 1 ? ' Active' : ''), onClick: () => this.tabIndex = 1 }, translate('viewLatest', this.language)))), h("div", { class: "NextDrawWrapper" }, h("div", { class: "TotalWinnings" }, translate('winUpTo', this.language), ": ", h("span", null, "$", this.totalWinningsAmount.toLocaleString('en-US', { maximumFractionDigits: 2 }))), h("div", { class: "NextDraw" }, h("p", { class: "BannerText" }, translate('nextDraw', this.language)), h("div", { class: "BannerCountdown" }, h("span", { class: "CountdownDays" }, this.daysRemaining, "D"), h("span", { class: "CountdownHours" }, this.hoursRemaining, "H"), h("span", { class: "CountdownMinutes" }, this.minutesRemaining, "M"), h("span", { class: "CountdownSeconds" }, this.secondsRemaining, "S")))), this.tabIndex == 0 &&
|
|
373
|
+
h("div", { class: "GamePageContent" }, h("div", { class: "GameDetails" }, h("lottery-game-details", { "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("div", { class: "TicketsWrapper" }, this.tickets.map((item) => h("lottery-ticket-controller", { endpoint: this.endpoint, "ticket-id": item.ticketId, "game-id": item.gameId, collapsed: false, last: true, language: this.language, "auto-pick": this.autoPick, "reset-button": this.resetButton, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("div", { class: "CreateNewTicket" }, h("button", { onClick: () => this.createNewTicket() }, "+"), h("span", null, translate('createTicket', this.language)))), h("div", { class: "OrderSummary" }, h("h3", { class: "OrderSummaryTitle" }, translate('orderSummaryTitle', this.language)), h("div", { class: "Ticket" }, translate('orderSummaryTickets', this.language), ": ", h("span", null, this.tickets.length)), h("div", { class: "Total" }, translate('orderSummaryTotal', this.language), ": ", h("span", null, this.totalAmount, " ", this.currency)), h("div", { class: "ButtonWrapper" }, this.isLoggedIn &&
|
|
337
374
|
h("span", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language)), !this.isLoggedIn &&
|
|
338
|
-
h("div", null, h("span", { class: "Button", onClick: () => this.showLoginModal() }, translate('orderSummarySubmit', this.language)), h("helper-modal", { "title-modal": "Success", visible: this.loginModalVisible }, h("p", { class: "SubmitModalSuccess" }, translate('modalLogin', this.language))))))), this.tabIndex == 1 &&
|
|
339
|
-
h("div", null, h("h4", { class: "LastDrawResultsTitle" }, translate('lastDrawResultsTitle', this.language)), h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "draw-id": this.lastDrawId, "draw-mode": true }), h("lottery-draw-results-history", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language })), h("helper-modal", { "title-modal": "Success", visible: this.successVisible }, h("p", { class: "SubmitModalSuccess" }, translate('modalSuccess', this.language))), h("helper-modal", { "title-modal": "Delete Ticket", visible: this.deleteVisible }, h("div", { class: "DeleteTicketModalWrapper" }, h("h3", { class: "DeleteTicketModalTitle" }, translate('deleteTicketModalTitle', this.language)), h("p", { class: "DeleteTicketModalText" }, translate('deleteTicketModalText', this.language)), h("div", { class: "DeleteTicketModalButtons" }, h("button", { class: "DeleteTicketModalCancel", onClick: () => this.modalCloseEvent() }, translate('deleteTicketModalCancel', this.language)), h("button", { class: "DeleteTicketModalConfirm", onClick: () => this.confirmDeleteTicketHandler(this.deleteEventData) }, translate('deleteTicketModalConfirm', this.language)))))));
|
|
375
|
+
h("div", null, h("span", { class: "Button", onClick: () => this.showLoginModal() }, translate('orderSummarySubmit', this.language)), h("helper-modal", { "title-modal": "Success", visible: this.loginModalVisible, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("p", { class: "SubmitModalSuccess" }, translate('modalLogin', this.language))))))), this.tabIndex == 1 &&
|
|
376
|
+
h("div", null, h("h4", { class: "LastDrawResultsTitle" }, translate('lastDrawResultsTitle', this.language)), h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "draw-id": this.lastDrawId, "draw-mode": true, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }), h("lottery-draw-results-history", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })), h("helper-modal", { "title-modal": "Success", visible: this.successVisible, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("p", { class: "SubmitModalSuccess" }, translate('modalSuccess', this.language))), h("helper-modal", { "title-modal": "Delete Ticket", visible: this.deleteVisible, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("div", { class: "DeleteTicketModalWrapper" }, h("h3", { class: "DeleteTicketModalTitle" }, translate('deleteTicketModalTitle', this.language)), h("p", { class: "DeleteTicketModalText" }, translate('deleteTicketModalText', this.language)), h("div", { class: "DeleteTicketModalButtons" }, h("button", { class: "DeleteTicketModalCancel", onClick: () => this.modalCloseEvent() }, translate('deleteTicketModalCancel', this.language)), h("button", { class: "DeleteTicketModalConfirm", onClick: () => this.confirmDeleteTicketHandler(this.deleteEventData) }, translate('deleteTicketModalConfirm', this.language)))))));
|
|
340
377
|
}
|
|
341
378
|
static get assetsDirs() { return ["static"]; }
|
|
342
379
|
get element() { return this; }
|
|
@@ -349,6 +386,9 @@ const LotteryGamePage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
349
386
|
"language": [1],
|
|
350
387
|
"autoPick": [4, "auto-pick"],
|
|
351
388
|
"resetButton": [4, "reset-button"],
|
|
389
|
+
"clientStyling": [1, "client-styling"],
|
|
390
|
+
"clientStylingurl": [1, "client-stylingurl"],
|
|
391
|
+
"clientStylingUrlContent": [32],
|
|
352
392
|
"tickets": [32],
|
|
353
393
|
"tabIndex": [32],
|
|
354
394
|
"hasErrors": [32],
|
|
@@ -364,7 +404,8 @@ const LotteryGamePage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
364
404
|
"totalWinningsAmount": [32],
|
|
365
405
|
"nextDate": [32],
|
|
366
406
|
"isLoggedIn": [32],
|
|
367
|
-
"loginModalVisible": [32]
|
|
407
|
+
"loginModalVisible": [32],
|
|
408
|
+
"limitStylingAppends": [32]
|
|
368
409
|
}, [[0, "ticketCompleted", "gridFilledHandler"], [0, "gridDirty", "gridDirtyHandler"], [0, "deleteTicket", "deleteTicketHandler"], [0, "modalCloseEvent", "modalCloseEvent"], [0, "stakeChange", "stakeChangeHandler"], [0, "multiplierChange", "multiplierChangeHandler"]]]);
|
|
369
410
|
function defineCustomElement$1() {
|
|
370
411
|
if (typeof customElements === "undefined") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$1 } from './lottery-bullet2.js';
|
|
3
3
|
|
|
4
|
-
const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:
|
|
4
|
+
const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.Grid.TicketGrid{gap:5px}";
|
|
5
5
|
|
|
6
6
|
const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-0f8edfd2.js';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_LANGUAGE = 'en';
|
|
4
4
|
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
@@ -15,7 +15,7 @@ const translate = (key, customLang) => {
|
|
|
15
15
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:
|
|
18
|
+
const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:5px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:1px}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff;text-transform:capitalize}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
|
|
19
19
|
|
|
20
20
|
const Accordion = class {
|
|
21
21
|
constructor(hostRef) {
|
|
@@ -61,11 +61,43 @@ const Accordion = class {
|
|
|
61
61
|
* Language
|
|
62
62
|
*/
|
|
63
63
|
this.language = 'en';
|
|
64
|
+
/**
|
|
65
|
+
* Client custom styling via string
|
|
66
|
+
*/
|
|
67
|
+
this.clientStyling = '';
|
|
68
|
+
/**
|
|
69
|
+
* Client custom styling via url content
|
|
70
|
+
*/
|
|
71
|
+
this.clientStylingUrlContent = '';
|
|
72
|
+
this.limitStylingAppends = false;
|
|
73
|
+
this.setClientStyling = () => {
|
|
74
|
+
let sheet = document.createElement('style');
|
|
75
|
+
sheet.innerHTML = this.clientStyling;
|
|
76
|
+
this.stylingContainer.prepend(sheet);
|
|
77
|
+
};
|
|
78
|
+
this.setClientStylingURL = () => {
|
|
79
|
+
let cssFile = document.createElement('style');
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
82
|
+
this.stylingContainer.prepend(cssFile);
|
|
83
|
+
}, 1);
|
|
84
|
+
};
|
|
64
85
|
}
|
|
65
86
|
// @TODO fix the `any` type :)
|
|
66
87
|
connectedCallback() {
|
|
67
88
|
this.showContent = !this.collapsed;
|
|
68
89
|
}
|
|
90
|
+
componentDidRender() {
|
|
91
|
+
// start custom styling area
|
|
92
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
93
|
+
if (this.clientStyling)
|
|
94
|
+
this.setClientStyling();
|
|
95
|
+
if (this.clientStylingUrlContent)
|
|
96
|
+
this.setClientStylingURL();
|
|
97
|
+
this.limitStylingAppends = true;
|
|
98
|
+
}
|
|
99
|
+
// end custom styling area
|
|
100
|
+
}
|
|
69
101
|
toggleContent() {
|
|
70
102
|
this.showContent = !this.showContent;
|
|
71
103
|
}
|
|
@@ -77,7 +109,7 @@ const Accordion = class {
|
|
|
77
109
|
this.accordionEvent.emit();
|
|
78
110
|
}
|
|
79
111
|
render() {
|
|
80
|
-
return (h("div", { class: "Wrapper" }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
|
|
112
|
+
return (h("div", { class: "Wrapper", ref: el => this.stylingContainer = el }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle Description" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
|
|
81
113
|
h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
|
|
82
114
|
h("div", null, this.deleteTab &&
|
|
83
115
|
h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
|