@everymatrix/lottery-draw-results 0.1.23 → 1.13.4

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.
@@ -629,6 +629,9 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
629
629
  }
630
630
  }
631
631
  }
632
+ {
633
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
634
+ }
632
635
  endSchedule();
633
636
  return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
634
637
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-43800d3c.js');
5
+ const index = require('./index-35787b9c.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -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([["lottery-bullet_3.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"],"ticketNumbers":[1,"ticket-numbers"],"sessionId":[1,"session-id"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"multiplier":[32],"isLoading":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32],"ticketData":[32],"ticketDataLoaded":[32],"ticketDraws":[32],"hasDrawNumbers":[32],"limitStylingAppends":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"gridType":[1,"grid-type"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
17
+ return index.bootstrapLazy([["lottery-bullet_3.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"],"ticketNumbers":[1,"ticket-numbers"],"sessionId":[1,"session-id"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"ticketDrawData":[1,"ticket-draw-data"],"multiplier":[32],"isLoading":[32],"hasErrors":[32],"errorText":[32],"ticketData":[32],"ticketDataLoaded":[32],"ticketDraws":[32],"toggleDrawer":[32],"limitStylingAppends":[32],"drawData":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"gridType":[1,"grid-type"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-43800d3c.js');
5
+ const index = require('./index-35787b9c.js');
6
6
 
7
7
  const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, white 0%, white 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, white 0%, #f1f1f1 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #00958f}.Circle.Disabled{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #D4D4D4;cursor:default}";
8
8
 
@@ -147,7 +147,7 @@ const translate = (key, customLang) => {
147
147
  return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
148
148
  };
149
149
 
150
- 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}";
150
+ 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{display:flex;flex-direction:column;gap:5px}.DrawNumbersGrid label{display:block;margin-bottom:7px}.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;border:1px solid #ccc;border-radius:5px;background-color:white}.ExpandableBox{border-bottom:1px solid #ccc;transition:height 300ms ease-in-out;overflow:hidden;height:80px}.ExpandableBox:last-child{border-bottom:0}.ExpandableBoxHeader{position:relative;list-style:none;outline:0;cursor:pointer;text-transform:uppercase;transition:color 300ms ease-in-out;margin-bottom:24px;margin-left:5px}.ShowBox>.ExpandableBoxHeader{color:#009993}.ExpandableBoxHeader::-webkit-details-marker{display:none}.ExpandableBoxHeader:before,.ExpandableBoxHeader:after{content:\"\";position:absolute}.ExpandableBoxHeader:before{right:21px;top:50%;height:2px;margin-top:-1px;width:16px;background:#009993}.ExpandableBoxHeader:after{right:28px;top:50%;height:16px;margin-top:-8px;width:2px;margin-left:-1px;background:#009993;transition:all 300ms ease-in-out}.ShowBox .ExpandableBoxHeader:after{opacity:0;transform:translateY(25%)}.ExpandableBoxBody{padding-top:0;font-weight:lighter;margin-left:5px}.ExpandableBox.ShowBox{height:300px}";
151
151
 
152
152
  const LotteryDrawResults = class {
153
153
  constructor(hostRef) {
@@ -208,78 +208,21 @@ const LotteryDrawResults = class {
208
208
  * Client custom styling via url content
209
209
  */
210
210
  this.clientStylingUrlContent = '';
211
+ /**
212
+ * Data showing the ticket's draw results details
213
+ */
214
+ this.ticketDrawData = '';
211
215
  this.multiplier = 3;
212
216
  this.isLoading = true;
213
- this.rules = {};
214
- this.toggleDrawer = [false];
215
217
  this.hasErrors = false;
216
218
  this.errorText = '';
217
219
  this.ticketData = [];
218
220
  this.ticketDataLoaded = false;
219
221
  this.ticketDraws = [];
220
- this.hasDrawNumbers = false;
222
+ this.toggleDrawer = [false];
221
223
  this.limitStylingAppends = false;
222
- this.getTicketsData = () => {
223
- let url = new URL(`${this.endpoint}/tickets`);
224
- let drawOptions = {
225
- method: "GET",
226
- headers: {
227
- 'Content-Type': "application/json",
228
- 'Accept': 'application/json',
229
- 'Authorization': `Bearer ${this.sessionId}`
230
- },
231
- };
232
- fetch(url.href, drawOptions)
233
- .then((response) => {
234
- return response.json();
235
- })
236
- .then((data) => {
237
- if (data) {
238
- this.ticketData = data;
239
- this.ticketDataLoaded = true;
240
- }
241
- return this.ticketData;
242
- })
243
- .then((response) => {
244
- response.forEach(ticket => {
245
- if (ticket.drawResults.length) {
246
- ticket.drawResults.forEach(draw => {
247
- fetch(`${this.endpoint}/games/${this.gameId}/draws/${draw.drawId}`)
248
- .then((response) => {
249
- return response.json();
250
- })
251
- .then((data) => {
252
- // check if draw id is unique
253
- if (!this.ticketDraws.some(el => el.drawId === draw.drawId)) {
254
- this.ticketDraws.push({ drawId: draw.drawId, drawNumbers: data.winningNumbers });
255
- }
256
- })
257
- .catch((err) => {
258
- console.log('error ', err);
259
- });
260
- });
261
- }
262
- return this.ticketDraws;
263
- });
264
- })
265
- .then(() => {
266
- this.hasDrawNumbers = true;
267
- })
268
- .catch((err) => {
269
- console.log('error ', err);
270
- });
271
- };
272
- this.changeBox = (index) => {
273
- this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
274
- if (itemIndex == index) {
275
- return !item;
276
- }
277
- return item;
278
- });
279
- if (index >= this.toggleDrawer.length) {
280
- this.toggleDrawer.push(true);
281
- }
282
- };
224
+ this.ticketDrawDetails = [];
225
+ this.ticketDrawDetailsFlag = true;
283
226
  this.setClientStyling = () => {
284
227
  let sheet = document.createElement('style');
285
228
  sheet.innerHTML = this.clientStyling;
@@ -295,13 +238,13 @@ const LotteryDrawResults = class {
295
238
  }
296
239
  connectedCallback() {
297
240
  let promises = [];
298
- promises.push(this.getGameData());
241
+ // Split ticket numbers for each grid
242
+ if (this.ticketNumbers) {
243
+ this.gridNumbers = JSON.parse(this.ticketNumbers);
244
+ }
299
245
  if (this.drawId) {
300
246
  promises.push(this.getDrawData());
301
247
  }
302
- if (!this.drawMode) {
303
- this.getTicketsData();
304
- }
305
248
  Promise.all(promises)
306
249
  .then(() => {
307
250
  this.isLoading = false;
@@ -310,6 +253,15 @@ const LotteryDrawResults = class {
310
253
  this.isLoading = false;
311
254
  });
312
255
  }
256
+ componentWillRender() {
257
+ if (this.ticketDrawData && this.ticketDrawDetailsFlag) {
258
+ this.ticketDrawDetails = JSON.parse(this.ticketDrawData);
259
+ this.ticketDrawDetails.forEach((drawDetail) => {
260
+ this.getDrawData(drawDetail.drawId).then((drawData) => drawDetail.drawData = drawData);
261
+ });
262
+ this.ticketDrawDetailsFlag = false;
263
+ }
264
+ }
313
265
  componentDidRender() {
314
266
  // start custom styling area
315
267
  if (!this.limitStylingAppends && this.stylingContainer) {
@@ -321,21 +273,24 @@ const LotteryDrawResults = class {
321
273
  }
322
274
  // end custom styling area
323
275
  }
324
- getDrawData(drawID) {
276
+ getDrawData(drawId) {
277
+ this.isLoading = true;
325
278
  return new Promise((resolve, reject) => {
326
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${drawID ? drawID : this.drawId}`);
279
+ let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${drawId ? drawId : this.drawId}`);
327
280
  fetch(url.href)
328
281
  .then((response) => {
329
282
  // @TODO EXCEPTIONS
330
283
  return response.json();
331
284
  })
332
285
  .then((data) => {
333
- this.drawData = data;
334
- resolve(true);
335
- this.isLoading = false;
336
- if (drawID) {
337
- return this.drawData.winningNumbers;
286
+ if (drawId) {
287
+ resolve(data);
288
+ }
289
+ else {
290
+ this.drawData = data;
291
+ resolve(true);
338
292
  }
293
+ this.isLoading = false;
339
294
  })
340
295
  .catch((err) => {
341
296
  reject(err);
@@ -343,29 +298,16 @@ const LotteryDrawResults = class {
343
298
  });
344
299
  });
345
300
  }
346
- getGameData() {
347
- return new Promise((resolve, reject) => {
348
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
349
- fetch(url.href)
350
- .then((response) => {
351
- return response.json();
352
- })
353
- .then((data) => {
354
- this.rules = {
355
- maximumAllowed: data.rules.boards[0].maximumAllowed,
356
- totalNumbers: data.rules.boards[0].totalNumbers
357
- };
358
- resolve(true);
359
- this.isLoading = false;
360
- this.hasErrors = false;
361
- })
362
- .catch((err) => {
363
- this.isLoading = false;
364
- this.hasErrors = true;
365
- this.errorText = err;
366
- reject(err);
367
- });
301
+ drawerToggle(index) {
302
+ this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
303
+ if (itemIndex == index) {
304
+ return !item;
305
+ }
306
+ return item;
368
307
  });
308
+ if (index >= this.toggleDrawer.length) {
309
+ this.toggleDrawer.push(true);
310
+ }
369
311
  }
370
312
  render() {
371
313
  if (this.isLoading) {
@@ -377,14 +319,19 @@ const LotteryDrawResults = class {
377
319
  else {
378
320
  return (index.h("section", { class: "DrawResultsSection", ref: el => this.stylingContainer = el }, this.drawMode ?
379
321
  index.h("div", { class: "DrawResultsArea" }, this.drawData &&
380
- 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), "0:"), index.h("div", { class: "BulletContainer" }, index.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 })), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))
322
+ 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), "0:"), index.h("div", { class: "BulletContainer" }, index.h("lottery-grid", { "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 })), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))
381
323
  :
382
- index.h("div", { class: "DrawResultsArea TicketDraws" }, index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "TicketIdContainer" }, index.h("label", { class: "Label" }, translate('ticketId', this.language), ": ", index.h("span", null, this.ticketId))), index.h("div", { class: "TicketAmountContainer" }, index.h("label", { class: "Label" }, translate('ticketAmount', this.language), " ", index.h("span", null, this.ticketAmount))), index.h("div", { class: "DrawNumbersGrid" }, index.h("label", { class: "Label" }, translate('drawNumbersGridTicket', this.language), "0:"), index.h("div", { class: "BulletContainer" }, index.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 }))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", JSON.stringify(this.ticketMultiplier))), index.h("div", { class: "NumberOfDrawsContainer" }, index.h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), index.h("div", { class: "DrawTicketsContainer" }, this.ticketData.map((ticket) => index.h("div", { class: "ExpandableBoxes" }, ticket.drawResults.length ?
383
- index.h("div", null, ticket.id == this.ticketId && ticket.drawResults.map((item, index$1) => 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.state)), item.state == 'won' &&
384
- 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" }, this.hasDrawNumbers && this.ticketDraws.map((ticketDraw) => item.drawId && item.drawId === ticketDraw.drawId &&
385
- index.h("div", null, index.h("label", { class: "Label" }, translate('drawNumbersGridDraw', this.language), "A:"), index.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 })))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", item.multiplier)))))
386
- :
387
- index.h("span", null)))))))));
324
+ index.h("div", { class: "DrawResultsArea TicketDraws" }, index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "TicketIdContainer" }, index.h("label", { class: "Label" }, translate('ticketId', this.language), ": ", index.h("span", null, this.ticketId))), index.h("div", { class: "TicketAmountContainer" }, index.h("label", { class: "Label" }, translate('ticketAmount', this.language), " ", index.h("span", null, this.ticketAmount))), index.h("div", { class: "DrawNumbersGrid" }, this.gridNumbers.map((grid, index$1) => index.h("div", null, index.h("label", { class: "Label" }, translate('drawNumbersGridTicket', this.language), " ", String.fromCharCode(index$1 + 65), ":"), index.h("div", { class: "BulletContainer" }, index.h("lottery-grid", { "selected-numbers": grid.join(','), selectable: false, "display-selected": true, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", JSON.stringify(this.ticketMultiplier))), index.h("div", { class: "NumberOfDrawsContainer" }, index.h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), index.h("div", { class: "DrawTicketsContainer" }, this.ticketDrawDetails && this.ticketDrawDetails.length > 0 &&
325
+ index.h("div", { class: "ExpandableBoxes" }, this.ticketDrawDetails.map((drawDetail, index$1) => {
326
+ var _a, _b, _c, _d, _e;
327
+ return index.h("div", { class: { 'ExpandableBox': true, 'ShowBox': this.toggleDrawer[index$1] }, onClick: () => this.drawerToggle(index$1) }, index.h("div", { class: "ExpandableBoxHeader" }, index.h("div", { class: "TicketResultContainer" }, index.h("p", null, translate('ticketResult', this.language), ": ", drawDetail.state)), drawDetail.state == 'won' &&
328
+ index.h("div", { class: "AmountWonContainer" }, index.h("p", null, translate('amountWon', this.language), ": ", Number(drawDetail.amount).toLocaleString('en'), " ", drawDetail.currency)), drawDetail.state == 'lost' &&
329
+ index.h("div", { class: "DrawIdContainer" }, index.h("p", null, translate('drawId', this.language), ": ", drawDetail.drawId))), index.h("div", { class: "ExpandableBoxBody" }, index.h("div", { class: "DrawIdContainer" }, index.h("p", null, translate('drawId', this.language), ": ", drawDetail.drawId)), index.h("div", { class: "DrawDateContainer" }, index.h("p", null, translate('drawDate', this.language), ": ", (_a = drawDetail.drawData) === null || _a === void 0 ? void 0 :
330
+ _a.date.slice(0, 10), " | ", (_b = drawDetail.drawData) === null || _b === void 0 ? void 0 :
331
+ _b.date.slice(11, 19))), index.h("div", { class: "DrawNumbersGrid" }, drawDetail.drawData &&
332
+ index.h("div", { class: 'BulletContainer' }, index.h("label", { class: "Label" }, translate('drawNumbersGridDraw', this.language), " ", String.fromCharCode(index$1 + 10), ":"), index.h("lottery-grid", { "selected-numbers": (_d = (_c = drawDetail.drawData) === null || _c === void 0 ? void 0 : _c.winningNumbers) === null || _d === void 0 ? void 0 : _d.join(','), selectable: false, "display-selected": true, language: this.language, "grid-type": 'ticket', "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", (_e = drawDetail.drawData) === null || _e === void 0 ? void 0 :
333
+ _e.multiplier))));
334
+ }))))))));
388
335
  }
389
336
  }
