@everymatrix/lottery-ticket 0.1.24 → 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 (53) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-f01e4770.js +1303 -0
  3. package/dist/cjs/loader.cjs.js +7 -13
  4. package/dist/cjs/lottery-bullet_3.cjs.entry.js +402 -440
  5. package/dist/cjs/lottery-ticket.cjs.js +17 -11
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/lottery-ticket/index.js +1 -0
  8. package/dist/collection/components/lottery-ticket/lottery-ticket.js +435 -485
  9. package/dist/collection/utils/locale.utils.js +53 -43
  10. package/dist/esm/app-globals-0f993ce5.js +3 -0
  11. package/dist/esm/index-cde6554c.js +1276 -0
  12. package/dist/esm/loader.js +7 -13
  13. package/dist/esm/lottery-bullet_3.entry.js +402 -440
  14. package/dist/esm/lottery-ticket.js +14 -11
  15. package/dist/lottery-ticket/lottery-ticket.esm.js +1 -1
  16. package/dist/lottery-ticket/p-174b5b05.entry.js +1 -0
  17. package/dist/lottery-ticket/p-73c1e1fd.js +2 -0
  18. package/dist/lottery-ticket/p-e1255160.js +1 -0
  19. package/dist/stencil.config.dev.js +17 -0
  20. package/dist/stencil.config.js +14 -19
  21. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.d.ts +2 -0
  22. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.dev.d.ts +2 -0
  23. package/dist/types/components/lottery-ticket/index.d.ts +1 -0
  24. package/dist/types/components/lottery-ticket/lottery-ticket.d.ts +78 -78
  25. package/dist/types/components/lottery-ticket/lottery-ticket.types.d.ts +31 -31
  26. package/dist/types/components.d.ts +24 -5
  27. package/dist/types/stencil-public-runtime.d.ts +142 -33
  28. package/loader/cdn.js +1 -3
  29. package/loader/index.cjs.js +1 -3
  30. package/loader/index.d.ts +13 -1
  31. package/loader/index.es2017.js +1 -3
  32. package/loader/index.js +1 -3
  33. package/loader/package.json +1 -0
  34. package/package.json +10 -3
  35. package/dist/cjs/index-6033a99f.js +0 -1272
  36. package/dist/components/index.d.ts +0 -26
  37. package/dist/components/index.js +0 -1
  38. package/dist/components/lottery-bullet.js +0 -6
  39. package/dist/components/lottery-bullet2.js +0 -91
  40. package/dist/components/lottery-grid.js +0 -6
  41. package/dist/components/lottery-grid2.js +0 -236
  42. package/dist/components/lottery-ticket.d.ts +0 -11
  43. package/dist/components/lottery-ticket.js +0 -266
  44. package/dist/esm/index-7790b5a7.js +0 -1246
  45. package/dist/esm/polyfills/core-js.js +0 -11
  46. package/dist/esm/polyfills/css-shim.js +0 -1
  47. package/dist/esm/polyfills/dom.js +0 -79
  48. package/dist/esm/polyfills/es5-html-element.js +0 -1
  49. package/dist/esm/polyfills/index.js +0 -34
  50. package/dist/esm/polyfills/system.js +0 -6
  51. package/dist/lottery-ticket/p-4e7976c5.entry.js +0 -1
  52. package/dist/lottery-ticket/p-913d0cce.js +0 -1
  53. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/widgets-stencil/packages/lottery-ticket/.stencil/packages/lottery-ticket/stencil.config.d.ts +0 -2
