@everymatrix/lottery-draw-results 0.1.1 → 0.1.2

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.
Files changed (27) hide show
  1. package/dist/cjs/{index-33a98fae.js → index-62f030ff.js} +73 -1
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/lottery-bullet_3.cjs.entry.js +374 -0
  4. package/dist/cjs/lottery-draw-results.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +14 -1
  6. package/dist/collection/components/lottery-draw-results/lottery-draw-results.css +7 -18
  7. package/dist/collection/components/lottery-draw-results/lottery-draw-results.js +56 -169
  8. package/dist/collection/utils/locale.utils.js +2 -14
  9. package/dist/components/lottery-bullet.js +6 -0
  10. package/dist/components/lottery-bullet2.js +56 -0
  11. package/dist/components/lottery-draw-results.js +59 -62
  12. package/dist/components/lottery-grid.js +6 -0
  13. package/dist/components/lottery-grid2.js +196 -0
  14. package/dist/esm/{index-c6e6b7f8.js → index-98326ddd.js} +73 -2
  15. package/dist/esm/loader.js +2 -2
  16. package/dist/esm/lottery-bullet_3.entry.js +368 -0
  17. package/dist/esm/lottery-draw-results.js +2 -2
  18. package/dist/lottery-draw-results/lottery-draw-results.esm.js +1 -1
  19. package/dist/lottery-draw-results/p-2b8529f6.entry.js +1 -0
  20. package/dist/lottery-draw-results/p-bb429486.js +1 -0
  21. package/dist/types/components/lottery-draw-results/lottery-draw-results.d.ts +3 -28
  22. package/dist/types/components.d.ts +2 -56
  23. package/package.json +1 -1
  24. package/dist/cjs/lottery-draw-results.cjs.entry.js +0 -188
  25. package/dist/esm/lottery-draw-results.entry.js +0 -184
  26. package/dist/lottery-draw-results/p-31e0953f.js +0 -1
  27. package/dist/lottery-draw-results/p-d7361a7b.entry.js +0 -1