390
337
  };
@@ -491,6 +438,15 @@ const LotteryGrid = class {
491
438
  }
492
439
  // end custom styling area
493
440
  }
441
+ // wrote this because the classic .sort(() => 0.5 - Math.random()) method yielded low entropy shuffles for some reason on certain devices
442
+ shuffleArray(array) {
443
+ const result = [];
444
+ while (array.length > 0) {
445
+ const randomIndex = Math.floor(Math.random() * (array.length));
446
+ result.push(array.splice(randomIndex, 1)[0]);
447
+ }
448
+ return result;
449
+ }
494
450
  lotteryBulletSelectionHandler(event) {
495
451
  this.numbers = this.numbers.map((item) => {
496
452
  if (item.number == event.detail.value) {
@@ -562,8 +518,8 @@ const LotteryGrid = class {
562
518
  if (event.detail && event.detail == this.ticketId) {
563
519
  this.resetSelectionHandler(event);
564
520
  let array = [...Array(this.totalNumbers).keys()]
565
- .map(number => number + 1)
566
- .sort(() => 0.5 - Math.random());
521
+ .map(number => number + 1);
522
+ array = this.shuffleArray(array);
567
523
  array = array.slice(0, this.minimumAllowed);
568
524
  this.numbers = this.numbers.map((item) => {
569
525
  return {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-43800d3c.js');
3
+ const index = require('./index-35787b9c.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["lottery-bullet_3.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"],"ticketNumbers":[1,"ticket-numbers"],"sessionId":[1,"session-id"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"multiplier":[32],"isLoading":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32],"ticketData":[32],"ticketDataLoaded":[32],"ticketDraws":[32],"hasDrawNumbers":[32],"limitStylingAppends":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"gridType":[1,"grid-type"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
18
+ return index.bootstrapLazy([["lottery-bullet_3.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"],"ticketNumbers":[1,"ticket-numbers"],"sessionId":[1,"session-id"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"ticketDrawData":[1,"ticket-draw-data"],"multiplier":[32],"isLoading":[32],"hasErrors":[32],"errorText":[32],"ticketData":[32],"ticketDataLoaded":[32],"ticketDraws":[32],"toggleDrawer":[32],"limitStylingAppends":[32],"drawData":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"gridType":[1,"grid-type"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
19
19
  });
@@ -65,11 +65,13 @@
65
65
  }
66
66
 
67
67
  .DrawNumbersGrid {
68
- margin-bottom: 15px;
68
+ display: flex;
69
+ flex-direction: column;
70
+ gap: 5px;
69
71
  }
70
72
  .DrawNumbersGrid label {
71
73
  display: block;
72
- margin-bottom: 10px;
74
+ margin-bottom: 7px;
73
75
  }
74
76
 
75
77
  .Toggle {
@@ -139,44 +141,67 @@
139
141
  position: relative;
140
142
  display: flex;
141
143
  flex-direction: column;
144
+ border: 1px solid #ccc;
145
+ border-radius: 5px;
146
+ background-color: white;
142
147
  }
143
148
 
144
149
  .ExpandableBox {
145
- line-height: 12px;
146
- font-weight: lighter;
147
- width: 100%;
148
- height: 100%;
149
- max-height: 80px;
150
- float: left;
151
- margin: 0 0 20px 0;
152
- border: 1px solid #009993;
153
- background: #fff;
154
- border-radius: 4px;
155
- padding: 10px;
156
- box-sizing: border-box;
157
- -webkit-transition: all 0.6s ease-in-out;
158
- -moz-transition: all 0.6s ease-in-out;
159
- -o-transition: all 0.6s ease-in-out;
160
- -ms-transition: all 0.6s ease-in-out;
161
- transition: all 0.6s ease-in-out;
150
+ border-bottom: 1px solid #ccc;
151
+ transition: height 300ms ease-in-out;
162
152
  overflow: hidden;
163
- box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
153
+ height: 80px;
164
154
  }
165
- .ExpandableBox:last-of-type {
166
- margin-bottom: 0;
155
+ .ExpandableBox:last-child {
156
+ border-bottom: 0;
167
157
  }
168
-
169
- .ExpandableBox.ShowBox {
170
- max-height: 400px;
171
- margin: 0px 0px 20p 0px;
158
+ .ExpandableBoxHeader {
159
+ position: relative;
160
+ list-style: none;
161
+ outline: 0;
162
+ cursor: pointer;
163
+ text-transform: uppercase;
164
+ transition: color 300ms ease-in-out;
165
+ margin-bottom: 24px;
166
+ margin-left: 5px;
172
167
  }
173
-
174
- .ExpandableBox.HideBox {
175
- width: 0;
176
- height: 0;
177
- overflow: hidden;
178
- border: none;
179
- padding: 0;
180
- margin: 0;
168
+ .ShowBox > .ExpandableBoxHeader {
169
+ color: #009993;
170
+ }
171
+ .ExpandableBoxHeader::-webkit-details-marker {
172
+ display: none;
173
+ }
174
+ .ExpandableBoxHeader:before, .ExpandableBoxHeader:after {
175
+ content: "";
176
+ position: absolute;
177
+ }
178
+ .ExpandableBoxHeader:before {
179
+ right: 21px;
180
+ top: 50%;
181
+ height: 2px;
182
+ margin-top: -1px;
183
+ width: 16px;
184
+ background: #009993;
185
+ }
186
+ .ExpandableBoxHeader:after {
187
+ right: 28px;
188
+ top: 50%;
189
+ height: 16px;
190
+ margin-top: -8px;
191
+ width: 2px;
192
+ margin-left: -1px;
193
+ background: #009993;
194
+ transition: all 300ms ease-in-out;
195
+ }
196
+ .ShowBox .ExpandableBoxHeader:after {
181
197
  opacity: 0;
198
+ transform: translateY(25%);
199
+ }
200
+ .ExpandableBoxBody {
201
+ padding-top: 0;
202
+ font-weight: lighter;
203
+ margin-left: 5px;
204
+ }
205
+ .ExpandableBox.ShowBox {
206
+ height: 300px;
182
207
  }