@everymatrix/casino-search 1.0.16 → 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-search.cjs +1 -0
- package/es2015/casino-search.js +16 -0
- package/package.json +16 -33
- package/README.md +0 -30
- package/dist/casino-search.js +0 -16365
- package/dist/casino-search.js.map +0 -1
- package/index.html +0 -100
- package/index.js +0 -1
- package/public/favicon.png +0 -0
- package/public/reset.css +0 -48
- package/rollup.config.js +0 -59
- package/src/CasinoSearch.svelte +0 -441
- package/src/i18n.js +0 -27
- package/src/index.ts +0 -4
- package/src/translations.js +0 -195
- package/stories/CasinoSearch.stories.js +0 -13
- package/tsconfig.json +0 -6
package/index.html
DELETED
|
@@ -1,100 +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>casino-search</title>
|
|
8
|
-
<link rel="stylesheet" href="public/reset.css" />
|
|
9
|
-
<script src="dist/casino-search.js"></script>
|
|
10
|
-
</head>
|
|
11
|
-
|
|
12
|
-
<body>
|
|
13
|
-
<style>
|
|
14
|
-
html,
|
|
15
|
-
body {
|
|
16
|
-
margin: 0;
|
|
17
|
-
padding: 0;
|
|
18
|
-
height: 100%;
|
|
19
|
-
font-family: "Helvetica Neue", "Helvetica", sans-serif;
|
|
20
|
-
}
|
|
21
|
-
.header {
|
|
22
|
-
display: flex;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
align-items: center;
|
|
25
|
-
padding: 10px 20px;
|
|
26
|
-
margin-bottom: 20px;
|
|
27
|
-
background: #252a31;
|
|
28
|
-
box-shadow: 3px 4px 5px 0px rgba(0, 0, 0, 0.2);
|
|
29
|
-
}
|
|
30
|
-
.header__logo svg {
|
|
31
|
-
height: 50px;
|
|
32
|
-
width: 50px;
|
|
33
|
-
margin-right: 5px;
|
|
34
|
-
}
|
|
35
|
-
.header__name {
|
|
36
|
-
color: #fff;
|
|
37
|
-
}
|
|
38
|
-
.header__name span {
|
|
39
|
-
margin-right: 10px;
|
|
40
|
-
font-weight: bold;
|
|
41
|
-
}
|
|
42
|
-
.webcomponent {
|
|
43
|
-
padding: 10px 20px;
|
|
44
|
-
}
|
|
45
|
-
</style>
|
|
46
|
-
<header class="header">
|
|
47
|
-
<div class="header__logo">
|
|
48
|
-
<svg
|
|
49
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
50
|
-
width="161"
|
|
51
|
-
height="132"
|
|
52
|
-
viewBox="0 0 161 132"
|
|
53
|
-
>
|
|
54
|
-
<defs>
|
|
55
|
-
<linearGradient x1="0%" y1="50%" y2="50%" id="a">
|
|
56
|
-
<stop stop-color="#2A3B8F" offset="0%" />
|
|
57
|
-
<stop stop-color="#29ABE2" offset="100%" />
|
|
58
|
-
</linearGradient>
|
|
59
|
-
<linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="c">
|
|
60
|
-
<stop stop-color="#B4D44E" offset="0%" />
|
|
61
|
-
<stop stop-color="#E7F716" offset="100%" />
|
|
62
|
-
</linearGradient>
|
|
63
|
-
</defs>
|
|
64
|
-
<g fill="none" fill-rule="evenodd">
|
|
65
|
-
<path
|
|
66
|
-
fill="#166DA5"
|
|
67
|
-
d="M160.6 65.9l-17.4 29.3-24.4-29.7 24.4-28.9z"
|
|
68
|
-
/>
|
|
69
|
-
<path
|
|
70
|
-
fill="#8FDB69"
|
|
71
|
-
d="M141.3 100.2l-26.5-31.7-15.9 26.6 24.7 36.1z"
|
|
72
|
-
/>
|
|
73
|
-
<path fill="#166DA5" d="M141 31.4l-26.2 31.8-15.9-26.6L123.6.9z" />
|
|
74
|
-
<path
|
|
75
|
-
fill="url(#a)"
|
|
76
|
-
opacity=".95"
|
|
77
|
-
d="M61.1 31.4H141L123.4.7H78.7z M114.8 63.3H159l-15.9-26.8H98.8"
|
|
78
|
-
/>
|
|
79
|
-
<path
|
|
80
|
-
fill="url(#c)"
|
|
81
|
-
opacity=".95"
|
|
82
|
-
d="M141.3 100.3H61l17.6 30.5h45z M114.8 68.4H159l-15.9 26.8H98.8"
|
|
83
|
-
/>
|
|
84
|
-
<path
|
|
85
|
-
fill="#010101"
|
|
86
|
-
d="M78.6 130.8L41 65.8 79.1.8H37.9L.4 65.8l37.5 65z"
|
|
87
|
-
/>
|
|
88
|
-
</g>
|
|
89
|
-
</svg>
|
|
90
|
-
</div>
|
|
91
|
-
<h1 class="header__name"><span>WEBCOMPONENT:</span> casino-search</h1>
|
|
92
|
-
</header>
|
|
93
|
-
|
|
94
|
-
<casino-search
|
|
95
|
-
endpoint="https://demo-api.stage.norway.everymatrix.com/v1"
|
|
96
|
-
datasource="RNG"
|
|
97
|
-
lang="en"
|
|
98
|
-
></casino-search>
|
|
99
|
-
</body>
|
|
100
|
-
</html>
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './dist/casino-search.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,59 +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
|
-
const production = process.env.NODE_ENV === 'production';
|
|
10
|
-
const dev = process.env.NODE_ENV === 'development';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
input: 'src/index.ts',
|
|
14
|
-
output: {
|
|
15
|
-
sourcemap: true,
|
|
16
|
-
format: 'umd',
|
|
17
|
-
name: 'app',
|
|
18
|
-
file: 'dist/casino-search.js'
|
|
19
|
-
},
|
|
20
|
-
plugins: [
|
|
21
|
-
svelte({
|
|
22
|
-
preprocess: sveltePreprocess(),
|
|
23
|
-
compilerOptions: {
|
|
24
|
-
// enable run-time checks when not in production
|
|
25
|
-
customElement: true,
|
|
26
|
-
dev: !production
|
|
27
|
-
}
|
|
28
|
-
}),
|
|
29
|
-
commonjs(),
|
|
30
|
-
resolve({
|
|
31
|
-
browser: true,
|
|
32
|
-
dedupe: ['svelte']
|
|
33
|
-
}),
|
|
34
|
-
dev && serve({
|
|
35
|
-
open: true,
|
|
36
|
-
verbose: true,
|
|
37
|
-
allowCrossOrigin: true,
|
|
38
|
-
historyApiFallback: false,
|
|
39
|
-
host: 'localhost',
|
|
40
|
-
port: 5050,
|
|
41
|
-
}),
|
|
42
|
-
dev && livereload({ watch: ['', 'dist'] }),
|
|
43
|
-
typescript({
|
|
44
|
-
sourceMap: !production,
|
|
45
|
-
inlineSources: !production,
|
|
46
|
-
}),
|
|
47
|
-
// If we're building for production (npm run build
|
|
48
|
-
// instead of npm run dev), minify
|
|
49
|
-
production &&
|
|
50
|
-
terser({
|
|
51
|
-
output: {
|
|
52
|
-
comments: "all"
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
],
|
|
56
|
-
watch: {
|
|
57
|
-
clearScreen: false
|
|
58
|
-
}
|
|
59
|
-
};
|
package/src/CasinoSearch.svelte
DELETED
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
<svelte:options tag={null} />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { _, addNewMessages, setLocale } from './i18n';
|
|
5
|
-
import { Translations } from './translations.js';
|
|
6
|
-
import { getDevice } from 'rvhelper';
|
|
7
|
-
import { onMount } from 'svelte';
|
|
8
|
-
|
|
9
|
-
import '@everymatrix/casino-game-thumbnail';
|
|
10
|
-
|
|
11
|
-
export let endpoint:string = '';
|
|
12
|
-
export let datasource:string = '';
|
|
13
|
-
export let lang:string = 'en';
|
|
14
|
-
export let clientstyling:string = '';
|
|
15
|
-
export let clientstylingurl:string = '';
|
|
16
|
-
export let integratedgameframedesktop:string = 'false';
|
|
17
|
-
export let integratedgameframemobile:string = 'false';
|
|
18
|
-
export let translationUrl:string = '';
|
|
19
|
-
|
|
20
|
-
let userAgent:any = window.navigator.userAgent;
|
|
21
|
-
let searchArray:Array<any> = [];
|
|
22
|
-
let searchedValues:any = [];
|
|
23
|
-
let gamesCache:Object = {};
|
|
24
|
-
|
|
25
|
-
let searchValue:string = '';
|
|
26
|
-
let searchElement:HTMLElement;
|
|
27
|
-
let searchCancelled:boolean = true;
|
|
28
|
-
let searchActive:boolean = false;
|
|
29
|
-
|
|
30
|
-
let isLoading:boolean = false;
|
|
31
|
-
let customStylingContainer:HTMLElement;
|
|
32
|
-
|
|
33
|
-
const setTranslationUrl = ():void => {
|
|
34
|
-
let url:string = translationUrl;
|
|
35
|
-
|
|
36
|
-
fetch(url).then((res:any) => res.json())
|
|
37
|
-
.then((res) => {
|
|
38
|
-
Object.keys(res).forEach((item:any):void => {
|
|
39
|
-
addNewMessages(item, res[item]);
|
|
40
|
-
});
|
|
41
|
-
}).catch((err:any) => {
|
|
42
|
-
console.log(err);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
Object.keys(Translations).forEach((item:any):void => {
|
|
47
|
-
addNewMessages(item, Translations[item]);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const messageHandler = (e:any):void => {
|
|
51
|
-
if (e.data && e.data.type == 'OpenGameFrame') {
|
|
52
|
-
addSearchedItem(e.data.gameId);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const onFocus = ():void => {
|
|
57
|
-
searchCancelled = false;
|
|
58
|
-
searchActive = true;
|
|
59
|
-
|
|
60
|
-
if (endpoint && datasource && lang) {
|
|
61
|
-
if (searchValue.length < 2) {
|
|
62
|
-
let recentSearchedGames = getCookieValue(`searchedGamesWds_casino`);
|
|
63
|
-
let recentSearchedGamesArray:Array<any> = [];
|
|
64
|
-
|
|
65
|
-
if (recentSearchedGames) {
|
|
66
|
-
recentSearchedGamesArray = recentSearchedGames.split(',');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
let promises:Array<Promise<any>> = [];
|
|
70
|
-
let index = 0;
|
|
71
|
-
let length = recentSearchedGamesArray.length;
|
|
72
|
-
|
|
73
|
-
if (length > 0) {
|
|
74
|
-
for (index = 0; index < length; index++) {
|
|
75
|
-
let url:any = new URL(`${endpoint}/casino/games/${recentSearchedGamesArray[index]}`);
|
|
76
|
-
|
|
77
|
-
url.searchParams.append('language', lang);
|
|
78
|
-
url.searchParams.append('datasource', datasource);
|
|
79
|
-
url.searchParams.append('platform', getDevice(userAgent));
|
|
80
|
-
|
|
81
|
-
promises.push(getGame(url, recentSearchedGamesArray[index]));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
Promise.all(promises).then((res:any):void => {
|
|
85
|
-
searchArray = res;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
sendSearchStatus(searchActive);
|
|
91
|
-
|
|
92
|
-
//Analytics event
|
|
93
|
-
if(typeof gtag == 'function'){
|
|
94
|
-
gtag('event', 'SearchInitialized', {
|
|
95
|
-
'context': 'SearchWidget'
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const getGames = (url:URL):Promise<any> => {
|
|
101
|
-
return new Promise((resolve, reject):void => {
|
|
102
|
-
isLoading = true;
|
|
103
|
-
|
|
104
|
-
fetch(url.href)
|
|
105
|
-
.then((res:any) => res.json())
|
|
106
|
-
.then((games:any) => {
|
|
107
|
-
isLoading = false;
|
|
108
|
-
|
|
109
|
-
resolve(games);
|
|
110
|
-
}).catch((err:any) => {
|
|
111
|
-
isLoading = false;
|
|
112
|
-
|
|
113
|
-
console.error(err);
|
|
114
|
-
|
|
115
|
-
reject(err);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const getGame = (url:any, gameId?:string):Promise<any> => {
|
|
121
|
-
return new Promise((resolve, reject) => {
|
|
122
|
-
isLoading = true;
|
|
123
|
-
|
|
124
|
-
if (gameId && Object.keys(gamesCache).indexOf(gameId) >= 0) {
|
|
125
|
-
isLoading = false;
|
|
126
|
-
|
|
127
|
-
resolve(gamesCache[gameId]);
|
|
128
|
-
} else {
|
|
129
|
-
fetch(url)
|
|
130
|
-
.then(fetchRes => fetchRes.json())
|
|
131
|
-
.then(gameData => {
|
|
132
|
-
isLoading = false;
|
|
133
|
-
|
|
134
|
-
gamesCache[gameData[0].gameId] = gameData[0];
|
|
135
|
-
|
|
136
|
-
resolve(gameData[0]);
|
|
137
|
-
}).catch((err:any) => {
|
|
138
|
-
isLoading = false;
|
|
139
|
-
|
|
140
|
-
console.error(err);
|
|
141
|
-
|
|
142
|
-
reject(err);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const addSearchedItem = (gameID:any):void => {
|
|
149
|
-
searchedValues = getCookieValue(`searchedGamesWds_casino`);
|
|
150
|
-
|
|
151
|
-
if (searchedValues) {
|
|
152
|
-
searchedValues = searchedValues.split(',');
|
|
153
|
-
} else {
|
|
154
|
-
searchedValues = [];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (searchedValues.indexOf(gameID) === -1) {
|
|
158
|
-
let value;
|
|
159
|
-
|
|
160
|
-
searchedValues.push(gameID);
|
|
161
|
-
value = searchedValues.join(',');
|
|
162
|
-
document.cookie = `searchedGamesWds_casino=` + value;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const getCookieValue = (name:string):string => {
|
|
167
|
-
let match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
|
|
168
|
-
|
|
169
|
-
if (match) {
|
|
170
|
-
return match[2];
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const cancelSearch = ():void => {
|
|
175
|
-
searchValue = '';
|
|
176
|
-
searchCancelled = true;
|
|
177
|
-
isLoading = false;
|
|
178
|
-
searchArray = [];
|
|
179
|
-
searchActive = false;
|
|
180
|
-
|
|
181
|
-
sendSearchStatus(searchActive);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const clearSearch = ():void => {
|
|
185
|
-
searchValue = '';
|
|
186
|
-
searchElement.focus();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// --- Communication with other widgets
|
|
190
|
-
|
|
191
|
-
const sendSearchStatus = (searchStatus):void => {
|
|
192
|
-
window.postMessage({ type: searchStatus === true ? 'searchActive' : 'searchCancelled', searchStatus});
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const setActiveLanguage = ():void => {
|
|
196
|
-
setLocale(lang);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const setClientStyling = ():void => {
|
|
200
|
-
let sheet = document.createElement('style');
|
|
201
|
-
sheet.innerHTML = clientstyling;
|
|
202
|
-
customStylingContainer.appendChild(sheet);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const setClientStylingURL = ():void => {
|
|
206
|
-
let url:URL = new URL(clientstylingurl);
|
|
207
|
-
let cssFile:HTMLElement = document.createElement('style');
|
|
208
|
-
|
|
209
|
-
fetch(url.href)
|
|
210
|
-
.then((res:any) => res.text())
|
|
211
|
-
.then((data:any) => {
|
|
212
|
-
cssFile.innerHTML = data
|
|
213
|
-
|
|
214
|
-
setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
$: if (searchValue.length >= 2) {
|
|
219
|
-
const searchUrl:URL = new URL(`${endpoint}/casino/games`);
|
|
220
|
-
|
|
221
|
-
searchUrl.searchParams.append("datasource", datasource);
|
|
222
|
-
searchUrl.searchParams.append("expand", "vendor");
|
|
223
|
-
searchUrl.searchParams.append("platform", getDevice(userAgent));
|
|
224
|
-
searchUrl.searchParams.append("language", lang);
|
|
225
|
-
searchUrl.searchParams.append("pagination", "offset=0,limit=30");
|
|
226
|
-
searchUrl.searchParams.append("filter", `name=${searchValue}`);
|
|
227
|
-
|
|
228
|
-
getGames(searchUrl).then((searchData:any) => {
|
|
229
|
-
searchArray = searchData.items.map((item) => item);
|
|
230
|
-
});
|
|
231
|
-
} else {
|
|
232
|
-
if (!searchCancelled) {
|
|
233
|
-
onFocus();
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
onMount(()=> {
|
|
238
|
-
window.addEventListener('message', messageHandler, false);
|
|
239
|
-
|
|
240
|
-
return () => {
|
|
241
|
-
window.removeEventListener('message', messageHandler);
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
$: lang && setActiveLanguage();
|
|
246
|
-
$: translationUrl && setTranslationUrl();
|
|
247
|
-
$: clientstyling && customStylingContainer && setClientStyling();
|
|
248
|
-
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
249
|
-
|
|
250
|
-
</script>
|
|
251
|
-
|
|
252
|
-
<div bind:this={customStylingContainer}>
|
|
253
|
-
<div class="CasinoSearch">
|
|
254
|
-
<div class="Search">
|
|
255
|
-
<div class="SearchIcon">
|
|
256
|
-
<svg width="14" height="15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
257
|
-
<path stroke="#212121" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="m10.48 10.985 2.21 2.373"/>
|
|
258
|
-
<circle cx="6.5" cy="6.5" r="5.75" stroke="#212121" stroke-width="1.5"/>
|
|
259
|
-
</svg>
|
|
260
|
-
</div>
|
|
261
|
-
<div class="SearchContainer">
|
|
262
|
-
<input class="SearchInput" type="search" placeholder="{$_('Translations.placeHolderSearchGames')}" bind:value={searchValue} on:focus={onFocus} bind:this={searchElement}>
|
|
263
|
-
<span on:click={() => clearSearch()} class="SearchClearButton { searchValue.length != 0 ? '' : 'NotVisible'}">
|
|
264
|
-
<svg width="11" height="11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
265
|
-
<path d="m1.45 1.5 8.1 8M1.45 9.5l8.1-8" stroke="#717171" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
266
|
-
</svg>
|
|
267
|
-
</span>
|
|
268
|
-
</div>
|
|
269
|
-
<small on:click={() => cancelSearch()} class="SearchCancelButton {searchCancelled ? 'NotVisible' : ''}">
|
|
270
|
-
{$_('Translations.cancel')}
|
|
271
|
-
</small>
|
|
272
|
-
</div>
|
|
273
|
-
{#if isLoading}
|
|
274
|
-
<p>{$_('Translations.loading')}</p>
|
|
275
|
-
{:else}
|
|
276
|
-
{#if searchActive == true && searchValue.length < 2}
|
|
277
|
-
<p class="SearchMessage">{$_('Translations.recentSearch')}</p>
|
|
278
|
-
{#if searchArray.length == 0}
|
|
279
|
-
<div class="ResultsContainerError">
|
|
280
|
-
<p class="SearchMessage">{$_('Translations.noRecentSearches')}</p>
|
|
281
|
-
</div>
|
|
282
|
-
{/if}
|
|
283
|
-
{:else if searchArray.length != 0}
|
|
284
|
-
<p class="SearchMessage">{$_('Translations.searchResult')}</p>
|
|
285
|
-
{/if}
|
|
286
|
-
<div class="SearchResultsContainer {searchActive == true ? '': 'NotVisible'}">
|
|
287
|
-
{#if searchCancelled === false}
|
|
288
|
-
{#each searchArray as game}
|
|
289
|
-
<casino-game-thumbnail
|
|
290
|
-
lang={lang}
|
|
291
|
-
gamethumbnail={game.thumbnail}
|
|
292
|
-
gamename={game.name}
|
|
293
|
-
gamevendor={game.vendor.name}
|
|
294
|
-
gameisnew={game.isNew}
|
|
295
|
-
gamepopularity={game.popularity}
|
|
296
|
-
gamecellsize={game.cellSize}
|
|
297
|
-
gameid={game.id}
|
|
298
|
-
gamefunmode={game.hasFunMode}
|
|
299
|
-
gamefavorite={game.isFavorite}
|
|
300
|
-
livelobbyendpoint={game.details ? game.launchUrl : ''}
|
|
301
|
-
endpoint={endpoint}
|
|
302
|
-
{integratedgameframedesktop}
|
|
303
|
-
{integratedgameframemobile}
|
|
304
|
-
{clientstyling}
|
|
305
|
-
{clientstylingurl}
|
|
306
|
-
></casino-game-thumbnail>
|
|
307
|
-
{/each}
|
|
308
|
-
{/if}
|
|
309
|
-
{#if searchValue.length >= 2 && searchArray.length == 0}
|
|
310
|
-
<div class="ResultsContainerError">
|
|
311
|
-
<p class="SearchMessage">{$_('Translations.notFound')}</p>
|
|
312
|
-
<p>{$_('Translations.notFoundText')}</p>
|
|
313
|
-
</div>
|
|
314
|
-
{/if}
|
|
315
|
-
</div>
|
|
316
|
-
{/if}
|
|
317
|
-
</div>
|
|
318
|
-
</div>
|
|
319
|
-
|
|
320
|
-
<style lang="scss">
|
|
321
|
-
:host {
|
|
322
|
-
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
$color-grey: #717171;
|
|
326
|
-
$color-light-grey: #cacaca;
|
|
327
|
-
$color-black: #212121;
|
|
328
|
-
|
|
329
|
-
$grid-gap: 8px;
|
|
330
|
-
$grid-cell-size: 167px;
|
|
331
|
-
$grid-cell-size-small: 110px;
|
|
332
|
-
$grid-cell-size-medium: 122px;
|
|
333
|
-
|
|
334
|
-
*,
|
|
335
|
-
*::before,
|
|
336
|
-
*::after {
|
|
337
|
-
margin: 0;
|
|
338
|
-
padding: 0;
|
|
339
|
-
box-sizing: border-box;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.CasinoSearch {
|
|
343
|
-
margin: 16px;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.Search {
|
|
347
|
-
display: flex;
|
|
348
|
-
align-items: center;
|
|
349
|
-
position: relative;
|
|
350
|
-
justify-content: space-between;
|
|
351
|
-
margin-bottom: 20px;
|
|
352
|
-
|
|
353
|
-
&Icon{
|
|
354
|
-
position: absolute;
|
|
355
|
-
left: 5%;
|
|
356
|
-
z-index: 1;
|
|
357
|
-
|
|
358
|
-
svg {
|
|
359
|
-
height: 14px;
|
|
360
|
-
width: 13px;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
&Container {
|
|
364
|
-
width: 100%;
|
|
365
|
-
position: relative;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
&Input {
|
|
369
|
-
border-radius: 4px;
|
|
370
|
-
border: 1px solid $color-light-grey;
|
|
371
|
-
color: $color-grey;
|
|
372
|
-
display: block;
|
|
373
|
-
font-size: 16px;
|
|
374
|
-
font-weight: 300;
|
|
375
|
-
padding: 14px 5px 14px 46px;
|
|
376
|
-
width:100%;
|
|
377
|
-
|
|
378
|
-
&::placeholder {
|
|
379
|
-
color: $color-grey;
|
|
380
|
-
font-size: 16px;
|
|
381
|
-
font-weight: 300;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
&:focus {
|
|
385
|
-
outline: 1px solid #d9d7d7;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
&::-webkit-search-decoration,
|
|
389
|
-
&::-webkit-search-cancel-button,
|
|
390
|
-
&::-webkit-search-results-button,
|
|
391
|
-
&::-webkit-search-results-decoration {
|
|
392
|
-
-webkit-appearance:none;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
&ClearButton{
|
|
397
|
-
position: absolute;
|
|
398
|
-
top: 30%;
|
|
399
|
-
right: 15px;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
&CancelButton {
|
|
403
|
-
color: $color-grey;
|
|
404
|
-
font-weight: 300;
|
|
405
|
-
margin-left: 8px;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
&Message {
|
|
409
|
-
font-size: 18px;
|
|
410
|
-
font-weight: 600;
|
|
411
|
-
margin: 24px 0;
|
|
412
|
-
color: $color-black;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
&ResultsContainer {
|
|
416
|
-
display: grid;
|
|
417
|
-
gap: $grid-gap;
|
|
418
|
-
grid-template-columns: repeat(auto-fill, minmax(Min($grid-cell-size, 46%), 1fr));
|
|
419
|
-
grid-template-rows: repeat(auto-fill, $grid-cell-size);
|
|
420
|
-
grid-auto-rows: $grid-cell-size;
|
|
421
|
-
grid-auto-columns: $grid-cell-size;
|
|
422
|
-
grid-auto-flow: row dense;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
.ResultsContainerError {
|
|
427
|
-
text-align: center;
|
|
428
|
-
width: 300px;
|
|
429
|
-
color: $color-grey;
|
|
430
|
-
font-weight: 300;
|
|
431
|
-
position: absolute;
|
|
432
|
-
top: 50%;
|
|
433
|
-
left: 50%;
|
|
434
|
-
transform: translate(-50%, -50%);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
.NotVisible {
|
|
438
|
-
display: none;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
</style>
|
package/src/i18n.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}); // maybe we will need this to make sure that the i18n is set up only once
|
|
15
|
-
/*dictionary.set(translations);
|
|
16
|
-
locale.set(_locale);*/
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function addNewMessages(lang, dict) {
|
|
20
|
-
addMessages(lang, dict);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function setLocale(_locale) {
|
|
24
|
-
locale.set(_locale);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { _, setupI18n, addNewMessages, setLocale };
|
package/src/index.ts
DELETED