@everymatrix/lottery-game-page 0.1.26 → 1.0.69

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 (115) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/{helper-filters_2.cjs.entry.js → helper-accordion_13.cjs.entry.js} +13401 -9890
  3. package/dist/cjs/helper-pagination.cjs.entry.js +197 -189
  4. package/dist/cjs/index-f3851683.js +1345 -0
  5. package/dist/cjs/loader.cjs.js +7 -13
  6. package/dist/cjs/lottery-game-page.cjs.js +17 -11
  7. package/dist/collection/collection-manifest.json +4 -10
  8. package/dist/collection/components/lottery-game-page/index.js +1 -0
  9. package/dist/collection/components/lottery-game-page/lottery-game-page.css +11 -2
  10. package/dist/collection/components/lottery-game-page/lottery-game-page.js +579 -594
  11. package/dist/collection/utils/locale.utils.js +118 -95
  12. package/dist/collection/utils/utils.js +4 -4
  13. package/dist/esm/app-globals-0f993ce5.js +3 -0
  14. package/dist/esm/{helper-filters_2.entry.js → helper-accordion_13.entry.js} +13391 -9891
  15. package/dist/esm/helper-pagination.entry.js +197 -189
  16. package/dist/esm/index-8248702b.js +1316 -0
  17. package/dist/esm/loader.js +7 -13
  18. package/dist/esm/lottery-game-page.js +14 -11
  19. package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
  20. package/dist/lottery-game-page/p-46aaa562.entry.js +1 -0
  21. package/dist/lottery-game-page/p-8f2c63c7.js +2 -0
  22. package/dist/lottery-game-page/p-bd89bbf0.entry.js +3567 -0
  23. package/dist/lottery-game-page/p-e1255160.js +1 -0
  24. package/dist/stencil.config.dev.js +17 -0
  25. package/dist/stencil.config.js +12 -36
  26. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-game-page/.stencil/packages/stencil/lottery-game-page/stencil.config.d.ts +2 -0
  27. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-game-page/.stencil/packages/stencil/lottery-game-page/stencil.config.dev.d.ts +2 -0
  28. package/dist/types/components/lottery-game-page/index.d.ts +1 -0
  29. package/dist/types/components/lottery-game-page/lottery-game-page.d.ts +99 -90
  30. package/dist/types/components.d.ts +28 -2
  31. package/dist/types/stencil-public-runtime.d.ts +142 -33
  32. package/loader/cdn.js +1 -3
  33. package/loader/index.cjs.js +1 -3
  34. package/loader/index.d.ts +13 -1
  35. package/loader/index.es2017.js +1 -3
  36. package/loader/index.js +1 -3
  37. package/loader/package.json +1 -0
  38. package/package.json +13 -7
  39. package/dist/cjs/helper-accordion.cjs.entry.js +0 -124
  40. package/dist/cjs/helper-modal.cjs.entry.js +0 -76
  41. package/dist/cjs/helper-tab.cjs.entry.js +0 -68
  42. package/dist/cjs/helper-tabs.cjs.entry.js +0 -74
  43. package/dist/cjs/index-cd44e726.js +0 -1324
  44. package/dist/cjs/lottery-bullet_2.cjs.entry.js +0 -270
  45. package/dist/cjs/lottery-draw-results-history.cjs.entry.js +0 -198
  46. package/dist/cjs/lottery-game-details.cjs.entry.js +0 -51
  47. package/dist/cjs/lottery-game-page.cjs.entry.js +0 -427
  48. package/dist/cjs/lottery-ticket-controller.cjs.entry.js +0 -116
  49. package/dist/cjs/lottery-ticket.cjs.entry.js +0 -201
  50. package/dist/collection/components/lottery-game-page/static/chrono_desktop.png +0 -0
  51. package/dist/collection/components/lottery-game-page/static/chrono_lottery_mobile.png +0 -0
  52. package/dist/components/assets/chrono_desktop.png +0 -0
  53. package/dist/components/assets/chrono_lottery_mobile.png +0 -0
  54. package/dist/components/helper-accordion.js +0 -6
  55. package/dist/components/helper-accordion2.js +0 -151
  56. package/dist/components/helper-filters.js +0 -6
  57. package/dist/components/helper-filters2.js +0 -22394
  58. package/dist/components/helper-modal.js +0 -6
  59. package/dist/components/helper-modal2.js +0 -94
  60. package/dist/components/helper-pagination.js +0 -251
  61. package/dist/components/helper-tab.js +0 -6
  62. package/dist/components/helper-tab2.js +0 -87
  63. package/dist/components/helper-tabs.js +0 -6
  64. package/dist/components/helper-tabs2.js +0 -103
  65. package/dist/components/index.d.ts +0 -26
  66. package/dist/components/index.js +0 -1
  67. package/dist/components/lottery-bullet.js +0 -6
  68. package/dist/components/lottery-bullet2.js +0 -92
  69. package/dist/components/lottery-draw-results-history.js +0 -6
  70. package/dist/components/lottery-draw-results-history2.js +0 -256
  71. package/dist/components/lottery-draw-results.js +0 -6
  72. package/dist/components/lottery-draw-results2.js +0 -335
  73. package/dist/components/lottery-game-details.js +0 -6
  74. package/dist/components/lottery-game-details2.js +0 -85
  75. package/dist/components/lottery-game-page.d.ts +0 -11
  76. package/dist/components/lottery-game-page.js +0 -542
  77. package/dist/components/lottery-grid.js +0 -6
  78. package/dist/components/lottery-grid2.js +0 -237
  79. package/dist/components/lottery-ticket-controller.js +0 -6
  80. package/dist/components/lottery-ticket-controller2.js +0 -168
  81. package/dist/components/lottery-ticket.js +0 -6
  82. package/dist/components/lottery-ticket2.js +0 -244
  83. package/dist/esm/helper-accordion.entry.js +0 -120
  84. package/dist/esm/helper-modal.entry.js +0 -72
  85. package/dist/esm/helper-tab.entry.js +0 -64
  86. package/dist/esm/helper-tabs.entry.js +0 -70
  87. package/dist/esm/index-d1baacd4.js +0 -1296
  88. package/dist/esm/lottery-bullet_2.entry.js +0 -265
  89. package/dist/esm/lottery-draw-results-history.entry.js +0 -194
  90. package/dist/esm/lottery-game-details.entry.js +0 -47
  91. package/dist/esm/lottery-game-page.entry.js +0 -423
  92. package/dist/esm/lottery-ticket-controller.entry.js +0 -112
  93. package/dist/esm/lottery-ticket.entry.js +0 -197
  94. package/dist/esm/polyfills/core-js.js +0 -11
  95. package/dist/esm/polyfills/css-shim.js +0 -1
  96. package/dist/esm/polyfills/dom.js +0 -79
  97. package/dist/esm/polyfills/es5-html-element.js +0 -1
  98. package/dist/esm/polyfills/index.js +0 -34
  99. package/dist/esm/polyfills/system.js +0 -6
  100. package/dist/lottery-game-page/p-023325a2.entry.js +0 -1
  101. package/dist/lottery-game-page/p-04fbc8fd.entry.js +0 -1
  102. package/dist/lottery-game-page/p-256b151c.entry.js +0 -1
  103. package/dist/lottery-game-page/p-381b5507.entry.js +0 -1
  104. package/dist/lottery-game-page/p-3f8b6ad9.entry.js +0 -1
  105. package/dist/lottery-game-page/p-4274053c.entry.js +0 -1
  106. package/dist/lottery-game-page/p-4f81cd37.entry.js +0 -1
  107. package/dist/lottery-game-page/p-5c389034.entry.js +0 -1
  108. package/dist/lottery-game-page/p-7d06371e.entry.js +0 -1
  109. package/dist/lottery-game-page/p-ca8430a0.entry.js +0 -2849
  110. package/dist/lottery-game-page/p-d6f76e8d.entry.js +0 -1
  111. package/dist/lottery-game-page/p-e765c7d9.js +0 -1
  112. package/dist/lottery-game-page/p-f6fcc22c.entry.js +0 -1
  113. package/dist/lottery-game-page/static/chrono_desktop.png +0 -0
  114. package/dist/lottery-game-page/static/chrono_lottery_mobile.png +0 -0
  115. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-game-page/.stencil/packages/lottery-game-page/stencil.config.d.ts +0 -2
