@everymatrix/lottery-ticket-controller 1.31.1 → 1.32.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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +5 -4
  3. package/dist/cjs/helper-accordion_5.cjs.entry.js +0 -755
  4. package/dist/cjs/index-797fecd9.js +0 -1286
  5. package/dist/cjs/index.cjs.js +0 -2
  6. package/dist/cjs/loader.cjs.js +0 -21
  7. package/dist/cjs/lottery-ticket-controller.cjs.js +0 -19
  8. package/dist/collection/collection-manifest.json +0 -37
  9. package/dist/collection/components/lottery-ticket-controller/lottery-ticket-controller.css +0 -185
  10. package/dist/collection/components/lottery-ticket-controller/lottery-ticket-controller.js +0 -404
  11. package/dist/collection/index.js +0 -1
  12. package/dist/collection/utils/locale.utils.js +0 -23
  13. package/dist/collection/utils/utils.js +0 -3
  14. package/dist/components/helper-accordion.js +0 -6
  15. package/dist/components/helper-accordion2.js +0 -159
  16. package/dist/components/index.d.ts +0 -26
  17. package/dist/components/index.js +0 -1
  18. package/dist/components/lottery-bullet.js +0 -6
  19. package/dist/components/lottery-bullet2.js +0 -91
  20. package/dist/components/lottery-grid.js +0 -6
  21. package/dist/components/lottery-grid2.js +0 -245
  22. package/dist/components/lottery-ticket-controller.d.ts +0 -11
  23. package/dist/components/lottery-ticket-controller.js +0 -185
  24. package/dist/components/lottery-ticket.js +0 -6
  25. package/dist/components/lottery-ticket2.js +0 -273
  26. package/dist/esm/helper-accordion_5.entry.js +0 -747
  27. package/dist/esm/index-c4bda097.js +0 -1260
  28. package/dist/esm/index.js +0 -1
  29. package/dist/esm/loader.js +0 -17
  30. package/dist/esm/lottery-ticket-controller.js +0 -17
  31. package/dist/esm/polyfills/core-js.js +0 -11
  32. package/dist/esm/polyfills/css-shim.js +0 -1
  33. package/dist/esm/polyfills/dom.js +0 -79
  34. package/dist/esm/polyfills/es5-html-element.js +0 -1
  35. package/dist/esm/polyfills/index.js +0 -34
  36. package/dist/esm/polyfills/system.js +0 -6
  37. package/dist/index.cjs.js +0 -1
  38. package/dist/index.js +0 -1
  39. package/dist/lottery-ticket-controller/index.esm.js +0 -0
  40. package/dist/lottery-ticket-controller/lottery-ticket-controller.esm.js +0 -1
  41. package/dist/lottery-ticket-controller/p-1f81b6df.js +0 -1
  42. package/dist/lottery-ticket-controller/p-e25b2082.entry.js +0 -1
  43. package/dist/stencil.config.js +0 -22
  44. package/dist/types/Users/sebastian.strulea/Documents/work/widgets-stencil/packages/lottery-ticket-controller/.stencil/packages/lottery-ticket-controller/stencil.config.d.ts +0 -2
  45. package/dist/types/components/lottery-ticket-controller/lottery-ticket-controller.d.ts +0 -73
  46. package/dist/types/components.d.ts +0 -158
  47. package/dist/types/index.d.ts +0 -1
  48. package/dist/types/stencil-public-runtime.d.ts +0 -1565
  49. package/dist/types/utils/locale.utils.d.ts +0 -1
  50. package/dist/types/utils/utils.d.ts +0 -1
  51. package/loader/cdn.js +0 -3
  52. package/loader/index.cjs.js +0 -3
  53. package/loader/index.d.ts +0 -12
  54. package/loader/index.es2017.js +0 -3
  55. package/loader/index.js +0 -4
  56. package/loader/package.json +0 -10
