@everymatrix/lottery-draw-results 0.0.3 → 0.1.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.
Files changed (29) hide show
  1. package/dist/cjs/{index-03778cb9.js → index-62f030ff.js} +81 -7
  2. package/dist/cjs/loader.cjs.js +3 -3
  3. package/dist/cjs/lottery-bullet_3.cjs.entry.js +383 -0
  4. package/dist/cjs/lottery-draw-results.cjs.js +3 -3
  5. package/dist/collection/collection-manifest.json +15 -2
  6. package/dist/collection/components/lottery-draw-results/lottery-draw-results.css +18 -7
  7. package/dist/collection/components/lottery-draw-results/lottery-draw-results.js +169 -56
  8. package/dist/collection/utils/locale.utils.js +14 -2
  9. package/dist/components/index.d.ts +5 -1
  10. package/dist/components/index.js +0 -1
  11. package/dist/components/lottery-bullet.js +6 -0
  12. package/dist/components/lottery-bullet2.js +56 -0
  13. package/dist/components/lottery-draw-results.js +73 -48
  14. package/dist/components/lottery-grid.js +6 -0
  15. package/dist/components/lottery-grid2.js +196 -0
  16. package/dist/esm/{index-17920f23.js → index-98326ddd.js} +81 -8
  17. package/dist/esm/loader.js +3 -3
  18. package/dist/esm/lottery-bullet_3.entry.js +377 -0
  19. package/dist/esm/lottery-draw-results.js +3 -3
  20. package/dist/lottery-draw-results/lottery-draw-results.esm.js +1 -1
  21. package/dist/lottery-draw-results/p-bb429486.js +1 -0
  22. package/dist/lottery-draw-results/p-d653e278.entry.js +1 -0
  23. package/dist/types/components/lottery-draw-results/lottery-draw-results.d.ts +28 -3
  24. package/dist/types/components.d.ts +56 -2
  25. package/package.json +1 -1
  26. package/dist/cjs/lottery-draw-results.cjs.entry.js +0 -179
  27. package/dist/esm/lottery-draw-results.entry.js +0 -175
  28. package/dist/lottery-draw-results/p-62092f31.js +0 -2
  29. package/dist/lottery-draw-results/p-c6628b24.entry.js +0 -1