@@ -1,188 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-33a98fae.js');
6
- require('@everymatrix/lottery-grid');
7
-
8
- const DEFAULT_LANGUAGE = 'en';
9
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
10
- const TRANSLATIONS = {
11
- en: {
12
- drawResultsHeader: 'Last draw results',
13
- drawId: 'Draw ID',
14
- drawName: 'Game name',
15
- drawDate: 'Draw Date',
16
- drawNumbersGridDraw: 'Draw numbers Grid A',
17
- drawNumbersGridTicket: 'Draw numbers Grid B',
18
- ticketResult: 'Ticket result',
19
- amountWon: 'Amount won',
20
- numberOfDraws: 'Number of draws',
21
- multiplier: 'Multiplier:',
22
- ticketPurchaseDate: 'Ticket Purchase Date',
23
- ticketStatus: 'Ticket Status',
24
- ticketId: 'Ticket ID',
25
- ticketAmount: 'Ticket Amount',
26
- winUpTo: 'Win up to',
27
- },
28
- ro: {
29
- drawResultsHeader: 'Ultimele rezultate extragere',
30
- drawId: 'Id extragere',
31
- drawName: 'Numele jocului',
32
- drawDate: 'Data extragerii',
33
- drawNumbersGridDraw: 'Numerele extrase Grid A',
34
- drawNumbersGridTicket: 'Numerele extrase Grid B',
35
- ticketResult: 'Rezultatul biletului',
36
- amountWon: 'Suma castigata',
37
- numberOfDraws: 'Numarul de extrageri',
38
- multiplier: 'Multiplicator:',
39
- ticketPurchaseDate: 'Data achizitionarii biletului',
40
- ticketStatus: 'Statusul biletului',
41
- ticketId: 'Id biletul',
42
- ticketAmount: 'Valoarea biletului',
43
- winUpTo: 'Poti castiga'
44
- },
45
- };
46
- const translate = (key, customLang) => {
47
- const lang = customLang;
48
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
49
- };
50
-
51
- const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0px 20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:70px;float:left;margin:0 0 20px 0;border:1px solid #f1f1f1;background:#fff;border-radius:4px;padding:10px;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden;box-shadow:rgba(99, 99, 99, 0.2) 0px 2px 8px 0px}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
52
-
53
- const LotteryDrawResults = class {
54
- constructor(hostRef) {
55
- index.registerInstance(this, hostRef);
56
- /**
57
- * Language of the widget
58
- */
59
- this.language = 'en';
60
- /**
61
- * Shows only the last draw
62
- */
63
- this.drawMode = false;
64
- /**
65
- * The drawID (option)
66
- */
67
- this.drawId = '';
68
- /**
69
- * The game name
70
- */
71
- this.gameName = '';
72
- /**
73
- * The ticket submission date
74
- */
75
- this.ticketDate = '';
76
- /**
77
- * The ticket status
78
- */
79
- this.ticketStatus = '';
80
- /**
81
- * The ticket id
82
- */
83
- this.ticketId = '';
84
- /**
85
- * The ticket amount
86
- */
87
- this.ticketAmount = '';
88
- /**
89
- * The ticket multiplier
90
- */
91
- this.ticketMultiplier = false;
92
- /**
93
- * The ticket draw count
94
- */
95
- this.ticketDrawCount = 0;
96
- this.multiplier = 3;
97
- this.isLoading = true;
98
- this.drawResults = [];
99
- this.rules = {};
100
- this.toggleDrawer = [false];
101
- this.hasErrors = false;
102
- this.errorText = '';
103
- this.changeBox = (index) => {
104
- this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
105
- if (itemIndex == index) {
106
- return !item;
107
- }
108
- return item;
109
- });
110
- if (index >= this.toggleDrawer.length) {
111
- this.toggleDrawer.push(true);
112
- }
113
- };
114
- }
115
- connectedCallback() {
116
- let promises = [];
117
- promises.push(this.getGameData());
118
- if (this.drawId) {
119
- promises.push(this.getDrawData());
120
- }
121
- Promise.all(promises)
122
- .then(() => {
123
- this.isLoading = false;
124
- });
125
- }
126
- getDrawData() {
127
- return new Promise((resolve, reject) => {
128
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
129
- fetch(url.href)
130
- .then((response) => {
131
- // @TODO EXCEPTIONS
132
- return response.json();
133
- })
134
- .then((data) => {
135
- this.drawData = data;
136
- resolve(true);
137
- this.isLoading = false;
138
- })
139
- .catch((err) => {
140
- reject(err);
141
- this.isLoading = false;
142
- });
143
- });
144
- }
145
- getGameData() {
146
- return new Promise((resolve, reject) => {
147
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
148
- fetch(url.href)
149
- .then((response) => {
150
- return response.json();
151
- })
152
- .then((data) => {
153
- this.rules = {
154
- maximumAllowed: data.rules.boards[0].maximumAllowed,
155
- totalNumbers: data.rules.boards[0].totalNumbers
156
- };
157
- resolve(true);
158
- this.isLoading = false;
159
- this.hasErrors = false;
160
- })
161
- .catch((err) => {
162
- this.isLoading = false;
163
- this.hasErrors = true;
164
- this.errorText = err;
165
- reject(err);
166
- });
167
- });
168
- }
169
- render() {
170
- if (this.isLoading) {
171
- return (index.h("p", null, "Loading, please wait ..."));
172
- }
173
- else if (this.hasErrors) {
174
- index.h("p", null, this.errorText);
175
- }
176
- else {
177
- return (index.h("section", { class: "DrawResultsSection" }, !this.drawMode ?
178
- index.h("div", { class: "DrawResultsArea" }, index.h("div", { class: "TicketInfo" }, index.h("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", index.h("span", null, this.gameName)), index.h("div", { class: "TicketDate" }, translate('ticketPurchaseDate', this.language), ": ", index.h("span", null, this.ticketDate.slice(0, 10))), index.h("div", { class: "TicketStatus" }, translate('ticketStatus', this.language), ": ", index.h("span", null, this.ticketStatus))), index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "TicketIdContainer" }, index.h("p", null, translate('ticketId', this.language), ": ", index.h("span", null, this.ticketId))), index.h("div", { class: "TicketAmountContainer" }, index.h("p", null, translate('ticketAmount', this.language), " ", index.h("span", null, this.ticketAmount))), index.h("div", { class: "DrawNumbersGrid" }, index.h("p", null, translate('drawNumbersGridTicket', this.language), ":"), index.h("div", { class: "BulletContainer" }, index.h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('winUpTo', this.language), " ", index.h("span", null, JSON.stringify(this.ticketMultiplier)))), index.h("div", { class: "NumberOfDrawsContainer" }, index.h("p", null, translate('numberOfDraws', this.language), ": ", this.ticketDrawCount), index.h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index$1) => index.h("div", { class: "ExpandableBoxes" }, index.h("div", { class: this.toggleDrawer[index$1] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index$1) }, index.h("div", { class: "TicketResultContainer" }, index.h("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
179
- index.h("div", { class: "AmountWonContainer" }, index.h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), index.h("div", { class: "DrawIdContainer" }, index.h("p", null, translate('drawId', this.language), ": ", item.drawId)), index.h("div", { class: "DrawDateContainer" }, index.h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), index.h("div", { class: "DrawNumbersGrid" }), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('winUpTo', this.language), " ", item.multiplier)))))))))
180
- :
181
- index.h("div", { class: "DrawResultsArea" }, this.drawData &&
182
- index.h("div", null, index.h("div", { class: "DrawResultsHeader" }, index.h("span", null, translate('drawId', this.language), ": ", this.drawData.id), index.h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "DrawNumbersGrid" }, index.h("p", null, translate('drawNumbersGridDraw', this.language), ":"), index.h("div", { class: "BulletContainer" }, index.h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), " ", this.multiplier))))))));
183
- }
184
- }
185
- };
186
- LotteryDrawResults.style = lotteryDrawResultsCss;
187
-
188
- exports.lottery_draw_results = LotteryDrawResults;
@@ -1,184 +0,0 @@
1
- import { r as registerInstance, h } from './index-c6e6b7f8.js';
2
- import '@everymatrix/lottery-grid';
3
-
4
- const DEFAULT_LANGUAGE = 'en';
5
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
6
- const TRANSLATIONS = {
7
- en: {
8
- drawResultsHeader: 'Last draw results',
9
- drawId: 'Draw ID',
10
- drawName: 'Game name',
11
- drawDate: 'Draw Date',
12
- drawNumbersGridDraw: 'Draw numbers Grid A',
13
- drawNumbersGridTicket: 'Draw numbers Grid B',
14
- ticketResult: 'Ticket result',
15
- amountWon: 'Amount won',
16
- numberOfDraws: 'Number of draws',
17
- multiplier: 'Multiplier:',
18
- ticketPurchaseDate: 'Ticket Purchase Date',
19
- ticketStatus: 'Ticket Status',
20
- ticketId: 'Ticket ID',
21
- ticketAmount: 'Ticket Amount',
22
- winUpTo: 'Win up to',
23
- },
24
- ro: {
25
- drawResultsHeader: 'Ultimele rezultate extragere',
26
- drawId: 'Id extragere',
27
- drawName: 'Numele jocului',
28
- drawDate: 'Data extragerii',
29
- drawNumbersGridDraw: 'Numerele extrase Grid A',
30
- drawNumbersGridTicket: 'Numerele extrase Grid B',
31
- ticketResult: 'Rezultatul biletului',
32
- amountWon: 'Suma castigata',
33
- numberOfDraws: 'Numarul de extrageri',
34
- multiplier: 'Multiplicator:',
35
- ticketPurchaseDate: 'Data achizitionarii biletului',
36
- ticketStatus: 'Statusul biletului',
37
- ticketId: 'Id biletul',
38
- ticketAmount: 'Valoarea biletului',
39
- winUpTo: 'Poti castiga'
40
- },
41
- };
42
- const translate = (key, customLang) => {
43
- const lang = customLang;
44
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
45
- };
46
-
47
- const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsArea{margin-top:15px}.DrawResultsSection{max-width:600px;margin:0px auto;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px;border-radius:4px 4px 0 0}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0;padding-top:15px}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0px 20px;margin-bottom:5px;border-radius:0 0 4px 4px;border:1px solid #009993}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{line-height:12px;font-weight:lighter;width:100%;height:100%;max-height:70px;float:left;margin:0 0 20px 0;border:1px solid #f1f1f1;background:#fff;border-radius:4px;padding:10px;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden;box-shadow:rgba(99, 99, 99, 0.2) 0px 2px 8px 0px}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
48
-
49
- const LotteryDrawResults = class {
50
- constructor(hostRef) {
51
- registerInstance(this, hostRef);
52
- /**
53
- * Language of the widget
54
- */
55
- this.language = 'en';
56
- /**
57
- * Shows only the last draw
58
- */
59
- this.drawMode = false;
60
- /**
61
- * The drawID (option)
62
- */
63
- this.drawId = '';
64
- /**
65
- * The game name
66
- */
67
- this.gameName = '';
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;
93
- this.isLoading = true;
94
- this.drawResults = [];
95
- this.rules = {};
96
- this.toggleDrawer = [false];
97
- this.hasErrors = false;
98
- this.errorText = '';
99
- this.changeBox = (index) => {
100
- this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
101
- if (itemIndex == index) {
102
- return !item;
103
- }
104
- return item;
105
- });
106
- if (index >= this.toggleDrawer.length) {
107
- this.toggleDrawer.push(true);
108
- }
109
- };
110
- }
111
- connectedCallback() {
112
- let promises = [];
113
- promises.push(this.getGameData());
114
- if (this.drawId) {
115
- promises.push(this.getDrawData());
116
- }
117
- Promise.all(promises)
118
- .then(() => {
119
- this.isLoading = false;
120
- });
121
- }
122
- getDrawData() {
123
- return new Promise((resolve, reject) => {
124
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
125
- fetch(url.href)
126
- .then((response) => {
127
- // @TODO EXCEPTIONS
128
- return response.json();
129
- })
130
- .then((data) => {
131
- this.drawData = data;
132
- resolve(true);
133
- this.isLoading = false;
134
- })
135
- .catch((err) => {
136
- reject(err);
137
- this.isLoading = false;
138
- });
139
- });
140
- }
141
- getGameData() {
142
- return new Promise((resolve, reject) => {
143
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
144
- fetch(url.href)
145
- .then((response) => {
146
- return response.json();
147
- })
148
- .then((data) => {
149
- this.rules = {
150
- maximumAllowed: data.rules.boards[0].maximumAllowed,
151
- totalNumbers: data.rules.boards[0].totalNumbers
152
- };
153
- resolve(true);
154
- this.isLoading = false;
155
- this.hasErrors = false;
156
- })
157
- .catch((err) => {
158
- this.isLoading = false;
159
- this.hasErrors = true;
160
- this.errorText = err;
161
- reject(err);
162
- });
163
- });
164
- }
165
- render() {
166
- if (this.isLoading) {
167
- return (h("p", null, "Loading, please wait ..."));
168
- }
169
- else if (this.hasErrors) {
170
- h("p", null, this.errorText);
171
- }
172
- else {
173
- return (h("section", { class: "DrawResultsSection" }, !this.drawMode ?
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)))))))))
176
- :
177
- h("div", { class: "DrawResultsArea" }, this.drawData &&
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))))))));
179
- }
180
- }
181
- };
182
- LotteryDrawResults.style = lotteryDrawResultsCss;
183
-
184
- export { LotteryDrawResults as lottery_draw_results };
@@ -1 +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),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}
@@ -1 +0,0 @@
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}