@@ -1,26 +0,0 @@
1
- /* LotteryTicket custom elements */
2
-
3
- import type { Components, JSX } from "../types/components";
4
-
5
- /**
6
- * Used to manually set the base path where assets can be found.
7
- * If the script is used as "module", it's recommended to use "import.meta.url",
8
- * such as "setAssetPath(import.meta.url)". Other options include
9
- * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
10
- * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
11
- * But do note that this configuration depends on how your script is bundled, or lack of
12
- * bundling, and where your assets can be loaded from. Additionally custom bundling
13
- * will have to ensure the static assets are copied to its build directory.
14
- */
15
- export declare const setAssetPath: (path: string) => void;
16
-
17
- export interface SetPlatformOptions {
18
- raf?: (c: FrameRequestCallback) => number;
19
- ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
20
- rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
21
- }
22
- export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
23
-
24
- export type { Components, JSX };
25
-
26
- export * from '../types';
@@ -1 +0,0 @@
1
- export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
@@ -1,6 +0,0 @@
1
- import { L as LotteryBullet$1, d as defineCustomElement$1 } from './lottery-bullet2.js';
2
-
3
- const LotteryBullet = LotteryBullet$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { LotteryBullet, defineCustomElement };
@@ -1,91 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
-
3
- const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, white 0%, white 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, white 0%, #f1f1f1 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #00958f}.Circle.Disabled{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #D4D4D4;cursor:default}";
4
-
5
- const LotteryBullet = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
- constructor() {
7
- super();
8
- this.__registerHost();
9
- this.__attachShadow();
10
- this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
11
- /**
12
- * Value of the bullet
13
- */
14
- this.value = '0';
15
- /**
16
- * Marks if the bullet should be selectable
17
- */
18
- this.selectable = true;
19
- /**
20
- * Marks if the bullet should be selected
21
- */
22
- this.isSelected = false;
23
- /**
24
- * Client custom styling via string
25
- */
26
- this.clientStyling = '';
27
- /**
28
- * Client custom styling via url content
29
- */
30
- this.clientStylingUrlContent = '';
31
- this.limitStylingAppends = false;
32
- this.select = () => {
33
- if (this.selectable) {
34
- this.isSelected = !this.isSelected;
35
- this.bulletEvent.emit({
36
- value: this.value,
37
- selected: this.isSelected
38
- });
39
- }
40
- };
41
- this.setClientStyling = () => {
42
- let sheet = document.createElement('style');
43
- sheet.innerHTML = this.clientStyling;
44
- this.stylingContainer.prepend(sheet);
45
- };
46
- this.setClientStylingURL = () => {
47
- let cssFile = document.createElement('style');
48
- setTimeout(() => {
49
- cssFile.innerHTML = this.clientStylingUrlContent;
50
- this.stylingContainer.prepend(cssFile);
51
- }, 1);
52
- };
53
- }
54
- componentDidRender() {
55
- // start custom styling area
56
- if (!this.limitStylingAppends && this.stylingContainer) {
57
- if (this.clientStyling)
58
- this.setClientStyling();
59
- if (this.clientStylingUrlContent)
60
- this.setClientStylingURL();
61
- this.limitStylingAppends = true;
62
- }
63
- // end custom styling area
64
- }
65
- render() {
66
- return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
67
- }
68
- static get style() { return lotteryBulletCss; }
69
- }, [1, "lottery-bullet", {
70
- "value": [1],
71
- "selectable": [4],
72
- "isSelected": [4, "is-selected"],
73
- "clientStyling": [1, "client-styling"],
74
- "clientStylingUrlContent": [1, "client-styling-url-content"],
75
- "limitStylingAppends": [32]
76
- }]);
77
- function defineCustomElement() {
78
- if (typeof customElements === "undefined") {
79
- return;
80
- }
81
- const components = ["lottery-bullet"];
82
- components.forEach(tagName => { switch (tagName) {
83
- case "lottery-bullet":
84
- if (!customElements.get(tagName)) {
85
- customElements.define(tagName, LotteryBullet);
86
- }
87
- break;
88
- } });
89
- }
90
-
91
- export { LotteryBullet as L, defineCustomElement as d };
@@ -1,6 +0,0 @@
1
- import { L as LotteryGrid$1, d as defineCustomElement$1 } from './lottery-grid2.js';
2
-
3
- const LotteryGrid = LotteryGrid$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { LotteryGrid, defineCustomElement };
@@ -1,236 +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
-
236
- export { LotteryGrid as L, defineCustomElement as d };
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface LotteryTicket extends Components.LotteryTicket, HTMLElement {}
4
- export const LotteryTicket: {
5
- prototype: LotteryTicket;
6
- new (): LotteryTicket;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,266 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { d as defineCustomElement$3 } from './lottery-bullet2.js';
3
- import { d as defineCustomElement$2 } 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
- fr: {
29
- loading: 'Loading, please wait ...',
30
- error: 'It was an error while trying to fetch the data',
31
- grid: 'Grid',
32
- multiplier: 'Multiplier',
33
- numberOfDraws: 'Number of draws',
34
- wagerPerDraw: 'Wager per draw',
35
- resetButton: 'Reset',
36
- autoButton: 'I feel lucky'
37
- },
38
- ar: {
39
- loading: 'Loading, please wait ...',
40
- error: 'It was an error while trying to fetch the data',
41
- grid: 'Grid',
42
- multiplier: 'Multiplier',
43
- numberOfDraws: 'Number of draws',
44
- wagerPerDraw: 'Wager per draw',
45
- resetButton: 'Reset',
46
- autoButton: 'I feel lucky'
47
- }
48
- };
49
- const translate = (key, customLang) => {
50
- const lang = customLang;
51
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
52
- };
53
-
54
- 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}";
55
-
56
- const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
57
- constructor() {
58
- super();
59
- this.__registerHost();
60
- this.__attachShadow();
61
- this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
62
- this.autoSelection = createEvent(this, "autoSelection", 7);
63
- this.resetSelection = createEvent(this, "resetSelection", 7);
64
- this.stakeChange = createEvent(this, "stakeChange", 7);
65
- this.multiplierChange = createEvent(this, "multiplierChange", 7);
66
- /**
67
- * Number of grids of a ticket
68
- */
69
- this.numberOfGrids = 1;
70
- /**
71
- * Option to have the ticket registered for multiple draws
72
- */
73
- this.multipleDraws = true;
74
- /**
75
- * Shows the reset button
76
- */
77
- this.resetButton = false;
78
- /**
79
- * Shows the auto-pick button
80
- */
81
- this.autoPick = false;
82
- /**
83
- * Language
84
- */
85
- this.language = 'en';
86
- /**
87
- * Client custom styling via string
88
- */
89
- this.clientStyling = '';
90
- /**
91
- * Client custom styling via url content
92
- */
93
- this.clientStylingUrlContent = '';
94
- this.multiplier = false;
95
- this.numberOfDraws = 1;
96
- this.isLoading = true;
97
- this.hasErrors = false;
98
- this.ticketDone = false;
99
- this.isCustomSelect = false;
100
- this.amountInfo = {};
101
- this.limitStylingAppends = false;
102
- this.setClientStyling = () => {
103
- let sheet = document.createElement('style');
104
- sheet.innerHTML = this.clientStyling;
105
- this.stylingContainer.prepend(sheet);
106
- };
107
- this.setClientStylingURL = () => {
108
- let cssFile = document.createElement('style');
109
- setTimeout(() => {
110
- cssFile.innerHTML = this.clientStylingUrlContent;
111
- this.stylingContainer.prepend(cssFile);
112
- }, 1);
113
- };
114
- }
115
- /**
116
- * @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
117
- */
118
- checkForClickOutside(ev) {
119
- if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
120
- this.isCustomSelect = false;
121
- }
122
- }
123
- connectedCallback() {
124
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
125
- fetch(url.href)
126
- .then((response) => {
127
- if (response.ok) {
128
- return response.json();
129
- }
130
- else {
131
- // Throw error
132
- this.hasErrors = true;
133
- }
134
- })
135
- .then((data) => {
136
- this.isLoading = false;
137
- this.gameData = data;
138
- this.grids = [...Array(data.rules.boards.length).keys()];
139
- this.amountInfo = this.gameData.rules.stakes[0]; // initial value for select
140
- })
141
- .catch((err) => {
142
- this.isLoading = false;
143
- this.hasErrors = true;
144
- console.error('Error!', err);
145
- });
146
- }
147
- componentDidRender() {
148
- // start custom styling area
149
- if (!this.limitStylingAppends && this.stylingContainer) {
150
- if (this.clientStyling)
151
- this.setClientStyling();
152
- if (this.clientStylingUrlContent)
153
- this.setClientStylingURL();
154
- this.limitStylingAppends = true;
155
- }
156
- // end custom styling area
157
- }
158
- multiplierChangeHandler(e) {
159
- this.multiplier = e.target ? e.target.checked : false;
160
- this.multiplierChange.emit(this.multiplier);
161
- }
162
- drawsChangeHandler(event) {
163
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
164
- this.ticketCompleted.emit(this.ticket);
165
- }
166
- gridFilledHandler(event) {
167
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
168
- this.ticketDone = true;
169
- this.ticketCompleted.emit(this.ticket);
170
- }
171
- toggleAutoSelection() {
172
- this.ticketDone = true;
173
- this.autoSelection.emit(this.ticketId);
174
- }
175
- toggleResetSelection() {
176
- this.ticketDone = false;
177
- this.resetSelection.emit(this.ticketId);
178
- }
179
- changeStake(ticketid, amount) {
180
- this.stakeChange.emit({
181
- ticketId: ticketid,
182
- stake: amount
183
- });
184
- }
185
- toggleClass() {
186
- this.isCustomSelect = !this.isCustomSelect;
187
- }
188
- setDropdownItem(item) {
189
- this.amountInfo = {
190
- amount: item.amount,
191
- currency: item.currency
192
- };
193
- this.isCustomSelect = false;
194
- this.changeStake(this.ticketId, item.amount);
195
- }
196
- render() {
197
- if (this.isLoading) {
198
- return (h("div", null, h("p", null, translate('loading', this.language))));
199
- }
200
- else {
201
- if (this.hasErrors) {
202
- return (h("div", null, h("p", null, translate('error', this.language))));
203
- }
204
- else {
205
- const { rules } = this.gameData;
206
- return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
207
- h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
208
- 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 &&
209
- 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 &&
210
- 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 ?
211
- (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)))))));
212
- }
213
- }
214
- }
215
- static get watchers() { return {
216
- "numberOfDraws": ["drawsChangeHandler"]
217
- }; }
218
- static get style() { return lotteryTicketCss; }
219
- }, [1, "lottery-ticket", {
220
- "endpoint": [1],
221
- "gameId": [1, "game-id"],
222
- "numberOfGrids": [2, "number-of-grids"],
223
- "multipleDraws": [4, "multiple-draws"],
224
- "ticketId": [2, "ticket-id"],
225
- "resetButton": [4, "reset-button"],
226
- "autoPick": [4, "auto-pick"],
227
- "language": [1],
228
- "clientStyling": [1, "client-styling"],
229
- "clientStylingUrlContent": [1, "client-styling-url-content"],
230
- "multiplier": [32],
231
- "numberOfDraws": [32],
232
- "isLoading": [32],
233
- "hasErrors": [32],
234
- "ticketDone": [32],
235
- "isCustomSelect": [32],
236
- "amountInfo": [32],
237
- "limitStylingAppends": [32]
238
- }, [[8, "click", "checkForClickOutside"], [0, "gridFilled", "gridFilledHandler"]]]);
239
- function defineCustomElement$1() {
240
- if (typeof customElements === "undefined") {
241
- return;
242
- }
243
- const components = ["lottery-ticket", "lottery-bullet", "lottery-grid"];
244
- components.forEach(tagName => { switch (tagName) {
245
- case "lottery-ticket":
246
- if (!customElements.get(tagName)) {
247
- customElements.define(tagName, LotteryTicket$1);
248
- }
249
- break;
250
- case "lottery-bullet":
251
- if (!customElements.get(tagName)) {
252
- defineCustomElement$3();
253
- }
254
- break;
255
- case "lottery-grid":
256
- if (!customElements.get(tagName)) {
257
- defineCustomElement$2();
258
- }
259
- break;
260
- } });
261
- }
262
-
263
- const LotteryTicket = LotteryTicket$1;
264
- const defineCustomElement = defineCustomElement$1;
265
-
266
- export { LotteryTicket, defineCustomElement };