@everymatrix/lottery-draw-results 0.0.3 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-17920f23.js';
1
+ import { r as registerInstance, h } from './index-c6e6b7f8.js';
2
2
  import '@everymatrix/lottery-grid';
3
3
 
4
4
  const DEFAULT_LANGUAGE = 'en';
@@ -13,7 +13,13 @@ const TRANSLATIONS = {
13
13
  drawNumbersGridTicket: 'Draw numbers Grid B',
14
14
  ticketResult: 'Ticket result',
15
15
  amountWon: 'Amount won',
16
- numberOfDraws: 'Number of draws'
16
+ numberOfDraws: 'Number of draws',
17
+ multiplier: 'Multiplier:',
18
+ ticketPurchaseDate: 'Ticket Purchase Date',
19
+ ticketStatus: 'Ticket Status',
20
+ ticketId: 'Ticket ID',
21
+ ticketAmount: 'Ticket Amount',
22
+ winUpTo: 'Win up to',
17
23
  },
18
24
  ro: {
19
25
  drawResultsHeader: 'Ultimele rezultate extragere',
@@ -24,7 +30,13 @@ const TRANSLATIONS = {
24
30
  drawNumbersGridTicket: 'Numerele extrase Grid B',
25
31
  ticketResult: 'Rezultatul biletului',
26
32
  amountWon: 'Suma castigata',
27
- numberOfDraws: 'Numarul de extrageri'
33
+ numberOfDraws: 'Numarul de extrageri',
34
+ multiplier: 'Multiplicator:',
35
+ ticketPurchaseDate: 'Data achizitionarii biletului',
36
+ ticketStatus: 'Statusul biletului',
37
+ ticketId: 'Id biletul',
38
+ ticketAmount: 'Valoarea biletului',
39
+ winUpTo: 'Poti castiga'
28
40
  },
29
41
  };
30
42
  const translate = (key, customLang) => {
@@ -32,22 +44,8 @@ const translate = (key, customLang) => {
32
44
  return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
33
45
  };
34
46
 
35
- 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}.DrawResultsSection{max-width:500px;margin:0 auto;margin:0px auto 10px;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0 20px}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{width:100%;height:100%;max-height:100px;float:left;margin:0 0 20px 0;border:1px solid #009993;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}.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}";
47
+ const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0px 20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:70px;float:left;margin:0 0 20px 0;border:1px solid #f1f1f1;background:#fff;border-radius:4px;padding:10px;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden;box-shadow:rgba(99, 99, 99, 0.2) 0px 2px 8px 0px}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
36
48
 
37
- const DEFAULT_VALUES = {
38
- gamename: 'Chrono',
39
- gamedate: '24/09/2022',
40
- state: 'Processing',
41
- amount: 304444,
42
- ticketid: '6963444',
43
- selection: '[5, 6, 7, 8, 9]',
44
- multiplier: 4.5,
45
- resultstatus: 'Processing',
46
- drawstatus: 'Won',
47
- drawamount: 1022,
48
- drawid: '54545555',
49
- drawdate: '24/09/2032'
50
- };
51
49
  const LotteryDrawResults = class {
52
50
  constructor(hostRef) {
53
51
  registerInstance(this, hostRef);
@@ -59,9 +57,39 @@ const LotteryDrawResults = class {
59
57
  * Shows only the last draw
60
58
  */
61
59
  this.drawMode = false;
60
+ /**
61
+ * The drawID (option)
62
+ */
63
+ this.drawId = '';
64
+ /**
65
+ * The game name
66
+ */
62
67
  this.gameName = '';
63
- this.multiplier = 5.434;
64
- this.ticketData = {};
68
+ /**
69
+ * The ticket submission date
70
+ */
71
+ this.ticketDate = '';
72
+ /**
73
+ * The ticket status
74
+ */
75
+ this.ticketStatus = '';
76
+ /**
77
+ * The ticket id
78
+ */
79
+ this.ticketId = '';
80
+ /**
81
+ * The ticket amount
82
+ */
83
+ this.ticketAmount = '';
84
+ /**
85
+ * The ticket multiplier
86
+ */
87
+ this.ticketMultiplier = false;
88
+ /**
89
+ * The ticket draw count
90
+ */
91
+ this.ticketDrawCount = 0;
92
+ this.multiplier = 3;
65
93
  this.isLoading = true;
66
94
  this.drawResults = [];
67
95
  this.rules = {};
@@ -83,9 +111,6 @@ const LotteryDrawResults = class {
83
111
  connectedCallback() {
84
112
  let promises = [];
85
113
  promises.push(this.getGameData());
86
- if (this.playerId) {
87
- promises.push(this.getTicketData());
88
- }
89
114
  if (this.drawId) {
90
115
  promises.push(this.getDrawData());
91
116
  }
@@ -105,9 +130,11 @@ const LotteryDrawResults = class {
105
130
  .then((data) => {
106
131
  this.drawData = data;
107
132
  resolve(true);
133
+ this.isLoading = false;
108
134
  })
109
135
  .catch((err) => {
110
136
  reject(err);
137
+ this.isLoading = false;
111
138
  });
112
139
  });
113
140
  }
@@ -124,6 +151,8 @@ const LotteryDrawResults = class {
124
151
  totalNumbers: data.rules.boards[0].totalNumbers
125
152
  };
126
153
  resolve(true);
154
+ this.isLoading = false;
155
+ this.hasErrors = false;
127
156
  })
128
157
  .catch((err) => {
129
158
  this.isLoading = false;
@@ -133,26 +162,7 @@ const LotteryDrawResults = class {
133
162
  });
134
163
  });
135
164
  }