@@ -1,747 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-c4bda097.js';
2
-
3
- const DEFAULT_LANGUAGE$2 = 'en';
4
- const SUPPORTED_LANGUAGES$2 = ['ro', 'en', 'hr'];
5
- const TRANSLATIONS$2 = {
6
- en: {
7
- deleteTicket: 'Delete ticket'
8
- },
9
- ro: {
10
- deleteTicket: 'Sterge biletul'
11
- },
12
- fr: {
13
- deleteTicket: 'Supprimer le billet'
14
- },
15
- ar: {
16
- deleteTicket: 'حذف التذكرة'
17
- },
18
- hr: {
19
- deleteTicket: 'Izbriši listić'
20
- }
21
- };
22
- const translate$2 = (key, customLang) => {
23
- const lang = customLang;
24
- return TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
25
- };
26
-
27
- const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:5px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:1px;cursor:pointer}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff;text-transform:capitalize}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px;cursor:pointer}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
28
-
29
- const Accordion = class {
30
- constructor(hostRef) {
31
- registerInstance(this, hostRef);
32
- this.accordionEvent = createEvent(this, "helperAccordionAction", 7);
33
- /**
34
- * Flag for ticket history
35
- */
36
- this.ticketHistoryFlag = false;
37
- /**
38
- * Title (top header)
39
- */
40
- this.headerTitle = '';
41
- /**
42
- * SubTitle (top header)
43
- */
44
- this.headerSubtitle = '';
45
- /**
46
- * Description
47
- */
48
- this.description = '';
49
- /**
50
- * Enables footer content
51
- */
52
- this.footer = false;
53
- /**
54
- * Enables footer button for tab deletion
55
- */
56
- this.deleteTab = false;
57
- /**
58
- * Activates postMessages as events for actions from the widget
59
- */
60
- this.postMessage = false;
61
- /**
62
- * Name of the event emitter by the action button
63
- */
64
- this.eventName = 'helperAccordionAction';
65
- /**
66
- * Collapsed
67
- */
68
- this.collapsed = true;
69
- /**
70
- * Language
71
- */
72
- this.language = 'en';
73
- /**
74
- * Client custom styling via string
75
- */
76
- this.clientStyling = '';
77
- /**
78
- * Client custom styling via url content
79
- */
80
- this.clientStylingUrlContent = '';
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
- // @TODO fix the `any` type :)
96
- connectedCallback() {
97
- this.showContent = !this.collapsed;
98
- }
99
- componentDidRender() {
100
- // start custom styling area
101
- if (!this.limitStylingAppends && this.stylingContainer) {
102
- if (this.clientStyling)
103
- this.setClientStyling();
104
- if (this.clientStylingUrlContent)
105
- this.setClientStylingURL();
106
- this.limitStylingAppends = true;
107
- }
108
- // end custom styling area
109
- }
110
- toggleContent() {
111
- this.showContent = !this.showContent;
112
- }
113
- deleteAction() {
114
- if (this.postMessage) {
115
- // @TODO maybe change the name type, this one sucks
116
- window.postMessage({ type: this.eventName }, window.location.href);
117
- }
118
- this.accordionEvent.emit();
119
- }
120
- render() {
121
- return (h("div", { class: "Wrapper", ref: el => this.stylingContainer = el }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header', onClick: () => this.toggleContent() }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle Description" }, this.description), h("span", { class: "Expand" }, this.showContent ? '<' : '>')), this.showContent &&
122
- h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
123
- h("div", null, this.deleteTab &&
124
- h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate$2('deleteTicket', this.language)))))));
125
- }
126
- };
127
- Accordion.style = helperAccordionCss;
128
-
129
- 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}";
130
-
131
- const LotteryBullet = class {
132
- constructor(hostRef) {
133
- registerInstance(this, hostRef);
134
- this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
135
- /**
136
- * Value of the bullet
137
- */
138
- this.value = '0';
139
- /**
140
- * Marks if the bullet should be selectable
141
- */
142
- this.selectable = true;
143
- /**
144
- * Marks if the bullet should be selected
145
- */
146
- this.isSelected = false;
147
- /**
148
- * Client custom styling via string
149
- */
150
- this.clientStyling = '';
151
- /**
152
- * Client custom styling via url content
153
- */
154
- this.clientStylingUrlContent = '';
155
- this.limitStylingAppends = false;
156
- this.select = () => {
157
- if (this.selectable) {
158
- this.isSelected = !this.isSelected;
159
- this.bulletEvent.emit({
160
- value: this.value,
161
- selected: this.isSelected
162
- });
163
- }
164
- };
165
- this.setClientStyling = () => {
166
- let sheet = document.createElement('style');
167
- sheet.innerHTML = this.clientStyling;
168
- this.stylingContainer.prepend(sheet);
169
- };
170
- this.setClientStylingURL = () => {
171
- let cssFile = document.createElement('style');
172
- setTimeout(() => {
173
- cssFile.innerHTML = this.clientStylingUrlContent;
174
- this.stylingContainer.prepend(cssFile);
175
- }, 1);
176
- };
177
- }
178
- componentDidRender() {
179
- // start custom styling area
180
- if (!this.limitStylingAppends && this.stylingContainer) {
181
- if (this.clientStyling)
182
- this.setClientStyling();
183
- if (this.clientStylingUrlContent)
184
- this.setClientStylingURL();
185
- this.limitStylingAppends = true;
186
- }
187
- // end custom styling area
188
- }
189
- render() {
190
- return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
191
- }
192
- };
193
- LotteryBullet.style = lotteryBulletCss;
194
-
195
- 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}";
196
-
197
- const LotteryGrid = class {
198
- constructor(hostRef) {
199
- registerInstance(this, hostRef);
200
- this.gridFilledEvent = createEvent(this, "gridFilled", 7);
201
- this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
202
- /**
203
- * Number of bullets of grid
204
- */
205
- this.totalNumbers = 0;
206
- /**
207
- * Number of maximum bullets that can be selected
208
- */
209
- this.maximumAllowed = 0;
210
- /**
211
- * Minimum allowed of bullets
212
- */
213
- this.minimumAllowed = 1;
214
- /**
215
- * Allows the user to select numbers on the grid
216
- */
217
- this.selectable = true;
218
- /**
219
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
220
- */
221
- this.selectedNumbers = '';
222
- /**
223
- * Show only selected numbers
224
- */
225
- this.displaySelected = false;
226
- /**
227
- * Language
228
- */
229
- this.language = 'en';
230
- /**
231
- * Personalize grid for ticket
232
- */
233
- this.gridType = '';
234
- /**
235
- * Client custom styling via string
236
- */
237
- this.clientStyling = '';
238
- /**
239
- * Client custom styling via url content
240
- */
241
- this.clientStylingUrlContent = '';
242
- this.numbers = [];
243
- this.limitStylingAppends = false;
244
- this.selectedCounter = 0;
245
- this.setClientStyling = () => {
246
- let sheet = document.createElement('style');
247
- sheet.innerHTML = this.clientStyling;
248
- this.stylingContainer.prepend(sheet);
249
- };
250
- this.setClientStylingURL = () => {
251
- let cssFile = document.createElement('style');
252
- setTimeout(() => {
253
- cssFile.innerHTML = this.clientStylingUrlContent;
254
- this.stylingContainer.prepend(cssFile);
255
- }, 1);
256
- };
257
- }
258
- connectedCallback() {
259
- let selected = [];
260
- if (this.selectedNumbers.length > 0) {
261
- selected = this.selectedNumbers.split(',');
262
- this.selectedCounter = selected.length;
263
- }
264
- if (this.displaySelected) {
265
- selected.forEach((item) => {
266
- this.numbers.push({
267
- number: item,
268
- selected: true,
269
- selectable: this.selectable
270
- });
271
- });
272
- }
273
- else {
274
- [...Array(this.totalNumbers).keys()]
275
- .map(number => (number + 1).toString())
276
- .forEach((number) => {
277
- this.numbers.push({
278
- number,
279
- selected: selected.indexOf(number) >= 0 ? true : false,
280
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
281
- });
282
- });
283
- }
284
- }
285
- componentDidRender() {
286
- // start custom styling area
287
- if (!this.limitStylingAppends && this.stylingContainer) {
288
- if (this.clientStyling)
289
- this.setClientStyling();
290
- if (this.clientStylingUrlContent)
291
- this.setClientStylingURL();
292
- this.limitStylingAppends = true;
293
- }
294
- // end custom styling area
295
- }
296
- // wrote this because the classic .sort(() => 0.5 - Math.random()) method yielded low entropy shuffles for some reason on certain devices
297
- shuffleArray(array) {
298
- const result = [];
299
- while (array.length > 0) {
300
- const randomIndex = Math.floor(Math.random() * (array.length));
301
- result.push(array.splice(randomIndex, 1)[0]);
302
- }
303
- return result;
304
- }
305
- lotteryBulletSelectionHandler(event) {
306
- this.numbers = this.numbers.map((item) => {
307
- if (item.number == event.detail.value) {
308
- return {
309
- number: item.number,
310
- selected: event.detail.selected,
311
- selectable: item.selectable
312
- };
313
- }
314
- return {
315
- number: item.number,
316
- selected: item.selected,
317
- selectable: item.selectable
318
- };
319
- });
320
- if (event.detail.selected) {
321
- this.selectedCounter += 1;
322
- if (this.selectedCounter == this.maximumAllowed) {
323
- this.numbers = this.numbers.map((item) => {
324
- return {
325
- number: item.number,
326
- selected: item.selected,
327
- selectable: item.selected ? true : false
328
- };
329
- });
330
- this.gridFilledEvent.emit({
331
- id: this.ticketId,
332
- index: this.gridIndex,
333
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
334
- });
335
- }
336
- }
337
- else {
338
- if (this.selectedCounter == this.maximumAllowed) {
339
- this.numbers = this.numbers.map((item) => {
340
- return {
341
- number: item.number,
342
- selected: item.selected,
343
- selectable: true
344
- };
345
- });
346
- this.gridDirtyEvent.emit({
347
- id: this.ticketId,
348
- index: this.gridIndex,
349
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
350
- });
351
- }
352
- this.selectedCounter -= 1;
353
- }
354
- }
355
- async resetSelectionHandler(event) {
356
- if (event.detail && event.detail == this.ticketId) {
357
- this.selectedCounter = 0;
358
- this.numbers = this.numbers.map((item) => {
359
- return {
360
- number: item.number,
361
- selected: false,
362
- selectable: this.selectable
363
- };
364
- });
365
- this.gridDirtyEvent.emit({
366
- id: this.ticketId,
367
- index: this.gridIndex,
368
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
369
- });
370
- }
371
- }
372
- async autoSelectionHandler(event) {
373
- if (event.detail && event.detail == this.ticketId) {
374
- this.resetSelectionHandler(event);
375
- let array = [...Array(this.totalNumbers).keys()]
376
- .map(number => number + 1);
377
- array = this.shuffleArray(array);
378
- array = array.slice(0, this.minimumAllowed);
379
- this.numbers = this.numbers.map((item) => {
380
- return {
381
- number: item.number,
382
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
383
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
384
- };
385
- });
386
- this.gridFilledEvent.emit({
387
- id: this.ticketId,
388
- index: this.gridIndex,
389
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
390
- });
391
- this.selectedCounter = this.maximumAllowed;
392
- }
393
- }
394
- render() {
395
- 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 }))))));
396
- }
397
- };
398
- LotteryGrid.style = lotteryGridCss;
399
-
400
- const DEFAULT_LANGUAGE$1 = 'en';
401
- const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'hr'];
402
- const TRANSLATIONS$1 = {
403
- en: {
404
- loading: 'Loading, please wait ...',
405
- error: 'It was an error while trying to fetch the data',
406
- grid: 'Grid',
407
- multiplier: 'Multiplier',
408
- numberOfDraws: 'Number of draws',
409
- wagerPerDraw: 'Wager per draw',
410
- resetButton: 'Reset',
411
- autoButton: 'I feel lucky'
412
- },
413
- ro: {
414
- loading: 'Se incarca, va rugam asteptati ...',
415
- error: 'A fost o eroare in timp ce asteptam datele',
416
- grid: 'Grid',
417
- multiplier: 'Multiplicator',
418
- numberOfDraws: 'Numarul de extrageri',
419
- wagerPerDraw: 'Pariul per extragere',
420
- resetButton: 'Reseteaza',
421
- autoButton: 'Ma simt norocos'
422
- },
423
- fr: {
424
- loading: 'Loading, please wait ...',
425
- error: 'It was an error while trying to fetch the data',
426
- grid: 'Grid',
427
- multiplier: 'Multiplier',
428
- numberOfDraws: 'Number of draws',
429
- wagerPerDraw: 'Wager per draw',
430
- resetButton: 'Reset',
431
- autoButton: 'I feel lucky'
432
- },
433
- ar: {
434
- loading: 'Loading, please wait ...',
435
- error: 'It was an error while trying to fetch the data',
436
- grid: 'Grid',
437
- multiplier: 'Multiplier',
438
- numberOfDraws: 'Number of draws',
439
- wagerPerDraw: 'Wager per draw',
440
- resetButton: 'Reset',
441
- autoButton: 'I feel lucky'
442
- },
443
- hr: {
444
- loading: 'Učitavanje, molimo pričekajte ...',
445
- error: 'Došlo je do pogreške prilikom pokušaja dohvaćanja podataka',
446
- grid: 'Tablica',
447
- multiplier: 'Multiplikator',
448
- numberOfDraws: 'Broj izvlačenja',
449
- wagerPerDraw: 'Ulog po izvlačenju',
450
- resetButton: 'Resetiraj',
451
- autoButton: 'Osjećam se sretno'
452
- }
453
- };
454
- const translate$1 = (key, customLang) => {
455
- const lang = customLang;
456
- return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
457
- };
458
-
459
- 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}";
460
-
461
- const LotteryTicket = class {
462
- constructor(hostRef) {
463
- registerInstance(this, hostRef);
464
- this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
465
- this.autoSelection = createEvent(this, "autoSelection", 7);
466
- this.resetSelection = createEvent(this, "resetSelection", 7);
467
- this.stakeChange = createEvent(this, "stakeChange", 7);
468
- this.multiplierChange = createEvent(this, "multiplierChange", 7);
469
- /**
470
- * Number of grids of a ticket
471
- */
472
- this.numberOfGrids = 1;
473
- /**
474
- * Option to have the ticket registered for multiple draws
475
- */
476
- this.multipleDraws = true;
477
- /**
478
- * Shows the reset button
479
- */
480
- this.resetButton = false;
481
- /**
482
- * Shows the auto-pick button
483
- */
484
- this.autoPick = false;
485
- /**
486
- * Language
487
- */
488
- this.language = 'en';
489
- /**
490
- * Client custom styling via string
491
- */
492
- this.clientStyling = '';
493
- /**
494
- * Client custom styling via url content
495
- */
496
- this.clientStylingUrlContent = '';
497
- this.multiplier = false;
498
- this.numberOfDraws = 1;
499
- this.isLoading = true;
500
- this.hasErrors = false;
501
- this.ticketDone = false;
502
- this.isCustomSelect = false;
503
- this.amountInfo = {};
504
- this.limitStylingAppends = false;
505
- this.setClientStyling = () => {
506
- let sheet = document.createElement('style');
507
- sheet.innerHTML = this.clientStyling;
508
- this.stylingContainer.prepend(sheet);
509
- };
510
- this.setClientStylingURL = () => {
511
- let cssFile = document.createElement('style');
512
- setTimeout(() => {
513
- cssFile.innerHTML = this.clientStylingUrlContent;
514
- this.stylingContainer.prepend(cssFile);
515
- }, 1);
516
- };
517
- }
518
- /**
519
- * @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
520
- */
521
- checkForClickOutside(ev) {
522
- if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
523
- this.isCustomSelect = false;
524
- }
525
- }
526
- connectedCallback() {
527
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
528
- fetch(url.href)
529
- .then((response) => {
530
- if (response.ok) {
531
- return response.json();
532
- }
533
- else {
534
- // Throw error
535
- this.hasErrors = true;
536
- }
537
- })
538
- .then((data) => {
539
- this.isLoading = false;
540
- this.gameData = data;
541
- this.grids = [...Array(this.gameData.type.boards.length).keys()];
542
- this.amountInfo = this.gameData.type.stakes[0]; // initial value for select
543
- })
544
- .catch((err) => {
545
- this.isLoading = false;
546
- this.hasErrors = true;
547
- console.error('Error!', err);
548
- });
549
- }
550
- componentDidRender() {
551
- // start custom styling area
552
- if (!this.limitStylingAppends && this.stylingContainer) {
553
- if (this.clientStyling)
554
- this.setClientStyling();
555
- if (this.clientStylingUrlContent)
556
- this.setClientStylingURL();
557
- this.limitStylingAppends = true;
558
- }
559
- // end custom styling area
560
- }
561
- multiplierChangeHandler(e) {
562
- this.multiplier = e.target ? e.target.checked : false;
563
- this.multiplierChange.emit(this.multiplier);
564
- }
565
- drawsChangeHandler(event) {
566
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
567
- this.ticketCompleted.emit(this.ticket);
568
- }
569
- gridFilledHandler(event) {
570
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
571
- this.ticketDone = true;
572
- this.ticketCompleted.emit(this.ticket);
573
- }
574
- toggleAutoSelection() {
575
- this.ticketDone = true;
576
- this.autoSelection.emit(this.ticketId);
577
- }
578
- toggleResetSelection() {
579
- this.ticketDone = false;
580
- this.resetSelection.emit(this.ticketId);
581
- }
582
- changeStake(ticketid, amount) {
583
- this.stakeChange.emit({
584
- ticketId: ticketid,
585
- stake: amount
586
- });
587
- }
588
- toggleClass() {
589
- this.isCustomSelect = !this.isCustomSelect;
590
- }
591
- setDropdownItem(item) {
592
- this.amountInfo = {
593
- value: item.value,
594
- currency: item.currency
595
- };
596
- this.isCustomSelect = false;
597
- this.changeStake(this.ticketId, item.amount);
598
- }
599
- render() {
600
- if (this.isLoading) {
601
- return (h("div", null, h("p", null, translate$1('loading', this.language))));
602
- }
603
- else {
604
- if (this.hasErrors) {
605
- return (h("div", null, h("p", null, translate$1('error', this.language))));
606
- }
607
- else {
608
- const { type } = this.gameData;
609
- return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
610
- h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate$1('resetButton', this.language))), this.autoPick && !this.ticketDone &&
611
- h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate$1('autoButton', this.language))), this.grids.map((_, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate$1('grid', this.language), " ", index + 1), h("lottery-grid", { "grid-index": index, "maximum-allowed": type.boards[index].maximumAllowed, "minimum-allowed": type.boards[index].minimumAllowed, "total-numbers": type.boards[index].highNumber - type.boards[index].lowNumber + 1, 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 }))), type.multiplier &&
612
- h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate$1('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
613
- h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate$1('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$1('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, type.stakes.length > 1 ?
614
- (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.value, " ", 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" }, type.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.value == item.value ? 'SelectedValue' : '', value: item.value, onClick: () => this.setDropdownItem(item) }, item.value, " ", item.currency)))))) : (h("div", null, h("input", { min: "1", value: type.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, type.stakes[0].currency)))))));
615
- }
616
- }
617
- }
618
- static get watchers() { return {
619
- "numberOfDraws": ["drawsChangeHandler"]
620
- }; }
621
- };
622
- LotteryTicket.style = lotteryTicketCss;
623
-
624
- const DEFAULT_LANGUAGE = 'en';
625
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
626
- const TRANSLATIONS = {
627
- en: {
628
- ticket: 'Ticket',
629
- },
630
- ro: {
631
- ticket: 'Bilet',
632
- },
633
- fr: {
634
- ticket: 'Billet'
635
- },
636
- ar: {
637
- ticket: 'تذكرة',
638
- },
639
- hr: {
640
- ticket: 'Listić',
641
- }
642
- };
643
- const translate = (key, customLang) => {
644
- const lang = customLang;
645
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
646
- };
647
-
648
- const lotteryTicketControllerCss = ":host{font-family:\"Roboto\", system-ui, -apple-system, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\";font-size:0.8rem}*,*::before,*::after{margin:0;padding:0;list-style:none;outline:none;box-sizing:border-box}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.player-account-gaming-limits-popup-2{background:var(--emfe-w-color-black, #000000);color:var(--emfe-w-color-white, #000)}.Title{font-weight:800;font-size:18px}button{display:block;font-size:0.75rem;padding:12px 0;border:0;border-radius:2px;cursor:pointer}button.PrimaryButtonStyle{font-size:14px;color:#fff;background:#7ac317}button.SecondaryButtonStyle{border:1px solid #999;color:#666;background:#fff}.LinkButton{display:inline;padding:0;color:#3366CC;text-decoration:underline;background-color:rgba(0, 0, 0, 0)}.ResultIconWrapper{display:flex;flex-direction:column;align-items:center;margin:12px 0}.ResultIconWrapper svg{height:auto;width:60px;margin:12px}.ResultIconWrapper p{color:#666}.Overlay{position:absolute;top:0;left:0;width:100vw;height:100vh;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center}.ModalContainer{position:fixed;top:30vh;width:320px;height:auto;padding:18px 14px;background:#fff;border-radius:4px}.InitialWrapper{display:flex;flex-direction:column;gap:12px}.AdditionalInformation{margin:10px 0;font-size:14px}.TermsConditions{font-size:12px}.ExpandButton{font-size:14px;background-color:#fff;border:0;padding:0;margin-top:-10px;color:#999;display:flex;justify-content:center;align-items:center;cursor:pointer}.ExpandButton svg{width:28px;height:auto;margin-left:-4px}.LeftAlign{text-align:left;font-size:16px}.CenterAlign{text-align:center}.SetLimitSection{display:flex;flex-direction:column;gap:6px}.DepositTextSection{display:flex;justify-content:space-between}.DepositInputSection{height:32px;display:flex;gap:4px}.DepositInput{flex-grow:1;padding:0 6px}.SubmitDepositButton{flex-grow:1;font-size:0.75rem;padding:0}.SubmitDepositButton[disabled]{align-items:center;color:#ccc;cursor:not-allowed;background:#fff;border:#ccc 1px solid}.Hidden{display:none}.Extended{transform:rotate(180deg)}";
649
-
650
- const LotteryTicketController = class {
651
- constructor(hostRef) {
652
- registerInstance(this, hostRef);
653
- this.deleteTicketEvent = createEvent(this, "deleteTicket", 7);
654
- /**
655
- * Endpoint URL for the source of data (NorWAy standard)
656
- */
657
- this.endpoint = '';
658
- /**
659
- * Ticket number
660
- */
661
- this.ticketId = 1;
662
- /**
663
- * Activates postMessages as events for actions from the widget
664
- */
665
- this.postMessage = false;
666
- /**
667
- * Name of the event emitter by the action button
668
- */
669
- this.eventName = 'deleteTicketAction';
670
- /**
671
- * Collapsed
672
- */
673
- this.collapsed = true;
674
- /**
675
- * Number of grids?
676
- */
677
- this.numberOfGrids = 1;
678
- /**
679
- * This toggles if the last ticket added should be expanded or not
680
- */
681
- this.last = false;
682
- /**
683
- * Language
684
- */
685
- this.language = 'en';
686
- /**
687
- * Shows the auto-pick button
688
- */
689
- this.autoPick = false;
690
- /**
691
- * Shows the reset button
692
- */
693
- this.resetButton = false;
694
- /**
695
- * Number of ticket controllers
696
- */
697
- this.totalControllers = 1;
698
- /**
699
- * Client custom styling via string
700
- */
701
- this.clientStyling = '';
702
- /**
703
- * Client custom styling via url content
704
- */
705
- this.clientStylingUrlContent = '';
706
- this.limitStylingAppends = false;
707
- this.setClientStyling = () => {
708
- let sheet = document.createElement('style');
709
- sheet.innerHTML = this.clientStyling;
710
- this.stylingContainer.prepend(sheet);
711
- };
712
- this.setClientStylingURL = () => {
713
- let cssFile = document.createElement('style');
714
- setTimeout(() => {
715
- cssFile.innerHTML = this.clientStylingUrlContent;
716
- this.stylingContainer.prepend(cssFile);
717
- }, 1);
718
- };
719
- }
720
- // @TODO fix the `any` type
721
- helperAccordionActionHandler() {
722
- if (this.postMessage) {
723
- window.postMessage({ type: this.eventName }, window.location.href);
724
- }
725
- this.deleteTicketEvent.emit({
726
- ticketId: this.ticketId
727
- });
728
- }
729
- componentDidRender() {
730
- // start custom styling area
731
- if (!this.limitStylingAppends && this.stylingContainer) {
732
- if (this.clientStyling)
733
- this.setClientStyling();
734
- if (this.clientStylingUrlContent)
735
- this.setClientStylingURL();
736
- this.limitStylingAppends = true;
737
- }
738
- // end custom styling area
739
- }
740
- render() {
741
- console.log('ticket id:', this.ticketId);
742
- 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": this.totalControllers !== 1, 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 })))));
743
- }
744
- };
745
- LotteryTicketController.style = lotteryTicketControllerCss;
746
-
747
- export { Accordion as helper_accordion, LotteryBullet as lottery_bullet, LotteryGrid as lottery_grid, LotteryTicket as lottery_ticket, LotteryTicketController as lottery_ticket_controller };