@@ -1,237 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { d as defineCustomElement$1 } from './lottery-bullet2.js';
3
-
4
- const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.Grid.TicketGrid{gap:5px}";
5
-
6
- const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
- constructor() {
8
- super();
9
- this.__registerHost();
10
- this.__attachShadow();
11
- this.gridFilledEvent = createEvent(this, "gridFilled", 7);
12
- this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
13
- /**
14
- * Number of bullets of grid
15
- */
16
- this.totalNumbers = 0;
17
- /**
18
- * Number of maximum bullets that can be selected
19
- */
20
- this.maximumAllowed = 0;
21
- /**
22
- * Minimum allowed of bullets
23
- */
24
- this.minimumAllowed = 1;
25
- /**
26
- * Allows the user to select numbers on the grid
27
- */
28
- this.selectable = true;
29
- /**
30
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
31
- */
32
- this.selectedNumbers = '';
33
- /**
34
- * Show only selected numbers
35
- */
36
- this.displaySelected = false;
37
- /**
38
- * Language
39
- */
40
- this.language = 'en';
41
- /**
42
- * Personalize grid for ticket
43
- */
44
- this.gridType = '';
45
- /**
46
- * Client custom styling via string
47
- */
48
- this.clientStyling = '';
49
- /**
50
- * Client custom styling via url content
51
- */
52
- this.clientStylingUrlContent = '';
53
- this.numbers = [];
54
- this.limitStylingAppends = false;
55
- this.selectedCounter = 0;
56
- this.setClientStyling = () => {
57
- let sheet = document.createElement('style');
58
- sheet.innerHTML = this.clientStyling;
59
- this.stylingContainer.prepend(sheet);
60
- };
61
- this.setClientStylingURL = () => {
62
- let cssFile = document.createElement('style');
63
- setTimeout(() => {
64
- cssFile.innerHTML = this.clientStylingUrlContent;
65
- this.stylingContainer.prepend(cssFile);
66
- }, 1);
67
- };
68
- }
69
- connectedCallback() {
70
- let selected = [];
71
- if (this.selectedNumbers.length > 0) {
72
- selected = this.selectedNumbers.split(',');
73
- this.selectedCounter = selected.length;
74
- }
75
- if (this.displaySelected) {
76
- selected.forEach((item) => {
77
- this.numbers.push({
78
- number: item,
79
- selected: true,
80
- selectable: this.selectable
81
- });
82
- });
83
- }
84
- else {
85
- [...Array(this.totalNumbers).keys()]
86
- .map(number => (number + 1).toString())
87
- .forEach((number) => {
88
- this.numbers.push({
89
- number,
90
- selected: selected.indexOf(number) >= 0 ? true : false,
91
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
92
- });
93
- });
94
- }
95
- }
96
- componentDidRender() {
97
- // start custom styling area
98
- if (!this.limitStylingAppends && this.stylingContainer) {
99
- if (this.clientStyling)
100
- this.setClientStyling();
101
- if (this.clientStylingUrlContent)
102
- this.setClientStylingURL();
103
- this.limitStylingAppends = true;
104
- }
105
- // end custom styling area
106
- }
107
- lotteryBulletSelectionHandler(event) {
108
- this.numbers = this.numbers.map((item) => {
109
- if (item.number == event.detail.value) {
110
- return {
111
- number: item.number,
112
- selected: event.detail.selected,
113
- selectable: item.selectable
114
- };
115
- }
116
- return {
117
- number: item.number,
118
- selected: item.selected,
119
- selectable: item.selectable
120
- };
121
- });
122
- if (event.detail.selected) {
123
- this.selectedCounter += 1;
124
- if (this.selectedCounter == this.maximumAllowed) {
125
- this.numbers = this.numbers.map((item) => {
126
- return {
127
- number: item.number,
128
- selected: item.selected,
129
- selectable: item.selected ? true : false
130
- };
131
- });
132
- this.gridFilledEvent.emit({
133
- id: this.ticketId,
134
- index: this.gridIndex,
135
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
136
- });
137
- }
138
- }
139
- else {
140
- if (this.selectedCounter == this.maximumAllowed) {
141
- this.numbers = this.numbers.map((item) => {
142
- return {
143
- number: item.number,
144
- selected: item.selected,
145
- selectable: true
146
- };
147
- });
148
- this.gridDirtyEvent.emit({
149
- id: this.ticketId,
150
- index: this.gridIndex,
151
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
152
- });
153
- }
154
- this.selectedCounter -= 1;
155
- }
156
- }
157
- async resetSelectionHandler(event) {
158
- if (event.detail && event.detail == this.ticketId) {
159
- this.selectedCounter = 0;
160
- this.numbers = this.numbers.map((item) => {
161
- return {
162
- number: item.number,
163
- selected: false,
164
- selectable: this.selectable
165
- };
166
- });
167
- this.gridDirtyEvent.emit({
168
- id: this.ticketId,
169
- index: this.gridIndex,
170
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
171
- });
172
- }
173
- }
174
- async autoSelectionHandler(event) {
175
- if (event.detail && event.detail == this.ticketId) {
176
- this.resetSelectionHandler(event);
177
- let array = [...Array(this.totalNumbers).keys()]
178
- .map(number => number + 1)
179
- .sort(() => 0.5 - Math.random());
180
- array = array.slice(0, this.minimumAllowed);
181
- this.numbers = this.numbers.map((item) => {
182
- return {
183
- number: item.number,
184
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
185
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
186
- };
187
- });
188
- this.gridFilledEvent.emit({
189
- id: this.ticketId,
190
- index: this.gridIndex,
191
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
192
- });
193
- this.selectedCounter = this.maximumAllowed;
194
- }
195
- }
196
- render() {
197
- return (h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
198
- }
199
- static get style() { return lotteryGridCss; }
200
- }, [1, "lottery-grid", {
201
- "ticketId": [2, "ticket-id"],
202
- "totalNumbers": [2, "total-numbers"],
203
- "gameId": [1, "game-id"],
204
- "maximumAllowed": [2, "maximum-allowed"],
205
- "minimumAllowed": [2, "minimum-allowed"],
206
- "selectable": [4],
207
- "selectedNumbers": [1, "selected-numbers"],
208
- "displaySelected": [4, "display-selected"],
209
- "language": [1],
210
- "gridIndex": [2, "grid-index"],
211
- "gridType": [1, "grid-type"],
212
- "clientStyling": [1, "client-styling"],
213
- "clientStylingUrlContent": [1, "client-styling-url-content"],
214
- "numbers": [32],
215
- "limitStylingAppends": [32]
216
- }, [[0, "lotteryBulletSelection", "lotteryBulletSelectionHandler"], [4, "resetSelection", "resetSelectionHandler"], [4, "autoSelection", "autoSelectionHandler"]]]);
217
- function defineCustomElement() {
218
- if (typeof customElements === "undefined") {
219
- return;
220
- }
221
- const components = ["lottery-grid", "lottery-bullet"];
222
- components.forEach(tagName => { switch (tagName) {
223
- case "lottery-grid":
224
- if (!customElements.get(tagName)) {
225
- customElements.define(tagName, LotteryGrid);
226
- }
227
- break;
228
- case "lottery-bullet":
229
- if (!customElements.get(tagName)) {
230
- defineCustomElement$1();
231
- }
232
- break;
233
- } });
234
- }
235
- defineCustomElement();
236
-
237
- export { LotteryGrid as L, defineCustomElement as d };
@@ -1,6 +0,0 @@
1
- import { L as LotteryTicketController$1, d as defineCustomElement$1 } from './lottery-ticket-controller2.js';
2
-
3
- const LotteryTicketController = LotteryTicketController$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { LotteryTicketController, defineCustomElement };
@@ -1,168 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { d as defineCustomElement$4 } from './helper-accordion2.js';
3
- import { d as defineCustomElement$3 } from './lottery-bullet2.js';
4
- import { d as defineCustomElement$2 } from './lottery-grid2.js';
5
- import { d as defineCustomElement$1 } from './lottery-ticket2.js';
6
-
7
- const DEFAULT_LANGUAGE = 'en';
8
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
9
- const TRANSLATIONS = {
10
- en: {
11
- ticket: 'Ticket',
12
- },
13
- ro: {
14
- ticket: 'Bilet',
15
- },
16
- };
17
- const translate = (key, customLang) => {
18
- const lang = customLang;
19
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
20
- };
21
-
22
- const lotteryTicketControllerCss = ":host{display:block}";
23
-
24
- const LotteryTicketController = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
25
- constructor() {
26
- super();
27
- this.__registerHost();
28
- this.__attachShadow();
29
- this.deleteTicketEvent = createEvent(this, "deleteTicket", 7);
30
- /**
31
- * Endpoint URL for the source of data (NorWAy standard)
32
- */
33
- this.endpoint = '';
34
- /**
35
- * Ticket number
36
- */
37
- this.ticketId = 1;
38
- /**
39
- * Activates postMessages as events for actions from the widget
40
- */
41
- this.postMessage = false;
42
- /**
43
- * Name of the event emitter by the action button
44
- */
45
- this.eventName = 'deleteTicketAction';
46
- /**
47
- * Collapsed
48
- */
49
- this.collapsed = true;
50
- /**
51
- * Number of grids?
52
- */
53
- this.numberOfGrids = 1;
54
- /**
55
- * This toggles if the last ticket added should be expanded or not
56
- */
57
- this.last = false;
58
- /**
59
- * Language
60
- */
61
- this.language = 'en';
62
- /**
63
- * Shows the auto-pick button
64
- */
65
- this.autoPick = false;
66
- /**
67
- * Shows the reset button
68
- */
69
- this.resetButton = false;
70
- /**
71
- * Client custom styling via string
72
- */
73
- this.clientStyling = '';
74
- /**
75
- * Client custom styling via url content
76
- */
77
- this.clientStylingUrlContent = '';
78
- this.limitStylingAppends = false;
79
- this.setClientStyling = () => {
80
- let sheet = document.createElement('style');
81
- sheet.innerHTML = this.clientStyling;
82
- this.stylingContainer.prepend(sheet);
83
- };
84
- this.setClientStylingURL = () => {
85
- let cssFile = document.createElement('style');
86
- setTimeout(() => {
87
- cssFile.innerHTML = this.clientStylingUrlContent;
88
- this.stylingContainer.prepend(cssFile);
89
- }, 1);
90
- };
91
- }
92
- // @TODO fix the `any` type
93
- helperAccordionActionHandler() {
94
- if (this.postMessage) {
95
- window.postMessage({ type: this.eventName }, window.location.href);
96
- }
97
- this.deleteTicketEvent.emit({
98
- ticketId: this.ticketId
99
- });
100
- }
101
- componentDidRender() {
102
- // start custom styling area
103
- if (!this.limitStylingAppends && this.stylingContainer) {
104
- if (this.clientStyling)
105
- this.setClientStyling();
106
- if (this.clientStylingUrlContent)
107
- this.setClientStylingURL();
108
- this.limitStylingAppends = true;
109
- }
110
- // end custom styling area
111
- }
112
- render() {
113
- return (h("div", { class: "LotteryTicketControllerContainer", ref: el => this.stylingContainer = el }, h("helper-accordion", { "header-title": `${translate('ticket', this.language)} ${this.ticketId}`, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, h("div", { slot: "accordionContent" }, h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })))));
114
- }
115
- static get style() { return lotteryTicketControllerCss; }
116
- }, [1, "lottery-ticket-controller", {
117
- "endpoint": [1],
118
- "ticketId": [2, "ticket-id"],
119
- "ticketDescription": [1, "ticket-description"],
120
- "gameId": [1, "game-id"],
121
- "postMessage": [4, "post-message"],
122
- "eventName": [1, "event-name"],
123
- "collapsed": [4],
124
- "numberOfGrids": [2, "number-of-grids"],
125
- "last": [4],
126
- "language": [1],
127
- "autoPick": [4, "auto-pick"],
128
- "resetButton": [4, "reset-button"],
129
- "clientStyling": [1, "client-styling"],
130
- "clientStylingUrlContent": [1, "client-styling-url-content"],
131
- "limitStylingAppends": [32]
132
- }, [[0, "helperAccordionAction", "helperAccordionActionHandler"]]]);
133
- function defineCustomElement() {
134
- if (typeof customElements === "undefined") {
135
- return;
136
- }
137
- const components = ["lottery-ticket-controller", "helper-accordion", "lottery-bullet", "lottery-grid", "lottery-ticket"];
138
- components.forEach(tagName => { switch (tagName) {
139
- case "lottery-ticket-controller":
140
- if (!customElements.get(tagName)) {
141
- customElements.define(tagName, LotteryTicketController);
142
- }
143
- break;
144
- case "helper-accordion":
145
- if (!customElements.get(tagName)) {
146
- defineCustomElement$4();
147
- }
148
- break;
149
- case "lottery-bullet":
150
- if (!customElements.get(tagName)) {
151
- defineCustomElement$3();
152
- }
153
- break;
154
- case "lottery-grid":
155
- if (!customElements.get(tagName)) {
156
- defineCustomElement$2();
157
- }
158
- break;
159
- case "lottery-ticket":
160
- if (!customElements.get(tagName)) {
161
- defineCustomElement$1();
162
- }
163
- break;
164
- } });
165
- }
166
- defineCustomElement();
167
-
168
- export { LotteryTicketController as L, defineCustomElement as d };
@@ -1,6 +0,0 @@
1
- import { L as LotteryTicket$1, d as defineCustomElement$1 } from './lottery-ticket2.js';
2
-
3
- const LotteryTicket = LotteryTicket$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { LotteryTicket, defineCustomElement };
@@ -1,244 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { d as defineCustomElement$2 } from './lottery-bullet2.js';
3
- import { d as defineCustomElement$1 } from './lottery-grid2.js';
4
-
5
- const DEFAULT_LANGUAGE = 'en';
6
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
7
- const TRANSLATIONS = {
8
- en: {
9
- loading: 'Loading, please wait ...',
10
- error: 'It was an error while trying to fetch the data',
11
- grid: 'Grid',
12
- multiplier: 'Multiplier',
13
- numberOfDraws: 'Number of draws',
14
- wagerPerDraw: 'Wager per draw',
15
- resetButton: 'Reset',
16
- autoButton: 'I feel lucky'
17
- },
18
- ro: {
19
- loading: 'Se incarca, va rugam asteptati ...',
20
- error: 'A fost o eroare in timp ce asteptam datele',
21
- grid: 'Grid',
22
- multiplier: 'Multiplicator',
23
- numberOfDraws: 'Numarul de extrageri',
24
- wagerPerDraw: 'Pariul per extragere',
25
- resetButton: 'Reseteaza',
26
- autoButton: 'Ma simt norocos'
27
- },
28
- };
29
- const translate = (key, customLang) => {
30
- const lang = customLang;
31
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
32
- };
33
-
34
- const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketTitle{font-size:16px;font-weight:bold}.ButtonContainer{display:flex;justify-content:flex-end}.Toggle{cursor:pointer;margin-top:20px;display:inline-block}.ToggleSwitch{display:inline-block;background:#707070;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%, #F1F1F1 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:#00ABA4}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px;font-size:14px;font-weight:lighter;color:#000}input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.NumberInput,.WagerInput{margin-top:10px;display:inline-flex;align-items:center}.NumberInput,.NumberInput *{box-sizing:border-box}.NumberInput button{cursor:pointer;outline:none;-webkit-appearance:none;border:none;align-items:center;justify-content:center;height:20px;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);align-items:center;text-align:center}.NumberInput button.Plus:after{transform:translate(-50%, -50%) rotate(0deg);width:30px;display:inline-flex;align-items:center;text-align:center}.NumberInput input[type=number],.WagerInput input[type=number]{max-width:50px;display:inline-flex;align-items:center;padding:4px 10px;text-align:center}.NumberInput input[type=number] .WagerInputTitle,.WagerInput input[type=number] .WagerInputTitle{font-size:14px;color:#000;padding:10px}.InputDefault{background-color:#F1F1F1;border-radius:4px;padding:5px;border:solid 1px #D4D4D4;color:#707070}.AutoButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.AutoButton:active{background:#00958f;color:#FFF}.ResetButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ResetButton:hover{background:#FF6536;border:1px solid #FF3D00}.TicketGridBullets{background:#f1f1f1;border-radius:4px;padding:20px;margin-top:5px}.TicketGridBullets .TicketGridTitle{margin-top:0px}.Minus{border-radius:4px;width:30px;height:24px !important;margin-right:10px;color:#FFF;background:#009993}.Plus{border-radius:4px;width:30px;height:24px !important;margin-left:10px;color:#FFF;background:#009993}.SelectWrapper{width:auto;padding:5px;margin:0 auto;border:1px solid #ccc;border-radius:5px;position:relative}.SelectButton,.SelectOptions li{display:flex;align-items:center;cursor:pointer}.SelectButton{display:flex;padding:0 5px;border-radius:7px;align-items:center;justify-content:space-between;font-size:14px}.SelectButton span:first-child{padding-right:10px}.SelectExpand{transition:transform 0.3s linear;font-size:12px}.SelectActive .SelectExpand{transform:rotate(180deg)}.SelectContent{display:none;padding:5px;border-radius:7px}.SelectWrapper.SelectActive .SelectContent{width:100%;display:block;position:absolute;left:0;top:32px;padding:0;border:1px solid #ccc;overflow:hidden;background:#fff}.SelectContent .SelectOptions{max-height:100px;margin:0;overflow-y:auto;padding:0}.SelectContent .SelectOptions .SelectedValue{background-color:#009993;color:#fff}.SelectOptions::-webkit-scrollbar{width:7px}.SelectOptions::-webkit-scrollbar-track{background:#f1f1f1;border-radius:25px}.SelectOptions::-webkit-scrollbar-thumb{background:#ccc;border-radius:25px}.SelectOptions li{height:20px;padding:0 13px;font-size:14px}.SelectOptions li:hover{background:#f2f2f2}";
35
-
36
- const LotteryTicket = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
37
- constructor() {
38
- super();
39
- this.__registerHost();
40
- this.__attachShadow();
41
- this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
42
- this.autoSelection = createEvent(this, "autoSelection", 7);
43
- this.resetSelection = createEvent(this, "resetSelection", 7);
44
- this.stakeChange = createEvent(this, "stakeChange", 7);
45
- this.multiplierChange = createEvent(this, "multiplierChange", 7);
46
- /**
47
- * Number of grids of a ticket
48
- */
49
- this.numberOfGrids = 1;
50
- /**
51
- * Option to have the ticket registered for multiple draws
52
- */
53
- this.multipleDraws = true;
54
- /**
55
- * Shows the reset button
56
- */
57
- this.resetButton = false;
58
- /**
59
- * Shows the auto-pick button
60
- */
61
- this.autoPick = false;
62
- /**
63
- * Language
64
- */
65
- this.language = 'en';
66
- /**
67
- * Client custom styling via string
68
- */
69
- this.clientStyling = '';
70
- /**
71
- * Client custom styling via url content
72
- */
73
- this.clientStylingUrlContent = '';
74
- this.multiplier = false;
75
- this.numberOfDraws = 1;
76
- this.isLoading = true;
77
- this.hasErrors = false;
78
- this.ticketDone = false;
79
- this.isCustomSelect = false;
80
- this.amountInfo = {};
81
- this.limitStylingAppends = false;
82
- this.setClientStyling = () => {
83
- let sheet = document.createElement('style');
84
- sheet.innerHTML = this.clientStyling;
85
- this.stylingContainer.prepend(sheet);
86
- };
87
- this.setClientStylingURL = () => {
88
- let cssFile = document.createElement('style');
89
- setTimeout(() => {
90
- cssFile.innerHTML = this.clientStylingUrlContent;
91
- this.stylingContainer.prepend(cssFile);
92
- }, 1);
93
- };
94
- }
95
- /**
96
- * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
97
- */
98
- checkForClickOutside(ev) {
99
- if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
100
- this.isCustomSelect = false;
101
- }
102
- }
103
- connectedCallback() {
104
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
105
- fetch(url.href)
106
- .then((response) => {
107
- if (response.ok) {
108
- return response.json();
109
- }
110
- else {
111
- // Throw error
112
- this.hasErrors = true;
113
- }
114
- })
115
- .then((data) => {
116
- this.isLoading = false;
117
- this.gameData = data;
118
- this.grids = [...Array(data.rules.boards.length).keys()];
119
- this.amountInfo = this.gameData.rules.stakes[0]; // initial value for select
120
- })
121
- .catch((err) => {
122
- this.isLoading = false;
123
- this.hasErrors = true;
124
- console.error('Error!', err);
125
- });
126
- }
127
- componentDidRender() {
128
- // start custom styling area
129
- if (!this.limitStylingAppends && this.stylingContainer) {
130
- if (this.clientStyling)
131
- this.setClientStyling();
132
- if (this.clientStylingUrlContent)
133
- this.setClientStylingURL();
134
- this.limitStylingAppends = true;
135
- }
136
- // end custom styling area
137
- }
138
- multiplierChangeHandler(e) {
139
- this.multiplier = e.target ? e.target.checked : false;
140
- this.multiplierChange.emit(this.multiplier);
141
- }
142
- drawsChangeHandler(event) {
143
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
144
- this.ticketCompleted.emit(this.ticket);
145
- }
146
- gridFilledHandler(event) {
147
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
148
- this.ticketDone = true;
149
- this.ticketCompleted.emit(this.ticket);
150
- }
151
- toggleAutoSelection() {
152
- this.ticketDone = true;
153
- this.autoSelection.emit(this.ticketId);
154
- }
155
- toggleResetSelection() {
156
- this.ticketDone = false;
157
- this.resetSelection.emit(this.ticketId);
158
- }
159
- changeStake(ticketid, amount) {
160
- this.stakeChange.emit({
161
- ticketId: ticketid,
162
- stake: amount
163
- });
164
- }
165
- toggleClass() {
166
- this.isCustomSelect = !this.isCustomSelect;
167
- }
168
- setDropdownItem(item) {
169
- this.amountInfo = {
170
- amount: item.amount,
171
- currency: item.currency
172
- };
173
- this.isCustomSelect = false;
174
- this.changeStake(this.ticketId, item.amount);
175
- }
176
- render() {
177
- if (this.isLoading) {
178
- return (h("div", null, h("p", null, translate('loading', this.language))));
179
- }
180
- else {
181
- if (this.hasErrors) {
182
- return (h("div", null, h("p", null, translate('error', this.language))));
183
- }
184
- else {
185
- const { rules } = this.gameData;
186
- return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
187
- h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
188
- h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), rules.multiplier &&
189
- h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
190
- h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h("div", { class: "NumberInput" }, h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h("div", null, h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
191
- (h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.amount, " ", this.amountInfo.currency), h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, rules.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.amount == item.amount ? 'SelectedValue' : '', value: item.amount, onClick: () => this.setDropdownItem(item) }, item.amount, " ", item.currency)))))) : (h("div", null, h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))))));
192
- }
193
- }
194
- }
195
- static get watchers() { return {
196
- "numberOfDraws": ["drawsChangeHandler"]
197
- }; }
198
- static get style() { return lotteryTicketCss; }
199
- }, [1, "lottery-ticket", {
200
- "endpoint": [1],
201
- "gameId": [1, "game-id"],
202
- "numberOfGrids": [2, "number-of-grids"],
203
- "multipleDraws": [4, "multiple-draws"],
204
- "ticketId": [2, "ticket-id"],
205
- "resetButton": [4, "reset-button"],
206
- "autoPick": [4, "auto-pick"],
207
- "language": [1],
208
- "clientStyling": [1, "client-styling"],
209
- "clientStylingUrlContent": [1, "client-styling-url-content"],
210
- "multiplier": [32],
211
- "numberOfDraws": [32],
212
- "isLoading": [32],
213
- "hasErrors": [32],
214
- "ticketDone": [32],
215
- "isCustomSelect": [32],
216
- "amountInfo": [32],
217
- "limitStylingAppends": [32]
218
- }, [[8, "click", "checkForClickOutside"], [0, "gridFilled", "gridFilledHandler"]]]);
219
- function defineCustomElement() {
220
- if (typeof customElements === "undefined") {
221
- return;
222
- }
223
- const components = ["lottery-ticket", "lottery-bullet", "lottery-grid"];
224
- components.forEach(tagName => { switch (tagName) {
225
- case "lottery-ticket":
226
- if (!customElements.get(tagName)) {
227
- customElements.define(tagName, LotteryTicket);
228
- }
229
- break;
230
- case "lottery-bullet":
231
- if (!customElements.get(tagName)) {
232
- defineCustomElement$2();
233
- }
234
- break;
235
- case "lottery-grid":
236
- if (!customElements.get(tagName)) {
237
- defineCustomElement$1();
238
- }
239
- break;
240
- } });
241
- }
242
- defineCustomElement();
243
-
244
- export { LotteryTicket as L, defineCustomElement as d };