136
- getTicketData() {
137
- return new Promise((resolve, reject) => {
138
- let url = new URL(`${this.endpoint}/tickets/player/${this.playerId}`);
139
- fetch(url.href)
140
- .then((response) => {
141
- return response.json();
142
- })
143
- .then((data) => {
144
- this.ticketData = data.length === 0 ? DEFAULT_VALUES : data[1];
145
- this.drawResults = this.ticketData.drawResults.map((item) => item);
146
- this.selection = this.ticketData.selection[0].join(',');
147
- resolve(true);
148
- })
149
- .catch((err) => {
150
- reject(err);
151
- });
152
- });
153
- }
154
165
  render() {
155
- var _a, _b, _c, _d, _e, _f;
156
166
  if (this.isLoading) {
157
167
  return (h("p", null, "Loading, please wait ..."));
158
168
  }
@@ -161,12 +171,11 @@ const LotteryDrawResults = class {
161
171
  }
162
172
  else {
163
173
  return (h("section", { class: "DrawResultsSection" }, !this.drawMode ?
164
- h("div", { class: "DrawResultsArea" }, h("div", { class: "TicketInfo" }, h("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", h("span", null, this.gameName)), h("div", { class: "TicketDate" }, "Ticket Purchase Date: ", h("span", null, (_a = this.ticketData) === null || _a === void 0 ? void 0 : _a.createdAt.slice(0, 10))), h("div", { class: "TicketStatus" }, "Status: ", h("span", null, (_b = this.ticketData) === null || _b === void 0 ? void 0 : _b.state))), h("div", { class: "DrawResultsBody" }, h("div", { class: "TicketIdContainer" }, h("p", null, "Ticket id: ", h("span", null, (_c = this.ticketData) === null || _c === void 0 ? void 0 : _c.id))), h("div", { class: "TicketAmountContainer" }, h("p", null, "Ticket amount: ", h("span", null, (_d = this.ticketData) === null || _d === void 0 ? void 0 : _d.amount))), h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridTicket', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, "Multiplier: ", h("span", null, JSON.stringify((_e = this.ticketData) === null || _e === void 0 ? void 0 : _e.multiplier)))), h("div", { class: "NumberOfDrawsContainer" }, h("p", null, translate('numberOfDraws', this.language), ": ", (_f = this.ticketData) === null || _f === void 0 ? void 0 :
165
- _f.drawCount), h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h("div", { class: "ExpandableBoxes" }, h("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) }, h("div", { class: "TicketResultContainer" }, h("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
166
- h("div", { class: "AmountWonContainer" }, h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), h("div", { class: "DrawIdContainer" }, h("p", null, translate('drawId', this.language), ": ", item.drawId)), h("div", { class: "DrawDateContainer" }, h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), h("div", { class: "DrawNumbersGrid" }), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, "Multiplier: ", item.multiplier)))))))))
174
+ h("div", { class: "DrawResultsArea" }, h("div", { class: "TicketInfo" }, h("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", h("span", null, this.gameName)), h("div", { class: "TicketDate" }, translate('ticketPurchaseDate', this.language), ": ", h("span", null, this.ticketDate.slice(0, 10))), h("div", { class: "TicketStatus" }, translate('ticketStatus', this.language), ": ", h("span", null, this.ticketStatus))), h("div", { class: "DrawResultsBody" }, h("div", { class: "TicketIdContainer" }, h("p", null, translate('ticketId', this.language), ": ", h("span", null, this.ticketId))), h("div", { class: "TicketAmountContainer" }, h("p", null, translate('ticketAmount', this.language), " ", h("span", null, this.ticketAmount))), h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridTicket', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('winUpTo', this.language), " ", h("span", null, JSON.stringify(this.ticketMultiplier)))), h("div", { class: "NumberOfDrawsContainer" }, h("p", null, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index) => h("div", { class: "ExpandableBoxes" }, h("div", { class: this.toggleDrawer[index] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index) }, h("div", { class: "TicketResultContainer" }, h("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
175
+ h("div", { class: "AmountWonContainer" }, h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), h("div", { class: "DrawIdContainer" }, h("p", null, translate('drawId', this.language), ": ", item.drawId)), h("div", { class: "DrawDateContainer" }, h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), h("div", { class: "DrawNumbersGrid" }), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('winUpTo', this.language), " ", item.multiplier)))))))))
167
176
  :
168
177
  h("div", { class: "DrawResultsArea" }, this.drawData &&
169
- h("div", null, h("div", { class: "DrawResultsHeader" }, h("span", null, translate('drawId', this.language), ": ", this.drawData.id), h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), h("div", { class: "DrawResultsBody" }, h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridDraw', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, "Multiplier: ", this.multiplier))))))));
178
+ h("div", null, h("div", { class: "DrawResultsHeader" }, h("span", null, translate('drawId', this.language), ": ", this.drawData.id), h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), h("div", { class: "DrawResultsBody" }, h("div", { class: "DrawNumbersGrid" }, h("p", null, translate('drawNumbersGridDraw', this.language), ":"), h("div", { class: "BulletContainer" }, h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), h("div", { class: "DrawMultipler" }, h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))));
170
179
  }
171
180
  }
172
181
  };
@@ -1,7 +1,7 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-17920f23.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-c6e6b7f8.js';
2
2
 
3
3
  /*
4
- Stencil Client Patch Browser v2.17.0 | MIT Licensed | https://stenciljs.com
4
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
5
5
  */
