@everymatrix/casino-categories-slider 1.0.15 → 1.0.69
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/es2015/casino-categories-slider.cjs +1 -0
- package/es2015/casino-categories-slider.js +16 -0
- package/package.json +16 -33
- package/README.md +0 -30
- package/dist/casino-categories-slider.js +0 -2
- package/dist/casino-categories-slider.js.map +0 -1
- package/index.html +0 -39
- package/index.js +0 -1
- package/public/favicon.png +0 -0
- package/public/reset.css +0 -48
- package/rollup.config.js +0 -67
- package/src/CasinoCategoriesSlider.svelte +0 -416
- package/src/CasinoCategoriesSlider.types.ts +0 -34
- package/src/index.ts +0 -4
- package/stories/CasinoCategoriesSlider.stories.js +0 -13
- package/tsconfig.json +0 -6
package/index.html
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset='utf-8'>
|
|
5
|
-
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
|
6
|
-
|
|
7
|
-
<title>
|
|
8
|
-
casino-categories-slider
|
|
9
|
-
</title>
|
|
10
|
-
<link rel="stylesheet" href="public/reset.css">
|
|
11
|
-
<script src='dist/casino-categories-slider.js'></script>
|
|
12
|
-
</head>
|
|
13
|
-
|
|
14
|
-
<body>
|
|
15
|
-
<style>
|
|
16
|
-
html,body { margin: 0; padding: 0; height: 100%; font-family: "Helvetica Neue", "Helvetica", sans-serif; }
|
|
17
|
-
.header { display: flex; justify-content: center; align-items: center; padding: 10px 20px; margin-bottom: 20px; background: #42a3e2; box-shadow: 3px 4px 5px 0px rgba(0,0,0, .2); }
|
|
18
|
-
.header__logo svg { height: 50px; width: 50px; margin-right: 5px; }
|
|
19
|
-
.header__name { color: #fff; }
|
|
20
|
-
.header__name span { margin-right: 10px; font-weight: bold; }
|
|
21
|
-
.webcomponent { padding: 10px 20px; }
|
|
22
|
-
</style>
|
|
23
|
-
<header class="header">
|
|
24
|
-
<div class="header__logo">
|
|
25
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="161" height="132" viewBox="0 0 161 132"><defs><linearGradient x1="0%" y1="50%" y2="50%" id="a"><stop stop-color="#2A3B8F" offset="0%"/><stop stop-color="#29ABE2" offset="100%"/></linearGradient><linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="c"><stop stop-color="#B4D44E" offset="0%"/><stop stop-color="#E7F716" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path fill="#166DA5" d="M160.6 65.9l-17.4 29.3-24.4-29.7 24.4-28.9z"/><path fill="#8FDB69" d="M141.3 100.2l-26.5-31.7-15.9 26.6 24.7 36.1z"/><path fill="#166DA5" d="M141 31.4l-26.2 31.8-15.9-26.6L123.6.9z"/><path fill="url(#a)" opacity=".95" d="M61.1 31.4H141L123.4.7H78.7z M114.8 63.3H159l-15.9-26.8H98.8"/><path fill="url(#c)" opacity=".95" d="M141.3 100.3H61l17.6 30.5h45z M114.8 68.4H159l-15.9 26.8H98.8"/><path fill="#010101" d="M78.6 130.8L41 65.8 79.1.8H37.9L.4 65.8l37.5 65z"/></g></svg>
|
|
26
|
-
</div>
|
|
27
|
-
<h1 class="header__name">
|
|
28
|
-
<span>WEBCOMPONENT:</span> casino-categories-slider
|
|
29
|
-
</h1>
|
|
30
|
-
</header>
|
|
31
|
-
|
|
32
|
-
<div class="webcomponent">
|
|
33
|
-
<casino-categories-slider endpoint="https://demo-api.stage.norway.everymatrix.com/v1" datasource="RNG" lang="en">
|
|
34
|
-
</casino-categories-slider>
|
|
35
|
-
</casino-categories-slider>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
</body>
|
|
39
|
-
</html>
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './dist/casino-categories-slider.js';
|
package/public/favicon.png
DELETED
|
Binary file
|
package/public/reset.css
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* http://meyerweb.com/eric/tools/css/reset/
|
|
2
|
-
v2.0 | 20110126
|
|
3
|
-
License: none (public domain)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
html, body, div, span, applet, object, iframe,
|
|
7
|
-
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
|
8
|
-
a, abbr, acronym, address, big, cite, code,
|
|
9
|
-
del, dfn, em, img, ins, kbd, q, s, samp,
|
|
10
|
-
small, strike, strong, sub, sup, tt, var,
|
|
11
|
-
b, u, i, center,
|
|
12
|
-
dl, dt, dd, ol, ul, li,
|
|
13
|
-
fieldset, form, label, legend,
|
|
14
|
-
table, caption, tbody, tfoot, thead, tr, th, td,
|
|
15
|
-
article, aside, canvas, details, embed,
|
|
16
|
-
figure, figcaption, footer, header, hgroup,
|
|
17
|
-
menu, nav, output, ruby, section, summary,
|
|
18
|
-
time, mark, audio, video {
|
|
19
|
-
margin: 0;
|
|
20
|
-
padding: 0;
|
|
21
|
-
border: 0;
|
|
22
|
-
font-size: 100%;
|
|
23
|
-
font: inherit;
|
|
24
|
-
vertical-align: baseline;
|
|
25
|
-
}
|
|
26
|
-
/* HTML5 display-role reset for older browsers */
|
|
27
|
-
article, aside, details, figcaption, figure,
|
|
28
|
-
footer, header, hgroup, menu, nav, section {
|
|
29
|
-
display: block;
|
|
30
|
-
}
|
|
31
|
-
body {
|
|
32
|
-
line-height: 1;
|
|
33
|
-
}
|
|
34
|
-
ol, ul {
|
|
35
|
-
list-style: none;
|
|
36
|
-
}
|
|
37
|
-
blockquote, q {
|
|
38
|
-
quotes: none;
|
|
39
|
-
}
|
|
40
|
-
blockquote:before, blockquote:after,
|
|
41
|
-
q:before, q:after {
|
|
42
|
-
content: '';
|
|
43
|
-
content: none;
|
|
44
|
-
}
|
|
45
|
-
table {
|
|
46
|
-
border-collapse: collapse;
|
|
47
|
-
border-spacing: 0;
|
|
48
|
-
}
|
package/rollup.config.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import svelte from 'rollup-plugin-svelte';
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
4
|
-
import serve from 'rollup-plugin-dev-server';
|
|
5
|
-
import livereload from 'rollup-plugin-livereload';
|
|
6
|
-
import { terser } from 'rollup-plugin-terser';
|
|
7
|
-
import sveltePreprocess from 'svelte-preprocess';
|
|
8
|
-
import typescript from '@rollup/plugin-typescript';
|
|
9
|
-
import uglify from 'rollup-plugin-uglify';
|
|
10
|
-
import image from '@rollup/plugin-image';
|
|
11
|
-
|
|
12
|
-
const production = process.env.NODE_ENV == 'production';
|
|
13
|
-
const dev = process.env.NODE_ENV == 'development';
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
input: 'src/index.ts',
|
|
17
|
-
output: {
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
format: 'umd',
|
|
20
|
-
name: 'app',
|
|
21
|
-
file: 'dist/casino-categories-slider.js',
|
|
22
|
-
},
|
|
23
|
-
plugins: [
|
|
24
|
-
svelte({
|
|
25
|
-
preprocess: sveltePreprocess(),
|
|
26
|
-
compilerOptions: {
|
|
27
|
-
// @TODO check generate and hydratable
|
|
28
|
-
// generate: 'ssr',
|
|
29
|
-
// hydratable: true,
|
|
30
|
-
// enable run-time checks when not in production
|
|
31
|
-
customElement: true,
|
|
32
|
-
dev: !production
|
|
33
|
-
}
|
|
34
|
-
}),
|
|
35
|
-
image(),
|
|
36
|
-
commonjs(),
|
|
37
|
-
resolve({
|
|
38
|
-
browser: true,
|
|
39
|
-
dedupe: ['svelte']
|
|
40
|
-
}),
|
|
41
|
-
dev && serve({
|
|
42
|
-
open: true,
|
|
43
|
-
verbose: true,
|
|
44
|
-
allowCrossOrigin: true,
|
|
45
|
-
historyApiFallback: false,
|
|
46
|
-
host: 'localhost',
|
|
47
|
-
port: 5050,
|
|
48
|
-
}),
|
|
49
|
-
dev && livereload({ watch: ['', 'dist'] }),
|
|
50
|
-
typescript({
|
|
51
|
-
sourceMap: !production,
|
|
52
|
-
inlineSources: !production,
|
|
53
|
-
}),
|
|
54
|
-
// If we're building for production (npm run build
|
|
55
|
-
// instead of npm run dev), minify
|
|
56
|
-
production &&
|
|
57
|
-
terser({
|
|
58
|
-
output: {
|
|
59
|
-
comments: "all"
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
production && uglify.uglify()
|
|
63
|
-
],
|
|
64
|
-
watch: {
|
|
65
|
-
clearScreen: false
|
|
66
|
-
}
|
|
67
|
-
};
|
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
<svelte:options tag={null} />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { onMount, tick } from "svelte";
|
|
5
|
-
import { getDevice, checkSession, platformFavorite } from 'rvhelper';
|
|
6
|
-
|
|
7
|
-
import type { CategoriesData, CategoriesItems } from './CasinoCategoriesSlider.types';
|
|
8
|
-
import '@everymatrix/casino-slider';
|
|
9
|
-
|
|
10
|
-
export let endpoint:string = '';
|
|
11
|
-
export let datasource:string = '';
|
|
12
|
-
export let lang:string = ''; // Language
|
|
13
|
-
export let userid:string = '';
|
|
14
|
-
export let session:string = ''; // Value for sessionID
|
|
15
|
-
export let mostplayed:string = ''; // True - add MostPlayed category in slider
|
|
16
|
-
export let mostplayedrounds:string = '';
|
|
17
|
-
export let lastplayed:string = 'false'; // True - add LastPlayed category in slider
|
|
18
|
-
export let lastplayedperiod:string = ''; // The period of the query (Last30Days|Last7Days|Yesterday|Today)
|
|
19
|
-
export let favorites:string = ''; // True - add Favorites category in slider
|
|
20
|
-
export let clientstyling:string = '';
|
|
21
|
-
export let clientstylingurl:string = '';
|
|
22
|
-
export let containermaxwidth:string = '';
|
|
23
|
-
export let activecategory:string = '';
|
|
24
|
-
export let actionevent:string = '';
|
|
25
|
-
export let sessioncheck:string = '';
|
|
26
|
-
export let location:string = "secondaryMenu";
|
|
27
|
-
export let showsubgroups:string = 'false';
|
|
28
|
-
export let filteredcategories:string = '';
|
|
29
|
-
|
|
30
|
-
let identity:string = 'CasinoSliderData'
|
|
31
|
-
|
|
32
|
-
// Player logged-in/logged-out status & session
|
|
33
|
-
let sessionID:string = '';
|
|
34
|
-
let isLoggedIn:boolean = false;
|
|
35
|
-
let playerID:string = '';
|
|
36
|
-
let activeIndex:number = 0;
|
|
37
|
-
let deviceSegregationValue:string = '';
|
|
38
|
-
|
|
39
|
-
let isLoading:boolean = true;
|
|
40
|
-
let error:string;
|
|
41
|
-
|
|
42
|
-
let categories:Array<CategoriesItems> = [];
|
|
43
|
-
let hasErrors:boolean = false;
|
|
44
|
-
let userAgent = window.navigator.userAgent;
|
|
45
|
-
let favoritesTitle:HTMLElement;
|
|
46
|
-
let customStylingContainer:HTMLElement;
|
|
47
|
-
let reworkedFavoriteGamesCollection:any = {
|
|
48
|
-
items: []
|
|
49
|
-
};
|
|
50
|
-
let numberOfFavoredGames:number;
|
|
51
|
-
let favoritesAdded:boolean = false;
|
|
52
|
-
let mostPlayedAdded:boolean = false;
|
|
53
|
-
let lastPlayedAdded:boolean = false;
|
|
54
|
-
let favoritesLoaded:boolean = false;
|
|
55
|
-
let mostPlayedLoaded:boolean = false;
|
|
56
|
-
let lastPlayedLoaded:boolean = false;
|
|
57
|
-
let categoriesLoaded:boolean = false;
|
|
58
|
-
let isLoadingMostPlayed:boolean = false;
|
|
59
|
-
let isLoadingLastPlayed:boolean = false;
|
|
60
|
-
let confirmCategoryParse:boolean = false;
|
|
61
|
-
|
|
62
|
-
$: numberOfFavoredGames = 0;
|
|
63
|
-
|
|
64
|
-
const messageHandler = (e:any):void => {
|
|
65
|
-
if (e.data) {
|
|
66
|
-
switch(e.data.type) {
|
|
67
|
-
case 'UpdateCategoryFavoriteGames':
|
|
68
|
-
case 'ShowFavoriteSection':
|
|
69
|
-
let platformSpecificFavoriteGames:any = {};
|
|
70
|
-
platformSpecificFavoriteGames = platformFavorite(e.data.receivedFavoriteResults.items, numberOfFavoredGames);
|
|
71
|
-
numberOfFavoredGames = platformSpecificFavoriteGames.length;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const getMostPlayedGames = ():Promise<boolean> => {
|
|
78
|
-
if (mostplayed) {
|
|
79
|
-
let url:URL = new URL(`${endpoint}/player/${userid}/games/most-played`);
|
|
80
|
-
|
|
81
|
-
let device = getDevice(userAgent);
|
|
82
|
-
|
|
83
|
-
if (device) {
|
|
84
|
-
if (device === 'PC') {
|
|
85
|
-
url.searchParams.append('device', 'Desktop');
|
|
86
|
-
} else {
|
|
87
|
-
url.searchParams.append('device', 'Mobile');
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
url.searchParams.append('device', 'All');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
url.searchParams.append('rounds', mostplayedrounds);
|
|
94
|
-
|
|
95
|
-
return new Promise((resolve, reject) => {
|
|
96
|
-
fetch(url.href)
|
|
97
|
-
.then((res:any) => res.json())
|
|
98
|
-
.then((data:any) => {
|
|
99
|
-
if (data.count == 0) {
|
|
100
|
-
resolve(false);
|
|
101
|
-
}
|
|
102
|
-
resolve(true);
|
|
103
|
-
}).catch((err:any) => {
|
|
104
|
-
console.error('err', err);
|
|
105
|
-
reject(false);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const getLastPlayedGames = ():Promise<any> => {
|
|
112
|
-
return new Promise((resolve, reject) => {
|
|
113
|
-
if (lastplayed) {
|
|
114
|
-
let url:URL = new URL(`${endpoint}/player/${userid}/games/last-played`);
|
|
115
|
-
|
|
116
|
-
let device = getDevice(userAgent);
|
|
117
|
-
|
|
118
|
-
if (device) {
|
|
119
|
-
if (device === 'PC') {
|
|
120
|
-
url.searchParams.append('device', 'Desktop');
|
|
121
|
-
} else {
|
|
122
|
-
url.searchParams.append('device', 'Mobile');
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
url.searchParams.append('device', 'All');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
url.searchParams.append('period', lastplayedperiod);
|
|
129
|
-
|
|
130
|
-
fetch(url.href)
|
|
131
|
-
.then((res:any) => res.json())
|
|
132
|
-
.then((data:any) => {
|
|
133
|
-
if (data.count == 0) {
|
|
134
|
-
resolve(false);
|
|
135
|
-
}
|
|
136
|
-
resolve(data);
|
|
137
|
-
}).catch((err:any) => {
|
|
138
|
-
console.error('err', err);
|
|
139
|
-
reject(false);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const addFavoritesCategory = ():void => {
|
|
146
|
-
if (favoritesAdded == false && favorites == 'true') {
|
|
147
|
-
categories.splice(1, 0, {
|
|
148
|
-
// @ts-ignore
|
|
149
|
-
id: 'FAVORITES',
|
|
150
|
-
name: 'Favorites',
|
|
151
|
-
href: '',
|
|
152
|
-
games: [],
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
favoritesAdded = true;
|
|
157
|
-
favoritesLoaded = true;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const addMostPlayedCategory = ():void => {
|
|
161
|
-
if (mostplayed) {
|
|
162
|
-
isLoadingMostPlayed = true;
|
|
163
|
-
|
|
164
|
-
getMostPlayedGames().then((display:boolean) => {
|
|
165
|
-
if (mostPlayedAdded == false && mostplayed == 'true' && display) {
|
|
166
|
-
categories.splice(2, 0, {
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
id: 'MOSTPLAYED',
|
|
169
|
-
name: 'Most Played',
|
|
170
|
-
href: '',
|
|
171
|
-
games: [],
|
|
172
|
-
triggerFetch: false
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
isLoadingMostPlayed = false;
|
|
177
|
-
tick();
|
|
178
|
-
|
|
179
|
-
mostPlayedAdded = true;
|
|
180
|
-
mostPlayedLoaded = true;
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
confirmCategoryParse = true;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const addLastPlayedCategory = ():void => {
|
|
187
|
-
if (lastplayed == 'true') {
|
|
188
|
-
isLoadingLastPlayed = true;
|
|
189
|
-
|
|
190
|
-
getLastPlayedGames().then((display:boolean) => {
|
|
191
|
-
if (lastPlayedAdded == false && lastplayed == 'true' && display) {
|
|
192
|
-
categories.splice(3, 0, {
|
|
193
|
-
// @ts-ignore
|
|
194
|
-
id: 'LASTPLAYED',
|
|
195
|
-
name: 'Last Played',
|
|
196
|
-
href: '',
|
|
197
|
-
games: [],
|
|
198
|
-
triggerFetch: false
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
isLoadingLastPlayed = false;
|
|
203
|
-
tick();
|
|
204
|
-
|
|
205
|
-
lastPlayedAdded = true;
|
|
206
|
-
lastPlayedLoaded = true;
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
confirmCategoryParse = true;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const checkAttrs = ():boolean => {
|
|
213
|
-
if (!endpoint) {
|
|
214
|
-
error = "Endpoint is missing! Please provide a valid endpointURL.";
|
|
215
|
-
hasErrors = true;
|
|
216
|
-
isLoading = false;
|
|
217
|
-
|
|
218
|
-
console.error(error);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (!datasource) {
|
|
222
|
-
error = "Datasource is missing! Please provide a valid datasource.";
|
|
223
|
-
hasErrors = true;
|
|
224
|
-
isLoading = false;
|
|
225
|
-
|
|
226
|
-
console.error(error);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (!lang || lang.length < 2) {
|
|
230
|
-
error = "Language is missing! Please provide a valid language (alpha2code)";
|
|
231
|
-
hasErrors = true;
|
|
232
|
-
isLoading = false;
|
|
233
|
-
|
|
234
|
-
console.error(error);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return hasErrors;
|
|
238
|
-
}
|
|
239
|
-
const setDevice = ():void => {
|
|
240
|
-
let device = getDevice(userAgent)
|
|
241
|
-
|
|
242
|
-
if(device){
|
|
243
|
-
if(device === 'PC'){
|
|
244
|
-
deviceSegregationValue = 'dk';
|
|
245
|
-
} else if(device === 'iPad' || device === 'iPhone') {
|
|
246
|
-
deviceSegregationValue = 'ios';
|
|
247
|
-
} else {
|
|
248
|
-
deviceSegregationValue = 'mtWeb';
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const initialLoad = ():void => {
|
|
255
|
-
setDevice();
|
|
256
|
-
|
|
257
|
-
if (!checkAttrs()) {
|
|
258
|
-
let url:any = new URL(`${endpoint}/casino/groups/${datasource}`);
|
|
259
|
-
|
|
260
|
-
url.searchParams.append('datasource', datasource);
|
|
261
|
-
url.searchParams.append('language', lang);
|
|
262
|
-
url.searchParams.append('device', deviceSegregationValue);
|
|
263
|
-
|
|
264
|
-
fetch(url)
|
|
265
|
-
.then((res:any) => res.json())
|
|
266
|
-
.then((data:CategoriesData) => {
|
|
267
|
-
//create an array of filtered categories
|
|
268
|
-
let arrayFilteredCategories = filteredcategories.split(',');
|
|
269
|
-
// filter type added to type
|
|
270
|
-
let arr = data.items.filter((item:any) => {
|
|
271
|
-
let filtered;
|
|
272
|
-
if( item.games.total > 0) {
|
|
273
|
-
filtered = true;
|
|
274
|
-
//exclude filtered categories
|
|
275
|
-
if( filteredcategories ){
|
|
276
|
-
for (let element of arrayFilteredCategories){
|
|
277
|
-
if( item.flags == element ) filtered = false;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
return filtered;
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
categories = [];
|
|
285
|
-
categories = categories.concat(arr);
|
|
286
|
-
|
|
287
|
-
// @TODO Translation for lobby
|
|
288
|
-
categories.unshift({
|
|
289
|
-
// @ts-ignore
|
|
290
|
-
id: 'LOBBY',
|
|
291
|
-
name: 'Lobby',
|
|
292
|
-
href: '',
|
|
293
|
-
games: [],
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
isLoading = false;
|
|
297
|
-
|
|
298
|
-
window.postMessage({ type: 'CategoriesLoadedForSlider' }, window.location.href);
|
|
299
|
-
}, (err:any) => {
|
|
300
|
-
hasErrors = true;
|
|
301
|
-
console.error('There was an error while fetching the categories', err);
|
|
302
|
-
}).catch((err:any) => {
|
|
303
|
-
hasErrors = true;
|
|
304
|
-
console.error('There was an error while fetching the categories', err);
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const setActiveCategory = ():void => {
|
|
310
|
-
let checkIfSubcategory = activecategory.split('$');
|
|
311
|
-
activecategory = (checkIfSubcategory.length > 2) ? activecategory.split('$').slice(0, 2).join('$') : activecategory;
|
|
312
|
-
activeIndex = categories.map((item) => item.id).indexOf(decodeURI(activecategory));
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const setSession = ():void => {
|
|
316
|
-
if (sessioncheck == 'true') {
|
|
317
|
-
checkSession(endpoint, session).then((res:any) => {
|
|
318
|
-
sessionID = res.Guid;
|
|
319
|
-
playerID = res.UserID;
|
|
320
|
-
isLoggedIn = true;
|
|
321
|
-
}, (err:any) => {
|
|
322
|
-
isLoggedIn = false;
|
|
323
|
-
console.error('err on session', err);
|
|
324
|
-
});
|
|
325
|
-
} else {
|
|
326
|
-
sessionID = session;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const setClientStyling = ():void => {
|
|
331
|
-
let sheet = document.createElement('style');
|
|
332
|
-
sheet.innerHTML = clientstyling;
|
|
333
|
-
customStylingContainer.appendChild(sheet);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
const setClientStylingURL = ():void => {
|
|
337
|
-
let cssFile:HTMLElement = document.createElement('style');
|
|
338
|
-
|
|
339
|
-
let url = new URL(clientstylingurl);
|
|
340
|
-
|
|
341
|
-
fetch(url.href)
|
|
342
|
-
.then((res:any) => res.text())
|
|
343
|
-
.then((data:any) => {
|
|
344
|
-
cssFile.innerHTML = data
|
|
345
|
-
|
|
346
|
-
setTimeout(() => { customStylingContainer.appendChild(cssFile); }, 1);
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const sendSliderData = (sliderData:any):void => {
|
|
351
|
-
window.postMessage({ type: 'SliderData', identity, data: categories }, window.location.href);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
onMount(() => {
|
|
355
|
-
window.addEventListener('message', messageHandler, false);
|
|
356
|
-
|
|
357
|
-
return () => {
|
|
358
|
-
window.removeEventListener('message', messageHandler);
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
$: endpoint && datasource && lang && initialLoad();
|
|
363
|
-
$: session && endpoint && setSession();
|
|
364
|
-
$: session && favorites && !isLoading && addFavoritesCategory();
|
|
365
|
-
$: session && endpoint && !isLoading && lastplayed && addLastPlayedCategory();
|
|
366
|
-
$: session && endpoint && !isLoading && userid && mostplayed && addMostPlayedCategory();
|
|
367
|
-
$: !isLoading && activecategory && (session ? confirmCategoryParse : true) && setActiveCategory();
|
|
368
|
-
$: clientstyling && customStylingContainer && setClientStyling();
|
|
369
|
-
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
370
|
-
</script>
|
|
371
|
-
|
|
372
|
-
<div bind:this={customStylingContainer} part="CustomStylingContainer">
|
|
373
|
-
{#if isLoading || isLoadingMostPlayed || isLoadingLastPlayed}
|
|
374
|
-
<div class="CasinoCategoriesLoading" part="CasinoCategoriesLoading"></div>
|
|
375
|
-
{:else}
|
|
376
|
-
{#if hasErrors}
|
|
377
|
-
<p class="SearchLoading" part="SearchLoading">500 Error - Internal Server Error.</p>
|
|
378
|
-
{:else}
|
|
379
|
-
<div class="CasinoCategoriesContainer" part="CasinoCategoriesContainer">
|
|
380
|
-
<casino-slider
|
|
381
|
-
{lang}
|
|
382
|
-
{datasource}
|
|
383
|
-
{endpoint}
|
|
384
|
-
{identity}
|
|
385
|
-
favoritesnumber={numberOfFavoredGames}
|
|
386
|
-
use:sendSliderData
|
|
387
|
-
{showsubgroups}
|
|
388
|
-
{clientstyling}
|
|
389
|
-
{clientstylingurl}
|
|
390
|
-
{containermaxwidth}
|
|
391
|
-
activeindex={activeIndex}
|
|
392
|
-
{actionevent}
|
|
393
|
-
{location}/>
|
|
394
|
-
</div>
|
|
395
|
-
{/if}
|
|
396
|
-
{/if}
|
|
397
|
-
</div>
|
|
398
|
-
|
|
399
|
-
<style>
|
|
400
|
-
:host {
|
|
401
|
-
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.CasinoCategoriesLoading {
|
|
405
|
-
height: 52px;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
p {
|
|
409
|
-
color: var(--emfe-w-color-white, #FFFFFF);
|
|
410
|
-
text-align: center;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
.CasinoCategoriesContainer {
|
|
414
|
-
background: var(--emfe-w-color-black, #000000);
|
|
415
|
-
}
|
|
416
|
-
</style>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface CategoriesData {
|
|
2
|
-
count: number,
|
|
3
|
-
items: Array<CategoriesItems>,
|
|
4
|
-
pages: CategoriesPages,
|
|
5
|
-
total: number,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface CategoriesItems {
|
|
9
|
-
id: number,
|
|
10
|
-
name: String,
|
|
11
|
-
href: String,
|
|
12
|
-
games: Array<GamesItem>
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
interface GamesItem {
|
|
16
|
-
count: number,
|
|
17
|
-
items: Array<Object>,
|
|
18
|
-
pages: PagesItem,
|
|
19
|
-
total: number
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface PagesItem {
|
|
23
|
-
first: String,
|
|
24
|
-
last: String,
|
|
25
|
-
next: String,
|
|
26
|
-
previous: String
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface CategoriesPages {
|
|
30
|
-
first: String,
|
|
31
|
-
last: String,
|
|
32
|
-
next: String,
|
|
33
|
-
previous: String,
|
|
34
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-element';
|
|
2
|
-
|
|
3
|
-
import CasinoCategoriesSlider from '../src/CasinoCategoriesSlider';
|
|
4
|
-
|
|
5
|
-
// This default export determines where your story goes in the story list
|
|
6
|
-
export default {
|
|
7
|
-
title: 'CasinoCategoriesSlider',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
// 👇 We create a “template” of how args map to rendering
|
|
11
|
-
const CasinoCategoriesSlider = ({ aProperty }) => html`<casino-categories-slider></casino-categories-slider>`;
|
|
12
|
-
|
|
13
|
-
export const FirstStory = CasinoCategoriesSlider.bind({});
|