@everymatrix/lottery-game-page 0.0.7 → 0.0.8
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/helper-accordion_13.cjs.entry.js +23492 -0
- package/dist/cjs/helper-pagination.cjs.entry.js +188 -0
- package/dist/cjs/{index-af6d701d.js → index-81cb3b3b.js} +70 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/lottery-game-page.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +75 -1
- package/dist/components/helper-accordion.js +6 -0
- package/dist/components/helper-accordion2.js +110 -0
- package/dist/components/helper-filters.js +6 -0
- package/dist/components/helper-filters2.js +22347 -0
- package/dist/components/helper-modal.js +6 -0
- package/dist/components/helper-modal2.js +58 -0
- package/dist/components/helper-pagination.js +215 -0
- package/dist/components/helper-tab.js +6 -0
- package/dist/components/helper-tab2.js +47 -0
- package/dist/components/helper-tabs.js +6 -0
- package/dist/components/helper-tabs2.js +62 -0
- package/dist/components/index.js +13 -0
- package/dist/components/lottery-bullet.js +6 -0
- package/dist/components/lottery-bullet2.js +56 -0
- package/dist/components/lottery-draw-results-history.js +6 -0
- package/dist/components/lottery-draw-results-history2.js +174 -0
- package/dist/components/lottery-draw-results.js +6 -0
- package/dist/components/lottery-draw-results2.js +217 -0
- package/dist/components/lottery-game-details.js +6 -0
- package/dist/components/lottery-game-details2.js +48 -0
- package/dist/components/lottery-game-page.js +73 -6
- package/dist/components/lottery-grid.js +6 -0
- package/dist/components/lottery-grid2.js +196 -0
- package/dist/components/lottery-ticket-controller.js +6 -0
- package/dist/components/lottery-ticket-controller2.js +117 -0
- package/dist/components/lottery-ticket.js +6 -0
- package/dist/components/lottery-ticket2.js +183 -0
- package/dist/esm/helper-accordion_13.entry.js +23476 -0
- package/dist/esm/helper-pagination.entry.js +184 -0
- package/dist/esm/{index-8c700c5e.js → index-be84da79.js} +70 -3
- package/dist/esm/loader.js +2 -2
- package/dist/esm/lottery-game-page.js +2 -2
- package/dist/lottery-game-page/lottery-game-page.esm.js +1 -1
- package/dist/lottery-game-page/p-08581ede.entry.js +1 -0
- package/dist/lottery-game-page/p-49bd2864.entry.js +2849 -0
- package/dist/lottery-game-page/p-91420518.js +2 -0
- package/package.json +1 -1
- package/dist/cjs/lottery-game-page.cjs.entry.js +0 -304
- package/dist/esm/lottery-game-page.entry.js +0 -300
- package/dist/lottery-game-page/p-453db7fa.entry.js +0 -1
- package/dist/lottery-game-page/p-b5969eab.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=(e,t,n)=>{n&&n.map((([n,l,s])=>{const c=u(e,n),r=a(t,s),i=f(n);o.ael(c,l,r,i),(t.o=t.o||[]).push((()=>o.rel(c,l,r,i)))}))},a=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){K(e)}},u=(e,t)=>4&t?s:e,f=e=>0!=(2&e),d=new WeakMap,h=e=>"sc-"+e.h,y={},$=e=>"object"==(e=typeof e)||"function"===e,m=(e,t,...n)=>{let l=null,s=!1,o=!1;const c=[],r=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!$(l))&&(l+=""),s&&o?c[c.length-1].$+=l:c.push(s?p(null,l):l),o=s)};if(r(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=p(e,null);return i.m=t,c.length>0&&(i.p=c),i},p=(e,t)=>({t:0,g:e,$:t,S:null,p:null,m:null}),b={},w=(e,t,n,s,c,r)=>{if(n!==s){let i=J(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,l=S(n),o=S(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if(i||"o"!==t[0]||"n"!==t[1]){const l=$(s);if((i||l&&null!==s)&&!c)try{if(e.tagName.includes("-"))e[t]=s;else{const l=null==s?"":s;"list"===t?i=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||c)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):J(l,a)?a.slice(2):a[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},g=/\s/,S=e=>e?e.split(g):[],j=(e,t,n,l)=>{const s=11===t.S.nodeType&&t.S.host?t.S.host:t.S,o=e&&e.m||y,c=t.m||y;for(l in o)l in c||w(s,l,o[l],void 0,n,t.t);for(l in c)w(s,l,o[l],c[l],n,t.t)},k=(t,n,l)=>{const o=n.p[l];let c,r,i=0;if(null!==o.$)c=o.S=s.createTextNode(o.$);else if(c=o.S=s.createElement(o.g),j(null,o,!1),null!=e&&c["s-si"]!==e&&c.classList.add(c["s-si"]=e),o.p)for(i=0;i<o.p.length;++i)r=k(t,o,i),r&&c.appendChild(r);return c},v=(e,n,l,s,o,c)=>{let r,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=c;++o)s[o]&&(r=k(null,l,o),r&&(s[o].S=r,i.insertBefore(r,n)))},C=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.S.remove()},M=(e,t)=>e.g===t.g,O=(e,t)=>{const n=t.S=e.S,l=e.p,s=t.p,o=t.$;null===o?("slot"===t.g||j(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,c=0,r=t.length-1,i=t[0],a=t[r],u=l.length-1,f=l[0],d=l[u];for(;o<=r&&c<=u;)null==i?i=t[++o]:null==a?a=t[--r]:null==f?f=l[++c]:null==d?d=l[--u]:M(i,f)?(O(i,f),i=t[++o],f=l[++c]):M(a,d)?(O(a,d),a=t[--r],d=l[--u]):M(i,d)?(O(i,d),e.insertBefore(i.S,a.S.nextSibling),i=t[++o],d=l[--u]):M(a,f)?(O(a,f),e.insertBefore(a.S,i.S),a=t[--r],f=l[++c]):(s=k(t&&t[c],n,c),f=l[++c],s&&i.S.parentNode.insertBefore(s,i.S));o>r?v(e,null==l[u+1]?null:l[u+1].S,n,l,c,u):c>u&&C(t,o,r)})(n,l,t,s):null!==s?(null!==e.$&&(n.textContent=""),v(n,null,t,s,0,s.length-1)):null!==l&&C(l,0,l.length-1)):e.$!==o&&(n.data=o)},P=e=>D(e).j,x=(e,t,n)=>{const l=P(e);return{emit:e=>E(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},E=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},N=(e,t)=>{t&&!e.k&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.k=t)))},R=(e,t)=>{if(e.t|=16,!(4&e.t))return N(e,e.v),oe((()=>T(e,t)));e.t|=512},T=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>U(n,e,t))),e.u=null)),l=q(l,(()=>U(n,"componentWillRender"))),q(l,(()=>W(e,n,t)))},W=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.C,n=e.j,l=t.t,o=((e,t)=>{let n=h(t);const l=Y.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=d.get(e=e.head||e);o||d.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);A(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>F(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},A=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.C,c=n.M||p(null,null),r=(e=>e&&e.g===b)(l)?l:m(null,null,l);t=s.tagName,o.O&&(r.m=r.m||{},o.O.map((([e,t])=>r.m[t]=s[e]))),r.g=null,r.t|=4,n.M=r,r.S=c.S=s.shadowRoot||s,e=s["s-sc"],O(c,r)})(n,l)}catch(e){K(e,n.j)}return null},F=e=>{const t=e.j,n=e.v;64&e.t||(e.t|=64,H(t),e.P(t),n||L()),e.k&&(e.k(),e.k=void 0),512&e.t&&se((()=>R(e,!1))),e.t&=-517},L=()=>{H(s.documentElement),se((()=>E(l,"appload",{detail:{namespace:"lottery-game-page"}})))},U=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){K(e)}},q=(e,t)=>e&&e.then?e.then(t):t(),H=e=>e.classList.add("hydrated"),V=(e,t,n)=>{if(t.N){e.watchers&&(t.R=e.watchers);const l=Object.entries(t.N),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>D(this).T.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=D(e),o=s.j,c=s.T.get(t),r=s.t,i=s.i;if(n=((e,t)=>null==e||$(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.N[t][0]),(!(8&r)||void 0===c)&&n!==c&&(!Number.isNaN(c)||!Number.isNaN(n))&&(s.T.set(t,n),i)){if(l.R&&128&r){const e=l.R[t];e&&e.map((e=>{try{i[e](n,c,t)}catch(e){K(e,o)}}))}2==(18&r)&&R(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){o.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(s.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.O.push([e,s]),s}))}}return e},_=e=>{U(e,"connectedCallback")},z=(e,t={})=>{const n=[],c=t.exclude||[],a=l.customElements,u=s.head,f=u.querySelector("meta[charset]"),d=s.createElement("style"),y=[];let $,m=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],h:t[1],N:t[2],W:t[3]};l.N=t[2],l.W=t[3],l.O=[],l.R={};const s=l.h,u=class extends HTMLElement{constructor(e){super(e),I(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){$&&(clearTimeout($),$=null),m?y.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=D(e),n=t.C,l=()=>{};if(1&t.t)i(e,t,n.W),_(t.i);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){N(t,t.v=n);break}}n.N&&Object.entries(n.N).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=X(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.R=s.watchers,V(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){K(e)}t.t&=-9,t.t|=128,e(),_(t.i)}if(s.style){let e=s.style;const t=h(n);if(!Y.has(t)){const l=()=>{};((e,t,n)=>{let l=Y.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,Y.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.v,c=()=>R(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=D(this),t=e.i;e.o&&(e.o.map((e=>e())),e.o=void 0),U(t,"disconnectedCallback")}})()))}componentOnReady(){return D(this).A}};l.F=e[0],c.includes(s)||a.get(s)||(n.push(s),a.define(s,V(u,l,1)))}))})),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),u.insertBefore(d,f?f.nextSibling:u.firstChild),m=!1,y.length?y.map((e=>e.connectedCallback())):o.jmp((()=>$=setTimeout(L,30)))},B=new WeakMap,D=e=>B.get(e),G=(e,t)=>B.set(t.i=e,t),I=(e,t)=>{const n={t:0,j:e,C:t,T:new Map};return n.A=new Promise((e=>n.P=e)),e["s-p"]=[],e["s-rc"]=[],i(e,n,t.W),B.set(e,n)},J=(e,t)=>t in e,K=(e,t)=>(0,console.error)(e,t),Q=new Map,X=e=>{const t=e.h.replace(/-/g,"_"),n=e.F,l=Q.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(Q.set(n,e),e[t])),K)
|
|
2
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},Y=new Map,Z=[],ee=[],te=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?se(le):o.raf(le))},ne=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){K(e)}e.length=0},le=()=>{ne(Z),ne(ee),(n=Z.length>0)&&o.raf(le)},se=e=>c().then(e),oe=te(ee,!0);export{z as b,x as c,P as g,m as h,c as p,G as r}
|
package/package.json
CHANGED
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-af6d701d.js');
|
|
6
|
-
require('@everymatrix/lottery-ticket-controller');
|
|
7
|
-
require('@everymatrix/helper-modal');
|
|
8
|
-
require('@everymatrix/lottery-game-details');
|
|
9
|
-
require('@everymatrix/lottery-draw-results-history');
|
|
10
|
-
require('@everymatrix/lottery-draw-results');
|
|
11
|
-
|
|
12
|
-
const DEFAULT_LANGUAGE = 'en';
|
|
13
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
14
|
-
const TRANSLATIONS = {
|
|
15
|
-
en: {
|
|
16
|
-
error: 'Error',
|
|
17
|
-
title: 'Chrono',
|
|
18
|
-
backButton: 'Back',
|
|
19
|
-
lobbyButton: 'Lobby',
|
|
20
|
-
prize: 'Prize',
|
|
21
|
-
winUpTo: 'Win up to',
|
|
22
|
-
nextDraw: 'Next draw in: ',
|
|
23
|
-
buy: 'Buy tickets',
|
|
24
|
-
viewLatest: 'View latest results',
|
|
25
|
-
createTicket: 'Create Ticket',
|
|
26
|
-
modalSuccess: 'Purchase will be successfull soon!',
|
|
27
|
-
deleteTicketModalTitle: 'Delete Ticket',
|
|
28
|
-
deleteTicketModalText: 'Are you sure you want to delete this ticket?',
|
|
29
|
-
deleteTicketModalCancel: 'Cancel',
|
|
30
|
-
deleteTicketModalConfirm: 'Delete',
|
|
31
|
-
orderSummaryTitle: 'Order Summary',
|
|
32
|
-
orderSummaryTickets: 'Ticket',
|
|
33
|
-
orderSummaryTotal: 'Total',
|
|
34
|
-
orderSummarySubmit: 'Submit'
|
|
35
|
-
},
|
|
36
|
-
ro: {
|
|
37
|
-
error: 'Eroare',
|
|
38
|
-
title: 'Loto 6/49',
|
|
39
|
-
backButton: 'Inapoi',
|
|
40
|
-
lobbyButton: 'Lobby',
|
|
41
|
-
prize: 'MARELE JACKPOT OMG',
|
|
42
|
-
winUpTo: 'Castiga pana la',
|
|
43
|
-
nextDraw: 'In cat timp devii milionar daca cumperi acum!!!',
|
|
44
|
-
buy: 'Cumpara bilet',
|
|
45
|
-
viewLatest: 'Ultimile extrageri',
|
|
46
|
-
createTicket: 'Creeaza bilet',
|
|
47
|
-
modalSuccess: 'Achiziția va avea succes în curând!',
|
|
48
|
-
deleteTicketModalTitle: 'Sterge biletul',
|
|
49
|
-
deleteTicketModalText: 'Esti sigur ca vrei sa stergi acest bilet?',
|
|
50
|
-
deleteTicketModalCancel: 'Anuleaza',
|
|
51
|
-
deleteTicketModalConfirm: 'Sterge',
|
|
52
|
-
orderSummaryTitle: 'Rezumat comanda',
|
|
53
|
-
orderSummaryTickets: 'Bilet',
|
|
54
|
-
orderSummaryTotal: 'Total',
|
|
55
|
-
orderSummarySubmit: 'Trimite'
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
const translate = (key, customLang) => {
|
|
59
|
-
const lang = customLang;
|
|
60
|
-
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const lotteryGamePageCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GamePage .GridBanner{background-color:#009993;background-repeat:no-repeat;background-position:center;color:#111;padding:0 20px 10px;height:220px;display:flex;flex-direction:column;justify-content:space-between}.GamePage .GridBanner .BannerButtonsWrapper{display:flex;justify-content:space-between;padding-top:16px}.GamePage .GridBanner .BannerButtonsWrapper .BannerBackButton,.GamePage .GridBanner .BannerButtonsWrapper .BannerLobbyButton{background:#fff;border:1px solid #D4D4D4;border-radius:4px;padding:7px 15px;font-size:12px;text-transform:uppercase;width:80px}.GamePage .GridBanner .GridBannerArea{padding-top:30px;display:flex;flex-direction:column;align-items:center}.GamePage .TotalWinnings{color:#00958f;font-size:18px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px}.GamePage .TotalWinnings span{font-size:22px;font-weight:700}.GamePage .NextDraw{color:#00958f;font-size:24px;font-weight:600;margin:0 auto;text-align:center;text-transform:capitalize;display:flex;justify-content:center;align-items:center;flex-direction:column}.GamePage .NextDraw .BannerText{font-weight:400;font-size:18px}.GamePage .NextDraw .BannerCountdown{font-size:22px;color:#00958f;display:flex;gap:20px}.GamePage .Tabs{display:flex;justify-content:center;gap:10px}.GamePage .Tabs .TabButton{border-radius:4px;cursor:pointer;padding:8px 0;width:50%;max-width:200px;border:1px solid #00958f;background:#F1F1F1;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.GamePage .Tabs .TabButton.Active{background:#00958f;color:#FFF}.NextDrawWrapper{padding:10px 15px;background:#fff}.NextDrawWrapper .BannerText{font-size:16px;font-weight:700;text-align:center}.NextDrawWrapper .BannerCountdown{font-size:22px;display:flex;gap:8px;color:#009993;font-weight:bolder;justify-content:center}.GamePageContent{padding:10px 15px;max-width:1200px;margin:0 auto}.GameDetails{padding-bottom:10px;margin-bottom:20px;border-bottom:1px solid #e9e9e9}.CreateNewTicket{background:#004D4A;height:100px;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.CreateNewTicket button{cursor:pointer;display:inline-block;border-radius:50%;width:40px;height:40px;margin:5px;border:1px solid #FFF;background:#FFF;color:#004D4A;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.CreateNewTicket button:hover{background:#F1F1F1}.CreateNewTicket span{display:inline-block;font-size:12px;text-align:center;margin:0 auto;color:#FFF}.OrderSummary{min-width:200px;border-radius:4px;display:flex;flex-direction:column;justify-content:center;margin-top:20px;background:#fff}.OrderSummary .OrderSummaryTitle{font-size:16px;color:#009993;text-transform:uppercase;text-align:center}.OrderSummary .Ticket{display:inline-block;color:#000;font-size:14px;height:50px;border-bottom:solid 1px #D4D4D4;line-height:50px}.OrderSummary .Ticket span{text-align:right}.OrderSummary .Total{display:inline-block;color:#000;font-size:14px;height:50px;line-height:50px}.OrderSummary .Total span{text-align:right}.ButtonWrapper{display:flex;align-items:center;justify-content:center}.ButtonWrapper .Button{cursor:pointer;border-radius:4px;padding:8px 60px;width:max-content;margin:5px;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#009993;border:1px solid #009993;color:#FFF}.ButtonWrapper .Button:hover{background:#00ABA4}.SubmitModalSuccess{text-align:center;font-size:18px;padding:20px}.DeleteTicketModalWrapper{padding:20px;text-align:center}.DeleteTicketModalWrapper .DeleteTicketModalTitle{font-size:16px;color:#00958f;font-weight:400;text-transform:uppercase;margin:20px 0 40px}.DeleteTicketModalWrapper .DeleteTicketModalText{font-size:14px;color:#000;line-height:22px;margin-bottom:40px}.DeleteTicketModalWrapper .DeleteTicketModalButtons{display:flex;gap:10px;justify-content:center}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm{cursor:pointer;border-radius:4px;padding:8px 25px;width:max-content;margin:5px;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}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm:hover{background:#FF6536;border:1px solid #FF3D00}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel{cursor:pointer;width:max-content;border-radius:4px;padding:10px 25px;margin:5px;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}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel:hover{background:#F1F1F1}@media (min-width: 1200px){.GamePageContent .TicketsWrapper{float:left;width:49%}.GamePageContent .GameDetails{float:right;width:49%}.GamePageContent .OrderSummary{float:right;width:49%}}";
|
|
64
|
-
|
|
65
|
-
const LotteryGamePage = class {
|
|
66
|
-
constructor(hostRef) {
|
|
67
|
-
index.registerInstance(this, hostRef);
|
|
68
|
-
/**
|
|
69
|
-
* Language of the widget
|
|
70
|
-
*/
|
|
71
|
-
this.language = 'en';
|
|
72
|
-
/**
|
|
73
|
-
* Shows the auto-pick button
|
|
74
|
-
*/
|
|
75
|
-
this.autoPick = false;
|
|
76
|
-
/**
|
|
77
|
-
* Shows the reset button
|
|
78
|
-
*/
|
|
79
|
-
this.resetButton = false;
|
|
80
|
-
this.tickets = [];
|
|
81
|
-
this.tabIndex = 0;
|
|
82
|
-
this.hasErrors = false;
|
|
83
|
-
this.totalAmount = 0;
|
|
84
|
-
this.successVisible = false;
|
|
85
|
-
this.deleteVisible = false;
|
|
86
|
-
this.latestDraw = {};
|
|
87
|
-
this.totalWinningsAmount = 0;
|
|
88
|
-
this.multiplier = false;
|
|
89
|
-
this.quickPick = false;
|
|
90
|
-
}
|
|
91
|
-
// @TODO fix `any` type later, I'm lazy now
|
|
92
|
-
connectedCallback() {
|
|
93
|
-
this.getGameDetails();
|
|
94
|
-
this.getDraws();
|
|
95
|
-
}
|
|
96
|
-
countdownLogic(date) {
|
|
97
|
-
this.interval = setInterval(() => {
|
|
98
|
-
this.daysRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60 * 24));
|
|
99
|
-
this.hoursRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60) - this.daysRemaining * 24);
|
|
100
|
-
this.minutesRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60) - this.daysRemaining * 24 * 60 - this.hoursRemaining * 60);
|
|
101
|
-
this.secondsRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / 1000 - this.daysRemaining * 24 * 60 * 60 - this.hoursRemaining * 60 * 60 - this.minutesRemaining * 60);
|
|
102
|
-
}, 1000);
|
|
103
|
-
}
|
|
104
|
-
disconnectedCallback() {
|
|
105
|
-
clearInterval(this.interval);
|
|
106
|
-
}
|
|
107
|
-
getGameDetails() {
|
|
108
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
109
|
-
fetch(url.href)
|
|
110
|
-
.then((res) => {
|
|
111
|
-
if (res.status >= 300) {
|
|
112
|
-
this.hasErrors = true;
|
|
113
|
-
throw new Error('There was an error while fetching the data');
|
|
114
|
-
}
|
|
115
|
-
return res.json();
|
|
116
|
-
})
|
|
117
|
-
.then((data) => {
|
|
118
|
-
this.gameData = data;
|
|
119
|
-
this.basicStake = this.gameData.rules.stakes[0].amount;
|
|
120
|
-
let draws = this.gameData.draws.filter((item) => !item.winningNumbers);
|
|
121
|
-
console.log('draws', draws);
|
|
122
|
-
this.nextDraw = draws[0].id;
|
|
123
|
-
this.createNewTicket();
|
|
124
|
-
})
|
|
125
|
-
.catch((err) => {
|
|
126
|
-
this.hasErrors = true;
|
|
127
|
-
console.log('Error', err);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
calculateTotalAmount() {
|
|
131
|
-
const { currency } = this.gameData.rules.stakes[0];
|
|
132
|
-
this.totalAmount = 0;
|
|
133
|
-
this.tickets.forEach((item) => {
|
|
134
|
-
if (item.completed) {
|
|
135
|
-
this.totalAmount += item.amount * item.stake;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
this.currency = currency;
|
|
139
|
-
}
|
|
140
|
-
// @TODO CustomEvent type
|
|
141
|
-
gridFilledHandler(event) {
|
|
142
|
-
// @TODO item ts
|
|
143
|
-
this.tickets = this.tickets.map((item) => {
|
|
144
|
-
if (item.ticketId == event.detail.id) {
|
|
145
|
-
let arr = item.selectedNumbers || [];
|
|
146
|
-
arr[event.detail.index] = event.detail.selectedNumbers.map((item) => parseInt(item, 10));
|
|
147
|
-
return {
|
|
148
|
-
gameId: item.gameId,
|
|
149
|
-
ticketId: item.ticketId,
|
|
150
|
-
completed: true,
|
|
151
|
-
amount: event.detail.draws,
|
|
152
|
-
stake: item.stake,
|
|
153
|
-
selectedNumbers: arr
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
return item;
|
|
157
|
-
});
|
|
158
|
-
this.calculateTotalAmount();
|
|
159
|
-
}
|
|
160
|
-
// @TODO fix any type
|
|
161
|
-
gridDirtyHandler(event) {
|
|
162
|
-
// @TODO item ts
|
|
163
|
-
this.tickets = this.tickets.map((item) => {
|
|
164
|
-
if (item.gameId == event.detail.id) {
|
|
165
|
-
return {
|
|
166
|
-
gameId: item.gameId,
|
|
167
|
-
ticketId: item.ticketId,
|
|
168
|
-
completed: false,
|
|
169
|
-
amount: item.amount,
|
|
170
|
-
stake: item.stake,
|
|
171
|
-
grids: []
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
return item;
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
// @TODO CustomEvent type
|
|
178
|
-
deleteTicketHandler(event) {
|
|
179
|
-
this.deleteVisible = true;
|
|
180
|
-
this.deleteEventData = event;
|
|
181
|
-
}
|
|
182
|
-
modalCloseEvent() {
|
|
183
|
-
this.deleteVisible = false;
|
|
184
|
-
}
|
|
185
|
-
stakeChangeHandler(event) {
|
|
186
|
-
const { ticketId, stake } = event.detail;
|
|
187
|
-
this.tickets[ticketId - 1].stake = stake;
|
|
188
|
-
this.calculateTotalAmount();
|
|
189
|
-
}
|
|
190
|
-
multiplierChangeHandler(event) {
|
|
191
|
-
this.multiplier = event.detail;
|
|
192
|
-
}
|
|
193
|
-
getDraws() {
|
|
194
|
-
// append from query param with the current date value in order to get the next draw
|
|
195
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws`);
|
|
196
|
-
let drawOptions = {
|
|
197
|
-
method: "GET",
|
|
198
|
-
headers: {
|
|
199
|
-
'Content-Type': "application/json",
|
|
200
|
-
'Accept': 'application/json',
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
fetch(url.href, drawOptions)
|
|
204
|
-
.then((response) => {
|
|
205
|
-
return response.json();
|
|
206
|
-
})
|
|
207
|
-
.then((data) => {
|
|
208
|
-
var _a;
|
|
209
|
-
let upcoming = data.items.filter((item) => {
|
|
210
|
-
if (Date.parse(item.date) > new Date().getTime()) {
|
|
211
|
-
return !item.winningNumbers;
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
let past = data.items.filter((item) => item.winningNumbers);
|
|
215
|
-
this.latestDraw = upcoming[0];
|
|
216
|
-
this.nextDate = this.latestDraw.date;
|
|
217
|
-
this.countdownLogic(this.nextDate);
|
|
218
|
-
this.lastDrawId = past[past.length - 1].id;
|
|
219
|
-
// calculate total winnings
|
|
220
|
-
// @TODO fix any type
|
|
221
|
-
(_a = this.latestDraw) === null || _a === void 0 ? void 0 : _a.prizes.forEach((element) => {
|
|
222
|
-
this.totalWinningsAmount += JSON.parse(element.amount);
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
;
|
|
227
|
-
// @TODO fix any type
|
|
228
|
-
confirmDeleteTicketHandler(event) {
|
|
229
|
-
// @TODO fix any type
|
|
230
|
-
this.tickets = this.tickets.filter((item) => {
|
|
231
|
-
if (item.ticketId == event.detail.ticketId) {
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
return true;
|
|
235
|
-
});
|
|
236
|
-
this.calculateTotalAmount();
|
|
237
|
-
this.deleteVisible = false;
|
|
238
|
-
}
|
|
239
|
-
createNewTicket() {
|
|
240
|
-
this.tickets = [
|
|
241
|
-
...this.tickets,
|
|
242
|
-
{ gameId: this.gameId, ticketId: this.tickets.length + 1, completed: false, amount: 1, stake: this.basicStake, grids: [] }
|
|
243
|
-
];
|
|
244
|
-
}
|
|
245
|
-
submitTickets() {
|
|
246
|
-
let url = new URL(`${this.endpoint}/tickets`);
|
|
247
|
-
// @TODO Body TS type
|
|
248
|
-
let body = {
|
|
249
|
-
gameId: this.gameId,
|
|
250
|
-
tickets: []
|
|
251
|
-
};
|
|
252
|
-
console.log('body', body);
|
|
253
|
-
this.tickets.forEach((item) => {
|
|
254
|
-
body.tickets.push({
|
|
255
|
-
startingDrawId: this.nextDraw,
|
|
256
|
-
amount: item.stake,
|
|
257
|
-
gameId: this.gameId,
|
|
258
|
-
currency: this.currency,
|
|
259
|
-
selection: item.selectedNumbers,
|
|
260
|
-
multiplier: this.multiplier,
|
|
261
|
-
drawCount: item.amount,
|
|
262
|
-
quickPick: this.quickPick,
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
// @TODO Options TS type
|
|
266
|
-
let options = {
|
|
267
|
-
method: 'POST',
|
|
268
|
-
headers: {
|
|
269
|
-
'Content-Type': 'application/json',
|
|
270
|
-
'Accept': 'application/json',
|
|
271
|
-
'Authorization': `Bearer ${this.sessionId}`
|
|
272
|
-
},
|
|
273
|
-
body: JSON.stringify(body)
|
|
274
|
-
};
|
|
275
|
-
fetch(url.href, options)
|
|
276
|
-
.then((res) => {
|
|
277
|
-
if (res.status > 300) {
|
|
278
|
-
throw new Error('err');
|
|
279
|
-
}
|
|
280
|
-
return res.json();
|
|
281
|
-
})
|
|
282
|
-
.then((data) => {
|
|
283
|
-
console.log('data', data);
|
|
284
|
-
});
|
|
285
|
-
this.successVisible = true;
|
|
286
|
-
}
|
|
287
|
-
render() {
|
|
288
|
-
// const backgroundSrc = getAssetPath('./static/chrono_lottery_mobile.png');
|
|
289
|
-
// const backgroundDesktopSrc = getAssetPath('./static/chrono_desktop.png');
|
|
290
|
-
if (this.hasErrors) {
|
|
291
|
-
return (index.h("div", { class: "GamePage" }, index.h("div", { class: "Title" }, translate('error', this.language))));
|
|
292
|
-
}
|
|
293
|
-
return (
|
|
294
|
-
/* Game details */
|
|
295
|
-
index.h("div", { class: "GamePage" }, index.h("div", { class: "GridBanner" }, index.h("div", { class: "BannerButtonsWrapper" }, index.h("button", { class: "BannerBackButton" }, index.h("span", { class: "BannerBackButtonArrow" }, "\u1438 "), translate('backButton', this.language)), index.h("button", { class: "BannerLobbyButton" }, translate('lobbyButton', this.language))), index.h("div", { class: "Tabs" }, index.h("div", { class: 'TabButton' + (this.tabIndex == 0 ? ' Active' : ''), onClick: () => this.tabIndex = 0 }, translate('buy', this.language)), index.h("div", { class: 'TabButton' + (this.tabIndex == 1 ? ' Active' : ''), onClick: () => this.tabIndex = 1 }, translate('viewLatest', this.language)))), index.h("div", { class: "NextDrawWrapper" }, index.h("div", { class: "TotalWinnings" }, translate('winUpTo', this.language), ": ", index.h("span", null, "$", this.totalWinningsAmount.toLocaleString('en-US', { maximumFractionDigits: 2 }))), index.h("div", { class: "NextDraw" }, index.h("p", { class: "BannerText" }, translate('nextDraw', this.language)), index.h("div", { class: "BannerCountdown" }, index.h("span", { class: "CountdownDays" }, this.daysRemaining, "D"), index.h("span", { class: "CountdownHours" }, this.hoursRemaining, "H"), index.h("span", { class: "CountdownMinutes" }, this.minutesRemaining, "M"), index.h("span", { class: "CountdownSeconds" }, this.secondsRemaining, "S")))), this.tabIndex == 0 &&
|
|
296
|
-
index.h("div", { class: "GamePageContent" }, index.h("div", { class: "GameDetails" }, index.h("lottery-game-details", null)), index.h("div", { class: "TicketsWrapper" }, this.tickets.map((item) => index.h("lottery-ticket-controller", { endpoint: this.endpoint, "ticket-id": item.ticketId, "game-id": item.gameId, collapsed: false, last: true, language: this.language, "auto-pick": this.autoPick, "reset-button": this.resetButton })), index.h("div", { class: "CreateNewTicket" }, index.h("button", { onClick: () => this.createNewTicket() }, "+"), index.h("span", null, translate('createTicket', this.language)))), index.h("div", { class: "OrderSummary" }, index.h("h3", { class: "OrderSummaryTitle" }, translate('orderSummaryTitle', this.language)), index.h("div", { class: "Ticket" }, translate('orderSummaryTickets', this.language), ": ", index.h("span", null, this.tickets.length)), index.h("div", { class: "Total" }, translate('orderSummaryTotal', this.language), ": ", index.h("span", null, this.totalAmount, " ", this.currency)), index.h("div", { class: "ButtonWrapper" }, index.h("span", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language))))), this.tabIndex == 1 &&
|
|
297
|
-
index.h("div", null, index.h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "draw-id": this.lastDrawId, "draw-mode": true }), index.h("lottery-draw-results-history", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language })), index.h("helper-modal", { "title-modal": "Success", visible: this.successVisible }, index.h("p", { class: "SubmitModalSuccess" }, translate('modalSuccess', this.language))), index.h("helper-modal", { "title-modal": "Delete Ticket", visible: this.deleteVisible }, index.h("div", { class: "DeleteTicketModalWrapper" }, index.h("h3", { class: "DeleteTicketModalTitle" }, translate('deleteTicketModalTitle', this.language)), index.h("p", { class: "DeleteTicketModalText" }, translate('deleteTicketModalText', this.language)), index.h("div", { class: "DeleteTicketModalButtons" }, index.h("button", { class: "DeleteTicketModalCancel", onClick: () => this.modalCloseEvent() }, translate('deleteTicketModalCancel', this.language)), index.h("button", { class: "DeleteTicketModalConfirm", onClick: () => this.confirmDeleteTicketHandler(this.deleteEventData) }, translate('deleteTicketModalConfirm', this.language)))))));
|
|
298
|
-
}
|
|
299
|
-
static get assetsDirs() { return ["static"]; }
|
|
300
|
-
get element() { return index.getElement(this); }
|
|
301
|
-
};
|
|
302
|
-
LotteryGamePage.style = lotteryGamePageCss;
|
|
303
|
-
|
|
304
|
-
exports.lottery_game_page = LotteryGamePage;
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-8c700c5e.js';
|
|
2
|
-
import '@everymatrix/lottery-ticket-controller';
|
|
3
|
-
import '@everymatrix/helper-modal';
|
|
4
|
-
import '@everymatrix/lottery-game-details';
|
|
5
|
-
import '@everymatrix/lottery-draw-results-history';
|
|
6
|
-
import '@everymatrix/lottery-draw-results';
|
|
7
|
-
|
|
8
|
-
const DEFAULT_LANGUAGE = 'en';
|
|
9
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
10
|
-
const TRANSLATIONS = {
|
|
11
|
-
en: {
|
|
12
|
-
error: 'Error',
|
|
13
|
-
title: 'Chrono',
|
|
14
|
-
backButton: 'Back',
|
|
15
|
-
lobbyButton: 'Lobby',
|
|
16
|
-
prize: 'Prize',
|
|
17
|
-
winUpTo: 'Win up to',
|
|
18
|
-
nextDraw: 'Next draw in: ',
|
|
19
|
-
buy: 'Buy tickets',
|
|
20
|
-
viewLatest: 'View latest results',
|
|
21
|
-
createTicket: 'Create Ticket',
|
|
22
|
-
modalSuccess: 'Purchase will be successfull soon!',
|
|
23
|
-
deleteTicketModalTitle: 'Delete Ticket',
|
|
24
|
-
deleteTicketModalText: 'Are you sure you want to delete this ticket?',
|
|
25
|
-
deleteTicketModalCancel: 'Cancel',
|
|
26
|
-
deleteTicketModalConfirm: 'Delete',
|
|
27
|
-
orderSummaryTitle: 'Order Summary',
|
|
28
|
-
orderSummaryTickets: 'Ticket',
|
|
29
|
-
orderSummaryTotal: 'Total',
|
|
30
|
-
orderSummarySubmit: 'Submit'
|
|
31
|
-
},
|
|
32
|
-
ro: {
|
|
33
|
-
error: 'Eroare',
|
|
34
|
-
title: 'Loto 6/49',
|
|
35
|
-
backButton: 'Inapoi',
|
|
36
|
-
lobbyButton: 'Lobby',
|
|
37
|
-
prize: 'MARELE JACKPOT OMG',
|
|
38
|
-
winUpTo: 'Castiga pana la',
|
|
39
|
-
nextDraw: 'In cat timp devii milionar daca cumperi acum!!!',
|
|
40
|
-
buy: 'Cumpara bilet',
|
|
41
|
-
viewLatest: 'Ultimile extrageri',
|
|
42
|
-
createTicket: 'Creeaza bilet',
|
|
43
|
-
modalSuccess: 'Achiziția va avea succes în curând!',
|
|
44
|
-
deleteTicketModalTitle: 'Sterge biletul',
|
|
45
|
-
deleteTicketModalText: 'Esti sigur ca vrei sa stergi acest bilet?',
|
|
46
|
-
deleteTicketModalCancel: 'Anuleaza',
|
|
47
|
-
deleteTicketModalConfirm: 'Sterge',
|
|
48
|
-
orderSummaryTitle: 'Rezumat comanda',
|
|
49
|
-
orderSummaryTickets: 'Bilet',
|
|
50
|
-
orderSummaryTotal: 'Total',
|
|
51
|
-
orderSummarySubmit: 'Trimite'
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
const translate = (key, customLang) => {
|
|
55
|
-
const lang = customLang;
|
|
56
|
-
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const lotteryGamePageCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GamePage .GridBanner{background-color:#009993;background-repeat:no-repeat;background-position:center;color:#111;padding:0 20px 10px;height:220px;display:flex;flex-direction:column;justify-content:space-between}.GamePage .GridBanner .BannerButtonsWrapper{display:flex;justify-content:space-between;padding-top:16px}.GamePage .GridBanner .BannerButtonsWrapper .BannerBackButton,.GamePage .GridBanner .BannerButtonsWrapper .BannerLobbyButton{background:#fff;border:1px solid #D4D4D4;border-radius:4px;padding:7px 15px;font-size:12px;text-transform:uppercase;width:80px}.GamePage .GridBanner .GridBannerArea{padding-top:30px;display:flex;flex-direction:column;align-items:center}.GamePage .TotalWinnings{color:#00958f;font-size:18px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px}.GamePage .TotalWinnings span{font-size:22px;font-weight:700}.GamePage .NextDraw{color:#00958f;font-size:24px;font-weight:600;margin:0 auto;text-align:center;text-transform:capitalize;display:flex;justify-content:center;align-items:center;flex-direction:column}.GamePage .NextDraw .BannerText{font-weight:400;font-size:18px}.GamePage .NextDraw .BannerCountdown{font-size:22px;color:#00958f;display:flex;gap:20px}.GamePage .Tabs{display:flex;justify-content:center;gap:10px}.GamePage .Tabs .TabButton{border-radius:4px;cursor:pointer;padding:8px 0;width:50%;max-width:200px;border:1px solid #00958f;background:#F1F1F1;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.GamePage .Tabs .TabButton.Active{background:#00958f;color:#FFF}.NextDrawWrapper{padding:10px 15px;background:#fff}.NextDrawWrapper .BannerText{font-size:16px;font-weight:700;text-align:center}.NextDrawWrapper .BannerCountdown{font-size:22px;display:flex;gap:8px;color:#009993;font-weight:bolder;justify-content:center}.GamePageContent{padding:10px 15px;max-width:1200px;margin:0 auto}.GameDetails{padding-bottom:10px;margin-bottom:20px;border-bottom:1px solid #e9e9e9}.CreateNewTicket{background:#004D4A;height:100px;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.CreateNewTicket button{cursor:pointer;display:inline-block;border-radius:50%;width:40px;height:40px;margin:5px;border:1px solid #FFF;background:#FFF;color:#004D4A;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.CreateNewTicket button:hover{background:#F1F1F1}.CreateNewTicket span{display:inline-block;font-size:12px;text-align:center;margin:0 auto;color:#FFF}.OrderSummary{min-width:200px;border-radius:4px;display:flex;flex-direction:column;justify-content:center;margin-top:20px;background:#fff}.OrderSummary .OrderSummaryTitle{font-size:16px;color:#009993;text-transform:uppercase;text-align:center}.OrderSummary .Ticket{display:inline-block;color:#000;font-size:14px;height:50px;border-bottom:solid 1px #D4D4D4;line-height:50px}.OrderSummary .Ticket span{text-align:right}.OrderSummary .Total{display:inline-block;color:#000;font-size:14px;height:50px;line-height:50px}.OrderSummary .Total span{text-align:right}.ButtonWrapper{display:flex;align-items:center;justify-content:center}.ButtonWrapper .Button{cursor:pointer;border-radius:4px;padding:8px 60px;width:max-content;margin:5px;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#009993;border:1px solid #009993;color:#FFF}.ButtonWrapper .Button:hover{background:#00ABA4}.SubmitModalSuccess{text-align:center;font-size:18px;padding:20px}.DeleteTicketModalWrapper{padding:20px;text-align:center}.DeleteTicketModalWrapper .DeleteTicketModalTitle{font-size:16px;color:#00958f;font-weight:400;text-transform:uppercase;margin:20px 0 40px}.DeleteTicketModalWrapper .DeleteTicketModalText{font-size:14px;color:#000;line-height:22px;margin-bottom:40px}.DeleteTicketModalWrapper .DeleteTicketModalButtons{display:flex;gap:10px;justify-content:center}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm{cursor:pointer;border-radius:4px;padding:8px 25px;width:max-content;margin:5px;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}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalConfirm:hover{background:#FF6536;border:1px solid #FF3D00}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel{cursor:pointer;width:max-content;border-radius:4px;padding:10px 25px;margin:5px;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}.DeleteTicketModalWrapper .DeleteTicketModalButtons .DeleteTicketModalCancel:hover{background:#F1F1F1}@media (min-width: 1200px){.GamePageContent .TicketsWrapper{float:left;width:49%}.GamePageContent .GameDetails{float:right;width:49%}.GamePageContent .OrderSummary{float:right;width:49%}}";
|
|
60
|
-
|
|
61
|
-
const LotteryGamePage = class {
|
|
62
|
-
constructor(hostRef) {
|
|
63
|
-
registerInstance(this, hostRef);
|
|
64
|
-
/**
|
|
65
|
-
* Language of the widget
|
|
66
|
-
*/
|
|
67
|
-
this.language = 'en';
|
|
68
|
-
/**
|
|
69
|
-
* Shows the auto-pick button
|
|
70
|
-
*/
|
|
71
|
-
this.autoPick = false;
|
|
72
|
-
/**
|
|
73
|
-
* Shows the reset button
|
|
74
|
-
*/
|
|
75
|
-
this.resetButton = false;
|
|
76
|
-
this.tickets = [];
|
|
77
|
-
this.tabIndex = 0;
|
|
78
|
-
this.hasErrors = false;
|
|
79
|
-
this.totalAmount = 0;
|
|
80
|
-
this.successVisible = false;
|
|
81
|
-
this.deleteVisible = false;
|
|
82
|
-
this.latestDraw = {};
|
|
83
|
-
this.totalWinningsAmount = 0;
|
|
84
|
-
this.multiplier = false;
|
|
85
|
-
this.quickPick = false;
|
|
86
|
-
}
|
|
87
|
-
// @TODO fix `any` type later, I'm lazy now
|
|
88
|
-
connectedCallback() {
|
|
89
|
-
this.getGameDetails();
|
|
90
|
-
this.getDraws();
|
|
91
|
-
}
|
|
92
|
-
countdownLogic(date) {
|
|
93
|
-
this.interval = setInterval(() => {
|
|
94
|
-
this.daysRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60 * 24));
|
|
95
|
-
this.hoursRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60 * 60) - this.daysRemaining * 24);
|
|
96
|
-
this.minutesRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / (1000 * 60) - this.daysRemaining * 24 * 60 - this.hoursRemaining * 60);
|
|
97
|
-
this.secondsRemaining = Math.floor((Date.parse(date) - new Date().getTime()) / 1000 - this.daysRemaining * 24 * 60 * 60 - this.hoursRemaining * 60 * 60 - this.minutesRemaining * 60);
|
|
98
|
-
}, 1000);
|
|
99
|
-
}
|
|
100
|
-
disconnectedCallback() {
|
|
101
|
-
clearInterval(this.interval);
|
|
102
|
-
}
|
|
103
|
-
getGameDetails() {
|
|
104
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
105
|
-
fetch(url.href)
|
|
106
|
-
.then((res) => {
|
|
107
|
-
if (res.status >= 300) {
|
|
108
|
-
this.hasErrors = true;
|
|
109
|
-
throw new Error('There was an error while fetching the data');
|
|
110
|
-
}
|
|
111
|
-
return res.json();
|
|
112
|
-
})
|
|
113
|
-
.then((data) => {
|
|
114
|
-
this.gameData = data;
|
|
115
|
-
this.basicStake = this.gameData.rules.stakes[0].amount;
|
|
116
|
-
let draws = this.gameData.draws.filter((item) => !item.winningNumbers);
|
|
117
|
-
console.log('draws', draws);
|
|
118
|
-
this.nextDraw = draws[0].id;
|
|
119
|
-
this.createNewTicket();
|
|
120
|
-
})
|
|
121
|
-
.catch((err) => {
|
|
122
|
-
this.hasErrors = true;
|
|
123
|
-
console.log('Error', err);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
calculateTotalAmount() {
|
|
127
|
-
const { currency } = this.gameData.rules.stakes[0];
|
|
128
|
-
this.totalAmount = 0;
|
|
129
|
-
this.tickets.forEach((item) => {
|
|
130
|
-
if (item.completed) {
|
|
131
|
-
this.totalAmount += item.amount * item.stake;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
this.currency = currency;
|
|
135
|
-
}
|
|
136
|
-
// @TODO CustomEvent type
|
|
137
|
-
gridFilledHandler(event) {
|
|
138
|
-
// @TODO item ts
|
|
139
|
-
this.tickets = this.tickets.map((item) => {
|
|
140
|
-
if (item.ticketId == event.detail.id) {
|
|
141
|
-
let arr = item.selectedNumbers || [];
|
|
142
|
-
arr[event.detail.index] = event.detail.selectedNumbers.map((item) => parseInt(item, 10));
|
|
143
|
-
return {
|
|
144
|
-
gameId: item.gameId,
|
|
145
|
-
ticketId: item.ticketId,
|
|
146
|
-
completed: true,
|
|
147
|
-
amount: event.detail.draws,
|
|
148
|
-
stake: item.stake,
|
|
149
|
-
selectedNumbers: arr
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
return item;
|
|
153
|
-
});
|
|
154
|
-
this.calculateTotalAmount();
|
|
155
|
-
}
|
|
156
|
-
// @TODO fix any type
|
|
157
|
-
gridDirtyHandler(event) {
|
|
158
|
-
// @TODO item ts
|
|
159
|
-
this.tickets = this.tickets.map((item) => {
|
|
160
|
-
if (item.gameId == event.detail.id) {
|
|
161
|
-
return {
|
|
162
|
-
gameId: item.gameId,
|
|
163
|
-
ticketId: item.ticketId,
|
|
164
|
-
completed: false,
|
|
165
|
-
amount: item.amount,
|
|
166
|
-
stake: item.stake,
|
|
167
|
-
grids: []
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
return item;
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
// @TODO CustomEvent type
|
|
174
|
-
deleteTicketHandler(event) {
|
|
175
|
-
this.deleteVisible = true;
|
|
176
|
-
this.deleteEventData = event;
|
|
177
|
-
}
|
|
178
|
-
modalCloseEvent() {
|
|
179
|
-
this.deleteVisible = false;
|
|
180
|
-
}
|
|
181
|
-
stakeChangeHandler(event) {
|
|
182
|
-
const { ticketId, stake } = event.detail;
|
|
183
|
-
this.tickets[ticketId - 1].stake = stake;
|
|
184
|
-
this.calculateTotalAmount();
|
|
185
|
-
}
|
|
186
|
-
multiplierChangeHandler(event) {
|
|
187
|
-
this.multiplier = event.detail;
|
|
188
|
-
}
|
|
189
|
-
getDraws() {
|
|
190
|
-
// append from query param with the current date value in order to get the next draw
|
|
191
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}/draws`);
|
|
192
|
-
let drawOptions = {
|
|
193
|
-
method: "GET",
|
|
194
|
-
headers: {
|
|
195
|
-
'Content-Type': "application/json",
|
|
196
|
-
'Accept': 'application/json',
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
fetch(url.href, drawOptions)
|
|
200
|
-
.then((response) => {
|
|
201
|
-
return response.json();
|
|
202
|
-
})
|
|
203
|
-
.then((data) => {
|
|
204
|
-
var _a;
|
|
205
|
-
let upcoming = data.items.filter((item) => {
|
|
206
|
-
if (Date.parse(item.date) > new Date().getTime()) {
|
|
207
|
-
return !item.winningNumbers;
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
let past = data.items.filter((item) => item.winningNumbers);
|
|
211
|
-
this.latestDraw = upcoming[0];
|
|
212
|
-
this.nextDate = this.latestDraw.date;
|
|
213
|
-
this.countdownLogic(this.nextDate);
|
|
214
|
-
this.lastDrawId = past[past.length - 1].id;
|
|
215
|
-
// calculate total winnings
|
|
216
|
-
// @TODO fix any type
|
|
217
|
-
(_a = this.latestDraw) === null || _a === void 0 ? void 0 : _a.prizes.forEach((element) => {
|
|
218
|
-
this.totalWinningsAmount += JSON.parse(element.amount);
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
;
|
|
223
|
-
// @TODO fix any type
|
|
224
|
-
confirmDeleteTicketHandler(event) {
|
|
225
|
-
// @TODO fix any type
|
|
226
|
-
this.tickets = this.tickets.filter((item) => {
|
|
227
|
-
if (item.ticketId == event.detail.ticketId) {
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
return true;
|
|
231
|
-
});
|
|
232
|
-
this.calculateTotalAmount();
|
|
233
|
-
this.deleteVisible = false;
|
|
234
|
-
}
|
|
235
|
-
createNewTicket() {
|
|
236
|
-
this.tickets = [
|
|
237
|
-
...this.tickets,
|
|
238
|
-
{ gameId: this.gameId, ticketId: this.tickets.length + 1, completed: false, amount: 1, stake: this.basicStake, grids: [] }
|
|
239
|
-
];
|
|
240
|
-
}
|
|
241
|
-
submitTickets() {
|
|
242
|
-
let url = new URL(`${this.endpoint}/tickets`);
|
|
243
|
-
// @TODO Body TS type
|
|
244
|
-
let body = {
|
|
245
|
-
gameId: this.gameId,
|
|
246
|
-
tickets: []
|
|
247
|
-
};
|
|
248
|
-
console.log('body', body);
|
|
249
|
-
this.tickets.forEach((item) => {
|
|
250
|
-
body.tickets.push({
|
|
251
|
-
startingDrawId: this.nextDraw,
|
|
252
|
-
amount: item.stake,
|
|
253
|
-
gameId: this.gameId,
|
|
254
|
-
currency: this.currency,
|
|
255
|
-
selection: item.selectedNumbers,
|
|
256
|
-
multiplier: this.multiplier,
|
|
257
|
-
drawCount: item.amount,
|
|
258
|
-
quickPick: this.quickPick,
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
// @TODO Options TS type
|
|
262
|
-
let options = {
|
|
263
|
-
method: 'POST',
|
|
264
|
-
headers: {
|
|
265
|
-
'Content-Type': 'application/json',
|
|
266
|
-
'Accept': 'application/json',
|
|
267
|
-
'Authorization': `Bearer ${this.sessionId}`
|
|
268
|
-
},
|
|
269
|
-
body: JSON.stringify(body)
|
|
270
|
-
};
|
|
271
|
-
fetch(url.href, options)
|
|
272
|
-
.then((res) => {
|
|
273
|
-
if (res.status > 300) {
|
|
274
|
-
throw new Error('err');
|
|
275
|
-
}
|
|
276
|
-
return res.json();
|
|
277
|
-
})
|
|
278
|
-
.then((data) => {
|
|
279
|
-
console.log('data', data);
|
|
280
|
-
});
|
|
281
|
-
this.successVisible = true;
|
|
282
|
-
}
|
|
283
|
-
render() {
|
|
284
|
-
// const backgroundSrc = getAssetPath('./static/chrono_lottery_mobile.png');
|
|
285
|
-
// const backgroundDesktopSrc = getAssetPath('./static/chrono_desktop.png');
|
|
286
|
-
if (this.hasErrors) {
|
|
287
|
-
return (h("div", { class: "GamePage" }, h("div", { class: "Title" }, translate('error', this.language))));
|
|
288
|
-
}
|
|
289
|
-
return (
|
|
290
|
-
/* Game details */
|
|
291
|
-
h("div", { class: "GamePage" }, h("div", { class: "GridBanner" }, h("div", { class: "BannerButtonsWrapper" }, h("button", { class: "BannerBackButton" }, h("span", { class: "BannerBackButtonArrow" }, "\u1438 "), translate('backButton', this.language)), h("button", { class: "BannerLobbyButton" }, translate('lobbyButton', this.language))), h("div", { class: "Tabs" }, h("div", { class: 'TabButton' + (this.tabIndex == 0 ? ' Active' : ''), onClick: () => this.tabIndex = 0 }, translate('buy', this.language)), h("div", { class: 'TabButton' + (this.tabIndex == 1 ? ' Active' : ''), onClick: () => this.tabIndex = 1 }, translate('viewLatest', this.language)))), h("div", { class: "NextDrawWrapper" }, h("div", { class: "TotalWinnings" }, translate('winUpTo', this.language), ": ", h("span", null, "$", this.totalWinningsAmount.toLocaleString('en-US', { maximumFractionDigits: 2 }))), h("div", { class: "NextDraw" }, h("p", { class: "BannerText" }, translate('nextDraw', this.language)), h("div", { class: "BannerCountdown" }, h("span", { class: "CountdownDays" }, this.daysRemaining, "D"), h("span", { class: "CountdownHours" }, this.hoursRemaining, "H"), h("span", { class: "CountdownMinutes" }, this.minutesRemaining, "M"), h("span", { class: "CountdownSeconds" }, this.secondsRemaining, "S")))), this.tabIndex == 0 &&
|
|
292
|
-
h("div", { class: "GamePageContent" }, h("div", { class: "GameDetails" }, h("lottery-game-details", null)), h("div", { class: "TicketsWrapper" }, this.tickets.map((item) => h("lottery-ticket-controller", { endpoint: this.endpoint, "ticket-id": item.ticketId, "game-id": item.gameId, collapsed: false, last: true, language: this.language, "auto-pick": this.autoPick, "reset-button": this.resetButton })), h("div", { class: "CreateNewTicket" }, h("button", { onClick: () => this.createNewTicket() }, "+"), h("span", null, translate('createTicket', this.language)))), h("div", { class: "OrderSummary" }, h("h3", { class: "OrderSummaryTitle" }, translate('orderSummaryTitle', this.language)), h("div", { class: "Ticket" }, translate('orderSummaryTickets', this.language), ": ", h("span", null, this.tickets.length)), h("div", { class: "Total" }, translate('orderSummaryTotal', this.language), ": ", h("span", null, this.totalAmount, " ", this.currency)), h("div", { class: "ButtonWrapper" }, h("span", { class: "Button", onClick: () => this.submitTickets() }, translate('orderSummarySubmit', this.language))))), this.tabIndex == 1 &&
|
|
293
|
-
h("div", null, h("lottery-draw-results", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language, "draw-id": this.lastDrawId, "draw-mode": true }), h("lottery-draw-results-history", { endpoint: this.endpoint, "game-id": this.gameId, language: this.language })), h("helper-modal", { "title-modal": "Success", visible: this.successVisible }, h("p", { class: "SubmitModalSuccess" }, translate('modalSuccess', this.language))), h("helper-modal", { "title-modal": "Delete Ticket", visible: this.deleteVisible }, h("div", { class: "DeleteTicketModalWrapper" }, h("h3", { class: "DeleteTicketModalTitle" }, translate('deleteTicketModalTitle', this.language)), h("p", { class: "DeleteTicketModalText" }, translate('deleteTicketModalText', this.language)), h("div", { class: "DeleteTicketModalButtons" }, h("button", { class: "DeleteTicketModalCancel", onClick: () => this.modalCloseEvent() }, translate('deleteTicketModalCancel', this.language)), h("button", { class: "DeleteTicketModalConfirm", onClick: () => this.confirmDeleteTicketHandler(this.deleteEventData) }, translate('deleteTicketModalConfirm', this.language)))))));
|
|
294
|
-
}
|
|
295
|
-
static get assetsDirs() { return ["static"]; }
|
|
296
|
-
get element() { return getElement(this); }
|
|
297
|
-
};
|
|
298
|
-
LotteryGamePage.style = lotteryGamePageCss;
|
|
299
|
-
|
|
300
|
-
export { LotteryGamePage as lottery_game_page };
|