6
6
  const patchBrowser = () => {
7
7
  const importMeta = import.meta.url;
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["lottery-draw-results",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"multiplier":[32],"ticketData":[32],"isLoading":[32],"drawResults":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32]}]]]], options);
16
+ return bootstrapLazy([["lottery-draw-results",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"ticketDate":[1,"ticket-date"],"ticketStatus":[1,"ticket-status"],"ticketId":[1,"ticket-id"],"ticketAmount":[1,"ticket-amount"],"ticketMultiplier":[4,"ticket-multiplier"],"ticketDrawCount":[2,"ticket-draw-count"],"multiplier":[32],"isLoading":[32],"drawResults":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32]}]]]], options);
17
17
  });
@@ -1 +1 @@
1
- import{p as r,b as e}from"./p-62092f31.js";(()=>{const e=import.meta.url,a={};return""!==e&&(a.resourcesUrl=new URL(".",e).href),r(a)})().then((r=>e([["p-c6628b24",[[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"],multiplier:[32],ticketData:[32],isLoading:[32],drawResults:[32],rules:[32],toggleDrawer:[32],hasErrors:[32],errorText:[32]}]]]],r)));
1
+ import{p as t,b as e}from"./p-31e0953f.js";(()=>{const e=import.meta.url,a={};return""!==e&&(a.resourcesUrl=new URL(".",e).href),t(a)})().then((t=>e([["p-d7361a7b",[[1,"lottery-draw-results",{endpoint:[1],gameId:[1,"game-id"],language:[1],playerId:[1,"player-id"],drawMode:[4,"draw-mode"],drawId:[1,"draw-id"],gameName:[1,"game-name"],ticketDate:[1,"ticket-date"],ticketStatus:[1,"ticket-status"],ticketId:[1,"ticket-id"],ticketAmount:[1,"ticket-amount"],ticketMultiplier:[4,"ticket-multiplier"],ticketDrawCount:[2,"ticket-draw-count"],multiplier:[32],isLoading:[32],drawResults:[32],rules:[32],toggleDrawer:[32],hasErrors:[32],errorText:[32]}]]]],t)));
@@ -0,0 +1 @@
1
+ let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},r=e=>Promise.resolve(e),i=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),c=new WeakMap,u=e=>"sc-"+e.o,a={},f=e=>"object"==(e=typeof e)||"function"===e,$=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const i=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!f(l))&&(l+=""),s&&o?r[r.length-1].i+=l:r.push(s?d(null,l):l),o=s)};if(i(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const c=d(e,null);return c.u=t,r.length>0&&(c.$=r),c},d=(e,t)=>({t:0,h:e,i:t,p:null,$:null,u:null}),h={},y=(e,t,n,s,r,i)=>{if(n!==s){let c=H(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=m(n),o=m(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if(c||"o"!==t[0]||"n"!==t[1]){const l=f(s);if((c||l&&null!==s)&&!r)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?c=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!c||4&i||r)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):H(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},p=/\s/,m=e=>e?e.split(p):[],b=(e,t,n,l)=>{const s=11===t.p.nodeType&&t.p.host?t.p.host:t.p,o=e&&e.u||a,r=t.u||a;for(l in o)l in r||y(s,l,o[l],void 0,n,t.t);for(l in r)y(s,l,o[l],r[l],n,t.t)},w=(t,n,l)=>{let o,r,i=n.$[l],c=0;if(null!==i.i)o=i.p=s.createTextNode(i.i);else if(o=i.p=s.createElement(i.h),b(null,i,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),i.$)for(c=0;c<i.$.length;++c)r=w(t,i,c),r&&o.appendChild(r);return o},S=(e,n,l,s,o,r)=>{let i,c=e;for(c.shadowRoot&&c.tagName===t&&(c=c.shadowRoot);o<=r;++o)s[o]&&(i=w(null,l,o),i&&(s[o].p=i,c.insertBefore(i,n)))},g=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.p.remove()},j=(e,t)=>e.h===t.h,v=(e,t)=>{const n=t.p=e.p,l=e.$,s=t.$,o=t.i;null===o?(b(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,r=0,i=t.length-1,c=t[0],u=t[i],a=l.length-1,f=l[0],$=l[a];for(;o<=i&&r<=a;)null==c?c=t[++o]:null==u?u=t[--i]:null==f?f=l[++r]:null==$?$=l[--a]:j(c,f)?(v(c,f),c=t[++o],f=l[++r]):j(u,$)?(v(u,$),u=t[--i],$=l[--a]):j(c,$)?(v(c,$),e.insertBefore(c.p,u.p.nextSibling),c=t[++o],$=l[--a]):j(u,f)?(v(u,f),e.insertBefore(u.p,c.p),u=t[--i],f=l[++r]):(s=w(t&&t[r],n,r),f=l[++r],s&&c.p.parentNode.insertBefore(s,c.p));o>i?S(e,null==l[a+1]?null:l[a+1].p,n,l,r,a):r>a&&g(t,o,i)})(n,l,t,s):null!==s?(null!==e.i&&(n.textContent=""),S(n,null,t,s,0,s.length-1)):null!==l&&g(l,0,l.length-1)):e.i!==o&&(n.data=o)},M=(e,t)=>{t&&!e.m&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.m=t)))},k=(e,t)=>{if(e.t|=16,!(4&e.t))return M(e,e.S),X((()=>C(e,t)));e.t|=512},C=(e,t)=>{const n=e.g;return N(void 0,(()=>O(e,n,t)))},O=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.v,n=e.j,l=t.t,o=((e,t)=>{let n=u(t),l=B.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=c.get(e=e.head||e);o||c.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);P(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>x(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},P=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.M||d(null,null),r=(e=>e&&e.h===h)(l)?l:$(null,null,l);t=s.tagName,r.h=null,r.t|=4,n.M=r,r.p=o.p=s.shadowRoot||s,e=s["s-sc"],v(o,r)})(n,l)}catch(e){V(e,n.j)}return null},x=e=>{const t=e.j,n=e.S;64&e.t||(e.t|=64,T(t),e.k(t),n||E()),e.m&&(e.m(),e.m=void 0),512&e.t&&Q((()=>k(e,!1))),e.t&=-517},E=()=>{T(s.documentElement),Q((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"lottery-draw-results"}});return e.dispatchEvent(t),t})(l)))},N=(e,t)=>e&&e.then?e.then(t):t(),T=e=>e.classList.add("hydrated"),A=(e,t,n)=>{if(t.C){const l=Object.entries(t.C),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>U(this).O.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=U(e),o=s.O.get(t),r=s.t,i=s.g;n=((e,t)=>null==e||f(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.C[t][0]),8&r&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.O.set(t,n),i&&2==(18&r)&&k(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},F=e=>{((e,t)=>{if(e&&e[t])try{e[t](void 0)}catch(e){V(e)}})(e,"connectedCallback")},L=(e,t={})=>{const n=[],r=t.exclude||[],c=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),d=[];let h,y=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],o:t[1],C:t[2],P:t[3]};l.C=t[2];const s=l.o,a=class extends HTMLElement{constructor(e){super(e),q(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),y?d.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=U(e),n=t.v,l=()=>{};if(1&t.t)F(t.g);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){M(t,t.S=n);break}}n.C&&Object.entries(n.C).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=z(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(A(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){V(e)}t.t&=-9,e(),F(t.g)}if(s.style){let e=s.style;const t=u(n);if(!B.has(t)){const l=()=>{};((e,t,n)=>{let l=B.get(e);i&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,B.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.S,r=()=>k(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>{}))}componentOnReady(){return U(this).N}};l.T=e[0],r.includes(s)||c.get(s)||(n.push(s),c.define(s,A(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),y=!1,d.length?d.map((e=>e.connectedCallback())):o.jmp((()=>h=setTimeout(E,30)))},R=new WeakMap,U=e=>R.get(e),W=(e,t)=>R.set(t.g=e,t),q=(e,t)=>{const n={t:0,j:e,v:t,O:new Map};return n.N=new Promise((e=>n.k=e)),e["s-p"]=[],e["s-rc"]=[],R.set(e,n)},H=(e,t)=>t in e,V=(e,t)=>(0,console.error)(e,t),_=new Map,z=e=>{const t=e.o.replace(/-/g,"_"),n=e.T,l=_.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(_.set(n,e),e[t])),V)},B=new Map,D=[],G=[],I=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?Q(K):o.raf(K))},J=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){V(e)}e.length=0},K=()=>{J(D),J(G),(n=D.length>0)&&o.raf(K)},Q=e=>r().then(e),X=I(G,!0);export{L as b,$ as h,r as p,W as r}
@@ -0,0 +1 @@
1
+ import{r as t,h as e}from"./p-31e0953f.js";import"@everymatrix/lottery-grid";const i=["ro","en"],s={en:{drawResultsHeader:"Last draw results",drawId:"Draw ID",drawName:"Game name",drawDate:"Draw Date",drawNumbersGridDraw:"Draw numbers Grid A",drawNumbersGridTicket:"Draw numbers Grid B",ticketResult:"Ticket result",amountWon:"Amount won",numberOfDraws:"Number of draws",multiplier:"Multiplier:",ticketPurchaseDate:"Ticket Purchase Date",ticketStatus:"Ticket Status",ticketId:"Ticket ID",ticketAmount:"Ticket Amount",winUpTo:"Win up to"},ro:{drawResultsHeader:"Ultimele rezultate extragere",drawId:"Id extragere",drawName:"Numele jocului",drawDate:"Data extragerii",drawNumbersGridDraw:"Numerele extrase Grid A",drawNumbersGridTicket:"Numerele extrase Grid B",ticketResult:"Rezultatul biletului",amountWon:"Suma castigata",numberOfDraws:"Numarul de extrageri",multiplier:"Multiplicator:",ticketPurchaseDate:"Data achizitionarii biletului",ticketStatus:"Statusul biletului",ticketId:"Id biletul",ticketAmount:"Valoarea biletului",winUpTo:"Poti castiga"}},a=(t,e)=>{const a=e;return s[void 0!==a&&i.includes(a)?a:"en"][t]},r=class{constructor(e){t(this,e),this.language="en",this.drawMode=!1,this.drawId="",this.gameName="",this.ticketDate="",this.ticketStatus="",this.ticketId="",this.ticketAmount="",this.ticketMultiplier=!1,this.ticketDrawCount=0,this.multiplier=3,this.isLoading=!0,this.drawResults=[],this.rules={},this.toggleDrawer=[!1],this.hasErrors=!1,this.errorText="",this.changeBox=t=>{this.toggleDrawer=this.toggleDrawer.map(((e,i)=>i==t?!e:e)),t>=this.toggleDrawer.length&&this.toggleDrawer.push(!0)}}connectedCallback(){let t=[];t.push(this.getGameData()),this.drawId&&t.push(this.getDrawData()),Promise.all(t).then((()=>{this.isLoading=!1}))}getDrawData(){return new Promise(((t,e)=>{let i=new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);fetch(i.href).then((t=>t.json())).then((e=>{this.drawData=e,t(!0),this.isLoading=!1})).catch((t=>{e(t),this.isLoading=!1}))}))}getGameData(){return new Promise(((t,e)=>{let i=new URL(`${this.endpoint}/games/${this.gameId}`);fetch(i.href).then((t=>t.json())).then((e=>{this.rules={maximumAllowed:e.rules.boards[0].maximumAllowed,totalNumbers:e.rules.boards[0].totalNumbers},t(!0),this.isLoading=!1,this.hasErrors=!1})).catch((t=>{this.isLoading=!1,this.hasErrors=!0,this.errorText=t,e(t)}))}))}render(){return this.isLoading?e("p",null,"Loading, please wait ..."):this.hasErrors?void e("p",null,this.errorText):e("section",{class:"DrawResultsSection"},this.drawMode?e("div",{class:"DrawResultsArea"},this.drawData&&e("div",null,e("div",{class:"DrawResultsHeader"},e("span",null,a("drawId",this.language),": ",this.drawData.id),e("span",null,a("drawDate",this.language),": ",this.drawData.date.slice(0,10))),e("div",{class:"DrawResultsBody"},e("div",{class:"DrawNumbersGrid"},e("p",null,a("drawNumbersGridDraw",this.language),":"),e("div",{class:"BulletContainer"},e("lottery-grid",{"maximum-allowed":this.rules.maximumAllowed,"total-numbers":this.rules.totalNumbers,selectedNumbers:this.drawData.winningNumbers.join(","),"display-selected":!0,selectable:!1,language:this.language})),e("div",{class:"DrawMultipler"},e("label",{class:"Label"},a("multiplier",this.language)," ",this.multiplier)))))):e("div",{class:"DrawResultsArea"},e("div",{class:"TicketInfo"},e("div",{class:"TicketGameName"},a("drawName",this.language),": ",e("span",null,this.gameName)),e("div",{class:"TicketDate"},a("ticketPurchaseDate",this.language),": ",e("span",null,this.ticketDate.slice(0,10))),e("div",{class:"TicketStatus"},a("ticketStatus",this.language),": ",e("span",null,this.ticketStatus))),e("div",{class:"DrawResultsBody"},e("div",{class:"TicketIdContainer"},e("p",null,a("ticketId",this.language),": ",e("span",null,this.ticketId))),e("div",{class:"TicketAmountContainer"},e("p",null,a("ticketAmount",this.language)," ",e("span",null,this.ticketAmount))),e("div",{class:"DrawNumbersGrid"},e("p",null,a("drawNumbersGridTicket",this.language),":"),e("div",{class:"BulletContainer"},e("lottery-grid",{"maximum-allowed":this.rules.maximumAllowed,"total-numbers":this.rules.totalNumbers,"selected-numbers":this.selection,selectable:!1,"display-selected":!0,language:this.language}))),e("div",{class:"DrawMultipler"},e("label",{class:"Label"},a("winUpTo",this.language)," ",e("span",null,JSON.stringify(this.ticketMultiplier)))),e("div",{class:"NumberOfDrawsContainer"},e("p",null,a("numberOfDraws",this.language),": ",this.ticketDrawCount),e("div",{class:"DrawTicketsContainer"},this.drawResults.map(((t,i)=>e("div",{class:"ExpandableBoxes"},e("div",{class:this.toggleDrawer[i]?"ExpandableBox ShowBox":"ExpandableBox",onClick:()=>this.changeBox(i)},e("div",{class:"TicketResultContainer"},e("p",null,a("ticketResult",this.language),": ",t.status)),"won"==t.state&&e("div",{class:"AmountWonContainer"},e("p",null,a("amountWon",this.language),": ",Number(t.amount).toLocaleString("en")," ",t.currency)),e("div",{class:"DrawIdContainer"},e("p",null,a("drawId",this.language),": ",t.drawId)),e("div",{class:"DrawDateContainer"},e("p",null,a("drawDate",this.language),": ",t.updatedAt.slice(0,10)," | ",t.updatedAt.slice(11,19))),e("div",{class:"DrawNumbersGrid"}),e("div",{class:"DrawMultipler"},e("label",{class:"Label"},a("winUpTo",this.language)," ",t.multiplier)))))))))))}};r.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0px 20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:""}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:70px;float:left;margin:0 0 20px 0;border:1px solid #f1f1f1;background:#fff;border-radius:4px;padding:10px;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden;box-shadow:rgba(99, 99, 99, 0.2) 0px 2px 8px 0px}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}';export{r as lottery_draw_results}
@@ -21,12 +21,38 @@ export declare class LotteryDrawResults {
21
21
  */
22
22
  drawMode: boolean;
23
23
  /**
24
- * Shows results for a specific drawID (option)
24
+ * The drawID (option)
25
25
  */
26
26
  drawId: string;
27
+ /**
28
+ * The game name
29
+ */
27
30
  gameName: string;
31
+ /**
32
+ * The ticket submission date
33
+ */
34
+ ticketDate: string;
35
+ /**
36
+ * The ticket status
37
+ */
38
+ ticketStatus: string;
39
+ /**
40
+ * The ticket id
41
+ */
42
+ ticketId: string;
43
+ /**
44
+ * The ticket amount
45
+ */
46
+ ticketAmount: string;
47
+ /**
48
+ * The ticket multiplier
49
+ */
50
+ ticketMultiplier: boolean;
51
+ /**
52
+ * The ticket draw count
53
+ */
54
+ ticketDrawCount: number;
28
55
  multiplier: number;
29
- ticketData: any;
30
56
  isLoading: boolean;
31
57
  drawResults: any;
32
58
  private rules;
@@ -39,6 +65,5 @@ export declare class LotteryDrawResults {
39
65
  getDrawData(): Promise<boolean>;
40
66
  getGameData(): Promise<boolean>;
41
67
  changeBox: (index: number) => void;
42
- getTicketData(): Promise<boolean>;
43
68
  render(): any;
44
69
  }
@@ -8,7 +8,7 @@ import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
8
  export namespace Components {
9
9
  interface LotteryDrawResults {
10
10
  /**
11
- * Shows results for a specific drawID (option)
11
+ * The drawID (option)
12
12
  */
13
13
  "drawId": string;
14
14
  /**
@@ -23,6 +23,9 @@ export namespace Components {
23
23
  * GameID of the lottery game
24
24
  */
25
25
  "gameId": string;
26
+ /**
27
+ * The game name
28
+ */
26
29
  "gameName": string;
27
30
  /**
28
31
  * Language of the widget
@@ -32,6 +35,30 @@ export namespace Components {
32
35
  * Player ID
33
36
  */
34
37
  "playerId": string;
38
+ /**
39
+ * The ticket amount
40
+ */
41
+ "ticketAmount": string;
42
+ /**
43
+ * The ticket submission date
44
+ */
45
+ "ticketDate": string;
46
+ /**
47
+ * The ticket draw count
48
+ */
49
+ "ticketDrawCount": number;
50
+ /**
51
+ * The ticket id
52
+ */
53
+ "ticketId": string;
54
+ /**
55
+ * The ticket multiplier
56
+ */
57
+ "ticketMultiplier": boolean;
58
+ /**
59
+ * The ticket status
60
+ */
61
+ "ticketStatus": string;
35
62
  }
36
63
  }
37
64
  declare global {
@@ -48,7 +75,7 @@ declare global {
48
75
  declare namespace LocalJSX {
49
76
  interface LotteryDrawResults {
50
77
  /**
51
- * Shows results for a specific drawID (option)
78
+ * The drawID (option)
52
79
  */
53
80
  "drawId"?: string;
54
81
  /**
@@ -63,6 +90,9 @@ declare namespace LocalJSX {
63
90
  * GameID of the lottery game
64
91
  */
65
92
  "gameId"?: string;
93
+ /**
94
+ * The game name
95
+ */
66
96
  "gameName"?: string;
67
97
  /**
68
98
  * Language of the widget
@@ -72,6 +102,30 @@ declare namespace LocalJSX {
72
102
  * Player ID
73
103
  */
74
104
  "playerId"?: string;
105
+ /**
106
+ * The ticket amount
107
+ */
108
+ "ticketAmount"?: string;
109
+ /**
110
+ * The ticket submission date
111
+ */
112
+ "ticketDate"?: string;
113
+ /**
114
+ * The ticket draw count
115
+ */
116
+ "ticketDrawCount"?: number;
117
+ /**
118
+ * The ticket id
119
+ */
120
+ "ticketId"?: string;
121
+ /**
122
+ * The ticket multiplier
123
+ */
124
+ "ticketMultiplier"?: boolean;
125
+ /**
126
+ * The ticket status
127
+ */
128
+ "ticketStatus"?: string;
75
129
  }
76
130
  interface IntrinsicElements {
77
131
  "lottery-draw-results": LotteryDrawResults;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/lottery-draw-results",
3
- "version": "0.0.3",
3
+ "version": "0.1.1",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1,2 +0,0 @@
1
- let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},r=e=>Promise.resolve(e),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=new WeakMap,u=e=>"sc-"+e.o,a={},f=e=>"object"==(e=typeof e)||"function"===e,$=(e,t,...n)=>{let l=null,s=!1,o=!1;const r=[],c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!f(l))&&(l+=""),s&&o?r[r.length-1].i+=l:r.push(s?d(null,l):l),o=s)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=d(e,null);return i.u=t,r.length>0&&(i.$=r),i},d=(e,t)=>({t:0,h:e,i:t,m:null,$:null,u:null}),h={},y=(e,t,n,s,r,c)=>{if(n!==s){let i=H(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=p(n),o=p(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if(i||"o"!==t[0]||"n"!==t[1]){const l=f(s);if((i||l&&null!==s)&&!r)try{if(e.tagName.includes("-"))e[t]=s;else{const l=null==s?"":s;"list"===t?i=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&c||r)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):H(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},m=/\s/,p=e=>e?e.split(m):[],b=(e,t,n,l)=>{const s=11===t.m.nodeType&&t.m.host?t.m.host:t.m,o=e&&e.u||a,r=t.u||a;for(l in o)l in r||y(s,l,o[l],void 0,n,t.t);for(l in r)y(s,l,o[l],r[l],n,t.t)},w=(t,n,l)=>{const o=n.$[l];let r,c,i=0;if(null!==o.i)r=o.m=s.createTextNode(o.i);else if(r=o.m=s.createElement(o.h),b(null,o,!1),null!=e&&r["s-si"]!==e&&r.classList.add(r["s-si"]=e),o.$)for(i=0;i<o.$.length;++i)c=w(t,o,i),c&&r.appendChild(c);return r},S=(e,n,l,s,o,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=w(null,l,o),c&&(s[o].m=c,i.insertBefore(c,n)))},g=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.m.remove()},j=(e,t)=>e.h===t.h,v=(e,t)=>{const n=t.m=e.m,l=e.$,s=t.$,o=t.i;null===o?(b(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,r=0,c=t.length-1,i=t[0],u=t[c],a=l.length-1,f=l[0],$=l[a];for(;o<=c&&r<=a;)null==i?i=t[++o]:null==u?u=t[--c]:null==f?f=l[++r]:null==$?$=l[--a]:j(i,f)?(v(i,f),i=t[++o],f=l[++r]):j(u,$)?(v(u,$),u=t[--c],$=l[--a]):j(i,$)?(v(i,$),e.insertBefore(i.m,u.m.nextSibling),i=t[++o],$=l[--a]):j(u,f)?(v(u,f),e.insertBefore(u.m,i.m),u=t[--c],f=l[++r]):(s=w(t&&t[r],n,r),f=l[++r],s&&i.m.parentNode.insertBefore(s,i.m));o>c?S(e,null==l[a+1]?null:l[a+1].m,n,l,r,a):r>a&&g(t,o,c)})(n,l,t,s):null!==s?(null!==e.i&&(n.textContent=""),S(n,null,t,s,0,s.length-1)):null!==l&&g(l,0,l.length-1)):e.i!==o&&(n.data=o)},M=(e,t)=>{t&&!e.p&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.p=t)))},k=(e,t)=>{if(e.t|=16,!(4&e.t))return M(e,e.S),X((()=>C(e,t)));e.t|=512},C=(e,t)=>{const n=e.g;return N(void 0,(()=>O(e,n,t)))},O=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.v,n=e.j,l=t.t,o=((e,t)=>{let n=u(t);const l=B.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=i.get(e=e.head||e);o||i.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);P(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>x(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},P=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.M||d(null,null),r=(e=>e&&e.h===h)(l)?l:$(null,null,l);t=s.tagName,r.h=null,r.t|=4,n.M=r,r.m=o.m=s.shadowRoot||s,e=s["s-sc"],v(o,r)})(n,l)}catch(e){V(e,n.j)}return null},x=e=>{const t=e.j,n=e.S;64&e.t||(e.t|=64,T(t),e.k(t),n||E()),e.p&&(e.p(),e.p=void 0),512&e.t&&Q((()=>k(e,!1))),e.t&=-517},E=()=>{T(s.documentElement),Q((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"lottery-draw-results"}});return e.dispatchEvent(t),t})(l)))},N=(e,t)=>e&&e.then?e.then(t):t(),T=e=>e.classList.add("hydrated"),A=(e,t,n)=>{if(t.C){const l=Object.entries(t.C),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>W(this).O.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=W(e),o=s.O.get(t),r=s.t,c=s.g;n=((e,t)=>null==e||f(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(n,l.C[t][0]),8&r&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.O.set(t,n),c&&2==(18&r)&&k(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},L=e=>{((e,t)=>{if(e&&e[t])try{e[t](void 0)}catch(e){V(e)}})(e,"connectedCallback")},R=(e,t={})=>{const n=[],r=t.exclude||[],i=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),d=[];let h,y=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],o:t[1],C:t[2],P:t[3]};l.C=t[2];const s=l.o,a=class extends HTMLElement{constructor(e){super(e),F(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),y?d.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=W(e),n=t.v,l=()=>{};if(1&t.t)L(t.g);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){M(t,t.S=n);break}}n.C&&Object.entries(n.C).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=z(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(A(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){V(e)}t.t&=-9,e(),L(t.g)}if(s.style){let e=s.style;const t=u(n);if(!B.has(t)){const l=()=>{};((e,t,n)=>{let l=B.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,B.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.S,r=()=>k(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>{}))}componentOnReady(){return W(this).N}};l.T=e[0],r.includes(s)||i.get(s)||(n.push(s),i.define(s,A(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),y=!1,d.length?d.map((e=>e.connectedCallback())):o.jmp((()=>h=setTimeout(E,30)))},U=new WeakMap,W=e=>U.get(e),q=(e,t)=>U.set(t.g=e,t),F=(e,t)=>{const n={t:0,j:e,v:t,O:new Map};return n.N=new Promise((e=>n.k=e)),e["s-p"]=[],e["s-rc"]=[],U.set(e,n)},H=(e,t)=>t in e,V=(e,t)=>(0,console.error)(e,t),_=new Map,z=e=>{const t=e.o.replace(/-/g,"_"),n=e.T,l=_.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(_.set(n,e),e[t])),V)
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},B=new Map,D=[],G=[],I=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?Q(K):o.raf(K))},J=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){V(e)}e.length=0},K=()=>{J(D),J(G),(n=D.length>0)&&o.raf(K)},Q=e=>r().then(e),X=I(G,!0);export{R as b,$ as h,r as p,q as r}
@@ -1 +0,0 @@
1
- import{r as e,h as t}from"./p-62092f31.js";import"@everymatrix/lottery-grid";const i=["ro","en"],s={en:{drawResultsHeader:"Last draw results",drawId:"Draw ID",drawName:"Game name",drawDate:"Draw Date",drawNumbersGridDraw:"Draw numbers Grid A",drawNumbersGridTicket:"Draw numbers Grid B",ticketResult:"Ticket result",amountWon:"Amount won",numberOfDraws:"Number of draws"},ro:{drawResultsHeader:"Ultimele rezultate extragere",drawId:"Id extragere",drawName:"Numele jocului",drawDate:"Data extragerii",drawNumbersGridDraw:"Numerele extrase Grid A",drawNumbersGridTicket:"Numerele extrase Grid B",ticketResult:"Rezultatul biletului",amountWon:"Suma castigata",numberOfDraws:"Numarul de extrageri"}},a=(e,t)=>{const a=t;return s[void 0!==a&&i.includes(a)?a:"en"][e]},r={gamename:"Chrono",gamedate:"24/09/2022",state:"Processing",amount:304444,ticketid:"6963444",selection:"[5, 6, 7, 8, 9]",multiplier:4.5,resultstatus:"Processing",drawstatus:"Won",drawamount:1022,drawid:"54545555",drawdate:"24/09/2032"},l=class{constructor(t){e(this,t),this.language="en",this.drawMode=!1,this.gameName="",this.multiplier=5.434,this.ticketData={},this.isLoading=!0,this.drawResults=[],this.rules={},this.toggleDrawer=[!1],this.hasErrors=!1,this.errorText="",this.changeBox=e=>{this.toggleDrawer=this.toggleDrawer.map(((t,i)=>i==e?!t:t)),e>=this.toggleDrawer.length&&this.toggleDrawer.push(!0)}}connectedCallback(){let e=[];e.push(this.getGameData()),this.playerId&&e.push(this.getTicketData()),this.drawId&&e.push(this.getDrawData()),Promise.all(e).then((()=>{this.isLoading=!1}))}getDrawData(){return new Promise(((e,t)=>{let i=new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);fetch(i.href).then((e=>e.json())).then((t=>{this.drawData=t,e(!0)})).catch((e=>{t(e)}))}))}getGameData(){return new Promise(((e,t)=>{let i=new URL(`${this.endpoint}/games/${this.gameId}`);fetch(i.href).then((e=>e.json())).then((t=>{this.rules={maximumAllowed:t.rules.boards[0].maximumAllowed,totalNumbers:t.rules.boards[0].totalNumbers},e(!0)})).catch((e=>{this.isLoading=!1,this.hasErrors=!0,this.errorText=e,t(e)}))}))}getTicketData(){return new Promise(((e,t)=>{let i=new URL(`${this.endpoint}/tickets/player/${this.playerId}`);fetch(i.href).then((e=>e.json())).then((t=>{this.ticketData=0===t.length?r:t[1],this.drawResults=this.ticketData.drawResults.map((e=>e)),this.selection=this.ticketData.selection[0].join(","),e(!0)})).catch((e=>{t(e)}))}))}render(){var e,i,s,r,l,o;return this.isLoading?t("p",null,"Loading, please wait ..."):this.hasErrors?void t("p",null,this.errorText):t("section",{class:"DrawResultsSection"},this.drawMode?t("div",{class:"DrawResultsArea"},this.drawData&&t("div",null,t("div",{class:"DrawResultsHeader"},t("span",null,a("drawId",this.language),": ",this.drawData.id),t("span",null,a("drawDate",this.language),": ",this.drawData.date.slice(0,10))),t("div",{class:"DrawResultsBody"},t("div",{class:"DrawNumbersGrid"},t("p",null,a("drawNumbersGridDraw",this.language),":"),t("div",{class:"BulletContainer"},t("lottery-grid",{"maximum-allowed":this.rules.maximumAllowed,"total-numbers":this.rules.totalNumbers,selectedNumbers:this.drawData.winningNumbers.join(","),"display-selected":!0,selectable:!1,language:this.language})),t("div",{class:"DrawMultipler"},t("label",{class:"Label"},"Multiplier: ",this.multiplier)))))):t("div",{class:"DrawResultsArea"},t("div",{class:"TicketInfo"},t("div",{class:"TicketGameName"},a("drawName",this.language),": ",t("span",null,this.gameName)),t("div",{class:"TicketDate"},"Ticket Purchase Date: ",t("span",null,null===(e=this.ticketData)||void 0===e?void 0:e.createdAt.slice(0,10))),t("div",{class:"TicketStatus"},"Status: ",t("span",null,null===(i=this.ticketData)||void 0===i?void 0:i.state))),t("div",{class:"DrawResultsBody"},t("div",{class:"TicketIdContainer"},t("p",null,"Ticket id: ",t("span",null,null===(s=this.ticketData)||void 0===s?void 0:s.id))),t("div",{class:"TicketAmountContainer"},t("p",null,"Ticket amount: ",t("span",null,null===(r=this.ticketData)||void 0===r?void 0:r.amount))),t("div",{class:"DrawNumbersGrid"},t("p",null,a("drawNumbersGridTicket",this.language),":"),t("div",{class:"BulletContainer"},t("lottery-grid",{"maximum-allowed":this.rules.maximumAllowed,"total-numbers":this.rules.totalNumbers,"selected-numbers":this.selection,selectable:!1,"display-selected":!0,language:this.language}))),t("div",{class:"DrawMultipler"},t("label",{class:"Label"},"Multiplier: ",t("span",null,JSON.stringify(null===(l=this.ticketData)||void 0===l?void 0:l.multiplier)))),t("div",{class:"NumberOfDrawsContainer"},t("p",null,a("numberOfDraws",this.language),": ",null===(o=this.ticketData)||void 0===o?void 0:o.drawCount),t("div",{class:"DrawTicketsContainer"},this.drawResults.map(((e,i)=>t("div",{class:"ExpandableBoxes"},t("div",{class:this.toggleDrawer[i]?"ExpandableBox ShowBox":"ExpandableBox",onClick:()=>this.changeBox(i)},t("div",{class:"TicketResultContainer"},t("p",null,a("ticketResult",this.language),": ",e.status)),"won"==e.state&&t("div",{class:"AmountWonContainer"},t("p",null,a("amountWon",this.language),": ",Number(e.amount).toLocaleString("en")," ",e.currency)),t("div",{class:"DrawIdContainer"},t("p",null,a("drawId",this.language),": ",e.drawId)),t("div",{class:"DrawDateContainer"},t("p",null,a("drawDate",this.language),": ",e.updatedAt.slice(0,10)," | ",e.updatedAt.slice(11,19))),t("div",{class:"DrawNumbersGrid"}),t("div",{class:"DrawMultipler"},t("label",{class:"Label"},"Multiplier: ",e.multiplier)))))))))))}};l.style='@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}.DrawResultsSection{max-width:500px;margin:0 auto;margin:0px auto 10px;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0 20px}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:""}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{width:100%;height:100%;max-height:100px;float:left;margin:0 0 20px 0;border:1px solid #009993;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}.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}';export{l as lottery_draw_results}