@everymatrix/lottery-draw-results 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-33a98fae.js → index-62f030ff.js} +73 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/lottery-bullet_3.cjs.entry.js +374 -0
- package/dist/cjs/lottery-draw-results.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +14 -1
- package/dist/collection/components/lottery-draw-results/lottery-draw-results.css +7 -18
- package/dist/collection/components/lottery-draw-results/lottery-draw-results.js +56 -169
- package/dist/collection/utils/locale.utils.js +2 -14
- package/dist/components/lottery-bullet.js +6 -0
- package/dist/components/lottery-bullet2.js +56 -0
- package/dist/components/lottery-draw-results.js +59 -62
- package/dist/components/lottery-grid.js +6 -0
- package/dist/components/lottery-grid2.js +196 -0
- package/dist/esm/{index-c6e6b7f8.js → index-98326ddd.js} +73 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/lottery-bullet_3.entry.js +368 -0
- package/dist/esm/lottery-draw-results.js +2 -2
- package/dist/lottery-draw-results/lottery-draw-results.esm.js +1 -1
- package/dist/lottery-draw-results/p-2b8529f6.entry.js +1 -0
- package/dist/lottery-draw-results/p-bb429486.js +1 -0
- package/dist/types/components/lottery-draw-results/lottery-draw-results.d.ts +3 -28
- package/dist/types/components.d.ts +2 -56
- package/package.json +1 -1
- package/dist/cjs/lottery-draw-results.cjs.entry.js +0 -188
- package/dist/esm/lottery-draw-results.entry.js +0 -184
- package/dist/lottery-draw-results/p-31e0953f.js +0 -1
- package/dist/lottery-draw-results/p-d7361a7b.entry.js +0 -1
|
@@ -47,6 +47,40 @@ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
|
47
47
|
return false;
|
|
48
48
|
})()
|
|
49
49
|
;
|
|
50
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
51
|
+
if (listeners) {
|
|
52
|
+
listeners.map(([flags, name, method]) => {
|
|
53
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
54
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
55
|
+
const opts = hostListenerOpts(flags);
|
|
56
|
+
plt.ael(target, name, handler, opts);
|
|
57
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
62
|
+
try {
|
|
63
|
+
{
|
|
64
|
+
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
65
|
+
// instance is ready, let's call it's member method for this event
|
|
66
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
consoleError(e);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
78
|
+
if (flags & 4 /* TargetDocument */)
|
|
79
|
+
return doc;
|
|
80
|
+
return elm;
|
|
81
|
+
};
|
|
82
|
+
// prettier-ignore
|
|
83
|
+
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
50
84
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
51
85
|
const createTime = (fnName, tagName = '') => {
|
|
52
86
|
{
|
|
@@ -523,6 +557,20 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
523
557
|
// synchronous patch
|
|
524
558
|
patch(oldVNode, rootVnode);
|
|
525
559
|
};
|
|
560
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
561
|
+
const createEvent = (ref, name, flags) => {
|
|
562
|
+
const elm = getElement(ref);
|
|
563
|
+
return {
|
|
564
|
+
emit: (detail) => {
|
|
565
|
+
return emitEvent(elm, name, {
|
|
566
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
|
567
|
+
composed: !!(flags & 2 /* Composed */),
|
|
568
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
|
569
|
+
detail,
|
|
570
|
+
});
|
|
571
|
+
},
|
|
572
|
+
};
|
|
573
|
+
};
|
|
526
574
|
/**
|
|
527
575
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
528
576
|
* @param elm the target of the Event
|
|
@@ -559,6 +607,15 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
559
607
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
560
608
|
const instance = hostRef.$lazyInstance$ ;
|
|
561
609
|
let promise;
|
|
610
|
+
if (isInitialLoad) {
|
|
611
|
+
{
|
|
612
|
+
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
613
|
+
if (hostRef.$queuedListeners$) {
|
|
614
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
615
|
+
hostRef.$queuedListeners$ = null;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
562
619
|
endSchedule();
|
|
563
620
|
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
564
621
|
};
|
|
@@ -960,6 +1017,10 @@ const connectedCallback = (elm) => {
|
|
|
960
1017
|
}
|
|
961
1018
|
}
|
|
962
1019
|
else {
|
|
1020
|
+
// not the first time this has connected
|
|
1021
|
+
// reattach any event listeners to the host
|
|
1022
|
+
// since they would have been removed when disconnected
|
|
1023
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
963
1024
|
// fire off connectedCallback() on component instance
|
|
964
1025
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
965
1026
|
}
|
|
@@ -968,7 +1029,13 @@ const connectedCallback = (elm) => {
|
|
|
968
1029
|
};
|
|
969
1030
|
const disconnectedCallback = (elm) => {
|
|
970
1031
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
971
|
-
getHostRef(elm);
|
|
1032
|
+
const hostRef = getHostRef(elm);
|
|
1033
|
+
{
|
|
1034
|
+
if (hostRef.$rmListeners$) {
|
|
1035
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1036
|
+
hostRef.$rmListeners$ = undefined;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
972
1039
|
}
|
|
973
1040
|
};
|
|
974
1041
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
@@ -995,6 +1062,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
995
1062
|
{
|
|
996
1063
|
cmpMeta.$members$ = compactMeta[2];
|
|
997
1064
|
}
|
|
1065
|
+
{
|
|
1066
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
|
1067
|
+
}
|
|
998
1068
|
const tagName = cmpMeta.$tagName$;
|
|
999
1069
|
const HostElement = class extends HTMLElement {
|
|
1000
1070
|
// StencilLazyHost
|
|
@@ -1075,6 +1145,7 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1075
1145
|
elm['s-p'] = [];
|
|
1076
1146
|
elm['s-rc'] = [];
|
|
1077
1147
|
}
|
|
1148
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
1078
1149
|
return hostRefs.set(elm, hostRef);
|
|
1079
1150
|
};
|
|
1080
1151
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
@@ -1144,6 +1215,7 @@ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
|
1144
1215
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1145
1216
|
|
|
1146
1217
|
exports.bootstrapLazy = bootstrapLazy;
|
|
1218
|
+
exports.createEvent = createEvent;
|
|
1147
1219
|
exports.h = h;
|
|
1148
1220
|
exports.promiseResolve = promiseResolve;
|
|
1149
1221
|
exports.registerInstance = registerInstance;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-62f030ff.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["lottery-
|
|
17
|
+
return index.bootstrapLazy([["lottery-bullet_3.cjs",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"multiplier":[32],"ticketData":[32],"isLoading":[32],"drawResults":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"numbers":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-62f030ff.js');
|
|
6
|
+
|
|
7
|
+
const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Circle{cursor:pointer;color:#000000;display:block;background:#FFF;border:solid 2px #00958f;height:20px;width:20px;border-radius:50%;margin:0;display:flex;align-items:center;justify-content:center;user-select:none;font-size:12px;font-weight:600;position:relative}.Circle:hover{background:#aee4e2}.Circle.Selected{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{color:#707070;background:#D4D4D4;border:solid 2px #707070;cursor:default}.Circle.DisabledSelected{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 #707070;cursor:default}";
|
|
8
|
+
|
|
9
|
+
const LotteryBullet = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.bulletEvent = index.createEvent(this, "lotteryBulletSelection", 7);
|
|
13
|
+
/**
|
|
14
|
+
* Value of the bullet
|
|
15
|
+
*/
|
|
16
|
+
this.value = '0';
|
|
17
|
+
/**
|
|
18
|
+
* Marks if the bullet should be selectable
|
|
19
|
+
*/
|
|
20
|
+
this.selectable = true;
|
|
21
|
+
/**
|
|
22
|
+
* Marks if the bullet should be selected
|
|
23
|
+
*/
|
|
24
|
+
this.isSelected = false;
|
|
25
|
+
this.select = () => {
|
|
26
|
+
if (this.selectable) {
|
|
27
|
+
this.isSelected = !this.isSelected;
|
|
28
|
+
this.bulletEvent.emit({
|
|
29
|
+
value: this.value,
|
|
30
|
+
selected: this.isSelected
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
LotteryBullet.style = lotteryBulletCss;
|
|
40
|
+
|
|
41
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
42
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
43
|
+
const TRANSLATIONS = {
|
|
44
|
+
en: {
|
|
45
|
+
drawResultsHeader: 'Last draw results',
|
|
46
|
+
drawId: 'Draw ID',
|
|
47
|
+
drawName: 'Game name',
|
|
48
|
+
drawDate: 'Draw Date',
|
|
49
|
+
drawNumbersGridDraw: 'Draw numbers Grid A',
|
|
50
|
+
drawNumbersGridTicket: 'Draw numbers Grid B',
|
|
51
|
+
ticketResult: 'Ticket result',
|
|
52
|
+
amountWon: 'Amount won',
|
|
53
|
+
numberOfDraws: 'Number of draws'
|
|
54
|
+
},
|
|
55
|
+
ro: {
|
|
56
|
+
drawResultsHeader: 'Ultimele rezultate extragere',
|
|
57
|
+
drawId: 'Id extragere',
|
|
58
|
+
drawName: 'Numele jocului',
|
|
59
|
+
drawDate: 'Data extragerii',
|
|
60
|
+
drawNumbersGridDraw: 'Numerele extrase Grid A',
|
|
61
|
+
drawNumbersGridTicket: 'Numerele extrase Grid B',
|
|
62
|
+
ticketResult: 'Rezultatul biletului',
|
|
63
|
+
amountWon: 'Suma castigata',
|
|
64
|
+
numberOfDraws: 'Numarul de extrageri'
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const translate = (key, customLang) => {
|
|
68
|
+
const lang = customLang;
|
|
69
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const lotteryDrawResultsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketInfo{display:flex;flex-direction:row;gap:15px;background-color:#009993;color:#fff;padding:12px;font-size:14px}.DrawResultsSection{max-width:500px;margin:0 auto;margin:0px auto 10px;border-radius:4px}.DrawResultsHeader{display:flex;justify-content:space-between;padding:10px 20px;background-color:#009993;color:#fff;font-size:14px}.DrawResultsHeader h4{text-transform:uppercase;font-weight:400;margin:0}.DrawMultipler label{display:block;margin:15px 0}.DrawResultsBody{padding:0 20px}.DrawResultsBody .DrawNumbersGrid{font-size:14px}.DrawResultsBody .NumberOfDrawsContainer{display:table;width:100%}.Toggle{cursor:pointer;display:inline-block}.ToggleSwitch{display:inline-block;background:#ccc;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #eee 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#56c080}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px}.DrawTicketsContainer{margin:30px auto}.ExpandableBoxes{position:relative}.ExpandableBox{width:100%;height:100%;max-height:100px;float:left;margin:0 0 20px 0;border:1px solid #009993;border-radius:4px;padding:10px;box-sizing:border-box;-webkit-transition:all 0.6s ease-in-out;-moz-transition:all 0.6s ease-in-out;-o-transition:all 0.6s ease-in-out;-ms-transition:all 0.6s ease-in-out;transition:all 0.6s ease-in-out;overflow:hidden}.ExpandableBox.ShowBox{max-height:400px;margin:0px 0px 20p 0px}.ExpandableBox.HideBox{width:0;height:0;overflow:hidden;border:none;padding:0;margin:0;opacity:0}";
|
|
73
|
+
|
|
74
|
+
const DEFAULT_VALUES = {
|
|
75
|
+
gamename: 'Chrono',
|
|
76
|
+
gamedate: '24/09/2022',
|
|
77
|
+
state: 'Processing',
|
|
78
|
+
amount: 304444,
|
|
79
|
+
ticketid: '6963444',
|
|
80
|
+
selection: '[5, 6, 7, 8, 9]',
|
|
81
|
+
multiplier: 4.5,
|
|
82
|
+
resultstatus: 'Processing',
|
|
83
|
+
drawstatus: 'Won',
|
|
84
|
+
drawamount: 1022,
|
|
85
|
+
drawid: '54545555',
|
|
86
|
+
drawdate: '24/09/2032'
|
|
87
|
+
};
|
|
88
|
+
const LotteryDrawResults = class {
|
|
89
|
+
constructor(hostRef) {
|
|
90
|
+
index.registerInstance(this, hostRef);
|
|
91
|
+
/**
|
|
92
|
+
* Language of the widget
|
|
93
|
+
*/
|
|
94
|
+
this.language = 'en';
|
|
95
|
+
/**
|
|
96
|
+
* Shows only the last draw
|
|
97
|
+
*/
|
|
98
|
+
this.drawMode = false;
|
|
99
|
+
this.gameName = '';
|
|
100
|
+
this.multiplier = 5.434;
|
|
101
|
+
this.ticketData = {};
|
|
102
|
+
this.isLoading = true;
|
|
103
|
+
this.drawResults = [];
|
|
104
|
+
this.rules = {};
|
|
105
|
+
this.toggleDrawer = [false];
|
|
106
|
+
this.hasErrors = false;
|
|
107
|
+
this.errorText = '';
|
|
108
|
+
this.changeBox = (index) => {
|
|
109
|
+
this.toggleDrawer = this.toggleDrawer.map((item, itemIndex) => {
|
|
110
|
+
if (itemIndex == index) {
|
|
111
|
+
return !item;
|
|
112
|
+
}
|
|
113
|
+
return item;
|
|
114
|
+
});
|
|
115
|
+
if (index >= this.toggleDrawer.length) {
|
|
116
|
+
this.toggleDrawer.push(true);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
connectedCallback() {
|
|
121
|
+
let promises = [];
|
|
122
|
+
promises.push(this.getGameData());
|
|
123
|
+
if (this.playerId) {
|
|
124
|
+
promises.push(this.getTicketData());
|
|
125
|
+
}
|
|
126
|
+
if (this.drawId) {
|
|
127
|
+
promises.push(this.getDrawData());
|
|
128
|
+
}
|
|
129
|
+
Promise.all(promises)
|
|
130
|
+
.then(() => {
|
|
131
|
+
this.isLoading = false;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
getDrawData() {
|
|
135
|
+
return new Promise((resolve, reject) => {
|
|
136
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws/${this.drawId}`);
|
|
137
|
+
fetch(url.href)
|
|
138
|
+
.then((response) => {
|
|
139
|
+
// @TODO EXCEPTIONS
|
|
140
|
+
return response.json();
|
|
141
|
+
})
|
|
142
|
+
.then((data) => {
|
|
143
|
+
this.drawData = data;
|
|
144
|
+
resolve(true);
|
|
145
|
+
})
|
|
146
|
+
.catch((err) => {
|
|
147
|
+
reject(err);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
getGameData() {
|
|
152
|
+
return new Promise((resolve, reject) => {
|
|
153
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
154
|
+
fetch(url.href)
|
|
155
|
+
.then((response) => {
|
|
156
|
+
return response.json();
|
|
157
|
+
})
|
|
158
|
+
.then((data) => {
|
|
159
|
+
this.rules = {
|
|
160
|
+
maximumAllowed: data.rules.boards[0].maximumAllowed,
|
|
161
|
+
totalNumbers: data.rules.boards[0].totalNumbers
|
|
162
|
+
};
|
|
163
|
+
resolve(true);
|
|
164
|
+
})
|
|
165
|
+
.catch((err) => {
|
|
166
|
+
this.isLoading = false;
|
|
167
|
+
this.hasErrors = true;
|
|
168
|
+
this.errorText = err;
|
|
169
|
+
reject(err);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
getTicketData() {
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
let url = new URL(`${this.endpoint}/tickets/player/${this.playerId}`);
|
|
176
|
+
fetch(url.href)
|
|
177
|
+
.then((response) => {
|
|
178
|
+
return response.json();
|
|
179
|
+
})
|
|
180
|
+
.then((data) => {
|
|
181
|
+
this.ticketData = data.length === 0 ? DEFAULT_VALUES : data[1];
|
|
182
|
+
this.drawResults = this.ticketData.drawResults.map((item) => item);
|
|
183
|
+
this.selection = this.ticketData.selection[0].join(',');
|
|
184
|
+
resolve(true);
|
|
185
|
+
})
|
|
186
|
+
.catch((err) => {
|
|
187
|
+
reject(err);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
render() {
|
|
192
|
+
var _a, _b, _c, _d, _e, _f;
|
|
193
|
+
if (this.isLoading) {
|
|
194
|
+
return (index.h("p", null, "Loading, please wait ..."));
|
|
195
|
+
}
|
|
196
|
+
else if (this.hasErrors) {
|
|
197
|
+
index.h("p", null, this.errorText);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
return (index.h("section", { class: "DrawResultsSection" }, !this.drawMode ?
|
|
201
|
+
index.h("div", { class: "DrawResultsArea" }, index.h("div", { class: "TicketInfo" }, index.h("div", { class: "TicketGameName" }, translate('drawName', this.language), ": ", index.h("span", null, this.gameName)), index.h("div", { class: "TicketDate" }, "Ticket Purchase Date: ", index.h("span", null, (_a = this.ticketData) === null || _a === void 0 ? void 0 : _a.createdAt.slice(0, 10))), index.h("div", { class: "TicketStatus" }, "Status: ", index.h("span", null, (_b = this.ticketData) === null || _b === void 0 ? void 0 : _b.state))), index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "TicketIdContainer" }, index.h("p", null, "Ticket id: ", index.h("span", null, (_c = this.ticketData) === null || _c === void 0 ? void 0 : _c.id))), index.h("div", { class: "TicketAmountContainer" }, index.h("p", null, "Ticket amount: ", index.h("span", null, (_d = this.ticketData) === null || _d === void 0 ? void 0 : _d.amount))), index.h("div", { class: "DrawNumbersGrid" }, index.h("p", null, translate('drawNumbersGridTicket', this.language), ":"), index.h("div", { class: "BulletContainer" }, index.h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, "selected-numbers": this.selection, selectable: false, "display-selected": true, language: this.language }))), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, "Multiplier: ", index.h("span", null, JSON.stringify((_e = this.ticketData) === null || _e === void 0 ? void 0 : _e.multiplier)))), index.h("div", { class: "NumberOfDrawsContainer" }, index.h("p", null, translate('numberOfDraws', this.language), ": ", (_f = this.ticketData) === null || _f === void 0 ? void 0 :
|
|
202
|
+
_f.drawCount), index.h("div", { class: "DrawTicketsContainer" }, this.drawResults.map((item, index$1) => index.h("div", { class: "ExpandableBoxes" }, index.h("div", { class: this.toggleDrawer[index$1] ? 'ExpandableBox ShowBox' : 'ExpandableBox', onClick: () => this.changeBox(index$1) }, index.h("div", { class: "TicketResultContainer" }, index.h("p", null, translate('ticketResult', this.language), ": ", item.status)), item.state == 'won' &&
|
|
203
|
+
index.h("div", { class: "AmountWonContainer" }, index.h("p", null, translate('amountWon', this.language), ": ", Number(item.amount).toLocaleString('en'), " ", item.currency)), index.h("div", { class: "DrawIdContainer" }, index.h("p", null, translate('drawId', this.language), ": ", item.drawId)), index.h("div", { class: "DrawDateContainer" }, index.h("p", null, translate('drawDate', this.language), ": ", item.updatedAt.slice(0, 10), " | ", item.updatedAt.slice(11, 19))), index.h("div", { class: "DrawNumbersGrid" }), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, "Multiplier: ", item.multiplier)))))))))
|
|
204
|
+
:
|
|
205
|
+
index.h("div", { class: "DrawResultsArea" }, this.drawData &&
|
|
206
|
+
index.h("div", null, index.h("div", { class: "DrawResultsHeader" }, index.h("span", null, translate('drawId', this.language), ": ", this.drawData.id), index.h("span", null, translate('drawDate', this.language), ": ", this.drawData.date.slice(0, 10))), index.h("div", { class: "DrawResultsBody" }, index.h("div", { class: "DrawNumbersGrid" }, index.h("p", null, translate('drawNumbersGridDraw', this.language), ":"), index.h("div", { class: "BulletContainer" }, index.h("lottery-grid", { "maximum-allowed": this.rules.maximumAllowed, "total-numbers": this.rules.totalNumbers, selectedNumbers: this.drawData.winningNumbers.join(','), "display-selected": true, selectable: false, language: this.language })), index.h("div", { class: "DrawMultipler" }, index.h("label", { class: "Label" }, "Multiplier: ", this.multiplier))))))));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
LotteryDrawResults.style = lotteryDrawResultsCss;
|
|
211
|
+
|
|
212
|
+
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:350px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:10px}";
|
|
213
|
+
|
|
214
|
+
const LotteryGrid = class {
|
|
215
|
+
constructor(hostRef) {
|
|
216
|
+
index.registerInstance(this, hostRef);
|
|
217
|
+
this.gridFilledEvent = index.createEvent(this, "gridFilled", 7);
|
|
218
|
+
this.gridDirtyEvent = index.createEvent(this, "gridDirty", 7);
|
|
219
|
+
/**
|
|
220
|
+
* Number of bullets of grid
|
|
221
|
+
*/
|
|
222
|
+
this.totalNumbers = 0;
|
|
223
|
+
/**
|
|
224
|
+
* Number of maximum bullets that can be selected
|
|
225
|
+
*/
|
|
226
|
+
this.maximumAllowed = 0;
|
|
227
|
+
/**
|
|
228
|
+
* Minimum allowed of bullets
|
|
229
|
+
*/
|
|
230
|
+
this.minimumAllowed = 1;
|
|
231
|
+
/**
|
|
232
|
+
* Allows the user to select numbers on the grid
|
|
233
|
+
*/
|
|
234
|
+
this.selectable = true;
|
|
235
|
+
/**
|
|
236
|
+
* Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
|
|
237
|
+
*/
|
|
238
|
+
this.selectedNumbers = '';
|
|
239
|
+
/**
|
|
240
|
+
* Show only selected numbers
|
|
241
|
+
*/
|
|
242
|
+
this.displaySelected = false;
|
|
243
|
+
/**
|
|
244
|
+
* Language
|
|
245
|
+
*/
|
|
246
|
+
this.language = 'en';
|
|
247
|
+
this.numbers = [];
|
|
248
|
+
this.selectedCounter = 0;
|
|
249
|
+
}
|
|
250
|
+
connectedCallback() {
|
|
251
|
+
let selected = [];
|
|
252
|
+
if (this.selectedNumbers.length > 0) {
|
|
253
|
+
selected = this.selectedNumbers.split(',');
|
|
254
|
+
this.selectedCounter = selected.length;
|
|
255
|
+
}
|
|
256
|
+
if (this.displaySelected) {
|
|
257
|
+
selected.forEach((item) => {
|
|
258
|
+
this.numbers.push({
|
|
259
|
+
number: item,
|
|
260
|
+
selected: true,
|
|
261
|
+
selectable: this.selectable
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
[...Array(this.totalNumbers).keys()]
|
|
267
|
+
.map(number => (number + 1).toString())
|
|
268
|
+
.forEach((number) => {
|
|
269
|
+
this.numbers.push({
|
|
270
|
+
number,
|
|
271
|
+
selected: selected.indexOf(number) >= 0 ? true : false,
|
|
272
|
+
selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
lotteryBulletSelectionHandler(event) {
|
|
278
|
+
this.numbers = this.numbers.map((item) => {
|
|
279
|
+
if (item.number == event.detail.value) {
|
|
280
|
+
return {
|
|
281
|
+
number: item.number,
|
|
282
|
+
selected: event.detail.selected,
|
|
283
|
+
selectable: item.selectable
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
number: item.number,
|
|
288
|
+
selected: item.selected,
|
|
289
|
+
selectable: item.selectable
|
|
290
|
+
};
|
|
291
|
+
});
|
|
292
|
+
if (event.detail.selected) {
|
|
293
|
+
this.selectedCounter += 1;
|
|
294
|
+
if (this.selectedCounter == this.maximumAllowed) {
|
|
295
|
+
this.numbers = this.numbers.map((item) => {
|
|
296
|
+
return {
|
|
297
|
+
number: item.number,
|
|
298
|
+
selected: item.selected,
|
|
299
|
+
selectable: item.selected ? true : false
|
|
300
|
+
};
|
|
301
|
+
});
|
|
302
|
+
this.gridFilledEvent.emit({
|
|
303
|
+
id: this.ticketId,
|
|
304
|
+
index: this.gridIndex,
|
|
305
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
if (this.selectedCounter == this.maximumAllowed) {
|
|
311
|
+
this.numbers = this.numbers.map((item) => {
|
|
312
|
+
return {
|
|
313
|
+
number: item.number,
|
|
314
|
+
selected: item.selected,
|
|
315
|
+
selectable: true
|
|
316
|
+
};
|
|
317
|
+
});
|
|
318
|
+
this.gridDirtyEvent.emit({
|
|
319
|
+
id: this.ticketId,
|
|
320
|
+
index: this.gridIndex,
|
|
321
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
this.selectedCounter -= 1;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
async resetSelectionHandler(event) {
|
|
328
|
+
if (event.detail && event.detail == this.ticketId) {
|
|
329
|
+
this.selectedCounter = 0;
|
|
330
|
+
this.numbers = this.numbers.map((item) => {
|
|
331
|
+
return {
|
|
332
|
+
number: item.number,
|
|
333
|
+
selected: false,
|
|
334
|
+
selectable: this.selectable
|
|
335
|
+
};
|
|
336
|
+
});
|
|
337
|
+
this.gridDirtyEvent.emit({
|
|
338
|
+
id: this.ticketId,
|
|
339
|
+
index: this.gridIndex,
|
|
340
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
async autoSelectionHandler(event) {
|
|
345
|
+
if (event.detail && event.detail == this.ticketId) {
|
|
346
|
+
this.resetSelectionHandler(event);
|
|
347
|
+
let array = [...Array(this.totalNumbers).keys()]
|
|
348
|
+
.map(number => number + 1)
|
|
349
|
+
.sort(() => 0.5 - Math.random());
|
|
350
|
+
array = array.slice(0, this.minimumAllowed);
|
|
351
|
+
this.numbers = this.numbers.map((item) => {
|
|
352
|
+
return {
|
|
353
|
+
number: item.number,
|
|
354
|
+
selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
|
|
355
|
+
selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
|
|
356
|
+
};
|
|
357
|
+
});
|
|
358
|
+
this.gridFilledEvent.emit({
|
|
359
|
+
id: this.ticketId,
|
|
360
|
+
index: this.gridIndex,
|
|
361
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
362
|
+
});
|
|
363
|
+
this.selectedCounter = this.maximumAllowed;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
render() {
|
|
367
|
+
return (index.h("div", { class: "GridContainer" }, index.h("div", { class: "Grid" }, this.numbers.map((item) => index.h("div", null, index.h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected }))))));
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
LotteryGrid.style = lotteryGridCss;
|
|
371
|
+
|
|
372
|
+
exports.lottery_bullet = LotteryBullet;
|
|
373
|
+
exports.lottery_draw_results = LotteryDrawResults;
|
|
374
|
+
exports.lottery_grid = LotteryGrid;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-62f030ff.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["lottery-
|
|
18
|
+
return index.bootstrapLazy([["lottery-bullet_3.cjs",[[1,"lottery-draw-results",{"endpoint":[1],"gameId":[1,"game-id"],"language":[1],"playerId":[1,"player-id"],"drawMode":[4,"draw-mode"],"drawId":[1,"draw-id"],"gameName":[1,"game-name"],"multiplier":[32],"ticketData":[32],"isLoading":[32],"drawResults":[32],"rules":[32],"toggleDrawer":[32],"hasErrors":[32],"errorText":[32]}],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"numbers":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"]}]]]], options);
|
|
19
19
|
});
|
|
@@ -7,6 +7,19 @@
|
|
|
7
7
|
"version": "2.15.2",
|
|
8
8
|
"typescriptVersion": "4.5.4"
|
|
9
9
|
},
|
|
10
|
-
"collections": [
|
|
10
|
+
"collections": [
|
|
11
|
+
{
|
|
12
|
+
"name": "@everymatrix/lottery-bullet",
|
|
13
|
+
"tags": [
|
|
14
|
+
"lottery-bullet"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "@everymatrix/lottery-grid",
|
|
19
|
+
"tags": [
|
|
20
|
+
"lottery-grid"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
11
24
|
"bundles": []
|
|
12
25
|
}
|
|
@@ -14,13 +14,10 @@
|
|
|
14
14
|
font-size: 14px;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.DrawResultsArea {
|
|
18
|
-
margin-top: 15px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
17
|
.DrawResultsSection {
|
|
22
|
-
max-width:
|
|
23
|
-
margin:
|
|
18
|
+
max-width: 500px;
|
|
19
|
+
margin: 0 auto;
|
|
20
|
+
margin: 0px auto 10px;
|
|
24
21
|
border-radius: 4px;
|
|
25
22
|
}
|
|
26
23
|
|
|
@@ -31,13 +28,11 @@
|
|
|
31
28
|
background-color: #009993;
|
|
32
29
|
color: #fff;
|
|
33
30
|
font-size: 14px;
|
|
34
|
-
border-radius: 4px 4px 0 0;
|
|
35
31
|
}
|
|
36
32
|
.DrawResultsHeader h4 {
|
|
37
33
|
text-transform: uppercase;
|
|
38
34
|
font-weight: 400;
|
|
39
35
|
margin: 0;
|
|
40
|
-
padding-top: 15px;
|
|
41
36
|
}
|
|
42
37
|
|
|
43
38
|
.DrawMultipler label {
|
|
@@ -46,10 +41,7 @@
|
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
.DrawResultsBody {
|
|
49
|
-
padding:
|
|
50
|
-
margin-bottom: 5px;
|
|
51
|
-
border-radius: 0 0 4px 4px;
|
|
52
|
-
border: 1px solid #009993;
|
|
44
|
+
padding: 0 20px;
|
|
53
45
|
}
|
|
54
46
|
.DrawResultsBody .DrawNumbersGrid {
|
|
55
47
|
font-size: 14px;
|
|
@@ -123,24 +115,21 @@
|
|
|
123
115
|
}
|
|
124
116
|
|
|
125
117
|
.ExpandableBox {
|
|
126
|
-
line-height: 12px;
|
|
127
|
-
font-weight: lighter;
|
|
128
118
|
width: 100%;
|
|
129
119
|
height: 100%;
|
|
130
|
-
max-height:
|
|
120
|
+
max-height: 100px;
|
|
131
121
|
float: left;
|
|
132
122
|
margin: 0 0 20px 0;
|
|
133
|
-
border: 1px solid #
|
|
134
|
-
background: #fff;
|
|
123
|
+
border: 1px solid #009993;
|
|
135
124
|
border-radius: 4px;
|
|
136
125
|
padding: 10px;
|
|
126
|
+
box-sizing: border-box;
|
|
137
127
|
-webkit-transition: all 0.6s ease-in-out;
|
|
138
128
|
-moz-transition: all 0.6s ease-in-out;
|
|
139
129
|
-o-transition: all 0.6s ease-in-out;
|
|
140
130
|
-ms-transition: all 0.6s ease-in-out;
|
|
141
131
|
transition: all 0.6s ease-in-out;
|
|
142
132
|
overflow: hidden;
|
|
143
|
-
box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
|
|
144
133
|
}
|
|
145
134
|
|
|
146
135
|
.ExpandableBox.ShowBox {
|