@everymatrix/casino-lobby 0.0.25-6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/casino-lobby.js +33 -0
- package/dist/casino-lobby.js.map +1 -0
- package/documentation.md +169 -0
- package/index.html +58 -0
- package/index.js +1 -0
- package/package.json +40 -0
- package/public/favicon.png +0 -0
- package/public/reset.css +48 -0
- package/rollup.config.js +67 -0
- package/src/CasinoLobby.svelte +316 -0
- package/src/i18n.js +25 -0
- package/src/index.ts +4 -0
- package/stories/CasinoLobby.stories.js +13 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
<svelte:options tag={null} />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import { onMount } from "svelte";
|
|
5
|
+
import { getDevice, checkSession } from 'rvhelper';
|
|
6
|
+
import { setupI18n, setLocale } from './i18n';
|
|
7
|
+
|
|
8
|
+
import '@everymatrix/casino-categories-slider';
|
|
9
|
+
import '@everymatrix/casino-page';
|
|
10
|
+
import '@everymatrix/casino-modal';
|
|
11
|
+
import '@everymatrix/casino-game-page';
|
|
12
|
+
import '@everymatrix/casino-filter-modal';
|
|
13
|
+
import '@everymatrix/casino-filter-page';
|
|
14
|
+
|
|
15
|
+
export let endpoint:string = '';
|
|
16
|
+
export let datasource:string = '';
|
|
17
|
+
export let lang:string = ''; // Language
|
|
18
|
+
export let session:string = ''; // Value for sessionID
|
|
19
|
+
export let userid:string = '';
|
|
20
|
+
export let opsession:string = '';
|
|
21
|
+
export let clientstyling:string = '';
|
|
22
|
+
export let clientstylingurl:string = '';
|
|
23
|
+
export let clockformat:string = '';
|
|
24
|
+
export let lobbyid:string = '';
|
|
25
|
+
export let currency:string = 'EUR';
|
|
26
|
+
|
|
27
|
+
export let loginurl:string = '';
|
|
28
|
+
export let registerurl:string = '';
|
|
29
|
+
export let depositurl:string = '';
|
|
30
|
+
export let loginevent:string = '';
|
|
31
|
+
export let registerevent:string = '';
|
|
32
|
+
export let depositevent:string = '';
|
|
33
|
+
|
|
34
|
+
export let mostplayed:string = '';
|
|
35
|
+
export let mostplayedrounds:string = '';
|
|
36
|
+
export let favorites:string = '';
|
|
37
|
+
|
|
38
|
+
export let desktopoffset:string = '0';
|
|
39
|
+
export let mobileoffset:string = '0';
|
|
40
|
+
export let alternativesearch:string = 'false';
|
|
41
|
+
|
|
42
|
+
export let containermaxwidth:string = '';
|
|
43
|
+
export let haspanicbutton:string = 'false';
|
|
44
|
+
|
|
45
|
+
export let activecategory:string = 'LOBBY';
|
|
46
|
+
export let actionevent:string = 'CategoryChange';
|
|
47
|
+
export let livecasino:string = 'false';
|
|
48
|
+
export let playforfun:string = 'true';
|
|
49
|
+
|
|
50
|
+
let endpointURL:string;
|
|
51
|
+
let DS:string;
|
|
52
|
+
let language:string;
|
|
53
|
+
|
|
54
|
+
let displayNone:boolean = false;
|
|
55
|
+
let hasErrors:boolean = false;
|
|
56
|
+
let error:string = 'Loading, please wait ...';
|
|
57
|
+
let isLoggedIn:boolean = false;
|
|
58
|
+
let sessionID:string = '';
|
|
59
|
+
let playerID:string = '';
|
|
60
|
+
let userAgent:string = window.navigator.userAgent;
|
|
61
|
+
let isLoading:boolean = true;
|
|
62
|
+
|
|
63
|
+
let headerPlaceholderSize:number = 0;
|
|
64
|
+
let scrollTop:boolean = false;
|
|
65
|
+
let customStylingContainer:HTMLElement;
|
|
66
|
+
let mostPlayed;
|
|
67
|
+
let fav;
|
|
68
|
+
|
|
69
|
+
setupI18n({ withLocale: 'en', translations: {}});
|
|
70
|
+
|
|
71
|
+
const messageHandler = (e:any):void => {
|
|
72
|
+
if (e.data) {
|
|
73
|
+
switch(e.data.type) {
|
|
74
|
+
case 'WidgetTopReference':
|
|
75
|
+
scrollTop = e.data.scrollTop;
|
|
76
|
+
// check if the category has been changed and the scroll top
|
|
77
|
+
if (scrollTop) {
|
|
78
|
+
if (headerPlaceholderSize) {
|
|
79
|
+
window.scrollTo({ top: headerPlaceholderSize });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
|
|
84
|
+
case 'UserSessionID':
|
|
85
|
+
sessionID = e.data.session;
|
|
86
|
+
playerID = e.data.userID;
|
|
87
|
+
break;
|
|
88
|
+
|
|
89
|
+
case 'CategoryChange':
|
|
90
|
+
activecategory = e.data.item.id;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const checkAttrs = ():boolean => {
|
|
97
|
+
if (!endpoint) {
|
|
98
|
+
error = "Endpoint is missing! Please provide a valid endpointURL.";
|
|
99
|
+
hasErrors = true;
|
|
100
|
+
|
|
101
|
+
console.error(error);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!datasource) {
|
|
105
|
+
error = "Datasource is missing! Please provide a valid datasource.";
|
|
106
|
+
hasErrors = true;
|
|
107
|
+
|
|
108
|
+
console.error(error);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!lang || lang.length != 2) {
|
|
112
|
+
error = "Language is missing! Please provide a valid language (alpha2code)";
|
|
113
|
+
hasErrors = true;
|
|
114
|
+
|
|
115
|
+
console.error(error);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return hasErrors;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const setActiveLanguage = ():void => {
|
|
122
|
+
setLocale(lang);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const initialSetup = ():void => {
|
|
126
|
+
checkAttrs();
|
|
127
|
+
setLocale(lang);
|
|
128
|
+
endpointURL = endpoint;
|
|
129
|
+
DS = datasource;
|
|
130
|
+
language = lang;
|
|
131
|
+
|
|
132
|
+
mostPlayed = mostplayed;
|
|
133
|
+
fav = favorites;
|
|
134
|
+
|
|
135
|
+
hasErrors = false;
|
|
136
|
+
isLoading = false;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const setSession = ():void => {
|
|
140
|
+
checkSession(endpoint, session).then((res:any) => {
|
|
141
|
+
sessionID = res.Guid;
|
|
142
|
+
playerID = res.UserID;
|
|
143
|
+
isLoggedIn = true;
|
|
144
|
+
}, (err:any) => {
|
|
145
|
+
isLoggedIn = false;
|
|
146
|
+
console.error('Error while checking the session - ', err)
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const setOpSession = ():void => {
|
|
151
|
+
isLoggedIn = true;
|
|
152
|
+
sessionID = opsession;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const setClientStyling = ():void => {
|
|
156
|
+
let sheet = document.createElement('style');
|
|
157
|
+
sheet.innerHTML = clientstyling;
|
|
158
|
+
customStylingContainer.appendChild(sheet);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const setClientStylingURL = ():void => {
|
|
162
|
+
displayNone = true;
|
|
163
|
+
|
|
164
|
+
let url:URL = new URL(clientstylingurl);
|
|
165
|
+
let cssFile:HTMLElement = document.createElement('style');
|
|
166
|
+
|
|
167
|
+
fetch(url.href)
|
|
168
|
+
.then((res:any) => res.text())
|
|
169
|
+
.then((data:any) => {
|
|
170
|
+
cssFile.innerHTML = data
|
|
171
|
+
|
|
172
|
+
if (customStylingContainer) {
|
|
173
|
+
setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
|
|
174
|
+
setTimeout(() => { displayNone = false; }, 500);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
onMount(() => {
|
|
180
|
+
window.addEventListener('message', messageHandler, false);
|
|
181
|
+
|
|
182
|
+
headerPlaceholderSize = (getDevice(userAgent) === 'PC') ? parseInt(desktopoffset) : parseInt(mobileoffset);
|
|
183
|
+
|
|
184
|
+
return () => {
|
|
185
|
+
window.removeEventListener('message', messageHandler);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
$: lang && setActiveLanguage();
|
|
190
|
+
$: session && userid && endpoint && setSession();
|
|
191
|
+
$: endpoint && datasource && lang && mostplayed && favorites && initialSetup();
|
|
192
|
+
$: opsession && setOpSession();
|
|
193
|
+
$: clientstyling && setClientStyling();
|
|
194
|
+
$: clientstylingurl && setClientStylingURL();
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<div bind:this={customStylingContainer} class={displayNone ? 'DisplayNone' : ''} part="{displayNone ? 'DisplayNone' : ''}">
|
|
198
|
+
{#if hasErrors}
|
|
199
|
+
<p style="color:var(--emfe-w-color-white, #FFFFFF)">{error}</p>
|
|
200
|
+
{:else}
|
|
201
|
+
<div class="CasinoLobby" part="CasinoLobby">
|
|
202
|
+
<div class="WidgetsSection" part="WidgetsSection">
|
|
203
|
+
<div class="HeaderPlaceholder" part="HeaderPlaceholder" style="height:{headerPlaceholderSize}px"></div>
|
|
204
|
+
<div class="ScrollTop" part="ScrollTop"></div>
|
|
205
|
+
<casino-categories-slider
|
|
206
|
+
endpoint={endpointURL}
|
|
207
|
+
datasource={DS}
|
|
208
|
+
lang={language}
|
|
209
|
+
session={session}
|
|
210
|
+
userid={userid}
|
|
211
|
+
{actionevent}
|
|
212
|
+
{mostplayed}
|
|
213
|
+
{mostplayedrounds}
|
|
214
|
+
{favorites}
|
|
215
|
+
{activecategory}
|
|
216
|
+
{clientstyling}
|
|
217
|
+
{clientstylingurl}
|
|
218
|
+
{containermaxwidth}
|
|
219
|
+
></casino-categories-slider>
|
|
220
|
+
<casino-page
|
|
221
|
+
session={session}
|
|
222
|
+
userid={userid}
|
|
223
|
+
endpoint={endpointURL}
|
|
224
|
+
datasource={DS}
|
|
225
|
+
lang={language}
|
|
226
|
+
visiblegames="10"
|
|
227
|
+
{activecategory}
|
|
228
|
+
{alternativesearch}
|
|
229
|
+
{favorites}
|
|
230
|
+
{mostplayedrounds}
|
|
231
|
+
{mostplayed}
|
|
232
|
+
{clientstyling}
|
|
233
|
+
{clientstylingurl}
|
|
234
|
+
{lobbyid}
|
|
235
|
+
{containermaxwidth}
|
|
236
|
+
{haspanicbutton}
|
|
237
|
+
{livecasino}
|
|
238
|
+
{currency}
|
|
239
|
+
></casino-page>
|
|
240
|
+
<casino-modal
|
|
241
|
+
session={session}
|
|
242
|
+
userid={userid}
|
|
243
|
+
endpoint={endpointURL}
|
|
244
|
+
datasource={DS}
|
|
245
|
+
lang={language}
|
|
246
|
+
{clientstyling}
|
|
247
|
+
{clientstylingurl}
|
|
248
|
+
><casino-game-page
|
|
249
|
+
session={session}
|
|
250
|
+
userid={userid}
|
|
251
|
+
endpoint={endpointURL}
|
|
252
|
+
datasource={DS}
|
|
253
|
+
lang={language}
|
|
254
|
+
loginevent={loginevent}
|
|
255
|
+
registerevent={registerevent}
|
|
256
|
+
depositevent={depositevent}
|
|
257
|
+
{playforfun}
|
|
258
|
+
{favorites}
|
|
259
|
+
{clientstyling}
|
|
260
|
+
{clientstylingurl}
|
|
261
|
+
{clockformat}
|
|
262
|
+
{haspanicbutton}
|
|
263
|
+
{currency}
|
|
264
|
+
/>
|
|
265
|
+
</casino-modal>
|
|
266
|
+
<casino-filter-modal
|
|
267
|
+
{clientstylingurl}
|
|
268
|
+
session={session}
|
|
269
|
+
userid={userid}
|
|
270
|
+
endpoint={endpointURL}
|
|
271
|
+
datasource={DS}
|
|
272
|
+
lang={language}
|
|
273
|
+
{clientstyling}>
|
|
274
|
+
<casino-filter-page
|
|
275
|
+
session={session}
|
|
276
|
+
userid={userid}
|
|
277
|
+
endpoint={endpointURL}
|
|
278
|
+
datasource={DS}
|
|
279
|
+
lang={language}
|
|
280
|
+
{clientstylingurl}
|
|
281
|
+
{clientstyling}>
|
|
282
|
+
</casino-filter-page>
|
|
283
|
+
</casino-filter-modal>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
{/if}
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
<style lang="scss">
|
|
290
|
+
* {
|
|
291
|
+
/* Display & Box Model */
|
|
292
|
+
margin: 0;
|
|
293
|
+
padding: 0;
|
|
294
|
+
box-sizing: border-box;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
:host {
|
|
298
|
+
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.CasinoLobby {
|
|
302
|
+
background-color: var(--emfe-w-color-contrast, #07072A);
|
|
303
|
+
width: 100%;
|
|
304
|
+
margin: 0 auto;
|
|
305
|
+
min-height: 100vh;
|
|
306
|
+
/*padding: 0 1em;*/
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.DisplayNone {
|
|
310
|
+
display: none;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.WidgetsSection {
|
|
314
|
+
padding-bottom: 40px;
|
|
315
|
+
}
|
|
316
|
+
</style>
|
package/src/i18n.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dictionary,
|
|
3
|
+
locale,
|
|
4
|
+
addMessages,
|
|
5
|
+
_,
|
|
6
|
+
} from 'svelte-i18n';
|
|
7
|
+
|
|
8
|
+
function setupI18n({ withLocale: _locale, translations }) {
|
|
9
|
+
locale.subscribe((data) => {
|
|
10
|
+
if (data == null) {
|
|
11
|
+
dictionary.set(translations);
|
|
12
|
+
locale.set(_locale);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function addNewMessages(lang, dict) {
|
|
18
|
+
addMessages(lang, dict);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function setLocale(_locale) {
|
|
22
|
+
locale.set(_locale);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { _, setupI18n, addNewMessages, setLocale };
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { html } from 'lit-element';
|
|
2
|
+
|
|
3
|
+
import CasinoLobby from '../src/CasinoLobby';
|
|
4
|
+
|
|
5
|
+
// This default export determines where your story goes in the story list
|
|
6
|
+
export default {
|
|
7
|
+
title: 'CasinoLobby',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// 👇 We create a “template” of how args map to rendering
|
|
11
|
+
const CasinoLobby = ({ aProperty }) => html`<casino-lobby></casino-lobby>`;
|
|
12
|
+
|
|
13
|
+
export const FirstStory = CasinoLobby.bind({});
|