@everymatrix/lottery-ticket 0.0.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-fc097c03.js → index-1a18a097.js} +12 -7
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/lottery-bullet_3.cjs.entry.js +365 -0
- package/dist/cjs/lottery-ticket.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +15 -2
- package/dist/collection/components/lottery-ticket/lottery-ticket.css +121 -7
- package/dist/collection/components/lottery-ticket/lottery-ticket.js +58 -17
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +0 -1
- package/dist/components/lottery-bullet.js +6 -0
- package/dist/components/lottery-bullet2.js +56 -0
- package/dist/components/lottery-grid.js +6 -0
- package/dist/components/lottery-grid2.js +196 -0
- package/dist/components/lottery-ticket.js +48 -12
- package/dist/esm/{index-84f8a38a.js → index-c436caae.js} +12 -7
- package/dist/esm/loader.js +3 -3
- package/dist/esm/lottery-bullet_3.entry.js +359 -0
- package/dist/esm/lottery-ticket.js +3 -3
- package/dist/lottery-ticket/lottery-ticket.esm.js +1 -1
- package/dist/lottery-ticket/p-91b1278e.js +1 -0
- package/dist/lottery-ticket/p-ec3208f7.entry.js +1 -0
- package/dist/types/components/lottery-ticket/lottery-ticket.d.ts +9 -1
- package/dist/types/components.d.ts +5 -9
- package/package.json +1 -1
- package/dist/cjs/lottery-ticket.cjs.entry.js +0 -147
- package/dist/esm/lottery-ticket.entry.js +0 -143
- package/dist/lottery-ticket/p-7ea3fc34.entry.js +0 -1
- package/dist/lottery-ticket/p-b69ccce7.js +0 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import '
|
|
2
|
+
import { d as defineCustomElement$3 } from './lottery-bullet2.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './lottery-grid2.js';
|
|
3
4
|
|
|
4
5
|
const DEFAULT_LANGUAGE = 'en';
|
|
5
6
|
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
@@ -30,7 +31,7 @@ const translate = (key, customLang) => {
|
|
|
30
31
|
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.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;
|
|
34
|
+
const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketTitle{font-size:16px;font-weight:bold}.ButtonContainer{display:flex;justify-content:flex-end}.Toggle{cursor:pointer;margin-top:20px;display:inline-block}.ToggleSwitch{display:inline-block;background:#707070;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #F1F1F1 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#00ABA4}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px;font-size:14px;font-weight:lighter;color:#000}input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.NumberInput,.WagerInput{margin-top:10px;display:inline-flex;align-items:center}.NumberInput,.NumberInput *{box-sizing:border-box}.NumberInput button{cursor:pointer;outline:none;-webkit-appearance:none;border:none;align-items:center;justify-content:center;height:20px;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);align-items:center;text-align:center}.NumberInput button.Plus:after{transform:translate(-50%, -50%) rotate(0deg);width:30px;display:inline-flex;align-items:center;text-align:center}.NumberInput input[type=number],.WagerInput input[type=number]{max-width:50px;display:inline-flex;align-items:center;padding:4px 10px;text-align:center}.NumberInput input[type=number] .WagerInputTitle,.WagerInput input[type=number] .WagerInputTitle{font-size:14px;color:#000;padding:10px}.InputDefault{background-color:#F1F1F1;border-radius:4px;padding:5px;border:solid 1px #D4D4D4;color:#707070}.AutoButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.AutoButton:active{background:#00958f;color:#FFF}.ResetButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ResetButton:hover{background:#FF6536;border:1px solid #FF3D00}.TicketGridBullets{background:#f1f1f1;border-radius:4px;padding:20px;margin-top:5px}.TicketGridBullets .TicketGridTitle{margin-top:0px}.Minus{border-radius:4px;width:30px;height:24px !important;margin-right:10px;color:#FFF;background:#009993}.Plus{border-radius:4px;width:30px;height:24px !important;margin-left:10px;color:#FFF;background:#009993}.SelectWrapper{width:auto;padding:5px;margin:0 auto;border:1px solid #ccc;border-radius:5px;position:relative}.SelectButton,.SelectOptions li{display:flex;align-items:center;cursor:pointer}.SelectButton{display:flex;padding:0 5px;border-radius:7px;align-items:center;justify-content:space-between;font-size:14px}.SelectButton span:first-child{padding-right:10px}.SelectExpand{transition:transform 0.3s linear;font-size:12px}.SelectActive .SelectExpand{transform:rotate(180deg)}.SelectContent{display:none;padding:5px;border-radius:7px}.SelectWrapper.SelectActive .SelectContent{width:100%;display:block;position:absolute;left:0;top:32px;padding:0;border:1px solid #ccc;overflow:hidden;background:#fff}.SelectContent .SelectOptions{max-height:100px;margin:0;overflow-y:auto;padding:0}.SelectContent .SelectOptions .SelectedValue{background-color:#009993;color:#fff}.SelectOptions::-webkit-scrollbar{width:7px}.SelectOptions::-webkit-scrollbar-track{background:#f1f1f1;border-radius:25px}.SelectOptions::-webkit-scrollbar-thumb{background:#ccc;border-radius:25px}.SelectOptions li{height:20px;padding:0 13px;font-size:14px}.SelectOptions li:hover{background:#f2f2f2}";
|
|
34
35
|
|
|
35
36
|
const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
36
37
|
constructor() {
|
|
@@ -67,6 +68,16 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
67
68
|
this.isLoading = true;
|
|
68
69
|
this.hasErrors = false;
|
|
69
70
|
this.ticketDone = false;
|
|
71
|
+
this.isCustomSelect = false;
|
|
72
|
+
this.amountInfo = {};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @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
|
|
76
|
+
*/
|
|
77
|
+
checkForClickOutside(ev) {
|
|
78
|
+
if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
|
|
79
|
+
this.isCustomSelect = false;
|
|
80
|
+
}
|
|
70
81
|
}
|
|
71
82
|
connectedCallback() {
|
|
72
83
|
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
@@ -84,6 +95,7 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
84
95
|
this.isLoading = false;
|
|
85
96
|
this.gameData = data;
|
|
86
97
|
this.grids = [...Array(data.rules.boards.length).keys()];
|
|
98
|
+
this.amountInfo = this.gameData.rules.stakes[0]; // initial value for select
|
|
87
99
|
})
|
|
88
100
|
.catch((err) => {
|
|
89
101
|
this.isLoading = false;
|
|
@@ -112,12 +124,23 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
112
124
|
this.ticketDone = false;
|
|
113
125
|
this.resetSelection.emit(this.ticketId);
|
|
114
126
|
}
|
|
115
|
-
changeStake(
|
|
127
|
+
changeStake(ticketid, amount) {
|
|
116
128
|
this.stakeChange.emit({
|
|
117
|
-
ticketId:
|
|
118
|
-
stake:
|
|
129
|
+
ticketId: ticketid,
|
|
130
|
+
stake: amount
|
|
119
131
|
});
|
|
120
132
|
}
|
|
133
|
+
toggleClass() {
|
|
134
|
+
this.isCustomSelect = !this.isCustomSelect;
|
|
135
|
+
}
|
|
136
|
+
setDropdownItem(item) {
|
|
137
|
+
this.amountInfo = {
|
|
138
|
+
amount: item.amount,
|
|
139
|
+
currency: item.currency
|
|
140
|
+
};
|
|
141
|
+
this.isCustomSelect = false;
|
|
142
|
+
this.changeStake(this.ticketId, item.amount);
|
|
143
|
+
}
|
|
121
144
|
render() {
|
|
122
145
|
if (this.isLoading) {
|
|
123
146
|
return (h("div", null, h("p", null, translate('loading', this.language))));
|
|
@@ -128,11 +151,12 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
128
151
|
}
|
|
129
152
|
else {
|
|
130
153
|
const { rules } = this.gameData;
|
|
131
|
-
return (h("div", { class: "TicketContainer" }, h("p",
|
|
132
|
-
h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language)), this.autoPick && !this.ticketDone &&
|
|
133
|
-
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 }))), rules.multiplier &&
|
|
154
|
+
return (h("div", { class: "TicketContainer" }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
|
|
155
|
+
h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
|
|
156
|
+
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 }))), rules.multiplier &&
|
|
134
157
|
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 &&
|
|
135
|
-
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("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
|
|
158
|
+
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 ?
|
|
159
|
+
(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)))))));
|
|
136
160
|
}
|
|
137
161
|
}
|
|
138
162
|
}
|
|
@@ -153,19 +177,31 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
153
177
|
"numberOfDraws": [32],
|
|
154
178
|
"isLoading": [32],
|
|
155
179
|
"hasErrors": [32],
|
|
156
|
-
"ticketDone": [32]
|
|
157
|
-
|
|
180
|
+
"ticketDone": [32],
|
|
181
|
+
"isCustomSelect": [32],
|
|
182
|
+
"amountInfo": [32]
|
|
183
|
+
}, [[8, "click", "checkForClickOutside"], [0, "gridFilled", "gridFilledHandler"]]]);
|
|
158
184
|
function defineCustomElement$1() {
|
|
159
185
|
if (typeof customElements === "undefined") {
|
|
160
186
|
return;
|
|
161
187
|
}
|
|
162
|
-
const components = ["lottery-ticket"];
|
|
188
|
+
const components = ["lottery-ticket", "lottery-bullet", "lottery-grid"];
|
|
163
189
|
components.forEach(tagName => { switch (tagName) {
|
|
164
190
|
case "lottery-ticket":
|
|
165
191
|
if (!customElements.get(tagName)) {
|
|
166
192
|
customElements.define(tagName, LotteryTicket$1);
|
|
167
193
|
}
|
|
168
194
|
break;
|
|
195
|
+
case "lottery-bullet":
|
|
196
|
+
if (!customElements.get(tagName)) {
|
|
197
|
+
defineCustomElement$3();
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
case "lottery-grid":
|
|
201
|
+
if (!customElements.get(tagName)) {
|
|
202
|
+
defineCustomElement$2();
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
169
205
|
} });
|
|
170
206
|
}
|
|
171
207
|
|
|
@@ -28,7 +28,7 @@ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
|
28
28
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
29
29
|
if (listeners) {
|
|
30
30
|
listeners.map(([flags, name, method]) => {
|
|
31
|
-
const target = elm;
|
|
31
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
32
32
|
const handler = hostListenerProxy(hostRef, method);
|
|
33
33
|
const opts = hostListenerOpts(flags);
|
|
34
34
|
plt.ael(target, name, handler, opts);
|
|
@@ -52,6 +52,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
52
52
|
consoleError(e);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
56
|
+
if (flags & 4 /* TargetDocument */)
|
|
57
|
+
return doc;
|
|
58
|
+
if (flags & 8 /* TargetWindow */)
|
|
59
|
+
return win;
|
|
60
|
+
return elm;
|
|
61
|
+
};
|
|
55
62
|
// prettier-ignore
|
|
56
63
|
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
57
64
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
@@ -83,7 +90,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
83
90
|
};
|
|
84
91
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
85
92
|
let scopeId = getScopeId(cmpMeta);
|
|
86
|
-
|
|
93
|
+
let style = styles.get(scopeId);
|
|
87
94
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
88
95
|
// so the fallback is to always use the document for the root node in those cases
|
|
89
96
|
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
@@ -163,7 +170,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
163
170
|
let child = null;
|
|
164
171
|
let simple = false;
|
|
165
172
|
let lastSimple = false;
|
|
166
|
-
|
|
173
|
+
let vNodeChildren = [];
|
|
167
174
|
const walk = (c) => {
|
|
168
175
|
for (let i = 0; i < c.length; i++) {
|
|
169
176
|
child = c[i];
|
|
@@ -286,7 +293,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
286
293
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
287
294
|
try {
|
|
288
295
|
if (!elm.tagName.includes('-')) {
|
|
289
|
-
|
|
296
|
+
let n = newValue == null ? '' : newValue;
|
|
290
297
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
291
298
|
if (memberName === 'list') {
|
|
292
299
|
isProp = false;
|
|
@@ -343,7 +350,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
343
350
|
};
|
|
344
351
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
345
352
|
// tslint:disable-next-line: prefer-const
|
|
346
|
-
|
|
353
|
+
let newVNode = newParentVNode.$children$[childIndex];
|
|
347
354
|
let i = 0;
|
|
348
355
|
let elm;
|
|
349
356
|
let childNode;
|
|
@@ -1164,9 +1171,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1164
1171
|
if (module) {
|
|
1165
1172
|
return module[exportName];
|
|
1166
1173
|
}
|
|
1167
|
-
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
1168
1174
|
return import(
|
|
1169
|
-
/* @vite-ignore */
|
|
1170
1175
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1171
1176
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1172
1177
|
/* webpackMode: "lazy" */
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-c436caae.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
|
-
Stencil Client Patch Esm v2.
|
|
4
|
+
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
5
5
|
*/
|
|
6
6
|
const patchEsm = () => {
|
|
7
7
|
return promiseResolve();
|
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["lottery-
|
|
13
|
+
return bootstrapLazy([["lottery-bullet_3",[[1,"lottery-ticket",{"endpoint":[1],"gameId":[1,"game-id"],"numberOfGrids":[2,"number-of-grids"],"multipleDraws":[4,"multiple-draws"],"ticketId":[2,"ticket-id"],"resetButton":[4,"reset-button"],"autoPick":[4,"auto-pick"],"language":[1],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[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);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-c436caae.js';
|
|
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 = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
|
|
9
|
+
/**
|
|
10
|
+
* Value of the bullet
|
|
11
|
+
*/
|
|
12
|
+
this.value = '0';
|
|
13
|
+
/**
|
|
14
|
+
* Marks if the bullet should be selectable
|
|
15
|
+
*/
|
|
16
|
+
this.selectable = true;
|
|
17
|
+
/**
|
|
18
|
+
* Marks if the bullet should be selected
|
|
19
|
+
*/
|
|
20
|
+
this.isSelected = false;
|
|
21
|
+
this.select = () => {
|
|
22
|
+
if (this.selectable) {
|
|
23
|
+
this.isSelected = !this.isSelected;
|
|
24
|
+
this.bulletEvent.emit({
|
|
25
|
+
value: this.value,
|
|
26
|
+
selected: this.isSelected
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
LotteryBullet.style = lotteryBulletCss;
|
|
36
|
+
|
|
37
|
+
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:25px}";
|
|
38
|
+
|
|
39
|
+
const LotteryGrid = class {
|
|
40
|
+
constructor(hostRef) {
|
|
41
|
+
registerInstance(this, hostRef);
|
|
42
|
+
this.gridFilledEvent = createEvent(this, "gridFilled", 7);
|
|
43
|
+
this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
|
|
44
|
+
/**
|
|
45
|
+
* Number of bullets of grid
|
|
46
|
+
*/
|
|
47
|
+
this.totalNumbers = 0;
|
|
48
|
+
/**
|
|
49
|
+
* Number of maximum bullets that can be selected
|
|
50
|
+
*/
|
|
51
|
+
this.maximumAllowed = 0;
|
|
52
|
+
/**
|
|
53
|
+
* Minimum allowed of bullets
|
|
54
|
+
*/
|
|
55
|
+
this.minimumAllowed = 1;
|
|
56
|
+
/**
|
|
57
|
+
* Allows the user to select numbers on the grid
|
|
58
|
+
*/
|
|
59
|
+
this.selectable = true;
|
|
60
|
+
/**
|
|
61
|
+
* Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
|
|
62
|
+
*/
|
|
63
|
+
this.selectedNumbers = '';
|
|
64
|
+
/**
|
|
65
|
+
* Show only selected numbers
|
|
66
|
+
*/
|
|
67
|
+
this.displaySelected = false;
|
|
68
|
+
/**
|
|
69
|
+
* Language
|
|
70
|
+
*/
|
|
71
|
+
this.language = 'en';
|
|
72
|
+
this.numbers = [];
|
|
73
|
+
this.selectedCounter = 0;
|
|
74
|
+
}
|
|
75
|
+
connectedCallback() {
|
|
76
|
+
let selected = [];
|
|
77
|
+
if (this.selectedNumbers.length > 0) {
|
|
78
|
+
selected = this.selectedNumbers.split(',');
|
|
79
|
+
this.selectedCounter = selected.length;
|
|
80
|
+
}
|
|
81
|
+
if (this.displaySelected) {
|
|
82
|
+
selected.forEach((item) => {
|
|
83
|
+
this.numbers.push({
|
|
84
|
+
number: item,
|
|
85
|
+
selected: true,
|
|
86
|
+
selectable: this.selectable
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
[...Array(this.totalNumbers).keys()]
|
|
92
|
+
.map(number => (number + 1).toString())
|
|
93
|
+
.forEach((number) => {
|
|
94
|
+
this.numbers.push({
|
|
95
|
+
number,
|
|
96
|
+
selected: selected.indexOf(number) >= 0 ? true : false,
|
|
97
|
+
selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
lotteryBulletSelectionHandler(event) {
|
|
103
|
+
this.numbers = this.numbers.map((item) => {
|
|
104
|
+
if (item.number == event.detail.value) {
|
|
105
|
+
return {
|
|
106
|
+
number: item.number,
|
|
107
|
+
selected: event.detail.selected,
|
|
108
|
+
selectable: item.selectable
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
number: item.number,
|
|
113
|
+
selected: item.selected,
|
|
114
|
+
selectable: item.selectable
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
if (event.detail.selected) {
|
|
118
|
+
this.selectedCounter += 1;
|
|
119
|
+
if (this.selectedCounter == this.maximumAllowed) {
|
|
120
|
+
this.numbers = this.numbers.map((item) => {
|
|
121
|
+
return {
|
|
122
|
+
number: item.number,
|
|
123
|
+
selected: item.selected,
|
|
124
|
+
selectable: item.selected ? true : false
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
this.gridFilledEvent.emit({
|
|
128
|
+
id: this.ticketId,
|
|
129
|
+
index: this.gridIndex,
|
|
130
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
if (this.selectedCounter == this.maximumAllowed) {
|
|
136
|
+
this.numbers = this.numbers.map((item) => {
|
|
137
|
+
return {
|
|
138
|
+
number: item.number,
|
|
139
|
+
selected: item.selected,
|
|
140
|
+
selectable: true
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
this.gridDirtyEvent.emit({
|
|
144
|
+
id: this.ticketId,
|
|
145
|
+
index: this.gridIndex,
|
|
146
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
this.selectedCounter -= 1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async resetSelectionHandler(event) {
|
|
153
|
+
if (event.detail && event.detail == this.ticketId) {
|
|
154
|
+
this.selectedCounter = 0;
|
|
155
|
+
this.numbers = this.numbers.map((item) => {
|
|
156
|
+
return {
|
|
157
|
+
number: item.number,
|
|
158
|
+
selected: false,
|
|
159
|
+
selectable: this.selectable
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
this.gridDirtyEvent.emit({
|
|
163
|
+
id: this.ticketId,
|
|
164
|
+
index: this.gridIndex,
|
|
165
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async autoSelectionHandler(event) {
|
|
170
|
+
if (event.detail && event.detail == this.ticketId) {
|
|
171
|
+
this.resetSelectionHandler(event);
|
|
172
|
+
let array = [...Array(this.totalNumbers).keys()]
|
|
173
|
+
.map(number => number + 1)
|
|
174
|
+
.sort(() => 0.5 - Math.random());
|
|
175
|
+
array = array.slice(0, this.minimumAllowed);
|
|
176
|
+
this.numbers = this.numbers.map((item) => {
|
|
177
|
+
return {
|
|
178
|
+
number: item.number,
|
|
179
|
+
selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
|
|
180
|
+
selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
this.gridFilledEvent.emit({
|
|
184
|
+
id: this.ticketId,
|
|
185
|
+
index: this.gridIndex,
|
|
186
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
187
|
+
});
|
|
188
|
+
this.selectedCounter = this.maximumAllowed;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
render() {
|
|
192
|
+
return (h("div", { class: "GridContainer" }, h("div", { class: "Grid" }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected }))))));
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
LotteryGrid.style = lotteryGridCss;
|
|
196
|
+
|
|
197
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
198
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
199
|
+
const TRANSLATIONS = {
|
|
200
|
+
en: {
|
|
201
|
+
loading: 'Loading, please wait ...',
|
|
202
|
+
error: 'It was an error while trying to fetch the data',
|
|
203
|
+
grid: 'Grid',
|
|
204
|
+
multiplier: 'Multiplier',
|
|
205
|
+
numberOfDraws: 'Number of draws',
|
|
206
|
+
wagerPerDraw: 'Wager per draw',
|
|
207
|
+
resetButton: 'Reset',
|
|
208
|
+
autoButton: 'I feel lucky'
|
|
209
|
+
},
|
|
210
|
+
ro: {
|
|
211
|
+
loading: 'Se incarca, va rugam asteptati ...',
|
|
212
|
+
error: 'A fost o eroare in timp ce asteptam datele',
|
|
213
|
+
grid: 'Grid',
|
|
214
|
+
multiplier: 'Multiplicator',
|
|
215
|
+
numberOfDraws: 'Numarul de extrageri',
|
|
216
|
+
wagerPerDraw: 'Pariul per extragere',
|
|
217
|
+
resetButton: 'Reseteaza',
|
|
218
|
+
autoButton: 'Ma simt norocos'
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
const translate = (key, customLang) => {
|
|
222
|
+
const lang = customLang;
|
|
223
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
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}";
|
|
227
|
+
|
|
228
|
+
const LotteryTicket = class {
|
|
229
|
+
constructor(hostRef) {
|
|
230
|
+
registerInstance(this, hostRef);
|
|
231
|
+
this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
|
|
232
|
+
this.autoSelection = createEvent(this, "autoSelection", 7);
|
|
233
|
+
this.resetSelection = createEvent(this, "resetSelection", 7);
|
|
234
|
+
this.stakeChange = createEvent(this, "stakeChange", 7);
|
|
235
|
+
this.multiplierChange = createEvent(this, "multiplierChange", 7);
|
|
236
|
+
/**
|
|
237
|
+
* Number of grids of a ticket
|
|
238
|
+
*/
|
|
239
|
+
this.numberOfGrids = 1;
|
|
240
|
+
/**
|
|
241
|
+
* Option to have the ticket registered for multiple draws
|
|
242
|
+
*/
|
|
243
|
+
this.multipleDraws = true;
|
|
244
|
+
/**
|
|
245
|
+
* Shows the reset button
|
|
246
|
+
*/
|
|
247
|
+
this.resetButton = false;
|
|
248
|
+
/**
|
|
249
|
+
* Shows the auto-pick button
|
|
250
|
+
*/
|
|
251
|
+
this.autoPick = false;
|
|
252
|
+
/**
|
|
253
|
+
* Language
|
|
254
|
+
*/
|
|
255
|
+
this.language = 'en';
|
|
256
|
+
this.multiplier = false;
|
|
257
|
+
this.numberOfDraws = 1;
|
|
258
|
+
this.isLoading = true;
|
|
259
|
+
this.hasErrors = false;
|
|
260
|
+
this.ticketDone = false;
|
|
261
|
+
this.isCustomSelect = false;
|
|
262
|
+
this.amountInfo = {};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @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
|
|
266
|
+
*/
|
|
267
|
+
checkForClickOutside(ev) {
|
|
268
|
+
if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
|
|
269
|
+
this.isCustomSelect = false;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
connectedCallback() {
|
|
273
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
274
|
+
fetch(url.href)
|
|
275
|
+
.then((response) => {
|
|
276
|
+
if (response.ok) {
|
|
277
|
+
return response.json();
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
// Throw error
|
|
281
|
+
this.hasErrors = true;
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
.then((data) => {
|
|
285
|
+
this.isLoading = false;
|
|
286
|
+
this.gameData = data;
|
|
287
|
+
this.grids = [...Array(data.rules.boards.length).keys()];
|
|
288
|
+
this.amountInfo = this.gameData.rules.stakes[0]; // initial value for select
|
|
289
|
+
})
|
|
290
|
+
.catch((err) => {
|
|
291
|
+
this.isLoading = false;
|
|
292
|
+
this.hasErrors = true;
|
|
293
|
+
console.error('Error!', err);
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
multiplierChangeHandler(e) {
|
|
297
|
+
this.multiplier = e.target ? e.target.checked : false;
|
|
298
|
+
this.multiplierChange.emit(this.multiplier);
|
|
299
|
+
}
|
|
300
|
+
drawsChangeHandler(event) {
|
|
301
|
+
this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
|
|
302
|
+
this.ticketCompleted.emit(this.ticket);
|
|
303
|
+
}
|
|
304
|
+
gridFilledHandler(event) {
|
|
305
|
+
this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
|
|
306
|
+
this.ticketDone = true;
|
|
307
|
+
this.ticketCompleted.emit(this.ticket);
|
|
308
|
+
}
|
|
309
|
+
toggleAutoSelection() {
|
|
310
|
+
this.ticketDone = true;
|
|
311
|
+
this.autoSelection.emit(this.ticketId);
|
|
312
|
+
}
|
|
313
|
+
toggleResetSelection() {
|
|
314
|
+
this.ticketDone = false;
|
|
315
|
+
this.resetSelection.emit(this.ticketId);
|
|
316
|
+
}
|
|
317
|
+
changeStake(ticketid, amount) {
|
|
318
|
+
this.stakeChange.emit({
|
|
319
|
+
ticketId: ticketid,
|
|
320
|
+
stake: amount
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
toggleClass() {
|
|
324
|
+
this.isCustomSelect = !this.isCustomSelect;
|
|
325
|
+
}
|
|
326
|
+
setDropdownItem(item) {
|
|
327
|
+
this.amountInfo = {
|
|
328
|
+
amount: item.amount,
|
|
329
|
+
currency: item.currency
|
|
330
|
+
};
|
|
331
|
+
this.isCustomSelect = false;
|
|
332
|
+
this.changeStake(this.ticketId, item.amount);
|
|
333
|
+
}
|
|
334
|
+
render() {
|
|
335
|
+
if (this.isLoading) {
|
|
336
|
+
return (h("div", null, h("p", null, translate('loading', this.language))));
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
if (this.hasErrors) {
|
|
340
|
+
return (h("div", null, h("p", null, translate('error', this.language))));
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
const { rules } = this.gameData;
|
|
344
|
+
return (h("div", { class: "TicketContainer" }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
|
|
345
|
+
h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
|
|
346
|
+
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 }))), rules.multiplier &&
|
|
347
|
+
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 &&
|
|
348
|
+
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 ?
|
|
349
|
+
(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)))))));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
static get watchers() { return {
|
|
354
|
+
"numberOfDraws": ["drawsChangeHandler"]
|
|
355
|
+
}; }
|
|
356
|
+
};
|
|
357
|
+
LotteryTicket.style = lotteryTicketCss;
|
|
358
|
+
|
|
359
|
+
export { LotteryBullet as lottery_bullet, LotteryGrid as lottery_grid, LotteryTicket as lottery_ticket };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-c436caae.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
|
-
Stencil Client Patch Browser v2.
|
|
4
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
5
5
|
*/
|
|
6
6
|
const patchBrowser = () => {
|
|
7
7
|
const importMeta = import.meta.url;
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["lottery-
|
|
16
|
+
return bootstrapLazy([["lottery-bullet_3",[[1,"lottery-ticket",{"endpoint":[1],"gameId":[1,"game-id"],"numberOfGrids":[2,"number-of-grids"],"multipleDraws":[4,"multiple-draws"],"ticketId":[2,"ticket-id"],"resetButton":[4,"reset-button"],"autoPick":[4,"auto-pick"],"language":[1],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[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);
|
|
17
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-
|
|
1
|
+
import{p as e,b as t}from"./p-91b1278e.js";(()=>{const t=import.meta.url,l={};return""!==t&&(l.resourcesUrl=new URL(".",t).href),e(l)})().then((e=>t([["p-ec3208f7",[[1,"lottery-ticket",{endpoint:[1],gameId:[1,"game-id"],numberOfGrids:[2,"number-of-grids"],multipleDraws:[4,"multiple-draws"],ticketId:[2,"ticket-id"],resetButton:[4,"reset-button"],autoPick:[4,"auto-pick"],language:[1],multiplier:[32],numberOfDraws:[32],isLoading:[32],hasErrors:[32],ticketDone:[32],isCustomSelect:[32],amountInfo:[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[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"]}]]]],e)));
|