@@ -1,179 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-03778cb9.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
- },
22
- ro: {
23
- drawResultsHeader: 'Ultimele rezultate extragere',
24
- drawId: 'Id extragere',
25
- drawName: 'Numele jocului',
26
- drawDate: 'Data extragerii',
27
- drawNumbersGridDraw: 'Numerele extrase Grid A',
28
- drawNumbersGridTicket: 'Numerele extrase Grid B',
29
- ticketResult: 'Rezultatul biletului',
30
- amountWon: 'Suma castigata',
31
- numberOfDraws: 'Numarul de extrageri'
32
- },
33
- };
34
- const translate = (key, customLang) => {
35
- const lang = customLang;
36
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
37
- };
38
-
39
- 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}";
40
-
41
- const DEFAULT_VALUES = {
42
- gamename: 'Chrono',
43
- gamedate: '24/09/2022',
44
- state: 'Processing',
45
- amount: 304444,
46
- ticketid: '6963444',
47
- selection: '[5, 6, 7, 8, 9]',
48
- multiplier: 4.5,
49
- resultstatus: 'Processing',
50
- drawstatus: 'Won',
51
- drawamount: 1022,
52
- drawid: '54545555',
53
- drawdate: '24/09/2032'
54
- };
55
- const LotteryDrawResults = class {
56
- constructor(hostRef) {
57
- index.registerInstance(this, hostRef);
58
- /**
59
- * Language of the widget
60
- */
61
- this.language = 'en';
62
- /**
63
- * Shows only the last draw
64
- */
65
- this.drawMode = false;
66
- this.gameName = '';
67
- this.multiplier = 5.434;
68
- this.ticketData = {};
69
- this.isLoading = true;
70
- this.drawResults = [];
71
- this.rules = {};
72
- this.toggleDrawer = [false];
73
- this.hasErrors = false;
74
- this.errorText = '';
75
- this.changeBox = (index) => {
76
- this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
77
- if (itemIndex == index) {
78
- return !item;
79
- }
80
- return item;
81
- });
82
- if (index >= this.toggleDrawer.length) {
83
- this.toggleDrawer.push(true);
84
- }
85
- };
86
- }
87
- connectedCallback() {
88
- let promises = [];
89
- promises.push(this.getGameData());
90
- if (this.playerId) {
91
- promises.push(this.getTicketData());
92
- }
93
- if (this.drawId) {
94
- promises.push(this.getDrawData());
95
- }
96
- Promise.all(promises)
97
- .then(() => {
98
- this.isLoading = false;
99
- });
100
- }
101
- getDrawData() {
102
- return new Promise((resolve, reject) => {
103
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
104
- fetch(url.href)
105
- .then((response) => {
106
- // @TODO EXCEPTIONS
107
- return response.json();
108
- })
109
- .then((data) => {
110
- this.drawData = data;
111
- resolve(true);
112
- })
113
- .catch((err) => {
114
- reject(err);
115
- });
116
- });
117
- }
118
- getGameData() {
119
- return new Promise((resolve, reject) => {
120
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
121
- fetch(url.href)
122
- .then((response) => {
123
- return response.json();
124
- })
125
- .then((data) => {
126
- this.rules = {
127
- maximumAllowed: data.rules.boards[0].maximumAllowed,
128
- totalNumbers: data.rules.boards[0].totalNumbers
129
- };
130
- resolve(true);
131
- })
132
- .catch((err) => {
133
- this.isLoading = false;
134
- this.hasErrors = true;
135
- this.errorText = err;
136
- reject(err);
137
- });
138
- });
139
- }
140
- getTicketData() {
141
- return new Promise((resolve, reject) => {
142
- let url = new URL(`${this.endpoint}/tickets/player/${this.playerId}`);
143
- fetch(url.href)
144
- .then((response) => {
145
- return response.json();
146
- })
147
- .then((data) => {
148
- this.ticketData = data.length === 0 ? DEFAULT_VALUES : data[1];
149
- this.drawResults = this.ticketData.drawResults.map((item) => item);
150
- this.selection = this.ticketData.selection[0].join(',');
151
- resolve(true);
152
- })
153
- .catch((err) => {
154
- reject(err);
155
- });
156
- });
157
- }
158
- render() {
159
- var _a, _b, _c, _d, _e, _f;
160
- if (this.isLoading) {
161
- return (index.h("p", null, "Loading, please wait ..."));
162
- }
163
- else if (this.hasErrors) {
164
- index.h("p", null, this.errorText);
165
- }
166
- else {
167
- return (index.h("section", { class: "DrawResultsSection" }, !this.drawMode ?
168
- 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" }, "Ticket Purchase Date: ", index.h("span", null, (_a = this.ticketData) === null || _a === void 0 ? void 0 : _a.createdAt.slice(0, 10))), index.h("div", { class: "TicketStatus" }, "Status: ", index.h("span", null, (_b = this.ticketData) === null || _b === void 0 ? void 0 : _b.state))), index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "TicketIdContainer" }, index.h("p", null, "Ticket id: ", index.h("span", null, (_c = this.ticketData) === null || _c === void 0 ? void 0 : _c.id))), index.h("div", { class: "TicketAmountContainer" }, index.h("p", null, "Ticket amount: ", index.h("span", null, (_d = this.ticketData) === null || _d === void 0 ? void 0 : _d.amount))), 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" }, "Multiplier: ", index.h("span", null, JSON.stringify((_e = this.ticketData) === null || _e === void 0 ? void 0 : _e.multiplier)))), index.h("div", { class: "NumberOfDrawsContainer" }, index.h("p", null, translate('numberOfDraws', this.language), ": ", (_f = this.ticketData) === null || _f === void 0 ? void 0 :
169
- _f.drawCount), 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' &&
170
- 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" }, "Multiplier: ", item.multiplier)))))))))
171
- :
172
- index.h("div", { class: "DrawResultsArea" }, this.drawData &&
173
- 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" }, "Multiplier: ", this.multiplier))))))));
174
- }
175
- }
176
- };
177
- LotteryDrawResults.style = lotteryDrawResultsCss;
178
-
179
- exports.lottery_draw_results = LotteryDrawResults;
@@ -1,175 +0,0 @@
1
- import { r as registerInstance, h } from './index-17920f23.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
- },
18
- ro: {
19
- drawResultsHeader: 'Ultimele rezultate extragere',
20
- drawId: 'Id extragere',
21
- drawName: 'Numele jocului',
22
- drawDate: 'Data extragerii',
23
- drawNumbersGridDraw: 'Numerele extrase Grid A',
24
- drawNumbersGridTicket: 'Numerele extrase Grid B',
25
- ticketResult: 'Rezultatul biletului',
26
- amountWon: 'Suma castigata',
27
- numberOfDraws: 'Numarul de extrageri'
28
- },
29
- };
30
- const translate = (key, customLang) => {
31
- const lang = customLang;
32
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
33
- };
34
-
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}";
36
-
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
- const LotteryDrawResults = class {
52
- constructor(hostRef) {
53
- registerInstance(this, hostRef);
54
- /**
55
- * Language of the widget
56
- */
57
- this.language = 'en';
58
- /**
59
- * Shows only the last draw
60
- */
61
- this.drawMode = false;
62
- this.gameName = '';
63
- this.multiplier = 5.434;
64
- this.ticketData = {};
65
- this.isLoading = true;
66
- this.drawResults = [];
67
- this.rules = {};
68
- this.toggleDrawer = [false];
69
- this.hasErrors = false;
70
- this.errorText = '';
71
- this.changeBox = (index) => {
72
- this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
73
- if (itemIndex == index) {
74
- return !item;
75
- }
76
- return item;
77
- });
78
- if (index >= this.toggleDrawer.length) {
79
- this.toggleDrawer.push(true);
80
- }
81
- };
82
- }
83
- connectedCallback() {
84
- let promises = [];
85
- promises.push(this.getGameData());
86
- if (this.playerId) {
87
- promises.push(this.getTicketData());
88
- }
89
- if (this.drawId) {
90
- promises.push(this.getDrawData());
91
- }
92
- Promise.all(promises)
93
- .then(() => {
94
- this.isLoading = false;
95
- });
96
- }
97
- getDrawData() {
98
- return new Promise((resolve, reject) => {
99
- let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
100
- fetch(url.href)
101
- .then((response) => {
102
- // @TODO EXCEPTIONS
103
- return response.json();
104
- })
105
- .then((data) => {
106
- this.drawData = data;
107
- resolve(true);
108
- })
109
- .catch((err) => {
110
- reject(err);
111
- });
112
- });
113
- }
114
- getGameData() {
115
- return new Promise((resolve, reject) => {
116
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
117
- fetch(url.href)
118
- .then((response) => {
119
- return response.json();
120
- })
121
- .then((data) => {
122
- this.rules = {
123
- maximumAllowed: data.rules.boards[0].maximumAllowed,
124
- totalNumbers: data.rules.boards[0].totalNumbers
125
- };
126
- resolve(true);
127
- })
128
- .catch((err) => {
129
- this.isLoading = false;
130
- this.hasErrors = true;
131
- this.errorText = err;
132
- reject(err);
133
- });
134
- });
135
- }
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
- render() {
155
- var _a, _b, _c, _d, _e, _f;
156
- if (this.isLoading) {
157
- return (h("p", null, "Loading, please wait ..."));
158
- }
159
- else if (this.hasErrors) {
160
- h("p", null, this.errorText);
161
- }
162
- else {
163
- 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)))))))))
167
- :
168
- 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))))))));
170
- }
171
- }
172
- };
173
- LotteryDrawResults.style = lotteryDrawResultsCss;
174
-
175
- export { LotteryDrawResults as lottery_draw_results };
@@ -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}